@mappedin/mappedin-js 6.0.1-beta.40 → 6.0.1-beta.42

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 po,i as Qa,j as $a}from"./chunk-PJ42DHEC.js";import{a as es}from"./chunk-7OMFVB52.js";import{$a as Ja,A as La,Aa as Br,B as Ga,E as bt,F as Fa,Fa as Za,Ga as Ya,Ha as Xa,I as Ba,J as co,L as fo,M as Be,N as Fr,O as Na,P as Mt,Q as ho,R as Ct,S as st,U as ai,Wa as Ka,X as sr,Z as ja,bb as qa,c as Pa,d as Ra,e as bn,g as xn,ha as si,ja as za,m as lo,ma as Va,na as Wa,pa as li,q as ii,r as oi,x as Ua,xa as Ha,z as uo}from"./chunk-EZ2BKVTT.js";import{a as O,b as re}from"./chunk-WEYCT3B2.js";import{b as mu,d as gu,e as m,f as Le,g as ct,h as Ke}from"./chunk-HALSTKAB.js";var Xs=mu((Dn,Xr)=>{O();var wc=200,Cs="__lodash_hash_undefined__",Mc=800,Cc=16,Ds=9007199254740991,Es="[object Arguments]",Dc="[object Array]",Ec="[object AsyncFunction]",Ac="[object Boolean]",Ic="[object Date]",Oc="[object Error]",As="[object Function]",Pc="[object GeneratorFunction]",Rc="[object Map]",Uc="[object Number]",Lc="[object Null]",Is="[object Object]",Gc="[object Proxy]",Fc="[object RegExp]",Bc="[object Set]",Nc="[object String]",jc="[object Undefined]",zc="[object WeakMap]",Vc="[object ArrayBuffer]",Wc="[object DataView]",Hc="[object Float32Array]",Zc="[object Float64Array]",Yc="[object Int8Array]",Xc="[object Int16Array]",Kc="[object Int32Array]",Jc="[object Uint8Array]",qc="[object Uint8ClampedArray]",Qc="[object Uint16Array]",$c="[object Uint32Array]",ef=/[\\^$.*+?()[\]{}|]/g,tf=/^\[object .+?Constructor\]$/,rf=/^(?:0|[1-9]\d*)$/,je={};je[Hc]=je[Zc]=je[Yc]=je[Xc]=je[Kc]=je[Jc]=je[qc]=je[Qc]=je[$c]=!0;je[Es]=je[Dc]=je[Vc]=je[Ac]=je[Wc]=je[Ic]=je[Oc]=je[As]=je[Rc]=je[Uc]=je[Is]=je[Fc]=je[Bc]=je[Nc]=je[zc]=!1;var Os=typeof global=="object"&&global&&global.Object===Object&&global,nf=typeof self=="object"&&self&&self.Object===Object&&self,In=Os||nf||Function("return this")(),Ps=typeof Dn=="object"&&Dn&&!Dn.nodeType&&Dn,En=Ps&&typeof Xr=="object"&&Xr&&!Xr.nodeType&&Xr,Rs=En&&En.exports===Ps,To=Rs&&Os.process,ys=function(){try{var t=En&&En.require&&En.require("util").types;return t||To&&To.binding&&To.binding("util")}catch{}}(),bs=ys&&ys.isTypedArray;function Us(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function of(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}function af(t){return function(e){return t(e)}}function sf(t,e){return t==null?void 0:t[e]}function lf(t,e){return function(r){return t(e(r))}}var uf=Array.prototype,cf=Function.prototype,bi=Object.prototype,So=In["__core-js_shared__"],xi=cf.toString,Nt=bi.hasOwnProperty,xs=function(){var t=/[^.]+$/.exec(So&&So.keys&&So.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Ls=bi.toString,ff=xi.call(Object),df=RegExp("^"+xi.call(Nt).replace(ef,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),vi=Rs?In.Buffer:void 0,_s=In.Symbol,Ts=In.Uint8Array,Ss=vi?vi.allocUnsafe:void 0,Gs=lf(Object.getPrototypeOf,Object),ks=Object.create,hf=bi.propertyIsEnumerable,pf=uf.splice,Mr=_s?_s.toStringTag:void 0,yi=function(){try{var t=Ao(Object,"defineProperty");return t({},"",{}),t}catch{}}(),mf=vi?vi.isBuffer:void 0,ws=Math.max,gf=Date.now,Fs=Ao(In,"Map"),An=Ao(Object,"create"),vf=function(){function t(){}return function(e){if(!Bt(e))return{};if(ks)return ks(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Cr(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])}}function yf(){this.__data__=An?An(null):{},this.size=0}function bf(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function xf(t){var e=this.__data__;if(An){var r=e[t];return r===Cs?void 0:r}return Nt.call(e,t)?e[t]:void 0}function _f(t){var e=this.__data__;return An?e[t]!==void 0:Nt.call(e,t)}function Tf(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=An&&e===void 0?Cs:e,this}Cr.prototype.clear=yf;Cr.prototype.delete=bf;Cr.prototype.get=xf;Cr.prototype.has=_f;Cr.prototype.set=Tf;function jt(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])}}function Sf(){this.__data__=[],this.size=0}function kf(t){var e=this.__data__,r=_i(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():pf.call(e,r,1),--this.size,!0}function wf(t){var e=this.__data__,r=_i(e,t);return r<0?void 0:e[r][1]}function Mf(t){return _i(this.__data__,t)>-1}function Cf(t,e){var r=this.__data__,o=_i(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}jt.prototype.clear=Sf;jt.prototype.delete=kf;jt.prototype.get=wf;jt.prototype.has=Mf;jt.prototype.set=Cf;function Kr(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])}}function Df(){this.size=0,this.__data__={hash:new Cr,map:new(Fs||jt),string:new Cr}}function Ef(t){var e=Si(this,t).delete(t);return this.size-=e?1:0,e}function Af(t){return Si(this,t).get(t)}function If(t){return Si(this,t).has(t)}function Of(t,e){var r=Si(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}Kr.prototype.clear=Df;Kr.prototype.delete=Ef;Kr.prototype.get=Af;Kr.prototype.has=If;Kr.prototype.set=Of;function Jr(t){var e=this.__data__=new jt(t);this.size=e.size}function Pf(){this.__data__=new jt,this.size=0}function Rf(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function Uf(t){return this.__data__.get(t)}function Lf(t){return this.__data__.has(t)}function Gf(t,e){var r=this.__data__;if(r instanceof jt){var o=r.__data__;if(!Fs||o.length<wc-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new Kr(o)}return r.set(t,e),this.size=r.size,this}Jr.prototype.clear=Pf;Jr.prototype.delete=Rf;Jr.prototype.get=Uf;Jr.prototype.has=Lf;Jr.prototype.set=Gf;function Ff(t,e){var r=Co(t),o=!r&&Mo(t),i=!r&&!o&&Vs(t),n=!r&&!o&&!i&&Hs(t),a=r||o||i||n,s=a?of(t.length,String):[],l=s.length;for(var u in t)(e||Nt.call(t,u))&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||n&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||js(u,l)))&&s.push(u);return s}function ko(t,e,r){(r!==void 0&&!ki(t[e],r)||r===void 0&&!(e in t))&&Do(t,e,r)}function Bf(t,e,r){var o=t[e];(!(Nt.call(t,e)&&ki(o,r))||r===void 0&&!(e in t))&&Do(t,e,r)}function _i(t,e){for(var r=t.length;r--;)if(ki(t[r][0],e))return r;return-1}function Do(t,e,r){e=="__proto__"&&yi?yi(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Nf=Qf();function Ti(t){return t==null?t===void 0?jc:Lc:Mr&&Mr in Object(t)?$f(t):od(t)}function Ms(t){return On(t)&&Ti(t)==Es}function jf(t){if(!Bt(t)||nd(t))return!1;var e=Oo(t)?df:tf;return e.test(ud(t))}function zf(t){return On(t)&&Ws(t.length)&&!!je[Ti(t)]}function Vf(t){if(!Bt(t))return id(t);var e=zs(t),r=[];for(var o in t)o=="constructor"&&(e||!Nt.call(t,o))||r.push(o);return r}function Eo(t,e,r,o,i){t!==e&&Nf(e,function(n,a){if(i||(i=new Jr),Bt(n))Wf(t,e,a,r,Eo,o,i);else{var s=o?o(wo(t,a),n,a+"",t,e,i):void 0;s===void 0&&(s=n),ko(t,a,s)}},Zs)}function Wf(t,e,r,o,i,n,a){var s=wo(t,r),l=wo(e,r),u=a.get(l);if(u){ko(t,r,u);return}var c=n?n(s,l,r+"",t,e,a):void 0,f=c===void 0;if(f){var d=Co(l),h=!d&&Vs(l),g=!d&&!h&&Hs(l);c=l,d||h||g?Co(s)?c=s:cd(s)?c=Kf(s):h?(f=!1,c=Zf(l,!0)):g?(f=!1,c=Xf(l,!0)):c=[]:fd(l)||Mo(l)?(c=s,Mo(s)?c=dd(s):(!Bt(s)||Oo(s))&&(c=ed(l))):f=!1}f&&(a.set(l,c),i(c,l,o,n,a),a.delete(l)),ko(t,r,c)}function Bs(t,e){return sd(ad(t,e,Ys),t+"")}var Hf=yi?function(t,e){return yi(t,"toString",{configurable:!0,enumerable:!1,value:md(e),writable:!0})}:Ys;function Zf(t,e){if(e)return t.slice();var r=t.length,o=Ss?Ss(r):new t.constructor(r);return t.copy(o),o}function Yf(t){var e=new t.constructor(t.byteLength);return new Ts(e).set(new Ts(t)),e}function Xf(t,e){var r=e?Yf(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Kf(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}function Jf(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?Do(r,s,l):Bf(r,s,l)}return r}function qf(t){return Bs(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&&td(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})}function Qf(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}}function Ns(t,e,r,o,i,n){return Bt(t)&&Bt(e)&&(n.set(e,t),Eo(t,e,void 0,Ns,n),n.delete(e)),t}function Si(t,e){var r=t.__data__;return rd(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Ao(t,e){var r=sf(t,e);return jf(r)?r:void 0}function $f(t){var e=Nt.call(t,Mr),r=t[Mr];try{t[Mr]=void 0;var o=!0}catch{}var i=Ls.call(t);return o&&(e?t[Mr]=r:delete t[Mr]),i}function ed(t){return typeof t.constructor=="function"&&!zs(t)?vf(Gs(t)):{}}function js(t,e){var r=typeof t;return e=e==null?Ds:e,!!e&&(r=="number"||r!="symbol"&&rf.test(t))&&t>-1&&t%1==0&&t<e}function td(t,e,r){if(!Bt(r))return!1;var o=typeof e;return(o=="number"?Io(r)&&js(e,r.length):o=="string"&&e in r)?ki(r[e],t):!1}function rd(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function nd(t){return!!xs&&xs in t}function zs(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||bi;return t===r}function id(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}function od(t){return Ls.call(t)}function ad(t,e,r){return e=ws(e===void 0?t.length-1:e,0),function(){for(var o=arguments,i=-1,n=ws(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),Us(t,this,s)}}function wo(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var sd=ld(Hf);function ld(t){var e=0,r=0;return function(){var o=gf(),i=Cc-(o-r);if(r=o,i>0){if(++e>=Mc)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function ud(t){if(t!=null){try{return xi.call(t)}catch{}try{return t+""}catch{}}return""}function ki(t,e){return t===e||t!==t&&e!==e}var Mo=Ms(function(){return arguments}())?Ms:function(t){return On(t)&&Nt.call(t,"callee")&&!hf.call(t,"callee")},Co=Array.isArray;function Io(t){return t!=null&&Ws(t.length)&&!Oo(t)}function cd(t){return On(t)&&Io(t)}var Vs=mf||gd;function Oo(t){if(!Bt(t))return!1;var e=Ti(t);return e==As||e==Pc||e==Ec||e==Gc}function Ws(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ds}function Bt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function On(t){return t!=null&&typeof t=="object"}function fd(t){if(!On(t)||Ti(t)!=Is)return!1;var e=Gs(t);if(e===null)return!0;var r=Nt.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&xi.call(r)==ff}var Hs=bs?af(bs):zf;function dd(t){return Jf(t,Zs(t))}var hd=Bs(function(t){return t.push(void 0,Ns),Us(pd,void 0,t)});function Zs(t){return Io(t)?Ff(t,!0):Vf(t)}var pd=qf(function(t,e,r,o){Eo(t,e,r,o)});function md(t){return function(){return t}}function Ys(t){return t}function gd(){return!1}Xr.exports=hd});O();var ui="[MappedinJS]",vu=(i=>(i[i.LOG=0]="LOG",i[i.WARN=1]="WARN",i[i.ERROR=2]="ERROR",i[i.SILENT=3]="SILENT",i))(vu||{});function Cp(t){0<=t&&t<=3&&(ts.logState=t)}var ts={logState:re.env.NODE_ENV==="test"?3:0,log(...t){this.logState<=0&&console.log(ui,...t)},warn(...t){this.logState<=1&&console.warn(ui,...t)},error(...t){this.logState<=2&&console.error(ui,...t)},assert(...t){console.assert(...t)},time(t){console.time(t)},timeEnd(t){console.timeEnd(t)},throw(t,e){throw new Error("".concat(ui," ").concat(t),e)}},Ut=ts;O();O();var lr=class extends Error{};lr.prototype.name="InvalidTokenError";function yu(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}))}function bu(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 yu(e)}catch{return atob(e)}}function rs(t,e){if(typeof t!="string")throw new lr("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 lr("Invalid token specified: missing part #".concat(r+1));let i;try{i=bu(o)}catch(n){throw new lr("Invalid token specified: invalid base64 for part #".concat(r+1," (").concat(n.message,")"))}try{return JSON.parse(i)}catch(n){throw new lr("Invalid token specified: invalid json for part #".concat(r+1," (").concat(n.message,")"))}}O();var ur=63710088e-1;function Gp(t){var r,o;let e=rs(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:{}}}function Kt(t){return t*(Math.PI/180)}function xu(t){return t*(180/Math.PI)}function Fp(t,e){let r=Math.pow(10,e);return Math.sign(t)*Math.round(Math.abs(t)*r)/r}function ns(t,e){return(t%e+e)%e}function Bp([t,e],[r,o]){let i=Kt(o-e),n=Kt(r-t),a=Kt(e),s=Kt(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 ur*u}function Np([t,e],[r,o]){let i=Kt(e),n=Kt(t),a=Kt(o),l=Kt(r)-n,u=Math.sin(l)*Math.cos(a),c=Math.cos(i)*Math.sin(a)-Math.sin(i)*Math.cos(a)*Math.cos(l);return xu((Math.atan2(u,c)+Math.PI*2)%(Math.PI*2))}function jp(t,e){let r=ns(t,Math.PI*2),o=ns(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}}function _u(t){return t instanceof Ja?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)}O();function Wp(t,e,r=!1){let o=null,i=0;return function(...n){i++,i===1&&r===!0&&t(...n);let a=()=>{(!r||i>1)&&t(...n),o=null,i=0};clearTimeout(o),o=setTimeout(a,e)}}O();O();function Tu(t){if(t==null)throw new Error("Expected value to be defined, but received ".concat(t))}function Yp(t,e,r){if(Tu(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)}}O();var mo=[0,4,6,8,10],tt=()=>{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],mo.map((o,i)=>r.slice(o,i===mo.length-1?void 0:mo[i+1]).join("")).join("-")};O();var _n=class{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={}}};O();var is="mi-session-data",os="mi-local-data",cr,xt,_t,ci=class ci{constructor(){ct(this,xt);ct(this,_t);try{let e=sessionStorage.getItem(is);e?Ke(this,xt,JSON.parse(e)):Ke(this,xt,{id:tt()})}catch{Ke(this,xt,{id:tt()})}try{let e=localStorage.getItem(os);e?Ke(this,_t,JSON.parse(e)):Ke(this,_t,{deviceId:tt()})}catch{Ke(this,_t,{deviceId:tt()})}Le(this,xt).id||(Le(this,xt).id=tt()),Le(this,_t).deviceId||(Le(this,_t).deviceId=tt())}static getInstance(){return Le(this,cr)||Ke(this,cr,new ci),Le(this,cr)}static ___clearInstance(){Ke(this,cr,void 0)}saveSessionData(e,r){Le(this,xt)[e]=r;try{return sessionStorage.setItem(is,JSON.stringify(Le(this,xt))),!0}catch{return!1}}loadSessionData(e){let r=Le(this,xt)[e];if(r!=null)return r}saveLocalData(e,r){Le(this,_t)[e]=r;try{return localStorage.setItem(os,JSON.stringify(Le(this,_t))),!0}catch{return!1}}loadLocalData(e){let r=Le(this,_t)[e];if(r!=null)return r}};cr=new WeakMap,xt=new WeakMap,_t=new WeakMap,ct(ci,cr);var go=ci;O();var Oe;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}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)}t.joinValues=o,t.jsonStringifyReplacer=(i,n)=>typeof n=="bigint"?n.toString():n})(Oe||(Oe={}));var yo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(yo||(yo={}));var $=Oe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jt=t=>{switch(typeof t){case"undefined":return $.undefined;case"string":return $.string;case"number":return isNaN(t)?$.nan:$.number;case"boolean":return $.boolean;case"function":return $.function;case"bigint":return $.bigint;case"symbol":return $.symbol;case"object":return Array.isArray(t)?$.array:t===null?$.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?$.promise:typeof Map<"u"&&t instanceof Map?$.map:typeof Set<"u"&&t instanceof Set?$.set:typeof Date<"u"&&t instanceof Date?$.date:$.object;default:return $.unknown}},H=Oe.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"]),Su=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ft=class t 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=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++}}};return i(this),o}static assert(e){if(!(e instanceof t))throw new Error("Not a ZodError: ".concat(e))}toString(){return this.message}get message(){return JSON.stringify(this.issues,Oe.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()}};ft.create=t=>new ft(t);var zr=(t,e)=>{let r;switch(t.code){case H.invalid_type:t.received===$.undefined?r="Required":r="Expected ".concat(t.expected,", received ").concat(t.received);break;case H.invalid_literal:r="Invalid literal value, expected ".concat(JSON.stringify(t.expected,Oe.jsonStringifyReplacer));break;case H.unrecognized_keys:r="Unrecognized key(s) in object: ".concat(Oe.joinValues(t.keys,", "));break;case H.invalid_union:r="Invalid input";break;case H.invalid_union_discriminator:r="Invalid discriminator value. Expected ".concat(Oe.joinValues(t.options));break;case H.invalid_enum_value:r="Invalid enum value. Expected ".concat(Oe.joinValues(t.options),", received '").concat(t.received,"'");break;case H.invalid_arguments:r="Invalid function arguments";break;case H.invalid_return_type:r="Invalid function return type";break;case H.invalid_date:r="Invalid date";break;case H.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,'"'):Oe.assertNever(t.validation):t.validation!=="regex"?r="Invalid ".concat(t.validation):r="Invalid";break;case H.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 H.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 H.custom:r="Invalid input";break;case H.invalid_intersection_types:r="Intersection results could not be merged";break;case H.not_multiple_of:r="Number must be a multiple of ".concat(t.multipleOf);break;case H.not_finite:r="Number must be finite";break;default:r=e.defaultError,Oe.assertNever(t)}return{message:r}},ls=zr;function ku(t){ls=t}function fi(){return ls}var di=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}},wu=[];function J(t,e){let r=fi(),o=di({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===zr?void 0:zr].filter(i=>!!i)});t.common.issues.push(o)}var Qe=class t{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 _e;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 t.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 _e;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}}},_e=Object.freeze({status:"aborted"}),jr=t=>({status:"dirty",value:t}),rt=t=>({status:"valid",value:t}),bo=t=>t.status==="aborted",xo=t=>t.status==="dirty",kn=t=>t.status==="valid",wn=t=>typeof Promise<"u"&&t instanceof Promise;function hi(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)}function us(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}var fe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(fe||(fe={}));var Tn,Sn,mt=class{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}},as=(t,e)=>{if(kn(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 ft(t.common.issues);return this._error=r,this._error}}};function we(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:(a,s)=>{var l,u;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c!=null?c:s.defaultError}:typeof s.data>"u"?{message:(l=c!=null?c:o)!==null&&l!==void 0?l:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(u=c!=null?c:r)!==null&&u!==void 0?u:s.defaultError}},description:i}}var Me=class{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 Jt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Jt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Qe,ctx:{common:e.parent.common,data:e.data,parsedType:Jt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(wn(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:Jt(e)},n=this._parseSync({data:e,path:i.path,parent:i});return as(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:Jt(e)},i=this._parse({data:e,path:o.path,parent:o}),n=await(wn(i)?i:Promise.resolve(i));return as(o,n)}refine(e,r){let o=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,n)=>{let a=e(i),s=()=>n.addIssue({code:H.custom,...o(i)});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 dt({schema:this,typeName:xe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return pt.create(this,this._def)}nullable(){return Et.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ft.create(this,this._def)}promise(){return $t.create(this,this._def)}or(e){return vr.create([this,e],this._def)}and(e){return yr.create(this,e,this._def)}transform(e){return new dt({...we(this._def),schema:this,typeName:xe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Sr({...we(this._def),innerType:this,defaultValue:r,typeName:xe.ZodDefault})}brand(){return new Mn({typeName:xe.ZodBranded,type:this,...we(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new kr({...we(this._def),innerType:this,catchValue:r,typeName:xe.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Cn.create(this,e)}readonly(){return wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Mu=/^c[^\s-]{8,}$/i,Cu=/^[0-9a-z]+$/,Du=/^[0-9A-HJKMNP-TV-Z]{26}$/,Eu=/^[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,Au=/^[a-z0-9_-]{21}$/i,Iu=/^[-+]?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)?)??$/,Ou=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Pu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",vo,Ru=/^(?:(?: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])$/,Uu=/^(([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})))$/,Lu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cs="((\\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])))",Gu=new RegExp("^".concat(cs,"$"));function fs(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}function Fu(t){return new RegExp("^".concat(fs(t),"$"))}function ds(t){let e="".concat(cs,"T").concat(fs(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,"$"))}function Bu(t,e){return!!((e==="v4"||!e)&&Ru.test(t)||(e==="v6"||!e)&&Uu.test(t))}var qt=class t extends Me{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==$.string){let n=this._getOrReturnCtx(e);return J(n,{code:H.invalid_type,expected:$.string,received:n.parsedType}),_e}let o=new Qe,i;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(i=this._getOrReturnCtx(e,i),J(i,{code:H.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),J(i,{code:H.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?J(i,{code:H.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):s&&J(i,{code:H.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),o.dirty())}else if(n.kind==="email")Ou.test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{validation:"email",code:H.invalid_string,message:n.message}),o.dirty());else if(n.kind==="emoji")vo||(vo=new RegExp(Pu,"u")),vo.test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{validation:"emoji",code:H.invalid_string,message:n.message}),o.dirty());else if(n.kind==="uuid")Eu.test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{validation:"uuid",code:H.invalid_string,message:n.message}),o.dirty());else if(n.kind==="nanoid")Au.test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{validation:"nanoid",code:H.invalid_string,message:n.message}),o.dirty());else if(n.kind==="cuid")Mu.test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{validation:"cuid",code:H.invalid_string,message:n.message}),o.dirty());else if(n.kind==="cuid2")Cu.test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{validation:"cuid2",code:H.invalid_string,message:n.message}),o.dirty());else if(n.kind==="ulid")Du.test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{validation:"ulid",code:H.invalid_string,message:n.message}),o.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),J(i,{validation:"url",code:H.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),J(i,{validation:"regex",code:H.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),J(i,{code:H.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),J(i,{code:H.invalid_string,validation:{startsWith:n.value},message:n.message}),o.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(i=this._getOrReturnCtx(e,i),J(i,{code:H.invalid_string,validation:{endsWith:n.value},message:n.message}),o.dirty()):n.kind==="datetime"?ds(n).test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{code:H.invalid_string,validation:"datetime",message:n.message}),o.dirty()):n.kind==="date"?Gu.test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{code:H.invalid_string,validation:"date",message:n.message}),o.dirty()):n.kind==="time"?Fu(n).test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{code:H.invalid_string,validation:"time",message:n.message}),o.dirty()):n.kind==="duration"?Iu.test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{validation:"duration",code:H.invalid_string,message:n.message}),o.dirty()):n.kind==="ip"?Bu(e.data,n.version)||(i=this._getOrReturnCtx(e,i),J(i,{validation:"ip",code:H.invalid_string,message:n.message}),o.dirty()):n.kind==="base64"?Lu.test(e.data)||(i=this._getOrReturnCtx(e,i),J(i,{validation:"base64",code:H.invalid_string,message:n.message}),o.dirty()):Oe.assertNever(n);return{status:o.value,value:e.data}}_regex(e,r,o){return this.refinement(i=>e.test(i),{validation:r,code:H.invalid_string,...fe.errToObj(o)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...fe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...fe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...fe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...fe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...fe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...fe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...fe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...fe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...fe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...fe.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,...fe.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,...fe.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...fe.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...fe.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...fe.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...fe.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...fe.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...fe.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...fe.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...fe.errToObj(r)})}nonempty(e){return this.min(1,fe.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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}};qt.create=t=>{var e;return new qt({checks:[],typeName:xe.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...we(t)})};function Nu(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)}var fr=class t extends Me{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)!==$.number){let n=this._getOrReturnCtx(e);return J(n,{code:H.invalid_type,expected:$.number,received:n.parsedType}),_e}let o,i=new Qe;for(let n of this._def.checks)n.kind==="int"?Oe.isInteger(e.data)||(o=this._getOrReturnCtx(e,o),J(o,{code:H.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),J(o,{code:H.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),J(o,{code:H.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="multipleOf"?Nu(e.data,n.value)!==0&&(o=this._getOrReturnCtx(e,o),J(o,{code:H.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(o=this._getOrReturnCtx(e,o),J(o,{code:H.not_finite,message:n.message}),i.dirty()):Oe.assertNever(n);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,fe.toString(r))}gt(e,r){return this.setLimit("min",e,!1,fe.toString(r))}lte(e,r){return this.setLimit("max",e,!0,fe.toString(r))}lt(e,r){return this.setLimit("max",e,!1,fe.toString(r))}setLimit(e,r,o,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:o,message:fe.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:fe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fe.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:fe.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:fe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fe.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"&&Oe.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)}};fr.create=t=>new fr({checks:[],typeName:xe.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...we(t)});var dr=class t extends Me{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)!==$.bigint){let n=this._getOrReturnCtx(e);return J(n,{code:H.invalid_type,expected:$.bigint,received:n.parsedType}),_e}let o,i=new Qe;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),J(o,{code:H.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),J(o,{code:H.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),J(o,{code:H.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):Oe.assertNever(n);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,fe.toString(r))}gt(e,r){return this.setLimit("min",e,!1,fe.toString(r))}lte(e,r){return this.setLimit("max",e,!0,fe.toString(r))}lt(e,r){return this.setLimit("max",e,!1,fe.toString(r))}setLimit(e,r,o,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:o,message:fe.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:fe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fe.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:fe.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}};dr.create=t=>{var e;return new dr({checks:[],typeName:xe.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...we(t)})};var hr=class extends Me{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==$.boolean){let o=this._getOrReturnCtx(e);return J(o,{code:H.invalid_type,expected:$.boolean,received:o.parsedType}),_e}return rt(e.data)}};hr.create=t=>new hr({typeName:xe.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...we(t)});var pr=class t extends Me{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==$.date){let n=this._getOrReturnCtx(e);return J(n,{code:H.invalid_type,expected:$.date,received:n.parsedType}),_e}if(isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return J(n,{code:H.invalid_date}),_e}let o=new Qe,i;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(i=this._getOrReturnCtx(e,i),J(i,{code:H.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),J(i,{code:H.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),o.dirty()):Oe.assertNever(n);return{status:o.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:fe.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:fe.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}};pr.create=t=>new pr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:xe.ZodDate,...we(t)});var Vr=class extends Me{_parse(e){if(this._getType(e)!==$.symbol){let o=this._getOrReturnCtx(e);return J(o,{code:H.invalid_type,expected:$.symbol,received:o.parsedType}),_e}return rt(e.data)}};Vr.create=t=>new Vr({typeName:xe.ZodSymbol,...we(t)});var mr=class extends Me{_parse(e){if(this._getType(e)!==$.undefined){let o=this._getOrReturnCtx(e);return J(o,{code:H.invalid_type,expected:$.undefined,received:o.parsedType}),_e}return rt(e.data)}};mr.create=t=>new mr({typeName:xe.ZodUndefined,...we(t)});var gr=class extends Me{_parse(e){if(this._getType(e)!==$.null){let o=this._getOrReturnCtx(e);return J(o,{code:H.invalid_type,expected:$.null,received:o.parsedType}),_e}return rt(e.data)}};gr.create=t=>new gr({typeName:xe.ZodNull,...we(t)});var Qt=class extends Me{constructor(){super(...arguments),this._any=!0}_parse(e){return rt(e.data)}};Qt.create=t=>new Qt({typeName:xe.ZodAny,...we(t)});var Gt=class extends Me{constructor(){super(...arguments),this._unknown=!0}_parse(e){return rt(e.data)}};Gt.create=t=>new Gt({typeName:xe.ZodUnknown,...we(t)});var Tt=class extends Me{_parse(e){let r=this._getOrReturnCtx(e);return J(r,{code:H.invalid_type,expected:$.never,received:r.parsedType}),_e}};Tt.create=t=>new Tt({typeName:xe.ZodNever,...we(t)});var Wr=class extends Me{_parse(e){if(this._getType(e)!==$.undefined){let o=this._getOrReturnCtx(e);return J(o,{code:H.invalid_type,expected:$.void,received:o.parsedType}),_e}return rt(e.data)}};Wr.create=t=>new Wr({typeName:xe.ZodVoid,...we(t)});var Ft=class t extends Me{_parse(e){let{ctx:r,status:o}=this._processInputParams(e),i=this._def;if(r.parsedType!==$.array)return J(r,{code:H.invalid_type,expected:$.array,received:r.parsedType}),_e;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(a||s)&&(J(r,{code:a?H.too_big:H.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&&(J(r,{code:H.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&&(J(r,{code:H.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 mt(r,a,r.path,s)))).then(a=>Qe.mergeArray(o,a));let n=[...r.data].map((a,s)=>i.type._parseSync(new mt(r,a,r.path,s)));return Qe.mergeArray(o,n)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:fe.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:fe.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:fe.toString(r)}})}nonempty(e){return this.min(1,e)}};Ft.create=(t,e)=>new Ft({type:t,minLength:null,maxLength:null,exactLength:null,typeName:xe.ZodArray,...we(e)});function Nr(t){if(t instanceof lt){let e={};for(let r in t.shape){let o=t.shape[r];e[r]=pt.create(Nr(o))}return new lt({...t._def,shape:()=>e})}else return t instanceof Ft?new Ft({...t._def,type:Nr(t.element)}):t instanceof pt?pt.create(Nr(t.unwrap())):t instanceof Et?Et.create(Nr(t.unwrap())):t instanceof Dt?Dt.create(t.items.map(e=>Nr(e))):t}var lt=class t extends Me{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=Oe.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==$.object){let u=this._getOrReturnCtx(e);return J(u,{code:H.invalid_type,expected:$.object,received:u.parsedType}),_e}let{status:o,ctx:i}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Tt&&this._def.unknownKeys==="strip"))for(let u in i.data)a.includes(u)||s.push(u);let l=[];for(let u of a){let c=n[u],f=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new mt(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Tt){let u=this._def.unknownKeys;if(u==="passthrough")for(let c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(J(i,{code:H.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 c of s){let f=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new mt(i,f,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let c of l){let f=await c.key,d=await c.value;u.push({key:f,value:d,alwaysSet:c.alwaysSet})}return u}).then(u=>Qe.mergeObjectSync(o,u)):Qe.mergeObjectSync(o,l)}get shape(){return this._def.shape()}strict(e){return fe.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(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=fe.errToObj(e).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:xe.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Oe.objectKeys(e).forEach(o=>{e[o]&&this.shape[o]&&(r[o]=this.shape[o])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Oe.objectKeys(this.shape).forEach(o=>{e[o]||(r[o]=this.shape[o])}),new t({...this._def,shape:()=>r})}deepPartial(){return Nr(this)}partial(e){let r={};return Oe.objectKeys(this.shape).forEach(o=>{let i=this.shape[o];e&&!e[o]?r[o]=i:r[o]=i.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return Oe.objectKeys(this.shape).forEach(o=>{if(e&&!e[o])r[o]=this.shape[o];else{let n=this.shape[o];for(;n instanceof pt;)n=n._def.innerType;r[o]=n}}),new t({...this._def,shape:()=>r})}keyof(){return hs(Oe.objectKeys(this.shape))}};lt.create=(t,e)=>new lt({shape:()=>t,unknownKeys:"strip",catchall:Tt.create(),typeName:xe.ZodObject,...we(e)});lt.strictCreate=(t,e)=>new lt({shape:()=>t,unknownKeys:"strict",catchall:Tt.create(),typeName:xe.ZodObject,...we(e)});lt.lazycreate=(t,e)=>new lt({shape:t,unknownKeys:"strip",catchall:Tt.create(),typeName:xe.ZodObject,...we(e)});var vr=class extends Me{_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 ft(s.ctx.common.issues));return J(r,{code:H.invalid_union,unionErrors:a}),_e}if(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},c=l._parseSync({data:r.data,path:r.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!n&&(n={result:c,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 ft(l));return J(r,{code:H.invalid_union,unionErrors:s}),_e}}get options(){return this._def.options}};vr.create=(t,e)=>new vr({options:t,typeName:xe.ZodUnion,...we(e)});var Lt=t=>t instanceof br?Lt(t.schema):t instanceof dt?Lt(t.innerType()):t instanceof xr?[t.value]:t instanceof _r?t.options:t instanceof Tr?Oe.objectValues(t.enum):t instanceof Sr?Lt(t._def.innerType):t instanceof mr?[void 0]:t instanceof gr?[null]:t instanceof pt?[void 0,...Lt(t.unwrap())]:t instanceof Et?[null,...Lt(t.unwrap())]:t instanceof Mn||t instanceof wr?Lt(t.unwrap()):t instanceof kr?Lt(t._def.innerType):[],pi=class t extends Me{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==$.object)return J(r,{code:H.invalid_type,expected:$.object,received:r.parsedType}),_e;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}):(J(r,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),_e)}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=Lt(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 t({typeName:xe.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...we(o)})}};function _o(t,e){let r=Jt(t),o=Jt(e);if(t===e)return{valid:!0,data:t};if(r===$.object&&o===$.object){let i=Oe.objectKeys(e),n=Oe.objectKeys(t).filter(s=>i.indexOf(s)!==-1),a={...t,...e};for(let s of n){let l=_o(t[s],e[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(r===$.array&&o===$.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=_o(a,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===$.date&&o===$.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var yr=class extends Me{_parse(e){let{status:r,ctx:o}=this._processInputParams(e),i=(n,a)=>{if(bo(n)||bo(a))return _e;let s=_o(n.value,a.value);return s.valid?((xo(n)||xo(a))&&r.dirty(),{status:r.value,value:s.data}):(J(o,{code:H.invalid_intersection_types}),_e)};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}))}};yr.create=(t,e,r)=>new yr({left:t,right:e,typeName:xe.ZodIntersection,...we(r)});var Dt=class t extends Me{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==$.array)return J(o,{code:H.invalid_type,expected:$.array,received:o.parsedType}),_e;if(o.data.length<this._def.items.length)return J(o,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_e;!this._def.rest&&o.data.length>this._def.items.length&&(J(o,{code:H.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 mt(o,a,o.path,s)):null}).filter(a=>!!a);return o.common.async?Promise.all(n).then(a=>Qe.mergeArray(r,a)):Qe.mergeArray(r,n)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Dt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:t,typeName:xe.ZodTuple,rest:null,...we(e)})};var mi=class t extends Me{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!==$.object)return J(o,{code:H.invalid_type,expected:$.object,received:o.parsedType}),_e;let i=[],n=this._def.keyType,a=this._def.valueType;for(let s in o.data)i.push({key:n._parse(new mt(o,s,o.path,s)),value:a._parse(new mt(o,o.data[s],o.path,s)),alwaysSet:s in o.data});return o.common.async?Qe.mergeObjectAsync(r,i):Qe.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,o){return r instanceof Me?new t({keyType:e,valueType:r,typeName:xe.ZodRecord,...we(o)}):new t({keyType:qt.create(),valueType:e,typeName:xe.ZodRecord,...we(r)})}},Hr=class extends Me{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!==$.map)return J(o,{code:H.invalid_type,expected:$.map,received:o.parsedType}),_e;let i=this._def.keyType,n=this._def.valueType,a=[...o.data.entries()].map(([s,l],u)=>({key:i._parse(new mt(o,s,o.path,[u,"key"])),value:n._parse(new mt(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,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return _e;(u.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(u.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of a){let u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return _e;(u.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(u.value,c.value)}return{status:r.value,value:s}}}};Hr.create=(t,e,r)=>new Hr({valueType:e,keyType:t,typeName:xe.ZodMap,...we(r)});var Zr=class t extends Me{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==$.set)return J(o,{code:H.invalid_type,expected:$.set,received:o.parsedType}),_e;let i=this._def;i.minSize!==null&&o.data.size<i.minSize.value&&(J(o,{code:H.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&&(J(o,{code:H.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 c of l){if(c.status==="aborted")return _e;c.status==="dirty"&&r.dirty(),u.add(c.value)}return{status:r.value,value:u}}let s=[...o.data.values()].map((l,u)=>n._parse(new mt(o,l,o.path,u)));return o.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:fe.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:fe.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Zr.create=(t,e)=>new Zr({valueType:t,minSize:null,maxSize:null,typeName:xe.ZodSet,...we(e)});var gi=class t extends Me{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==$.function)return J(r,{code:H.invalid_type,expected:$.function,received:r.parsedType}),_e;function o(s,l){return di({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,fi(),zr].filter(u=>!!u),issueData:{code:H.invalid_arguments,argumentsError:l}})}function i(s,l){return di({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,fi(),zr].filter(u=>!!u),issueData:{code:H.invalid_return_type,returnTypeError:l}})}let n={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof $t){let s=this;return rt(async function(...l){let u=new ft([]),c=await s._def.args.parseAsync(l,n).catch(h=>{throw u.addIssue(o(l,h)),u}),f=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(f,n).catch(h=>{throw u.addIssue(i(f,h)),u})})}else{let s=this;return rt(function(...l){let u=s._def.args.safeParse(l,n);if(!u.success)throw new ft([o(l,u.error)]);let c=Reflect.apply(a,this,u.data),f=s._def.returns.safeParse(c,n);if(!f.success)throw new ft([i(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Dt.create(e).rest(Gt.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,o){return new t({args:e||Dt.create([]).rest(Gt.create()),returns:r||Gt.create(),typeName:xe.ZodFunction,...we(o)})}},br=class extends Me{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})}};br.create=(t,e)=>new br({getter:t,typeName:xe.ZodLazy,...we(e)});var xr=class extends Me{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return J(r,{received:r.data,code:H.invalid_literal,expected:this._def.value}),_e}return{status:"valid",value:e.data}}get value(){return this._def.value}};xr.create=(t,e)=>new xr({value:t,typeName:xe.ZodLiteral,...we(e)});function hs(t,e){return new _r({values:t,typeName:xe.ZodEnum,...we(e)})}var _r=class t extends Me{constructor(){super(...arguments),Tn.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),o=this._def.values;return J(r,{expected:Oe.joinValues(o),received:r.parsedType,code:H.invalid_type}),_e}if(hi(this,Tn,"f")||us(this,Tn,new Set(this._def.values),"f"),!hi(this,Tn,"f").has(e.data)){let r=this._getOrReturnCtx(e),o=this._def.values;return J(r,{received:r.data,code:H.invalid_enum_value,options:o}),_e}return rt(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 t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(o=>!e.includes(o)),{...this._def,...r})}};Tn=new WeakMap;_r.create=hs;var Tr=class extends Me{constructor(){super(...arguments),Sn.set(this,void 0)}_parse(e){let r=Oe.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(e);if(o.parsedType!==$.string&&o.parsedType!==$.number){let i=Oe.objectValues(r);return J(o,{expected:Oe.joinValues(i),received:o.parsedType,code:H.invalid_type}),_e}if(hi(this,Sn,"f")||us(this,Sn,new Set(Oe.getValidEnumValues(this._def.values)),"f"),!hi(this,Sn,"f").has(e.data)){let i=Oe.objectValues(r);return J(o,{received:o.data,code:H.invalid_enum_value,options:i}),_e}return rt(e.data)}get enum(){return this._def.values}};Sn=new WeakMap;Tr.create=(t,e)=>new Tr({values:t,typeName:xe.ZodNativeEnum,...we(e)});var $t=class extends Me{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==$.promise&&r.common.async===!1)return J(r,{code:H.invalid_type,expected:$.promise,received:r.parsedType}),_e;let o=r.parsedType===$.promise?r.data:Promise.resolve(r.data);return rt(o.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$t.create=(t,e)=>new $t({type:t,typeName:xe.ZodPromise,...we(e)});var dt=class extends Me{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xe.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:a=>{J(o,a),a.fatal?r.abort():r.dirty()},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 _e;let l=await this._def.schema._parseAsync({data:s,path:o.path,parent:o});return l.status==="aborted"?_e:l.status==="dirty"||r.value==="dirty"?jr(l.value):l});{if(r.value==="aborted")return _e;let s=this._def.schema._parseSync({data:a,path:o.path,parent:o});return s.status==="aborted"?_e:s.status==="dirty"||r.value==="dirty"?jr(s.value):s}}if(i.type==="refinement"){let a=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};if(o.common.async===!1){let s=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return s.status==="aborted"?_e:(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"?_e:(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(!kn(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=>kn(a)?Promise.resolve(i.transform(a.value,n)).then(s=>({status:r.value,value:s})):a);Oe.assertNever(i)}};dt.create=(t,e,r)=>new dt({schema:t,typeName:xe.ZodEffects,effect:e,...we(r)});dt.createWithPreprocess=(t,e,r)=>new dt({schema:e,effect:{type:"preprocess",transform:t},typeName:xe.ZodEffects,...we(r)});var pt=class extends Me{_parse(e){return this._getType(e)===$.undefined?rt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pt.create=(t,e)=>new pt({innerType:t,typeName:xe.ZodOptional,...we(e)});var Et=class extends Me{_parse(e){return this._getType(e)===$.null?rt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Et.create=(t,e)=>new Et({innerType:t,typeName:xe.ZodNullable,...we(e)});var Sr=class extends Me{_parse(e){let{ctx:r}=this._processInputParams(e),o=r.data;return r.parsedType===$.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Sr.create=(t,e)=>new Sr({innerType:t,typeName:xe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...we(e)});var kr=class extends Me{_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 wn(i)?i.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ft(o.common.issues)},input:o.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ft(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}};kr.create=(t,e)=>new kr({innerType:t,typeName:xe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...we(e)});var Yr=class extends Me{_parse(e){if(this._getType(e)!==$.nan){let o=this._getOrReturnCtx(e);return J(o,{code:H.invalid_type,expected:$.nan,received:o.parsedType}),_e}return{status:"valid",value:e.data}}};Yr.create=t=>new Yr({typeName:xe.ZodNaN,...we(t)});var ju=Symbol("zod_brand"),Mn=class extends Me{_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}},Cn=class t extends Me{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return n.status==="aborted"?_e:n.status==="dirty"?(r.dirty(),jr(n.value)):this._def.out._parseAsync({data:n.value,path:o.path,parent:o})})();{let i=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return i.status==="aborted"?_e: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 t({in:e,out:r,typeName:xe.ZodPipeline})}},wr=class extends Me{_parse(e){let r=this._def.innerType._parse(e),o=i=>(kn(i)&&(i.value=Object.freeze(i.value)),i);return wn(r)?r.then(i=>o(i)):o(r)}unwrap(){return this._def.innerType}};wr.create=(t,e)=>new wr({innerType:t,typeName:xe.ZodReadonly,...we(e)});function ps(t,e={},r){return t?Qt.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})}}):Qt.create()}var zu={object:lt.lazycreate},xe;(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"})(xe||(xe={}));var Vu=(t,e={message:"Input not instance of ".concat(t.name)})=>ps(r=>r instanceof t,e),ms=qt.create,gs=fr.create,Wu=Yr.create,Hu=dr.create,vs=hr.create,Zu=pr.create,Yu=Vr.create,Xu=mr.create,Ku=gr.create,Ju=Qt.create,qu=Gt.create,Qu=Tt.create,$u=Wr.create,ec=Ft.create,tc=lt.create,rc=lt.strictCreate,nc=vr.create,ic=pi.create,oc=yr.create,ac=Dt.create,sc=mi.create,lc=Hr.create,uc=Zr.create,cc=gi.create,fc=br.create,dc=xr.create,hc=_r.create,pc=Tr.create,mc=$t.create,ss=dt.create,gc=pt.create,vc=Et.create,yc=dt.createWithPreprocess,bc=Cn.create,xc=()=>ms().optional(),_c=()=>gs().optional(),Tc=()=>vs().optional(),Sc={string:t=>qt.create({...t,coerce:!0}),number:t=>fr.create({...t,coerce:!0}),boolean:t=>hr.create({...t,coerce:!0}),bigint:t=>dr.create({...t,coerce:!0}),date:t=>pr.create({...t,coerce:!0})},kc=_e,K=Object.freeze({__proto__:null,defaultErrorMap:zr,setErrorMap:ku,getErrorMap:fi,makeIssue:di,EMPTY_PATH:wu,addIssueToContext:J,ParseStatus:Qe,INVALID:_e,DIRTY:jr,OK:rt,isAborted:bo,isDirty:xo,isValid:kn,isAsync:wn,get util(){return Oe},get objectUtil(){return yo},ZodParsedType:$,getParsedType:Jt,ZodType:Me,datetimeRegex:ds,ZodString:qt,ZodNumber:fr,ZodBigInt:dr,ZodBoolean:hr,ZodDate:pr,ZodSymbol:Vr,ZodUndefined:mr,ZodNull:gr,ZodAny:Qt,ZodUnknown:Gt,ZodNever:Tt,ZodVoid:Wr,ZodArray:Ft,ZodObject:lt,ZodUnion:vr,ZodDiscriminatedUnion:pi,ZodIntersection:yr,ZodTuple:Dt,ZodRecord:mi,ZodMap:Hr,ZodSet:Zr,ZodFunction:gi,ZodLazy:br,ZodLiteral:xr,ZodEnum:_r,ZodNativeEnum:Tr,ZodPromise:$t,ZodEffects:dt,ZodTransformer:dt,ZodOptional:pt,ZodNullable:Et,ZodDefault:Sr,ZodCatch:kr,ZodNaN:Yr,BRAND:ju,ZodBranded:Mn,ZodPipeline:Cn,ZodReadonly:wr,custom:ps,Schema:Me,ZodSchema:Me,late:zu,get ZodFirstPartyTypeKind(){return xe},coerce:Sc,any:Ju,array:ec,bigint:Hu,boolean:vs,date:Zu,discriminatedUnion:ic,effect:ss,enum:hc,function:cc,instanceof:Vu,intersection:oc,lazy:fc,literal:dc,map:lc,nan:Wu,nativeEnum:pc,never:Qu,null:Ku,nullable:vc,number:gs,object:tc,oboolean:Tc,onumber:_c,optional:gc,ostring:xc,pipeline:bc,preprocess:yc,promise:mc,record:sc,set:uc,strictObject:rc,string:ms,symbol:Yu,transformer:ss,tuple:ac,undefined:Xu,union:nc,unknown:qu,void:$u,NEVER:kc,ZodIssueCode:H,quotelessJson:Su,ZodError:ft});O();function wi(t){return(t%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}O();O();var er=class extends Ct{},zt=class{constructor(e,r,o=0){m(this,"id");m(this,"verticalOffset");m(this,"positionDirty",!0);m(this,"occluderId");m(this,"object3d",new er);m(this,"components");m(this,"disposed",!1);m(this,"worldPosition",new Be);this.id=e.id||tt(),this.components=[e],this.verticalOffset=o,this.object3d=new er,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}};O();O();O();O();O();O();O();var nt=63710088e-1,Js={centimeters:nt*100,centimetres:nt*100,degrees:nt/111325,feet:nt*3.28084,inches:nt*39.37,kilometers:nt/1e3,kilometres:nt/1e3,meters:nt,metres:nt,miles:nt/1609.344,millimeters:nt*1e3,millimetres:nt*1e3,nauticalmiles:nt/1852,radians:1,yards:nt*1.0936},km={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/nt,yards:1.0936133};function tr(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}function vd(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(!Ks(t[0])||!Ks(t[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:t};return tr(o,e,r)}function wm(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 tr(s,e,r)}function qs(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 tr(o,e,r)}function Mm(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}function Cm(t,e,r){r===void 0&&(r={});var o={type:"MultiLineString",coordinates:t};return tr(o,e,r)}function Dm(t,e,r){r===void 0&&(r={});var o={type:"MultiPolygon",coordinates:t};return tr(o,e,r)}function Em(t,e){e===void 0&&(e="kilometers");var r=Js[e];if(!r)throw new Error(e+" units is invalid");return t*r}function Am(t,e){e===void 0&&(e="kilometers");var r=Js[e];if(!r)throw new Error(e+" units is invalid");return t/r}function Im(t){var e=t%(2*Math.PI);return e*180/Math.PI}function Om(t){var e=t%360;return e*Math.PI/180}function Ks(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function Mi(t,e,r){if(t!==null)for(var o,i,n,a,s,l,u,c=0,f=0,d,h=t.type,g=h==="FeatureCollection",p=h==="Feature",y=g?t.features.length:1,E=0;E<y;E++){u=g?t.features[E].geometry:p?t.geometry:t,d=u?u.type==="GeometryCollection":!1,s=d?u.geometries.length:1;for(var k=0;k<s;k++){var b=0,_=0;if(a=d?u.geometries[k]:u,a!==null){l=a.coordinates;var w=a.type;switch(c=r&&(w==="Polygon"||w==="MultiPolygon")?1:0,w){case null:break;case"Point":if(e(l,f,E,b,_)===!1)return!1;f++,b++;break;case"LineString":case"MultiPoint":for(o=0;o<l.length;o++){if(e(l[o],f,E,b,_)===!1)return!1;f++,w==="MultiPoint"&&b++}w==="LineString"&&b++;break;case"Polygon":case"MultiLineString":for(o=0;o<l.length;o++){for(i=0;i<l[o].length-c;i++){if(e(l[o][i],f,E,b,_)===!1)return!1;f++}w==="MultiLineString"&&b++,w==="Polygon"&&_++}w==="Polygon"&&b++;break;case"MultiPolygon":for(o=0;o<l.length;o++){for(_=0,i=0;i<l[o].length;i++){for(n=0;n<l[o][i].length-c;n++){if(e(l[o][i][n],f,E,b,_)===!1)return!1;f++}_++}b++}break;case"GeometryCollection":for(o=0;o<a.geometries.length;o++)if(Mi(a.geometries[o],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Gm(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++);}function yd(t,e){var r,o,i,n,a,s,l,u,c,f,d=0,h=t.type==="FeatureCollection",g=t.type==="Feature",p=h?t.features.length:1;for(r=0;r<p;r++){for(s=h?t.features[r].geometry:g?t.geometry:t,u=h?t.features[r].properties:g?t.properties:{},c=h?t.features[r].bbox:g?t.bbox:void 0,f=h?t.features[r].id:g?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,d,u,c,f)===!1)return!1;continue}switch(n.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(n,d,u,c,f)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<n.geometries.length;o++)if(e(n.geometries[o],d,u,c,f)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}d++}}function bd(t,e){yd(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(tr(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 c=r.coordinates[u],f={type:l,coordinates:c};if(e(tr(f,i),o,u)===!1)return!1}})}function xd(t,e){bd(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,c=0;if(Mi(r,function(f,d,h,g,p){if(s===void 0||o>l||g>u||p>c){s=f,l=o,u=g,c=p,n=0;return}var y=qs([s,f],r.properties);if(e(y,o,i,p,n)===!1)return!1;n++,s=f})===!1)return!1}}})}function Fm(t,e,r){var o=r,i=!1;return xd(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}function Po(t){var e=[1/0,1/0,-1/0,-1/0];return Mi(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}Po.default=Po;var Qs=Po;function $s(t){return Qs(t)}O();var Ro="#ffffff";var Uo=class{constructor(e={}){m(this,"initialColor",Ro);m(this,"color",Ro);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}};var rr=class extends Va{constructor(){super(...arguments);m(this,"type","entityBatchedMesh");m(this,"userData",{entities:{}})}},Pn,Rn,Dr,At=class{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 st);m(this,"topColor",new st);m(this,"position",new Be);ct(this,Pn,0);ct(this,Rn,1);ct(this,Dr);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 Le(this,Pn)}set altitude(e){this.mesh&&(this.mesh.position.z=e,Ke(this,Pn,e))}get opacity(){return Le(this,Rn)}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}Ke(this,Rn,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 Le(this,Dr)?Le(this,Dr):(Ke(this,Dr,$s(this.feature)),Le(this,Dr))}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)}};Pn=new WeakMap,Rn=new WeakMap,Dr=new WeakMap;O();var el="#ffffff",nr,Ci=class{constructor(e={}){m(this,"color",el);m(this,"initialColor",el);m(this,"topColor");m(this,"initialTopColor");m(this,"opacity",1);m(this,"height");ct(this,nr);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 Le(this,nr)}set shading(e){var r;if(!e){Ke(this,nr,void 0);return}Ke(this,nr,(r=Le(this,nr))!=null?r:{start:0,end:0,intensity:0}),Object.assign(Le(this,nr),e)}};nr=new WeakMap;O();O();function qr(t){var r;let e=(r=t.parent)==null?void 0:r.children.find(o=>o.userData.outlineOfEntityId===t.userData.entityId);return e instanceof li?e:void 0}O();O();O();O();var Qr=class{constructor(){m(this,"hover",!1);m(this,"dirty",!1)}};O();O();function Di(t){"@babel/helpers - typeof";return Di=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},Di(t)}var Td=/^\s+/,Sd=/\s+$/;function ae(t,e){if(t=t||"",e=e||{},t instanceof ae)return t;if(!(this instanceof ae))return new ae(t,e);var r=kd(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}ae.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance: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},setAlpha:function(e){return this._a=sl(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=rl(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=rl(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+")"},toHsl:function(){var e=tl(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=tl(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+")"},toHex:function(e){return nl(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return Dd(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(He(this._r,255)*100)+"%",g:Math.round(He(this._g,255)*100)+"%",b:Math.round(He(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(He(this._r,255)*100)+"%, "+Math.round(He(this._g,255)*100)+"%, "+Math.round(He(this._b,255)*100)+"%)":"rgba("+Math.round(He(this._r,255)*100)+"%, "+Math.round(He(this._g,255)*100)+"%, "+Math.round(He(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Nd[nl(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var r="#"+il(this._r,this._g,this._b,this._a),o=r,i=this._gradientType?"GradientType = 1, ":"";if(e){var n=ae(e);o="#"+il(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+o+")"},toString: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())},clone:function(){return ae(this.toString())},_applyModification: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},lighten:function(){return this._applyModification(Od,arguments)},brighten:function(){return this._applyModification(Pd,arguments)},darken:function(){return this._applyModification(Rd,arguments)},desaturate:function(){return this._applyModification(Ed,arguments)},saturate:function(){return this._applyModification(Ad,arguments)},greyscale:function(){return this._applyModification(Id,arguments)},spin:function(){return this._applyModification(Ud,arguments)},_applyCombination:function(e,r){return e.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(Fd,arguments)},complement:function(){return this._applyCombination(Ld,arguments)},monochromatic:function(){return this._applyCombination(Bd,arguments)},splitcomplement:function(){return this._applyCombination(Gd,arguments)},triad:function(){return this._applyCombination(ol,[3])},tetrad:function(){return this._applyCombination(ol,[4])}};ae.fromRatio=function(t,e){if(Di(t)=="object"){var r={};for(var o in t)t.hasOwnProperty(o)&&(o==="a"?r[o]=t[o]:r[o]=Un(t[o]));t=r}return ae(t,e)};function kd(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=Wd(t)),Di(t)=="object"&&(Vt(t.r)&&Vt(t.g)&&Vt(t.b)?(e=wd(t.r,t.g,t.b),a=!0,s=String(t.r).substr(-1)==="%"?"prgb":"rgb"):Vt(t.h)&&Vt(t.s)&&Vt(t.v)?(o=Un(t.s),i=Un(t.v),e=Cd(t.h,o,i),a=!0,s="hsv"):Vt(t.h)&&Vt(t.s)&&Vt(t.l)&&(o=Un(t.s),n=Un(t.l),e=Md(t.h,o,n),a=!0,s="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=sl(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}}function wd(t,e,r){return{r:He(t,255)*255,g:He(e,255)*255,b:He(r,255)*255}}function tl(t,e,r){t=He(t,255),e=He(e,255),r=He(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}}function Md(t,e,r){var o,i,n;t=He(t,360),e=He(e,100),r=He(r,100);function a(u,c,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?u+(c-u)*6*f:f<1/2?c:f<2/3?u+(c-u)*(2/3-f)*6:u}if(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}}function rl(t,e,r){t=He(t,255),e=He(e,255),r=He(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}}function Cd(t,e,r){t=He(t,360)*6,e=He(e,100),r=He(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],c=[s,r,r,a,n,n][l],f=[n,n,s,r,r,a][l];return{r:u*255,g:c*255,b:f*255}}function nl(t,e,r,o){var i=[kt(Math.round(t).toString(16)),kt(Math.round(e).toString(16)),kt(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("")}function Dd(t,e,r,o,i){var n=[kt(Math.round(t).toString(16)),kt(Math.round(e).toString(16)),kt(Math.round(r).toString(16)),kt(ll(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("")}function il(t,e,r,o){var i=[kt(ll(o)),kt(Math.round(t).toString(16)),kt(Math.round(e).toString(16)),kt(Math.round(r).toString(16))];return i.join("")}ae.equals=function(t,e){return!t||!e?!1:ae(t).toRgbString()==ae(e).toRgbString()};ae.random=function(){return ae.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Ed(t,e){e=e===0?0:e||10;var r=ae(t).toHsl();return r.s-=e/100,r.s=Ei(r.s),ae(r)}function Ad(t,e){e=e===0?0:e||10;var r=ae(t).toHsl();return r.s+=e/100,r.s=Ei(r.s),ae(r)}function Id(t){return ae(t).desaturate(100)}function Od(t,e){e=e===0?0:e||10;var r=ae(t).toHsl();return r.l+=e/100,r.l=Ei(r.l),ae(r)}function Pd(t,e){e=e===0?0:e||10;var r=ae(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)))),ae(r)}function Rd(t,e){e=e===0?0:e||10;var r=ae(t).toHsl();return r.l-=e/100,r.l=Ei(r.l),ae(r)}function Ud(t,e){var r=ae(t).toHsl(),o=(r.h+e)%360;return r.h=o<0?360+o:o,ae(r)}function Ld(t){var e=ae(t).toHsl();return e.h=(e.h+180)%360,ae(e)}function ol(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var r=ae(t).toHsl(),o=[ae(t)],i=360/e,n=1;n<e;n++)o.push(ae({h:(r.h+n*i)%360,s:r.s,l:r.l}));return o}function Gd(t){var e=ae(t).toHsl(),r=e.h;return[ae(t),ae({h:(r+72)%360,s:e.s,l:e.l}),ae({h:(r+216)%360,s:e.s,l:e.l})]}function Fd(t,e,r){e=e||6,r=r||30;var o=ae(t).toHsl(),i=360/r,n=[ae(t)];for(o.h=(o.h-(i*e>>1)+720)%360;--e;)o.h=(o.h+i)%360,n.push(ae(o));return n}function Bd(t,e){e=e||6;for(var r=ae(t).toHsv(),o=r.h,i=r.s,n=r.v,a=[],s=1/e;e--;)a.push(ae({h:o,s:i,v:n})),n=(n+s)%1;return a}ae.mix=function(t,e,r){r=r===0?0:r||50;var o=ae(t).toRgb(),i=ae(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 ae(a)};ae.readability=function(t,e){var r=ae(t),o=ae(e);return(Math.max(r.getLuminance(),o.getLuminance())+.05)/(Math.min(r.getLuminance(),o.getLuminance())+.05)};ae.isReadable=function(t,e,r){var o=ae.readability(t,e),i,n;switch(n=!1,i=Hd(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};ae.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=ae.readability(t,e[u]),n>i&&(i=n,o=ae(e[u]));return ae.isReadable(t,o,{level:s,size:l})||!a?o:(r.includeFallbackColors=!1,ae.mostReadable(t,["#fff","#000"],r))};var Lo=ae.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"},Nd=ae.hexNames=jd(Lo);function jd(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function sl(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function He(t,e){zd(t)&&(t="100%");var r=Vd(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)}function Ei(t){return Math.min(1,Math.max(0,t))}function ht(t){return parseInt(t,16)}function zd(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function Vd(t){return typeof t=="string"&&t.indexOf("%")!=-1}function kt(t){return t.length==1?"0"+t:""+t}function Un(t){return t<=1&&(t=t*100+"%"),t}function ll(t){return Math.round(parseFloat(t)*255).toString(16)}function al(t){return ht(t)/255}var St=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 Vt(t){return!!St.CSS_UNIT.exec(t)}function Wd(t){t=t.replace(Td,"").replace(Sd,"").toLowerCase();var e=!1;if(Lo[t])t=Lo[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=St.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=St.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=St.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=St.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=St.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=St.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=St.hex8.exec(t))?{r:ht(r[1]),g:ht(r[2]),b:ht(r[3]),a:al(r[4]),format:e?"name":"hex8"}:(r=St.hex6.exec(t))?{r:ht(r[1]),g:ht(r[2]),b:ht(r[3]),format:e?"name":"hex"}:(r=St.hex4.exec(t))?{r:ht(r[1]+""+r[1]),g:ht(r[2]+""+r[2]),b:ht(r[3]+""+r[3]),a:al(r[4]+""+r[4]),format:e?"name":"hex8"}:(r=St.hex3.exec(t))?{r:ht(r[1]+""+r[1]),g:ht(r[2]+""+r[2]),b:ht(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function Hd(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}}var Go=gu(Xs());O();var ul=["","","low","medium","high","always-visible"];function cl(t){return Math.min(5,Math.max(2,t))}function $r(t){if(typeof t=="number")return cl(t);let e=ul.indexOf(t);return e===-1?3:e}function hg(t){let e=cl(t);return ul[e]}var Bo=K.object({rank:K.union([K.enum(["low","medium","high","always-visible"]),K.number()]).optional(),interactive:K.boolean().optional(),appearance:K.object({margin:K.number().min(6).optional(),text:K.object({numLines:K.number().optional(),lineHeight:K.number().optional(),size:K.number().optional(),maxWidth:K.number().optional(),foregroundColor:K.string().optional(),backgroundColor:K.string().optional()}).optional(),marker:K.object({size:K.number().optional(),foregroundColor:K.object({active:K.string().optional(),inactive:K.string().optional()}).optional(),backgroundColor:K.object({active:K.string().optional(),inactive:K.string().optional()}).optional()}).optional()}).optional()});function _g(t,e,r){K.array(K.number()).min(2).max(3).parse(t),K.string().parse(e),Bo.parse(r||{})}var en={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}}},Zd={lightOnDark:{...en,text:{...en.text,foregroundColor:"white",backgroundColor:"#333"},marker:{...en.marker,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},darkOnLight:{...en,text:{...en.text,foregroundColor:"#333",backgroundColor:"white"},marker:{...en.marker,foregroundColor:{active:"#333",inactive:void 0},backgroundColor:{active:"white",inactive:void 0}}}},Yd="LOW_PRIORITY",fl=4,Xd=6,Kd=20,Jd=2.5,qd=2,Qd="cover",$d=-1/0,dl=6.5,hl={heightAbovePolygon:0,appearance:Zd.darkOnLight};var tn=class tn{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 bt);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",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});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:tt(),this.options=(0,Go.default)({},r,hl),this.text=e,this.dp=(s=1)=>s*o.pixelRatio,typeof r.rank=="string")this.rank=$r(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(re.env.NODE_ENV==="test"?tn.testId:tn.testId*10)/10;tn.testId+=.001,this.rank=s,this.initialRank=s}let i=(0,Go.default)({},this.options.appearance,hl.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||ae(i.marker.foregroundColor.active).setAlpha(.5).toRgbString()},backgroundColor:{active:i.marker.backgroundColor.active,inactive:i.marker.backgroundColor.inactive||ae(i.marker.backgroundColor.active).setAlpha(.5).toRgbString()},icon:i.marker.icon,iconSize:i.marker.iconSize||Kd,iconPadding:(a=i.marker.iconPadding)!=null?a:qd,iconFit:i.marker.iconFit||Qd,iconOverflow:i.marker.iconOverflow||"hidden",iconVisibleAtZoomLevel:i.marker.iconVisibleAtZoomLevel==null?$d: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(dl),this.totalMarkerSize=Math.ceil((this.markerSize+Jd)/e)}get lowPriorityStrategyIndex(){return this.text===""?-1:3}get strategies(){let{width:e,height:r}=this.dimensions,{margin:o}=this.appearance,i=Math.max(Xd,o),n=this.iconVisible?i/2:0,a=this.iconVisible?this.totalMarkerSize:dl,s=[{name:"RIGHT",getBoundingBox:()=>{let l=Math.max(this.totalMarkerSize,r);return[l/2+i,l/2+i,this.totalMarkerSize/2+i,this.totalMarkerSize/2+e+i]},onStrategySelected:()=>{this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=this.totalMarkerSize/2+fl,this.newStyle.textLabelVisible=!0}},{name:"LEFT",getBoundingBox:()=>{let l=Math.max(this.totalMarkerSize,r);return[l/2+i,l/2+i,this.totalMarkerSize/2+e+i,this.totalMarkerSize/2+i]},onStrategySelected:()=>{this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=-e-this.totalMarkerSize/2-fl,this.newStyle.textLabelVisible=!0}},{name:"TOP",getBoundingBox:()=>{let l=this.dp();return[r+this.totalMarkerSize/2/l+i,this.totalMarkerSize/2+i,e/2+i,e/2+i]},onStrategySelected:()=>{this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r-this.totalMarkerSize/2,this.newStyle.left=-e/2}},{name:Yd,getBoundingBox:()=>[a/2+n,a/2+n,a/2+n,a/2+n],onStrategySelected:()=>{this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0}}];return this.text===""?[{name:"ICON_ONLY",getBoundingBox:()=>[this.totalMarkerSize/2+i,this.totalMarkerSize/2+i,this.totalMarkerSize/2+i,this.totalMarkerSize/2+i],onStrategySelected:()=>{this.newStyle.pinVisibility=1,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0}}]: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(){}};m(tn,"testId",0);var Fo=tn,pl=Fo;O();var Ai=4,No=K.object({rank:K.union([K.enum(["low","medium","high","always-visible"]),K.number()]).optional(),interactive:K.union([K.boolean(),K.literal("pointer-events-auto")]).optional(),id:K.string().optional(),anchor:K.union([K.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]),K.array(K.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]))]).optional(),dynamicResize:K.boolean().optional(),zIndex:K.number().optional()});function Og(t,e,r){K.array(K.number()).min(2).max(3).parse(t),K.string().parse(e),No.parse(r)}var rn=class rn{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 bt);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",(e,r=!1)=>{if(this.currentStrategyIndex===e||r)return;this.currentStrategyIndex=e,this.activeAnchor=this.strategies[e].name,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});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)||tt(),this.options={...this.options,...r},typeof r.rank=="string")this.rank=$r(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let i=Math.trunc(re.env.NODE_ENV==="test"?rn.testId:rn.testId*10)/10;rn.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:()=>{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+Ai,a+Ai,s+Ai,l+Ai]}}))}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(){}};m(rn,"testId",0);var ml=rn;O();var ir=class t extends Ct{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});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 t?(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 Ot?(this.childrenIds.add(r.userData.entityId),this.add(r)):r instanceof It&&r.object3d&&(this.childrenIds.add(r.id),this.add(r.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(r){r instanceof t?(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 Ot?(this.childrenIds.delete(r.userData.entityId),this.remove(r)):r instanceof It&&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}};O();O();O();O();O();function eh(){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=function(){});var c=i.getTransferables;if(c===void 0&&(c=null),!t[a])try{l=l.map(function(d){return d&&d.isWorkerModule&&(e(d,function(h){if(h instanceof Error)throw h}),d=t[d.id].value),d}),u=o("<"+s+">.init",u),c&&(c=o("<"+s+">.getTransferables",c));var f=null;typeof u=="function"?f=u.apply(void 0,l):console.error("worker module init function failed to rehydrate"),t[a]={id:a,value:f,getTransferables:c},n(f)}catch(d){d&&d.noLog||console.error(d),n(d)}}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(c,function(f){return n(f instanceof Error?f:new Error(""+f))}):c(u)}catch(f){n(f)}function c(f){try{var d=t[s].getTransferables&&t[s].getTransferables(f);(!d||!Array.isArray(d)||!d.length)&&(d=void 0),n(f,d)}catch(h){console.error(h),n(h)}}}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}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,c){u instanceof Error?postMessage({messageId:a,success:!1,error:u.message}):postMessage({messageId:a,success:!0,result:u},c||void 0)})}catch(u){postMessage({messageId:a,success:!1,error:u.stack})}})}function th(t){var e=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")})};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}var vl=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 re<"u"&&re.env.NODE_ENV==="test"||console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+r.message+"]")}return vl=function(){return t},t},rh=0,nh=0,jo=!1,Ln=Object.create(null),Gn=Object.create(null),zo=Object.create(null);function Er(t){if((!t||typeof t.init!="function")&&!jo)throw new Error("requires `options.init` function");var e=t.dependencies,r=t.init,o=t.getTransferables,i=t.workerId,n=th(t);i==null&&(i="#default");var a="workerModule"+ ++rh,s=t.name||a,l=null;e=e&&e.map(function(c){return typeof c=="function"&&!c.workerModuleData&&(jo=!0,c=Er({workerId:i,name:"<"+s+"> function dependency: "+c.name,init:"function(){return (\n"+Ii(c)+"\n)}"}),jo=!1),c&&c.workerModuleData&&(c=c.workerModuleData),c});function u(){for(var c=[],f=arguments.length;f--;)c[f]=arguments[f];if(!vl())return n.apply(void 0,c);if(!l){l=gl(i,"registerModule",u.workerModuleData);var d=function(){l=null,Gn[i].delete(d)};(Gn[i]||(Gn[i]=new Set)).add(d)}return l.then(function(h){var g=h.isCallable;if(g)return gl(i,"callModule",{id:a,args:c});throw new Error("Worker module function was called but `init` did not return a callable function")})}return u.workerModuleData={isWorkerModule:!0,id:a,name:s,dependencies:e,init:Ii(r),getTransferables:o&&Ii(o)},u.onMainThread=n,u}function yl(t){Gn[t]&&Gn[t].forEach(function(e){e()}),Ln[t]&&(Ln[t].terminate(),delete Ln[t])}function Ii(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function ih(t){var e=Ln[t];if(!e){var r=Ii(eh);e=Ln[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=zo[n];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete zo[n],a(i)}}return e}function gl(t,e,r){return new Promise(function(o,i){var n=++nh;zo[n]=function(a){a.success?o(a.result):i(new Error("Error in worker "+e+" call: "+a.error))},ih(t).postMessage({messageId:n,action:e,data:r})})}O();function Vo(){var t=function(e){function r(B,G,v,S,C,I,M,V){var R=1-M;V.x=R*R*B+2*R*M*v+M*M*C,V.y=R*R*G+2*R*M*S+M*M*I}function o(B,G,v,S,C,I,M,V,R,N){var Q=1-R;N.x=Q*Q*Q*B+3*Q*Q*R*v+3*Q*R*R*C+R*R*R*M,N.y=Q*Q*Q*G+3*Q*Q*R*S+3*Q*R*R*I+R*R*R*V}function i(B,G){for(var v=/([MLQCZ])([^MLQCZ]*)/g,S,C,I,M,V;S=v.exec(B);){var R=S[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(N){return parseFloat(N)});switch(S[1]){case"M":M=C=R[0],V=I=R[1];break;case"L":(R[0]!==M||R[1]!==V)&&G("L",M,V,M=R[0],V=R[1]);break;case"Q":{G("Q",M,V,M=R[2],V=R[3],R[0],R[1]);break}case"C":{G("C",M,V,M=R[4],V=R[5],R[0],R[1],R[2],R[3]);break}case"Z":(M!==C||V!==I)&&G("L",M,V,C,I);break}}}function n(B,G,v){v===void 0&&(v=16);var S={x:0,y:0};i(B,function(C,I,M,V,R,N,Q,se,Y){switch(C){case"L":G(I,M,V,R);break;case"Q":{for(var W=I,Se=M,ve=1;ve<v;ve++)r(I,M,N,Q,V,R,ve/(v-1),S),G(W,Se,S.x,S.y),W=S.x,Se=S.y;break}case"C":{for(var te=I,le=M,he=1;he<v;he++)o(I,M,N,Q,se,Y,V,R,he/(v-1),S),G(te,le,S.x,S.y),te=S.x,le=S.y;break}}})}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 c(B,G){var v=B.getContext?B.getContext("webgl",u):B,S=l.get(v);if(!S){let Q=function(te){var le=I[te];if(!le&&(le=I[te]=v.getExtension(te),!le))throw new Error(te+" not supported");return le},se=function(te,le){var he=v.createShader(le);return v.shaderSource(he,te),v.compileShader(he),he},Y=function(te,le,he,X){if(!M[te]){var ue={},ce={},j=v.createProgram();v.attachShader(j,se(le,v.VERTEX_SHADER)),v.attachShader(j,se(he,v.FRAGMENT_SHADER)),v.linkProgram(j),M[te]={program:j,transaction:function(ie){v.useProgram(j),ie({setUniform:function(ee,Pe){for(var de=[],me=arguments.length-2;me-- >0;)de[me]=arguments[me+2];var be=ce[Pe]||(ce[Pe]=v.getUniformLocation(j,Pe));v["uniform"+ee].apply(v,[be].concat(de))},setAttribute:function(ee,Pe,de,me,be){var Ce=ue[ee];Ce||(Ce=ue[ee]={buf:v.createBuffer(),loc:v.getAttribLocation(j,ee),data:null}),v.bindBuffer(v.ARRAY_BUFFER,Ce.buf),v.vertexAttribPointer(Ce.loc,Pe,v.FLOAT,!1,0,0),v.enableVertexAttribArray(Ce.loc),C?v.vertexAttribDivisor(Ce.loc,me):Q("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Ce.loc,me),be!==Ce.data&&(v.bufferData(v.ARRAY_BUFFER,be,de),Ce.data=be)}})}}}M[te].transaction(X)},W=function(te,le){R++;try{v.activeTexture(v.TEXTURE0+R);var he=V[te];he||(he=V[te]=v.createTexture(),v.bindTexture(v.TEXTURE_2D,he),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,v.NEAREST),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,v.NEAREST)),v.bindTexture(v.TEXTURE_2D,he),le(he,R)}finally{R--}},Se=function(te,le,he){var X=v.createFramebuffer();N.push(X),v.bindFramebuffer(v.FRAMEBUFFER,X),v.activeTexture(v.TEXTURE0+le),v.bindTexture(v.TEXTURE_2D,te),v.framebufferTexture2D(v.FRAMEBUFFER,v.COLOR_ATTACHMENT0,v.TEXTURE_2D,te,0);try{he(X)}finally{v.deleteFramebuffer(X),v.bindFramebuffer(v.FRAMEBUFFER,N[--N.length-1]||null)}},ve=function(){I={},M={},V={},R=-1,N.length=0};var C=typeof WebGL2RenderingContext<"u"&&v instanceof WebGL2RenderingContext,I={},M={},V={},R=-1,N=[];v.canvas.addEventListener("webglcontextlost",function(te){ve(),te.preventDefault()},!1),l.set(v,S={gl:v,isWebGL2:C,getExtension:Q,withProgram:Y,withTexture:W,withTextureFramebuffer:Se,handleContextLoss:ve})}G(S)}function f(B,G,v,S,C,I,M,V){M===void 0&&(M=15),V===void 0&&(V=null),c(B,function(R){var N=R.gl,Q=R.withProgram,se=R.withTexture;se("copy",function(Y,W){N.texImage2D(N.TEXTURE_2D,0,N.RGBA,C,I,0,N.RGBA,N.UNSIGNED_BYTE,G),Q("copy",a,s,function(Se){var ve=Se.setUniform,te=Se.setAttribute;te("aUV",2,N.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),ve("1i","image",W),N.bindFramebuffer(N.FRAMEBUFFER,V||null),N.disable(N.BLEND),N.colorMask(M&8,M&4,M&2,M&1),N.viewport(v,S,C,I),N.scissor(v,S,C,I),N.drawArrays(N.TRIANGLES,0,3)})})})}function d(B,G,v){var S=B.width,C=B.height;c(B,function(I){var M=I.gl,V=new Uint8Array(S*C*4);M.readPixels(0,0,S,C,M.RGBA,M.UNSIGNED_BYTE,V),B.width=G,B.height=v,f(M,V,0,0,S,C)})}var h=Object.freeze({__proto__:null,withWebGLContext:c,renderImageData:f,resizeWebGLCanvasWithoutClearing:d});function g(B,G,v,S,C,I){I===void 0&&(I=1);var M=new Uint8Array(B*G),V=S[2]-S[0],R=S[3]-S[1],N=[];n(v,function(te,le,he,X){N.push({x1:te,y1:le,x2:he,y2:X,minX:Math.min(te,he),minY:Math.min(le,X),maxX:Math.max(te,he),maxY:Math.max(le,X)})}),N.sort(function(te,le){return te.maxX-le.maxX});for(var Q=0;Q<B;Q++)for(var se=0;se<G;se++){var Y=Se(S[0]+V*(Q+.5)/B,S[1]+R*(se+.5)/G),W=Math.pow(1-Math.abs(Y)/C,I)/2;Y<0&&(W=1-W),W=Math.max(0,Math.min(255,Math.round(W*255))),M[se*B+Q]=W}return M;function Se(te,le){for(var he=1/0,X=1/0,ue=N.length;ue--;){var ce=N[ue];if(ce.maxX+X<=te)break;if(te+X>ce.minX&&le-X<ce.maxY&&le+X>ce.minY){var j=E(te,le,ce.x1,ce.y1,ce.x2,ce.y2);j<he&&(he=j,X=Math.sqrt(he))}}return ve(te,le)&&(X=-X),X}function ve(te,le){for(var he=0,X=N.length;X--;){var ue=N[X];if(ue.maxX<=te)break;var ce=ue.y1>le!=ue.y2>le&&te<(ue.x2-ue.x1)*(le-ue.y1)/(ue.y2-ue.y1)+ue.x1;ce&&(he+=ue.y1<ue.y2?1:-1)}return he!==0}}function p(B,G,v,S,C,I,M,V,R,N){I===void 0&&(I=1),V===void 0&&(V=0),R===void 0&&(R=0),N===void 0&&(N=0),y(B,G,v,S,C,I,M,null,V,R,N)}function y(B,G,v,S,C,I,M,V,R,N,Q){I===void 0&&(I=1),R===void 0&&(R=0),N===void 0&&(N=0),Q===void 0&&(Q=0);for(var se=g(B,G,v,S,C,I),Y=new Uint8Array(se.length*4),W=0;W<se.length;W++)Y[W*4+Q]=se[W];f(M,Y,R,N,B,G,1<<3-Q,V)}function E(B,G,v,S,C,I){var M=C-v,V=I-S,R=M*M+V*V,N=R?Math.max(0,Math.min(1,((B-v)*M+(G-S)*V)/R)):0,Q=B-(v+N*M),se=G-(S+N*V);return Q*Q+se*se}var k=Object.freeze({__proto__:null,generate:g,generateIntoCanvas:p,generateIntoFramebuffer:y}),b="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);}",_="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);}",w="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);}",P=new Float32Array([0,0,2,0,0,2]),T=null,A=!1,z={},U=new WeakMap;function q(B){if(!A&&!Z(B))throw new Error("WebGL generation not supported")}function x(B,G,v,S,C,I,M){if(I===void 0&&(I=1),M===void 0&&(M=null),!M&&(M=T,!M)){var V=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!V)throw new Error("OffscreenCanvas or DOM canvas not supported");M=T=V.getContext("webgl",{depth:!1})}q(M);var R=new Uint8Array(B*G*4);c(M,function(Y){var W=Y.gl,Se=Y.withTexture,ve=Y.withTextureFramebuffer;Se("readable",function(te,le){W.texImage2D(W.TEXTURE_2D,0,W.RGBA,B,G,0,W.RGBA,W.UNSIGNED_BYTE,null),ve(te,le,function(he){D(B,G,v,S,C,I,W,he,0,0,0),W.readPixels(0,0,B,G,W.RGBA,W.UNSIGNED_BYTE,R)})})});for(var N=new Uint8Array(B*G),Q=0,se=0;Q<R.length;Q+=4)N[se++]=R[Q];return N}function L(B,G,v,S,C,I,M,V,R,N){I===void 0&&(I=1),V===void 0&&(V=0),R===void 0&&(R=0),N===void 0&&(N=0),D(B,G,v,S,C,I,M,null,V,R,N)}function D(B,G,v,S,C,I,M,V,R,N,Q){I===void 0&&(I=1),R===void 0&&(R=0),N===void 0&&(N=0),Q===void 0&&(Q=0),q(M);var se=[];n(v,function(Y,W,Se,ve){se.push(Y,W,Se,ve)}),se=new Float32Array(se),c(M,function(Y){var W=Y.gl,Se=Y.isWebGL2,ve=Y.getExtension,te=Y.withProgram,le=Y.withTexture,he=Y.withTextureFramebuffer,X=Y.handleContextLoss;if(le("rawDistances",function(ue,ce){(B!==ue._lastWidth||G!==ue._lastHeight)&&W.texImage2D(W.TEXTURE_2D,0,W.RGBA,ue._lastWidth=B,ue._lastHeight=G,0,W.RGBA,W.UNSIGNED_BYTE,null),te("main",b,_,function(j){var ke=j.setAttribute,ie=j.setUniform,pe=!Se&&ve("ANGLE_instanced_arrays"),ee=!Se&&ve("EXT_blend_minmax");ke("aUV",2,W.STATIC_DRAW,0,P),ke("aLineSegment",4,W.DYNAMIC_DRAW,1,se),ie.apply(void 0,["4f","uGlyphBounds"].concat(S)),ie("1f","uMaxDistance",C),ie("1f","uExponent",I),he(ue,ce,function(Pe){W.enable(W.BLEND),W.colorMask(!0,!0,!0,!0),W.viewport(0,0,B,G),W.scissor(0,0,B,G),W.blendFunc(W.ONE,W.ONE),W.blendEquationSeparate(W.FUNC_ADD,Se?W.MAX:ee.MAX_EXT),W.clear(W.COLOR_BUFFER_BIT),Se?W.drawArraysInstanced(W.TRIANGLES,0,3,se.length/4):pe.drawArraysInstancedANGLE(W.TRIANGLES,0,3,se.length/4)})}),te("post",a,w,function(j){j.setAttribute("aUV",2,W.STATIC_DRAW,0,P),j.setUniform("1i","tex",ce),W.bindFramebuffer(W.FRAMEBUFFER,V),W.disable(W.BLEND),W.colorMask(Q===0,Q===1,Q===2,Q===3),W.viewport(R,N,B,G),W.scissor(R,N,B,G),W.drawArrays(W.TRIANGLES,0,3)})}),W.isContextLost())throw X(),new Error("webgl context lost")})}function Z(B){var G=!B||B===T?z:B.canvas||B,v=U.get(G);if(v===void 0){A=!0;var S=null;try{var C=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],I=x(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,B);v=I&&C.length===I.length&&I.every(function(M,V){return M===C[V]}),v||(S="bad trial run results",console.info(C,I))}catch(M){v=!1,S=M.message}S&&console.warn("WebGL SDF generation not supported:",S),A=!1,U.set(G,v)}return v}var F=Object.freeze({__proto__:null,generate:x,generateIntoCanvas:L,generateIntoFramebuffer:D,isSupported:Z});function ne(B,G,v,S,C,I){C===void 0&&(C=Math.max(S[2]-S[0],S[3]-S[1])/2),I===void 0&&(I=1);try{return x.apply(F,arguments)}catch(M){return console.info("WebGL SDF generation failed, falling back to JS",M),g.apply(k,arguments)}}function oe(B,G,v,S,C,I,M,V,R,N){C===void 0&&(C=Math.max(S[2]-S[0],S[3]-S[1])/2),I===void 0&&(I=1),V===void 0&&(V=0),R===void 0&&(R=0),N===void 0&&(N=0);try{return L.apply(F,arguments)}catch(Q){return console.info("WebGL SDF generation failed, falling back to JS",Q),p.apply(k,arguments)}}return e.forEachPathCommand=i,e.generate=ne,e.generateIntoCanvas=oe,e.javascript=k,e.pathToLineSegments=n,e.webgl=F,e.webglUtils=h,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return t}O();function oh(){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(X,ue){o[X]=1<<ue+1,i[o[X]]=X}),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,c=null;function f(){if(!c){c=new Map;var X=function(ce){if(r.hasOwnProperty(ce)){var j=0;r[ce].split(",").forEach(function(ke){var ie=ke.split("+"),pe=ie[0],ee=ie[1];pe=parseInt(pe,36),ee=ee?parseInt(ee,36):0,c.set(j+=pe,o[ce]);for(var Pe=0;Pe<ee;Pe++)c.set(++j,o[ce])})}};for(var ue in r)X(ue)}}function d(X){return f(),c.get(X.codePointAt(0))||o.L}function h(X){return i[d(X)]}var g={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 p(X,ue){var ce=36,j=0,ke=new Map,ie=ue&&new Map,pe;return X.split(",").forEach(function ee(Pe){if(Pe.indexOf("+")!==-1)for(var de=+Pe;de--;)ee(pe);else{pe=Pe;var me=Pe.split(">"),be=me[0],Ce=me[1];be=String.fromCodePoint(j+=parseInt(be,ce)),Ce=String.fromCodePoint(j+=parseInt(Ce,ce)),ke.set(be,Ce),ue&&ie.set(Ce,be)}}),{map:ke,reverseMap:ie}}var y,E,k;function b(){if(!y){var X=p(g.pairs,!0),ue=X.map,ce=X.reverseMap;y=ue,E=ce,k=p(g.canonical,!1).map}}function _(X){return b(),y.get(X)||null}function w(X){return b(),E.get(X)||null}function P(X){return b(),k.get(X)||null}var T=o.L,A=o.R,z=o.EN,U=o.ES,q=o.ET,x=o.AN,L=o.CS,D=o.B,Z=o.S,F=o.ON,ne=o.BN,oe=o.NSM,B=o.AL,G=o.LRO,v=o.RLO,S=o.LRE,C=o.RLE,I=o.PDF,M=o.LRI,V=o.RLI,R=o.FSI,N=o.PDI;function Q(X,ue){for(var ce=125,j=new Uint32Array(X.length),ke=0;ke<X.length;ke++)j[ke]=d(X[ke]);var ie=new Map;function pe(ot,yt){var at=j[ot];j[ot]=yt,ie.set(at,ie.get(at)-1),at&s&&ie.set(s,ie.get(s)-1),ie.set(yt,(ie.get(yt)||0)+1),yt&s&&ie.set(s,(ie.get(s)||0)+1)}for(var ee=new Uint8Array(X.length),Pe=new Map,de=[],me=null,be=0;be<X.length;be++)me||de.push(me={start:be,end:X.length-1,level:ue==="rtl"?1:ue==="ltr"?0:Ia(be,!1)}),j[be]&D&&(me.end=be,me=null);for(var Ce=C|S|v|G|n|N|I|D,Ge=function(ot){return ot+(ot&1?1:2)},Ze=function(ot){return ot+(ot&1?2:1)},Ee=0;Ee<de.length;Ee++){me=de[Ee];var Ae=[{_level:me.level,_override:0,_isolate:0}],ye=void 0,Ne=0,ze=0,it=0;ie.clear();for(var Fe=me.start;Fe<=me.end;Fe++){var Te=j[Fe];if(ye=Ae[Ae.length-1],ie.set(Te,(ie.get(Te)||0)+1),Te&s&&ie.set(s,(ie.get(s)||0)+1),Te&Ce)if(Te&(C|S)){ee[Fe]=ye._level;var Re=(Te===C?Ze:Ge)(ye._level);Re<=ce&&!Ne&&!ze?Ae.push({_level:Re,_override:0,_isolate:0}):Ne||ze++}else if(Te&(v|G)){ee[Fe]=ye._level;var Wt=(Te===v?Ze:Ge)(ye._level);Wt<=ce&&!Ne&&!ze?Ae.push({_level:Wt,_override:Te&v?A:T,_isolate:0}):Ne||ze++}else if(Te&n){Te&R&&(Te=Ia(Fe+1,!0)===1?V:M),ee[Fe]=ye._level,ye._override&&pe(Fe,ye._override);var Ue=(Te===V?Ze:Ge)(ye._level);Ue<=ce&&Ne===0&&ze===0?(it++,Ae.push({_level:Ue,_override:0,_isolate:1,_isolInitIndex:Fe})):Ne++}else if(Te&N){if(Ne>0)Ne--;else if(it>0){for(ze=0;!Ae[Ae.length-1]._isolate;)Ae.pop();var Ie=Ae[Ae.length-1]._isolInitIndex;Ie!=null&&(Pe.set(Ie,Fe),Pe.set(Fe,Ie)),Ae.pop(),it--}ye=Ae[Ae.length-1],ee[Fe]=ye._level,ye._override&&pe(Fe,ye._override)}else Te&I?(Ne===0&&(ze>0?ze--:!ye._isolate&&Ae.length>1&&(Ae.pop(),ye=Ae[Ae.length-1])),ee[Fe]=ye._level):Te&D&&(ee[Fe]=me.level);else ee[Fe]=ye._level,ye._override&&Te!==ne&&pe(Fe,ye._override)}for(var Ye=[],Ve=null,De=me.start;De<=me.end;De++){var We=j[De];if(!(We&l)){var $e=ee[De],qe=We&n,Xe=We===N;Ve&&$e===Ve._level?(Ve._end=De,Ve._endsWithIsolInit=qe):Ye.push(Ve={_start:De,_end:De,_level:$e,_startsWithPDI:Xe,_endsWithIsolInit:qe})}}for(var gt=[],Ht=0;Ht<Ye.length;Ht++){var Pt=Ye[Ht];if(!Pt._startsWithPDI||Pt._startsWithPDI&&!Pe.has(Pt._start)){for(var Zt=[Ve=Pt],or=void 0;Ve&&Ve._endsWithIsolInit&&(or=Pe.get(Ve._end))!=null;)for(var Rt=Ht+1;Rt<Ye.length;Rt++)if(Ye[Rt]._start===or){Zt.push(Ve=Ye[Rt]);break}for(var et=[],ar=0;ar<Zt.length;ar++)for(var fa=Zt[ar],zi=fa._start;zi<=fa._end;zi++)et.push(zi);for(var uu=ee[et[0]],da=me.level,Hn=et[0]-1;Hn>=0;Hn--)if(!(j[Hn]&l)){da=ee[Hn];break}var Vi=et[et.length-1],cu=ee[Vi],ha=me.level;if(!(j[Vi]&n)){for(var Zn=Vi+1;Zn<=me.end;Zn++)if(!(j[Zn]&l)){ha=ee[Zn];break}}gt.push({_seqIndices:et,_sosType:Math.max(da,uu)%2?A:T,_eosType:Math.max(ha,cu)%2?A:T})}}for(var Wi=0;Wi<gt.length;Wi++){var Hi=gt[Wi],ge=Hi._seqIndices,un=Hi._sosType,fu=Hi._eosType,Rr=ee[ge[0]]&1?A:T;if(ie.get(oe))for(var Yn=0;Yn<ge.length;Yn++){var pa=ge[Yn];if(j[pa]&oe){for(var Zi=un,Xn=Yn-1;Xn>=0;Xn--)if(!(j[ge[Xn]]&l)){Zi=j[ge[Xn]];break}pe(pa,Zi&(n|N)?F:Zi)}}if(ie.get(z))for(var Kn=0;Kn<ge.length;Kn++){var ma=ge[Kn];if(j[ma]&z)for(var Jn=Kn-1;Jn>=-1;Jn--){var ga=Jn===-1?un:j[ge[Jn]];if(ga&a){ga===B&&pe(ma,x);break}}}if(ie.get(B))for(var Yi=0;Yi<ge.length;Yi++){var va=ge[Yi];j[va]&B&&pe(va,A)}if(ie.get(U)||ie.get(L))for(var cn=1;cn<ge.length-1;cn++){var Xi=ge[cn];if(j[Xi]&(U|L)){for(var Ur=0,Ki=0,Ji=cn-1;Ji>=0&&(Ur=j[ge[Ji]],!!(Ur&l));Ji--);for(var qi=cn+1;qi<ge.length&&(Ki=j[ge[qi]],!!(Ki&l));qi++);Ur===Ki&&(j[Xi]===U?Ur===z:Ur&(z|x))&&pe(Xi,Ur)}}if(ie.get(z))for(var wt=0;wt<ge.length;wt++){var du=ge[wt];if(j[du]&z){for(var qn=wt-1;qn>=0&&j[ge[qn]]&(q|l);qn--)pe(ge[qn],z);for(wt++;wt<ge.length&&j[ge[wt]]&(q|l|z);wt++)j[ge[wt]]!==z&&pe(ge[wt],z)}}if(ie.get(q)||ie.get(U)||ie.get(L))for(var fn=0;fn<ge.length;fn++){var ya=ge[fn];if(j[ya]&(q|U|L)){pe(ya,F);for(var Qn=fn-1;Qn>=0&&j[ge[Qn]]&l;Qn--)pe(ge[Qn],F);for(var $n=fn+1;$n<ge.length&&j[ge[$n]]&l;$n++)pe(ge[$n],F)}}if(ie.get(z))for(var Qi=0,ba=un;Qi<ge.length;Qi++){var xa=ge[Qi],$i=j[xa];$i&z?ba===T&&pe(xa,T):$i&a&&(ba=$i)}if(ie.get(s)){var dn=A|z|x,_a=dn|T,ei=[];{for(var Lr=[],Gr=0;Gr<ge.length;Gr++)if(j[ge[Gr]]&s){var hn=X[ge[Gr]],Ta=void 0;if(_(hn)!==null)if(Lr.length<63)Lr.push({char:hn,seqIndex:Gr});else break;else if((Ta=w(hn))!==null)for(var pn=Lr.length-1;pn>=0;pn--){var eo=Lr[pn].char;if(eo===Ta||eo===w(P(hn))||_(P(eo))===hn){ei.push([Lr[pn].seqIndex,Gr]),Lr.length=pn;break}}}ei.sort(function(ot,yt){return ot[0]-yt[0]})}for(var to=0;to<ei.length;to++){for(var Sa=ei[to],ti=Sa[0],ro=Sa[1],ka=!1,vt=0,no=ti+1;no<ro;no++){var wa=ge[no];if(j[wa]&_a){ka=!0;var Ma=j[wa]&dn?A:T;if(Ma===Rr){vt=Ma;break}}}if(ka&&!vt){vt=un;for(var io=ti-1;io>=0;io--){var Ca=ge[io];if(j[Ca]&_a){var Da=j[Ca]&dn?A:T;Da!==Rr?vt=Da:vt=Rr;break}}}if(vt){if(j[ge[ti]]=j[ge[ro]]=vt,vt!==Rr){for(var mn=ti+1;mn<ge.length;mn++)if(!(j[ge[mn]]&l)){d(X[ge[mn]])&oe&&(j[ge[mn]]=vt);break}}if(vt!==Rr){for(var gn=ro+1;gn<ge.length;gn++)if(!(j[ge[gn]]&l)){d(X[ge[gn]])&oe&&(j[ge[gn]]=vt);break}}}}for(var Yt=0;Yt<ge.length;Yt++)if(j[ge[Yt]]&s){for(var Ea=Yt,oo=Yt,ao=un,vn=Yt-1;vn>=0;vn--)if(j[ge[vn]]&l)Ea=vn;else{ao=j[ge[vn]]&dn?A:T;break}for(var Aa=fu,yn=Yt+1;yn<ge.length;yn++)if(j[ge[yn]]&(s|l))oo=yn;else{Aa=j[ge[yn]]&dn?A:T;break}for(var so=Ea;so<=oo;so++)j[ge[so]]=ao===Aa?ao:Rr;Yt=oo}}}for(var ut=me.start;ut<=me.end;ut++){var hu=ee[ut],ri=j[ut];if(hu&1?ri&(T|z|x)&&ee[ut]++:ri&A?ee[ut]++:ri&(x|z)&&(ee[ut]+=2),ri&l&&(ee[ut]=ut===0?me.level:ee[ut-1]),ut===me.end||d(X[ut])&(Z|D))for(var ni=ut;ni>=0&&d(X[ni])&u;ni--)ee[ni]=me.level}}return{levels:ee,paragraphs:de};function Ia(ot,yt){for(var at=ot;at<X.length;at++){var Xt=j[at];if(Xt&(A|B))return 1;if(Xt&(D|T)||yt&&Xt===N)return 0;if(Xt&n){var Oa=pu(at);at=Oa===-1?X.length:Oa}}return 0}function pu(ot){for(var yt=1,at=ot+1;at<X.length;at++){var Xt=j[at];if(Xt&D)break;if(Xt&N){if(--yt===0)return at}else Xt&n&&yt++}return-1}}var se="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",Y;function W(){if(!Y){var X=p(se,!0),ue=X.map,ce=X.reverseMap;ce.forEach(function(j,ke){ue.set(ke,j)}),Y=ue}}function Se(X){return W(),Y.get(X)||null}function ve(X,ue,ce,j){var ke=X.length;ce=Math.max(0,ce==null?0:+ce),j=Math.min(ke-1,j==null?ke-1:+j);for(var ie=new Map,pe=ce;pe<=j;pe++)if(ue[pe]&1){var ee=Se(X[pe]);ee!==null&&ie.set(pe,ee)}return ie}function te(X,ue,ce,j){var ke=X.length;ce=Math.max(0,ce==null?0:+ce),j=Math.min(ke-1,j==null?ke-1:+j);var ie=[];return ue.paragraphs.forEach(function(pe){var ee=Math.max(ce,pe.start),Pe=Math.min(j,pe.end);if(ee<Pe){for(var de=ue.levels.slice(ee,Pe+1),me=Pe;me>=ee&&d(X[me])&u;me--)de[me]=pe.level;for(var be=pe.level,Ce=1/0,Ge=0;Ge<de.length;Ge++){var Ze=de[Ge];Ze>be&&(be=Ze),Ze<Ce&&(Ce=Ze|1)}for(var Ee=be;Ee>=Ce;Ee--)for(var Ae=0;Ae<de.length;Ae++)if(de[Ae]>=Ee){for(var ye=Ae;Ae+1<de.length&&de[Ae+1]>=Ee;)Ae++;Ae>ye&&ie.push([ye+ee,Ae+ee])}}}),ie}function le(X,ue,ce,j){var ke=he(X,ue,ce,j),ie=[].concat(X);return ke.forEach(function(pe,ee){ie[ee]=(ue.levels[pe]&1?Se(X[pe]):null)||X[pe]}),ie.join("")}function he(X,ue,ce,j){for(var ke=te(X,ue,ce,j),ie=[],pe=0;pe<X.length;pe++)ie[pe]=pe;return ke.forEach(function(ee){for(var Pe=ee[0],de=ee[1],me=ie.slice(Pe,de+1),be=me.length;be--;)ie[de-be]=me[be]}),ie}return e.closingToOpeningBracket=w,e.getBidiCharType=d,e.getBidiCharTypeName=h,e.getCanonicalBracket=P,e.getEmbeddingLevels=Q,e.getMirroredCharacter=Se,e.getMirroredCharactersMap=ve,e.getReorderSegments=te,e.getReorderedIndices=he,e.getReorderedString=le,e.openingToClosingBracket=_,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return t}var bl=oh;O();var Ho=/\bvoid\s+main\s*\(\s*\)\s*{/g;function Wo(t){let e=/^[ \t]*#include +<([\w\d./]+)>/gm;function r(o,i){let n=qa[i];return n?Wo(n):o}return t.replace(e,r)}var Je=[];for(let t=0;t<256;t++)Je[t]=(t<16?"0":"")+t.toString(16);function ah(){let t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,r=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(Je[t&255]+Je[t>>8&255]+Je[t>>16&255]+Je[t>>24&255]+"-"+Je[e&255]+Je[e>>8&255]+"-"+Je[e>>16&15|64]+Je[e>>24&255]+"-"+Je[r&63|128]+Je[r>>8&255]+"-"+Je[r>>16&255]+Je[r>>24&255]+Je[o&255]+Je[o>>8&255]+Je[o>>16&255]+Je[o>>24&255]).toUpperCase()}var Ar=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},sh=Date.now(),xl=new WeakMap,_l=new Map,lh=1e10;function nn(t,e){let r=dh(e),o=xl.get(t);if(o||xl.set(t,o=Object.create(null)),o[r])return new o[r];let i="_onBeforeCompile".concat(r),n=function(u,c){t.onBeforeCompile.call(this,u,c);let f=this.customProgramCacheKey()+"|"+u.vertexShader+"|"+u.fragmentShader,d=_l[f];if(!d){let h=uh(this,u,e,r);d=_l[f]=h}u.vertexShader=d.vertexShader,u.fragmentShader=d.fragmentShader,Ar(u.uniforms,this.uniforms),e.timeUniform&&(u.uniforms[e.timeUniform]={get value(){return Date.now()-sh}}),this[i]&&this[i](u)},a=function(){return s(e.chained?t:t.clone())},s=function(u){let c=Object.create(u,l);return Object.defineProperty(c,"baseMaterial",{value:t}),Object.defineProperty(c,"id",{value:lh++}),c.uuid=ah(),c.uniforms=Ar({},u.uniforms,e.uniforms),c.defines=Ar({},u.defines,e.defines),c.defines["TROIKA_DERIVED_MATERIAL_".concat(r)]="",c.extensions=Ar({},u.extensions,e.extensions),c._listeners=void 0,c},l={constructor:{value:a},isDerivedMaterial:{value:!0},type:{get:()=>t.type,set:u=>{t.type=u}},isDerivedFrom:{writable:!0,configurable:!0,value:function(u){let c=this.baseMaterial;return u===c||c.isDerivedMaterial&&c.isDerivedFrom(u)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return t.customProgramCacheKey()+"|"+r}},onBeforeCompile:{get(){return n},set(u){this[i]=u}},copy:{writable:!0,configurable:!0,value:function(u){return t.copy.call(this,u),!t.isShaderMaterial&&!t.isDerivedMaterial&&(Ar(this.extensions,u.extensions),Ar(this.defines,u.defines),Ar(this.uniforms,ja.clone(u.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){let u=new t.constructor;return s(u).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let u=this._depthMaterial;return u||(u=this._depthMaterial=nn(t.isDerivedMaterial?t.getDepthMaterial():new Ya({depthPacking:Ua}),e),u.defines.IS_DEPTH_MATERIAL="",u.uniforms=this.uniforms),u}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let u=this._distanceMaterial;return u||(u=this._distanceMaterial=nn(t.isDerivedMaterial?t.getDistanceMaterial():new Xa,e),u.defines.IS_DISTANCE_MATERIAL="",u.uniforms=this.uniforms),u}},dispose:{writable:!0,configurable:!0,value(){let{_depthMaterial:u,_distanceMaterial:c}=this;u&&u.dispose(),c&&c.dispose(),t.dispose.call(this)}}};return o[r]=a,new a}function uh(t,{vertexShader:e,fragmentShader:r},o,i){let{vertexDefs:n,vertexMainIntro:a,vertexMainOutro:s,vertexTransform:l,fragmentDefs:u,fragmentMainIntro:c,fragmentMainOutro:f,fragmentColorTransform:d,customRewriter:h,timeUniform:g}=o;if(n=n||"",a=a||"",s=s||"",u=u||"",c=c||"",f=f||"",(l||h)&&(e=Wo(e)),(d||h)&&(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=Wo(r)),h){let p=h({vertexShader:e,fragmentShader:r});e=p.vertexShader,r=p.fragmentShader}if(d){let p=[];r=r.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,y=>(p.push(y),"")),f="".concat(d,"\n").concat(p.join("\n"),"\n").concat(f)}if(g){let p="\nuniform float ".concat(g,";\n");n=p+n,u=p+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,(p,y,E,k)=>/\battribute\s+vec[23]\s+$/.test(k.substr(0,E))?y:"troika_".concat(y,"_").concat(i)),t.map&&t.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,"troika_uv_".concat(i)))),e=Tl(e,i,n,a,s),r=Tl(r,i,u,c,f),{vertexShader:e,fragmentShader:r}}function Tl(t,e,r,o,i){return(o||i||r)&&(t=t.replace(Ho,"\n".concat(r,"\nvoid troikaOrigMain").concat(e,"() {")),t+="\nvoid main() {\n ".concat(o,"\n troikaOrigMain").concat(e,"();\n ").concat(i,"\n}")),t}function ch(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}var fh=0,Sl=new Map;function dh(t){let e=JSON.stringify(t,ch),r=Sl.get(e);return r==null&&Sl.set(e,r=++fh),r}function hh(){return typeof window>"u"&&(self.window=self),function(t){var e={parse: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=[],c=0;c<l;c++){var f=n.readUint(a,s);s+=4,u.push(e._readFont(a,f))}return u}return[e._readFont(a,0)]},_readFont: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 "],c={_data:i,_offset:s},f={},d=0;d<l;d++){var h=a.readASCII(i,n,4);n+=4,a.readUint(i,n),n+=4;var g=a.readUint(i,n);n+=4;var p=a.readUint(i,n);n+=4,f[h]={offset:g,length:p}}for(d=0;d<u.length;d++){var y=u[d];f[y]&&(c[y.trim()]=e[y.trim()].parse(i,f[y].offset,f[y].length,c))}return c},_tabOffset:function(i,n,a){for(var s=e._bin,l=s.readUshort(i,a+4),u=a+12,c=0;c<l;c++){var f=s.readASCII(i,u,4);u+=4,s.readUint(i,u),u+=4;var d=s.readUint(i,u);if(u+=4,s.readUint(i,u),u+=4,f==n)return d}return 0}};e._bin={readFixed:function(i,n){return(i[n]<<8|i[n+1])+(i[n+2]<<8|i[n+3])/65540},readF2dot14:function(i,n){return e._bin.readShort(i,n)/16384},readInt:function(i,n){return e._bin._view(i).getInt32(n)},readInt8:function(i,n){return e._bin._view(i).getInt8(n)},readShort:function(i,n){return e._bin._view(i).getInt16(n)},readUshort:function(i,n){return e._bin._view(i).getUint16(n)},readUshorts:function(i,n,a){for(var s=[],l=0;l<a;l++)s.push(e._bin.readUshort(i,n+2*l));return s},readUint:function(i,n){return e._bin._view(i).getUint32(n)},readUint64:function(i,n){return 4294967296*e._bin.readUint(i,n)+e._bin.readUint(i,n+4)},readASCII:function(i,n,a){for(var s="",l=0;l<a;l++)s+=String.fromCharCode(i[n+l]);return s},readUnicode: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},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8: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)},readBytes:function(i,n,a){for(var s=[],l=0;l<a;l++)s.push(i[n+l]);return s},readASCIIArray:function(i,n,a){for(var s=[],l=0;l<a;l++)s.push(String.fromCharCode(i[n+l]));return s},_view:function(i){return i._dataView||(i._dataView=i.buffer?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(new Uint8Array(i).buffer))}},e._lctf={},e._lctf.parse=function(i,n,a,s,l){var u=e._bin,c={},f=n;u.readFixed(i,n),n+=4;var d=u.readUshort(i,n);n+=2;var h=u.readUshort(i,n);n+=2;var g=u.readUshort(i,n);return n+=2,c.scriptList=e._lctf.readScriptList(i,f+d),c.featureList=e._lctf.readFeatureList(i,f+h),c.lookupList=e._lctf.readLookupList(i,f+g,l),c},e._lctf.readLookupList=function(i,n,a){var s=e._bin,l=n,u=[],c=s.readUshort(i,n);n+=2;for(var f=0;f<c;f++){var d=s.readUshort(i,n);n+=2;var h=e._lctf.readLookupTable(i,l+d,a);u.push(h)}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 c=s.readUshort(i,n);n+=2;for(var f=u.ltype,d=0;d<c;d++){var h=s.readUshort(i,n);n+=2;var g=a(i,f,l+h,u);u.tabs.push(g)}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 c=a.readUshort(i,n);n+=2;for(var f=0;f<c;f++)s.push(u+f),s.push(u+f),s.push(a.readUshort(i,n)),n+=2}if(l==2){var d=a.readUshort(i,n);for(n+=2,f=0;f<d;f++)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 c=0;c<u;c++){var f=a.readASCII(i,n,4);n+=4;var d=a.readUshort(i,n);n+=2;var h=e._lctf.readFeatureTable(i,s+d);h.tag=f.trim(),l.push(h)}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 c=a.readUshort(i,n);n+=2,l.tab=[];for(var f=0;f<c;f++)l.tab.push(a.readUshort(i,n+2*f));return l},e._lctf.readScriptList=function(i,n){var a=e._bin,s=n,l={},u=a.readUshort(i,n);n+=2;for(var c=0;c<u;c++){var f=a.readASCII(i,n,4);n+=4;var d=a.readUshort(i,n);n+=2,l[f.trim()]=e._lctf.readScriptTable(i,s+d)}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 c=a.readUshort(i,n);n+=2;for(var f=0;f<c;f++){var d=a.readASCII(i,n,4);n+=4;var h=a.readUshort(i,n);n+=2,l[d.trim()]=e._lctf.readLangSysTable(i,s+h)}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=[],c=0;c<l.length-1;c++)u.push(s.readASCII(i,n+l[c],l[c+1]-l[c]));n+=l[l.length-1];var f=[];n=e.CFF.readIndex(i,n,f);var d=[];for(c=0;c<f.length-1;c++)d.push(e.CFF.readDict(i,n+f[c],n+f[c+1]));n+=f[f.length-1];var h=d[0],g=[];n=e.CFF.readIndex(i,n,g);var p=[];for(c=0;c<g.length-1;c++)p.push(s.readASCII(i,n+g[c],g[c+1]-g[c]));if(n+=g[g.length-1],e.CFF.readSubrs(i,n,h),h.CharStrings){n=h.CharStrings,g=[],n=e.CFF.readIndex(i,n,g);var y=[];for(c=0;c<g.length-1;c++)y.push(s.readBytes(i,n+g[c],g[c+1]-g[c]));h.CharStrings=y}if(h.ROS){n=h.FDArray;var E=[];for(n=e.CFF.readIndex(i,n,E),h.FDArray=[],c=0;c<E.length-1;c++){var k=e.CFF.readDict(i,n+E[c],n+E[c+1]);e.CFF._readFDict(i,k,p),h.FDArray.push(k)}n+=E[E.length-1],n=h.FDSelect,h.FDSelect=[];var b=i[n];if(n++,b!=3)throw b;var _=s.readUshort(i,n);for(n+=2,c=0;c<_+1;c++)h.FDSelect.push(s.readUshort(i,n),i[n+2]),n+=3}return h.Encoding&&(h.Encoding=e.CFF.readEncoding(i,h.Encoding,h.CharStrings.length)),h.charset&&(h.charset=e.CFF.readCharset(i,h.charset,h.CharStrings.length)),e.CFF._readFDict(i,h,p),h},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,c=l.length;u=c<1240?107:c<33900?1131:32768,a.Bias=u,a.Subrs=[];for(var f=0;f<l.length-1;f++)a.Subrs.push(s.readBytes(i,n+l[f],l[f+1]-l[f]))},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 c=0;c<u;c++)s.push(i[n+c]);return s},e.CFF.readCharset=function(i,n,a){var s=e._bin,l=[".notdef"],u=i[n];if(n++,u==0)for(var c=0;c<a;c++){var f=s.readUshort(i,n);n+=2,l.push(f)}else{if(u!=1&&u!=2)throw"error: format: "+u;for(;l.length<a;){f=s.readUshort(i,n),n+=2;var d=0;for(u==1?(d=i[n],n++):(d=s.readUshort(i,n),n+=2),c=0;c<=d;c++)l.push(f),f++}}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 c=0;c<l;c++)a.push(i[n+c]);else if(u==2)for(c=0;c<l;c++)a.push(s.readUshort(i,n+2*c));else if(u==3)for(c=0;c<l;c++)a.push(16777215&s.readUint(i,n+3*c-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 c=1,f=null,d=null;l<=20&&(f=l,c=1),l==12&&(f=100*l+u,c=2),21<=l&&l<=27&&(f=l,c=1),l==28&&(d=s.readShort(i,n+1),c=3),29<=l&&l<=31&&(f=l,c=1),32<=l&&l<=246&&(d=l-139,c=1),247<=l&&l<=250&&(d=256*(l-247)+u+108,c=2),251<=l&&l<=254&&(d=256*-(l-251)-u-108,c=2),l==255&&(d=s.readInt(i,n+1)/65535,c=5),a.val=d!=null?d:"o"+f,a.size=c},e.CFF.readCharString=function(i,n,a){for(var s=n+a,l=e._bin,u=[];n<s;){var c=i[n],f=i[n+1];i[n+2],i[n+3],i[n+4];var d=1,h=null,g=null;c<=20&&(h=c,d=1),c==12&&(h=100*c+f,d=2),c!=19&&c!=20||(h=c,d=2),21<=c&&c<=27&&(h=c,d=1),c==28&&(g=l.readShort(i,n+1),d=3),29<=c&&c<=31&&(h=c,d=1),32<=c&&c<=246&&(g=c-139,d=1),247<=c&&c<=250&&(g=256*(c-247)+f+108,d=2),251<=c&&c<=254&&(g=256*-(c-251)-f-108,d=2),c==255&&(g=l.readInt(i,n+1)/65535,d=5),u.push(g!=null?g:"o"+h),n+=d}return u},e.CFF.readDict=function(i,n,a){for(var s=e._bin,l={},u=[];n<a;){var c=i[n],f=i[n+1];i[n+2],i[n+3],i[n+4];var d=1,h=null,g=null;if(c==28&&(g=s.readShort(i,n+1),d=3),c==29&&(g=s.readInt(i,n+1),d=5),32<=c&&c<=246&&(g=c-139,d=1),247<=c&&c<=250&&(g=256*(c-247)+f+108,d=2),251<=c&&c<=254&&(g=256*-(c-251)-f-108,d=2),c==255)throw g=s.readInt(i,n+1)/65535,d=5,"unknown number";if(c==30){var p=[];for(d=1;;){var y=i[n+d];d++;var E=y>>4,k=15&y;if(E!=15&&p.push(E),k!=15&&p.push(k),k==15)break}for(var b="",_=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],w=0;w<p.length;w++)b+=_[p[w]];g=parseFloat(b)}c<=21&&(h=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][c],d=1,c==12&&(h=["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"][f],d=2)),h!=null?(l[h]=u.length==1?u[0]:u,u=[]):u.push(g),n+=d}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 c=[];l.tables=[];for(var f=0;f<u;f++){var d=s.readUshort(i,n);n+=2;var h=s.readUshort(i,n);n+=2;var g=s.readUint(i,n);n+=4;var p="p"+d+"e"+h,y=c.indexOf(g);if(y==-1){var E;y=l.tables.length,c.push(g);var k=s.readUshort(i,g);k==0?E=e.cmap.parse0(i,g):k==4?E=e.cmap.parse4(i,g):k==6?E=e.cmap.parse6(i,g):k==12?E=e.cmap.parse12(i,g):console.debug("unknown format: "+k,d,h,g),l.tables.push(E)}if(l[p]!=null)throw"multiple tables for one platform+encoding";l[p]=y}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 c=a.readUshort(i,n);n+=2;var f=c/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,f),n+=2*f,n+=2,l.startCount=a.readUshorts(i,n,f),n+=2*f,l.idDelta=[];for(var d=0;d<f;d++)l.idDelta.push(a.readShort(i,n)),n+=2;for(l.idRangeOffset=a.readUshorts(i,n,f),n+=2*f,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 c=n+12*u,f=a.readUint(i,c+0),d=a.readUint(i,c+4),h=a.readUint(i,c+8);s.groups.push([f,d,h])}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 c=0;c<u.noc;c++)u.endPts.push(a.readUshort(s,l)),l+=2;var f=a.readUshort(s,l);if(l+=2,s.length-l<f)return null;u.instructions=a.readBytes(s,l,f),l+=f;var d=u.endPts[u.noc-1]+1;for(u.flags=[],c=0;c<d;c++){var h=s[l];if(l++,u.flags.push(h),(8&h)!=0){var g=s[l];l++;for(var p=0;p<g;p++)u.flags.push(h),c++}}for(u.xs=[],c=0;c<d;c++){var y=(2&u.flags[c])!=0,E=(16&u.flags[c])!=0;y?(u.xs.push(E?s[l]:-s[l]),l++):E?u.xs.push(0):(u.xs.push(a.readShort(s,l)),l+=2)}for(u.ys=[],c=0;c<d;c++)y=(4&u.flags[c])!=0,E=(32&u.flags[c])!=0,y?(u.ys.push(E?s[l]:-s[l]),l++):E?u.ys.push(0):(u.ys.push(a.readShort(s,l)),l+=2);var k=0,b=0;for(c=0;c<d;c++)k+=u.xs[c],b+=u.ys[c],u.xs[c]=k,u.ys[c]=b}else{var _;u.parts=[];do{_=a.readUshort(s,l),l+=2;var w={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(u.parts.push(w),w.glyphIndex=a.readUshort(s,l),l+=2,1&_){var P=a.readShort(s,l);l+=2;var T=a.readShort(s,l);l+=2}else P=a.readInt8(s,l),l++,T=a.readInt8(s,l),l++;2&_?(w.m.tx=P,w.m.ty=T):(w.p1=P,w.p2=T),8&_?(w.m.a=w.m.d=a.readF2dot14(s,l),l+=2):64&_?(w.m.a=a.readF2dot14(s,l),l+=2,w.m.d=a.readF2dot14(s,l),l+=2):128&_&&(w.m.a=a.readF2dot14(s,l),l+=2,w.m.b=a.readF2dot14(s,l),l+=2,w.m.c=a.readF2dot14(s,l),l+=2,w.m.d=a.readF2dot14(s,l),l+=2)}while(32&_);if(256&_){var A=a.readUshort(s,l);for(l+=2,u.instr=[],c=0;c<A;c++)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,c={};if(c.fmt=l.readUshort(i,a),a+=2,n==1||n==2||n==3||n==7||n==8&&c.fmt<=2){var f=l.readUshort(i,a);a+=2,c.coverage=e._lctf.readCoverage(i,f+u)}if(n==1&&c.fmt==1){var d=l.readUshort(i,a);a+=2,d!=0&&(c.pos=e.GPOS.readValueRecord(i,a,d))}else if(n==2&&c.fmt>=1&&c.fmt<=2){d=l.readUshort(i,a),a+=2;var h=l.readUshort(i,a);a+=2;var g=e._lctf.numOfOnes(d),p=e._lctf.numOfOnes(h);if(c.fmt==1){c.pairsets=[];var y=l.readUshort(i,a);a+=2;for(var E=0;E<y;E++){var k=u+l.readUshort(i,a);a+=2;var b=l.readUshort(i,k);k+=2;for(var _=[],w=0;w<b;w++){var P=l.readUshort(i,k);k+=2,d!=0&&(x=e.GPOS.readValueRecord(i,k,d),k+=2*g),h!=0&&(L=e.GPOS.readValueRecord(i,k,h),k+=2*p),_.push({gid2:P,val1:x,val2:L})}c.pairsets.push(_)}}if(c.fmt==2){var T=l.readUshort(i,a);a+=2;var A=l.readUshort(i,a);a+=2;var z=l.readUshort(i,a);a+=2;var U=l.readUshort(i,a);for(a+=2,c.classDef1=e._lctf.readClassDef(i,u+T),c.classDef2=e._lctf.readClassDef(i,u+A),c.matrix=[],E=0;E<z;E++){var q=[];for(w=0;w<U;w++){var x=null,L=null;d!=0&&(x=e.GPOS.readValueRecord(i,a,d),a+=2*g),h!=0&&(L=e.GPOS.readValueRecord(i,a,h),a+=2*p),q.push({val1:x,val2:L})}c.matrix.push(q)}}}else if(n==4&&c.fmt==1)c.markCoverage=e._lctf.readCoverage(i,l.readUshort(i,a)+u),c.baseCoverage=e._lctf.readCoverage(i,l.readUshort(i,a+2)+u),c.markClassCount=l.readUshort(i,a+4),c.markArray=e.GPOS.readMarkArray(i,l.readUshort(i,a+6)+u),c.baseArray=e.GPOS.readBaseArray(i,l.readUshort(i,a+8)+u,c.markClassCount);else if(n==6&&c.fmt==1)c.mark1Coverage=e._lctf.readCoverage(i,l.readUshort(i,a)+u),c.mark2Coverage=e._lctf.readCoverage(i,l.readUshort(i,a+2)+u),c.markClassCount=l.readUshort(i,a+4),c.mark1Array=e.GPOS.readMarkArray(i,l.readUshort(i,a+6)+u),c.mark2Array=e.GPOS.readBaseArray(i,l.readUshort(i,a+8)+u,c.markClassCount);else{if(n==9&&c.fmt==1){var D=l.readUshort(i,a);a+=2;var Z=l.readUint(i,a);if(a+=4,s.ltype==9)s.ltype=D;else if(s.ltype!=D)throw"invalid extension substitution";return e.GPOS.subt(i,s.ltype,u+Z)}console.debug("unsupported GPOS table LookupType",n,"format",c.fmt)}return c},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,c=s.readUshort(i,n);n+=2;for(var f=0;f<c;f++){for(var d=[],h=0;h<a;h++)d.push(e.GPOS.readAnchorRecord(i,u+s.readUshort(i,n))),n+=2;l.push(d)}return l},e.GPOS.readMarkArray=function(i,n){var a=e._bin,s=[],l=n,u=a.readUshort(i,n);n+=2;for(var c=0;c<u;c++){var f=e.GPOS.readAnchorRecord(i,a.readUshort(i,n+2)+l);f.markClass=a.readUshort(i,n),s.push(f),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,c={};if(c.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&&c.fmt<=2||n==6&&c.fmt<=2){var f=l.readUshort(i,a);a+=2,c.coverage=e._lctf.readCoverage(i,u+f)}if(n==1&&c.fmt>=1&&c.fmt<=2){if(c.fmt==1)c.delta=l.readShort(i,a),a+=2;else if(c.fmt==2){var d=l.readUshort(i,a);a+=2,c.newg=l.readUshorts(i,a,d),a+=2*c.newg.length}}else if(n==2&&c.fmt==1){d=l.readUshort(i,a),a+=2,c.seqs=[];for(var h=0;h<d;h++){var g=l.readUshort(i,a)+u;a+=2;var p=l.readUshort(i,g);c.seqs.push(l.readUshorts(i,g+2,p))}}else if(n==4)for(c.vals=[],d=l.readUshort(i,a),a+=2,h=0;h<d;h++){var y=l.readUshort(i,a);a+=2,c.vals.push(e.GSUB.readLigatureSet(i,u+y))}else if(n==5&&c.fmt==2){if(c.fmt==2){var E=l.readUshort(i,a);a+=2,c.cDef=e._lctf.readClassDef(i,u+E),c.scset=[];var k=l.readUshort(i,a);for(a+=2,h=0;h<k;h++){var b=l.readUshort(i,a);a+=2,c.scset.push(b==0?null:e.GSUB.readSubClassSet(i,u+b))}}}else if(n==6&&c.fmt==3){if(c.fmt==3){for(h=0;h<3;h++){d=l.readUshort(i,a),a+=2;for(var _=[],w=0;w<d;w++)_.push(e._lctf.readCoverage(i,u+l.readUshort(i,a+2*w)));a+=2*d,h==0&&(c.backCvg=_),h==1&&(c.inptCvg=_),h==2&&(c.ahedCvg=_)}d=l.readUshort(i,a),a+=2,c.lookupRec=e.GSUB.readSubstLookupRecords(i,a,d)}}else{if(n==7&&c.fmt==1){var P=l.readUshort(i,a);a+=2;var T=l.readUint(i,a);if(a+=4,s.ltype==9)s.ltype=P;else if(s.ltype!=P)throw"invalid extension substitution";return e.GSUB.subt(i,s.ltype,u+T)}console.debug("unsupported GSUB table LookupType",n,"format",c.fmt)}return c},e.GSUB.readSubClassSet=function(i,n){var a=e._bin.readUshort,s=n,l=[],u=a(i,n);n+=2;for(var c=0;c<u;c++){var f=a(i,n);n+=2,l.push(e.GSUB.readSubClassRule(i,s+f))}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 c=0;c<l-1;c++)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 c=0;c<u;c++){var f=a.readUshort(i,n);n+=2,l.push(e.GSUB.readChainSubClassRule(i,s+f))}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 c=a.readUshort(i,n);n+=2,u==1&&c--,s[l[u]]=a.readUshorts(i,n,c),n+=2*s[l[u]].length}return c=a.readUshort(i,n),n+=2,s.subst=a.readUshorts(i,n,2*c),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 c=0;c<u;c++){var f=a.readUshort(i,n);n+=2,l.push(e.GSUB.readLigature(i,s+f))}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:[]},c=0,f=0,d=0;d<s.maxp.numGlyphs;d++)d<s.hhea.numberOfHMetrics&&(c=l.readUshort(i,n),n+=2,f=l.readShort(i,n),n+=2),u.aWidth.push(c),u.lsBearing.push(f);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 c=l.readUshort(i,n);n+=2;for(var f={glyph1:[],rval:[]},d=0;d<c;d++){n+=2,a=l.readUshort(i,n),n+=2;var h=l.readUshort(i,n);n+=2;var g=h>>>8;if((g&=15)!=0)throw"unknown kern table format: "+g;n=e.kern.readFormat0(i,n,f)}return f},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 c={glyph1:[],rval:[]},f=0;f<u;f++){l.readUint(i,n),n+=4;var d=l.readUshort(i,n);n+=2,l.readUshort(i,n),n+=2;var h=d>>>8;if((h&=15)!=0)throw"unknown kern table format: "+h;n=e.kern.readFormat0(i,n,c)}return c},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 c=0;c<u;c++){var f=s.readUshort(i,n);n+=2;var d=s.readUshort(i,n);n+=2;var h=s.readShort(i,n);n+=2,f!=l&&(a.glyph1.push(f),a.rval.push({glyph2:[],vals:[]}));var g=a.rval[a.rval.length-1];g.glyph2.push(d),g.vals.push(h),l=f}return n},e.loca={},e.loca.parse=function(i,n,a,s){var l=e._bin,u=[],c=s.head.indexToLocFormat,f=s.maxp.numGlyphs+1;if(c==0)for(var d=0;d<f;d++)u.push(l.readUshort(i,n+(d<<1))<<1);if(c==1)for(d=0;d<f;d++)u.push(l.readUint(i,n+(d<<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 c,f=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],d=n+=2,h=0;h<u;h++){var g=s.readUshort(i,n);n+=2;var p=s.readUshort(i,n);n+=2;var y=s.readUshort(i,n);n+=2;var E=s.readUshort(i,n);n+=2;var k=s.readUshort(i,n);n+=2;var b=s.readUshort(i,n);n+=2;var _,w=f[E],P=d+12*u+b;if(g==0)_=s.readUnicode(i,P,k/2);else if(g==3&&p==0)_=s.readUnicode(i,P,k/2);else if(p==0)_=s.readASCII(i,P,k);else if(p==1)_=s.readUnicode(i,P,k/2);else if(p==3)_=s.readUnicode(i,P,k/2);else{if(g!=1)throw"unknown encoding "+p+", platformID: "+g;_=s.readASCII(i,P,k),console.debug("reading unknown MAC encoding "+p+" as ASCII")}var T="p"+g+","+y.toString(16);l[T]==null&&(l[T]={}),l[T][w!==void 0?w:E]=_,l[T]._lang=y}for(var A in l)if(l[A].postScriptName!=null&&l[A]._lang==1033)return l[A];for(var A in l)if(l[A].postScriptName!=null&&l[A]._lang==0)return l[A];for(var A in l)if(l[A].postScriptName!=null&&l[A]._lang==3084)return l[A];for(var A in l)if(l[A].postScriptName!=null)return l[A];for(var A in l){c=A;break}return console.debug("returning name table with languageID "+l[c]._lang),l[c]},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,c=0;c<l.endCount.length;c++)if(n<=l.endCount[c]){u=c;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(c=0;c<l.groups.length;c++){var f=l.groups[c];if(f[0]<=n&&n<=f[1])return f[2]+(n-f[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,c=i.CFF.Private;if(u.ROS){for(var f=0;u.FDSelect[f+2]<=n;)f+=2;c=u.FDArray[u.FDSelect[f+1]].Private}e.U._drawCFF(i.CFF.CharStrings[n],l,u,c,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 c=u==s?l:u-1,f=u==l?s:u+1,d=1&i.flags[u],h=1&i.flags[c],g=1&i.flags[f],p=i.xs[u],y=i.ys[u];if(u==s)if(d){if(!h){e.U.P.moveTo(n,p,y);continue}e.U.P.moveTo(n,i.xs[c],i.ys[c])}else h?e.U.P.moveTo(n,i.xs[c],i.ys[c]):e.U.P.moveTo(n,(i.xs[c]+p)/2,(i.ys[c]+y)/2);d?h&&e.U.P.lineTo(n,p,y):g?e.U.P.qcurveTo(n,p,y,i.xs[f],i.ys[f]):e.U.P.qcurveTo(n,p,y,(p+i.xs[f])/2,(y+i.ys[f])/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 c=u.m,f=0;f<l.crds.length;f+=2){var d=l.crds[f],h=l.crds[f+1];a.crds.push(d*c.a+h*c.b+c.tx),a.crds.push(d*c.c+h*c.d+c.ty)}for(f=0;f<l.cmds.length;f++)a.cmds.push(l.cmds[f])}},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 c,f=a.tabs[u];if(!f.coverage||(c=e._lctf.coverageIndex(f.coverage,i[n]))!=-1){if(a.ltype==1)i[n],f.fmt==1?i[n]=i[n]+f.delta:i[n]=f.newg[c];else if(a.ltype==4)for(var d=f.vals[c],h=0;h<d.length;h++){var g=d[h],p=g.chain.length;if(!(p>l)){for(var y=!0,E=0,k=0;k<p;k++){for(;i[n+E+(1+k)]==-1;)E++;g.chain[k]!=i[n+E+(1+k)]&&(y=!1)}if(y){for(i[n]=g.nglyph,k=0;k<p+E;k++)i[n+k+1]=-1;break}}}else if(a.ltype==5&&f.fmt==2)for(var b=e._lctf.getInterval(f.cDef,i[n]),_=f.cDef[b+2],w=f.scset[_],P=0;P<w.length;P++){var T=w[P],A=T.input;if(!(A.length>l)){for(y=!0,k=0;k<A.length;k++){var z=e._lctf.getInterval(f.cDef,i[n+1+k]);if(b==-1&&f.cDef[z+2]!=A[k]){y=!1;break}}if(y){var U=T.substLookupRecords;for(h=0;h<U.length;h+=2)U[h],U[h+1]}}}else if(a.ltype==6&&f.fmt==3){if(!e.U._glsCovered(i,f.backCvg,n-f.backCvg.length)||!e.U._glsCovered(i,f.inptCvg,n)||!e.U._glsCovered(i,f.ahedCvg,n+f.inptCvg.length))continue;var q=f.lookupRec;for(P=0;P<q.length;P+=2){b=q[P];var x=s[q[P+1]];e.U._applySubs(i,n+b,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 c=n[u];if(c!=-1){for(var f=u<n.length-1&&n[u+1]!=-1?n[u+1]:0,d=e.U.glyphToPath(i,c),h=0;h<d.crds.length;h+=2)s.crds.push(d.crds[h]+l),s.crds.push(d.crds[h+1]);for(a&&s.cmds.push(a),h=0;h<d.cmds.length;h++)s.cmds.push(d.cmds[h]);a&&s.cmds.push("X"),l+=i.hmtx.aWidth[c],u<n.length-1&&(l+=e.U.getPairAdjustment(i,c,f))}}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,c){i.cmds.push("C"),i.crds.push(n,a,s,l,u,c)},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,c=n.nStems,f=n.haveWidth,d=n.width,h=n.open,g=0,p=n.x,y=n.y,E=0,k=0,b=0,_=0,w=0,P=0,T=0,A=0,z=0,U=0,q={val:0,size:0};g<i.length;){e.CFF.getCharString(i,g,q);var x=q.val;if(g+=q.size,x=="o1"||x=="o18")u.length%2!=0&&!f&&(d=u.shift()+s.nominalWidthX),c+=u.length>>1,u.length=0,f=!0;else if(x=="o3"||x=="o23")u.length%2!=0&&!f&&(d=u.shift()+s.nominalWidthX),c+=u.length>>1,u.length=0,f=!0;else if(x=="o4")u.length>1&&!f&&(d=u.shift()+s.nominalWidthX,f=!0),h&&e.U.P.closePath(l),y+=u.pop(),e.U.P.moveTo(l,p,y),h=!0;else if(x=="o5")for(;u.length>0;)p+=u.shift(),y+=u.shift(),e.U.P.lineTo(l,p,y);else if(x=="o6"||x=="o7")for(var L=u.length,D=x=="o6",Z=0;Z<L;Z++){var F=u.shift();D?p+=F:y+=F,D=!D,e.U.P.lineTo(l,p,y)}else if(x=="o8"||x=="o24"){L=u.length;for(var ne=0;ne+6<=L;)E=p+u.shift(),k=y+u.shift(),b=E+u.shift(),_=k+u.shift(),p=b+u.shift(),y=_+u.shift(),e.U.P.curveTo(l,E,k,b,_,p,y),ne+=6;x=="o24"&&(p+=u.shift(),y+=u.shift(),e.U.P.lineTo(l,p,y))}else{if(x=="o11")break;if(x=="o1234"||x=="o1235"||x=="o1236"||x=="o1237")x=="o1234"&&(k=y,b=(E=p+u.shift())+u.shift(),U=_=k+u.shift(),P=_,A=y,p=(T=(w=(z=b+u.shift())+u.shift())+u.shift())+u.shift(),e.U.P.curveTo(l,E,k,b,_,z,U),e.U.P.curveTo(l,w,P,T,A,p,y)),x=="o1235"&&(E=p+u.shift(),k=y+u.shift(),b=E+u.shift(),_=k+u.shift(),z=b+u.shift(),U=_+u.shift(),w=z+u.shift(),P=U+u.shift(),T=w+u.shift(),A=P+u.shift(),p=T+u.shift(),y=A+u.shift(),u.shift(),e.U.P.curveTo(l,E,k,b,_,z,U),e.U.P.curveTo(l,w,P,T,A,p,y)),x=="o1236"&&(E=p+u.shift(),k=y+u.shift(),b=E+u.shift(),U=_=k+u.shift(),P=_,T=(w=(z=b+u.shift())+u.shift())+u.shift(),A=P+u.shift(),p=T+u.shift(),e.U.P.curveTo(l,E,k,b,_,z,U),e.U.P.curveTo(l,w,P,T,A,p,y)),x=="o1237"&&(E=p+u.shift(),k=y+u.shift(),b=E+u.shift(),_=k+u.shift(),z=b+u.shift(),U=_+u.shift(),w=z+u.shift(),P=U+u.shift(),T=w+u.shift(),A=P+u.shift(),Math.abs(T-p)>Math.abs(A-y)?p=T+u.shift():y=A+u.shift(),e.U.P.curveTo(l,E,k,b,_,z,U),e.U.P.curveTo(l,w,P,T,A,p,y));else if(x=="o14"){if(u.length>0&&!f&&(d=u.shift()+a.nominalWidthX,f=!0),u.length==4){var oe=u.shift(),B=u.shift(),G=u.shift(),v=u.shift(),S=e.CFF.glyphBySE(a,G),C=e.CFF.glyphBySE(a,v);e.U._drawCFF(a.CharStrings[S],n,a,s,l),n.x=oe,n.y=B,e.U._drawCFF(a.CharStrings[C],n,a,s,l)}h&&(e.U.P.closePath(l),h=!1)}else if(x=="o19"||x=="o20")u.length%2!=0&&!f&&(d=u.shift()+s.nominalWidthX),c+=u.length>>1,u.length=0,f=!0,g+=c+7>>3;else if(x=="o21")u.length>2&&!f&&(d=u.shift()+s.nominalWidthX,f=!0),y+=u.pop(),p+=u.pop(),h&&e.U.P.closePath(l),e.U.P.moveTo(l,p,y),h=!0;else if(x=="o22")u.length>1&&!f&&(d=u.shift()+s.nominalWidthX,f=!0),p+=u.pop(),h&&e.U.P.closePath(l),e.U.P.moveTo(l,p,y),h=!0;else if(x=="o25"){for(;u.length>6;)p+=u.shift(),y+=u.shift(),e.U.P.lineTo(l,p,y);E=p+u.shift(),k=y+u.shift(),b=E+u.shift(),_=k+u.shift(),p=b+u.shift(),y=_+u.shift(),e.U.P.curveTo(l,E,k,b,_,p,y)}else if(x=="o26")for(u.length%2&&(p+=u.shift());u.length>0;)E=p,k=y+u.shift(),p=b=E+u.shift(),y=(_=k+u.shift())+u.shift(),e.U.P.curveTo(l,E,k,b,_,p,y);else if(x=="o27")for(u.length%2&&(y+=u.shift());u.length>0;)k=y,b=(E=p+u.shift())+u.shift(),_=k+u.shift(),p=b+u.shift(),y=_,e.U.P.curveTo(l,E,k,b,_,p,y);else if(x=="o10"||x=="o29"){var I=x=="o10"?s:a;if(u.length==0)console.debug("error: empty stack");else{var M=u.pop(),V=I.Subrs[M+I.Bias];n.x=p,n.y=y,n.nStems=c,n.haveWidth=f,n.width=d,n.open=h,e.U._drawCFF(V,n,a,s,l),p=n.x,y=n.y,c=n.nStems,f=n.haveWidth,d=n.width,h=n.open}}else if(x=="o30"||x=="o31"){var R=u.length,N=(ne=0,x=="o31");for(ne+=R-(L=-3&R);ne<L;)N?(k=y,b=(E=p+u.shift())+u.shift(),y=(_=k+u.shift())+u.shift(),L-ne==5?(p=b+u.shift(),ne++):p=b,N=!1):(E=p,k=y+u.shift(),b=E+u.shift(),_=k+u.shift(),p=b+u.shift(),L-ne==5?(y=_+u.shift(),ne++):y=_,N=!0),e.U.P.curveTo(l,E,k,b,_,p,y),ne+=4}else{if((x+"").charAt(0)=="o")throw console.debug("Unknown operation: "+x,i),x;u.push(x)}}}n.x=p,n.y=y,n.nStems=c,n.haveWidth=f,n.width=d,n.open=h};var r=e,o={Typr:r};return t.Typr=r,t.default=o,Object.defineProperty(t,"__esModule",{value:!0}),t}({}).Typr}function ph(){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=function(x,L){for(var D=new r(31),Z=0;Z<31;++Z)D[Z]=L+=1<<x[Z-1];var F=new o(D[30]);for(Z=1;Z<30;++Z)for(var ne=D[Z];ne<D[Z+1];++ne)F[ne]=ne-D[Z]<<5|Z;return[D,F]},l=s(i,2),u=l[0],c=l[1];u[28]=258,c[258]=28;for(var f=s(n,0)[0],d=new r(32768),h=0;h<32768;++h){var g=(43690&h)>>>1|(21845&h)<<1;g=(61680&(g=(52428&g)>>>2|(13107&g)<<2))>>>4|(3855&g)<<4,d[h]=((65280&g)>>>8|(255&g)<<8)>>>1}var p=function(x,L,D){for(var Z=x.length,F=0,ne=new r(L);F<Z;++F)++ne[x[F]-1];var oe,B=new r(L);for(F=0;F<L;++F)B[F]=B[F-1]+ne[F-1]<<1;if(D){oe=new r(1<<L);var G=15-L;for(F=0;F<Z;++F)if(x[F])for(var v=F<<4|x[F],S=L-x[F],C=B[x[F]-1]++<<S,I=C|(1<<S)-1;C<=I;++C)oe[d[C]>>>G]=v}else for(oe=new r(Z),F=0;F<Z;++F)x[F]&&(oe[F]=d[B[x[F]-1]++]>>>15-x[F]);return oe},y=new e(288);for(h=0;h<144;++h)y[h]=8;for(h=144;h<256;++h)y[h]=9;for(h=256;h<280;++h)y[h]=7;for(h=280;h<288;++h)y[h]=8;var E=new e(32);for(h=0;h<32;++h)E[h]=5;var k=p(y,9,1),b=p(E,5,1),_=function(x){for(var L=x[0],D=1;D<x.length;++D)x[D]>L&&(L=x[D]);return L},w=function(x,L,D){var Z=L/8|0;return(x[Z]|x[Z+1]<<8)>>(7&L)&D},P=function(x,L){var D=L/8|0;return(x[D]|x[D+1]<<8|x[D+2]<<16)>>(7&L)},T=["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"],A=function(x,L,D){var Z=new Error(L||T[x]);if(Z.code=x,Error.captureStackTrace&&Error.captureStackTrace(Z,A),!D)throw Z;return Z},z=function(x,L,D){var Z=x.length;if(!Z||D&&!D.l&&Z<5)return L||new e(0);var F=!L||D,ne=!D||D.i;D||(D={}),L||(L=new e(3*Z));var oe,B=function(ye){var Ne=L.length;if(ye>Ne){var ze=new e(Math.max(2*Ne,ye));ze.set(L),L=ze}},G=D.f||0,v=D.p||0,S=D.b||0,C=D.l,I=D.d,M=D.m,V=D.n,R=8*Z;do{if(!C){D.f=G=w(x,v,1);var N=w(x,v+1,3);if(v+=3,!N){var Q=x[(ce=((oe=v)/8|0)+(7&oe&&1)+4)-4]|x[ce-3]<<8,se=ce+Q;if(se>Z){ne&&A(0);break}F&&B(S+Q),L.set(x.subarray(ce,se),S),D.b=S+=Q,D.p=v=8*se;continue}if(N==1)C=k,I=b,M=9,V=5;else if(N==2){var Y=w(x,v,31)+257,W=w(x,v+10,15)+4,Se=Y+w(x,v+5,31)+1;v+=14;for(var ve=new e(Se),te=new e(19),le=0;le<W;++le)te[a[le]]=w(x,v+3*le,7);v+=3*W;var he=_(te),X=(1<<he)-1,ue=p(te,he,1);for(le=0;le<Se;){var ce,j=ue[w(x,v,X)];if(v+=15&j,(ce=j>>>4)<16)ve[le++]=ce;else{var ke=0,ie=0;for(ce==16?(ie=3+w(x,v,3),v+=2,ke=ve[le-1]):ce==17?(ie=3+w(x,v,7),v+=3):ce==18&&(ie=11+w(x,v,127),v+=7);ie--;)ve[le++]=ke}}var pe=ve.subarray(0,Y),ee=ve.subarray(Y);M=_(pe),V=_(ee),C=p(pe,M,1),I=p(ee,V,1)}else A(1);if(v>R){ne&&A(0);break}}F&&B(S+131072);for(var Pe=(1<<M)-1,de=(1<<V)-1,me=v;;me=v){var be=(ke=C[P(x,v)&Pe])>>>4;if((v+=15&ke)>R){ne&&A(0);break}if(ke||A(2),be<256)L[S++]=be;else{if(be==256){me=v,C=null;break}var Ce=be-254;if(be>264){var Ge=i[le=be-257];Ce=w(x,v,(1<<Ge)-1)+u[le],v+=Ge}var Ze=I[P(x,v)&de],Ee=Ze>>>4;if(Ze||A(3),v+=15&Ze,ee=f[Ee],Ee>3&&(Ge=n[Ee],ee+=P(x,v)&(1<<Ge)-1,v+=Ge),v>R){ne&&A(0);break}F&&B(S+131072);for(var Ae=S+Ce;S<Ae;S+=4)L[S]=L[S-ee],L[S+1]=L[S+1-ee],L[S+2]=L[S+2-ee],L[S+3]=L[S+3-ee];S=Ae}}D.l=C,D.p=me,D.b=S,C&&(G=1,D.m=M,D.d=I,D.n=V)}while(!G);return S==L.length?L:function(ye,Ne,ze){(Ne==null||Ne<0)&&(Ne=0),(ze==null||ze>ye.length)&&(ze=ye.length);var it=new(ye instanceof r?r:ye instanceof o?o:e)(ze-Ne);return it.set(ye.subarray(Ne,ze)),it}(L,0,S)},U=new e(0),q=typeof TextDecoder<"u"&&new TextDecoder;try{q.decode(U,{stream:!0})}catch{}return t.convert_streams=function(x){var L=new DataView(x),D=0;function Z(){var Y=L.getUint16(D);return D+=2,Y}function F(){var Y=L.getUint32(D);return D+=4,Y}function ne(Y){Q.setUint16(se,Y),se+=2}function oe(Y){Q.setUint32(se,Y),se+=4}for(var B={signature:F(),flavor:F(),length:F(),numTables:Z(),reserved:Z(),totalSfntSize:F(),majorVersion:Z(),minorVersion:Z(),metaOffset:F(),metaLength:F(),metaOrigLength:F(),privOffset:F(),privLength:F()},G=0;Math.pow(2,G)<=B.numTables;)G++;G--;for(var v=16*Math.pow(2,G),S=16*B.numTables-v,C=12,I=[],M=0;M<B.numTables;M++)I.push({tag:F(),offset:F(),compLength:F(),origLength:F(),origChecksum:F()}),C+=16;var V,R=new Uint8Array(12+16*I.length+I.reduce(function(Y,W){return Y+W.origLength+4},0)),N=R.buffer,Q=new DataView(N),se=0;return oe(B.flavor),ne(B.numTables),ne(v),ne(G),ne(S),I.forEach(function(Y){oe(Y.tag),oe(Y.origChecksum),oe(C),oe(Y.origLength),Y.outOffset=C,(C+=Y.origLength)%4!=0&&(C+=4-C%4)}),I.forEach(function(Y){var W,Se=x.slice(Y.offset,Y.offset+Y.compLength);if(Y.compLength!=Y.origLength){var ve=new Uint8Array(Y.origLength);W=new Uint8Array(Se,2),z(W,ve)}else ve=new Uint8Array(Se);R.set(ve,Y.outOffset);var te=0;(C=Y.outOffset+Y.origLength)%4!=0&&(te=4-C%4),R.set(new Uint8Array(te).buffer,Y.outOffset+Y.origLength),V=C+te}),N.slice(0,V)},Object.defineProperty(t,"__esModule",{value:!0}),t}({}).convert_streams}function mh(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,c;function f(T){if(!c){let A={R:n,L:i,D:a,C:l,U:u,T:s};c=new Map;for(let z in o){let U=0;o[z].split(",").forEach(q=>{let[x,L]=q.split("+");x=parseInt(x,36),L=L?parseInt(L,36):0,c.set(U+=x,A[z]);for(let D=L;D--;)c.set(++U,A[z])})}}return c.get(T)||u}let d=1,h=2,g=3,p=4,y=[null,"isol","init","fina","medi"];function E(T){let A=new Uint8Array(T.length),z=u,U=d,q=-1;for(let x=0;x<T.length;x++){let L=T.codePointAt(x),D=f(L)|0,Z=d;D&s||(z&(i|a|l)?D&(n|a|l)?(Z=g,(U===d||U===g)&&A[q]++):D&(i|u)&&(U===h||U===p)&&A[q]--:z&(n|u)&&(U===h||U===p)&&A[q]--,U=A[x]=Z,z=D,q=x,L>65535&&x++)}return A}function k(T,A){let z=[];for(let q=0;q<A.length;q++){let x=A.codePointAt(q);x>65535&&q++,z.push(t.U.codeToGlyph(T,x))}let U=T.GSUB;if(U){let{lookupList:q,featureList:x}=U,L,D=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,Z=[];x.forEach(F=>{if(D.test(F.tag))for(let ne=0;ne<F.tab.length;ne++){if(Z[F.tab[ne]])continue;Z[F.tab[ne]]=!0;let oe=q[F.tab[ne]],B=/^(isol|init|fina|medi)$/.test(F.tag);B&&!L&&(L=E(A));for(let G=0;G<z.length;G++)(!L||!B||y[L[G]]===F.tag)&&t.U._applySubs(z,G,oe,q)}})}return z}function b(T,A){let z=new Int16Array(A.length*3),U=0;for(;U<A.length;U++){let D=A[U];if(D===-1)continue;z[U*3+2]=T.hmtx.aWidth[D];let Z=T.GPOS;if(Z){let F=Z.lookupList;for(let ne=0;ne<F.length;ne++){let oe=F[ne];for(let B=0;B<oe.tabs.length;B++){let G=oe.tabs[B];if(oe.ltype===1){if(t._lctf.coverageIndex(G.coverage,D)!==-1&&G.pos){L(G.pos,U);break}}else if(oe.ltype===2){let v=null,S=q();if(S!==-1){let C=t._lctf.coverageIndex(G.coverage,A[S]);if(C!==-1){if(G.fmt===1){let I=G.pairsets[C];for(let M=0;M<I.length;M++)I[M].gid2===D&&(v=I[M])}else if(G.fmt===2){let I=t.U._getGlyphClass(A[S],G.classDef1),M=t.U._getGlyphClass(D,G.classDef2);v=G.matrix[I][M]}if(v){v.val1&&L(v.val1,S),v.val2&&L(v.val2,U);break}}}}else if(oe.ltype===4){let v=t._lctf.coverageIndex(G.markCoverage,D);if(v!==-1){let S=q(x),C=S===-1?-1:t._lctf.coverageIndex(G.baseCoverage,A[S]);if(C!==-1){let I=G.markArray[v],M=G.baseArray[C][I.markClass];z[U*3]=M.x-I.x+z[S*3]-z[S*3+2],z[U*3+1]=M.y-I.y+z[S*3+1];break}}}else if(oe.ltype===6){let v=t._lctf.coverageIndex(G.mark1Coverage,D);if(v!==-1){let S=q();if(S!==-1){let C=A[S];if(_(T,C)===3){let I=t._lctf.coverageIndex(G.mark2Coverage,C);if(I!==-1){let M=G.mark1Array[v],V=G.mark2Array[I][M.markClass];z[U*3]=V.x-M.x+z[S*3]-z[S*3+2],z[U*3+1]=V.y-M.y+z[S*3+1];break}}}}}}}}else if(T.kern&&!T.cff){let F=q();if(F!==-1){let ne=T.kern.glyph1.indexOf(A[F]);if(ne!==-1){let oe=T.kern.rval[ne].glyph2.indexOf(D);oe!==-1&&(z[F*3+2]+=T.kern.rval[ne].vals[oe])}}}}return z;function q(D){for(let Z=U-1;Z>=0;Z--)if(A[Z]!==-1&&(!D||D(A[Z])))return Z;return-1}function x(D){return _(T,D)===1}function L(D,Z){for(let F=0;F<3;F++)z[Z*3+F]+=D[F]||0}}function _(T,A){let z=T.GDEF&&T.GDEF.glyphClassDef;return z?t.U._getGlyphClass(A,z):0}function w(...T){for(let A=0;A<T.length;A++)if(typeof T[A]=="number")return T[A]}function P(T){let A=Object.create(null),z=T["OS/2"],U=T.hhea,q=T.head.unitsPerEm,x=w(z&&z.sTypoAscender,U&&U.ascender,q),L={unitsPerEm:q,ascender:x,descender:w(z&&z.sTypoDescender,U&&U.descender,0),capHeight:w(z&&z.sCapHeight,x),xHeight:w(z&&z.sxHeight,x),lineGap:w(z&&z.sTypoLineGap,U&&U.lineGap),supportsCodePoint(D){return t.U.codeToGlyph(T,D)>0},forEachGlyph(D,Z,F,ne){let oe=0,B=1/L.unitsPerEm*Z,G=k(T,D),v=0,S=b(T,G);return G.forEach((C,I)=>{if(C!==-1){let M=A[C];if(!M){let{cmds:V,crds:R}=t.U.glyphToPath(T,C),N="",Q=0;for(let ve=0,te=V.length;ve<te;ve++){let le=r[V[ve]];N+=V[ve];for(let he=1;he<=le;he++)N+=(he>1?",":"")+R[Q++]}let se,Y,W,Se;if(R.length){se=Y=1/0,W=Se=-1/0;for(let ve=0,te=R.length;ve<te;ve+=2){let le=R[ve],he=R[ve+1];le<se&&(se=le),he<Y&&(Y=he),le>W&&(W=le),he>Se&&(Se=he)}}else se=W=Y=Se=0;M=A[C]={index:C,advanceWidth:T.hmtx.aWidth[C],xMin:se,yMin:Y,xMax:W,yMax:Se,path:N}}ne.call(null,M,oe+S[I*3]*B,S[I*3+1]*B,v),oe+=S[I*3+2]*B,F&&(oe+=F*Z)}v+=D.codePointAt(v)>65535?2:1}),oe}};return L}return function(A){let z=new Uint8Array(A,0,4),U=t._bin.readASCII(z,0,4);if(U==="wOFF")A=e(A);else if(U==="wOF2")throw new Error("woff2 fonts not supported");return P(t.parse(A)[0])}}var gh=Er({name:"Typr Font Parser",dependencies:[hh,ph,mh],init(t,e,r){let o=t(),i=e();return r(o,i)}});function vh(){return function(t){var e=function(){this.buckets=new Map};e.prototype.add=function(b){var _=b>>5;this.buckets.set(_,(this.buckets.get(_)||0)|1<<(31&b))},e.prototype.has=function(b){var _=this.buckets.get(b>>5);return _!==void 0&&(_&1<<(31&b))!=0},e.prototype.serialize=function(){var b=[];return this.buckets.forEach(function(_,w){b.push((+w).toString(36)+":"+_.toString(36))}),b.join(",")},e.prototype.deserialize=function(b){var _=this;this.buckets.clear(),b.split(",").forEach(function(w){var P=w.split(":");_.buckets.set(parseInt(P[0],36),parseInt(P[1],36))})};var r=Math.pow(2,8),o=r-1,i=~o;function n(b){var _=function(P){return P&i}(b).toString(16),w=function(P){return(P&i)+r-1}(b).toString(16);return"codepoint-index/plane"+(b>>16)+"/"+_+"-"+w+".json"}function a(b,_){var w=b&o,P=_.codePointAt(w/6|0);return((P=(P||48)-48)&1<<w%6)!=0}function s(b,_){var w;(w=b,w.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map(function(P){return P.split("-").map(function(T){return parseInt(T.trim(),16)})})).forEach(function(P){var T=P[0],A=P[1];A===void 0&&(A=T),_(T,A)})}function l(b,_){s(b,function(w,P){for(var T=w;T<=P;T++)_(T)})}var u={},c={},f=new WeakMap,d="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function h(b){var _=f.get(b);return _||(_=new e,l(b.ranges,function(w){return _.add(w)}),f.set(b,_)),_}var g,p=new Map;function y(b,_,w){return b[_]?_:b[w]?w:function(P){for(var T in P)return T}(b)}function E(b,_){var w=_;if(!b.includes(w)){w=1/0;for(var P=0;P<b.length;P++)Math.abs(b[P]-_)<Math.abs(w-_)&&(w=b[P])}return w}function k(b){return g||(g=new Set,l("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",function(_){g.add(_)})),g.has(b)}return t.CodePointSet=e,t.clearCache=function(){u={},c={}},t.getFontsForString=function(b,_){_===void 0&&(_={});var w,P=_.lang;P===void 0&&(P=new RegExp("\\p{Script=Hangul}","u").test(w=b)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(w)?"ja":"en");var T=_.category;T===void 0&&(T="sans-serif");var A=_.style;A===void 0&&(A="normal");var z=_.weight;z===void 0&&(z=400);var U=(_.dataUrl||d).replace(/\/$/g,""),q=new Map,x=new Uint8Array(b.length),L={},D={},Z=new Array(b.length),F=new Map,ne=!1;function oe(v){var S=p.get(v);return S||(S=fetch(U+"/"+v).then(function(C){if(!C.ok)throw new Error(C.statusText);return C.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(C){if(U!==d)return ne||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+U+'", trying default CDN. '+C.message),ne=!0),U=d,p.delete(v),oe(v);throw C}),p.set(v,S)),S}for(var B=function(v){var S=b.codePointAt(v),C=n(S);Z[v]=C,u[C]||F.has(C)||F.set(C,oe(C).then(function(I){u[C]=I})),S>65535&&(v++,G=v)},G=0;G<b.length;G++)B(G);return Promise.all(F.values()).then(function(){F.clear();for(var v=function(C){var I=b.codePointAt(C),M=null,V=u[Z[C]],R=void 0;for(var N in V){var Q=D[N];if(Q===void 0&&(Q=D[N]=new RegExp(N).test(P||"en")),Q){for(var se in R=N,V[N])if(a(I,V[N][se])){M=se;break}break}}if(!M){e:for(var Y in V)if(Y!==R){for(var W in V[Y])if(a(I,V[Y][W])){M=W;break e}}}M||(console.debug("No font coverage for U+"+I.toString(16)),M="latin"),Z[C]=M,c[M]||F.has(M)||F.set(M,oe("font-meta/"+M+".json").then(function(Se){c[M]=Se})),I>65535&&(C++,S=C)},S=0;S<b.length;S++)v(S);return Promise.all(F.values())}).then(function(){for(var v,S=null,C=0;C<b.length;C++){var I=b.codePointAt(C);if(S&&(k(I)||h(S).has(I)))x[C]=x[C-1];else{S=c[Z[C]];var M=L[S.id];if(!M){var V=S.typeforms,R=y(V,T,"sans-serif"),N=y(V[R],A,"normal"),Q=E((v=V[R])===null||v===void 0?void 0:v[N],z);M=L[S.id]=U+"/font-files/"+S.id+"/"+R+"."+N+"."+Q+".woff"}var se=q.get(M);se==null&&(se=q.size,q.set(M,se)),x[C]=se}I>65535&&(C++,x[C]=x[C-1])}return{fontUrls:Array.from(q.keys()),chars:x}})},Object.defineProperty(t,"__esModule",{value:!0}),t}({})}function yh(t,e){let r=Object.create(null),o=Object.create(null);function i(a,s){let l=u=>{console.error("Failure loading font ".concat(a),u)};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 c=t(u.response);c.src=a,s(c)}catch(c){l(c)}},u.onerror=l,u.send()}catch(u){l(u)}}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(c=>c(u)),delete o[a]}))}return function(a,s,{lang:l,fonts:u=[],style:c="normal",weight:f="normal",unicodeFontsURL:d}={}){let h=new Uint8Array(a.length),g=[];a.length||k();let p=new Map,y=[];if(c!=="italic"&&(c="normal"),typeof f!="number"&&(f=f==="bold"?700:400),u&&!Array.isArray(u)&&(u=[u]),u=u.slice().filter(_=>!_.lang||_.lang.test(l)).reverse(),u.length){let T=0;(function A(z=0){for(let U=z,q=a.length;U<q;U++){let x=a.codePointAt(U);if(T===1&&g[h[U-1]].supportsCodePoint(x)||U>0&&/\s/.test(a[U]))h[U]=h[U-1],T===2&&(y[y.length-1][1]=U);else for(let L=h[U],D=u.length;L<=D;L++)if(L===D){let Z=T===2?y[y.length-1]:y[y.length]=[U,U];Z[1]=U,T=2}else{h[U]=L;let{src:Z,unicodeRange:F}=u[L];if(!F||b(x,F)){let ne=r[Z];if(!ne){n(Z,()=>{A(U)});return}if(ne.supportsCodePoint(x)){let oe=p.get(ne);typeof oe!="number"&&(oe=g.length,g.push(ne),p.set(ne,oe)),h[U]=oe,T=1;break}}}x>65535&&U+1<q&&(h[U+1]=h[U],U++,T===2&&(y[y.length-1][1]=U))}E()})()}else y.push([0,a.length-1]),E();function E(){if(y.length){let _=y.map(w=>a.substring(w[0],w[1]+1)).join("\n");e.getFontsForString(_,{lang:l||void 0,style:c,weight:f,dataUrl:d}).then(({fontUrls:w,chars:P})=>{let T=g.length,A=0;y.forEach(U=>{for(let q=0,x=U[1]-U[0];q<=x;q++)h[U[0]+q]=P[A++]+T;A++});let z=0;w.forEach((U,q)=>{n(U,x=>{g[q+T]=x,++z===w.length&&k()})})})}else k()}function k(){s({chars:h,fonts:g})}function b(_,w){for(let P=0;P<w.length;P++){let[T,A=T]=w[P];if(T<=_&&_<=A)return!0}return!1}}}var bh=Er({name:"FontResolver",dependencies:[yh,gh,vh],init(t,e,r){return t(e,r())}});function xh(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:g,lang:p,fonts:y,style:E,weight:k,preResolvedFonts:b,unicodeFontsURL:_},w){let P=({chars:T,fonts:A})=>{let z,U,q=[];for(let x=0;x<T.length;x++)T[x]!==U?(U=T[x],q.push(z={start:x,end:x,fontObj:A[T[x]]})):z.end=x;w(q)};b?P(b):t(g,P,{lang:p,fonts:y,style:E,weight:k,unicodeFontsURL:_})}function s({text:g="",font:p,lang:y,sdfGlyphSize:E=64,fontSize:k=400,fontWeight:b=1,fontStyle:_="normal",letterSpacing:w=0,lineHeight:P="normal",maxWidth:T=1/0,direction:A,textAlign:z="left",textIndent:U=0,whiteSpace:q="normal",overflowWrap:x="normal",anchorX:L=0,anchorY:D=0,metricsOnly:Z=!1,unicodeFontsURL:F,preResolvedFonts:ne=null,includeCaretPositions:oe=!1,chunkedBoundsSize:B=8192,colorRanges:G=null},v){let S=f(),C={fontLoad:0,typesetting:0};g.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),g=g.replace(/\r\n/g,"\n").replace(/\r/g,"\n")),k=+k,w=+w,T=+T,P=P||"normal",U=+U,a({text:g,lang:y,style:_,weight:b,fonts:typeof p=="string"?[{src:p}]:p,unicodeFontsURL:F,preResolvedFonts:ne},I=>{C.fontLoad=f()-S;let M=isFinite(T),V=null,R=null,N=null,Q=null,se=null,Y=null,W=null,Se=null,ve=0,te=0,le=q!=="nowrap",he=new Map,X=f(),ue=U,ce=0,j=new d,ke=[j];I.forEach(de=>{let{fontObj:me}=de,{ascender:be,descender:Ce,unitsPerEm:Ge,lineGap:Ze,capHeight:Ee,xHeight:Ae}=me,ye=he.get(me);if(!ye){let Te=k/Ge,Re=P==="normal"?(be-Ce+Ze)*Te:P*k,Wt=(Re-(be-Ce)*Te)/2,Ue=Math.min(Re,(be-Ce)*Te),Ie=(be+Ce)/2*Te+Ue/2;ye={index:he.size,src:me.src,fontObj:me,fontSizeMult:Te,unitsPerEm:Ge,ascender:be*Te,descender:Ce*Te,capHeight:Ee*Te,xHeight:Ae*Te,lineHeight:Re,baseline:-Wt-be*Te,caretTop:Ie,caretBottom:Ie-Ue},he.set(me,ye)}let{fontSizeMult:Ne}=ye,ze=g.slice(de.start,de.end+1),it,Fe;me.forEachGlyph(ze,k,w,(Te,Re,Wt,Ue)=>{Re+=ce,Ue+=de.start,it=Re,Fe=Te;let Ie=g.charAt(Ue),Ye=Te.advanceWidth*Ne,Ve=j.count,De;if("isEmpty"in Te||(Te.isWhitespace=!!Ie&&new RegExp(i).test(Ie),Te.canBreakAfter=!!Ie&&n.test(Ie),Te.isEmpty=Te.xMin===Te.xMax||Te.yMin===Te.yMax||o.test(Ie)),!Te.isWhitespace&&!Te.isEmpty&&te++,le&&M&&!Te.isWhitespace&&Re+Ye+ue>T&&Ve){if(j.glyphAt(Ve-1).glyphObj.canBreakAfter)De=new d,ue=-Re;else for(let $e=Ve;$e--;)if($e===0&&x==="break-word"){De=new d,ue=-Re;break}else if(j.glyphAt($e).glyphObj.canBreakAfter){De=j.splitAt($e+1);let qe=De.glyphAt(0).x;ue-=qe;for(let Xe=De.count;Xe--;)De.glyphAt(Xe).x-=qe;break}De&&(j.isSoftWrapped=!0,j=De,ke.push(j),ve=T)}let We=j.glyphAt(j.count);We.glyphObj=Te,We.x=Re+ue,We.y=Wt,We.width=Ye,We.charIndex=Ue,We.fontData=ye,Ie==="\n"&&(j=new d,ke.push(j),ue=-(Re+Ye+w*k)+U)}),ce=it+Fe.advanceWidth*Ne+w*k});let ie=0;ke.forEach(de=>{let me=!0;for(let be=de.count;be--;){let Ce=de.glyphAt(be);me&&!Ce.glyphObj.isWhitespace&&(de.width=Ce.x+Ce.width,de.width>ve&&(ve=de.width),me=!1);let{lineHeight:Ge,capHeight:Ze,xHeight:Ee,baseline:Ae}=Ce.fontData;Ge>de.lineHeight&&(de.lineHeight=Ge);let ye=Ae-de.baseline;ye<0&&(de.baseline+=ye,de.cap+=ye,de.ex+=ye),de.cap=Math.max(de.cap,de.baseline+Ze),de.ex=Math.max(de.ex,de.baseline+Ee)}de.baseline-=ie,de.cap-=ie,de.ex-=ie,ie+=de.lineHeight});let pe=0,ee=0;if(L&&(typeof L=="number"?pe=-L:typeof L=="string"&&(pe=-ve*(L==="left"?0:L==="center"?.5:L==="right"?1:u(L)))),D&&(typeof D=="number"?ee=-D:typeof D=="string"&&(ee=D==="top"?0:D==="top-baseline"?-ke[0].baseline:D==="top-cap"?-ke[0].cap:D==="top-ex"?-ke[0].ex:D==="middle"?ie/2:D==="bottom"?ie:D==="bottom-baseline"?-ke[ke.length-1].baseline:u(D)*ie)),!Z){let de=e.getEmbeddingLevels(g,A);V=new Uint16Array(te),R=new Uint8Array(te),N=new Float32Array(te*2),Q={},W=[1/0,1/0,-1/0,-1/0],Se=[],oe&&(Y=new Float32Array(g.length*4)),G&&(se=new Uint8Array(te*3));let me=0,be=-1,Ce=-1,Ge,Ze;if(ke.forEach((Ee,Ae)=>{let{count:ye,width:Ne}=Ee;if(ye>0){let ze=0;for(let Ue=ye;Ue--&&Ee.glyphAt(Ue).glyphObj.isWhitespace;)ze++;let it=0,Fe=0;if(z==="center")it=(ve-Ne)/2;else if(z==="right")it=ve-Ne;else if(z==="justify"&&Ee.isSoftWrapped){let Ue=0;for(let Ie=ye-ze;Ie--;)Ee.glyphAt(Ie).glyphObj.isWhitespace&&Ue++;Fe=(ve-Ne)/Ue}if(Fe||it){let Ue=0;for(let Ie=0;Ie<ye;Ie++){let Ye=Ee.glyphAt(Ie),Ve=Ye.glyphObj;Ye.x+=it+Ue,Fe!==0&&Ve.isWhitespace&&Ie<ye-ze&&(Ue+=Fe,Ye.width+=Fe)}}let Te=e.getReorderSegments(g,de,Ee.glyphAt(0).charIndex,Ee.glyphAt(Ee.count-1).charIndex);for(let Ue=0;Ue<Te.length;Ue++){let[Ie,Ye]=Te[Ue],Ve=1/0,De=-1/0;for(let We=0;We<ye;We++)if(Ee.glyphAt(We).charIndex>=Ie){let $e=We,qe=We;for(;qe<ye;qe++){let Xe=Ee.glyphAt(qe);if(Xe.charIndex>Ye)break;qe<ye-ze&&(Ve=Math.min(Ve,Xe.x),De=Math.max(De,Xe.x+Xe.width))}for(let Xe=$e;Xe<qe;Xe++){let gt=Ee.glyphAt(Xe);gt.x=De-(gt.x+gt.width-Ve)}break}}let Re,Wt=Ue=>Re=Ue;for(let Ue=0;Ue<ye;Ue++){let Ie=Ee.glyphAt(Ue);Re=Ie.glyphObj;let Ye=Re.index,Ve=de.levels[Ie.charIndex]&1;if(Ve){let De=e.getMirroredCharacter(g[Ie.charIndex]);De&&Ie.fontData.fontObj.forEachGlyph(De,0,0,Wt)}if(oe){let{charIndex:De,fontData:We}=Ie,$e=Ie.x+pe,qe=Ie.x+Ie.width+pe;Y[De*4]=Ve?qe:$e,Y[De*4+1]=Ve?$e:qe,Y[De*4+2]=Ee.baseline+We.caretBottom+ee,Y[De*4+3]=Ee.baseline+We.caretTop+ee;let Xe=De-be;Xe>1&&c(Y,be,Xe),be=De}if(G){let{charIndex:De}=Ie;for(;De>Ce;)Ce++,G.hasOwnProperty(Ce)&&(Ze=G[Ce])}if(!Re.isWhitespace&&!Re.isEmpty){let De=me++,{fontSizeMult:We,src:$e,index:qe}=Ie.fontData,Xe=Q[$e]||(Q[$e]={});Xe[Ye]||(Xe[Ye]={path:Re.path,pathBounds:[Re.xMin,Re.yMin,Re.xMax,Re.yMax]});let gt=Ie.x+pe,Ht=Ie.y+Ee.baseline+ee;N[De*2]=gt,N[De*2+1]=Ht;let Pt=gt+Re.xMin*We,Zt=Ht+Re.yMin*We,or=gt+Re.xMax*We,Rt=Ht+Re.yMax*We;Pt<W[0]&&(W[0]=Pt),Zt<W[1]&&(W[1]=Zt),or>W[2]&&(W[2]=or),Rt>W[3]&&(W[3]=Rt),De%B===0&&(Ge={start:De,end:De,rect:[1/0,1/0,-1/0,-1/0]},Se.push(Ge)),Ge.end++;let et=Ge.rect;if(Pt<et[0]&&(et[0]=Pt),Zt<et[1]&&(et[1]=Zt),or>et[2]&&(et[2]=or),Rt>et[3]&&(et[3]=Rt),V[De]=Ye,R[De]=qe,G){let ar=De*3;se[ar]=Ze>>16&255,se[ar+1]=Ze>>8&255,se[ar+2]=Ze&255}}}}}),Y){let Ee=g.length-be;Ee>1&&c(Y,be,Ee)}}let Pe=[];he.forEach(({index:de,src:me,unitsPerEm:be,ascender:Ce,descender:Ge,lineHeight:Ze,capHeight:Ee,xHeight:Ae})=>{Pe[de]={src:me,unitsPerEm:be,ascender:Ce,descender:Ge,lineHeight:Ze,capHeight:Ee,xHeight:Ae}}),C.typesetting=f()-X,v({glyphIds:V,glyphFontIndices:R,glyphPositions:N,glyphData:Q,fontData:Pe,caretPositions:Y,glyphColors:se,chunkedBounds:Se,fontSize:k,topBaseline:ee+ke[0].baseline,blockBounds:[pe,ee-ie,pe+ve,ee],visibleBounds:W,timings:C})})}function l(g,p){s({...g,metricsOnly:!0},y=>{let[E,k,b,_]=y.blockBounds;p({width:b-E,height:_-k})})}function u(g){let p=g.match(/^([\d.]+)%$/),y=p?parseFloat(p[1]):NaN;return isNaN(y)?0:y/100}function c(g,p,y){let E=g[p*4],k=g[p*4+1],b=g[p*4+2],_=g[p*4+3],w=(k-E)/y;for(let P=0;P<y;P++){let T=(p+P)*4;g[T]=E+w*P,g[T+1]=E+w*(P+1),g[T+2]=b,g[T+3]=_}}function f(){return(self.performance||Date).now()}function d(){this.data=[]}let h=["glyphObj","x","y","width","charIndex","fontData"];return d.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/h.length)},glyphAt(g){let p=d.flyweight;return p.data=this.data,p.index=g,p},splitAt(g){let p=new d;return p.data=this.data.splice(g*h.length),p}},d.flyweight=h.reduce((g,p,y,E)=>(Object.defineProperty(g,p,{get(){return this.data[this.index*h.length+y]},set(k){this.data[this.index*h.length+y]=k}}),g),{data:null,index:0}),{typeset:s,measure:l}}var Or=()=>(self.performance||Date).now(),Li=Vo(),kl;function _h(t,e,r,o,i,n,a,s,l,u,c=!0){return c?Sh(t,e,r,o,i,n,a,s,l,u).then(null,f=>(kl||(console.warn("WebGL SDF generation failed, falling back to JS",f),kl=!0),Ml(t,e,r,o,i,n,a,s,l,u))):Ml(t,e,r,o,i,n,a,s,l,u)}var Ri=[],Th=5,Ko=0;function Ll(){let t=Or();for(;Ri.length&&Or()-t<Th;)Ri.shift()();Ko=Ri.length?setTimeout(Ll,0):0}var Sh=(...t)=>new Promise((e,r)=>{Ri.push(()=>{let o=Or();try{Li.webgl.generateIntoCanvas(...t),e({timing:Or()-o})}catch(i){r(i)}}),Ko||(Ko=setTimeout(Ll,0))}),kh=4,wh=2e3,wl={},Mh=0;function Ml(t,e,r,o,i,n,a,s,l,u){let c="TroikaTextSDFGenerator_JS_"+Mh++%kh,f=wl[c];return f||(f=wl[c]={workerModule:Er({name:c,workerId:c,dependencies:[Vo,Or],init(d,h){let g=d().javascript.generate;return function(...p){let y=h();return{textureData:g(...p),timing:h()-y}}},getTransferables(d){return[d.textureData.buffer]}}),requests:0,idleTimer:null}),f.requests++,clearTimeout(f.idleTimer),f.workerModule(t,e,r,o,i,n).then(({textureData:d,timing:h})=>{let g=Or(),p=new Uint8Array(d.length*4);for(let y=0;y<d.length;y++)p[y*4+u]=d[y];return Li.webglUtils.renderImageData(a,p,s,l,t,e,1<<3-u),h+=Or()-g,--f.requests===0&&(f.idleTimer=setTimeout(()=>{yl(c)},wh)),{timing:h}})}function Ch(t){t._warm||(Li.webgl.isSupported(t),t._warm=!0)}var Dh=Li.webglUtils.resizeWebGLCanvasWithoutClearing,Ir={defaultFontURL:null,unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048,useWorker:!0},Eh=new st,Ah=!1;function on(){return(self.performance||Date).now()}var Cl=Object.create(null);function Gl(t,e){Ah=!0,t=Oh({},t);let r=on(),{defaultFontURL:o}=Ir,i=[];if(o&&i.push({label:"default",src:Dl(o)}),t.font&&i.push({label:"user",src:Dl(t.font)}),t.font=i,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||Ir.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||Ir.unicodeFontsURL,t.colorRanges!=null){let h={};for(let g in t.colorRanges)if(t.colorRanges.hasOwnProperty(g)){let p=t.colorRanges[g];typeof p!="number"&&(p=Eh.set(p).getHex()),h[g]=p}t.colorRanges=h}Object.freeze(t);let{textureWidth:n,sdfExponent:a}=Ir,{sdfGlyphSize:s}=t,l=n/s*4,u=Cl[s];if(!u){let h=document.createElement("canvas");h.width=n,h.height=s*256/l,u=Cl[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:h,sdfTexture:new Ba(h,void 0,void 0,void 0,lo,lo),contextLost:!1,glyphsByFont:new Map},u.sdfTexture.generateMipmaps=!1,Ih(u)}let{sdfTexture:c,sdfCanvas:f}=u;(Ir.useWorker?Nl:Rh)(t).then(h=>{let{glyphIds:g,glyphFontIndices:p,fontData:y,glyphPositions:E,fontSize:k,timings:b}=h,_=[],w=new Float32Array(g.length*4),P=0,T=0,A=on(),z=y.map(D=>{let Z=u.glyphsByFont.get(D.src);return Z||u.glyphsByFont.set(D.src,Z=new Map),Z});g.forEach((D,Z)=>{let F=p[Z],{src:ne,unitsPerEm:oe}=y[F],B=z[F].get(D);if(!B){let{path:I,pathBounds:M}=h.glyphData[ne][D],V=Math.max(M[2]-M[0],M[3]-M[1])/s*(Ir.sdfMargin*s+.5),R=u.glyphCount++,N=[M[0]-V,M[1]-V,M[2]+V,M[3]+V];z[F].set(D,B={path:I,atlasIndex:R,sdfViewBox:N}),_.push(B)}let{sdfViewBox:G}=B,v=E[T++],S=E[T++],C=k/oe;w[P++]=v+G[0]*C,w[P++]=S+G[1]*C,w[P++]=v+G[2]*C,w[P++]=S+G[3]*C,g[Z]=B.atlasIndex}),b.quads=(b.quads||0)+(on()-A);let U=on();b.sdf={};let q=f.height,x=Math.ceil(u.glyphCount/l),L=Math.pow(2,Math.ceil(Math.log2(x*s)));L>q&&(console.info("Increasing SDF texture size ".concat(q,"->").concat(L)),Dh(f,n,L),c.dispose()),Promise.all(_.map(D=>Fl(D,u,t.gpuAccelerateSDF).then(({timing:Z})=>{b.sdf[D.atlasIndex]=Z}))).then(()=>{_.length&&!u.contextLost&&(Bl(u),c.needsUpdate=!0),b.sdfTotal=on()-U,b.total=on()-r,e(Object.freeze({parameters:t,sdfTexture:c,sdfGlyphSize:s,sdfExponent:a,glyphBounds:w,glyphAtlasIndices:g,glyphColors:h.glyphColors,caretPositions:h.caretPositions,chunkedBounds:h.chunkedBounds,ascender:h.ascender,descender:h.descender,lineHeight:h.lineHeight,capHeight:h.capHeight,xHeight:h.xHeight,topBaseline:h.topBaseline,blockBounds:h.blockBounds,visibleBounds:h.visibleBounds,timings:h.timings}))})}),Promise.resolve().then(()=>{u.contextLost||Ch(f)})}function Fl({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}=Ir,u=Math.max(r[2]-r[0],r[3]-r[1]),c=Math.floor(e/4),f=c%(s/o)*o,d=Math.floor(c/(s/o))*o,h=e%4;return _h(o,o,t,r,u,l,i,f,d,h,a)}function Ih(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(Fl(n,t,!0))})}),Promise.all(o).then(()=>{Bl(t),t.sdfTexture.needsUpdate=!0})})}function Qo({font:t,characters:e,sdfGlyphSize:r},o){let i=Array.isArray(e)?e.join("\n"):""+e;Gl({font:t,sdfGlyphSize:r,text:i},o)}function Oh(t,e){for(let r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}var Oi;function Dl(t){return Oi||(Oi=typeof document>"u"?{}:document.createElement("a")),Oi.href=t,Oi.href}function Bl(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)}}var Ph=Er({name:"Typesetter",dependencies:[xh,bh,bl],init(t,e,r){return t(e,r())}}),Nl=Er({name:"Typesetter",dependencies:[Ph],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}}),Rh=Nl.onMainThread;var El={};function Uh(t){let e=El[t];return e||(e=El[t]=new Br(1,1,t,t).translate(.5,.5,0)),e}var Ui="aTroikaGlyphBounds",Bn="aTroikaGlyphIndex",Lh="aTroikaGlyphColor",Jo=class extends Ka{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 Na,this.boundingBox=new Fr}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let r=Uh(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(Ui,e,4),this.updateAttributeData(Bn,r,1),this.updateAttributeData(Lh,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,c=i/2,f=i*2,d=Math.abs(r),h=e[0]/d,g=e[2]/d,p=n((h+c)/f)!==n((g+c)/f)?-d:a(l(h)*d,l(g)*d),y=n((h-c)/f)!==n((g-c)/f)?d:s(l(h)*d,l(g)*d),E=n((h+i)/f)!==n((g+i)/f)?d*2:s(d-u(h)*d,d-u(g)*d);o.min.set(p,e[1],r<0?-E:0),o.max.set(y,e[3],r<0?0:E)}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(Bn).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 za(r,o)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}},Gh="\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",Fh="\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",Bh="\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",Nh="\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 jl(t){let e=nn(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new bt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new co(0,0,0,0)},uTroikaClipRect:{value:new co(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new bt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new st},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Fa},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:Gh,vertexTransform:Fh,fragmentDefs:Bh,fragmentColorTransform:Nh,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(Ho,"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}var $o=new ai({color:16777215,side:bn,transparent:!0}),Al=8421504,Il=new Mt,Pi=new Be,Zo=new Be,Fn=[],jh=new Be,Yo="+x+y";function Ol(t){return Array.isArray(t)?t[0]:t}var zl=()=>{let t=new sr(new Br(1,1),$o);return zl=()=>t,t},Vl=()=>{let t=new sr(new Br(1,1,32,1),$o);return Vl=()=>t,t},zh={type:"syncstart"},Vh={type:"synccomplete"},Wl=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],Wh=Wl.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail"),sn=class extends sr{constructor(){let e=new Jo;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=Al,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=Yo,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(zh),Gl({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(Vh),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 jl(e)}get material(){let e=this._derivedMaterial,r=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=$o.clone());if((!e||!e.isDerivedFrom(r))&&(e=this._derivedMaterial=this.createDerivedMaterial(r),r.addEventListener("dispose",function o(){r.removeEventListener("dispose",o),e.dispose()})),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",function i(){e.removeEventListener("dispose",i),o.dispose()})),[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 Ol(this.material).getDepthMaterial()}get customDistanceMaterial(){return Ol(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,c=0,f=0,d,h,g,p=0,y=0;if(r){let{outlineWidth:k,outlineOffsetX:b,outlineOffsetY:_,outlineBlur:w,outlineOpacity:P}=this;u=this._parsePercent(k)||0,c=Math.max(0,this._parsePercent(w)||0),d=P,p=this._parsePercent(b)||0,y=this._parsePercent(_)||0}else f=Math.max(0,this._parsePercent(this.strokeWidth)||0),f&&(g=this.strokeColor,o.uTroikaStrokeColor.value.set(g==null?Al:g),h=this.strokeOpacity,h==null&&(h=1)),d=this.fillOpacity;o.uTroikaEdgeOffset.value=u,o.uTroikaPositionOffset.value.set(p,y),o.uTroikaBlurRadius.value=c,o.uTroikaStrokeWidth.value=f,o.uTroikaStrokeOpacity.value=h,o.uTroikaFillOpacity.value=d==null?1:d,o.uTroikaCurveRadius.value=this.curveRadius||0;let E=this.clipRect;if(E&&Array.isArray(E)&&E.length===4)o.uTroikaClipRect.value.fromArray(E);else{let k=(this.fontSize||.1)*100;o.uTroikaClipRect.value.set(l[0]-k,l[1]-k,l[2]+k,l[3]+k)}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 st;(n!==s._input||typeof n=="object")&&s.set(s._input=n)}let a=this.orientation||Yo;if(a!==e._orientation){let s=o.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let l=a!==Yo&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,u,c,f,d]=l;Pi.set(0,0,0)[c]=u==="-"?1:-1,Zo.set(0,0,0)[d]=f==="-"?-1:1,Il.lookAt(jh,Pi.cross(Zo),Zo),s.setFromMatrix4(Il)}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 bt){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 bt){return Pi.copy(e),this.localPositionToTextCoords(this.worldToLocal(Pi),r)}raycast(e,r){let{textRenderInfo:o,curveRadius:i}=this;if(o){let n=o.blockBounds,a=i?Vl():zl(),s=a.geometry,{position:l,uv:u}=s.attributes;for(let c=0;c<u.count;c++){let f=n[0]+u.getX(c)*(n[2]-n[0]),d=n[1]+u.getY(c)*(n[3]-n[1]),h=0;i&&(h=i-Math.cos(f/i)*i,f=Math.sin(f/i)*i),l.setXYZ(c,f,d,h)}s.boundingSphere=this.geometry.boundingSphere,s.boundingBox=this.geometry.boundingBox,a.matrixWorld=this.matrixWorld,a.material.side=this.material.side,Fn.length=0,a.raycast(e,Fn);for(let c=0;c<Fn.length;c++)Fn[c].object=this,r.push(Fn[c])}}copy(e){let r=this.geometry;return super.copy(e),this.geometry=r,Wh.forEach(o=>{this[o]=e[o]}),this}clone(){return new this.constructor().copy(this)}};Wl.forEach(t=>{let e="_private_"+t;Object.defineProperty(sn.prototype,t,{get(){return this[e]},set(r){r!==this[e]&&(this[e]=r,this._needsSync=!0)}})});var Hh={type:"syncstart"},Zh={type:"synccomplete"},an="aTroikaTextBatchMemberIndex",qo=32,Pl=new Fr,Rl=new st,Ul=class t extends sn{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 sn?this.addText(e[r]):super.add(e[r]);return this}remove(...e){for(let r=0;r<e.length;r++)e[r]instanceof sn?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 Yh(e)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateBounds()}updateBounds(){let e=this.geometry.boundingBox.makeEmpty();this._members.forEach((r,o)=>{o.matrixAutoUpdate&&o.updateMatrix(),Pl.copy(o.geometry.boundingBox).applyMatrix4(o.matrix),e.union(Pl)}),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*qo)));if(!o||i!==o.image.data.length){o&&o.dispose();let s=Math.min(i/4,1024);o=this._dataTextures[r?"outline":"main"]=new si(new Float32Array(i),s,i/4/s,oi,ii)}let n=o.image.data,a=(s,l)=>{l!==n[s]&&(n[s]=l,o.needsUpdate=!0)};this._members.forEach(({index:s,dirty:l},u)=>{if(s>-1){let c=s*qo,f=u.matrix.elements;for(let T=0;T<16;T++)a(c+T,f[T]);u._prepareForRender(e);let{uTroikaTotalBounds:d,uTroikaClipRect:h,uTroikaPositionOffset:g,uTroikaEdgeOffset:p,uTroikaBlurRadius:y,uTroikaStrokeWidth:E,uTroikaStrokeColor:k,uTroikaStrokeOpacity:b,uTroikaFillOpacity:_,uTroikaCurveRadius:w}=e.uniforms;for(let T=0;T<4;T++)a(c+16+T,d.value.getComponent(T));for(let T=0;T<4;T++)a(c+20+T,h.value.getComponent(T));let P=r?u.outlineColor||0:u.color;P==null&&(P=this.color),P==null&&(P=this.material.color),P==null&&(P=16777215),a(c+24,Rl.set(P).getHex()),a(c+25,_.value),a(c+26,w.value),r?(a(c+28,g.value.x),a(c+29,g.value.y),a(c+30,p.value),a(c+31,y.value)):(a(c+28,E.value),a(c+29,Rl.set(k.value).getHex()),a(c+30,b.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(Hh),Promise.all(r).then(()=>{let{geometry:o}=this,i=o.attributes,n=i[an]&&i[an].array||new Uint16Array(0),a=i[Bn]&&i[Bn].array||new Float32Array(0),s=i[Ui]&&i[Ui].array||new Float32Array(0),l=0;this._members.forEach((f,{textRenderInfo:d})=>{d&&(l+=d.glyphAtlasIndices.length,this._textRenderInfo=d)}),l!==n.length&&(n=Xo(n,l),a=Xo(a,l),s=Xo(s,l*4));let u=0,c=0;this._members.forEach((f,{textRenderInfo:d})=>{if(d){let h=d.glyphAtlasIndices.length;n.fill(u,c,c+h),a.set(d.glyphAtlasIndices,c,c+h),s.set(d.glyphBounds,c*4,(c+h)*4),c+=h,f.index=u++}}),o.updateAttributeData(an,n,1),o.getAttribute(an).setUsage(Ga),o.updateAttributeData(Bn,a,1),o.updateAttributeData(Ui,s,4),this.updateBounds(),this.dispatchEvent(Zh),e&&e()}))}copy(e){return e instanceof t&&(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())}};function Xo(t,e){let r=new t.constructor(e);return r.set(t.subarray(0,e)),r}function Yh(t){let e="uTroikaMatricesTexture",r="uTroikaMatricesTextureSize",o=nn(t,{chained:!0,uniforms:{[r]:{value:new bt},[e]:{value:null}},vertexDefs:"\n uniform highp sampler2D ".concat(e,";\n uniform vec2 ").concat(r,";\n attribute float ").concat(an,";\n\n vec4 troikaBatchTexel(float offset) {\n offset += ").concat(an," * ").concat(qo.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=jl(o),o=nn(o,{chained:!0,uniforms:{uTroikaIsOutline:{value:!1}},customRewriter(i){return["uTroikaTotalBounds","uTroikaClipRect","uTroikaPositionOffset","uTroikaEdgeOffset","uTroikaBlurRadius","uTroikaStrokeWidth","uTroikaStrokeColor","uTroikaStrokeOpacity","uTroikaFillOpacity","uTroikaCurveRadius","diffuse"].forEach(a=>{i=Xh(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}function Xh({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}}var Hl="abcdefghijklmnopqrstuvwxyz";function cv(t){return new Promise((e,r)=>{t?typeof t=="string"?Qo({font:t,characters:Hl},()=>{e(t)}):r(new Error("bad fontUrl ".concat(t))):import("./roboto-regular-E2V4PXOH.js").then(o=>{Qo({font:o.default,characters:Hl},()=>{e(o.default)})})})}var ea=.1,Kh=new Be;function fv(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(Kh);if(l>r||s>e){if(t.fontSize===ea)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(ea,"."));t.fontSize=Math.max(ea,t.fontSize-o),t.sync(a)}else return i({size:[s,l]})}})}function Zl(t){return new Promise(e=>{t.sync(()=>{e()})})}var Yl=class extends _n{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 c of this.rendererState.geometry3DIdsInScene)if(o=this.rendererState.geometry3DMap.get(c),(o==null?void 0:o.type)==="text3d"){i=o.components[0],n=o.components[1];let f=(s=i.mesh)==null?void 0:s.parent;if(!f||!(f instanceof ir)||!(i instanceof Bi))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(f)||this.batchedTextMap.set(f,Gi().then(({BatchedText:g})=>{let p=new g;return p.type="batchedtext",f.add(p),p}));let h=this.batchedTextMap.get(f);if(!h)throw new Error("batched text required");a.push(Xl({entityId:c,textComponent:i,styleComponent:n,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:h,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(c.toString()))continue;this.textSet.add(c.toString()),this.batchedTextMap.has(f)||this.batchedTextMap.set(f,Gi().then(({BatchedText:g})=>{let p=new g;return p.type="batchedtext",f.add(p),p}));let h=this.batchedTextMap.get(f);if(!h)throw new Error("batched text required");a.push(Xl({entityId:c,textComponent:i,styleComponent:n,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:h,rendererState:this.rendererState,type:"point"}).then(()=>{this.publish("render")}))}let d=this.batchedTextMap.get(f);i.textMesh&&d&&i.polygonEntityId!=null&&Promise.all([d,Promise.resolve({meshComponent:i,styleComponent:n})]).then(([h,{meshComponent:g,styleComponent:p}])=>{let{textMesh:y}=g;if(h&&y){let E=na(h,y);g.visible&&!E?h.add(y):!g.visible&&E&&h.remove(y)}p.flipToFaceCamera&&this.flipIfNeeded(g,r)})}return Promise.all(a)}flipIfNeeded(r,o){let i=r.textMesh;if(!i)return!1;let n=i.rotation.z,a=wi(n+o);a>Math.PI/2&&a<3*Math.PI/2&&(i.rotation.z=wi(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 Br(n.maxWidth,n.maxHeight),s=new sr(a,new ai({color:"pink"})),{textMesh:l}=o;if(!l)continue;let u=this.convertTo3DMapPosition(n.position,Nn);s.position.copy(u),s.position.z=l.position.z-.1,s.rotation.z=l.rotation.z,ta.identity(),ta.makeRotationAxis(new Be(0,0,1),l.userData.rotationZ),Nn.set(n.maxWidth/2,0,0),Nn.applyMatrix4(ta),s.position.x-=Nn.x,s.position.y-=Nn.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")}},ta=new Mt,Nn=new Be,ra;async function _v(t){let{preloadFont:e}=await Gi();return e(t)}function Gi(){return ra||(ra=import("./text3d-AK6F2J7Q.js").then(t=>t)),ra}async function Xl({entityId:t,textComponent:e,styleComponent:r,convertTo3DMapPosition:o,batchedMeshPromise:i,rendererState:n,type:a="text-area"}){return Promise.all([Gi(),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=>{Ut.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 c=u.components[0],f=u.components[1];c.textMesh=s.text,c.mesh!=null&&(s.text.position.z=f.altitude+f.height+Jh)}}else l[2]=Zl(s.text);return Promise.all(l)}).then(s=>{if(!s)return;let[l,u]=s;u.add(l),e.batchedText||(e.batchedText=u)})}function na(t,e){return t._members.has(e)}var Jh=.5;var qh=K.object({visible:K.boolean(),color:K.string(),flipToFaceCamera:K.boolean(),font:K.string().optional(),fontSize:K.number(),margin:K.union([K.number(),K.tuple([K.number(),K.number(),K.number(),K.number()])]),outlineColor:K.string(),outlineOpacity:K.number(),outlineBlur:K.union([K.number(),K.string()]),outlineWidth:K.number(),outlineOffsetX:K.number(),outlineOffsetY:K.number(),strokeWidth:K.number(),maxWidth:K.number().optional(),maxHeight:K.number().optional(),strokeOpacity:K.number(),strokeColor:K.string(),fillOpacity:K.number(),hoverColor:K.string().optional(),id:K.union([K.string(),K.number()]),type:K.literal("text3d"),position:K.tuple([K.number(),K.number(),K.number()]),content:K.string()}),Kl=qh.partial().omit({id:!0,type:!0}).strict(),Jl=Kl.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0}).strict(),Dv=K.object({appearance:Kl.optional(),parentId:K.string().optional()}).strict(),Bi=class{constructor(e){m(this,"mesh",new Pr);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?na(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}};function jn(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 Qr,t.components[1].dirty=!0):t instanceof It&&t.components[2]===void 0?(t.components[2]=new Qr,t.components[2].dirty=!0):t instanceof ir&&t.components[1]===void 0&&(t.components[1]=new Qr,t.components[1].dirty=!0),!0):(t instanceof zt?t.components[1]=void 0:t instanceof It?t.components[2]=void 0:t instanceof ir&&(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),jn(o,e,r);return!0}}return!1}function Hv(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}}function Zv(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}function Yv(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))}function Xv(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}function $h(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)}function Kv(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)))}function Jv(t,e){var r;return e!==void 0&&(t.type==="marker"||t.type==="label"||t.type==="custom-geometry")&&t.parentObject3D!==e&&t.parentObject3D instanceof ir?((r=t.parentObject3D)==null||r.removeEntity(t),e.addEntity(t),!0):!1}function qv(t,e){e!==void 0&&(t.type==="marker"||t.type==="label")&&t.components[0].enabled!==e&&(t.components[0].enabled=e)}function Qv(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{No.parse(e.options||{})}catch(i){return Ut.error(i),!1}return e.options.interactive!=null&&(e.options.interactive==="pointer-events-auto"?(o.pointerEvents="auto",jn(t,!1,r)):(o.pointerEvents="none",jn(t,e.options.interactive,r))),ql(t,e.options.rank),!0}}return!1}function ql(t,e){return e!==void 0&&(t.type==="marker"||t.type==="label")?(t.components[0].rank=$r(e),!0):!1}function $v(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{Bo.parse(e.options||{})}catch(u){Ut.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&&(oa(l.appearance,((n=e.options)==null?void 0:n.appearance)||{}),l.dirty=!0),jn(t,(a=e.options)==null?void 0:a.interactive,r),ql(t,(s=e.options)==null?void 0:s.rank)}}function ey(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].hoverColor=e,t.components[1].dirty=!0)}function ty(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}function ry(t,e){e!==void 0&&t.type==="image"&&(t.components[1].flipImageToFaceCamera=e)}function Ql(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 Ot&&(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 er){let i=e.geometry2DMap.get(o.userData.entityId);if(i){let n=i.components[0];n instanceof pl&&(n.canShow=r)}}})):t.type==="label"&&(t.components[0].visible=r);return!0}return!1}function ny(t,e,r){if(r!==void 0&&t.type==="geometry-group"){let o=t.components[0];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,!0}return!1}function iy(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)}}function oy(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 At){let i=t.components[0];return i.detached===!1&&(i.detached=!0,i.dirty=!0),!0}}return!1}function ay(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}function sy(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}function ly(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 Ot&&(r.userData.outlineDirty=!0)}return!0}return!1}function uy(t,e){return e!==void 0&&t.type==="geometry"&&t.components[0]&&t.components[0]instanceof At?(t.components[0].focusable=e,!0):!1}function cy(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}function fy(t,e,r){let{visible:o,color:i}=r;if(t.type!=="path")return;let n=t.components[0];o!=null&&Ql(t,e,o),i!=null&&$h(t,{color:i}),Object.assign(n,ep(r)),ia(r)||(n.materialDirty=!0,(r.nearRadius!=null||r.farRadius!=null)&&(n.dirty=!0))}function ep(t){return zn(t,tp)}var tp=["animateArrowsOnPath","displayArrowsOnPath","nearRadius","farRadius","accentColor","completeFraction"];function dy(t){if(!(t instanceof It&&t.type==="text3d"))throw new Error("expect target is TextGeometry3D")}var rp=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function hy(t,e,r){Ql(t,e,r.visible);let o=t.components[1],i=zn(r,rp);"margin"in r&&Ut.warn("update to margin is not supported atm"),"content"in r&&Ut.warn("content update is not supported atm");try{Jl.parse(i)}catch(n){Ut.error(n);return}Object.keys(i).length>0&&(Object.assign(o,i),o.dirty=!0)}var np=["color","material","opacity","verticalOffset","rotation","position","scale"];function py(t,e){let r=zn(e,np),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)}O();O();O();O();var Ni=class extends si{constructor(r){let o=r,i=3,n=i*4;super(new Float32Array(r*n),i,r,oi,ii);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 st(o[i],o[i+1],o[i+2]),a=new st(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}};var $l="#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 eu="#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 sp=-.05,lp=1,Vn=class extends Za{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",uo);m(this,"showTextures",r=>{let o=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(o||i)&&(this.propertiesTexture.setTexture(r,o,i),this.needsUpdate=!0)});this.propertiesTexture=new Ni(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,c=this.uniforms.uTexture,f=this.uniforms.uRepeatYFactor,d=this.uniforms.uBlendTexture;this.uniforms=n.uniforms,n.vertexShader=$l,n.fragmentShader=eu,Object.assign(this.uniforms,{uGradientIntensity:a,uGradientEnd:s,uGradientStart:l,uMinSideAlpha:{value:sp},uMaxSideAlpha:{value:lp},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:u,uTexture:c,uRepeatYFactor:f,uBlendTexture:d})}}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=xn,r.wrapT=xn,r.colorSpace=this.colorSpace,this.uniforms.uTexture.value=r}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(r){r.wrapS=xn,r.wrapT=xn,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?La:uo,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()}};O();var Fy={top:0,bottom:0,left:0,right:0,type:"pixel"},tu="mappedin";var By=250;var cp=80;function Jy(t,e){var s,l,u;let r=0;for(let c of t)r+=((l=(s=c.components[0])==null?void 0:s.geometry)==null?void 0:l.attributes.position.count)||0;let o=new st(e.color),i;i=new Vn({color:o,side:e.side==="back"?Ra:e.side==="front"?Pa:bn,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 rr(t.length,r,0,i),a;for(let c of t)a=c.components[0],!(!(a instanceof At)||!a.geometry)&&(a.mesh=n,a.material=i,a.instanceIndex=n.addGeometry(a.geometry),n.addInstance(a.instanceIndex),n.userData.entities[a.instanceIndex]=c.id,i instanceof Vn&&i.setColor(a.instanceIndex,o,e.topColor?new st(e.topColor):o));return n.perObjectFrustumCulled=!0,n.matrixAutoUpdate=!1,n}function aa(t,e){let r=new Ha(t,cp),o=fp(e.color.getHexString()),i=new Wa({linewidth:1,color:o,transparent:!0}),n=new li(r,i);return n.layers.set(1),n}function fp(t){return ae(t).darken(30).toRgbString()}function qy(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=function(b,_){return t.index.getX(b*3+_)}):(l=n.count/3,u=function(b,_){return b*3+_});let c=new Mt;c.makeRotationFromQuaternion(new fo().setFromEuler(new ho(0,0,r/180*Math.PI)));let f=e.find(b=>b.face==="top"),d;f&&(d={min:o(f.bounds[1],f.bounds[0],0),max:o(f.bounds[3],f.bounds[2],i.max.z)});let h=e.find(b=>b.face==="side"),g;if(h&&(g={min:o(h.bounds[1],h.bounds[0],0),max:o(h.bounds[3],h.bounds[2],i.max.z)}),!(!g&&!d))for(let b=0;b<l;++b){let _=a.getX(u(b,0))+a.getX(u(b,1))+a.getX(u(b,2)),w=a.getY(u(b,0))+a.getY(u(b,1))+a.getY(u(b,2)),P=a.getZ(u(b,0))+a.getZ(u(b,1))+a.getZ(u(b,2)),T=Math.abs(_),A=Math.abs(w),z=Math.abs(P);var p,y;T<=A&&T<=z?(p="x",A<=z?y="y":y="z"):A<=T&&A<=z?(p="y",T<=z?y="x":y="z"):(p="z",T<=A?y="x":y="y"),p==="z"&&(p=y,y="z");let U,q,x,L,D,Z;if(y==="z"||p==="z"){if(!h||!g)continue;U=h.repeat.u,q=h.repeat.v,x=h.offset.u,L=h.offset.v,D=h.rotation,Z=g}else{if(!f||!d)continue;U=f.repeat.u,q=f.repeat.v,x=f.offset.u,L=f.offset.v,D=(360-r+f.rotation)%360,Z=d}let{min:F,max:ne}=Z,oe=new Ct;oe.position.set(F.x,F.y,0),oe.updateMatrix(),oe.updateMatrixWorld();let B=F.clone().applyMatrix4(c),G=ne.clone().applyMatrix4(c),v=Math.abs(G.x-B.x),S=Math.abs(G.y-B.y),C=new Be(v,S,ne.z).applyMatrix4(oe.matrixWorld),I=Math.abs(C[p]-F[p]),M=Math.abs(C[y]-F[y]),V=D*Math.PI/180||0,R=Math.cos(V),N=Math.sin(V),Q=oe.matrixWorld.clone().invert(),se=new fo().setFromEuler(new ho(0,0,r/180*Math.PI));for(let Y=0;Y<3;Y++){let Se=new Be(n.getX(u(b,Y)),n.getY(u(b,Y)),n.getZ(u(b,Y))).applyMatrix4(Q);Se.applyQuaternion(se);let ve=Se.applyMatrix4(oe.matrixWorld),te=ve.x,le=ve.y,he=ve.z;var E,k;p==="x"?E=U*(te-F[p])/I+x:p==="y"?E=U*(le-F[p])/I+x:E=U*(he-F[p])/I+x,y==="x"?k=q*(te-F[y])/M+L:y==="y"?k=q*(le-F[y])/M+L:k=q*(he-F[y])/M+L,E-=.5,k-=.5;let X=E*R-k*N+.5,ue=E*N+k*R+.5;s.setX(u(b,Y),X),s.setY(u(b,Y),ue)}}}O();function ru(t){t&&(t.map&&(t.map.dispose(),t.map=void 0),t.dispose())}function ji(t){for(let e=t.children.length-1;e>=0;e--)ji(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){ru(e)}):"material"in t&&typeof t.material<"u"&&ru(t.material)}var Wn,ln,sa=class{constructor(e){m(this,"rendererState");m(this,"dirty",!0);ct(this,Wn,!0);ct(this,ln,0);this.rendererState=e}get geometries3DDirty(){return Le(this,Wn)}set geometries3DDirty(e){Ke(this,Wn,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 c=qr(o);if(c&&ji(c),!o.components[0].outline||!o.visible)continue;if(o.children.length>0){let f;if(u instanceof rr){let g=[],p,y,E,k;for(let b of o.userData.entities3D)k=this.rendererState.geometry3DMap.get(b),(k==null?void 0:k.type)==="geometry"&&(y=k.components[0],E=k.components[1],y instanceof At&&E.visible&&E.opacity>0&&E.outline&&!y.detached&&(p=y==null?void 0:y.geometry,p&&g.push(p)));g.length>0&&(f=es(g))}else f=u.geometry;f&&(s=aa(f,u.material),s.position.z=o.altitude,s.userData.outlineOfEntityId=o.userData.entityId);let d,h;for(let g of o.userData.entities3D.values()){let p=this.rendererState.geometry3DMap.get(g);(p==null?void 0:p.type)==="geometry"&&(d=p.components[0],h=p.components[1],s&&(p==null?void 0:p.type)==="geometry"&&!d.detached?(p.components[0].outline=s,(n=o.parent)==null||n.add(s)):(p==null?void 0:p.type)==="geometry"&&d.geometry!=null&&d.material!=null&&d.detached&&(d.outline&&ji(d.outline),h&&h.opacity>0&&h.visible&&h.outline&&(d.outline=aa(d.geometry,d.material),d.outline.position.z=h.altitude,(a=o.parent)==null||a.add(d.outline))))}}this.dirty=!0}this.geometries3DDirty=!1}let i=r?nu(e,16,19,0,1):Le(this,ln);if((i!==Le(this,ln)||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=qr(s);if(u&&u.visible){let c=Array.isArray(u.material)?u.material:[u.material];for(let f of c)f.opacity=Math.min(i,s.components[0].opacity)}}else if((s==null?void 0:s.type)==="geometry"&&s.components[0]instanceof At&&s.components[0].detached){let u=s.components[0].outline;if(u){let c=Array.isArray(u.material)?u.material:[u.material];for(let f of c)f.opacity=Math.min(i,s.components[1].opacity)}}}Ke(this,ln,i),this.dirty=!1}};Wn=new WeakMap,ln=new WeakMap;var Ot=class extends Ct{constructor(r,o=new Ci){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=qr(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 rr?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}};var Pr=class extends Ct{constructor(){super(...arguments);m(this,"type","geometry");m(this,"userData",{entityId:"",type:"geometry"})}},It=class{constructor(e,r){m(this,"id",tt());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 Ot?(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)}};O();function pp(t){let e=t.min,r=t.max,o=new Be(e.x,e.y,e.z),i=new Be(r.x,e.y,e.z),n=new Be(e.x,r.y,e.z),a=new Be(r.x,r.y,e.z);return[o,i,n,a]}O();function iu(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}function Ub(t,e,r=[],o=new Fr){(t.getSystems().renderSystem.threeDdirty||t.getSystems().renderSystem.twoDdirty)&&t.renderSync();let i=iu(t.getInternalState(),e);return ou(i,r,o),r}var la=new Be;function ou(t,e=[],r=new Fr){if(t.visible){if(t.isMesh||t.isLine||t.isPoints){let o=t.geometry;if(o.isBufferGeometry){let i=o.attributes.position;for(let n=0;n<i.count;n++)la.fromBufferAttribute(i,n),e.push(la.clone()),r.expandByPoint(la)}}for(let o of t.children)ou(o,e,r)}}O();function mp(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}O();function gp(t,e,r=!1){let o=null,i=0;return function(...n){i++,i===1&&r===!0&&t(...n);let a=()=>{(!r||i>1)&&t(...n),o=null,i=0};clearTimeout(o),o=setTimeout(a,e)}}O();var vp=(()=>{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}}})(),au=vp.getDeviceType,su=(()=>{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=au().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}}function i(){var a,s;if(!au().isWindows)return!1;if(r!==void 0)return r;let n=(s=(a=yp())==null?void 0:a.toLowerCase())!=null?s:"";return r=n.includes("intel")&&(n.includes("uhd")||n.includes("iris")),r}return{getInfo:o,shouldDisableOffscreenCanvas:i,_setCanvas(n){t=n,e=void 0,r=void 0}}})(),yp=su.getInfo,bp=su.shouldDisableOffscreenCanvas;O();function zn(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}function ia(t){return Object.keys(t).length===0}O();var xp=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}};function t0(t,e,r,o){let i=t*(Math.PI/180),n=o/ur,a=t+n*180/Math.PI,s=r/ur/Math.cos(i),l=e+s*180/Math.PI;return{lat:a,lon:l}}function r0(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,c=ur*u*Math.cos(a),f=ur*l;return{x:c,y:f}}var _p=(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 Pr)&&e.add(o.userData.entityId);_p(o,e)}return e},Tp=(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 er&&e.add(o.userData.entityId),Tp(o,e);return e};function oa(t,e){for(let r in e){if(e[r]==null){t[r]=void 0;continue}typeof e[r]=="object"?oa(t[r],e[r]):t[r]=e[r]}return t}function n0(t,e,r,o){let i={translateX:t.x,translateY:t.y,translateZ:t.z,scale:t.meterInMercatorCoordinateUnits()},n=new Mt,a=new Be(i.scale,-i.scale,i.scale),s=new Mt().makeTranslation(i.translateX,i.translateY,i.translateZ).scale(a),l=r.elevation;return{id:tu,type:"custom",renderingMode:"3d",render:(u,c)=>{if(n.fromArray(c),l!==r.elevation){let f=$a.fromLngLat(t.toLngLat(),r.elevation);s.makeTranslation(i.translateX,i.translateY,-f.z).scale(a)}e.projectionMatrix=n.multiply(s),l=r.elevation,o()}}}function Sp(t){return fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}async function i0(t){let e=await Sp(t),{access_token:r}=await e.json();return{"x-mappedin-tiles-key":r}}function o0(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)}var kp=t=>t;var a0=t=>1-Math.cos(t*Math.PI/2);function nu(t,e,r,o,i,n=kp){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)}function s0(t,e,r){let o=t*(Math.PI/180)/2,i=e/2;return r*Math.tan(o)/i}function l0(t){return new Qa(new po(t[0][0],t[0][1]),new po(t[1][0],t[1][1])).getCenter().toArray()}function u0(t,e){return t<e||e<=12}O();var ua=class{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",lu.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}},lu=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});O();O();var ca=class{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)}};O();var wp=[1,1,1],Mp=[0,0,0];export{vu as a,Cp as b,Ut as c,ur as d,Gp as e,Kt as f,Fp as g,Bp as h,Np as i,jp as j,_u as k,Wp as l,Yp as m,tt as n,_n as o,go as p,tr as q,vd as r,wm as s,qs as t,Mm as u,Cm as v,Dm as w,Em as x,Am as y,Im as z,Om as A,Mi as B,Gm as C,bd as D,Fm as E,Qs as F,K as G,Xs as H,Ro as I,Uo as J,rr as K,At as L,Ci as M,qr as N,ae as O,hg as P,_g as Q,pl as R,Og as S,ml as T,zt as U,Pr as V,It as W,Fy as X,tu as Y,By as Z,pp as _,iu as $,Ub as aa,mp as ba,gp as ca,bp as da,zn as ea,xp as fa,wi as ga,t0 as ha,r0 as ia,_p as ja,Tp as ka,n0 as la,i0 as ma,o0 as na,kp as oa,a0 as pa,nu as qa,s0 as ra,l0 as sa,u0 as ta,sn as ua,Ul as va,cv as wa,fv as xa,ua as ya,lu as za,ca as Aa,wp as Ba,Mp as Ca,Yl as Da,_v as Ea,Dv as Fa,Bi as Ga,jn as Ha,Hv as Ia,Zv as Ja,Yv as Ka,Xv as La,$h as Ma,Kv as Na,Jv as Oa,qv as Pa,Qv as Qa,$v as Ra,ey as Sa,ty as Ta,ry as Ua,Ql as Va,ny as Wa,iy as Xa,oy as Ya,ay as Za,sy as _a,ly as $a,uy as ab,cy as bb,fy as cb,ep as db,dy as eb,rp as fb,hy as gb,py as hb,Vn as ib,Jy as jb,fp as kb,qy as lb,ji as mb,sa as nb,Ot as ob,ir as pb};