@mappedin/maplibre-overlay 6.0.1-beta.54 → 6.0.1-beta.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/{GLTFExporter-CVG4TSMU.js → GLTFExporter-R6F7IFS2.js} +1 -1
- package/lib/esm/{GLTFLoader-N7FATKQH.js → GLTFLoader-NEDVOJZ7.js} +1 -1
- package/lib/esm/{chunk-MSQIQNNK.js → chunk-BJJSORNB.js} +1 -1
- package/lib/esm/{chunk-MY2QYVOC.js → chunk-FWRW5PDC.js} +1 -1
- package/lib/esm/chunk-JL7KYJFU.js +1 -0
- package/lib/esm/{chunk-DZU6L3QB.js → chunk-V373UAUS.js} +1 -1
- package/lib/esm/{chunk-DMDOMXWY.js → chunk-VXAB6NBV.js} +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/{outdoor-context-v5-H6GAWAMZ.js → outdoor-context-v5-SDXFT2FP.js} +1 -1
- package/lib/esm/{text3d-FS4EQ4SH.js → text3d-242FO3DA.js} +1 -1
- package/package.json +4 -4
- package/lib/esm/chunk-3N4I2ZNL.js +0 -1
package/lib/esm/index.js
CHANGED
|
@@ -1 +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};
|
|
1
|
+
import{$ as ta,A as yi,B as ip,C as np,D as op,E as Kt,F as $s,G as Ne,H as xt,I as sp,J as gi,K as Bt,L as fe,M as Ie,N as Js,O as uo,P as Ks,Q as mc,R as ap,S as fn,T as lp,U as ho,V as po,W as cp,X as Qs,Y as up,Z as fc,_ as ea,a as cc,aa as hp,b as uc,ba as dp,c as Ws,ca as pp,d as Vs,da as yc,e as fi,ea as mp,f as Hd,fa as gc,g as Wd,ga as fp,h as hc,ha as yp,i as zr,ia as yn,j as Vd,ja as gp,k as te,ka as vp,l as dc,la as ra,m as $t,ma as vc,n as qd,na as mo,o as $d,oa as gn,p as mn,pa as ia,q as Jd,qa as vn,r as Kd,ra as bn,s as qs,t as pc,u as Jt,v as me,w as Qd,x as ep,y as tp,z as rp}from"./chunk-JL7KYJFU.js";import{X as oc,k as Td,w as wd}from"./chunk-FWRW5PDC.js";import{a as Pt}from"./chunk-VXAB6NBV.js";import{$ as be,$a as Zd,A as Id,Aa as lc,B as Xs,Ba as Gr,C as zs,Ca as Xr,D as Ed,Da as Nt,E as Dd,Ea as Us,Fa as Xd,G as Od,Ga as zd,H as ue,I as ae,Ia as mi,M as Ld,N as Ad,O as kd,P as pi,Q as H,R as it,S as Rd,Sa as js,T as bt,U as mr,V as fr,W as Ee,Wa as Hs,Xa as Yd,Y as st,Z as ct,_ as Ys,aa as kr,b as Bs,bb as qt,c as hi,ca as Rr,d as co,da as Nd,db as Ud,e as Rt,ea as sc,f as Md,fb as jd,g as Vt,ga as Nr,la as Bd,oa as Br,p as Fs,pa as Fd,qa as Zs,r as Gs,ra as ac,ta as pn,ya as Gd,z as di,za as Fr}from"./chunk-BJJSORNB.js";import{a as v,b as E}from"./chunk-V373UAUS.js";import{a as O,b as j,c as a,d as _d,f as Ar,g as Pd,h as Ns,i as p,j as c,k as L,l as R,m as _e}from"./chunk-CU2O7JF6.js";var Mm=Ar((wo,Ln)=>{v();var Ib=200,sm="__lodash_hash_undefined__",Eb=800,Db=16,am=9007199254740991,lm="[object Arguments]",Ob="[object Array]",Lb="[object AsyncFunction]",Ab="[object Boolean]",kb="[object Date]",Rb="[object Error]",cm="[object Function]",Nb="[object GeneratorFunction]",Bb="[object Map]",Fb="[object Number]",Gb="[object Null]",um="[object Object]",Xb="[object Proxy]",zb="[object RegExp]",Yb="[object Set]",Zb="[object String]",Ub="[object Undefined]",jb="[object WeakMap]",Hb="[object ArrayBuffer]",Wb="[object DataView]",Vb="[object Float32Array]",qb="[object Float64Array]",$b="[object Int8Array]",Jb="[object Int16Array]",Kb="[object Int32Array]",Qb="[object Uint8Array]",e0="[object Uint8ClampedArray]",t0="[object Uint16Array]",r0="[object Uint32Array]",i0=/[\\^$.*+?()[\]{}|]/g,n0=/^\[object .+?Constructor\]$/,o0=/^(?:0|[1-9]\d*)$/,Oe={};Oe[Vb]=Oe[qb]=Oe[$b]=Oe[Jb]=Oe[Kb]=Oe[Qb]=Oe[e0]=Oe[t0]=Oe[r0]=!0;Oe[lm]=Oe[Ob]=Oe[Hb]=Oe[Ab]=Oe[Wb]=Oe[kb]=Oe[Rb]=Oe[cm]=Oe[Bb]=Oe[Fb]=Oe[um]=Oe[zb]=Oe[Yb]=Oe[Zb]=Oe[jb]=!1;var hm=typeof global=="object"&&global&&global.Object===Object&&global,s0=typeof self=="object"&&self&&self.Object===Object&&self,Eo=hm||s0||Function("return this")(),dm=typeof wo=="object"&&wo&&!wo.nodeType&&wo,Mo=dm&&typeof Ln=="object"&&Ln&&!Ln.nodeType&&Ln,pm=Mo&&Mo.exports===dm,Kc=pm&&hm.process,Jp=function(){try{var t=Mo&&Mo.require&&Mo.require("util").types;return t||Kc&&Kc.binding&&Kc.binding("util")}catch(e){}}(),Kp=Jp&&Jp.isTypedArray;function mm(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}a(mm,"apply");function a0(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}a(a0,"baseTimes");function l0(t){return function(e){return t(e)}}a(l0,"baseUnary");function c0(t,e){return t==null?void 0:t[e]}a(c0,"getValue");function u0(t,e){return function(r){return t(e(r))}}a(u0,"overArg");var h0=Array.prototype,d0=Function.prototype,Sa=Object.prototype,Qc=Eo["__core-js_shared__"],Ca=d0.toString,_r=Sa.hasOwnProperty,Qp=function(){var t=/[^.]+$/.exec(Qc&&Qc.keys&&Qc.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),fm=Sa.toString,p0=Ca.call(Object),m0=RegExp("^"+Ca.call(_r).replace(i0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ba=pm?Eo.Buffer:void 0,em=Eo.Symbol,tm=Eo.Uint8Array,rm=ba?ba.allocUnsafe:void 0,ym=u0(Object.getPrototypeOf,Object),im=Object.create,f0=Sa.propertyIsEnumerable,y0=h0.splice,Bi=em?em.toStringTag:void 0,xa=function(){try{var t=su(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),g0=ba?ba.isBuffer:void 0,nm=Math.max,v0=Date.now,gm=su(Eo,"Map"),Io=su(Object,"create"),b0=function(){function t(){}return a(t,"object"),function(e){if(!Cr(e))return{};if(im)return im(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Fi(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(Fi,"Hash");function x0(){this.__data__=Io?Io(null):{},this.size=0}a(x0,"hashClear");function S0(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}a(S0,"hashDelete");function C0(t){var e=this.__data__;if(Io){var r=e[t];return r===sm?void 0:r}return _r.call(e,t)?e[t]:void 0}a(C0,"hashGet");function _0(t){var e=this.__data__;return Io?e[t]!==void 0:_r.call(e,t)}a(_0,"hashHas");function P0(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Io&&e===void 0?sm:e,this}a(P0,"hashSet");Fi.prototype.clear=x0;Fi.prototype.delete=S0;Fi.prototype.get=C0;Fi.prototype.has=_0;Fi.prototype.set=P0;function Pr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(Pr,"ListCache");function T0(){this.__data__=[],this.size=0}a(T0,"listCacheClear");function w0(t){var e=this.__data__,r=_a(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():y0.call(e,r,1),--this.size,!0}a(w0,"listCacheDelete");function M0(t){var e=this.__data__,r=_a(e,t);return r<0?void 0:e[r][1]}a(M0,"listCacheGet");function I0(t){return _a(this.__data__,t)>-1}a(I0,"listCacheHas");function E0(t,e){var r=this.__data__,i=_a(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}a(E0,"listCacheSet");Pr.prototype.clear=T0;Pr.prototype.delete=w0;Pr.prototype.get=M0;Pr.prototype.has=I0;Pr.prototype.set=E0;function An(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(An,"MapCache");function D0(){this.size=0,this.__data__={hash:new Fi,map:new(gm||Pr),string:new Fi}}a(D0,"mapCacheClear");function O0(t){var e=Ta(this,t).delete(t);return this.size-=e?1:0,e}a(O0,"mapCacheDelete");function L0(t){return Ta(this,t).get(t)}a(L0,"mapCacheGet");function A0(t){return Ta(this,t).has(t)}a(A0,"mapCacheHas");function k0(t,e){var r=Ta(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}a(k0,"mapCacheSet");An.prototype.clear=D0;An.prototype.delete=O0;An.prototype.get=L0;An.prototype.has=A0;An.prototype.set=k0;function kn(t){var e=this.__data__=new Pr(t);this.size=e.size}a(kn,"Stack");function R0(){this.__data__=new Pr,this.size=0}a(R0,"stackClear");function N0(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}a(N0,"stackDelete");function B0(t){return this.__data__.get(t)}a(B0,"stackGet");function F0(t){return this.__data__.has(t)}a(F0,"stackHas");function G0(t,e){var r=this.__data__;if(r instanceof Pr){var i=r.__data__;if(!gm||i.length<Ib-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new An(i)}return r.set(t,e),this.size=r.size,this}a(G0,"stackSet");kn.prototype.clear=R0;kn.prototype.delete=N0;kn.prototype.get=B0;kn.prototype.has=F0;kn.prototype.set=G0;function X0(t,e){var r=iu(t),i=!r&&ru(t),n=!r&&!i&&Cm(t),o=!r&&!i&&!n&&Pm(t),s=r||i||n||o,l=s?a0(t.length,String):[],u=l.length;for(var h in t)(e||_r.call(t,h))&&!(s&&(h=="length"||n&&(h=="offset"||h=="parent")||o&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||xm(h,u)))&&l.push(h);return l}a(X0,"arrayLikeKeys");function eu(t,e,r){(r!==void 0&&!wa(t[e],r)||r===void 0&&!(e in t))&&nu(t,e,r)}a(eu,"assignMergeValue");function z0(t,e,r){var i=t[e];(!(_r.call(t,e)&&wa(i,r))||r===void 0&&!(e in t))&&nu(t,e,r)}a(z0,"assignValue");function _a(t,e){for(var r=t.length;r--;)if(wa(t[r][0],e))return r;return-1}a(_a,"assocIndexOf");function nu(t,e,r){e=="__proto__"&&xa?xa(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}a(nu,"baseAssignValue");var Y0=ex();function Pa(t){return t==null?t===void 0?Ub:Gb:Bi&&Bi in Object(t)?tx(t):ax(t)}a(Pa,"baseGetTag");function om(t){return Do(t)&&Pa(t)==lm}a(om,"baseIsArguments");function Z0(t){if(!Cr(t)||ox(t))return!1;var e=lu(t)?m0:n0;return e.test(hx(t))}a(Z0,"baseIsNative");function U0(t){return Do(t)&&_m(t.length)&&!!Oe[Pa(t)]}a(U0,"baseIsTypedArray");function j0(t){if(!Cr(t))return sx(t);var e=Sm(t),r=[];for(var i in t)i=="constructor"&&(e||!_r.call(t,i))||r.push(i);return r}a(j0,"baseKeysIn");function ou(t,e,r,i,n){t!==e&&Y0(e,function(o,s){if(n||(n=new kn),Cr(o))H0(t,e,s,r,ou,i,n);else{var l=i?i(tu(t,s),o,s+"",t,e,n):void 0;l===void 0&&(l=o),eu(t,s,l)}},Tm)}a(ou,"baseMerge");function H0(t,e,r,i,n,o,s){var l=tu(t,r),u=tu(e,r),h=s.get(u);if(h){eu(t,r,h);return}var m=o?o(l,u,r+"",t,e,s):void 0,f=m===void 0;if(f){var b=iu(u),y=!b&&Cm(u),_=!b&&!y&&Pm(u);m=u,b||y||_?iu(l)?m=l:dx(l)?m=J0(l):y?(f=!1,m=V0(u,!0)):_?(f=!1,m=$0(u,!0)):m=[]:px(u)||ru(u)?(m=l,ru(l)?m=mx(l):(!Cr(l)||lu(l))&&(m=rx(u))):f=!1}f&&(s.set(u,m),n(m,u,i,o,s),s.delete(u)),eu(t,r,m)}a(H0,"baseMergeDeep");function vm(t,e){return cx(lx(t,e,wm),t+"")}a(vm,"baseRest");var W0=xa?function(t,e){return xa(t,"toString",{configurable:!0,enumerable:!1,value:gx(e),writable:!0})}:wm;function V0(t,e){if(e)return t.slice();var r=t.length,i=rm?rm(r):new t.constructor(r);return t.copy(i),i}a(V0,"cloneBuffer");function q0(t){var e=new t.constructor(t.byteLength);return new tm(e).set(new tm(t)),e}a(q0,"cloneArrayBuffer");function $0(t,e){var r=e?q0(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}a($0,"cloneTypedArray");function J0(t,e){var r=-1,i=t.length;for(e||(e=Array(i));++r<i;)e[r]=t[r];return e}a(J0,"copyArray");function K0(t,e,r,i){var n=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var l=e[o],u=i?i(r[l],t[l],l,r,t):void 0;u===void 0&&(u=t[l]),n?nu(r,l,u):z0(r,l,u)}return r}a(K0,"copyObject");function Q0(t){return vm(function(e,r){var i=-1,n=r.length,o=n>1?r[n-1]:void 0,s=n>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(n--,o):void 0,s&&ix(r[0],r[1],s)&&(o=n<3?void 0:o,n=1),e=Object(e);++i<n;){var l=r[i];l&&t(e,l,i,o)}return e})}a(Q0,"createAssigner");function ex(t){return function(e,r,i){for(var n=-1,o=Object(e),s=i(e),l=s.length;l--;){var u=s[t?l:++n];if(r(o[u],u,o)===!1)break}return e}}a(ex,"createBaseFor");function bm(t,e,r,i,n,o){return Cr(t)&&Cr(e)&&(o.set(e,t),ou(t,e,void 0,bm,o),o.delete(e)),t}a(bm,"customDefaultsMerge");function Ta(t,e){var r=t.__data__;return nx(e)?r[typeof e=="string"?"string":"hash"]:r.map}a(Ta,"getMapData");function su(t,e){var r=c0(t,e);return Z0(r)?r:void 0}a(su,"getNative");function tx(t){var e=_r.call(t,Bi),r=t[Bi];try{t[Bi]=void 0;var i=!0}catch(o){}var n=fm.call(t);return i&&(e?t[Bi]=r:delete t[Bi]),n}a(tx,"getRawTag");function rx(t){return typeof t.constructor=="function"&&!Sm(t)?b0(ym(t)):{}}a(rx,"initCloneObject");function xm(t,e){var r=typeof t;return e=e==null?am:e,!!e&&(r=="number"||r!="symbol"&&o0.test(t))&&t>-1&&t%1==0&&t<e}a(xm,"isIndex");function ix(t,e,r){if(!Cr(r))return!1;var i=typeof e;return(i=="number"?au(r)&&xm(e,r.length):i=="string"&&e in r)?wa(r[e],t):!1}a(ix,"isIterateeCall");function nx(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}a(nx,"isKeyable");function ox(t){return!!Qp&&Qp in t}a(ox,"isMasked");function Sm(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Sa;return t===r}a(Sm,"isPrototype");function sx(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}a(sx,"nativeKeysIn");function ax(t){return fm.call(t)}a(ax,"objectToString");function lx(t,e,r){return e=nm(e===void 0?t.length-1:e,0),function(){for(var i=arguments,n=-1,o=nm(i.length-e,0),s=Array(o);++n<o;)s[n]=i[e+n];n=-1;for(var l=Array(e+1);++n<e;)l[n]=i[n];return l[e]=r(s),mm(t,this,l)}}a(lx,"overRest");function tu(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}a(tu,"safeGet");var cx=ux(W0);function ux(t){var e=0,r=0;return function(){var i=v0(),n=Db-(i-r);if(r=i,n>0){if(++e>=Eb)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}a(ux,"shortOut");function hx(t){if(t!=null){try{return Ca.call(t)}catch(e){}try{return t+""}catch(e){}}return""}a(hx,"toSource");function wa(t,e){return t===e||t!==t&&e!==e}a(wa,"eq");var ru=om(function(){return arguments}())?om:function(t){return Do(t)&&_r.call(t,"callee")&&!f0.call(t,"callee")},iu=Array.isArray;function au(t){return t!=null&&_m(t.length)&&!lu(t)}a(au,"isArrayLike");function dx(t){return Do(t)&&au(t)}a(dx,"isArrayLikeObject");var Cm=g0||vx;function lu(t){if(!Cr(t))return!1;var e=Pa(t);return e==cm||e==Nb||e==Lb||e==Xb}a(lu,"isFunction");function _m(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=am}a(_m,"isLength");function Cr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}a(Cr,"isObject");function Do(t){return t!=null&&typeof t=="object"}a(Do,"isObjectLike");function px(t){if(!Do(t)||Pa(t)!=um)return!1;var e=ym(t);if(e===null)return!0;var r=_r.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Ca.call(r)==p0}a(px,"isPlainObject");var Pm=Kp?l0(Kp):U0;function mx(t){return K0(t,Tm(t))}a(mx,"toPlainObject");var fx=vm(function(t){return t.push(void 0,bm),mm(yx,void 0,t)});function Tm(t){return au(t)?X0(t,!0):j0(t)}a(Tm,"keysIn");var yx=Q0(function(t,e,r,i){ou(t,e,r,i)});function gx(t){return function(){return t}}a(gx,"constant");function wm(t){return t}a(wm,"identity");function vx(){return!1}a(vx,"stubFalse");Ln.exports=fx});var mf=Ar((Oo,Rn)=>{v();var Ox=200,Vm="__lodash_hash_undefined__",Lx=800,Ax=16,qm=9007199254740991,$m="[object Arguments]",kx="[object Array]",Rx="[object AsyncFunction]",Nx="[object Boolean]",Bx="[object Date]",Fx="[object Error]",Jm="[object Function]",Gx="[object GeneratorFunction]",Xx="[object Map]",zx="[object Number]",Yx="[object Null]",Km="[object Object]",Zx="[object Proxy]",Ux="[object RegExp]",jx="[object Set]",Hx="[object String]",Wx="[object Undefined]",Vx="[object WeakMap]",qx="[object ArrayBuffer]",$x="[object DataView]",Jx="[object Float32Array]",Kx="[object Float64Array]",Qx="[object Int8Array]",eS="[object Int16Array]",tS="[object Int32Array]",rS="[object Uint8Array]",iS="[object Uint8ClampedArray]",nS="[object Uint16Array]",oS="[object Uint32Array]",sS=/[\\^$.*+?()[\]{}|]/g,aS=/^\[object .+?Constructor\]$/,lS=/^(?:0|[1-9]\d*)$/,Le={};Le[Jx]=Le[Kx]=Le[Qx]=Le[eS]=Le[tS]=Le[rS]=Le[iS]=Le[nS]=Le[oS]=!0;Le[$m]=Le[kx]=Le[qx]=Le[Nx]=Le[$x]=Le[Bx]=Le[Fx]=Le[Jm]=Le[Xx]=Le[zx]=Le[Km]=Le[Ux]=Le[jx]=Le[Hx]=Le[Vx]=!1;var Qm=typeof global=="object"&&global&&global.Object===Object&&global,cS=typeof self=="object"&&self&&self.Object===Object&&self,ko=Qm||cS||Function("return this")(),ef=typeof Oo=="object"&&Oo&&!Oo.nodeType&&Oo,Lo=ef&&typeof Rn=="object"&&Rn&&!Rn.nodeType&&Rn,tf=Lo&&Lo.exports===ef,du=tf&&Qm.process,Gm=function(){try{var t=Lo&&Lo.require&&Lo.require("util").types;return t||du&&du.binding&&du.binding("util")}catch(e){}}(),Xm=Gm&&Gm.isTypedArray;function uS(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}a(uS,"apply");function hS(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}a(hS,"baseTimes");function dS(t){return function(e){return t(e)}}a(dS,"baseUnary");function pS(t,e){return t==null?void 0:t[e]}a(pS,"getValue");function mS(t,e){return function(r){return t(e(r))}}a(mS,"overArg");var fS=Array.prototype,yS=Function.prototype,Ea=Object.prototype,pu=ko["__core-js_shared__"],Da=yS.toString,Tr=Ea.hasOwnProperty,zm=function(){var t=/[^.]+$/.exec(pu&&pu.keys&&pu.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),rf=Ea.toString,gS=Da.call(Object),vS=RegExp("^"+Da.call(Tr).replace(sS,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ma=tf?ko.Buffer:void 0,Ym=ko.Symbol,Zm=ko.Uint8Array,Um=Ma?Ma.allocUnsafe:void 0,nf=mS(Object.getPrototypeOf,Object),jm=Object.create,bS=Ea.propertyIsEnumerable,xS=fS.splice,Xi=Ym?Ym.toStringTag:void 0,Ia=function(){try{var t=bu(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),SS=Ma?Ma.isBuffer:void 0,Hm=Math.max,CS=Date.now,of=bu(ko,"Map"),Ao=bu(Object,"create"),_S=function(){function t(){}return a(t,"object"),function(e){if(!Yi(e))return{};if(jm)return jm(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function zi(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(zi,"Hash");function PS(){this.__data__=Ao?Ao(null):{},this.size=0}a(PS,"hashClear");function TS(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}a(TS,"hashDelete");function wS(t){var e=this.__data__;if(Ao){var r=e[t];return r===Vm?void 0:r}return Tr.call(e,t)?e[t]:void 0}a(wS,"hashGet");function MS(t){var e=this.__data__;return Ao?e[t]!==void 0:Tr.call(e,t)}a(MS,"hashHas");function IS(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Ao&&e===void 0?Vm:e,this}a(IS,"hashSet");zi.prototype.clear=PS;zi.prototype.delete=TS;zi.prototype.get=wS;zi.prototype.has=MS;zi.prototype.set=IS;function wr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(wr,"ListCache");function ES(){this.__data__=[],this.size=0}a(ES,"listCacheClear");function DS(t){var e=this.__data__,r=Oa(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():xS.call(e,r,1),--this.size,!0}a(DS,"listCacheDelete");function OS(t){var e=this.__data__,r=Oa(e,t);return r<0?void 0:e[r][1]}a(OS,"listCacheGet");function LS(t){return Oa(this.__data__,t)>-1}a(LS,"listCacheHas");function AS(t,e){var r=this.__data__,i=Oa(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}a(AS,"listCacheSet");wr.prototype.clear=ES;wr.prototype.delete=DS;wr.prototype.get=OS;wr.prototype.has=LS;wr.prototype.set=AS;function Nn(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(Nn,"MapCache");function kS(){this.size=0,this.__data__={hash:new zi,map:new(of||wr),string:new zi}}a(kS,"mapCacheClear");function RS(t){var e=Aa(this,t).delete(t);return this.size-=e?1:0,e}a(RS,"mapCacheDelete");function NS(t){return Aa(this,t).get(t)}a(NS,"mapCacheGet");function BS(t){return Aa(this,t).has(t)}a(BS,"mapCacheHas");function FS(t,e){var r=Aa(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}a(FS,"mapCacheSet");Nn.prototype.clear=kS;Nn.prototype.delete=RS;Nn.prototype.get=NS;Nn.prototype.has=BS;Nn.prototype.set=FS;function Bn(t){var e=this.__data__=new wr(t);this.size=e.size}a(Bn,"Stack");function GS(){this.__data__=new wr,this.size=0}a(GS,"stackClear");function XS(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}a(XS,"stackDelete");function zS(t){return this.__data__.get(t)}a(zS,"stackGet");function YS(t){return this.__data__.has(t)}a(YS,"stackHas");function ZS(t,e){var r=this.__data__;if(r instanceof wr){var i=r.__data__;if(!of||i.length<Ox-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new Nn(i)}return r.set(t,e),this.size=r.size,this}a(ZS,"stackSet");Bn.prototype.clear=GS;Bn.prototype.delete=XS;Bn.prototype.get=zS;Bn.prototype.has=YS;Bn.prototype.set=ZS;function US(t,e){var r=gu(t),i=!r&&yu(t),n=!r&&!i&&cf(t),o=!r&&!i&&!n&&hf(t),s=r||i||n||o,l=s?hS(t.length,String):[],u=l.length;for(var h in t)(e||Tr.call(t,h))&&!(s&&(h=="length"||n&&(h=="offset"||h=="parent")||o&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||af(h,u)))&&l.push(h);return l}a(US,"arrayLikeKeys");function mu(t,e,r){(r!==void 0&&!ka(t[e],r)||r===void 0&&!(e in t))&&vu(t,e,r)}a(mu,"assignMergeValue");function jS(t,e,r){var i=t[e];(!(Tr.call(t,e)&&ka(i,r))||r===void 0&&!(e in t))&&vu(t,e,r)}a(jS,"assignValue");function Oa(t,e){for(var r=t.length;r--;)if(ka(t[r][0],e))return r;return-1}a(Oa,"assocIndexOf");function vu(t,e,r){e=="__proto__"&&Ia?Ia(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}a(vu,"baseAssignValue");var HS=oC();function La(t){return t==null?t===void 0?Wx:Yx:Xi&&Xi in Object(t)?sC(t):dC(t)}a(La,"baseGetTag");function Wm(t){return Ro(t)&&La(t)==$m}a(Wm,"baseIsArguments");function WS(t){if(!Yi(t)||uC(t))return!1;var e=Su(t)?vS:aS;return e.test(yC(t))}a(WS,"baseIsNative");function VS(t){return Ro(t)&&uf(t.length)&&!!Le[La(t)]}a(VS,"baseIsTypedArray");function qS(t){if(!Yi(t))return hC(t);var e=lf(t),r=[];for(var i in t)i=="constructor"&&(e||!Tr.call(t,i))||r.push(i);return r}a(qS,"baseKeysIn");function sf(t,e,r,i,n){t!==e&&HS(e,function(o,s){if(n||(n=new Bn),Yi(o))$S(t,e,s,r,sf,i,n);else{var l=i?i(fu(t,s),o,s+"",t,e,n):void 0;l===void 0&&(l=o),mu(t,s,l)}},df)}a(sf,"baseMerge");function $S(t,e,r,i,n,o,s){var l=fu(t,r),u=fu(e,r),h=s.get(u);if(h){mu(t,r,h);return}var m=o?o(l,u,r+"",t,e,s):void 0,f=m===void 0;if(f){var b=gu(u),y=!b&&cf(u),_=!b&&!y&&hf(u);m=u,b||y||_?gu(l)?m=l:gC(l)?m=rC(l):y?(f=!1,m=QS(u,!0)):_?(f=!1,m=tC(u,!0)):m=[]:vC(u)||yu(u)?(m=l,yu(l)?m=bC(l):(!Yi(l)||Su(l))&&(m=aC(u))):f=!1}f&&(s.set(u,m),n(m,u,i,o,s),s.delete(u)),mu(t,r,m)}a($S,"baseMergeDeep");function JS(t,e){return mC(pC(t,e,pf),t+"")}a(JS,"baseRest");var KS=Ia?function(t,e){return Ia(t,"toString",{configurable:!0,enumerable:!1,value:SC(e),writable:!0})}:pf;function QS(t,e){if(e)return t.slice();var r=t.length,i=Um?Um(r):new t.constructor(r);return t.copy(i),i}a(QS,"cloneBuffer");function eC(t){var e=new t.constructor(t.byteLength);return new Zm(e).set(new Zm(t)),e}a(eC,"cloneArrayBuffer");function tC(t,e){var r=e?eC(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}a(tC,"cloneTypedArray");function rC(t,e){var r=-1,i=t.length;for(e||(e=Array(i));++r<i;)e[r]=t[r];return e}a(rC,"copyArray");function iC(t,e,r,i){var n=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var l=e[o],u=i?i(r[l],t[l],l,r,t):void 0;u===void 0&&(u=t[l]),n?vu(r,l,u):jS(r,l,u)}return r}a(iC,"copyObject");function nC(t){return JS(function(e,r){var i=-1,n=r.length,o=n>1?r[n-1]:void 0,s=n>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(n--,o):void 0,s&&lC(r[0],r[1],s)&&(o=n<3?void 0:o,n=1),e=Object(e);++i<n;){var l=r[i];l&&t(e,l,i,o)}return e})}a(nC,"createAssigner");function oC(t){return function(e,r,i){for(var n=-1,o=Object(e),s=i(e),l=s.length;l--;){var u=s[t?l:++n];if(r(o[u],u,o)===!1)break}return e}}a(oC,"createBaseFor");function Aa(t,e){var r=t.__data__;return cC(e)?r[typeof e=="string"?"string":"hash"]:r.map}a(Aa,"getMapData");function bu(t,e){var r=pS(t,e);return WS(r)?r:void 0}a(bu,"getNative");function sC(t){var e=Tr.call(t,Xi),r=t[Xi];try{t[Xi]=void 0;var i=!0}catch(o){}var n=rf.call(t);return i&&(e?t[Xi]=r:delete t[Xi]),n}a(sC,"getRawTag");function aC(t){return typeof t.constructor=="function"&&!lf(t)?_S(nf(t)):{}}a(aC,"initCloneObject");function af(t,e){var r=typeof t;return e=e==null?qm:e,!!e&&(r=="number"||r!="symbol"&&lS.test(t))&&t>-1&&t%1==0&&t<e}a(af,"isIndex");function lC(t,e,r){if(!Yi(r))return!1;var i=typeof e;return(i=="number"?xu(r)&&af(e,r.length):i=="string"&&e in r)?ka(r[e],t):!1}a(lC,"isIterateeCall");function cC(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}a(cC,"isKeyable");function uC(t){return!!zm&&zm in t}a(uC,"isMasked");function lf(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ea;return t===r}a(lf,"isPrototype");function hC(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}a(hC,"nativeKeysIn");function dC(t){return rf.call(t)}a(dC,"objectToString");function pC(t,e,r){return e=Hm(e===void 0?t.length-1:e,0),function(){for(var i=arguments,n=-1,o=Hm(i.length-e,0),s=Array(o);++n<o;)s[n]=i[e+n];n=-1;for(var l=Array(e+1);++n<e;)l[n]=i[n];return l[e]=r(s),uS(t,this,l)}}a(pC,"overRest");function fu(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}a(fu,"safeGet");var mC=fC(KS);function fC(t){var e=0,r=0;return function(){var i=CS(),n=Ax-(i-r);if(r=i,n>0){if(++e>=Lx)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}a(fC,"shortOut");function yC(t){if(t!=null){try{return Da.call(t)}catch(e){}try{return t+""}catch(e){}}return""}a(yC,"toSource");function ka(t,e){return t===e||t!==t&&e!==e}a(ka,"eq");var yu=Wm(function(){return arguments}())?Wm:function(t){return Ro(t)&&Tr.call(t,"callee")&&!bS.call(t,"callee")},gu=Array.isArray;function xu(t){return t!=null&&uf(t.length)&&!Su(t)}a(xu,"isArrayLike");function gC(t){return Ro(t)&&xu(t)}a(gC,"isArrayLikeObject");var cf=SS||CC;function Su(t){if(!Yi(t))return!1;var e=La(t);return e==Jm||e==Gx||e==Rx||e==Zx}a(Su,"isFunction");function uf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=qm}a(uf,"isLength");function Yi(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}a(Yi,"isObject");function Ro(t){return t!=null&&typeof t=="object"}a(Ro,"isObjectLike");function vC(t){if(!Ro(t)||La(t)!=Km)return!1;var e=nf(t);if(e===null)return!0;var r=Tr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Da.call(r)==gS}a(vC,"isPlainObject");var hf=Xm?dS(Xm):VS;function bC(t){return iC(t,df(t))}a(bC,"toPlainObject");function df(t){return xu(t)?US(t,!0):qS(t)}a(df,"keysIn");var xC=nC(function(t,e,r){sf(t,e,r)});function SC(t){return function(){return t}}a(SC,"constant");function pf(t){return t}a(pf,"identity");function CC(){return!1}a(CC,"stubFalse");Rn.exports=xC});var gy=Ar((wL,Qo)=>{"use strict";v();var c_=!1,Vi=!1,uy=!0,hy=!1,d={},dy=!1;typeof Qo<"u"&&Qo.exports?(Qo.exports=d,dy=!0):typeof document<"u"?window.ClipperLib=d:self.ClipperLib=d;var ll;dy?(We="chrome",ll="Netscape"):(We=navigator.userAgent.toString().toLowerCase(),ll=navigator.appName);var We,de={};We.indexOf("chrome")!=-1&&We.indexOf("chromium")==-1?de.chrome=1:de.chrome=0;We.indexOf("chromium")!=-1?de.chromium=1:de.chromium=0;We.indexOf("safari")!=-1&&We.indexOf("chrome")==-1&&We.indexOf("chromium")==-1?de.safari=1:de.safari=0;We.indexOf("firefox")!=-1?de.firefox=1:de.firefox=0;We.indexOf("firefox/17")!=-1?de.firefox17=1:de.firefox17=0;We.indexOf("firefox/15")!=-1?de.firefox15=1:de.firefox15=0;We.indexOf("firefox/3")!=-1?de.firefox3=1:de.firefox3=0;We.indexOf("opera")!=-1?de.opera=1:de.opera=0;We.indexOf("msie 10")!=-1?de.msie10=1:de.msie10=0;We.indexOf("msie 9")!=-1?de.msie9=1:de.msie9=0;We.indexOf("msie 8")!=-1?de.msie8=1:de.msie8=0;We.indexOf("msie 7")!=-1?de.msie7=1:de.msie7=0;We.indexOf("msie ")!=-1?de.msie=1:de.msie=0;d.biginteger_used=null;var Kr,u_=0xdeadbeefcafe,ly=(u_&16777215)==15715070;function B(t,e,r){d.biginteger_used=1,t!=null&&(typeof t=="number"&&typeof e>"u"?this.fromInt(t):typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}a(B,"BigInteger");function ye(){return new B(null)}a(ye,"nbi");function h_(t,e,r,i,n,o){for(;--o>=0;){var s=e*this[t++]+r[i]+n;n=Math.floor(s/67108864),r[i++]=s&67108863}return n}a(h_,"am1");function d_(t,e,r,i,n,o){for(var s=e&32767,l=e>>15;--o>=0;){var u=this[t]&32767,h=this[t++]>>15,m=l*u+h*s;u=s*u+((m&32767)<<15)+r[i]+(n&1073741823),n=(u>>>30)+(m>>>15)+l*h+(n>>>30),r[i++]=u&1073741823}return n}a(d_,"am2");function p_(t,e,r,i,n,o){for(var s=e&16383,l=e>>14;--o>=0;){var u=this[t]&16383,h=this[t++]>>14,m=l*u+h*s;u=s*u+((m&16383)<<14)+r[i]+n,n=(u>>28)+(m>>14)+l*h,r[i++]=u&268435455}return n}a(p_,"am3");ly&&ll=="Microsoft Internet Explorer"?(B.prototype.am=d_,Kr=30):ly&&ll!="Netscape"?(B.prototype.am=h_,Kr=26):(B.prototype.am=p_,Kr=28);B.prototype.DB=Kr;B.prototype.DM=(1<<Kr)-1;B.prototype.DV=1<<Kr;var ph=52;B.prototype.FV=Math.pow(2,ph);B.prototype.F1=ph-Kr;B.prototype.F2=2*Kr-ph;var m_="0123456789abcdefghijklmnopqrstuvwxyz",ul=new Array,Wn,Ot;Wn=48;for(Ot=0;Ot<=9;++Ot)ul[Wn++]=Ot;Wn=97;for(Ot=10;Ot<36;++Ot)ul[Wn++]=Ot;Wn=65;for(Ot=10;Ot<36;++Ot)ul[Wn++]=Ot;function cy(t){return m_.charAt(t)}a(cy,"int2char");function py(t,e){var r=ul[t.charCodeAt(e)];return r==null?-1:r}a(py,"intAt");function f_(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}a(f_,"bnpCopyTo");function y_(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}a(y_,"bnpFromInt");function Jr(t){var e=ye();return e.fromInt(t),e}a(Jr,"nbv");function g_(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var i=t.length,n=!1,o=0;--i>=0;){var s=r==8?t[i]&255:py(t,i);if(s<0){t.charAt(i)=="-"&&(n=!0);continue}n=!1,o==0?this[this.t++]=s:o+r>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+=r,o>=this.DB&&(o-=this.DB)}r==8&&(t[0]&128)!=0&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),n&&B.ZERO.subTo(this,this)}a(g_,"bnpFromString");function v_(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}a(v_,"bnpClamp");function b_(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<<e)-1,i,n=!1,o="",s=this.t,l=this.DB-s*this.DB%e;if(s-- >0)for(l<this.DB&&(i=this[s]>>l)>0&&(n=!0,o=cy(i));s>=0;)l<e?(i=(this[s]&(1<<l)-1)<<e-l,i|=this[--s]>>(l+=this.DB-e)):(i=this[s]>>(l-=e)&r,l<=0&&(l+=this.DB,--s)),i>0&&(n=!0),n&&(o+=cy(i));return n?o:"0"}a(b_,"bnToString");function x_(){var t=ye();return B.ZERO.subTo(this,t),t}a(x_,"bnNegate");function S_(){return this.s<0?this.negate():this}a(S_,"bnAbs");function C_(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this[r]-t[r])!=0)return e;return 0}a(C_,"bnCompareTo");function hl(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}a(hl,"nbits");function __(){return this.t<=0?0:this.DB*(this.t-1)+hl(this[this.t-1]^this.s&this.DM)}a(__,"bnBitLength");function P_(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}a(P_,"bnpDLShiftTo");function T_(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s}a(T_,"bnpDRShiftTo");function w_(t,e){var r=t%this.DB,i=this.DB-r,n=(1<<i)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,l;for(l=this.t-1;l>=0;--l)e[l+o+1]=this[l]>>i|s,s=(this[l]&n)<<r;for(l=o-1;l>=0;--l)e[l]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()}a(w_,"bnpLShiftTo");function M_(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var i=t%this.DB,n=this.DB-i,o=(1<<i)-1;e[0]=this[r]>>i;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<n,e[s-r]=this[s]>>i;i>0&&(e[this.t-r-1]|=(this.s&o)<<n),e.t=this.t-r,e.clamp()}a(M_,"bnpRShiftTo");function I_(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this[r]-t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i-=t[r],e[r++]=i&this.DM,i>>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[r++]=this.DV+i:i>0&&(e[r++]=i),e.t=r,e.clamp()}a(I_,"bnpSubTo");function E_(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e[n]=0;for(n=0;n<i.t;++n)e[n+r.t]=r.am(0,i[n],e,n,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&B.ZERO.subTo(e,e)}a(E_,"bnpMultiplyTo");function D_(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var i=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,i,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}a(D_,"bnpSquareTo");function O_(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t){e!=null&&e.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=ye());var o=ye(),s=this.s,l=t.s,u=this.DB-hl(i[i.t-1]);u>0?(i.lShiftTo(u,o),n.lShiftTo(u,r)):(i.copyTo(o),n.copyTo(r));var h=o.t,m=o[h-1];if(m!=0){var f=m*(1<<this.F1)+(h>1?o[h-2]>>this.F2:0),b=this.FV/f,y=(1<<this.F1)/f,_=1<<this.F2,T=r.t,g=T-h,x=e==null?ye():e;for(o.dlShiftTo(g,x),r.compareTo(x)>=0&&(r[r.t++]=1,r.subTo(x,r)),B.ONE.dlShiftTo(h,x),x.subTo(o,o);o.t<h;)o[o.t++]=0;for(;--g>=0;){var P=r[--T]==m?this.DM:Math.floor(r[T]*b+(r[T-1]+_)*y);if((r[T]+=o.am(0,P,r,g,0,h))<P)for(o.dlShiftTo(g,x),r.subTo(x,r);r[T]<--P;)r.subTo(x,r)}e!=null&&(r.drShiftTo(h,e),s!=l&&B.ZERO.subTo(e,e)),r.t=h,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&B.ZERO.subTo(r,r)}}}a(O_,"bnpDivRemTo");function L_(t){var e=ye();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(B.ZERO)>0&&t.subTo(e,e),e}a(L_,"bnMod");function qi(t){this.m=t}a(qi,"Classic");function A_(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}a(A_,"cConvert");function k_(t){return t}a(k_,"cRevert");function R_(t){t.divRemTo(this.m,null,t)}a(R_,"cReduce");function N_(t,e,r){t.multiplyTo(e,r),this.reduce(r)}a(N_,"cMulTo");function B_(t,e){t.squareTo(e),this.reduce(e)}a(B_,"cSqrTo");qi.prototype.convert=A_;qi.prototype.revert=k_;qi.prototype.reduce=R_;qi.prototype.mulTo=N_;qi.prototype.sqrTo=B_;function F_(){if(this.t<1)return 0;var t=this[0];if((t&1)==0)return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}a(F_,"bnpInvDigit");function $i(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}a($i,"Montgomery");function G_(t){var e=ye();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(B.ZERO)>0&&this.m.subTo(e,e),e}a(G_,"montConvert");function X_(t){var e=ye();return t.copyTo(e),this.reduce(e),e}a(X_,"montRevert");function z_(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=t[e]&32767,i=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t[r]+=this.m.am(0,i,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}a(z_,"montReduce");function Y_(t,e){t.squareTo(e),this.reduce(e)}a(Y_,"montSqrTo");function Z_(t,e,r){t.multiplyTo(e,r),this.reduce(r)}a(Z_,"montMulTo");$i.prototype.convert=G_;$i.prototype.revert=X_;$i.prototype.reduce=z_;$i.prototype.mulTo=Z_;$i.prototype.sqrTo=Y_;function U_(){return(this.t>0?this[0]&1:this.s)==0}a(U_,"bnpIsEven");function j_(t,e){if(t>4294967295||t<1)return B.ONE;var r=ye(),i=ye(),n=e.convert(this),o=hl(t)-1;for(n.copyTo(r);--o>=0;)if(e.sqrTo(r,i),(t&1<<o)>0)e.mulTo(i,n,r);else{var s=r;r=i,i=s}return e.revert(r)}a(j_,"bnpExp");function H_(t,e){var r;return t<256||e.isEven()?r=new qi(e):r=new $i(e),this.exp(t,r)}a(H_,"bnModPowInt");B.prototype.copyTo=f_;B.prototype.fromInt=y_;B.prototype.fromString=g_;B.prototype.clamp=v_;B.prototype.dlShiftTo=P_;B.prototype.drShiftTo=T_;B.prototype.lShiftTo=w_;B.prototype.rShiftTo=M_;B.prototype.subTo=I_;B.prototype.multiplyTo=E_;B.prototype.squareTo=D_;B.prototype.divRemTo=O_;B.prototype.invDigit=F_;B.prototype.isEven=U_;B.prototype.exp=j_;B.prototype.toString=b_;B.prototype.negate=x_;B.prototype.abs=S_;B.prototype.compareTo=C_;B.prototype.bitLength=__;B.prototype.mod=L_;B.prototype.modPowInt=H_;B.ZERO=Jr(0);B.ONE=Jr(1);function W_(){var t=ye();return this.copyTo(t),t}a(W_,"bnClone");function V_(){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(V_,"bnIntValue");function q_(){return this.t==0?this.s:this[0]<<24>>24}a(q_,"bnByteValue");function $_(){return this.t==0?this.s:this[0]<<16>>16}a($_,"bnShortValue");function J_(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}a(J_,"bnpChunkSize");function K_(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}a(K_,"bnSigNum");function Q_(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=Jr(r),n=ye(),o=ye(),s="";for(this.divRemTo(i,n,o);n.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,n.divRemTo(i,n,o);return o.intValue().toString(t)+s}a(Q_,"bnpToRadix");function eP(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,s=0,l=0;l<t.length;++l){var u=py(t,l);if(u<0){t.charAt(l)=="-"&&this.signum()==0&&(n=!0);continue}s=e*s+u,++o>=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),n&&B.ZERO.subTo(this,this)}a(eP,"bnpFromRadix");function tP(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(B.ONE.shiftLeft(t-1),mh,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(B.ONE.shiftLeft(t-1),this);else{var i=new Array,n=t&7;i.length=(t>>3)+1,e.nextBytes(i),n>0?i[0]&=(1<<n)-1:i[0]=0,this.fromString(i,256)}}a(tP,"bnpFromNumber");function rP(){var t=this.t,e=new Array;e[0]=this.s;var r=this.DB-t*this.DB%8,i,n=0;if(t-- >0)for(r<this.DB&&(i=this[t]>>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<<this.DB-r);t>=0;)r<8?(i=(this[t]&(1<<r)-1)<<8-r,i|=this[--t]>>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),(i&128)!=0&&(i|=-256),n==0&&(this.s&128)!=(i&128)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e}a(rP,"bnToByteArray");function iP(t){return this.compareTo(t)==0}a(iP,"bnEquals");function nP(t){return this.compareTo(t)<0?this:t}a(nP,"bnMin");function oP(t){return this.compareTo(t)>0?this:t}a(oP,"bnMax");function sP(t,e,r){var i,n,o=Math.min(t.t,this.t);for(i=0;i<o;++i)r[i]=e(this[i],t[i]);if(t.t<this.t){for(n=t.s&this.DM,i=o;i<this.t;++i)r[i]=e(this[i],n);r.t=this.t}else{for(n=this.s&this.DM,i=o;i<t.t;++i)r[i]=e(n,t[i]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}a(sP,"bnpBitwiseTo");function aP(t,e){return t&e}a(aP,"op_and");function lP(t){var e=ye();return this.bitwiseTo(t,aP,e),e}a(lP,"bnAnd");function mh(t,e){return t|e}a(mh,"op_or");function cP(t){var e=ye();return this.bitwiseTo(t,mh,e),e}a(cP,"bnOr");function my(t,e){return t^e}a(my,"op_xor");function uP(t){var e=ye();return this.bitwiseTo(t,my,e),e}a(uP,"bnXor");function fy(t,e){return t&~e}a(fy,"op_andnot");function hP(t){var e=ye();return this.bitwiseTo(t,fy,e),e}a(hP,"bnAndNot");function dP(){for(var t=ye(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}a(dP,"bnNot");function pP(t){var e=ye();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}a(pP,"bnShiftLeft");function mP(t){var e=ye();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}a(mP,"bnShiftRight");function fP(t){if(t==0)return-1;var e=0;return(t&65535)==0&&(t>>=16,e+=16),(t&255)==0&&(t>>=8,e+=8),(t&15)==0&&(t>>=4,e+=4),(t&3)==0&&(t>>=2,e+=2),(t&1)==0&&++e,e}a(fP,"lbit");function yP(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+fP(this[t]);return this.s<0?this.t*this.DB:-1}a(yP,"bnGetLowestSetBit");function gP(t){for(var e=0;t!=0;)t&=t-1,++e;return e}a(gP,"cbit");function vP(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=gP(this[r]^e);return t}a(vP,"bnBitCount");function bP(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this[e]&1<<t%this.DB)!=0}a(bP,"bnTestBit");function xP(t,e){var r=B.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}a(xP,"bnpChangeBit");function SP(t){return this.changeBit(t,mh)}a(SP,"bnSetBit");function CP(t){return this.changeBit(t,fy)}a(CP,"bnClearBit");function _P(t){return this.changeBit(t,my)}a(_P,"bnFlipBit");function PP(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this[r]+t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i+=t[r],e[r++]=i&this.DM,i>>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[r++]=i:i<-1&&(e[r++]=this.DV+i),e.t=r,e.clamp()}a(PP,"bnpAddTo");function TP(t){var e=ye();return this.addTo(t,e),e}a(TP,"bnAdd");function wP(t){var e=ye();return this.subTo(t,e),e}a(wP,"bnSubtract");function MP(t){var e=ye();return this.multiplyTo(t,e),e}a(MP,"bnMultiply");function IP(){var t=ye();return this.squareTo(t),t}a(IP,"bnSquare");function EP(t){var e=ye();return this.divRemTo(t,e,null),e}a(EP,"bnDivide");function DP(t){var e=ye();return this.divRemTo(t,null,e),e}a(DP,"bnRemainder");function OP(t){var e=ye(),r=ye();return this.divRemTo(t,e,r),new Array(e,r)}a(OP,"bnDivideAndRemainder");function LP(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}a(LP,"bnpDMultiply");function AP(t,e){if(t!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}a(AP,"bnpDAddOffset");function es(){}a(es,"NullExp");function yy(t){return t}a(yy,"nNop");function kP(t,e,r){t.multiplyTo(e,r)}a(kP,"nMulTo");function RP(t,e){t.squareTo(e)}a(RP,"nSqrTo");es.prototype.convert=yy;es.prototype.revert=yy;es.prototype.mulTo=kP;es.prototype.sqrTo=RP;function NP(t){return this.exp(t,new es)}a(NP,"bnPow");function BP(t,e,r){var i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;var n;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,t[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t[i],r,i,0,e-i);r.clamp()}a(BP,"bnpMultiplyLowerTo");function FP(t,e,r){--e;var i=r.t=this.t+t.t-e;for(r.s=0;--i>=0;)r[i]=0;for(i=Math.max(e-this.t,0);i<t.t;++i)r[this.t+i-e]=this.am(e-i,t[i],r,0,0,this.t+i-e);r.clamp(),r.drShiftTo(1,r)}a(FP,"bnpMultiplyUpperTo");function Vn(t){this.r2=ye(),this.q3=ye(),B.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}a(Vn,"Barrett");function GP(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=ye();return t.copyTo(e),this.reduce(e),e}a(GP,"barrettConvert");function XP(t){return t}a(XP,"barrettRevert");function zP(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}a(zP,"barrettReduce");function YP(t,e){t.squareTo(e),this.reduce(e)}a(YP,"barrettSqrTo");function ZP(t,e,r){t.multiplyTo(e,r),this.reduce(r)}a(ZP,"barrettMulTo");Vn.prototype.convert=GP;Vn.prototype.revert=XP;Vn.prototype.reduce=zP;Vn.prototype.mulTo=ZP;Vn.prototype.sqrTo=YP;function UP(t,e){var r=t.bitLength(),i,n=Jr(1),o;if(r<=0)return n;r<18?i=1:r<48?i=3:r<144?i=4:r<768?i=5:i=6,r<8?o=new qi(e):e.isEven()?o=new Vn(e):o=new $i(e);var s=new Array,l=3,u=i-1,h=(1<<i)-1;if(s[1]=o.convert(this),i>1){var m=ye();for(o.sqrTo(s[1],m);l<=h;)s[l]=ye(),o.mulTo(m,s[l-2],s[l]),l+=2}var f=t.t-1,b,y=!0,_=ye(),T;for(r=hl(t[f])-1;f>=0;){for(r>=u?b=t[f]>>r-u&h:(b=(t[f]&(1<<r+1)-1)<<u-r,f>0&&(b|=t[f-1]>>this.DB+r-u)),l=i;(b&1)==0;)b>>=1,--l;if((r-=l)<0&&(r+=this.DB,--f),y)s[b].copyTo(n),y=!1;else{for(;l>1;)o.sqrTo(n,_),o.sqrTo(_,n),l-=2;l>0?o.sqrTo(n,_):(T=n,n=_,_=T),o.mulTo(_,s[b],n)}for(;f>=0&&(t[f]&1<<r)==0;)o.sqrTo(n,_),T=n,n=_,_=T,--r<0&&(r=this.DB-1,--f)}return o.revert(n)}a(UP,"bnModPow");function jP(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(n<o&&(o=n),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}a(jP,"bnGCD");function HP(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this[i])%t;return r}a(HP,"bnpModInt");function WP(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return B.ZERO;for(var r=t.clone(),i=this.clone(),n=Jr(1),o=Jr(0),s=Jr(0),l=Jr(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!n.isEven()||!o.isEven())&&(n.addTo(this,n),o.subTo(t,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),e?((!s.isEven()||!l.isEven())&&(s.addTo(this,s),l.subTo(t,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(t,l),l.rShiftTo(1,l);r.compareTo(i)>=0?(r.subTo(i,r),e&&n.subTo(s,n),o.subTo(l,o)):(i.subTo(r,i),e&&s.subTo(n,s),l.subTo(o,l))}if(i.compareTo(B.ONE)!=0)return B.ZERO;if(l.compareTo(t)>=0)return l.subtract(t);if(l.signum()<0)l.addTo(t,l);else return l;return l.signum()<0?l.add(t):l}a(WP,"bnModInverse");var ut=[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],VP=(1<<26)/ut[ut.length-1];function qP(t){var e,r=this.abs();if(r.t==1&&r[0]<=ut[ut.length-1]){for(e=0;e<ut.length;++e)if(r[0]==ut[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<ut.length;){for(var i=ut[e],n=e+1;n<ut.length&&i<VP;)i*=ut[n++];for(i=r.modInt(i);e<n;)if(i%ut[e++]==0)return!1}return r.millerRabin(t)}a(qP,"bnIsProbablePrime");function $P(t){var e=this.subtract(B.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var i=e.shiftRight(r);t=t+1>>1,t>ut.length&&(t=ut.length);for(var n=ye(),o=0;o<t;++o){n.fromInt(ut[Math.floor(Math.random()*ut.length)]);var s=n.modPow(i,this);if(s.compareTo(B.ONE)!=0&&s.compareTo(e)!=0){for(var l=1;l++<r&&s.compareTo(e)!=0;)if(s=s.modPowInt(2,this),s.compareTo(B.ONE)==0)return!1;if(s.compareTo(e)!=0)return!1}}return!0}a($P,"bnpMillerRabin");B.prototype.chunkSize=J_;B.prototype.toRadix=Q_;B.prototype.fromRadix=eP;B.prototype.fromNumber=tP;B.prototype.bitwiseTo=sP;B.prototype.changeBit=xP;B.prototype.addTo=PP;B.prototype.dMultiply=LP;B.prototype.dAddOffset=AP;B.prototype.multiplyLowerTo=BP;B.prototype.multiplyUpperTo=FP;B.prototype.modInt=HP;B.prototype.millerRabin=$P;B.prototype.clone=W_;B.prototype.intValue=V_;B.prototype.byteValue=q_;B.prototype.shortValue=$_;B.prototype.signum=K_;B.prototype.toByteArray=rP;B.prototype.equals=iP;B.prototype.min=nP;B.prototype.max=oP;B.prototype.and=lP;B.prototype.or=cP;B.prototype.xor=uP;B.prototype.andNot=hP;B.prototype.not=dP;B.prototype.shiftLeft=pP;B.prototype.shiftRight=mP;B.prototype.getLowestSetBit=yP;B.prototype.bitCount=vP;B.prototype.testBit=bP;B.prototype.setBit=SP;B.prototype.clearBit=CP;B.prototype.flipBit=_P;B.prototype.add=TP;B.prototype.subtract=wP;B.prototype.multiply=MP;B.prototype.divide=EP;B.prototype.remainder=DP;B.prototype.divideAndRemainder=OP;B.prototype.modPow=UP;B.prototype.modInverse=WP;B.prototype.pow=NP;B.prototype.gcd=jP;B.prototype.isProbablePrime=qP;B.prototype.square=IP;var ce=B;ce.prototype.IsNegative=function(){return this.compareTo(ce.ZERO)==-1};ce.op_Equality=function(t,e){return t.compareTo(e)==0};ce.op_Inequality=function(t,e){return t.compareTo(e)!=0};ce.op_GreaterThan=function(t,e){return t.compareTo(e)>0};ce.op_LessThan=function(t,e){return t.compareTo(e)<0};ce.op_Addition=function(t,e){return new ce(t).add(new ce(e))};ce.op_Subtraction=function(t,e){return new ce(t).subtract(new ce(e))};ce.Int128Mul=function(t,e){return new ce(t).multiply(new ce(e))};ce.op_Division=function(t,e){return t.divide(e)};ce.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof cl>"u"&&(cl=a(function(t,e){var r;if(typeof Object.getOwnPropertyNames>"u"){for(r in e.prototype)(typeof t.prototype[r]>"u"||t.prototype[r]==Object.prototype[r])&&(t.prototype[r]=e.prototype[r]);for(r in e)typeof t[r]>"u"&&(t[r]=e[r]);t.$baseCtor=e}else{for(var i=Object.getOwnPropertyNames(e.prototype),n=0;n<i.length;n++)typeof Object.getOwnPropertyDescriptor(t.prototype,i[n])>"u"&&Object.defineProperty(t.prototype,i[n],Object.getOwnPropertyDescriptor(e.prototype,i[n]));for(r in e)typeof t[r]>"u"&&(t[r]=e[r]);t.$baseCtor=e}},"Inherit"));var cl;d.Path=function(){return[]};d.Paths=function(){return[]};d.DoublePoint=function(){var t=arguments;this.X=0,this.Y=0,t.length==1?(this.X=t[0].X,this.Y=t[0].Y):t.length==2&&(this.X=t[0],this.Y=t[1])};d.DoublePoint0=function(){this.X=0,this.Y=0};d.DoublePoint1=function(t){this.X=t.X,this.Y=t.Y};d.DoublePoint2=function(t,e){this.X=t,this.Y=e};d.PolyNode=function(){this.m_Parent=null,this.m_polygon=new d.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};d.PolyNode.prototype.IsHoleNode=function(){for(var t=!0,e=this.m_Parent;e!==null;)t=!t,e=e.m_Parent;return t};d.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};d.PolyNode.prototype.Contour=function(){return this.m_polygon};d.PolyNode.prototype.AddChild=function(t){var e=this.m_Childs.length;this.m_Childs.push(t),t.m_Parent=this,t.m_Index=e};d.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};d.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]};d.PolyNode.prototype.Childs=function(){return this.m_Childs};d.PolyNode.prototype.Parent=function(){return this.m_Parent};d.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};d.PolyTree=function(){this.m_AllPolys=[],d.PolyNode.call(this)};d.PolyTree.prototype.Clear=function(){for(var t=0,e=this.m_AllPolys.length;t<e;t++)this.m_AllPolys[t]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};d.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};d.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};cl(d.PolyTree,d.PolyNode);d.Math_Abs_Int64=d.Math_Abs_Int32=d.Math_Abs_Double=function(t){return Math.abs(t)};d.Math_Max_Int32_Int32=function(t,e){return Math.max(t,e)};de.msie||de.opera||de.safari?d.Cast_Int32=function(t){return t|0}:d.Cast_Int32=function(t){return~~t};de.chrome?d.Cast_Int64=function(t){return t<-2147483648||t>2147483647?t<0?Math.ceil(t):Math.floor(t):~~t}:de.firefox&&typeof Number.toInteger=="function"?d.Cast_Int64=function(t){return Number.toInteger(t)}:de.msie7||de.msie8?d.Cast_Int64=function(t){return parseInt(t,10)}:de.msie?d.Cast_Int64=function(t){return t<-2147483648||t>2147483647?t<0?Math.ceil(t):Math.floor(t):t|0}:d.Cast_Int64=function(t){return t<0?Math.ceil(t):Math.floor(t)};d.Clear=function(t){t.length=0};d.PI=3.141592653589793;d.PI2=2*3.141592653589793;d.IntPoint=function(){var t=arguments,e=t.length;if(this.X=0,this.Y=0,Vi)if(this.Z=0,e==3)this.X=t[0],this.Y=t[1],this.Z=t[2];else if(e==2)this.X=t[0],this.Y=t[1],this.Z=0;else if(e==1)if(t[0]instanceof d.DoublePoint){var r=t[0];this.X=d.Clipper.Round(r.X),this.Y=d.Clipper.Round(r.Y),this.Z=0}else{var i=t[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(e==2)this.X=t[0],this.Y=t[1];else if(e==1)if(t[0]instanceof d.DoublePoint){var r=t[0];this.X=d.Clipper.Round(r.X),this.Y=d.Clipper.Round(r.Y)}else{var i=t[0];this.X=i.X,this.Y=i.Y}else this.X=0,this.Y=0};d.IntPoint.op_Equality=function(t,e){return t.X==e.X&&t.Y==e.Y};d.IntPoint.op_Inequality=function(t,e){return t.X!=e.X||t.Y!=e.Y};Vi?(d.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},d.IntPoint1=function(t){this.X=t.X,this.Y=t.Y,this.Z=t.Z},d.IntPoint1dp=function(t){this.X=d.Clipper.Round(t.X),this.Y=d.Clipper.Round(t.Y),this.Z=0},d.IntPoint2=function(t,e){this.X=t,this.Y=e,this.Z=0},d.IntPoint3=function(t,e,r){this.X=t,this.Y=e,this.Z=r}):(d.IntPoint0=function(){this.X=0,this.Y=0},d.IntPoint1=function(t){this.X=t.X,this.Y=t.Y},d.IntPoint1dp=function(t){this.X=d.Clipper.Round(t.X),this.Y=d.Clipper.Round(t.Y)},d.IntPoint2=function(t,e){this.X=t,this.Y=e});d.IntRect=function(){var t=arguments,e=t.length;e==4?(this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3]):e==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)};d.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};d.IntRect1=function(t){this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom};d.IntRect4=function(t,e,r,i){this.left=t,this.top=e,this.right=r,this.bottom=i};d.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};d.PolyType={ptSubject:0,ptClip:1};d.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};d.JoinType={jtSquare:0,jtRound:1,jtMiter:2};d.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};hy&&(d.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});d.EdgeSide={esLeft:0,esRight:1};d.Direction={dRightToLeft:0,dLeftToRight:1};d.TEdge=function(){this.Bot=new d.IntPoint,this.Curr=new d.IntPoint,this.Top=new d.IntPoint,this.Delta=new d.IntPoint,this.Dx=0,this.PolyTyp=d.PolyType.ptSubject,this.Side=d.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};d.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new d.IntPoint};d.MyIntersectNodeSort=function(){};d.MyIntersectNodeSort.Compare=function(t,e){return e.Pt.Y-t.Pt.Y};d.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};d.Scanbeam=function(){this.Y=0,this.Next=null};d.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};d.OutPt=function(){this.Idx=0,this.Pt=new d.IntPoint,this.Next=null,this.Prev=null};d.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new d.IntPoint};d.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};d.ClipperBase.horizontal=-9007199254740992;d.ClipperBase.Skip=-2;d.ClipperBase.Unassigned=-1;d.ClipperBase.tolerance=1e-20;c_?(d.ClipperBase.loRange=46340,d.ClipperBase.hiRange=46340):(d.ClipperBase.loRange=47453132,d.ClipperBase.hiRange=0xfffffffffffff);d.ClipperBase.near_zero=function(t){return t>-d.ClipperBase.tolerance&&t<d.ClipperBase.tolerance};d.ClipperBase.IsHorizontal=function(t){return t.Delta.Y===0};d.ClipperBase.prototype.PointIsVertex=function(t,e){var r=e;do{if(d.IntPoint.op_Equality(r.Pt,t))return!0;r=r.Next}while(r!=e);return!1};d.ClipperBase.prototype.PointOnLineSegment=function(t,e,r,i){return i?t.X==e.X&&t.Y==e.Y||t.X==r.X&&t.Y==r.Y||t.X>e.X==t.X<r.X&&t.Y>e.Y==t.Y<r.Y&&ce.op_Equality(ce.Int128Mul(t.X-e.X,r.Y-e.Y),ce.Int128Mul(r.X-e.X,t.Y-e.Y)):t.X==e.X&&t.Y==e.Y||t.X==r.X&&t.Y==r.Y||t.X>e.X==t.X<r.X&&t.Y>e.Y==t.Y<r.Y&&(t.X-e.X)*(r.Y-e.Y)==(r.X-e.X)*(t.Y-e.Y)};d.ClipperBase.prototype.PointOnPolygon=function(t,e,r){for(var i=e;;){if(this.PointOnLineSegment(t,i.Pt,i.Next.Pt,r))return!0;if(i=i.Next,i==e)break}return!1};d.ClipperBase.prototype.SlopesEqual=d.ClipperBase.SlopesEqual=function(){var t=arguments,e=t.length,r,i,n,o,s,l,u;return e==3?(r=t[0],i=t[1],u=t[2],u?ce.op_Equality(ce.Int128Mul(r.Delta.Y,i.Delta.X),ce.Int128Mul(r.Delta.X,i.Delta.Y)):d.Cast_Int64(r.Delta.Y*i.Delta.X)==d.Cast_Int64(r.Delta.X*i.Delta.Y)):e==4?(n=t[0],o=t[1],s=t[2],u=t[3],u?ce.op_Equality(ce.Int128Mul(n.Y-o.Y,o.X-s.X),ce.Int128Mul(n.X-o.X,o.Y-s.Y)):d.Cast_Int64((n.Y-o.Y)*(o.X-s.X))-d.Cast_Int64((n.X-o.X)*(o.Y-s.Y))===0):(n=t[0],o=t[1],s=t[2],l=t[3],u=t[4],u?ce.op_Equality(ce.Int128Mul(n.Y-o.Y,s.X-l.X),ce.Int128Mul(n.X-o.X,s.Y-l.Y)):d.Cast_Int64((n.Y-o.Y)*(s.X-l.X))-d.Cast_Int64((n.X-o.X)*(s.Y-l.Y))===0)};d.ClipperBase.SlopesEqual3=function(t,e,r){return r?ce.op_Equality(ce.Int128Mul(t.Delta.Y,e.Delta.X),ce.Int128Mul(t.Delta.X,e.Delta.Y)):d.Cast_Int64(t.Delta.Y*e.Delta.X)==d.Cast_Int64(t.Delta.X*e.Delta.Y)};d.ClipperBase.SlopesEqual4=function(t,e,r,i){return i?ce.op_Equality(ce.Int128Mul(t.Y-e.Y,e.X-r.X),ce.Int128Mul(t.X-e.X,e.Y-r.Y)):d.Cast_Int64((t.Y-e.Y)*(e.X-r.X))-d.Cast_Int64((t.X-e.X)*(e.Y-r.Y))===0};d.ClipperBase.SlopesEqual5=function(t,e,r,i,n){return n?ce.op_Equality(ce.Int128Mul(t.Y-e.Y,r.X-i.X),ce.Int128Mul(t.X-e.X,r.Y-i.Y)):d.Cast_Int64((t.Y-e.Y)*(r.X-i.X))-d.Cast_Int64((t.X-e.X)*(r.Y-i.Y))===0};d.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var t=0,e=this.m_edges.length;t<e;++t){for(var r=0,i=this.m_edges[t].length;r<i;++r)this.m_edges[t][r]=null;d.Clear(this.m_edges[t])}d.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};d.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var t=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=t}this.m_CurrentLM=null};d.ClipperBase.prototype.RangeTest=function(t,e){e.Value?(t.X>d.ClipperBase.hiRange||t.Y>d.ClipperBase.hiRange||-t.X>d.ClipperBase.hiRange||-t.Y>d.ClipperBase.hiRange)&&d.Error("Coordinate outside allowed range in RangeTest()."):(t.X>d.ClipperBase.loRange||t.Y>d.ClipperBase.loRange||-t.X>d.ClipperBase.loRange||-t.Y>d.ClipperBase.loRange)&&(e.Value=!0,this.RangeTest(t,e))};d.ClipperBase.prototype.InitEdge=function(t,e,r,i){t.Next=e,t.Prev=r,t.Curr.X=i.X,t.Curr.Y=i.Y,t.OutIdx=-1};d.ClipperBase.prototype.InitEdge2=function(t,e){t.Curr.Y>=t.Next.Curr.Y?(t.Bot.X=t.Curr.X,t.Bot.Y=t.Curr.Y,t.Top.X=t.Next.Curr.X,t.Top.Y=t.Next.Curr.Y):(t.Top.X=t.Curr.X,t.Top.Y=t.Curr.Y,t.Bot.X=t.Next.Curr.X,t.Bot.Y=t.Next.Curr.Y),this.SetDx(t),t.PolyTyp=e};d.ClipperBase.prototype.FindNextLocMin=function(t){for(var e;;){for(;d.IntPoint.op_Inequality(t.Bot,t.Prev.Bot)||d.IntPoint.op_Equality(t.Curr,t.Top);)t=t.Next;if(t.Dx!=d.ClipperBase.horizontal&&t.Prev.Dx!=d.ClipperBase.horizontal)break;for(;t.Prev.Dx==d.ClipperBase.horizontal;)t=t.Prev;for(e=t;t.Dx==d.ClipperBase.horizontal;)t=t.Next;if(t.Top.Y!=t.Prev.Bot.Y){e.Prev.Bot.X<t.Bot.X&&(t=e);break}}return t};d.ClipperBase.prototype.ProcessBound=function(t,e){var r=t,i=t,n,o;if(t.Dx==d.ClipperBase.horizontal&&(e?o=t.Prev.Bot.X:o=t.Next.Bot.X,t.Bot.X!=o&&this.ReverseHorizontal(t)),i.OutIdx!=d.ClipperBase.Skip)if(e){for(;i.Top.Y==i.Next.Bot.Y&&i.Next.OutIdx!=d.ClipperBase.Skip;)i=i.Next;if(i.Dx==d.ClipperBase.horizontal&&i.Next.OutIdx!=d.ClipperBase.Skip){for(n=i;n.Prev.Dx==d.ClipperBase.horizontal;)n=n.Prev;n.Prev.Top.X==i.Next.Top.X?e||(i=n.Prev):n.Prev.Top.X>i.Next.Top.X&&(i=n.Prev)}for(;t!=i;)t.NextInLML=t.Next,t.Dx==d.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Prev.Top.X&&this.ReverseHorizontal(t),t=t.Next;t.Dx==d.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Prev.Top.X&&this.ReverseHorizontal(t),i=i.Next}else{for(;i.Top.Y==i.Prev.Bot.Y&&i.Prev.OutIdx!=d.ClipperBase.Skip;)i=i.Prev;if(i.Dx==d.ClipperBase.horizontal&&i.Prev.OutIdx!=d.ClipperBase.Skip){for(n=i;n.Next.Dx==d.ClipperBase.horizontal;)n=n.Next;n.Next.Top.X==i.Prev.Top.X?e||(i=n.Next):n.Next.Top.X>i.Prev.Top.X&&(i=n.Next)}for(;t!=i;)t.NextInLML=t.Prev,t.Dx==d.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Next.Top.X&&this.ReverseHorizontal(t),t=t.Prev;t.Dx==d.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Next.Top.X&&this.ReverseHorizontal(t),i=i.Prev}if(i.OutIdx==d.ClipperBase.Skip){if(t=i,e){for(;t.Top.Y==t.Next.Bot.Y;)t=t.Next;for(;t!=i&&t.Dx==d.ClipperBase.horizontal;)t=t.Prev}else{for(;t.Top.Y==t.Prev.Bot.Y;)t=t.Prev;for(;t!=i&&t.Dx==d.ClipperBase.horizontal;)t=t.Next}if(t==i)e?i=t.Next:i=t.Prev;else{e?t=i.Next:t=i.Prev;var s=new d.LocalMinima;s.Next=null,s.Y=t.Bot.Y,s.LeftBound=null,s.RightBound=t,s.RightBound.WindDelta=0,i=this.ProcessBound(s.RightBound,e),this.InsertLocalMinima(s)}}return i};d.ClipperBase.prototype.AddPath=function(t,e,r){uy?!r&&e==d.PolyType.ptClip&&d.Error("AddPath: Open paths must be subject."):r||d.Error("AddPath: Open paths have been disabled.");var i=t.length-1;if(r)for(;i>0&&d.IntPoint.op_Equality(t[i],t[0]);)--i;for(;i>0&&d.IntPoint.op_Equality(t[i],t[i-1]);)--i;if(r&&i<2||!r&&i<1)return!1;for(var n=new Array,o=0;o<=i;o++)n.push(new d.TEdge);var s=!0;n[1].Curr.X=t[1].X,n[1].Curr.Y=t[1].Y;var l={Value:this.m_UseFullRange};this.RangeTest(t[0],l),this.m_UseFullRange=l.Value,l.Value=this.m_UseFullRange,this.RangeTest(t[i],l),this.m_UseFullRange=l.Value,this.InitEdge(n[0],n[1],n[i],t[0]),this.InitEdge(n[i],n[0],n[i-1],t[i]);for(var o=i-1;o>=1;--o)l.Value=this.m_UseFullRange,this.RangeTest(t[o],l),this.m_UseFullRange=l.Value,this.InitEdge(n[o],n[o+1],n[o-1],t[o]);for(var u=n[0],h=u,m=u;;){if(d.IntPoint.op_Equality(h.Curr,h.Next.Curr)){if(h==h.Next)break;h==u&&(u=h.Next),h=this.RemoveEdge(h),m=h;continue}if(h.Prev==h.Next)break;if(r&&d.ClipperBase.SlopesEqual(h.Prev.Curr,h.Curr,h.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(h.Prev.Curr,h.Curr,h.Next.Curr))){h==u&&(u=h.Next),h=this.RemoveEdge(h),h=h.Prev,m=h;continue}if(h=h.Next,h==m)break}if(!r&&h==h.Next||r&&h.Prev==h.Next)return!1;r||(this.m_HasOpenPaths=!0,u.Prev.OutIdx=d.ClipperBase.Skip);var f=u;h=u;do this.InitEdge2(h,e),h=h.Next,s&&h.Curr.Y!=u.Curr.Y&&(s=!1);while(h!=u);if(s){if(r)return!1;h.Prev.OutIdx=d.ClipperBase.Skip,h.Prev.Bot.X<h.Prev.Top.X&&this.ReverseHorizontal(h.Prev);var b=new d.LocalMinima;for(b.Next=null,b.Y=h.Bot.Y,b.LeftBound=null,b.RightBound=h,b.RightBound.Side=d.EdgeSide.esRight,b.RightBound.WindDelta=0;h.Next.OutIdx!=d.ClipperBase.Skip;)h.NextInLML=h.Next,h.Bot.X!=h.Prev.Top.X&&this.ReverseHorizontal(h),h=h.Next;return this.InsertLocalMinima(b),this.m_edges.push(n),!0}this.m_edges.push(n);for(var y,_=null;h=this.FindNextLocMin(h),h!=_;){_==null&&(_=h);var b=new d.LocalMinima;b.Next=null,b.Y=h.Bot.Y,h.Dx<h.Prev.Dx?(b.LeftBound=h.Prev,b.RightBound=h,y=!1):(b.LeftBound=h,b.RightBound=h.Prev,y=!0),b.LeftBound.Side=d.EdgeSide.esLeft,b.RightBound.Side=d.EdgeSide.esRight,r?b.LeftBound.Next==b.RightBound?b.LeftBound.WindDelta=-1:b.LeftBound.WindDelta=1:b.LeftBound.WindDelta=0,b.RightBound.WindDelta=-b.LeftBound.WindDelta,h=this.ProcessBound(b.LeftBound,y);var T=this.ProcessBound(b.RightBound,!y);b.LeftBound.OutIdx==d.ClipperBase.Skip?b.LeftBound=null:b.RightBound.OutIdx==d.ClipperBase.Skip&&(b.RightBound=null),this.InsertLocalMinima(b),y||(h=T)}return!0};d.ClipperBase.prototype.AddPaths=function(t,e,r){for(var i=!1,n=0,o=t.length;n<o;++n)this.AddPath(t[n],e,r)&&(i=!0);return i};d.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(t,e,r){return d.IntPoint.op_Equality(t,r)||d.IntPoint.op_Equality(t,e)||d.IntPoint.op_Equality(r,e)?!1:t.X!=r.X?e.X>t.X==e.X<r.X:e.Y>t.Y==e.Y<r.Y};d.ClipperBase.prototype.RemoveEdge=function(t){t.Prev.Next=t.Next,t.Next.Prev=t.Prev;var e=t.Next;return t.Prev=null,e};d.ClipperBase.prototype.SetDx=function(t){t.Delta.X=t.Top.X-t.Bot.X,t.Delta.Y=t.Top.Y-t.Bot.Y,t.Delta.Y===0?t.Dx=d.ClipperBase.horizontal:t.Dx=t.Delta.X/t.Delta.Y};d.ClipperBase.prototype.InsertLocalMinima=function(t){if(this.m_MinimaList===null)this.m_MinimaList=t;else if(t.Y>=this.m_MinimaList.Y)t.Next=this.m_MinimaList,this.m_MinimaList=t;else{for(var e=this.m_MinimaList;e.Next!==null&&t.Y<e.Next.Y;)e=e.Next;t.Next=e.Next,e.Next=t}};d.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};d.ClipperBase.prototype.ReverseHorizontal=function(t){var e=t.Top.X;t.Top.X=t.Bot.X,t.Bot.X=e,Vi&&(e=t.Top.Z,t.Top.Z=t.Bot.Z,t.Bot.Z=e)};d.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var t=this.m_MinimaList;t!=null;){var e=t.LeftBound;e!=null&&(e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.Side=d.EdgeSide.esLeft,e.OutIdx=d.ClipperBase.Unassigned),e=t.RightBound,e!=null&&(e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.Side=d.EdgeSide.esRight,e.OutIdx=d.ClipperBase.Unassigned),t=t.Next}};d.Clipper=function(t){typeof t>"u"&&(t=0),this.m_PolyOuts=null,this.m_ClipType=d.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=d.PolyFillType.pftEvenOdd,this.m_SubjFillType=d.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,d.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=d.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&t)!==0,this.StrictlySimple=(2&t)!==0,this.PreserveCollinear=(4&t)!==0,Vi&&(this.ZFillFunction=null)};d.Clipper.ioReverseSolution=1;d.Clipper.ioStrictlySimple=2;d.Clipper.ioPreserveCollinear=4;d.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),d.ClipperBase.prototype.Clear.call(this))};d.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var t=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=t}};d.Clipper.prototype.Reset=function(){d.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var t=this.m_MinimaList;t!==null;)this.InsertScanbeam(t.Y),t=t.Next};d.Clipper.prototype.InsertScanbeam=function(t){if(this.m_Scanbeam===null)this.m_Scanbeam=new d.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=t;else if(t>this.m_Scanbeam.Y){var e=new d.Scanbeam;e.Y=t,e.Next=this.m_Scanbeam,this.m_Scanbeam=e}else{for(var r=this.m_Scanbeam;r.Next!==null&&t<=r.Next.Y;)r=r.Next;if(t==r.Y)return;var e=new d.Scanbeam;e.Y=t,e.Next=r.Next,r.Next=e}};d.Clipper.prototype.Execute=function(){var t=arguments,e=t.length,r=t[1]instanceof d.PolyTree;if(e==4&&!r){var i=t[0],n=t[1],o=t[2],s=t[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&d.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,d.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(e==4&&r){var i=t[0],u=t[1],o=t[2],s=t[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(u)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(e==2&&!r){var i=t[0],n=t[1];return this.Execute(i,n,d.PolyFillType.pftEvenOdd,d.PolyFillType.pftEvenOdd)}else if(e==2&&r){var i=t[0],u=t[1];return this.Execute(i,u,d.PolyFillType.pftEvenOdd,d.PolyFillType.pftEvenOdd)}};d.Clipper.prototype.FixHoleLinkage=function(t){if(!(t.FirstLeft===null||t.IsHole!=t.FirstLeft.IsHole&&t.FirstLeft.Pts!==null)){for(var e=t.FirstLeft;e!==null&&(e.IsHole==t.IsHole||e.Pts===null);)e=e.FirstLeft;t.FirstLeft=e}};d.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var t=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(t),d.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var e=this.PopScanbeam();if(!this.ProcessIntersections(t,e))return!1;this.ProcessEdgesAtTopOfScanbeam(e),t=e}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=this.m_PolyOuts[r];n.Pts===null||n.IsOpen||(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)}this.JoinCommonEdges();for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=this.m_PolyOuts[r];n.Pts!==null&&!n.IsOpen&&this.FixupOutPolygon(n)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{d.Clear(this.m_Joins),d.Clear(this.m_GhostJoins)}};d.Clipper.prototype.PopScanbeam=function(){var t=this.m_Scanbeam.Y,e=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,e=null,t};d.Clipper.prototype.DisposeAllPolyPts=function(){for(var t=0,e=this.m_PolyOuts.length;t<e;++t)this.DisposeOutRec(t);d.Clear(this.m_PolyOuts)};d.Clipper.prototype.DisposeOutRec=function(t){var e=this.m_PolyOuts[t];e.Pts!==null&&this.DisposeOutPts(e.Pts),e=null,this.m_PolyOuts[t]=null};d.Clipper.prototype.DisposeOutPts=function(t){if(t!==null){var e=null;for(t.Prev.Next=null;t!==null;)e=t,t=t.Next,e=null}};d.Clipper.prototype.AddJoin=function(t,e,r){var i=new d.Join;i.OutPt1=t,i.OutPt2=e,i.OffPt.X=r.X,i.OffPt.Y=r.Y,this.m_Joins.push(i)};d.Clipper.prototype.AddGhostJoin=function(t,e){var r=new d.Join;r.OutPt1=t,r.OffPt.X=e.X,r.OffPt.Y=e.Y,this.m_GhostJoins.push(r)};Vi&&(d.Clipper.prototype.SetZ=function(t,e){t.Z=0,this.ZFillFunction!==null&&(e.OutIdx<0?this.ZFillFunction(e.Bot,e.Top,t):this.ZFillFunction(e.Top,e.Bot,t))});d.Clipper.prototype.InsertLocalMinimaIntoAEL=function(t){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==t;){var e=this.m_CurrentLM.LeftBound,r=this.m_CurrentLM.RightBound;this.PopLocalMinima();var i=null;if(e===null?(this.InsertEdgeIntoAEL(r,null),this.SetWindingCount(r),this.IsContributing(r)&&(i=this.AddOutPt(r,r.Bot))):r==null?(this.InsertEdgeIntoAEL(e,null),this.SetWindingCount(e),this.IsContributing(e)&&(i=this.AddOutPt(e,e.Bot)),this.InsertScanbeam(e.Top.Y)):(this.InsertEdgeIntoAEL(e,null),this.InsertEdgeIntoAEL(r,e),this.SetWindingCount(e),r.WindCnt=e.WindCnt,r.WindCnt2=e.WindCnt2,this.IsContributing(e)&&(i=this.AddLocalMinPoly(e,r,e.Bot)),this.InsertScanbeam(e.Top.Y)),r!=null&&(d.ClipperBase.IsHorizontal(r)?this.AddEdgeToSEL(r):this.InsertScanbeam(r.Top.Y)),!(e==null||r==null)){if(i!==null&&d.ClipperBase.IsHorizontal(r)&&this.m_GhostJoins.length>0&&r.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,r.Bot,r.Top)&&this.AddJoin(s.OutPt1,i,s.OffPt)}if(e.OutIdx>=0&&e.PrevInAEL!==null&&e.PrevInAEL.Curr.X==e.Bot.X&&e.PrevInAEL.OutIdx>=0&&d.ClipperBase.SlopesEqual(e.PrevInAEL,e,this.m_UseFullRange)&&e.WindDelta!==0&&e.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(i,l,e.Top)}if(e.NextInAEL!=r){if(r.OutIdx>=0&&r.PrevInAEL.OutIdx>=0&&d.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)}var u=e.NextInAEL;if(u!==null)for(;u!=r;)this.IntersectEdges(r,u,e.Curr,!1),u=u.NextInAEL}}}};d.Clipper.prototype.InsertEdgeIntoAEL=function(t,e){if(this.m_ActiveEdges===null)t.PrevInAEL=null,t.NextInAEL=null,this.m_ActiveEdges=t;else if(e===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,t))t.PrevInAEL=null,t.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=t,this.m_ActiveEdges=t;else{for(e===null&&(e=this.m_ActiveEdges);e.NextInAEL!==null&&!this.E2InsertsBeforeE1(e.NextInAEL,t);)e=e.NextInAEL;t.NextInAEL=e.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=t),t.PrevInAEL=e,e.NextInAEL=t}};d.Clipper.prototype.E2InsertsBeforeE1=function(t,e){return e.Curr.X==t.Curr.X?e.Top.Y>t.Top.Y?e.Top.X<d.Clipper.TopX(t,e.Top.Y):t.Top.X>d.Clipper.TopX(e,t.Top.Y):e.Curr.X<t.Curr.X};d.Clipper.prototype.IsEvenOddFillType=function(t){return t.PolyTyp==d.PolyType.ptSubject?this.m_SubjFillType==d.PolyFillType.pftEvenOdd:this.m_ClipFillType==d.PolyFillType.pftEvenOdd};d.Clipper.prototype.IsEvenOddAltFillType=function(t){return t.PolyTyp==d.PolyType.ptSubject?this.m_ClipFillType==d.PolyFillType.pftEvenOdd:this.m_SubjFillType==d.PolyFillType.pftEvenOdd};d.Clipper.prototype.IsContributing=function(t){var e,r;switch(t.PolyTyp==d.PolyType.ptSubject?(e=this.m_SubjFillType,r=this.m_ClipFillType):(e=this.m_ClipFillType,r=this.m_SubjFillType),e){case d.PolyFillType.pftEvenOdd:if(t.WindDelta===0&&t.WindCnt!=1)return!1;break;case d.PolyFillType.pftNonZero:if(Math.abs(t.WindCnt)!=1)return!1;break;case d.PolyFillType.pftPositive:if(t.WindCnt!=1)return!1;break;default:if(t.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case d.ClipType.ctIntersection:switch(r){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return t.WindCnt2!==0;case d.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case d.ClipType.ctUnion:switch(r){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return t.WindCnt2===0;case d.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}case d.ClipType.ctDifference:if(t.PolyTyp==d.PolyType.ptSubject)switch(r){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return t.WindCnt2===0;case d.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else switch(r){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return t.WindCnt2!==0;case d.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case d.ClipType.ctXor:if(t.WindDelta===0)switch(r){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return t.WindCnt2===0;case d.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else return!0}return!0};d.Clipper.prototype.SetWindingCount=function(t){for(var e=t.PrevInAEL;e!==null&&(e.PolyTyp!=t.PolyTyp||e.WindDelta===0);)e=e.PrevInAEL;if(e===null)t.WindCnt=t.WindDelta===0?1:t.WindDelta,t.WindCnt2=0,e=this.m_ActiveEdges;else if(t.WindDelta===0&&this.m_ClipType!=d.ClipType.ctUnion)t.WindCnt=1,t.WindCnt2=e.WindCnt2,e=e.NextInAEL;else if(this.IsEvenOddFillType(t)){if(t.WindDelta===0){for(var r=!0,i=e.PrevInAEL;i!==null;)i.PolyTyp==e.PolyTyp&&i.WindDelta!==0&&(r=!r),i=i.PrevInAEL;t.WindCnt=r?0:1}else t.WindCnt=t.WindDelta;t.WindCnt2=e.WindCnt2,e=e.NextInAEL}else e.WindCnt*e.WindDelta<0?Math.abs(e.WindCnt)>1?e.WindDelta*t.WindDelta<0?t.WindCnt=e.WindCnt:t.WindCnt=e.WindCnt+t.WindDelta:t.WindCnt=t.WindDelta===0?1:t.WindDelta:t.WindDelta===0?t.WindCnt=e.WindCnt<0?e.WindCnt-1:e.WindCnt+1:e.WindDelta*t.WindDelta<0?t.WindCnt=e.WindCnt:t.WindCnt=e.WindCnt+t.WindDelta,t.WindCnt2=e.WindCnt2,e=e.NextInAEL;if(this.IsEvenOddAltFillType(t))for(;e!=t;)e.WindDelta!==0&&(t.WindCnt2=t.WindCnt2===0?1:0),e=e.NextInAEL;else for(;e!=t;)t.WindCnt2+=e.WindDelta,e=e.NextInAEL};d.Clipper.prototype.AddEdgeToSEL=function(t){this.m_SortedEdges===null?(this.m_SortedEdges=t,t.PrevInSEL=null,t.NextInSEL=null):(t.NextInSEL=this.m_SortedEdges,t.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=t,this.m_SortedEdges=t)};d.Clipper.prototype.CopyAELToSEL=function(){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;t!==null;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t=t.NextInAEL};d.Clipper.prototype.SwapPositionsInAEL=function(t,e){if(!(t.NextInAEL==t.PrevInAEL||e.NextInAEL==e.PrevInAEL)){if(t.NextInAEL==e){var r=e.NextInAEL;r!==null&&(r.PrevInAEL=t);var i=t.PrevInAEL;i!==null&&(i.NextInAEL=e),e.PrevInAEL=i,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=r}else if(e.NextInAEL==t){var r=t.NextInAEL;r!==null&&(r.PrevInAEL=e);var i=e.PrevInAEL;i!==null&&(i.NextInAEL=t),t.PrevInAEL=i,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=r}else{var r=t.NextInAEL,i=t.PrevInAEL;t.NextInAEL=e.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=e.PrevInAEL,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t),e.NextInAEL=r,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=i,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e)}t.PrevInAEL===null?this.m_ActiveEdges=t:e.PrevInAEL===null&&(this.m_ActiveEdges=e)}};d.Clipper.prototype.SwapPositionsInSEL=function(t,e){if(!(t.NextInSEL===null&&t.PrevInSEL===null)&&!(e.NextInSEL===null&&e.PrevInSEL===null)){if(t.NextInSEL==e){var r=e.NextInSEL;r!==null&&(r.PrevInSEL=t);var i=t.PrevInSEL;i!==null&&(i.NextInSEL=e),e.PrevInSEL=i,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=r}else if(e.NextInSEL==t){var r=t.NextInSEL;r!==null&&(r.PrevInSEL=e);var i=e.PrevInSEL;i!==null&&(i.NextInSEL=t),t.PrevInSEL=i,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=r}else{var r=t.NextInSEL,i=t.PrevInSEL;t.NextInSEL=e.NextInSEL,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=e.PrevInSEL,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t),e.NextInSEL=r,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=i,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e)}t.PrevInSEL===null?this.m_SortedEdges=t:e.PrevInSEL===null&&(this.m_SortedEdges=e)}};d.Clipper.prototype.AddLocalMaxPoly=function(t,e,r){this.AddOutPt(t,r),e.WindDelta==0&&this.AddOutPt(e,r),t.OutIdx==e.OutIdx?(t.OutIdx=-1,e.OutIdx=-1):t.OutIdx<e.OutIdx?this.AppendPolygon(t,e):this.AppendPolygon(e,t)};d.Clipper.prototype.AddLocalMinPoly=function(t,e,r){var i,n,o;if(d.ClipperBase.IsHorizontal(e)||t.Dx>e.Dx?(i=this.AddOutPt(t,r),e.OutIdx=t.OutIdx,t.Side=d.EdgeSide.esLeft,e.Side=d.EdgeSide.esRight,n=t,n.PrevInAEL==e?o=e.PrevInAEL:o=n.PrevInAEL):(i=this.AddOutPt(e,r),t.OutIdx=e.OutIdx,t.Side=d.EdgeSide.esRight,e.Side=d.EdgeSide.esLeft,n=e,n.PrevInAEL==t?o=t.PrevInAEL:o=n.PrevInAEL),o!==null&&o.OutIdx>=0&&d.Clipper.TopX(o,r.Y)==d.Clipper.TopX(n,r.Y)&&d.ClipperBase.SlopesEqual(n,o,this.m_UseFullRange)&&n.WindDelta!==0&&o.WindDelta!==0){var s=this.AddOutPt(o,r);this.AddJoin(i,s,n.Top)}return i};d.Clipper.prototype.CreateOutRec=function(){var t=new d.OutRec;return t.Idx=-1,t.IsHole=!1,t.IsOpen=!1,t.FirstLeft=null,t.Pts=null,t.BottomPt=null,t.PolyNode=null,this.m_PolyOuts.push(t),t.Idx=this.m_PolyOuts.length-1,t};d.Clipper.prototype.AddOutPt=function(t,e){var r=t.Side==d.EdgeSide.esLeft;if(t.OutIdx<0){var i=this.CreateOutRec();i.IsOpen=t.WindDelta===0;var n=new d.OutPt;return i.Pts=n,n.Idx=i.Idx,n.Pt.X=e.X,n.Pt.Y=e.Y,n.Next=n,n.Prev=n,i.IsOpen||this.SetHoleState(t,i),Vi&&(d.IntPoint.op_Equality(e,t.Bot)?(n.Pt.X=t.Bot.X,n.Pt.Y=t.Bot.Y,n.Pt.Z=t.Bot.Z):d.IntPoint.op_Equality(e,t.Top)?(n.Pt.X=t.Top.X,n.Pt.Y=t.Top.Y,n.Pt.Z=t.Top.Z):this.SetZ(n.Pt,t)),t.OutIdx=i.Idx,n}else{var i=this.m_PolyOuts[t.OutIdx],o=i.Pts;if(r&&d.IntPoint.op_Equality(e,o.Pt))return o;if(!r&&d.IntPoint.op_Equality(e,o.Prev.Pt))return o.Prev;var n=new d.OutPt;return n.Idx=i.Idx,n.Pt.X=e.X,n.Pt.Y=e.Y,n.Next=o,n.Prev=o.Prev,n.Prev.Next=n,o.Prev=n,r&&(i.Pts=n),Vi&&(d.IntPoint.op_Equality(e,t.Bot)?(n.Pt.X=t.Bot.X,n.Pt.Y=t.Bot.Y,n.Pt.Z=t.Bot.Z):d.IntPoint.op_Equality(e,t.Top)?(n.Pt.X=t.Top.X,n.Pt.Y=t.Top.Y,n.Pt.Z=t.Top.Z):this.SetZ(n.Pt,t)),n}};d.Clipper.prototype.SwapPoints=function(t,e){var r=new d.IntPoint(t.Value);t.Value.X=e.Value.X,t.Value.Y=e.Value.Y,e.Value.X=r.X,e.Value.Y=r.Y};d.Clipper.prototype.HorzSegmentsOverlap=function(t,e,r,i){return t.X>r.X==t.X<i.X||e.X>r.X==e.X<i.X||r.X>t.X==r.X<e.X||i.X>t.X==i.X<e.X||t.X==r.X&&e.X==i.X?!0:t.X==i.X&&e.X==r.X};d.Clipper.prototype.InsertPolyPtBetween=function(t,e,r){var i=new d.OutPt;return i.Pt.X=r.X,i.Pt.Y=r.Y,e==t.Next?(t.Next=i,e.Prev=i,i.Next=e,i.Prev=t):(e.Next=i,t.Prev=i,i.Next=t,i.Prev=e),i};d.Clipper.prototype.SetHoleState=function(t,e){for(var r=!1,i=t.PrevInAEL;i!==null;)i.OutIdx>=0&&i.WindDelta!=0&&(r=!r,e.FirstLeft===null&&(e.FirstLeft=this.m_PolyOuts[i.OutIdx])),i=i.PrevInAEL;r&&(e.IsHole=!0)};d.Clipper.prototype.GetDx=function(t,e){return t.Y==e.Y?d.ClipperBase.horizontal:(e.X-t.X)/(e.Y-t.Y)};d.Clipper.prototype.FirstIsBottomPt=function(t,e){for(var r=t.Prev;d.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Prev;var i=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=t.Next;d.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Next;var n=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=e.Prev;d.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Prev;var o=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=e.Next;d.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Next;var s=Math.abs(this.GetDx(e.Pt,r.Pt));return i>=o&&i>=s||n>=o&&n>=s};d.Clipper.prototype.GetBottomPt=function(t){for(var e=null,r=t.Next;r!=t;)r.Pt.Y>t.Pt.Y?(t=r,e=null):r.Pt.Y==t.Pt.Y&&r.Pt.X<=t.Pt.X&&(r.Pt.X<t.Pt.X?(e=null,t=r):r.Next!=t&&r.Prev!=t&&(e=r)),r=r.Next;if(e!==null)for(;e!=r;)for(this.FirstIsBottomPt(r,e)||(t=e),e=e.Next;d.IntPoint.op_Inequality(e.Pt,t.Pt);)e=e.Next;return t};d.Clipper.prototype.GetLowermostRec=function(t,e){t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts)),e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts));var r=t.BottomPt,i=e.BottomPt;return r.Pt.Y>i.Pt.Y?t:r.Pt.Y<i.Pt.Y?e:r.Pt.X<i.Pt.X?t:r.Pt.X>i.Pt.X||r.Next==r?e:i.Next==i||this.FirstIsBottomPt(r,i)?t:e};d.Clipper.prototype.Param1RightOfParam2=function(t,e){do if(t=t.FirstLeft,t==e)return!0;while(t!==null);return!1};d.Clipper.prototype.GetOutRec=function(t){for(var e=this.m_PolyOuts[t];e!=this.m_PolyOuts[e.Idx];)e=this.m_PolyOuts[e.Idx];return e};d.Clipper.prototype.AppendPolygon=function(t,e){var r=this.m_PolyOuts[t.OutIdx],i=this.m_PolyOuts[e.OutIdx],n;this.Param1RightOfParam2(r,i)?n=i:this.Param1RightOfParam2(i,r)?n=r:n=this.GetLowermostRec(r,i);var o=r.Pts,s=o.Prev,l=i.Pts,u=l.Prev,h;t.Side==d.EdgeSide.esLeft?(e.Side==d.EdgeSide.esLeft?(this.ReversePolyPtLinks(l),l.Next=o,o.Prev=l,s.Next=u,u.Prev=s,r.Pts=u):(u.Next=o,o.Prev=u,l.Prev=s,s.Next=l,r.Pts=l),h=d.EdgeSide.esLeft):(e.Side==d.EdgeSide.esRight?(this.ReversePolyPtLinks(l),s.Next=u,u.Prev=s,l.Next=o,o.Prev=l):(s.Next=l,l.Prev=s,o.Prev=u,u.Next=o),h=d.EdgeSide.esRight),r.BottomPt=null,n==i&&(i.FirstLeft!=r&&(r.FirstLeft=i.FirstLeft),r.IsHole=i.IsHole),i.Pts=null,i.BottomPt=null,i.FirstLeft=r;var m=t.OutIdx,f=e.OutIdx;t.OutIdx=-1,e.OutIdx=-1;for(var b=this.m_ActiveEdges;b!==null;){if(b.OutIdx==f){b.OutIdx=m,b.Side=h;break}b=b.NextInAEL}i.Idx=r.Idx};d.Clipper.prototype.ReversePolyPtLinks=function(t){if(t!==null){var e,r;e=t;do r=e.Next,e.Next=e.Prev,e.Prev=r,e=r;while(e!=t)}};d.Clipper.SwapSides=function(t,e){var r=t.Side;t.Side=e.Side,e.Side=r};d.Clipper.SwapPolyIndexes=function(t,e){var r=t.OutIdx;t.OutIdx=e.OutIdx,e.OutIdx=r};d.Clipper.prototype.IntersectEdges=function(t,e,r,i){var n=!i&&t.NextInLML===null&&t.Top.X==r.X&&t.Top.Y==r.Y,o=!i&&e.NextInLML===null&&e.Top.X==r.X&&e.Top.Y==r.Y,s=t.OutIdx>=0,l=e.OutIdx>=0;if(uy&&(t.WindDelta===0||e.WindDelta===0)){t.WindDelta===0&&e.WindDelta===0?(n||o)&&s&&l&&this.AddLocalMaxPoly(t,e,r):t.PolyTyp==e.PolyTyp&&t.WindDelta!=e.WindDelta&&this.m_ClipType==d.ClipType.ctUnion?t.WindDelta===0?l&&(this.AddOutPt(t,r),s&&(t.OutIdx=-1)):s&&(this.AddOutPt(e,r),l&&(e.OutIdx=-1)):t.PolyTyp!=e.PolyTyp&&(t.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=d.ClipType.ctUnion||e.WindCnt2===0)?(this.AddOutPt(t,r),s&&(t.OutIdx=-1)):e.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=d.ClipType.ctUnion||t.WindCnt2===0)&&(this.AddOutPt(e,r),l&&(e.OutIdx=-1))),n&&(t.OutIdx<0?this.DeleteFromAEL(t):d.Error("Error intersecting polylines")),o&&(e.OutIdx<0?this.DeleteFromAEL(e):d.Error("Error intersecting polylines"));return}if(t.PolyTyp==e.PolyTyp)if(this.IsEvenOddFillType(t)){var u=t.WindCnt;t.WindCnt=e.WindCnt,e.WindCnt=u}else t.WindCnt+e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt+=e.WindDelta,e.WindCnt-t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt-=t.WindDelta;else this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2+=e.WindDelta,this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2-=t.WindDelta;var h,m,f,b;t.PolyTyp==d.PolyType.ptSubject?(h=this.m_SubjFillType,f=this.m_ClipFillType):(h=this.m_ClipFillType,f=this.m_SubjFillType),e.PolyTyp==d.PolyType.ptSubject?(m=this.m_SubjFillType,b=this.m_ClipFillType):(m=this.m_ClipFillType,b=this.m_SubjFillType);var y,_;switch(h){case d.PolyFillType.pftPositive:y=t.WindCnt;break;case d.PolyFillType.pftNegative:y=-t.WindCnt;break;default:y=Math.abs(t.WindCnt);break}switch(m){case d.PolyFillType.pftPositive:_=e.WindCnt;break;case d.PolyFillType.pftNegative:_=-e.WindCnt;break;default:_=Math.abs(e.WindCnt);break}if(s&&l)n||o||y!==0&&y!=1||_!==0&&_!=1||t.PolyTyp!=e.PolyTyp&&this.m_ClipType!=d.ClipType.ctXor?this.AddLocalMaxPoly(t,e,r):(this.AddOutPt(t,r),this.AddOutPt(e,r),d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e));else if(s)(_===0||_==1)&&(this.AddOutPt(t,r),d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e));else if(l)(y===0||y==1)&&(this.AddOutPt(e,r),d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e));else if((y===0||y==1)&&(_===0||_==1)&&!n&&!o){var T,g;switch(f){case d.PolyFillType.pftPositive:T=t.WindCnt2;break;case d.PolyFillType.pftNegative:T=-t.WindCnt2;break;default:T=Math.abs(t.WindCnt2);break}switch(b){case d.PolyFillType.pftPositive:g=e.WindCnt2;break;case d.PolyFillType.pftNegative:g=-e.WindCnt2;break;default:g=Math.abs(e.WindCnt2);break}if(t.PolyTyp!=e.PolyTyp)this.AddLocalMinPoly(t,e,r);else if(y==1&&_==1)switch(this.m_ClipType){case d.ClipType.ctIntersection:T>0&&g>0&&this.AddLocalMinPoly(t,e,r);break;case d.ClipType.ctUnion:T<=0&&g<=0&&this.AddLocalMinPoly(t,e,r);break;case d.ClipType.ctDifference:(t.PolyTyp==d.PolyType.ptClip&&T>0&&g>0||t.PolyTyp==d.PolyType.ptSubject&&T<=0&&g<=0)&&this.AddLocalMinPoly(t,e,r);break;case d.ClipType.ctXor:this.AddLocalMinPoly(t,e,r);break}else d.Clipper.SwapSides(t,e)}n!=o&&(n&&t.OutIdx>=0||o&&e.OutIdx>=0)&&(d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e)),n&&this.DeleteFromAEL(t),o&&this.DeleteFromAEL(e)};d.Clipper.prototype.DeleteFromAEL=function(t){var e=t.PrevInAEL,r=t.NextInAEL;e===null&&r===null&&t!=this.m_ActiveEdges||(e!==null?e.NextInAEL=r:this.m_ActiveEdges=r,r!==null&&(r.PrevInAEL=e),t.NextInAEL=null,t.PrevInAEL=null)};d.Clipper.prototype.DeleteFromSEL=function(t){var e=t.PrevInSEL,r=t.NextInSEL;e===null&&r===null&&t!=this.m_SortedEdges||(e!==null?e.NextInSEL=r:this.m_SortedEdges=r,r!==null&&(r.PrevInSEL=e),t.NextInSEL=null,t.PrevInSEL=null)};d.Clipper.prototype.UpdateEdgeIntoAEL=function(t){t.NextInLML===null&&d.Error("UpdateEdgeIntoAEL: invalid call");var e=t.PrevInAEL,r=t.NextInAEL;return t.NextInLML.OutIdx=t.OutIdx,e!==null?e.NextInAEL=t.NextInLML:this.m_ActiveEdges=t.NextInLML,r!==null&&(r.PrevInAEL=t.NextInLML),t.NextInLML.Side=t.Side,t.NextInLML.WindDelta=t.WindDelta,t.NextInLML.WindCnt=t.WindCnt,t.NextInLML.WindCnt2=t.WindCnt2,t=t.NextInLML,t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.PrevInAEL=e,t.NextInAEL=r,d.ClipperBase.IsHorizontal(t)||this.InsertScanbeam(t.Top.Y),t};d.Clipper.prototype.ProcessHorizontals=function(t){for(var e=this.m_SortedEdges;e!==null;)this.DeleteFromSEL(e),this.ProcessHorizontal(e,t),e=this.m_SortedEdges};d.Clipper.prototype.GetHorzDirection=function(t,e){t.Bot.X<t.Top.X?(e.Left=t.Bot.X,e.Right=t.Top.X,e.Dir=d.Direction.dLeftToRight):(e.Left=t.Top.X,e.Right=t.Bot.X,e.Dir=d.Direction.dRightToLeft)};d.Clipper.prototype.PrepareHorzJoins=function(t,e){var r=this.m_PolyOuts[t.OutIdx].Pts;t.Side!=d.EdgeSide.esLeft&&(r=r.Prev),e&&(d.IntPoint.op_Equality(r.Pt,t.Top)?this.AddGhostJoin(r,t.Bot):this.AddGhostJoin(r,t.Top))};d.Clipper.prototype.ProcessHorizontal=function(t,e){var r={Dir:null,Left:null,Right:null};this.GetHorzDirection(t,r);for(var i=r.Dir,n=r.Left,o=r.Right,s=t,l=null;s.NextInLML!==null&&d.ClipperBase.IsHorizontal(s.NextInLML);)s=s.NextInLML;for(s.NextInLML===null&&(l=this.GetMaximaPair(s));;){for(var u=t==s,h=this.GetNextInAEL(t,i);h!==null&&!(h.Curr.X==t.Top.X&&t.NextInLML!==null&&h.Dx<t.NextInLML.Dx);){var m=this.GetNextInAEL(h,i);if(i==d.Direction.dLeftToRight&&h.Curr.X<=o||i==d.Direction.dRightToLeft&&h.Curr.X>=n){if(t.OutIdx>=0&&t.WindDelta!=0&&this.PrepareHorzJoins(t,e),h==l&&u){i==d.Direction.dLeftToRight?this.IntersectEdges(t,h,h.Top,!1):this.IntersectEdges(h,t,h.Top,!1),l.OutIdx>=0&&d.Error("ProcessHorizontal error");return}else if(i==d.Direction.dLeftToRight){var f=new d.IntPoint(h.Curr.X,t.Curr.Y);this.IntersectEdges(t,h,f,!0)}else{var f=new d.IntPoint(h.Curr.X,t.Curr.Y);this.IntersectEdges(h,t,f,!0)}this.SwapPositionsInAEL(t,h)}else if(i==d.Direction.dLeftToRight&&h.Curr.X>=o||i==d.Direction.dRightToLeft&&h.Curr.X<=n)break;h=m}if(t.OutIdx>=0&&t.WindDelta!==0&&this.PrepareHorzJoins(t,e),t.NextInLML!==null&&d.ClipperBase.IsHorizontal(t.NextInLML)){t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot);var r={Dir:i,Left:n,Right:o};this.GetHorzDirection(t,r),i=r.Dir,n=r.Left,o=r.Right}else break}if(t.NextInLML!==null)if(t.OutIdx>=0){var b=this.AddOutPt(t,t.Top);if(t=this.UpdateEdgeIntoAEL(t),t.WindDelta===0)return;var y=t.PrevInAEL,m=t.NextInAEL;if(y!==null&&y.Curr.X==t.Bot.X&&y.Curr.Y==t.Bot.Y&&y.WindDelta!==0&&y.OutIdx>=0&&y.Curr.Y>y.Top.Y&&d.ClipperBase.SlopesEqual(t,y,this.m_UseFullRange)){var _=this.AddOutPt(y,t.Bot);this.AddJoin(b,_,t.Top)}else if(m!==null&&m.Curr.X==t.Bot.X&&m.Curr.Y==t.Bot.Y&&m.WindDelta!==0&&m.OutIdx>=0&&m.Curr.Y>m.Top.Y&&d.ClipperBase.SlopesEqual(t,m,this.m_UseFullRange)){var _=this.AddOutPt(m,t.Bot);this.AddJoin(b,_,t.Top)}}else t=this.UpdateEdgeIntoAEL(t);else l!==null?l.OutIdx>=0?(i==d.Direction.dLeftToRight?this.IntersectEdges(t,l,t.Top,!1):this.IntersectEdges(l,t,t.Top,!1),l.OutIdx>=0&&d.Error("ProcessHorizontal error")):(this.DeleteFromAEL(t),this.DeleteFromAEL(l)):(t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t))};d.Clipper.prototype.GetNextInAEL=function(t,e){return e==d.Direction.dLeftToRight?t.NextInAEL:t.PrevInAEL};d.Clipper.prototype.IsMinima=function(t){return t!==null&&t.Prev.NextInLML!=t&&t.Next.NextInLML!=t};d.Clipper.prototype.IsMaxima=function(t,e){return t!==null&&t.Top.Y==e&&t.NextInLML===null};d.Clipper.prototype.IsIntermediate=function(t,e){return t.Top.Y==e&&t.NextInLML!==null};d.Clipper.prototype.GetMaximaPair=function(t){var e=null;return d.IntPoint.op_Equality(t.Next.Top,t.Top)&&t.Next.NextInLML===null?e=t.Next:d.IntPoint.op_Equality(t.Prev.Top,t.Top)&&t.Prev.NextInLML===null&&(e=t.Prev),e!==null&&(e.OutIdx==-2||e.NextInAEL==e.PrevInAEL&&!d.ClipperBase.IsHorizontal(e))?null:e};d.Clipper.prototype.ProcessIntersections=function(t,e){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(t,e),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch(r){this.m_SortedEdges=null,this.m_IntersectList.length=0,d.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};d.Clipper.prototype.BuildIntersectList=function(t,e){if(this.m_ActiveEdges!==null){var r=this.m_ActiveEdges;for(this.m_SortedEdges=r;r!==null;)r.PrevInSEL=r.PrevInAEL,r.NextInSEL=r.NextInAEL,r.Curr.X=d.Clipper.TopX(r,e),r=r.NextInAEL;for(var i=!0;i&&this.m_SortedEdges!==null;){for(i=!1,r=this.m_SortedEdges;r.NextInSEL!==null;){var n=r.NextInSEL,o=new d.IntPoint;if(r.Curr.X>n.Curr.X){!this.IntersectPoint(r,n,o)&&r.Curr.X>n.Curr.X+1&&d.Error("Intersection error"),o.Y>t&&(o.Y=t,Math.abs(r.Dx)>Math.abs(n.Dx)?o.X=d.Clipper.TopX(n,t):o.X=d.Clipper.TopX(r,t));var s=new d.IntersectNode;s.Edge1=r,s.Edge2=n,s.Pt.X=o.X,s.Pt.Y=o.Y,this.m_IntersectList.push(s),this.SwapPositionsInSEL(r,n),i=!0}else r=n}if(r.PrevInSEL!==null)r.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};d.Clipper.prototype.EdgesAdjacent=function(t){return t.Edge1.NextInSEL==t.Edge2||t.Edge1.PrevInSEL==t.Edge2};d.Clipper.IntersectNodeSort=function(t,e){return e.Pt.Y-t.Pt.Y};d.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var t=this.m_IntersectList.length,e=0;e<t;e++){if(!this.EdgesAdjacent(this.m_IntersectList[e])){for(var r=e+1;r<t&&!this.EdgesAdjacent(this.m_IntersectList[r]);)r++;if(r==t)return!1;var i=this.m_IntersectList[e];this.m_IntersectList[e]=this.m_IntersectList[r],this.m_IntersectList[r]=i}this.SwapPositionsInSEL(this.m_IntersectList[e].Edge1,this.m_IntersectList[e].Edge2)}return!0};d.Clipper.prototype.ProcessIntersectList=function(){for(var t=0,e=this.m_IntersectList.length;t<e;t++){var r=this.m_IntersectList[t];this.IntersectEdges(r.Edge1,r.Edge2,r.Pt,!0),this.SwapPositionsInAEL(r.Edge1,r.Edge2)}this.m_IntersectList.length=0};var JP=a(function(t){return t<0?Math.ceil(t-.5):Math.round(t)},"R1"),KP=a(function(t){return t<0?Math.ceil(t-.5):Math.floor(t+.5)},"R2"),QP=a(function(t){return t<0?-Math.round(Math.abs(t)):Math.round(t)},"R3"),eT=a(function(t){return t<0?(t-=.5,t<-2147483648?Math.ceil(t):t|0):(t+=.5,t>2147483647?Math.floor(t):t|0)},"R4");de.msie?d.Clipper.Round=JP:de.chromium?d.Clipper.Round=QP:de.safari?d.Clipper.Round=eT:d.Clipper.Round=KP;d.Clipper.TopX=function(t,e){return e==t.Top.Y?t.Top.X:t.Bot.X+d.Clipper.Round(t.Dx*(e-t.Bot.Y))};d.Clipper.prototype.IntersectPoint=function(t,e,r){r.X=0,r.Y=0;var i,n;if(d.ClipperBase.SlopesEqual(t,e,this.m_UseFullRange)||t.Dx==e.Dx)return e.Bot.Y>t.Bot.Y?(r.X=e.Bot.X,r.Y=e.Bot.Y):(r.X=t.Bot.X,r.Y=t.Bot.Y),!1;if(t.Delta.X===0)r.X=t.Bot.X,d.ClipperBase.IsHorizontal(e)?r.Y=e.Bot.Y:(n=e.Bot.Y-e.Bot.X/e.Dx,r.Y=d.Clipper.Round(r.X/e.Dx+n));else if(e.Delta.X===0)r.X=e.Bot.X,d.ClipperBase.IsHorizontal(t)?r.Y=t.Bot.Y:(i=t.Bot.Y-t.Bot.X/t.Dx,r.Y=d.Clipper.Round(r.X/t.Dx+i));else{i=t.Bot.X-t.Bot.Y*t.Dx,n=e.Bot.X-e.Bot.Y*e.Dx;var o=(n-i)/(t.Dx-e.Dx);r.Y=d.Clipper.Round(o),Math.abs(t.Dx)<Math.abs(e.Dx)?r.X=d.Clipper.Round(t.Dx*o+i):r.X=d.Clipper.Round(e.Dx*o+n)}if(r.Y<t.Top.Y||r.Y<e.Top.Y){if(t.Top.Y>e.Top.Y)return r.Y=t.Top.Y,r.X=d.Clipper.TopX(e,t.Top.Y),r.X<t.Top.X;r.Y=e.Top.Y,Math.abs(t.Dx)<Math.abs(e.Dx)?r.X=d.Clipper.TopX(t,r.Y):r.X=d.Clipper.TopX(e,r.Y)}return!0};d.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(t){for(var e=this.m_ActiveEdges;e!==null;){var r=this.IsMaxima(e,t);if(r){var i=this.GetMaximaPair(e);r=i===null||!d.ClipperBase.IsHorizontal(i)}if(r){var n=e.PrevInAEL;this.DoMaxima(e),n===null?e=this.m_ActiveEdges:e=n.NextInAEL}else{if(this.IsIntermediate(e,t)&&d.ClipperBase.IsHorizontal(e.NextInLML)?(e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot),this.AddEdgeToSEL(e)):(e.Curr.X=d.Clipper.TopX(e,t),e.Curr.Y=t),this.StrictlySimple){var n=e.PrevInAEL;if(e.OutIdx>=0&&e.WindDelta!==0&&n!==null&&n.OutIdx>=0&&n.Curr.X==e.Curr.X&&n.WindDelta!==0){var o=this.AddOutPt(n,e.Curr),s=this.AddOutPt(e,e.Curr);this.AddJoin(o,s,e.Curr)}}e=e.NextInAEL}}for(this.ProcessHorizontals(!0),e=this.m_ActiveEdges;e!==null;){if(this.IsIntermediate(e,t)){var o=null;e.OutIdx>=0&&(o=this.AddOutPt(e,e.Top)),e=this.UpdateEdgeIntoAEL(e);var n=e.PrevInAEL,l=e.NextInAEL;if(n!==null&&n.Curr.X==e.Bot.X&&n.Curr.Y==e.Bot.Y&&o!==null&&n.OutIdx>=0&&n.Curr.Y>n.Top.Y&&d.ClipperBase.SlopesEqual(e,n,this.m_UseFullRange)&&e.WindDelta!==0&&n.WindDelta!==0){var s=this.AddOutPt(n,e.Bot);this.AddJoin(o,s,e.Top)}else if(l!==null&&l.Curr.X==e.Bot.X&&l.Curr.Y==e.Bot.Y&&o!==null&&l.OutIdx>=0&&l.Curr.Y>l.Top.Y&&d.ClipperBase.SlopesEqual(e,l,this.m_UseFullRange)&&e.WindDelta!==0&&l.WindDelta!==0){var s=this.AddOutPt(l,e.Bot);this.AddJoin(o,s,e.Top)}}e=e.NextInAEL}};d.Clipper.prototype.DoMaxima=function(t){var e=this.GetMaximaPair(t);if(e===null){t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t);return}for(var r=t.NextInAEL,i=!0;r!==null&&r!=e;)this.IntersectEdges(t,r,t.Top,!0),this.SwapPositionsInAEL(t,r),r=t.NextInAEL;t.OutIdx==-1&&e.OutIdx==-1?(this.DeleteFromAEL(t),this.DeleteFromAEL(e)):t.OutIdx>=0&&e.OutIdx>=0?this.IntersectEdges(t,e,t.Top,!1):i&&t.WindDelta===0?(t.OutIdx>=0&&(this.AddOutPt(t,t.Top),t.OutIdx=-1),this.DeleteFromAEL(t),e.OutIdx>=0&&(this.AddOutPt(e,t.Top),e.OutIdx=-1),this.DeleteFromAEL(e)):d.Error("DoMaxima error")};d.Clipper.ReversePaths=function(t){for(var e=0,r=t.length;e<r;e++)t[e].reverse()};d.Clipper.Orientation=function(t){return d.Clipper.Area(t)>=0};d.Clipper.prototype.PointCount=function(t){if(t===null)return 0;var e=0,r=t;do e++,r=r.Next;while(r!=t);return e};d.Clipper.prototype.BuildResult=function(t){d.Clear(t);for(var e=0,r=this.m_PolyOuts.length;e<r;e++){var i=this.m_PolyOuts[e];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;t.push(s)}}}};d.Clipper.prototype.BuildResult2=function(t){t.Clear();for(var e=0,r=this.m_PolyOuts.length;e<r;e++){var i=this.m_PolyOuts[e],n=this.PointCount(i.Pts);if(!(i.IsOpen&&n<2||!i.IsOpen&&n<3)){this.FixHoleLinkage(i);var o=new d.PolyNode;t.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 e=0,r=this.m_PolyOuts.length;e<r;e++){var i=this.m_PolyOuts[e];i.PolyNode!==null&&(i.IsOpen?(i.PolyNode.IsOpen=!0,t.AddChild(i.PolyNode)):i.FirstLeft!==null&&i.FirstLeft.PolyNode!=null?i.FirstLeft.PolyNode.AddChild(i.PolyNode):t.AddChild(i.PolyNode))}};d.Clipper.prototype.FixupOutPolygon=function(t){var e=null;t.BottomPt=null;for(var r=t.Pts;;){if(r.Prev==r||r.Prev==r.Next){this.DisposeOutPts(r),t.Pts=null;return}if(d.IntPoint.op_Equality(r.Pt,r.Next.Pt)||d.IntPoint.op_Equality(r.Pt,r.Prev.Pt)||d.ClipperBase.SlopesEqual(r.Prev.Pt,r.Pt,r.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(r.Prev.Pt,r.Pt,r.Next.Pt))){e=null;var i=r;r.Prev.Next=r.Next,r.Next.Prev=r.Prev,r=r.Prev,i=null}else{if(r==e)break;e===null&&(e=r),r=r.Next}}t.Pts=r};d.Clipper.prototype.DupOutPt=function(t,e){var r=new d.OutPt;return r.Pt.X=t.Pt.X,r.Pt.Y=t.Pt.Y,r.Idx=t.Idx,e?(r.Next=t.Next,r.Prev=t,t.Next.Prev=r,t.Next=r):(r.Prev=t.Prev,r.Next=t,t.Prev.Next=r,t.Prev=r),r};d.Clipper.prototype.GetOverlap=function(t,e,r,i,n){return t<e?r<i?(n.Left=Math.max(t,r),n.Right=Math.min(e,i)):(n.Left=Math.max(t,i),n.Right=Math.min(e,r)):r<i?(n.Left=Math.max(e,r),n.Right=Math.min(t,i)):(n.Left=Math.max(e,i),n.Right=Math.min(t,r)),n.Left<n.Right};d.Clipper.prototype.JoinHorz=function(t,e,r,i,n,o){var s=t.Pt.X>e.Pt.X?d.Direction.dRightToLeft:d.Direction.dLeftToRight,l=r.Pt.X>i.Pt.X?d.Direction.dRightToLeft:d.Direction.dLeftToRight;if(s==l)return!1;if(s==d.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),e=this.DupOutPt(t,!o),d.IntPoint.op_Inequality(e.Pt,n)&&(t=e,t.Pt.X=n.X,t.Pt.Y=n.Y,e=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),e=this.DupOutPt(t,o),d.IntPoint.op_Inequality(e.Pt,n)&&(t=e,t.Pt.X=n.X,t.Pt.Y=n.Y,e=this.DupOutPt(t,o))}if(l==d.Direction.dLeftToRight){for(;r.Next.Pt.X<=n.X&&r.Next.Pt.X>=r.Pt.X&&r.Next.Pt.Y==n.Y;)r=r.Next;o&&r.Pt.X!=n.X&&(r=r.Next),i=this.DupOutPt(r,!o),d.IntPoint.op_Inequality(i.Pt,n)&&(r=i,r.Pt.X=n.X,r.Pt.Y=n.Y,i=this.DupOutPt(r,!o))}else{for(;r.Next.Pt.X>=n.X&&r.Next.Pt.X<=r.Pt.X&&r.Next.Pt.Y==n.Y;)r=r.Next;!o&&r.Pt.X!=n.X&&(r=r.Next),i=this.DupOutPt(r,o),d.IntPoint.op_Inequality(i.Pt,n)&&(r=i,r.Pt.X=n.X,r.Pt.Y=n.Y,i=this.DupOutPt(r,o))}return s==d.Direction.dLeftToRight==o?(t.Prev=r,r.Next=t,e.Next=i,i.Prev=e):(t.Next=r,r.Prev=t,e.Prev=i,i.Next=e),!0};d.Clipper.prototype.JoinPoints=function(t,e,r){var i=t.OutPt1,n=new d.OutPt,o=t.OutPt2,s=new d.OutPt,l=t.OutPt1.Pt.Y==t.OffPt.Y;if(l&&d.IntPoint.op_Equality(t.OffPt,t.OutPt1.Pt)&&d.IntPoint.op_Equality(t.OffPt,t.OutPt2.Pt)){for(n=t.OutPt1.Next;n!=i&&d.IntPoint.op_Equality(n.Pt,t.OffPt);)n=n.Next;var u=n.Pt.Y>t.OffPt.Y;for(s=t.OutPt2.Next;s!=o&&d.IntPoint.op_Equality(s.Pt,t.OffPt);)s=s.Next;var h=s.Pt.Y>t.OffPt.Y;return u==h?!1:u?(n=this.DupOutPt(i,!1),s=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=s,s.Prev=n,t.OutPt1=i,t.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,t.OutPt1=i,t.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,b=m.Right,y=new d.IntPoint,_;return i.Pt.X>=f&&i.Pt.X<=b?(y.X=i.Pt.X,y.Y=i.Pt.Y,_=i.Pt.X>n.Pt.X):o.Pt.X>=f&&o.Pt.X<=b?(y.X=o.Pt.X,y.Y=o.Pt.Y,_=o.Pt.X>s.Pt.X):n.Pt.X>=f&&n.Pt.X<=b?(y.X=n.Pt.X,y.Y=n.Pt.Y,_=n.Pt.X>i.Pt.X):(y.X=s.Pt.X,y.Y=s.Pt.Y,_=s.Pt.X>o.Pt.X),t.OutPt1=i,t.OutPt2=o,this.JoinHorz(i,n,o,s,y,_)}else{for(n=i.Next;d.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Next;var T=n.Pt.Y>i.Pt.Y||!d.ClipperBase.SlopesEqual(i.Pt,n.Pt,t.OffPt,this.m_UseFullRange);if(T){for(n=i.Prev;d.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Prev;if(n.Pt.Y>i.Pt.Y||!d.ClipperBase.SlopesEqual(i.Pt,n.Pt,t.OffPt,this.m_UseFullRange))return!1}for(s=o.Next;d.IntPoint.op_Equality(s.Pt,o.Pt)&&s!=o;)s=s.Next;var g=s.Pt.Y>o.Pt.Y||!d.ClipperBase.SlopesEqual(o.Pt,s.Pt,t.OffPt,this.m_UseFullRange);if(g){for(s=o.Prev;d.IntPoint.op_Equality(s.Pt,o.Pt)&&s!=o;)s=s.Prev;if(s.Pt.Y>o.Pt.Y||!d.ClipperBase.SlopesEqual(o.Pt,s.Pt,t.OffPt,this.m_UseFullRange))return!1}return n==i||s==o||n==s||e==r&&T==g?!1:T?(n=this.DupOutPt(i,!1),s=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=s,s.Prev=n,t.OutPt1=i,t.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,t.OutPt1=i,t.OutPt2=n,!0)}};d.Clipper.GetBounds=function(t){for(var e=0,r=t.length;e<r&&t[e].length==0;)e++;if(e==r)return new d.IntRect(0,0,0,0);var i=new d.IntRect;for(i.left=t[e][0].X,i.right=i.left,i.top=t[e][0].Y,i.bottom=i.top;e<r;e++)for(var n=0,o=t[e].length;n<o;n++)t[e][n].X<i.left?i.left=t[e][n].X:t[e][n].X>i.right&&(i.right=t[e][n].X),t[e][n].Y<i.top?i.top=t[e][n].Y:t[e][n].Y>i.bottom&&(i.bottom=t[e][n].Y);return i};d.Clipper.prototype.GetBounds2=function(t){var e=t,r=new d.IntRect;for(r.left=t.Pt.X,r.right=t.Pt.X,r.top=t.Pt.Y,r.bottom=t.Pt.Y,t=t.Next;t!=e;)t.Pt.X<r.left&&(r.left=t.Pt.X),t.Pt.X>r.right&&(r.right=t.Pt.X),t.Pt.Y<r.top&&(r.top=t.Pt.Y),t.Pt.Y>r.bottom&&(r.bottom=t.Pt.Y),t=t.Next;return r};d.Clipper.PointInPolygon=function(t,e){var r=0,i=e.length;if(i<3)return 0;for(var n=e[0],o=1;o<=i;++o){var s=o==i?e[0]:e[o];if(s.Y==t.Y&&(s.X==t.X||n.Y==t.Y&&s.X>t.X==n.X<t.X))return-1;if(n.Y<t.Y!=s.Y<t.Y){if(n.X>=t.X)if(s.X>t.X)r=1-r;else{var l=(n.X-t.X)*(s.Y-t.Y)-(s.X-t.X)*(n.Y-t.Y);if(l==0)return-1;l>0==s.Y>n.Y&&(r=1-r)}else if(s.X>t.X){var l=(n.X-t.X)*(s.Y-t.Y)-(s.X-t.X)*(n.Y-t.Y);if(l==0)return-1;l>0==s.Y>n.Y&&(r=1-r)}}n=s}return r};d.Clipper.prototype.PointInPolygon=function(t,e){for(var r=0,i=e;;){var n=e.Pt.X,o=e.Pt.Y,s=e.Next.Pt.X,l=e.Next.Pt.Y;if(l==t.Y&&(s==t.X||o==t.Y&&s>t.X==n<t.X))return-1;if(o<t.Y!=l<t.Y){if(n>=t.X)if(s>t.X)r=1-r;else{var u=(n-t.X)*(l-t.Y)-(s-t.X)*(o-t.Y);if(u==0)return-1;u>0==l>o&&(r=1-r)}else if(s>t.X){var u=(n-t.X)*(l-t.Y)-(s-t.X)*(o-t.Y);if(u==0)return-1;u>0==l>o&&(r=1-r)}}if(e=e.Next,i==e)break}return r};d.Clipper.prototype.Poly2ContainsPoly1=function(t,e){var r=t;do{var i=this.PointInPolygon(r.Pt,e);if(i>=0)return i!=0;r=r.Next}while(r!=t);return!0};d.Clipper.prototype.FixupFirstLefts1=function(t,e){for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=this.m_PolyOuts[r];n.Pts!==null&&n.FirstLeft==t&&this.Poly2ContainsPoly1(n.Pts,e.Pts)&&(n.FirstLeft=e)}};d.Clipper.prototype.FixupFirstLefts2=function(t,e){for(var r=0,i=this.m_PolyOuts,n=i.length,o=i[r];r<n;r++,o=i[r])o.FirstLeft==t&&(o.FirstLeft=e)};d.Clipper.ParseFirstLeft=function(t){for(;t!=null&&t.Pts==null;)t=t.FirstLeft;return t};d.Clipper.prototype.JoinCommonEdges=function(){for(var t=0,e=this.m_Joins.length;t<e;t++){var r=this.m_Joins[t],i=this.GetOutRec(r.OutPt1.Idx),n=this.GetOutRec(r.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(r,i,n))if(i==n){if(i.Pts=r.OutPt1,i.BottomPt=null,n=this.CreateOutRec(),n.Pts=r.OutPt2,this.UpdateOutPtIdxs(n),this.m_UsingPolyTree)for(var s=0,l=this.m_PolyOuts.length;s<l-1;s++){var u=this.m_PolyOuts[s];u.Pts==null||d.Clipper.ParseFirstLeft(u.FirstLeft)!=i||u.IsHole==i.IsHole||this.Poly2ContainsPoly1(u.Pts,r.OutPt2)&&(u.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)}}};d.Clipper.prototype.UpdateOutPtIdxs=function(t){var e=t.Pts;do e.Idx=t.Idx,e=e.Prev;while(e!=t.Pts)};d.Clipper.prototype.DoSimplePolygons=function(){for(var t=0;t<this.m_PolyOuts.length;){var e=this.m_PolyOuts[t++],r=e.Pts;if(r!==null)do{for(var i=r.Next;i!=e.Pts;){if(d.IntPoint.op_Equality(r.Pt,i.Pt)&&i.Next!=r&&i.Prev!=r){var n=r.Prev,o=i.Prev;r.Prev=o,o.Next=r,i.Prev=n,n.Next=i,e.Pts=r;var s=this.CreateOutRec();s.Pts=i,this.UpdateOutPtIdxs(s),this.Poly2ContainsPoly1(s.Pts,e.Pts)?(s.IsHole=!e.IsHole,s.FirstLeft=e):this.Poly2ContainsPoly1(e.Pts,s.Pts)?(s.IsHole=e.IsHole,e.IsHole=!s.IsHole,s.FirstLeft=e.FirstLeft,e.FirstLeft=s):(s.IsHole=e.IsHole,s.FirstLeft=e.FirstLeft),i=r}i=i.Next}r=r.Next}while(r!=e.Pts)}};d.Clipper.Area=function(t){var e=t.length;if(e<3)return 0;for(var r=0,i=0,n=e-1;i<e;++i)r+=(t[n].X+t[i].X)*(t[n].Y-t[i].Y),n=i;return-r*.5};d.Clipper.prototype.Area=function(t){var e=t.Pts;if(e==null)return 0;var r=0;do r=r+(e.Prev.Pt.X+e.Pt.X)*(e.Prev.Pt.Y-e.Pt.Y),e=e.Next;while(e!=t.Pts);return r*.5};hy&&(d.Clipper.OffsetPaths=function(t,e,r,i,n){var o=new d.Paths,s=new d.ClipperOffset(n,n);return s.AddPaths(t,r,i),s.Execute(o,e),o});d.Clipper.SimplifyPolygon=function(t,e){var r=new Array,i=new d.Clipper(0);return i.StrictlySimple=!0,i.AddPath(t,d.PolyType.ptSubject,!0),i.Execute(d.ClipType.ctUnion,r,e,e),r};d.Clipper.SimplifyPolygons=function(t,e){typeof e>"u"&&(e=d.PolyFillType.pftEvenOdd);var r=new Array,i=new d.Clipper(0);return i.StrictlySimple=!0,i.AddPaths(t,d.PolyType.ptSubject,!0),i.Execute(d.ClipType.ctUnion,r,e,e),r};d.Clipper.DistanceSqrd=function(t,e){var r=t.X-e.X,i=t.Y-e.Y;return r*r+i*i};d.Clipper.DistanceFromLineSqrd=function(t,e,r){var i=e.Y-r.Y,n=r.X-e.X,o=i*e.X+n*e.Y;return o=i*t.X+n*t.Y-o,o*o/(i*i+n*n)};d.Clipper.SlopesNearCollinear=function(t,e,r,i){return d.Clipper.DistanceFromLineSqrd(e,t,r)<i};d.Clipper.PointsAreClose=function(t,e,r){var i=t.X-e.X,n=t.Y-e.Y;return i*i+n*n<=r};d.Clipper.ExcludeOp=function(t){var e=t.Prev;return e.Next=t.Next,t.Next.Prev=e,e.Idx=0,e};d.Clipper.CleanPolygon=function(t,e){typeof e>"u"&&(e=1.415);var r=t.length;if(r==0)return new Array;for(var i=new Array(r),n=0;n<r;++n)i[n]=new d.OutPt;for(var n=0;n<r;++n)i[n].Pt=t[n],i[n].Next=i[(n+1)%r],i[n].Next.Prev=i[n],i[n].Idx=0;for(var o=e*e,s=i[0];s.Idx==0&&s.Next!=s.Prev;)d.Clipper.PointsAreClose(s.Pt,s.Prev.Pt,o)?(s=d.Clipper.ExcludeOp(s),r--):d.Clipper.PointsAreClose(s.Prev.Pt,s.Next.Pt,o)?(d.Clipper.ExcludeOp(s.Next),s=d.Clipper.ExcludeOp(s),r-=2):d.Clipper.SlopesNearCollinear(s.Prev.Pt,s.Pt,s.Next.Pt,o)?(s=d.Clipper.ExcludeOp(s),r--):(s.Idx=1,s=s.Next);r<3&&(r=0);for(var l=new Array(r),n=0;n<r;++n)l[n]=new d.IntPoint(s.Pt),s=s.Next;return i=null,l};d.Clipper.CleanPolygons=function(t,e){for(var r=new Array(t.length),i=0,n=t.length;i<n;i++)r[i]=d.Clipper.CleanPolygon(t[i],e);return r};d.Clipper.Minkowski=function(t,e,r,i){var n=i?1:0,o=t.length,s=e.length,l=new Array;if(r)for(var u=0;u<s;u++){for(var h=new Array(o),m=0,f=t.length,b=t[m];m<f;m++,b=t[m])h[m]=new d.IntPoint(e[u].X+b.X,e[u].Y+b.Y);l.push(h)}else for(var u=0;u<s;u++){for(var h=new Array(o),m=0,f=t.length,b=t[m];m<f;m++,b=t[m])h[m]=new d.IntPoint(e[u].X-b.X,e[u].Y-b.Y);l.push(h)}for(var y=new Array,u=0;u<s-1+n;u++)for(var m=0;m<o;m++){var _=new Array;_.push(l[u%s][m%o]),_.push(l[(u+1)%s][m%o]),_.push(l[(u+1)%s][(m+1)%o]),_.push(l[u%s][(m+1)%o]),d.Clipper.Orientation(_)||_.reverse(),y.push(_)}var T=new d.Clipper(0);return T.AddPaths(y,d.PolyType.ptSubject,!0),T.Execute(d.ClipType.ctUnion,l,d.PolyFillType.pftNonZero,d.PolyFillType.pftNonZero),l};d.Clipper.MinkowskiSum=function(){var t=arguments,e=t.length;if(e==3){var r=t[0],i=t[1],n=t[2];return d.Clipper.Minkowski(r,i,!0,n)}else if(e==4){for(var r=t[0],o=t[1],s=t[2],n=t[3],l=new d.Clipper,u,h=0,m=o.length;h<m;++h){var u=d.Clipper.Minkowski(r,o[h],!0,n);l.AddPaths(u,d.PolyType.ptSubject,!0)}n&&l.AddPaths(o,d.PolyType.ptClip,!0);var f=new d.Paths;return l.Execute(d.ClipType.ctUnion,f,s,s),f}};d.Clipper.MinkowskiDiff=function(t,e,r){return d.Clipper.Minkowski(t,e,!1,r)};d.Clipper.PolyTreeToPaths=function(t){var e=new Array;return d.Clipper.AddPolyNodeToPaths(t,d.Clipper.NodeType.ntAny,e),e};d.Clipper.AddPolyNodeToPaths=function(t,e,r){var i=!0;switch(e){case d.Clipper.NodeType.ntOpen:return;case d.Clipper.NodeType.ntClosed:i=!t.IsOpen;break;default:break}t.m_polygon.length>0&&i&&r.push(t.m_polygon);for(var n=0,o=t.Childs(),s=o.length,l=o[n];n<s;n++,l=o[n])d.Clipper.AddPolyNodeToPaths(l,e,r)};d.Clipper.OpenPathsFromPolyTree=function(t){for(var e=new d.Paths,r=0,i=t.ChildCount();r<i;r++)t.Childs()[r].IsOpen&&e.push(t.Childs()[r].m_polygon);return e};d.Clipper.ClosedPathsFromPolyTree=function(t){var e=new d.Paths;return d.Clipper.AddPolyNodeToPaths(t,d.Clipper.NodeType.ntClosed,e),e};cl(d.Clipper,d.ClipperBase);d.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};d.ClipperOffset=function(t,e){typeof t>"u"&&(t=2),typeof e>"u"&&(e=d.ClipperOffset.def_arc_tolerance),this.m_destPolys=new d.Paths,this.m_srcPoly=new d.Path,this.m_destPoly=new d.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 d.IntPoint,this.m_polyNodes=new d.PolyNode,this.MiterLimit=t,this.ArcTolerance=e,this.m_lowest.X=-1};d.ClipperOffset.two_pi=6.28318530717959;d.ClipperOffset.def_arc_tolerance=.25;d.ClipperOffset.prototype.Clear=function(){d.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};d.ClipperOffset.Round=d.Clipper.Round;d.ClipperOffset.prototype.AddPath=function(t,e,r){var i=t.length-1;if(!(i<0)){var n=new d.PolyNode;if(n.m_jointype=e,n.m_endtype=r,r==d.EndType.etClosedLine||r==d.EndType.etClosedPolygon)for(;i>0&&d.IntPoint.op_Equality(t[0],t[i]);)i--;n.m_polygon.push(t[0]);for(var o=0,s=0,l=1;l<=i;l++)d.IntPoint.op_Inequality(n.m_polygon[o],t[l])&&(o++,n.m_polygon.push(t[l]),(t[l].Y>n.m_polygon[s].Y||t[l].Y==n.m_polygon[s].Y&&t[l].X<n.m_polygon[s].X)&&(s=o));if(!(r==d.EndType.etClosedPolygon&&o<2||r!=d.EndType.etClosedPolygon&&o<0)&&(this.m_polyNodes.AddChild(n),r==d.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new d.IntPoint(0,s);else{var u=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[s].Y>u.Y||n.m_polygon[s].Y==u.Y&&n.m_polygon[s].X<u.X)&&(this.m_lowest=new d.IntPoint(this.m_polyNodes.ChildCount()-1,s))}}};d.ClipperOffset.prototype.AddPaths=function(t,e,r){for(var i=0,n=t.length;i<n;i++)this.AddPath(t[i],e,r)};d.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!d.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];(e.m_endtype==d.EndType.etClosedPolygon||e.m_endtype==d.EndType.etClosedLine&&d.Clipper.Orientation(e.m_polygon))&&e.m_polygon.reverse()}else for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];e.m_endtype==d.EndType.etClosedLine&&!d.Clipper.Orientation(e.m_polygon)&&e.m_polygon.reverse()}};d.ClipperOffset.GetUnitNormal=function(t,e){var r=e.X-t.X,i=e.Y-t.Y;if(r==0&&i==0)return new d.DoublePoint(0,0);var n=1/Math.sqrt(r*r+i*i);return r*=n,i*=n,new d.DoublePoint(i,-r)};d.ClipperOffset.prototype.DoOffset=function(t){if(this.m_destPolys=new Array,this.m_delta=t,d.ClipperBase.near_zero(t)){for(var e=0;e<this.m_polyNodes.ChildCount();e++){var r=this.m_polyNodes.Childs()[e];r.m_endtype==d.EndType.etClosedPolygon&&this.m_destPolys.push(r.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var i;this.ArcTolerance<=0?i=d.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(t)*d.ClipperOffset.def_arc_tolerance?i=Math.abs(t)*d.ClipperOffset.def_arc_tolerance:i=this.ArcTolerance;var n=3.14159265358979/Math.acos(1-i/Math.abs(t));this.m_sin=Math.sin(d.ClipperOffset.two_pi/n),this.m_cos=Math.cos(d.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/d.ClipperOffset.two_pi,t<0&&(this.m_sin=-this.m_sin);for(var e=0;e<this.m_polyNodes.ChildCount();e++){var r=this.m_polyNodes.Childs()[e];this.m_srcPoly=r.m_polygon;var o=this.m_srcPoly.length;if(!(o==0||t<=0&&(o<3||r.m_endtype!=d.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,o==1){if(r.m_jointype==d.JoinType.jtRound)for(var s=1,l=0,u=1;u<=n;u++){this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[0].X+s*t),d.ClipperOffset.Round(this.m_srcPoly[0].Y+l*t)));var h=s;s=s*this.m_cos-this.m_sin*l,l=h*this.m_sin+l*this.m_cos}else for(var s=-1,l=-1,u=0;u<4;++u)this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[0].X+s*t),d.ClipperOffset.Round(this.m_srcPoly[0].Y+l*t))),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 u=0;u<o-1;u++)this.m_normals.push(d.ClipperOffset.GetUnitNormal(this.m_srcPoly[u],this.m_srcPoly[u+1]));if(r.m_endtype==d.EndType.etClosedLine||r.m_endtype==d.EndType.etClosedPolygon?this.m_normals.push(d.ClipperOffset.GetUnitNormal(this.m_srcPoly[o-1],this.m_srcPoly[0])):this.m_normals.push(new d.DoublePoint(this.m_normals[o-2])),r.m_endtype==d.EndType.etClosedPolygon){for(var m=o-1,u=0;u<o;u++)m=this.OffsetPoint(u,m,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(r.m_endtype==d.EndType.etClosedLine){for(var m=o-1,u=0;u<o;u++)m=this.OffsetPoint(u,m,r.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var f=this.m_normals[o-1],u=o-1;u>0;u--)this.m_normals[u]=new d.DoublePoint(-this.m_normals[u-1].X,-this.m_normals[u-1].Y);this.m_normals[0]=new d.DoublePoint(-f.X,-f.Y),m=0;for(var u=o-1;u>=0;u--)m=this.OffsetPoint(u,m,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var m=0,u=1;u<o-1;++u)m=this.OffsetPoint(u,m,r.m_jointype);var b;if(r.m_endtype==d.EndType.etOpenButt){var u=o-1;b=new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[u].X+this.m_normals[u].X*t),d.ClipperOffset.Round(this.m_srcPoly[u].Y+this.m_normals[u].Y*t)),this.m_destPoly.push(b),b=new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[u].X-this.m_normals[u].X*t),d.ClipperOffset.Round(this.m_srcPoly[u].Y-this.m_normals[u].Y*t)),this.m_destPoly.push(b)}else{var u=o-1;m=o-2,this.m_sinA=0,this.m_normals[u]=new d.DoublePoint(-this.m_normals[u].X,-this.m_normals[u].Y),r.m_endtype==d.EndType.etOpenSquare?this.DoSquare(u,m):this.DoRound(u,m)}for(var u=o-1;u>0;u--)this.m_normals[u]=new d.DoublePoint(-this.m_normals[u-1].X,-this.m_normals[u-1].Y);this.m_normals[0]=new d.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),m=o-1;for(var u=m-1;u>0;--u)m=this.OffsetPoint(u,m,r.m_jointype);r.m_endtype==d.EndType.etOpenButt?(b=new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*t),d.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*t)),this.m_destPoly.push(b),b=new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*t),d.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*t)),this.m_destPoly.push(b)):(m=1,this.m_sinA=0,r.m_endtype==d.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};d.ClipperOffset.prototype.Execute=function(){var t=arguments,e=t[0]instanceof d.PolyTree;if(e){var r=t[0],i=t[1];r.Clear(),this.FixOrientations(),this.DoOffset(i);var n=new d.Clipper(0);if(n.AddPaths(this.m_destPolys,d.PolyType.ptSubject,!0),i>0)n.Execute(d.ClipType.ctUnion,r,d.PolyFillType.pftPositive,d.PolyFillType.pftPositive);else{var o=d.Clipper.GetBounds(this.m_destPolys),s=new d.Path;if(s.push(new d.IntPoint(o.left-10,o.bottom+10)),s.push(new d.IntPoint(o.right+10,o.bottom+10)),s.push(new d.IntPoint(o.right+10,o.top-10)),s.push(new d.IntPoint(o.left-10,o.top-10)),n.AddPath(s,d.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(d.ClipType.ctUnion,r,d.PolyFillType.pftNegative,d.PolyFillType.pftNegative),r.ChildCount()==1&&r.Childs()[0].ChildCount()>0){var l=r.Childs()[0];r.Childs()[0]=l.Childs()[0];for(var u=1;u<l.ChildCount();u++)r.AddChild(l.Childs()[u])}else r.Clear()}}else{var r=t[0],i=t[1];d.Clear(r),this.FixOrientations(),this.DoOffset(i);var n=new d.Clipper(0);if(n.AddPaths(this.m_destPolys,d.PolyType.ptSubject,!0),i>0)n.Execute(d.ClipType.ctUnion,r,d.PolyFillType.pftPositive,d.PolyFillType.pftPositive);else{var o=d.Clipper.GetBounds(this.m_destPolys),s=new d.Path;s.push(new d.IntPoint(o.left-10,o.bottom+10)),s.push(new d.IntPoint(o.right+10,o.bottom+10)),s.push(new d.IntPoint(o.right+10,o.top-10)),s.push(new d.IntPoint(o.left-10,o.top-10)),n.AddPath(s,d.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(d.ClipType.ctUnion,r,d.PolyFillType.pftNegative,d.PolyFillType.pftNegative),r.length>0&&r.splice(0,1)}}};d.ClipperOffset.prototype.OffsetPoint=function(t,e,r){if(this.m_sinA=this.m_normals[e].X*this.m_normals[t].Y-this.m_normals[t].X*this.m_normals[e].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return e;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 d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[e].X*this.m_delta),d.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[e].Y*this.m_delta))),this.m_destPoly.push(new d.IntPoint(this.m_srcPoly[t])),this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta),d.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta)));else switch(r){case d.JoinType.jtMiter:{var i=1+(this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y);i>=this.m_miterLim?this.DoMiter(t,e,i):this.DoSquare(t,e);break}case d.JoinType.jtSquare:this.DoSquare(t,e);break;case d.JoinType.jtRound:this.DoRound(t,e);break}return e=t,e};d.ClipperOffset.prototype.DoSquare=function(t,e){var r=Math.tan(Math.atan2(this.m_sinA,this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y)/4);this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[e].X-this.m_normals[e].Y*r)),d.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[e].Y+this.m_normals[e].X*r)))),this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[t].X+this.m_normals[t].Y*r)),d.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[t].Y-this.m_normals[t].X*r))))};d.ClipperOffset.prototype.DoMiter=function(t,e,r){var i=this.m_delta/r;this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+(this.m_normals[e].X+this.m_normals[t].X)*i),d.ClipperOffset.Round(this.m_srcPoly[t].Y+(this.m_normals[e].Y+this.m_normals[t].Y)*i)))};d.ClipperOffset.prototype.DoRound=function(t,e){for(var r=Math.atan2(this.m_sinA,this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y),i=d.Cast_Int32(d.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(r))),n=this.m_normals[e].X,o=this.m_normals[e].Y,s,l=0;l<i;++l)this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+n*this.m_delta),d.ClipperOffset.Round(this.m_srcPoly[t].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 d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta),d.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta)))};d.Error=function(t){try{throw new Error(t)}catch(e){alert(e.message)}};d.JS={};d.JS.AreaOfPolygon=function(t,e){return e||(e=1),d.Clipper.Area(t)/(e*e)};d.JS.AreaOfPolygons=function(t,e){e||(e=1);for(var r=0,i=0;i<t.length;i++)r+=d.Clipper.Area(t[i]);return r/(e*e)};d.JS.BoundsOfPath=function(t,e){return d.JS.BoundsOfPaths([t],e)};d.JS.BoundsOfPaths=function(t,e){e||(e=1);var r=d.Clipper.GetBounds(t);return r.left/=e,r.bottom/=e,r.right/=e,r.top/=e,r};d.JS.Clean=function(i,e){if(!(i instanceof Array))return[];var r=i[0]instanceof Array,i=d.JS.Clone(i);if(typeof e!="number"||e===null)return d.Error("Delta is not a number in Clean()."),i;if(i.length===0||i.length==1&&i[0].length===0||e<0)return i;r||(i=[i]);for(var n=i.length,o,s,l,u,h,m,f,b=[],y=0;y<n;y++)if(s=i[y],o=s.length,o!==0){if(o<3){l=s,b.push(l);continue}for(l=s,u=e*e,h=s[0],m=1,f=1;f<o;f++)(s[f].X-h.X)*(s[f].X-h.X)+(s[f].Y-h.Y)*(s[f].Y-h.Y)<=u||(l[m]=s[f],h=s[f],m++);h=s[m-1],(s[0].X-h.X)*(s[0].X-h.X)+(s[0].Y-h.Y)*(s[0].Y-h.Y)<=u&&m--,m<o&&l.splice(m,o-m),l.length&&b.push(l)}return!r&&b.length?b=b[0]:!r&&b.length===0?b=[]:r&&b.length===0&&(b=[[]]),b};d.JS.Clone=function(t){if(!(t instanceof Array))return[];if(t.length===0)return[];if(t.length==1&&t[0].length===0)return[[]];var e=t[0]instanceof Array;e||(t=[t]);var r=t.length,i,n,o,s,l=new Array(r);for(n=0;n<r;n++){for(i=t[n].length,s=new Array(i),o=0;o<i;o++)s[o]={X:t[n][o].X,Y:t[n][o].Y};l[n]=s}return e||(l=l[0]),l};d.JS.Lighten=function(t,e){if(!(t instanceof Array))return[];if(typeof e!="number"||e===null)return d.Error("Tolerance is not a number in Lighten()."),d.JS.Clone(t);if(t.length===0||t.length==1&&t[0].length===0||e<0)return d.JS.Clone(t);t[0]instanceof Array||(t=[t]);var r,i,n,o,s,l,u,h,m,f,b,y,_,T,g,x,P,S=t.length,C=e*e,w=[];for(r=0;r<S;r++)if(n=t[r],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,b=[],i=0;i<l-2;i++)u=n[i],m=n[i+1],h=n[i+2],x=u.X,P=u.Y,_=h.X-x,T=h.Y-P,(_!==0||T!==0)&&(g=((m.X-x)*_+(m.Y-P)*T)/(_*_+T*T),g>1?(x=h.X,P=h.Y):g>0&&(x+=_*g,P+=T*g)),_=m.X-x,T=m.Y-P,f=_*_+T*T,f<=C&&(b[i+1]=1,i++);for(s.push({X:n[0].X,Y:n[0].Y}),i=1;i<l-1;i++)b[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(),b.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&&w.push(s)}return!t[0]instanceof Array&&(w=w[0]),typeof w>"u"&&(w=[[]]),w};d.JS.PerimeterOfPath=function(t,e,r){if(typeof t>"u")return 0;var i=Math.sqrt,n=0,o,s,l=0,u=0,h=0,m=0,f=t.length;if(f<2)return 0;for(e&&(t[f]=t[0],f++);--f;)o=t[f],l=o.X,u=o.Y,s=t[f-1],h=s.X,m=s.Y,n+=i((l-h)*(l-h)+(u-m)*(u-m));return e&&t.pop(),n/r};d.JS.PerimeterOfPaths=function(t,e,r){r||(r=1);for(var i=0,n=0;n<t.length;n++)i+=d.JS.PerimeterOfPath(t[n],e,r);return i};d.JS.ScaleDownPath=function(t,e){var r,i;for(e||(e=1),r=t.length;r--;)i=t[r],i.X=i.X/e,i.Y=i.Y/e};d.JS.ScaleDownPaths=function(t,e){var r,i,n,o=Math.round;for(e||(e=1),r=t.length;r--;)for(i=t[r].length;i--;)n=t[r][i],n.X=n.X/e,n.Y=n.Y/e};d.JS.ScaleUpPath=function(t,e){var r,i,n=Math.round;for(e||(e=1),r=t.length;r--;)i=t[r],i.X=n(i.X*e),i.Y=n(i.Y*e)};d.JS.ScaleUpPaths=function(t,e){var r,i,n,o=Math.round;for(e||(e=1),r=t.length;r--;)for(i=t[r].length;i--;)n=t[r][i],n.X=o(n.X*e),n.Y=o(n.Y*e)};d.ExPolygons=function(){return[]};d.ExPolygon=function(){this.outer=null,this.holes=null};d.JS.AddOuterPolyNodeToExPolygons=function(t,e){var r=new d.ExPolygon;r.outer=t.Contour();var i=t.Childs(),n=i.length;r.holes=new Array(n);var o,s,l,u,h,m;for(l=0;l<n;l++)for(o=i[l],r.holes[l]=o.Contour(),u=0,h=o.Childs(),m=h.length;u<m;u++)s=h[u],d.JS.AddOuterPolyNodeToExPolygons(s,e);e.push(r)};d.JS.ExPolygonsToPaths=function(t){var e,r,i,n,o=new d.Paths;for(e=0,i=t.length;e<i;e++)for(o.push(t[e].outer),r=0,n=t[e].holes.length;r<n;r++)o.push(t[e].holes[r]);return o};d.JS.PolyTreeToExPolygons=function(t){var e=new d.ExPolygons,r,i,n,o;for(i=0,n=t.Childs(),o=n.length;i<o;i++)r=n[i],d.JS.AddOuterPolyNodeToExPolygons(r,e);return e};Qo.exports=d});var Wy=Ar((jh,Hh)=>{v();(function(t,e){typeof jh=="object"&&typeof Hh<"u"?Hh.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self).RBush=e()})(jh,function(){"use strict";function t(g,x,P,S,C){a(function w(k,A,N,Y,z){for(;Y>N;){if(Y-N>600){var X=Y-N+1,q=A-N+1,F=Math.log(X),J=.5*Math.exp(2*F/3),pe=.5*Math.sqrt(F*J*(X-J)/X)*(q-X/2<0?-1:1),se=Math.max(N,Math.floor(A-q*J/X+pe)),De=Math.min(Y,Math.floor(A+(X-q)*J/X+pe));w(k,A,se,De,z)}var ve=k[A],ge=N,xe=Y;for(e(k,N,A),z(k[Y],ve)>0&&e(k,N,Y);ge<xe;){for(e(k,ge,xe),ge++,xe--;z(k[ge],ve)<0;)ge++;for(;z(k[xe],ve)>0;)xe--}z(k[N],ve)===0?e(k,N,xe):e(k,++xe,Y),xe<=A&&(N=xe+1),A<=xe&&(Y=xe-1)}},"t")(g,x,P||0,S||g.length-1,C||r)}a(t,"t");function e(g,x,P){var S=g[x];g[x]=g[P],g[P]=S}a(e,"i");function r(g,x){return g<x?-1:g>x?1:0}a(r,"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,x,P){if(!P)return x.indexOf(g);for(var S=0;S<x.length;S++)if(P(g,x[S]))return S;return-1}a(n,"e");function o(g,x){s(g,0,g.children.length,x,g)}a(o,"a");function s(g,x,P,S,C){C||(C=_(null)),C.minX=1/0,C.minY=1/0,C.maxX=-1/0,C.maxY=-1/0;for(var w=x;w<P;w++){var k=g.children[w];l(C,g.leaf?S(k):k)}return C}a(s,"h");function l(g,x){return g.minX=Math.min(g.minX,x.minX),g.minY=Math.min(g.minY,x.minY),g.maxX=Math.max(g.maxX,x.maxX),g.maxY=Math.max(g.maxY,x.maxY),g}a(l,"o");function u(g,x){return g.minX-x.minX}a(u,"s");function h(g,x){return g.minY-x.minY}a(h,"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 b(g,x){return g.minX<=x.minX&&g.minY<=x.minY&&x.maxX<=g.maxX&&x.maxY<=g.maxY}a(b,"m");function y(g,x){return x.minX<=g.maxX&&x.minY<=g.maxY&&x.maxX>=g.minX&&x.maxY>=g.minY}a(y,"c");function _(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}a(_,"p");function T(g,x,P,S,C){for(var w=[x,P];w.length;)if(!((P=w.pop())-(x=w.pop())<=S)){var k=x+Math.ceil((P-x)/S/2)*S;t(g,k,x,P,C),w.push(x,k,k,P)}}return a(T,"d"),i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(g){var x=this.data,P=[];if(!y(g,x))return P;for(var S=this.toBBox,C=[];x;){for(var w=0;w<x.children.length;w++){var k=x.children[w],A=x.leaf?S(k):k;y(g,A)&&(x.leaf?P.push(k):b(g,A)?this._all(k,P):C.push(k))}x=C.pop()}return P},i.prototype.collides=function(g){var x=this.data;if(!y(g,x))return!1;for(var P=[];x;){for(var S=0;S<x.children.length;S++){var C=x.children[S],w=x.leaf?this.toBBox(C):C;if(y(g,w)){if(x.leaf||b(g,w))return!0;P.push(C)}}x=P.pop()}return!1},i.prototype.load=function(g){if(!g||!g.length)return this;if(g.length<this._minEntries){for(var x=0;x<g.length;x++)this.insert(g[x]);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=_([]),this},i.prototype.remove=function(g,x){if(!g)return this;for(var P,S,C,w=this.data,k=this.toBBox(g),A=[],N=[];w||A.length;){if(w||(w=A.pop(),S=A[A.length-1],P=N.pop(),C=!0),w.leaf){var Y=n(g,w.children,x);if(Y!==-1)return w.children.splice(Y,1),A.push(w),this._condense(A),this}C||w.leaf||!b(w,k)?S?(P++,w=S.children[P],C=!1):w=null:(A.push(w),N.push(P),P=0,S=w,w=w.children[0])}return this},i.prototype.toBBox=function(g){return g},i.prototype.compareMinX=function(g,x){return g.minX-x.minX},i.prototype.compareMinY=function(g,x){return g.minY-x.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(g){return this.data=g,this},i.prototype._all=function(g,x){for(var P=[];g;)g.leaf?x.push.apply(x,g.children):P.push.apply(P,g.children),g=P.pop();return x},i.prototype._build=function(g,x,P,S){var C,w=P-x+1,k=this._maxEntries;if(w<=k)return o(C=_(g.slice(x,P+1)),this.toBBox),C;S||(S=Math.ceil(Math.log(w)/Math.log(k)),k=Math.ceil(w/Math.pow(k,S-1))),(C=_([])).leaf=!1,C.height=S;var A=Math.ceil(w/k),N=A*Math.ceil(Math.sqrt(k));T(g,x,P,N,this.compareMinX);for(var Y=x;Y<=P;Y+=N){var z=Math.min(Y+N-1,P);T(g,Y,z,A,this.compareMinY);for(var X=Y;X<=z;X+=A){var q=Math.min(X+A-1,z);C.children.push(this._build(g,X,q,S-1))}}return o(C,this.toBBox),C},i.prototype._chooseSubtree=function(g,x,P,S){for(;S.push(x),!x.leaf&&S.length-1!==P;){for(var C=1/0,w=1/0,k=void 0,A=0;A<x.children.length;A++){var N=x.children[A],Y=m(N),z=(X=g,q=N,(Math.max(q.maxX,X.maxX)-Math.min(q.minX,X.minX))*(Math.max(q.maxY,X.maxY)-Math.min(q.minY,X.minY))-Y);z<w?(w=z,C=Y<C?Y:C,k=N):z===w&&Y<C&&(C=Y,k=N)}x=k||x.children[0]}var X,q;return x},i.prototype._insert=function(g,x,P){var S=P?g:this.toBBox(g),C=[],w=this._chooseSubtree(S,this.data,x,C);for(w.children.push(g),l(w,S);x>=0&&C[x].children.length>this._maxEntries;)this._split(C,x),x--;this._adjustParentBBoxes(S,C,x)},i.prototype._split=function(g,x){var P=g[x],S=P.children.length,C=this._minEntries;this._chooseSplitAxis(P,C,S);var w=this._chooseSplitIndex(P,C,S),k=_(P.children.splice(w,P.children.length-w));k.height=P.height,k.leaf=P.leaf,o(P,this.toBBox),o(k,this.toBBox),x?g[x-1].children.push(k):this._splitRoot(P,k)},i.prototype._splitRoot=function(g,x){this.data=_([g,x]),this.data.height=g.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(g,x,P){for(var S,C,w,k,A,N,Y,z=1/0,X=1/0,q=x;q<=P-x;q++){var F=s(g,0,q,this.toBBox),J=s(g,q,P,this.toBBox),pe=(C=F,w=J,k=void 0,A=void 0,N=void 0,Y=void 0,k=Math.max(C.minX,w.minX),A=Math.max(C.minY,w.minY),N=Math.min(C.maxX,w.maxX),Y=Math.min(C.maxY,w.maxY),Math.max(0,N-k)*Math.max(0,Y-A)),se=m(F)+m(J);pe<z?(z=pe,S=q,X=se<X?se:X):pe===z&&se<X&&(X=se,S=q)}return S||P-x},i.prototype._chooseSplitAxis=function(g,x,P){var S=g.leaf?this.compareMinX:u,C=g.leaf?this.compareMinY:h;this._allDistMargin(g,x,P,S)<this._allDistMargin(g,x,P,C)&&g.children.sort(S)},i.prototype._allDistMargin=function(g,x,P,S){g.children.sort(S);for(var C=this.toBBox,w=s(g,0,x,C),k=s(g,P-x,P,C),A=f(w)+f(k),N=x;N<P-x;N++){var Y=g.children[N];l(w,g.leaf?C(Y):Y),A+=f(w)}for(var z=P-x-1;z>=x;z--){var X=g.children[z];l(k,g.leaf?C(X):X),A+=f(k)}return A},i.prototype._adjustParentBBoxes=function(g,x,P){for(var S=P;S>=0;S--)l(x[S],g)},i.prototype._condense=function(g){for(var x=g.length-1,P=void 0;x>=0;x--)g[x].children.length===0?x>0?(P=g[x-1].children).splice(P.indexOf(g[x]),1):this.clear():o(g[x],this.toBBox)},i})});var Jh=Ar(ee=>{"use strict";v();Object.defineProperty(ee,"__esModule",{value:!0});ee.earthRadius=63710088e-1;ee.factors={centimeters:ee.earthRadius*100,centimetres:ee.earthRadius*100,degrees:ee.earthRadius/111325,feet:ee.earthRadius*3.28084,inches:ee.earthRadius*39.37,kilometers:ee.earthRadius/1e3,kilometres:ee.earthRadius/1e3,meters:ee.earthRadius,metres:ee.earthRadius,miles:ee.earthRadius/1609.344,millimeters:ee.earthRadius*1e3,millimetres:ee.earthRadius*1e3,nauticalmiles:ee.earthRadius/1852,radians:1,yards:ee.earthRadius*1.0936};ee.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/ee.earthRadius,yards:1.0936133};ee.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 ni(t,e,r){r===void 0&&(r={});var i={type:"Feature"};return(r.id===0||r.id)&&(i.id=r.id),r.bbox&&(i.bbox=r.bbox),i.properties=e||{},i.geometry=t,i}a(ni,"feature");ee.feature=ni;function QT(t,e,r){switch(r===void 0&&(r={}),t){case"Point":return Wh(e).geometry;case"LineString":return qh(e).geometry;case"Polygon":return Vh(e).geometry;case"MultiPoint":return qy(e).geometry;case"MultiLineString":return Vy(e).geometry;case"MultiPolygon":return $y(e).geometry;default:throw new Error(t+" is invalid")}}a(QT,"geometry");ee.geometry=QT;function Wh(t,e,r){if(r===void 0&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Fl(t[0])||!Fl(t[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:t};return ni(i,e,r)}a(Wh,"point");ee.point=Wh;function e1(t,e,r){return r===void 0&&(r={}),Gl(t.map(function(i){return Wh(i,e)}),r)}a(e1,"points");ee.points=e1;function Vh(t,e,r){r===void 0&&(r={});for(var i=0,n=t;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:t};return ni(l,e,r)}a(Vh,"polygon");ee.polygon=Vh;function t1(t,e,r){return r===void 0&&(r={}),Gl(t.map(function(i){return Vh(i,e)}),r)}a(t1,"polygons");ee.polygons=t1;function qh(t,e,r){if(r===void 0&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:t};return ni(i,e,r)}a(qh,"lineString");ee.lineString=qh;function r1(t,e,r){return r===void 0&&(r={}),Gl(t.map(function(i){return qh(i,e)}),r)}a(r1,"lineStrings");ee.lineStrings=r1;function Gl(t,e){e===void 0&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}a(Gl,"featureCollection");ee.featureCollection=Gl;function Vy(t,e,r){r===void 0&&(r={});var i={type:"MultiLineString",coordinates:t};return ni(i,e,r)}a(Vy,"multiLineString");ee.multiLineString=Vy;function qy(t,e,r){r===void 0&&(r={});var i={type:"MultiPoint",coordinates:t};return ni(i,e,r)}a(qy,"multiPoint");ee.multiPoint=qy;function $y(t,e,r){r===void 0&&(r={});var i={type:"MultiPolygon",coordinates:t};return ni(i,e,r)}a($y,"multiPolygon");ee.multiPolygon=$y;function i1(t,e,r){r===void 0&&(r={});var i={type:"GeometryCollection",geometries:t};return ni(i,e,r)}a(i1,"geometryCollection");ee.geometryCollection=i1;function n1(t,e){if(e===void 0&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r}a(n1,"round");ee.round=n1;function Jy(t,e){e===void 0&&(e="kilometers");var r=ee.factors[e];if(!r)throw new Error(e+" units is invalid");return t*r}a(Jy,"radiansToLength");ee.radiansToLength=Jy;function $h(t,e){e===void 0&&(e="kilometers");var r=ee.factors[e];if(!r)throw new Error(e+" units is invalid");return t/r}a($h,"lengthToRadians");ee.lengthToRadians=$h;function o1(t,e){return Ky($h(t,e))}a(o1,"lengthToDegrees");ee.lengthToDegrees=o1;function s1(t){var e=t%360;return e<0&&(e+=360),e}a(s1,"bearingToAzimuth");ee.bearingToAzimuth=s1;function Ky(t){var e=t%(2*Math.PI);return e*180/Math.PI}a(Ky,"radiansToDegrees");ee.radiansToDegrees=Ky;function a1(t){var e=t%360;return e*Math.PI/180}a(a1,"degreesToRadians");ee.degreesToRadians=a1;function l1(t,e,r){if(e===void 0&&(e="kilometers"),r===void 0&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return Jy($h(t,e),r)}a(l1,"convertLength");ee.convertLength=l1;function c1(t,e,r){if(e===void 0&&(e="meters"),r===void 0&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=ee.areaFactors[e];if(!i)throw new Error("invalid original units");var n=ee.areaFactors[r];if(!n)throw new Error("invalid final units");return t/i*n}a(c1,"convertArea");ee.convertArea=c1;function Fl(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}a(Fl,"isNumber");ee.isNumber=Fl;function u1(t){return!!t&&t.constructor===Object}a(u1,"isObject");ee.isObject=u1;function h1(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(e){if(!Fl(e))throw new Error("bbox must only contain numbers")})}a(h1,"validateBBox");ee.validateBBox=h1;function d1(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}a(d1,"validateId");ee.validateId=d1});var Qh=Ar($e=>{"use strict";v();Object.defineProperty($e,"__esModule",{value:!0});var lt=Jh();function hs(t,e,r){if(t!==null)for(var i,n,o,s,l,u,h,m=0,f=0,b,y=t.type,_=y==="FeatureCollection",T=y==="Feature",g=_?t.features.length:1,x=0;x<g;x++){h=_?t.features[x].geometry:T?t.geometry:t,b=h?h.type==="GeometryCollection":!1,l=b?h.geometries.length:1;for(var P=0;P<l;P++){var S=0,C=0;if(s=b?h.geometries[P]:h,s!==null){u=s.coordinates;var w=s.type;switch(m=r&&(w==="Polygon"||w==="MultiPolygon")?1:0,w){case null:break;case"Point":if(e(u,f,x,S,C)===!1)return!1;f++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<u.length;i++){if(e(u[i],f,x,S,C)===!1)return!1;f++,w==="MultiPoint"&&S++}w==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<u.length;i++){for(n=0;n<u[i].length-m;n++){if(e(u[i][n],f,x,S,C)===!1)return!1;f++}w==="MultiLineString"&&S++,w==="Polygon"&&C++}w==="Polygon"&&S++;break;case"MultiPolygon":for(i=0;i<u.length;i++){for(C=0,n=0;n<u[i].length;n++){for(o=0;o<u[i][n].length-m;o++){if(e(u[i][n][o],f,x,S,C)===!1)return!1;f++}C++}S++}break;case"GeometryCollection":for(i=0;i<s.geometries.length;i++)if(hs(s.geometries[i],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}a(hs,"coordEach");function p1(t,e,r,i){var n=r;return hs(t,function(o,s,l,u,h){s===0&&r===void 0?n=o:n=e(n,o,s,l,u,h)},i),n}a(p1,"coordReduce");function Qy(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&e(t.features[r].properties,r)!==!1;r++);break;case"Feature":e(t.properties,0);break}}a(Qy,"propEach");function m1(t,e,r){var i=r;return Qy(t,function(n,o){o===0&&r===void 0?i=n:i=e(i,n,o)}),i}a(m1,"propReduce");function eg(t,e){if(t.type==="Feature")e(t,0);else if(t.type==="FeatureCollection")for(var r=0;r<t.features.length&&e(t.features[r],r)!==!1;r++);}a(eg,"featureEach");function f1(t,e,r){var i=r;return eg(t,function(n,o){o===0&&r===void 0?i=n:i=e(i,n,o)}),i}a(f1,"featureReduce");function y1(t){var e=[];return hs(t,function(r){e.push(r)}),e}a(y1,"coordAll");function Kh(t,e){var r,i,n,o,s,l,u,h,m,f,b=0,y=t.type==="FeatureCollection",_=t.type==="Feature",T=y?t.features.length:1;for(r=0;r<T;r++){for(l=y?t.features[r].geometry:_?t.geometry:t,h=y?t.features[r].properties:_?t.properties:{},m=y?t.features[r].bbox:_?t.bbox:void 0,f=y?t.features[r].id:_?t.id:void 0,u=l?l.type==="GeometryCollection":!1,s=u?l.geometries.length:1,n=0;n<s;n++){if(o=u?l.geometries[n]:l,o===null){if(e(null,b,h,m,f)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(o,b,h,m,f)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(e(o.geometries[i],b,h,m,f)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}b++}}a(Kh,"geomEach");function g1(t,e,r){var i=r;return Kh(t,function(n,o,s,l,u){o===0&&r===void 0?i=n:i=e(i,n,o,s,l,u)}),i}a(g1,"geomReduce");function Xl(t,e){Kh(t,function(r,i,n,o,s){var l=r===null?null:r.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return e(lt.feature(r,n,{bbox:o,id:s}),i,0)===!1?!1:void 0}var u;switch(l){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var h=0;h<r.coordinates.length;h++){var m=r.coordinates[h],f={type:u,coordinates:m};if(e(lt.feature(f,n),i,h)===!1)return!1}})}a(Xl,"flattenEach");function v1(t,e,r){var i=r;return Xl(t,function(n,o,s){o===0&&s===0&&r===void 0?i=n:i=e(i,n,o,s)}),i}a(v1,"flattenReduce");function tg(t,e){Xl(t,function(r,i,n){var o=0;if(r.geometry){var s=r.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var l,u=0,h=0,m=0;if(hs(r,function(f,b,y,_,T){if(l===void 0||i>u||_>h||T>m){l=f,u=i,h=_,m=T,o=0;return}var g=lt.lineString([l,f],r.properties);if(e(g,i,n,T,o)===!1)return!1;o++,l=f})===!1)return!1}}})}a(tg,"segmentEach");function b1(t,e,r){var i=r,n=!1;return tg(t,function(o,s,l,u,h){n===!1&&r===void 0?i=o:i=e(i,o,s,l,u,h),n=!0}),i}a(b1,"segmentReduce");function rg(t,e){if(!t)throw new Error("geojson is required");Xl(t,function(r,i,n){if(r.geometry!==null){var o=r.geometry.type,s=r.geometry.coordinates;switch(o){case"LineString":if(e(r,i,n,0,0)===!1)return!1;break;case"Polygon":for(var l=0;l<s.length;l++)if(e(lt.lineString(s[l],r.properties),i,n,l)===!1)return!1;break}}})}a(rg,"lineEach");function x1(t,e,r){var i=r;return rg(t,function(n,o,s,l){o===0&&r===void 0?i=n:i=e(i,n,o,s,l)}),i}a(x1,"lineReduce");function S1(t,e){if(e=e||{},!lt.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,i=e.multiFeatureIndex||0,n=e.geometryIndex||0,o=e.segmentIndex||0,s=e.properties,l;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),s=s||t.features[r].properties,l=t.features[r].geometry;break;case"Feature":s=s||t.properties,l=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=t;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var u=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=u.length+o-1),lt.lineString([u[o],u[o+1]],s,e);case"Polygon":return n<0&&(n=u.length+n),o<0&&(o=u[n].length+o-1),lt.lineString([u[n][o],u[n][o+1]],s,e);case"MultiLineString":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o-1),lt.lineString([u[i][o],u[i][o+1]],s,e);case"MultiPolygon":return i<0&&(i=u.length+i),n<0&&(n=u[i].length+n),o<0&&(o=u[i][n].length-o-1),lt.lineString([u[i][n][o],u[i][n][o+1]],s,e)}throw new Error("geojson is invalid")}a(S1,"findSegment");function C1(t,e){if(e=e||{},!lt.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,i=e.multiFeatureIndex||0,n=e.geometryIndex||0,o=e.coordIndex||0,s=e.properties,l;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),s=s||t.features[r].properties,l=t.features[r].geometry;break;case"Feature":s=s||t.properties,l=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=t;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var u=l.coordinates;switch(l.type){case"Point":return lt.point(u,s,e);case"MultiPoint":return i<0&&(i=u.length+i),lt.point(u[i],s,e);case"LineString":return o<0&&(o=u.length+o),lt.point(u[o],s,e);case"Polygon":return n<0&&(n=u.length+n),o<0&&(o=u[n].length+o),lt.point(u[n][o],s,e);case"MultiLineString":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),lt.point(u[i][o],s,e);case"MultiPolygon":return i<0&&(i=u.length+i),n<0&&(n=u[i].length+n),o<0&&(o=u[i][n].length-o),lt.point(u[i][n][o],s,e)}throw new Error("geojson is invalid")}a(C1,"findPoint");$e.coordAll=y1;$e.coordEach=hs;$e.coordReduce=p1;$e.featureEach=eg;$e.featureReduce=f1;$e.findPoint=C1;$e.findSegment=S1;$e.flattenEach=Xl;$e.flattenReduce=v1;$e.geomEach=Kh;$e.geomReduce=g1;$e.lineEach=rg;$e.lineReduce=x1;$e.propEach=Qy;$e.propReduce=m1;$e.segmentEach=tg;$e.segmentReduce=b1});var ig=Ar(td=>{"use strict";v();Object.defineProperty(td,"__esModule",{value:!0});var _1=Qh();function ed(t){var e=[1/0,1/0,-1/0,-1/0];return _1.coordEach(t,function(r){e[0]>r[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]<r[0]&&(e[2]=r[0]),e[3]<r[1]&&(e[3]=r[1])}),e}a(ed,"bbox");ed.default=ed;td.default=ed});var lg=Ar((o4,rd)=>{v();var ur=Wy(),og=Jh(),sg=Qh(),Qn=ig().default,P1=sg.featureEach,i4=sg.coordEach,n4=og.polygon,ng=og.featureCollection;function ag(t){var e=new ur(t);return e.insert=function(r){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Qn(r),ur.prototype.insert.call(this,r)},e.load=function(r){var i=[];return Array.isArray(r)?r.forEach(function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Qn(n),i.push(n)}):P1(r,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Qn(n),i.push(n)}),ur.prototype.load.call(this,i)},e.remove=function(r,i){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Qn(r),ur.prototype.remove.call(this,r,i)},e.clear=function(){return ur.prototype.clear.call(this)},e.search=function(r){var i=ur.prototype.search.call(this,this.toBBox(r));return ng(i)},e.collides=function(r){return ur.prototype.collides.call(this,this.toBBox(r))},e.all=function(){var r=ur.prototype.all.call(this);return ng(r)},e.toJSON=function(){return ur.prototype.toJSON.call(this)},e.fromJSON=function(r){return ur.prototype.fromJSON.call(this,r)},e.toBBox=function(r){var i;if(r.bbox)i=r.bbox;else if(Array.isArray(r)&&r.length===4)i=r;else if(Array.isArray(r)&&r.length===6)i=[r[0],r[1],r[3],r[4]];else if(r.type==="Feature")i=Qn(r);else if(r.type==="FeatureCollection")i=Qn(r);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},e}a(ag,"geojsonRbush");rd.exports=ag;rd.exports.default=ag});v();import{MapView as $1}from"@mappedin/mappedin-js";v();v();v();(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 bp="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=";v();v();var Ug=!1;function xp(){return Ug}a(xp,"isTestMode");var bc=class bc{constructor(e){p(this,"backgroundAlpha",1);p(this,"backgroundColor",new Ee);p(this,"width",0);p(this,"height",0);p(this,"options",{});p(this,"renderer");p(this,"enabledLayers",new Set([0,1]));p(this,"handleWebGLContextCreationError",a(e=>{var r,i;(i=(r=this.options).onWebGLContextCreationError)==null||i.call(r,e)},"handleWebGLContextCreationError"));p(this,"handleWebGLContextLost",a(e=>{var r,i;(i=(r=this.options).onWebGLContextLost)==null||i.call(r,e)},"handleWebGLContextLost"));p(this,"handleWebGLContextRestored",a(e=>{var r,i;(i=(r=this.options).onWebGLContextRestored)==null||i.call(r,e)},"handleWebGLContextRestored"));var r,i,n,o,s;try{this.options=e,xp()?(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 Ee,"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 jd({canvas:e.canvas,alpha:e.alpha||!1,stencil:!0,antialias:typeof e.antialias=="boolean"?e.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.backgroundColor=new Ee((r=e.backgroundColor)!=null?r:"#ffffff"),this.backgroundAlpha=(i=e.backgroundAlpha)!=null?i:1}catch(l){te.error(l),e.onWebGLRendererError&&e.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 e,r,i,n,o;this.renderer&&((r=(e=this.renderer).dispose)==null||r.call(e)),(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(e,r){if(this.renderer){this.renderer.state.reset(),r.layers.disableAll();for(let i of this.enabledLayers.values())r.layers.enable(i);this.renderer.clearStencil(),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(e,r),this.renderer.clearDepth(),r.layers.disableAll(),r.layers.enable(Ks.ALWAYS_ON_TOP),this.renderer.render(e,r),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(e,r){E.env.NODE_ENV==="test"||!this.renderer||(this.width=e,this.height=r,this.renderer.setSize(e,r,!1))}setBackgroundColor(e,r){this.backgroundColor=e,this.backgroundAlpha=r}domElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}};a(bc,"Renderer");var na=bc;v();v();var Sp='"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';v();v();v();v();v();function Cp(t,e){return e.x+e.w<t.x+t.w&&e.x>t.x&&e.y>t.y&&e.y+e.h<t.y+t.h}a(Cp,"contains");v();function _p(t,e){let[r,i]=e;return r>=t.x&&r<=t.x+t.w&&i>=t.y&&i<=t.y+t.h}a(_p,"intersectPoint");v();function Pp(t,e){let r=e.x,i=e.y,n=e.x+e.w,o=e.y+e.h,s=t.x,l=t.y,u=t.x+t.w,h=t.y+t.h;return r<u&&s<n&&i<h&&l<o}a(Pp,"intersects");v();function yr(t,e){for(let r=0;r<e.length;r++)t.push(e[r])}a(yr,"appendItems");v();var xc=class xc{constructor(e,r,i,n,o){p(this,"x");p(this,"y");p(this,"w");p(this,"h");p(this,"userData");this.userData=typeof o>"u"?null:o,this.x=e,this.y=r,this.w=i,this.h=n}contains(e){return e===this?!1:Cp(this,e)}intersects(e){return Pp(this,e)}intersectsPoint(e){return _p(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};a(xc,"Rectangle");var Se=xc;var vi=class vi{constructor(e,r){p(this,"topLeft");p(this,"topRight");p(this,"bottomLeft");p(this,"bottomRight");p(this,"divided",!1);p(this,"boundary");p(this,"capacity",16);p(this,"objects",[]);p(this,"parent");this.parent=r,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:r,w:i,h:n}=this.boundary;this.topLeft=new vi(new Se(e,r,i/2,n/2),this),this.topRight=new vi(new Se(e+i/2,r,i/2,n/2),this),this.bottomLeft=new vi(new Se(e,r+n/2,i/2,n/2),this),this.bottomRight=new vi(new Se(e+i/2,r+n/2,i/2,n/2),this),this.divided=!0}queryRect(e){let r=[];if(this.boundary.intersects(e))r.push(...this.objects);else return[];return this.divided&&(yr(r,this.topLeft.queryRect(e)),yr(r,this.topRight.queryRect(e)),yr(r,this.bottomLeft.queryRect(e)),yr(r,this.bottomRight.queryRect(e))),r}queryPoint(e){let r=[];if(this.boundary.intersectsPoint(e))r.push(...this.objects);else return[];return this.divided&&(yr(r,this.topLeft.queryPoint(e)),yr(r,this.topRight.queryPoint(e)),yr(r,this.bottomLeft.queryPoint(e)),yr(r,this.bottomRight.queryPoint(e))),r}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(r=>r.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()}};a(vi,"QuadTree");var Tt=vi;v();v();v();v();var I={};Pd(I,{BRAND:()=>yv,DIRTY:()=>bi,EMPTY_PATH:()=>Vg,INVALID:()=>Q,NEVER:()=>eb,OK:()=>at,ParseStatus:()=>nt,Schema:()=>le,ZodAny:()=>Ur,ZodArray:()=>xr,ZodBigInt:()=>Ci,ZodBoolean:()=>_i,ZodBranded:()=>So,ZodCatch:()=>ki,ZodDate:()=>Pi,ZodDefault:()=>Ai,ZodDiscriminatedUnion:()=>ca,ZodEffects:()=>It,ZodEnum:()=>Oi,ZodError:()=>gt,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>ha,ZodIntersection:()=>Ii,ZodIssueCode:()=>G,ZodLazy:()=>Ei,ZodLiteral:()=>Di,ZodMap:()=>Mn,ZodNaN:()=>En,ZodNativeEnum:()=>Li,ZodNever:()=>Ft,ZodNull:()=>wi,ZodNullable:()=>tr,ZodNumber:()=>Si,ZodObject:()=>vt,ZodOptional:()=>wt,ZodParsedType:()=>U,ZodPipeline:()=>Co,ZodPromise:()=>jr,ZodReadonly:()=>Ri,ZodRecord:()=>ua,ZodSchema:()=>le,ZodSet:()=>In,ZodString:()=>Zr,ZodSymbol:()=>Tn,ZodTransformer:()=>It,ZodTuple:()=>er,ZodType:()=>le,ZodUndefined:()=>Ti,ZodUnion:()=>Mi,ZodUnknown:()=>br,ZodVoid:()=>wn,addIssueToContext:()=>Z,any:()=>Tv,array:()=>Ev,bigint:()=>xv,boolean:()=>Rp,coerce:()=>Qv,custom:()=>Lp,date:()=>Sv,datetimeRegex:()=>Dp,defaultErrorMap:()=>gr,discriminatedUnion:()=>Av,effect:()=>jv,enum:()=>Yv,function:()=>Gv,getErrorMap:()=>xn,getParsedType:()=>Qt,instanceof:()=>vv,intersection:()=>kv,isAborted:()=>aa,isAsync:()=>Sn,isDirty:()=>la,isValid:()=>Yr,late:()=>gv,lazy:()=>Xv,literal:()=>zv,makeIssue:()=>fo,map:()=>Bv,nan:()=>bv,nativeEnum:()=>Zv,never:()=>Mv,null:()=>Pv,nullable:()=>Wv,number:()=>kp,object:()=>Dv,objectUtil:()=>Sc,oboolean:()=>Kv,onumber:()=>Jv,optional:()=>Hv,ostring:()=>$v,pipeline:()=>qv,preprocess:()=>Vv,promise:()=>Uv,quotelessJson:()=>jg,record:()=>Nv,set:()=>Fv,setErrorMap:()=>Wg,strictObject:()=>Ov,string:()=>Ap,symbol:()=>Cv,transformer:()=>jv,tuple:()=>Rv,undefined:()=>_v,union:()=>Lv,unknown:()=>wv,util:()=>he,void:()=>Iv});v();v();v();v();v();var he;(function(t){t.assertEqual=n=>{};function e(n){}a(e,"assertIs"),t.assertIs=e;function r(n){throw new Error}a(r,"assertNever"),t.assertNever=r,t.arrayToEnum=n=>{let o={};for(let s of n)o[s]=s;return o},t.getValidEnumValues=n=>{let o=t.objectKeys(n).filter(l=>typeof n[n[l]]!="number"),s={};for(let l of o)s[l]=n[l];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(o){return n[o]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&o.push(s);return o},t.find=(n,o)=>{for(let s of n)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map(s=>typeof s=="string"?"'".concat(s,"'"):s).join(o)}a(i,"joinValues"),t.joinValues=i,t.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o})(he||(he={}));var Sc;(function(t){t.mergeShapes=(e,r)=>O(O({},e),r)})(Sc||(Sc={}));var U=he.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qt=a(t=>{switch(typeof t){case"undefined":return U.undefined;case"string":return U.string;case"number":return Number.isNaN(t)?U.nan:U.number;case"boolean":return U.boolean;case"function":return U.function;case"bigint":return U.bigint;case"symbol":return U.symbol;case"object":return Array.isArray(t)?U.array:t===null?U.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?U.promise:typeof Map<"u"&&t instanceof Map?U.map:typeof Set<"u"&&t instanceof Set?U.set:typeof Date<"u"&&t instanceof Date?U.date:U.object;default:return U.unknown}},"getParsedType");var G=he.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"]),jg=a(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),oa=class oa extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},i={_errors:[]},n=a(o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)i._errors.push(r(s));else{let l=i,u=0;for(;u<s.path.length;){let h=s.path[u];u===s.path.length-1?(l[h]=l[h]||{_errors:[]},l[h]._errors.push(r(s))):l[h]=l[h]||{_errors:[]},l=l[h],u++}}},"processError");return n(this),i}static assert(e){if(!(e instanceof oa))throw new Error("Not a ZodError: ".concat(e))}toString(){return this.message}get message(){return JSON.stringify(this.issues,he.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};a(oa,"ZodError");var gt=oa;gt.create=t=>new gt(t);var Hg=a((t,e)=>{let r;switch(t.code){case G.invalid_type:t.received===U.undefined?r="Required":r="Expected ".concat(t.expected,", received ").concat(t.received);break;case G.invalid_literal:r="Invalid literal value, expected ".concat(JSON.stringify(t.expected,he.jsonStringifyReplacer));break;case G.unrecognized_keys:r="Unrecognized key(s) in object: ".concat(he.joinValues(t.keys,", "));break;case G.invalid_union:r="Invalid input";break;case G.invalid_union_discriminator:r="Invalid discriminator value. Expected ".concat(he.joinValues(t.options));break;case G.invalid_enum_value:r="Invalid enum value. Expected ".concat(he.joinValues(t.options),", received '").concat(t.received,"'");break;case G.invalid_arguments:r="Invalid function arguments";break;case G.invalid_return_type:r="Invalid function return type";break;case G.invalid_date:r="Invalid date";break;case G.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r='Invalid input: must include "'.concat(t.validation.includes,'"'),typeof t.validation.position=="number"&&(r="".concat(r," at one or more positions greater than or equal to ").concat(t.validation.position))):"startsWith"in t.validation?r='Invalid input: must start with "'.concat(t.validation.startsWith,'"'):"endsWith"in t.validation?r='Invalid input: must end with "'.concat(t.validation.endsWith,'"'):he.assertNever(t.validation):t.validation!=="regex"?r="Invalid ".concat(t.validation):r="Invalid";break;case G.too_small:t.type==="array"?r="Array must contain ".concat(t.exact?"exactly":t.inclusive?"at least":"more than"," ").concat(t.minimum," element(s)"):t.type==="string"?r="String must contain ".concat(t.exact?"exactly":t.inclusive?"at least":"over"," ").concat(t.minimum," character(s)"):t.type==="number"?r="Number must be ".concat(t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than ").concat(t.minimum):t.type==="date"?r="Date must be ".concat(t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than ").concat(new Date(Number(t.minimum))):r="Invalid input";break;case G.too_big:t.type==="array"?r="Array must contain ".concat(t.exact?"exactly":t.inclusive?"at most":"less than"," ").concat(t.maximum," element(s)"):t.type==="string"?r="String must contain ".concat(t.exact?"exactly":t.inclusive?"at most":"under"," ").concat(t.maximum," character(s)"):t.type==="number"?r="Number must be ".concat(t.exact?"exactly":t.inclusive?"less than or equal to":"less than"," ").concat(t.maximum):t.type==="bigint"?r="BigInt must be ".concat(t.exact?"exactly":t.inclusive?"less than or equal to":"less than"," ").concat(t.maximum):t.type==="date"?r="Date must be ".concat(t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"," ").concat(new Date(Number(t.maximum))):r="Invalid input";break;case G.custom:r="Invalid input";break;case G.invalid_intersection_types:r="Intersection results could not be merged";break;case G.not_multiple_of:r="Number must be a multiple of ".concat(t.multipleOf);break;case G.not_finite:r="Number must be finite";break;default:r=e.defaultError,he.assertNever(t)}return{message:r}},"errorMap"),gr=Hg;var Tp=gr;function Wg(t){Tp=t}a(Wg,"setErrorMap");function xn(){return Tp}a(xn,"getErrorMap");v();var fo=a(t=>{let{data:e,path:r,errorMaps:i,issueData:n}=t,o=[...r,...n.path||[]],s=j(O({},n),{path:o});if(n.message!==void 0)return j(O({},n),{path:o,message:n.message});let l="",u=i.filter(h=>!!h).slice().reverse();for(let h of u)l=h(s,{data:e,defaultError:l}).message;return j(O({},n),{path:o,message:l})},"makeIssue"),Vg=[];function Z(t,e){let r=xn(),i=fo({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===gr?void 0:gr].filter(n=>!!n)});t.common.issues.push(i)}a(Z,"addIssueToContext");var sa=class sa{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let n of r){if(n.status==="aborted")return Q;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let n of r){let o=await n.key,s=await n.value;i.push({key:o,value:s})}return sa.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let n of r){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return Q;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(i[o.value]=s.value)}return{status:e.value,value:i}}};a(sa,"ParseStatus");var nt=sa,Q=Object.freeze({status:"aborted"}),bi=a(t=>({status:"dirty",value:t}),"DIRTY"),at=a(t=>({status:"valid",value:t}),"OK"),aa=a(t=>t.status==="aborted","isAborted"),la=a(t=>t.status==="dirty","isDirty"),Yr=a(t=>t.status==="valid","isValid"),Sn=a(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync");v();v();v();var V;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(V||(V={}));var Pc=class Pc{constructor(e,r,i,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,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}};a(Pc,"ParseInputLazyPath");var Mt=Pc,wp=a((t,e)=>{if(Yr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new gt(t.common.issues);return this._error=r,this._error}}},"handleResult");function oe(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:n}=t;if(e&&(r||i))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:a((s,l)=>{var h,m;let{message:u}=t;return s.code==="invalid_enum_value"?{message:u!=null?u:l.defaultError}:typeof l.data>"u"?{message:(h=u!=null?u:i)!=null?h:l.defaultError}:s.code!=="invalid_type"?{message:l.defaultError}:{message:(m=u!=null?u:r)!=null?m:l.defaultError}},"customMap"),description:n}}a(oe,"processCreateParams");var Tc=class Tc{get description(){return this._def.description}_getType(e){return Qt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Qt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new nt,ctx:{common:e.parent.common,data:e.data,parsedType:Qt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Sn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){var o;let i={common:{issues:[],async:(o=r==null?void 0:r.async)!=null?o:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qt(e)},n=this._parseSync({data:e,path:i.path,parent:i});return wp(i,n)}"~validate"(e){var i,n;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qt(e)};if(!this["~standard"].async)try{let o=this._parseSync({data:e,path:[],parent:r});return Yr(o)?{value:o.value}:{issues:r.common.issues}}catch(o){(n=(i=o==null?void 0:o.message)==null?void 0:i.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(o=>Yr(o)?{value:o.value}:{issues:r.common.issues})}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qt(e)},n=this._parse({data:e,path:i.path,parent:i}),o=await(Sn(n)?n:Promise.resolve(n));return wp(i,o)}refine(e,r){let i=a(n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r,"getIssueProperties");return this._refinement((n,o)=>{let s=e(n),l=a(()=>o.addIssue(O({code:G.custom},i(n))),"setError");return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(e,r){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(e){return new It({schema:this,typeName:re.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:a(r=>this["~validate"](r),"validate")}}optional(){return wt.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xr.create(this)}promise(){return jr.create(this,this._def)}or(e){return Mi.create([this,e],this._def)}and(e){return Ii.create(this,e,this._def)}transform(e){return new It(j(O({},oe(this._def)),{schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){let r=typeof e=="function"?e:()=>e;return new Ai(j(O({},oe(this._def)),{innerType:this,defaultValue:r,typeName:re.ZodDefault}))}brand(){return new So(O({typeName:re.ZodBranded,type:this},oe(this._def)))}catch(e){let r=typeof e=="function"?e:()=>e;return new ki(j(O({},oe(this._def)),{innerType:this,catchValue:r,typeName:re.ZodCatch}))}describe(e){let r=this.constructor;return new r(j(O({},this._def),{description:e}))}pipe(e){return Co.create(this,e)}readonly(){return Ri.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};a(Tc,"ZodType");var le=Tc,qg=/^c[^\s-]{8,}$/i,$g=/^[0-9a-z]+$/,Jg=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Kg=/^[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,Qg=/^[a-z0-9_-]{21}$/i,ev=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tv=/^[-+]?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)?)??$/,rv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Cc,nv=/^(?:(?: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])$/,ov=/^(?:(?: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])$/,sv=/^(([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]))$/,av=/^(([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])$/,lv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ip="((\\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])))",uv=new RegExp("^".concat(Ip,"$"));function Ep(t){let e="[0-5]\\d";t.precision?e="".concat(e,"\\.\\d{").concat(t.precision,"}"):t.precision==null&&(e="".concat(e,"(\\.\\d+)?"));let r=t.precision?"+":"?";return"([01]\\d|2[0-3]):[0-5]\\d(:".concat(e,")").concat(r)}a(Ep,"timeRegexSource");function hv(t){return new RegExp("^".concat(Ep(t),"$"))}a(hv,"timeRegex");function Dp(t){let e="".concat(Ip,"T").concat(Ep(t)),r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e="".concat(e,"(").concat(r.join("|"),")"),new RegExp("^".concat(e,"$"))}a(Dp,"datetimeRegex");function dv(t,e){return!!((e==="v4"||!e)&&nv.test(t)||(e==="v6"||!e)&&sv.test(t))}a(dv,"isValidIP");function pv(t,e){if(!ev.test(t))return!1;try{let[r]=t.split("."),i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch(r){return!1}}a(pv,"isValidJWT");function mv(t,e){return!!((e==="v4"||!e)&&ov.test(t)||(e==="v6"||!e)&&av.test(t))}a(mv,"isValidCidr");var xi=class xi extends le{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==U.string){let o=this._getOrReturnCtx(e);return Z(o,{code:G.invalid_type,expected:U.string,received:o.parsedType}),Q}let i=new nt,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:G.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:G.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,l=e.data.length<o.value;(s||l)&&(n=this._getOrReturnCtx(e,n),s?Z(n,{code:G.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):l&&Z(n,{code:G.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")rv.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"email",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")Cc||(Cc=new RegExp(iv,"u")),Cc.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"emoji",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")Kg.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"uuid",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")Qg.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"nanoid",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")qg.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"cuid",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")$g.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"cuid2",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")Jg.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"ulid",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(e.data)}catch(s){n=this._getOrReturnCtx(e,n),Z(n,{validation:"url",code:G.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"regex",code:G.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?Dp(o).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?uv.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?hv(o).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?tv.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"duration",code:G.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?dv(e.data,o.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"ip",code:G.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?pv(e.data,o.alg)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"jwt",code:G.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?mv(e.data,o.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"cidr",code:G.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?lv.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"base64",code:G.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?cv.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"base64url",code:G.invalid_string,message:o.message}),i.dirty()):he.assertNever(o);return{status:i.value,value:e.data}}_regex(e,r,i){return this.refinement(n=>e.test(n),O({validation:r,code:G.invalid_string},V.errToObj(i)))}_addCheck(e){return new xi(j(O({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(O({kind:"email"},V.errToObj(e)))}url(e){return this._addCheck(O({kind:"url"},V.errToObj(e)))}emoji(e){return this._addCheck(O({kind:"emoji"},V.errToObj(e)))}uuid(e){return this._addCheck(O({kind:"uuid"},V.errToObj(e)))}nanoid(e){return this._addCheck(O({kind:"nanoid"},V.errToObj(e)))}cuid(e){return this._addCheck(O({kind:"cuid"},V.errToObj(e)))}cuid2(e){return this._addCheck(O({kind:"cuid2"},V.errToObj(e)))}ulid(e){return this._addCheck(O({kind:"ulid"},V.errToObj(e)))}base64(e){return this._addCheck(O({kind:"base64"},V.errToObj(e)))}base64url(e){return this._addCheck(O({kind:"base64url"},V.errToObj(e)))}jwt(e){return this._addCheck(O({kind:"jwt"},V.errToObj(e)))}ip(e){return this._addCheck(O({kind:"ip"},V.errToObj(e)))}cidr(e){return this._addCheck(O({kind:"cidr"},V.errToObj(e)))}datetime(e){var r,i;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(O({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(i=e==null?void 0:e.local)!=null?i:!1},V.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(O({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision},V.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(O({kind:"duration"},V.errToObj(e)))}regex(e,r){return this._addCheck(O({kind:"regex",regex:e},V.errToObj(r)))}includes(e,r){return this._addCheck(O({kind:"includes",value:e,position:r==null?void 0:r.position},V.errToObj(r==null?void 0:r.message)))}startsWith(e,r){return this._addCheck(O({kind:"startsWith",value:e},V.errToObj(r)))}endsWith(e,r){return this._addCheck(O({kind:"endsWith",value:e},V.errToObj(r)))}min(e,r){return this._addCheck(O({kind:"min",value:e},V.errToObj(r)))}max(e,r){return this._addCheck(O({kind:"max",value:e},V.errToObj(r)))}length(e,r){return this._addCheck(O({kind:"length",value:e},V.errToObj(r)))}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new xi(j(O({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new xi(j(O({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new xi(j(O({},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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};a(xi,"ZodString");var Zr=xi;Zr.create=t=>{var e;return new Zr(O({checks:[],typeName:re.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1},oe(t)))};function fv(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return o%s/10**n}a(fv,"floatSafeRemainder");var yo=class yo extends le{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)!==U.number){let o=this._getOrReturnCtx(e);return Z(o,{code:G.invalid_type,expected:U.number,received:o.parsedType}),Q}let i,n=new nt;for(let o of this._def.checks)o.kind==="int"?he.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Z(i,{code:G.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?fv(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Z(i,{code:G.not_finite,message:o.message}),n.dirty()):he.assertNever(o);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,V.toString(r))}gt(e,r){return this.setLimit("min",e,!1,V.toString(r))}lte(e,r){return this.setLimit("max",e,!0,V.toString(r))}lt(e,r){return this.setLimit("max",e,!1,V.toString(r))}setLimit(e,r,i,n){return new yo(j(O({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:V.toString(n)}]}))}_addCheck(e){return new yo(j(O({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&he.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(r)&&Number.isFinite(e)}};a(yo,"ZodNumber");var Si=yo;Si.create=t=>new Si(O({checks:[],typeName:re.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1},oe(t)));var go=class go extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(o){return this._getInvalidInput(e)}if(this._getType(e)!==U.bigint)return this._getInvalidInput(e);let i,n=new nt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):he.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Z(r,{code:G.invalid_type,expected:U.bigint,received:r.parsedType}),Q}gte(e,r){return this.setLimit("min",e,!0,V.toString(r))}gt(e,r){return this.setLimit("min",e,!1,V.toString(r))}lte(e,r){return this.setLimit("max",e,!0,V.toString(r))}lt(e,r){return this.setLimit("max",e,!1,V.toString(r))}setLimit(e,r,i,n){return new go(j(O({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:V.toString(n)}]}))}_addCheck(e){return new go(j(O({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};a(go,"ZodBigInt");var Ci=go;Ci.create=t=>{var e;return new Ci(O({checks:[],typeName:re.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1},oe(t)))};var wc=class wc extends le{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==U.boolean){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.boolean,received:i.parsedType}),Q}return at(e.data)}};a(wc,"ZodBoolean");var _i=wc;_i.create=t=>new _i(O({typeName:re.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1},oe(t)));var da=class da extends le{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==U.date){let o=this._getOrReturnCtx(e);return Z(o,{code:G.invalid_type,expected:U.date,received:o.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Z(o,{code:G.invalid_date}),Q}let i=new nt,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:G.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:G.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):he.assertNever(o);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new da(j(O({},this._def),{checks:[...this._def.checks,e]}))}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};a(da,"ZodDate");var Pi=da;Pi.create=t=>new Pi(O({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:re.ZodDate},oe(t)));var Mc=class Mc extends le{_parse(e){if(this._getType(e)!==U.symbol){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.symbol,received:i.parsedType}),Q}return at(e.data)}};a(Mc,"ZodSymbol");var Tn=Mc;Tn.create=t=>new Tn(O({typeName:re.ZodSymbol},oe(t)));var Ic=class Ic extends le{_parse(e){if(this._getType(e)!==U.undefined){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.undefined,received:i.parsedType}),Q}return at(e.data)}};a(Ic,"ZodUndefined");var Ti=Ic;Ti.create=t=>new Ti(O({typeName:re.ZodUndefined},oe(t)));var Ec=class Ec extends le{_parse(e){if(this._getType(e)!==U.null){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.null,received:i.parsedType}),Q}return at(e.data)}};a(Ec,"ZodNull");var wi=Ec;wi.create=t=>new wi(O({typeName:re.ZodNull},oe(t)));var Dc=class Dc extends le{constructor(){super(...arguments),this._any=!0}_parse(e){return at(e.data)}};a(Dc,"ZodAny");var Ur=Dc;Ur.create=t=>new Ur(O({typeName:re.ZodAny},oe(t)));var Oc=class Oc extends le{constructor(){super(...arguments),this._unknown=!0}_parse(e){return at(e.data)}};a(Oc,"ZodUnknown");var br=Oc;br.create=t=>new br(O({typeName:re.ZodUnknown},oe(t)));var Lc=class Lc extends le{_parse(e){let r=this._getOrReturnCtx(e);return Z(r,{code:G.invalid_type,expected:U.never,received:r.parsedType}),Q}};a(Lc,"ZodNever");var Ft=Lc;Ft.create=t=>new Ft(O({typeName:re.ZodNever},oe(t)));var Ac=class Ac extends le{_parse(e){if(this._getType(e)!==U.undefined){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.void,received:i.parsedType}),Q}return at(e.data)}};a(Ac,"ZodVoid");var wn=Ac;wn.create=t=>new wn(O({typeName:re.ZodVoid},oe(t)));var _n=class _n extends le{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),n=this._def;if(r.parsedType!==U.array)return Z(r,{code:G.invalid_type,expected:U.array,received:r.parsedType}),Q;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,l=r.data.length<n.exactLength.value;(s||l)&&(Z(r,{code:s?G.too_big:G.too_small,minimum:l?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(Z(r,{code:G.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(Z(r,{code:G.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((s,l)=>n.type._parseAsync(new Mt(r,s,r.path,l)))).then(s=>nt.mergeArray(i,s));let o=[...r.data].map((s,l)=>n.type._parseSync(new Mt(r,s,r.path,l)));return nt.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new _n(j(O({},this._def),{minLength:{value:e,message:V.toString(r)}}))}max(e,r){return new _n(j(O({},this._def),{maxLength:{value:e,message:V.toString(r)}}))}length(e,r){return new _n(j(O({},this._def),{exactLength:{value:e,message:V.toString(r)}}))}nonempty(e){return this.min(1,e)}};a(_n,"ZodArray");var xr=_n;xr.create=(t,e)=>new xr(O({type:t,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray},oe(e)));function Cn(t){if(t instanceof vt){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=wt.create(Cn(i))}return new vt(j(O({},t._def),{shape:a(()=>e,"shape")}))}else return t instanceof xr?new xr(j(O({},t._def),{type:Cn(t.element)})):t instanceof wt?wt.create(Cn(t.unwrap())):t instanceof tr?tr.create(Cn(t.unwrap())):t instanceof er?er.create(t.items.map(e=>Cn(e))):t}a(Cn,"deepPartialify");var St=class St extends le{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(),r=he.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==U.object){let h=this._getOrReturnCtx(e);return Z(h,{code:G.invalid_type,expected:U.object,received:h.parsedType}),Q}let{status:i,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof Ft&&this._def.unknownKeys==="strip"))for(let h in n.data)s.includes(h)||l.push(h);let u=[];for(let h of s){let m=o[h],f=n.data[h];u.push({key:{status:"valid",value:h},value:m._parse(new Mt(n,f,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof Ft){let h=this._def.unknownKeys;if(h==="passthrough")for(let m of l)u.push({key:{status:"valid",value:m},value:{status:"valid",value:n.data[m]}});else if(h==="strict")l.length>0&&(Z(n,{code:G.unrecognized_keys,keys:l}),i.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let h=this._def.catchall;for(let m of l){let f=n.data[m];u.push({key:{status:"valid",value:m},value:h._parse(new Mt(n,f,n.path,m)),alwaysSet:m in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let h=[];for(let m of u){let f=await m.key,b=await m.value;h.push({key:f,value:b,alwaysSet:m.alwaysSet})}return h}).then(h=>nt.mergeObjectSync(i,h)):nt.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new St(O(j(O({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:a((r,i)=>{var o,s,l,u;let n=(l=(s=(o=this._def).errorMap)==null?void 0:s.call(o,r,i).message)!=null?l:i.defaultError;return r.code==="unrecognized_keys"?{message:(u=V.errToObj(e).message)!=null?u:n}:{message:n}},"errorMap")}:{}))}strip(){return new St(j(O({},this._def),{unknownKeys:"strip"}))}passthrough(){return new St(j(O({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new St(j(O({},this._def),{shape:a(()=>O(O({},this._def.shape()),e),"shape")}))}merge(e){return new St({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:a(()=>O(O({},this._def.shape()),e._def.shape()),"shape"),typeName:re.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new St(j(O({},this._def),{catchall:e}))}pick(e){let r={};for(let i of he.objectKeys(e))e[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new St(j(O({},this._def),{shape:a(()=>r,"shape")}))}omit(e){let r={};for(let i of he.objectKeys(this.shape))e[i]||(r[i]=this.shape[i]);return new St(j(O({},this._def),{shape:a(()=>r,"shape")}))}deepPartial(){return Cn(this)}partial(e){let r={};for(let i of he.objectKeys(this.shape)){let n=this.shape[i];e&&!e[i]?r[i]=n:r[i]=n.optional()}return new St(j(O({},this._def),{shape:a(()=>r,"shape")}))}required(e){let r={};for(let i of he.objectKeys(this.shape))if(e&&!e[i])r[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof wt;)o=o._def.innerType;r[i]=o}return new St(j(O({},this._def),{shape:a(()=>r,"shape")}))}keyof(){return Op(he.objectKeys(this.shape))}};a(St,"ZodObject");var vt=St;vt.create=(t,e)=>new vt(O({shape:a(()=>t,"shape"),unknownKeys:"strip",catchall:Ft.create(),typeName:re.ZodObject},oe(e)));vt.strictCreate=(t,e)=>new vt(O({shape:a(()=>t,"shape"),unknownKeys:"strict",catchall:Ft.create(),typeName:re.ZodObject},oe(e)));vt.lazycreate=(t,e)=>new vt(O({shape:t,unknownKeys:"strip",catchall:Ft.create(),typeName:re.ZodObject},oe(e)));var kc=class kc extends le{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function n(o){for(let l of o)if(l.result.status==="valid")return l.result;for(let l of o)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let s=o.map(l=>new gt(l.ctx.common.issues));return Z(r,{code:G.invalid_union,unionErrors:s}),Q}if(a(n,"handleResults"),r.common.async)return Promise.all(i.map(async o=>{let s=j(O({},r),{common:j(O({},r.common),{issues:[]}),parent:null});return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let u of i){let h=j(O({},r),{common:j(O({},r.common),{issues:[]}),parent:null}),m=u._parseSync({data:r.data,path:r.path,parent:h});if(m.status==="valid")return m;m.status==="dirty"&&!o&&(o={result:m,ctx:h}),h.common.issues.length&&s.push(h.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let l=s.map(u=>new gt(u));return Z(r,{code:G.invalid_union,unionErrors:l}),Q}}get options(){return this._def.options}};a(kc,"ZodUnion");var Mi=kc;Mi.create=(t,e)=>new Mi(O({options:t,typeName:re.ZodUnion},oe(e)));var vr=a(t=>t instanceof Ei?vr(t.schema):t instanceof It?vr(t.innerType()):t instanceof Di?[t.value]:t instanceof Oi?t.options:t instanceof Li?he.objectValues(t.enum):t instanceof Ai?vr(t._def.innerType):t instanceof Ti?[void 0]:t instanceof wi?[null]:t instanceof wt?[void 0,...vr(t.unwrap())]:t instanceof tr?[null,...vr(t.unwrap())]:t instanceof So||t instanceof Ri?vr(t.unwrap()):t instanceof ki?vr(t._def.innerType):[],"getDiscriminator"),pa=class pa extends le{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==U.object)return Z(r,{code:G.invalid_type,expected:U.object,received:r.parsedType}),Q;let i=this.discriminator,n=r.data[i],o=this.optionsMap.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Z(r,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){let n=new Map;for(let o of r){let s=vr(o.shape[e]);if(!s.length)throw new Error("A discriminator value for key `".concat(e,"` could not be extracted from all schema options"));for(let l of s){if(n.has(l))throw new Error("Discriminator property ".concat(String(e)," has duplicate value ").concat(String(l)));n.set(l,o)}}return new pa(O({typeName:re.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n},oe(i)))}};a(pa,"ZodDiscriminatedUnion");var ca=pa;function _c(t,e){let r=Qt(t),i=Qt(e);if(t===e)return{valid:!0,data:t};if(r===U.object&&i===U.object){let n=he.objectKeys(e),o=he.objectKeys(t).filter(l=>n.indexOf(l)!==-1),s=O(O({},t),e);for(let l of o){let u=_c(t[l],e[l]);if(!u.valid)return{valid:!1};s[l]=u.data}return{valid:!0,data:s}}else if(r===U.array&&i===U.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<t.length;o++){let s=t[o],l=e[o],u=_c(s,l);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return r===U.date&&i===U.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}a(_c,"mergeValues");var Rc=class Rc extends le{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=a((o,s)=>{if(aa(o)||aa(s))return Q;let l=_c(o.value,s.value);return l.valid?((la(o)||la(s))&&r.dirty(),{status:r.value,value:l.data}):(Z(i,{code:G.invalid_intersection_types}),Q)},"handleParsed");return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,s])=>n(o,s)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};a(Rc,"ZodIntersection");var Ii=Rc;Ii.create=(t,e,r)=>new Ii(O({left:t,right:e,typeName:re.ZodIntersection},oe(r)));var ma=class ma extends le{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==U.array)return Z(i,{code:G.invalid_type,expected:U.array,received:i.parsedType}),Q;if(i.data.length<this._def.items.length)return Z(i,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&i.data.length>this._def.items.length&&(Z(i,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...i.data].map((s,l)=>{let u=this._def.items[l]||this._def.rest;return u?u._parse(new Mt(i,s,i.path,l)):null}).filter(s=>!!s);return i.common.async?Promise.all(o).then(s=>nt.mergeArray(r,s)):nt.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new ma(j(O({},this._def),{rest:e}))}};a(ma,"ZodTuple");var er=ma;er.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new er(O({items:t,typeName:re.ZodTuple,rest:null},oe(e)))};var vo=class vo extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==U.object)return Z(i,{code:G.invalid_type,expected:U.object,received:i.parsedType}),Q;let n=[],o=this._def.keyType,s=this._def.valueType;for(let l in i.data)n.push({key:o._parse(new Mt(i,l,i.path,l)),value:s._parse(new Mt(i,i.data[l],i.path,l)),alwaysSet:l in i.data});return i.common.async?nt.mergeObjectAsync(r,n):nt.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof le?new vo(O({keyType:e,valueType:r,typeName:re.ZodRecord},oe(i))):new vo(O({keyType:Zr.create(),valueType:e,typeName:re.ZodRecord},oe(r)))}};a(vo,"ZodRecord");var ua=vo,Nc=class Nc extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==U.map)return Z(i,{code:G.invalid_type,expected:U.map,received:i.parsedType}),Q;let n=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([l,u],h)=>({key:n._parse(new Mt(i,l,i.path,[h,"key"])),value:o._parse(new Mt(i,u,i.path,[h,"value"]))}));if(i.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let u of s){let h=await u.key,m=await u.value;if(h.status==="aborted"||m.status==="aborted")return Q;(h.status==="dirty"||m.status==="dirty")&&r.dirty(),l.set(h.value,m.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let u of s){let h=u.key,m=u.value;if(h.status==="aborted"||m.status==="aborted")return Q;(h.status==="dirty"||m.status==="dirty")&&r.dirty(),l.set(h.value,m.value)}return{status:r.value,value:l}}}};a(Nc,"ZodMap");var Mn=Nc;Mn.create=(t,e,r)=>new Mn(O({valueType:e,keyType:t,typeName:re.ZodMap},oe(r)));var bo=class bo extends le{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==U.set)return Z(i,{code:G.invalid_type,expected:U.set,received:i.parsedType}),Q;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(Z(i,{code:G.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(Z(i,{code:G.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function s(u){let h=new Set;for(let m of u){if(m.status==="aborted")return Q;m.status==="dirty"&&r.dirty(),h.add(m.value)}return{status:r.value,value:h}}a(s,"finalizeSet");let l=[...i.data.values()].map((u,h)=>o._parse(new Mt(i,u,i.path,h)));return i.common.async?Promise.all(l).then(u=>s(u)):s(l)}min(e,r){return new bo(j(O({},this._def),{minSize:{value:e,message:V.toString(r)}}))}max(e,r){return new bo(j(O({},this._def),{maxSize:{value:e,message:V.toString(r)}}))}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};a(bo,"ZodSet");var In=bo;In.create=(t,e)=>new In(O({valueType:t,minSize:null,maxSize:null,typeName:re.ZodSet},oe(e)));var Pn=class Pn extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==U.function)return Z(r,{code:G.invalid_type,expected:U.function,received:r.parsedType}),Q;function i(l,u){return fo({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xn(),gr].filter(h=>!!h),issueData:{code:G.invalid_arguments,argumentsError:u}})}a(i,"makeArgsIssue");function n(l,u){return fo({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xn(),gr].filter(h=>!!h),issueData:{code:G.invalid_return_type,returnTypeError:u}})}a(n,"makeReturnsIssue");let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof jr){let l=this;return at(async function(...u){let h=new gt([]),m=await l._def.args.parseAsync(u,o).catch(y=>{throw h.addIssue(i(u,y)),h}),f=await Reflect.apply(s,this,m);return await l._def.returns._def.type.parseAsync(f,o).catch(y=>{throw h.addIssue(n(f,y)),h})})}else{let l=this;return at(function(...u){let h=l._def.args.safeParse(u,o);if(!h.success)throw new gt([i(u,h.error)]);let m=Reflect.apply(s,this,h.data),f=l._def.returns.safeParse(m,o);if(!f.success)throw new gt([n(m,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Pn(j(O({},this._def),{args:er.create(e).rest(br.create())}))}returns(e){return new Pn(j(O({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,i){return new Pn(O({args:e||er.create([]).rest(br.create()),returns:r||br.create(),typeName:re.ZodFunction},oe(i)))}};a(Pn,"ZodFunction");var ha=Pn,Bc=class Bc extends le{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};a(Bc,"ZodLazy");var Ei=Bc;Ei.create=(t,e)=>new Ei(O({getter:t,typeName:re.ZodLazy},oe(e)));var Fc=class Fc extends le{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Z(r,{received:r.data,code:G.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};a(Fc,"ZodLiteral");var Di=Fc;Di.create=(t,e)=>new Di(O({value:t,typeName:re.ZodLiteral},oe(e)));function Op(t,e){return new Oi(O({values:t,typeName:re.ZodEnum},oe(e)))}a(Op,"createZodEnum");var xo=class xo extends le{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return Z(r,{expected:he.joinValues(i),received:r.parsedType,code:G.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),i=this._def.values;return Z(r,{received:r.data,code:G.invalid_enum_value,options:i}),Q}return at(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return xo.create(e,O(O({},this._def),r))}exclude(e,r=this._def){return xo.create(this.options.filter(i=>!e.includes(i)),O(O({},this._def),r))}};a(xo,"ZodEnum");var Oi=xo;Oi.create=Op;var Gc=class Gc extends le{_parse(e){let r=he.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==U.string&&i.parsedType!==U.number){let n=he.objectValues(r);return Z(i,{expected:he.joinValues(n),received:i.parsedType,code:G.invalid_type}),Q}if(this._cache||(this._cache=new Set(he.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=he.objectValues(r);return Z(i,{received:i.data,code:G.invalid_enum_value,options:n}),Q}return at(e.data)}get enum(){return this._def.values}};a(Gc,"ZodNativeEnum");var Li=Gc;Li.create=(t,e)=>new Li(O({values:t,typeName:re.ZodNativeEnum},oe(e)));var Xc=class Xc extends le{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==U.promise&&r.common.async===!1)return Z(r,{code:G.invalid_type,expected:U.promise,received:r.parsedType}),Q;let i=r.parsedType===U.promise?r.data:Promise.resolve(r.data);return at(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};a(Xc,"ZodPromise");var jr=Xc;jr.create=(t,e)=>new jr(O({type:t,typeName:re.ZodPromise},oe(e)));var zc=class zc extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:a(s=>{Z(i,s),s.fatal?r.abort():r.dirty()},"addIssue"),get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async l=>{if(r.value==="aborted")return Q;let u=await this._def.schema._parseAsync({data:l,path:i.path,parent:i});return u.status==="aborted"?Q:u.status==="dirty"?bi(u.value):r.value==="dirty"?bi(u.value):u});{if(r.value==="aborted")return Q;let l=this._def.schema._parseSync({data:s,path:i.path,parent:i});return l.status==="aborted"?Q:l.status==="dirty"?bi(l.value):r.value==="dirty"?bi(l.value):l}}if(n.type==="refinement"){let s=a(l=>{let u=n.refinement(l,o);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l},"executeRefinement");if(i.common.async===!1){let l=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return l.status==="aborted"?Q:(l.status==="dirty"&&r.dirty(),s(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(l=>l.status==="aborted"?Q:(l.status==="dirty"&&r.dirty(),s(l.value).then(()=>({status:r.value,value:l.value}))))}if(n.type==="transform")if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Yr(s))return Q;let l=n.transform(s.value,o);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>Yr(s)?Promise.resolve(n.transform(s.value,o)).then(l=>({status:r.value,value:l})):Q);he.assertNever(n)}};a(zc,"ZodEffects");var It=zc;It.create=(t,e,r)=>new It(O({schema:t,typeName:re.ZodEffects,effect:e},oe(r)));It.createWithPreprocess=(t,e,r)=>new It(O({schema:e,effect:{type:"preprocess",transform:t},typeName:re.ZodEffects},oe(r)));var Yc=class Yc extends le{_parse(e){return this._getType(e)===U.undefined?at(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};a(Yc,"ZodOptional");var wt=Yc;wt.create=(t,e)=>new wt(O({innerType:t,typeName:re.ZodOptional},oe(e)));var Zc=class Zc extends le{_parse(e){return this._getType(e)===U.null?at(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};a(Zc,"ZodNullable");var tr=Zc;tr.create=(t,e)=>new tr(O({innerType:t,typeName:re.ZodNullable},oe(e)));var Uc=class Uc extends le{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===U.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};a(Uc,"ZodDefault");var Ai=Uc;Ai.create=(t,e)=>new Ai(O({innerType:t,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},oe(e)));var jc=class jc extends le{_parse(e){let{ctx:r}=this._processInputParams(e),i=j(O({},r),{common:j(O({},r.common),{issues:[]})}),n=this._def.innerType._parse({data:i.data,path:i.path,parent:O({},i)});return Sn(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new gt(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new gt(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};a(jc,"ZodCatch");var ki=jc;ki.create=(t,e)=>new ki(O({innerType:t,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},oe(e)));var Hc=class Hc extends le{_parse(e){if(this._getType(e)!==U.nan){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.nan,received:i.parsedType}),Q}return{status:"valid",value:e.data}}};a(Hc,"ZodNaN");var En=Hc;En.create=t=>new En(O({typeName:re.ZodNaN},oe(t)));var yv=Symbol("zod_brand"),Wc=class Wc extends le{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}};a(Wc,"ZodBranded");var So=Wc,fa=class fa extends le{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.common.async)return a(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?Q:o.status==="dirty"?(r.dirty(),bi(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})},"handleAsync")();{let n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?Q:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(e,r){return new fa({in:e,out:r,typeName:re.ZodPipeline})}};a(fa,"ZodPipeline");var Co=fa,Vc=class Vc extends le{_parse(e){let r=this._def.innerType._parse(e),i=a(n=>(Yr(n)&&(n.value=Object.freeze(n.value)),n),"freeze");return Sn(r)?r.then(n=>i(n)):i(r)}unwrap(){return this._def.innerType}};a(Vc,"ZodReadonly");var Ri=Vc;Ri.create=(t,e)=>new Ri(O({innerType:t,typeName:re.ZodReadonly},oe(e)));function Mp(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}a(Mp,"cleanParams");function Lp(t,e={},r){return t?Ur.create().superRefine((i,n)=>{var s,l;let o=t(i);if(o instanceof Promise)return o.then(u=>{var h,m;if(!u){let f=Mp(e,i),b=(m=(h=f.fatal)!=null?h:r)!=null?m:!0;n.addIssue(j(O({code:"custom"},f),{fatal:b}))}});if(!o){let u=Mp(e,i),h=(l=(s=u.fatal)!=null?s:r)!=null?l:!0;n.addIssue(j(O({code:"custom"},u),{fatal:h}))}}):Ur.create()}a(Lp,"custom");var gv={object:vt.lazycreate},re;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(re||(re={}));var vv=a((t,e={message:"Input not instance of ".concat(t.name)})=>Lp(r=>r instanceof t,e),"instanceOfType"),Ap=Zr.create,kp=Si.create,bv=En.create,xv=Ci.create,Rp=_i.create,Sv=Pi.create,Cv=Tn.create,_v=Ti.create,Pv=wi.create,Tv=Ur.create,wv=br.create,Mv=Ft.create,Iv=wn.create,Ev=xr.create,Dv=vt.create,Ov=vt.strictCreate,Lv=Mi.create,Av=ca.create,kv=Ii.create,Rv=er.create,Nv=ua.create,Bv=Mn.create,Fv=In.create,Gv=ha.create,Xv=Ei.create,zv=Di.create,Yv=Oi.create,Zv=Li.create,Uv=jr.create,jv=It.create,Hv=wt.create,Wv=tr.create,Vv=It.createWithPreprocess,qv=Co.create,$v=a(()=>Ap().optional(),"ostring"),Jv=a(()=>kp().optional(),"onumber"),Kv=a(()=>Rp().optional(),"oboolean"),Qv={string:a(t=>Zr.create(j(O({},t),{coerce:!0})),"string"),number:a(t=>Si.create(j(O({},t),{coerce:!0})),"number"),boolean:a(t=>_i.create(j(O({},t),{coerce:!0})),"boolean"),bigint:a(t=>Ci.create(j(O({},t),{coerce:!0})),"bigint"),date:a(t=>Pi.create(j(O({},t),{coerce:!0})),"date")};var eb=Q;var Np=I;var Hr=Np;var Bp=I.union([I.enum(["low","medium","high","always-visible"]),I.number()]),Fp=["","","low","medium","high","always-visible"],tb=2,rb=3;var Ni=5;function Gp(t){return Math.min(Ni,Math.max(tb,t))}a(Gp,"clampTierNumber");function Dn(t){if(typeof t=="number")return Gp(t);let e=Fp.indexOf(t);return e===-1?rb:e}a(Dn,"convertCollisionRankingTierToNumber");function _o(t){let e=Gp(t);return Fp[e]}a(_o,"convertNumberToCollisionRankingTier");function Xp(t,e,r){let i,n,o,s=null,l=0;r||(r={});let u=a(function(){l=r.leading===!1?0:Date.now(),s=null,o=t.apply(i,n),s||(i=n=null)},"later");return function(){let h=Date.now();!l&&r.leading===!1&&(l=h);let m=e-(h-l);return i=globalThis,n=arguments,m<=0||m>e?(s&&(clearTimeout(s),s=null),l=h,o=t.apply(i,n),s||(i=n=null)):!s&&r.trailing!==!1&&(s=setTimeout(u,m)),o}}a(Xp,"throttle");function zp(t){let e=t[0].map(r=>{let i=r[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:r[1]===1,rank:r[2]===1?Ni:0,x:r[3],y:r[4],shouldCollideWithScreenEdges:r[5]===1,bboxes:i,lockedToStrategyIndex:r[6]}});return{msgId:"-1",totalWidth:t[3],totalHeight:t[2],watermarkWidth:t[4],watermarkHeight:t[5],watermarkPosition:t[6],colliders:e,devicePixelRatio:t[1]}}a(zp,"unpackMessage");v();v();var Wr=200,ya=10;function Yp(t,e,r,i,n,o,s="-1"){let l=1/0,u=1/0,h=-1/0,m=-1/0,f=new Se(-ya,0,5,r),b=new Se(-ya,0,e,5),y=new Se(e-5,0,e+ya,r),_=new Se(0,r-5,e,r+ya),T=ib(e,r,i,n,o),g=[f,b,y,_],x=new Se(-Wr,-Wr,e+Wr*2,r+Wr*2);for(let w of t){let k,A;for(let N=0;N<w.bboxes.length;N++){if(w.bboxes[N]==null||(k=w.bboxes[N].boundingBox,A=w.bboxes[N].index,w.lockedToStrategyIndex!==-1&&A!==w.lockedToStrategyIndex))continue;let[Y,z,X,q]=k,[F,J,pe,se]=[w.y-Y,w.y+z,w.x-X,w.x+q],De=pe,ve=F,ge=se-pe,xe=J-F;l=Math.min(l,De)-Wr,u=Math.min(u,ve)-Wr,h=Math.max(h,De+ge)+Wr,m=Math.max(m,ve+xe)+Wr,w.bboxes[N].boundingRect=new Se(De,ve,ge,xe)}}let P={msgId:s,colliders:new Array(t.length),debug:[]},S=new Tt(new Se(l,u,h-l,m-u)),C;for(let w=0;w<t.length;w++)if(C=t[w],P.colliders[w]=[-1,0],C.enabledAndVisible){let[k,A,N]=[1/0,-1,void 0];for(let{index:Y,boundingRect:z}of C.bboxes){if(z==null)continue;let X=[];if(X=S.queryRect(z).filter(F=>z.intersects(F)),C.shouldCollideWithScreenEdges&&g.forEach(F=>{z.intersects(F)&&X.push(F)}),z.intersects(T)){P.colliders[w]=[-1,0,z];break}if(X.length<=k&&(N=z,A=Y,k=X.length),X.length===0){S.insert(z),P.colliders[w]=[Y,x.contains(z)?0:1,z];break}}C.rank===Ni&&N!=null&&(S.insert(N),P.colliders[w]=[A,x.contains(N)?0:1,N])}else P.colliders[w]=[-1,0];return P}a(Yp,"processColliders");function ib(t,e,r,i,n){switch(n){case"top-right":return new Se(t-r,0,r,i);case"bottom-left":return new Se(0,e-i,r,i);case"bottom-right":return new Se(t-r,e-i,r,i);case"top-left":return new Se(0,0,r,i)}}a(ib,"getWatermarkBoundary");var qc=class qc{constructor(){p(this,"onerror",a(()=>{},"onerror"));p(this,"onmessage",a(()=>{},"onmessage"));p(this,"postMessage",a(e=>{let r=zp(e);this.onmessage({data:Yp(r.colliders,r.totalWidth,r.totalHeight,r.watermarkWidth,r.watermarkHeight,r.watermarkPosition,r.msgId)})},"postMessage"));p(this,"terminate",a(()=>{},"terminate"))}};a(qc,"SyncWorker");var Po=qc;v();v();v();function ga(t){"@babel/helpers - typeof";return ga=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ga(t)}a(ga,"_typeof");var nb=/^\s+/,ob=/\s+$/;function W(t,e){if(t=t||"",e=e||{},t instanceof W)return t;if(!(this instanceof W))return new W(t,e);var r=sb(t);this._originalInput=t,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||r.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}a(W,"tinycolor");W.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 e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},"getBrightness"),getLuminance:a(function(){var e=this.toRgb(),r,i,n,o,s,l;return r=e.r/255,i=e.g/255,n=e.b/255,r<=.03928?o=r/12.92:o=Math.pow((r+.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(e){return this._a=qp(e),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:a(function(){var e=Up(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},"toHsv"),toHsvString:a(function(){var e=Up(this._r,this._g,this._b),r=Math.round(e.h*360),i=Math.round(e.s*100),n=Math.round(e.v*100);return this._a==1?"hsv("+r+", "+i+"%, "+n+"%)":"hsva("+r+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHsvString"),toHsl:a(function(){var e=Zp(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},"toHsl"),toHslString:a(function(){var e=Zp(this._r,this._g,this._b),r=Math.round(e.h*360),i=Math.round(e.s*100),n=Math.round(e.l*100);return this._a==1?"hsl("+r+", "+i+"%, "+n+"%)":"hsla("+r+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHslString"),toHex:a(function(e){return jp(this._r,this._g,this._b,e)},"toHex"),toHexString:a(function(e){return"#"+this.toHex(e)},"toHexString"),toHex8:a(function(e){return ub(this._r,this._g,this._b,this._a,e)},"toHex8"),toHex8String:a(function(e){return"#"+this.toHex8(e)},"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(Ae(this._r,255)*100)+"%",g:Math.round(Ae(this._g,255)*100)+"%",b:Math.round(Ae(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:a(function(){return this._a==1?"rgb("+Math.round(Ae(this._r,255)*100)+"%, "+Math.round(Ae(this._g,255)*100)+"%, "+Math.round(Ae(this._b,255)*100)+"%)":"rgba("+Math.round(Ae(this._r,255)*100)+"%, "+Math.round(Ae(this._g,255)*100)+"%, "+Math.round(Ae(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:a(function(){return this._a===0?"transparent":this._a<1?!1:Cb[jp(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:a(function(e){var r="#"+Hp(this._r,this._g,this._b,this._a),i=r,n=this._gradientType?"GradientType = 1, ":"";if(e){var o=W(e);i="#"+Hp(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+r+",endColorstr="+i+")"},"toFilter"),toString:a(function(e){var r=!!e;e=e||this._format;var i=!1,n=this._a<1&&this._a>=0,o=!r&&n&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return o?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(i=this.toRgbString()),e==="prgb"&&(i=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(i=this.toHexString()),e==="hex3"&&(i=this.toHexString(!0)),e==="hex4"&&(i=this.toHex8String(!0)),e==="hex8"&&(i=this.toHex8String()),e==="name"&&(i=this.toName()),e==="hsl"&&(i=this.toHslString()),e==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},"toString"),clone:a(function(){return W(this.toString())},"clone"),_applyModification:a(function(e,r){var i=e.apply(null,[this].concat([].slice.call(r)));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(mb,arguments)},"lighten"),brighten:a(function(){return this._applyModification(fb,arguments)},"brighten"),darken:a(function(){return this._applyModification(yb,arguments)},"darken"),desaturate:a(function(){return this._applyModification(hb,arguments)},"desaturate"),saturate:a(function(){return this._applyModification(db,arguments)},"saturate"),greyscale:a(function(){return this._applyModification(pb,arguments)},"greyscale"),spin:a(function(){return this._applyModification(gb,arguments)},"spin"),_applyCombination:a(function(e,r){return e.apply(null,[this].concat([].slice.call(r)))},"_applyCombination"),analogous:a(function(){return this._applyCombination(xb,arguments)},"analogous"),complement:a(function(){return this._applyCombination(vb,arguments)},"complement"),monochromatic:a(function(){return this._applyCombination(Sb,arguments)},"monochromatic"),splitcomplement:a(function(){return this._applyCombination(bb,arguments)},"splitcomplement"),triad:a(function(){return this._applyCombination(Wp,[3])},"triad"),tetrad:a(function(){return this._applyCombination(Wp,[4])},"tetrad")};W.fromRatio=function(t,e){if(ga(t)=="object"){var r={};for(var i in t)t.hasOwnProperty(i)&&(i==="a"?r[i]=t[i]:r[i]=To(t[i]));t=r}return W(t,e)};function sb(t){var e={r:0,g:0,b:0},r=1,i=null,n=null,o=null,s=!1,l=!1;return typeof t=="string"&&(t=wb(t)),ga(t)=="object"&&(Sr(t.r)&&Sr(t.g)&&Sr(t.b)?(e=ab(t.r,t.g,t.b),s=!0,l=String(t.r).substr(-1)==="%"?"prgb":"rgb"):Sr(t.h)&&Sr(t.s)&&Sr(t.v)?(i=To(t.s),n=To(t.v),e=cb(t.h,i,n),s=!0,l="hsv"):Sr(t.h)&&Sr(t.s)&&Sr(t.l)&&(i=To(t.s),o=To(t.l),e=lb(t.h,i,o),s=!0,l="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=qp(r),{ok:s,format:t.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:r}}a(sb,"inputToRGB");function ab(t,e,r){return{r:Ae(t,255)*255,g:Ae(e,255)*255,b:Ae(r,255)*255}}a(ab,"rgbToRgb");function Zp(t,e,r){t=Ae(t,255),e=Ae(e,255),r=Ae(r,255);var i=Math.max(t,e,r),n=Math.min(t,e,r),o,s,l=(i+n)/2;if(i==n)o=s=0;else{var u=i-n;switch(s=l>.5?u/(2-i-n):u/(i+n),i){case t:o=(e-r)/u+(e<r?6:0);break;case e:o=(r-t)/u+2;break;case r:o=(t-e)/u+4;break}o/=6}return{h:o,s,l}}a(Zp,"rgbToHsl");function lb(t,e,r){var i,n,o;t=Ae(t,360),e=Ae(e,100),r=Ae(r,100);function s(h,m,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?h+(m-h)*6*f:f<1/2?m:f<2/3?h+(m-h)*(2/3-f)*6:h}if(a(s,"hue2rgb"),e===0)i=n=o=r;else{var l=r<.5?r*(1+e):r+e-r*e,u=2*r-l;i=s(u,l,t+1/3),n=s(u,l,t),o=s(u,l,t-1/3)}return{r:i*255,g:n*255,b:o*255}}a(lb,"hslToRgb");function Up(t,e,r){t=Ae(t,255),e=Ae(e,255),r=Ae(r,255);var i=Math.max(t,e,r),n=Math.min(t,e,r),o,s,l=i,u=i-n;if(s=i===0?0:u/i,i==n)o=0;else{switch(i){case t:o=(e-r)/u+(e<r?6:0);break;case e:o=(r-t)/u+2;break;case r:o=(t-e)/u+4;break}o/=6}return{h:o,s,v:l}}a(Up,"rgbToHsv");function cb(t,e,r){t=Ae(t,360)*6,e=Ae(e,100),r=Ae(r,100);var i=Math.floor(t),n=t-i,o=r*(1-e),s=r*(1-n*e),l=r*(1-(1-n)*e),u=i%6,h=[r,s,o,o,l,r][u],m=[l,r,r,s,o,o][u],f=[o,o,l,r,r,s][u];return{r:h*255,g:m*255,b:f*255}}a(cb,"hsvToRgb");function jp(t,e,r,i){var n=[Xt(Math.round(t).toString(16)),Xt(Math.round(e).toString(16)),Xt(Math.round(r).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(jp,"rgbToHex");function ub(t,e,r,i,n){var o=[Xt(Math.round(t).toString(16)),Xt(Math.round(e).toString(16)),Xt(Math.round(r).toString(16)),Xt($p(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(ub,"rgbaToHex");function Hp(t,e,r,i){var n=[Xt($p(i)),Xt(Math.round(t).toString(16)),Xt(Math.round(e).toString(16)),Xt(Math.round(r).toString(16))];return n.join("")}a(Hp,"rgbaToArgbHex");W.equals=function(t,e){return!t||!e?!1:W(t).toRgbString()==W(e).toRgbString()};W.random=function(){return W.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function hb(t,e){e=e===0?0:e||10;var r=W(t).toHsl();return r.s-=e/100,r.s=va(r.s),W(r)}a(hb,"_desaturate");function db(t,e){e=e===0?0:e||10;var r=W(t).toHsl();return r.s+=e/100,r.s=va(r.s),W(r)}a(db,"_saturate");function pb(t){return W(t).desaturate(100)}a(pb,"_greyscale");function mb(t,e){e=e===0?0:e||10;var r=W(t).toHsl();return r.l+=e/100,r.l=va(r.l),W(r)}a(mb,"_lighten");function fb(t,e){e=e===0?0:e||10;var r=W(t).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(e/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(e/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(e/100)))),W(r)}a(fb,"_brighten");function yb(t,e){e=e===0?0:e||10;var r=W(t).toHsl();return r.l-=e/100,r.l=va(r.l),W(r)}a(yb,"_darken");function gb(t,e){var r=W(t).toHsl(),i=(r.h+e)%360;return r.h=i<0?360+i:i,W(r)}a(gb,"_spin");function vb(t){var e=W(t).toHsl();return e.h=(e.h+180)%360,W(e)}a(vb,"_complement");function Wp(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var r=W(t).toHsl(),i=[W(t)],n=360/e,o=1;o<e;o++)i.push(W({h:(r.h+o*n)%360,s:r.s,l:r.l}));return i}a(Wp,"polyad");function bb(t){var e=W(t).toHsl(),r=e.h;return[W(t),W({h:(r+72)%360,s:e.s,l:e.l}),W({h:(r+216)%360,s:e.s,l:e.l})]}a(bb,"_splitcomplement");function xb(t,e,r){e=e||6,r=r||30;var i=W(t).toHsl(),n=360/r,o=[W(t)];for(i.h=(i.h-(n*e>>1)+720)%360;--e;)i.h=(i.h+n)%360,o.push(W(i));return o}a(xb,"_analogous");function Sb(t,e){e=e||6;for(var r=W(t).toHsv(),i=r.h,n=r.s,o=r.v,s=[],l=1/e;e--;)s.push(W({h:i,s:n,v:o})),o=(o+l)%1;return s}a(Sb,"_monochromatic");W.mix=function(t,e,r){r=r===0?0:r||50;var i=W(t).toRgb(),n=W(e).toRgb(),o=r/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 W(s)};W.readability=function(t,e){var r=W(t),i=W(e);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};W.isReadable=function(t,e,r){var i=W.readability(t,e),n,o;switch(o=!1,n=Mb(r),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};W.mostReadable=function(t,e,r){var i=null,n=0,o,s,l,u;r=r||{},s=r.includeFallbackColors,l=r.level,u=r.size;for(var h=0;h<e.length;h++)o=W.readability(t,e[h]),o>n&&(n=o,i=W(e[h]));return W.isReadable(t,i,{level:l,size:u})||!s?i:(r.includeFallbackColors=!1,W.mostReadable(t,["#fff","#000"],r))};var $c=W.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"},Cb=W.hexNames=_b($c);function _b(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}a(_b,"flip");function qp(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}a(qp,"boundAlpha");function Ae(t,e){Pb(t)&&(t="100%");var r=Tb(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}a(Ae,"bound01");function va(t){return Math.min(1,Math.max(0,t))}a(va,"clamp01");function Ct(t){return parseInt(t,16)}a(Ct,"parseIntFromHex");function Pb(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}a(Pb,"isOnePointZero");function Tb(t){return typeof t=="string"&&t.indexOf("%")!=-1}a(Tb,"isPercentage");function Xt(t){return t.length==1?"0"+t:""+t}a(Xt,"pad2");function To(t){return t<=1&&(t=t*100+"%"),t}a(To,"convertToPercentage");function $p(t){return Math.round(parseFloat(t)*255).toString(16)}a($p,"convertDecimalToHex");function Vp(t){return Ct(t)/255}a(Vp,"convertHexToDecimal");var Gt=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),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 Sr(t){return!!Gt.CSS_UNIT.exec(t)}a(Sr,"isValidCSSUnit");function wb(t){t=t.replace(nb,"").replace(ob,"").toLowerCase();var e=!1;if($c[t])t=$c[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Gt.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Gt.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Gt.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Gt.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Gt.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Gt.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Gt.hex8.exec(t))?{r:Ct(r[1]),g:Ct(r[2]),b:Ct(r[3]),a:Vp(r[4]),format:e?"name":"hex8"}:(r=Gt.hex6.exec(t))?{r:Ct(r[1]),g:Ct(r[2]),b:Ct(r[3]),format:e?"name":"hex"}:(r=Gt.hex4.exec(t))?{r:Ct(r[1]+""+r[1]),g:Ct(r[2]+""+r[2]),b:Ct(r[3]+""+r[3]),a:Vp(r[4]+""+r[4]),format:e?"name":"hex8"}:(r=Gt.hex3.exec(t))?{r:Ct(r[1]+""+r[1]),g:Ct(r[2]+""+r[2]),b:Ct(r[3]+""+r[3]),format:e?"name":"hex"}:!1}a(wb,"stringInputToObject");function Mb(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:e,size:r}}a(Mb,"validateWCAG2Parms");v();v();var Jc=class Jc{constructor(){p(this,"hover",!1);p(this,"dirty",!1)}};a(Jc,"InteractionComponent");var On=Jc;v();var Fm=Ns(Mm());v();v();v();var bx=Hr.enum(ep),xx=a(t=>{let e=t[0];for(let r=1;r<t.length;r++){let i=t[r];if(i<=e)return!1;e=i}return!0},"isStrictlyIncreasing"),Sx=a(t=>{let e=t[0];for(let r=1;r<t.length;r++){let i=t[r];if(i>=e)return!1;e=i}return!0},"isStrictlyDecreasing"),Cx=a(t=>xx(t)||Sx(t),"isStrictlyIncreasingOrDecreasing"),Im=Hr.object({on:Hr.literal("zoom-level"),input:Hr.array(Hr.number()).nonempty().refine(Cx,{message:"input array must be strictly increasing or decreasing"}),output:Hr.array(Hr.number()).nonempty(),easing:bx.default("linear")}).refine(t=>t.input.length===t.output.length,{message:"input and output must have the same length"});var Em=I.object({margin:I.number().min(6).default(6),maxLines:I.number().min(1).default(2),textSize:I.number().min(0).default(11.5),maxWidth:I.number().min(0).default(150),lineHeight:I.number().min(0).default(1.2),color:I.string().default("#333"),outlineColor:I.string().default("white"),textColor:I.string().optional(),textOutlineColor:I.string().optional(),pinColor:I.string().optional(),pinOutlineColor:I.string().optional(),pinColorInactive:I.string().optional(),pinOutlineColorInactive:I.string().optional(),icon:I.string().optional(),iconSize:I.number().min(0).default(20),iconScale:I.union([I.number(),Im]).default(1),iconPadding:I.number().min(0).default(2),iconFit:I.enum(["fill","contain","cover"]).default("cover"),iconOverflow:I.enum(["visible","hidden"]).default("hidden"),iconVisibleAtZoomLevel:I.number().default(-1/0)}),Dm=Em.transform(t=>{var e,r,i,n,o,s,l,u;return j(O({},t),{textColor:(e=t.textColor)!=null?e:t.color,textOutlineColor:(r=t.textOutlineColor)!=null?r:t.outlineColor,pinColor:(i=t.pinColor)!=null?i:t.color,pinOutlineColor:(n=t.pinOutlineColor)!=null?n:t.outlineColor,pinColorInactive:(s=t.pinColorInactive)!=null?s:W((o=t.pinColor)!=null?o:t.color).setAlpha(.5).toRgbString(),pinOutlineColorInactive:(u=t.pinOutlineColorInactive)!=null?u:W((l=t.pinOutlineColor)!=null?l:t.outlineColor).setAlpha(.5).toRgbString()})}),AI=Em.strict(),Om=a(t=>Dm.parse(t),"parseLabelAppearance"),_x=I.object({rank:Bp.optional(),appearance:Dm.optional(),interactive:I.boolean().default(!1)}),cu=a(t=>{_x.parse(t!=null?t:{})},"validateLabelOptions"),Lm=a((t,e,r)=>{I.array(I.number()).min(2).max(3).parse(t),I.string().parse(e),cu(r)},"validateLabel"),Am=["color","outlineColor","margin"],Px=[...Am,"maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"],Tx=[...Am,"icon","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"],km=a((t,e)=>Px.some(r=>e[r]!=null&&t[r]!==e[r]),"isOneOfTextDirtyOptions"),Rm=a((t,e)=>Tx.some(r=>e[r]!=null&&t[r]!==e[r]),"isOneOfPinDirtyOptions");var Ix="LOW_PRIORITY",Nm=4,Ex=6,Bm=6.5,Dx={heightAbovePolygon:0},Gi=class Gi{constructor(e,r,i){p(this,"lines",0);p(this,"id");p(this,"rank");p(this,"type","label");p(this,"initialRank");p(this,"contextConfigured",!1);p(this,"fillText");p(this,"newStyle",{});p(this,"opacity",0);p(this,"visibilityNeedsUpdate",!1);p(this,"text");p(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});p(this,"projection",new ae);p(this,"labelCacheId");p(this,"_cache",{});p(this,"appearance");p(this,"options");p(this,"visible",!0);p(this,"enabled",!0);p(this,"isOccluded",!1);p(this,"offscreen",!1);p(this,"canShow",!1);p(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});p(this,"dimensions",{width:0,height:0});p(this,"currentStrategyIndex",-1);p(this,"totalMarkerSize",0);p(this,"iconScale",1);p(this,"iconPadding");p(this,"dirty",!0);p(this,"textDirty",!0);p(this,"markerDirty",!0);p(this,"attachedDirty",!0);p(this,"collisionDirty",!0);p(this,"lastTextAlign");p(this,"imageHash");p(this,"markerSize",0);p(this,"iconVisible",!1);p(this,"dp");p(this,"animate",!0);p(this,"onStrategySelected",a(e=>{if(this.currentStrategyIndex===e)return;this.currentStrategyIndex=e;let r=this.strategies[this.currentStrategyIndex];if(r){r.onStrategySelected();let i=this.style;this.style=this.newStyle,this.newStyle=i}},"onStrategySelected"));p(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});var o,s;if(this.id=(o=r.id)!=null?o:Jt(),this.options=(0,Fm.default)({},r,Dx),this.text=e,this.dp=(l=1)=>l*i.pixelRatio,typeof r.rank=="string")this.rank=Dn(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let l=Math.trunc(E.env.NODE_ENV==="test"?Gi.testId:Gi.testId*10)/10;Gi.testId+=.001,this.rank=l,this.initialRank=l}let n=Om((s=r.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 e=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.markerSize=this.dp(this.appearance.iconSize):this.markerSize=this.dp(Bm),this.totalMarkerSize=Math.ceil((this.markerSize+2.5)/e)}get lowPriorityStrategyIndex(){return this.text===""?-1:3}get strategies(){let{width:e,height:r}=this.dimensions,{margin:i}=this.appearance,n=Math.max(Ex,i),o=this.iconVisible?n/2:0,s=this.iconVisible?this.scaledMarkerSize:Bm/2,l=[{name:"RIGHT",getBoundingBox:a(()=>{let u=Math.max(this.scaledMarkerSize,r);return[u/2+n,u/2+n,this.scaledMarkerSize/2+n,this.scaledMarkerSize/2+e+n]},"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=this.scaledMarkerSize/2+Nm,this.newStyle.textLabelVisible=!0},"onStrategySelected")},{name:"LEFT",getBoundingBox:a(()=>{let u=Math.max(this.scaledMarkerSize,r);return[u/2+n,u/2+n,this.scaledMarkerSize/2+e+n,this.scaledMarkerSize/2+n]},"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=-e-this.scaledMarkerSize/2-Nm,this.newStyle.textLabelVisible=!0},"onStrategySelected")},{name:"TOP",getBoundingBox:a(()=>{let u=this.dp();return[r+this.scaledMarkerSize/2/u+n,this.scaledMarkerSize/2+n,e/2+n,e/2+n]},"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r-this.scaledMarkerSize/2,this.newStyle.left=-e/2},"onStrategySelected")},{name:Ix,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(e=this.iconScale){if(this.iconScale!==e||this.dirty){let r=this.strategies[this.currentStrategyIndex];if(this.iconScale=e,this.collisionDirty=!0,r){r.onStrategySelected(e);let i=this.style;this.style=this.newStyle,this.newStyle=i}this.dirty=!1}}updatePosition(){}disable(){this.visible=!1}toPackedMessage(e=!1){var r;if(this.visible&&e&&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!==((r=this.packedMessage.bboxes[0])==null?void 0:r[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(Gi,"LabelComponent"),p(Gi,"testId",0);var uu=Gi,rr=uu;v();var yf=Ns(mf());var No=4,_C=8,PC="0.6",ff="low-priority-pin",Cu=I.object({rank:I.union([I.enum(["low","medium","high","always-visible"]),I.number()]).optional(),interactive:I.union([I.boolean(),I.literal("pointer-events-auto")]).optional(),id:I.string().optional(),placement:I.union([I.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]),I.array(I.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]))]).optional(),dynamicResize:I.boolean().optional(),zIndex:I.number().optional(),lowPriorityPin:I.object({enabled:I.boolean().optional(),size:I.number().positive().optional(),color:I.string().optional()}).optional()});function gf(t,e,r){I.array(I.number()).min(2).max(3).parse(t),I.string().parse(e),Cu.parse(r)}a(gf,"validateMarker");var TC=Object.freeze({enabled:!0,size:_C,color:"#666"}),Zi=class Zi{constructor(e,r={}){p(this,"id");p(this,"type","marker");p(this,"rank",0);p(this,"initialRank",0);p(this,"activePlacement","center");p(this,"pointerEvents","none");p(this,"options",{rank:"low",interactive:!1,id:"",placement:"center",dynamicResize:!1,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:O({},TC)});p(this,"projection",new ae);p(this,"enabled",!0);p(this,"canShow",!1);p(this,"visible",!0);p(this,"isOccluded",!1);p(this,"offscreen",!1);p(this,"strategyIndex",-1);p(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});p(this,"dimensions",{width:0,height:0});p(this,"markerContainer");p(this,"containerEl");p(this,"contentEl",null);p(this,"contentHtml","");p(this,"style",{top:"0px",left:"0px"});p(this,"dirty",!1);p(this,"attachedDirty",!0);p(this,"collisionDirty",!0);p(this,"visibilityNeedsUpdate","show");p(this,"animation",null);p(this,"currentStrategyIndex",-1);p(this,"onStrategySelected",a((e,r=!1)=>{var n,o;if(this.currentStrategyIndex===e&&!r)return;if(this.currentStrategyIndex=e,e===this.lowPriorityPinStrategyIndex){this.activePlacement="center",this.markerContainer.setAttribute("data-placement",ff);let s=this.options.lowPriorityPin,l=s.size,u=s.color;this.markerContainer.style.setProperty("--mappedin-pin-size","".concat(l,"px")),this.markerContainer.style.setProperty("--pin-color",u),this.markerContainer.style.opacity=PC,this.style.top=-l/2+"px",this.style.left=-l/2+"px"}else{this.activePlacement=(o=(n=this.strategies[e])==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,u=-l/2+"px",h=-s/2+"px";switch(this.style.top=u,this.style.left=h,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=u,this.style.left=h}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left},"onStrategySelected"));p(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!1});var i,n,o;if(this.id=(r==null?void 0:r.id)||Jt(),this.options=(0,yf.default)(this.options,r),typeof r.rank=="string")this.rank=Dn(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let s=Math.trunc(E.env.NODE_ENV==="test"?Zi.testId:Zi.testId*10)/10;Zi.testId+=.001,this.rank=s}typeof r.interactive=="string"&&(this.pointerEvents=r.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=e,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(e,r){if(e!=null&&r!=null)this.dimensions={width:e,height:r};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:e,height:r}=this.dimensions;if(e===0||r===0)return[];let n=(Array.isArray(this.options.placement)?this.options.placement:[this.options.placement]).map(s=>({name:s,getBoundingBox:a(()=>{let l=r/2,u=r/2,h=e/2,m=e/2;switch(s){case"top":{l=r,u=0;break}case"bottom":{l=0,u=r;break}case"left":{h=e,m=0;break}case"right":{h=0,m=e;break}case"top-left":{l=r,h=e,u=0,m=0;break}case"top-right":{l=r,m=e,u=0,h=0;break}case"bottom-left":{u=r,h=e,l=0,m=0;break}case"bottom-right":{u=r,m=e,l=0,h=0;break}}return[l+No,u+No,h+No,m+No]},"getBoundingBox")}));if((o=this.options.lowPriorityPin)!=null&&o.enabled&&this.options.rank!=="always-visible"){let s={name:ff,getBoundingBox:a(()=>{let l=Math.max(2,No/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(e=!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 r=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&e&&r&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,r&&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&&r?this.packedMessage.bboxes.unshift([...o.getBoundingBox(),n]):this.packedMessage.bboxes.push([...o.getBoundingBox(),n])}return this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){var e;return!((e=this.options.lowPriorityPin)!=null&&e.enabled)||this.options.rank==="always-visible"?-1:Array.isArray(this.options.placement)?this.options.placement.length:1}destroy(){}};a(Zi,"MarkerComponent"),p(Zi,"testId",0);var nr=Zi;v();v();v();var wu=class wu extends me{constructor(r,i,n=!0){super();p(this,"rendererState");p(this,"convertTo3DMapPosition");p(this,"textSet",new Set);p(this,"batchedTextMap",new Map);p(this,"useWorker",!0);p(this,"debugTextAreaMesh",new Map);n===!1&&(this.useWorker=!1,bf(!1)),this.rendererState=r,this.convertTo3DMapPosition=i}remove(r){this.textSet.delete(r)}update(r){var l,u,h;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 Ie)||!(n instanceof Vr))continue;if("textArea"in n.feature.properties&&n.mesh!=null&&n.polygonEntityId!=null&&n.textMesh==null&&n.mesh.parent!=null&&((h=(u=n.feature.properties)==null?void 0:u.textArea)==null?void 0:h.position)!=null){if(this.textSet.has(n.polygonEntityId))continue;this.textSet.add(n.polygonEntityId),this.batchedTextMap.has(f)||this.batchedTextMap.set(f,Fo().then(({BatchedText:_})=>{let T=new _;return T.type="batchedtext",f.add(T),T}));let y=this.batchedTextMap.get(f);if(!y)throw new Error("batched text required");s.push(vf({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,Fo().then(({BatchedText:_})=>{let T=new _;return T.type="batchedtext",f.add(T),T}));let y=this.batchedTextMap.get(f);if(!y)throw new Error("batched text required");s.push(vf({entityId:m,textComponent:n,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:y,rendererState:this.rendererState,type:"point"}).then(()=>{this.publish("render")}))}let b=this.batchedTextMap.get(f);n.textMesh&&b&&n.polygonEntityId!=null&&Promise.all([b,Promise.resolve({meshComponent:n,styleComponent:o})]).then(([y,{meshComponent:_,styleComponent:T}])=>{let{textMesh:g}=_;if(y&&g){let x=Tu(y,g);_.visible&&!x?y.add(g):!_.visible&&x&&y.remove(g)}T.flipToFaceCamera&&this.flipIfNeeded(_,r)})}return Promise.all(s)}flipIfNeeded(r,i){let n=r.textMesh;if(!n)return!1;let o=n.rotation.z,s=fc(o+i);s>Math.PI/2&&s<3*Math.PI/2&&(n.rotation.z=fc(o+Math.PI))}showTextAreaMesh(){let r,i;for(let n of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(n),(r==null?void 0:r.type)==="text3d"&&(i=r.components[0],"textArea"in i.feature.properties)){let o=i.feature.properties.textArea;if(!o)continue;let s=new Nt(o.maxWidth,o.maxHeight),l=new be(s,new st({color:"pink"})),{textMesh:u}=i;if(!u)continue;let h=this.convertTo3DMapPosition(o.position,Bo);l.position.copy(h),l.position.z=u.position.z-.1,l.rotation.z=u.rotation.z,_u.identity(),_u.makeRotationAxis(new H(0,0,1),u.userData.rotationZ),Bo.set(o.maxWidth/2,0,0),Bo.applyMatrix4(_u),l.position.x-=Bo.x,l.position.y-=Bo.y,this.rendererState.entityScene.add(l),this.debugTextAreaMesh.set(n,l)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(r=>{this.rendererState.entityScene.remove(r)}),this.debugTextAreaMesh.clear(),this.publish("render")}};a(wu,"Text3DSystem");var Ra=wu;function bf(t){Fo().then(({configureTroikaTextBuilder:e})=>{e({useWorker:t})})}a(bf,"configureWorker");var _u=new bt,Bo=new H,Pu;function Fo(){return Pu||(Pu=import("./text3d-242FO3DA.js").then(t=>t)),Pu}a(Fo,"getText3DService");async function vf({entityId:t,textComponent:e,styleComponent:r,convertTo3DMapPosition:i,batchedMeshPromise:n,rendererState:o,type:s="text-area"}){return Promise.all([Fo(),Promise.resolve({entityId:t,meshComponent:e,styleComponent:r})]).then(([{createTroikaTextPoint:l,createTroikaTextArea:u},h])=>s==="text-area"?u(h.entityId,h.meshComponent,h.styleComponent,i):l(h.entityId,h.meshComponent,h.styleComponent,i)).catch(l=>{te.warn("Trouble creating text: ",l)}).then(l=>{if(!(l!=null&&l.text))return;let u=[Promise.resolve(l.text),n,Promise.resolve()];if(e.polygonEntityId){let h=o.geometry3DMap.get(e.polygonEntityId);if((h==null?void 0:h.type)==="geometry"){let m=h.components[0],f=h.components[1];m.textMesh=l.text,l.text.position.z=f.altitude+f.height+wC}}else u[2]=Fo().then(({syncText:h})=>h(l.text));return Promise.all(u)}).then(l=>{if(!l)return;let[u,h]=l;h.add(u),e.batchedText||(e.batchedText=h)})}a(vf,"createText");function Tu(t,e){return t._members.has(e)}a(Tu,"doesBatchedTextContainsText");var wC=.5;var MC=I.object({visible:I.boolean(),color:I.string(),flipToFaceCamera:I.boolean(),font:I.string().optional(),fontSize:I.number(),margin:I.union([I.number(),I.tuple([I.number(),I.number(),I.number(),I.number()])]),outlineColor:I.string(),outlineOpacity:I.number(),outlineBlur:I.union([I.number(),I.string()]),outlineWidth:I.number(),outlineOffsetX:I.number(),outlineOffsetY:I.number(),strokeWidth:I.number(),maxWidth:I.number().optional(),maxHeight:I.number().optional(),strokeOpacity:I.number(),strokeColor:I.string(),fillOpacity:I.number(),hoverColor:I.string().optional(),id:I.union([I.string(),I.number()]),type:I.literal("text3d"),position:I.tuple([I.number(),I.number(),I.number()]),content:I.string()}),xf=MC.partial().omit({id:!0,type:!0}).strict(),Sf=xf.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0}).strict(),Cf=I.object({appearance:xf.optional(),parentId:I.string().optional()}).strict(),Mu=class Mu{constructor(e){p(this,"mesh",new Bt);p(this,"textMesh");p(this,"type","text3d");p(this,"feature");p(this,"parent");p(this,"batchedText");p(this,"polygonEntityId");this.feature=e}get visible(){return this.batchedText&&this.textMesh?Tu(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(e){this.batchedText&&this.textMesh?e?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=e),this.mesh.visible=e}};a(Mu,"Text3DComponent");var Vr=Mu;v();var Fn,Iu=class Iu{constructor(e){p(this,"color");p(this,"dirty",!0);p(this,"enabled",!0);L(this,Fn,!1);p(this,"edgeColors");p(this,"edgeVisibility");p(this,"geometry");p(this,"ranges");p(this,"topFaceVerticesIndices");this.color=e}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(e){if(!this.edgeVisibility||!this.ranges||c(this,Fn)===e)return;R(this,Fn,e);let r=this.edgeVisibility.array,i=e?1:0;for(let n=0;n<this.ranges.count;n++){let o=this.ranges.start+n;r[o]=i}this.edgeVisibility.needsUpdate=!0}get visible(){return c(this,Fn)}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]}};Fn=new WeakMap,a(Iu,"OutlineComponent");var Gn=Iu;v();v();v();var Eu=class Eu extends Bd{constructor(r){let i=r,n=3,o=n*4;super(new Uint8Array(r*o),n,r,Gs,Fs);p(this,"_width");p(this,"_height");p(this,"_propertiesLength");this._width=o,this._height=i,this._propertiesLength=n}setColor(r,i,n){let o=this.image.data,s=r*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(r){let i=this.image.data,n=r*this._width,o=new Ee(i[n]/255,i[n+1]/255,i[n+2]/255),s=new Ee(i[n+4]/255,i[n+5]/255,i[n+6]/255);return{color:o,topColor:s}}setTexture(r,i,n){let o=this.image.data,s=r*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(r){let i=this.image.data,n=r*this._width,o=i[n+8]===255,s=i[n+9]===255;return{texture:o,topTexture:s}}};a(Eu,"BatchedPropertiesTexture");var Na=Eu;v();var _f="#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";v();var Pf="#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 IC=-.05,EC=1,Du=class Du extends mi{constructor(r,i,n=1){super(r);p(this,"propertiesTexture");p(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:null},uTexture:{value:null},uRepeatYFactor:{value:1},uBlendTexture:{value:!1}});p(this,"colorSpace",di);p(this,"showTextures",a(r=>{let i=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(i||n)&&(this.propertiesTexture.setTexture(r,i,n),this.needsUpdate=!0)},"showTextures"));this.alphaTest=.01,this.propertiesTexture=new Na(i),this.uniforms.uRepeatYFactor.value=n,this.onBeforeCompile=o=>{let s=this.uniforms.uGradientIntensity,l=this.uniforms.uGradientEnd,u=this.uniforms.uGradientStart,h=this.uniforms.uTopTexture,m=this.uniforms.uTexture,f=this.uniforms.uRepeatYFactor,b=this.uniforms.uBlendTexture;this.uniforms=o.uniforms,o.vertexShader=_f,o.fragmentShader=Pf,Object.assign(this.uniforms,{uGradientIntensity:s,uGradientEnd:l,uGradientStart:u,uMinSideAlpha:{value:IC},uMaxSideAlpha:{value:EC},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:h,uTexture:m,uRepeatYFactor:f,uBlendTexture:b})}}get repeatYFactor(){return this.uniforms.uRepeatYFactor.value}set repeatYFactor(r){r!==this.uniforms.uRepeatYFactor.value&&(this.uniforms.uRepeatYFactor.value=r,this.needsUpdate=!0)}get texture(){return this.uniforms.uTexture.value}set texture(r){r.wrapS=Vt,r.wrapT=Vt,r.colorSpace=this.colorSpace,this.uniforms.uTexture.value=r}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(r){r.wrapS=Vt,r.wrapT=Vt,r.colorSpace=this.colorSpace,this.uniforms.uTopTexture.value=r}get blendTexture(){return this.uniforms.uBlendTexture.value}set blendTexture(r){r!==this.uniforms.uBlendTexture.value&&(this.uniforms.uBlendTexture.value=r,this.colorSpace=r?Id:di,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(r,i,n){this.uniforms.uGradientStart.value=r,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(r,i,n){this.propertiesTexture.setColor(r,i,n)}getColor(r){return this.propertiesTexture.getColor(r)}hideTextures(r){let i=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(i||n)&&(this.propertiesTexture.setTexture(r,!1,!1),this.needsUpdate=!0)}removeSideTexture(r){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let i=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(r,!1,i),this.needsUpdate=!0}}removeTopTexture(r){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let i=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(r,i,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}};a(Du,"BatchedStandardMaterial");var Ui=Du;v();function Tf(t,e){var h,m,f;let r=0;for(let b of t)r+=((m=(h=b.components[0])==null?void 0:h.geometry)==null?void 0:m.attributes.position.count)||0;let i=new Ee(e.color),n;n=new Ui({color:i,side:e.side==="back"?co:e.side==="front"?hi:Rt,opacity:(f=e.opacity)!=null?f:1,transparent:e.opacity!==void 0?e.opacity<1:!1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},t.length);let o=new $s(t.length,r,0,n);o.renderOrder=0;let s,l,u;for(let b of t)s=b.components[0],!(!(s instanceof Ne)||!s.geometry)&&(s.mesh=o,s.material=n,s.instanceIndex=o.addGeometry(s.geometry),o.addInstance(s.instanceIndex),o.userData.entities[s.instanceIndex]=b.id,n instanceof Ui&&n.setColor(s.instanceIndex,i,e.topColor?new Ee(e.topColor):i),l=o.getGeometryIdAt(s.instanceIndex),s.batchedProps&&(u=o.getGeometryRangeAt(l),u&&(s.batchedProps.range=u),s.batchedProps.geometryId=l));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}a(Tf,"batchGeometries");function Go(t){return W(t).darken(30).toRgbString()}a(Go,"darkenColorForOutline");function wf(t,e,r,i){if(e.length<1)return;t.boundingBox||t.computeBoundingBox();let n=t.boundingBox,o=t.getAttribute("position"),s=t.getAttribute("normal"),l=t.getAttribute("uv"),u,h;t.index?(u=t.index.count/3,h=a(function(S,C){return t.index.getX(S*3+C)},"meshIndex")):(u=o.count/3,h=a(function(S,C){return S*3+C},"meshIndex"));let m=new bt;m.makeRotationFromQuaternion(new pi().setFromEuler(new mr(0,0,r/180*Math.PI)));let f=e.find(S=>S.face==="top"),b;f&&(b={min:i(f.bounds[1],f.bounds[0],0),max:i(f.bounds[3],f.bounds[2],n.max.z)});let y=e.find(S=>S.face==="side"),_;if(y&&(_={min:i(y.bounds[1],y.bounds[0],0),max:i(y.bounds[3],y.bounds[2],n.max.z)}),!(!_&&!b))for(let S=0;S<u;++S){let C=s.getX(h(S,0))+s.getX(h(S,1))+s.getX(h(S,2)),w=s.getY(h(S,0))+s.getY(h(S,1))+s.getY(h(S,2)),k=s.getZ(h(S,0))+s.getZ(h(S,1))+s.getZ(h(S,2)),A=Math.abs(C),N=Math.abs(w),Y=Math.abs(k);var T,g;A<=N&&A<=Y?(T="x",N<=Y?g="y":g="z"):N<=A&&N<=Y?(T="y",A<=Y?g="x":g="z"):(T="z",A<=N?g="x":g="y"),T==="z"&&(T=g,g="z");let z,X,q,F,J,pe;if(g==="z"||T==="z"){if(!y||!_)continue;z=y.repeat.u,X=y.repeat.v,q=y.offset.u,F=y.offset.v,J=y.rotation,pe=_}else{if(!f||!b)continue;z=f.repeat.u,X=f.repeat.v,q=f.offset.u,F=f.offset.v,J=(360-r+f.rotation)%360,pe=b}let{min:se,max:De}=pe,ve=new fr;ve.position.set(se.x,se.y,0),ve.updateMatrix(),ve.updateMatrixWorld();let ge=se.clone().applyMatrix4(m),xe=De.clone().applyMatrix4(m),rt=Math.abs(xe.x-ge.x),Ge=Math.abs(xe.y-ge.y),Ue=new H(rt,Ge,De.z).applyMatrix4(ve.matrixWorld),je=Math.abs(Ue[T]-se[T]),Me=Math.abs(Ue[g]-se[g]),Xe=J*Math.PI/180||0,Ke=Math.cos(Xe),_t=Math.sin(Xe),Lr=ve.matrixWorld.clone().invert(),yt=new pi().setFromEuler(new mr(0,0,r/180*Math.PI));for(let Qe=0;Qe<3;Qe++){let K=new H(o.getX(h(S,Qe)),o.getY(h(S,Qe)),o.getZ(h(S,Qe))).applyMatrix4(Lr);K.applyQuaternion(yt);let Pe=K.applyMatrix4(ve.matrixWorld),Ye=Pe.x,Wt=Pe.y,ui=Pe.z;var x,P;T==="x"?x=z*(Ye-se[T])/je+q:T==="y"?x=z*(Wt-se[T])/je+q:x=z*(ui-se[T])/je+q,g==="x"?P=X*(Ye-se[g])/Me+F:g==="y"?P=X*(Wt-se[g])/Me+F:P=X*(ui-se[g])/Me+F,x-=.5,P-=.5;let pr=x*Ke-P*_t+.5,lo=x*_t+P*Ke+.5;l.setX(h(S,Qe),pr),l.setY(h(S,Qe),lo)}}}a(wf,"updateUVsLegacy");v();var Ou=class Ou{constructor(){p(this,"focusMesh");p(this,"dirty",!0)}};a(Ou,"FocusableComponent");var Mr=Ou;function et(t,e,r){if(e!==void 0){if(t.type==="model"||t.type==="path"||t.type==="marker"||t.type==="label"||t.type==="geometry"||t.type==="group-container"||t.type==="custom-geometry")return e===!0?(t instanceof gi&&t.components[1]===void 0?(t.components[1]=new On,t.components[1].dirty=!0):t instanceof fe&&t.components[2]===void 0?(t.components[2]=new On,t.components[2].dirty=!0):t instanceof Ie&&t.components[0]===void 0&&(t.components[0]=new On,t.components[0].dirty=!0),!0):(t instanceof gi?t.components[1]=void 0:t instanceof fe?t.components[2]=void 0:t instanceof Ie&&(t.components[0]=void 0),!0);if(t.type==="geometry-group"){let i;for(let n of t.userData.entities3D.values())i=r.geometry3DMap.get(n),et(i,e,r);return!0}}return!1}a(et,"updateInteractivity");function Mf(t,e,r){if(!(!(r!=null&&r.color)&&!("topColor"in r))){if(r!==void 0&&t.type==="geometry-group"){let i;for(let n of t.userData.entities3D.values())i=e.geometry3DMap.get(n),i&&Fa(i,r);return!0}return!1}}a(Mf,"updateGroupColor");function AC(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].shading=e,t.components[1].dirty=!0)}a(AC,"updateShading");function If(t,e,r){if(r!==void 0&&t.type==="geometry-group"){for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);n&&AC(n,r)}return!0}return!1}a(If,"updateGroupShading");function Ef(t,e){e!==void 0&&t.type==="geometry"&&(e.showImage!==void 0&&(t.components[1].showImage=e.showImage),e.flipImageToFaceCamera!==void 0&&(t.components[1].flipImageToFaceCamera=e.flipImageToFaceCamera))}a(Ef,"updateImageProps");function Ba(t,e,r){if(r!==void 0){if(t.type==="geometry"){let i=t.components[1];if(i.height!==r)return i.height=r,i.dirty=!0,t.components[3]&&(t.components[3].dirty=!0),!0}else if(t.type==="geometry-group"){for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&Ba(n,e,r)}return!0}}return!1}a(Ba,"updateHeight");function Fa(t,e){if(e!==void 0){let r=!1;(t.type==="path"||t.type==="geometry")&&(e.initialColor!==void 0&&e.initialColor!==t.components[1].initialColor&&(t.components[1].initialColor=e.initialColor,r=!0),e.color!==void 0&&e.color!==t.components[1].color&&(t.components[1].color=e.color,r=!0,t.components[3]&&(t.components[3].color=Go(e.color),t.components[3].dirty=!0)),"topColor"in e&&(t.components[1].topColor=e.topColor,r=!0),r&&(t.components[1].dirty=!0))}}a(Fa,"updateColor");function Au(t,e,r){e!==void 0&&(t.type==="label"||t.type==="marker"?t.updatePosition(r(e[1],e[0],e[2]||0)):t.type==="custom-geometry"&&t.components[0].position.copy(r(e[1],e[0],e[2]||0)))}a(Au,"updatePosition");function ku(t,e){var r;return e!==void 0&&(t.type==="marker"||t.type==="label"||t.type==="custom-geometry")&&t.parentObject3D!==e&&t.parentObject3D instanceof Ie?((r=t.parentObject3D)==null||r.removeEntity(t),e.addEntity(t),!0):!1}a(ku,"updateParent");function Df(t,e){e!==void 0&&(t.type==="marker"||t.type==="label")&&t.components[0].enabled!==e&&(t.components[0].enabled=e)}a(Df,"updateEnabled");function Of(t,e,r){if(e!==void 0&&t.type==="marker"){let i=t.components[0];if(e.contentHTML!==void 0)return i.containerEl.innerHTML=e.contentHTML,i.contentHtml=e.contentHTML,!0;if(e.placement!==void 0&&(i.options.placement=e.placement,i.collisionDirty=!0),e.dynamicResize!==void 0)return i.options.dynamicResize=e.dynamicResize,!0;if(e.options!=null){try{Cu.parse(e.options||{})}catch(n){return te.error(n),!1}return e.options.interactive!=null&&(e.options.interactive==="pointer-events-auto"?(i.pointerEvents="auto",et(t,!1,r)):(i.pointerEvents="none",et(t,e.options.interactive,r))),Lf(t,e.options.rank),!0}}return!1}a(Of,"updateMarker");function Lf(t,e){return e!==void 0&&(t.type==="marker"||t.type==="label")?(t.components[0].rank=Dn(e),!0):!1}a(Lf,"updateRank");function Af(t,e,r){var i,n,o,s,l,u;if(e!==void 0&&t.type==="label"){let h=t.components[0];e.text!==void 0&&e.text!==h.text&&(h.text=e.text,h.textDirty=!0);try{cu((i=e.options)!=null?i:{})}catch(m){te.error(m);return}km(h.appearance,((n=e.options)==null?void 0:n.appearance)||{})&&(h.textDirty=!0),Rm(h.appearance,((o=e.options)==null?void 0:o.appearance)||{})&&(h.markerDirty=!0),pp(h.appearance,((s=e.options)==null?void 0:s.appearance)||{}),et(t,(l=e.options)==null?void 0:l.interactive,r),Lf(t,(u=e.options)==null?void 0:u.rank)}}a(Af,"updateLabel");function kf(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].hoverColor=e,t.components[1].dirty=!0)}a(kf,"updateHoverColor");function Rf(t,e){if(e!==void 0){let r=t.components[2];if(t.type==="geometry"&&r!=null)return r.hover=e,r.dirty=!0,!0}return!1}a(Rf,"updateHovered");function Ru(t,e){e!==void 0&&t.type==="image"&&(t.components[1].flipImageToFaceCamera=e)}a(Ru,"updateFlipImageToFaceCamera");function sr(t,e,r){if(r!==void 0)if(t.type==="model"||t.type==="path"||t.type==="geometry"||t.type==="custom-geometry"||t.type==="image"||t.type==="text3d"){r!==t.components[1].visible&&(t.components[1].visible=r,t.components[1].dirty=!0);let i=t.components[3];return i&&(i.dirty=!0),!0}else{if(t.type==="geometry-group")return t.setVisible(r),!0;if(t.type==="group-container"){if(t.visible!==r)return t.setVisible(r),r===!1&&t.traverse(i=>{if(i instanceof sp){let n=e.geometry2DMap.get(i.userData.entityId);if(n){let o=n.components[0];o instanceof rr&&(o.canShow=r)}}}),!0}else if(t.type==="label")return t.components[0].visible=r,!0}return!1}a(sr,"updateVisibility");function Xo(t,e,r){if(r!==void 0)if(t.type==="geometry-group"){for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&Xo(n,e,r)}return!0}else if(t.type==="group-container"){if(t.opacity!==r){t.setOpacity(r);let i=1;return t.parent instanceof Ie&&(i=t.parent.opacity),Nf(t,e,i),!0}}else t instanceof fe&&t.components[1].opacity!==r&&(t.components[1].opacity=r,t.components[1].dirty=!0);return!1}a(Xo,"updateOpacity");function Nf(t,e,r=1){if(t.type==="group-container"&&"children"in t&&t.children.length>0){let i=r*t.opacity;t.userData.computedOpacity=i;for(let n of t.children)(n instanceof xt&&n.type==="geometry-group"||n instanceof Ie&&n.type==="group-container")&&Nf(n,e,i)}else if(t.type==="geometry-group")for(let i of t.userData.entities3D.values()){let n=e.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(Nf,"cascadeOpacity");function Bf(t,e,r){if(r!==void 0&&t.type==="geometry-group")for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);n&&Nu(n,r)}}a(Bf,"updateGroupTexture");function Nu(t,e){if(t.type==="geometry"){let r=!1,i=t.components[1];if((e==null?void 0:e.texture)!=null&&i.texture!==(e==null?void 0:e.texture)&&(i.texture=e.texture,r=!0),(e==null?void 0:e.topTexture)!=null&&i.topTexture!==(e==null?void 0:e.topTexture)&&(i.topTexture=e.topTexture,r=!0),r&&t.components[0]instanceof Ne){let n=t.components[0];return n.detached===!1&&(n.detached=!0,n.dirty=!0),t.components[1].dirty=!0,!0}}return!1}a(Nu,"updateIndividualGeometryTexture");function Ff(t,e){if(e!==void 0&&t.type==="geometry"){let r=t.components[1];if(r.opacity!==e){r.opacity=e;let i=t.components[0],n=t.components[3];n&&(n.dirty=!0),i.detached===!1&&(i.detached=!0,i.dirty=!0),r.dirty=!0;let o=t.parentObject3D;return(o==null?void 0:o.type)==="geometry-group"&&(o.userData.shadingDirty=!0),!0}}return!1}a(Ff,"updateIndividualGeometryOpacity");function Xn(t,e){if(e!==void 0)if(t.type==="geometry"||t.type==="path"||t.type==="custom-geometry"){let r=t.components[1];if(r.altitude!==e)return r.altitude=e,r.dirty=!0,t.components[3]&&(t.components[3].dirty=!0),!0}else{if(t.type==="group-container"&&t.altitude!==e)return t.setAltitude(e),!0;if(t.type==="geometry-group"&&t.altitude!==e)return t.setAltitude(e),!0}return!1}a(Xn,"updateAltitude");function Ga(t,e,r){if(r!==void 0){if(t.type==="geometry-group")for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);n instanceof fe&&Ga(n,e,r)}else if(t.type==="geometry"){let i=t.components[3],n=t.components[1];!i&&r===!0?t.components[3]=new Gn(Go(n.color)):i&&(i.enabled=r,i.dirty=!0)}return!0}return!1}a(Ga,"updateOutline");function Xa(t,e){if(e!==void 0){let r,i=4;if(t.type==="geometry"?(r=t.components[4],i=4):t.type==="group-container"&&(r=t.components[1],i=1),e===!0&&r==null)return t.components[i]=new Mr,!0;if(e===!1&&r!=null)return t.components[i]=void 0,!0}return!1}a(Xa,"updateFocusable");function Gf(t,e){if(e!==void 0&&t.type==="geometry"){let r=t.components[1];if(r.renderOrder!==e){r.renderOrder=e;let i=t.components[0];return i.detached===!1&&(i.detached=!0,i.dirty=!0),i.imageMesh&&(i.imageMesh.renderOrder=e+1),r.dirty=!0,!0}}return!1}a(Gf,"updateIndividualGeometryRenderOrder");function za(t,e,r){if(r!=null){if(t.type==="geometry"){let i=t.components[1];i.side!==r&&(i.side=r,i.dirty=!0)}else if(t.type==="geometry-group")for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);n instanceof fe&&za(n,e,r)}}}a(za,"updateSide");function Xf(t,e,r){let{visible:i,color:n}=r;if(t.type!=="path")return;let o=t.components[0];i!=null&&sr(t,e,i),n!=null&&Fa(t,{color:n}),Object.assign(o,Bu(r)),up(r)||(o.materialDirty=!0,r.width!=null&&(o.dirty=!0))}a(Xf,"handlePathUpdate");function Bu(t){return Qs(t,kC)}a(Bu,"pickPathOptions");var kC=["animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","dashed","visibleThroughGeometry"];function zf(t){if(!(t instanceof fe&&t.type==="text3d"))throw new Error("expect target is TextGeometry3D")}a(zf,"assetGeometryIsText3D");var Yf=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function Zf(t,e,r){sr(t,e,r.visible);let i=t.components[1],n=Qs(r,Yf);"margin"in r&&te.warn("update to margin is not supported atm"),"content"in r&&te.warn("content update is not supported atm");try{Sf.parse(n)}catch(o){te.error(o);return}Object.keys(n).length>0&&(Object.assign(i,n),i.dirty=!0)}a(Zf,"handleText3DUpdate");var RC=["color","material","opacity","verticalOffset","rotation","position","scale"];function Uf(t,e){let r=Qs(e,RC),i=t.components[1],n=t.components[0];Object.keys(r).length>0&&(r.material&&(i.material=r.material),r.opacity!=null&&(i.opacity=r.opacity),r.visible!=null&&(i.visible=r.visible),r.verticalOffset!=null&&(i.verticalOffset=r.verticalOffset),r.color!=null&&(i.color=r.color),r.position!=null&&(n.feature.geometry.coordinates=r.position,n.positionDirty=!0),r.rotation!=null&&(i.rotation=r.rotation),r.scale!=null&&(i.scale=r.scale),i.dirty=!0)}a(Uf,"handleModelStyleUpdate");v();v();v();v();v();v();v();v();v();v();function Fu(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}a(Fu,"getCoord");function ji(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}a(ji,"getCoords");function zn(t){return t.type==="Feature"?t.geometry:t}a(zn,"getGeom");function qr(t,e,r){if(r===void 0&&(r={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var i=Fu(t),n=zn(e),o=n.type,s=e.bbox,l=n.coordinates;if(s&&NC(i,s)===!1)return!1;o==="Polygon"&&(l=[l]);for(var u=!1,h=0;h<l.length&&!u;h++)if(jf(i,l[h][0],r.ignoreBoundary)){for(var m=!1,f=1;f<l[h].length&&!m;)jf(i,l[h][f],!r.ignoreBoundary)&&(m=!0),f++;m||(u=!0)}return u}a(qr,"booleanPointInPolygon");function jf(t,e,r){var i=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var n=0,o=e.length-1;n<e.length;o=n++){var s=e[n][0],l=e[n][1],u=e[o][0],h=e[o][1],m=t[1]*(s-u)+l*(u-t[0])+h*(t[0]-s)===0&&(s-t[0])*(u-t[0])<=0&&(l-t[1])*(h-t[1])<=0;if(m)return!r;var f=l>t[1]!=h>t[1]&&t[0]<(u-s)*(t[1]-l)/(h-l)+s;f&&(i=!i)}return i}a(jf,"inRing");function NC(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}a(NC,"inBBox");v();v();v();v();v();v();v();v();v();var Gu="\xA9 Mappedin",zC="https://info.mappedin.com/feedback",zu=["top-left","top-right","bottom-left","bottom-right"],YC=640,ZC=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"),Xu={custom:[],position:"bottom-right",feedback:!0},Yn,Yu=class Yu{constructor(e,r={}){p(this,"controlContainerEl");p(this,"controlPositions");p(this,"compact");L(this,Yn);p(this,"attribContainerEl");p(this,"attribInnerEl");p(this,"attribButtonEl");p(this,"feedbackLinkEl");p(this,"attribHTML",Gu);p(this,"customAttributions",[]);p(this,"toggleAttribution",a(e=>{this.attribContainerEl!=null&&(e.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"));R(this,Yn,!!r.outdoorEnabled),this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),e.appendChild(this.controlContainerEl),this.controlPositions=zu.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(e=Xu){var n;let r=e.position&&zu.includes(e.position)?e.position:Xu.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib","mappedin-ctrl-attrib-".concat(r)),this.attribContainerEl.open=!0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[r].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=ZC(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribHTML=c(this,Yn)?Gu:"",this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.appendChild(this.attribInnerEl),((n=e.feedback)!=null?n:Xu.feedback)&&(this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=zC,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)),e.custom&&(this.customAttributions=e.custom),this.updateAttributionDisplay()}updateAttribution(e){if(!e.style||!this.attribInnerEl||!this.attribContainerEl)return;let r=c(this,Yn)?[Gu]:[],i=e.style.sourceCaches;for(let n in i){let o=i[n];if(o.used||o.usedForTerrain){let s=o.getSource();s.attribution&&r.indexOf(s.attribution)<0&&r.push(s.attribution)}}r=r.filter(n=>String(n).trim()),r=r.filter((n,o)=>{for(let s=o+1;s<r.length;s++)if(r[s].indexOf(n)>=0)return!1;return!0}),this.attribHTML=r.join(" "),this.updateAttributionDisplay()}updateAttributionDisplay(){let e=[...new Set([this.attribHTML,...this.customAttributions])].filter(Boolean).join(" ");this.attribInnerEl&&(this.attribInnerEl.innerHTML=e)}resizeAttribution(e){this.attribContainerEl&&(e<=YC||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(e){this.resizeAttribution(e)}updateData(e){this.updateAttribution(e)}destroy(){this.destroyAttributionControl(),this.controlContainerEl.remove(),this.compact=void 0}};Yn=new WeakMap,a(Yu,"HTMLControlsSystem");var Ya=Yu;v();v();var Et=Object.freeze({Linear:Object.freeze({None:a(function(t){return t},"None"),In:a(function(t){return t},"In"),Out:a(function(t){return t},"Out"),InOut:a(function(t){return t},"InOut")}),Quadratic:Object.freeze({In:a(function(t){return t*t},"In"),Out:a(function(t){return t*(2-t)},"Out"),InOut:a(function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},"InOut")}),Cubic:Object.freeze({In:a(function(t){return t*t*t},"In"),Out:a(function(t){return--t*t*t+1},"Out"),InOut:a(function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},"InOut")}),Quartic:Object.freeze({In:a(function(t){return t*t*t*t},"In"),Out:a(function(t){return 1- --t*t*t*t},"Out"),InOut:a(function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},"InOut")}),Quintic:Object.freeze({In:a(function(t){return t*t*t*t*t},"In"),Out:a(function(t){return--t*t*t*t*t+1},"Out"),InOut:a(function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},"InOut")}),Sinusoidal:Object.freeze({In:a(function(t){return 1-Math.sin((1-t)*Math.PI/2)},"In"),Out:a(function(t){return Math.sin(t*Math.PI/2)},"Out"),InOut:a(function(t){return .5*(1-Math.sin(Math.PI*(.5-t)))},"InOut")}),Exponential:Object.freeze({In:a(function(t){return t===0?0:Math.pow(1024,t-1)},"In"),Out:a(function(t){return t===1?1:1-Math.pow(2,-10*t)},"Out"),InOut:a(function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},"InOut")}),Circular:Object.freeze({In:a(function(t){return 1-Math.sqrt(1-t*t)},"In"),Out:a(function(t){return Math.sqrt(1- --t*t)},"Out"),InOut:a(function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},"InOut")}),Elastic:Object.freeze({In:a(function(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},"In"),Out:a(function(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},"Out"),InOut:a(function(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)},"InOut")}),Back:Object.freeze({In:a(function(t){var e=1.70158;return t===1?1:t*t*((e+1)*t-e)},"In"),Out:a(function(t){var e=1.70158;return t===0?0:--t*t*((e+1)*t+e)+1},"Out"),InOut:a(function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)},"InOut")}),Bounce:Object.freeze({In:a(function(t){return 1-Et.Bounce.Out(1-t)},"In"),Out:a(function(t){return t<.36363636363636365?7.5625*t*t:t<.7272727272727273?7.5625*(t-=.5454545454545454)*t+.75:t<.9090909090909091?7.5625*(t-=.8181818181818182)*t+.9375:7.5625*(t-=.9545454545454546)*t+.984375},"Out"),InOut:a(function(t){return t<.5?Et.Bounce.In(t*2)*.5:Et.Bounce.Out(t*2-1)*.5+.5},"InOut")}),generatePow:a(function(t){return t===void 0&&(t=4),t=t<Number.EPSILON?Number.EPSILON:t,t=t>1e4?1e4:t,{In:a(function(e){return Math.pow(e,t)},"In"),Out:a(function(e){return 1-Math.pow(1-e,t)},"Out"),InOut:a(function(e){return e<.5?Math.pow(e*2,t)/2:(1-Math.pow(2-e*2,t))/2+.5},"InOut")}},"generatePow")}),zo=a(function(){return performance.now()},"now"),Za=function(){function t(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return a(t,"Group"),t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(r){return e._tweens[r]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(){for(var e,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];for(var n=0,o=r;n<o.length;n++){var s=o[n];(e=s._group)===null||e===void 0||e.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var i=0,n=e;i<n.length;i++){var o=n[i];o._group=void 0,delete this._tweens[o.getId()],delete this._tweensAddedDuringUpdate[o.getId()]}},t.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},t.prototype.update=function(e,r){e===void 0&&(e=zo()),r===void 0&&(r=!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=!r;o&&o.update(e,s)===!1&&!r&&this.remove(o)}i=Object.keys(this._tweensAddedDuringUpdate)}},t}(),Zn={Linear:a(function(t,e){var r=t.length-1,i=r*e,n=Math.floor(i),o=Zn.Utils.Linear;return e<0?o(t[0],t[1],i):e>1?o(t[r],t[r-1],r-i):o(t[n],t[n+1>r?r:n+1],i-n)},"Linear"),Bezier:a(function(t,e){for(var r=0,i=t.length-1,n=Math.pow,o=Zn.Utils.Bernstein,s=0;s<=i;s++)r+=n(1-e,i-s)*n(e,s)*t[s]*o(i,s);return r},"Bezier"),CatmullRom:a(function(t,e){var r=t.length-1,i=r*e,n=Math.floor(i),o=Zn.Utils.CatmullRom;return t[0]===t[r]?(e<0&&(n=Math.floor(i=r*(1+e))),o(t[(n-1+r)%r],t[n],t[(n+1)%r],t[(n+2)%r],i-n)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-i)-t[0]):e>1?t[r]-(o(t[r],t[r],t[r-1],t[r-1],i-r)-t[r]):o(t[n?n-1:0],t[n],t[r<n+1?r:n+1],t[r<n+2?r:n+2],i-n)},"CatmullRom"),Utils:{Linear:a(function(t,e,r){return(e-t)*r+t},"Linear"),Bernstein:a(function(t,e){var r=Zn.Utils.Factorial;return r(t)/r(e)/r(t-e)},"Bernstein"),Factorial:function(){var t=[1];return function(e){var r=1;if(t[e])return t[e];for(var i=e;i>1;i--)r*=i;return t[e]=r,r}}(),CatmullRom:a(function(t,e,r,i,n){var o=(r-t)*.5,s=(i-e)*.5,l=n*n,u=n*l;return(2*e-2*r+o+s)*u+(-3*e+3*r-2*o-s)*l+o*n+e},"CatmullRom")}},Wf=function(){function t(){}return a(t,"Sequence"),t.nextId=function(){return t._nextId++},t._nextId=0,t}(),Zu=new Za,Vf=function(){function t(e,r){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Et.Linear.None,this._interpolationFunction=Zn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Wf.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=Zu,Zu.add(this))}return a(t,"Tween"),t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(e,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},t.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},t.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},t.prototype.start=function(e,r){if(e===void 0&&(e=zo()),r===void 0&&(r=!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=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){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,r)}return this},t.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},t.prototype._setupProperties=function(e,r,i,n,o){for(var s in i){var l=e[s],u=Array.isArray(l),h=u?"array":typeof l,m=!u&&Array.isArray(i[s]);if(!(h==="undefined"||h==="function")){if(m){var f=i[s];if(f.length===0)continue;for(var b=[l],y=0,_=f.length;y<_;y+=1){var T=this._handleRelativeValue(l,f[y]);if(isNaN(T)){m=!1,console.warn("Found invalid interpolation list. Skipping.");break}b.push(T)}m&&(i[s]=b)}if((h==="object"||u)&&l&&!m){r[s]=u?[]:{};var g=l;for(var x in g)r[s][x]=g[x];n[s]=u?[]:{};var f=i[s];if(!this._isDynamic){var P={};for(var x in f)P[x]=f[x];i[s]=f=P}this._setupProperties(g,r[s],f,n[s],o)}else(typeof r[s]>"u"||o)&&(r[s]=l),u||(r[s]*=1),m?n[s]=i[s].slice().reverse():n[s]=r[s]||0}}},t.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},t.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},t.prototype.pause=function(e){return e===void 0&&(e=zo()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},t.prototype.resume=function(e){return e===void 0&&(e=zo()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},t.prototype.stopChainedTweens=function(){for(var e=0,r=this._chainedTweens.length;e<r;e++)this._chainedTweens[e].stop();return this},t.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},t.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},t.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},t.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},t.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},t.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},t.prototype.easing=function(e){return e===void 0&&(e=Et.Linear.None),this._easingFunction=e,this},t.prototype.interpolation=function(e){return e===void 0&&(e=Zn.Linear),this._interpolationFunction=e,this},t.prototype.chain=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this._chainedTweens=e,this},t.prototype.onStart=function(e){return this._onStartCallback=e,this},t.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},t.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},t.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},t.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},t.prototype.onStop=function(e){return this._onStopCallback=e,this},t.prototype.update=function(e,r){var i=this,n;if(e===void 0&&(e=zo()),r===void 0&&(r=t.autoStartOnUpdate),this._isPaused)return!0;var o;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<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=e-this._startTime,l=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),u=this._duration+this._repeat*l,h=a(function(){if(i._duration===0||s>u)return 1;var T=Math.trunc(s/l),g=s-T*l,x=Math.min(g/i._duration,1);return x===0&&s===i._duration?1:x},"calculateElapsedPortion"),m=h(),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 b=Math.min(Math.trunc((s-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=b);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*b,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var y=0,_=this._chainedTweens.length;y<_;y++)this._chainedTweens[y].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(e,r,i,n){for(var o in i)if(r[o]!==void 0){var s=r[o]||0,l=i[o],u=Array.isArray(e[o]),h=Array.isArray(l),m=!u&&h;m?e[o]=this._interpolationFunction(l,n):typeof l=="object"&&l?this._updateProperties(e[o],s,l,n):(l=this._handleRelativeValue(s,l),typeof l=="number"&&(e[o]=s+(l-s)*n))}},t.prototype._handleRelativeValue=function(e,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?e+parseFloat(r):parseFloat(r)},t.prototype._swapEndStartRepeatValues=function(e){var r=this._valuesStartRepeat[e],i=this._valuesEnd[e];typeof i=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(i):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=r},t.autoStartOnUpdate=!1,t}();var r3=Wf.nextId,ar=Zu,i3=ar.getAll.bind(ar),n3=ar.removeAll.bind(ar),o3=ar.add.bind(ar),s3=ar.remove.bind(ar),a3=ar.update.bind(ar);v();v();v();v();v();var qf=a((t,e)=>(e-t+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,"differenceBetweenAngles"),$f=a((t,e)=>new ae(t.clientX-e.offsetLeft,t.clientY-e.offsetTop),"getTouchPos"),Uu=a((t,e)=>Math.atan2(e.y-t.y,e.x-t.x),"angle"),Yo=a((t,e)=>Math.sqrt((e.y-t.y)**2+(e.x-t.x)**2),"distance"),ju=a((t,e)=>new ae((t.x+e.x)/2,(t.y+e.y)/2),"average"),Hu=a(t=>{let e=0,{wheelDelta:r,detail:i}=t;return r!==void 0?e=r:i!==void 0&&(e=-i),e},"getScrollDelta");var Wu=class Wu{constructor(e,r){p(this,"input1");p(this,"input2");p(this,"lastAngle");p(this,"lastDistance");p(this,"totalDistance");p(this,"first");p(this,"second");this.input1=e,this.input2=r,this.lastAngle=Uu(e,r),this.lastDistance=Yo(e,r),this.totalDistance=0,this.first=e,this.second=r}update(e,r){let i=Yo(e,r);this.input1=e,this.input2=r;let n=Uu(e,r);this.lastAngle=n,this.lastDistance=i,this.totalDistance+=(Yo(this.first,e)+Yo(this.second,r))/2,this.first=ju(this.first,e),this.second=ju(this.second,r)}};a(Wu,"InputSet");var Ua=Wu;v();var Vu=class Vu{constructor(e,r,i){p(this,"touch");p(this,"camera");p(this,"cameraPlane");p(this,"viewCoordinate");p(this,"snapHolderMatrix");p(this,"snapCamera");p(this,"cameraPosition");p(this,"raycaster");p(this,"worldCoordinate");p(this,"snapshotted",!1);this.touch=e,this.camera=r,this.cameraPlane=i,this.viewCoordinate={x:e.x,y:e.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 e=new ae(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new qt,this.raycaster.setFromCamera(e,this.snapCamera);let r=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=r&&r.length>0?r[0].point:null,this.snapshotted=!0}updateAnchorState(e,r){this.camera=e,this.snapCamera=e.clone(),this.snapHolderMatrix=e.matrixWorld.clone(),this.updateViewCoordinate(r),this.snapshotCameraState()}updateViewCoordinate(e){this.viewCoordinate={x:e.x,y:e.y}}reUnproject(){var i,n;let e=new ae(this.viewCoordinate.x,this.viewCoordinate.y);(i=this.raycaster)==null||i.setFromCamera(e,this.snapCamera);let r=(n=this.raycaster)==null?void 0:n.intersectObject(this.cameraPlane,!0)[0];return r?r.point:void 0}};a(Vu,"TouchAnchor");var Zo=Vu;var Dt={};Pd(Dt,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>jC,CLIPPING_RADIUS:()=>Uo,CONTROL_OPTIONS:()=>UC,DEFAULT_ANIMATION_DURATION:()=>Qu,DEFAULT_BEARING:()=>$C,DEFAULT_MAX_ZOOM_LEVEL:()=>VC,DEFAULT_MIN_ZOOM_LEVEL:()=>eh,DEFAULT_PITCH:()=>qC,DEFAULT_ZOOM_LEVEL:()=>WC,EVENTS:()=>Va,MAPLIBRE_TILE_SIZE:()=>ja,MAX_LAT:()=>$u,MAX_MERCATOR_ZOOM_LEVEL:()=>Wa,MIN_LAT:()=>qu,MIN_MERCATOR_ZOOM_LEVEL:()=>Ha,ROOM_MERCATOR_ZOOM_LEVEL:()=>HC,TWO_PI:()=>Ju,WHEEL_ZOOM_MULTIPLIER:()=>Ku,ZRANGE:()=>Un});v();var ja=512,qu=-85.051129,$u=85.051129,Uo=1e4,UC={chain:"chain",cancel:"cancel"},Ju=Math.PI*2,Un=100,Ku=1e4,Ha=0,Wa=24,jC=17,HC=20,Qu=200,Va=["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"],WC=18,eh=12,VC=22,qC=0,$C=0;v();function Jf(t){t&&(t.map&&(t.map.dispose(),t.map=void 0),t.dispose())}a(Jf,"scrubMaterial");function ze(t){for(let e=t.children.length-1;e>=0;e--)ze(t.children[e]);"geometry"in t&&t.geometry&&t.geometry.dispose(),t.parent&&t.parent.remove(t),"material"in t&&Array.isArray(t.material)?t.material.forEach(function(e){Jf(e)}):"material"in t&&typeof t.material<"u"&&Jf(t.material)}a(ze,"destroyObject3D");var qa=!1,JC=!1;var $a,Ja=class Ja extends me{constructor(r,i,n,o,s){super();p(this,"dirty",!1);p(this,"zoomDirty",!1);p(this,"rotationDirty",!1);p(this,"panDirty",!1);p(this,"stateDirty",!1);L(this,$a,eh);p(this,"zoomSpeed",5);p(this,"rotateSpeed",100);p(this,"enabled",!0);p(this,"enableZoom",!0);p(this,"enablePan",!0);p(this,"enablePedestal",!1);p(this,"maxPedestal",1/0);p(this,"minPedestal",0);p(this,"enableRotate",!0);p(this,"minZoomAltitude",0);p(this,"maxZoomAltitude",1/0);p(this,"ignoreZoomLimits",!1);p(this,"zoomFactor",1);p(this,"panBounds",{min:new H(1/0,1/0),max:new H(-1/0,-1/0),center:new H(0,0,0),radius:1/0});p(this,"minTilt",0);p(this,"maxTilt",1.2);p(this,"MOUSE_BUTTONS",{ORBIT:Bs.RIGHT,ZOOM:Bs.MIDDLE,PAN:Bs.LEFT});p(this,"camera");p(this,"scene");p(this,"renderer");p(this,"elevation");p(this,"orbit");p(this,"cameraPlane");p(this,"raycaster",new qt);p(this,"rendererState");p(this,"options");p(this,"state",-1);p(this,"intersection");p(this,"viewState",null);p(this,"tweens",new Map);p(this,"clock",new Zd(!0));p(this,"coords",{mouse:new ae,rotateStart:new ae,rotateEnd:new ae,rotateDelta:new ae,panStart:new H,panCameraStart:new H,panEnd:new H,panDelta:new H,initialShiftPos:new ae,initialPedestal:0,floorAnchor:new H});p(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});p(this,"scrollTimer",null);p(this,"lastWheelTime",0);p(this,"resetZoom",!1);p(this,"zoomStart");p(this,"pedestalScaleFactor",1);p(this,"isUserZooming",!1);p(this,"stayInsideBounds",!0);p(this,"userInteracting",!1);p(this,"cameraMoving",!1);p(this,"lastCameraMoveTime",Date.now());p(this,"raycastToFloor",a(r=>{this.raycaster.setFromCamera(r,this.camera);let i=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return i?i.point:new H},"raycastToFloor"));p(this,"isUserInteracting",a(()=>this.userInteracting,"isUserInteracting"));p(this,"getPosition",a(()=>new H(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z),"getPosition"));p(this,"getPedestal",a(()=>this.orbit.position.z,"getPedestal"));p(this,"pan",a((r,i)=>{isNaN(r)||isNaN(i)||(this.setPosition(this.orbit.position.x+r,this.orbit.position.y+i),this.publish("position-updated"))},"pan"));p(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"));p(this,"isCameraMoving",a(()=>this.cameraMoving,"isCameraMoving"));p(this,"lastCameraStoppedMovingTime",a(()=>this.lastCameraMoveTime,"lastCameraStoppedMovingTime"));p(this,"setPosition",a((r,i)=>{r===void 0||i===void 0||isNaN(r)||isNaN(i)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(r,i),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)},"setPosition"));p(this,"updateCameraPosition",a((r,i)=>{let n=r-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),u={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=u.x,this.orbit.position.y=u.y}else this.orbit.position.x=r,this.orbit.position.y=i},"updateCameraPosition"));p(this,"tilt",a(r=>{if(isNaN(r))return;this.state===-1&&this.publish("rotate-start");let i=this.stayInsideBounds?Math.max(Math.min(r+this.getTilt(),this.maxTilt),this.minTilt):r+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"));p(this,"zoomIn",a((r,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o/1.5},r,i,n)},"zoomIn"));p(this,"zoomOut",a((r,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o*1.5},r,i,n)},"zoomOut"));p(this,"getRotation",a(()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2),"getRotation"));p(this,"cancelAnimation",a(()=>{let r=Array.from(this.tweens.keys()),i=r[r.length-1];i.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(i)},"cancelAnimation"));p(this,"animateCamera",a((r,i,n,o,s,l)=>{let u=O({interruptible:!0},l),h={},m={},f=this.getPosition();if(r.position!=null&&(r.position.x!==void 0&&(h.x=f.x,m.x=r.position.x),r.position.y!==void 0&&(h.y=f.y,m.y=r.position.y),r.position.z!==void 0&&(h.z=f.z,m.z=r.position.z)),r.zoom!==void 0&&(h.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?m.zoom=r.zoom:m.zoom=Math.min(Math.max(r.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),r.rotation!==void 0){let{start:S,end:C}=Kd(this.getRotation(),r.rotation);h.rotation=S,m.rotation=C}r.tilt!==void 0&&(h.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?m.tilt=r.tilt:m.tilt=Math.max(Math.min(r.tilt,this.maxTilt),this.minTilt));let b=h.zoom!==m.zoom,y=h.rotation!==m.rotation,_=h.tilt!==m.tilt,T=new Vf(h).to(m,E.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(T),this.publish("multi-end",{zooming:b,rotating:y,tilting:_}),o&&o()}).onStart(()=>{this.state!==7&&(this.state=7,T.state=7,this.publish("multi-start",{zooming:b,rotating:y,tilting:_})),this.publish("change")});this.rendererState.internalTweenGroup.add(T);let g=Array.from(this.tweens.entries()),x=g[g.length-1],P=!1;return x!=null&&(x[1].interruptible?(typeof x[1].cancelledCallback=="function"&&x[1].cancelledCallback(),this.completeTween(x[0])):(P=!0,x[0].chain(T))),this.tweens.set(T,{cancelledCallback:s,interruptible:u.interruptible}),n?T.easing(n):T.easing(Et.Quadratic.In),!r.doNotAutoStart&&!P&&(T.start(),this.publish("change")),T.cameraAnimation=!0,T},"animateCamera"));p(this,"setMulti",a((r,i,n,o,s=!0)=>{this.state===-1&&this.publish("multi-start");let l=!1;r!=null&&(r.x!==void 0&&!isNaN(r.x)&&r.y!==void 0&&!isNaN(r.y)&&(this.updateCameraPosition(r.x,r.y),l=!0),r.z!==void 0&&!isNaN(r.z)&&(this.setPedestal(r.z,!0,!1),l=!0)),l&&this.publish("position-updated");let u={zooming:!1,tilting:!!i,rotating:!1};if(i!==void 0&&!isNaN(i)){let h=this.stayInsideBounds?Math.min(Math.max(i,this.getZoomScaledMin()),this.getZoomScaledMax()):i;h!==this.camera.position.z&&(u.zooming=!0,this.camera.position.z=h,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?i>Uo&&(this.camera.near=i-Uo,this.camera.far=i+Uo):(this.camera.near=i/Un,this.camera.far=i*Un),this.camera.updateProjectionMatrix())}if(n!==void 0&&!isNaN(n)&&n!==this.getRotation()&&(u.rotating=!0,this.orbit.rotation.z=-n,this.publish("rotation-updated")),o!==void 0&&!isNaN(o)){let h=this.stayInsideBounds?Math.max(Math.min(o,this.maxTilt),this.minTilt):o;h!==this.elevation.rotation.x&&(u.tilting=!0,this.elevation.rotation.x=h,this.publish("tilt-updated"))}s&&this.publish("change"),this.state===-1&&this.publish("multi-end",u),this.stateDirty=!0},"setMulti"));p(this,"getZoomScaledMin",a(()=>this.minZoomAltitude*this.zoomFactor,"getZoomScaledMin"));p(this,"getZoomScaledMax",a(()=>{let r=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,r)},"getZoomScaledMax"));p(this,"setRotation",a((r,i)=>{if(isNaN(r))return;this.state===-1&&!i&&this.publish("rotate-start");let n=-(r%Ju);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"));p(this,"setZoomAltitude",a(r=>{if(isNaN(r))return;this.state===-1&&this.publish("zoom-start");let i=this.stayInsideBounds?Math.min(Math.max(r,this.getZoomScaledMin()),this.getZoomScaledMax()):r;i!==this.camera.position.z&&(this.camera.position.z=i,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=i/Un,this.camera.far=i*Un,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0},"setZoomAltitude"));p(this,"setZoomLevel",a(r=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(r))},"setZoomLevel"));p(this,"getZoomAltitude",a(()=>this.camera.position.z,"getZoomAltitude"));p(this,"getZoomLevel",a(()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()),"getZoomLevel"));p(this,"setTilt",a((r,i)=>{if(isNaN(r))return;this.state===-1&&!i&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(r,this.maxTilt),this.minTilt):r;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"));p(this,"getTilt",a(()=>this.elevation.rotation.x,"getTilt"));p(this,"setCameraPlaneElevation",a(r=>{this.cameraPlane.position.z=r},"setCameraPlaneElevation"));p(this,"zoom",a(r=>{if(isNaN(r))return;this.state===-1&&this.publish("zoom-start");let i=this.getZoomAltitude()-r;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"));p(this,"getProjectionScaleFactor",a((r,i,n)=>gc(r,i,n),"getProjectionScaleFactor"));p(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"));p(this,"setPedestal",a((r,i=!1,n=!0)=>{typeof r=="number"&&!isNaN(r)&&(this.orbit.position.z=r,i&&(this.publishPedestalChangeEvent(r),this.publish("pedestal-change",{pedestal:r})),this.publish("change"),this.dirty=!0,n&&(this.stateDirty=!0))},"setPedestal"));p(this,"dispose",a(()=>{for(let r of Va)r.endsWith("start")?(this.off(r,this.setCameraMoving),r.startsWith("user")&&this.off(r,this.setUserInteracting)):(r.endsWith("end")||r.endsWith("cancel"))&&(this.off(r,this.unsetCameraMoving),r.startsWith("user")&&this.off(r,this.unsetUserInteracting));this.removeEventListeners(),this.scene.remove(this.cameraPlane),this.destroy()},"dispose"));p(this,"createCameraPlane",a(()=>{let r=qa?2e3:1e10,i=qa?100:1,n=new Nt(r,r,i,i),o=new st({color:0,wireframe:qa,visible:qa}),s=new be(n,o);return this.scene.add(s),s},"createCameraPlane"));p(this,"addEventListeners",a(()=>{let{domElement:r}=this.renderer;for(let i of Va)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));r.addEventListener("contextmenu",this.onContextMenu,!1),r.addEventListener("mousedown",this.onMouseDown,!1),r.addEventListener("wheel",this.onMouseWheel,{passive:!1}),r.addEventListener("touchstart",this.onTouchStart,!1),r.addEventListener("touchend",this.onTouchEnd,!1),r.addEventListener("touchmove",this.onTouchMove,!1)},"addEventListeners"));p(this,"addMouseEventListeners",a(()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,!1),window.addEventListener("mouseout",this.onMouseUp,!1)},"addMouseEventListeners"));p(this,"addMouseMoveEventListeners",a(()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1)},"addMouseMoveEventListeners"));p(this,"removeMouseMoveEventListeners",a(()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1)},"removeMouseMoveEventListeners"));p(this,"removeEventListeners",a(()=>{let{domElement:r}=this.renderer;r.removeEventListener("contextmenu",this.onContextMenu,!1),r.removeEventListener("mousedown",this.onMouseDown,!1),r.removeEventListener("wheel",this.onMouseWheel,!1),r.removeEventListener("touchstart",this.onTouchStart,!1),r.removeEventListener("touchend",this.onTouchEnd,!1),r.removeEventListener("touchmove",this.onTouchMove,!1),r.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)},"removeEventListeners"));p(this,"removeMouseUpEventListeners",a(()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)},"removeMouseUpEventListeners"));p(this,"onContextMenu",a(r=>{r.preventDefault()},"onContextMenu"));p(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"));p(this,"onMouseMove",a(r=>{if(this.enabled!==!1)if(r.preventDefault(),this.mouseToScene(r),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(r)}else if(this.state===2){if(this.enablePan===!1)return;this.handleMouseMovePan()}else this.state===3?(this.resetZoom=!0,this.state=-1):this.state===8&&this.handleMouseMovePedestal(r)},"onMouseMove"));p(this,"onTouchStart",a(r=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(r),r.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(r),this.state=9):this.enablePan&&(this.handleTouchStartPan(r),this.state=6);break;case 2:this.touch.inputs=new Ua(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}},"onTouchStart"));p(this,"onTouchMove",a(r=>{if(this.enabled!==!1)switch(this.touchToScene(r),r.touches.length){case 2:r.preventDefault(),r.stopPropagation();let i=O({},this.touch.inputs.first),n=O({},this.touch.inputs.second),o=new ae(this.touch.touches[0].x,this.touch.touches[0].y),s=new ae(this.touch.touches[1].x,this.touch.touches[1].y);if(this.touch.inputs.update(this.touch.touches[0],this.touch.touches[1]),this.enableRotate&&this.state===4)this.handleTouchMoveTilt(r);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let l=i.y<o.y&&n.y<s.y,u=i.y>o.y&&n.y>s.y;this.enableRotate&&this.state!==4&&(u||l)?(this.handleTouchStartTilt(r),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(r.preventDefault(),r.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(r):this.enablePan&&this.state===6&&this.handleTouchMovePan(r);break;default:this.state=-1}},"onTouchMove"));p(this,"onTouchEnd",a(r=>{if(this.enabled!==!1){switch(this.handleTouchEnd(),this.state){case 2:case 6:this.publish("user-pan-end");break;case 4:this.publish("pan-end"),this.publish("user-tilt-end");break;case 1:case 5:this.publish("zoom-end"),this.publish("user-dolly-end");break;case 0:this.publish("rotate-end"),this.publish("user-rotate-end");break;case 8:case 9:this.publish("pedestal-end"),this.publish("user-pedestal-end");break}r.touches.length?this.onTouchStart(r):this.state=-1}},"onTouchEnd"));p(this,"handleTouchMovePan",a(r=>{let i=Object.hasOwn(r,"x")?new ae(r.x,r.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"));p(this,"handleTouchStartDolly",a(()=>{let r=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 ae(this.touch.touches[0].x-r/2,this.touch.touches[0].y-i/2);this.coords.floorAnchor=this.raycastToFloor(n),this.orbit.updateMatrixWorld(),this.touch.anchor1=new Zo(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Zo(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"));p(this,"handleMouseMovePan",a(()=>{let r=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(r.x,r.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change"),this.panDirty=!0},"handleMouseMovePan"));p(this,"handleTouchStartTilt",a(r=>{this.coords.rotateStart.set(r.touches[1].clientX,r.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")},"handleTouchStartTilt"));p(this,"handleTouchMovePedestal",a(r=>{this.handleMouseMovePedestal(r.touches[0])},"handleTouchMovePedestal"));p(this,"handleTouchMoveTilt",a(r=>{this.coords.rotateEnd.set(r.touches[1].clientX,r.touches[1].clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd)},"handleTouchMoveTilt"));p(this,"handleTouchMoveDolly",a(()=>{let r=this.touch.inputs.first,i=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:r.x,y:r.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,r),this.touch.anchor2.updateAnchorState(this.camera,i)},"handleTouchMoveDolly"));p(this,"handleTouchEnd",a(()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1},"handleTouchEnd"));p(this,"handleTouchStartPan",a(r=>{let i=Object.hasOwn(r,"x")?new ae(r.x,r.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"));p(this,"handleTouchStartPedestal",a(r=>{this.handleMouseDownPedestal(r.touches[0])},"handleTouchStartPedestal"));p(this,"onMouseDown",a(r=>{if(this.enabled!==!1){if(this.mouseToScene(r),r.preventDefault(),this.state===3&&this.publish("zoom-end"),r.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(r),this.state=0}else r.button===this.MOUSE_BUTTONS.PAN&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(r),this.state=8));this.state!==-1&&this.addMouseEventListeners()}},"onMouseDown"));p(this,"onMouseWheel",a(r=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(r.preventDefault(),r.stopPropagation(),this.mouseToScene(r),this.canScrollZoom(r)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(r)&&(this.addMouseMoveEventListeners(),this.state=3,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("zoom-start")),this.scrollTimer!=null&&clearTimeout(this.scrollTimer),this.scrollTimer=setTimeout(()=>{this.publish("zoom-end")},50),this.handleMouseWheel(r))},"onMouseWheel"));p(this,"handleMouseWheel",a(r=>{if(this.publish("zoom-start"),!this.canScrollZoom(r)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let i=this.getZoomAltitude(),n=i-Hu(r)*i/Ku*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"));p(this,"setCameraFromTransformMatrix",a(r=>{this.orbit.updateMatrixWorld();let i=new mr;i.setFromRotationMatrix(r,"ZYX");let n=(r.elements[14]-this.cameraPlane.position.z)/Math.cos(i.x),o=i.z,s=new H(0,0,1);s.applyEuler(i),s.setLength(n);let l=new H;l.setFromMatrixPosition(r),l.sub(s),this.enablePan&&this.setPosition(l.x,l.y),this.enableZoom&&this.setZoomAltitude(n),this.enableRotate&&this.setRotation(-o)},"setCameraFromTransformMatrix"));p(this,"makeTransformFromTouchAnchors",a((r,i)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let n=this.camera.projectionMatrix.clone(),o=r.worldCoordinate,s=i.worldCoordinate,l=r.reUnproject(),u=i.reUnproject();if(!l||!u||!o||!s)return null;let h=r.viewCoordinate,m=i.viewCoordinate,f=s.x-o.x,b=s.y-o.y,y=Math.atan2(b,f),_=u.x-l.x,T=u.y-l.y,g=Math.atan2(T,_),x=qf(y,g),P=new bt;P.makeRotationZ(-x);let S=P.clone();S.multiply(r.snapHolderMatrix);let C=a((Xg,zg,Yg)=>Xg.elements[(zg-1)*4+Yg-1],"m"),w=C(n,1,1)*C(S,1,1)-h.x*C(n,3,4)*C(S,3,1),k=C(n,1,1)*C(S,1,2)-h.x*C(n,3,4)*C(S,3,2),A=C(n,1,1)*C(S,1,3)-h.x*C(n,3,4)*C(S,3,3),N=o.x*w+o.y*k+o.z*A,Y=C(n,2,2)*C(S,2,1)-h.y*C(n,3,4)*C(S,3,1),z=C(n,2,2)*C(S,2,2)-h.y*C(n,3,4)*C(S,3,2),X=C(n,2,2)*C(S,2,3)-h.y*C(n,3,4)*C(S,3,3),q=o.x*Y+o.y*z+o.z*X,F=C(n,1,1)*C(S,1,1)-m.x*C(n,3,4)*C(S,3,1),J=C(n,1,1)*C(S,1,2)-m.x*C(n,3,4)*C(S,3,2),pe=C(n,1,1)*C(S,1,3)-m.x*C(n,3,4)*C(S,3,3),se=s.x*F+s.y*J+s.z*pe,De=C(n,2,2)*C(S,2,1)-m.y*C(n,3,4)*C(S,3,1),ve=C(n,2,2)*C(S,2,2)-m.y*C(n,3,4)*C(S,3,2),ge=C(n,2,2)*C(S,2,3)-m.y*C(n,3,4)*C(S,3,3),xe=s.x*De+s.y*ve+s.z*ge,rt=Math.abs(F-w),Ge=Math.abs(J-k),Ue=Math.abs(pe-A),je=Math.abs(F-Y),Me=Math.abs(J-z),Xe=Math.abs(pe-X),Ke=Math.abs(De-w),_t=Math.abs(ve-k),Lr=Math.abs(ge-A),yt=Math.abs(De-Y),Qe=Math.abs(ve-z),ne=Math.abs(ge-X),K=Math.min(rt+Ge+Ue,je+Me+Xe),Pe=Math.min(Ke+_t+Lr,yt+Qe+ne);K<Pe&&(F=De,J=ve,pe=ge,se=xe);let Ye=Y*A-w*X,Wt=z*A-k*X,ui=q*A-N*X,pr=F*X-Y*pe,lo=J*X-z*pe,bd=se*X-q*pe,Rg=(bd*Wt-ui*lo)/(pr*Wt-Ye*lo),Ng=(bd*Ye-ui*pr)/(lo*Ye-Wt*pr),xd=z*w-k*Y,Bg=X*w-A*Y,Fg=q*w-N*Y,Sd=J*Y-z*F,Gg=pe*Y-X*F,Cd=((se*Y-q*F)*xd-Fg*Sd)/(Gg*xd-Bg*Sd),Rs=S.clone();return Rs.elements[12]=Rg,Rs.elements[13]=Ng,Rs.elements[14]=Cd,Cd>0?Rs:null},"makeTransformFromTouchAnchors"));p(this,"updateTouchOrigin",a(()=>{let r=this.renderer.domElement;this.touch.origin.offsetLeft=r.getBoundingClientRect().left,this.touch.origin.offsetTop=r.getBoundingClientRect().top},"updateTouchOrigin"));p(this,"touchToScene",a(r=>{this.touch.touches=[];for(let i=0,n=r.touches.length;i<n;i++){let o=r.touches[i],s=$f(o,this.touch.origin);this.touch.touches.push(new ae(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"));p(this,"canScrollZoom",a(r=>{let i=Hu(r),n=this.getZoomAltitude();return!(i<0&&n===this.getZoomScaledMax()||i>0&&n===this.getZoomScaledMin())},"canScrollZoom"));p(this,"mouseToScene",a(r=>{let i=this.getMousePos(r);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"));p(this,"getMousePos",a(r=>({x:r.offsetX,y:r.offsetY}),"getMousePos"));p(this,"handleMouseDownRotate",a(r=>{this.coords.rotateStart.set(r.clientX,r.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")},"handleMouseDownRotate"));p(this,"handleMouseDownPan",a(()=>{let r=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(r.x,r.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")},"handleMouseDownPan"));p(this,"handleMouseDownPedestal",a(r=>{let i=new ae(r.clientX,r.clientY);this.coords.initialShiftPos=i,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=gc(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")},"handleMouseDownPedestal"));p(this,"handleMouseMovePedestal",a(r=>{let i={x:r.clientX,y:r.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"));p(this,"handleMouseMoveRotate",a(r=>{this.coords.rotateEnd.set(r.clientX,r.clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setRotation(this.getRotation()+this.coords.rotateDelta.x/this.rotateSpeed),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd),this.publish("change")},"handleMouseMoveRotate"));p(this,"publishUserZoomDebounced",po(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));p(this,"publishUserZoomEvent",a(()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())},"publishUserZoomEvent"));p(this,"setCameraMoving",a(()=>{this.cameraMoving=!0},"setCameraMoving"));p(this,"unsetCameraMoving",a(()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()},"unsetCameraMoving"));p(this,"setUserInteracting",a(()=>{this.userInteracting=!0},"setUserInteracting"));p(this,"unsetUserInteracting",a(()=>{this.userInteracting=!1},"unsetUserInteracting"));p(this,"publishPedestalChangeEvent",a(r=>{this.publish("pedestal-change",{pedestal:r,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})},"publishPedestalChangeEvent"));p(this,"convertAltitudeToZoomLevel",a(r=>{let[,i]=this.center,o=r*2*Math.tan(ue.degToRad(this.camera.fov)/2)/this.options.canvasHeight,s=Math.cos(ue.degToRad(i))*2*Math.PI*dc/o;return ue.clamp(Math.log2(s/512),Ha,Wa)},"convertAltitudeToZoomLevel"));p(this,"convertZoomLevelToAltitude",a(r=>{let[,i]=this.center,n=ue.clamp(r,Ha,Wa),o=Math.pow(2,n),s=ue.clamp(i,qu,$u),l=o*512;return Math.cos(ue.degToRad(s))*Math.PI*2*dc/l*this.options.canvasHeight/2/Math.tan(ue.degToRad(this.camera.fov)/2)},"convertZoomLevelToAltitude"));p(this,"completeTween",a(r=>{r.isPlaying()&&r.stop(),this.rendererState.internalTweenGroup.remove(r),this.tweens.delete(r)},"completeTween"));p(this,"debugContainer",new fr);this.camera=r,this.renderer=n,this.rendererState=o,this.scene=i,this.options=s,this.elevation=r.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=r.position.z,s.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(r){this.minZoomAltitude=this.convertZoomLevelToAltitude(r),this.stateDirty=!0}get defaultMinZoomLevel(){return c(this,$a)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(r){this.maxZoomAltitude=this.convertZoomLevelToAltitude(r),this.stateDirty=!0}get scrollPercent(){let r=this.minPedestal,i=this.maxPedestal,n=this.getPedestal();return n=Math.min(n,i),n=Math.max(n,r),(n-r)/(i-r)*100}get fov(){return this.camera.fov}get scrolledToBottom(){return this.minPedestal===0||Math.floor(this.getPedestal())<=this.minPedestal}get scrolledToTop(){return this.maxPedestal===0||Math.ceil(this.getPedestal())>=this.maxPedestal}get center(){var o,s,l,u;let r=this.getPosition(),{lat:i,lon:n}=ea((s=(o=this.rendererState.center)==null?void 0:o[1])!=null?s:0,(u=(l=this.rendererState.center)==null?void 0:l[0])!=null?u:0,r.x,r.y);return[n,i]}setCenter(r,i){var s,l,u,h;let{x:n,y:o}=ta((l=(s=this.rendererState.center)==null?void 0:s[1])!=null?l:0,(h=(u=this.rendererState.center)==null?void 0:u[0])!=null?h:0,i,r);this.setPosition(n,o)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(r=>r.cameraAnimation)}getCameraFrameForCoordinates(r,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,u=this.getRotation(),h=this.getTilt(),m=this.getPosition();this.setRotation(i.rotation||u,!0),this.setTilt(i.tilt||h,!0);let f=Kf(r,{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(u,!0),this.setTilt(h,!0),{center:f.position,zoomLevel:this.convertAltitudeToZoomLevel(f.zoom)}}focusOn(r,i){if(JC){this.debugContainer&&ze(this.debugContainer);let g=new kr(4,4,4),x=new st({color:65280,depthTest:!1}),P=new Br(g,x,r.length),S=new bt;r.forEach((C,w)=>{S.setPosition(C),P.setMatrixAt(w,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,u=i.maxZoom!==void 0?i.maxZoom:this.maxZoomAltitude,h=this.options.canvasWidth,m=this.options.canvasHeight,f;i.duration!==void 0?f=i.duration:E.env.TESTING==="true"?f=0:f=Qu;let b=i.padding,y=this.getRotation(),_=this.getTilt();i.rotation!=null&&this.setRotation(i.rotation),i.tilt!=null&&this.setTilt(i.tilt);let T=Kf(r,{canvasHeight:m,paddingOption:b,canvasWidth:h,minZoom:l,maxZoom:u,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:i.verticalPadding});this.setRotation(y),this.setTilt(_),this.animateCamera({position:T.position,tilt:i.tilt,rotation:i.rotation,zoom:T.zoom},f,n,o,s,i)}resize(r,i){this.options.canvasWidth=r,this.options.canvasHeight=i}};$a=new WeakMap,a(Ja,"CameraSystem"),p(Ja,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);var jn=Ja;function Kf(t,{canvasWidth:e,orbit:r,paddingOption:i,verticalPadding:n=0,canvasHeight:o,minZoom:s,maxZoom:l,camera:u,position:h}){let m={zoom:s,position:h};if(t.length===0)return m;for(let Ye of jn.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*e,right:i.right*e,type:"pixel"}:i;if(f.left+f.right>=e||f.top+f.bottom>=o)return m;r.updateMatrixWorld();let b=u.matrixWorldInverse,y=u.fov*(Math.PI/180)/2,_=y,g=Math.atan(Math.tan(y)*(e/o)),x=new H(1/0,1/0,1/0),P=new H(-1/0,-1/0,-1/0),S=new it,C=new H;for(let Ye=0,Wt=t.length;Ye<Wt;Ye++)C.copy(t[Ye]),S.expandByPoint(C),C.applyMatrix4(b),x.min(C),P.max(C),C.copy(t[Ye]),C.z-=n,C.applyMatrix4(b),x.min(C),P.max(C),C.copy(t[Ye]),C.z+=n,C.applyMatrix4(b),x.min(C),P.max(C);let w=P.x-x.x,k=P.y-x.y,A=e-f.left-f.right,N=o-f.top-f.bottom,Y=(P.x+x.x)/2,z=(P.y+x.y)/2,X=w/A,q=k/N,F=s,J=l,pe=F*Math.tan(g)*2,se=J*Math.tan(g)*2,De=pe/e,ve=se/e,ge=Math.max(X,q);ge=ue.clamp(ge,De,ve);let xe=A*ge,rt=N*ge,Ge={min:{x:Y-xe/2-f.left*ge,y:z-rt/2-f.bottom*ge},max:{x:Y+xe/2+f.right*ge,y:z+rt/2+f.top*ge}},Ue=(Ge.min.x+Ge.max.x)/2,je=(Ge.min.y+Ge.max.y)/2,Me=S.getCenter(new H),Xe=Math.abs(Ue-Ge.min.x),Ke=Math.abs(je-Ge.min.y),_t=Xe/Math.tan(g),Lr=Ke/Math.tan(_),yt=new H;yt.set(Ue,je,P.z+Math.max(_t,Lr)),yt.applyMatrix4(u.matrixWorld);let Qe=new H;Qe.set(Ue,je,P.z),Qe.applyMatrix4(u.matrixWorld);let ne=new H().subVectors(Qe,yt),K=(Me.z-yt.z)/ne.z,Pe=new H().copy(yt).add(ne.clone().multiplyScalar(K));return Qe.set(Pe.x,Pe.y,Pe.z),yt.sub(Qe),{position:Pe,zoom:yt.length()}}a(Kf,"getCameraFrameForPoints");var KC=0,QC=90,e_=(E.env.NODE_ENV==="test",!1),Ka={linear:Et.Linear.None,"ease-in":Et.Quadratic.In,"ease-out":Et.Quadratic.Out,"ease-in-out":Et.Quadratic.InOut},t_=-50,$,ie,Ir,jo,Ho,rh,ih=class ih{constructor(e,r,i){L(this,Ho);L(this,$);L(this,ie);L(this,Ir);L(this,jo);R(this,$,e),R(this,ie,r),R(this,Ir,i),c(this,$).map&&c(this,$).map.transform.setMinElevationForCurrentTile(t_),c(this,ie).cameraSystem.on("pedestal-change",({pedestal:n})=>{c(this,ie).cameraSystem.setCameraPlaneElevation(n)})}get center(){var e,r;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(r=(e=c(this,$).map).getCenter)==null?void 0:r.call(e).toArray():c(this,ie).cameraSystem.center}setCenter(e){var r;if(c(this,$).mode==="outdoors-overlay"&&c(this,$).map){(r=c(this,$).map)==null||r.setCenter(e),c(this,ie).interactionSystem.handleHover();return}c(this,ie).cameraSystem.setCenter(e[0],e[1]),c(this,ie).interactionSystem.handleHover()}get zoomLevel(){var e;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(e=c(this,$).map)==null?void 0:e.getZoom():c(this,ie).cameraSystem.getZoomLevel()}setZoomLevel(e){var r;c(this,$).mode==="outdoors-overlay"&&c(this,$).map&&((r=c(this,$).map)==null||r.setZoom(e)),c(this,ie).cameraSystem.setZoomLevel($t(e,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits."))}getState(){return{zoomLevel:this.zoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,minPitch:this.minPitch,maxPitch:this.maxPitch,autoMinZoomLevel:this.autoMinZoomLevel,panMode:this.panMode,screenOffsets:this.insetsPadding,center:this.center,bearing:this.bearing,pitch:this.pitch,elevation:this.elevation}}get isAnimating(){return c(this,ie).cameraSystem.isAnimating}cancelAnimation(){c(this,ie).cameraSystem.cancelAnimation()}get maxZoomLevel(){return c(this,ie).cameraSystem.maxZoomLevel}get minZoomLevel(){return c(this,ie).cameraSystem.minZoomLevel}setAutoMinZoomLevel(e){c(this,ie).panBoundsSystem.autoMinZoomLevel=e,e&&(c(this,ie).panBoundsSystem.dirty=!0,c(this,ie).panBoundsSystem.update())}get autoMinZoomLevel(){return c(this,ie).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(e,r=!1){var n;r&&this.setAutoMinZoomLevel(!1);let i=$t(e,Dt.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,"setMinZoomLevel was clamped. minZoomLevel must be between ".concat(Dt.MIN_MERCATOR_ZOOM_LEVEL," and maxZoomLevel."));c(this,ie).cameraSystem.setMinZoomLevel(i),this.zoomLevel<i&&this.setZoomLevel(i),(n=c(this,$).map)==null||n.setMinZoom(i)}setMaxZoomLevel(e){var i;let r=$t(e,this.minZoomLevel,Dt.MAX_MERCATOR_ZOOM_LEVEL,"setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ".concat(Dt.MAX_MERCATOR_ZOOM_LEVEL,"."));c(this,ie).cameraSystem.setMaxZoomLevel(r),this.zoomLevel>r&&this.setZoomLevel(r),(i=c(this,$).map)==null||i.setMaxZoom(r)}get maxPitch(){var e,r;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(r=(e=c(this,$).map)==null?void 0:e.getMaxPitch)==null?void 0:r.call(e):ue.radToDeg(c(this,ie).cameraSystem.maxTilt)}get minPitch(){var e,r;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(r=(e=c(this,$).map)==null?void 0:e.getMinPitch)==null?void 0:r.call(e):ue.radToDeg(c(this,ie).cameraSystem.minTilt)}setMinPitch(e){var i;let r=Math.max(KC,e);(i=c(this,$).map)==null||i.setMinPitch(r),c(this,ie).cameraSystem.minTilt=ue.degToRad(r)}setMaxPitch(e){var i;let r=Math.min(QC,e);(i=c(this,$).map)==null||i.setMaxPitch(r),c(this,ie).cameraSystem.maxTilt=ue.degToRad(r)}get bearing(){var e;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(e=c(this,$).map)==null?void 0:e.getBearing():ue.radToDeg(c(this,ie).cameraSystem.getRotation())}setBearing(e){var r;if(c(this,$).mode==="outdoors-overlay"&&c(this,$).map){(r=c(this,$).map)==null||r.setBearing(e);return}c(this,ie).cameraSystem.setRotation(ue.degToRad(e))}get pitch(){var e;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(e=c(this,$).map)==null?void 0:e.getPitch():ue.radToDeg(c(this,ie).cameraSystem.getTilt())}setPitch(e){var r;if(c(this,$).mode==="outdoors-overlay"&&c(this,$).map){(r=c(this,$).map)==null||r.setPitch(e);return}c(this,ie).cameraSystem.setTilt(ue.degToRad($t(e,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")))}get elevation(){return c(this,ie).cameraSystem.getPedestal()}setElevation(e){c(this,ie).cameraSystem.setPedestal(e,!0)}animateElevation(e,r){return c(this,jo)&&c(this,jo).stop(),new Promise(i=>{var n;c(this,ie).cameraSystem.animateCamera({position:{z:e}},(r==null?void 0:r.duration)||300,Ka[(r==null?void 0:r.easing)||"ease-in-out"],i,i,{interruptible:(n=r==null?void 0:r.interruptible)!=null?n:!0})})}get insetsPadding(){return c(this,Ir).insetsPadding}get panMode(){return c(this,ie).cameraSystem.enablePan===!1&&c(this,ie).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(e){if(e!=="default"&&e!=="elevation")throw new Error("Invalid pan mode");e!==this.panMode&&(e==="default"?(c(this,ie).cameraSystem.enablePan=!0,c(this,ie).cameraSystem.enablePedestal=!1):(c(this,ie).cameraSystem.enablePan=!1,c(this,ie).cameraSystem.enablePedestal=!0))}setInsetPadding(e){c(this,Ir).insetsPadding=Object.assign({},c(this,Ir).insetsPadding,e)}animateTo(e){var s,l,u,h,m,f;if(c(this,$).mode==="outdoors-overlay"&&c(this,$).map)return(f=c(this,$).map)==null||f.flyTo({center:(s=e.center)!=null?s:this.center,zoom:(l=e.zoomLevel)!=null?l:this.zoomLevel,bearing:(u=e.bearing)!=null?u:this.bearing,pitch:(h=e.pitch)!=null?h:this.pitch,duration:(m=e.duration)!=null?m:600}),Promise.resolve();let r=e.center?c(this,$).convertTo3DMapPosition(e.center[1],e.center[0],e.center[2]||this.elevation):void 0,i=e.zoomLevel!==void 0?c(this,ie).cameraSystem.convertZoomLevelToAltitude($t(e.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,n=e.bearing!==void 0?ue.degToRad(e.bearing):void 0,o=e.pitch!==void 0?ue.degToRad($t(e.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0;return new Promise(b=>{var y;c(this,ie).cameraSystem.animateCamera({position:r,zoom:i,rotation:n,tilt:o},e.duration||0,Ka[e.easing||"ease-in-out"],()=>{c(this,ie).interactionSystem.handleHover(),b()},b,{interruptible:(y=e==null?void 0:e.interruptible)!=null?y:!0})})}getCameraFrameForCoordinates(e,r){let i=_e(this,Ho,rh).call(this,r||{},()=>Promise.resolve()),{pointCloud:n}=Qf(e,c(this,$),c(this,Ir).geometry3DMap);if(n.length===0)return te.error("No valid coordinates found in targets:",e),{center:this.center,zoomLevel:this.zoomLevel};let{center:o,zoomLevel:s}=c(this,ie).cameraSystem.getCameraFrameForCoordinates(n,i);return{center:c(this,$).convert3DMapPositionToCoordinate(o),zoomLevel:s}}focusOn(e,r){var s,l,u,h;let{pointCloud:i,geoBounds:n,firstPosition:o}=Qf(e,c(this,$),c(this,Ir).geometry3DMap);return i.length===0?(te.error("No valid coordinates found in targets:",e),Promise.resolve()):c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(i.length===1&&o?(s=c(this,$).map)==null||s.flyTo({center:[o[0],o[1]],duration:(r==null?void 0:r.duration)||c(this,$).map.getBearing(),animate:!0,bearing:(r==null?void 0:r.bearing)===void 0?c(this,$).map.getBearing():r==null?void 0:r.bearing,pitch:(r==null?void 0:r.pitch)===void 0?c(this,$).map.getPitch():r==null?void 0:r.pitch,zoom:(r==null?void 0:r.maxZoomLevel)||c(this,$).map.getMaxZoom()}):(e_&&r_(c(this,$),n),(h=c(this,$).map)==null||h.fitBounds(n,{duration:(l=r==null?void 0:r.duration)!=null?l:Dt.DEFAULT_ANIMATION_DURATION,bearing:(r==null?void 0:r.bearing)===void 0?c(this,$).map.getBearing():r==null?void 0:r.bearing,pitch:(r==null?void 0:r.pitch)===void 0?c(this,$).map.getPitch():r==null?void 0:r.pitch,maxZoom:(u=r==null?void 0:r.maxZoomLevel)!=null?u:c(this,$).map.getMaxZoom()})),c(this,ie).interactionSystem.handleHover(),Promise.resolve()):new Promise(m=>{c(this,ie).cameraSystem.focusOn(i,_e(this,Ho,rh).call(this,r||{},m))})}};$=new WeakMap,ie=new WeakMap,Ir=new WeakMap,jo=new WeakMap,Ho=new WeakSet,rh=a(function(e,r){var i;return{minZoom:(e==null?void 0:e.maxZoomLevel)===void 0?void 0:c(this,ie).cameraSystem.convertZoomLevelToAltitude($t(e.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:(e==null?void 0:e.minZoomLevel)===void 0?void 0:c(this,ie).cameraSystem.convertZoomLevelToAltitude($t(e.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:e!=null&&e.padding?Object.assign({},Js,e==null?void 0:e.padding):this.insetsPadding,curve:Ka[(e==null?void 0:e.easing)||"ease-in-out"],rotation:(e==null?void 0:e.bearing)===void 0?void 0:ue.degToRad(e.bearing),tilt:(e==null?void 0:e.pitch)!==void 0?ue.degToRad($t(e.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0,duration:e==null?void 0:e.duration,callback:a(()=>{c(this,ie).interactionSystem.handleHover(),r()},"callback"),cancelledCallback:r,interruptible:(i=e==null?void 0:e.interruptible)!=null?i:!0,verticalPadding:e==null?void 0:e.verticalPadding}},"#convertToLegacy"),a(ih,"Camera");var Qa=ih;function th(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}a(th,"updateBounds");function Qf(t,e,r){var l;let i=[],n=[1/0,1/0,-1/0,-1/0],o=null;if(!t||!Array.isArray(t)||t.length===0)return{pointCloud:i,geoBounds:n,firstPosition:o};let s=e.getSystems().renderSystem;(s.threeDdirty||s.twoDdirty)&&e.renderSync();for(let u of t)if(typeof u=="string"){let h=r.get(u);if(!h){te.error("Entity not found with id:",u);continue}let m=new it;lp(e,"userData"in h&&(l=h.userData.entityId)!=null?l:h.id,i,m,h instanceof Ie?h.position.z:void 0);let f=e.convert3DMapPositionToCoordinate(m.min),b=e.convert3DMapPositionToCoordinate(m.max);th(n,f),th(n,b),o||(o=e.convert3DMapPositionToCoordinate(m.getCenter(new H)))}else i.push(e.convertTo3DMapPosition(u[1],u[0],u[2]||0)),th(n,u),o||(o=u);return{pointCloud:i,geoBounds:n,firstPosition:o}}a(Qf,"processTargets");function r_(t,e){var i,n,o,s;let r=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]],[e[0],e[1]]];(i=t.map)!=null&&i.getLayer("bounds-outline")&&t.map.removeLayer("bounds-outline"),(n=t.map)!=null&&n.getSource("bounds-source")&&t.map.removeSource("bounds-source"),(o=t.map)==null||o.addSource("bounds-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:r}}}),(s=t.map)==null||s.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}a(r_,"drawBounds");var nh="";var Hi=!1,i_=150,sh=class sh extends me{constructor(r,i,n=!0){super();p(this,"worker");p(this,"debugContext");p(this,"debugCanvas");p(this,"collidersDirty",!0);p(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]);p(this,"visibleCollidersQTree",new Tt(new Se(0,0,0,0)));p(this,"interactiveCollidersQTree",new Tt(new Se(0,0,0,0)));p(this,"coreState");p(this,"postMessage");p(this,"showCollisionBoxes",a(()=>{Hi=!0,this.debugCanvas.style.display="block"},"showCollisionBoxes"));p(this,"hideCollisionBoxes",a(()=>{Hi=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"},"hideCollisionBoxes"));p(this,"currentMsgId","");p(this,"working",!1);p(this,"_postMessage",a(()=>{this.worker.postMessage(this.packedMessage)},"_postMessage"));p(this,"componentArray",[]);p(this,"update",a((r,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 u of this.coreState.geometry2DIdsInScene){let h=this.coreState.geometry2DMap.get(u);h&&(l=h.components[0],this.componentArray.push(l))}this.resize(r,i,n),this.collidersDirty=!1,s=!0}else s=this.componentArray.some(l=>l.collisionDirty===!0);s&&this.componentArray.sort((l,u)=>u.rank-l.rank);for(let l=0;l<this.componentArray.length;l++)if(this.packedMessage){let u=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]=u.bboxes,this.packedMessage[0][l][1]=u.enabled&&this.componentArray[l].visible&&!this.componentArray[l].isOccluded?1:0,this.packedMessage[0][l][2]=u.rank===Ni?1:0,this.packedMessage[0][l][3]=u.x,this.packedMessage[0][l][4]=u.y,this.packedMessage[0][l][5]=u.shouldCollideWithScreenEdges?1:0,this.packedMessage[0][l][6]=u.lockedToStrategyIndex}this.working||this.postMessage()},"update"));p(this,"resolve",a(r=>{if(this.working=!1,this.collidersDirty||!r.data)return;let i=r.data.colliders,n=-1,o,s,l;Hi&&(this.visibleCollidersQTree=new Tt(new Se(0,0,this.debugCanvas.width,this.debugCanvas.height))),this.interactiveCollidersQTree=new Tt(new Se(0,0,this.debugCanvas.width,this.debugCanvas.height));for(let u=0;u<this.componentArray.length;u++){let h=this.componentArray[u];i[u]!=null&&(n=i[u][0],o=i[u][2],h.offscreen=i[u][1]===1,n!==-1&&o!=null?(l=new Se(o.x,o.y,o.w,o.h,{entityId:h.id}),Hi&&this.visibleCollidersQTree.insert(l),s=this.coreState.geometry2DMap.get(h.id),(s==null?void 0:s.components[1])!=null&&this.interactiveCollidersQTree.insert(new Se(o.x,o.y,o.w,o.h,{entityId:h.id})),(h.canShow===!1||h.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in h&&(h.visibilityNeedsUpdate="show"),n!==-1&&n!==h.currentStrategyIndex&&(h.activeBoundingBox=l,h.onStrategySelected(n))):((h.canShow===!0||h.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in h&&(h.visibilityNeedsUpdate="hide"),n!==-1&&n!==h.currentStrategyIndex&&h.onStrategySelected(n)))}Hi&&this.drawDebug(),this.publish("visibility-changed")},"resolve"));p(this,"drawDebug",a(()=>{Hi&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))},"drawDebug"));p(this,"destroy",a(()=>{this.worker.terminate()},"destroy"));this.worker=n===!1?new Po:nh!==""?new Worker(nh):new Worker(URL.createObjectURL(new Blob([Sp],{type:"text/javascript"}))),this.worker.onerror=()=>{this.worker=new Po,this.worker.onmessage=o=>this.resolve(o)},this.coreState=i,this.debugCanvas=r,this.debugContext=r.getContext("2d"),this.worker.onmessage=o=>this.resolve(o),this.postMessage=Xp(this._postMessage,i_,!1),Hi?this.showCollisionBoxes():this.hideCollisionBoxes()}resize(r,i,n){this.packedMessage[6]=n,this.packedMessage[5]=i,this.packedMessage[4]=r,this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}};a(sh,"CollisionSystem");var el=sh;v();v();v();v();var lh=class lh{constructor(e){p(this,"type");p(this,"event");this.type=0,this.event=e}get timestamp(){return this.event.timeStamp}};a(lh,"Tap");var tl=lh,ch=class ch{constructor(){p(this,"taps",[])}add(e){this.lastPointerDown&&e.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(e)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){var e;return this.isSingleTap&&((e=this.lastPointerDown)==null?void 0:e.type)===1}get isSingleTapWithOneFinger(){var e;return this.isSingleTap&&((e=this.lastPointerDown)==null?void 0:e.type)===0}get isDoubleTapWithOneFinger(){var e,r;return this.isDoubleTap&&((e=this.taps[0])==null?void 0:e.type)===0&&((r=this.taps[1])==null?void 0:r.type)===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(e){this.taps=this.taps.filter(r=>e-r.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};a(ch,"TapsController");var rl=ch;v();function uh(t){let e=new Set;for(let r of t){let i=r.object;for(;i.visible&&i.parent&&i.parent.visible===!0&&!e.has(i.parent);)i=i.parent,i instanceof Ie&&i.type==="group-container"&&i.visible&&i.components[0]&&e.add(i)}return Array.from(e)}a(uh,"getUniqueIntersectedGroupContainers");var Hn,hh=class hh extends me{constructor(r,i,n,o,s){super();p(this,"raycaster",new qt);p(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});p(this,"coreState");p(this,"camera");p(this,"worldPlane");p(this,"_quadtree",new Tt(new Se(0,0,0,0)));p(this,"_container");p(this,"lastPointerEvent");p(this,"cursor","grab");p(this,"touchesCount",0);p(this,"isUserInteracting");p(this,"hasTouched",!1);L(this,Hn);p(this,"onPointerMoveRaf",a(r=>{this.lastPointerEvent=r,c(this,Hn)&&cancelAnimationFrame(c(this,Hn)),R(this,Hn,requestAnimationFrame(()=>{this.onPointerMove(r)}))},"onPointerMoveRaf"));p(this,"onPointerMove",a(r=>{r.preventDefault(),this.updateInteractionStateIfPanning(r),(r.pointerType!=="touch"||r.pointerType===void 0&&this.hasTouched)&&this.handleHover(r),this.handleCursor()},"onPointerMove"));p(this,"tapsControl",new rl);p(this,"onPointerDown",a(r=>{r.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:r.timeStamp,offsetX:r.offsetX,offsetY:r.offsetY},this.lastPointerEvent=r,this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),r.pointerType==="touch"&&(this.tapsControl.add(new tl(r)),this.touchesCount=Math.max(0,this.touchesCount+1)))},"onPointerDown"));p(this,"clickTimeout");p(this,"onPointerUp",a(r=>{this.tapsControl.discardOutsideOfWaitWindow(r.timeStamp),this.lastPointerEvent=r,this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)),this.updateInteractionStateIfPanning(r);let{mouseDownStart:i}=this.state.interaction;!i||this.state.interaction.distanceFromMouseDown==null||(Date.now()<i.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(r.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",r),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(r),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",r),this.flush()):this.handleClick(r)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())},"onPointerUp"));p(this,"dirty3D",!0);p(this,"cachedHitBoxes",{entities:[]});p(this,"ndcPoint",new ae);p(this,"debugPanel");this.isUserInteracting=s,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=n,this._container=r,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(r){this._quadtree=r}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let r=this.state.hovered3DEntity.components[2];r&&(r.dirty=!0)}}getThreeDIntersectsFromXY(r){this.raycaster.setFromCamera(r,this.camera),this.raycaster.layers.enable(0);let 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(r){let i=this.getThreeDIntersectsFromXY(r),n;return i!=null&&i.length>0&&(n=uh(i)),n}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(r){let i=r||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 r=!!(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=s_(r,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(r){return this.state.hovered2DEntity!==r}handleClick(r){let i=this.intersect(r);this.publish("click",{entity2D:i.entity2D,entity3D:i.entity3D,position:i.position,groupContainers:i.groupContainers,pointerEvent:{button:r.button}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let r;for(let i of this.coreState.geometry3DIdsInScene)r=this.coreState.geometry3DMap.get(i),((r==null?void 0:r.type)==="geometry"||(r==null?void 0:r.type)==="model"||(r==null?void 0:r.type)==="path"||(r==null?void 0:r.type)==="custom-geometry")&&r.components[0].mesh&&!this.cachedHitBoxes.entities.includes(r.components[0].mesh)&&this.cachedHitBoxes.entities.push(r.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}intersect(r){var x,P,S,C,w;let{offsetX:i,offsetY:n}=r,o=[i,n],s=this._quadtree.queryPoint(o),[l]=s.filter(k=>k.intersectsPoint(o));this.ndcPoint.x=i/this._container.clientWidth*2-1,this.ndcPoint.y=-(n/this._container.clientHeight)*2+1;let u=this.getThreeDIntersectsFromXY(this.ndcPoint),h=(x=u[0])==null?void 0:x.point,m=[],f=[],b=u.filter(k=>k.object.name!=="worldPlane");for(let k of b)k.object instanceof be&&k.object.material.depthTest===!1?m.push(k):f.push(k);let y=(S=(P=m[0])!=null?P:f[0])!=null?S:void 0,_,T;if(y!=null){if(_=l_(y.object,this.coreState.geometry3DMap),!_){let k=(C=y==null?void 0:y.instanceId)!=null?C:y==null?void 0:y.batchId;_=k!=null&&(y!=null&&y.object.userData.entities)?this.coreState.geometry3DMap.get(y==null?void 0:y.object.userData.entities[k]):this.coreState.geometry3DMap.get(y==null?void 0:y.object.userData.entityId)}_!=null&&_.components[2]&&(T=_)}let g=uh(b);return{entity2D:((w=l==null?void 0:l.userData)==null?void 0:w.entityId)==="watermark"?{id:"watermark"}:this.coreState.geometry2DMap.get(l==null?void 0:l.userData.entityId),entity3D:T,position:h,groupContainers:g.length>0?g:void 0}}detect3DEntityHover(r){return this.state.lastHover!==r&&(this.state.lastHover&&ny(this.state.lastHover,!1,this.coreState),r&&ny(r,!0,this.coreState)),this.state.hovered3DEntity!==r}detect3DContainerHover(r){return!qd(this.state.hovered3DContainers,r)}updateInteractionStateIfPanning(r){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(r.offsetX-this.state.interaction.mouseDownStart.offsetX,2)+Math.pow(r.offsetY-this.state.interaction.mouseDownStart.offsetY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.worldPlane],!1)}destroy(){this._container.removeEventListener("pointerdown",this.onPointerDown,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let r=document.createElement("div");r.style.position="absolute",r.style.top="0",r.style.right="0",r.style.backgroundColor="white",r.style.padding="10px",document.body.append(r),r.id="interaction-debug-panel",this.debugPanel=r,this.on("doubletap-with-onefinger",()=>{this.queueDebugMessage("doubletap-with-onefinger","#ffadad")}),this.on("singletap-with-twofinger",()=>{this.queueDebugMessage("singletap-with-twofinger","#ffd6a5")}),this.on("click",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(r,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=r,(o=this.debugPanel)==null||o.prepend(n),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>{n.remove()},500)},2500)}getCursor(){return this.cursor}};Hn=new WeakMap,a(hh,"InteractionSystem");var Wo=hh;function ny(t,e,r){var s;let i=t.components[2];i&&i.hover!==!0&&(i.hover=e?"user-interaction":!1,i.dirty=!0);let n=(s=t.components[0].textMesh)==null?void 0:s.userData.entityId;if(!n)return;let o=r.geometry3DMap.get(n);(o==null?void 0:o.type)==="text3d"&&(o.components[1].hoverByPolygon=e,o.components[1].dirty=!0)}a(ny,"updateHover");function s_(t,e,r){return e?"grabbing":t?"pointer":r?"grabbing":"grab"}a(s_,"processCursor");function a_(t){let e=t;for(;e!=null&&e.parent;){if(e instanceof Nr)return;if(e.userData.isSingleModel)return e;e=e.parent}}a(a_,"findModelParent");function l_(t,e){let r=a_(t);return r?e.get(r.userData.entityId):void 0}a(l_,"findModelParentEntity");v();v();var Wi,lr,il,$r,oy,qo,nl,sy,ay,$o,ol,Jo,Ko,sl,dh=class dh{constructor(e){L(this,$r);L(this,Wi,null);L(this,lr);p(this,"getCurrentSceneGLTF",a(async e=>{let r=O({onlyVisible:!0,binary:!0,light:!0,scale:1},e),i=await _e(this,$r,oy).call(this),n=c(this,il).call(this,r),o=await i.parseAsync(n,{trs:!1,maxTextureSize:1/0,onlyVisible:r.onlyVisible,binary:r.binary,scale:r.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,il,a(e=>{let{scale:r,light:i,onlyVisible:n}=e,o=new Nr,s=new it().setFromObject(c(this,lr).entityScene);if(c(this,qo).call(this,c(this,lr).entityScene,o,n),i){let l=new Hs(16777215,.3*Math.PI);l.position.set(0,Math.max(s.max.x,s.max.y)*r*.5,s.max.y*r*4),l.lookAt(0,0,-1),l.target.position.set(0,0,-1),l.add(l.target),o.add(l)}return o},"#getExportedScene"));L(this,qo,a((e,r,i)=>{e.material&&(e instanceof Zs?_e(this,$r,sy).call(this,e).forEach(n=>r.add(n)):e instanceof pn&&r.add(_e(this,$r,ay).call(this,e))),e.children.forEach(n=>{(!i||n.visible)&&c(this,qo).call(this,n,r,i)})},"#processObject3D"));L(this,nl,a((e,r,i)=>{let n=new zd({color:new Ee(e),metalness:0});return n.opacity=r,n.transparent=i,n},"#createStandardMaterial"));L(this,$o,a(e=>{let{geometry:r,material:i,position:n,rotation:o,quaternion:s,scale:l}=e;if(!(r!=null&&r.isBufferGeometry))return e;let u=r.attributes.position,h=r.attributes.normal,m=r.attributes.uv;return c(this,ol).call(this,u,h),c(this,Ko).call(this,n,l,o,s),m&&c(this,sl).call(this,m),i!=null&&i.map&&r.type==="PlaneGeometry"&&(e.side=Rt),e},"#convertGeometry"));L(this,ol,a((e,r)=>{let i=new H,n=new H;for(let o=0;o<e.count;o++)i.fromBufferAttribute(e,o),c(this,Jo).call(this,i),e.setXYZ(o,i.x,i.y,i.z),r&&(n.fromBufferAttribute(r,o),c(this,Jo).call(this,n),r.setXYZ(o,n.x,n.y,n.z))},"#convertAttributes"));L(this,Jo,a(e=>{let r=e.y;e.y=e.z,e.z=-r},"#convertVector"));L(this,Ko,a((e,r,i,n)=>{let o=e.y;e.y=e.z,e.z=-o;let s=r.y;if(r.y=r.z,r.z=s,i instanceof mr)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,sl,a(e=>{for(let r=0;r<e.count;r++){let i=e.getX(r),n=e.getY(r);e.setXY(r,i,n)}},"#convertUVs"));R(this,lr,e),c(this,lr).entityScene=e.entityScene,c(this,lr).geometry3DMap=e.geometry3DMap}destroy(){R(this,Wi,null)}};Wi=new WeakMap,lr=new WeakMap,il=new WeakMap,$r=new WeakSet,oy=a(async function(){if(!c(this,Wi)){let{GLTFExporter:e}=await import("./GLTFExporter-R6F7IFS2.js");R(this,Wi,new e)}return c(this,Wi)},"#getGLTFExporter"),qo=new WeakMap,nl=new WeakMap,sy=a(function(e){var s,l;let r=[],n=((s=e.userData)!=null&&s.entities?Object.values((l=e.userData)==null?void 0:l.entities):[]).map(u=>c(this,lr).geometry3DMap.get(u)),o=new Map;return n.forEach(u=>{var y;if(!u||!(u instanceof fe))return;let h=u.components[1],m=u.components[2];if(!h.visible||h instanceof Kt&&h.opacity===0||h instanceof mo||h instanceof ia)return;let f=m!=null&&m.hover?h.hoverColor||c(this,lr).hoverColor:h.color,b="".concat(f,"-").concat(h.opacity,"-").concat(Number(h.visible));o.has(b)||o.set(b,[]),(y=o.get(b))==null||y.push(u)}),o.forEach((u,h)=>{let[m,f,b]=h.split("-"),y=u.reduce((x,P)=>{if(P.type==="custom-geometry")return x;let S=P.components[0];return"geometry"in S&&S.geometry instanceof Ys&&x.push(S.geometry),x},[]),_=c(this,nl).call(this,m,Number(f),e.material.transparent),T=Pt(y,!0),g=new be(T,_);g.position.copy(e.position),g.rotation.copy(e.rotation),g.scale.copy(e.scale),g.visible=!!b,c(this,Ko).call(this,g.position,g.scale,g.rotation,g.quaternion),r.push(c(this,$o).call(this,g))}),r},"#processBatchedMesh"),ay=a(function(e){let r=e.geometry.clone(),i=e.material,n=new st({color:i.color,side:Rt});n.opacity=i.opacity,n.transparent=i.transparent;let o=new pn(r,n);return o.position.copy(e.position),o.rotation.copy(e.rotation),o.scale.copy(e.scale),o.visible=e.visible,c(this,$o).call(this,o)},"#processLineSegments"),$o=new WeakMap,ol=new WeakMap,Jo=new WeakMap,Ko=new WeakMap,sl=new WeakMap,a(dh,"ExporterSystem");var Vo=dh;v();v();v();var fh=Ns(gy());function vy(t){this.name="JSClipperError",this.message=t,this.stack=new Error().stack}a(vy,"JSClipperError");vy.prototype=Error.prototype;fh.default.Error=function(t){throw new vy(t)};var Ve=fh.default;var tT="gray",rT=.1,ts=100,yh=new Ve.ClipperOffset;function iT(t,e){yh.Clear(),e/=2;let r=t.map(n=>({X:n.x*ts,Y:n.y*ts}));yh.AddPath(r,Ve.JoinType.jtMiter,Ve.EndType.etClosedPolygon);let i=new Ve.Paths;return yh.Execute(i,e*ts),i.length?i.map(o=>o.map(s=>({x:s.X/ts,y:s.Y/ts}))):[t]}a(iT,"offset");function dl(t,e,r){var y,_,T,g,x;let{color:i=tT,opacity:n=1,altitude:o=0,height:s=rT}=r||{};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}},h=t.geometry.coordinates[0].map(P=>{let S=e(P[1],P[0]);return l.min.x=Math.min(l.min.x,S.x),l.min.y=Math.min(l.min.y,S.y),l.max.x=Math.max(l.max.x,S.x),l.max.y=Math.max(l.max.y,S.y),S});((_=(y=t.properties)==null?void 0:y.style)==null?void 0:_.edgeOffset)!=null&&t.properties.style.edgeOffset!==0||((T=t.properties)==null?void 0:T.image)!=null?h=iT(h,((x=(g=t.properties)==null?void 0:g.style)==null?void 0:x.edgeOffset)||0):h=[h];let m=[];for(let P of h){let S=new Gr;S.moveTo(P[0].x,P[0].y),P.slice(1).forEach(A=>S.lineTo(A.x,A.y)),S.lineTo(P[0].x,P[0].y);let C=t.geometry.coordinates.slice(1);S.holes=C.map(A=>{let N=A.map(z=>e(z[1],z[0])),Y=new Fr;return Y.moveTo(N[0].x,N[0].y),N.slice(1).forEach(z=>Y.lineTo(z.x,z.y)),Y.lineTo(N[0].x,N[0].y),Y});let w=uo(r==null?void 0:r.bevel,s),k=new Xr(S,w);k.userData={style:{color:i,opacity:n},usedBevelSettings:w},m.push(k)}if(m.length===1)return m[0];let f=Pt(m);m.forEach(P=>P.dispose());let b=uo(r==null?void 0:r.bevel,s);return f.userData={style:{color:i,opacity:n},usedBevelSettings:b,_split:!0},f}a(dl,"renderPolygonGeometry");v();var nT="gray",oT=.1;function pl(t,e,r){let{color:i=nT,opacity:n=1,altitude:o=0,height:s=oT}=r||{};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}},u=uo(r==null?void 0:r.bevel,s),h=[];t.geometry.coordinates.forEach(f=>{let b=new Gr,y=f[0].map(g=>{let x=e(g[1],g[0]);return l.min.x=Math.min(l.min.x,x.x),l.min.y=Math.min(l.min.y,x.y),l.max.x=Math.max(l.max.x,x.x),l.max.y=Math.max(l.max.y,x.y),x});b.moveTo(y[0].x,y[0].y),y.slice(1).forEach(g=>b.lineTo(g.x,g.y)),b.lineTo(y[0].x,y[0].y);let _=f.slice(1);b.holes=_.map(g=>{let x=g.map(S=>e(S[1],S[0])),P=new Fr;return P.moveTo(x[0].x,x[0].y),x.slice(1).forEach(S=>P.lineTo(S.x,S.y)),P.lineTo(x[0].x,x[0].y),P});let T=new Xr(b,u);h.push(T)});let m=Pt(h);return h.forEach(f=>f.dispose()),m.translate(0,0,o||0),m.userData={style:{color:i,opacity:n},usedBevelSettings:u},m}a(pl,"renderMultiPolygonGeometry");v();var sT="gray",gh=new Ve.ClipperOffset,ht=100;function by(t,e,r){let{color:i=sT,opacity:n=1,width:o=1,join:s="round",cap:l="round",height:u=.01,altitude:h=0}=r||{};Array.isArray(n)&&(n=0);let m=[];for(let T=0;T<t.geometry.coordinates.length-1;T++){let g=e(t.geometry.coordinates[T][1],t.geometry.coordinates[T][0]),x=e(t.geometry.coordinates[T+1][1],t.geometry.coordinates[T+1][0]);m.push([g,x])}gh.AddPaths(m.map(T=>T.map(g=>({X:g.x*ht,Y:g.y*ht}))),s==="round"?Ve.JoinType.jsRound:s==="miter"?Ve.JoinType.jsMiter:Ve.JoinType.jsSquare,l==="round"?Ve.EndType.etOpenRound:l==="butt"?Ve.EndType.etOpenButt:Ve.EndType.etOpenSquare);let f=new Ve.PolyTree;gh.Execute(f,o/2*ht);let b=[],y={bevelEnabled:!1,depth:u};for(let T of f.m_AllPolys){let g=new Gr;if(T.IsHole())continue;let x=T.m_polygon;g.moveTo(x[0].X/ht,x[0].Y/ht),x.slice(1).forEach(P=>g.lineTo(P.X/ht,P.Y/ht)),g.lineTo(x[0].X/ht,x[0].Y/ht),g.holes=T.m_Childs.map(P=>{let S=new Fr,C=P.m_polygon;return S.moveTo(C[0].X/ht,C[0].Y/ht),C.slice(1).forEach(w=>S.lineTo(w.X/ht,w.Y/ht)),S.lineTo(C[0].X/ht,C[0].Y/ht),S}),b.push(new Xr(g,y))}let _=Pt(b);return _.translate(0,0,h||0),_.userData={style:{color:i,opacity:n}},gh.Clear(),_}a(by,"renderLineStringGeometry");v();var dt=100,aT=.22,lT=.01;function xy(t,e,r={}){let{width:i=aT,height:n=lT,color:o="gray",opacity:s=1,altitude:l=0}=r,u={min:{x:1/0,y:1/0,z:l},max:{x:-1/0,y:-1/0,z:l+n}},h={bevelEnabled:!1,depth:n},m=new Ve.ClipperOffset,f=t.geometry.coordinates.map(T=>T.map(g=>e(g[1],g[0])));m.AddPaths(f.map(T=>T.map(g=>({X:g.x*dt,Y:g.y*dt}))),Ve.JoinType.jsMiter,Ve.EndType.etOpenRound);let b=new Ve.PolyTree;m.Execute(b,i/2*dt);let y=[];for(let T of b.m_AllPolys){let g=new Gr;if(T.IsHole())continue;u.min.x=Math.min(u.min.x,T.m_polygon[0].X),u.min.y=Math.min(u.min.y,T.m_polygon[0].Y),u.max.x=Math.max(u.max.x,T.m_polygon[0].X),u.max.y=Math.max(u.max.y,T.m_polygon[0].Y);let x=T.m_polygon;g.moveTo(x[0].X/dt,x[0].Y/dt),x.slice(1).forEach(P=>g.lineTo(P.X/dt,P.Y/dt)),g.lineTo(x[0].X/dt,x[0].Y/dt),g.holes=T.m_Childs.map(P=>{let S=new Fr,C=P.m_polygon;return S.moveTo(C[0].X/dt,C[0].Y/dt),C.slice(1).forEach(w=>S.lineTo(w.X/dt,w.Y/dt)),S.lineTo(C[0].X/dt,C[0].Y/dt),S}),y.push(new Xr(g,h))}let _=Pt(y);return _.translate(0,0,l||0),_.userData={style:{color:o,opacity:s}},m.Clear(),_}a(xy,"renderMultiLineStringGeometry");v();v();var qn=I.object({type:I.enum(["Point"]),coordinates:I.array(I.number()).min(2).max(3)});var cT=I.object({rotation:I.array(I.number()).length(3).optional(),altitude:I.number().optional(),scale:I.array(I.number()).length(3).optional(),interactive:I.boolean().optional(),verticalOffset:I.number().optional(),id:I.union([I.number(),I.string()]).optional()}),uT=I.object({type:I.enum(["Feature"]),geometry:qn,properties:cT}),hT=I.object({type:I.enum(["FeatureCollection"]),features:I.array(uT)}),dT=I.object({color:I.string()}),pT=I.object({url:I.string(),color:I.string().optional(),opacity:I.number().optional(),material:I.record(I.string(),dT).optional()});function Cy(t,e,r){I.union([I.number(),I.string()]).parse(t),hT.parse(e),pT.parse(r)}a(Cy,"validateModelGroup");var rs,is,vh=class vh{constructor(e){p(this,"mesh");p(this,"type","model");p(this,"positionDirty",!0);p(this,"outline");p(this,"geometry");p(this,"material");p(this,"feature");p(this,"instanceIndex",-1);p(this,"visible",!0);p(this,"color",new Ee);p(this,"position",new H);L(this,rs,0);L(this,is,1);this.feature=e}setOpacity(){}setColor(){}get altitude(){return c(this,rs)}set altitude(e){this.mesh&&(this.mesh.position.z=e,R(this,rs,e))}getRotation(){return this.mesh?[this.mesh.rotation.x,this.mesh.rotation.y,this.mesh.rotation.z]:void 0}setRotation(e){this.mesh&&this.mesh.rotation.set(ue.degToRad(e[0]),ue.degToRad(e[1]),ue.degToRad(e[2]))}getScale(){return this.mesh?[this.mesh.scale.x,this.mesh.scale.y,this.mesh.scale.z]:void 0}setScale(e){this.mesh&&this.mesh.scale.set(e[0],e[1],e[2])}get opacity(){return c(this,is)}set opacity(e){var r,i,n;if(this.mesh){if(this.mesh.children[0]instanceof Br){for(let o of this.mesh.children)if(o instanceof Br){((r=o.userData)==null?void 0:r.originalOpacity)===void 0&&(o.userData.originalOpacity=o.material.opacity);let s=yi(e,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 be&&o.material&&(Array.isArray(o.material)?o.material.forEach(s=>{Sy(s,e)}):Sy(o.material,e))});R(this,is,e)}}};rs=new WeakMap,is=new WeakMap,a(vh,"ModelComponent");var Qr=vh;function Sy(t,e){t.opacity!==e&&(e===1?(t.opacity=1,t.transparent=!1):(t.opacity=e,t.transparent=!0),t.needsUpdate=!0)}a(Sy,"updateMaterialOpacity");v();function ml(t){var l,u;let e=t.components[0],r=t.components[1];r.opacity!=null&&r.opacity!==e.opacity&&(e.opacity=r.opacity);let i=r.material,n=r.color;if(i||n){let h=mT(n,i);(l=e.mesh)==null||l.traverse(m=>{m instanceof be&&m.material&&(Array.isArray(m.material)?m.material.forEach(f=>{h[f.name]?f.color.set(h[f.name].color):f.color.set(n)}):h[m.material.name]?m.material.color.set(h[m.material.name].color):m.material.color.set(n))})}let o=(u=e.feature.geometry.coordinates[2])!=null?u:0,s=r.verticalOffset+o;e.altitude!==s&&(e.altitude=s),r.visible!==e.visible&&(e.visible=r.visible),r.rotation&&e.setRotation(r.rotation),r.scale&&e.setScale(r.scale)}a(ml,"applyModelGeometryStyle");function mT(t,e){let r={};if(t&&Object.assign(r,{Default:{color:t},Fabric:{color:t},Mpdn_Logo:{color:t},CouchLogo:{color:t}}),e)for(let i in e)e[i].color&&(r[i]?r[i].color=e[i].color:r[i]={color:e[i].color});return r}a(mT,"consolidateColorAndMaterial");function _y(t,e){var s,l;let r=t.components[0],n=(s=t.components[1].verticalOffset)!=null?s:0,o=r.feature.geometry.coordinates.slice();o[2]=((l=o[2])!=null?l:0)+n,r.mesh?r.mesh.position.copy(e(o)):r.position.copy(e(o))}a(_y,"applyModelPosition");function Py(t){return t instanceof Ne?t.material:null}a(Py,"getMaterial");function Ty(t){return t.side===co?"back":t.side===hi?"front":"double"}a(Ty,"getMaterialSide");function wy(t,e){t.side=e==="back"?co:e==="front"?hi:Rt}a(wy,"setMaterialSide");function fT(t){let{color:e,opacity:r,topColor:i,texture:n,topTexture:o}=t;return"".concat(e).concat(r).concat(i||"").concat(n||"").concat(o||"")}a(fT,"generateIndex");var bh=class bh extends me{constructor(r,i){super();p(this,"state");p(this,"convertTo3DMapPosition");p(this,"loader");p(this,"optimizePromise",[]);this.state=r,this.convertTo3DMapPosition=i}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:r}=await import("./GLTFLoader-NEDVOJZ7.js");return this.loader=new r,this.loader}createEntityFromFeature(r,i,n){var m,f,b;let o=new Ne(i),s=(m=i==null?void 0:i.properties)==null?void 0:m.bevel,l=n&&"bevel"in n?n.bevel:void 0,u;l?u=O(O({},s),l):s&&(u=s);let h=new fe(o,new Kt(j(O({},n),{url:(b=(f=i.properties)==null?void 0:f.image)==null?void 0:b.path,bevel:u})));return n!=null&&n.outline&&(h.components[3]=new Gn(Go(n.color))),n!=null&&n.focusable&&(h.components[4]=new Mr),h.id=r,h}createModelFromFeature(r,i,n){let o=new Qr(i),s=O({},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 ia(s),u=new fe(o,l);return u.id=r,u}populateEntityMesh(r,i){let n=r.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=r.components[1].height,n.dirty=!1}async populateModelGroup(r,i,n){let o=new bt,s=new mr,l=new pi,u=new H,h=new Bt,m=await this.getGLTFLoader(),f=new Promise(b=>{m.load(i,y=>{"entities3D"in n.userData&&(n.userData.entities3D.size>1?y.scene.traverse(_=>{let T=_;if("isMesh"in T&&T.isMesh===!0){let g=new Br(T.geometry,T.material,r.size);g.userData={entities:{}},h.add(g),n.add(h)}}):(y.scene.traverse(_=>{"isMesh"in _&&_.isMesh===!0&&(_.position.set(0,0,0),_.rotation.set(0,0,0),_.scale.set(1,1,1),_.updateMatrix())}),h.add(y.scene),n.add(h),h.userData.isSingleModel=!0,h.userData.entityId=r.values().next().value,h.userData.type="model")),b()})});return this.optimizePromise.push(f.then(()=>{var _,T,g,x,P,S,C,w,k,A,N,Y;let b=0,y;for(let z of r.values()){if(y=this.state.geometry3DMap.get(z),!y||(y==null?void 0:y.type)!=="model")continue;let X=y.components[0],q=y.components[1],F=y.components[0].feature;X.mesh=h,X.instanceIndex=b,ml(y),y.components[1].dirty=!1;let{x:J,y:pe}=this.convertTo3DMapPosition(F.geometry.coordinates[1],F.geometry.coordinates[0],0);X.position.set(J,pe,X.altitude),s.set(ue.degToRad((T=(_=q.rotation)==null?void 0:_[0])!=null?T:bn[0]),ue.degToRad((x=(g=q.rotation)==null?void 0:g[1])!=null?x:bn[1]),ue.degToRad((S=(P=q.rotation)==null?void 0:P[2])!=null?S:bn[2])),u.set((w=(C=q.scale)==null?void 0:C[0])!=null?w:vn[0],(A=(k=q.scale)==null?void 0:k[1])!=null?A:vn[1],(Y=(N=q.scale)==null?void 0:N[2])!=null?Y:vn[2]),l.setFromEuler(s),o.compose(X.position,l,u),h.children.forEach(se=>{!y||(y==null?void 0:y.type)!=="model"||!(se instanceof Br)||(se.setMatrixAt(b,o),se.userData.entities[b]=y.id)}),X.mesh.userData.isSingleModel&&(X.mesh.matrix.copy(o),X.mesh.matrix.decompose(X.mesh.position,X.mesh.quaternion,X.mesh.scale)),b++}this.publish("model-loaded")})),h}populateEntityGroup(r){var l;let i,n,o,s;for(let u of r.values())s=this.state.geometry3DMap.get(u),s.components[0]instanceof Ne&&(n=s.components[0].feature,o=s.components[1],n.geometry.type==="Polygon"?(i=dl(n,this.convertTo3DMapPosition,o),(l=n.properties)!=null&&l.textures&&n.properties.textures.length>0&&wf(i,n.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(s,i)):n.geometry.type==="MultiPolygon"?(i=pl(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,i)):n.geometry.type==="LineString"?(i=by(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,i)):n.geometry.type==="MultiLineString"&&(i=xy(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,i)));return r}update(){var r;for(let i of this.state.geometryGroupIdsToLoad.values()){let n=this.state.geometry3DMap.get(i);if(n instanceof xt&&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){te.warn(l)}let o,s={};for(let l of n.userData.entities3D.values()){o=this.state.geometry3DMap.get(l);let u=o==null?void 0:o.components[0];if((o==null?void 0:o.type)==="geometry"){let h=o.components[1],m=fT(h);s[m]===void 0&&(s[m]={style:h,entities:[]}),s[m].entities.push(o)}else u&&"mesh"in u&&u.mesh&&((r=u.mesh)==null?void 0:r.parent)!==n&&n.add(u.mesh)}for(let l in s){let u=Tf(s[l].entities,s[l].style);n.add(u)}for(let l of n.userData.entities3D.values())if(o=this.state.geometry3DMap.get(l),o!=null&&o.entities2D.size>0)for(let u of o.entities2D.values())u&&(o.attach(u),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),n.userData.dirty=!1}}return Promise.resolve()}};a(bh,"MeshCreationAndOptimizationSystem");var fl=bh;v();var xh=class xh{constructor(e,r){p(this,"state");p(this,"dirty",!0);p(this,"domTree");this.state=e,this.domTree=r}update(){if(this.dirty){let e;for(let r of Array.from(this.domTree.children))if(e=this.state.geometry2DMap.get(r.userData.entityId),e){let i=e.components[0];(!i.enabled||!i.visible||!this.state.geometry2DIdsInScene.has(r.userData.entityId))&&this.domTree.removeChild(r)}else this.domTree.removeChild(r);for(let r of this.state.geometry2DIdsInScene)if(e=this.state.geometry2DMap.get(r),e){let i=e.components[0];i instanceof nr&&i.enabled&&i.markerContainer&&!this.domTree.contains(i.markerContainer)&&(i.markerContainer.userData={entityId:e.id},this.domTree.appendChild(i.markerContainer),i.updateDimensions())}this.dirty=!1}}};a(xh,"DOMVisibilitySystem");var yl=xh;v();var Sh=class Sh{constructor(e,r){p(this,"state");p(this,"project");this.state=e,this.project=r}update(){let e,r=0,i,n;for(let o of this.state.geometry2DIdsInScene)if(e=this.state.geometry2DMap.get(o),e){n=e.components[0];let s=e.attachedTo?this.state.geometry3DMap.get(e.attachedTo):void 0;if(s instanceof fe)if(this.state.geometry3DIdsInScene.has(s.id)){i=s.components[1],n=e.components[0],(i.dirty||e.components[0].attachedDirty)&&(r=i.height,e.setAltitude(r));let l=i.visible;n.visible!==l&&(n.visible=l)}else n.visible===!0&&(n.visible=!1);this.project(e.components[0].projection,e.position),e.components[0].attachedDirty=!1}}};a(Sh,"TwoDProjectionSystem");var gl=Sh;v();v();var yT=a(function(){let e,r;return i=>{if((!r||!r)&&(e=document.createElement("canvas"),e.width=500*i,e.height=500*i,e.style.width="500px",e.style.height="500px",r=e.getContext("2d")),!r)throw new Error("Could not get 2D context");return{measureCanvas:e,measureCanvasContext:r}}},"createMeasureCanvasContext")(),My=a(({text:t,size:e,maxWidth:r,pixelRatio:i,maxLines:n=2,lineHeight:o=1.2,options:s={strokeText:!0}})=>{let l="bold ".concat(e*i,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),{measureCanvasContext:u}=yT(i);u.font=l;let h=[],m=t.split(" "),f=0,b=0,y=0;for(;b<m.length;){let x=m[b];if(f===n&&f>0){h[f-1]+="...";break}if(h[f]==null&&(h[f]=x,b++),m.length===1){h[f]=x;break}if(m[b]==null)break;let{width:P}=u.measureText(h[f]+" "+m[b]);P<=r*i?(h[f]+=" "+m[b],b++):f++}h.forEach(x=>{let{width:P}=u.measureText(x);y=Math.max(P,y)});let _=e*i*o,T=h.length*_;return{maxWidth:y,maxHeight:T,lines:h.length,draw:a((x,P,S)=>{h.length===1?(s.strokeText&&x.strokeText(h[0],P,S),x.fillText(h[0],P,S)):(s.strokeText&&(x.strokeText(h[0],P,S-_/2),x.strokeText(h[1],P,S+_/2)),x.fillText(h[0],P,S-_/2),x.fillText(h[1],P,S+_/2))},"draw")}},"shaveText");v();function Iy(t){let e=new Image;return t&&(/<svg[\s\S]*>/i.test(t)?e.src="data:image/svg+xml;base64,".concat(btoa(t)):e.src=t),e}a(Iy,"createImage");var _h=class _h extends me{constructor(r,i,n){super();p(this,"dirty",!1);p(this,"state");p(this,"colliderContext");p(this,"colliderCanvas");p(this,"transformRequestFunc");p(this,"transformRequest",a(async r=>this.transformRequestFunc?await this.transformRequestFunc(r):{url:r},"transformRequest"));p(this,"pinCache",{});p(this,"imageCache",{});p(this,"imagePromiseCache",{});p(this,"imageDimensionsCache",{});p(this,"textCache",{});p(this,"update",a(r=>{let i=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let n,o,s,l,u,h,m;for(let f of this.state.geometry2DIdsInScene)if(m=this.state.geometry2DMap.get(f),m!=null&&(h=m.components[0],h instanceof rr&&!m.disposed)){if(u=h.appearance.iconVisibleAtZoomLevel,h.appearance.icon!=null&&u&&r>=u!==h.iconVisible&&(h.iconVisible=r>=u,h.dirty=!0),(h.dirty||this.dirty)&&h.calculateMarkerSize(),o={active:h.appearance.pinColor,inactive:h.appearance.pinColorInactive},s={active:h.appearance.pinOutlineColor,inactive:h.appearance.pinOutlineColorInactive},l=mn(h.markerSize,2),n="".concat(o.active,"-").concat(o.inactive,"-").concat(s.active,"-").concat(s.inactive,"-").concat(l,"-").concat(h.iconVisible),h.labelCacheId=n,(!this.pinCache[n]||this.dirty)&&(this.prepare(h,n,this.colliderContext),h.dirty=!0),(h.appearance.icon&&(!h.imageHash||h.markerDirty)||this.dirty)&&this.cacheImage(h),this.textCache[h.id]==null||h.textDirty||this.dirty){h.dirty=!0,this.textCache[h.id]={};let{textDrawFn:y,width:_,height:T}=this.processText(h.text,h.appearance.textSize,h.appearance.maxWidth,h.appearance.maxLines,h.appearance.lineHeight);["left","center","right"].forEach(g=>{this.textCache[h.id][g]=this.textToCanvas(y,h.appearance.textSize,g,_,T,h.appearance.textColor,h.appearance.textOutlineColor)}),h.dimensions={width:Math.ceil(_/i),height:Math.ceil(T/i)}}let b=1;if(h.appearance.iconScale)if(typeof h.appearance.iconScale=="number")b=h.appearance.iconScale;else{let{on:y,input:_,output:T,easing:g}=h.appearance.iconScale;y==="zoom-level"?b=np(r,_,T,g!=null?g:"linear"):te.warn("Unsupported interpolation property: ".concat(y))}h.recomputeCurrentStrategy(h.iconVisible?b:1),h.canShow&&h.visible&&(h.enabled||h.visibilityNeedsUpdate!==!1)&&this.draw(h,n,this.colliderContext),h.textDirty=!1,h.markerDirty=!1}this.dirty=!1},"update"));p(this,"processText",a((r,i,n,o,s)=>{let l=this.state.pixelRatio,{draw:u,maxWidth:h,maxHeight:m}=My({text:r,size:i,pixelRatio:l,maxWidth:n,maxLines:o,lineHeight:s});return{textDrawFn:u,width:h+2.5*l*2,height:m+2.5*l*2}},"processText"));p(this,"textToCanvas",a((r,i,n,o,s,l,u)=>{let h=this.state.pixelRatio,m,f=o,b=s;window.OffscreenCanvas!=null&&!cp()?m=new OffscreenCanvas(f,b):(m=document.createElement("canvas"),m.width=f,m.height=b,m.style.width=f+"px",m.style.height=b+"px");let y=m.getContext("2d",{willReadFrequently:!0});if(!y)return;let _=2.5*h;y.textAlign=n,y.font="bold ".concat(i*h,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),y.textBaseline="middle",y.lineJoin="miter",y.miterLimit=2,y.strokeStyle="white",y.lineWidth=_,y.fillStyle=l,y.strokeStyle=u;let T=n==="left"?_/2:n==="center"?f/2:f-_/2;return r(y,T,(b+_/2)/2),m},"textToCanvas"));p(this,"cacheImage",a(r=>{if(!r.appearance.icon)return;let i=mp(r.appearance.icon);this.imagePromiseCache[i]||(this.imagePromiseCache[i]=new Promise(n=>{this.transformRequest(r.appearance.icon).then(o=>{let s=Iy(o.url);s.onload=()=>{this.imageCache[i]=s,this.publish("img:loaded"),n(s)}})})),r.imageHash!==i&&(r.imageHash=i,this.imagePromiseCache[i].then(()=>{r.dirty=!0}))},"cacheImage"));p(this,"createPinCanvas",a((r,i,n,o,s=1)=>{let l,u=this.state.pixelRatio,h=r.totalMarkerSize*2*u*s;window.OffscreenCanvas!=null?l=new OffscreenCanvas(h,h):(l=document.createElement("canvas"),l.width=h,l.height=h,l.style.width=h/u+"px",l.style.height=h/u+"px");let m=l.getContext("2d");return m.shadowColor="rgba(0,0,0,0.3)",m.shadowOffsetY=2*u,m.shadowBlur=5*u,m.beginPath(),m.arc(h/2,h/2,(i/2+2.5*u/2)*s,0,2*Math.PI),m.fillStyle=n,m.fill(),m.beginPath(),m.arc(h/2,h/2,i/2*s,0,2*Math.PI),m.shadowColor="transparent",m.fillStyle=o,m.fill(),l},"createPinCanvas"));p(this,"prepare",a((r,i,n)=>{let o=this.state.pixelRatio;n.lineWidth=4*o;let s=typeof r.appearance.iconScale=="number"?[r.appearance.iconScale]:r.appearance.iconScale==null?[]:r.appearance.iconScale.output,l=s.length>0?Math.max(...s):void 0,u=this.createPinCanvas(r,r.markerSize,r.appearance.pinOutlineColor,r.appearance.pinColor,l),h=this.createPinCanvas(r,r.iconVisible?r.markerSize:3.5*o,r.appearance.pinOutlineColorInactive,r.appearance.pinColorInactive,l);this.pinCache[i]=[u,h]},"prepare"));this.state=r,this.colliderCanvas=i,this.colliderContext=i.getContext("2d"),this.transformRequestFunc=n}draw(r,i,n){var h;if(!r.canShow||!r.visible)return;n.save(),n.globalAlpha=r.opacity;let o=this.state.pixelRatio,s=r.projection.x*o,l=r.projection.y*o,u=r.style.pinVisibility===1?this.pinCache[i][0]:this.pinCache[i][1];if(n.drawImage(u,s-r.scaledMarkerSize*o,l-r.scaledMarkerSize*o,r.scaledMarkerSize*2*o,r.scaledMarkerSize*2*o),r.appearance.icon&&r.iconVisible&&r.imageHash&&r.appearance.iconSize&&this.imageCache[r.imageHash]){let m=this.imageCache[r.imageHash],f=(r.scaledMarkerSize-r.scaledIconPadding)*o,b=r.appearance.iconFit,y=f,_=f,T="".concat(r.imageHash,"_").concat(b);if(this.imageDimensionsCache[T])y=this.imageDimensionsCache[T].width,_=this.imageDimensionsCache[T].height;else{let g=m.width*o,x=m.height*o;if(b==="contain"){let P=Math.sqrt(g**2+x**2),S=f/P;y=g*S,_=x*S}if(b==="cover"){let P=f/g,S=f/x,C=Math.max(P,S);y=g*C,_=x*C}}n.save(),n.beginPath(),n.arc(s,l,f/2,0,2*Math.PI),n.closePath(),((h=r==null?void 0:r.appearance)==null?void 0:h.iconOverflow)!=="visible"&&n.clip(),n.drawImage(m,s-y/2,l-_/2,y,_),n.restore()}r.style.textLabelVisible&&r.style.textAlign!=null&&r.style.left!=null&&r.style.top!=null&&n.drawImage(this.textCache[r.id][r.style.textAlign],s+r.style.left*o,l+r.style.top*o),n.restore()}};a(_h,"TwoDDrawSystem");var vl=_h;v();v();var ei=class ei{constructor(){p(this,"loader");this.loader=new js}static getInstance(){return ei.instance||(ei.instance=new ei),ei.instance}getLoader(){return this.loader}load(e){return new Promise((r,i)=>{this.loader.load(e,r,void 0,i)})}};a(ei,"TextureLoaderSingleton"),p(ei,"instance");var Ph=ei,ti=Ph.getInstance();function xT(t,e){let r=t.components[2],i=t.components[1];return r!=null&&r.hover?[i.hoverColor||e,i.hoverColor||e]:[i.color,i.topColor||i.color]}a(xT,"processColor");var Ji,ns,Th=class Th extends me{constructor(r,i){super();L(this,Ji);p(this,"state");p(this,"convertTo3DMapPosition");p(this,"textureLoadingCache",new Map);this.convertTo3DMapPosition=i,this.state=r}processTextures(r,i,n){var o;if(i.texture!==r.texture&&i.texture!==""&&_e(this,Ji,ns).call(this,i.texture,r,"texture"),i.topTexture!==r.topTexture&&i.topTexture!==""&&_e(this,Ji,ns).call(this,i.topTexture,r,"topTexture"),(r.texture==null||r.topTexture==null)&&Array.isArray((o=r.feature.properties)==null?void 0:o.textures)&&r.feature.properties.textures.length>0)for(let s of r.feature.properties.textures)s.face==="top"&&r.topTexture!==s.path?_e(this,Ji,ns).call(this,s.path,r,"topTexture"):s.face==="side"&&r.texture!==s.path&&_e(this,Ji,ns).call(this,s.path,r,"texture"),r.blendTexture=!0;(r.texture!=null||r.topTexture!=null)&&(n!=null&&n.hover&&r.texturesVisible?r.hideTextures():r.texturesVisible||r.showTextures(),i.texture===""&&r.removeSideTexture(),i.topTexture===""&&r.removeTopTexture())}update(){var o,s,l,u,h,m,f,b,y,_,T,g,x,P,S,C,w;let r,i,n;for(let k of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(k),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],N=n.components[1];i=n.components[2];let Y=xT(n,this.state.hoverColor);A.setColor(Y[0],Y[1]);let z=Py(A);if(N.visible!==A.visible&&(A.visible=N.visible,A instanceof Ne&&A.textMesh)){let q=this.state.geometry3DMap.get(A.textMesh.userData.entityId);(q==null?void 0:q.type)==="text3d"&&q.components[0].polygonEntityId!=null&&(q.components[0].visible=N.visible)}N.altitude!==A.altitude&&(A.altitude=N.altitude);let X=N.opacity*yn(n);X!==A.opacity&&(A.opacity=X),N.renderOrder!==A.renderOrder&&(A.renderOrder=N.renderOrder),z&&N.side!==Ty(z)&&wy(z,N.side),A instanceof Ne&&N.shading!=null&&(((l=N.shading)==null?void 0:l.start)!==(z==null?void 0:z.getGradientShading().start)||((u=N.shading)==null?void 0:u.end)!==(z==null?void 0:z.getGradientShading().end)||((h=N.shading)==null?void 0:h.intensity)!==(z==null?void 0:z.getGradientShading().intensity))&&(z==null||z.setGradientShading((f=(m=N.shading)==null?void 0:m.start)!=null?f:0,(y=(b=N.shading)==null?void 0:b.end)!=null?y:0,(T=(_=N.shading)==null?void 0:_.intensity)!=null?T:0)),N.dirty=!1,A instanceof Ne&&this.processTextures(A,N,i),n.components[2]&&(n.components[2].dirty=!1)}else if((n==null?void 0:n.type)==="model")n.components[1].dirty&&(ml(n),n.components[1].dirty=!1),n.components[0].positionDirty&&(_y(n,this.convertTo3DMapPosition),n.components[0].positionDirty=!1);else if((n==null?void 0:n.type)==="image"&&((g=n.components[1])!=null&&g.dirty)){r=n.components[0];let A=n.components[1];A.visible!==r.visible&&(r.visible=A.visible),A.dirty=!1}else if((n==null?void 0:n.type)==="text3d"&&((x=n.components[1])!=null&&x.dirty)&&n.components[0].polygonEntityId!=null){r=n.components[0];let A=n.components[1];A.visible!=null&&A.visible!==r.visible&&(r.visible=A.visible);let{textMesh:N}=r;if(N){Object.assign(N,A.getState());let Y=(P=A.hoverColor)!=null?P:this.state.text3dHoverColor;N.color=A.hoverByPolygon?Y:(S=A.color)!=null?S:gn.color,N.outlineColor=A.hoverByPolygon?Y:(C=A.outlineColor)!=null?C:gn.outlineColor,N.strokeColor=A.hoverByPolygon?Y:(w=A.strokeColor)!=null?w:gn.strokeColor}A.dirty=!1}}destroy(){this.textureLoadingCache.forEach(async r=>{(await r).dispose()}),this.textureLoadingCache.clear()}};Ji=new WeakSet,ns=a(async function(r,i,n){if(!(!r||!i.showTextures))if(this.textureLoadingCache.has(r)){n==="topTexture"?i.topTexture=await this.textureLoadingCache.get(r):i.texture=await this.textureLoadingCache.get(r),i.showTextures();return}else{let o=new Promise((s,l)=>{ti.getLoader().load(r,u=>{n==="topTexture"?i.topTexture=u:i.texture=u,i.showTextures(),this.publish("texture-loaded"),s(u)},void 0,()=>{te.error("Failed to load texture: ".concat(r)),l("Failed to load texture: ".concat(r))})});this.textureLoadingCache.set(r,o)}},"#loadTexture"),a(Th,"DrawSystem");var bl=Th;v();var wh=class wh extends me{constructor(r){super();p(this,"state");p(this,"animating",new Map);p(this,"isAnimating",!1);p(this,"startTime",-1);p(this,"showDuration",300);p(this,"hideDuration",250);p(this,"update",a(()=>{this.animating.clear();let r,i;for(let n of this.state.geometry2DIdsInScene)r=this.state.geometry2DMap.get(n),r&&(i=r.components[0],i instanceof rr&&(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"));p(this,"playAnimations");this.state=r,this.playAnimations=this._playAnimations}_playAnimations(){let r=performance.now();for(let[i,[n,o]]of this.animating.entries()){let s=o===1?this.showDuration:this.hideDuration,l=(r-this.startTime)/s;i.opacity=yi(l,0,1,n,o,o===0?tp:rp),r-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(wh,"TwoDVisibilitySystem");var xl=wh;v();var Mh=class Mh extends me{constructor(r,i,n,o,s,l,u){super();p(this,"state");p(this,"renderer");p(this,"mode");p(this,"scene");p(this,"cameraObject");p(this,"viewCamera");p(this,"systems");p(this,"needs2DRecompute",!1);p(this,"twoDdirty",!0);p(this,"threeDdirty",!0);p(this,"frameId",null);p(this,"twoDFrameId",null);p(this,"animationFrameId",null);p(this,"nextFrame",null);p(this,"update",a((r=!1)=>{var i;if(((i=this.renderer)==null?void 0:i.renderer)==null)return Promise.resolve();if(r){let n=this.commitRenderState();return this.paint(),n}else return this.frameId?Promise.resolve():new Promise((n,o)=>{this.frameId=requestAnimationFrame(()=>{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(u=>{o(u)}):n()})})},"update"));p(this,"animate2D",a(()=>{this.animationFrameId=requestAnimationFrame(()=>{this.animationFrameId=null,this.systems.twoDVisiblitySystem.playAnimations()})},"animate2D"));p(this,"drawEntities2D",a(()=>{this.twoDFrameId||(this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel())}))},"drawEntities2D"));p(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"));p(this,"commitRenderState",a(()=>{try{let r=[];this.frameId=null,this.publish("pre-render"),this.state.internalTweenGroup.update(),this.state.externalTweenGroup.update(),(this.mode==="outdoors-interleaved"||this.mode==="standalone")&&this.systems.cameraSystem.update(),this.state.shouldMeasureCanvas&&(this.state.shouldMeasureCanvas=!1,this.publish("measure-canvas")),this.twoDdirty&&(this.state.geometry2DIdsInScene.clear(),dp(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(),hp(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&&r.push(i),this.systems.meshModificationSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation()),r.push(this.systems.text3DSystem.update(this.systems.cameraSystem.getRotation())),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.geometryInFocusSystem.update(this.systems.cameraSystem.isCameraMoving(),this.systems.cameraSystem.lastCameraStoppedMovingTime()),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.pathSystem.update(this.systems.cameraSystem.minZoomAltitude,this.systems.cameraSystem.maxZoomAltitude,this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getRotation()),this.systems.cameraSystem.postRender(),this.systems.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.occlusion2DSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update();let 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(r)}catch(r){return Promise.reject(r)}},"commitRenderState"));this.renderer=r,this.state=i,this.mode=n,this.scene=o,this.cameraObject=s,this.viewCamera=l,this.systems=u,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 r;(r=this.renderer)!=null&&r.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(Mh,"RenderSystem");var Sl=Mh;v();var ST=I.object({interactive:I.boolean().optional(),id:I.string().optional(),width:I.union([I.number(),I.object({on:I.literal("zoom-level").optional(),input:I.array(I.number()).nonempty(),output:I.array(I.number()).nonempty(),easing:I.string().optional()})]).optional(),accentColor:I.string().optional(),displayArrowsOnPath:I.boolean().optional(),animateArrowsOnPath:I.boolean().optional(),visibleThroughGeometry:I.boolean().optional(),dashed:I.boolean().optional()}),CT=I.object({type:I.enum(["Feature"]),geometry:qn,properties:I.object({parentId:I.any().optional()})});function Ey(t,e){I.object({features:I.array(CT)}).parse(t),ST.parse(e)}a(Ey,"validatePath");var os,Ih=class Ih{constructor(e,r){p(this,"type","path");p(this,"mesh",new Bt);p(this,"material");p(this,"geometry");p(this,"outline");p(this,"feature");p(this,"options");p(this,"width",{on:"zoom-level",input:[17,22],output:[.8,.4]});p(this,"breakpoint",0);p(this,"altitudeBreakpoints");p(this,"accentColor","blue");p(this,"completeFraction",1);p(this,"altitudeAdjustment",1);p(this,"displayArrowsOnPath",!1);p(this,"animateArrowsOnPath",!1);p(this,"visibleThroughGeometry",!1);p(this,"dashed",!1);p(this,"isVertical",!1);p(this,"dirty",!0);p(this,"materialDirty",!0);p(this,"position",new H);L(this,os,0);var i,n,o,s,l,u;this.feature=e,this.options=r||{},this.width=(i=r==null?void 0:r.width)!=null?i:this.width,this.accentColor=(n=r==null?void 0:r.accentColor)!=null?n:this.accentColor,this.displayArrowsOnPath=(o=r==null?void 0:r.displayArrowsOnPath)!=null?o:this.displayArrowsOnPath,this.animateArrowsOnPath=(s=r==null?void 0:r.animateArrowsOnPath)!=null?s:this.animateArrowsOnPath,this.visibleThroughGeometry=(l=r==null?void 0:r.visibleThroughGeometry)!=null?l:this.visibleThroughGeometry,this.dashed=(u=r==null?void 0:r.dashed)!=null?u:this.dashed}setColor(){}setOpacity(){}set visible(e){this.mesh&&(this.mesh.visible=e)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return c(this,os)}set altitude(e){this.mesh&&(this.mesh.position.z=e,R(this,os,e))}set complete(e){this.material&&(this.material.uniforms.complete.value=e,this.material.needsUpdate=!0)}};os=new WeakMap,a(Ih,"PathComponent");var ri=Ih;v();var _T=300,ss,as,Eh=class Eh{constructor(e){p(this,"state");L(this,ss,new H);L(this,as,new H);this.state=e}update(e){var n;let r,i;this.state.cameraObject.getWorldPosition(c(this,as));for(let o of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(o),r&&(i=r.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{r.object3d.getWorldPosition(c(this,ss));let s=c(this,as).distanceTo(c(this,ss));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=e?"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:_T,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)}}};ss=new WeakMap,as=new WeakMap,a(Eh,"DOMDrawSystem");var Cl=Eh;v();var Dh=class Dh extends me{constructor(r,i){super();p(this,"state");p(this,"dirty",!0);p(this,"domTree");p(this,"observers",new Map);p(this,"updateDimensions",a(r=>{r.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),u=l==null?void 0:l.components[0];l&&u instanceof nr&&(u.updateDimensions(i.contentRect.width,i.contentRect.height),u.collisionDirty=!0)}}),this.publish("dimensions-update")},"updateDimensions"));this.state=r,this.domTree=i}setupObserver(){var n;if(this.observers){for(let o of this.observers.values())o.disconnect();this.observers.clear()}let r,i;for(let o of this.domTree.children){let s=o.getAttribute("data-marker-id");if(s!=null&&(r=this.state.geometry2DMap.get(s),i=r.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 r of this.observers.values())r.disconnect();this.observers.clear()}};a(Dh,"DOMResizeSystem");var _l=Dh;v();v();var Dy="uniform vec4 uSize;\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n // Scale the position by the size of the quad\n // and shift to top left corner for 0,0\n vec2 transformed = position.xy * uSize.xy - vec2(1.0, -1.0);\n // Apply width .x and height .y of image\n transformed += vec2(uSize.x, -uSize.y);\n // Apply left .w and top .z offset\n transformed += vec2(uSize.w, -uSize.z) * 2.0;\n gl_Position = vec4(transformed, 1.0, 1.0);\n}";v();var Oy="varying vec2 vUv;\nuniform sampler2D uTexture;\nuniform float uOpacity;\nvoid main() {\n #ifndef debug\n vec4 texture = texture2D(uTexture, vUv);\n gl_FragColor = vec4(texture.rgb, texture.a * uOpacity);\n #else\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n #endif\n}";v();var Ly=4.291666666666667,Ay=15,ky=25,Ry=43/60;v();var Ny=["horizontal","icon"],PT=new Map([[Ny[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>'],[Ny[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>']]),TT=/<svg([^>]*)>/g;function By(t,e,r,i){let n=PT.get(t);return n?n.replace(TT,'<svg$1 width="'.concat(r,'" height="').concat(i,'" xmlns="http://www.w3.org/2000/svg" style="fill: ').concat(e,';">')):""}a(By,"getLogoIcon");var Fy=!1,Te,Er,$n,qe,pt,Ki,zt,cr,Oh=class Oh extends me{constructor(r,i,n){super();L(this,Te,{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,Er);L(this,$n);L(this,qe);L(this,pt);L(this,Ki);L(this,zt,0);L(this,cr,0);p(this,"dirty",!0);p(this,"getPositionAlignedCanvasCoordinates",a((r,i)=>({"top-left":{x:0,y:0},"top-right":{x:r,y:0},"bottom-left":{x:0,y:i},"bottom-right":{x:r,y:i},center:{x:r/2,y:i/2},top:{x:r/2,y:0},bottom:{x:r/2,y:i},left:{x:0,y:i/2},right:{x:r,y:i/2}})[c(this,Te).position],"getPositionAlignedCanvasCoordinates"));p(this,"getPositionAlignedPadding",a(()=>{var n,o,s,l;let r=c(this,Te).padding;if(typeof r=="number")return{"top-left":{x:r,y:r},"top-right":{x:-r,y:r},"bottom-left":{x:r,y:-r},"bottom-right":{x:-r,y:-r},center:{x:0,y:0},top:{x:0,y:r},bottom:{x:0,y:-r},left:{x:r,y:0},right:{x:-r,y:0}}[c(this,Te).position];let i={top:(n=r.top)!=null?n:0,right:(o=r.right)!=null?o:0,bottom:(s=r.bottom)!=null?s:0,left:(l=r.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&&(c(this,Te)[o]=s)}),R(this,$n,r),R(this,Er,i)}get color(){return c(this,Te).color==="light"?"white":"#293136"}get iconName(){return c(this,Te).iconOnly?"icon":"horizontal"}get minWidth(){return c(this,Te).iconOnly?Ay:75}get defaultWidth(){return c(this,Te).iconOnly?ky:150}get aspectRatio(){return c(this,Te).iconOnly?Ry:Ly}get options(){return O({},c(this,Te))}set options(r){var i,n;R(this,Te,{padding:r.padding||c(this,Te).padding,position:r.position||c(this,Te).position,iconOnly:r.iconOnly||c(this,Te).iconOnly,color:r.color||c(this,Te).color,scale:r.scale||c(this,Te).scale,onClick:c(this,Te).onClick,interactive:(i=r.interactive)!=null?i:c(this,Te).interactive,visible:(n=r.visible)!=null?n:c(this,Te).visible})}get icon(){return By(this.iconName,this.color,c(this,zt)*c(this,Er).pixelRatio,c(this,cr)*c(this,Er).pixelRatio)}setSize(r,i){c(this,pt)&&(c(this,pt).uniforms.uSize.value.x=r,c(this,pt).uniforms.uSize.value.y=i)}setXY(r,i){c(this,pt)&&(c(this,pt).uniforms.uSize.value.w=r,c(this,pt).uniforms.uSize.value.z=i)}get width(){return c(this,zt)}get height(){return c(this,cr)}getPositionAlignedOffset(r,i){return{"top-left":{x:0,y:0},"top-right":{x:-r,y:0},"bottom-left":{x:0,y:-i},"bottom-right":{x:-r,y:-i},center:{x:-(r/2),y:-(i/2)},top:{x:-(r/2),y:0},bottom:{x:-(r/2),y:-i},left:{x:0,y:-(i/2)},right:{x:-r,y:-(i/2)}}[c(this,Te).position]}insertIntoQuadTree(r){c(this,Ki)!=null&&typeof c(this,Te).onClick=="function"&&c(this,Te).interactive&&r.insert(c(this,Ki))}resize(r,i){if(c(this,Te).visible!==!0)return;let n=this.getPositionAlignedCanvasCoordinates(r,i),o=this.getPositionAlignedPadding(),s=this.getPositionAlignedOffset(c(this,zt),c(this,cr)),l=Math.min(r-c(this,zt),Math.max(0,n.x+o.x+s.x)),u=Math.min(i-c(this,cr),Math.max(0,n.y+o.y+s.y));this.setSize(c(this,zt)/r,c(this,cr)/i),this.setXY(l/r,u/i),R(this,Ki,new Se(l,u,c(this,zt),c(this,cr),{entityId:"watermark"}))}update(){this.dirty&&(c(this,Te).visible===!0?(R(this,zt,Math.min(c(this,Er).canvasWidth,Math.max(this.minWidth,this.defaultWidth*c(this,Te).scale))),R(this,cr,c(this,zt)/this.aspectRatio),ti.getLoader().load("data:image/svg+xml;base64,".concat(btoa(this.icon)),r=>{if(R(this,pt,new Rr({uniforms:{uTexture:{value:r},uSize:{value:new Ad(0,0,0,0)},uOpacity:{value:.7}},vertexShader:Dy,fragmentShader:Oy,depthWrite:!1,depthTest:!1,defines:{debug:Fy},wireframe:Fy,transparent:!0,visible:!0})),c(this,qe))c(this,qe).visible=!0,c(this,qe).material=c(this,pt),c(this,qe).material.needsUpdate=!0;else{let i=new Nt(2,2,1,1);R(this,qe,new be(i,c(this,pt))),c(this,qe).position.set(0,0,-1),c(this,qe).frustumCulled=!1,c(this,qe).renderOrder=999;let n=new kr(1,1,1),o=new be(n,new st({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));o.frustumCulled=!1,o.layers.set(1),c(this,qe).add(o),c(this,$n).add(c(this,qe))}this.resize(c(this,Er).canvasWidth,c(this,Er).canvasHeight),this.publish("texture-loaded")})):c(this,qe)&&(c(this,qe).visible=!1),this.dirty=!1)}destroy(){c(this,qe)&&(c(this,$n).remove(c(this,qe)),ze(c(this,qe))),R(this,qe,void 0),c(this,pt)&&c(this,pt).dispose(),R(this,pt,void 0),R(this,Ki,void 0)}};Te=new WeakMap,Er=new WeakMap,$n=new WeakMap,qe=new WeakMap,pt=new WeakMap,Ki=new WeakMap,zt=new WeakMap,cr=new WeakMap,a(Oh,"WatermarkSystem");var Pl=Oh;v();var Tl=100,IT=!1,Lh=class Lh extends me{constructor(r,i){super();p(this,"currentTotalBoundingBox");p(this,"state");p(this,"cameraSystem");p(this,"debugMesh",null);p(this,"dirty",!0);p(this,"autoMinZoomLevel",!0);this.state=r,this.cameraSystem=i}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new it,this.state.entityScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new H(0,0,0),new H(Tl*2,Tl*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.entityScene),this.currentTotalBoundingBox.expandByScalar(Tl)));let r=new it().setFromObject(this.state.entityScene);this.currentTotalBoundingBox.union(r);let i=r.getSize(new H),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=wl.copy(this.currentTotalBoundingBox).expandByScalar(Math.max(n,Tl)).getBoundingSphere(ET).radius;if(this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new H),min:wl.min,max:wl.max,radius:o},this.publish("update"),this.cameraSystem.dirty=!0,this.dirty=!1,IT&&this.state.entityScene.parent instanceof Nr){this.debugMesh&&(this.state.entityScene.parent.remove(this.debugMesh),this.debugMesh=null),this.debugMesh=new fr,this.debugMesh.add(new be(new Us(this.cameraSystem.panBounds.radius),new st({color:16711680,transparent:!0,opacity:.2}))),this.debugMesh.position.copy(this.cameraSystem.panBounds.center),this.state.entityScene.parent.add(this.debugMesh);let s=new H;wl.getSize(s);let l=new kr(s.x,s.y,s.z),u=new st({color:65280,wireframe:!0,transparent:!0,opacity:.5}),h=new be(l,u);h.position.copy(this.currentTotalBoundingBox.getCenter(new H)),this.debugMesh.add(h)}}}};a(Lh,"PanBoundsSystem");var Ml=Lh,wl=new it,ET=new Rd;v();var ls,cs,Ah=class Ah{constructor(e,r){p(this,"mesh");p(this,"type","custom-geometry");p(this,"dirty",!0);p(this,"feature");p(this,"builder");p(this,"outline");L(this,ls,1);p(this,"color",new Ee);L(this,cs,0);this.mesh=new Bt,this.feature=e,this.builder=r}get visible(){return this.mesh.visible}set visible(e){this.mesh.visible=e}set opacity(e){R(this,ls,e)}get opacity(){return c(this,ls)}setColor(e){this.color.set(e)}get position(){var e;return(e=this.mesh)==null?void 0:e.position}get altitude(){return c(this,cs)}set altitude(e){this.mesh&&(this.mesh.position.z=e,R(this,cs,e))}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(e){this.mesh&&(this.mesh.renderOrder=e)}};ls=new WeakMap,cs=new WeakMap,a(Ah,"CustomGeometryComponent");var Jn=Ah;v();var kh=class kh{constructor(e,r){p(this,"state");p(this,"convertTo3DMapPosition");this.state=e,this.convertTo3DMapPosition=r}update(){let e,r;for(let i of this.state.geometry3DIdsInScene){let n=this.state.geometry3DMap.get(i);(n==null?void 0:n.type)==="custom-geometry"&&(e=n.components[0],r=n.components[1],e.dirty&&r.visible!==!1&&(e.position.copy(this.convertTo3DMapPosition(e.feature.geometry.coordinates[1],e.feature.geometry.coordinates[0],r.altitude)),e.builder.setup(e.mesh),e.mesh.traverse(o=>{o.userData=j(O({},o.userData),{entityId:i,type:"custom-geometry"})}),e.dirty=!1),r.visible!==!1&&e.builder.update(e.mesh))}}};a(kh,"CustomGeometrySystem");var Il=kh;v();v();function Gy(t){return t.children.some(e=>e.userData.isOutline)}a(Gy,"hasOutline");function Xy(t,e){var i;let r=t.userData.entities3D.values().next().value;return r?((i=e.geometry3DMap.get(r))==null?void 0:i.components[3])!==void 0:!1}a(Xy,"needsOutline");function El(t,e,r,i){let o=t.getAttribute("position").array,s=-1/0;for(let l=0;l<e.count;l++){let h=(e.start+l)*3,m=o[h+2];s=Math.max(s,m)}for(let l=0;l<e.count;l++){let h=(e.start+l)*3,m=o[h+2];Math.abs(m-s)<1e-4?o[h+2]=Math.max(r+i,2e-4+i):o[h+2]=i}t.attributes.position.needsUpdate=!0}a(El,"updateBufferGeometryHeight");v();function Rh(t){var h,m;let e=new Ys,r=(h=t.mesh)==null?void 0:h.geometry;if(!r||!((m=t.batchedProps)!=null&&m.range))return;let i=t.batchedProps.range,n=i.start,o=i.count,s=r.getAttribute("position");if(s){let f=new Float32Array(o*3);for(let b=0;b<o;b++){let y=n+b;f[b*3]=s.array[y*3],f[b*3+1]=s.array[y*3+1],f[b*3+2]=s.array[y*3+2]}e.setAttribute("position",new ct(f,3))}let l=r.getAttribute("normal");if(l){let f=new Float32Array(o*3);for(let b=0;b<o;b++){let y=n+b;f[b*3]=l.array[y*3],f[b*3+1]=l.array[y*3+1],f[b*3+2]=l.array[y*3+2]}e.setAttribute("normal",new ct(f,3))}let u=r.getAttribute("uv");if(u){let f=new Float32Array(o*2);for(let b=0;b<o;b++){let y=n+b;f[b*2]=u.array[y*2],f[b*2+1]=u.array[y*2+1]}e.setAttribute("uv",new ct(f,2))}if(r.index){let f=r.index,b=new Uint32Array(o);for(let y=0;y<o;y++)b[y]=f.array[n+y];e.setIndex(new ct(b,1))}return e}a(Rh,"extractBufferGeometryFromBatchedGeometry");function zy(t,e){let r=Rh(t);if(!r||!t.mesh)return;t.mesh.deleteInstance(t.instanceIndex),t.mesh.optimize();let i=e.addGeometry(r);e.addInstance(i);let n=e.getGeometryIdAt(i),o=e.getGeometryRangeAt(n);return o&&t.batchedProps&&(t.batchedProps.range=o),r.dispose(),i}a(zy,"transferGeometryToNewBatchedMesh");v();v();var Yy="// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\nattribute float visibility;\nvarying vec4 v_color;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n vLineDistance = scale * lineDistance;\n v_color = color;\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n if (visibility < 0.5) {\n gl_Position = vec4(-2.0, -2.0, -2.0, 1.0);\n }\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n\n}";v();var Zy="// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\nvarying vec4 v_color;\n\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n discard;\n\n }\n\n vec3 outgoingLight = vec3( 0.0 );\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n\n outgoingLight = diffuseColor.rgb; // simple shader\n\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n // Discard alpha lower than 0.01 to avoid opacity fighting\n if (v_color.a <= 0.01) { \n discard;\n }\n}\n";var Nh=class Nh extends ac{constructor(e){super(e),this.onBeforeCompile=r=>{r.vertexShader=Yy,r.fragmentShader=Zy}}};a(Nh,"OutlineLineMaterial");var Dl=Nh;var LT=80,Qi,Kn,Ll,Al,Bh=class Bh{constructor(e){p(this,"rendererState");p(this,"outlineOpacitiesDirty",!0);L(this,Qi,!0);L(this,Kn,-1/0);L(this,Ll,new Map);L(this,Al,new Dl({vertexColors:!0,linewidth:1,transparent:!0,opacity:1,side:hi}));this.rendererState=e}get geometries3DDirty(){return c(this,Qi)}set geometries3DDirty(e){R(this,Qi,e)}update(e,r=!0){var o,s,l;let i;if(this.geometries3DDirty){for(let u of this.rendererState.geometry3DIdsInScene){let h=this.rendererState.geometry3DMap.get(u);if(h instanceof xt&&Xy(h,this.rendererState)&&!Gy(h)&&h.userData.entities3D.size>0){let m=[];for(let S of h.userData.entities3D.values()){let C=this.rendererState.geometry3DMap.get(S);if(C instanceof fe&&C.type==="geometry"&&C.components[3]&&C.components[3].dirty===!0&&C.components[0].material!=null){let w=C.components[0].geometry,k=!1;w||(w=Rh(C.components[0]),k=!0);let A=C.components[1];m.push([C.components[3],new lc(w,(o=A.bevel)!=null&&o.enabled?1:LT)]),k&&(w==null||w.dispose(),w=void 0)}}if(m.length===0)continue;let f=Pt(m.map(S=>S[1]),!1);if(f==null)continue;let b=f.getAttribute("position"),y=new Float32Array(b.count*4),_=new ct(y,4);f.setAttribute("color",_);let T=new Uint8Array(b.count);T.fill(0);let g=new ct(T,1,!1);f.setAttribute("visibility",g);let x=0;for(let S=0;S<m.length;S++){let[C,w]=m[S],k=w.getAttribute("position").count;C.edgeColors=_,C.edgeVisibility=g,C.geometry=f,C.ranges={count:k,start:x},x+=k,w.dispose()}let P=new pn(f,c(this,Al));P.userData.isOutline=!0,h.add(P)}}R(this,Qi,!1),this.outlineOpacitiesDirty=!0}for(let u of this.rendererState.geometry3DIdsInScene){let h=this.rendererState.geometry3DMap.get(u);if(h instanceof fe&&h.type==="geometry"&&h.components[3]&&h.components[3].dirty===!0&&h.components[0].material!=null&&h.parentObject3D instanceof xt){let m=h.components[3].geometry;if(!m)continue;let f=h.components[3];if(!f)continue;let b=f.enabled&&h.components[1].visible;if(f.visible!==b&&(f.visible=b),!f.visible)continue;let y=f.edgeColors;if(!y||!f.ranges)continue;let _=new Ee(f.color);for(let P=0;P<f.ranges.count;P++){let S=f.ranges.start+P;y.setXYZ(S,_.r,_.g,_.b)}let T=h.components[1].height,g=h.components[1].altitude;((l=(s=h.components[1])==null?void 0:s.bevel)==null?void 0:l.enabled)||El(m,f.ranges,T,g),m.attributes.color.needsUpdate=!0,m.computeBoundingSphere(),f.dirty=!1}}let n=r?yi(e,16,19,0,1):c(this,Kn);if((n!==c(this,Kn)||this.outlineOpacitiesDirty)&&this.rendererState.geometry3DIdsInScene.size>0){for(let u of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(u),(i==null?void 0:i.type)==="geometry"&&i.components[0]instanceof Ne){let h=i.components[3];if(h&&h.edgeColors&&h.geometry&&h.visible){let m=Math.min(n,i.components[1].opacity*yn(i));if(h.currentOpacity!==m){for(let f=0;f<h.ranges.count;f++){let b=h.ranges.start+f;h.edgeColors.setW(b,m)}h.geometry.attributes.color.needsUpdate=!0}}}}R(this,Kn,n),R(this,Qi,!1),this.outlineOpacitiesDirty=!1}destroy(){c(this,Ll).clear()}};Qi=new WeakMap,Kn=new WeakMap,Ll=new WeakMap,Al=new WeakMap,a(Bh,"OutlineInterpolationSystem");var Ol=Bh;v();v();var Fh=class Fh extends be{constructor(){super(...arguments);p(this,"userData",{entityId:""})}};a(Fh,"EntityMesh");var kl=Fh,AT=I.object({flipImageToFaceCamera:I.boolean().optional(),url:I.string()}),kT=I.object({type:I.enum(["Feature"]),properties:I.object({width:I.number(),height:I.number(),rotation:I.number().min(0).max(360).optional(),verticalOffset:I.number().optional()}),geometry:qn});function Uy(t,e,r){I.union([I.number(),I.string()]).parse(t),kT.parse(e),AT.parse(r)}a(Uy,"validateImage");var Gh=class Gh{constructor(e){p(this,"mesh",new Bt);p(this,"imageMesh");p(this,"outline");p(this,"type","image");p(this,"instanceIndex",-1);p(this,"geometry");p(this,"material");p(this,"feature");p(this,"position",new H);this.feature=e}get visible(){var e,r;return(r=(e=this.mesh)==null?void 0:e.visible)!=null?r:!1}set visible(e){this.mesh&&(this.mesh.visible=e)}};a(Gh,"ImageComponent");var Rl=Gh;v();function Xh(t,e){return{x:t.x*Math.cos(e)-t.y*Math.sin(e),y:t.x*Math.sin(e)+t.y*Math.cos(e)}}a(Xh,"rotatePoint");function RT(t,e){return t.map(r=>Xh(r,e))}a(RT,"rotatePoints");function NT(t){let e=1/0,r=1/0,i=-1/0,n=-1/0;for(let o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return{minX:e,minY:r,maxX:i,maxY:n}}a(NT,"getBounds");function BT(t,e){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let o=e[i].x,s=e[i].y,l=e[n].x,u=e[n].y;s>t.y!=u>t.y&&t.x<(l-o)*(t.y-s)/(u-s)+o&&(r=!r)}return r}a(BT,"pointInPolygon");function jy(t,e,r,i,n){for(let o=0;o<n;o++)for(let s=0;s<i;s++)if(t[r+o][e+s]!==1)return!1;return!0}a(jy,"isValidRectangle");function FT(t,e,r){let i=t.maxX-t.minX,n=t.maxY-t.minY,o,s,l=O({},t);return i/n>e?(s=n/r,o=s*e,l.minX+=(i-o*r)/2):(o=i/r,s=o/e,l.minY+=(n-s*r)/2),{dx:o,dy:s,gridBounds:l}}a(FT,"calculateGridDimensions");function GT(t,e,r,i,n){let o=Array(r).fill(0).map(()=>Array(r).fill(0));for(let s=0;s<r;s++)for(let l=0;l<r;l++){let u={x:e.minX+l*i,y:e.minY+s*n};BT(u,t)&&(o[s][l]=1)}return o}a(GT,"createAndFillGrid");function XT(t,e){let r=Array(e).fill(0).map(()=>Array(e).fill(0));for(let i=0;i<e;i++)for(let n=0;n<e;n++)if(t[i][n]===1){let o=0;for(let s=1;s<=Math.min(e-n,e-i)&&jy(t,n,i,s,s);s++)o=s;r[i][n]=o}return r}a(XT,"calculateRectSizes");function zT(t,e,r,i,n,o){let s=0,l=0,u=0;for(let h=0;h<i;h++)for(let m=0;m<i;m++)if(t[h][m]===1){let f=Math.pow(e[h][m],2),b=r.minX+m*n,y=r.minY+h*o;s+=f,l+=b*f,u+=y*f}return{x:l/s,y:u/s}}a(zT,"calculatePolygonCenter");function YT(t,e,r,i,n,o,s){let l=-1/0,u=null,h=t.length,m=Math.sqrt(Math.pow(e.maxX-e.minX,2)+Math.pow(e.maxY-e.minY,2));for(let f=0;f<h;f++)for(let b=0;b<h;b++)if(t[f][b]===1)for(let y=1;y<=h-b;y++){let _=y;if(!(_>h-f)&&jy(t,b,f,y,_)){let T=y*_,g=e.minX+(b+y/2)*r,x=e.minY+(f+_/2)*i,P={x:g,y:x},C=Math.sqrt(Math.pow(P.x-n.x,2)+Math.pow(P.y-n.y,2))/m,w=T*(1-o)-C*o*T;w>l&&(l=w,u={center:P,width:y*r*s,height:y*i*s})}}return u}a(YT,"findBestRectangle");function zh(t,e,r,i={}){let{scaleFactor:n=.9,centerPriority:o=.5,resolution:s=100,minimumSizeRatio:l=.5}=i,u=$d(r),h=t.width/t.height,m=RT(e,u),f=NT(m),{dx:b,dy:y,gridBounds:_}=FT(f,h,s),T=GT(m,_,s,b,y),g=XT(T,s),x=zT(T,g,_,s,b,y),P=YT(T,_,b,y,x,o,n);return!P||P.width<t.width*l||P.height<t.height*l?t:j(O({},P),{center:Xh(P.center,-u),rotation:r,polygonCenter:Xh(x,-u)})}a(zh,"findLargestInteriorRectangle");var us=Math.PI*2,ZT=Math.PI/2,UT=Math.PI*1.5,jT=mn(ZT,2),HT=mn(UT,2),WT=.01,Hy=!1,Yh=class Yh extends me{constructor(r,i,n=0,o=0,s={}){super();p(this,"rendererState");p(this,"convertTo3DMapPosition");p(this,"initialBearing",0);p(this,"naturalBearing",0);p(this,"imagePlacementOptions");p(this,"imageLoadingCache",new Map);this.rendererState=r,this.convertTo3DMapPosition=i,this.initialBearing=n,this.naturalBearing=o,this.imagePlacementOptions=s}createImageMesh(r,i,n,o=0,s,l){var _,T,g;let u={width:n.width,height:n.height,center:this.convertTo3DMapPosition(s),rotation:(_=n.rotation)!=null?_:0},h=(T=this.imagePlacementOptions.mode)!=null?T:"default",m=(()=>{switch(h){case"fit-nearest-90":let x=(this.initialBearing-this.naturalBearing+360)%180;return x>=45&&x<=135?zh(u,l,u.rotation+90,this.imagePlacementOptions):u;case"fit-initial-bearing":return zh(u,l,this.initialBearing,this.imagePlacementOptions);case"default":case"none":default:return u}})();if(Hy&&m.polygonCenter){let x=new be(new Us(1),new mi({color:65280}));x.position.set(m.polygonCenter.x,m.polygonCenter.y,o),this.rendererState.entityScene.add(x)}let f=new mi({transparent:!0,depthWrite:!1,side:Rt}),b=new Nt(m.width,m.height),y=new kl(b);if(y.visible=!1,y.renderOrder=1,(g=this.getOrDownloadImage(i))==null||g.then(x=>{f.map=x,f.needsUpdate=!0,f.map.colorSpace=di,y.visible=!0,this.publish("image-loaded")}),y.userData.entityId=r,y.material=f,Hy){let x=new be(new Nt(n.width,n.height),new mi({color:"gray"}));y.add(x);let P=new Ud;y.add(P),P.scale.set(10,10,10)}return y.position.set(m.center.x,m.center.y,o+WT),y.rotation.z=(-ue.degToRad(m.rotation)+us)%us,y}getOrDownloadImage(r){var i;if(this.imageLoadingCache.has(r))return(i=this.imageLoadingCache.get(r))==null?void 0:i.promise;{let n=new Promise(o=>{ti.getLoader().load(r,s=>{let l=this.imageLoadingCache.get(r);l&&!l.loaded&&(l.loaded=!0),o(s)})});return this.imageLoadingCache.set(r,{loaded:!1,promise:n}),n}}flipIfNeeded(r,i){if(r.imageMesh==null)return;let n=-i,o=r.imageMesh.rotation.z,s=mn((o-n+us)%us,2);s>jT&&s<HT&&(r.imageMesh.rotation.z=(o+Math.PI)%us)}update(r){var s,l,u,h,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 b=this.convertTo3DMapPosition(n.feature.geometry.coordinates),y={x:b.x,y:b.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,r),n.imageMesh.material instanceof mi&&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 b=n.feature.geometry.coordinates[0].map(_=>{let T=this.convertTo3DMapPosition(_);return{x:T.x,y:T.y}}),y=this.createImageMesh(f,(u=n.feature.properties)==null?void 0:u.image.path,(h=n.feature.properties)==null?void 0:h.image,o.height,(m=n.feature.properties)==null?void 0:m.image.position,b);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 b=this.imageLoadingCache.get(o.url);b&&b.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,r)}}}};a(Yh,"ImageSystem");var Nl=Yh;v();var VT=250,ii,Zh=class Zh extends me{constructor(r,i){super();p(this,"cameraDirty",!0);p(this,"focusablesDirty",!0);p(this,"state");p(this,"camera");p(this,"debugEl",null);p(this,"raycasters",[]);p(this,"collisions",new Map);p(this,"focusableEntities",new Set);p(this,"debugRaycasters",!1);L(this,ii);p(this,"update",a((r=!1,i=Date.now())=>{this.focusablesDirty&&this.updateFocusableEntities(),!r&&(Date.now()-i>VT||(c(this,ii)&&cancelAnimationFrame(c(this,ii)),R(this,ii,requestAnimationFrame(()=>{this.updateRaf()}))))},"update"));this.state=r,this.camera=i,this.buildRaycasters()}resize(){this.buildRaycasters()}buildRaycasters(){this.debugEl&&this.debugEl.remove();let r=new ae(this.state.canvasWidth/2,this.state.canvasHeight/2),i=new ae(r.x/1.2,r.y/1.2),n=new ae(r.x+(r.x-i.x),i.y),o=new ae(i.x,r.y+(r.y-i.y)),s=new ae(n.x,o.y),l=new ae(r.x,r.y/1.5),u=new ae(r.x,r.y+(r.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=[r,l,u,i,n,o,s].map((h,m)=>{if(this.debugRaycasters){let T=document.createElement("div");T.style.position="absolute",T.style.top=h.y+"px",T.style.left=h.x+"px",T.style.width="10px",T.style.height="10px",T.style.backgroundColor="red",this.debugEl.append(T)}let f=h.x/this.state.canvasWidth*2-1,b=-(h.y/this.state.canvasHeight)*2+1,y=new ae(f,b),_=new qt;return _.setFromCamera(y,this.camera),[_,y,m===0?10:m<7?2:1]})}updateFocusableEntities(){this.focusableEntities.clear();let r,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 Mr){if(i=n.components[1],i.dirty===!0||i.focusMesh==null){i.focusMesh&&ze(i.focusMesh);let s=new it;s.setFromObject(n);let l=s.max.x-s.min.x,u=s.max.y-s.min.y,h=s.max.z-s.min.z;if(!isFinite(l)||!isFinite(u)||!isFinite(h)||isNaN(l)||isNaN(u)||isNaN(h)||l<=0||u<=0||h<=0)continue;let m=new kr(l,u,h),f={transparent:!0,opacity:this.debugRaycasters?1:0,visible:this.debugRaycasters};if(this.debugRaycasters){let _=["red","green","blue","yellow","purple","orange","pink","brown","gray","black"];f.color=_[Math.floor(Math.random()*_.length)]}let b=new st(f),y=new be(m,b);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 Mr&&(r=n.components[0],i=n.components[4],r instanceof Ne&&r.geometry!=null&&(i.dirty===!0||i.focusMesh==null))){if(i.focusMesh==null){let s=new be(r.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 u;if((l==null?void 0:l.object)!=null&&"isMesh"in l.object&&(l!=null&&l.object.isMesh)){let h=l.object.userData.entityId,m=(u=this.collisions.get(h))!=null?u:0;this.collisions.set(h,m+o)}});let r=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",r),this.cameraDirty=!1}showRaycasters(){this.debugRaycasters=!0,this.buildRaycasters()}hideRaycasters(){this.debugRaycasters=!1,this.buildRaycasters()}destroy(){c(this,ii)&&cancelAnimationFrame(c(this,ii)),this.debugEl&&this.debugEl.remove(),this.collisions.clear(),this.focusableEntities.clear(),this.raycasters=[]}};ii=new WeakMap,a(Zh,"GeometryInFocusSystem");var Bl=Zh;v();v();v();v();v();function qT(t){if(!t)throw new Error("geojson is required");var e=[];return zr(t,function(r){$T(r,e)}),fi(e)}a(qT,"lineSegment");function $T(t,e){var r=[],i=t.geometry;if(i!==null){switch(i.type){case"Polygon":r=ji(i);break;case"LineString":r=[ji(i)]}r.forEach(function(n){var o=JT(n,t.properties);o.forEach(function(s){s.id=e.length,e.push(s)})})}}a($T,"lineSegmentFeature");function JT(t,e){var r=[];return t.reduce(function(i,n){var o=Vs([i,n],e);return o.bbox=KT(i,n),r.push(o),n}),r}a(JT,"createSegments");function KT(t,e){var r=t[0],i=t[1],n=e[0],o=e[1],s=r<n?r:n,l=i<o?i:o,u=r>n?r:n,h=i>o?i:o;return[s,l,u,h]}a(KT,"bbox");var Uh=qT;var ug=Ns(lg(),1);function T1(t,e){var r={},i=[];if(t.type==="LineString"&&(t=cc(t)),e.type==="LineString"&&(e=cc(e)),t.type==="Feature"&&e.type==="Feature"&&t.geometry!==null&&e.geometry!==null&&t.geometry.type==="LineString"&&e.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var n=cg(t,e);return n&&i.push(n),fi(i)}var o=(0,ug.default)();return o.load(Uh(e)),hc(Uh(t),function(s){hc(o.search(s),function(l){var u=cg(s,l);if(u){var h=ji(u).join(",");r[h]||(r[h]=!0,i.push(u))}})}),fi(i)}a(T1,"lineIntersect");function cg(t,e){var r=ji(t),i=ji(e);if(r.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=r[0][0],o=r[0][1],s=r[1][0],l=r[1][1],u=i[0][0],h=i[0][1],m=i[1][0],f=i[1][1],b=(f-h)*(s-n)-(m-u)*(l-o),y=(m-u)*(o-h)-(f-h)*(n-u),_=(s-n)*(o-h)-(l-o)*(n-u);if(b===0)return null;var T=y/b,g=_/b;if(T>=0&&T<=1&&g>=0&&g<=1){var x=n+T*(s-n),P=o+T*(l-o);return uc([x,P])}return null}a(cg,"intersects");var zl=T1;v();function ds(t,e){e===void 0&&(e={});var r=zn(t);switch(!e.properties&&t.type==="Feature"&&(e.properties=t.properties),r.type){case"Polygon":return w1(r,e);case"MultiPolygon":return M1(r,e);default:throw new Error("invalid poly")}}a(ds,"default");function w1(t,e){e===void 0&&(e={});var r=zn(t),i=r.coordinates,n=e.properties?e.properties:t.type==="Feature"?t.properties:{};return hg(i,n)}a(w1,"polygonToLine");function M1(t,e){e===void 0&&(e={});var r=zn(t),i=r.coordinates,n=e.properties?e.properties:t.type==="Feature"?t.properties:{},o=[];return i.forEach(function(s){o.push(hg(s,n))}),fi(o)}a(M1,"multiPolygonToLine");function hg(t,e){return t.length>1?Hd(t,e):Vs(t[0],e)}a(hg,"coordsToLine");function I1(t,e){var r=!0;return zr(t,function(i){zr(e,function(n){if(r===!1)return!1;r=E1(i.geometry,n.geometry)})}),r}a(I1,"booleanDisjoint");function E1(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return!A1(t.coordinates,e.coordinates);case"LineString":return!dg(e,t);case"Polygon":return!qr(t,e)}break;case"LineString":switch(e.type){case"Point":return!dg(t,e);case"LineString":return!D1(t,e);case"Polygon":return!pg(e,t)}break;case"Polygon":switch(e.type){case"Point":return!qr(e,t);case"LineString":return!pg(t,e);case"Polygon":return!O1(e,t)}}return!1}a(E1,"disjoint");function dg(t,e){for(var r=0;r<t.coordinates.length-1;r++)if(L1(t.coordinates[r],t.coordinates[r+1],e.coordinates))return!0;return!1}a(dg,"isPointOnLine");function D1(t,e){var r=zl(t,e);return r.features.length>0}a(D1,"isLineOnLine");function pg(t,e){for(var r=0,i=e.coordinates;r<i.length;r++){var n=i[r];if(qr(n,t))return!0}var o=zl(e,ds(t));return o.features.length>0}a(pg,"isLineInPoly");function O1(t,e){for(var r=0,i=t.coordinates[0];r<i.length;r++){var n=i[r];if(qr(n,e))return!0}for(var o=0,s=e.coordinates[0];o<s.length;o++){var l=s[o];if(qr(l,t))return!0}var u=zl(ds(t),ds(e));return u.features.length>0}a(O1,"isPolyInPoly");function L1(t,e,r){var i=r[0]-t[0],n=r[1]-t[1],o=e[0]-t[0],s=e[1]-t[1],l=i*s-n*o;return l!==0?!1:Math.abs(o)>=Math.abs(s)?o>0?t[0]<=r[0]&&r[0]<=e[0]:e[0]<=r[0]&&r[0]<=t[0]:s>0?t[1]<=r[1]&&r[1]<=e[1]:e[1]<=r[1]&&r[1]<=t[1]}a(L1,"isPointOnLineSegment");function A1(t,e){return t[0]===e[0]&&t[1]===e[1]}a(A1,"compareCoords");var mg=I1;function id(t,e){var r=!1;return zr(t,function(i){zr(e,function(n){if(r===!0)return!0;r=!mg(i.geometry,n.geometry)})}),r}a(id,"booleanIntersects");var fg=20,k1=5e3,nd="outdoor-system-debug-container",yg=!1,Yt,ke,ps,en,Zt,eo,oi,tn,Lt,to,ms,fs,ys,hr,Yl,rn,Ut,si,ai,nn,Ul,gs,vs,gg,vg,od=class od{constructor(e){L(this,hr);L(this,Yt,!0);L(this,ke);L(this,ps,"");L(this,en,new Set);L(this,Zt,new Set);L(this,eo);L(this,oi);L(this,tn);L(this,Lt,null);L(this,to,!1);L(this,ms,a(e=>{if(!c(this,ke))throw new Error("Map not initialized");let i=[[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]]].map(u=>c(this,ke).project(u)),n=Math.max(...i.map(u=>u.x)),o=Math.min(...i.map(u=>u.x)),s=Math.max(...i.map(u=>u.y)),l=Math.min(...i.map(u=>u.y));return[new oc.default(o,l),new oc.default(n,s)]},"#getScreenPoints"));L(this,fs,a(()=>{c(this,Lt)&&(clearTimeout(c(this,Lt)),R(this,Lt,null),R(this,Yt,!1))},"#stopTrying"));L(this,ys,a(()=>{c(this,Lt)&&(clearTimeout(c(this,Lt)),R(this,Lt,null)),R(this,Lt,setTimeout(()=>{c(this,fs).call(this)},k1))},"#startTrying"));L(this,rn,a(async()=>{if(yg&&c(this,oi)){let e=c(this,ms).call(this,c(this,oi));_e(this,hr,vg).call(this,e)}if(!(!c(this,ke)||!c(this,to))&&c(this,Yt)&&!(!c(this,Zt)||c(this,Zt).size===0)){if(c(this,si)&&(c(this,Ul).call(this),R(this,si,!1)),c(this,eo)){let e=c(this,ke).project(c(this,eo)),r=c(this,ke).queryRenderedFeatures(e,{layers:Array.from(c(this,Zt))});if(r.length>0){for(let i of r)c(this,Ut).push(["!=",["id"],i.id]);c(this,Ut).length>0&&c(this,Zt).forEach(i=>{var n;(n=c(this,ke))==null||n.setFilter(i,["all",...c(this,Ut)])}),R(this,Ut,[]),R(this,si,!1),R(this,Yt,!1)}}else if(c(this,oi)&&c(this,tn)){let e=c(this,ms).call(this,c(this,oi)),r=c(this,ke).queryRenderedFeatures(e,{layers:Array.from(c(this,Zt))});if(r.length>0){R(this,si,!0),c(this,ai).push(()=>{c(this,Ut).length>0&&(c(this,Zt).forEach(i=>{var n;(n=c(this,ke))==null||n.setFilter(i,["all",...c(this,Ut)])}),R(this,Yt,!1)),R(this,Ut,[])});for(let i=0;i<r.length;i+=fg){let n=r.slice(i,i+fg);c(this,ai).push(()=>{for(let o of n)if(o.geometry!=null&&"coordinates"in o.geometry){if(c(this,tn)==null)return;let s;if(o.geometry.type==="Polygon"?s=Ws(o.geometry.coordinates):o.geometry.type==="MultiPolygon"&&(s=Wd(o.geometry.coordinates)),!s)continue;for(let l of c(this,tn))if(id(l,s)){c(this,Ut).push(["!=",["id"],o.id]);continue}}})}c(this,gs).call(this)}}}},"#handleRender"));L(this,Ut,[]);L(this,si,!1);L(this,ai,[]);L(this,nn,null);L(this,Ul,a(()=>{c(this,nn)&&(globalThis.cancelAnimationFrame(c(this,nn)),R(this,nn,null)),R(this,ai,[])},"#cancelJobs"));L(this,gs,a(()=>{let e=c(this,ai).pop();typeof e=="function"&&(e(),c(this,ai).length>0&&R(this,nn,globalThis.requestAnimationFrame(c(this,gs)))),R(this,si,!1),c(this,fs).call(this)},"#runJobs"));L(this,vs,a(e=>{var r,i;if(c(this,ke)&&e&&e.dataType==="style"&&e.type==="styledata"&&c(this,en).size>0){let n=(i=(r=e==null?void 0:e.style)==null?void 0:r.stylesheet)==null?void 0:i.id;(!n||n!==c(this,ps))&&(R(this,ps,n),_e(this,hr,Yl).call(this),R(this,Yt,!0))}},"#handleStyleChange"));e&&(R(this,ke,e),c(this,ke).on("styledata",c(this,vs)),c(this,ke).on("render",c(this,rn)),R(this,to,c(this,ke).loaded()),c(this,ke).on("load",()=>{R(this,to,!0)})),yg&&_e(this,hr,gg).call(this)}hideLayersUnderPoint(e,r){c(this,ys).call(this),R(this,eo,e);for(let i of r)c(this,en).add(i);R(this,Yt,!0),_e(this,hr,Yl).call(this),c(this,rn).call(this)}hideLayersIntersectingPolygons(e,r,i){c(this,Lt)&&clearTimeout(c(this,Lt)),c(this,ys).call(this),R(this,oi,e),R(this,tn,r.reduce((n,o)=>{if(o.geometry.type==="Polygon"){let s=Ws(o.geometry.coordinates);n.push(s)}else o.geometry.type==="MultiPolygon"&&n.push(...o.geometry.coordinates.map(s=>Ws(s)));return n},[]));for(let n of i)c(this,en).add(n);R(this,Yt,!0),_e(this,hr,Yl).call(this),c(this,rn).call(this)}destroy(){c(this,ke)&&(c(this,ke).off("styledata",c(this,vs)),c(this,ke).off("render",c(this,rn)))}};Yt=new WeakMap,ke=new WeakMap,ps=new WeakMap,en=new WeakMap,Zt=new WeakMap,eo=new WeakMap,oi=new WeakMap,tn=new WeakMap,Lt=new WeakMap,to=new WeakMap,ms=new WeakMap,fs=new WeakMap,ys=new WeakMap,hr=new WeakSet,Yl=a(function(){if(R(this,Zt,new Set),c(this,ke))for(let e of c(this,en))c(this,ke).getLayer(e)&&c(this,Zt).add(e)},"#filterStylesInMap"),rn=new WeakMap,Ut=new WeakMap,si=new WeakMap,ai=new WeakMap,nn=new WeakMap,Ul=new WeakMap,gs=new WeakMap,vs=new WeakMap,gg=a(function(){if(!document.getElementById(nd)&&c(this,ke)){let e=document.createElement("div");e.id=nd,e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.bottom="0",e.style.right="0",e.style.pointerEvents="none",e.style.zIndex="1000",c(this,ke).getContainer().appendChild(e)}},"#addDebugContainer"),vg=a(function(e){let r=document.getElementById(nd);if(!r)return;let i=document.getElementById("bbox");i==null&&(i=document.createElement("div"),i.id="bbox",i.style.position="absolute",r.appendChild(i));let n=[Math.min(e[0].x,e[1].x),Math.min(e[0].y,e[1].y)],o=[Math.max(e[0].x,e[1].x),Math.max(e[0].y,e[1].y)];i.style.top=n[1]+"px",i.style.left=n[0]+"px",i.style.width=o[0]-n[0]+"px",i.style.height=o[1]-n[1]+"px",i.style.border="2px solid ".concat(c(this,Yt)?"red":"blue")},"#updateDebugBBox"),a(od,"OutdoorLayers");var Zl=od;v();v();v();v();var jl="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";v();var sd="#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";v();var bg="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 xg="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 N1=new js;function Sg(t,e,r){var yt,Qe;let{breakpoint:i,width:n,accentColor:o,completeFraction:s,isVertical:l,visibleThroughGeometry:u,dashed:h}=e,{color:m}=r,f=!0,b=0,y=1/0,_=e.displayArrowsOnPath,T=!0,g=_,x=typeof n=="object"?Number(n.output[i])/2:n/2,P=typeof n=="object"?Number((yt=n.output[i+1])!=null?yt:n.output[i])/2:n/2,S=((Qe=r.altitude)!=null?Qe:0)+B1,C=0;t[0].z+=S;for(let ne=1;ne<t.length;++ne){t[ne].z+=S;let K=t[ne].x-t[ne-1].x,Pe=t[ne].z-t[ne-1].z;if(l)C+=Math.sqrt(K*K+Pe*Pe);else{let Ye=t[ne].y-t[ne-1].y;C+=Math.sqrt(K*K+Ye*Ye+Pe*Pe)}}if(!l){let ne=t[0],K=t[t.length-1];t.push(K.clone().setZ(K.z-.01)),t.unshift(ne.clone().setZ(ne.z-.01))}let w=new Ld;g&&(w=N1.load(xg),w.colorSpace=di);let k=new Ee(m),A=new Ee(o),N={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new ae(1,1)},cameraParameters:{type:"v2",value:new ae(b,0)},complete:{type:"f",value:f?0:1},color:{type:"c",value:k},pathLength:{type:"f",value:C},nearRadius:{type:"f",value:x},farRadius:{type:"f",value:P},nearZoom:{type:"f",value:b},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:w},displayArrowsOnPath:{type:"b",value:_},showPulse:{type:"b",value:T},opacityMultiplier:{type:"f",value:1},dashed:{type:"b",value:h}},Y=new Gd(t);Y.curveType="catmullrom",Y.tension=0;let z=30,X=8,q=z*t.length,F=new Xd(Y,q,x,X,!1),J=new Float32Array(F.attributes.position.count);for(let ne=t.length;ne<J.length;ne++)J[ne]=ne;F.setAttribute("vertexIndex",new ct(J,1));let pe=new Float32Array(F.attributes.position.count),se=new ct(pe,1);for(let ne=0;ne<=q;ne++)for(let K=0;K<=X;++K)se.setX(ne*(X+1)+K,ne/q);F.setAttribute("pathDistance",se);let De=new Float32Array(F.attributes.normal.count*3),ve=new ct(De,3);for(let ne=0;ne<q;ne++){let K=F.tangents[ne];for(let Pe=0;Pe<=X;++Pe)ve.setXYZ(ne*(X+1)+Pe,K.x,K.y,K.z)}F.setAttribute("pathTangent",ve);let ge=new Float32Array(F.attributes.normal.count*3),xe=new ct(ge,3);for(let ne=0;ne<q;ne++){let K=F.tangents[ne];var rt,Ge,Ue;l?(rt=K.x*K.y,Ge=-1+K.y*K.y,Ue=K.z*K.y):(rt=-K.x*K.z,Ge=-K.y*K.z,Ue=1-K.z*K.z);let Pe=Math.sqrt(rt*rt+Ge*Ge+Ue*Ue);Pe===0&&(Pe=1);let Ye=rt/Pe,Wt=Ge/Pe,ui=Ue/Pe;for(let pr=0;pr<=X;++pr)xe.setXYZ(ne*(X+1)+pr,Ye,Wt,ui)}F.setAttribute("pathNormal",xe);let je=new Rr({uniforms:N,vertexShader:jl,fragmentShader:sd});je.transparent=!0,je.alphaTest=.5,N.resolution.value.x=1,N.resolution.value.y=1,N.vertexes.value=J.length,N.arrowTexture.value.wrapS=Vt,N.arrowTexture.value.wrapT=Vt,N.arrowTexture.value.anisotropy=16;let Me=new be(F,je),Xe=Me.clone(),Ke=j(O({},N),{opacityMultiplier:{type:"f",value:.25}});Ke.complete.value=1,Xe.material=new Rr({uniforms:Ke,vertexShader:jl,fragmentShader:sd}),Xe.material.transparent=!0,Xe.material.alphaTest=.5,Xe.material.depthWrite=!1,Xe.material.depthTest=!1,Ke.resolution.value.x=1,Ke.resolution.value.y=1,Ke.vertexes.value=J.length,Ke.arrowTexture.value.wrapS=Vt,Ke.arrowTexture.value.wrapT=Vt,Ke.arrowTexture.value.anisotropy=16,Ke.complete.value=s,Me.userData=Xe.userData=e.mesh.userData;let _t=e.mesh;if(!u){let ne=new Rr({uniforms:N,vertexShader:jl,fragmentShader:bg}),K=new be(F,ne);K.name="stencil",K.material.colorWrite=!1,K.material.stencilWrite=!0,K.material.stencilRef=1,K.material.stencilFunc=Dd,K.material.stencilZPass=zs,K.material.stencilZFail=zs,K.material.stencilFail=zs,K.material.depthWrite=!1,K.material.depthTest=!1,K.userData=e.mesh.userData,_t.add(K),_t.add(Xe),Xe.renderOrder=0,Me.renderOrder=1}if(_t.add(Me),l){let ne=new it().setFromObject(Me),K=new H;ne.getCenter(K),_t.children.forEach(Pe=>{Pe.geometry.center(),Pe.position.copy(K)})}u&&(Me.material.stencilWrite=!0,Me.material.stencilRef=1,Me.material.stencilFunc=Ed,Me.material.stencilZPass=Xs,Me.material.stencilZFail=Xs,Me.material.stencilFail=Xs,Me.material.needsUpdate=!0,Me.layers.disableAll(),Me.layers.enable(Ks.ALWAYS_ON_TOP)),F.computeBoundingBox();let Lr=new H;return F.boundingBox.getCenter(Lr),{mesh:_t,material:je,center:Lr}}a(Sg,"buildPath");var B1=.15;var F1=.5,ad=class ad extends me{constructor(r,i,n,o){super();p(this,"rendererState");p(this,"verticalDistanceDirty",!0);p(this,"convertTo3DMapPosition");p(this,"getParentContainer");p(this,"convertZoomLevelToAltitude");this.rendererState=r,this.convertTo3DMapPosition=i,this.getParentContainer=n,this.convertZoomLevelToAltitude=o}update(r,i,n,o=0){let s,l=!1;for(let u of this.rendererState.geometry3DIdsInScene)if(s=this.rendererState.geometry3DMap.get(u),s&&s.type==="path"&&s.components[0].type==="path"){let h=s.components[0],m=s.components[1],f=h.isVertical&&this.verticalDistanceDirty;if(!(h instanceof ri))continue;let b=[];if(h.dirty||m.dirty||f){if(h.mesh.parent!=null)for(let y=h.mesh.children.length-1;y>=0;y--)ze(h.mesh.children[0]);if(h.feature.features.length===2&&h.feature.features[0].properties.parentId&&h.feature.features[1].properties.parentId){let y=h.feature.features[0],_=h.feature.features[h.feature.features.length-1],T,g,x=y.geometry.coordinates[2]||0,P=_.geometry.coordinates[2]||0;y.properties.parentId&&(T=this.getParentContainer(y.properties.parentId,!0),T!=null&&T.altitude!=null&&(x+=T.altitude,h.isVertical=!0)),_.properties.parentId&&(g=this.getParentContainer(_.properties.parentId,!0),g!=null&&g.altitude!=null&&(P+=g.altitude,h.isVertical=!0));let S=this.convertTo3DMapPosition(y.geometry.coordinates[1],y.geometry.coordinates[0],x),C=this.convertTo3DMapPosition(_.geometry.coordinates[1],_.geometry.coordinates[0],P);Math.abs(S.z-C.z)>F1&&T!=null&&T.visible&&g!=null&&g.visible&&(b=[S,C])}else{let y=h.feature.features;for(let _=0;_<y.length;_++)if(_===0||!gp(y[_].geometry.coordinates,y[_-1].geometry.coordinates)){let T=this.convertTo3DMapPosition(y[_].geometry.coordinates[1],y[_].geometry.coordinates[0],y[_].geometry.coordinates[2]||0);b.push(T)}}if(b.length>1){let{mesh:y,material:_,center:T}=Sg(b,h,{color:m.color,altitude:m.altitude});h.mesh=y,h.material=_,h.position=T}h.dirty&&typeof h.width=="object"&&h.width.on==="zoom-level"&&(h.altitudeBreakpoints=h.width.input.map(y=>this.convertZoomLevelToAltitude(y))),h.dirty=!1}m.dirty&&(h.mesh.children.forEach(y=>{y.name!=="stencil"&&(y.material.uniforms.color.value.set(m.color),y.material.visible=m.visible,y.material.needsUpdate=!0)}),h.mesh.position.z=m.altitude,m.dirty=!1),h.isVertical&&h.mesh.children.forEach(y=>{y.rotation.z=-o}),h.material&&(h.mesh.children.forEach(y=>{var T,g,x,P,S,C,w;let _=y.material.uniforms;if(y.name==="stencil"){h.materialDirty&&(_.complete.value=h.completeFraction);return}if(typeof h.width=="object"&&h.width.on==="zoom-level"){h.altitudeBreakpoints&&h.altitudeBreakpoints.length>2&&te.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 k=ip(n,(g=(T=h.altitudeBreakpoints)==null?void 0:T.slice(0,2))!=null?g:[r,i]);h.breakpoint=k,_.nearZoom.value=(P=(x=h.altitudeBreakpoints)==null?void 0:x[k])!=null?P:r,_.farZoom.value=(C=(S=h.altitudeBreakpoints)==null?void 0:S[k+1])!=null?C:i,_.nearRadius.value=Number(h.width.output[k])/2,_.farRadius.value=Number((w=h.width.output[k+1])!=null?w:h.width.output[k])/2}_.cameraParameters.value.x=n,h.materialDirty&&(_.displayArrowsOnPath.value=h.displayArrowsOnPath,_.pulseColor.value.set(h.accentColor),_.complete.value=h.completeFraction,typeof h.width=="number"&&(_.nearZoom.value=r,_.farZoom.value=i,_.nearRadius.value=Number(h.width)/2,_.farRadius.value=Number(h.width)/2))}),h.displayArrowsOnPath&&h.animateArrowsOnPath&&(h.mesh.children.forEach(y=>{y.name!=="stencil"&&(y.material.uniforms.arrowAnimationTimer.value=performance.now()/3e3,y.material.needsUpdate=!0)}),l=!0),h.materialDirty=!1)}this.verticalDistanceDirty=!1,l&&this.publish("animate:path")}};a(ad,"PathSystem");var bs=ad;v();var Ze,ro,Dr,ld=class ld{constructor(e){p(this,"rendererState");p(this,"dirty",!1);L(this,Ze);L(this,ro);L(this,Dr);this.rendererState=e}updateOne(e){if(e instanceof fe&&e.components[0]instanceof Ne&&e.components[1]instanceof Kt&&e.parentObject3D instanceof xt&&(R(this,Ze,e.components[0]),R(this,Dr,e.components[1]),c(this,Ze).detached&&c(this,Ze).dirty&&c(this,Ze).mesh!=null&&c(this,Ze).material!=null&&c(this,Ze).batchedProps!=null)){R(this,ro,e.parentObject3D),c(this,Ze).visible=!1;let r=new Ee(c(this,Dr).color),i=c(this,Dr).opacity*yn(e),n=new Ui({color:r,side:Rt,opacity:i!=null?i:1,transparent:i!==void 0?i<1:!1},1,c(this,Ze).material.repeatYFactor),o=new $s(1,c(this,Ze).batchedProps.positionCount,0,n),s=zy(c(this,Ze),o);if(s==null)return;o.userData={entities:{0:e.id},detached:!0},c(this,Ze).instanceIndex=s,c(this,Ze).material.setColor(c(this,Ze).instanceIndex,r,c(this,Dr).topColor?new Ee(c(this,Dr).topColor):r),c(this,Ze).mesh=o,c(this,Ze).material=n,c(this,ro).add(o),c(this,Ze).dirty=!1}}update(){if(!this.dirty)return;let e;for(let r of this.rendererState.geometry3DIdsInScene)e=this.rendererState.geometry3DMap.get(r),this.updateOne(e);this.dirty=!1,this.cleanup()}cleanup(){R(this,Ze,void 0),R(this,ro,void 0),R(this,Dr,void 0)}};Ze=new WeakMap,ro=new WeakMap,Dr=new WeakMap,a(ld,"MeshDetachmentSystem");var Hl=ld;v();v();function Cg(t,e,r){var i;if((i=t.batchedProps)!=null&&i.range&&t.mesh){let n=e||1e-4,o=n/Math.max(r,1e-4);return El(t.mesh.geometry,t.batchedProps.range,n,0),t.material&&(t.material.repeatYFactor=o),t.currentHeight=n,!0}return!1}a(Cg,"updateHeight");function _g(t,e,r,i,n,o){return t.mesh&&t.instanceIndex!==-1?(t.mesh.getMatrixAt(t.instanceIndex,r),r.decompose(i,n,o),i.z=e,r.compose(i,n,o),t.mesh.setMatrixAt(t.instanceIndex,r),t.altitude=e,!0):!1}a(_g,"updateAltitude");var jt,dr,Vl,ql,$l,Jl,cd=class cd{constructor(e){p(this,"rendererState");p(this,"dirty",!1);L(this,jt);L(this,dr);L(this,Vl,new bt);L(this,ql,new H);L(this,$l,new pi);L(this,Jl,new H);this.rendererState=e}updateOne(e){var r;if(e instanceof fe&&e.type==="geometry"&&((r=e.components[1])!=null&&r.dirty)&&(R(this,jt,e.components[0]),R(this,dr,e.components[1]),e.type==="geometry")){let i=!1;c(this,dr).height!==c(this,jt).currentHeight&&(i=Cg(c(this,jt),c(this,dr).height,c(this,dr).initialHeight)),c(this,dr).altitude!==c(this,jt).altitude&&(i=_g(c(this,jt),c(this,dr).altitude,c(this,Vl),c(this,ql),c(this,$l),c(this,Jl))),i&&c(this,jt).mesh!=null&&c(this,jt).mesh.computeBoundingSphere()}}update(){let e;for(let r of this.rendererState.geometry3DIdsInScene)e=this.rendererState.geometry3DMap.get(r),this.updateOne(e);this.cleanup()}cleanup(){R(this,jt,void 0),R(this,dr,void 0)}};jt=new WeakMap,dr=new WeakMap,Vl=new WeakMap,ql=new WeakMap,$l=new WeakMap,Jl=new WeakMap,a(cd,"MeshModificationSystem");var Wl=cd;v();var G1={showPolygonLabelTextAreaMesh:!1,showEnvMap:!1,showCollisionBoxes:!1},ud=class ud{constructor(e){p(this,"state",G1);p(this,"core");this.core=e}update(e){let r={};for(let[i,n]of Object.entries(e))i in this.state&&this.state[i]!==e[i]&&(this.state[i]=n,r[i]=n);this.handleUpdate(r)}handleUpdate(e){e.showPolygonLabelTextAreaMesh!=null&&(e.showPolygonLabelTextAreaMesh?this.core.getSystems().text3DSystem.showTextAreaMesh():this.core.getSystems().text3DSystem.hideTextAreaMesh()),e.showEnvMap!=null&&(e.showEnvMap?this.core.setEnvironment("basic"):this.core.setEnvironment(!1)),e.showCollisionBoxes!=null&&(e.showCollisionBoxes?(this.core.getSystems().collisionSystem.showCollisionBoxes(),this.core.render()):this.core.getSystems().collisionSystem.hideCollisionBoxes())}};a(ud,"Debug");var Kl=ud;v();var xs=9,X1=!1,Pg=.1;function z1(t,e,r){for(let i=0;i<e;i++){let n=(r&16711680)>>16,o=(r&65280)>>8,s=r&255;t[i*3]=n/255,t[i*3+1]=o/255,t[i*3+2]=s/255}}a(z1,"fillArrayWithColor");var hd=class hd{constructor(e,r,i){p(this,"state");p(this,"renderer");p(this,"renderService");p(this,"pickingTexture");p(this,"pickingMaterial");p(this,"pixelBuffer");p(this,"width",0);p(this,"height",0);p(this,"scale",1/2);p(this,"color",1);p(this,"convertTo3DMapPosition");p(this,"destroyed",!1);p(this,"enabled",!1);p(this,"backgroundId",16777215);p(this,"resize",a(()=>{let e=this.state.pixelRatio;this.width=Math.floor(this.renderer.domElement.width/e*this.scale),this.height=Math.floor(this.renderer.domElement.height/e*this.scale),this.pixelBuffer=new Uint8Array(4*this.width*this.height),this.pickingTexture=new kd(this.width,this.height,{format:Gs,type:Fs,internalFormat:"RGBA"})},"resize"));p(this,"shouldShowByXY",a((e,r,i)=>{if(this.pixelBuffer==null)return!1;let n=e+(this.height-r-1)*this.width,o=this.pixelBuffer[n*4],s=this.pixelBuffer[n*4+1],l=this.pixelBuffer[n*4+2],u=o<<16|s<<8|l;return u===i||u===this.backgroundId},"shouldShowByXY"));p(this,"activeOccluders",new Set);p(this,"update",a(()=>{if(!this.enabled||this.destroyed||(this.activeOccluders.clear(),this.activeOccluders.add(this.backgroundId),!this.pickingTexture||!this.pixelBuffer))return;let e,r;for(let n of this.state.geometry3DIdsInScene){let o=this.state.geometry3DMap.get(n);if(o&&o instanceof Ie&&o.userData.occluderFeature!=null&&o.userData.occluderId!=null&&(this.activeOccluders.add(o.userData.occluderId),o.userData.occluderDirty)){if(e=o.userData.occluderFeature,e.geometry.type==="Polygon"){let s=dl(e,this.convertTo3DMapPosition,{color:"white",height:Pg});r=this.createOccluderMesh(s,o.userData.occluderId),o.add(r)}else if(e.geometry.type==="MultiPolygon"){let s=pl(e,this.convertTo3DMapPosition,{color:"white",height:Pg});r=this.createOccluderMesh(s,o.userData.occluderId),o==null||o.add(r)}o.userData.occluderDirty=!1}}this.renderer.setRenderTarget(this.pickingTexture);let i=new Ee(this.backgroundId);this.renderer.setClearColor(i),this.renderer.clear(),this.state.cameraObject.layers.disableAll(),this.state.cameraObject.layers.enable(xs),this.renderer.render(this.state.entityScene.parent,this.state.cameraObject),this.renderer.setRenderTarget(null),this.state.cameraObject.layers.disable(xs),X1?this.renderService.enabledLayers.add(xs):this.renderService.enabledLayers.delete(xs),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),u=Math.floor(s.y*this.scale),h=this.shouldShowByXY(l,u,o.occluderId);o.components[0].isOccluded=!h}}}).catch(n=>{this.destroyed||te.error(n)})},"update"));if(this.state=e,this.convertTo3DMapPosition=r,(i==null?void 0:i.renderer)==null)throw new Error("No Renderer");this.renderService=i,this.renderer=i.renderer,this.resize(),this.pickingMaterial=new Rr({glslVersion:Od,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(e,r){let i=e.attributes.position,n=new Float32Array(i.count*3);z1(n,i.count,r),e.setAttribute("color",new ct(n,3))}createOccluderMesh(e,r){let i=new be(e,this.pickingMaterial);return i.layers.set(xs),this.applyId(i.geometry,r),i.userData.occluderId=r,i}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){var e;this.destroyed=!0,(e=this.pickingTexture)==null||e.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};a(hd,"Occlusion2DSystem");var Ql=hd;v();var dd=class dd{constructor(e){this.state=e;p(this,"dirty",!0)}update(){var e;if(this.dirty){for(let r of this.state.geometry3DIdsInScene){let i=this.state.geometry3DMap.get(r);if(i instanceof fe&&i.type==="geometry"&&((e=i.components[0])==null?void 0:e.geometry)!=null){let n=i.components[0];n.geometry&&(n.geometry.dispose(),n.geometry=void 0)}}this.dirty=!1}}};a(dd,"GeometryDisposalSystem");var ec=dd;var Tg=new qt;var{DEFAULT_PITCH:ey,DEFAULT_BEARING:ty,DEFAULT_ZOOM_LEVEL:ry,DEFAULT_MIN_ZOOM_LEVEL:Y1,DEFAULT_MAX_ZOOM_LEVEL:Z1}=Dt,U1=ue.radToDeg(.6435011087932844),Be,Re,on,Ss,io,li,sn,no,ot,md,D,At,an,Ce,Ht,Fe,kt,tt,M,Cs,Je,we,wg,Mg,Ig,Or,_s,Ps,Ts,ws,oo,tc,Ms,Is,Es,ln,fd,cn,Ds,Os,mt,ft,yd,rc,ic,so,Ls,gd=class gd extends me{constructor(r,i={}){var _,T,g,x,P,S,C,w,k,A,N,Y,z,X,q;super();L(this,ot);p(this,"options");p(this,"container");p(this,"Debug");L(this,Be);L(this,Re);L(this,on);L(this,Ss);L(this,io);L(this,li);L(this,sn);L(this,no);p(this,"rendererDomElement");L(this,D,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,entityScene:new Ie("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:Js,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new Za,externalTweenGroup:new Za,cameraObject:new sc,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1});L(this,At,{});L(this,an,new AbortController);p(this,"camera");L(this,Ce);L(this,Ht);L(this,Fe);L(this,kt);L(this,tt);L(this,M,{});L(this,Cs,window.matchMedia("screen and (min-resolution: 2dppx)"));p(this,"map");L(this,Je,a(()=>{var r;this.aborted||!((r=c(this,M))!=null&&r.renderSystem)||(c(this,M).renderSystem.twoDdirty=!0)},"#invalidate2DEntities"));L(this,we,a(()=>{var r;this.aborted||!((r=c(this,M))!=null&&r.renderSystem)||(c(this,M).renderSystem.threeDdirty=!0)},"#invalidate3DEntities"));L(this,Or,"standalone");L(this,_s,a(()=>{c(this,M).geometryDisposalSystem.dirty=!0,this.render()},"#setGeometryDisposalDirty"));L(this,Ps,a(r=>Math.trunc(r*10)/10,"#round10"));L(this,Ts,a(()=>{_e(this,ot,md).call(this,ho()),c(this,M).twoDDrawSystem.dirty=!0,c(this,oo).call(this,void 0,void 0,!0)},"#handlePixelRatioChange"));L(this,ws,a(()=>{c(this,oo).call(this)},"#handleWindowResizeWithEvent"));L(this,oo,a((r,i,n=!1)=>{let o=r!=null?r:this.rendererDomElement.clientWidth,s=i!=null?i:this.rendererDomElement.clientHeight;if((o===0||s===0)&&!n)return;c(this,D).canvasWidth=o,c(this,D).canvasHeight=s,_e(this,ot,md).call(this,ho()),c(this,ln).call(this),_e(this,ot,Ig).call(this),c(this,M).cameraSystem.resize(this.canvasWidth,this.canvasHeight),c(this,M).cameraSystem.dirty=!0,c(this,M).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),c(this,M).htmlControlsSystem.resize(this.canvasWidth),c(this,M).geometryInFocusSystem.resize(),c(this,M).occlusion2DSystem.resize();let{top:l,left:u}=this.container.getBoundingClientRect();c(this,D).containerOffset=[l,u],this.publish("resize"),this.render()},"#handleWindowResize"));L(this,tc,a(()=>{this.renderSync()},"#renderFull"));L(this,Ms,new H);L(this,Is,a((r,i)=>{let n=this.mode==="standalone"?c(this,Re):this.viewCamera;if(c(this,Re).position.z+this.camera.elevation>i.z){c(this,Ms).copy(i);let o=c(this,Ms).project(n),s=(o.x+1)/2*this.canvasWidth-0/2,l=(-o.y+1)/2*this.canvasHeight-0/2,u=c(this,Ps).call(this,s),h=c(this,Ps).call(this,l);r.x=u,r.y=h}else r.x=-1e3,r.y=-1e3},"#project"));L(this,Es,a((r,i)=>{c(this,tt).setBufferSize(r,i),c(this,Re).aspect=r/i,c(this,Re).updateProjectionMatrix(),c(this,Re).updateMatrixWorld(!0),c(this,io).x=r,c(this,io).y=i},"#setBufferSize"));L(this,ln,a(()=>{var s;let r=c(this,D).canvasWidth=this.rendererDomElement.clientWidth,i=c(this,D).canvasHeight=this.rendererDomElement.clientHeight,n=Math.floor(r*this.resolutionScale),o=Math.floor(i*this.resolutionScale);c(this,Es).call(this,n,o),(s=this.map)==null||s.resize(),c(this,D).shouldMeasureCanvas=!1},"#measureCanvas"));p(this,"getParentContainer",a((r,i=!0)=>{if(!r)return i?c(this,D).entityScene:void 0;if(typeof r=="string"||typeof r=="number"){let n=c(this,D).geometry3DMap.get(r);return n instanceof Ie?n:(te.warn("Parent (".concat(typeof r=="object"?r.id:r,") is not a valid container, adding to scene")),i?c(this,D).entityScene:void 0)}else if(r.type==="group-container"){let n=c(this,D).geometry3DMap.get(r.id);if(n instanceof Ie)return n}return i?c(this,D).entityScene:void 0},"getParentContainer"));p(this,"showCollisionBoxes",a(()=>{c(this,M).collisionSystem.showCollisionBoxes(),this.render()},"showCollisionBoxes"));p(this,"hideCollisionBoxes",a(()=>{c(this,M).collisionSystem.hideCollisionBoxes(),this.render()},"hideCollisionBoxes"));p(this,"projectScreenXYToCoordinate",a((r,i,n=!1)=>{var f,b;let o=this.container.getBoundingClientRect(),s=(r-o.left)/c(this,D).canvasWidth*2-1,l=-((i-o.top)/c(this,D).canvasHeight)*2+1,u=new ae(s,l),h,m;if(n)Tg.setFromCamera(u,c(this,Re)),h=(f=Tg.intersectObject(c(this,li),!1)[0])==null?void 0:f.point;else{let y=c(this,M).interactionSystem.getThreeDIntersectsFromXY(u);h=(b=y==null?void 0:y[0])==null?void 0:b.point,m=c(this,M).interactionSystem.getGroupContainerIntersectsFromXY(u)}if(h)return{coordinate:this.convert3DMapPositionToCoordinate(h),groupContainers:m}},"projectScreenXYToCoordinate"));p(this,"projectCoordinateToScreenXY",a(r=>{let i=this.convertTo3DMapPosition(r[1],r[0],r[2]||0),n=new ae;return c(this,Is).call(this,n,i),{x:n.x,y:n.y}},"projectCoordinateToScreenXY"));p(this,"convert3DMapPositionToCoordinate",a(r=>{var o,s,l,u;let{lat:i,lon:n}=ea((s=(o=c(this,D).center)==null?void 0:o[1])!=null?s:0,(u=(l=c(this,D).center)==null?void 0:l[0])!=null?u:0,r.x,r.y);return[n,i,r.z]},"convert3DMapPositionToCoordinate"));p(this,"setBackgroundColor",a((r,i)=>{c(this,tt).setBackgroundColor(r,i)},"setBackgroundColor"));p(this,"getMetresPerPixel",a(()=>{let r=this.container.clientWidth,i=this.container.clientHeight/2,n=this.projectScreenXYToCoordinate(0,i,!0),o=this.projectScreenXYToCoordinate(r,i,!0);return n==null||o==null?void 0:Jd(n.coordinate,o.coordinate)/r},"getMetresPerPixel"));p(this,"hideOutdoorLayersUnderPoint",a((r,i)=>{!this.map||(i==null?void 0:i.length)===0||(c(this,M).outdoorLayersSystem.hideLayersUnderPoint(r,i),this.render())},"hideOutdoorLayersUnderPoint"));p(this,"hideOutdoorLayersIntersectingPolygons",a((r,i,n)=>{c(this,M).outdoorLayersSystem.hideLayersIntersectingPolygons(r,i,n),this.render()},"hideOutdoorLayersIntersectingPolygons"));L(this,cn,new Fd);L(this,Ds,new bt);L(this,Os,a(r=>{var i;te.error("Render failed: ",r,(i=r.stack)!=null?i:"No stack trace available"),this.publish("render-error",{error:r})},"#onRenderError"));p(this,"render",a(()=>{var r;if(!(((r=c(this,M))==null?void 0:r.renderSystem)==null||this.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return c(this,M).renderSystem.update().catch(c(this,Os))},"render"));p(this,"renderSync",a(()=>this.aborted?Promise.resolve():c(this,M).renderSystem.update(!0).catch(c(this,Os)),"renderSync"));L(this,mt,po(()=>{this.publish("user-interaction-start",void 0)},0,!0));L(this,ft,po(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0));p(this,"on",a((r,i)=>{this.aborted||(super.on(r,i),["outdoor-view-loaded","outdoor-style-loaded"].includes(r)&&this.mode==="standalone"&&E.env.NODE_ENV!=="test"&&(te.warn('"'.concat(r,'" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.')),this.publish(r)))},"on"));p(this,"off",a((r,i)=>{super.off(r,i)},"off"));p(this,"getCursor",a(()=>c(this,M).interactionSystem.getCursor(),"getCursor"));L(this,rc,a(()=>{if(c(this,D).entityScene.removeEventListener("childadded",c(this,we)),c(this,D).entityScene.removeEventListener("childadded",c(this,Je)),c(this,D).entityScene.removeEventListener("childremoved",c(this,we)),c(this,D).entityScene.removeEventListener("childremoved",c(this,Je)),window.removeEventListener("resize",c(this,ws),!1),c(this,Cs).removeEventListener("change",c(this,Ts)),this.map){for(let r in c(this,At))for(let i of c(this,At)[r])this.map.off(r,i);R(this,At,{})}this._subscribers={}},"#cleanupEventListeners"));L(this,ic,a(()=>{try{c(this,Or)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container&&(c(this,kt)&&this.container.contains(c(this,kt))&&this.container.removeChild(c(this,kt)),c(this,Ce)&&this.container.contains(c(this,Ce))&&this.container.removeChild(c(this,Ce)))}catch(r){te.warn("Error during DOM cleanup, some elements may not have been removed:",r)}},"#cleanupDOMElements"));p(this,"destroy",a(()=>{var r;c(this,M)&&(this.aborted||c(this,an).abort(),c(this,rc).call(this),this.remove("__scene"),c(this,M).renderSystem.destroy(),c(this,M).cameraSystem.dispose(),c(this,M).exporterSystem.destroy(),c(this,M).outdoorLayersSystem.destroy(),c(this,M).drawSystem.destroy(),c(this,sn)&&c(this,sn).disconnect(),c(this,tt).destroy(),(r=c(this,Be))==null||r.traverse(i=>{ze(i),"dispose"in i&&typeof i.dispose=="function"&&i.dispose()}),R(this,Be,void 0),c(this,M).htmlControlsSystem.destroy(),c(this,M).collisionSystem.destroy(),c(this,M).interactionSystem.destroy(),c(this,M).domMutationSystem.destroy(),c(this,M).geometryInFocusSystem.destroy(),c(this,M).occlusion2DSystem.destroy(),R(this,M,void 0),c(this,ic).call(this),R(this,tt,void 0))},"destroy"));L(this,so,new H);L(this,Ls,new H);if(R(this,an,new AbortController),c(this,D).useStandaloneCamera=(_=i.useStandaloneCamera)!=null?_:!1,c(this,D).naturalBearing=(T=i.naturalBearing)!=null?T:0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!r.clientWidth||!r.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(i.mode==="outdoors-interleaved"||i.mode==="outdoors-overlay")&&i.map&&(R(this,Or,i.mode),this.map=i.map),c(this,D).entityScene.addEventListener("childadded",()=>{c(this,we).call(this),c(this,Je).call(this)}),c(this,D).entityScene.addEventListener("childremoved",()=>{c(this,we).call(this),c(this,Je).call(this)}),c(this,D).geometry3DMap.set(c(this,D).entityScene.userData.entityId,c(this,D).entityScene),i.center&&(c(this,D).center=i.center?[...i.center]:[0,0]),this.options=i,this.container=r,_e(this,ot,wg).call(this),_e(this,ot,Mg).call(this),c(this,M).htmlControlsSystem=new Ya(this.container,{outdoorEnabled:!!this.map}),c(this,Or)!=="outdoors-overlay"&&c(this,M).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),E.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),R(this,tt,new na({antialias:typeof i.antialias=="boolean"?i.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?(g=i.gl)==null?void 0:g.canvas:void 0,onWebGLContextCreationError:i.onWebGLContextCreationError,onWebGLContextLost:i.onWebGLContextLost,onWebGLContextRestored:a(F=>{var J;(J=i.onWebGLContextRestored)==null||J.call(i,F),c(this,Je).call(this),c(this,we).call(this),this.render()},"onWebGLContextRestored"),onWebGLRendererError:i.onWebGLRendererError,backgroundColor:i.backgroundColor||"#ffffff",backgroundAlpha:(x=i.backgroundAlpha)!=null?x:1})),R(this,Be,new Nr),c(this,Or)!=="standalone"&&c(this,Be).add(vp()),c(this,Be).add(c(this,D).entityScene);let n=window.__THREE_DEVTOOLS__;E.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:c(this,Be)})),n.dispatchEvent(new CustomEvent("observe",{detail:c(this,tt)}))),R(this,Re,new sc(U1,this.aspect,50,1e5)),c(this,D).cameraObject=c(this,Re),R(this,Ss,new Nd),c(this,Re).renderOrder=999;let o=new fr;o.add(c(this,Re)),R(this,no,new fr),c(this,no).add(o),c(this,Be).add(c(this,no)),c(this,Re).updateProjectionMatrix(),c(this,Re).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=c(this,tt).domElement(),R(this,io,new ae);let s=new Nt(1e6,1e6),l=new st({color:0,visible:!1});R(this,li,new be(s,l)),c(this,li).name="worldPlane",c(this,Be).add(c(this,li)),(P=i.gl)!=null&&P.canvas||r.appendChild(this.rendererDomElement),window.addEventListener("resize",c(this,ws),!1),c(this,Cs).addEventListener("change",c(this,Ts)),typeof ResizeObserver=="function"&&((S=E.env)==null?void 0:S.NODE_ENV)!=="test"&&(R(this,sn,new ResizeObserver(wd(F=>{c(this,oo).call(this,F[0].contentRect.width,F[0].contentRect.height)},50))),(C=c(this,sn))==null||C.observe(r)),r.classList.add("mappedin-map"),this.rendererDomElement.style.width=(w=globalThis.MappedinDebug)!=null&&w.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=(k=globalThis.MappedinDebug)!=null&&k.TEST_IOS?"1920px":"100%",E.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),c(this,D).canvasWidth=this.rendererDomElement.clientWidth,c(this,D).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let u=this.canvasWidth,h=this.canvasHeight;c(this,M).watermarkSystem=new Pl(c(this,Re),c(this,D),i==null?void 0:i.watermark),c(this,M).watermarkSystem.on("texture-loaded",this.render),c(this,D).shouldMeasureCanvas=!0,c(this,D).pixelRatio=this.resolutionScale,c(this,Es).call(this,Math.floor(u*this.resolutionScale),Math.floor(h*this.resolutionScale));let m=new Hs(16777215,.3*Math.PI);m.position.set(-150,-150,350),c(this,Be).add(m);let f=new Yd(16777215,.741*Math.PI);c(this,Be).add(f),c(this,M).cameraSystem=new jn(c(this,Re),c(this,Be),c(this,tt).renderer,c(this,D),{mode:this.mode,canvasHeight:h,canvasWidth:u}),c(this,M).cameraSystem.on("user-dolly-start",c(this,mt)),c(this,M).cameraSystem.on("user-pan-start",c(this,mt)),c(this,M).cameraSystem.on("user-rotate-start",c(this,mt)),c(this,M).cameraSystem.on("user-zoom-start",c(this,mt)),c(this,M).cameraSystem.on("user-tilt-start",c(this,mt)),c(this,M).cameraSystem.on("user-pedestal-start",c(this,mt)),c(this,M).cameraSystem.on("user-dolly-end",c(this,ft)),c(this,M).cameraSystem.on("user-pan-end",c(this,ft)),c(this,M).cameraSystem.on("user-rotate-end",c(this,ft)),c(this,M).cameraSystem.on("user-zoom-end",c(this,ft)),c(this,M).cameraSystem.on("user-tilt-end",c(this,ft)),c(this,M).cameraSystem.on("user-pedestal-end",c(this,ft)),c(this,M).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),c(this,M).geometryInFocusSystem&&(c(this,M).geometryInFocusSystem.cameraDirty=!0),this.render()}),this.onAbort(()=>{c(this,M).cameraSystem.off("user-dolly-start",c(this,mt)),c(this,M).cameraSystem.off("user-pan-start",c(this,mt)),c(this,M).cameraSystem.off("user-rotate-start",c(this,mt)),c(this,M).cameraSystem.off("user-zoom-start",c(this,mt)),c(this,M).cameraSystem.off("user-tilt-start",c(this,mt)),c(this,M).cameraSystem.off("user-pedestal-start",c(this,mt)),c(this,M).cameraSystem.off("user-dolly-end",c(this,ft)),c(this,M).cameraSystem.off("user-pan-end",c(this,ft)),c(this,M).cameraSystem.off("user-rotate-end",c(this,ft)),c(this,M).cameraSystem.off("user-zoom-end",c(this,ft)),c(this,M).cameraSystem.off("user-tilt-end",c(this,ft)),c(this,M).cameraSystem.off("user-pedestal-end",c(this,ft)),c(this,M).renderSystem.off("measure-canvas",c(this,ln)),c(this,M).cameraSystem.off("change",this.render)}),c(this,M).pathSystem=new bs(c(this,D),this.convertTo3DMapPosition,this.getParentContainer,c(this,M).cameraSystem.convertZoomLevelToAltitude),c(this,M).pathSystem.on("animate:path",this.render),this.onAbort(()=>{c(this,M).pathSystem.off("animate:path",this.render)}),c(this,M).panBoundsSystem=new Ml(c(this,D),c(this,M).cameraSystem);let b=a(()=>{let{panBounds:F,fov:J,convertAltitudeToZoomLevel:pe}=c(this,M).cameraSystem;if(c(this,M).panBoundsSystem.autoMinZoomLevel){if(F.radius<=0)return;let se=Math.min(c(this,D).canvasWidth/c(this,D).canvasHeight,1),De=J*Math.PI/180*se,ve=Math.tan(De/2),{radius:ge,center:xe}=c(this,M).cameraSystem.panBounds,rt=ge/ve,Ge=this.getThreeCamera().getWorldPosition(new H),Ue=xe.distanceTo(Ge),je=Math.abs(Ge.z-xe.z),Me=rt*je/Ue,Xe=pe(Me);yp(Xe,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(Xe)}this.publish("pan-bounds-change",c(this,M).cameraSystem.panBounds)},"handlePanBoundsUpdate");c(this,M).panBoundsSystem.on("update",b),this.onAbort(()=>{c(this,M).panBoundsSystem.off("update",b)}),this.camera=new Qa(this,c(this,M),c(this,D)),this.camera.setZoomLevel((A=i.zoomLevel)!=null?A:ry),this.camera.setBearing((N=i.bearing)!=null?N:ty),this.camera.setPitch((Y=i.pitch)!=null?Y:ey),this.camera.setMaxZoomLevel(Z1),this.camera.setMinZoomLevel(Y1),c(this,M).domVisiblitySystem=new yl(c(this,D),c(this,kt)),c(this,M).domMutationSystem=new _l(c(this,D),c(this,kt)),c(this,M).domMutationSystem.on("dimensions-update",()=>{c(this,M).collisionSystem.collidersDirty=!0,this.render()}),c(this,M).domDrawSystem=new Cl(c(this,D)),c(this,M).collisionSystem=new el(c(this,Ht),c(this,D),((z=i.useCollisionWorker)!=null?z:!0)&&((X=i.useWorkers)!=null?X:!0)),c(this,M).twoDDrawSystem=new vl(c(this,D),c(this,Fe),i.transformImageRequest),c(this,M).twoDDrawSystem.on("img:loaded",this.render),c(this,M).interactionSystem=new Wo(this.rendererDomElement,c(this,D),c(this,Re),c(this,li),c(this,M).cameraSystem.isUserInteracting),c(this,M).interactionSystem.on("doubletap-with-onefinger",F=>{var J;c(this,M).cameraSystem.enableZoom&&this.camera.animateTo({center:(J=this.projectScreenXYToCoordinate(F.clientX,F.clientY))==null?void 0:J.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:mc,easing:"ease-out"})}),c(this,M).interactionSystem.on("singletap-with-twofinger",()=>{c(this,M).cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:mc,easing:"ease-out"})}),c(this,M).interactionSystem.on("hover",this.render),c(this,M).interactionSystem.on("click",F=>{var pe,se,De,ve,ge,xe,rt,Ge,Ue,je,Me,Xe;if(((pe=F.entity2D)==null?void 0:pe.id)==="watermark"&&typeof c(this,M).watermarkSystem.options.onClick=="function"&&c(this,M).watermarkSystem.options.interactive){c(this,M).watermarkSystem.options.onClick();return}let J=F.entity3D?[(se=F.entity3D)==null?void 0:se.id]:[];(ge=(ve=(De=F.entity3D)==null?void 0:De.parentObject3D)==null?void 0:ve.userData)!=null&&ge.entityId&&J.push((Ge=(rt=(xe=F.entity3D)==null?void 0:xe.parentObject3D)==null?void 0:rt.userData)==null?void 0:Ge.entityId),this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(F.position),geometry:J,paths:((Ue=F.entity3D)==null?void 0:Ue.components[0])instanceof ri?[F.entity3D.id]:[],markers:((je=F.entity2D)==null?void 0:je.components[0])instanceof nr?[F.entity2D.id]:[],models:((Me=F.entity3D)==null?void 0:Me.components[0])instanceof Qr?[F.entity3D.id]:[],labels:((Xe=F.entity2D)==null?void 0:Xe.components[0])instanceof rr?[F.entity2D.id]:[],containers:Array.isArray(F.groupContainers)?F.groupContainers.map(Ke=>Ke.userData.entityId):[],pointerEvent:F.pointerEvent})}),c(this,M).interactionSystem.on("hover",F=>{var J,pe,se,De,ve;F.position&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(F.position),geometry:F.entity3D?[(J=F.entity3D)==null?void 0:J.id]:[],paths:((pe=F.entity3D)==null?void 0:pe.components[0])instanceof ri?[F.entity3D.id]:[],markers:((se=F.entity2D)==null?void 0:se.components[0])instanceof nr?[F.entity2D.id]:[],models:((De=F.entity3D)==null?void 0:De.components[0])instanceof Qr?[F.entity3D.id]:[],labels:((ve=F.entity2D)==null?void 0:ve.components[0])instanceof rr?[F.entity2D.id]:[],containers:Array.isArray(F.groupContainers)?F.groupContainers.map(ge=>ge.userData.entityId):[]})}),c(this,M).geometryInFocusSystem=new Bl(c(this,D),c(this,Re));let y=a(F=>{this.publish("geometry-in-focus",F)},"handleGeometryInFocus");c(this,M).geometryInFocusSystem.on("geometry-in-focus",y),this.onAbort(()=>{c(this,M).geometryInFocusSystem.off("geometry-in-focus",y)}),c(this,M).twoDVisiblitySystem=new xl(c(this,D)),c(this,M).drawSystem=new bl(c(this,D),this.convertTo3DMapPosition),c(this,M).drawSystem.on("texture-loaded",this.render),c(this,M).twoDProjectionSystem=new gl(c(this,D),c(this,Is)),c(this,M).exporterSystem=new Vo(c(this,D)),c(this,M).meshOptimizationSystem=new fl(c(this,D),this.convertTo3DMapPosition),c(this,M).meshOptimizationSystem.on("model-loaded",this.render),c(this,M).meshOptimizationSystem.on("geometry-2d-added",this.render),c(this,M).meshOptimizationSystem.on("geometry-group-added",c(this,_s)),this.onAbort(()=>{c(this,M).meshOptimizationSystem.off("model-loaded",this.render),c(this,M).meshOptimizationSystem.off("geometry-2d-added",this.render),c(this,M).meshOptimizationSystem.off("geometry-group-added",c(this,_s))}),c(this,M).meshDetachmentSystem=new Hl(c(this,D)),c(this,M).meshModificationSystem=new Wl(c(this,D)),c(this,M).geometryDisposalSystem=new ec(c(this,D)),c(this,M).customGeometrySystem=new Il(c(this,D),this.convertTo3DMapPosition),c(this,M).outlineInterpolationSystem=new Ol(c(this,D)),c(this,M).renderSystem=new Sl(c(this,tt),c(this,D),this.mode,c(this,Be),c(this,Re),this.viewCamera,c(this,M)),c(this,M).imageSystem=new Nl(c(this,D),this.convertTo3DMapPosition,i.bearing,i.naturalBearing,i.imagePlacementOptions),c(this,M).text3DSystem=new Ra(c(this,D),this.convertTo3DMapPosition,(q=i.useWorkers)!=null?q:!0),c(this,M).text3DSystem.on("render",this.render),c(this,M).imageSystem.on("image-loaded",this.render),c(this,M).renderSystem.on("pre-render",()=>this.publish("pre-render")),c(this,M).renderSystem.on("post-render",()=>this.publish("post-render")),c(this,M).renderSystem.on("measure-canvas",c(this,ln)),this.onAbort(()=>{c(this,M).renderSystem.off("pre-render",()=>this.publish("pre-render")),c(this,M).renderSystem.off("post-render",()=>this.publish("post-render")),c(this,M).renderSystem.off("measure-canvas",c(this,ln))}),c(this,M).outdoorLayersSystem=new Zl(this.map),c(this,M).occlusion2DSystem=new Ql(c(this,D),this.convertTo3DMapPosition,c(this,tt)),i.occlusionEnabled&&c(this,M).occlusion2DSystem.enable(),this.Debug=new Kl(this),i.environment!==!1&&R(this,on,_e(this,ot,yd).call(this)),c(this,tc).call(this)}get viewCamera(){return c(this,Ss)}get canvasWidth(){return c(this,D).canvasWidth}get canvasHeight(){return c(this,D).canvasHeight}get resolutionScale(){var r,i;return(i=(r=this.map)==null?void 0:r._getClampedPixelRatio(this.canvasWidth,this.canvasHeight))!=null?i:ho()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return c(this,Or)}addGroupContainer(r,i,n){if(!c(this,D).geometry3DMap.has(r)&&!c(this,D).geometry2DMap.has(r)){let o=new Ie(r);o.addEventListener("childadded",()=>{c(this,we).call(this),c(this,Je).call(this)}),o.addEventListener("childremoved",()=>{c(this,we).call(this),c(this,Je).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&&et(o,i.interactive,c(this,D)),(i==null?void 0:i.focusable)!==void 0&&Xa(o,i.focusable),(i==null?void 0:i.preloadGeometry)!==void 0&&(o.userData.preloadGeometry=i.preloadGeometry),c(this,D).geometry3DMap.set(r,o);let s=this.getParentContainer(n);s instanceof Ie&&s.addEntity(o),c(this,we).call(this),this.render()}else te.error("Group container with ID '".concat(r,"' already exists. The group container cannot be added."));return{id:r,type:"group-container"}}addCustomGeometry(r,i,n,o,s){if(c(this,D).geometry3DMap.has(r))te.error("Custom geometry with ID '".concat(r,"' already exists. The custom geometry cannot be added."));else{let l=new Jn(i,n),u=new fe(l,new Kt(o));(o==null?void 0:o.interactive)!==void 0&&et(u,o.interactive,c(this,D)),u.id=r,l.mesh.userData={entityId:r,type:"custom-geometry"},c(this,D).geometry3DMap.set(u.id,u);let h=this.getParentContainer(s);s&&h instanceof Ie?h.addEntity(u):c(this,D).entityScene.addEntity(u),c(this,we).call(this),this.render()}return{id:r,type:"custom-geometry"}}addGeometryGroup(r,i,n,o){var s,u;if(!c(this,D).geometry3DMap.has(r)&&!c(this,D).geometry2DMap.has(r)){let h=new xt(r);h.addEventListener("childadded",()=>{c(this,we).call(this),c(this,Je).call(this)}),h.addEventListener("childremoved",()=>{c(this,we).call(this),c(this,Je).call(this)}),h.userData.dirty=!0,c(this,D).geometry3DMap.set(r,h);for(let f of i.features){if(f.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(f.geometry.type))continue;let b=(f==null?void 0:f.id)||((s=f==null?void 0:f.properties)==null?void 0:s.id)||Jt(),l=n||{color:op},{visible:y,altitude:_}=l,T=_d(l,["visible","altitude"]),g=c(this,M).meshOptimizationSystem.createEntityFromFeature(b,f,O({outline:!0},T));c(this,D).geometry3DMap.set(b,g),h.userData.entities3D.add(b)}h.setVisible((u=n==null?void 0:n.visible)!=null?u:!0),(n==null?void 0:n.altitude)!=null&&h.setAltitude(n.altitude);let m=this.getParentContainer(o);m instanceof Ie&&m.addEntity(h),c(this,we).call(this),this.render()}else te.error("Geometry group with ID '".concat(r,"' already exists. The geometry group cannot be added."));return c(this,M).outlineInterpolationSystem.geometries3DDirty=!0,{id:r,type:"geometry-group"}}addOccluder(r,i){let n=this.getParentContainer(i),o=c(this,M).occlusion2DSystem.reserveOccluderId();return n==null||n.addOccluderFeature(r,o),o}addImage(r,i,n,o){try{Uy(r,i,n)}catch(s){te.error(s);return}if(!c(this,D).geometry3DMap.has(r)&&!c(this,D).geometry2DMap.has(r)){let s=new Rl(i),l=new fe(s,new Kt(n));l.id=r||Jt(),s.mesh.userData={entityId:l.id,type:"path"},c(this,D).geometry3DMap.set(l.id,l);let u=this.getParentContainer(o);u instanceof Ie&&u.addEntity(l),c(this,we).call(this),this.render()}else te.error("Image with ID '".concat(r,"' already exists. The image cannot be added."));return{id:r,type:"image"}}addModelGroup(r,i,n,{parent:o,onComplete:s}={}){var l,u;try{Cy(r,i,n)}catch(h){te.error(h);return}if(!c(this,D).geometry3DMap.has(r)&&!c(this,D).geometry2DMap.has(r)){let h=new xt(r);h.addEventListener("childadded",()=>{c(this,we).call(this),c(this,Je).call(this)}),h.addEventListener("childremoved",()=>{c(this,we).call(this),c(this,Je).call(this)}),c(this,D).geometry3DMap.set(r,h),h.userData.dirty=!0,h.userData.modelURL=n.url;for(let f of i.features){let b=f.id||f.properties.id||Jt(),y=c(this,M).meshOptimizationSystem.createModelFromFeature(b,f,O({},n));(f.properties.interactive!==void 0||n.interactive!=null)&&et(y,(l=f.properties.interactive)!=null?l:n.interactive,c(this,D)),y.parentId=h.userData.entityId,c(this,D).geometry3DMap.set(b,y),h.userData.entities3D.add(b)}let m=this.getParentContainer(o);m instanceof Ie&&m.addEntity(h),c(this,we).call(this),(u=this.render())==null||u.then(s)}else te.error("Model group with ID '".concat(r,"' already exists. The model group cannot be added."));return{id:r,type:"geometry-group"}}addMarker2D(r,i,n,o){var l;let s=n==null?void 0:n.id;try{gf(r,i,n||{})}catch(u){te.error(u);return}if(s===void 0||!c(this,D).geometry2DMap.has(s)&&!c(this,D).geometry3DMap.has(s)){let u=_e(this,ot,fd).call(this,r,new nr(i,n),n==null?void 0:n.occluderId,n==null?void 0:n.verticalOffset);u.id=s||String(u.id),s=u.id,(n==null?void 0:n.interactive)!=null&&n.interactive!=="pointer-events-auto"&&et(u,n==null?void 0:n.interactive,c(this,D));let h=typeof(n==null?void 0:n.attachTo)=="string"||typeof(n==null?void 0:n.attachTo)=="number"?c(this,D).geometry3DMap.get(n.attachTo):void 0;h instanceof fe&&h.attach(u),(l=this.getParentContainer(o))==null||l.addEntity(u),this.render()}else te.error("Marker2D with ID '".concat(s,"' already exists. The marker cannot be added."));return{id:s,type:"marker"}}addText3D(r,i,n,o){if(!c(this,D).geometry3DMap.has(r)&&!c(this,D).geometry2DMap.has(r)){let s=new Vr(j(O({},i),{properties:j(O({},i.properties),{id:r,content:i.properties.text})})),l=new fe(s,new mo(n==null?void 0:n.appearance));l.id=r,s.mesh.userData.entityId=r.toString(),s.mesh.userData.type="text3d",c(this,D).geometry3DMap.set(r,l);let u=this.getParentContainer(o);u instanceof Ie&&u.addEntity(l),c(this,we).call(this),this.render()}else te.error("Text3D with ID '".concat(r,"' already exists. The text3d cannot be added."));return{id:r,type:"text3d"}}labelText3D(r,i,n={}){var h,m;try{if(!i||!r)throw new Error("content and meshGeometryId are required");Cf.parse(n)}catch(f){te.error(f);return}let o=c(this,D).geometry3DMap.get(r);if((o==null?void 0:o.type)!=="geometry"){te.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=c(this,D).geometry3DMap.get(s.textEntityId);if((f==null?void 0:f.type)!=="text3d"){te.error(".labelText3D failed: existing text3d not found");return}return{id:f.id,type:f.type}}let l=new Vr({type:"Feature",geometry:{coordinates:(h=s.feature.properties.textArea)==null?void 0:h.position,type:"Point"},properties:{textArea:s.feature.properties.textArea,content:i,id:Jt()}});l.polygonEntityId=r;let u=new fe(l,new mo(n==null?void 0:n.appearance));return s.textEntityId=u.id.toString(),l.mesh.userData.entityId=u.id.toString(),l.mesh.userData.type="text3d",c(this,D).geometry3DMap.set(u.id.toString(),u),n.parentId&&((m=this.getParentContainer(n.parentId))==null||m.addEntity(u)),this.render(),{id:u.id,type:"text3d"}}addLabel2D(r,i,n,o){var l;let s=n==null?void 0:n.id;try{Lm(r,i,n||{})}catch(u){te.error(u);return}if(s===void 0||!c(this,D).geometry2DMap.has(s)&&!c(this,D).geometry3DMap.has(s)){let u=_e(this,ot,fd).call(this,r,new rr(i,n||{},c(this,D)),n==null?void 0:n.occluderId,n==null?void 0:n.verticalOffset);u.id=s||String(u.id),s=u.id,(n==null?void 0:n.interactive)!=null&&et(u,n==null?void 0:n.interactive,c(this,D));let h=typeof(n==null?void 0:n.attachTo)=="string"||typeof(n==null?void 0:n.attachTo)=="number"?c(this,D).geometry3DMap.get(n.attachTo):void 0;h instanceof fe&&h.attach(u),(l=this.getParentContainer(o))==null||l.addEntity(u),c(this,Je).call(this),this.render()}else te.error("Label2D with ID '".concat(s,"' already exists. The label cannot be added."));return{id:s,type:"label"}}addPath(r,i={},n){var u,h;try{Ey(r,i||{})}catch(m){te.error(m);return}let o=new ri(r,Bu(i)),s=new fe(o,new Kt({color:(u=i==null?void 0:i.color)!=null?u:"#ff834c",altitude:(h=i==null?void 0:i.verticalOffset)!=null?h:.1}));s.id=(i==null?void 0:i.id)||Jt(),o.mesh.userData={entityId:s.id,type:"path"},c(this,D).geometry3DMap.set(s.id,s),(i==null?void 0:i.interactive)!=null&&et(s,i==null?void 0:i.interactive,c(this,D));let l=this.getParentContainer(n);return l instanceof Ie&&l.addEntity(s),c(this,we).call(this),this.render(),{id:s.id,type:"path"}}updateWatermark(r){c(this,M).watermarkSystem.options=r,c(this,M).watermarkSystem.dirty=!0,c(this,M).collisionSystem.collidersDirty=!0,this.render()}remove(r){var n,o;let i;if(typeof r=="string"||typeof r=="number"?(i=c(this,D).geometry2DMap.get(r),i==null&&(i=c(this,D).geometry3DMap.get(r))):typeof r.id=="string"||typeof r.id=="number"?(i=c(this,D).geometry2DMap.get(r.id),i==null&&(i=c(this,D).geometry3DMap.get(r.id))):i=r,i!=null){if(i.type==="custom-geometry")c(this,D).geometry3DMap.delete(i.id),i.object3d&&ze(i.object3d);else if(i.type==="group-container"){c(this,D).geometry3DMap.delete(i.userData.entityId);for(let l of i.childrenIds.values())this.remove(l),i.userData.entities2D.delete(l);let s=i.components[1];s&&s.focusMesh&&ze(s.focusMesh),ze(i)}else if(i.type==="geometry-group"){c(this,D).geometry3DMap.delete(i.userData.entityId);for(let s of i.userData.entities3D.values())this.remove(s),i.userData.entities3D.delete(s);ze(i)}else if(i.type==="geometry"||i.type==="model"||i.type==="path"){let s=i.components[0],l=i.components[4];if(i.entities2D.size>0){for(let h of i.entities2D.values())this.remove(h);i.removeAllEntities()}let u=(o=(n=i.parentObject3D)==null?void 0:n.userData.entityId)!=null?o:i.parentId;if(u){let h=c(this,D).geometry3DMap.get(u);h instanceof xt&&h.userData.entities3D.delete(i.id)}if(i.object3d&&ze(i.object3d),i.type==="geometry"){let h=i.components[3];h&&(h.enabled=!1,h.dirty=!0)}l&&"focusMesh"in l&&l.focusMesh!=null&&ze(l.focusMesh),"textMesh"in s&&s.textMesh!=null&&this.remove(s.textMesh.userData.entityId),c(this,D).geometry3DMap.delete(i.id)}else if(i.type==="marker"||i.type==="label"){let s=i.attachedTo;if(s){let l=c(this,D).geometry3DMap.get(s);l instanceof fe&&l.detach(i)}i.object3d&&ze(i.object3d),i.type==="label"&&delete c(this,M).twoDDrawSystem.textCache[i.id],c(this,D).geometry2DMap.delete(i.id)}else if(i.type==="image")i.object3d&&ze(i.object3d),c(this,D).geometry3DMap.delete(i.id);else if(i.type==="text3d"){ze(i.object3d);let{batchedText:s,textMesh:l,polygonEntityId:u}=i.components[0];if(l&&(s&&s.removeText(l),ze(l)),u){c(this,M).text3DSystem.remove(u);let h=c(this,D).geometry3DMap.get(u);(h==null?void 0:h.type)==="geometry"&&(h.components[0].textMesh=void 0,h.components[0].textEntityId=void 0)}c(this,D).geometry3DMap.delete(i.id)}c(this,we).call(this),c(this,Je).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return c(this,Be)}getThreeCamera(){return c(this,Re)}async setEnvironment(r){if(c(this,Be))if(r==="basic"){c(this,on)||R(this,on,_e(this,ot,yd).call(this));let i=await c(this,on);c(this,Be).environment=i}else c(this,Be).environment=null}getEnvironment(){var r;return(r=c(this,Be))!=null&&r.environment?"basic":!1}getCurrentSceneGLTF(r){return c(this,M).exporterSystem.getCurrentSceneGLTF(r)}getBoundingArea(r){(c(this,M).renderSystem.threeDdirty||c(this,M).renderSystem.twoDdirty)&&this.renderSync();let i=new it;if(r==null)i.setFromObject(c(this,D).entityScene);else{let n=fn(c(this,D),r);if((n==null?void 0:n.type)==="geometry"&&(n==null?void 0:n.object3d)!=null){let o=n.components[0],s=o instanceof Ne?o.geometry:void 0;o.mesh instanceof Zs&&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(qs(i))return ap(i).map(this.convert3DMapPositionToCoordinate)}hasState(r){return fn(c(this,D),r)!=null}getState(r){var n,o,s,l,u,h,m,f,b,y,_,T,g,x,P;if(r==null)return{type:"map-view",hoverColor:c(this,D).hoverColor,text3dHoverColor:c(this,D).text3dHoverColor};let i=fn(c(this,D),r);if((i==null?void 0:i.type)==="custom-geometry"){let S=i.components[0],C=i.components[1];return{id:i.id,type:"custom-geometry",visible:C.visible,altitude:C.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=Array.from(i.userData.entities3D.values()),C=S==null?void 0:S[0],w=C?this.getState(C):{};return{id:i.userData.entityId,type:"geometry-group",visible:i.visible,altitude:i.altitude,color:w==null?void 0:w.color,initialColor:w==null?void 0:w.initialColor,side:(o=w==null?void 0:w.side)!=null?o:"double",opacity:w==null?void 0:w.opacity,height:w==null?void 0:w.height,texture:w==null?void 0:w.texture,topColor:w==null?void 0:w.topColor,topTexture:w==null?void 0:w.topTexture,interactive:w==null?void 0:w.interactive,children:S,bevel:w==null?void 0:w.bevel}}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(j1).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],C=i.object3d.parent,w=C==null?void 0:C.userData.entityId;return{id:i.id,type:"label",text:S.text||"",parent:{id:w,type:C==null?void 0:C.type},position:this.convert3DMapPositionToCoordinate(i.position),enabled:S.enabled,visible:S.visible,initialRank:_o(S.initialRank),options:{rank:_o(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],C=i.object3d.parent,w=C==null?void 0:C.userData.entityId;return{id:i.id,type:"marker",enabled:S.enabled,visible:S.visible,placement:S.options.placement,dynamicResize:S.options.dynamicResize,parent:{id:w,type:C==null?void 0:C.type},position:this.convert3DMapPositionToCoordinate(i.position),element:S.containerEl,initialRank:_o(S.initialRank),contentHTML:S.contentHtml,options:{rank:_o(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:C,initialColor:w,initialTopColor:k,topColor:A,altitude:N}=i.components[1],Y=i.components[0],z=i.components[1],X=i.components[1],q=i.components[2],F=i.components[3],J=i.parentObject3D;return{id:i.id,type:"geometry",opacity:X.opacity,initialColor:w,color:S,focusable:z!=null&&z.focusMesh!=null,initialTopColor:k,topColor:A,side:X.side,hoverColor:C,hovered:!!(q!=null&&q.hover),height:X.height,visible:X.visible,outline:F==null?void 0:F.enabled,showImage:X.showImage,texture:X.texture,topTexture:X.topTexture,flipImageToFaceCamera:X.flipImageToFaceCamera,parent:{id:J==null?void 0:J.userData.entityId,type:J==null?void 0:J.type},altitude:N,bevel:X.bevel,position:this.convert3DMapPositionToCoordinate(Y.position),interactive:i.components[2]!=null}}else if((i==null?void 0:i.type)==="model"){let S=i.components[0],C=i.components[1],w=i.components[2];return{id:i.id,type:"model",position:S.mesh?this.convert3DMapPositionToCoordinate((l=S.mesh)==null?void 0:l.getWorldPosition(new H)):this.convert3DMapPositionToCoordinate(S.position),interactive:w!=null,material:C.material,parent:(u=i.parentObject3D)!=null&&u.parent?{id:i.parentObject3D.parent.userData.entityId,type:i.parentObject3D.parent.type}:void 0,visible:C.visible,verticalOffset:C.verticalOffset,color:C.color,opacity:C.opacity,rotation:(h=C.rotation)!=null?h:bn,scale:(m=C.scale)!=null?m:vn}}else if((i==null?void 0:i.type)==="path"){let S=i.components[0],C=i.components[2],w=i.components[1];return{id:i.id,type:"path",position:this.convert3DMapPositionToCoordinate(S.position),visible:w.visible,interactive:C!=null,completeFraction:S.completeFraction,color:w.color,accentColor:S.accentColor,width:S.width,animateArrowsOnPath:S.animateArrowsOnPath,displayArrowsOnPath:S.displayArrowsOnPath,verticalOffset:w.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:(b=S.feature.properties.width)!=null?b:0,height:(y=S.feature.properties.height)!=null?y:0,rotation:(_=S.feature.properties.rotation)!=null?_:0}}else if((i==null?void 0:i.type)==="text3d"&&i.components[0]instanceof Vr&&"textArea"in i.components[0].feature.properties){zf(i);let S=i.components[0],C=i.components[1],{textMesh:w}=S,k=(T=S.mesh)==null?void 0:T.parent;k instanceof Ie&&((g=k.children.find(Y=>Y.type==="batchedtext"))==null||g.getWorldPosition(c(this,Ls))),c(this,so).set(0,0,0);let A=w?w.getWorldPosition(c(this,so)):c(this,so);return Object.assign({},gn,C.getState(),{id:i.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(A.add(c(this,Ls))),visible:(x=S.visible)!=null?x:!1,content:(P=S.feature.properties.content)!=null?P:""})}else return}}setState(r,i){var o,s;if(typeof r=="object"&&i==null){"hoverColor"in r&&(Qd(r.hoverColor)?c(this,D).hoverColor=(o=r.hoverColor)!=null?o:c(this,D).hoverColor:te.warn('Failed to update global hover color. Invalid color "'.concat(r.hoverColor,'".'))),"text3dHoverColor"in r&&(c(this,D).text3dHoverColor=(s=r.text3dHoverColor)!=null?s:c(this,D).text3dHoverColor);return}let n=fn(c(this,D),r);if(n!=null){if(n.type==="custom-geometry"){let l=c(this,D).geometry3DMap.get(n.id);if(l instanceof fe&&l.components[0]instanceof Jn){let u=i;sr(n,c(this,D),u.visible),Xn(n,u.altitude),Au(n,u.position,this.convertTo3DMapPosition),ku(n,this.getParentContainer(u.parent,!1)),et(n,u.interactive,c(this,D))&&c(this,we).call(this)}}else if(n.type==="path"){let l=i;et(n,l.interactive,c(this,D))&&c(this,we).call(this),Xn(n,l.verticalOffset),Xf(n,c(this,D),l)}else if(n.type==="model"){let l=i;et(n,l.interactive,c(this,D))&&c(this,we).call(this),sr(n,c(this,D),l.visible),Uf(n,l)}else if(n.type==="group-container"){let l=i;sr(n,c(this,D),l.visible)&&(c(this,M).pathSystem.verticalDistanceDirty=!0,c(this,M).geometryInFocusSystem.focusablesDirty=!0),Xn(n,l.altitude)&&(c(this,M).pathSystem.verticalDistanceDirty=!0),et(n,l.interactive,c(this,D))&&c(this,we).call(this),Xo(n,c(this,D),l.opacity)&&(c(this,M).outlineInterpolationSystem.outlineOpacitiesDirty=!0),l.preloadGeometry&&n.userData.preloadGeometry!==!0&&(n.userData.preloadGeometry=!0,c(this,M).outlineInterpolationSystem.geometries3DDirty=!0),Xa(n,l.focusable)&&(c(this,M).geometryInFocusSystem.focusablesDirty=!0)}else if(n.type==="geometry-group"){let l=i;sr(n,c(this,D),l.visible),Mf(n,c(this,D),l),Ga(n,c(this,D),l.outline),l.height!=null&&Ba(n,c(this,D),l.height),Xn(n,l.altitude),Bf(n,c(this,D),l),If(n,c(this,D),l.shading),Xo(n,c(this,D),l.opacity)&&(c(this,M).outlineInterpolationSystem.outlineOpacitiesDirty=!0),et(n,l.interactive,c(this,D))&&(c(this,we).call(this),c(this,Je).call(this)),za(n,c(this,D),l.side)}else if(n.type==="geometry"){if(n.components[0]instanceof Ne){let l=i;sr(n,c(this,D),l.visible),Ga(n,c(this,D),l.outline),Ef(n,l),Xa(n,l.focusable)&&(c(this,M).geometryInFocusSystem.focusablesDirty=!0),Gf(n,l.renderOrder)&&(c(this,M).meshDetachmentSystem.dirty=!0),Ff(n,l.opacity)&&(c(this,M).meshDetachmentSystem.dirty=!0,c(this,M).interactionSystem.dirty3D=!0,c(this,M).outlineInterpolationSystem.outlineOpacitiesDirty=!0),Ru(n,l.flipImageToFaceCamera),Xn(n,l.altitude),l.height!=null&&Ba(n,c(this,D),l.height),Nu(n,l)&&(c(this,M).meshDetachmentSystem.dirty=!0),Fa(n,l),kf(n,l.hoverColor),et(n,l.interactive,c(this,D)),Rf(n,l.hovered),za(n,c(this,D),l.side)}c(this,we).call(this)}else if(n.type==="label"||n.type==="marker"){let l=i;Af(n,i,c(this,D)),Of(n,i,c(this,D))&&(c(this,Je).call(this),c(this,M).domMutationSystem.dirty=!0),Au(n,l.position,this.convertTo3DMapPosition),ku(n,this.getParentContainer(l.parent,!1))&&(c(this,Je).call(this),c(this,M).panBoundsSystem.dirty=!0),Df(n,l.enabled),sr(n,c(this,D),l.visible)}else if(n.type==="image"){let l=i;sr(n,c(this,D),l.visible),Xo(n,c(this,D),l.opacity),Ru(n,l.flipImageToFaceCamera)}else if(n.type==="text3d"){let l=i;Zf(n,c(this,D),l)}this.render()}}convertTo3DMapPosition(r,i,n=0,o){var u,h,m,f,b;if(Array.isArray(r))return this.convertTo3DMapPosition(r[1],r[0],(u=r[2])!=null?u: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}=ta((m=(h=c(this,D).center)==null?void 0:h[1])!=null?m:0,(b=(f=c(this,D).center)==null?void 0:f[0])!=null?b:0,r,i);return o?(o.set(s,l,n),o):new H(s,l,n)}get backgroundColor(){return typeof c(this,tt).backgroundColor=="string"?c(this,tt).backgroundColor:"#".concat(c(this,tt).backgroundColor.getHexString())}get backgroundAlpha(){return c(this,tt).backgroundAlpha}getThreeRenderer(){return c(this,tt)}getCenter(r){let i=Array.isArray(r)?r:this.getBoundingArea(r);return i?fp(i):void 0}isInView(r){let i=fn(c(this,D),r);if(c(this,Ds).identity().multiply(c(this,Re).projectionMatrix).multiply(c(this,Re).matrixWorldInverse),c(this,cn).setFromProjectionMatrix(c(this,Ds)),i instanceof gi)return c(this,cn).containsPoint(i.position);if(i instanceof fe){let n=i==null?void 0:i.components[0];if(n instanceof Jn||n instanceof Qr)return c(this,cn).containsPoint(this.convertTo3DMapPosition(n.feature.geometry.coordinates));if(n instanceof Ne){let o=new it(this.convertTo3DMapPosition(n.featureBbox[1],n.featureBbox[0],0),this.convertTo3DMapPosition(n.featureBbox[3],n.featureBbox[2],0));return c(this,cn).intersectsBox(o)}}return!1}onMapLibreEvent(r,i){if(!this.map){te.warn('Tried to add event listener "'.concat(r,'" but MapLibre map is not initialized.'));return}this.map.on(r,i),c(this,At)[r]=c(this,At)[r]||[],c(this,At)[r].push(i)}offMapLibreEvent(r,i){!this.map||!Array.isArray(c(this,At)[r])||(this.map.off(r,i),c(this,At)[r]=c(this,At)[r].filter(n=>n!==i))}get aborted(){return c(this,an).signal.aborted}onAbort(r){c(this,an).signal.addEventListener("abort",r,{once:!0})}getSystems(){return c(this,M)}getInternalState(){return c(this,D)}getInternalTweenGroup(){return c(this,D).internalTweenGroup}getExternalTweenGroup(){return c(this,D).externalTweenGroup}computeMinZOffsetBetweenContainers(r,i,n){if(!r||!i)return-1;pc(r,"group-container"),pc(i,"group-container");let o=ra(r,this.getThreeCamera()),s=i.clone(),l=ra(s,this.getThreeCamera());if(!qs(o)||!qs(l))return-1;let u=0,h;n&&this.container.querySelectorAll(".debug-box").forEach(f=>f.remove());do{if(u>1e4)return-1;if(u+=20,s.position.z=u,s.updateMatrixWorld(),l.makeEmpty(),ra(s,c(this,Re),l),h=o.intersectsBox(l),n){let m=vc(o,"blue",this.container),f=vc(l,h?"red":"green",this.container);m.classList.add("debug-box"),f.classList.add("debug-box")}}while(h);return u}};Be=new WeakMap,Re=new WeakMap,on=new WeakMap,Ss=new WeakMap,io=new WeakMap,li=new WeakMap,sn=new WeakMap,no=new WeakMap,ot=new WeakSet,md=a(function(r){var i;c(this,Or)!=="outdoors-overlay"&&((i=this.map)==null||i.setPixelRatio(r)),c(this,D).pixelRatio=this.resolutionScale},"#setResolutionScale"),D=new WeakMap,At=new WeakMap,an=new WeakMap,Ce=new WeakMap,Ht=new WeakMap,Fe=new WeakMap,kt=new WeakMap,tt=new WeakMap,M=new WeakMap,Cs=new WeakMap,Je=new WeakMap,we=new WeakMap,wg=a(function(){R(this,Ce,document.createElement("div")),c(this,Ce).classList.add("mappedin__smart-collision-engine__container"),R(this,Ht,document.createElement("canvas")),c(this,Ht).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(c(this,Ce)),R(this,Fe,document.createElement("canvas")),c(this,Fe).classList.add("mappedin__smart-collision-engine__container"),c(this,Fe).width=c(this,Ce).clientWidth*this.resolutionScale,c(this,Fe).height=c(this,Ce).clientHeight*this.resolutionScale,c(this,Fe).style.width=c(this,Ce).clientWidth+"px",c(this,Fe).style.height=c(this,Ce).clientHeight+"px",c(this,Ce).appendChild(c(this,Ht)),c(this,Ce).appendChild(c(this,Fe)),c(this,Ht).width=c(this,Ce).clientWidth,c(this,Ht).height=c(this,Ce).clientHeight,c(this,Fe).width=c(this,Ce).clientWidth*this.resolutionScale,c(this,Fe).height=c(this,Ce).clientHeight*this.resolutionScale,c(this,Fe).style.width=c(this,Ce).clientWidth+"px",c(this,Fe).style.height=c(this,Ce).clientHeight+"px"},"#renderEntity2DContainer"),Mg=a(function(){R(this,kt,document.createElement("div")),c(this,kt).classList.add("mappedin-2d-entities"),Object.assign(c(this,kt).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(c(this,kt))},"#renderEntityDOMContainer"),Ig=a(function(){c(this,Fe).width=c(this,Ce).clientWidth*this.resolutionScale,c(this,Fe).height=c(this,Ce).clientHeight*this.resolutionScale,c(this,Fe).style.width=c(this,Ce).clientWidth+"px",c(this,Fe).style.height=c(this,Ce).clientHeight+"px",c(this,Ht).width=c(this,Ce).clientWidth,c(this,Ht).height=c(this,Ce).clientHeight,c(this,Fe).width=c(this,Ce).clientWidth*this.resolutionScale,c(this,Fe).height=c(this,Ce).clientHeight*this.resolutionScale,c(this,Fe).style.width=c(this,Ce).clientWidth+"px",c(this,Fe).style.height=c(this,Ce).clientHeight+"px",c(this,M).collisionSystem.collidersDirty=!0},"#resizeCollisionCanvas"),Or=new WeakMap,_s=new WeakMap,Ps=new WeakMap,Ts=new WeakMap,ws=new WeakMap,oo=new WeakMap,tc=new WeakMap,Ms=new WeakMap,Is=new WeakMap,Es=new WeakMap,ln=new WeakMap,fd=a(function(r,i,n,o){let s=new gi(i,this.convertTo3DMapPosition(r[1],r[0],r[2]||0),o);return s.occluderId=n!=null?n:c(this,M).occlusion2DSystem.backgroundId,c(this,D).geometry2DMap.set(s.id,s),s},"#createEntity2D"),cn=new WeakMap,Ds=new WeakMap,Os=new WeakMap,mt=new WeakMap,ft=new WeakMap,yd=a(async function(){return ti.load(bp).then(r=>{var i;return c(this,Be)&&((i=c(this,Be).environment)==null||i.dispose(),r.mapping=Md,c(this,Be).environment=r,this.render()),r})},"#loadEnvMap"),rc=new WeakMap,ic=new WeakMap,so=new WeakMap,Ls=new WeakMap,a(gd,"Core");var pd=gd,j1=new H,oh=pd;var vd=class vd extends me{constructor(r){super();p(this,"gl");p(this,"el",document.createElement("div"));p(this,"core");p(this,"origin");p(this,"map");p(this,"layer");p(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"));p(this,"handleMove",a(()=>{if(!this.map)return;let[r,i]=this.map.getCenter().toArray();this.core.getSystems().cameraSystem.setCenter(r,i),this.core.getSystems().cameraSystem.setZoomLevel(this.map.getZoom()),this.core.getSystems().cameraSystem.setRotation(ue.degToRad(this.map.getBearing())),this.core.getSystems().cameraSystem.setTilt(ue.degToRad(this.map.getPitch()))},"handleMove"));p(this,"handleError",a(r=>{te.warn(r)},"handleError"));this.origin=r}onAdd(r){this.origin=this.origin||r.getCenter().toArray(),this.gl=r.painter.context.gl,this.core=new oh(r._container,{center:this.origin,zoomLevel:r.getZoom(),pitch:r.getPitch(),bearing:r.getBearing(),gl:this.gl,map:r,mode:"outdoors-overlay"}),this.map=r,this.core.camera.setMinZoomLevel(r.getMinZoom()),this.core.camera.setMaxZoomLevel(r.getMaxZoom()),this.core.camera.setMinPitch(r.getMinPitch()),this.core.camera.setMaxPitch(r.getMaxPitch()),this.map.on("error",this.handleError);let i=Td.fromLngLat(this.origin,0);return this.layer=yc(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(vd,"MapLibreOverlay");var nc=vd;v();var Eg=Vd("",{prefix:"[MapLibreOverlay]"});v();var Dg=a((t,{id:e}={})=>{let r=Array.isArray(t)?t:[t];if(!r.every(o=>typeof o=="string"))return;let i=r.join(""),n=null;if(e){let o=document.getElementById(e);o instanceof HTMLStyleElement&&(n=o)}n==null&&(n=document.createElement("style")),e&&e!==""&&(n.id=e),n.textContent=i,document.head.appendChild(n)},"injectCSS");var Og=".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 Lg=".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 Ag=".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 kg=".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 J1=[Og,Lg,Ag,kg],L9=a((t,e)=>{As.instance!=null&&Eg.warn("Only a single map venue is supported at this time.");let r=new As([t.mapCenter.longitude,t.mapCenter.latitude],t,e);return As.instance=r,r},"createMapLibreOverlay"),K1=3,Q1={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:K1}},un,hn,ao,ci,dn,ks=class ks{constructor(e,r,i){L(this,un);L(this,hn);L(this,ao);L(this,ci);L(this,dn);p(this,"on",a((e,r)=>{c(this,un).on(e,r)},"on"));p(this,"off",a((e,r)=>{c(this,un).off(e,r)},"off"));R(this,un,new me),R(this,dn,new nc(e)),R(this,hn,r),R(this,ao,i)}onAdd(e){var n,o,s;let r=c(this,dn).onAdd(e),i=j(O(O({},Q1),(n=c(this,ao))!=null?n:{}),{outdoorView:O({token:c(this,hn).outdoorViewToken},(o=c(this,ao))==null?void 0:o.outdoorView)});return R(this,ci,new $1(c(this,dn).core)),((s=i.injectStyles)==null||s)&&Dg(J1,{id:"mappedin__styles"}),c(this,ci).addMap(c(this,hn),i).then(()=>{c(this,un).publish("loaded",{mapView:c(this,ci),mapData:c(this,hn)})}),r}onRemove(){c(this,ci)&&c(this,ci).clear(),ks.instance=null,c(this,dn).onRemove()}};un=new WeakMap,hn=new WeakMap,ao=new WeakMap,ci=new WeakMap,dn=new WeakMap,a(ks,"MappedinMapLibreOverlay"),p(ks,"instance");var As=ks;export{Q1 as DEFAULT_MAP_OPTIONS,K1 as FLOOR_GAP,As as MappedinMapLibreOverlay,L9 as createMapLibreOverlay};
|