@mappedin/react-sdk 6.0.1-beta.43 → 6.0.1-beta.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- import{h as Ro,i as fl,j as dl}from"./chunk-RV2X5GSW.js";import{a as hl}from"./chunk-VTOSGJTF.js";import{$a as ul,A as Ks,Aa as Wr,B as Js,E as St,F as qs,Fa as ol,Ga as al,Ha as sl,I as Qs,J as Oo,L as Io,M as Ne,N as Vr,O as $s,P as At,Q as Po,R as Ot,S as lt,U as yi,Wa as ll,X as ur,Z as el,bb as cl,c as Zs,d as Ys,e as kn,g as wn,ha as bi,ja as tl,m as Eo,ma as rl,na as nl,pa as xi,q as gi,r as vi,x as Xs,xa as il,z as Ao}from"./chunk-DOOA5SBB.js";import{a as P,b as ne}from"./chunk-BVQ2DBMP.js";import{a as c,c as Ac,e as Oc,f as m,g as Ge,h as ft,i as Je}from"./chunk-BYMKRV3A.js";var lu=Ac((Bn,tn)=>{P();var Nf=200,jl="__lodash_hash_undefined__",jf=800,zf=16,zl=9007199254740991,Vl="[object Arguments]",Vf="[object Array]",Wf="[object AsyncFunction]",Hf="[object Boolean]",Zf="[object Date]",Yf="[object Error]",Wl="[object Function]",Xf="[object GeneratorFunction]",Kf="[object Map]",Jf="[object Number]",qf="[object Null]",Hl="[object Object]",Qf="[object Proxy]",$f="[object RegExp]",ed="[object Set]",td="[object String]",rd="[object Undefined]",nd="[object WeakMap]",id="[object ArrayBuffer]",od="[object DataView]",ad="[object Float32Array]",sd="[object Float64Array]",ld="[object Int8Array]",ud="[object Int16Array]",cd="[object Int32Array]",fd="[object Uint8Array]",dd="[object Uint8ClampedArray]",hd="[object Uint16Array]",pd="[object Uint32Array]",md=/[\\^$.*+?()[\]{}|]/g,gd=/^\[object .+?Constructor\]$/,vd=/^(?:0|[1-9]\d*)$/,ze={};ze[ad]=ze[sd]=ze[ld]=ze[ud]=ze[cd]=ze[fd]=ze[dd]=ze[hd]=ze[pd]=!0;ze[Vl]=ze[Vf]=ze[id]=ze[Hf]=ze[od]=ze[Zf]=ze[Yf]=ze[Wl]=ze[Kf]=ze[Jf]=ze[Hl]=ze[$f]=ze[ed]=ze[td]=ze[nd]=!1;var Zl=typeof global=="object"&&global&&global.Object===Object&&global,yd=typeof self=="object"&&self&&self.Object===Object&&self,zn=Zl||yd||Function("return this")(),Yl=typeof Bn=="object"&&Bn&&!Bn.nodeType&&Bn,Nn=Yl&&typeof tn=="object"&&tn&&!tn.nodeType&&tn,Xl=Nn&&Nn.exports===Yl,ga=Xl&&Zl.process,Il=function(){try{var t=Nn&&Nn.require&&Nn.require("util").types;return t||ga&&ga.binding&&ga.binding("util")}catch{}}(),Pl=Il&&Il.isTypedArray;function Kl(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)}c(Kl,"apply");function bd(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}c(bd,"baseTimes");function xd(t){return function(e){return t(e)}}c(xd,"baseUnary");function _d(t,e){return t==null?void 0:t[e]}c(_d,"getValue");function Td(t,e){return function(r){return t(e(r))}}c(Td,"overArg");var Sd=Array.prototype,kd=Function.prototype,Gi=Object.prototype,va=zn["__core-js_shared__"],Fi=kd.toString,Vt=Gi.hasOwnProperty,Rl=function(){var t=/[^.]+$/.exec(va&&va.keys&&va.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Jl=Gi.toString,wd=Fi.call(Object),Md=RegExp("^"+Fi.call(Vt).replace(md,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ui=Xl?zn.Buffer:void 0,Ul=zn.Symbol,Ll=zn.Uint8Array,Gl=Ui?Ui.allocUnsafe:void 0,ql=Td(Object.getPrototypeOf,Object),Fl=Object.create,Cd=Gi.propertyIsEnumerable,Dd=Sd.splice,Er=Ul?Ul.toStringTag:void 0,Li=function(){try{var t=ka(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Ed=Ui?Ui.isBuffer:void 0,Bl=Math.max,Ad=Date.now,Ql=ka(zn,"Map"),jn=ka(Object,"create"),Od=function(){function t(){}return c(t,"object"),function(e){if(!zt(e))return{};if(Fl)return Fl(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Ar(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}c(Ar,"Hash");function Id(){this.__data__=jn?jn(null):{},this.size=0}c(Id,"hashClear");function Pd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}c(Pd,"hashDelete");function Rd(t){var e=this.__data__;if(jn){var r=e[t];return r===jl?void 0:r}return Vt.call(e,t)?e[t]:void 0}c(Rd,"hashGet");function Ud(t){var e=this.__data__;return jn?e[t]!==void 0:Vt.call(e,t)}c(Ud,"hashHas");function Ld(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=jn&&e===void 0?jl:e,this}c(Ld,"hashSet");Ar.prototype.clear=Id;Ar.prototype.delete=Pd;Ar.prototype.get=Rd;Ar.prototype.has=Ud;Ar.prototype.set=Ld;function Wt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}c(Wt,"ListCache");function Gd(){this.__data__=[],this.size=0}c(Gd,"listCacheClear");function Fd(t){var e=this.__data__,r=Bi(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Dd.call(e,r,1),--this.size,!0}c(Fd,"listCacheDelete");function Bd(t){var e=this.__data__,r=Bi(e,t);return r<0?void 0:e[r][1]}c(Bd,"listCacheGet");function Nd(t){return Bi(this.__data__,t)>-1}c(Nd,"listCacheHas");function jd(t,e){var r=this.__data__,o=Bi(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}c(jd,"listCacheSet");Wt.prototype.clear=Gd;Wt.prototype.delete=Fd;Wt.prototype.get=Bd;Wt.prototype.has=Nd;Wt.prototype.set=jd;function rn(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}c(rn,"MapCache");function zd(){this.size=0,this.__data__={hash:new Ar,map:new(Ql||Wt),string:new Ar}}c(zd,"mapCacheClear");function Vd(t){var e=ji(this,t).delete(t);return this.size-=e?1:0,e}c(Vd,"mapCacheDelete");function Wd(t){return ji(this,t).get(t)}c(Wd,"mapCacheGet");function Hd(t){return ji(this,t).has(t)}c(Hd,"mapCacheHas");function Zd(t,e){var r=ji(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}c(Zd,"mapCacheSet");rn.prototype.clear=zd;rn.prototype.delete=Vd;rn.prototype.get=Wd;rn.prototype.has=Hd;rn.prototype.set=Zd;function nn(t){var e=this.__data__=new Wt(t);this.size=e.size}c(nn,"Stack");function Yd(){this.__data__=new Wt,this.size=0}c(Yd,"stackClear");function Xd(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}c(Xd,"stackDelete");function Kd(t){return this.__data__.get(t)}c(Kd,"stackGet");function Jd(t){return this.__data__.has(t)}c(Jd,"stackHas");function qd(t,e){var r=this.__data__;if(r instanceof Wt){var o=r.__data__;if(!Ql||o.length<Nf-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new rn(o)}return r.set(t,e),this.size=r.size,this}c(qd,"stackSet");nn.prototype.clear=Yd;nn.prototype.delete=Xd;nn.prototype.get=Kd;nn.prototype.has=Jd;nn.prototype.set=qd;function Qd(t,e){var r=_a(t),o=!r&&xa(t),i=!r&&!o&&nu(t),n=!r&&!o&&!i&&ou(t),a=r||o||i||n,s=a?bd(t.length,String):[],l=s.length;for(var u in t)(e||Vt.call(t,u))&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||n&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||tu(u,l)))&&s.push(u);return s}c(Qd,"arrayLikeKeys");function ya(t,e,r){(r!==void 0&&!zi(t[e],r)||r===void 0&&!(e in t))&&Ta(t,e,r)}c(ya,"assignMergeValue");function $d(t,e,r){var o=t[e];(!(Vt.call(t,e)&&zi(o,r))||r===void 0&&!(e in t))&&Ta(t,e,r)}c($d,"assignValue");function Bi(t,e){for(var r=t.length;r--;)if(zi(t[r][0],e))return r;return-1}c(Bi,"assocIndexOf");function Ta(t,e,r){e=="__proto__"&&Li?Li(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}c(Ta,"baseAssignValue");var eh=dh();function Ni(t){return t==null?t===void 0?rd:qf:Er&&Er in Object(t)?hh(t):bh(t)}c(Ni,"baseGetTag");function Nl(t){return Vn(t)&&Ni(t)==Vl}c(Nl,"baseIsArguments");function th(t){if(!zt(t)||vh(t))return!1;var e=Ma(t)?Md:gd;return e.test(Sh(t))}c(th,"baseIsNative");function rh(t){return Vn(t)&&iu(t.length)&&!!ze[Ni(t)]}c(rh,"baseIsTypedArray");function nh(t){if(!zt(t))return yh(t);var e=ru(t),r=[];for(var o in t)o=="constructor"&&(e||!Vt.call(t,o))||r.push(o);return r}c(nh,"baseKeysIn");function Sa(t,e,r,o,i){t!==e&&eh(e,function(n,a){if(i||(i=new nn),zt(n))ih(t,e,a,r,Sa,o,i);else{var s=o?o(ba(t,a),n,a+"",t,e,i):void 0;s===void 0&&(s=n),ya(t,a,s)}},au)}c(Sa,"baseMerge");function ih(t,e,r,o,i,n,a){var s=ba(t,r),l=ba(e,r),u=a.get(l);if(u){ya(t,r,u);return}var f=n?n(s,l,r+"",t,e,a):void 0,d=f===void 0;if(d){var h=_a(l),p=!h&&nu(l),v=!h&&!p&&ou(l);f=l,h||p||v?_a(s)?f=s:kh(s)?f=uh(s):p?(d=!1,f=ah(l,!0)):v?(d=!1,f=lh(l,!0)):f=[]:wh(l)||xa(l)?(f=s,xa(s)?f=Mh(s):(!zt(s)||Ma(s))&&(f=ph(l))):d=!1}d&&(a.set(l,f),i(f,l,o,n,a),a.delete(l)),ya(t,r,f)}c(ih,"baseMergeDeep");function $l(t,e){return _h(xh(t,e,su),t+"")}c($l,"baseRest");var oh=Li?function(t,e){return Li(t,"toString",{configurable:!0,enumerable:!1,value:Eh(e),writable:!0})}:su;function ah(t,e){if(e)return t.slice();var r=t.length,o=Gl?Gl(r):new t.constructor(r);return t.copy(o),o}c(ah,"cloneBuffer");function sh(t){var e=new t.constructor(t.byteLength);return new Ll(e).set(new Ll(t)),e}c(sh,"cloneArrayBuffer");function lh(t,e){var r=e?sh(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}c(lh,"cloneTypedArray");function uh(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}c(uh,"copyArray");function ch(t,e,r,o){var i=!r;r||(r={});for(var n=-1,a=e.length;++n<a;){var s=e[n],l=o?o(r[s],t[s],s,r,t):void 0;l===void 0&&(l=t[s]),i?Ta(r,s,l):$d(r,s,l)}return r}c(ch,"copyObject");function fh(t){return $l(function(e,r){var o=-1,i=r.length,n=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(n=t.length>3&&typeof n=="function"?(i--,n):void 0,a&&mh(r[0],r[1],a)&&(n=i<3?void 0:n,i=1),e=Object(e);++o<i;){var s=r[o];s&&t(e,s,o,n)}return e})}c(fh,"createAssigner");function dh(t){return function(e,r,o){for(var i=-1,n=Object(e),a=o(e),s=a.length;s--;){var l=a[t?s:++i];if(r(n[l],l,n)===!1)break}return e}}c(dh,"createBaseFor");function eu(t,e,r,o,i,n){return zt(t)&&zt(e)&&(n.set(e,t),Sa(t,e,void 0,eu,n),n.delete(e)),t}c(eu,"customDefaultsMerge");function ji(t,e){var r=t.__data__;return gh(e)?r[typeof e=="string"?"string":"hash"]:r.map}c(ji,"getMapData");function ka(t,e){var r=_d(t,e);return th(r)?r:void 0}c(ka,"getNative");function hh(t){var e=Vt.call(t,Er),r=t[Er];try{t[Er]=void 0;var o=!0}catch{}var i=Jl.call(t);return o&&(e?t[Er]=r:delete t[Er]),i}c(hh,"getRawTag");function ph(t){return typeof t.constructor=="function"&&!ru(t)?Od(ql(t)):{}}c(ph,"initCloneObject");function tu(t,e){var r=typeof t;return e=e==null?zl:e,!!e&&(r=="number"||r!="symbol"&&vd.test(t))&&t>-1&&t%1==0&&t<e}c(tu,"isIndex");function mh(t,e,r){if(!zt(r))return!1;var o=typeof e;return(o=="number"?wa(r)&&tu(e,r.length):o=="string"&&e in r)?zi(r[e],t):!1}c(mh,"isIterateeCall");function gh(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}c(gh,"isKeyable");function vh(t){return!!Rl&&Rl in t}c(vh,"isMasked");function ru(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Gi;return t===r}c(ru,"isPrototype");function yh(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}c(yh,"nativeKeysIn");function bh(t){return Jl.call(t)}c(bh,"objectToString");function xh(t,e,r){return e=Bl(e===void 0?t.length-1:e,0),function(){for(var o=arguments,i=-1,n=Bl(o.length-e,0),a=Array(n);++i<n;)a[i]=o[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=o[i];return s[e]=r(a),Kl(t,this,s)}}c(xh,"overRest");function ba(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}c(ba,"safeGet");var _h=Th(oh);function Th(t){var e=0,r=0;return function(){var o=Ad(),i=zf-(o-r);if(r=o,i>0){if(++e>=jf)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}c(Th,"shortOut");function Sh(t){if(t!=null){try{return Fi.call(t)}catch{}try{return t+""}catch{}}return""}c(Sh,"toSource");function zi(t,e){return t===e||t!==t&&e!==e}c(zi,"eq");var xa=Nl(function(){return arguments}())?Nl:function(t){return Vn(t)&&Vt.call(t,"callee")&&!Cd.call(t,"callee")},_a=Array.isArray;function wa(t){return t!=null&&iu(t.length)&&!Ma(t)}c(wa,"isArrayLike");function kh(t){return Vn(t)&&wa(t)}c(kh,"isArrayLikeObject");var nu=Ed||Ah;function Ma(t){if(!zt(t))return!1;var e=Ni(t);return e==Wl||e==Xf||e==Wf||e==Qf}c(Ma,"isFunction");function iu(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=zl}c(iu,"isLength");function zt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}c(zt,"isObject");function Vn(t){return t!=null&&typeof t=="object"}c(Vn,"isObjectLike");function wh(t){if(!Vn(t)||Ni(t)!=Hl)return!1;var e=ql(t);if(e===null)return!0;var r=Vt.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Fi.call(r)==wd}c(wh,"isPlainObject");var ou=Pl?xd(Pl):rh;function Mh(t){return ch(t,au(t))}c(Mh,"toPlainObject");var Ch=$l(function(t){return t.push(void 0,eu),Kl(Dh,void 0,t)});function au(t){return wa(t)?Qd(t,!0):nh(t)}c(au,"keysIn");var Dh=fh(function(t,e,r,o){Sa(t,e,r,o)});function Eh(t){return function(){return t}}c(Eh,"constant");function su(t){return t}c(su,"identity");function Ah(){return!1}c(Ah,"stubFalse");tn.exports=Ch});P();function jm(t,e,r=!1){let o=null,i=0;return function(...n){i++,i===1&&r===!0&&t(...n);let a=c(()=>{(!r||i>1)&&t(...n),o=null,i=0},"later");clearTimeout(o),o=setTimeout(a,e)}}c(jm,"debounce");P();P();var _i="[MappedinJS]",Ic=(i=>(i[i.LOG=0]="LOG",i[i.WARN=1]="WARN",i[i.ERROR=2]="ERROR",i[i.SILENT=3]="SILENT",i))(Ic||{});function Hm(t){0<=t&&t<=3&&(pl.logState=t)}c(Hm,"setLoggerLevel");var pl={logState:ne.env.NODE_ENV==="test"?3:0,log(...t){this.logState<=0&&console.log(_i,...t)},warn(...t){this.logState<=1&&console.warn(_i,...t)},error(...t){this.logState<=2&&console.error(_i,...t)},assert(...t){console.assert(...t)},time(t){console.time(t)},timeEnd(t){console.timeEnd(t)},throw(t,e){throw new Error("".concat(_i," ").concat(t),e)}},Ft=pl;P();P();var Uo=class Uo extends Error{};c(Uo,"InvalidTokenError");var cr=Uo;cr.prototype.name="InvalidTokenError";function Pc(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let o=r.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}c(Pc,"b64DecodeUnicode");function Rc(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Pc(e)}catch{return atob(e)}}c(Rc,"base64UrlDecode");function ml(t,e){if(typeof t!="string")throw new cr("Invalid token specified: must be a string");e||(e={});let r=e.header===!0?0:1,o=t.split(".")[r];if(typeof o!="string")throw new cr("Invalid token specified: missing part #".concat(r+1));let i;try{i=Rc(o)}catch(n){throw new cr("Invalid token specified: invalid base64 for part #".concat(r+1," (").concat(n.message,")"))}try{return JSON.parse(i)}catch(n){throw new cr("Invalid token specified: invalid json for part #".concat(r+1," (").concat(n.message,")"))}}c(ml,"jwtDecode");P();var fr=63710088e-1;function ng(t){var r,o;let e=ml(t);if(e.sub==null)throw new Error("Access token is missing sub claim.");return{sub:e.sub,aud:typeof e.aud=="string"?[e.aud]:(r=e.aud)!=null?r:[],capabilities:(o=e.capabilities)!=null?o:{}}}c(ng,"decodeAccessToken");function Qt(t){return t*(Math.PI/180)}c(Qt,"toRadians");function Uc(t){return t*(180/Math.PI)}c(Uc,"toDegrees");function ig(t,e){let r=Math.pow(10,e);return Math.sign(t)*Math.round(Math.abs(t)*r)/r}c(ig,"round");function gl(t,e){return(t%e+e)%e}c(gl,"euclideanModulo");function og([t,e],[r,o]){let i=Qt(o-e),n=Qt(r-t),a=Qt(e),s=Qt(o),l=Math.sin(i/2)*Math.sin(i/2)+Math.sin(n/2)*Math.sin(n/2)*Math.cos(a)*Math.cos(s),u=2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l));return fr*u}c(og,"haversineDistance");function ag([t,e],[r,o]){let i=Qt(e),n=Qt(t),a=Qt(o),l=Qt(r)-n,u=Math.sin(l)*Math.cos(a),f=Math.cos(i)*Math.sin(a)-Math.sin(i)*Math.cos(a)*Math.cos(l);return Uc((Math.atan2(u,f)+Math.PI*2)%(Math.PI*2))}c(ag,"getForwardBearing");function sg(t,e){let r=gl(t,Math.PI*2),o=gl(e,Math.PI*2),i=o-r,n=o+(i>Math.PI?-Math.PI*2:i<-Math.PI?Math.PI*2:0);return{start:r,end:n}}c(sg,"shortestTweenRotation");function Lc(t){return t instanceof ul?Number.isFinite(t.min.x)&&Number.isFinite(t.min.y)&&Number.isFinite(t.max.x)&&Number.isFinite(t.max.y):Number.isFinite(t.min.x)&&Number.isFinite(t.min.y)&&Number.isFinite(t.max.x)&&Number.isFinite(t.max.y)&&Number.isFinite(t.min.z)&&Number.isFinite(t.max.z)}c(Lc,"isFiniteBox");P();var Ti=class Ti extends Error{constructor(r){super(r);m(this,"name","AssertionError");Error.captureStackTrace&&Error.captureStackTrace(this,Ti)}};c(Ti,"AssertionError");var Lo=Ti;function vl(t,e){if(t==null){let r;if(e!=null&&e.customMessage)r=e.customMessage;else{let n=e!=null&&e.valueName?"'".concat(e.valueName,"'"):"value";r="Expected ".concat(n," to be defined, but received ").concat(t)}let o=(e==null?void 0:e.errorClass)||Lo,i=new o(r);throw(e==null?void 0:e.captureStackTrace)!==!1&&Error.captureStackTrace&&Error.captureStackTrace(i,vl),i}}c(vl,"assertExists");function fg(t,e,r){if(vl(t),(t==null?void 0:t.type)!==e){let o="Expected type ".concat(e," but got ").concat(t==null?void 0:t.type);throw new Error(r!=null?r:o)}}c(fg,"assertType");P();var Go=[0,4,6,8,10],rt=c(()=>{let t=new Array(16).fill(0),e=Math.random()*4294967296;for(let o=0;o<t.length;o++)o>0&&(o&3)===0&&(e=Math.random()*4294967296),t[o]=e>>>((o&3)<<3)&255;let r=t.map(o=>o.toString(16).padStart(2,"0"));return r[6]="4"+r[6][1],r[8]=["8","9","a","b"].includes(r[7][0])?r[7]:"a"+r[7][1],Go.map((o,i)=>r.slice(o,i===Go.length-1?void 0:Go[i+1]).join("")).join("-")},"randomId");P();var Fo=class Fo{constructor(){m(this,"_subscribers",{})}publish(e,r){!this._subscribers||!this._subscribers[e]||this._subscribers[e].forEach(function(o){typeof o=="function"&&o(r)})}on(e,r){this._subscribers||(this._subscribers={}),this._subscribers[e]=this._subscribers[e]||[],this._subscribers[e].push(r)}off(e,r){if(!this._subscribers||this._subscribers[e]==null)return;let o=this._subscribers[e].indexOf(r);o!==-1&&this._subscribers[e].splice(o,1)}destroy(){this._subscribers={}}};c(Fo,"PubSub");var Mn=Fo;P();var yl="mi-session-data",bl="mi-local-data",dr,kt,wt,Cn=class Cn{constructor(){ft(this,kt);ft(this,wt);try{let e=sessionStorage.getItem(yl);e?Je(this,kt,JSON.parse(e)):Je(this,kt,{id:rt()})}catch{Je(this,kt,{id:rt()})}try{let e=localStorage.getItem(bl);e?Je(this,wt,JSON.parse(e)):Je(this,wt,{deviceId:rt()})}catch{Je(this,wt,{deviceId:rt()})}Ge(this,kt).id||(Ge(this,kt).id=rt()),Ge(this,wt).deviceId||(Ge(this,wt).deviceId=rt())}static getInstance(){return Ge(this,dr)||Je(this,dr,new Cn),Ge(this,dr)}static ___clearInstance(){Je(this,dr,void 0)}saveSessionData(e,r){Ge(this,kt)[e]=r;try{return sessionStorage.setItem(yl,JSON.stringify(Ge(this,kt))),!0}catch{return!1}}loadSessionData(e){let r=Ge(this,kt)[e];if(r!=null)return r}saveLocalData(e,r){Ge(this,wt)[e]=r;try{return localStorage.setItem(bl,JSON.stringify(Ge(this,wt))),!0}catch{return!1}}loadLocalData(e){let r=Ge(this,wt)[e];if(r!=null)return r}};dr=new WeakMap,kt=new WeakMap,wt=new WeakMap,c(Cn,"SafeStorage"),ft(Cn,dr);var Bo=Cn;P();var Pe;(function(t){t.assertEqual=i=>i;function e(i){}c(e,"assertIs"),t.assertIs=e;function r(i){throw new Error}c(r,"assertNever"),t.assertNever=r,t.arrayToEnum=i=>{let n={};for(let a of i)n[a]=a;return n},t.getValidEnumValues=i=>{let n=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(let s of n)a[s]=i[s];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(n){return i[n]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let n=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&n.push(a);return n},t.find=(i,n)=>{for(let a of i)if(n(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function o(i,n=" | "){return i.map(a=>typeof a=="string"?"'".concat(a,"'"):a).join(n)}c(o,"joinValues"),t.joinValues=o,t.jsonStringifyReplacer=(i,n)=>typeof n=="bigint"?n.toString():n})(Pe||(Pe={}));var jo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(jo||(jo={}));var ee=Pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$t=c(t=>{switch(typeof t){case"undefined":return ee.undefined;case"string":return ee.string;case"number":return isNaN(t)?ee.nan:ee.number;case"boolean":return ee.boolean;case"function":return ee.function;case"bigint":return ee.bigint;case"symbol":return ee.symbol;case"object":return Array.isArray(t)?ee.array:t===null?ee.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ee.promise:typeof Map<"u"&&t instanceof Map?ee.map:typeof Set<"u"&&t instanceof Set?ee.set:typeof Date<"u"&&t instanceof Date?ee.date:ee.object;default:return ee.unknown}},"getParsedType"),Z=Pe.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"]),Gc=c(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ei=class Ei extends Error{constructor(e){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(n){return n.message},o={_errors:[]},i=c(n=>{for(let a of n.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)o._errors.push(r(a));else{let s=o,l=0;for(;l<a.path.length;){let u=a.path[l];l===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],l++}}},"processError");return i(this),o}static assert(e){if(!(e instanceof Ei))throw new Error("Not a ZodError: ".concat(e))}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},o=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):o.push(e(i));return{formErrors:o,fieldErrors:r}}get formErrors(){return this.flatten()}};c(Ei,"ZodError");var ht=Ei;ht.create=t=>new ht(t);var Kr=c((t,e)=>{let r;switch(t.code){case Z.invalid_type:t.received===ee.undefined?r="Required":r="Expected ".concat(t.expected,", received ").concat(t.received);break;case Z.invalid_literal:r="Invalid literal value, expected ".concat(JSON.stringify(t.expected,Pe.jsonStringifyReplacer));break;case Z.unrecognized_keys:r="Unrecognized key(s) in object: ".concat(Pe.joinValues(t.keys,", "));break;case Z.invalid_union:r="Invalid input";break;case Z.invalid_union_discriminator:r="Invalid discriminator value. Expected ".concat(Pe.joinValues(t.options));break;case Z.invalid_enum_value:r="Invalid enum value. Expected ".concat(Pe.joinValues(t.options),", received '").concat(t.received,"'");break;case Z.invalid_arguments:r="Invalid function arguments";break;case Z.invalid_return_type:r="Invalid function return type";break;case Z.invalid_date:r="Invalid date";break;case Z.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,'"'):Pe.assertNever(t.validation):t.validation!=="regex"?r="Invalid ".concat(t.validation):r="Invalid";break;case Z.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 Z.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 Z.custom:r="Invalid input";break;case Z.invalid_intersection_types:r="Intersection results could not be merged";break;case Z.not_multiple_of:r="Number must be a multiple of ".concat(t.multipleOf);break;case Z.not_finite:r="Number must be finite";break;default:r=e.defaultError,Pe.assertNever(t)}return{message:r}},"errorMap"),Tl=Kr;function Fc(t){Tl=t}c(Fc,"setErrorMap");function Si(){return Tl}c(Si,"getErrorMap");var ki=c(t=>{let{data:e,path:r,errorMaps:o,issueData:i}=t,n=[...r,...i.path||[]],a={...i,path:n};if(i.message!==void 0)return{...i,path:n,message:i.message};let s="",l=o.filter(u=>!!u).slice().reverse();for(let u of l)s=u(a,{data:e,defaultError:s}).message;return{...i,path:n,message:s}},"makeIssue"),Bc=[];function q(t,e){let r=Si(),o=ki({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Kr?void 0:Kr].filter(i=>!!i)});t.common.issues.push(o)}c(q,"addIssueToContext");var Ai=class Ai{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let o=[];for(let i of r){if(i.status==="aborted")return Te;i.status==="dirty"&&e.dirty(),o.push(i.value)}return{status:e.value,value:o}}static async mergeObjectAsync(e,r){let o=[];for(let i of r){let n=await i.key,a=await i.value;o.push({key:n,value:a})}return Ai.mergeObjectSync(e,o)}static mergeObjectSync(e,r){let o={};for(let i of r){let{key:n,value:a}=i;if(n.status==="aborted"||a.status==="aborted")return Te;n.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(o[n.value]=a.value)}return{status:e.value,value:o}}};c(Ai,"ParseStatus");var $e=Ai,Te=Object.freeze({status:"aborted"}),Zr=c(t=>({status:"dirty",value:t}),"DIRTY"),nt=c(t=>({status:"valid",value:t}),"OK"),zo=c(t=>t.status==="aborted","isAborted"),Vo=c(t=>t.status==="dirty","isDirty"),Un=c(t=>t.status==="valid","isValid"),Ln=c(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync");function wi(t,e,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(t):o?o.value:e.get(t)}c(wi,"__classPrivateFieldGet");function Sl(t,e,r,o,i){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}c(Sl,"__classPrivateFieldSet");var de;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(de||(de={}));var Dn,En,Ho=class Ho{constructor(e,r,o,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=o,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};c(Ho,"ParseInputLazyPath");var bt=Ho,xl=c((t,e)=>{if(Un(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 ht(t.common.issues);return this._error=r,this._error}}},"handleResult");function Me(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:o,description:i}=t;if(e&&(r||o))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return e?{errorMap:e,description:i}:{errorMap:c((a,s)=>{var l,u;let{message:f}=t;return a.code==="invalid_enum_value"?{message:f!=null?f:s.defaultError}:typeof s.data>"u"?{message:(l=f!=null?f:o)!==null&&l!==void 0?l:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(u=f!=null?f:r)!==null&&u!==void 0?u:s.defaultError}},"customMap"),description:i}}c(Me,"processCreateParams");var Zo=class Zo{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)}get description(){return this._def.description}_getType(e){return $t(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:$t(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $e,ctx:{common:e.parent.common,data:e.data,parsedType:$t(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ln(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 o=this.safeParse(e,r);if(o.success)return o.data;throw o.error}safeParse(e,r){var o;let i={common:{issues:[],async:(o=r==null?void 0:r.async)!==null&&o!==void 0?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:$t(e)},n=this._parseSync({data:e,path:i.path,parent:i});return xl(i,n)}async parseAsync(e,r){let o=await this.safeParseAsync(e,r);if(o.success)return o.data;throw o.error}async safeParseAsync(e,r){let o={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:$t(e)},i=this._parse({data:e,path:o.path,parent:o}),n=await(Ln(i)?i:Promise.resolve(i));return xl(o,n)}refine(e,r){let o=c(i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r,"getIssueProperties");return this._refinement((i,n)=>{let a=e(i),s=c(()=>n.addIssue({code:Z.custom,...o(i)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((o,i)=>e(o)?!0:(i.addIssue(typeof r=="function"?r(o,i):r),!1))}_refinement(e){return new pt({schema:this,typeName:_e.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return yt.create(this,this._def)}nullable(){return Pt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return jt.create(this,this._def)}promise(){return rr.create(this,this._def)}or(e){return xr.create([this,e],this._def)}and(e){return _r.create(this,e,this._def)}transform(e){return new pt({...Me(this._def),schema:this,typeName:_e.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Mr({...Me(this._def),innerType:this,defaultValue:r,typeName:_e.ZodDefault})}brand(){return new Gn({typeName:_e.ZodBranded,type:this,...Me(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Cr({...Me(this._def),innerType:this,catchValue:r,typeName:_e.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Fn.create(this,e)}readonly(){return Dr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c(Zo,"ZodType");var Ce=Zo,Nc=/^c[^\s-]{8,}$/i,jc=/^[0-9a-z]+$/,zc=/^[0-9A-HJKMNP-TV-Z]{26}$/,Vc=/^[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,Wc=/^[a-z0-9_-]{21}$/i,Hc=/^[-+]?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)?)??$/,Zc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",No,Xc=/^(?:(?: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])$/,Kc=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Jc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kl="((\\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])))",qc=new RegExp("^".concat(kl,"$"));function wl(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e="".concat(e,"\\.\\d{").concat(t.precision,"}"):t.precision==null&&(e="".concat(e,"(\\.\\d+)?")),e}c(wl,"timeRegexSource");function Qc(t){return new RegExp("^".concat(wl(t),"$"))}c(Qc,"timeRegex");function Ml(t){let e="".concat(kl,"T").concat(wl(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,"$"))}c(Ml,"datetimeRegex");function $c(t,e){return!!((e==="v4"||!e)&&Xc.test(t)||(e==="v6"||!e)&&Kc.test(t))}c($c,"isValidIP");var hr=class hr extends Ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ee.string){let n=this._getOrReturnCtx(e);return q(n,{code:Z.invalid_type,expected:ee.string,received:n.parsedType}),Te}let o=new $e,i;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:Z.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),o.dirty());else if(n.kind==="max")e.data.length>n.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:Z.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),o.dirty());else if(n.kind==="length"){let a=e.data.length>n.value,s=e.data.length<n.value;(a||s)&&(i=this._getOrReturnCtx(e,i),a?q(i,{code:Z.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):s&&q(i,{code:Z.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),o.dirty())}else if(n.kind==="email")Zc.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"email",code:Z.invalid_string,message:n.message}),o.dirty());else if(n.kind==="emoji")No||(No=new RegExp(Yc,"u")),No.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"emoji",code:Z.invalid_string,message:n.message}),o.dirty());else if(n.kind==="uuid")Vc.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"uuid",code:Z.invalid_string,message:n.message}),o.dirty());else if(n.kind==="nanoid")Wc.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"nanoid",code:Z.invalid_string,message:n.message}),o.dirty());else if(n.kind==="cuid")Nc.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid",code:Z.invalid_string,message:n.message}),o.dirty());else if(n.kind==="cuid2")jc.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid2",code:Z.invalid_string,message:n.message}),o.dirty());else if(n.kind==="ulid")zc.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ulid",code:Z.invalid_string,message:n.message}),o.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),q(i,{validation:"url",code:Z.invalid_string,message:n.message}),o.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"regex",code:Z.invalid_string,message:n.message}),o.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(i=this._getOrReturnCtx(e,i),q(i,{code:Z.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),o.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:Z.invalid_string,validation:{startsWith:n.value},message:n.message}),o.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:Z.invalid_string,validation:{endsWith:n.value},message:n.message}),o.dirty()):n.kind==="datetime"?Ml(n).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:Z.invalid_string,validation:"datetime",message:n.message}),o.dirty()):n.kind==="date"?qc.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:Z.invalid_string,validation:"date",message:n.message}),o.dirty()):n.kind==="time"?Qc(n).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:Z.invalid_string,validation:"time",message:n.message}),o.dirty()):n.kind==="duration"?Hc.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"duration",code:Z.invalid_string,message:n.message}),o.dirty()):n.kind==="ip"?$c(e.data,n.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ip",code:Z.invalid_string,message:n.message}),o.dirty()):n.kind==="base64"?Jc.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64",code:Z.invalid_string,message:n.message}),o.dirty()):Pe.assertNever(n);return{status:o.value,value:e.data}}_regex(e,r,o){return this.refinement(i=>e.test(i),{validation:r,code:Z.invalid_string,...de.errToObj(o)})}_addCheck(e){return new hr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...de.errToObj(e)})}url(e){return this._addCheck({kind:"url",...de.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...de.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...de.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...de.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...de.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...de.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...de.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...de.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...de.errToObj(e)})}datetime(e){var r,o;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({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!==void 0?r:!1,local:(o=e==null?void 0:e.local)!==null&&o!==void 0?o:!1,...de.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({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...de.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...de.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...de.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...de.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...de.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...de.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...de.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...de.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...de.errToObj(r)})}nonempty(e){return this.min(1,de.errToObj(e))}trim(){return new hr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new hr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new hr({...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 isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}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}};c(hr,"ZodString");var er=hr;er.create=t=>{var e;return new er({checks:[],typeName:_e.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Me(t)})};function ef(t,e){let r=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,i=r>o?r:o,n=parseInt(t.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return n%a/Math.pow(10,i)}c(ef,"floatSafeRemainder");var An=class An extends Ce{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)!==ee.number){let n=this._getOrReturnCtx(e);return q(n,{code:Z.invalid_type,expected:ee.number,received:n.parsedType}),Te}let o,i=new $e;for(let n of this._def.checks)n.kind==="int"?Pe.isInteger(e.data)||(o=this._getOrReturnCtx(e,o),q(o,{code:Z.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(o=this._getOrReturnCtx(e,o),q(o,{code:Z.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(o=this._getOrReturnCtx(e,o),q(o,{code:Z.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="multipleOf"?ef(e.data,n.value)!==0&&(o=this._getOrReturnCtx(e,o),q(o,{code:Z.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(o=this._getOrReturnCtx(e,o),q(o,{code:Z.not_finite,message:n.message}),i.dirty()):Pe.assertNever(n);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,de.toString(r))}gt(e,r){return this.setLimit("min",e,!1,de.toString(r))}lte(e,r){return this.setLimit("max",e,!0,de.toString(r))}lt(e,r){return this.setLimit("max",e,!1,de.toString(r))}setLimit(e,r,o,i){return new An({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:o,message:de.toString(i)}]})}_addCheck(e){return new An({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:de.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:de.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:de.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:de.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:de.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:de.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:de.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:de.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:de.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"&&Pe.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(r===null||o.value>r)&&(r=o.value):o.kind==="max"&&(e===null||o.value<e)&&(e=o.value)}return Number.isFinite(r)&&Number.isFinite(e)}};c(An,"ZodNumber");var pr=An;pr.create=t=>new pr({checks:[],typeName:_e.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Me(t)});var On=class On extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ee.bigint){let n=this._getOrReturnCtx(e);return q(n,{code:Z.invalid_type,expected:ee.bigint,received:n.parsedType}),Te}let o,i=new $e;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(o=this._getOrReturnCtx(e,o),q(o,{code:Z.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(o=this._getOrReturnCtx(e,o),q(o,{code:Z.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(o=this._getOrReturnCtx(e,o),q(o,{code:Z.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):Pe.assertNever(n);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,de.toString(r))}gt(e,r){return this.setLimit("min",e,!1,de.toString(r))}lte(e,r){return this.setLimit("max",e,!0,de.toString(r))}lt(e,r){return this.setLimit("max",e,!1,de.toString(r))}setLimit(e,r,o,i){return new On({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:o,message:de.toString(i)}]})}_addCheck(e){return new On({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:de.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:de.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:de.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:de.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:de.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}};c(On,"ZodBigInt");var mr=On;mr.create=t=>{var e;return new mr({checks:[],typeName:_e.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Me(t)})};var Yo=class Yo extends Ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ee.boolean){let o=this._getOrReturnCtx(e);return q(o,{code:Z.invalid_type,expected:ee.boolean,received:o.parsedType}),Te}return nt(e.data)}};c(Yo,"ZodBoolean");var gr=Yo;gr.create=t=>new gr({typeName:_e.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Me(t)});var Oi=class Oi extends Ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ee.date){let n=this._getOrReturnCtx(e);return q(n,{code:Z.invalid_type,expected:ee.date,received:n.parsedType}),Te}if(isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return q(n,{code:Z.invalid_date}),Te}let o=new $e,i;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:Z.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),o.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:Z.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),o.dirty()):Pe.assertNever(n);return{status:o.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Oi({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:de.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:de.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}};c(Oi,"ZodDate");var vr=Oi;vr.create=t=>new vr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:_e.ZodDate,...Me(t)});var Xo=class Xo extends Ce{_parse(e){if(this._getType(e)!==ee.symbol){let o=this._getOrReturnCtx(e);return q(o,{code:Z.invalid_type,expected:ee.symbol,received:o.parsedType}),Te}return nt(e.data)}};c(Xo,"ZodSymbol");var Jr=Xo;Jr.create=t=>new Jr({typeName:_e.ZodSymbol,...Me(t)});var Ko=class Ko extends Ce{_parse(e){if(this._getType(e)!==ee.undefined){let o=this._getOrReturnCtx(e);return q(o,{code:Z.invalid_type,expected:ee.undefined,received:o.parsedType}),Te}return nt(e.data)}};c(Ko,"ZodUndefined");var yr=Ko;yr.create=t=>new yr({typeName:_e.ZodUndefined,...Me(t)});var Jo=class Jo extends Ce{_parse(e){if(this._getType(e)!==ee.null){let o=this._getOrReturnCtx(e);return q(o,{code:Z.invalid_type,expected:ee.null,received:o.parsedType}),Te}return nt(e.data)}};c(Jo,"ZodNull");var br=Jo;br.create=t=>new br({typeName:_e.ZodNull,...Me(t)});var qo=class qo extends Ce{constructor(){super(...arguments),this._any=!0}_parse(e){return nt(e.data)}};c(qo,"ZodAny");var tr=qo;tr.create=t=>new tr({typeName:_e.ZodAny,...Me(t)});var Qo=class Qo extends Ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nt(e.data)}};c(Qo,"ZodUnknown");var Nt=Qo;Nt.create=t=>new Nt({typeName:_e.ZodUnknown,...Me(t)});var $o=class $o extends Ce{_parse(e){let r=this._getOrReturnCtx(e);return q(r,{code:Z.invalid_type,expected:ee.never,received:r.parsedType}),Te}};c($o,"ZodNever");var Mt=$o;Mt.create=t=>new Mt({typeName:_e.ZodNever,...Me(t)});var ea=class ea extends Ce{_parse(e){if(this._getType(e)!==ee.undefined){let o=this._getOrReturnCtx(e);return q(o,{code:Z.invalid_type,expected:ee.void,received:o.parsedType}),Te}return nt(e.data)}};c(ea,"ZodVoid");var qr=ea;qr.create=t=>new qr({typeName:_e.ZodVoid,...Me(t)});var Yr=class Yr extends Ce{_parse(e){let{ctx:r,status:o}=this._processInputParams(e),i=this._def;if(r.parsedType!==ee.array)return q(r,{code:Z.invalid_type,expected:ee.array,received:r.parsedType}),Te;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(a||s)&&(q(r,{code:a?Z.too_big:Z.too_small,minimum:s?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),o.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(q(r,{code:Z.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),o.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(q(r,{code:Z.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),o.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>i.type._parseAsync(new bt(r,a,r.path,s)))).then(a=>$e.mergeArray(o,a));let n=[...r.data].map((a,s)=>i.type._parseSync(new bt(r,a,r.path,s)));return $e.mergeArray(o,n)}get element(){return this._def.type}min(e,r){return new Yr({...this._def,minLength:{value:e,message:de.toString(r)}})}max(e,r){return new Yr({...this._def,maxLength:{value:e,message:de.toString(r)}})}length(e,r){return new Yr({...this._def,exactLength:{value:e,message:de.toString(r)}})}nonempty(e){return this.min(1,e)}};c(Yr,"ZodArray");var jt=Yr;jt.create=(t,e)=>new jt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:_e.ZodArray,...Me(e)});function Hr(t){if(t instanceof ut){let e={};for(let r in t.shape){let o=t.shape[r];e[r]=yt.create(Hr(o))}return new ut({...t._def,shape:c(()=>e,"shape")})}else return t instanceof jt?new jt({...t._def,type:Hr(t.element)}):t instanceof yt?yt.create(Hr(t.unwrap())):t instanceof Pt?Pt.create(Hr(t.unwrap())):t instanceof It?It.create(t.items.map(e=>Hr(e))):t}c(Hr,"deepPartialify");var dt=class dt extends Ce{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=Pe.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==ee.object){let u=this._getOrReturnCtx(e);return q(u,{code:Z.invalid_type,expected:ee.object,received:u.parsedType}),Te}let{status:o,ctx:i}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Mt&&this._def.unknownKeys==="strip"))for(let u in i.data)a.includes(u)||s.push(u);let l=[];for(let u of a){let f=n[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:f._parse(new bt(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Mt){let u=this._def.unknownKeys;if(u==="passthrough")for(let f of s)l.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(u==="strict")s.length>0&&(q(i,{code:Z.unrecognized_keys,keys:s}),o.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let f of s){let d=i.data[f];l.push({key:{status:"valid",value:f},value:u._parse(new bt(i,d,i.path,f)),alwaysSet:f in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let f of l){let d=await f.key,h=await f.value;u.push({key:d,value:h,alwaysSet:f.alwaysSet})}return u}).then(u=>$e.mergeObjectSync(o,u)):$e.mergeObjectSync(o,l)}get shape(){return this._def.shape()}strict(e){return de.errToObj,new dt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:c((r,o)=>{var i,n,a,s;let l=(a=(n=(i=this._def).errorMap)===null||n===void 0?void 0:n.call(i,r,o).message)!==null&&a!==void 0?a:o.defaultError;return r.code==="unrecognized_keys"?{message:(s=de.errToObj(e).message)!==null&&s!==void 0?s:l}:{message:l}},"errorMap")}:{}})}strip(){return new dt({...this._def,unknownKeys:"strip"})}passthrough(){return new dt({...this._def,unknownKeys:"passthrough"})}extend(e){return new dt({...this._def,shape:c(()=>({...this._def.shape(),...e}),"shape")})}merge(e){return new dt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:c(()=>({...this._def.shape(),...e._def.shape()}),"shape"),typeName:_e.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new dt({...this._def,catchall:e})}pick(e){let r={};return Pe.objectKeys(e).forEach(o=>{e[o]&&this.shape[o]&&(r[o]=this.shape[o])}),new dt({...this._def,shape:c(()=>r,"shape")})}omit(e){let r={};return Pe.objectKeys(this.shape).forEach(o=>{e[o]||(r[o]=this.shape[o])}),new dt({...this._def,shape:c(()=>r,"shape")})}deepPartial(){return Hr(this)}partial(e){let r={};return Pe.objectKeys(this.shape).forEach(o=>{let i=this.shape[o];e&&!e[o]?r[o]=i:r[o]=i.optional()}),new dt({...this._def,shape:c(()=>r,"shape")})}required(e){let r={};return Pe.objectKeys(this.shape).forEach(o=>{if(e&&!e[o])r[o]=this.shape[o];else{let n=this.shape[o];for(;n instanceof yt;)n=n._def.innerType;r[o]=n}}),new dt({...this._def,shape:c(()=>r,"shape")})}keyof(){return Cl(Pe.objectKeys(this.shape))}};c(dt,"ZodObject");var ut=dt;ut.create=(t,e)=>new ut({shape:c(()=>t,"shape"),unknownKeys:"strip",catchall:Mt.create(),typeName:_e.ZodObject,...Me(e)});ut.strictCreate=(t,e)=>new ut({shape:c(()=>t,"shape"),unknownKeys:"strict",catchall:Mt.create(),typeName:_e.ZodObject,...Me(e)});ut.lazycreate=(t,e)=>new ut({shape:t,unknownKeys:"strip",catchall:Mt.create(),typeName:_e.ZodObject,...Me(e)});var ta=class ta extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),o=this._def.options;function i(n){for(let s of n)if(s.result.status==="valid")return s.result;for(let s of n)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=n.map(s=>new ht(s.ctx.common.issues));return q(r,{code:Z.invalid_union,unionErrors:a}),Te}if(c(i,"handleResults"),r.common.async)return Promise.all(o.map(async n=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await n._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let n,a=[];for(let l of o){let u={...r,common:{...r.common,issues:[]},parent:null},f=l._parseSync({data:r.data,path:r.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!n&&(n={result:f,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(n)return r.common.issues.push(...n.ctx.common.issues),n.result;let s=a.map(l=>new ht(l));return q(r,{code:Z.invalid_union,unionErrors:s}),Te}}get options(){return this._def.options}};c(ta,"ZodUnion");var xr=ta;xr.create=(t,e)=>new xr({options:t,typeName:_e.ZodUnion,...Me(e)});var Bt=c(t=>t instanceof Tr?Bt(t.schema):t instanceof pt?Bt(t.innerType()):t instanceof Sr?[t.value]:t instanceof kr?t.options:t instanceof wr?Pe.objectValues(t.enum):t instanceof Mr?Bt(t._def.innerType):t instanceof yr?[void 0]:t instanceof br?[null]:t instanceof yt?[void 0,...Bt(t.unwrap())]:t instanceof Pt?[null,...Bt(t.unwrap())]:t instanceof Gn||t instanceof Dr?Bt(t.unwrap()):t instanceof Cr?Bt(t._def.innerType):[],"getDiscriminator"),Ii=class Ii extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ee.object)return q(r,{code:Z.invalid_type,expected:ee.object,received:r.parsedType}),Te;let o=this.discriminator,i=r.data[o],n=this.optionsMap.get(i);return n?r.common.async?n._parseAsync({data:r.data,path:r.path,parent:r}):n._parseSync({data:r.data,path:r.path,parent:r}):(q(r,{code:Z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),Te)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,o){let i=new Map;for(let n of r){let a=Bt(n.shape[e]);if(!a.length)throw new Error("A discriminator value for key `".concat(e,"` could not be extracted from all schema options"));for(let s of a){if(i.has(s))throw new Error("Discriminator property ".concat(String(e)," has duplicate value ").concat(String(s)));i.set(s,n)}}return new Ii({typeName:_e.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Me(o)})}};c(Ii,"ZodDiscriminatedUnion");var Mi=Ii;function Wo(t,e){let r=$t(t),o=$t(e);if(t===e)return{valid:!0,data:t};if(r===ee.object&&o===ee.object){let i=Pe.objectKeys(e),n=Pe.objectKeys(t).filter(s=>i.indexOf(s)!==-1),a={...t,...e};for(let s of n){let l=Wo(t[s],e[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(r===ee.array&&o===ee.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let n=0;n<t.length;n++){let a=t[n],s=e[n],l=Wo(a,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===ee.date&&o===ee.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}c(Wo,"mergeValues");var ra=class ra extends Ce{_parse(e){let{status:r,ctx:o}=this._processInputParams(e),i=c((n,a)=>{if(zo(n)||zo(a))return Te;let s=Wo(n.value,a.value);return s.valid?((Vo(n)||Vo(a))&&r.dirty(),{status:r.value,value:s.data}):(q(o,{code:Z.invalid_intersection_types}),Te)},"handleParsed");return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([n,a])=>i(n,a)):i(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}};c(ra,"ZodIntersection");var _r=ra;_r.create=(t,e,r)=>new _r({left:t,right:e,typeName:_e.ZodIntersection,...Me(r)});var Pi=class Pi extends Ce{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==ee.array)return q(o,{code:Z.invalid_type,expected:ee.array,received:o.parsedType}),Te;if(o.data.length<this._def.items.length)return q(o,{code:Z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Te;!this._def.rest&&o.data.length>this._def.items.length&&(q(o,{code:Z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let n=[...o.data].map((a,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new bt(o,a,o.path,s)):null}).filter(a=>!!a);return o.common.async?Promise.all(n).then(a=>$e.mergeArray(r,a)):$e.mergeArray(r,n)}get items(){return this._def.items}rest(e){return new Pi({...this._def,rest:e})}};c(Pi,"ZodTuple");var It=Pi;It.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new It({items:t,typeName:_e.ZodTuple,rest:null,...Me(e)})};var In=class In extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==ee.object)return q(o,{code:Z.invalid_type,expected:ee.object,received:o.parsedType}),Te;let i=[],n=this._def.keyType,a=this._def.valueType;for(let s in o.data)i.push({key:n._parse(new bt(o,s,o.path,s)),value:a._parse(new bt(o,o.data[s],o.path,s)),alwaysSet:s in o.data});return o.common.async?$e.mergeObjectAsync(r,i):$e.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,o){return r instanceof Ce?new In({keyType:e,valueType:r,typeName:_e.ZodRecord,...Me(o)}):new In({keyType:er.create(),valueType:e,typeName:_e.ZodRecord,...Me(r)})}};c(In,"ZodRecord");var Ci=In,na=class na extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==ee.map)return q(o,{code:Z.invalid_type,expected:ee.map,received:o.parsedType}),Te;let i=this._def.keyType,n=this._def.valueType,a=[...o.data.entries()].map(([s,l],u)=>({key:i._parse(new bt(o,s,o.path,[u,"key"])),value:n._parse(new bt(o,l,o.path,[u,"value"]))}));if(o.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of a){let u=await l.key,f=await l.value;if(u.status==="aborted"||f.status==="aborted")return Te;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),s.set(u.value,f.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of a){let u=l.key,f=l.value;if(u.status==="aborted"||f.status==="aborted")return Te;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),s.set(u.value,f.value)}return{status:r.value,value:s}}}};c(na,"ZodMap");var Qr=na;Qr.create=(t,e,r)=>new Qr({valueType:e,keyType:t,typeName:_e.ZodMap,...Me(r)});var Pn=class Pn extends Ce{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==ee.set)return q(o,{code:Z.invalid_type,expected:ee.set,received:o.parsedType}),Te;let i=this._def;i.minSize!==null&&o.data.size<i.minSize.value&&(q(o,{code:Z.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&o.data.size>i.maxSize.value&&(q(o,{code:Z.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let n=this._def.valueType;function a(l){let u=new Set;for(let f of l){if(f.status==="aborted")return Te;f.status==="dirty"&&r.dirty(),u.add(f.value)}return{status:r.value,value:u}}c(a,"finalizeSet");let s=[...o.data.values()].map((l,u)=>n._parse(new bt(o,l,o.path,u)));return o.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(e,r){return new Pn({...this._def,minSize:{value:e,message:de.toString(r)}})}max(e,r){return new Pn({...this._def,maxSize:{value:e,message:de.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};c(Pn,"ZodSet");var $r=Pn;$r.create=(t,e)=>new $r({valueType:t,minSize:null,maxSize:null,typeName:_e.ZodSet,...Me(e)});var Xr=class Xr extends Ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ee.function)return q(r,{code:Z.invalid_type,expected:ee.function,received:r.parsedType}),Te;function o(s,l){return ki({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Si(),Kr].filter(u=>!!u),issueData:{code:Z.invalid_arguments,argumentsError:l}})}c(o,"makeArgsIssue");function i(s,l){return ki({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Si(),Kr].filter(u=>!!u),issueData:{code:Z.invalid_return_type,returnTypeError:l}})}c(i,"makeReturnsIssue");let n={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof rr){let s=this;return nt(async function(...l){let u=new ht([]),f=await s._def.args.parseAsync(l,n).catch(p=>{throw u.addIssue(o(l,p)),u}),d=await Reflect.apply(a,this,f);return await s._def.returns._def.type.parseAsync(d,n).catch(p=>{throw u.addIssue(i(d,p)),u})})}else{let s=this;return nt(function(...l){let u=s._def.args.safeParse(l,n);if(!u.success)throw new ht([o(l,u.error)]);let f=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(f,n);if(!d.success)throw new ht([i(f,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Xr({...this._def,args:It.create(e).rest(Nt.create())})}returns(e){return new Xr({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,o){return new Xr({args:e||It.create([]).rest(Nt.create()),returns:r||Nt.create(),typeName:_e.ZodFunction,...Me(o)})}};c(Xr,"ZodFunction");var Di=Xr,ia=class ia extends Ce{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})}};c(ia,"ZodLazy");var Tr=ia;Tr.create=(t,e)=>new Tr({getter:t,typeName:_e.ZodLazy,...Me(e)});var oa=class oa extends Ce{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return q(r,{received:r.data,code:Z.invalid_literal,expected:this._def.value}),Te}return{status:"valid",value:e.data}}get value(){return this._def.value}};c(oa,"ZodLiteral");var Sr=oa;Sr.create=(t,e)=>new Sr({value:t,typeName:_e.ZodLiteral,...Me(e)});function Cl(t,e){return new kr({values:t,typeName:_e.ZodEnum,...Me(e)})}c(Cl,"createZodEnum");var Rn=class Rn extends Ce{constructor(){super(...arguments),Dn.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),o=this._def.values;return q(r,{expected:Pe.joinValues(o),received:r.parsedType,code:Z.invalid_type}),Te}if(wi(this,Dn,"f")||Sl(this,Dn,new Set(this._def.values),"f"),!wi(this,Dn,"f").has(e.data)){let r=this._getOrReturnCtx(e),o=this._def.values;return q(r,{received:r.data,code:Z.invalid_enum_value,options:o}),Te}return nt(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 Rn.create(e,{...this._def,...r})}exclude(e,r=this._def){return Rn.create(this.options.filter(o=>!e.includes(o)),{...this._def,...r})}};c(Rn,"ZodEnum");var kr=Rn;Dn=new WeakMap;kr.create=Cl;var aa=class aa extends Ce{constructor(){super(...arguments),En.set(this,void 0)}_parse(e){let r=Pe.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(e);if(o.parsedType!==ee.string&&o.parsedType!==ee.number){let i=Pe.objectValues(r);return q(o,{expected:Pe.joinValues(i),received:o.parsedType,code:Z.invalid_type}),Te}if(wi(this,En,"f")||Sl(this,En,new Set(Pe.getValidEnumValues(this._def.values)),"f"),!wi(this,En,"f").has(e.data)){let i=Pe.objectValues(r);return q(o,{received:o.data,code:Z.invalid_enum_value,options:i}),Te}return nt(e.data)}get enum(){return this._def.values}};c(aa,"ZodNativeEnum");var wr=aa;En=new WeakMap;wr.create=(t,e)=>new wr({values:t,typeName:_e.ZodNativeEnum,...Me(e)});var sa=class sa extends Ce{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ee.promise&&r.common.async===!1)return q(r,{code:Z.invalid_type,expected:ee.promise,received:r.parsedType}),Te;let o=r.parsedType===ee.promise?r.data:Promise.resolve(r.data);return nt(o.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};c(sa,"ZodPromise");var rr=sa;rr.create=(t,e)=>new rr({type:t,typeName:_e.ZodPromise,...Me(e)});var la=class la extends Ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:o}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:c(a=>{q(o,a),a.fatal?r.abort():r.dirty()},"addIssue"),get path(){return o.path}};if(n.addIssue=n.addIssue.bind(n),i.type==="preprocess"){let a=i.transform(o.data,n);if(o.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return Te;let l=await this._def.schema._parseAsync({data:s,path:o.path,parent:o});return l.status==="aborted"?Te:l.status==="dirty"||r.value==="dirty"?Zr(l.value):l});{if(r.value==="aborted")return Te;let s=this._def.schema._parseSync({data:a,path:o.path,parent:o});return s.status==="aborted"?Te:s.status==="dirty"||r.value==="dirty"?Zr(s.value):s}}if(i.type==="refinement"){let a=c(s=>{let l=i.refinement(s,n);if(o.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s},"executeRefinement");if(o.common.async===!1){let s=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return s.status==="aborted"?Te:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(s=>s.status==="aborted"?Te:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(o.common.async===!1){let a=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!Un(a))return a;let s=i.transform(a.value,n);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(a=>Un(a)?Promise.resolve(i.transform(a.value,n)).then(s=>({status:r.value,value:s})):a);Pe.assertNever(i)}};c(la,"ZodEffects");var pt=la;pt.create=(t,e,r)=>new pt({schema:t,typeName:_e.ZodEffects,effect:e,...Me(r)});pt.createWithPreprocess=(t,e,r)=>new pt({schema:e,effect:{type:"preprocess",transform:t},typeName:_e.ZodEffects,...Me(r)});var ua=class ua extends Ce{_parse(e){return this._getType(e)===ee.undefined?nt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c(ua,"ZodOptional");var yt=ua;yt.create=(t,e)=>new yt({innerType:t,typeName:_e.ZodOptional,...Me(e)});var ca=class ca extends Ce{_parse(e){return this._getType(e)===ee.null?nt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c(ca,"ZodNullable");var Pt=ca;Pt.create=(t,e)=>new Pt({innerType:t,typeName:_e.ZodNullable,...Me(e)});var fa=class fa extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),o=r.data;return r.parsedType===ee.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};c(fa,"ZodDefault");var Mr=fa;Mr.create=(t,e)=>new Mr({innerType:t,typeName:_e.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Me(e)});var da=class da extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),o={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return Ln(i)?i.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ht(o.common.issues)},input:o.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ht(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}};c(da,"ZodCatch");var Cr=da;Cr.create=(t,e)=>new Cr({innerType:t,typeName:_e.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Me(e)});var ha=class ha extends Ce{_parse(e){if(this._getType(e)!==ee.nan){let o=this._getOrReturnCtx(e);return q(o,{code:Z.invalid_type,expected:ee.nan,received:o.parsedType}),Te}return{status:"valid",value:e.data}}};c(ha,"ZodNaN");var en=ha;en.create=t=>new en({typeName:_e.ZodNaN,...Me(t)});var tf=Symbol("zod_brand"),pa=class pa extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),o=r.data;return this._def.type._parse({data:o,path:r.path,parent:r})}unwrap(){return this._def.type}};c(pa,"ZodBranded");var Gn=pa,Ri=class Ri extends Ce{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.common.async)return c(async()=>{let n=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return n.status==="aborted"?Te:n.status==="dirty"?(r.dirty(),Zr(n.value)):this._def.out._parseAsync({data:n.value,path:o.path,parent:o})},"handleAsync")();{let i=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return i.status==="aborted"?Te:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:o.path,parent:o})}}static create(e,r){return new Ri({in:e,out:r,typeName:_e.ZodPipeline})}};c(Ri,"ZodPipeline");var Fn=Ri,ma=class ma extends Ce{_parse(e){let r=this._def.innerType._parse(e),o=c(i=>(Un(i)&&(i.value=Object.freeze(i.value)),i),"freeze");return Ln(r)?r.then(i=>o(i)):o(r)}unwrap(){return this._def.innerType}};c(ma,"ZodReadonly");var Dr=ma;Dr.create=(t,e)=>new Dr({innerType:t,typeName:_e.ZodReadonly,...Me(e)});function Dl(t,e={},r){return t?tr.create().superRefine((o,i)=>{var n,a;if(!t(o)){let s=typeof e=="function"?e(o):typeof e=="string"?{message:e}:e,l=(a=(n=s.fatal)!==null&&n!==void 0?n:r)!==null&&a!==void 0?a:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):tr.create()}c(Dl,"custom");var rf={object:ut.lazycreate},_e;(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"})(_e||(_e={}));var nf=c((t,e={message:"Input not instance of ".concat(t.name)})=>Dl(r=>r instanceof t,e),"instanceOfType"),El=er.create,Al=pr.create,of=en.create,af=mr.create,Ol=gr.create,sf=vr.create,lf=Jr.create,uf=yr.create,cf=br.create,ff=tr.create,df=Nt.create,hf=Mt.create,pf=qr.create,mf=jt.create,gf=ut.create,vf=ut.strictCreate,yf=xr.create,bf=Mi.create,xf=_r.create,_f=It.create,Tf=Ci.create,Sf=Qr.create,kf=$r.create,wf=Di.create,Mf=Tr.create,Cf=Sr.create,Df=kr.create,Ef=wr.create,Af=rr.create,_l=pt.create,Of=yt.create,If=Pt.create,Pf=pt.createWithPreprocess,Rf=Fn.create,Uf=c(()=>El().optional(),"ostring"),Lf=c(()=>Al().optional(),"onumber"),Gf=c(()=>Ol().optional(),"oboolean"),Ff={string:c(t=>er.create({...t,coerce:!0}),"string"),number:c(t=>pr.create({...t,coerce:!0}),"number"),boolean:c(t=>gr.create({...t,coerce:!0}),"boolean"),bigint:c(t=>mr.create({...t,coerce:!0}),"bigint"),date:c(t=>vr.create({...t,coerce:!0}),"date")},Bf=Te,J=Object.freeze({__proto__:null,defaultErrorMap:Kr,setErrorMap:Fc,getErrorMap:Si,makeIssue:ki,EMPTY_PATH:Bc,addIssueToContext:q,ParseStatus:$e,INVALID:Te,DIRTY:Zr,OK:nt,isAborted:zo,isDirty:Vo,isValid:Un,isAsync:Ln,get util(){return Pe},get objectUtil(){return jo},ZodParsedType:ee,getParsedType:$t,ZodType:Ce,datetimeRegex:Ml,ZodString:er,ZodNumber:pr,ZodBigInt:mr,ZodBoolean:gr,ZodDate:vr,ZodSymbol:Jr,ZodUndefined:yr,ZodNull:br,ZodAny:tr,ZodUnknown:Nt,ZodNever:Mt,ZodVoid:qr,ZodArray:jt,ZodObject:ut,ZodUnion:xr,ZodDiscriminatedUnion:Mi,ZodIntersection:_r,ZodTuple:It,ZodRecord:Ci,ZodMap:Qr,ZodSet:$r,ZodFunction:Di,ZodLazy:Tr,ZodLiteral:Sr,ZodEnum:kr,ZodNativeEnum:wr,ZodPromise:rr,ZodEffects:pt,ZodTransformer:pt,ZodOptional:yt,ZodNullable:Pt,ZodDefault:Mr,ZodCatch:Cr,ZodNaN:en,BRAND:tf,ZodBranded:Gn,ZodPipeline:Fn,ZodReadonly:Dr,custom:Dl,Schema:Ce,ZodSchema:Ce,late:rf,get ZodFirstPartyTypeKind(){return _e},coerce:Ff,any:ff,array:mf,bigint:af,boolean:Ol,date:sf,discriminatedUnion:bf,effect:_l,enum:Df,function:wf,instanceof:nf,intersection:xf,lazy:Mf,literal:Cf,map:Sf,nan:of,nativeEnum:Ef,never:hf,null:cf,nullable:If,number:Al,object:gf,oboolean:Gf,onumber:Lf,optional:Of,ostring:Uf,pipeline:Rf,preprocess:Pf,promise:Af,record:Tf,set:kf,strictObject:vf,string:El,symbol:lf,transformer:_l,tuple:_f,undefined:uf,union:yf,unknown:df,void:pf,NEVER:Bf,ZodIssueCode:Z,quotelessJson:Gc,ZodError:ht});P();function Vi(t){return(t%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}c(Vi,"normalizeAngle");P();P();P();P();P();P();P();P();var it=63710088e-1,cu={centimeters:it*100,centimetres:it*100,degrees:it/111325,feet:it*3.28084,inches:it*39.37,kilometers:it/1e3,kilometres:it/1e3,meters:it,metres:it,miles:it/1609.344,millimeters:it*1e3,millimetres:it*1e3,nauticalmiles:it/1852,radians:1,yards:it*1.0936},zg={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/it,yards:1.0936133};function nr(t,e,r){r===void 0&&(r={});var o={type:"Feature"};return(r.id===0||r.id)&&(o.id=r.id),r.bbox&&(o.bbox=r.bbox),o.properties=e||{},o.geometry=t,o}c(nr,"feature");function Oh(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(!uu(t[0])||!uu(t[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:t};return nr(o,e,r)}c(Oh,"point");function Vg(t,e,r){r===void 0&&(r={});for(var o=0,i=t;o<i.length;o++){var n=i[o];if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<n[n.length-1].length;a++)if(n[n.length-1][a]!==n[0][a])throw new Error("First and last Position are not equivalent.")}var s={type:"Polygon",coordinates:t};return nr(s,e,r)}c(Vg,"polygon");function fu(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 o={type:"LineString",coordinates:t};return nr(o,e,r)}c(fu,"lineString");function Wg(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}c(Wg,"featureCollection");function Hg(t,e,r){r===void 0&&(r={});var o={type:"MultiLineString",coordinates:t};return nr(o,e,r)}c(Hg,"multiLineString");function Zg(t,e,r){r===void 0&&(r={});var o={type:"MultiPolygon",coordinates:t};return nr(o,e,r)}c(Zg,"multiPolygon");function Yg(t,e){e===void 0&&(e="kilometers");var r=cu[e];if(!r)throw new Error(e+" units is invalid");return t*r}c(Yg,"radiansToLength");function Xg(t,e){e===void 0&&(e="kilometers");var r=cu[e];if(!r)throw new Error(e+" units is invalid");return t/r}c(Xg,"lengthToRadians");function Kg(t){var e=t%(2*Math.PI);return e*180/Math.PI}c(Kg,"radiansToDegrees");function Jg(t){var e=t%360;return e*Math.PI/180}c(Jg,"degreesToRadians");function uu(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}c(uu,"isNumber");function Wi(t,e,r){if(t!==null)for(var o,i,n,a,s,l,u,f=0,d=0,h,p=t.type,v=p==="FeatureCollection",g=p==="Feature",b=v?t.features.length:1,A=0;A<b;A++){u=v?t.features[A].geometry:g?t.geometry:t,h=u?u.type==="GeometryCollection":!1,s=h?u.geometries.length:1;for(var w=0;w<s;w++){var x=0,T=0;if(a=h?u.geometries[w]:u,a!==null){l=a.coordinates;var M=a.type;switch(f=r&&(M==="Polygon"||M==="MultiPolygon")?1:0,M){case null:break;case"Point":if(e(l,d,A,x,T)===!1)return!1;d++,x++;break;case"LineString":case"MultiPoint":for(o=0;o<l.length;o++){if(e(l[o],d,A,x,T)===!1)return!1;d++,M==="MultiPoint"&&x++}M==="LineString"&&x++;break;case"Polygon":case"MultiLineString":for(o=0;o<l.length;o++){for(i=0;i<l[o].length-f;i++){if(e(l[o][i],d,A,x,T)===!1)return!1;d++}M==="MultiLineString"&&x++,M==="Polygon"&&T++}M==="Polygon"&&x++;break;case"MultiPolygon":for(o=0;o<l.length;o++){for(T=0,i=0;i<l[o].length;i++){for(n=0;n<l[o][i].length-f;n++){if(e(l[o][i][n],d,A,x,T)===!1)return!1;d++}T++}x++}break;case"GeometryCollection":for(o=0;o<a.geometries.length;o++)if(Wi(a.geometries[o],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}c(Wi,"coordEach");function rv(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++);}c(rv,"featureEach");function Ih(t,e){var r,o,i,n,a,s,l,u,f,d,h=0,p=t.type==="FeatureCollection",v=t.type==="Feature",g=p?t.features.length:1;for(r=0;r<g;r++){for(s=p?t.features[r].geometry:v?t.geometry:t,u=p?t.features[r].properties:v?t.properties:{},f=p?t.features[r].bbox:v?t.bbox:void 0,d=p?t.features[r].id:v?t.id:void 0,l=s?s.type==="GeometryCollection":!1,a=l?s.geometries.length:1,i=0;i<a;i++){if(n=l?s.geometries[i]:s,n===null){if(e(null,h,u,f,d)===!1)return!1;continue}switch(n.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(n,h,u,f,d)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<n.geometries.length;o++)if(e(n.geometries[o],h,u,f,d)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}c(Ih,"geomEach");function Ph(t,e){Ih(t,function(r,o,i,n,a){var s=r===null?null:r.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return e(nr(r,i,{bbox:n,id:a}),o,0)===!1?!1:void 0}var l;switch(s){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var u=0;u<r.coordinates.length;u++){var f=r.coordinates[u],d={type:l,coordinates:f};if(e(nr(d,i),o,u)===!1)return!1}})}c(Ph,"flattenEach");function Rh(t,e){Ph(t,function(r,o,i){var n=0;if(r.geometry){var a=r.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var s,l=0,u=0,f=0;if(Wi(r,function(d,h,p,v,g){if(s===void 0||o>l||v>u||g>f){s=d,l=o,u=v,f=g,n=0;return}var b=fu([s,d],r.properties);if(e(b,o,i,g,n)===!1)return!1;n++,s=d})===!1)return!1}}})}c(Rh,"segmentEach");function nv(t,e,r){var o=r,i=!1;return Rh(t,function(n,a,s,l,u){i===!1&&r===void 0?o=n:o=e(o,n,a,s,l,u),i=!0}),o}c(nv,"segmentReduce");function Ca(t){var e=[1/0,1/0,-1/0,-1/0];return Wi(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}c(Ca,"bbox");Ca.default=Ca;var du=Ca;function hu(t){return du(t)}c(hu,"getBoundingBoxFromFeature");P();var Da="#ffffff";var Aa=class Aa{constructor(e={}){m(this,"initialColor",Da);m(this,"color",Da);m(this,"initialTopColor");m(this,"topColor");m(this,"topTexture");m(this,"texture");m(this,"hoverColor");m(this,"dirty",!0);m(this,"visible",!0);m(this,"opacity",1);m(this,"width",.1);m(this,"height",.1);m(this,"initialHeight",.1);m(this,"altitude",0);m(this,"join","round");m(this,"cap","round");m(this,"outline",!0);m(this,"showImage",!0);m(this,"flipImageToFaceCamera",!0);m(this,"url");m(this,"side","double");m(this,"renderOrder",0);this.color=(e==null?void 0:e.color)!==void 0?e.color:this.color,this.initialColor=this.color,this.width=(e==null?void 0:e.width)!==void 0?e.width:this.width,this.opacity=(e==null?void 0:e.opacity)!==void 0?e.opacity:this.opacity,this.visible=(e==null?void 0:e.visible)!==void 0?e.visible:this.visible,this.height=(e==null?void 0:e.height)!==void 0?e.height:this.height,this.initialHeight=this.height,this.altitude=(e==null?void 0:e.altitude)!==void 0?e.altitude:this.altitude,this.join=(e==null?void 0:e.join)!==void 0?e.join:this.join,this.cap=(e==null?void 0:e.cap)!==void 0?e.cap:this.cap,this.topColor=e==null?void 0:e.topColor,this.initialTopColor=this.topColor,this.texture=e==null?void 0:e.texture,this.topTexture=e==null?void 0:e.topTexture,this.outline=(e==null?void 0:e.outline)!==void 0?!!e.outline:this.outline,this.showImage=(e==null?void 0:e.showImage)!==void 0?e.showImage:this.showImage,this.flipImageToFaceCamera=(e==null?void 0:e.flipImageToFaceCamera)!==void 0?e.flipImageToFaceCamera:this.flipImageToFaceCamera,this.url=e==null?void 0:e.url,this.side=(e==null?void 0:e.side)!==void 0?e.side:this.side,this.renderOrder=(e==null?void 0:e.renderOrder)!==void 0?e.renderOrder:this.renderOrder}};c(Aa,"StyleComponent");var Ea=Aa;var Oa=class Oa extends rl{constructor(){super(...arguments);m(this,"type","entityBatchedMesh");m(this,"userData",{entities:{}})}};c(Oa,"EntityBatchedMesh");var ir=Oa,Wn,Hn,Or,Ia=class Ia{constructor(e){m(this,"mesh");m(this,"focusMesh");m(this,"outline");m(this,"imageMesh");m(this,"textMesh");m(this,"textEntityId");m(this,"type","geometry");m(this,"dirty",!0);m(this,"detached",!1);m(this,"instanceIndex",-1);m(this,"geometry");m(this,"material");m(this,"feature");m(this,"currentHeight",.1);m(this,"focusable",!1);m(this,"color",new lt);m(this,"topColor",new lt);m(this,"position",new Ne);ft(this,Wn,0);ft(this,Hn,1);ft(this,Or);m(this,"texturesVisible",!1);this.feature=e}get visible(){return this.mesh&&this.instanceIndex!==-1?this.mesh.getVisibleAt(this.instanceIndex):!1}set visible(e){this.mesh&&this.instanceIndex!==-1&&this.mesh.setVisibleAt(this.instanceIndex,e)}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(e){this.mesh&&(this.mesh.renderOrder=e)}setColor(e,r){this.color.set(e),this.topColor.set(r),this.material&&this.material.setColor(this.instanceIndex,this.color,this.topColor)}getColor(){var e;return(e=this.material)==null?void 0:e.getColor(this.instanceIndex)}get altitude(){return Ge(this,Wn)}set altitude(e){this.mesh&&(this.mesh.position.z=e,Je(this,Wn,e))}get opacity(){return Ge(this,Hn)}set opacity(e){if(this.material&&(this.material.opacity=e,this.material.transparent=e<1,this.material.needsUpdate=!0),this.imageMesh){let r=Array.isArray(this.imageMesh.material)?this.imageMesh.material:[this.imageMesh.material];for(let o of r)o.opacity=e,o.needsUpdate=!0}Je(this,Hn,e)}get texture(){var e,r;return(r=(e=this.material)==null?void 0:e.texture)==null?void 0:r.image.src}set texture(e){this.material&&(this.material.texture=e)}get textureInstance(){var e;return(e=this.material)==null?void 0:e.texture}set topTexture(e){this.material&&(this.material.topTexture=e)}get topTexture(){var e,r;return(r=(e=this.material)==null?void 0:e.topTexture)==null?void 0:r.image.src}get topTextureInstance(){var e;return(e=this.material)==null?void 0:e.topTexture}set blendTexture(e){this.material&&(this.material.blendTexture=e)}get featureBbox(){return Ge(this,Or)?Ge(this,Or):(Je(this,Or,hu(this.feature)),Ge(this,Or))}showTextures(){this.material&&(this.material.showTextures(this.instanceIndex),this.texturesVisible=!0)}hideTextures(){this.material&&(this.material.hideTextures(this.instanceIndex),this.texturesVisible=!1)}removeSideTexture(){this.material&&this.material.removeSideTexture(this.instanceIndex)}removeTopTexture(){this.material&&this.material.removeTopTexture(this.instanceIndex)}};Wn=new WeakMap,Hn=new WeakMap,Or=new WeakMap,c(Ia,"MeshComponent");var Rt=Ia;P();var pu="#ffffff",or,Pa=class Pa{constructor(e={}){m(this,"color",pu);m(this,"initialColor",pu);m(this,"topColor");m(this,"initialTopColor");m(this,"opacity",1);m(this,"height");ft(this,or);m(this,"outline",!0);m(this,"texture");m(this,"topTexture");m(this,"dirty",!0);var r,o;this.color=(r=e==null?void 0:e.color)!=null?r:this.color,this.initialColor=this.color,this.topColor=e==null?void 0:e.topColor,this.initialTopColor=this.topColor,this.opacity=(o=e==null?void 0:e.opacity)!=null?o:this.opacity,this.height=e==null?void 0:e.height,this.shading=e==null?void 0:e.shading,this.outline=(e==null?void 0:e.outline)!==void 0?!!e.outline:this.outline}get shading(){return Ge(this,or)}set shading(e){var r;if(!e){Je(this,or,void 0);return}Je(this,or,(r=Ge(this,or))!=null?r:{start:0,end:0,intensity:0}),Object.assign(Ge(this,or),e)}};or=new WeakMap,c(Pa,"GeometryGroupStyleComponent");var Hi=Pa;P();P();function on(t){var r;let e=(r=t.parent)==null?void 0:r.children.find(o=>o.userData.outlineOfEntityId===t.userData.entityId);return e instanceof xi?e:void 0}c(on,"findOutline");P();P();P();P();var Ra=class Ra{constructor(){m(this,"hover",!1);m(this,"dirty",!1)}};c(Ra,"InteractionComponent");var an=Ra;P();P();function Zi(t){"@babel/helpers - typeof";return Zi=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},Zi(t)}c(Zi,"_typeof");var Lh=/^\s+/,Gh=/\s+$/;function se(t,e){if(t=t||"",e=e||{},t instanceof se)return t;if(!(this instanceof se))return new se(t,e);var r=Fh(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}c(se,"tinycolor");se.prototype={isDark:c(function(){return this.getBrightness()<128},"isDark"),isLight:c(function(){return!this.isDark()},"isLight"),isValid:c(function(){return this._ok},"isValid"),getOriginalInput:c(function(){return this._originalInput},"getOriginalInput"),getFormat:c(function(){return this._format},"getFormat"),getAlpha:c(function(){return this._a},"getAlpha"),getBrightness:c(function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},"getBrightness"),getLuminance:c(function(){var e=this.toRgb(),r,o,i,n,a,s;return r=e.r/255,o=e.g/255,i=e.b/255,r<=.03928?n=r/12.92:n=Math.pow((r+.055)/1.055,2.4),o<=.03928?a=o/12.92:a=Math.pow((o+.055)/1.055,2.4),i<=.03928?s=i/12.92:s=Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*a+.0722*s},"getLuminance"),setAlpha:c(function(e){return this._a=_u(e),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:c(function(){var e=gu(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},"toHsv"),toHsvString:c(function(){var e=gu(this._r,this._g,this._b),r=Math.round(e.h*360),o=Math.round(e.s*100),i=Math.round(e.v*100);return this._a==1?"hsv("+r+", "+o+"%, "+i+"%)":"hsva("+r+", "+o+"%, "+i+"%, "+this._roundA+")"},"toHsvString"),toHsl:c(function(){var e=mu(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},"toHsl"),toHslString:c(function(){var e=mu(this._r,this._g,this._b),r=Math.round(e.h*360),o=Math.round(e.s*100),i=Math.round(e.l*100);return this._a==1?"hsl("+r+", "+o+"%, "+i+"%)":"hsla("+r+", "+o+"%, "+i+"%, "+this._roundA+")"},"toHslString"),toHex:c(function(e){return vu(this._r,this._g,this._b,e)},"toHex"),toHexString:c(function(e){return"#"+this.toHex(e)},"toHexString"),toHex8:c(function(e){return zh(this._r,this._g,this._b,this._a,e)},"toHex8"),toHex8String:c(function(e){return"#"+this.toHex8(e)},"toHex8String"),toRgb:c(function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},"toRgb"),toRgbString:c(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:c(function(){return{r:Math.round(Ze(this._r,255)*100)+"%",g:Math.round(Ze(this._g,255)*100)+"%",b:Math.round(Ze(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:c(function(){return this._a==1?"rgb("+Math.round(Ze(this._r,255)*100)+"%, "+Math.round(Ze(this._g,255)*100)+"%, "+Math.round(Ze(this._b,255)*100)+"%)":"rgba("+Math.round(Ze(this._r,255)*100)+"%, "+Math.round(Ze(this._g,255)*100)+"%, "+Math.round(Ze(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:c(function(){return this._a===0?"transparent":this._a<1?!1:ep[vu(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:c(function(e){var r="#"+yu(this._r,this._g,this._b,this._a),o=r,i=this._gradientType?"GradientType = 1, ":"";if(e){var n=se(e);o="#"+yu(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+o+")"},"toFilter"),toString:c(function(e){var r=!!e;e=e||this._format;var o=!1,i=this._a<1&&this._a>=0,n=!r&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return n?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(o=this.toRgbString()),e==="prgb"&&(o=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(o=this.toHexString()),e==="hex3"&&(o=this.toHexString(!0)),e==="hex4"&&(o=this.toHex8String(!0)),e==="hex8"&&(o=this.toHex8String()),e==="name"&&(o=this.toName()),e==="hsl"&&(o=this.toHslString()),e==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},"toString"),clone:c(function(){return se(this.toString())},"clone"),_applyModification:c(function(e,r){var o=e.apply(null,[this].concat([].slice.call(r)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},"_applyModification"),lighten:c(function(){return this._applyModification(Zh,arguments)},"lighten"),brighten:c(function(){return this._applyModification(Yh,arguments)},"brighten"),darken:c(function(){return this._applyModification(Xh,arguments)},"darken"),desaturate:c(function(){return this._applyModification(Vh,arguments)},"desaturate"),saturate:c(function(){return this._applyModification(Wh,arguments)},"saturate"),greyscale:c(function(){return this._applyModification(Hh,arguments)},"greyscale"),spin:c(function(){return this._applyModification(Kh,arguments)},"spin"),_applyCombination:c(function(e,r){return e.apply(null,[this].concat([].slice.call(r)))},"_applyCombination"),analogous:c(function(){return this._applyCombination(Qh,arguments)},"analogous"),complement:c(function(){return this._applyCombination(Jh,arguments)},"complement"),monochromatic:c(function(){return this._applyCombination($h,arguments)},"monochromatic"),splitcomplement:c(function(){return this._applyCombination(qh,arguments)},"splitcomplement"),triad:c(function(){return this._applyCombination(bu,[3])},"triad"),tetrad:c(function(){return this._applyCombination(bu,[4])},"tetrad")};se.fromRatio=function(t,e){if(Zi(t)=="object"){var r={};for(var o in t)t.hasOwnProperty(o)&&(o==="a"?r[o]=t[o]:r[o]=Zn(t[o]));t=r}return se(t,e)};function Fh(t){var e={r:0,g:0,b:0},r=1,o=null,i=null,n=null,a=!1,s=!1;return typeof t=="string"&&(t=ip(t)),Zi(t)=="object"&&(Ht(t.r)&&Ht(t.g)&&Ht(t.b)?(e=Bh(t.r,t.g,t.b),a=!0,s=String(t.r).substr(-1)==="%"?"prgb":"rgb"):Ht(t.h)&&Ht(t.s)&&Ht(t.v)?(o=Zn(t.s),i=Zn(t.v),e=jh(t.h,o,i),a=!0,s="hsv"):Ht(t.h)&&Ht(t.s)&&Ht(t.l)&&(o=Zn(t.s),n=Zn(t.l),e=Nh(t.h,o,n),a=!0,s="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=_u(r),{ok:a,format:t.format||s,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}}c(Fh,"inputToRGB");function Bh(t,e,r){return{r:Ze(t,255)*255,g:Ze(e,255)*255,b:Ze(r,255)*255}}c(Bh,"rgbToRgb");function mu(t,e,r){t=Ze(t,255),e=Ze(e,255),r=Ze(r,255);var o=Math.max(t,e,r),i=Math.min(t,e,r),n,a,s=(o+i)/2;if(o==i)n=a=0;else{var l=o-i;switch(a=s>.5?l/(2-o-i):l/(o+i),o){case t:n=(e-r)/l+(e<r?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4;break}n/=6}return{h:n,s:a,l:s}}c(mu,"rgbToHsl");function Nh(t,e,r){var o,i,n;t=Ze(t,360),e=Ze(e,100),r=Ze(r,100);function a(u,f,d){return d<0&&(d+=1),d>1&&(d-=1),d<1/6?u+(f-u)*6*d:d<1/2?f:d<2/3?u+(f-u)*(2/3-d)*6:u}if(c(a,"hue2rgb"),e===0)o=i=n=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;o=a(l,s,t+1/3),i=a(l,s,t),n=a(l,s,t-1/3)}return{r:o*255,g:i*255,b:n*255}}c(Nh,"hslToRgb");function gu(t,e,r){t=Ze(t,255),e=Ze(e,255),r=Ze(r,255);var o=Math.max(t,e,r),i=Math.min(t,e,r),n,a,s=o,l=o-i;if(a=o===0?0:l/o,o==i)n=0;else{switch(o){case t:n=(e-r)/l+(e<r?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4;break}n/=6}return{h:n,s:a,v:s}}c(gu,"rgbToHsv");function jh(t,e,r){t=Ze(t,360)*6,e=Ze(e,100),r=Ze(r,100);var o=Math.floor(t),i=t-o,n=r*(1-e),a=r*(1-i*e),s=r*(1-(1-i)*e),l=o%6,u=[r,a,n,n,s,r][l],f=[s,r,r,a,n,n][l],d=[n,n,s,r,r,a][l];return{r:u*255,g:f*255,b:d*255}}c(jh,"hsvToRgb");function vu(t,e,r,o){var i=[Dt(Math.round(t).toString(16)),Dt(Math.round(e).toString(16)),Dt(Math.round(r).toString(16))];return o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}c(vu,"rgbToHex");function zh(t,e,r,o,i){var n=[Dt(Math.round(t).toString(16)),Dt(Math.round(e).toString(16)),Dt(Math.round(r).toString(16)),Dt(Tu(o))];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[3].charAt(0)==n[3].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0)+n[3].charAt(0):n.join("")}c(zh,"rgbaToHex");function yu(t,e,r,o){var i=[Dt(Tu(o)),Dt(Math.round(t).toString(16)),Dt(Math.round(e).toString(16)),Dt(Math.round(r).toString(16))];return i.join("")}c(yu,"rgbaToArgbHex");se.equals=function(t,e){return!t||!e?!1:se(t).toRgbString()==se(e).toRgbString()};se.random=function(){return se.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Vh(t,e){e=e===0?0:e||10;var r=se(t).toHsl();return r.s-=e/100,r.s=Yi(r.s),se(r)}c(Vh,"_desaturate");function Wh(t,e){e=e===0?0:e||10;var r=se(t).toHsl();return r.s+=e/100,r.s=Yi(r.s),se(r)}c(Wh,"_saturate");function Hh(t){return se(t).desaturate(100)}c(Hh,"_greyscale");function Zh(t,e){e=e===0?0:e||10;var r=se(t).toHsl();return r.l+=e/100,r.l=Yi(r.l),se(r)}c(Zh,"_lighten");function Yh(t,e){e=e===0?0:e||10;var r=se(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)))),se(r)}c(Yh,"_brighten");function Xh(t,e){e=e===0?0:e||10;var r=se(t).toHsl();return r.l-=e/100,r.l=Yi(r.l),se(r)}c(Xh,"_darken");function Kh(t,e){var r=se(t).toHsl(),o=(r.h+e)%360;return r.h=o<0?360+o:o,se(r)}c(Kh,"_spin");function Jh(t){var e=se(t).toHsl();return e.h=(e.h+180)%360,se(e)}c(Jh,"_complement");function bu(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var r=se(t).toHsl(),o=[se(t)],i=360/e,n=1;n<e;n++)o.push(se({h:(r.h+n*i)%360,s:r.s,l:r.l}));return o}c(bu,"polyad");function qh(t){var e=se(t).toHsl(),r=e.h;return[se(t),se({h:(r+72)%360,s:e.s,l:e.l}),se({h:(r+216)%360,s:e.s,l:e.l})]}c(qh,"_splitcomplement");function Qh(t,e,r){e=e||6,r=r||30;var o=se(t).toHsl(),i=360/r,n=[se(t)];for(o.h=(o.h-(i*e>>1)+720)%360;--e;)o.h=(o.h+i)%360,n.push(se(o));return n}c(Qh,"_analogous");function $h(t,e){e=e||6;for(var r=se(t).toHsv(),o=r.h,i=r.s,n=r.v,a=[],s=1/e;e--;)a.push(se({h:o,s:i,v:n})),n=(n+s)%1;return a}c($h,"_monochromatic");se.mix=function(t,e,r){r=r===0?0:r||50;var o=se(t).toRgb(),i=se(e).toRgb(),n=r/100,a={r:(i.r-o.r)*n+o.r,g:(i.g-o.g)*n+o.g,b:(i.b-o.b)*n+o.b,a:(i.a-o.a)*n+o.a};return se(a)};se.readability=function(t,e){var r=se(t),o=se(e);return(Math.max(r.getLuminance(),o.getLuminance())+.05)/(Math.min(r.getLuminance(),o.getLuminance())+.05)};se.isReadable=function(t,e,r){var o=se.readability(t,e),i,n;switch(n=!1,i=op(r),i.level+i.size){case"AAsmall":case"AAAlarge":n=o>=4.5;break;case"AAlarge":n=o>=3;break;case"AAAsmall":n=o>=7;break}return n};se.mostReadable=function(t,e,r){var o=null,i=0,n,a,s,l;r=r||{},a=r.includeFallbackColors,s=r.level,l=r.size;for(var u=0;u<e.length;u++)n=se.readability(t,e[u]),n>i&&(i=n,o=se(e[u]));return se.isReadable(t,o,{level:s,size:l})||!a?o:(r.includeFallbackColors=!1,se.mostReadable(t,["#fff","#000"],r))};var Ua=se.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"},ep=se.hexNames=tp(Ua);function tp(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}c(tp,"flip");function _u(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}c(_u,"boundAlpha");function Ze(t,e){rp(t)&&(t="100%");var r=np(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)}c(Ze,"bound01");function Yi(t){return Math.min(1,Math.max(0,t))}c(Yi,"clamp01");function mt(t){return parseInt(t,16)}c(mt,"parseIntFromHex");function rp(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}c(rp,"isOnePointZero");function np(t){return typeof t=="string"&&t.indexOf("%")!=-1}c(np,"isPercentage");function Dt(t){return t.length==1?"0"+t:""+t}c(Dt,"pad2");function Zn(t){return t<=1&&(t=t*100+"%"),t}c(Zn,"convertToPercentage");function Tu(t){return Math.round(parseFloat(t)*255).toString(16)}c(Tu,"convertDecimalToHex");function xu(t){return mt(t)/255}c(xu,"convertHexToDecimal");var Ct=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+o),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+o),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+o),hsva:new RegExp("hsva"+i),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 Ht(t){return!!Ct.CSS_UNIT.exec(t)}c(Ht,"isValidCSSUnit");function ip(t){t=t.replace(Lh,"").replace(Gh,"").toLowerCase();var e=!1;if(Ua[t])t=Ua[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Ct.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Ct.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Ct.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Ct.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Ct.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Ct.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Ct.hex8.exec(t))?{r:mt(r[1]),g:mt(r[2]),b:mt(r[3]),a:xu(r[4]),format:e?"name":"hex8"}:(r=Ct.hex6.exec(t))?{r:mt(r[1]),g:mt(r[2]),b:mt(r[3]),format:e?"name":"hex"}:(r=Ct.hex4.exec(t))?{r:mt(r[1]+""+r[1]),g:mt(r[2]+""+r[2]),b:mt(r[3]+""+r[3]),a:xu(r[4]+""+r[4]),format:e?"name":"hex8"}:(r=Ct.hex3.exec(t))?{r:mt(r[1]+""+r[1]),g:mt(r[2]+""+r[2]),b:mt(r[3]+""+r[3]),format:e?"name":"hex"}:!1}c(ip,"stringInputToObject");function op(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}}c(op,"validateWCAG2Parms");var La=Oc(lu());P();var Su=["","","low","medium","high","always-visible"];function ku(t){return Math.min(5,Math.max(2,t))}c(ku,"clampTierNumber");function sn(t){if(typeof t=="number")return ku(t);let e=Su.indexOf(t);return e===-1?3:e}c(sn,"convertCollisionRankingTierToNumber");function Gv(t){let e=ku(t);return Su[e]}c(Gv,"convertNumberToCollisionRankingTier");var Fa=J.object({rank:J.union([J.enum(["low","medium","high","always-visible"]),J.number()]).optional(),interactive:J.boolean().optional(),appearance:J.object({margin:J.number().min(6).optional(),text:J.object({numLines:J.number().optional(),lineHeight:J.number().optional(),size:J.number().optional(),maxWidth:J.number().optional(),foregroundColor:J.string().optional(),backgroundColor:J.string().optional()}).optional(),marker:J.object({size:J.number().optional(),foregroundColor:J.object({active:J.string().optional(),inactive:J.string().optional()}).optional(),backgroundColor:J.object({active:J.string().optional(),inactive:J.string().optional()}).optional()}).optional()}).optional()});function Zv(t,e,r){J.array(J.number()).min(2).max(3).parse(t),J.string().parse(e),Fa.parse(r||{})}c(Zv,"validateLabel");var ln={margin:6,text:{numLines:2,lineHeight:1.2,size:11.5,maxWidth:150,foregroundColor:"white",backgroundColor:"#333"},marker:{size:5,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},ap={lightOnDark:{...ln,text:{...ln.text,foregroundColor:"white",backgroundColor:"#333"},marker:{...ln.marker,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},darkOnLight:{...ln,text:{...ln.text,foregroundColor:"#333",backgroundColor:"white"},marker:{...ln.marker,foregroundColor:{active:"#333",inactive:void 0},backgroundColor:{active:"white",inactive:void 0}}}},sp="LOW_PRIORITY",wu=4,lp=6,up=20,cp=2.5,fp=2,dp="cover",hp=-1/0,Mu=6.5,Cu={heightAbovePolygon:0,appearance:ap.darkOnLight};var Ir=class Ir{constructor(e,r,o){m(this,"lines",0);m(this,"id");m(this,"rank");m(this,"type","label");m(this,"initialRank");m(this,"contextConfigured",!1);m(this,"fillText");m(this,"newStyle",{});m(this,"opacity",0);m(this,"visibilityNeedsUpdate",!1);m(this,"text");m(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});m(this,"projection",new St);m(this,"labelCacheId");m(this,"_cache",{});m(this,"appearance");m(this,"options");m(this,"visible",!0);m(this,"enabled",!0);m(this,"isOccluded",!1);m(this,"offscreen",!1);m(this,"canShow",!1);m(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});m(this,"dimensions",{width:0,height:0});m(this,"currentStrategyIndex",-1);m(this,"totalMarkerSize",0);m(this,"dirty",!0);m(this,"parentDirty",!0);m(this,"collisionDirty",!0);m(this,"lastTextAlign");m(this,"imageHash");m(this,"markerSize",0);m(this,"iconVisible",!1);m(this,"dp");m(this,"animate",!0);m(this,"onStrategySelected",c(e=>{if(this.currentStrategyIndex===e)return;let r=this.strategies[e];r&&r.onStrategySelected(this),this.currentStrategyIndex=e;let o=this.style;this.style=this.newStyle,this.newStyle=o},"onStrategySelected"));m(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});var n,a;if(this.id=(n=r.id)!=null?n:rt(),this.options=(0,La.default)({},r,Cu),this.text=e,this.dp=(s=1)=>s*o.pixelRatio,typeof r.rank=="string")this.rank=sn(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let s=Math.trunc(ne.env.NODE_ENV==="test"?Ir.testId:Ir.testId*10)/10;Ir.testId+=.001,this.rank=s,this.initialRank=s}let i=(0,La.default)({},this.options.appearance,Cu.appearance);this.appearance={margin:i.margin,text:{lineHeight:i.text.lineHeight,numLines:i.text.numLines,size:i.text.size,maxWidth:i.text.maxWidth,foregroundColor:i.text.foregroundColor,backgroundColor:i.text.backgroundColor},marker:{foregroundColor:{active:i.marker.foregroundColor.active,inactive:i.marker.foregroundColor.inactive||se(i.marker.foregroundColor.active).setAlpha(.5).toRgbString()},backgroundColor:{active:i.marker.backgroundColor.active,inactive:i.marker.backgroundColor.inactive||se(i.marker.backgroundColor.active).setAlpha(.5).toRgbString()},icon:i.marker.icon,iconSize:i.marker.iconSize||up,iconPadding:(a=i.marker.iconPadding)!=null?a:fp,iconFit:i.marker.iconFit||dp,iconOverflow:i.marker.iconOverflow||"hidden",iconVisibleAtZoomLevel:i.marker.iconVisibleAtZoomLevel==null?hp:i.marker.iconVisibleAtZoomLevel}}}setEntity(){}calculateMarkerSize(){let e=this.dp();this.iconVisible&&typeof this.appearance.marker.iconSize<"u"&&this.imageHash?this.markerSize=this.dp(this.appearance.marker.iconSize):this.markerSize=this.dp(Mu),this.totalMarkerSize=Math.ceil((this.markerSize+cp)/e)}get lowPriorityStrategyIndex(){return this.text===""?-1:3}get strategies(){let{width:e,height:r}=this.dimensions,{margin:o}=this.appearance,i=Math.max(lp,o),n=this.iconVisible?i/2:0,a=this.iconVisible?this.totalMarkerSize:Mu,s=[{name:"RIGHT",getBoundingBox:c(()=>{let l=Math.max(this.totalMarkerSize,r);return[l/2+i,l/2+i,this.totalMarkerSize/2+i,this.totalMarkerSize/2+e+i]},"getBoundingBox"),onStrategySelected:c(()=>{this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=this.totalMarkerSize/2+wu,this.newStyle.textLabelVisible=!0},"onStrategySelected")},{name:"LEFT",getBoundingBox:c(()=>{let l=Math.max(this.totalMarkerSize,r);return[l/2+i,l/2+i,this.totalMarkerSize/2+e+i,this.totalMarkerSize/2+i]},"getBoundingBox"),onStrategySelected:c(()=>{this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=-e-this.totalMarkerSize/2-wu,this.newStyle.textLabelVisible=!0},"onStrategySelected")},{name:"TOP",getBoundingBox:c(()=>{let l=this.dp();return[r+this.totalMarkerSize/2/l+i,this.totalMarkerSize/2+i,e/2+i,e/2+i]},"getBoundingBox"),onStrategySelected:c(()=>{this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r-this.totalMarkerSize/2,this.newStyle.left=-e/2},"onStrategySelected")},{name:sp,getBoundingBox:c(()=>[a/2+n,a/2+n,a/2+n,a/2+n],"getBoundingBox"),onStrategySelected:c(()=>{this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0},"onStrategySelected")}];return this.text===""?[{name:"ICON_ONLY",getBoundingBox:c(()=>[this.totalMarkerSize/2+i,this.totalMarkerSize/2+i,this.totalMarkerSize/2+i,this.totalMarkerSize/2+i],"getBoundingBox"),onStrategySelected:c(()=>{this.newStyle.pinVisibility=1,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0},"onStrategySelected")}]:s}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 o=this.packedMessage.bboxes.findIndex(i=>i[4]===this.currentStrategyIndex);if(o!==-1){let i=this.packedMessage.bboxes.splice(o,1)[0];this.packedMessage.bboxes.unshift(i)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let o=0;o<this.strategies.length;o++){let i=this.strategies[o];o===this.currentStrategyIndex&&this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex?this.packedMessage.bboxes.unshift([...i.getBoundingBox(),o]):this.packedMessage.bboxes.push([...i.getBoundingBox(),o])}return this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};c(Ir,"LabelComponent"),m(Ir,"testId",0);var Ga=Ir,Du=Ga;P();var Xi=4,Ba=J.object({rank:J.union([J.enum(["low","medium","high","always-visible"]),J.number()]).optional(),interactive:J.union([J.boolean(),J.literal("pointer-events-auto")]).optional(),id:J.string().optional(),anchor:J.union([J.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]),J.array(J.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]))]).optional(),dynamicResize:J.boolean().optional(),zIndex:J.number().optional()});function ny(t,e,r){J.array(J.number()).min(2).max(3).parse(t),J.string().parse(e),Ba.parse(r)}c(ny,"validateMarker");var Pr=class Pr{constructor(e,r={}){m(this,"id");m(this,"type","marker");m(this,"rank",0);m(this,"initialRank",0);m(this,"activeAnchor","center");m(this,"pointerEvents","none");m(this,"options",{rank:"low",interactive:!1,id:"",anchor:"center",dynamicResize:!1,occluderId:0,zIndex:void 0,verticalOffset:0});m(this,"projection",new St);m(this,"enabled",!0);m(this,"canShow",!1);m(this,"visible",!0);m(this,"isOccluded",!1);m(this,"offscreen",!1);m(this,"strategyIndex",-1);m(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});m(this,"dimensions",{width:0,height:0});m(this,"containerEl");m(this,"contentEl",null);m(this,"contentHtml","");m(this,"style",{top:"0px",left:"0px"});m(this,"dirty",!1);m(this,"parentDirty",!0);m(this,"collisionDirty",!0);m(this,"visibilityNeedsUpdate","show");m(this,"animation",null);m(this,"currentStrategyIndex",-1);m(this,"onStrategySelected",c((e,r=!1)=>{var s,l;if(this.currentStrategyIndex===e||r)return;this.currentStrategyIndex=e,this.activeAnchor=(l=(s=this.strategies[e])==null?void 0:s.name)!=null?l:"center",this.containerEl.getAttribute("data-anchor")!==this.activeAnchor&&this.containerEl.setAttribute("data-anchor",this.activeAnchor);let{width:o,height:i}=this.dimensions,n=-i/2+"px",a=-o/2+"px";switch(this.style.top=n,this.style.left=a,this.activeAnchor){case"top":{this.style.top=-i+"px";break}case"bottom":{this.style.top="0px";break}case"left":{this.style.left=-o+"px";break}case"right":{this.style.left="0px";break}case"top-left":{this.style.top=-i+"px",this.style.left=-o+"px";break}case"top-right":{this.style.top=-i+"px",this.style.left="0px";break}case"bottom-left":{this.style.top="0px",this.style.left=-o+"px";break}case"bottom-right":{this.style.top="0px",this.style.left="0px";break}default:this.style.top=n,this.style.left=a}this.containerEl.style.top=this.style.top,this.containerEl.style.left=this.style.left},"onStrategySelected"));m(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!1});if(this.id=(r==null?void 0:r.id)||rt(),this.options={...this.options,...r},typeof r.rank=="string")this.rank=sn(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let i=Math.trunc(ne.env.NODE_ENV==="test"?Pr.testId:Pr.testId*10)/10;Pr.testId+=.001,this.rank=i}typeof r.interactive=="string"&&(this.pointerEvents=r.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=e,this.initialRank=this.rank;let o=document.createElement("div");o.style.opacity="0",o.innerHTML='<div class="mappedin-marker">'.concat(this.contentHtml,"</div>"),this.containerEl=o.querySelector(".mappedin-marker"),this.containerEl.setAttribute("data-marker-id",this.id.toString()),this.contentEl=this.containerEl?this.containerEl.firstElementChild:null}updateDimensions(e,r){if(e!=null&&r!=null)this.dimensions={width:e,height:r};else{let{width:o,height:i}=this.containerEl.getBoundingClientRect();this.dimensions={width:o,height:i}}Object.assign(this.containerEl,{width:this.dimensions.width+"px",height:this.dimensions.height+"px"}),this.currentStrategyIndex=-1}get strategies(){let{width:e,height:r}=this.dimensions;return(Array.isArray(this.options.anchor)?this.options.anchor:[this.options.anchor]).map(i=>({name:i,getBoundingBox:c(()=>{let n=r/2,a=r/2,s=e/2,l=e/2;switch(i){case"top":{n=r,a=0;break}case"bottom":{n=0,a=r;break}case"left":{s=e,l=0;break}case"right":{s=0,l=e;break}case"top-left":{n=r,s=e,a=0,l=0;break}case"top-right":{n=r,l=e,a=0,s=0;break}case"bottom-left":{a=r,s=e,n=0,l=0;break}case"bottom-right":{a=r,l=e,n=0,s=0;break}}return[n+Xi,a+Xi,s+Xi,l+Xi]},"getBoundingBox")}))}toPackedMessage(e=!1){var r;if(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,this.visible&&e&&this.currentStrategyIndex!==-1&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==((r=this.packedMessage.bboxes[0])==null?void 0:r[4])){let o=this.packedMessage.bboxes.findIndex(i=>i[4]===this.currentStrategyIndex);if(o!==-1){let i=this.packedMessage.bboxes.splice(o,1)[0];this.packedMessage.bboxes.unshift(i)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let o=0;o<this.strategies.length;o++){let i=this.strategies[o];o===this.currentStrategyIndex&&this.currentStrategyIndex!==-1?this.packedMessage.bboxes.unshift([...i.getBoundingBox(),o]):this.packedMessage.bboxes.push([...i.getBoundingBox(),o])}return this.collisionDirty=!1,this.packedMessage}destroy(){}};c(Pr,"MarkerComponent"),m(Pr,"testId",0);var Eu=Pr;P();var Na=class Na extends Ot{constructor(){super(...arguments);m(this,"type","geometry");m(this,"userData",{entityId:"",type:"geometry"})}raycast(r,o){this.userData.type==="model"&&this.children[0]&&r.intersectObject(this.children[0],!0).forEach(i=>{o.push(i)})}};c(Na,"Geometry3DObject3D");var Rr=Na,ja=class ja{constructor(e,r){m(this,"id",rt());m(this,"components");m(this,"entities2D",new Map);this.components=[e,r]}get object3d(){return this.components[0].mesh}get parentObject3D(){var e;return(e=this.components[0].mesh)==null?void 0:e.parent}get type(){return this.components[0].type}addEntity(e){this.parentObject3D instanceof gt?(this.parentObject3D.add(e.object3d),e.object3d.userData.parentEntityId=this.id):this.entities2D.set(e.id,e)}removeEntity(e){var r;(r=e.parentObject3D)==null||r.remove(e.object3d),this.entities2D.delete(e.id)}removeAllEntities(){for(let e of this.entities2D.values())this.removeEntity(e)}};c(ja,"Geometry3D");var Ut=ja;P();var za=class za extends Ot{};c(za,"Geometry2DObject3D");var ar=za,Va=class Va{constructor(e,r,o=0){m(this,"id");m(this,"verticalOffset");m(this,"positionDirty",!0);m(this,"occluderId");m(this,"object3d",new ar);m(this,"components");m(this,"disposed",!1);m(this,"worldPosition",new Ne);this.id=e.id||rt(),this.components=[e],this.verticalOffset=o,this.object3d=new ar,this.object3d.position.set(r.x,r.y,r.z+o),this.object3d.userData.entityId=this.id,this.object3d.userData.type=this.type}get type(){return this.components[0].type}get parentObject3D(){return this.object3d.parent}get position(){return this.object3d.getWorldPosition(this.worldPosition),this.worldPosition}setAltitude(e){this.object3d.position.z=e}};c(Va,"Geometry2D");var Zt=Va;P();P();P();P();P();function pp(){var t=Object.create(null);function e(i,n){var a=i.id,s=i.name,l=i.dependencies;l===void 0&&(l=[]);var u=i.init;u===void 0&&(u=c(function(){},"init"));var f=i.getTransferables;if(f===void 0&&(f=null),!t[a])try{l=l.map(function(h){return h&&h.isWorkerModule&&(e(h,function(p){if(p instanceof Error)throw p}),h=t[h.id].value),h}),u=o("<"+s+">.init",u),f&&(f=o("<"+s+">.getTransferables",f));var d=null;typeof u=="function"?d=u.apply(void 0,l):console.error("worker module init function failed to rehydrate"),t[a]={id:a,value:d,getTransferables:f},n(d)}catch(h){h&&h.noLog||console.error(h),n(h)}}c(e,"registerModule");function r(i,n){var a,s=i.id,l=i.args;(!t[s]||typeof t[s].value!="function")&&n(new Error("Worker module "+s+": not found or its 'init' did not return a function"));try{var u=(a=t[s]).value.apply(a,l);u&&typeof u.then=="function"?u.then(f,function(d){return n(d instanceof Error?d:new Error(""+d))}):f(u)}catch(d){n(d)}function f(d){try{var h=t[s].getTransferables&&t[s].getTransferables(d);(!h||!Array.isArray(h)||!h.length)&&(h=void 0),n(d,h)}catch(p){console.error(p),n(p)}}c(f,"handleResult")}c(r,"callModule");function o(i,n){var a=void 0;self.troikaDefine=function(l){return a=l};var s=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+" **/\n\ntroikaDefine(\n"+n+"\n)"],{type:"application/javascript"}));try{importScripts(s)}catch(l){console.error(l)}return URL.revokeObjectURL(s),delete self.troikaDefine,a}c(o,"rehydrate"),self.addEventListener("message",function(i){var n=i.data,a=n.messageId,s=n.action,l=n.data;try{s==="registerModule"&&e(l,function(u){u instanceof Error?postMessage({messageId:a,success:!1,error:u.message}):postMessage({messageId:a,success:!0,result:{isCallable:typeof u=="function"}})}),s==="callModule"&&r(l,function(u,f){u instanceof Error?postMessage({messageId:a,success:!1,error:u.message}):postMessage({messageId:a,success:!0,result:u},f||void 0)})}catch(u){postMessage({messageId:a,success:!1,error:u.stack})}})}c(pp,"workerBootstrap");function mp(t){var e=c(function(){for(var r=[],o=arguments.length;o--;)r[o]=arguments[o];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,r);throw new Error("Worker module function was called but `init` did not return a callable function")})},"moduleFunc");return e._getInitResult=function(){var r=t.dependencies,o=t.init;r=Array.isArray(r)?r.map(function(n){return n&&(n=n.onMainThread||n,n._getInitResult&&(n=n._getInitResult())),n}):[];var i=Promise.all(r).then(function(n){return o.apply(null,n)});return e._getInitResult=function(){return i},i},e}c(mp,"defineMainThreadModule");var Ou=c(function(){var t=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),t=!0}catch(r){typeof ne<"u"&&ne.env.NODE_ENV==="test"||console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+r.message+"]")}return Ou=c(function(){return t},"supportsWorkers"),t},"supportsWorkers"),gp=0,vp=0,Wa=!1,Yn=Object.create(null),Xn=Object.create(null),Ha=Object.create(null);function Ur(t){if((!t||typeof t.init!="function")&&!Wa)throw new Error("requires `options.init` function");var e=t.dependencies,r=t.init,o=t.getTransferables,i=t.workerId,n=mp(t);i==null&&(i="#default");var a="workerModule"+ ++gp,s=t.name||a,l=null;e=e&&e.map(function(f){return typeof f=="function"&&!f.workerModuleData&&(Wa=!0,f=Ur({workerId:i,name:"<"+s+"> function dependency: "+f.name,init:"function(){return (\n"+Ki(f)+"\n)}"}),Wa=!1),f&&f.workerModuleData&&(f=f.workerModuleData),f});function u(){for(var f=[],d=arguments.length;d--;)f[d]=arguments[d];if(!Ou())return n.apply(void 0,f);if(!l){l=Au(i,"registerModule",u.workerModuleData);var h=c(function(){l=null,Xn[i].delete(h)},"unregister");(Xn[i]||(Xn[i]=new Set)).add(h)}return l.then(function(p){var v=p.isCallable;if(v)return Au(i,"callModule",{id:a,args:f});throw new Error("Worker module function was called but `init` did not return a callable function")})}return c(u,"moduleFunc"),u.workerModuleData={isWorkerModule:!0,id:a,name:s,dependencies:e,init:Ki(r),getTransferables:o&&Ki(o)},u.onMainThread=n,u}c(Ur,"defineWorkerModule");function Iu(t){Xn[t]&&Xn[t].forEach(function(e){e()}),Yn[t]&&(Yn[t].terminate(),delete Yn[t])}c(Iu,"terminateWorker");function Ki(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}c(Ki,"stringifyFunction");function yp(t){var e=Yn[t];if(!e){var r=Ki(pp);e=Yn[t]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+t.replace(/\*/g,"")+" **/\n\n;("+r+")()"],{type:"application/javascript"}))),e.onmessage=function(o){var i=o.data,n=i.messageId,a=Ha[n];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete Ha[n],a(i)}}return e}c(yp,"getWorker");function Au(t,e,r){return new Promise(function(o,i){var n=++vp;Ha[n]=function(a){a.success?o(a.result):i(new Error("Error in worker "+e+" call: "+a.error))},yp(t).postMessage({messageId:n,action:e,data:r})})}c(Au,"callWorker");P();function Za(){var t=function(e){function r(N,F,y,k,D,I,C,W){var U=1-C;W.x=U*U*N+2*U*C*y+C*C*D,W.y=U*U*F+2*U*C*k+C*C*I}c(r,"pointOnQuadraticBezier");function o(N,F,y,k,D,I,C,W,U,j){var $=1-U;j.x=$*$*$*N+3*$*$*U*y+3*$*U*U*D+U*U*U*C,j.y=$*$*$*F+3*$*$*U*k+3*$*U*U*I+U*U*U*W}c(o,"pointOnCubicBezier");function i(N,F){for(var y=/([MLQCZ])([^MLQCZ]*)/g,k,D,I,C,W;k=y.exec(N);){var U=k[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(j){return parseFloat(j)});switch(k[1]){case"M":C=D=U[0],W=I=U[1];break;case"L":(U[0]!==C||U[1]!==W)&&F("L",C,W,C=U[0],W=U[1]);break;case"Q":{F("Q",C,W,C=U[2],W=U[3],U[0],U[1]);break}case"C":{F("C",C,W,C=U[4],W=U[5],U[0],U[1],U[2],U[3]);break}case"Z":(C!==D||W!==I)&&F("L",C,W,D,I);break}}}c(i,"forEachPathCommand");function n(N,F,y){y===void 0&&(y=16);var k={x:0,y:0};i(N,function(D,I,C,W,U,j,$,le,X){switch(D){case"L":F(I,C,W,U);break;case"Q":{for(var H=I,ke=C,ye=1;ye<y;ye++)r(I,C,j,$,W,U,ye/(y-1),k),F(H,ke,k.x,k.y),H=k.x,ke=k.y;break}case"C":{for(var re=I,ue=C,pe=1;pe<y;pe++)o(I,C,j,$,le,X,W,U,pe/(y-1),k),F(re,ue,k.x,k.y),re=k.x,ue=k.y;break}}})}c(n,"pathToLineSegments");var a="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",s="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",l=new WeakMap,u={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function f(N,F){var y=N.getContext?N.getContext("webgl",u):N,k=l.get(y);if(!k){let $=function(re){var ue=I[re];if(!ue&&(ue=I[re]=y.getExtension(re),!ue))throw new Error(re+" not supported");return ue},le=function(re,ue){var pe=y.createShader(ue);return y.shaderSource(pe,re),y.compileShader(pe),pe},X=function(re,ue,pe,K){if(!C[re]){var ce={},fe={},z=y.createProgram();y.attachShader(z,le(ue,y.VERTEX_SHADER)),y.attachShader(z,le(pe,y.FRAGMENT_SHADER)),y.linkProgram(z),C[re]={program:z,transaction:c(function(oe){y.useProgram(z),oe({setUniform:c(function(te,Re){for(var he=[],ge=arguments.length-2;ge-- >0;)he[ge]=arguments[ge+2];var xe=fe[Re]||(fe[Re]=y.getUniformLocation(z,Re));y["uniform"+te].apply(y,[xe].concat(he))},"setUniform"),setAttribute:c(function(te,Re,he,ge,xe){var De=ce[te];De||(De=ce[te]={buf:y.createBuffer(),loc:y.getAttribLocation(z,te),data:null}),y.bindBuffer(y.ARRAY_BUFFER,De.buf),y.vertexAttribPointer(De.loc,Re,y.FLOAT,!1,0,0),y.enableVertexAttribArray(De.loc),D?y.vertexAttribDivisor(De.loc,ge):$("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(De.loc,ge),xe!==De.data&&(y.bufferData(y.ARRAY_BUFFER,xe,he),De.data=xe)},"setAttribute")})},"transaction")}}C[re].transaction(K)},H=function(re,ue){U++;try{y.activeTexture(y.TEXTURE0+U);var pe=W[re];pe||(pe=W[re]=y.createTexture(),y.bindTexture(y.TEXTURE_2D,pe),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.NEAREST),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.NEAREST)),y.bindTexture(y.TEXTURE_2D,pe),ue(pe,U)}finally{U--}},ke=function(re,ue,pe){var K=y.createFramebuffer();j.push(K),y.bindFramebuffer(y.FRAMEBUFFER,K),y.activeTexture(y.TEXTURE0+ue),y.bindTexture(y.TEXTURE_2D,re),y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,re,0);try{pe(K)}finally{y.deleteFramebuffer(K),y.bindFramebuffer(y.FRAMEBUFFER,j[--j.length-1]||null)}},ye=function(){I={},C={},W={},U=-1,j.length=0};c($,"getExtension"),c(le,"compileShader"),c(X,"withProgram"),c(H,"withTexture"),c(ke,"withTextureFramebuffer"),c(ye,"handleContextLoss");var D=typeof WebGL2RenderingContext<"u"&&y instanceof WebGL2RenderingContext,I={},C={},W={},U=-1,j=[];y.canvas.addEventListener("webglcontextlost",function(re){ye(),re.preventDefault()},!1),l.set(y,k={gl:y,isWebGL2:D,getExtension:$,withProgram:X,withTexture:H,withTextureFramebuffer:ke,handleContextLoss:ye})}F(k)}c(f,"withWebGLContext");function d(N,F,y,k,D,I,C,W){C===void 0&&(C=15),W===void 0&&(W=null),f(N,function(U){var j=U.gl,$=U.withProgram,le=U.withTexture;le("copy",function(X,H){j.texImage2D(j.TEXTURE_2D,0,j.RGBA,D,I,0,j.RGBA,j.UNSIGNED_BYTE,F),$("copy",a,s,function(ke){var ye=ke.setUniform,re=ke.setAttribute;re("aUV",2,j.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),ye("1i","image",H),j.bindFramebuffer(j.FRAMEBUFFER,W||null),j.disable(j.BLEND),j.colorMask(C&8,C&4,C&2,C&1),j.viewport(y,k,D,I),j.scissor(y,k,D,I),j.drawArrays(j.TRIANGLES,0,3)})})})}c(d,"renderImageData");function h(N,F,y){var k=N.width,D=N.height;f(N,function(I){var C=I.gl,W=new Uint8Array(k*D*4);C.readPixels(0,0,k,D,C.RGBA,C.UNSIGNED_BYTE,W),N.width=F,N.height=y,d(C,W,0,0,k,D)})}c(h,"resizeWebGLCanvasWithoutClearing");var p=Object.freeze({__proto__:null,withWebGLContext:f,renderImageData:d,resizeWebGLCanvasWithoutClearing:h});function v(N,F,y,k,D,I){I===void 0&&(I=1);var C=new Uint8Array(N*F),W=k[2]-k[0],U=k[3]-k[1],j=[];n(y,function(re,ue,pe,K){j.push({x1:re,y1:ue,x2:pe,y2:K,minX:Math.min(re,pe),minY:Math.min(ue,K),maxX:Math.max(re,pe),maxY:Math.max(ue,K)})}),j.sort(function(re,ue){return re.maxX-ue.maxX});for(var $=0;$<N;$++)for(var le=0;le<F;le++){var X=ke(k[0]+W*($+.5)/N,k[1]+U*(le+.5)/F),H=Math.pow(1-Math.abs(X)/D,I)/2;X<0&&(H=1-H),H=Math.max(0,Math.min(255,Math.round(H*255))),C[le*N+$]=H}return C;function ke(re,ue){for(var pe=1/0,K=1/0,ce=j.length;ce--;){var fe=j[ce];if(fe.maxX+K<=re)break;if(re+K>fe.minX&&ue-K<fe.maxY&&ue+K>fe.minY){var z=A(re,ue,fe.x1,fe.y1,fe.x2,fe.y2);z<pe&&(pe=z,K=Math.sqrt(pe))}}return ye(re,ue)&&(K=-K),K}function ye(re,ue){for(var pe=0,K=j.length;K--;){var ce=j[K];if(ce.maxX<=re)break;var fe=ce.y1>ue!=ce.y2>ue&&re<(ce.x2-ce.x1)*(ue-ce.y1)/(ce.y2-ce.y1)+ce.x1;fe&&(pe+=ce.y1<ce.y2?1:-1)}return pe!==0}}c(v,"generate$2");function g(N,F,y,k,D,I,C,W,U,j){I===void 0&&(I=1),W===void 0&&(W=0),U===void 0&&(U=0),j===void 0&&(j=0),b(N,F,y,k,D,I,C,null,W,U,j)}c(g,"generateIntoCanvas$2");function b(N,F,y,k,D,I,C,W,U,j,$){I===void 0&&(I=1),U===void 0&&(U=0),j===void 0&&(j=0),$===void 0&&($=0);for(var le=v(N,F,y,k,D,I),X=new Uint8Array(le.length*4),H=0;H<le.length;H++)X[H*4+$]=le[H];d(C,X,U,j,N,F,1<<3-$,W)}c(b,"generateIntoFramebuffer$1");function A(N,F,y,k,D,I){var C=D-y,W=I-k,U=C*C+W*W,j=U?Math.max(0,Math.min(1,((N-y)*C+(F-k)*W)/U)):0,$=N-(y+j*C),le=F-(k+j*W);return $*$+le*le}c(A,"absSquareDistanceToLineSegment");var w=Object.freeze({__proto__:null,generate:v,generateIntoCanvas:g,generateIntoFramebuffer:b}),x="precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",T="precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",M="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",R=new Float32Array([0,0,2,0,0,2]),S=null,O=!1,V={},L=new WeakMap;function Q(N){if(!O&&!Y(N))throw new Error("WebGL generation not supported")}c(Q,"validateSupport");function _(N,F,y,k,D,I,C){if(I===void 0&&(I=1),C===void 0&&(C=null),!C&&(C=S,!C)){var W=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!W)throw new Error("OffscreenCanvas or DOM canvas not supported");C=S=W.getContext("webgl",{depth:!1})}Q(C);var U=new Uint8Array(N*F*4);f(C,function(X){var H=X.gl,ke=X.withTexture,ye=X.withTextureFramebuffer;ke("readable",function(re,ue){H.texImage2D(H.TEXTURE_2D,0,H.RGBA,N,F,0,H.RGBA,H.UNSIGNED_BYTE,null),ye(re,ue,function(pe){E(N,F,y,k,D,I,H,pe,0,0,0),H.readPixels(0,0,N,F,H.RGBA,H.UNSIGNED_BYTE,U)})})});for(var j=new Uint8Array(N*F),$=0,le=0;$<U.length;$+=4)j[le++]=U[$];return j}c(_,"generate$1");function G(N,F,y,k,D,I,C,W,U,j){I===void 0&&(I=1),W===void 0&&(W=0),U===void 0&&(U=0),j===void 0&&(j=0),E(N,F,y,k,D,I,C,null,W,U,j)}c(G,"generateIntoCanvas$1");function E(N,F,y,k,D,I,C,W,U,j,$){I===void 0&&(I=1),U===void 0&&(U=0),j===void 0&&(j=0),$===void 0&&($=0),Q(C);var le=[];n(y,function(X,H,ke,ye){le.push(X,H,ke,ye)}),le=new Float32Array(le),f(C,function(X){var H=X.gl,ke=X.isWebGL2,ye=X.getExtension,re=X.withProgram,ue=X.withTexture,pe=X.withTextureFramebuffer,K=X.handleContextLoss;if(ue("rawDistances",function(ce,fe){(N!==ce._lastWidth||F!==ce._lastHeight)&&H.texImage2D(H.TEXTURE_2D,0,H.RGBA,ce._lastWidth=N,ce._lastHeight=F,0,H.RGBA,H.UNSIGNED_BYTE,null),re("main",x,T,function(z){var we=z.setAttribute,oe=z.setUniform,me=!ke&&ye("ANGLE_instanced_arrays"),te=!ke&&ye("EXT_blend_minmax");we("aUV",2,H.STATIC_DRAW,0,R),we("aLineSegment",4,H.DYNAMIC_DRAW,1,le),oe.apply(void 0,["4f","uGlyphBounds"].concat(k)),oe("1f","uMaxDistance",D),oe("1f","uExponent",I),pe(ce,fe,function(Re){H.enable(H.BLEND),H.colorMask(!0,!0,!0,!0),H.viewport(0,0,N,F),H.scissor(0,0,N,F),H.blendFunc(H.ONE,H.ONE),H.blendEquationSeparate(H.FUNC_ADD,ke?H.MAX:te.MAX_EXT),H.clear(H.COLOR_BUFFER_BIT),ke?H.drawArraysInstanced(H.TRIANGLES,0,3,le.length/4):me.drawArraysInstancedANGLE(H.TRIANGLES,0,3,le.length/4)})}),re("post",a,M,function(z){z.setAttribute("aUV",2,H.STATIC_DRAW,0,R),z.setUniform("1i","tex",fe),H.bindFramebuffer(H.FRAMEBUFFER,W),H.disable(H.BLEND),H.colorMask($===0,$===1,$===2,$===3),H.viewport(U,j,N,F),H.scissor(U,j,N,F),H.drawArrays(H.TRIANGLES,0,3)})}),H.isContextLost())throw K(),new Error("webgl context lost")})}c(E,"generateIntoFramebuffer");function Y(N){var F=!N||N===S?V:N.canvas||N,y=L.get(F);if(y===void 0){O=!0;var k=null;try{var D=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],I=_(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,N);y=I&&D.length===I.length&&I.every(function(C,W){return C===D[W]}),y||(k="bad trial run results",console.info(D,I))}catch(C){y=!1,k=C.message}k&&console.warn("WebGL SDF generation not supported:",k),O=!1,L.set(F,y)}return y}c(Y,"isSupported");var B=Object.freeze({__proto__:null,generate:_,generateIntoCanvas:G,generateIntoFramebuffer:E,isSupported:Y});function ie(N,F,y,k,D,I){D===void 0&&(D=Math.max(k[2]-k[0],k[3]-k[1])/2),I===void 0&&(I=1);try{return _.apply(B,arguments)}catch(C){return console.info("WebGL SDF generation failed, falling back to JS",C),v.apply(w,arguments)}}c(ie,"generate");function ae(N,F,y,k,D,I,C,W,U,j){D===void 0&&(D=Math.max(k[2]-k[0],k[3]-k[1])/2),I===void 0&&(I=1),W===void 0&&(W=0),U===void 0&&(U=0),j===void 0&&(j=0);try{return G.apply(B,arguments)}catch($){return console.info("WebGL SDF generation failed, falling back to JS",$),g.apply(w,arguments)}}return c(ae,"generateIntoCanvas"),e.forEachPathCommand=i,e.generate=ie,e.generateIntoCanvas=ae,e.javascript=w,e.pathToLineSegments=n,e.webgl=B,e.webglUtils=p,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return t}c(Za,"SDFGenerator");P();function bp(){var t=function(e){var r={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},o={},i={};o.L=1,i[1]="L",Object.keys(r).forEach(function(K,ce){o[K]=1<<ce+1,i[o[K]]=K}),Object.freeze(o);var n=o.LRI|o.RLI|o.FSI,a=o.L|o.R|o.AL,s=o.B|o.S|o.WS|o.ON|o.FSI|o.LRI|o.RLI|o.PDI,l=o.BN|o.RLE|o.LRE|o.RLO|o.LRO|o.PDF,u=o.S|o.WS|o.B|n|o.PDI|l,f=null;function d(){if(!f){f=new Map;var K=c(function(fe){if(r.hasOwnProperty(fe)){var z=0;r[fe].split(",").forEach(function(we){var oe=we.split("+"),me=oe[0],te=oe[1];me=parseInt(me,36),te=te?parseInt(te,36):0,f.set(z+=me,o[fe]);for(var Re=0;Re<te;Re++)f.set(++z,o[fe])})}},"loop");for(var ce in r)K(ce)}}c(d,"parseData");function h(K){return d(),f.get(K.codePointAt(0))||o.L}c(h,"getBidiCharType");function p(K){return i[h(K)]}c(p,"getBidiCharTypeName");var v={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function g(K,ce){var fe=36,z=0,we=new Map,oe=ce&&new Map,me;return K.split(",").forEach(c(function te(Re){if(Re.indexOf("+")!==-1)for(var he=+Re;he--;)te(me);else{me=Re;var ge=Re.split(">"),xe=ge[0],De=ge[1];xe=String.fromCodePoint(z+=parseInt(xe,fe)),De=String.fromCodePoint(z+=parseInt(De,fe)),we.set(xe,De),ce&&oe.set(De,xe)}},"visit")),{map:we,reverseMap:oe}}c(g,"parseCharacterMap");var b,A,w;function x(){if(!b){var K=g(v.pairs,!0),ce=K.map,fe=K.reverseMap;b=ce,A=fe,w=g(v.canonical,!1).map}}c(x,"parse$1");function T(K){return x(),b.get(K)||null}c(T,"openingToClosingBracket");function M(K){return x(),A.get(K)||null}c(M,"closingToOpeningBracket");function R(K){return x(),w.get(K)||null}c(R,"getCanonicalBracket");var S=o.L,O=o.R,V=o.EN,L=o.ES,Q=o.ET,_=o.AN,G=o.CS,E=o.B,Y=o.S,B=o.ON,ie=o.BN,ae=o.NSM,N=o.AL,F=o.LRO,y=o.RLO,k=o.LRE,D=o.RLE,I=o.PDF,C=o.LRI,W=o.RLI,U=o.FSI,j=o.PDI;function $(K,ce){for(var fe=125,z=new Uint32Array(K.length),we=0;we<K.length;we++)z[we]=h(K[we]);var oe=new Map;function me(at,Tt){var st=z[at];z[at]=Tt,oe.set(st,oe.get(st)-1),st&s&&oe.set(s,oe.get(s)-1),oe.set(Tt,(oe.get(Tt)||0)+1),Tt&s&&oe.set(s,(oe.get(s)||0)+1)}c(me,"changeCharType");for(var te=new Uint8Array(K.length),Re=new Map,he=[],ge=null,xe=0;xe<K.length;xe++)ge||he.push(ge={start:xe,end:K.length-1,level:ce==="rtl"?1:ce==="ltr"?0:Ws(xe,!1)}),z[xe]&E&&(ge.end=xe,ge=null);for(var De=D|k|y|F|n|j|I|E,Fe=c(function(at){return at+(at&1?1:2)},"nextEven"),Ye=c(function(at){return at+(at&1?2:1)},"nextOdd"),Ae=0;Ae<he.length;Ae++){ge=he[Ae];var Oe=[{_level:ge.level,_override:0,_isolate:0}],be=void 0,je=0,Ve=0,ot=0;oe.clear();for(var Be=ge.start;Be<=ge.end;Be++){var Se=z[Be];if(be=Oe[Oe.length-1],oe.set(Se,(oe.get(Se)||0)+1),Se&s&&oe.set(s,(oe.get(s)||0)+1),Se&De)if(Se&(D|k)){te[Be]=be._level;var Ue=(Se===D?Ye:Fe)(be._level);Ue<=fe&&!je&&!Ve?Oe.push({_level:Ue,_override:0,_isolate:0}):je||Ve++}else if(Se&(y|F)){te[Be]=be._level;var Yt=(Se===y?Ye:Fe)(be._level);Yt<=fe&&!je&&!Ve?Oe.push({_level:Yt,_override:Se&y?O:S,_isolate:0}):je||Ve++}else if(Se&n){Se&U&&(Se=Ws(Be+1,!0)===1?W:C),te[Be]=be._level,be._override&&me(Be,be._override);var Le=(Se===W?Ye:Fe)(be._level);Le<=fe&&je===0&&Ve===0?(ot++,Oe.push({_level:Le,_override:0,_isolate:1,_isolInitIndex:Be})):je++}else if(Se&j){if(je>0)je--;else if(ot>0){for(Ve=0;!Oe[Oe.length-1]._isolate;)Oe.pop();var Ie=Oe[Oe.length-1]._isolInitIndex;Ie!=null&&(Re.set(Ie,Be),Re.set(Be,Ie)),Oe.pop(),ot--}be=Oe[Oe.length-1],te[Be]=be._level,be._override&&me(Be,be._override)}else Se&I?(je===0&&(Ve>0?Ve--:!be._isolate&&Oe.length>1&&(Oe.pop(),be=Oe[Oe.length-1])),te[Be]=be._level):Se&E&&(te[Be]=ge.level);else te[Be]=be._level,be._override&&Se!==ie&&me(Be,be._override)}for(var Xe=[],We=null,Ee=ge.start;Ee<=ge.end;Ee++){var He=z[Ee];if(!(He&l)){var et=te[Ee],Qe=He&n,Ke=He===j;We&&et===We._level?(We._end=Ee,We._endsWithIsolInit=Qe):Xe.push(We={_start:Ee,_end:Ee,_level:et,_startsWithPDI:Ke,_endsWithIsolInit:Qe})}}for(var xt=[],Xt=0;Xt<Xe.length;Xt++){var Lt=Xe[Xt];if(!Lt._startsWithPDI||Lt._startsWithPDI&&!Re.has(Lt._start)){for(var Kt=[We=Lt],sr=void 0;We&&We._endsWithIsolInit&&(sr=Re.get(We._end))!=null;)for(var Gt=Xt+1;Gt<Xe.length;Gt++)if(Xe[Gt]._start===sr){Kt.push(We=Xe[Gt]);break}for(var tt=[],lr=0;lr<Kt.length;lr++)for(var ks=Kt[lr],lo=ks._start;lo<=ks._end;lo++)tt.push(lo);for(var kc=te[tt[0]],ws=ge.level,ni=tt[0]-1;ni>=0;ni--)if(!(z[ni]&l)){ws=te[ni];break}var uo=tt[tt.length-1],wc=te[uo],Ms=ge.level;if(!(z[uo]&n)){for(var ii=uo+1;ii<=ge.end;ii++)if(!(z[ii]&l)){Ms=te[ii];break}}xt.push({_seqIndices:tt,_sosType:Math.max(ws,kc)%2?O:S,_eosType:Math.max(Ms,wc)%2?O:S})}}for(var co=0;co<xt.length;co++){var fo=xt[co],ve=fo._seqIndices,pn=fo._sosType,Mc=fo._eosType,Br=te[ve[0]]&1?O:S;if(oe.get(ae))for(var oi=0;oi<ve.length;oi++){var Cs=ve[oi];if(z[Cs]&ae){for(var ho=pn,ai=oi-1;ai>=0;ai--)if(!(z[ve[ai]]&l)){ho=z[ve[ai]];break}me(Cs,ho&(n|j)?B:ho)}}if(oe.get(V))for(var si=0;si<ve.length;si++){var Ds=ve[si];if(z[Ds]&V)for(var li=si-1;li>=-1;li--){var Es=li===-1?pn:z[ve[li]];if(Es&a){Es===N&&me(Ds,_);break}}}if(oe.get(N))for(var po=0;po<ve.length;po++){var As=ve[po];z[As]&N&&me(As,O)}if(oe.get(L)||oe.get(G))for(var mn=1;mn<ve.length-1;mn++){var mo=ve[mn];if(z[mo]&(L|G)){for(var Nr=0,go=0,vo=mn-1;vo>=0&&(Nr=z[ve[vo]],!!(Nr&l));vo--);for(var yo=mn+1;yo<ve.length&&(go=z[ve[yo]],!!(go&l));yo++);Nr===go&&(z[mo]===L?Nr===V:Nr&(V|_))&&me(mo,Nr)}}if(oe.get(V))for(var Et=0;Et<ve.length;Et++){var Cc=ve[Et];if(z[Cc]&V){for(var ui=Et-1;ui>=0&&z[ve[ui]]&(Q|l);ui--)me(ve[ui],V);for(Et++;Et<ve.length&&z[ve[Et]]&(Q|l|V);Et++)z[ve[Et]]!==V&&me(ve[Et],V)}}if(oe.get(Q)||oe.get(L)||oe.get(G))for(var gn=0;gn<ve.length;gn++){var Os=ve[gn];if(z[Os]&(Q|L|G)){me(Os,B);for(var ci=gn-1;ci>=0&&z[ve[ci]]&l;ci--)me(ve[ci],B);for(var fi=gn+1;fi<ve.length&&z[ve[fi]]&l;fi++)me(ve[fi],B)}}if(oe.get(V))for(var bo=0,Is=pn;bo<ve.length;bo++){var Ps=ve[bo],xo=z[Ps];xo&V?Is===S&&me(Ps,S):xo&a&&(Is=xo)}if(oe.get(s)){var vn=O|V|_,Rs=vn|S,di=[];{for(var jr=[],zr=0;zr<ve.length;zr++)if(z[ve[zr]]&s){var yn=K[ve[zr]],Us=void 0;if(T(yn)!==null)if(jr.length<63)jr.push({char:yn,seqIndex:zr});else break;else if((Us=M(yn))!==null)for(var bn=jr.length-1;bn>=0;bn--){var _o=jr[bn].char;if(_o===Us||_o===M(R(yn))||T(R(_o))===yn){di.push([jr[bn].seqIndex,zr]),jr.length=bn;break}}}di.sort(function(at,Tt){return at[0]-Tt[0]})}for(var To=0;To<di.length;To++){for(var Ls=di[To],hi=Ls[0],So=Ls[1],Gs=!1,_t=0,ko=hi+1;ko<So;ko++){var Fs=ve[ko];if(z[Fs]&Rs){Gs=!0;var Bs=z[Fs]&vn?O:S;if(Bs===Br){_t=Bs;break}}}if(Gs&&!_t){_t=pn;for(var wo=hi-1;wo>=0;wo--){var Ns=ve[wo];if(z[Ns]&Rs){var js=z[Ns]&vn?O:S;js!==Br?_t=js:_t=Br;break}}}if(_t){if(z[ve[hi]]=z[ve[So]]=_t,_t!==Br){for(var xn=hi+1;xn<ve.length;xn++)if(!(z[ve[xn]]&l)){h(K[ve[xn]])&ae&&(z[ve[xn]]=_t);break}}if(_t!==Br){for(var _n=So+1;_n<ve.length;_n++)if(!(z[ve[_n]]&l)){h(K[ve[_n]])&ae&&(z[ve[_n]]=_t);break}}}}for(var Jt=0;Jt<ve.length;Jt++)if(z[ve[Jt]]&s){for(var zs=Jt,Mo=Jt,Co=pn,Tn=Jt-1;Tn>=0;Tn--)if(z[ve[Tn]]&l)zs=Tn;else{Co=z[ve[Tn]]&vn?O:S;break}for(var Vs=Mc,Sn=Jt+1;Sn<ve.length;Sn++)if(z[ve[Sn]]&(s|l))Mo=Sn;else{Vs=z[ve[Sn]]&vn?O:S;break}for(var Do=zs;Do<=Mo;Do++)z[ve[Do]]=Co===Vs?Co:Br;Jt=Mo}}}for(var ct=ge.start;ct<=ge.end;ct++){var Dc=te[ct],pi=z[ct];if(Dc&1?pi&(S|V|_)&&te[ct]++:pi&O?te[ct]++:pi&(_|V)&&(te[ct]+=2),pi&l&&(te[ct]=ct===0?ge.level:te[ct-1]),ct===ge.end||h(K[ct])&(Y|E))for(var mi=ct;mi>=0&&h(K[mi])&u;mi--)te[mi]=ge.level}}return{levels:te,paragraphs:he};function Ws(at,Tt){for(var st=at;st<K.length;st++){var qt=z[st];if(qt&(O|N))return 1;if(qt&(E|S)||Tt&&qt===j)return 0;if(qt&n){var Hs=Ec(st);st=Hs===-1?K.length:Hs}}return 0}function Ec(at){for(var Tt=1,st=at+1;st<K.length;st++){var qt=z[st];if(qt&E)break;if(qt&j){if(--Tt===0)return st}else qt&n&&Tt++}return-1}}c($,"getEmbeddingLevels");var le="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",X;function H(){if(!X){var K=g(le,!0),ce=K.map,fe=K.reverseMap;fe.forEach(function(z,we){ce.set(we,z)}),X=ce}}c(H,"parse");function ke(K){return H(),X.get(K)||null}c(ke,"getMirroredCharacter");function ye(K,ce,fe,z){var we=K.length;fe=Math.max(0,fe==null?0:+fe),z=Math.min(we-1,z==null?we-1:+z);for(var oe=new Map,me=fe;me<=z;me++)if(ce[me]&1){var te=ke(K[me]);te!==null&&oe.set(me,te)}return oe}c(ye,"getMirroredCharactersMap");function re(K,ce,fe,z){var we=K.length;fe=Math.max(0,fe==null?0:+fe),z=Math.min(we-1,z==null?we-1:+z);var oe=[];return ce.paragraphs.forEach(function(me){var te=Math.max(fe,me.start),Re=Math.min(z,me.end);if(te<Re){for(var he=ce.levels.slice(te,Re+1),ge=Re;ge>=te&&h(K[ge])&u;ge--)he[ge]=me.level;for(var xe=me.level,De=1/0,Fe=0;Fe<he.length;Fe++){var Ye=he[Fe];Ye>xe&&(xe=Ye),Ye<De&&(De=Ye|1)}for(var Ae=xe;Ae>=De;Ae--)for(var Oe=0;Oe<he.length;Oe++)if(he[Oe]>=Ae){for(var be=Oe;Oe+1<he.length&&he[Oe+1]>=Ae;)Oe++;Oe>be&&oe.push([be+te,Oe+te])}}}),oe}c(re,"getReorderSegments");function ue(K,ce,fe,z){var we=pe(K,ce,fe,z),oe=[].concat(K);return we.forEach(function(me,te){oe[te]=(ce.levels[me]&1?ke(K[me]):null)||K[me]}),oe.join("")}c(ue,"getReorderedString");function pe(K,ce,fe,z){for(var we=re(K,ce,fe,z),oe=[],me=0;me<K.length;me++)oe[me]=me;return we.forEach(function(te){for(var Re=te[0],he=te[1],ge=oe.slice(Re,he+1),xe=ge.length;xe--;)oe[he-xe]=ge[xe]}),oe}return c(pe,"getReorderedIndices"),e.closingToOpeningBracket=M,e.getBidiCharType=h,e.getBidiCharTypeName=p,e.getCanonicalBracket=R,e.getEmbeddingLevels=$,e.getMirroredCharacter=ke,e.getMirroredCharactersMap=ye,e.getReorderSegments=re,e.getReorderedIndices=pe,e.getReorderedString=ue,e.openingToClosingBracket=T,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return t}c(bp,"bidiFactory");var Pu=bp;P();var Xa=/\bvoid\s+main\s*\(\s*\)\s*{/g;function Ya(t){let e=/^[ \t]*#include +<([\w\d./]+)>/gm;function r(o,i){let n=cl[i];return n?Ya(n):o}return c(r,"replace"),t.replace(e,r)}c(Ya,"expandShaderIncludes");var qe=[];for(let t=0;t<256;t++)qe[t]=(t<16?"0":"")+t.toString(16);function xp(){let t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,r=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(qe[t&255]+qe[t>>8&255]+qe[t>>16&255]+qe[t>>24&255]+"-"+qe[e&255]+qe[e>>8&255]+"-"+qe[e>>16&15|64]+qe[e>>24&255]+"-"+qe[r&63|128]+qe[r>>8&255]+"-"+qe[r>>16&255]+qe[r>>24&255]+qe[o&255]+qe[o>>8&255]+qe[o>>16&255]+qe[o>>24&255]).toUpperCase()}c(xp,"generateUUID");var Lr=Object.assign||function(){let t=arguments[0];for(let e=1,r=arguments.length;e<r;e++){let o=arguments[e];if(o)for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&(t[i]=o[i])}return t},_p=Date.now(),Ru=new WeakMap,Uu=new Map,Tp=1e10;function un(t,e){let r=Mp(e),o=Ru.get(t);if(o||Ru.set(t,o=Object.create(null)),o[r])return new o[r];let i="_onBeforeCompile".concat(r),n=c(function(u,f){t.onBeforeCompile.call(this,u,f);let d=this.customProgramCacheKey()+"|"+u.vertexShader+"|"+u.fragmentShader,h=Uu[d];if(!h){let p=Sp(this,u,e,r);h=Uu[d]=p}u.vertexShader=h.vertexShader,u.fragmentShader=h.fragmentShader,Lr(u.uniforms,this.uniforms),e.timeUniform&&(u.uniforms[e.timeUniform]={get value(){return Date.now()-_p}}),this[i]&&this[i](u)},"onBeforeCompile"),a=c(function(){return s(e.chained?t:t.clone())},"DerivedMaterial"),s=c(function(u){let f=Object.create(u,l);return Object.defineProperty(f,"baseMaterial",{value:t}),Object.defineProperty(f,"id",{value:Tp++}),f.uuid=xp(),f.uniforms=Lr({},u.uniforms,e.uniforms),f.defines=Lr({},u.defines,e.defines),f.defines["TROIKA_DERIVED_MATERIAL_".concat(r)]="",f.extensions=Lr({},u.extensions,e.extensions),f._listeners=void 0,f},"derive"),l={constructor:{value:a},isDerivedMaterial:{value:!0},type:{get:c(()=>t.type,"get"),set:c(u=>{t.type=u},"set")},isDerivedFrom:{writable:!0,configurable:!0,value:c(function(u){let f=this.baseMaterial;return u===f||f.isDerivedMaterial&&f.isDerivedFrom(u)||!1},"value")},customProgramCacheKey:{writable:!0,configurable:!0,value:c(function(){return t.customProgramCacheKey()+"|"+r},"value")},onBeforeCompile:{get(){return n},set(u){this[i]=u}},copy:{writable:!0,configurable:!0,value:c(function(u){return t.copy.call(this,u),!t.isShaderMaterial&&!t.isDerivedMaterial&&(Lr(this.extensions,u.extensions),Lr(this.defines,u.defines),Lr(this.uniforms,el.clone(u.uniforms))),this},"value")},clone:{writable:!0,configurable:!0,value:c(function(){let u=new t.constructor;return s(u).copy(this)},"value")},getDepthMaterial:{writable:!0,configurable:!0,value:c(function(){let u=this._depthMaterial;return u||(u=this._depthMaterial=un(t.isDerivedMaterial?t.getDepthMaterial():new al({depthPacking:Xs}),e),u.defines.IS_DEPTH_MATERIAL="",u.uniforms=this.uniforms),u},"value")},getDistanceMaterial:{writable:!0,configurable:!0,value:c(function(){let u=this._distanceMaterial;return u||(u=this._distanceMaterial=un(t.isDerivedMaterial?t.getDistanceMaterial():new sl,e),u.defines.IS_DISTANCE_MATERIAL="",u.uniforms=this.uniforms),u},"value")},dispose:{writable:!0,configurable:!0,value(){let{_depthMaterial:u,_distanceMaterial:f}=this;u&&u.dispose(),f&&f.dispose(),t.dispose.call(this)}}};return o[r]=a,new a}c(un,"createDerivedMaterial");function Sp(t,{vertexShader:e,fragmentShader:r},o,i){let{vertexDefs:n,vertexMainIntro:a,vertexMainOutro:s,vertexTransform:l,fragmentDefs:u,fragmentMainIntro:f,fragmentMainOutro:d,fragmentColorTransform:h,customRewriter:p,timeUniform:v}=o;if(n=n||"",a=a||"",s=s||"",u=u||"",f=f||"",d=d||"",(l||p)&&(e=Ya(e)),(h||p)&&(r=r.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,"\n//!BEGIN_POST_CHUNK $1\n$&\n//!END_POST_CHUNK\n"),r=Ya(r)),p){let g=p({vertexShader:e,fragmentShader:r});e=g.vertexShader,r=g.fragmentShader}if(h){let g=[];r=r.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,b=>(g.push(b),"")),d="".concat(h,"\n").concat(g.join("\n"),"\n").concat(d)}if(v){let g="\nuniform float ".concat(v,";\n");n=g+n,u=g+u}return l&&(e="vec3 troika_position_".concat(i,";\nvec3 troika_normal_").concat(i,";\nvec2 troika_uv_").concat(i,";\n").concat(e,"\n"),n="".concat(n,"\nvoid troikaVertexTransform").concat(i,"(inout vec3 position, inout vec3 normal, inout vec2 uv) {\n ").concat(l,"\n}\n"),a="\ntroika_position_".concat(i," = vec3(position);\ntroika_normal_").concat(i," = vec3(normal);\ntroika_uv_").concat(i," = vec2(uv);\ntroikaVertexTransform").concat(i,"(troika_position_").concat(i,", troika_normal_").concat(i,", troika_uv_").concat(i,");\n").concat(a,"\n"),e=e.replace(/\b(position|normal|uv)\b/g,(g,b,A,w)=>/\battribute\s+vec[23]\s+$/.test(w.substr(0,A))?b:"troika_".concat(b,"_").concat(i)),t.map&&t.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,"troika_uv_".concat(i)))),e=Lu(e,i,n,a,s),r=Lu(r,i,u,f,d),{vertexShader:e,fragmentShader:r}}c(Sp,"upgradeShaders");function Lu(t,e,r,o,i){return(o||i||r)&&(t=t.replace(Xa,"\n".concat(r,"\nvoid troikaOrigMain").concat(e,"() {")),t+="\nvoid main() {\n ".concat(o,"\n troikaOrigMain").concat(e,"();\n ").concat(i,"\n}")),t}c(Lu,"injectIntoShaderCode");function kp(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}c(kp,"optionsJsonReplacer");var wp=0,Gu=new Map;function Mp(t){let e=JSON.stringify(t,kp),r=Gu.get(e);return r==null&&Gu.set(e,r=++wp),r}c(Mp,"getKeyForOptions");function Cp(){return typeof window>"u"&&(self.window=self),function(t){var e={parse:c(function(i){var n=e._bin,a=new Uint8Array(i);if(n.readASCII(a,0,4)=="ttcf"){var s=4;n.readUshort(a,s),s+=2,n.readUshort(a,s),s+=2;var l=n.readUint(a,s);s+=4;for(var u=[],f=0;f<l;f++){var d=n.readUint(a,s);s+=4,u.push(e._readFont(a,d))}return u}return[e._readFont(a,0)]},"parse"),_readFont:c(function(i,n){var a=e._bin,s=n;a.readFixed(i,n),n+=4;var l=a.readUshort(i,n);n+=2,a.readUshort(i,n),n+=2,a.readUshort(i,n),n+=2,a.readUshort(i,n),n+=2;for(var u=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],f={_data:i,_offset:s},d={},h=0;h<l;h++){var p=a.readASCII(i,n,4);n+=4,a.readUint(i,n),n+=4;var v=a.readUint(i,n);n+=4;var g=a.readUint(i,n);n+=4,d[p]={offset:v,length:g}}for(h=0;h<u.length;h++){var b=u[h];d[b]&&(f[b.trim()]=e[b.trim()].parse(i,d[b].offset,d[b].length,f))}return f},"_readFont"),_tabOffset:c(function(i,n,a){for(var s=e._bin,l=s.readUshort(i,a+4),u=a+12,f=0;f<l;f++){var d=s.readASCII(i,u,4);u+=4,s.readUint(i,u),u+=4;var h=s.readUint(i,u);if(u+=4,s.readUint(i,u),u+=4,d==n)return h}return 0},"_tabOffset")};e._bin={readFixed:c(function(i,n){return(i[n]<<8|i[n+1])+(i[n+2]<<8|i[n+3])/65540},"readFixed"),readF2dot14:c(function(i,n){return e._bin.readShort(i,n)/16384},"readF2dot14"),readInt:c(function(i,n){return e._bin._view(i).getInt32(n)},"readInt"),readInt8:c(function(i,n){return e._bin._view(i).getInt8(n)},"readInt8"),readShort:c(function(i,n){return e._bin._view(i).getInt16(n)},"readShort"),readUshort:c(function(i,n){return e._bin._view(i).getUint16(n)},"readUshort"),readUshorts:c(function(i,n,a){for(var s=[],l=0;l<a;l++)s.push(e._bin.readUshort(i,n+2*l));return s},"readUshorts"),readUint:c(function(i,n){return e._bin._view(i).getUint32(n)},"readUint"),readUint64:c(function(i,n){return 4294967296*e._bin.readUint(i,n)+e._bin.readUint(i,n+4)},"readUint64"),readASCII:c(function(i,n,a){for(var s="",l=0;l<a;l++)s+=String.fromCharCode(i[n+l]);return s},"readASCII"),readUnicode:c(function(i,n,a){for(var s="",l=0;l<a;l++){var u=i[n++]<<8|i[n++];s+=String.fromCharCode(u)}return s},"readUnicode"),_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:c(function(i,n,a){var s=e._bin._tdec;return s&&n==0&&a==i.length?s.decode(i):e._bin.readASCII(i,n,a)},"readUTF8"),readBytes:c(function(i,n,a){for(var s=[],l=0;l<a;l++)s.push(i[n+l]);return s},"readBytes"),readASCIIArray:c(function(i,n,a){for(var s=[],l=0;l<a;l++)s.push(String.fromCharCode(i[n+l]));return s},"readASCIIArray"),_view:c(function(i){return i._dataView||(i._dataView=i.buffer?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(new Uint8Array(i).buffer))},"_view")},e._lctf={},e._lctf.parse=function(i,n,a,s,l){var u=e._bin,f={},d=n;u.readFixed(i,n),n+=4;var h=u.readUshort(i,n);n+=2;var p=u.readUshort(i,n);n+=2;var v=u.readUshort(i,n);return n+=2,f.scriptList=e._lctf.readScriptList(i,d+h),f.featureList=e._lctf.readFeatureList(i,d+p),f.lookupList=e._lctf.readLookupList(i,d+v,l),f},e._lctf.readLookupList=function(i,n,a){var s=e._bin,l=n,u=[],f=s.readUshort(i,n);n+=2;for(var d=0;d<f;d++){var h=s.readUshort(i,n);n+=2;var p=e._lctf.readLookupTable(i,l+h,a);u.push(p)}return u},e._lctf.readLookupTable=function(i,n,a){var s=e._bin,l=n,u={tabs:[]};u.ltype=s.readUshort(i,n),n+=2,u.flag=s.readUshort(i,n),n+=2;var f=s.readUshort(i,n);n+=2;for(var d=u.ltype,h=0;h<f;h++){var p=s.readUshort(i,n);n+=2;var v=a(i,d,l+p,u);u.tabs.push(v)}return u},e._lctf.numOfOnes=function(i){for(var n=0,a=0;a<32;a++)(i>>>a&1)!=0&&n++;return n},e._lctf.readClassDef=function(i,n){var a=e._bin,s=[],l=a.readUshort(i,n);if(n+=2,l==1){var u=a.readUshort(i,n);n+=2;var f=a.readUshort(i,n);n+=2;for(var d=0;d<f;d++)s.push(u+d),s.push(u+d),s.push(a.readUshort(i,n)),n+=2}if(l==2){var h=a.readUshort(i,n);for(n+=2,d=0;d<h;d++)s.push(a.readUshort(i,n)),n+=2,s.push(a.readUshort(i,n)),n+=2,s.push(a.readUshort(i,n)),n+=2}return s},e._lctf.getInterval=function(i,n){for(var a=0;a<i.length;a+=3){var s=i[a],l=i[a+1];if(i[a+2],s<=n&&n<=l)return a}return-1},e._lctf.readCoverage=function(i,n){var a=e._bin,s={};s.fmt=a.readUshort(i,n),n+=2;var l=a.readUshort(i,n);return n+=2,s.fmt==1&&(s.tab=a.readUshorts(i,n,l)),s.fmt==2&&(s.tab=a.readUshorts(i,n,3*l)),s},e._lctf.coverageIndex=function(i,n){var a=i.tab;if(i.fmt==1)return a.indexOf(n);if(i.fmt==2){var s=e._lctf.getInterval(a,n);if(s!=-1)return a[s+2]+(n-a[s])}return-1},e._lctf.readFeatureList=function(i,n){var a=e._bin,s=n,l=[],u=a.readUshort(i,n);n+=2;for(var f=0;f<u;f++){var d=a.readASCII(i,n,4);n+=4;var h=a.readUshort(i,n);n+=2;var p=e._lctf.readFeatureTable(i,s+h);p.tag=d.trim(),l.push(p)}return l},e._lctf.readFeatureTable=function(i,n){var a=e._bin,s=n,l={},u=a.readUshort(i,n);n+=2,u>0&&(l.featureParams=s+u);var f=a.readUshort(i,n);n+=2,l.tab=[];for(var d=0;d<f;d++)l.tab.push(a.readUshort(i,n+2*d));return l},e._lctf.readScriptList=function(i,n){var a=e._bin,s=n,l={},u=a.readUshort(i,n);n+=2;for(var f=0;f<u;f++){var d=a.readASCII(i,n,4);n+=4;var h=a.readUshort(i,n);n+=2,l[d.trim()]=e._lctf.readScriptTable(i,s+h)}return l},e._lctf.readScriptTable=function(i,n){var a=e._bin,s=n,l={},u=a.readUshort(i,n);n+=2,u>0&&(l.default=e._lctf.readLangSysTable(i,s+u));var f=a.readUshort(i,n);n+=2;for(var d=0;d<f;d++){var h=a.readASCII(i,n,4);n+=4;var p=a.readUshort(i,n);n+=2,l[h.trim()]=e._lctf.readLangSysTable(i,s+p)}return l},e._lctf.readLangSysTable=function(i,n){var a=e._bin,s={};a.readUshort(i,n),n+=2,s.reqFeature=a.readUshort(i,n),n+=2;var l=a.readUshort(i,n);return n+=2,s.features=a.readUshorts(i,n,l),s},e.CFF={},e.CFF.parse=function(i,n,a){var s=e._bin;(i=new Uint8Array(i.buffer,n,a))[n=0],i[++n],i[++n],i[++n],n++;var l=[];n=e.CFF.readIndex(i,n,l);for(var u=[],f=0;f<l.length-1;f++)u.push(s.readASCII(i,n+l[f],l[f+1]-l[f]));n+=l[l.length-1];var d=[];n=e.CFF.readIndex(i,n,d);var h=[];for(f=0;f<d.length-1;f++)h.push(e.CFF.readDict(i,n+d[f],n+d[f+1]));n+=d[d.length-1];var p=h[0],v=[];n=e.CFF.readIndex(i,n,v);var g=[];for(f=0;f<v.length-1;f++)g.push(s.readASCII(i,n+v[f],v[f+1]-v[f]));if(n+=v[v.length-1],e.CFF.readSubrs(i,n,p),p.CharStrings){n=p.CharStrings,v=[],n=e.CFF.readIndex(i,n,v);var b=[];for(f=0;f<v.length-1;f++)b.push(s.readBytes(i,n+v[f],v[f+1]-v[f]));p.CharStrings=b}if(p.ROS){n=p.FDArray;var A=[];for(n=e.CFF.readIndex(i,n,A),p.FDArray=[],f=0;f<A.length-1;f++){var w=e.CFF.readDict(i,n+A[f],n+A[f+1]);e.CFF._readFDict(i,w,g),p.FDArray.push(w)}n+=A[A.length-1],n=p.FDSelect,p.FDSelect=[];var x=i[n];if(n++,x!=3)throw x;var T=s.readUshort(i,n);for(n+=2,f=0;f<T+1;f++)p.FDSelect.push(s.readUshort(i,n),i[n+2]),n+=3}return p.Encoding&&(p.Encoding=e.CFF.readEncoding(i,p.Encoding,p.CharStrings.length)),p.charset&&(p.charset=e.CFF.readCharset(i,p.charset,p.CharStrings.length)),e.CFF._readFDict(i,p,g),p},e.CFF._readFDict=function(i,n,a){var s;for(var l in n.Private&&(s=n.Private[1],n.Private=e.CFF.readDict(i,s,s+n.Private[0]),n.Private.Subrs&&e.CFF.readSubrs(i,s+n.Private.Subrs,n.Private)),n)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(l)!=-1&&(n[l]=a[n[l]-426+35])},e.CFF.readSubrs=function(i,n,a){var s=e._bin,l=[];n=e.CFF.readIndex(i,n,l);var u,f=l.length;u=f<1240?107:f<33900?1131:32768,a.Bias=u,a.Subrs=[];for(var d=0;d<l.length-1;d++)a.Subrs.push(s.readBytes(i,n+l[d],l[d+1]-l[d]))},e.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],e.CFF.glyphByUnicode=function(i,n){for(var a=0;a<i.charset.length;a++)if(i.charset[a]==n)return a;return-1},e.CFF.glyphBySE=function(i,n){return n<0||n>255?-1:e.CFF.glyphByUnicode(i,e.CFF.tableSE[n])},e.CFF.readEncoding=function(i,n,a){e._bin;var s=[".notdef"],l=i[n];if(n++,l!=0)throw"error: unknown encoding format: "+l;var u=i[n];n++;for(var f=0;f<u;f++)s.push(i[n+f]);return s},e.CFF.readCharset=function(i,n,a){var s=e._bin,l=[".notdef"],u=i[n];if(n++,u==0)for(var f=0;f<a;f++){var d=s.readUshort(i,n);n+=2,l.push(d)}else{if(u!=1&&u!=2)throw"error: format: "+u;for(;l.length<a;){d=s.readUshort(i,n),n+=2;var h=0;for(u==1?(h=i[n],n++):(h=s.readUshort(i,n),n+=2),f=0;f<=h;f++)l.push(d),d++}}return l},e.CFF.readIndex=function(i,n,a){var s=e._bin,l=s.readUshort(i,n)+1,u=i[n+=2];if(n++,u==1)for(var f=0;f<l;f++)a.push(i[n+f]);else if(u==2)for(f=0;f<l;f++)a.push(s.readUshort(i,n+2*f));else if(u==3)for(f=0;f<l;f++)a.push(16777215&s.readUint(i,n+3*f-1));else if(l!=1)throw"unsupported offset size: "+u+", count: "+l;return(n+=l*u)-1},e.CFF.getCharString=function(i,n,a){var s=e._bin,l=i[n],u=i[n+1];i[n+2],i[n+3],i[n+4];var f=1,d=null,h=null;l<=20&&(d=l,f=1),l==12&&(d=100*l+u,f=2),21<=l&&l<=27&&(d=l,f=1),l==28&&(h=s.readShort(i,n+1),f=3),29<=l&&l<=31&&(d=l,f=1),32<=l&&l<=246&&(h=l-139,f=1),247<=l&&l<=250&&(h=256*(l-247)+u+108,f=2),251<=l&&l<=254&&(h=256*-(l-251)-u-108,f=2),l==255&&(h=s.readInt(i,n+1)/65535,f=5),a.val=h!=null?h:"o"+d,a.size=f},e.CFF.readCharString=function(i,n,a){for(var s=n+a,l=e._bin,u=[];n<s;){var f=i[n],d=i[n+1];i[n+2],i[n+3],i[n+4];var h=1,p=null,v=null;f<=20&&(p=f,h=1),f==12&&(p=100*f+d,h=2),f!=19&&f!=20||(p=f,h=2),21<=f&&f<=27&&(p=f,h=1),f==28&&(v=l.readShort(i,n+1),h=3),29<=f&&f<=31&&(p=f,h=1),32<=f&&f<=246&&(v=f-139,h=1),247<=f&&f<=250&&(v=256*(f-247)+d+108,h=2),251<=f&&f<=254&&(v=256*-(f-251)-d-108,h=2),f==255&&(v=l.readInt(i,n+1)/65535,h=5),u.push(v!=null?v:"o"+p),n+=h}return u},e.CFF.readDict=function(i,n,a){for(var s=e._bin,l={},u=[];n<a;){var f=i[n],d=i[n+1];i[n+2],i[n+3],i[n+4];var h=1,p=null,v=null;if(f==28&&(v=s.readShort(i,n+1),h=3),f==29&&(v=s.readInt(i,n+1),h=5),32<=f&&f<=246&&(v=f-139,h=1),247<=f&&f<=250&&(v=256*(f-247)+d+108,h=2),251<=f&&f<=254&&(v=256*-(f-251)-d-108,h=2),f==255)throw v=s.readInt(i,n+1)/65535,h=5,"unknown number";if(f==30){var g=[];for(h=1;;){var b=i[n+h];h++;var A=b>>4,w=15&b;if(A!=15&&g.push(A),w!=15&&g.push(w),w==15)break}for(var x="",T=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],M=0;M<g.length;M++)x+=T[g[M]];v=parseFloat(x)}f<=21&&(p=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][f],h=1,f==12&&(p=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][d],h=2)),p!=null?(l[p]=u.length==1?u[0]:u,u=[]):u.push(v),n+=h}return l},e.cmap={},e.cmap.parse=function(i,n,a){i=new Uint8Array(i.buffer,n,a),n=0;var s=e._bin,l={};s.readUshort(i,n),n+=2;var u=s.readUshort(i,n);n+=2;var f=[];l.tables=[];for(var d=0;d<u;d++){var h=s.readUshort(i,n);n+=2;var p=s.readUshort(i,n);n+=2;var v=s.readUint(i,n);n+=4;var g="p"+h+"e"+p,b=f.indexOf(v);if(b==-1){var A;b=l.tables.length,f.push(v);var w=s.readUshort(i,v);w==0?A=e.cmap.parse0(i,v):w==4?A=e.cmap.parse4(i,v):w==6?A=e.cmap.parse6(i,v):w==12?A=e.cmap.parse12(i,v):console.debug("unknown format: "+w,h,p,v),l.tables.push(A)}if(l[g]!=null)throw"multiple tables for one platform+encoding";l[g]=b}return l},e.cmap.parse0=function(i,n){var a=e._bin,s={};s.format=a.readUshort(i,n),n+=2;var l=a.readUshort(i,n);n+=2,a.readUshort(i,n),n+=2,s.map=[];for(var u=0;u<l-6;u++)s.map.push(i[n+u]);return s},e.cmap.parse4=function(i,n){var a=e._bin,s=n,l={};l.format=a.readUshort(i,n),n+=2;var u=a.readUshort(i,n);n+=2,a.readUshort(i,n),n+=2;var f=a.readUshort(i,n);n+=2;var d=f/2;l.searchRange=a.readUshort(i,n),n+=2,l.entrySelector=a.readUshort(i,n),n+=2,l.rangeShift=a.readUshort(i,n),n+=2,l.endCount=a.readUshorts(i,n,d),n+=2*d,n+=2,l.startCount=a.readUshorts(i,n,d),n+=2*d,l.idDelta=[];for(var h=0;h<d;h++)l.idDelta.push(a.readShort(i,n)),n+=2;for(l.idRangeOffset=a.readUshorts(i,n,d),n+=2*d,l.glyphIdArray=[];n<s+u;)l.glyphIdArray.push(a.readUshort(i,n)),n+=2;return l},e.cmap.parse6=function(i,n){var a=e._bin,s={};s.format=a.readUshort(i,n),n+=2,a.readUshort(i,n),n+=2,a.readUshort(i,n),n+=2,s.firstCode=a.readUshort(i,n),n+=2;var l=a.readUshort(i,n);n+=2,s.glyphIdArray=[];for(var u=0;u<l;u++)s.glyphIdArray.push(a.readUshort(i,n)),n+=2;return s},e.cmap.parse12=function(i,n){var a=e._bin,s={};s.format=a.readUshort(i,n),n+=2,n+=2,a.readUint(i,n),n+=4,a.readUint(i,n),n+=4;var l=a.readUint(i,n);n+=4,s.groups=[];for(var u=0;u<l;u++){var f=n+12*u,d=a.readUint(i,f+0),h=a.readUint(i,f+4),p=a.readUint(i,f+8);s.groups.push([d,h,p])}return s},e.glyf={},e.glyf.parse=function(i,n,a,s){for(var l=[],u=0;u<s.maxp.numGlyphs;u++)l.push(null);return l},e.glyf._parseGlyf=function(i,n){var a=e._bin,s=i._data,l=e._tabOffset(s,"glyf",i._offset)+i.loca[n];if(i.loca[n]==i.loca[n+1])return null;var u={};if(u.noc=a.readShort(s,l),l+=2,u.xMin=a.readShort(s,l),l+=2,u.yMin=a.readShort(s,l),l+=2,u.xMax=a.readShort(s,l),l+=2,u.yMax=a.readShort(s,l),l+=2,u.xMin>=u.xMax||u.yMin>=u.yMax)return null;if(u.noc>0){u.endPts=[];for(var f=0;f<u.noc;f++)u.endPts.push(a.readUshort(s,l)),l+=2;var d=a.readUshort(s,l);if(l+=2,s.length-l<d)return null;u.instructions=a.readBytes(s,l,d),l+=d;var h=u.endPts[u.noc-1]+1;for(u.flags=[],f=0;f<h;f++){var p=s[l];if(l++,u.flags.push(p),(8&p)!=0){var v=s[l];l++;for(var g=0;g<v;g++)u.flags.push(p),f++}}for(u.xs=[],f=0;f<h;f++){var b=(2&u.flags[f])!=0,A=(16&u.flags[f])!=0;b?(u.xs.push(A?s[l]:-s[l]),l++):A?u.xs.push(0):(u.xs.push(a.readShort(s,l)),l+=2)}for(u.ys=[],f=0;f<h;f++)b=(4&u.flags[f])!=0,A=(32&u.flags[f])!=0,b?(u.ys.push(A?s[l]:-s[l]),l++):A?u.ys.push(0):(u.ys.push(a.readShort(s,l)),l+=2);var w=0,x=0;for(f=0;f<h;f++)w+=u.xs[f],x+=u.ys[f],u.xs[f]=w,u.ys[f]=x}else{var T;u.parts=[];do{T=a.readUshort(s,l),l+=2;var M={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(u.parts.push(M),M.glyphIndex=a.readUshort(s,l),l+=2,1&T){var R=a.readShort(s,l);l+=2;var S=a.readShort(s,l);l+=2}else R=a.readInt8(s,l),l++,S=a.readInt8(s,l),l++;2&T?(M.m.tx=R,M.m.ty=S):(M.p1=R,M.p2=S),8&T?(M.m.a=M.m.d=a.readF2dot14(s,l),l+=2):64&T?(M.m.a=a.readF2dot14(s,l),l+=2,M.m.d=a.readF2dot14(s,l),l+=2):128&T&&(M.m.a=a.readF2dot14(s,l),l+=2,M.m.b=a.readF2dot14(s,l),l+=2,M.m.c=a.readF2dot14(s,l),l+=2,M.m.d=a.readF2dot14(s,l),l+=2)}while(32&T);if(256&T){var O=a.readUshort(s,l);for(l+=2,u.instr=[],f=0;f<O;f++)u.instr.push(s[l]),l++}}return u},e.GDEF={},e.GDEF.parse=function(i,n,a,s){var l=n;n+=4;var u=e._bin.readUshort(i,n);return{glyphClassDef:u===0?null:e._lctf.readClassDef(i,l+u)}},e.GPOS={},e.GPOS.parse=function(i,n,a,s){return e._lctf.parse(i,n,a,s,e.GPOS.subt)},e.GPOS.subt=function(i,n,a,s){var l=e._bin,u=a,f={};if(f.fmt=l.readUshort(i,a),a+=2,n==1||n==2||n==3||n==7||n==8&&f.fmt<=2){var d=l.readUshort(i,a);a+=2,f.coverage=e._lctf.readCoverage(i,d+u)}if(n==1&&f.fmt==1){var h=l.readUshort(i,a);a+=2,h!=0&&(f.pos=e.GPOS.readValueRecord(i,a,h))}else if(n==2&&f.fmt>=1&&f.fmt<=2){h=l.readUshort(i,a),a+=2;var p=l.readUshort(i,a);a+=2;var v=e._lctf.numOfOnes(h),g=e._lctf.numOfOnes(p);if(f.fmt==1){f.pairsets=[];var b=l.readUshort(i,a);a+=2;for(var A=0;A<b;A++){var w=u+l.readUshort(i,a);a+=2;var x=l.readUshort(i,w);w+=2;for(var T=[],M=0;M<x;M++){var R=l.readUshort(i,w);w+=2,h!=0&&(_=e.GPOS.readValueRecord(i,w,h),w+=2*v),p!=0&&(G=e.GPOS.readValueRecord(i,w,p),w+=2*g),T.push({gid2:R,val1:_,val2:G})}f.pairsets.push(T)}}if(f.fmt==2){var S=l.readUshort(i,a);a+=2;var O=l.readUshort(i,a);a+=2;var V=l.readUshort(i,a);a+=2;var L=l.readUshort(i,a);for(a+=2,f.classDef1=e._lctf.readClassDef(i,u+S),f.classDef2=e._lctf.readClassDef(i,u+O),f.matrix=[],A=0;A<V;A++){var Q=[];for(M=0;M<L;M++){var _=null,G=null;h!=0&&(_=e.GPOS.readValueRecord(i,a,h),a+=2*v),p!=0&&(G=e.GPOS.readValueRecord(i,a,p),a+=2*g),Q.push({val1:_,val2:G})}f.matrix.push(Q)}}}else if(n==4&&f.fmt==1)f.markCoverage=e._lctf.readCoverage(i,l.readUshort(i,a)+u),f.baseCoverage=e._lctf.readCoverage(i,l.readUshort(i,a+2)+u),f.markClassCount=l.readUshort(i,a+4),f.markArray=e.GPOS.readMarkArray(i,l.readUshort(i,a+6)+u),f.baseArray=e.GPOS.readBaseArray(i,l.readUshort(i,a+8)+u,f.markClassCount);else if(n==6&&f.fmt==1)f.mark1Coverage=e._lctf.readCoverage(i,l.readUshort(i,a)+u),f.mark2Coverage=e._lctf.readCoverage(i,l.readUshort(i,a+2)+u),f.markClassCount=l.readUshort(i,a+4),f.mark1Array=e.GPOS.readMarkArray(i,l.readUshort(i,a+6)+u),f.mark2Array=e.GPOS.readBaseArray(i,l.readUshort(i,a+8)+u,f.markClassCount);else{if(n==9&&f.fmt==1){var E=l.readUshort(i,a);a+=2;var Y=l.readUint(i,a);if(a+=4,s.ltype==9)s.ltype=E;else if(s.ltype!=E)throw"invalid extension substitution";return e.GPOS.subt(i,s.ltype,u+Y)}console.debug("unsupported GPOS table LookupType",n,"format",f.fmt)}return f},e.GPOS.readValueRecord=function(i,n,a){var s=e._bin,l=[];return l.push(1&a?s.readShort(i,n):0),n+=1&a?2:0,l.push(2&a?s.readShort(i,n):0),n+=2&a?2:0,l.push(4&a?s.readShort(i,n):0),n+=4&a?2:0,l.push(8&a?s.readShort(i,n):0),n+=8&a?2:0,l},e.GPOS.readBaseArray=function(i,n,a){var s=e._bin,l=[],u=n,f=s.readUshort(i,n);n+=2;for(var d=0;d<f;d++){for(var h=[],p=0;p<a;p++)h.push(e.GPOS.readAnchorRecord(i,u+s.readUshort(i,n))),n+=2;l.push(h)}return l},e.GPOS.readMarkArray=function(i,n){var a=e._bin,s=[],l=n,u=a.readUshort(i,n);n+=2;for(var f=0;f<u;f++){var d=e.GPOS.readAnchorRecord(i,a.readUshort(i,n+2)+l);d.markClass=a.readUshort(i,n),s.push(d),n+=4}return s},e.GPOS.readAnchorRecord=function(i,n){var a=e._bin,s={};return s.fmt=a.readUshort(i,n),s.x=a.readShort(i,n+2),s.y=a.readShort(i,n+4),s},e.GSUB={},e.GSUB.parse=function(i,n,a,s){return e._lctf.parse(i,n,a,s,e.GSUB.subt)},e.GSUB.subt=function(i,n,a,s){var l=e._bin,u=a,f={};if(f.fmt=l.readUshort(i,a),a+=2,n!=1&&n!=2&&n!=4&&n!=5&&n!=6)return null;if(n==1||n==2||n==4||n==5&&f.fmt<=2||n==6&&f.fmt<=2){var d=l.readUshort(i,a);a+=2,f.coverage=e._lctf.readCoverage(i,u+d)}if(n==1&&f.fmt>=1&&f.fmt<=2){if(f.fmt==1)f.delta=l.readShort(i,a),a+=2;else if(f.fmt==2){var h=l.readUshort(i,a);a+=2,f.newg=l.readUshorts(i,a,h),a+=2*f.newg.length}}else if(n==2&&f.fmt==1){h=l.readUshort(i,a),a+=2,f.seqs=[];for(var p=0;p<h;p++){var v=l.readUshort(i,a)+u;a+=2;var g=l.readUshort(i,v);f.seqs.push(l.readUshorts(i,v+2,g))}}else if(n==4)for(f.vals=[],h=l.readUshort(i,a),a+=2,p=0;p<h;p++){var b=l.readUshort(i,a);a+=2,f.vals.push(e.GSUB.readLigatureSet(i,u+b))}else if(n==5&&f.fmt==2){if(f.fmt==2){var A=l.readUshort(i,a);a+=2,f.cDef=e._lctf.readClassDef(i,u+A),f.scset=[];var w=l.readUshort(i,a);for(a+=2,p=0;p<w;p++){var x=l.readUshort(i,a);a+=2,f.scset.push(x==0?null:e.GSUB.readSubClassSet(i,u+x))}}}else if(n==6&&f.fmt==3){if(f.fmt==3){for(p=0;p<3;p++){h=l.readUshort(i,a),a+=2;for(var T=[],M=0;M<h;M++)T.push(e._lctf.readCoverage(i,u+l.readUshort(i,a+2*M)));a+=2*h,p==0&&(f.backCvg=T),p==1&&(f.inptCvg=T),p==2&&(f.ahedCvg=T)}h=l.readUshort(i,a),a+=2,f.lookupRec=e.GSUB.readSubstLookupRecords(i,a,h)}}else{if(n==7&&f.fmt==1){var R=l.readUshort(i,a);a+=2;var S=l.readUint(i,a);if(a+=4,s.ltype==9)s.ltype=R;else if(s.ltype!=R)throw"invalid extension substitution";return e.GSUB.subt(i,s.ltype,u+S)}console.debug("unsupported GSUB table LookupType",n,"format",f.fmt)}return f},e.GSUB.readSubClassSet=function(i,n){var a=e._bin.readUshort,s=n,l=[],u=a(i,n);n+=2;for(var f=0;f<u;f++){var d=a(i,n);n+=2,l.push(e.GSUB.readSubClassRule(i,s+d))}return l},e.GSUB.readSubClassRule=function(i,n){var a=e._bin.readUshort,s={},l=a(i,n),u=a(i,n+=2);n+=2,s.input=[];for(var f=0;f<l-1;f++)s.input.push(a(i,n)),n+=2;return s.substLookupRecords=e.GSUB.readSubstLookupRecords(i,n,u),s},e.GSUB.readSubstLookupRecords=function(i,n,a){for(var s=e._bin.readUshort,l=[],u=0;u<a;u++)l.push(s(i,n),s(i,n+2)),n+=4;return l},e.GSUB.readChainSubClassSet=function(i,n){var a=e._bin,s=n,l=[],u=a.readUshort(i,n);n+=2;for(var f=0;f<u;f++){var d=a.readUshort(i,n);n+=2,l.push(e.GSUB.readChainSubClassRule(i,s+d))}return l},e.GSUB.readChainSubClassRule=function(i,n){for(var a=e._bin,s={},l=["backtrack","input","lookahead"],u=0;u<l.length;u++){var f=a.readUshort(i,n);n+=2,u==1&&f--,s[l[u]]=a.readUshorts(i,n,f),n+=2*s[l[u]].length}return f=a.readUshort(i,n),n+=2,s.subst=a.readUshorts(i,n,2*f),n+=2*s.subst.length,s},e.GSUB.readLigatureSet=function(i,n){var a=e._bin,s=n,l=[],u=a.readUshort(i,n);n+=2;for(var f=0;f<u;f++){var d=a.readUshort(i,n);n+=2,l.push(e.GSUB.readLigature(i,s+d))}return l},e.GSUB.readLigature=function(i,n){var a=e._bin,s={chain:[]};s.nglyph=a.readUshort(i,n),n+=2;var l=a.readUshort(i,n);n+=2;for(var u=0;u<l-1;u++)s.chain.push(a.readUshort(i,n)),n+=2;return s},e.head={},e.head.parse=function(i,n,a){var s=e._bin,l={};return s.readFixed(i,n),n+=4,l.fontRevision=s.readFixed(i,n),n+=4,s.readUint(i,n),n+=4,s.readUint(i,n),n+=4,l.flags=s.readUshort(i,n),n+=2,l.unitsPerEm=s.readUshort(i,n),n+=2,l.created=s.readUint64(i,n),n+=8,l.modified=s.readUint64(i,n),n+=8,l.xMin=s.readShort(i,n),n+=2,l.yMin=s.readShort(i,n),n+=2,l.xMax=s.readShort(i,n),n+=2,l.yMax=s.readShort(i,n),n+=2,l.macStyle=s.readUshort(i,n),n+=2,l.lowestRecPPEM=s.readUshort(i,n),n+=2,l.fontDirectionHint=s.readShort(i,n),n+=2,l.indexToLocFormat=s.readShort(i,n),n+=2,l.glyphDataFormat=s.readShort(i,n),n+=2,l},e.hhea={},e.hhea.parse=function(i,n,a){var s=e._bin,l={};return s.readFixed(i,n),n+=4,l.ascender=s.readShort(i,n),n+=2,l.descender=s.readShort(i,n),n+=2,l.lineGap=s.readShort(i,n),n+=2,l.advanceWidthMax=s.readUshort(i,n),n+=2,l.minLeftSideBearing=s.readShort(i,n),n+=2,l.minRightSideBearing=s.readShort(i,n),n+=2,l.xMaxExtent=s.readShort(i,n),n+=2,l.caretSlopeRise=s.readShort(i,n),n+=2,l.caretSlopeRun=s.readShort(i,n),n+=2,l.caretOffset=s.readShort(i,n),n+=2,n+=8,l.metricDataFormat=s.readShort(i,n),n+=2,l.numberOfHMetrics=s.readUshort(i,n),n+=2,l},e.hmtx={},e.hmtx.parse=function(i,n,a,s){for(var l=e._bin,u={aWidth:[],lsBearing:[]},f=0,d=0,h=0;h<s.maxp.numGlyphs;h++)h<s.hhea.numberOfHMetrics&&(f=l.readUshort(i,n),n+=2,d=l.readShort(i,n),n+=2),u.aWidth.push(f),u.lsBearing.push(d);return u},e.kern={},e.kern.parse=function(i,n,a,s){var l=e._bin,u=l.readUshort(i,n);if(n+=2,u==1)return e.kern.parseV1(i,n-2,a,s);var f=l.readUshort(i,n);n+=2;for(var d={glyph1:[],rval:[]},h=0;h<f;h++){n+=2,a=l.readUshort(i,n),n+=2;var p=l.readUshort(i,n);n+=2;var v=p>>>8;if((v&=15)!=0)throw"unknown kern table format: "+v;n=e.kern.readFormat0(i,n,d)}return d},e.kern.parseV1=function(i,n,a,s){var l=e._bin;l.readFixed(i,n),n+=4;var u=l.readUint(i,n);n+=4;for(var f={glyph1:[],rval:[]},d=0;d<u;d++){l.readUint(i,n),n+=4;var h=l.readUshort(i,n);n+=2,l.readUshort(i,n),n+=2;var p=h>>>8;if((p&=15)!=0)throw"unknown kern table format: "+p;n=e.kern.readFormat0(i,n,f)}return f},e.kern.readFormat0=function(i,n,a){var s=e._bin,l=-1,u=s.readUshort(i,n);n+=2,s.readUshort(i,n),n+=2,s.readUshort(i,n),n+=2,s.readUshort(i,n),n+=2;for(var f=0;f<u;f++){var d=s.readUshort(i,n);n+=2;var h=s.readUshort(i,n);n+=2;var p=s.readShort(i,n);n+=2,d!=l&&(a.glyph1.push(d),a.rval.push({glyph2:[],vals:[]}));var v=a.rval[a.rval.length-1];v.glyph2.push(h),v.vals.push(p),l=d}return n},e.loca={},e.loca.parse=function(i,n,a,s){var l=e._bin,u=[],f=s.head.indexToLocFormat,d=s.maxp.numGlyphs+1;if(f==0)for(var h=0;h<d;h++)u.push(l.readUshort(i,n+(h<<1))<<1);if(f==1)for(h=0;h<d;h++)u.push(l.readUint(i,n+(h<<2)));return u},e.maxp={},e.maxp.parse=function(i,n,a){var s=e._bin,l={},u=s.readUint(i,n);return n+=4,l.numGlyphs=s.readUshort(i,n),n+=2,u==65536&&(l.maxPoints=s.readUshort(i,n),n+=2,l.maxContours=s.readUshort(i,n),n+=2,l.maxCompositePoints=s.readUshort(i,n),n+=2,l.maxCompositeContours=s.readUshort(i,n),n+=2,l.maxZones=s.readUshort(i,n),n+=2,l.maxTwilightPoints=s.readUshort(i,n),n+=2,l.maxStorage=s.readUshort(i,n),n+=2,l.maxFunctionDefs=s.readUshort(i,n),n+=2,l.maxInstructionDefs=s.readUshort(i,n),n+=2,l.maxStackElements=s.readUshort(i,n),n+=2,l.maxSizeOfInstructions=s.readUshort(i,n),n+=2,l.maxComponentElements=s.readUshort(i,n),n+=2,l.maxComponentDepth=s.readUshort(i,n),n+=2),l},e.name={},e.name.parse=function(i,n,a){var s=e._bin,l={};s.readUshort(i,n),n+=2;var u=s.readUshort(i,n);n+=2,s.readUshort(i,n);for(var f,d=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],h=n+=2,p=0;p<u;p++){var v=s.readUshort(i,n);n+=2;var g=s.readUshort(i,n);n+=2;var b=s.readUshort(i,n);n+=2;var A=s.readUshort(i,n);n+=2;var w=s.readUshort(i,n);n+=2;var x=s.readUshort(i,n);n+=2;var T,M=d[A],R=h+12*u+x;if(v==0)T=s.readUnicode(i,R,w/2);else if(v==3&&g==0)T=s.readUnicode(i,R,w/2);else if(g==0)T=s.readASCII(i,R,w);else if(g==1)T=s.readUnicode(i,R,w/2);else if(g==3)T=s.readUnicode(i,R,w/2);else{if(v!=1)throw"unknown encoding "+g+", platformID: "+v;T=s.readASCII(i,R,w),console.debug("reading unknown MAC encoding "+g+" as ASCII")}var S="p"+v+","+b.toString(16);l[S]==null&&(l[S]={}),l[S][M!==void 0?M:A]=T,l[S]._lang=b}for(var O in l)if(l[O].postScriptName!=null&&l[O]._lang==1033)return l[O];for(var O in l)if(l[O].postScriptName!=null&&l[O]._lang==0)return l[O];for(var O in l)if(l[O].postScriptName!=null&&l[O]._lang==3084)return l[O];for(var O in l)if(l[O].postScriptName!=null)return l[O];for(var O in l){f=O;break}return console.debug("returning name table with languageID "+l[f]._lang),l[f]},e["OS/2"]={},e["OS/2"].parse=function(i,n,a){var s=e._bin.readUshort(i,n);n+=2;var l={};if(s==0)e["OS/2"].version0(i,n,l);else if(s==1)e["OS/2"].version1(i,n,l);else if(s==2||s==3||s==4)e["OS/2"].version2(i,n,l);else{if(s!=5)throw"unknown OS/2 table version: "+s;e["OS/2"].version5(i,n,l)}return l},e["OS/2"].version0=function(i,n,a){var s=e._bin;return a.xAvgCharWidth=s.readShort(i,n),n+=2,a.usWeightClass=s.readUshort(i,n),n+=2,a.usWidthClass=s.readUshort(i,n),n+=2,a.fsType=s.readUshort(i,n),n+=2,a.ySubscriptXSize=s.readShort(i,n),n+=2,a.ySubscriptYSize=s.readShort(i,n),n+=2,a.ySubscriptXOffset=s.readShort(i,n),n+=2,a.ySubscriptYOffset=s.readShort(i,n),n+=2,a.ySuperscriptXSize=s.readShort(i,n),n+=2,a.ySuperscriptYSize=s.readShort(i,n),n+=2,a.ySuperscriptXOffset=s.readShort(i,n),n+=2,a.ySuperscriptYOffset=s.readShort(i,n),n+=2,a.yStrikeoutSize=s.readShort(i,n),n+=2,a.yStrikeoutPosition=s.readShort(i,n),n+=2,a.sFamilyClass=s.readShort(i,n),n+=2,a.panose=s.readBytes(i,n,10),n+=10,a.ulUnicodeRange1=s.readUint(i,n),n+=4,a.ulUnicodeRange2=s.readUint(i,n),n+=4,a.ulUnicodeRange3=s.readUint(i,n),n+=4,a.ulUnicodeRange4=s.readUint(i,n),n+=4,a.achVendID=[s.readInt8(i,n),s.readInt8(i,n+1),s.readInt8(i,n+2),s.readInt8(i,n+3)],n+=4,a.fsSelection=s.readUshort(i,n),n+=2,a.usFirstCharIndex=s.readUshort(i,n),n+=2,a.usLastCharIndex=s.readUshort(i,n),n+=2,a.sTypoAscender=s.readShort(i,n),n+=2,a.sTypoDescender=s.readShort(i,n),n+=2,a.sTypoLineGap=s.readShort(i,n),n+=2,a.usWinAscent=s.readUshort(i,n),n+=2,a.usWinDescent=s.readUshort(i,n),n+=2},e["OS/2"].version1=function(i,n,a){var s=e._bin;return n=e["OS/2"].version0(i,n,a),a.ulCodePageRange1=s.readUint(i,n),n+=4,a.ulCodePageRange2=s.readUint(i,n),n+=4},e["OS/2"].version2=function(i,n,a){var s=e._bin;return n=e["OS/2"].version1(i,n,a),a.sxHeight=s.readShort(i,n),n+=2,a.sCapHeight=s.readShort(i,n),n+=2,a.usDefault=s.readUshort(i,n),n+=2,a.usBreak=s.readUshort(i,n),n+=2,a.usMaxContext=s.readUshort(i,n),n+=2},e["OS/2"].version5=function(i,n,a){var s=e._bin;return n=e["OS/2"].version2(i,n,a),a.usLowerOpticalPointSize=s.readUshort(i,n),n+=2,a.usUpperOpticalPointSize=s.readUshort(i,n),n+=2},e.post={},e.post.parse=function(i,n,a){var s=e._bin,l={};return l.version=s.readFixed(i,n),n+=4,l.italicAngle=s.readFixed(i,n),n+=4,l.underlinePosition=s.readShort(i,n),n+=2,l.underlineThickness=s.readShort(i,n),n+=2,l},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(i,n){var a=i.cmap,s=-1;if(a.p0e4!=null?s=a.p0e4:a.p3e1!=null?s=a.p3e1:a.p1e0!=null?s=a.p1e0:a.p0e3!=null&&(s=a.p0e3),s==-1)throw"no familiar platform and encoding!";var l=a.tables[s];if(l.format==0)return n>=l.map.length?0:l.map[n];if(l.format==4){for(var u=-1,f=0;f<l.endCount.length;f++)if(n<=l.endCount[f]){u=f;break}return u==-1||l.startCount[u]>n?0:65535&(l.idRangeOffset[u]!=0?l.glyphIdArray[n-l.startCount[u]+(l.idRangeOffset[u]>>1)-(l.idRangeOffset.length-u)]:n+l.idDelta[u])}if(l.format==12){if(n>l.groups[l.groups.length-1][1])return 0;for(f=0;f<l.groups.length;f++){var d=l.groups[f];if(d[0]<=n&&n<=d[1])return d[2]+(n-d[0])}return 0}throw"unknown cmap table format "+l.format},e.U.glyphToPath=function(i,n){var a={cmds:[],crds:[]};if(i.SVG&&i.SVG.entries[n]){var s=i.SVG.entries[n];return s==null?a:(typeof s=="string"&&(s=e.SVG.toPath(s),i.SVG.entries[n]=s),s)}if(i.CFF){var l={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:i.CFF.Private?i.CFF.Private.defaultWidthX:0,open:!1},u=i.CFF,f=i.CFF.Private;if(u.ROS){for(var d=0;u.FDSelect[d+2]<=n;)d+=2;f=u.FDArray[u.FDSelect[d+1]].Private}e.U._drawCFF(i.CFF.CharStrings[n],l,u,f,a)}else i.glyf&&e.U._drawGlyf(n,i,a);return a},e.U._drawGlyf=function(i,n,a){var s=n.glyf[i];s==null&&(s=n.glyf[i]=e.glyf._parseGlyf(n,i)),s!=null&&(s.noc>-1?e.U._simpleGlyph(s,a):e.U._compoGlyph(s,n,a))},e.U._simpleGlyph=function(i,n){for(var a=0;a<i.noc;a++){for(var s=a==0?0:i.endPts[a-1]+1,l=i.endPts[a],u=s;u<=l;u++){var f=u==s?l:u-1,d=u==l?s:u+1,h=1&i.flags[u],p=1&i.flags[f],v=1&i.flags[d],g=i.xs[u],b=i.ys[u];if(u==s)if(h){if(!p){e.U.P.moveTo(n,g,b);continue}e.U.P.moveTo(n,i.xs[f],i.ys[f])}else p?e.U.P.moveTo(n,i.xs[f],i.ys[f]):e.U.P.moveTo(n,(i.xs[f]+g)/2,(i.ys[f]+b)/2);h?p&&e.U.P.lineTo(n,g,b):v?e.U.P.qcurveTo(n,g,b,i.xs[d],i.ys[d]):e.U.P.qcurveTo(n,g,b,(g+i.xs[d])/2,(b+i.ys[d])/2)}e.U.P.closePath(n)}},e.U._compoGlyph=function(i,n,a){for(var s=0;s<i.parts.length;s++){var l={cmds:[],crds:[]},u=i.parts[s];e.U._drawGlyf(u.glyphIndex,n,l);for(var f=u.m,d=0;d<l.crds.length;d+=2){var h=l.crds[d],p=l.crds[d+1];a.crds.push(h*f.a+p*f.b+f.tx),a.crds.push(h*f.c+p*f.d+f.ty)}for(d=0;d<l.cmds.length;d++)a.cmds.push(l.cmds[d])}},e.U._getGlyphClass=function(i,n){var a=e._lctf.getInterval(n,i);return a==-1?0:n[a+2]},e.U._applySubs=function(i,n,a,s){for(var l=i.length-n-1,u=0;u<a.tabs.length;u++)if(a.tabs[u]!=null){var f,d=a.tabs[u];if(!d.coverage||(f=e._lctf.coverageIndex(d.coverage,i[n]))!=-1){if(a.ltype==1)i[n],d.fmt==1?i[n]=i[n]+d.delta:i[n]=d.newg[f];else if(a.ltype==4)for(var h=d.vals[f],p=0;p<h.length;p++){var v=h[p],g=v.chain.length;if(!(g>l)){for(var b=!0,A=0,w=0;w<g;w++){for(;i[n+A+(1+w)]==-1;)A++;v.chain[w]!=i[n+A+(1+w)]&&(b=!1)}if(b){for(i[n]=v.nglyph,w=0;w<g+A;w++)i[n+w+1]=-1;break}}}else if(a.ltype==5&&d.fmt==2)for(var x=e._lctf.getInterval(d.cDef,i[n]),T=d.cDef[x+2],M=d.scset[T],R=0;R<M.length;R++){var S=M[R],O=S.input;if(!(O.length>l)){for(b=!0,w=0;w<O.length;w++){var V=e._lctf.getInterval(d.cDef,i[n+1+w]);if(x==-1&&d.cDef[V+2]!=O[w]){b=!1;break}}if(b){var L=S.substLookupRecords;for(p=0;p<L.length;p+=2)L[p],L[p+1]}}}else if(a.ltype==6&&d.fmt==3){if(!e.U._glsCovered(i,d.backCvg,n-d.backCvg.length)||!e.U._glsCovered(i,d.inptCvg,n)||!e.U._glsCovered(i,d.ahedCvg,n+d.inptCvg.length))continue;var Q=d.lookupRec;for(R=0;R<Q.length;R+=2){x=Q[R];var _=s[Q[R+1]];e.U._applySubs(i,n+x,_,s)}}}}},e.U._glsCovered=function(i,n,a){for(var s=0;s<n.length;s++)if(e._lctf.coverageIndex(n[s],i[a+s])==-1)return!1;return!0},e.U.glyphsToPath=function(i,n,a){for(var s={cmds:[],crds:[]},l=0,u=0;u<n.length;u++){var f=n[u];if(f!=-1){for(var d=u<n.length-1&&n[u+1]!=-1?n[u+1]:0,h=e.U.glyphToPath(i,f),p=0;p<h.crds.length;p+=2)s.crds.push(h.crds[p]+l),s.crds.push(h.crds[p+1]);for(a&&s.cmds.push(a),p=0;p<h.cmds.length;p++)s.cmds.push(h.cmds[p]);a&&s.cmds.push("X"),l+=i.hmtx.aWidth[f],u<n.length-1&&(l+=e.U.getPairAdjustment(i,f,d))}}return s},e.U.P={},e.U.P.moveTo=function(i,n,a){i.cmds.push("M"),i.crds.push(n,a)},e.U.P.lineTo=function(i,n,a){i.cmds.push("L"),i.crds.push(n,a)},e.U.P.curveTo=function(i,n,a,s,l,u,f){i.cmds.push("C"),i.crds.push(n,a,s,l,u,f)},e.U.P.qcurveTo=function(i,n,a,s,l){i.cmds.push("Q"),i.crds.push(n,a,s,l)},e.U.P.closePath=function(i){i.cmds.push("Z")},e.U._drawCFF=function(i,n,a,s,l){for(var u=n.stack,f=n.nStems,d=n.haveWidth,h=n.width,p=n.open,v=0,g=n.x,b=n.y,A=0,w=0,x=0,T=0,M=0,R=0,S=0,O=0,V=0,L=0,Q={val:0,size:0};v<i.length;){e.CFF.getCharString(i,v,Q);var _=Q.val;if(v+=Q.size,_=="o1"||_=="o18")u.length%2!=0&&!d&&(h=u.shift()+s.nominalWidthX),f+=u.length>>1,u.length=0,d=!0;else if(_=="o3"||_=="o23")u.length%2!=0&&!d&&(h=u.shift()+s.nominalWidthX),f+=u.length>>1,u.length=0,d=!0;else if(_=="o4")u.length>1&&!d&&(h=u.shift()+s.nominalWidthX,d=!0),p&&e.U.P.closePath(l),b+=u.pop(),e.U.P.moveTo(l,g,b),p=!0;else if(_=="o5")for(;u.length>0;)g+=u.shift(),b+=u.shift(),e.U.P.lineTo(l,g,b);else if(_=="o6"||_=="o7")for(var G=u.length,E=_=="o6",Y=0;Y<G;Y++){var B=u.shift();E?g+=B:b+=B,E=!E,e.U.P.lineTo(l,g,b)}else if(_=="o8"||_=="o24"){G=u.length;for(var ie=0;ie+6<=G;)A=g+u.shift(),w=b+u.shift(),x=A+u.shift(),T=w+u.shift(),g=x+u.shift(),b=T+u.shift(),e.U.P.curveTo(l,A,w,x,T,g,b),ie+=6;_=="o24"&&(g+=u.shift(),b+=u.shift(),e.U.P.lineTo(l,g,b))}else{if(_=="o11")break;if(_=="o1234"||_=="o1235"||_=="o1236"||_=="o1237")_=="o1234"&&(w=b,x=(A=g+u.shift())+u.shift(),L=T=w+u.shift(),R=T,O=b,g=(S=(M=(V=x+u.shift())+u.shift())+u.shift())+u.shift(),e.U.P.curveTo(l,A,w,x,T,V,L),e.U.P.curveTo(l,M,R,S,O,g,b)),_=="o1235"&&(A=g+u.shift(),w=b+u.shift(),x=A+u.shift(),T=w+u.shift(),V=x+u.shift(),L=T+u.shift(),M=V+u.shift(),R=L+u.shift(),S=M+u.shift(),O=R+u.shift(),g=S+u.shift(),b=O+u.shift(),u.shift(),e.U.P.curveTo(l,A,w,x,T,V,L),e.U.P.curveTo(l,M,R,S,O,g,b)),_=="o1236"&&(A=g+u.shift(),w=b+u.shift(),x=A+u.shift(),L=T=w+u.shift(),R=T,S=(M=(V=x+u.shift())+u.shift())+u.shift(),O=R+u.shift(),g=S+u.shift(),e.U.P.curveTo(l,A,w,x,T,V,L),e.U.P.curveTo(l,M,R,S,O,g,b)),_=="o1237"&&(A=g+u.shift(),w=b+u.shift(),x=A+u.shift(),T=w+u.shift(),V=x+u.shift(),L=T+u.shift(),M=V+u.shift(),R=L+u.shift(),S=M+u.shift(),O=R+u.shift(),Math.abs(S-g)>Math.abs(O-b)?g=S+u.shift():b=O+u.shift(),e.U.P.curveTo(l,A,w,x,T,V,L),e.U.P.curveTo(l,M,R,S,O,g,b));else if(_=="o14"){if(u.length>0&&!d&&(h=u.shift()+a.nominalWidthX,d=!0),u.length==4){var ae=u.shift(),N=u.shift(),F=u.shift(),y=u.shift(),k=e.CFF.glyphBySE(a,F),D=e.CFF.glyphBySE(a,y);e.U._drawCFF(a.CharStrings[k],n,a,s,l),n.x=ae,n.y=N,e.U._drawCFF(a.CharStrings[D],n,a,s,l)}p&&(e.U.P.closePath(l),p=!1)}else if(_=="o19"||_=="o20")u.length%2!=0&&!d&&(h=u.shift()+s.nominalWidthX),f+=u.length>>1,u.length=0,d=!0,v+=f+7>>3;else if(_=="o21")u.length>2&&!d&&(h=u.shift()+s.nominalWidthX,d=!0),b+=u.pop(),g+=u.pop(),p&&e.U.P.closePath(l),e.U.P.moveTo(l,g,b),p=!0;else if(_=="o22")u.length>1&&!d&&(h=u.shift()+s.nominalWidthX,d=!0),g+=u.pop(),p&&e.U.P.closePath(l),e.U.P.moveTo(l,g,b),p=!0;else if(_=="o25"){for(;u.length>6;)g+=u.shift(),b+=u.shift(),e.U.P.lineTo(l,g,b);A=g+u.shift(),w=b+u.shift(),x=A+u.shift(),T=w+u.shift(),g=x+u.shift(),b=T+u.shift(),e.U.P.curveTo(l,A,w,x,T,g,b)}else if(_=="o26")for(u.length%2&&(g+=u.shift());u.length>0;)A=g,w=b+u.shift(),g=x=A+u.shift(),b=(T=w+u.shift())+u.shift(),e.U.P.curveTo(l,A,w,x,T,g,b);else if(_=="o27")for(u.length%2&&(b+=u.shift());u.length>0;)w=b,x=(A=g+u.shift())+u.shift(),T=w+u.shift(),g=x+u.shift(),b=T,e.U.P.curveTo(l,A,w,x,T,g,b);else if(_=="o10"||_=="o29"){var I=_=="o10"?s:a;if(u.length==0)console.debug("error: empty stack");else{var C=u.pop(),W=I.Subrs[C+I.Bias];n.x=g,n.y=b,n.nStems=f,n.haveWidth=d,n.width=h,n.open=p,e.U._drawCFF(W,n,a,s,l),g=n.x,b=n.y,f=n.nStems,d=n.haveWidth,h=n.width,p=n.open}}else if(_=="o30"||_=="o31"){var U=u.length,j=(ie=0,_=="o31");for(ie+=U-(G=-3&U);ie<G;)j?(w=b,x=(A=g+u.shift())+u.shift(),b=(T=w+u.shift())+u.shift(),G-ie==5?(g=x+u.shift(),ie++):g=x,j=!1):(A=g,w=b+u.shift(),x=A+u.shift(),T=w+u.shift(),g=x+u.shift(),G-ie==5?(b=T+u.shift(),ie++):b=T,j=!0),e.U.P.curveTo(l,A,w,x,T,g,b),ie+=4}else{if((_+"").charAt(0)=="o")throw console.debug("Unknown operation: "+_,i),_;u.push(_)}}}n.x=g,n.y=b,n.nStems=f,n.haveWidth=d,n.width=h,n.open=p};var r=e,o={Typr:r};return t.Typr=r,t.default=o,Object.defineProperty(t,"__esModule",{value:!0}),t}({}).Typr}c(Cp,"typrFactory");function Dp(){return function(t){var e=Uint8Array,r=Uint16Array,o=Uint32Array,i=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),n=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=c(function(_,G){for(var E=new r(31),Y=0;Y<31;++Y)E[Y]=G+=1<<_[Y-1];var B=new o(E[30]);for(Y=1;Y<30;++Y)for(var ie=E[Y];ie<E[Y+1];++ie)B[ie]=ie-E[Y]<<5|Y;return[E,B]},"f"),l=s(i,2),u=l[0],f=l[1];u[28]=258,f[258]=28;for(var d=s(n,0)[0],h=new r(32768),p=0;p<32768;++p){var v=(43690&p)>>>1|(21845&p)<<1;v=(61680&(v=(52428&v)>>>2|(13107&v)<<2))>>>4|(3855&v)<<4,h[p]=((65280&v)>>>8|(255&v)<<8)>>>1}var g=c(function(_,G,E){for(var Y=_.length,B=0,ie=new r(G);B<Y;++B)++ie[_[B]-1];var ae,N=new r(G);for(B=0;B<G;++B)N[B]=N[B-1]+ie[B-1]<<1;if(E){ae=new r(1<<G);var F=15-G;for(B=0;B<Y;++B)if(_[B])for(var y=B<<4|_[B],k=G-_[B],D=N[_[B]-1]++<<k,I=D|(1<<k)-1;D<=I;++D)ae[h[D]>>>F]=y}else for(ae=new r(Y),B=0;B<Y;++B)_[B]&&(ae[B]=h[N[_[B]-1]++]>>>15-_[B]);return ae},"w"),b=new e(288);for(p=0;p<144;++p)b[p]=8;for(p=144;p<256;++p)b[p]=9;for(p=256;p<280;++p)b[p]=7;for(p=280;p<288;++p)b[p]=8;var A=new e(32);for(p=0;p<32;++p)A[p]=5;var w=g(b,9,1),x=g(A,5,1),T=c(function(_){for(var G=_[0],E=1;E<_.length;++E)_[E]>G&&(G=_[E]);return G},"y"),M=c(function(_,G,E){var Y=G/8|0;return(_[Y]|_[Y+1]<<8)>>(7&G)&E},"L"),R=c(function(_,G){var E=G/8|0;return(_[E]|_[E+1]<<8|_[E+2]<<16)>>(7&G)},"U"),S=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],O=c(function(_,G,E){var Y=new Error(G||S[_]);if(Y.code=_,Error.captureStackTrace&&Error.captureStackTrace(Y,O),!E)throw Y;return Y},"T"),V=c(function(_,G,E){var Y=_.length;if(!Y||E&&!E.l&&Y<5)return G||new e(0);var B=!G||E,ie=!E||E.i;E||(E={}),G||(G=new e(3*Y));var ae,N=c(function(be){var je=G.length;if(be>je){var Ve=new e(Math.max(2*je,be));Ve.set(G),G=Ve}},"d"),F=E.f||0,y=E.p||0,k=E.b||0,D=E.l,I=E.d,C=E.m,W=E.n,U=8*Y;do{if(!D){E.f=F=M(_,y,1);var j=M(_,y+1,3);if(y+=3,!j){var $=_[(fe=((ae=y)/8|0)+(7&ae&&1)+4)-4]|_[fe-3]<<8,le=fe+$;if(le>Y){ie&&O(0);break}B&&N(k+$),G.set(_.subarray(fe,le),k),E.b=k+=$,E.p=y=8*le;continue}if(j==1)D=w,I=x,C=9,W=5;else if(j==2){var X=M(_,y,31)+257,H=M(_,y+10,15)+4,ke=X+M(_,y+5,31)+1;y+=14;for(var ye=new e(ke),re=new e(19),ue=0;ue<H;++ue)re[a[ue]]=M(_,y+3*ue,7);y+=3*H;var pe=T(re),K=(1<<pe)-1,ce=g(re,pe,1);for(ue=0;ue<ke;){var fe,z=ce[M(_,y,K)];if(y+=15&z,(fe=z>>>4)<16)ye[ue++]=fe;else{var we=0,oe=0;for(fe==16?(oe=3+M(_,y,3),y+=2,we=ye[ue-1]):fe==17?(oe=3+M(_,y,7),y+=3):fe==18&&(oe=11+M(_,y,127),y+=7);oe--;)ye[ue++]=we}}var me=ye.subarray(0,X),te=ye.subarray(X);C=T(me),W=T(te),D=g(me,C,1),I=g(te,W,1)}else O(1);if(y>U){ie&&O(0);break}}B&&N(k+131072);for(var Re=(1<<C)-1,he=(1<<W)-1,ge=y;;ge=y){var xe=(we=D[R(_,y)&Re])>>>4;if((y+=15&we)>U){ie&&O(0);break}if(we||O(2),xe<256)G[k++]=xe;else{if(xe==256){ge=y,D=null;break}var De=xe-254;if(xe>264){var Fe=i[ue=xe-257];De=M(_,y,(1<<Fe)-1)+u[ue],y+=Fe}var Ye=I[R(_,y)&he],Ae=Ye>>>4;if(Ye||O(3),y+=15&Ye,te=d[Ae],Ae>3&&(Fe=n[Ae],te+=R(_,y)&(1<<Fe)-1,y+=Fe),y>U){ie&&O(0);break}B&&N(k+131072);for(var Oe=k+De;k<Oe;k+=4)G[k]=G[k-te],G[k+1]=G[k+1-te],G[k+2]=G[k+2-te],G[k+3]=G[k+3-te];k=Oe}}E.l=D,E.p=ge,E.b=k,D&&(F=1,E.m=C,E.d=I,E.n=W)}while(!F);return k==G.length?G:function(be,je,Ve){(je==null||je<0)&&(je=0),(Ve==null||Ve>be.length)&&(Ve=be.length);var ot=new(be instanceof r?r:be instanceof o?o:e)(Ve-je);return ot.set(be.subarray(je,Ve)),ot}(G,0,k)},"O"),L=new e(0),Q=typeof TextDecoder<"u"&&new TextDecoder;try{Q.decode(L,{stream:!0})}catch{}return t.convert_streams=function(_){var G=new DataView(_),E=0;function Y(){var X=G.getUint16(E);return E+=2,X}c(Y,"t");function B(){var X=G.getUint32(E);return E+=4,X}c(B,"a");function ie(X){$.setUint16(le,X),le+=2}c(ie,"i");function ae(X){$.setUint32(le,X),le+=4}c(ae,"o");for(var N={signature:B(),flavor:B(),length:B(),numTables:Y(),reserved:Y(),totalSfntSize:B(),majorVersion:Y(),minorVersion:Y(),metaOffset:B(),metaLength:B(),metaOrigLength:B(),privOffset:B(),privLength:B()},F=0;Math.pow(2,F)<=N.numTables;)F++;F--;for(var y=16*Math.pow(2,F),k=16*N.numTables-y,D=12,I=[],C=0;C<N.numTables;C++)I.push({tag:B(),offset:B(),compLength:B(),origLength:B(),origChecksum:B()}),D+=16;var W,U=new Uint8Array(12+16*I.length+I.reduce(function(X,H){return X+H.origLength+4},0)),j=U.buffer,$=new DataView(j),le=0;return ae(N.flavor),ie(N.numTables),ie(y),ie(F),ie(k),I.forEach(function(X){ae(X.tag),ae(X.origChecksum),ae(D),ae(X.origLength),X.outOffset=D,(D+=X.origLength)%4!=0&&(D+=4-D%4)}),I.forEach(function(X){var H,ke=_.slice(X.offset,X.offset+X.compLength);if(X.compLength!=X.origLength){var ye=new Uint8Array(X.origLength);H=new Uint8Array(ke,2),V(H,ye)}else ye=new Uint8Array(ke);U.set(ye,X.outOffset);var re=0;(D=X.outOffset+X.origLength)%4!=0&&(re=4-D%4),U.set(new Uint8Array(re).buffer,X.outOffset+X.origLength),W=D+re}),j.slice(0,W)},Object.defineProperty(t,"__esModule",{value:!0}),t}({}).convert_streams}c(Dp,"woff2otfFactory");function Ep(t,e){let r={M:2,L:2,Q:4,C:6,Z:0},o={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},i=1,n=2,a=4,s=8,l=16,u=32,f;function d(S){if(!f){let O={R:n,L:i,D:a,C:l,U:u,T:s};f=new Map;for(let V in o){let L=0;o[V].split(",").forEach(Q=>{let[_,G]=Q.split("+");_=parseInt(_,36),G=G?parseInt(G,36):0,f.set(L+=_,O[V]);for(let E=G;E--;)f.set(++L,O[V])})}}return f.get(S)||u}c(d,"getCharJoiningType");let h=1,p=2,v=3,g=4,b=[null,"isol","init","fina","medi"];function A(S){let O=new Uint8Array(S.length),V=u,L=h,Q=-1;for(let _=0;_<S.length;_++){let G=S.codePointAt(_),E=d(G)|0,Y=h;E&s||(V&(i|a|l)?E&(n|a|l)?(Y=v,(L===h||L===v)&&O[Q]++):E&(i|u)&&(L===p||L===g)&&O[Q]--:V&(n|u)&&(L===p||L===g)&&O[Q]--,L=O[_]=Y,V=E,Q=_,G>65535&&_++)}return O}c(A,"detectJoiningForms");function w(S,O){let V=[];for(let Q=0;Q<O.length;Q++){let _=O.codePointAt(Q);_>65535&&Q++,V.push(t.U.codeToGlyph(S,_))}let L=S.GSUB;if(L){let{lookupList:Q,featureList:_}=L,G,E=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,Y=[];_.forEach(B=>{if(E.test(B.tag))for(let ie=0;ie<B.tab.length;ie++){if(Y[B.tab[ie]])continue;Y[B.tab[ie]]=!0;let ae=Q[B.tab[ie]],N=/^(isol|init|fina|medi)$/.test(B.tag);N&&!G&&(G=A(O));for(let F=0;F<V.length;F++)(!G||!N||b[G[F]]===B.tag)&&t.U._applySubs(V,F,ae,Q)}})}return V}c(w,"stringToGlyphs");function x(S,O){let V=new Int16Array(O.length*3),L=0;for(;L<O.length;L++){let E=O[L];if(E===-1)continue;V[L*3+2]=S.hmtx.aWidth[E];let Y=S.GPOS;if(Y){let B=Y.lookupList;for(let ie=0;ie<B.length;ie++){let ae=B[ie];for(let N=0;N<ae.tabs.length;N++){let F=ae.tabs[N];if(ae.ltype===1){if(t._lctf.coverageIndex(F.coverage,E)!==-1&&F.pos){G(F.pos,L);break}}else if(ae.ltype===2){let y=null,k=Q();if(k!==-1){let D=t._lctf.coverageIndex(F.coverage,O[k]);if(D!==-1){if(F.fmt===1){let I=F.pairsets[D];for(let C=0;C<I.length;C++)I[C].gid2===E&&(y=I[C])}else if(F.fmt===2){let I=t.U._getGlyphClass(O[k],F.classDef1),C=t.U._getGlyphClass(E,F.classDef2);y=F.matrix[I][C]}if(y){y.val1&&G(y.val1,k),y.val2&&G(y.val2,L);break}}}}else if(ae.ltype===4){let y=t._lctf.coverageIndex(F.markCoverage,E);if(y!==-1){let k=Q(_),D=k===-1?-1:t._lctf.coverageIndex(F.baseCoverage,O[k]);if(D!==-1){let I=F.markArray[y],C=F.baseArray[D][I.markClass];V[L*3]=C.x-I.x+V[k*3]-V[k*3+2],V[L*3+1]=C.y-I.y+V[k*3+1];break}}}else if(ae.ltype===6){let y=t._lctf.coverageIndex(F.mark1Coverage,E);if(y!==-1){let k=Q();if(k!==-1){let D=O[k];if(T(S,D)===3){let I=t._lctf.coverageIndex(F.mark2Coverage,D);if(I!==-1){let C=F.mark1Array[y],W=F.mark2Array[I][C.markClass];V[L*3]=W.x-C.x+V[k*3]-V[k*3+2],V[L*3+1]=W.y-C.y+V[k*3+1];break}}}}}}}}else if(S.kern&&!S.cff){let B=Q();if(B!==-1){let ie=S.kern.glyph1.indexOf(O[B]);if(ie!==-1){let ae=S.kern.rval[ie].glyph2.indexOf(E);ae!==-1&&(V[B*3+2]+=S.kern.rval[ie].vals[ae])}}}}return V;function Q(E){for(let Y=L-1;Y>=0;Y--)if(O[Y]!==-1&&(!E||E(O[Y])))return Y;return-1}function _(E){return T(S,E)===1}function G(E,Y){for(let B=0;B<3;B++)V[Y*3+B]+=E[B]||0}}c(x,"calcGlyphPositions");function T(S,O){let V=S.GDEF&&S.GDEF.glyphClassDef;return V?t.U._getGlyphClass(O,V):0}c(T,"getGlyphClass");function M(...S){for(let O=0;O<S.length;O++)if(typeof S[O]=="number")return S[O]}c(M,"firstNum");function R(S){let O=Object.create(null),V=S["OS/2"],L=S.hhea,Q=S.head.unitsPerEm,_=M(V&&V.sTypoAscender,L&&L.ascender,Q),G={unitsPerEm:Q,ascender:_,descender:M(V&&V.sTypoDescender,L&&L.descender,0),capHeight:M(V&&V.sCapHeight,_),xHeight:M(V&&V.sxHeight,_),lineGap:M(V&&V.sTypoLineGap,L&&L.lineGap),supportsCodePoint(E){return t.U.codeToGlyph(S,E)>0},forEachGlyph(E,Y,B,ie){let ae=0,N=1/G.unitsPerEm*Y,F=w(S,E),y=0,k=x(S,F);return F.forEach((D,I)=>{if(D!==-1){let C=O[D];if(!C){let{cmds:W,crds:U}=t.U.glyphToPath(S,D),j="",$=0;for(let ye=0,re=W.length;ye<re;ye++){let ue=r[W[ye]];j+=W[ye];for(let pe=1;pe<=ue;pe++)j+=(pe>1?",":"")+U[$++]}let le,X,H,ke;if(U.length){le=X=1/0,H=ke=-1/0;for(let ye=0,re=U.length;ye<re;ye+=2){let ue=U[ye],pe=U[ye+1];ue<le&&(le=ue),pe<X&&(X=pe),ue>H&&(H=ue),pe>ke&&(ke=pe)}}else le=H=X=ke=0;C=O[D]={index:D,advanceWidth:S.hmtx.aWidth[D],xMin:le,yMin:X,xMax:H,yMax:ke,path:j}}ie.call(null,C,ae+k[I*3]*N,k[I*3+1]*N,y),ae+=k[I*3+2]*N,B&&(ae+=B*Y)}y+=E.codePointAt(y)>65535?2:1}),ae}};return G}return c(R,"wrapFontObj"),c(function(O){let V=new Uint8Array(O,0,4),L=t._bin.readASCII(V,0,4);if(L==="wOFF")O=e(O);else if(L==="wOF2")throw new Error("woff2 fonts not supported");return R(t.parse(O)[0])},"parse")}c(Ep,"parserFactory");var Ap=Ur({name:"Typr Font Parser",dependencies:[Cp,Dp,Ep],init(t,e,r){let o=t(),i=e();return r(o,i)}});function Op(){return function(t){var e=c(function(){this.buckets=new Map},"n");e.prototype.add=function(x){var T=x>>5;this.buckets.set(T,(this.buckets.get(T)||0)|1<<(31&x))},e.prototype.has=function(x){var T=this.buckets.get(x>>5);return T!==void 0&&(T&1<<(31&x))!=0},e.prototype.serialize=function(){var x=[];return this.buckets.forEach(function(T,M){x.push((+M).toString(36)+":"+T.toString(36))}),x.join(",")},e.prototype.deserialize=function(x){var T=this;this.buckets.clear(),x.split(",").forEach(function(M){var R=M.split(":");T.buckets.set(parseInt(R[0],36),parseInt(R[1],36))})};var r=Math.pow(2,8),o=r-1,i=~o;function n(x){var T=function(R){return R&i}(x).toString(16),M=function(R){return(R&i)+r-1}(x).toString(16);return"codepoint-index/plane"+(x>>16)+"/"+T+"-"+M+".json"}c(n,"a");function a(x,T){var M=x&o,R=T.codePointAt(M/6|0);return((R=(R||48)-48)&1<<M%6)!=0}c(a,"i");function s(x,T){var M;(M=x,M.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map(function(R){return R.split("-").map(function(S){return parseInt(S.trim(),16)})})).forEach(function(R){var S=R[0],O=R[1];O===void 0&&(O=S),T(S,O)})}c(s,"u");function l(x,T){s(x,function(M,R){for(var S=M;S<=R;S++)T(S)})}c(l,"c");var u={},f={},d=new WeakMap,h="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function p(x){var T=d.get(x);return T||(T=new e,l(x.ranges,function(M){return T.add(M)}),d.set(x,T)),T}c(p,"d");var v,g=new Map;function b(x,T,M){return x[T]?T:x[M]?M:function(R){for(var S in R)return S}(x)}c(b,"g");function A(x,T){var M=T;if(!x.includes(M)){M=1/0;for(var R=0;R<x.length;R++)Math.abs(x[R]-T)<Math.abs(M-T)&&(M=x[R])}return M}c(A,"w");function w(x){return v||(v=new Set,l("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",function(T){v.add(T)})),v.has(x)}return c(w,"k"),t.CodePointSet=e,t.clearCache=function(){u={},f={}},t.getFontsForString=function(x,T){T===void 0&&(T={});var M,R=T.lang;R===void 0&&(R=new RegExp("\\p{Script=Hangul}","u").test(M=x)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(M)?"ja":"en");var S=T.category;S===void 0&&(S="sans-serif");var O=T.style;O===void 0&&(O="normal");var V=T.weight;V===void 0&&(V=400);var L=(T.dataUrl||h).replace(/\/$/g,""),Q=new Map,_=new Uint8Array(x.length),G={},E={},Y=new Array(x.length),B=new Map,ie=!1;function ae(y){var k=g.get(y);return k||(k=fetch(L+"/"+y).then(function(D){if(!D.ok)throw new Error(D.statusText);return D.json().then(function(I){if(!Array.isArray(I)||I[0]!==1)throw new Error("Incorrect schema version; need 1, got "+I[0]);return I[1]})}).catch(function(D){if(L!==h)return ie||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+L+'", trying default CDN. '+D.message),ie=!0),L=h,g.delete(y),ae(y);throw D}),g.set(y,k)),k}c(ae,"M");for(var N=function(y){var k=x.codePointAt(y),D=n(k);Y[y]=D,u[D]||B.has(D)||B.set(D,ae(D).then(function(I){u[D]=I})),k>65535&&(y++,F=y)},F=0;F<x.length;F++)N(F);return Promise.all(B.values()).then(function(){B.clear();for(var y=function(D){var I=x.codePointAt(D),C=null,W=u[Y[D]],U=void 0;for(var j in W){var $=E[j];if($===void 0&&($=E[j]=new RegExp(j).test(R||"en")),$){for(var le in U=j,W[j])if(a(I,W[j][le])){C=le;break}break}}if(!C){e:for(var X in W)if(X!==U){for(var H in W[X])if(a(I,W[X][H])){C=H;break e}}}C||(console.debug("No font coverage for U+"+I.toString(16)),C="latin"),Y[D]=C,f[C]||B.has(C)||B.set(C,ae("font-meta/"+C+".json").then(function(ke){f[C]=ke})),I>65535&&(D++,k=D)},k=0;k<x.length;k++)y(k);return Promise.all(B.values())}).then(function(){for(var y,k=null,D=0;D<x.length;D++){var I=x.codePointAt(D);if(k&&(w(I)||p(k).has(I)))_[D]=_[D-1];else{k=f[Y[D]];var C=G[k.id];if(!C){var W=k.typeforms,U=b(W,S,"sans-serif"),j=b(W[U],O,"normal"),$=A((y=W[U])===null||y===void 0?void 0:y[j],V);C=G[k.id]=L+"/font-files/"+k.id+"/"+U+"."+j+"."+$+".woff"}var le=Q.get(C);le==null&&(le=Q.size,Q.set(C,le)),_[D]=le}I>65535&&(D++,_[D]=_[D-1])}return{fontUrls:Array.from(Q.keys()),chars:_}})},Object.defineProperty(t,"__esModule",{value:!0}),t}({})}c(Op,"unicodeFontResolverClientFactory");function Ip(t,e){let r=Object.create(null),o=Object.create(null);function i(a,s){let l=c(u=>{console.error("Failure loading font ".concat(a),u)},"onError");try{let u=new XMLHttpRequest;u.open("get",a,!0),u.responseType="arraybuffer",u.onload=function(){if(u.status>=400)l(new Error(u.statusText));else if(u.status>0)try{let f=t(u.response);f.src=a,s(f)}catch(f){l(f)}},u.onerror=l,u.send()}catch(u){l(u)}}c(i,"doLoadFont");function n(a,s){let l=r[a];l?s(l):o[a]?o[a].push(s):(o[a]=[s],i(a,u=>{u.src=a,r[a]=u,o[a].forEach(f=>f(u)),delete o[a]}))}return c(n,"loadFont"),function(a,s,{lang:l,fonts:u=[],style:f="normal",weight:d="normal",unicodeFontsURL:h}={}){let p=new Uint8Array(a.length),v=[];a.length||w();let g=new Map,b=[];if(f!=="italic"&&(f="normal"),typeof d!="number"&&(d=d==="bold"?700:400),u&&!Array.isArray(u)&&(u=[u]),u=u.slice().filter(T=>!T.lang||T.lang.test(l)).reverse(),u.length){let S=0;c(function O(V=0){for(let L=V,Q=a.length;L<Q;L++){let _=a.codePointAt(L);if(S===1&&v[p[L-1]].supportsCodePoint(_)||L>0&&/\s/.test(a[L]))p[L]=p[L-1],S===2&&(b[b.length-1][1]=L);else for(let G=p[L],E=u.length;G<=E;G++)if(G===E){let Y=S===2?b[b.length-1]:b[b.length]=[L,L];Y[1]=L,S=2}else{p[L]=G;let{src:Y,unicodeRange:B}=u[G];if(!B||x(_,B)){let ie=r[Y];if(!ie){n(Y,()=>{O(L)});return}if(ie.supportsCodePoint(_)){let ae=g.get(ie);typeof ae!="number"&&(ae=v.length,v.push(ie),g.set(ie,ae)),p[L]=ae,S=1;break}}}_>65535&&L+1<Q&&(p[L+1]=p[L],L++,S===2&&(b[b.length-1][1]=L))}A()},"resolveUserFonts")()}else b.push([0,a.length-1]),A();function A(){if(b.length){let T=b.map(M=>a.substring(M[0],M[1]+1)).join("\n");e.getFontsForString(T,{lang:l||void 0,style:f,weight:d,dataUrl:h}).then(({fontUrls:M,chars:R})=>{let S=v.length,O=0;b.forEach(L=>{for(let Q=0,_=L[1]-L[0];Q<=_;Q++)p[L[0]+Q]=R[O++]+S;O++});let V=0;M.forEach((L,Q)=>{n(L,_=>{v[Q+S]=_,++V===M.length&&w()})})})}else w()}c(A,"resolveFallbacks");function w(){s({chars:p,fonts:v})}c(w,"allDone");function x(T,M){for(let R=0;R<M.length;R++){let[S,O=S]=M[R];if(S<=T&&T<=O)return!0}return!1}c(x,"isCodeInRanges")}}c(Ip,"createFontResolver");var Pp=Ur({name:"FontResolver",dependencies:[Ip,Ap,Op],init(t,e,r){return t(e,r())}});function Rp(t,e){let o=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,i="[^\\S\\u00A0]",n=new RegExp("".concat(i,"|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]"));function a({text:v,lang:g,fonts:b,style:A,weight:w,preResolvedFonts:x,unicodeFontsURL:T},M){let R=c(({chars:S,fonts:O})=>{let V,L,Q=[];for(let _=0;_<S.length;_++)S[_]!==L?(L=S[_],Q.push(V={start:_,end:_,fontObj:O[S[_]]})):V.end=_;M(Q)},"onResolved");x?R(x):t(v,R,{lang:g,fonts:b,style:A,weight:w,unicodeFontsURL:T})}c(a,"calculateFontRuns");function s({text:v="",font:g,lang:b,sdfGlyphSize:A=64,fontSize:w=400,fontWeight:x=1,fontStyle:T="normal",letterSpacing:M=0,lineHeight:R="normal",maxWidth:S=1/0,direction:O,textAlign:V="left",textIndent:L=0,whiteSpace:Q="normal",overflowWrap:_="normal",anchorX:G=0,anchorY:E=0,metricsOnly:Y=!1,unicodeFontsURL:B,preResolvedFonts:ie=null,includeCaretPositions:ae=!1,chunkedBoundsSize:N=8192,colorRanges:F=null},y){let k=d(),D={fontLoad:0,typesetting:0};v.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),v=v.replace(/\r\n/g,"\n").replace(/\r/g,"\n")),w=+w,M=+M,S=+S,R=R||"normal",L=+L,a({text:v,lang:b,style:T,weight:x,fonts:typeof g=="string"?[{src:g}]:g,unicodeFontsURL:B,preResolvedFonts:ie},I=>{D.fontLoad=d()-k;let C=isFinite(S),W=null,U=null,j=null,$=null,le=null,X=null,H=null,ke=null,ye=0,re=0,ue=Q!=="nowrap",pe=new Map,K=d(),ce=L,fe=0,z=new h,we=[z];I.forEach(he=>{let{fontObj:ge}=he,{ascender:xe,descender:De,unitsPerEm:Fe,lineGap:Ye,capHeight:Ae,xHeight:Oe}=ge,be=pe.get(ge);if(!be){let Se=w/Fe,Ue=R==="normal"?(xe-De+Ye)*Se:R*w,Yt=(Ue-(xe-De)*Se)/2,Le=Math.min(Ue,(xe-De)*Se),Ie=(xe+De)/2*Se+Le/2;be={index:pe.size,src:ge.src,fontObj:ge,fontSizeMult:Se,unitsPerEm:Fe,ascender:xe*Se,descender:De*Se,capHeight:Ae*Se,xHeight:Oe*Se,lineHeight:Ue,baseline:-Yt-xe*Se,caretTop:Ie,caretBottom:Ie-Le},pe.set(ge,be)}let{fontSizeMult:je}=be,Ve=v.slice(he.start,he.end+1),ot,Be;ge.forEachGlyph(Ve,w,M,(Se,Ue,Yt,Le)=>{Ue+=fe,Le+=he.start,ot=Ue,Be=Se;let Ie=v.charAt(Le),Xe=Se.advanceWidth*je,We=z.count,Ee;if("isEmpty"in Se||(Se.isWhitespace=!!Ie&&new RegExp(i).test(Ie),Se.canBreakAfter=!!Ie&&n.test(Ie),Se.isEmpty=Se.xMin===Se.xMax||Se.yMin===Se.yMax||o.test(Ie)),!Se.isWhitespace&&!Se.isEmpty&&re++,ue&&C&&!Se.isWhitespace&&Ue+Xe+ce>S&&We){if(z.glyphAt(We-1).glyphObj.canBreakAfter)Ee=new h,ce=-Ue;else for(let et=We;et--;)if(et===0&&_==="break-word"){Ee=new h,ce=-Ue;break}else if(z.glyphAt(et).glyphObj.canBreakAfter){Ee=z.splitAt(et+1);let Qe=Ee.glyphAt(0).x;ce-=Qe;for(let Ke=Ee.count;Ke--;)Ee.glyphAt(Ke).x-=Qe;break}Ee&&(z.isSoftWrapped=!0,z=Ee,we.push(z),ye=S)}let He=z.glyphAt(z.count);He.glyphObj=Se,He.x=Ue+ce,He.y=Yt,He.width=Xe,He.charIndex=Le,He.fontData=be,Ie==="\n"&&(z=new h,we.push(z),ce=-(Ue+Xe+M*w)+L)}),fe=ot+Be.advanceWidth*je+M*w});let oe=0;we.forEach(he=>{let ge=!0;for(let xe=he.count;xe--;){let De=he.glyphAt(xe);ge&&!De.glyphObj.isWhitespace&&(he.width=De.x+De.width,he.width>ye&&(ye=he.width),ge=!1);let{lineHeight:Fe,capHeight:Ye,xHeight:Ae,baseline:Oe}=De.fontData;Fe>he.lineHeight&&(he.lineHeight=Fe);let be=Oe-he.baseline;be<0&&(he.baseline+=be,he.cap+=be,he.ex+=be),he.cap=Math.max(he.cap,he.baseline+Ye),he.ex=Math.max(he.ex,he.baseline+Ae)}he.baseline-=oe,he.cap-=oe,he.ex-=oe,oe+=he.lineHeight});let me=0,te=0;if(G&&(typeof G=="number"?me=-G:typeof G=="string"&&(me=-ye*(G==="left"?0:G==="center"?.5:G==="right"?1:u(G)))),E&&(typeof E=="number"?te=-E:typeof E=="string"&&(te=E==="top"?0:E==="top-baseline"?-we[0].baseline:E==="top-cap"?-we[0].cap:E==="top-ex"?-we[0].ex:E==="middle"?oe/2:E==="bottom"?oe:E==="bottom-baseline"?-we[we.length-1].baseline:u(E)*oe)),!Y){let he=e.getEmbeddingLevels(v,O);W=new Uint16Array(re),U=new Uint8Array(re),j=new Float32Array(re*2),$={},H=[1/0,1/0,-1/0,-1/0],ke=[],ae&&(X=new Float32Array(v.length*4)),F&&(le=new Uint8Array(re*3));let ge=0,xe=-1,De=-1,Fe,Ye;if(we.forEach((Ae,Oe)=>{let{count:be,width:je}=Ae;if(be>0){let Ve=0;for(let Le=be;Le--&&Ae.glyphAt(Le).glyphObj.isWhitespace;)Ve++;let ot=0,Be=0;if(V==="center")ot=(ye-je)/2;else if(V==="right")ot=ye-je;else if(V==="justify"&&Ae.isSoftWrapped){let Le=0;for(let Ie=be-Ve;Ie--;)Ae.glyphAt(Ie).glyphObj.isWhitespace&&Le++;Be=(ye-je)/Le}if(Be||ot){let Le=0;for(let Ie=0;Ie<be;Ie++){let Xe=Ae.glyphAt(Ie),We=Xe.glyphObj;Xe.x+=ot+Le,Be!==0&&We.isWhitespace&&Ie<be-Ve&&(Le+=Be,Xe.width+=Be)}}let Se=e.getReorderSegments(v,he,Ae.glyphAt(0).charIndex,Ae.glyphAt(Ae.count-1).charIndex);for(let Le=0;Le<Se.length;Le++){let[Ie,Xe]=Se[Le],We=1/0,Ee=-1/0;for(let He=0;He<be;He++)if(Ae.glyphAt(He).charIndex>=Ie){let et=He,Qe=He;for(;Qe<be;Qe++){let Ke=Ae.glyphAt(Qe);if(Ke.charIndex>Xe)break;Qe<be-Ve&&(We=Math.min(We,Ke.x),Ee=Math.max(Ee,Ke.x+Ke.width))}for(let Ke=et;Ke<Qe;Ke++){let xt=Ae.glyphAt(Ke);xt.x=Ee-(xt.x+xt.width-We)}break}}let Ue,Yt=c(Le=>Ue=Le,"setGlyphObj");for(let Le=0;Le<be;Le++){let Ie=Ae.glyphAt(Le);Ue=Ie.glyphObj;let Xe=Ue.index,We=he.levels[Ie.charIndex]&1;if(We){let Ee=e.getMirroredCharacter(v[Ie.charIndex]);Ee&&Ie.fontData.fontObj.forEachGlyph(Ee,0,0,Yt)}if(ae){let{charIndex:Ee,fontData:He}=Ie,et=Ie.x+me,Qe=Ie.x+Ie.width+me;X[Ee*4]=We?Qe:et,X[Ee*4+1]=We?et:Qe,X[Ee*4+2]=Ae.baseline+He.caretBottom+te,X[Ee*4+3]=Ae.baseline+He.caretTop+te;let Ke=Ee-xe;Ke>1&&f(X,xe,Ke),xe=Ee}if(F){let{charIndex:Ee}=Ie;for(;Ee>De;)De++,F.hasOwnProperty(De)&&(Ye=F[De])}if(!Ue.isWhitespace&&!Ue.isEmpty){let Ee=ge++,{fontSizeMult:He,src:et,index:Qe}=Ie.fontData,Ke=$[et]||($[et]={});Ke[Xe]||(Ke[Xe]={path:Ue.path,pathBounds:[Ue.xMin,Ue.yMin,Ue.xMax,Ue.yMax]});let xt=Ie.x+me,Xt=Ie.y+Ae.baseline+te;j[Ee*2]=xt,j[Ee*2+1]=Xt;let Lt=xt+Ue.xMin*He,Kt=Xt+Ue.yMin*He,sr=xt+Ue.xMax*He,Gt=Xt+Ue.yMax*He;Lt<H[0]&&(H[0]=Lt),Kt<H[1]&&(H[1]=Kt),sr>H[2]&&(H[2]=sr),Gt>H[3]&&(H[3]=Gt),Ee%N===0&&(Fe={start:Ee,end:Ee,rect:[1/0,1/0,-1/0,-1/0]},ke.push(Fe)),Fe.end++;let tt=Fe.rect;if(Lt<tt[0]&&(tt[0]=Lt),Kt<tt[1]&&(tt[1]=Kt),sr>tt[2]&&(tt[2]=sr),Gt>tt[3]&&(tt[3]=Gt),W[Ee]=Xe,U[Ee]=Qe,F){let lr=Ee*3;le[lr]=Ye>>16&255,le[lr+1]=Ye>>8&255,le[lr+2]=Ye&255}}}}}),X){let Ae=v.length-xe;Ae>1&&f(X,xe,Ae)}}let Re=[];pe.forEach(({index:he,src:ge,unitsPerEm:xe,ascender:De,descender:Fe,lineHeight:Ye,capHeight:Ae,xHeight:Oe})=>{Re[he]={src:ge,unitsPerEm:xe,ascender:De,descender:Fe,lineHeight:Ye,capHeight:Ae,xHeight:Oe}}),D.typesetting=d()-K,y({glyphIds:W,glyphFontIndices:U,glyphPositions:j,glyphData:$,fontData:Re,caretPositions:X,glyphColors:le,chunkedBounds:ke,fontSize:w,topBaseline:te+we[0].baseline,blockBounds:[me,te-oe,me+ye,te],visibleBounds:H,timings:D})})}c(s,"typeset");function l(v,g){s({...v,metricsOnly:!0},b=>{let[A,w,x,T]=b.blockBounds;g({width:x-A,height:T-w})})}c(l,"measure");function u(v){let g=v.match(/^([\d.]+)%$/),b=g?parseFloat(g[1]):NaN;return isNaN(b)?0:b/100}c(u,"parsePercent");function f(v,g,b){let A=v[g*4],w=v[g*4+1],x=v[g*4+2],T=v[g*4+3],M=(w-A)/b;for(let R=0;R<b;R++){let S=(g+R)*4;v[S]=A+M*R,v[S+1]=A+M*(R+1),v[S+2]=x,v[S+3]=T}}c(f,"fillLigatureCaretPositions");function d(){return(self.performance||Date).now()}c(d,"now");function h(){this.data=[]}c(h,"TextLine");let p=["glyphObj","x","y","width","charIndex","fontData"];return h.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/p.length)},glyphAt(v){let g=h.flyweight;return g.data=this.data,g.index=v,g},splitAt(v){let g=new h;return g.data=this.data.splice(v*p.length),g}},h.flyweight=p.reduce((v,g,b,A)=>(Object.defineProperty(v,g,{get(){return this.data[this.index*p.length+b]},set(w){this.data[this.index*p.length+b]=w}}),v),{data:null,index:0}),{typeset:s,measure:l}}c(Rp,"createTypesetter");var Fr=c(()=>(self.performance||Date).now(),"now"),to=Za(),Fu;function Up(t,e,r,o,i,n,a,s,l,u,f=!0){return f?Gp(t,e,r,o,i,n,a,s,l,u).then(null,d=>(Fu||(console.warn("WebGL SDF generation failed, falling back to JS",d),Fu=!0),Nu(t,e,r,o,i,n,a,s,l,u))):Nu(t,e,r,o,i,n,a,s,l,u)}c(Up,"generateSDF");var Qi=[],Lp=5,Qa=0;function Ju(){let t=Fr();for(;Qi.length&&Fr()-t<Lp;)Qi.shift()();Qa=Qi.length?setTimeout(Ju,0):0}c(Ju,"nextChunk");var Gp=c((...t)=>new Promise((e,r)=>{Qi.push(()=>{let o=Fr();try{to.webgl.generateIntoCanvas(...t),e({timing:Fr()-o})}catch(i){r(i)}}),Qa||(Qa=setTimeout(Ju,0))}),"generateSDF_GL"),Fp=4,Bp=2e3,Bu={},Np=0;function Nu(t,e,r,o,i,n,a,s,l,u){let f="TroikaTextSDFGenerator_JS_"+Np++%Fp,d=Bu[f];return d||(d=Bu[f]={workerModule:Ur({name:f,workerId:f,dependencies:[Za,Fr],init(h,p){let v=h().javascript.generate;return function(...g){let b=p();return{textureData:v(...g),timing:p()-b}}},getTransferables(h){return[h.textureData.buffer]}}),requests:0,idleTimer:null}),d.requests++,clearTimeout(d.idleTimer),d.workerModule(t,e,r,o,i,n).then(({textureData:h,timing:p})=>{let v=Fr(),g=new Uint8Array(h.length*4);for(let b=0;b<h.length;b++)g[b*4+u]=h[b];return to.webglUtils.renderImageData(a,g,s,l,t,e,1<<3-u),p+=Fr()-v,--d.requests===0&&(d.idleTimer=setTimeout(()=>{Iu(f)},Bp)),{timing:p}})}c(Nu,"generateSDF_JS_Worker");function jp(t){t._warm||(to.webgl.isSupported(t),t._warm=!0)}c(jp,"warmUpSDFCanvas");var zp=to.webglUtils.resizeWebGLCanvasWithoutClearing,Gr={defaultFontURL:null,unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048,useWorker:!0},Vp=new lt,Wp=!1;function cn(){return(self.performance||Date).now()}c(cn,"now$1");var ju=Object.create(null);function qu(t,e){Wp=!0,t=Zp({},t);let r=cn(),{defaultFontURL:o}=Gr,i=[];if(o&&i.push({label:"default",src:zu(o)}),t.font&&i.push({label:"user",src:zu(t.font)}),t.font=i,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||Gr.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||Gr.unicodeFontsURL,t.colorRanges!=null){let p={};for(let v in t.colorRanges)if(t.colorRanges.hasOwnProperty(v)){let g=t.colorRanges[v];typeof g!="number"&&(g=Vp.set(g).getHex()),p[v]=g}t.colorRanges=p}Object.freeze(t);let{textureWidth:n,sdfExponent:a}=Gr,{sdfGlyphSize:s}=t,l=n/s*4,u=ju[s];if(!u){let p=document.createElement("canvas");p.width=n,p.height=s*256/l,u=ju[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:p,sdfTexture:new Qs(p,void 0,void 0,void 0,Eo,Eo),contextLost:!1,glyphsByFont:new Map},u.sdfTexture.generateMipmaps=!1,Hp(u)}let{sdfTexture:f,sdfCanvas:d}=u;(Gr.useWorker?ec:Xp)(t).then(p=>{let{glyphIds:v,glyphFontIndices:g,fontData:b,glyphPositions:A,fontSize:w,timings:x}=p,T=[],M=new Float32Array(v.length*4),R=0,S=0,O=cn(),V=b.map(E=>{let Y=u.glyphsByFont.get(E.src);return Y||u.glyphsByFont.set(E.src,Y=new Map),Y});v.forEach((E,Y)=>{let B=g[Y],{src:ie,unitsPerEm:ae}=b[B],N=V[B].get(E);if(!N){let{path:I,pathBounds:C}=p.glyphData[ie][E],W=Math.max(C[2]-C[0],C[3]-C[1])/s*(Gr.sdfMargin*s+.5),U=u.glyphCount++,j=[C[0]-W,C[1]-W,C[2]+W,C[3]+W];V[B].set(E,N={path:I,atlasIndex:U,sdfViewBox:j}),T.push(N)}let{sdfViewBox:F}=N,y=A[S++],k=A[S++],D=w/ae;M[R++]=y+F[0]*D,M[R++]=k+F[1]*D,M[R++]=y+F[2]*D,M[R++]=k+F[3]*D,v[Y]=N.atlasIndex}),x.quads=(x.quads||0)+(cn()-O);let L=cn();x.sdf={};let Q=d.height,_=Math.ceil(u.glyphCount/l),G=Math.pow(2,Math.ceil(Math.log2(_*s)));G>Q&&(console.info("Increasing SDF texture size ".concat(Q,"->").concat(G)),zp(d,n,G),f.dispose()),Promise.all(T.map(E=>Qu(E,u,t.gpuAccelerateSDF).then(({timing:Y})=>{x.sdf[E.atlasIndex]=Y}))).then(()=>{T.length&&!u.contextLost&&($u(u),f.needsUpdate=!0),x.sdfTotal=cn()-L,x.total=cn()-r,e(Object.freeze({parameters:t,sdfTexture:f,sdfGlyphSize:s,sdfExponent:a,glyphBounds:M,glyphAtlasIndices:v,glyphColors:p.glyphColors,caretPositions:p.caretPositions,chunkedBounds:p.chunkedBounds,ascender:p.ascender,descender:p.descender,lineHeight:p.lineHeight,capHeight:p.capHeight,xHeight:p.xHeight,topBaseline:p.topBaseline,blockBounds:p.blockBounds,visibleBounds:p.visibleBounds,timings:p.timings}))})}),Promise.resolve().then(()=>{u.contextLost||jp(d)})}c(qu,"getTextRenderInfo");function Qu({path:t,atlasIndex:e,sdfViewBox:r},{sdfGlyphSize:o,sdfCanvas:i,contextLost:n},a){if(n)return Promise.resolve({timing:-1});let{textureWidth:s,sdfExponent:l}=Gr,u=Math.max(r[2]-r[0],r[3]-r[1]),f=Math.floor(e/4),d=f%(s/o)*o,h=Math.floor(f/(s/o))*o,p=e%4;return Up(o,o,t,r,u,l,i,d,h,p,a)}c(Qu,"generateGlyphSDF");function Hp(t){let e=t.sdfCanvas;e.addEventListener("webglcontextlost",r=>{console.log("Context Lost",r),r.preventDefault(),t.contextLost=!0}),e.addEventListener("webglcontextrestored",r=>{console.log("Context Restored",r),t.contextLost=!1;let o=[];t.glyphsByFont.forEach(i=>{i.forEach(n=>{o.push(Qu(n,t,!0))})}),Promise.all(o).then(()=>{$u(t),t.sdfTexture.needsUpdate=!0})})}c(Hp,"initContextLossHandling");function ts({font:t,characters:e,sdfGlyphSize:r},o){let i=Array.isArray(e)?e.join("\n"):""+e;qu({font:t,sdfGlyphSize:r,text:i},o)}c(ts,"preloadFont");function Zp(t,e){for(let r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}c(Zp,"assign");var Ji;function zu(t){return Ji||(Ji=typeof document>"u"?{}:document.createElement("a")),Ji.href=t,Ji.href}c(zu,"toAbsoluteURL");function $u(t){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");let{sdfCanvas:e,sdfTexture:r}=t,{width:o,height:i}=e,n=t.sdfCanvas.getContext("webgl"),a=r.image.data;(!a||a.length!==o*i*4)&&(a=new Uint8Array(o*i*4),r.image={width:o,height:i,data:a},r.flipY=!1,r.isDataTexture=!0),n.readPixels(0,0,o,i,n.RGBA,n.UNSIGNED_BYTE,a)}}c($u,"safariPre15Workaround");var Yp=Ur({name:"Typesetter",dependencies:[Rp,Pp,Pu],init(t,e,r){return t(e,r())}}),ec=Ur({name:"Typesetter",dependencies:[Yp],init(t){return function(e){return new Promise(r=>{t.typeset(e,r)})}},getTransferables(t){let e=[];for(let r in t)t[r]&&t[r].buffer&&e.push(t[r].buffer);return e}}),Xp=ec.onMainThread;var Vu={};function Kp(t){let e=Vu[t];return e||(e=Vu[t]=new Wr(1,1,t,t).translate(.5,.5,0)),e}c(Kp,"getTemplateGeometry");var $i="aTroikaGlyphBounds",Jn="aTroikaGlyphIndex",Jp="aTroikaGlyphColor",ns=class ns extends ll{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new $s,this.boundingBox=new Vr}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let r=Kp(e);["position","normal","uv"].forEach(o=>{this.attributes[o]=r.attributes[o].clone()}),this.setIndex(r.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,r,o,i,n){this.updateAttributeData($i,e,4),this.updateAttributeData(Jn,r,1),this.updateAttributeData(Jp,n,3),this._blockBounds=o,this._chunkedBounds=i,this.instanceCount=r.length,this._updateBounds()}_updateBounds(){let e=this._blockBounds;if(e){let{curveRadius:r,boundingBox:o}=this;if(r){let{PI:i,floor:n,min:a,max:s,sin:l,cos:u}=Math,f=i/2,d=i*2,h=Math.abs(r),p=e[0]/h,v=e[2]/h,g=n((p+f)/d)!==n((v+f)/d)?-h:a(l(p)*h,l(v)*h),b=n((p-f)/d)!==n((v-f)/d)?h:s(l(p)*h,l(v)*h),A=n((p+i)/d)!==n((v+i)/d)?h*2:s(h-u(p)*h,h-u(v)*h);o.min.set(g,e[1],r<0?-A:0),o.max.set(b,e[3],r<0?0:A)}else o.min.set(e[0],e[1],0),o.max.set(e[2],e[3],0);o.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let r=this.getAttribute(Jn).count,o=this._chunkedBounds;if(o)for(let i=o.length;i--;){r=o[i].end;let n=o[i].rect;if(n[1]<e.w&&n[3]>e.y&&n[0]<e.z&&n[2]>e.x)break}this.instanceCount=r}updateAttributeData(e,r,o){let i=this.getAttribute(e);r?i&&i.array.length===r.length?(i.array.set(r),i.needsUpdate=!0):(this.setAttribute(e,new tl(r,o)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}};c(ns,"GlyphsGeometry");var $a=ns,qp="\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform vec4 uTroikaTotalBounds;\nuniform vec4 uTroikaClipRect;\nuniform mat3 uTroikaOrient;\nuniform bool uTroikaUseGlyphColors;\nuniform float uTroikaEdgeOffset;\nuniform float uTroikaBlurRadius;\nuniform vec2 uTroikaPositionOffset;\nuniform float uTroikaCurveRadius;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nattribute vec3 aTroikaGlyphColor;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec3 vTroikaGlyphColor;\nvarying vec2 vTroikaGlyphDimensions;\n",Qp="\nvec4 bounds = aTroikaGlyphBounds;\nbounds.xz += uTroikaPositionOffset.x;\nbounds.yw -= uTroikaPositionOffset.y;\n\nvec4 outlineBounds = vec4(\n bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,\n bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius\n);\nvec4 clippedBounds = vec4(\n clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),\n clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)\n);\n\nvec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);\n\nposition.xy = mix(bounds.xy, bounds.zw, clippedXY);\n\nuv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);\n\nfloat rad = uTroikaCurveRadius;\nif (rad != 0.0) {\n float angle = position.x / rad;\n position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);\n normal.xz = vec2(sin(angle), cos(angle));\n}\n \nposition = uTroikaOrient * position;\nnormal = uTroikaOrient * normal;\n\nvTroikaGlyphUV = clippedXY.xy;\nvTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);\n\n\nfloat txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;\nvec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;\nvec2 txStartUV = txUvPerSquare * vec2(\n mod(floor(aTroikaGlyphIndex / 4.0), txCols),\n floor(floor(aTroikaGlyphIndex / 4.0) / txCols)\n);\nvTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);\nvTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);\n",$p="\nuniform sampler2D uTroikaSDFTexture;\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform float uTroikaSDFExponent;\nuniform float uTroikaEdgeOffset;\nuniform float uTroikaFillOpacity;\nuniform float uTroikaBlurRadius;\nuniform vec3 uTroikaStrokeColor;\nuniform float uTroikaStrokeWidth;\nuniform float uTroikaStrokeOpacity;\nuniform bool uTroikaSDFDebug;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec2 vTroikaGlyphDimensions;\n\nfloat troikaSdfValueToSignedDistance(float alpha) {\n // Inverse of exponential encoding in webgl-sdf-generator\n \n float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);\n float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;\n float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);\n return signedDist;\n}\n\nfloat troikaGlyphUvToSdfValue(vec2 glyphUV) {\n vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);\n vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);\n float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1\n return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;\n}\n\nfloat troikaGlyphUvToDistance(vec2 uv) {\n return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));\n}\n\nfloat troikaGetAADist() {\n \n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;\n #else\n return vTroikaGlyphDimensions.x / 64.0;\n #endif\n}\n\nfloat troikaGetFragDistValue() {\n vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);\n float distance = troikaGlyphUvToDistance(clampedGlyphUV);\n \n // Extrapolate distance when outside bounds:\n distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : \n length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);\n\n \n\n return distance;\n}\n\nfloat troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {\n #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\n float alpha = step(-distanceOffset, -distance);\n #else\n\n float alpha = smoothstep(\n distanceOffset + aaDist,\n distanceOffset - aaDist,\n distance\n );\n #endif\n\n return alpha;\n}\n",em="\nfloat aaDist = troikaGetAADist();\nfloat fragDistance = troikaGetFragDistValue();\nfloat edgeAlpha = uTroikaSDFDebug ?\n troikaGlyphUvToSdfValue(vTroikaGlyphUV) :\n troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));\n\n#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)\nvec4 fillRGBA = gl_FragColor;\nfillRGBA.a *= uTroikaFillOpacity;\nvec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);\nif (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;\ngl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(\n -uTroikaStrokeWidth - aaDist,\n -uTroikaStrokeWidth + aaDist,\n fragDistance\n));\ngl_FragColor.a *= edgeAlpha;\n#endif\n\nif (edgeAlpha == 0.0) {\n discard;\n}\n";function tc(t){let e=un(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new St},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Oo(0,0,0,0)},uTroikaClipRect:{value:new Oo(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new St},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new lt},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new qs},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:qp,vertexTransform:Qp,fragmentDefs:$p,fragmentColorTransform:em,customRewriter({vertexShader:r,fragmentShader:o}){let i=/\buniform\s+vec3\s+diffuse\b/;return i.test(o)&&(o=o.replace(i,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),i.test(r)||(r=r.replace(Xa,"uniform vec3 diffuse;\n$&\nvTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;\n"))),{vertexShader:r,fragmentShader:o}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}c(tc,"createTextDerivedMaterial");var rs=new yi({color:16777215,side:kn,transparent:!0}),Wu=8421504,Hu=new At,qi=new Ne,Ka=new Ne,Kn=[],tm=new Ne,Ja="+x+y";function Zu(t){return Array.isArray(t)?t[0]:t}c(Zu,"first");var rc=c(()=>{let t=new ur(new Wr(1,1),rs);return rc=c(()=>t,"getFlatRaycastMesh"),t},"getFlatRaycastMesh"),nc=c(()=>{let t=new ur(new Wr(1,1,32,1),rs);return nc=c(()=>t,"getCurvedRaycastMesh"),t},"getCurvedRaycastMesh"),rm={type:"syncstart"},nm={type:"synccomplete"},ic=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],im=ic.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail"),is=class is extends ur{constructor(){let e=new $a;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=Wu,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=Ja,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(rm),qu({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},r=>{this._isSyncing=!1,this._textRenderInfo=r,this.geometry.updateGlyphs(r.glyphBounds,r.glyphAtlasIndices,r.blockBounds,r.chunkedBounds,r.glyphColors);let o=this._queuedSyncs;o&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{o.forEach(i=>i&&i())})),this.dispatchEvent(nm),e&&e()})))}onBeforeRender(e,r,o,i,n,a){this.sync(),n.isTroikaTextMaterial&&this._prepareForRender(n)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return tc(e)}get material(){let e=this._derivedMaterial,r=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=rs.clone());if((!e||!e.isDerivedFrom(r))&&(e=this._derivedMaterial=this.createDerivedMaterial(r),r.addEventListener("dispose",c(function o(){r.removeEventListener("dispose",o),e.dispose()},"onDispose"))),this.hasOutline()){let o=e._outlineMtl;return o||(o=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),o.isTextOutlineMaterial=!0,o.depthWrite=!1,o.map=null,e.addEventListener("dispose",c(function i(){e.removeEventListener("dispose",i),o.dispose()},"onDispose"))),[o,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return Zu(this.material).getDepthMaterial()}get customDistanceMaterial(){return Zu(this.material).getDistanceMaterial()}_prepareForRender(e){let r=e.isTextOutlineMaterial,o=e.uniforms,i=this.textRenderInfo;if(i){let{sdfTexture:s,blockBounds:l}=i;o.uTroikaSDFTexture.value=s,o.uTroikaSDFTextureSize.value.set(s.image.width,s.image.height),o.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,o.uTroikaSDFExponent.value=i.sdfExponent,o.uTroikaTotalBounds.value.fromArray(l),o.uTroikaUseGlyphColors.value=!r&&!!i.glyphColors;let u=0,f=0,d=0,h,p,v,g=0,b=0;if(r){let{outlineWidth:w,outlineOffsetX:x,outlineOffsetY:T,outlineBlur:M,outlineOpacity:R}=this;u=this._parsePercent(w)||0,f=Math.max(0,this._parsePercent(M)||0),h=R,g=this._parsePercent(x)||0,b=this._parsePercent(T)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(v=this.strokeColor,o.uTroikaStrokeColor.value.set(v==null?Wu:v),p=this.strokeOpacity,p==null&&(p=1)),h=this.fillOpacity;o.uTroikaEdgeOffset.value=u,o.uTroikaPositionOffset.value.set(g,b),o.uTroikaBlurRadius.value=f,o.uTroikaStrokeWidth.value=d,o.uTroikaStrokeOpacity.value=p,o.uTroikaFillOpacity.value=h==null?1:h,o.uTroikaCurveRadius.value=this.curveRadius||0;let A=this.clipRect;if(A&&Array.isArray(A)&&A.length===4)o.uTroikaClipRect.value.fromArray(A);else{let w=(this.fontSize||.1)*100;o.uTroikaClipRect.value.set(l[0]-w,l[1]-w,l[2]+w,l[3]+w)}this.geometry.applyClipRect(o.uTroikaClipRect.value)}o.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;let n=r?this.outlineColor||0:this.color;if(n==null)delete e.color;else{let s=e.hasOwnProperty("color")?e.color:e.color=new lt;(n!==s._input||typeof n=="object")&&s.set(s._input=n)}let a=this.orientation||Ja;if(a!==e._orientation){let s=o.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let l=a!==Ja&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,u,f,d,h]=l;qi.set(0,0,0)[f]=u==="-"?1:-1,Ka.set(0,0,0)[h]=d==="-"?-1:1,Hu.lookAt(tm,qi.cross(Ka),Ka),s.setFromMatrix4(Hu)}else s.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let r=e.match(/^(-?[\d.]+)%$/),o=r?parseFloat(r[1]):NaN;e=(isNaN(o)?0:o/100)*this.fontSize}return e}localPositionToTextCoords(e,r=new St){r.copy(e);let o=this.curveRadius;return o&&(r.x=Math.atan2(e.x,Math.abs(o)-Math.abs(e.z))*Math.abs(o)),r}worldPositionToTextCoords(e,r=new St){return qi.copy(e),this.localPositionToTextCoords(this.worldToLocal(qi),r)}raycast(e,r){let{textRenderInfo:o,curveRadius:i}=this;if(o){let n=o.blockBounds,a=i?nc():rc(),s=a.geometry,{position:l,uv:u}=s.attributes;for(let f=0;f<u.count;f++){let d=n[0]+u.getX(f)*(n[2]-n[0]),h=n[1]+u.getY(f)*(n[3]-n[1]),p=0;i&&(p=i-Math.cos(d/i)*i,d=Math.sin(d/i)*i),l.setXYZ(f,d,h,p)}s.boundingSphere=this.geometry.boundingSphere,s.boundingBox=this.geometry.boundingBox,a.matrixWorld=this.matrixWorld,a.material.side=this.material.side,Kn.length=0,a.raycast(e,Kn);for(let f=0;f<Kn.length;f++)Kn[f].object=this,r.push(Kn[f])}}copy(e){let r=this.geometry;return super.copy(e),this.geometry=r,im.forEach(o=>{this[o]=e[o]}),this}clone(){return new this.constructor().copy(this)}};c(is,"Text");var dn=is;ic.forEach(t=>{let e="_private_"+t;Object.defineProperty(dn.prototype,t,{get(){return this[e]},set(r){r!==this[e]&&(this[e]=r,this._needsSync=!0)}})});var om={type:"syncstart"},am={type:"synccomplete"},fn="aTroikaTextBatchMemberIndex",es=32,Yu=new Vr,Xu=new lt,eo=class eo extends dn{constructor(){super(),this._members=new Map,this._dataTextures={},this._onMemberSynced=e=>{this._members.get(e.target).dirty=!0}}add(...e){for(let r=0;r<e.length;r++)e[r]instanceof dn?this.addText(e[r]):super.add(e[r]);return this}remove(...e){for(let r=0;r<e.length;r++)e[r]instanceof dn?this.removeText(e[r]):super.remove(e[r]);return this}addText(e){this._members.has(e)||(this._members.set(e,{index:-1,glyphCount:-1,dirty:!0}),e.addEventListener("synccomplete",this._onMemberSynced))}removeText(e){this._needsRepack=!0,e.removeEventListener("synccomplete",this._onMemberSynced),this._members.delete(e)}createDerivedMaterial(e){return sm(e)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateBounds()}updateBounds(){let e=this.geometry.boundingBox.makeEmpty();this._members.forEach((r,o)=>{o.matrixAutoUpdate&&o.updateMatrix(),Yu.copy(o.geometry.boundingBox).applyMatrix4(o.matrix),e.union(Yu)}),e.getBoundingSphere(this.geometry.boundingSphere)}hasOutline(){for(let e of this._members.keys())if(e.hasOutline())return!0;return!1}_prepareForRender(e){let r=e.isTextOutlineMaterial;e.uniforms.uTroikaIsOutline.value=r;let o=this._dataTextures[r?"outline":"main"],i=Math.pow(2,Math.ceil(Math.log2(this._members.size*es)));if(!o||i!==o.image.data.length){o&&o.dispose();let s=Math.min(i/4,1024);o=this._dataTextures[r?"outline":"main"]=new bi(new Float32Array(i),s,i/4/s,vi,gi)}let n=o.image.data,a=c((s,l)=>{l!==n[s]&&(n[s]=l,o.needsUpdate=!0)},"setTexData");this._members.forEach(({index:s,dirty:l},u)=>{if(s>-1){let f=s*es,d=u.matrix.elements;for(let S=0;S<16;S++)a(f+S,d[S]);u._prepareForRender(e);let{uTroikaTotalBounds:h,uTroikaClipRect:p,uTroikaPositionOffset:v,uTroikaEdgeOffset:g,uTroikaBlurRadius:b,uTroikaStrokeWidth:A,uTroikaStrokeColor:w,uTroikaStrokeOpacity:x,uTroikaFillOpacity:T,uTroikaCurveRadius:M}=e.uniforms;for(let S=0;S<4;S++)a(f+16+S,h.value.getComponent(S));for(let S=0;S<4;S++)a(f+20+S,p.value.getComponent(S));let R=r?u.outlineColor||0:u.color;R==null&&(R=this.color),R==null&&(R=this.material.color),R==null&&(R=16777215),a(f+24,Xu.set(R).getHex()),a(f+25,T.value),a(f+26,M.value),r?(a(f+28,v.value.x),a(f+29,v.value.y),a(f+30,g.value),a(f+31,b.value)):(a(f+28,A.value),a(f+29,Xu.set(w.value).getHex()),a(f+30,x.value))}}),e.setMatrixTexture(o),super._prepareForRender(e)}sync(e){let r=this._needsRepack?[]:null;this._needsRepack=!1,this._members.forEach((o,i)=>{(o.dirty||i._needsSync)&&(o.dirty=!1,(r||(r=[])).push(new Promise(n=>{i._needsSync?i.sync(n):n()})))}),r&&(this.dispatchEvent(om),Promise.all(r).then(()=>{let{geometry:o}=this,i=o.attributes,n=i[fn]&&i[fn].array||new Uint16Array(0),a=i[Jn]&&i[Jn].array||new Float32Array(0),s=i[$i]&&i[$i].array||new Float32Array(0),l=0;this._members.forEach((d,{textRenderInfo:h})=>{h&&(l+=h.glyphAtlasIndices.length,this._textRenderInfo=h)}),l!==n.length&&(n=qa(n,l),a=qa(a,l),s=qa(s,l*4));let u=0,f=0;this._members.forEach((d,{textRenderInfo:h})=>{if(h){let p=h.glyphAtlasIndices.length;n.fill(u,f,f+p),a.set(h.glyphAtlasIndices,f,f+p),s.set(h.glyphBounds,f*4,(f+p)*4),f+=p,d.index=u++}}),o.updateAttributeData(fn,n,1),o.getAttribute(fn).setUsage(Js),o.updateAttributeData(Jn,a,1),o.updateAttributeData($i,s,4),this.updateBounds(),this.dispatchEvent(am),e&&e()}))}copy(e){return e instanceof eo&&(super.copy(e),this._members.forEach((r,o)=>this.removeText(o)),e._members.forEach((r,o)=>this.addText(o))),this}dispose(){super.dispose(),Object.values(this._dataTextures).forEach(e=>e.dispose())}};c(eo,"BatchedText");var Ku=eo;function qa(t,e){let r=new t.constructor(e);return r.set(t.subarray(0,e)),r}c(qa,"cloneAndResize");function sm(t){let e="uTroikaMatricesTexture",r="uTroikaMatricesTextureSize",o=un(t,{chained:!0,uniforms:{[r]:{value:new St},[e]:{value:null}},vertexDefs:"\n uniform highp sampler2D ".concat(e,";\n uniform vec2 ").concat(r,";\n attribute float ").concat(fn,";\n\n vec4 troikaBatchTexel(float offset) {\n offset += ").concat(fn," * ").concat(es.toFixed(1)," / 4.0;\n float w = ").concat(r,".x;\n vec2 uv = (vec2(mod(offset, w), floor(offset / w)) + 0.5) / ").concat(r,";\n return texture2D(").concat(e,", uv);\n }\n "),vertexTransform:"\n mat4 matrix = mat4(\n troikaBatchTexel(0.0),\n troikaBatchTexel(1.0),\n troikaBatchTexel(2.0),\n troikaBatchTexel(3.0)\n );\n position.xyz = (matrix * vec4(position, 1.0)).xyz;\n "});return o=tc(o),o=un(o,{chained:!0,uniforms:{uTroikaIsOutline:{value:!1}},customRewriter(i){return["uTroikaTotalBounds","uTroikaClipRect","uTroikaPositionOffset","uTroikaEdgeOffset","uTroikaBlurRadius","uTroikaStrokeWidth","uTroikaStrokeColor","uTroikaStrokeOpacity","uTroikaFillOpacity","uTroikaCurveRadius","diffuse"].forEach(a=>{i=lm(i,a)}),i},vertexDefs:"\n uniform bool uTroikaIsOutline;\n vec3 troikaFloatToColor(float v) {\n return mod(floor(vec3(v / 65536.0, v / 256.0, v)), 256.0) / 256.0;\n }\n ",vertexTransform:"\n uTroikaTotalBounds = troikaBatchTexel(4.0);\n uTroikaClipRect = troikaBatchTexel(5.0);\n \n vec4 data = troikaBatchTexel(6.0);\n diffuse = troikaFloatToColor(data.x);\n uTroikaFillOpacity = data.y;\n uTroikaCurveRadius = data.z;\n \n data = troikaBatchTexel(7.0);\n if (uTroikaIsOutline) {\n if (data == vec4(0.0)) { // degenerate if zero outline\n position = vec3(0.0);\n } else {\n uTroikaPositionOffset = data.xy;\n uTroikaEdgeOffset = data.z;\n uTroikaBlurRadius = data.w;\n }\n } else {\n uTroikaStrokeWidth = data.x;\n uTroikaStrokeColor = troikaFloatToColor(data.y);\n uTroikaStrokeOpacity = data.z;\n }\n "}),o.setMatrixTexture=i=>{o.uniforms[e].value=i,o.uniforms[r].value.set(i.image.width,i.image.height)},o}c(sm,"createBatchedTextMaterial");function lm({vertexShader:t,fragmentShader:e},r,o=r){let i=new RegExp("uniform\\s+(bool|float|vec[234]|mat[34])\\s+".concat(r,"\\b")),n,a=!1;e=e.replace(i,(l,u)=>(a=!0,"varying ".concat(n=u," ").concat(o)));let s=!1;return t=t.replace(i,(l,u)=>(s=!0,"".concat(a?"varying":""," ").concat(n=u," ").concat(o))),s||(t="".concat(a?"varying":""," ").concat(n," ").concat(o,";\n").concat(t)),{vertexShader:t,fragmentShader:e}}c(lm,"uniformToVarying");var oc="abcdefghijklmnopqrstuvwxyz";function Wy(t){return new Promise((e,r)=>{t?typeof t=="string"?ts({font:t,characters:oc},()=>{e(t)}):r(new Error("bad fontUrl ".concat(t))):import("./roboto-regular-E5TUWU5Q.js").then(o=>{ts({font:o.default,characters:oc},()=>{e(o.default)})})})}c(Wy,"preloadFont");var os=.1,um=new Ne;function Hy(t,e,r,o){return e<=0||r<=0?Promise.reject("incoorect dimension [".concat(e,", ").concat(r,"]")):new Promise((i,n)=>{t.sync(a);function a(){if(!t.geometry.boundingBox)return;let{x:s,y:l}=t.geometry.boundingBox.getSize(um);if(l>r||s>e){if(t.fontSize===os)return n("cannot find suitable font size for ".concat(t.text,". MaxSize: [").concat(e,", ").concat(r,"], Current size: [").concat(s,", ").concat(l,"]. min font size").concat(os,"."));t.fontSize=Math.max(os,t.fontSize-o),t.sync(a)}else return i({size:[s,l]})}c(a,"syncCallback")})}c(Hy,"fitTextToArea");function ac(t){return new Promise(e=>{t.sync(()=>{e()})})}c(ac,"syncText");var us=class us extends Mn{constructor(r,o){super();m(this,"rendererState");m(this,"convertTo3DMapPosition");m(this,"textSet",new Set);m(this,"batchedTextMap",new Map);m(this,"debugTextAreaMesh",new Map);this.rendererState=r,this.convertTo3DMapPosition=o}remove(r){this.textSet.delete(r)}update(r){var s,l,u;let o,i,n,a=[];for(let f of this.rendererState.geometry3DIdsInScene)if(o=this.rendererState.geometry3DMap.get(f),(o==null?void 0:o.type)==="text3d"){i=o.components[0],n=o.components[1];let d=(s=i.mesh)==null?void 0:s.parent;if(!d||!(d instanceof vt)||!(i instanceof io))continue;if("textArea"in i.feature.properties&&i.mesh!=null&&i.polygonEntityId!=null&&i.textMesh==null&&i.mesh.parent!=null&&((u=(l=i.feature.properties)==null?void 0:l.textArea)==null?void 0:u.position)!=null){if(this.textSet.has(i.polygonEntityId))continue;this.textSet.add(i.polygonEntityId),this.batchedTextMap.has(d)||this.batchedTextMap.set(d,ro().then(({BatchedText:v})=>{let g=new v;return g.type="batchedtext",d.add(g),g}));let p=this.batchedTextMap.get(d);if(!p)throw new Error("batched text required");a.push(lc({entityId:f,textComponent:i,styleComponent:n,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:p,rendererState:this.rendererState,type:"text-area"}).then(()=>{this.publish("render")}))}else if(i.mesh!=null&&i.textMesh==null&&i.mesh.parent!=null){if(this.textSet.has(f.toString()))continue;this.textSet.add(f.toString()),this.batchedTextMap.has(d)||this.batchedTextMap.set(d,ro().then(({BatchedText:v})=>{let g=new v;return g.type="batchedtext",d.add(g),g}));let p=this.batchedTextMap.get(d);if(!p)throw new Error("batched text required");a.push(lc({entityId:f,textComponent:i,styleComponent:n,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:p,rendererState:this.rendererState,type:"point"}).then(()=>{this.publish("render")}))}let h=this.batchedTextMap.get(d);i.textMesh&&h&&i.polygonEntityId!=null&&Promise.all([h,Promise.resolve({meshComponent:i,styleComponent:n})]).then(([p,{meshComponent:v,styleComponent:g}])=>{let{textMesh:b}=v;if(p&&b){let A=ls(p,b);v.visible&&!A?p.add(b):!v.visible&&A&&p.remove(b)}g.flipToFaceCamera&&this.flipIfNeeded(v,r)})}return Promise.all(a)}flipIfNeeded(r,o){let i=r.textMesh;if(!i)return!1;let n=i.rotation.z,a=Vi(n+o);a>Math.PI/2&&a<3*Math.PI/2&&(i.rotation.z=Vi(n+Math.PI))}showTextAreaMesh(){let r,o;for(let i of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(i),(r==null?void 0:r.type)==="text3d"&&(o=r.components[0],"textArea"in o.feature.properties)){let n=o.feature.properties.textArea;if(!n)continue;let a=new Wr(n.maxWidth,n.maxHeight),s=new ur(a,new yi({color:"pink"})),{textMesh:l}=o;if(!l)continue;let u=this.convertTo3DMapPosition(n.position,qn);s.position.copy(u),s.position.z=l.position.z-.1,s.rotation.z=l.rotation.z,as.identity(),as.makeRotationAxis(new Ne(0,0,1),l.userData.rotationZ),qn.set(n.maxWidth/2,0,0),qn.applyMatrix4(as),s.position.x-=qn.x,s.position.y-=qn.y,this.rendererState.entityScene.add(s),this.debugTextAreaMesh.set(i,s)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(r=>{this.rendererState.entityScene.remove(r)}),this.debugTextAreaMesh.clear(),this.publish("render")}};c(us,"Text3DSystem");var sc=us,as=new At,qn=new Ne,ss;async function rb(t){let{preloadFont:e}=await ro();return e(t)}c(rb,"preloadFont");function ro(){return ss||(ss=import("./text3d-CTCEJGTL.js").then(t=>t)),ss}c(ro,"getText3DService");async function lc({entityId:t,textComponent:e,styleComponent:r,convertTo3DMapPosition:o,batchedMeshPromise:i,rendererState:n,type:a="text-area"}){return Promise.all([ro(),Promise.resolve({entityId:t,meshComponent:e,styleComponent:r})]).then(([{createTroikaTextPoint:s,createTroikaTextArea:l},u])=>a==="text-area"?l(u.entityId,u.meshComponent,u.styleComponent,o):s(u.entityId,u.meshComponent,u.styleComponent,o)).catch(s=>{Ft.warn("Trouble creating text: ",s)}).then(s=>{if(!(s!=null&&s.text))return;let l=[Promise.resolve(s.text),i,Promise.resolve()];if(e.polygonEntityId){let u=n.geometry3DMap.get(e.polygonEntityId);if((u==null?void 0:u.type)==="geometry"){let f=u.components[0],d=u.components[1];f.textMesh=s.text,f.mesh!=null&&(s.text.position.z=d.altitude+d.height+cm)}}else l[2]=ac(s.text);return Promise.all(l)}).then(s=>{if(!s)return;let[l,u]=s;u.add(l),e.batchedText||(e.batchedText=u)})}c(lc,"createText");function ls(t,e){return t._members.has(e)}c(ls,"doesBatchedTextContainsText");var cm=.5;var fm=J.object({visible:J.boolean(),color:J.string(),flipToFaceCamera:J.boolean(),font:J.string().optional(),fontSize:J.number(),margin:J.union([J.number(),J.tuple([J.number(),J.number(),J.number(),J.number()])]),outlineColor:J.string(),outlineOpacity:J.number(),outlineBlur:J.union([J.number(),J.string()]),outlineWidth:J.number(),outlineOffsetX:J.number(),outlineOffsetY:J.number(),strokeWidth:J.number(),maxWidth:J.number().optional(),maxHeight:J.number().optional(),strokeOpacity:J.number(),strokeColor:J.string(),fillOpacity:J.number(),hoverColor:J.string().optional(),id:J.union([J.string(),J.number()]),type:J.literal("text3d"),position:J.tuple([J.number(),J.number(),J.number()]),content:J.string()}),uc=fm.partial().omit({id:!0,type:!0}).strict(),cc=uc.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0}).strict(),ub=J.object({appearance:uc.optional(),parentId:J.string().optional()}).strict(),cs=class cs{constructor(e){m(this,"mesh",new Rr);m(this,"textMesh");m(this,"type","text3d");m(this,"feature");m(this,"parent");m(this,"batchedText");m(this,"polygonEntityId");this.feature=e}get visible(){return this.batchedText&&this.textMesh?ls(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}};c(cs,"Text3DComponent");var io=cs;function Qn(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 Zt&&t.components[1]===void 0?(t.components[1]=new an,t.components[1].dirty=!0):t instanceof Ut&&t.components[2]===void 0?(t.components[2]=new an,t.components[2].dirty=!0):t instanceof vt&&t.components[1]===void 0&&(t.components[1]=new an,t.components[1].dirty=!0),!0):(t instanceof Zt?t.components[1]=void 0:t instanceof Ut?t.components[2]=void 0:t instanceof vt&&(t.components[1]=void 0),!0);if(t.type==="geometry-group"){let o;for(let i of t.userData.entities3D.values())o=r.geometry3DMap.get(i),Qn(o,e,r);return!0}}return!1}c(Qn,"updateInteractivity");function Mb(t,e,r){if(!(!(r!=null&&r.color)&&!("topColor"in r))){if(r!==void 0&&t.type==="geometry-group"&&t.components[0]!=null){let o,i,n=t.components[0];for(let a of t.userData.entities3D.values())o=e.geometry3DMap.get(a),o&&(i=o.components[1],i.color===n.color&&(i.initialColor=r.color||n.color,i.color=r.color||n.color,i.dirty=!0),i.topColor===n.topColor&&(i.topColor=r.topColor||n.topColor,i.dirty=!0));return r.color!==void 0&&(n.color=r.color,n.dirty=!0),"topColor"in r&&(n.topColor=r.topColor,n.dirty=!0),!0}return!1}}c(Mb,"updateGroupColor");function Cb(t,e){if(e!==void 0&&t.type==="geometry-group"&&t.components[0]!=null){let r=t.components[0];return r.shading=r.shading||{},r.shading&&(e.start!==r.shading.start||e.end!==r.shading.end||e.intensity!==r.shading.intensity)&&(Object.assign(r.shading,e),t.userData.shadingDirty=!0),!0}return!1}c(Cb,"updateGroupShading");function Db(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))}c(Db,"updateImageProps");function Eb(t,e,r){var o;if(r!==void 0){if(t.type==="geometry"){let i=t.components[1];if(i.height!==r)return i.height=r,i.dirty=!0,((o=t.parentObject3D)==null?void 0:o.type)==="geometry-group"&&(t.parentObject3D.userData.outlineDirty=!0),!0}else if(t.type==="geometry-group"){let i=t.components[0];for(let n of t.userData.entities3D.values()){let a=e.geometry3DMap.get(n),s;((a==null?void 0:a.type)==="geometry"||(a==null?void 0:a.type)==="model")&&(s=a.components[1],s.height===i.height&&(a.components[1].height=r,a.components[1].dirty=!0))}return t.components[0].height=r,t.userData.outlineDirty=!0,!0}}return!1}c(Eb,"updateHeight");function hm(t,e){e!==void 0&&(t.type==="path"||t.type==="geometry")&&(e.initialColor!==void 0&&(t.components[1].initialColor=e.initialColor),e.color!==void 0&&(t.components[1].color=e.color),"topColor"in e&&(t.components[1].topColor=e.topColor),t.components[1].dirty=!0)}c(hm,"updateColor");function Ab(t,e,r){e!==void 0&&(t.type==="label"||t.type==="marker"?(t.object3d.position.copy(r(e[1],e[0],e[2]||0)),t.positionDirty=!0):t.type==="custom-geometry"&&t.components[0].position.copy(r(e[1],e[0],e[2]||0)))}c(Ab,"updatePosition");function Ob(t,e){var r;return e!==void 0&&(t.type==="marker"||t.type==="label"||t.type==="custom-geometry")&&t.parentObject3D!==e&&t.parentObject3D instanceof vt?((r=t.parentObject3D)==null||r.removeEntity(t),e.addEntity(t),!0):!1}c(Ob,"updateParent");function Ib(t,e){e!==void 0&&(t.type==="marker"||t.type==="label")&&t.components[0].enabled!==e&&(t.components[0].enabled=e)}c(Ib,"updateEnabled");function Pb(t,e,r){if(e!==void 0&&t.type==="marker"){let o=t.components[0];if(e.contentHTML!==void 0)return o.containerEl.innerHTML=e.contentHTML,!0;if(e.anchor!==void 0&&(o.options.anchor=e.anchor,o.collisionDirty=!0),e.dynamicResize!==void 0)return o.options.dynamicResize=e.dynamicResize,!0;if(e.options!=null){try{Ba.parse(e.options||{})}catch(i){return Ft.error(i),!1}return e.options.interactive!=null&&(e.options.interactive==="pointer-events-auto"?(o.pointerEvents="auto",Qn(t,!1,r)):(o.pointerEvents="none",Qn(t,e.options.interactive,r))),fc(t,e.options.rank),!0}}return!1}c(Pb,"updateMarker");function fc(t,e){return e!==void 0&&(t.type==="marker"||t.type==="label")?(t.components[0].rank=sn(e),!0):!1}c(fc,"updateRank");function Rb(t,e,r){var o,i,n,a,s;if(e!==void 0&&t.type==="label"){let l=t.components[0];e.text!==void 0&&(l.text=e.text,l.dirty=!0);try{Fa.parse(e.options||{})}catch(u){Ft.error(u);return}((o=e.options)==null?void 0:o.appearance)!==void 0&&Object.keys((i=e.options)==null?void 0:i.appearance).length>0&&(ds(l.appearance,((n=e.options)==null?void 0:n.appearance)||{}),l.dirty=!0),Qn(t,(a=e.options)==null?void 0:a.interactive,r),fc(t,(s=e.options)==null?void 0:s.rank)}}c(Rb,"updateLabel");function Ub(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].hoverColor=e,t.components[1].dirty=!0)}c(Ub,"updateHoverColor");function Lb(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}c(Lb,"updateHovered");function Gb(t,e){e!==void 0&&t.type==="image"&&(t.components[1].flipImageToFaceCamera=e)}c(Gb,"updateFlipImageToFaceCamera");function dc(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"){t.components[1].visible=r,t.components[1].dirty=!0;let o=t.parentObject3D;o instanceof gt&&(o.userData.outlineDirty=!0)}else t.type==="geometry-group"?t.setVisible(r):t.type==="group-container"?(t.setVisible(r),r===!1&&t.traverse(o=>{if(o instanceof ar){let i=e.geometry2DMap.get(o.userData.entityId);if(i){let n=i.components[0];n instanceof Du&&(n.canShow=r)}}})):t.type==="label"&&(t.components[0].visible=r);return!0}return!1}c(dc,"updateVisibility");function Fb(t,e,r){if(r!==void 0){if(t.type==="geometry-group"){let o=t.components[0];if(o.opacity!==r){for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i),a;((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&(a=n.components[1],(!a.opacity||a.opacity===o.opacity)&&(a.opacity=r,a.dirty=!0))}return t.setOpacity(r),o.opacity=r,t.userData.outlineDirty=!0,!0}}else if(t.type==="group-container"&&t.opacity!==r){t.setOpacity(r);let o=1;return t.parent instanceof vt&&(o=t.parent.opacity),hc(t,e,o),!0}}return!1}c(Fb,"updateOpacity");function hc(t,e,r=1){if(t.type==="group-container"&&"children"in t&&t.children.length>0){let o=r*t.opacity;t.userData.computedOpacity=o;for(let i of t.children)(i instanceof gt&&i.type==="geometry-group"||i instanceof vt&&i.type==="group-container")&&hc(i,e,o)}else if(t.type==="geometry-group"){for(let o of t.userData.entities3D.values()){let i=e.geometry3DMap.get(o),n;((i==null?void 0:i.type)==="geometry"||(i==null?void 0:i.type)==="model")&&(n=i.components[1],n.dirty=!0)}t.userData.outlineDirty=!0}}c(hc,"cascadeOpacity");function Bb(t,e){if(e!==void 0&&t.type==="geometry-group"){let r=t.components[0];(e==null?void 0:e.texture)!=null&&r.texture!==(e==null?void 0:e.texture)&&(r.texture=e.texture,r.dirty=!0),(e==null?void 0:e.topTexture)!=null&&r.topTexture!==(e==null?void 0:e.topTexture)&&(r.topTexture=e.topTexture,r.dirty=!0)}}c(Bb,"updateGroupTexture");function Nb(t,e){if(t.type==="geometry"){let r=!1,o=t.components[1];if((e==null?void 0:e.texture)!=null&&o.texture!==(e==null?void 0:e.texture)&&(o.texture=e.texture,r=!0),(e==null?void 0:e.topTexture)!=null&&o.topTexture!==(e==null?void 0:e.topTexture)&&(o.topTexture=e.topTexture,r=!0),r&&t.components[0]instanceof Rt){let i=t.components[0];return i.detached===!1&&(i.detached=!0,i.dirty=!0),!0}}return!1}c(Nb,"updateIndividualGeometryTexture");function jb(t,e){if(e!==void 0&&t.type==="geometry"){let r=t.components[1];if(r.opacity!==e){r.opacity=e;let o=t.components[0];o.detached===!1&&(o.detached=!0,o.dirty=!0),e===0?r.visible=!1:r.visible=!0,r.dirty=!0;let i=t.parentObject3D;return(i==null?void 0:i.type)==="geometry-group"&&(i.userData.outlineDirty=!0,i.userData.shadingDirty=!0),!0}}return!1}c(jb,"updateIndividualGeometryOpacity");function zb(t,e){if(e!==void 0){if(t.type==="path"||t.type==="geometry"||t.type==="custom-geometry")t.components[1].altitude=e,t.components[1].dirty=!0;else if(t.type==="group-container"&&t.altitude!==e)return t.setAltitude(e),!0}return!1}c(zb,"updateAltitude");function Vb(t,e){if(e!==void 0){if(t.type==="geometry-group"&&t.components[0]!=null)t.components[0].outline=e,t.userData.outlineDirty=!0;else if(t.type==="geometry"){t.components[1].outline=e,t.components[1].dirty=!0;let r=t.parentObject3D;r instanceof gt&&(r.userData.outlineDirty=!0)}return!0}return!1}c(Vb,"updateOutline");function Wb(t,e){return e!==void 0&&t.type==="geometry"&&t.components[0]&&t.components[0]instanceof Rt?(t.components[0].focusable=e,!0):!1}c(Wb,"updateFocusable");function Hb(t,e){if(e!==void 0&&t.type==="geometry"){let r=t.components[1];if(r.renderOrder!==e){r.renderOrder=e;let o=t.components[0];return o.detached===!1&&(o.detached=!0,o.dirty=!0),o.imageMesh&&(o.imageMesh.renderOrder=e+1),r.dirty=!0,!0}}return!1}c(Hb,"updateIndividualGeometryRenderOrder");function Zb(t,e,r){let{visible:o,color:i}=r;if(t.type!=="path")return;let n=t.components[0];o!=null&&dc(t,e,o),i!=null&&hm(t,{color:i}),Object.assign(n,pm(r)),fs(r)||(n.materialDirty=!0,(r.nearRadius!=null||r.farRadius!=null)&&(n.dirty=!0),(r.nearZoomLevel!=null||r.farZoomLevel!=null)&&(n.dirty=!0))}c(Zb,"handlePathUpdate");function pm(t){return $n(t,mm)}c(pm,"pickPathOptions");var mm=["animateArrowsOnPath","displayArrowsOnPath","nearRadius","farRadius","accentColor","completeFraction","nearZoomLevel","farZoomLevel"];function Yb(t){if(!(t instanceof Ut&&t.type==="text3d"))throw new Error("expect target is TextGeometry3D")}c(Yb,"assetGeometryIsText3D");var gm=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function Xb(t,e,r){dc(t,e,r.visible);let o=t.components[1],i=$n(r,gm);"margin"in r&&Ft.warn("update to margin is not supported atm"),"content"in r&&Ft.warn("content update is not supported atm");try{cc.parse(i)}catch(n){Ft.error(n);return}Object.keys(i).length>0&&(Object.assign(o,i),o.dirty=!0)}c(Xb,"handleText3DUpdate");var vm=["color","material","opacity","verticalOffset","rotation","position","scale"];function Kb(t,e){let r=$n(e,vm),o=t.components[1],i=t.components[0];Object.keys(r).length>0&&(r.material&&(o.material=r.material),r.opacity!=null&&(o.opacity=r.opacity,r.opacity===0?o.visible=!1:o.visible=!0,o.dirty=!0),r.verticalOffset!=null&&(o.verticalOffset=r.verticalOffset),r.color!=null&&(o.color=r.color),r.position!=null&&(i.feature.geometry.coordinates=r.position,i.positionDirty=!0),r.rotation!=null&&(o.rotation=r.rotation),r.scale!=null&&(o.scale=r.scale),o.dirty=!0)}c(Kb,"handleModelStyleUpdate");P();P();P();P();var hs=class hs extends bi{constructor(r){let o=r,i=3,n=i*4;super(new Float32Array(r*n),i,r,vi,gi);m(this,"_width");m(this,"_height");m(this,"_propertiesLength");this._width=n,this._height=o,this._propertiesLength=i}setColor(r,o,i){let n=this.image.data,a=r*this._width;n[a]=o.r,n[a+1]=o.g,n[a+2]=o.b,n[a+3]=0,n[a+4]=i.r,n[a+5]=i.g,n[a+6]=i.b,n[a+7]=0,this.needsUpdate=!0}getColor(r){let o=this.image.data,i=r*this._width,n=new lt(o[i],o[i+1],o[i+2]),a=new lt(o[i+4],o[i+5],o[i+6]);return{color:n,topColor:a}}setTexture(r,o,i){let n=this.image.data,a=r*this._width;n[a+8]=o?1:0,n[a+9]=i?1:0,n[a+10]=0,n[a+11]=0,this.needsUpdate=!0}};c(hs,"BatchedPropertiesTexture");var oo=hs;var pc="#define LAMBERT\nvarying vec3 vViewPosition;\nvarying vec4 vPosition;\nvarying vec2 vUv;\nvarying vec4 finalPosition;\nvarying vec3 vWorldPosition;\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 vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;\n}\n";var mc="#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 vec3 vWorldPosition;\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(vWorldPosition.z) - 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 _m=-.05,Tm=1,ps=class ps extends ol{constructor(r,o,i=1){super(r);m(this,"propertiesTexture");m(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:null},uTexture:{value:null},uRepeatYFactor:{value:1},uBlendTexture:{value:!1}});m(this,"colorSpace",Ao);m(this,"showTextures",c(r=>{let o=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(o||i)&&(this.propertiesTexture.setTexture(r,o,i),this.needsUpdate=!0)},"showTextures"));this.propertiesTexture=new oo(o),this.uniforms.uRepeatYFactor.value=i,this.onBeforeCompile=n=>{let a=this.uniforms.uGradientIntensity,s=this.uniforms.uGradientEnd,l=this.uniforms.uGradientStart,u=this.uniforms.uTopTexture,f=this.uniforms.uTexture,d=this.uniforms.uRepeatYFactor,h=this.uniforms.uBlendTexture;this.uniforms=n.uniforms,n.vertexShader=pc,n.fragmentShader=mc,Object.assign(this.uniforms,{uGradientIntensity:a,uGradientEnd:s,uGradientStart:l,uMinSideAlpha:{value:_m},uMaxSideAlpha:{value:Tm},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:u,uTexture:f,uRepeatYFactor:d,uBlendTexture:h})}}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=wn,r.wrapT=wn,r.colorSpace=this.colorSpace,this.uniforms.uTexture.value=r}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(r){r.wrapS=wn,r.wrapT=wn,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?Ks:Ao,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(r,o,i){this.uniforms.uGradientStart.value=r,this.uniforms.uGradientEnd.value=o,this.uniforms.uGradientIntensity.value=i}setColor(r,o,i){this.propertiesTexture.setColor(r,o,i)}getColor(r){return this.propertiesTexture.getColor(r)}hideTextures(r){let o=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(o||i)&&(this.propertiesTexture.setTexture(r,!1,!1),this.needsUpdate=!0)}removeSideTexture(r){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let o=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(r,!1,o),this.needsUpdate=!0}}removeTopTexture(r){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let o=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(r,o,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}};c(ps,"BatchedStandardMaterial");var ei=ps;P();var x0={top:0,bottom:0,left:0,right:0,type:"pixel"},gc="mappedin";var _0=250;var km=80;function I0(t,e){var s,l,u;let r=0;for(let f of t)r+=((l=(s=f.components[0])==null?void 0:s.geometry)==null?void 0:l.attributes.position.count)||0;let o=new lt(e.color),i;i=new ei({color:o,side:e.side==="back"?Ys:e.side==="front"?Zs:kn,opacity:(u=e.opacity)!=null?u:1,transparent:e.opacity!==void 0?e.opacity<1:!1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},t.length);let n=new ir(t.length,r,0,i),a;for(let f of t)a=f.components[0],!(!(a instanceof Rt)||!a.geometry)&&(a.mesh=n,a.material=i,a.instanceIndex=n.addGeometry(a.geometry),n.addInstance(a.instanceIndex),n.userData.entities[a.instanceIndex]=f.id,i instanceof ei&&i.setColor(a.instanceIndex,o,e.topColor?new lt(e.topColor):o));return n.perObjectFrustumCulled=!0,n.matrixAutoUpdate=!1,n}c(I0,"batchGeometries");function ms(t,e){let r=new il(t,km),o=wm(e.color.getHexString()),i=new nl({linewidth:1,color:o,transparent:!0}),n=new xi(r,i);return n.layers.set(1),n}c(ms,"createOutlines");function wm(t){return se(t).darken(30).toRgbString()}c(wm,"darkenColorForOutline");function P0(t,e,r,o){if(e.length<1)return;t.boundingBox||t.computeBoundingBox();let i=t.boundingBox,n=t.getAttribute("position"),a=t.getAttribute("normal"),s=t.getAttribute("uv"),l,u;t.index?(l=t.index.count/3,u=c(function(x,T){return t.index.getX(x*3+T)},"meshIndex")):(l=n.count/3,u=c(function(x,T){return x*3+T},"meshIndex"));let f=new At;f.makeRotationFromQuaternion(new Io().setFromEuler(new Po(0,0,r/180*Math.PI)));let d=e.find(x=>x.face==="top"),h;d&&(h={min:o(d.bounds[1],d.bounds[0],0),max:o(d.bounds[3],d.bounds[2],i.max.z)});let p=e.find(x=>x.face==="side"),v;if(p&&(v={min:o(p.bounds[1],p.bounds[0],0),max:o(p.bounds[3],p.bounds[2],i.max.z)}),!(!v&&!h))for(let x=0;x<l;++x){let T=a.getX(u(x,0))+a.getX(u(x,1))+a.getX(u(x,2)),M=a.getY(u(x,0))+a.getY(u(x,1))+a.getY(u(x,2)),R=a.getZ(u(x,0))+a.getZ(u(x,1))+a.getZ(u(x,2)),S=Math.abs(T),O=Math.abs(M),V=Math.abs(R);var g,b;S<=O&&S<=V?(g="x",O<=V?b="y":b="z"):O<=S&&O<=V?(g="y",S<=V?b="x":b="z"):(g="z",S<=O?b="x":b="y"),g==="z"&&(g=b,b="z");let L,Q,_,G,E,Y;if(b==="z"||g==="z"){if(!p||!v)continue;L=p.repeat.u,Q=p.repeat.v,_=p.offset.u,G=p.offset.v,E=p.rotation,Y=v}else{if(!d||!h)continue;L=d.repeat.u,Q=d.repeat.v,_=d.offset.u,G=d.offset.v,E=(360-r+d.rotation)%360,Y=h}let{min:B,max:ie}=Y,ae=new Ot;ae.position.set(B.x,B.y,0),ae.updateMatrix(),ae.updateMatrixWorld();let N=B.clone().applyMatrix4(f),F=ie.clone().applyMatrix4(f),y=Math.abs(F.x-N.x),k=Math.abs(F.y-N.y),D=new Ne(y,k,ie.z).applyMatrix4(ae.matrixWorld),I=Math.abs(D[g]-B[g]),C=Math.abs(D[b]-B[b]),W=E*Math.PI/180||0,U=Math.cos(W),j=Math.sin(W),$=ae.matrixWorld.clone().invert(),le=new Io().setFromEuler(new Po(0,0,r/180*Math.PI));for(let X=0;X<3;X++){let ke=new Ne(n.getX(u(x,X)),n.getY(u(x,X)),n.getZ(u(x,X))).applyMatrix4($);ke.applyQuaternion(le);let ye=ke.applyMatrix4(ae.matrixWorld),re=ye.x,ue=ye.y,pe=ye.z;var A,w;g==="x"?A=L*(re-B[g])/I+_:g==="y"?A=L*(ue-B[g])/I+_:A=L*(pe-B[g])/I+_,b==="x"?w=Q*(re-B[b])/C+G:b==="y"?w=Q*(ue-B[b])/C+G:w=Q*(pe-B[b])/C+G,A-=.5,w-=.5;let K=A*U-w*j+.5,ce=A*j+w*U+.5;s.setX(u(x,X),K),s.setY(u(x,X),ce)}}}c(P0,"updateUVsLegacy");P();function vc(t){t&&(t.map&&(t.map.dispose(),t.map=void 0),t.dispose())}c(vc,"scrubMaterial");function ao(t){for(let e=t.children.length-1;e>=0;e--)ao(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){vc(e)}):"material"in t&&typeof t.material<"u"&&vc(t.material)}c(ao,"destroyObject3D");var ti,hn,ys=class ys{constructor(e){m(this,"rendererState");m(this,"dirty",!0);ft(this,ti,!0);ft(this,hn,0);this.rendererState=e}get geometries3DDirty(){return Ge(this,ti)}set geometries3DDirty(e){Je(this,ti,e)}update(e,r=!1){var n,a;let o;if(this.geometries3DDirty){let s;for(let l of this.rendererState.geometry3DIdsInScene)if(o=this.rendererState.geometry3DMap.get(l),o&&o.type==="geometry-group"&&o.userData.modelURL===void 0&&o.userData.dirty===!1&&o.userData.outlineDirty===!0){let u=o.children[0];o.userData.outlineDirty=!1;let f=on(o);if(f&&ao(f),!o.components[0].outline||!o.visible)continue;if(o.children.length>0){let d;if(u instanceof ir){let v=[],g,b,A,w;for(let x of o.userData.entities3D)w=this.rendererState.geometry3DMap.get(x),(w==null?void 0:w.type)==="geometry"&&(b=w.components[0],A=w.components[1],b instanceof Rt&&A.visible&&A.opacity>0&&A.outline&&!b.detached&&(g=b==null?void 0:b.geometry,g&&v.push(g)));v.length>0&&(d=hl(v))}else d=u.geometry;d&&(s=ms(d,u.material),s.position.z=o.altitude,s.userData.outlineOfEntityId=o.userData.entityId);let h,p;for(let v of o.userData.entities3D.values()){let g=this.rendererState.geometry3DMap.get(v);(g==null?void 0:g.type)==="geometry"&&(h=g.components[0],p=g.components[1],s&&(g==null?void 0:g.type)==="geometry"&&!h.detached?(g.components[0].outline=s,(n=o.parent)==null||n.add(s)):(g==null?void 0:g.type)==="geometry"&&h.geometry!=null&&h.material!=null&&h.detached&&(h.outline&&ao(h.outline),p&&p.opacity>0&&p.visible&&p.outline&&(h.outline=ms(h.geometry,h.material),h.outline.position.z=p.altitude,(a=o.parent)==null||a.add(h.outline))))}}this.dirty=!0}this.geometries3DDirty=!1}let i=r?yc(e,16,19,0,1):Ge(this,hn);if((i!==Ge(this,hn)||this.dirty)&&this.rendererState.geometry3DIdsInScene.size>0){let s;for(let l of this.rendererState.geometry3DIdsInScene)if(s=this.rendererState.geometry3DMap.get(l),(s==null?void 0:s.type)==="geometry-group"&&s.components[0]!=null&&s.components[0].outline&&s.visible){let u=on(s);if(u&&u.visible){let f=Array.isArray(u.material)?u.material:[u.material];for(let d of f)d.opacity=Math.min(i,s.components[0].opacity*gs(s))}}else if((s==null?void 0:s.type)==="geometry"&&s.components[0]instanceof Rt&&s.components[0].detached){let u=s.components[0].outline;if(u){let f=Array.isArray(u.material)?u.material:[u.material];for(let d of f)d.opacity=Math.min(i,s.components[1].opacity*gs(s))}}}Je(this,hn,i),this.dirty=!1}};ti=new WeakMap,hn=new WeakMap,c(ys,"OutlineInterpolationSystem");var vs=ys;var bs=class bs extends Ot{constructor(r,o=new Hi){super();m(this,"visible",!0);m(this,"type","geometry-group");m(this,"components");m(this,"userData",{entityId:"",entities3D:new Set,opacity:1,dirty:!0,outlineDirty:!0,shadingDirty:!0});this.components=[o],this.userData.entityId=r}setVisible(r){if(this.visible!==r){this.visible=r;let o=on(this);o&&(o.visible=r),this.dispatchEvent({type:"childremoved",child:this})}}getOpacity(){return this.userData.opacity}setOpacity(r){this.userData.opacity=r}removeEntity(){this.dispatchEvent({type:"childremoved",child:this})}getfirstChildEntityId(){let r;for(let i of this.children)if(!i.userData.detached){r=i;break}return r instanceof ir?Object.values(r.userData.entities)[0]:void 0}setAltitude(r){this.position.z!==r&&(this.position.z=r,this.dispatchEvent({type:"childremoved",child:this}))}get altitude(){return this.position.z}};c(bs,"GeometryGroupObject3D");var gt=bs;var ri=class ri extends Ot{constructor(r){super();m(this,"childrenIds",new Set);m(this,"children",[]);m(this,"type","group-container");m(this,"userData",{entityId:"",entities2D:new Set,dirty:!0,occluderDirty:!1,opacity:1,computedOpacity:1});m(this,"components",[]);this.userData.entityId=r}addOccluderFeature(r,o){this.userData.occluderFeature=r,this.userData.occluderId=o,this.userData.occluderDirty=!0}addEntity(r){r instanceof ri?(this.childrenIds.add(r.userData.entityId),this.add(r)):r instanceof Zt?(this.childrenIds.add(r.id),this.add(r.object3d),this.userData.entities2D.add(r.id)):r instanceof gt?(this.childrenIds.add(r.userData.entityId),this.add(r)):r instanceof Ut&&r.object3d&&(this.childrenIds.add(r.id),this.add(r.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(r){r instanceof ri?(this.childrenIds.delete(r.userData.entityId),this.remove(r)):r instanceof Zt?(this.childrenIds.delete(r.id),this.userData.entities2D.delete(r.id),this.remove(r.object3d)):r instanceof gt?(this.childrenIds.delete(r.userData.entityId),this.remove(r)):r instanceof Ut&&r.object3d&&(this.childrenIds.delete(r.id),this.add(r.object3d)),this.dispatchEvent({type:"childremoved",child:this})}setVisible(r){this.visible!==r&&(this.visible=r,this.dispatchEvent({type:"childremoved",child:this}))}setAltitude(r){this.position.z!==r&&(this.position.z=r,this.dispatchEvent({type:"childremoved",child:this}))}get altitude(){return this.position.z}setOpacity(r){this.userData.opacity=r}get opacity(){return this.userData.opacity}};c(ri,"GroupContainerObject3D");var vt=ri;P();function Dm(t){let e=t.min,r=t.max,o=new Ne(e.x,e.y,e.z),i=new Ne(r.x,e.y,e.z),n=new Ne(e.x,r.y,e.z),a=new Ne(r.x,r.y,e.z);return[o,i,n,a]}c(Dm,"getCornersOfBoundingBox");P();function bc(t,e){let r;return typeof e=="string"||typeof e=="number"?(r=t.geometry2DMap.get(e),r==null&&(r=t.geometry3DMap.get(e))):typeof(e==null?void 0:e.id)=="string"||typeof(e==null?void 0:e.id)=="number"?(r=t.geometry2DMap.get(e.id),r==null&&(r=t.geometry3DMap.get(e.id))):r=e,r}c(bc,"getGeometryByGeometryId");function _x(t,e,r=[],o=new Vr,i){(t.getSystems().renderSystem.threeDdirty||t.getSystems().renderSystem.twoDdirty)&&t.renderSync();let n=bc(t.getInternalState(),e);return xc(n,r,o,i),r}c(_x,"getVerticesOfEntity");var so=new Ne;function xc(t,e=[],r=new Vr,o){if(t.visible){if(t.isMesh||t.isLine||t.isPoints){let i=t.geometry;if(i.isBufferGeometry){let n=i.attributes.position;for(let a=0;a<n.count;a++)so.fromBufferAttribute(n,a),o!==void 0&&(so.z=o),e.push(so.clone()),r.expandByPoint(so)}}for(let i of t.children)xc(i,e,r,o)}}c(xc,"traverse");P();function Em(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}c(Em,"getPixelRatio");P();function Am(t,e,r=!1){let o=null,i=0;return function(...n){i++,i===1&&r===!0&&t(...n);let a=c(()=>{(!r||i>1)&&t(...n),o=null,i=0},"later");clearTimeout(o),o=setTimeout(a,e)}}c(Am,"debounce");P();var Om=(()=>{let t;return{getDeviceType(){if(t)return t;let{userAgent:e,platform:r,maxTouchPoints:o}=window.navigator,i=/(iphone|ipod|ipad)/i.test(e),n=r==="iPad"||r.indexOf("Mac")===0&&o>0&&!window.MSStream,a=/android/i.test(e);return t={isIpad:n,isMobile:a||i||n,isSafari12:/Version\/12.+Safari/.test(e),isFirefox:/Firefox/.test(e),isWindows:/windows/i.test(e)},t},_reset(){t=void 0}}})(),_c=Om.getDeviceType,Tc=(()=>{let t,e,r;function o(){if(e!==void 0)return e;t||(t=document.createElement("canvas"));let n=t.getContext("webgl")||t.getContext("experimental-webgl");if(!n)return e;try{let a=_c().isFirefox?null:n.getExtension("WEBGL_debug_renderer_info");return e=a?n.getParameter(a.UNMASKED_RENDERER_WEBGL):n.getParameter(n.RENDERER),e}catch{let s=new Error("Failed getting device info");throw s.name="FailedGettingDeviceInfo",s}}c(o,"getInfo");function i(){var a,s;if(!_c().isWindows)return!1;if(r!==void 0)return r;let n=(s=(a=Im())==null?void 0:a.toLowerCase())!=null?s:"";return r=n.includes("intel")&&(n.includes("uhd")||n.includes("iris")),r}return c(i,"shouldDisableOffscreenCanvas"),{getInfo:o,shouldDisableOffscreenCanvas:i,_setCanvas(n){t=n,e=void 0,r=void 0}}})(),Im=Tc.getInfo,Pm=Tc.shouldDisableOffscreenCanvas;P();function $n(t,e){let r={};for(let o=0;o<e.length;o++){let i=e[o];i in t&&(r[i]=t[i])}return r}c($n,"pick");function fs(t){return Object.keys(t).length===0}c(fs,"isEmpty");P();var Rm=c(t=>e=>{if(!e.includes("mappedin")){let r={};for(let o in t){let i=t[o];e.includes("mappedin")||(t[o]=i)}return{url:e,headers:r}}return{url:e,headers:t}},"transformRequest");function Kx(t,e,r,o){let i=t*(Math.PI/180),n=o/fr,a=t+n*180/Math.PI,s=r/fr/Math.cos(i),l=e+s*180/Math.PI;return{lat:a,lon:l}}c(Kx,"cartesianToGeographic");function Jx(t,e,r,o){let i=r*(Math.PI/180),n=o*(Math.PI/180),a=t*(Math.PI/180),s=e*(Math.PI/180),l=i-a,u=n-s,f=fr*u*Math.cos(a),d=fr*l;return{x:f,y:d}}c(Jx,"geographicToCartesian");var Um=c((t,e)=>{var r;if(t.children&&t.visible)for(let o of t.children){if(o.visible&&o.type)if("entities3D"in o.userData&&((r=o.userData)!=null&&r.entities3D)&&o.type==="geometry-group"){e.add(o.userData.entityId);for(let i of o.userData.entities3D.values())e.add(i)}else(o.type==="group-container"||o.type==="custom-geometry"||o instanceof Rr)&&e.add(o.userData.entityId);Um(o,e)}return e},"populateGeometry3DIdsInScene"),Lm=c((t,e)=>{var r;if(t.children&&t.visible&&!((r=t.userData)!=null&&r.hidden))for(let o of t.children)o.visible&&o instanceof ar&&e.add(o.userData.entityId),Lm(o,e);return e},"populateGeometry2DIdsInScene");function ds(t,e){for(let r in e){if(e[r]==null){t[r]=void 0;continue}typeof e[r]=="object"?ds(t[r],e[r]):t[r]=e[r]}return t}c(ds,"mergeObjects");function qx(t,e,r,o){let i={translateX:t.x,translateY:t.y,translateZ:t.z,scale:t.meterInMercatorCoordinateUnits()},n=new At,a=new Ne(i.scale,-i.scale,i.scale),s=new At().makeTranslation(i.translateX,i.translateY,i.translateZ).scale(a),l=r.elevation;return{id:gc,type:"custom",renderingMode:"3d",render:c((u,f)=>{if(n.fromArray(f),l!==r.elevation){let d=dl.fromLngLat(t.toLngLat(),r.elevation);s.makeTranslation(i.translateX,i.translateY,-d.z).scale(a)}e.projectionMatrix=n.multiply(s),l=r.elevation,o()},"render")}}c(qx,"createCustomLayer");function Gm(t){return fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}c(Gm,"fetchToken");async function Qx(t){let e=await Gm(t),{access_token:r}=await e.json();return{"x-mappedin-tiles-key":r}}c(Qx,"getRequestHeaders");function $x(t,e=0){let r=3735928559^e,o=1103547991^e;for(let i=0,n;i<t.length;i++)n=t.charCodeAt(i),r=Math.imul(r^n,2654435761),o=Math.imul(o^n,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)}c($x,"cyrb53");var Fm=c(t=>t,"linearEase");var e1=c(t=>1-Math.cos(t*Math.PI/2),"easeIn");function yc(t,e,r,o,i,n=Fm){t=Math.max(e,Math.min(t,r));let a=(t-Math.min(e,r))/Math.abs(r-e),s=n(a);return o+s*(i-o)}c(yc,"interpolate");function t1(t,e,r){let o=t*(Math.PI/180)/2,i=e/2;return r*Math.tan(o)/i}c(t1,"getProjectionScaleFactor");function r1(t){return new fl(new Ro(t[0][0],t[0][1]),new Ro(t[1][0],t[1][1])).getCenter().toArray()}c(r1,"getBoundingBoxCenter");function n1(t,e){return t<e||e<=12}c(n1,"shouldExpandZoomLevel");function gs(t){let e=1;return t.type==="geometry-group"&&t.parent!=null&&t.parent instanceof vt?e=t.parent.userData.computedOpacity:(t.type==="geometry"||t.type==="custom-geometry"||t.type==="model")&&t.parentObject3D!=null&&t.parentObject3D instanceof gt&&t.parentObject3D.parent!=null&&t.parentObject3D.parent instanceof vt&&(e=t.parentObject3D.parent.userData.computedOpacity),e}c(gs,"getGroupContainerOpacity");P();var _s=class _s{constructor(e){m(this,"visible");m(this,"altitude");m(this,"color");m(this,"dirty",!0);m(this,"maxWidth");m(this,"maxHeight");m(this,"hoverByPolygon");m(this,"flipToFaceCamera",Sc.flipToFaceCamera);m(this,"font");m(this,"fillOpacity");m(this,"fontSize");m(this,"margin");m(this,"outlineWidth");m(this,"outlineBlur");m(this,"outlineOffsetX");m(this,"strokeColor");m(this,"strokeOpacity");m(this,"strokeWidth");m(this,"hoverColor");m(this,"outlineOffsetY");m(this,"outlineColor");m(this,"outlineOpacity");e&&Object.assign(this,e)}getState(e=!1){let r={};for(let o in this)!e&&o==="dirty"||this[o]!==void 0&&(r[o]=this[o]);return r}};c(_s,"Text3DStyleComponent");var xs=_s,Sc=Object.freeze({visible:!0,color:"black",flipToFaceCamera:!0,fillOpacity:1,font:void 0,fontSize:2,margin:[.2,1,.2,1.5],outlineColor:"black",outlineOpacity:1,outlineWidth:0,outlineOffsetX:0,outlineOffsetY:0,outlineBlur:0,strokeOpacity:1,strokeWidth:0,maxWidth:void 0,maxHeight:void 0,strokeColor:"black",hoverColor:void 0});P();P();var Ss=class Ss{constructor(e){m(this,"dirty",!0);m(this,"visible",!0);m(this,"opacity",1);m(this,"verticalOffset",0);m(this,"interactive",!1);m(this,"color");m(this,"material");m(this,"rotation");m(this,"scale");e&&Object.assign(this,e)}};c(Ss,"ModelStyleComponnet");var Ts=Ss;P();var Bm=[1,1,1],Nm=[0,0,0];export{Ic as a,Hm as b,Ft as c,fr as d,ng as e,Qt as f,ig as g,og as h,ag as i,sg as j,Lc as k,jm as l,fg as m,rt as n,Mn as o,Bo as p,nr as q,Oh as r,Vg as s,fu as t,Wg as u,Hg as v,Zg as w,Yg as x,Xg as y,Kg as z,Jg as A,Wi as B,rv as C,Ph as D,nv as E,du as F,J as G,lu as H,Da as I,Ea as J,ir as K,Rt as L,Hi as M,on as N,se as O,Gv as P,Zv as Q,Du as R,ny as S,Eu as T,Zt as U,Rr as V,Ut as W,x0 as X,gc as Y,_0 as Z,Dm as _,bc as $,_x as aa,Em as ba,Am as ca,Pm as da,$n as ea,Rm as fa,Vi as ga,Kx as ha,Jx as ia,Um as ja,Lm as ka,qx as la,Qx as ma,$x as na,Fm as oa,e1 as pa,yc as qa,t1 as ra,r1 as sa,n1 as ta,gs as ua,dn as va,Ku as wa,Wy as xa,Hy as ya,xs as za,Sc as Aa,Ts as Ba,Bm as Ca,Nm as Da,sc as Ea,rb as Fa,ub as Ga,io as Ha,Qn as Ia,Mb as Ja,Cb as Ka,Db as La,Eb as Ma,hm as Na,Ab as Oa,Ob as Pa,Ib as Qa,Pb as Ra,Rb as Sa,Ub as Ta,Lb as Ua,Gb as Va,dc as Wa,Fb as Xa,Bb as Ya,Nb as Za,jb as _a,zb as $a,Vb as ab,Wb as bb,Hb as cb,Zb as db,pm as eb,Yb as fb,gm as gb,Xb as hb,Kb as ib,ei as jb,I0 as kb,wm as lb,P0 as mb,ao as nb,vs as ob,gt as pb,vt as qb};