becomap-v2 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +119 -0
- package/dist/becomap.umd.js +329 -0
- package/dist/becomap.umd.js.map +1 -0
- package/dist/index.d.ts +603 -0
- package/dist/index.js +6970 -0
- package/dist/index.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use strict";var becomap=(()=>{var Bf=Object.create;var Mr=Object.defineProperty;var Df=Object.getOwnPropertyDescriptor;var Nf=Object.getOwnPropertyNames;var Hf=Object.getPrototypeOf,Gf=Object.prototype.hasOwnProperty;var Ol=u=>{throw TypeError(u)};var rt=(u,t)=>()=>(t||u((t={exports:{}}).exports,t),t.exports),Vf=(u,t)=>{for(var o in t)Mr(u,o,{get:t[o],enumerable:!0})},Fl=(u,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of Nf(t))!Gf.call(u,e)&&e!==o&&Mr(u,e,{get:()=>t[e],enumerable:!(r=Df(t,e))||r.enumerable});return u};var gt=(u,t,o)=>(o=u!=null?Bf(Hf(u)):{},Fl(t||!u||!u.__esModule?Mr(o,"default",{value:u,enumerable:!0}):o,u)),jf=u=>Fl(Mr({},"__esModule",{value:!0}),u);var Bs=(u,t,o)=>t.has(u)||Ol("Cannot "+o);var p=(u,t,o)=>(Bs(u,t,"read from private field"),o?o.call(u):t.get(u)),V=(u,t,o)=>t.has(u)?Ol("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(u):t.set(u,o),N=(u,t,o,r)=>(Bs(u,t,"write to private field"),r?r.call(u,o):t.set(u,o),o),re=(u,t,o)=>(Bs(u,t,"access private method"),o);var kr=(u,t,o,r)=>({set _(e){N(u,t,e,o)},get _(){return p(u,t,r)}});var Rr=rt((Op,Pl)=>{"use strict";Pl.exports=globalThis.maplibregl});var Ft=rt((Bp,Bl)=>{"use strict";Bl.exports=globalThis.THREE});var Mu=rt((dm,Au)=>{"use strict";Au.exports=wp;function wp(u,t){for(var o=new Array(arguments.length-1),r=0,e=2,n=!0;e<arguments.length;)o[r++]=arguments[e++];return new Promise(function(s,l){o[r]=function(a){if(n)if(n=!1,a)l(a);else{for(var f=new Array(arguments.length-1),h=0;h<f.length;)f[h++]=arguments[h];s.apply(null,f)}};try{u.apply(t||null,o)}catch(c){n&&(n=!1,l(c))}})}});var Iu=rt(Ru=>{"use strict";var cs=Ru;cs.length=function(t){var o=t.length;if(!o)return 0;for(;o>0&&t.charAt(o-1)==="=";)--o;return Math.floor(o*3/4)};var ui=new Array(64),us=new Array(123);for(Jt=0;Jt<64;)us[ui[Jt]=Jt<26?Jt+65:Jt<52?Jt+71:Jt<62?Jt-4:Jt-59|43]=Jt++;var Jt;us[45]=62;us[95]=63;cs.encode=function(t,o,r){for(var e=null,n=[],i=0,s=0,l;o<r;){var c=t[o++];switch(s){case 0:n[i++]=ui[c>>2],l=(c&3)<<4,s=1;break;case 1:n[i++]=ui[l|c>>4],l=(c&15)<<2,s=2;break;case 2:n[i++]=ui[l|c>>6],n[i++]=ui[c&63],s=0;break}i>8191&&((e||(e=[])).push(String.fromCharCode.apply(String,n)),i=0)}return s&&(n[i++]=ui[l],n[i++]=61,s===1&&(n[i++]=61)),e?(i&&e.push(String.fromCharCode.apply(String,n.slice(0,i))),e.join("")):String.fromCharCode.apply(String,n.slice(0,i))};var ku="invalid encoding";cs.decode=function(t,o,r){for(var e=r,n=0,i,s=0;s<t.length;){var l=t.charCodeAt(s++);if(l===61&&n>1)break;if((l=us[l])===void 0)throw Error(ku);switch(n){case 0:i=l,n=1;break;case 1:o[r++]=i<<2|(l&48)>>4,i=l,n=2;break;case 2:o[r++]=(i&15)<<4|(l&60)>>2,i=l,n=3;break;case 3:o[r++]=(i&3)<<6|l,n=0;break}}if(n===1)throw Error(ku);return r-e};var Tp=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,xp=/[-_]/,Ep=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}(?:==)?|[A-Za-z0-9_-]{3}=?)?$/;cs.test=function(t){return Tp.test(t)||xp.test(t)&&Ep.test(t)}});var Lu=rt((gm,_u)=>{"use strict";_u.exports=fs;function fs(){this._listeners=Object.create(null)}fs.prototype.on=function(t,o,r){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:o,ctx:r||this}),this};fs.prototype.off=function(t,o){if(t===void 0)this._listeners=Object.create(null);else if(o===void 0)this._listeners[t]=[];else{var r=this._listeners[t];if(!r)return this;for(var e=0;e<r.length;)r[e].fn===o?r.splice(e,1):++e}return this};fs.prototype.emit=function(t){var o=this._listeners[t];if(o){for(var r=[],e=1;e<arguments.length;)r.push(arguments[e++]);for(e=0;e<o.length;)o[e].fn.apply(o[e++].ctx,r)}return this}});var Du=rt((mm,Bu)=>{"use strict";Bu.exports=Cu(Cu);function Cu(u){return typeof Float32Array<"u"?(function(){var t=new Float32Array([-0]),o=new Uint8Array(t.buffer),r=o[3]===128;function e(l,c,a){t[0]=l,c[a]=o[0],c[a+1]=o[1],c[a+2]=o[2],c[a+3]=o[3]}function n(l,c,a){t[0]=l,c[a]=o[3],c[a+1]=o[2],c[a+2]=o[1],c[a+3]=o[0]}u.writeFloatLE=r?e:n,u.writeFloatBE=r?n:e;function i(l,c){return o[0]=l[c],o[1]=l[c+1],o[2]=l[c+2],o[3]=l[c+3],t[0]}function s(l,c){return o[3]=l[c],o[2]=l[c+1],o[1]=l[c+2],o[0]=l[c+3],t[0]}u.readFloatLE=r?i:s,u.readFloatBE=r?s:i})():(function(){function t(r,e,n,i){var s=e<0?1:0;if(s&&(e=-e),e===0)r(1/e>0?0:2147483648,n,i);else if(isNaN(e))r(2143289344,n,i);else if(e>34028234663852886e22)r((s<<31|2139095040)>>>0,n,i);else if(e<11754943508222875e-54)r((s<<31|Math.round(e/1401298464324817e-60))>>>0,n,i);else{var l=Math.floor(Math.log(e)/Math.LN2),c=Math.round(e*Math.pow(2,-l)*8388608)&8388607;r((s<<31|l+127<<23|c)>>>0,n,i)}}u.writeFloatLE=t.bind(null,Ou),u.writeFloatBE=t.bind(null,Fu);function o(r,e,n){var i=r(e,n),s=(i>>31)*2+1,l=i>>>23&255,c=i&8388607;return l===255?c?NaN:s*(1/0):l===0?s*1401298464324817e-60*c:s*Math.pow(2,l-150)*(c+8388608)}u.readFloatLE=o.bind(null,Pu),u.readFloatBE=o.bind(null,Uu)})(),typeof Float64Array<"u"?(function(){var t=new Float64Array([-0]),o=new Uint8Array(t.buffer),r=o[7]===128;function e(l,c,a){t[0]=l,c[a]=o[0],c[a+1]=o[1],c[a+2]=o[2],c[a+3]=o[3],c[a+4]=o[4],c[a+5]=o[5],c[a+6]=o[6],c[a+7]=o[7]}function n(l,c,a){t[0]=l,c[a]=o[7],c[a+1]=o[6],c[a+2]=o[5],c[a+3]=o[4],c[a+4]=o[3],c[a+5]=o[2],c[a+6]=o[1],c[a+7]=o[0]}u.writeDoubleLE=r?e:n,u.writeDoubleBE=r?n:e;function i(l,c){return o[0]=l[c],o[1]=l[c+1],o[2]=l[c+2],o[3]=l[c+3],o[4]=l[c+4],o[5]=l[c+5],o[6]=l[c+6],o[7]=l[c+7],t[0]}function s(l,c){return o[7]=l[c],o[6]=l[c+1],o[5]=l[c+2],o[4]=l[c+3],o[3]=l[c+4],o[2]=l[c+5],o[1]=l[c+6],o[0]=l[c+7],t[0]}u.readDoubleLE=r?i:s,u.readDoubleBE=r?s:i})():(function(){function t(r,e,n,i,s,l){var c=i<0?1:0;if(c&&(i=-i),i===0)r(0,s,l+e),r(1/i>0?0:2147483648,s,l+n);else if(isNaN(i))r(0,s,l+e),r(2146959360,s,l+n);else if(i>17976931348623157e292)r(0,s,l+e),r((c<<31|2146435072)>>>0,s,l+n);else{var a;if(i<22250738585072014e-324)a=i/5e-324,r(a>>>0,s,l+e),r((c<<31|a/4294967296)>>>0,s,l+n);else{var f=Math.floor(Math.log(i)/Math.LN2);f===1024&&(f=1023),a=i*Math.pow(2,-f),r(a*4503599627370496>>>0,s,l+e),r((c<<31|f+1023<<20|a*1048576&1048575)>>>0,s,l+n)}}}u.writeDoubleLE=t.bind(null,Ou,0,4),u.writeDoubleBE=t.bind(null,Fu,4,0);function o(r,e,n,i,s){var l=r(i,s+e),c=r(i,s+n),a=(c>>31)*2+1,f=c>>>20&2047,h=4294967296*(c&1048575)+l;return f===2047?h?NaN:a*(1/0):f===0?a*5e-324*h:a*Math.pow(2,f-1075)*(h+4503599627370496)}u.readDoubleLE=o.bind(null,Pu,0,4),u.readDoubleBE=o.bind(null,Uu,4,0)})(),u}function Ou(u,t,o){t[o]=u&255,t[o+1]=u>>>8&255,t[o+2]=u>>>16&255,t[o+3]=u>>>24}function Fu(u,t,o){t[o]=u>>>24,t[o+1]=u>>>16&255,t[o+2]=u>>>8&255,t[o+3]=u&255}function Pu(u,t){return(u[t]|u[t+1]<<8|u[t+2]<<16|u[t+3]<<24)>>>0}function Uu(u,t){return(u[t]<<24|u[t+1]<<16|u[t+2]<<8|u[t+3])>>>0}});var ju=rt(Vu=>{"use strict";var ds=Vu,Qa="\uFFFD",Hu=new TextDecoder("utf-8",{ignoreBOM:!0}),ar,Gu=64;try{ar=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}catch{ar=Hu}ds.length=function(t){for(var o=0,r=0,e=0;e<t.length;++e)r=t.charCodeAt(e),r<128?o+=1:r<2048?o+=2:(r&64512)===55296&&(t.charCodeAt(e+1)&64512)===56320?(++e,o+=4):o+=3;return o};function Nu(u,t,o,r){for(var e=t;e<o;){var n=u[e++];if(n<=127)r+=String.fromCharCode(n);else if(n>=192&&n<224){var i=(n&31)<<6|u[e++]&63;r+=i>=128?String.fromCharCode(i):Qa}else if(n>=224&&n<240){var s=(n&15)<<12|(u[e++]&63)<<6|u[e++]&63;r+=s>=2048?String.fromCharCode(s):Qa}else if(n>=240){var l=(n&7)<<18|(u[e++]&63)<<12|(u[e++]&63)<<6|u[e++]&63;l<65536||l>1114111?r+=Qa:(l-=65536,r+=String.fromCharCode(55296+(l>>10)),r+=String.fromCharCode(56320+(l&1023)))}}return r}function hs(u,t,o,r){var e=o===0&&r===t.length?t:t.subarray(o,r);return u.decode(e)}ds.read=function(t,o,r){if(r-o<1)return"";if(r-o>=Gu)return hs(Hu,t,o,r);for(var e="",n=o,i,s,l,c,a,f,h,d;n+7<r;n+=8){if(i=t[n],s=t[n+1],l=t[n+2],c=t[n+3],a=t[n+4],f=t[n+5],h=t[n+6],d=t[n+7],(i|s|l|c|a|f|h|d)&128)return Nu(t,n,r,e);e+=String.fromCharCode(i,s,l,c,a,f,h,d)}for(;n<r;++n){if(i=t[n],i&128)return Nu(t,n,r,e);e+=String.fromCharCode(i)}return e};ds.readStrict=function(t,o,r){if(r-o<1)return"";if(r-o>=Gu)return hs(ar,t,o,r);for(var e="",n=o,i,s,l,c,a,f,h,d;n+7<r;n+=8){if(i=t[n],s=t[n+1],l=t[n+2],c=t[n+3],a=t[n+4],f=t[n+5],h=t[n+6],d=t[n+7],(i|s|l|c|a|f|h|d)&128)return e+hs(ar,t,n,r);e+=String.fromCharCode(i,s,l,c,a,f,h,d)}for(;n<r;++n){if(i=t[n],i&128)return e+hs(ar,t,n,r);e+=String.fromCharCode(i)}return e};ds.write=function(t,o,r){for(var e=r,n,i,s=0;s<t.length;++s)n=t.charCodeAt(s),n<128?o[r++]=n:n<2048?(o[r++]=n>>6|192,o[r++]=n&63|128):(n&64512)===55296&&((i=t.charCodeAt(s+1))&64512)===56320?(n=65536+((n&1023)<<10)+(i&1023),++s,o[r++]=n>>18|240,o[r++]=n>>12&63|128,o[r++]=n>>6&63|128,o[r++]=n&63|128):(o[r++]=n>>12|224,o[r++]=n>>6&63|128,o[r++]=n&63|128);return r-e}});var Wu=rt((ym,zu)=>{"use strict";zu.exports=Sp;function Sp(u,t,o){var r=o||8192,e=r>>>1,n=null,i=r;return function(l){if(l<1||l>e)return u(l);i+l>r&&(n=u(r),i=0);var c=t.call(n,i,i+=l);return i&7&&(i=(i|7)+1),c}}});var Xu=rt((vm,Ku)=>{"use strict";Ku.exports=lt;var lr;function lt(u,t){this.lo=u>>>0,this.hi=t>>>0}var xo=lt.zero=new lt(0,0);xo.toNumber=function(){return 0};xo.zzEncode=xo.zzDecode=function(){return this};xo.length=function(){return 1};var Ap=lt.zeroHash="\0\0\0\0\0\0\0\0";lt.fromNumber=function(t){if(t===0)return xo;var o=t<0;o&&(t=-t);var r=t>>>0,e=(t-r)/4294967296>>>0;return o&&(e=~e>>>0,r=~r>>>0,++r>4294967295&&(r=0,++e>4294967295&&(e=0))),new lt(r,e)};lt.from=function(t){if(typeof t=="number")return lt.fromNumber(t);if(typeof t=="string"||t instanceof String)if(lr)t=lr.fromString(t);else return lt.fromNumber(parseInt(t,10));return t.low||t.high?new lt(t.low>>>0,t.high>>>0):xo};lt.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var o=~this.lo+1>>>0,r=~this.hi>>>0;return o||(r=r+1>>>0),-(o+r*4294967296)}return this.lo+this.hi*4294967296};lt.prototype.toLong=function(t){return lr?new lr(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var Xn=String.prototype.charCodeAt;lt.fromHash=function(t){return t===Ap?xo:new lt((Xn.call(t,0)|Xn.call(t,1)<<8|Xn.call(t,2)<<16|Xn.call(t,3)<<24)>>>0,(Xn.call(t,4)|Xn.call(t,5)<<8|Xn.call(t,6)<<16|Xn.call(t,7)<<24)>>>0)};lt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};lt.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};lt.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};lt.prototype.length=function(){var t=this.lo,o=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return r===0?o===0?t<16384?t<128?1:2:t<2097152?3:4:o<16384?o<128?5:6:o<2097152?7:8:r<128?9:10};lt._configure=function(u){lr=u}});var qu=rt((cr,el)=>{"use strict";(function(u,t){function o(r){return r.default||r}typeof define=="function"&&define.amd?define([],function(){var r={};return t(r),o(r)}):typeof cr=="object"?(t(cr),typeof el=="object"&&(el.exports=o(cr))):(function(){var r={};t(r),u.Long=o(r)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:cr,function(u){"use strict";Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function o(S,m,L){this.low=S|0,this.high=m|0,this.unsigned=!!L}o.prototype.__isLong__,Object.defineProperty(o.prototype,"__isLong__",{value:!0});function r(S){return(S&&S.__isLong__)===!0}function e(S){var m=Math.clz32(S&-S);return S?31-m:m}o.isLong=r;var n={},i={};function s(S,m){var L,D,Y;return m?(S>>>=0,(Y=0<=S&&S<256)&&(D=i[S],D)?D:(L=c(S,0,!0),Y&&(i[S]=L),L)):(S|=0,(Y=-128<=S&&S<128)&&(D=n[S],D)?D:(L=c(S,S<0?-1:0,!1),Y&&(n[S]=L),L))}o.fromInt=s;function l(S,m){if(isNaN(S))return m?x:T;if(m){if(S<0)return x;if(S>=b)return M}else{if(S<=-v)return F;if(S+1>=v)return k}return S<0?l(-S,m).neg():c(S%y|0,S/y|0,m)}o.fromNumber=l;function c(S,m,L){return new o(S,m,L)}o.fromBits=c;var a=Math.pow;function f(S,m,L){if(S.length===0)throw Error("empty string");if(typeof m=="number"?(L=m,m=!1):m=!!m,S==="NaN"||S==="Infinity"||S==="+Infinity"||S==="-Infinity")return m?x:T;if(L=L||10,L<2||36<L)throw RangeError("radix");var D;if((D=S.indexOf("-"))>0)throw Error("interior hyphen");if(D===0)return f(S.substring(1),m,L).neg();for(var Y=l(a(L,8)),J=T,j=0;j<S.length;j+=8){var H=Math.min(8,S.length-j),R=parseInt(S.substring(j,j+H),L);if(H<8){var P=l(a(L,H));J=J.mul(P).add(l(R))}else J=J.mul(Y),J=J.add(l(R))}return J.unsigned=m,J}o.fromString=f;function h(S,m){return typeof S=="number"?l(S,m):typeof S=="string"?f(S,m):c(S.low,S.high,typeof m=="boolean"?m:S.unsigned)}o.fromValue=h;var d=65536,g=1<<24,y=d*d,b=y*y,v=b/2,w=s(g),T=s(0);o.ZERO=T;var x=s(0,!0);o.UZERO=x;var E=s(1);o.ONE=E;var O=s(1,!0);o.UONE=O;var A=s(-1);o.NEG_ONE=A;var k=c(-1,2147483647,!1);o.MAX_VALUE=k;var M=c(-1,-1,!0);o.MAX_UNSIGNED_VALUE=M;var F=c(0,-2147483648,!1);o.MIN_VALUE=F;var I=o.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*y+(this.low>>>0):this.high*y+(this.low>>>0)},I.toString=function(m){if(m=m||10,m<2||36<m)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(F)){var L=l(m),D=this.div(L),Y=D.mul(L).sub(this);return D.toString(m)+Y.toInt().toString(m)}else return"-"+this.neg().toString(m);for(var J=l(a(m,6),this.unsigned),j=this,H="";;){var R=j.div(J),P=j.sub(R.mul(J)).toInt()>>>0,U=P.toString(m);if(j=R,j.isZero())return U+H;for(;U.length<6;)U="0"+U;H=""+U+H}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(F)?64:this.neg().getNumBitsAbs();for(var m=this.high!=0?this.high:this.low,L=31;L>0&&(m&1<<L)==0;L--);return this.high!=0?L+33:L+1},I.isSafeInteger=function(){var m=this.high>>21;return m?this.unsigned?!1:m===-1&&!(this.low===0&&this.high===-2097152):!0},I.isZero=function(){return this.high===0&&this.low===0},I.eqz=I.isZero,I.isNegative=function(){return!this.unsigned&&this.high<0},I.isPositive=function(){return this.unsigned||this.high>=0},I.isOdd=function(){return(this.low&1)===1},I.isEven=function(){return(this.low&1)===0},I.equals=function(m){return r(m)||(m=h(m)),this.unsigned!==m.unsigned&&this.high>>>31===1&&m.high>>>31===1?!1:this.high===m.high&&this.low===m.low},I.eq=I.equals,I.notEquals=function(m){return!this.eq(m)},I.neq=I.notEquals,I.ne=I.notEquals,I.lessThan=function(m){return this.comp(m)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(m){return this.comp(m)<=0},I.lte=I.lessThanOrEqual,I.le=I.lessThanOrEqual,I.greaterThan=function(m){return this.comp(m)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(m){return this.comp(m)>=0},I.gte=I.greaterThanOrEqual,I.ge=I.greaterThanOrEqual,I.compare=function(m){if(r(m)||(m=h(m)),this.eq(m))return 0;var L=this.isNegative(),D=m.isNegative();return L&&!D?-1:!L&&D?1:this.unsigned?m.high>>>0>this.high>>>0||m.high===this.high&&m.low>>>0>this.low>>>0?-1:1:this.sub(m).isNegative()?-1:1},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(F)?F:this.not().add(E)},I.neg=I.negate,I.add=function(m){r(m)||(m=h(m));var L=this.high>>>16,D=this.high&65535,Y=this.low>>>16,J=this.low&65535,j=m.high>>>16,H=m.high&65535,R=m.low>>>16,P=m.low&65535,U=0,G=0,B=0,W=0;return W+=J+P,B+=W>>>16,W&=65535,B+=Y+R,G+=B>>>16,B&=65535,G+=D+H,U+=G>>>16,G&=65535,U+=L+j,U&=65535,c(B<<16|W,U<<16|G,this.unsigned)},I.subtract=function(m){return r(m)||(m=h(m)),this.add(m.neg())},I.sub=I.subtract,I.multiply=function(m){if(this.isZero())return this;if(r(m)||(m=h(m)),t){var L=t.mul(this.low,this.high,m.low,m.high);return c(L,t.get_high(),this.unsigned)}if(m.isZero())return this.unsigned?x:T;if(this.eq(F))return m.isOdd()?F:T;if(m.eq(F))return this.isOdd()?F:T;if(this.isNegative())return m.isNegative()?this.neg().mul(m.neg()):this.neg().mul(m).neg();if(m.isNegative())return this.mul(m.neg()).neg();if(this.lt(w)&&m.lt(w))return l(this.toNumber()*m.toNumber(),this.unsigned);var D=this.high>>>16,Y=this.high&65535,J=this.low>>>16,j=this.low&65535,H=m.high>>>16,R=m.high&65535,P=m.low>>>16,U=m.low&65535,G=0,B=0,W=0,K=0;return K+=j*U,W+=K>>>16,K&=65535,W+=J*U,B+=W>>>16,W&=65535,W+=j*P,B+=W>>>16,W&=65535,B+=Y*U,G+=B>>>16,B&=65535,B+=J*P,G+=B>>>16,B&=65535,B+=j*R,G+=B>>>16,B&=65535,G+=D*U+Y*P+J*R+j*H,G&=65535,c(W<<16|K,G<<16|B,this.unsigned)},I.mul=I.multiply,I.divide=function(m){if(r(m)||(m=h(m)),m.isZero())throw Error("division by zero");if(t){if(!this.unsigned&&this.high===-2147483648&&m.low===-1&&m.high===-1)return this;var L=(this.unsigned?t.div_u:t.div_s)(this.low,this.high,m.low,m.high);return c(L,t.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?x:T;var D,Y,J;if(this.unsigned){if(m.unsigned||(m=m.toUnsigned()),m.gt(this))return x;if(m.gt(this.shru(1)))return O;J=x}else{if(this.eq(F)){if(m.eq(E)||m.eq(A))return F;if(m.eq(F))return E;var j=this.shr(1);return D=j.div(m).shl(1),D.eq(T)?m.isNegative()?E:A:(Y=this.sub(m.mul(D)),J=D.add(Y.div(m)),J)}else if(m.eq(F))return this.unsigned?x:T;if(this.isNegative())return m.isNegative()?this.neg().div(m.neg()):this.neg().div(m).neg();if(m.isNegative())return this.div(m.neg()).neg();J=T}for(Y=this;Y.gte(m);){D=Math.max(1,Math.floor(Y.toNumber()/m.toNumber()));for(var H=Math.ceil(Math.log(D)/Math.LN2),R=H<=48?1:a(2,H-48),P=l(D),U=P.mul(m);U.isNegative()||U.gt(Y);)D-=R,P=l(D,this.unsigned),U=P.mul(m);P.isZero()&&(P=E),J=J.add(P),Y=Y.sub(U)}return J},I.div=I.divide,I.modulo=function(m){if(r(m)||(m=h(m)),t){var L=(this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,m.low,m.high);return c(L,t.get_high(),this.unsigned)}return this.sub(this.div(m).mul(m))},I.mod=I.modulo,I.rem=I.modulo,I.not=function(){return c(~this.low,~this.high,this.unsigned)},I.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},I.clz=I.countLeadingZeros,I.countTrailingZeros=function(){return this.low?e(this.low):e(this.high)+32},I.ctz=I.countTrailingZeros,I.and=function(m){return r(m)||(m=h(m)),c(this.low&m.low,this.high&m.high,this.unsigned)},I.or=function(m){return r(m)||(m=h(m)),c(this.low|m.low,this.high|m.high,this.unsigned)},I.xor=function(m){return r(m)||(m=h(m)),c(this.low^m.low,this.high^m.high,this.unsigned)},I.shiftLeft=function(m){return r(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?c(this.low<<m,this.high<<m|this.low>>>32-m,this.unsigned):c(0,this.low<<m-32,this.unsigned)},I.shl=I.shiftLeft,I.shiftRight=function(m){return r(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?c(this.low>>>m|this.high<<32-m,this.high>>m,this.unsigned):c(this.high>>m-32,this.high>=0?0:-1,this.unsigned)},I.shr=I.shiftRight,I.shiftRightUnsigned=function(m){return r(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?c(this.low>>>m|this.high<<32-m,this.high>>>m,this.unsigned):m===32?c(this.high,0,this.unsigned):c(this.high>>>m-32,0,this.unsigned)},I.shru=I.shiftRightUnsigned,I.shr_u=I.shiftRightUnsigned,I.rotateLeft=function(m){var L;return r(m)&&(m=m.toInt()),(m&=63)===0?this:m===32?c(this.high,this.low,this.unsigned):m<32?(L=32-m,c(this.low<<m|this.high>>>L,this.high<<m|this.low>>>L,this.unsigned)):(m-=32,L=32-m,c(this.high<<m|this.low>>>L,this.low<<m|this.high>>>L,this.unsigned))},I.rotl=I.rotateLeft,I.rotateRight=function(m){var L;return r(m)&&(m=m.toInt()),(m&=63)===0?this:m===32?c(this.high,this.low,this.unsigned):m<32?(L=32-m,c(this.high<<L|this.low>>>m,this.low<<L|this.high>>>m,this.unsigned)):(m-=32,L=32-m,c(this.low<<L|this.high>>>m,this.high<<L|this.low>>>m,this.unsigned))},I.rotr=I.rotateRight,I.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},I.toBytes=function(m){return m?this.toBytesLE():this.toBytesBE()},I.toBytesLE=function(){var m=this.high,L=this.low;return[L&255,L>>>8&255,L>>>16&255,L>>>24,m&255,m>>>8&255,m>>>16&255,m>>>24]},I.toBytesBE=function(){var m=this.high,L=this.low;return[m>>>24,m>>>16&255,m>>>8&255,m&255,L>>>24,L>>>16&255,L>>>8&255,L&255]},o.fromBytes=function(m,L,D){return D?o.fromBytesLE(m,L):o.fromBytesBE(m,L)},o.fromBytesLE=function(m,L){return new o(m[0]|m[1]<<8|m[2]<<16|m[3]<<24,m[4]|m[5]<<8|m[6]<<16|m[7]<<24,L)},o.fromBytesBE=function(m,L){return new o(m[4]<<24|m[5]<<16|m[6]<<8|m[7],m[0]<<24|m[1]<<16|m[2]<<8|m[3],L)},typeof BigInt=="function"&&(o.fromBigInt=function(m,L){var D=Number(BigInt.asIntN(32,m)),Y=Number(BigInt.asIntN(32,m>>BigInt(32)));return c(D,Y,L)},o.fromValue=function(m,L){return typeof m=="bigint"?o.fromBigInt(m,L):h(m,L)},I.toBigInt=function(){var m=BigInt(this.low>>>0),L=BigInt(this.unsigned?this.high>>>0:this.high);return L<<BigInt(32)|m});var C=u.default=o})});var Eo=rt(tl=>{"use strict";var pe=tl;pe.asPromise=Mu();pe.base64=Iu();pe.EventEmitter=Lu();pe.float=Du();pe.utf8=ju();pe.pool=Wu();pe.LongBits=Xu();function Zu(u){return u==="__proto__"||u==="prototype"||u==="constructor"}pe.isUnsafeProperty=Zu;pe.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);pe.global=pe.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||typeof globalThis<"u"&&globalThis||tl;pe.emptyArray=Object.freeze?Object.freeze([]):[];pe.emptyObject=Object.freeze?Object.freeze({}):{};pe.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};pe.isString=function(t){return typeof t=="string"||t instanceof String};pe.isObject=function(t){return t&&typeof t=="object"};pe.isset=pe.isSet=function(t,o){var r=t[o];return r!=null&&Object.hasOwnProperty.call(t,o)?typeof r!="object"||(Array.isArray(r)?r.length:Object.keys(r).length)>0:!1};pe.Buffer=(function(){try{var u=pe.global.Buffer;return u.prototype.utf8Write||pe.isNode?u:null}catch{return null}})();pe.newBuffer=function(t){var o=pe.Buffer;return typeof t=="number"?o?o.allocUnsafe(t):new Uint8Array(t):o?o.from(t):new Uint8Array(t)};pe.rawField=function(t,o,r){var e=[],n=t<<3|o;for(n>>>=0;n>127;)e.push(n&127|128),n>>>=7;e.push(n);for(var i=0;i<r.length;++i)e.push(r[i]);return pe.newBuffer(e)};pe.Array=Uint8Array;pe.Long=pe.global.dcodeIO&&pe.global.dcodeIO.Long||pe.global.Long||(function(){try{var u=qu();return u&&u.isLong?u:null}catch{return null}})();pe.key2Re=/^(?:true|false|0|1)$/;pe.key32Re=/^-?(?:0|[1-9][0-9]*)$/;pe.key64Re=/^(?:[\x00-\xff]{8}|-?(?:0|[1-9][0-9]*))$/;pe.longToHash=function(t){return t?pe.LongBits.from(t).toHash():pe.LongBits.zeroHash};pe.longFromHash=function(t,o){var r=pe.LongBits.fromHash(t);return pe.Long?pe.Long.fromBits(r.lo,r.hi,o):r.toNumber(!!o)};pe.longFromKey=function(t,o){return pe.key64Re.test(t)&&!pe.key32Re.test(t)?pe.longFromHash(t,o):t};pe.boolFromKey=function(t){return t==="true"||t==="1"};function Yu(u){var t=typeof arguments[arguments.length-1]=="boolean",o=t?arguments.length-1:arguments.length;t=t&&arguments[arguments.length-1];for(var r=1;r<o;++r){var e=arguments[r];if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)!Zu(n[i])&&(!t||!Object.prototype.hasOwnProperty.call(u,n[i])||u[n[i]]===void 0)&&(u[n[i]]=e[n[i]])}return u}pe.merge=Yu;pe.nestingLimit=32;pe.recursionLimit=100;pe.makeProp=function(t,o,r){Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{enumerable:r===void 0?!0:r,configurable:!0,writable:!0})};pe.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function $u(u){function t(o,r){if(!(this instanceof t))return new t(o,r);Object.defineProperty(this,"message",{get:function(){return o}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),r&&Yu(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return u},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}pe.newError=$u;pe.ProtocolError=$u("ProtocolError");pe.oneOfGetter=function(t){for(var o={},r=0;r<t.length;++r)o[t[r]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(o[e[n]]===1&&this[e[n]]!==void 0&&this[e[n]]!==null)return e[n]}};pe.oneOfSetter=function(t){return function(o){for(var r=0;r<t.length;++r)t[r]!==o&&delete this[t[r]]}};pe.toJSONOptions={longs:String,enums:String,bytes:String,json:!0}});var rl=rt((Tm,nf)=>{"use strict";nf.exports=be;var ln=Eo(),ol,Tn=ln.LongBits,Ju=ln.base64,nl=ln.utf8;function be(){this.pos=0,this.buf=this.constructor.alloc(64),this.view=null,this.states=null}Object.defineProperty(be.prototype,"len",{configurable:!0,enumerable:!0,get:function(){return this.pos}});var Qu=function(){return ln.Buffer?function(){return(be.create=function(){return new ol})()}:function(){return new be}};be.create=Qu();be.alloc=function(t){return new Uint8Array(t)};be.alloc=ln.pool(be.alloc,Uint8Array.prototype.subarray);function il(u){return u<128?1:u<16384?2:u<2097152?3:u<268435456?4:5}be.prototype._reserve=function(t){var o=this.pos+t;if(o>this.buf.length){var r=this.buf.length<<1;r<o&&(r=o);var e=this.constructor.alloc(r);e.set(this.buf.subarray(0,this.pos),0),this.buf=e,this.view=null}};function Mp(u,t,o){for(var r=0;r<u.length;)t[o++]=u.charCodeAt(r++)}function So(u,t,o){for(;u>127;)t[o++]=u&127|128,u>>>=7;return t[o]=u,o+1}be.prototype.uint32=function(t){t=t>>>0,this._reserve(5);var o=this.pos;return this.pos=So(t,this.buf,o),this};be.prototype.int32=function(t){return(t|=0)<0?(this._reserve(10),hi(Tn.fromNumber(t),this.buf,this.pos),this.pos+=10,this):this.uint32(t)};be.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function hi(u,t,o){for(var r=u.lo,e=u.hi;e;)t[o++]=r&127|128,r=(r>>>7|e<<25)>>>0,e>>>=7;for(;r>127;)t[o++]=r&127|128,r=r>>>7;return t[o]=r,o+1}be.prototype.uint64=function(t){var o=Tn.from(t);this._reserve(10);var r=this.pos;return this.pos=hi(o,this.buf,r),this};be.prototype.int64=be.prototype.uint64;be.prototype.sint64=function(t){var o=Tn.from(t).zzEncode();this._reserve(10);var r=this.pos;return this.pos=hi(o,this.buf,r),this};be.prototype.bool=function(t){return this._reserve(1),this.buf[this.pos++]=t?1:0,this};function fi(u,t,o){t[o]=u&255,t[o+1]=u>>>8&255,t[o+2]=u>>>16&255,t[o+3]=u>>>24}be.prototype.fixed32=function(t){return this._reserve(4),fi(t>>>0,this.buf,this.pos),this.pos+=4,this};be.prototype.sfixed32=be.prototype.fixed32;be.prototype.fixed64=function(t){var o=Tn.from(t);return this._reserve(8),fi(o.lo,this.buf,this.pos),fi(o.hi,this.buf,this.pos+4),this.pos+=8,this};be.prototype.sfixed64=be.prototype.fixed64;be.prototype.float=function(t){return this._reserve(4),ln.float.writeFloatLE(t,this.buf,this.pos),this.pos+=4,this};be.prototype.double=function(t){return this._reserve(8),ln.float.writeDoubleLE(t,this.buf,this.pos),this.pos+=8,this};be.prototype.bytes=function(t){var o=t.length>>>0;if(!o)return this._reserve(1),this.buf[this.pos++]=0,this;if(ln.isString(t)){var r=be.alloc(o=Ju.length(t));Ju.decode(t,r,0),t=r}return this.uint32(o),this._reserve(o),this.buf.set(t,this.pos),this.pos+=o,this};be.prototype.raw=function(t){var o=t.length>>>0;return o?(this._reserve(o),this.buf.set(t,this.pos),this.pos+=o,this):this};be.prototype._delim=function(t,o){var r=il(o);return r>1&&this.buf.copyWithin(t+r,t+1,t+1+o),So(o,this.buf,t),this.pos=t+r+o,this};be.prototype.string=function(t){var o=t.length;if(!o)return this._reserve(1),this.buf[this.pos++]=0,this;if(o<128){this._reserve(o*3+5);var r=this.pos;return this._delim(r,nl.write(t,this.buf,r+1))}var e=nl.length(t);return this.uint32(e),this._reserve(e),e===t.length?Mp(t,this.buf,this.pos):nl.write(t,this.buf,this.pos),this.pos+=e,this};be.prototype.uint32s=function(t){var o=t.length;this._reserve(o*5+5);for(var r=this.buf,e=this.pos,n=e+1,i=0;i<o;++i)n=So(t[i]>>>0,r,n);return this._delim(e,n-e-1)};be.prototype.int32s=function(t){var o=t.length;this._reserve(o*10+5);for(var r=this.buf,e=this.pos,n=e+1,i,s=0;s<o;++s)(i=t[s]|0)<0?n=hi(Tn.fromNumber(i),r,n):n=So(i,r,n);return this._delim(e,n-e-1)};be.prototype.sint32s=function(t){var o=t.length;this._reserve(o*5+5);for(var r=this.buf,e=this.pos,n=e+1,i=0;i<o;++i)n=So((t[i]<<1^t[i]>>31)>>>0,r,n);return this._delim(e,n-e-1)};be.prototype.uint64s=function(t){var o=t.length;this._reserve(o*10+5);for(var r=this.buf,e=this.pos,n=e+1,i=0;i<o;++i)n=hi(Tn.from(t[i]),r,n);return this._delim(e,n-e-1)};be.prototype.int64s=be.prototype.uint64s;be.prototype.sint64s=function(t){var o=t.length;this._reserve(o*10+5);for(var r=this.buf,e=this.pos,n=e+1,i=0;i<o;++i)n=hi(Tn.from(t[i]).zzEncode(),r,n);return this._delim(e,n-e-1)};be.prototype.bools=function(t){var o=t.length;this.uint32(o),this._reserve(o);for(var r=this.buf,e=this.pos,n=0;n<o;++n)r[e++]=t[n]?1:0;return this.pos+=o,this};var ef=16,tf=128;function ps(u,t,o){var r=u.view;if(r||t<o)return r;var e=u.buf;return u.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}be.prototype.fixed32s=function(t){var o=t.length,r=o*4;this.uint32(r),this._reserve(r);var e=this.pos,n,i=ps(this,o,tf);if(i)for(n=0;n<o;++n)i.setUint32(e,t[n]>>>0,!0),e+=4;else{var s=this.buf;for(n=0;n<o;++n)fi(t[n]>>>0,s,e),e+=4}return this.pos+=r,this};be.prototype.sfixed32s=be.prototype.fixed32s;be.prototype.fixed64s=function(t){var o=t.length,r=o*8;this.uint32(r),this._reserve(r);var e=this.pos,n,i,s=ps(this,o,tf);if(s)for(n=0;n<o;++n)i=Tn.from(t[n]),s.setUint32(e,i.lo,!0),s.setUint32(e+4,i.hi,!0),e+=8;else{var l=this.buf;for(n=0;n<o;++n)i=Tn.from(t[n]),fi(i.lo,l,e),fi(i.hi,l,e+4),e+=8}return this.pos+=r,this};be.prototype.sfixed64s=be.prototype.fixed64s;be.prototype.floats=function(t){var o=t.length,r=o*4;this.uint32(r),this._reserve(r);var e=this.pos,n,i=ps(this,o,ef);if(i)for(n=0;n<o;++n)i.setFloat32(e,t[n],!0),e+=4;else{var s=this.buf;for(n=0;n<o;++n)ln.float.writeFloatLE(t[n],s,e),e+=4}return this.pos+=r,this};be.prototype.doubles=function(t){var o=t.length,r=o*8;this.uint32(r),this._reserve(r);var e=this.pos,n,i=ps(this,o,ef);if(i)for(n=0;n<o;++n)i.setFloat64(e,t[n],!0),e+=8;else{var s=this.buf;for(n=0;n<o;++n)ln.float.writeDoubleLE(t[n],s,e),e+=8}return this.pos+=r,this};be.prototype.fork=function(){return this._reserve(1),(this.states||(this.states=[])).push(this.pos),this.pos+=1,this};be.prototype.reset=function(){var t=this.states;return t&&t.length?this.pos=t.pop():this.pos=0,this};be.prototype.ldelim=function(){var t=this.states,o,r;if(t&&t.length){var e=t.pop();o=this.pos-e-1,r=il(o),r>1?(this._reserve(r-1),this.buf.copyWithin(e+r,e+1,e+1+o),this.pos+=r-1,So(o,this.buf,e)):this.buf[e]=o}else o=this.pos,r=il(o),this._reserve(r),this.buf.copyWithin(r,0,o),So(o,this.buf,0),this.pos+=r;return this};be.prototype.finish=function(t){if(t)return this.buf.subarray(0,this.pos);var o=this.constructor.alloc(this.pos);return o.set(this.buf.subarray(0,this.pos),0),o};be.prototype.finishInto=function(t,o){return o===void 0&&(o=0),t.set(this.buf.subarray(0,this.pos),o),t};be._configure=function(u){ol=u,be.create=Qu(),ol._configure()}});var sf=rt((xm,rf)=>{"use strict";rf.exports=Zn;var of=rl();Zn.prototype=Object.create(of.prototype,{constructor:{value:Zn,writable:!0,enumerable:!1,configurable:!0}});var qn=Eo();function Zn(){of.call(this)}var sl;Zn._configure=function(){Zn.alloc=qn.Buffer&&qn.Buffer.allocUnsafe,sl=qn.Buffer&&qn.Buffer.prototype.utf8Write?function(t,o,r){return o.utf8Write(t,r)}:function(t,o,r){return o.write(t,r)}};Zn.prototype.bytes=function(t){qn.isString(t)&&(t=qn.Buffer.from(t,"base64"));var o=t.length>>>0;return this.uint32(o),o&&(this._reserve(o),this.buf.set(t,this.pos),this.pos+=o),this};Zn.prototype.string=function(t){var o=t.length;if(!o)return this._reserve(1),this.buf[this.pos++]=0,this;if(o<128){this._reserve(o*3+5);var r=this.pos,e=this.buf;return this._delim(r,o<40?qn.utf8.write(t,e,r+1):sl(t,e,r+1))}var n=qn.Buffer.byteLength(t);return this.uint32(n),this._reserve(n),sl(t,this.buf,this.pos),this.pos+=n,this};Zn._configure()});var cl=rt((Em,pf)=>{"use strict";pf.exports=Pe;var Qt=Eo(),ll,cf=Qt.LongBits,uf=Qt.utf8;function Ze(u,t){return RangeError("index out of range: "+u.pos+" + "+(t||1)+" > "+u.len)}function Pe(u){this.buf=u,this.pos=0,this.len=u.length,this.view=null,this.discardUnknown=Pe.discardUnknown}function af(u){if(Array.isArray(u)&&(u=new Uint8Array(u)),u instanceof Uint8Array)return new Pe(u);throw Error("illegal buffer")}var ff=function(){return Qt.Buffer?function(o){return(Pe.create=function(e){return Qt.Buffer.isBuffer(e)?new ll(e):af(e)})(o)}:af};Pe.create=ff();Pe.prototype.raw=function(t,o){return this.buf.subarray(t,o)};Pe.prototype.uint32=function(){var t=this.buf,o=this.pos,r=(t[o]&127)>>>0;if(t[o++]<128)return this.pos=o,r;if(r=(r|(t[o]&127)<<7)>>>0,t[o++]<128)return this.pos=o,r;if(r=(r|(t[o]&127)<<14)>>>0,t[o++]<128)return this.pos=o,r;if(r=(r|(t[o]&127)<<21)>>>0,t[o++]<128)return this.pos=o,r;if(r=(r|(t[o]&15)<<28)>>>0,t[o++]<128)return this.pos=o,r;for(var e=0;e<5;++e){if(o>=this.len)throw this.pos=o,Ze(this);if(t[o++]<128)return this.pos=o,r}throw this.pos=o,Error("invalid varint encoding")};Pe.prototype.tag=function(){var t=this.buf,o=this.pos,r=(t[o]&127)>>>0;if(t[o++]<128)return this.pos=o,r;if(r=(r|(t[o]&127)<<7)>>>0,t[o++]<128)return this.pos=o,r;if(r=(r|(t[o]&127)<<14)>>>0,t[o++]<128)return this.pos=o,r;if(r=(r|(t[o]&127)<<21)>>>0,t[o++]<128)return this.pos=o,r;if(r=(r|(t[o]&15)<<28)>>>0,t[o]<128&&(t[o]&112)===0)return this.pos=o+1,r;throw this.pos=o+1,Error("invalid tag encoding")};Pe.prototype.int32=function(){return this.uint32()|0};Pe.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function al(){var u=new cf(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(u.lo=(u.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return u;if(u.lo=(u.lo|(this.buf[this.pos]&127)<<28)>>>0,u.hi=(u.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return u;t=0}else{for(;t<4;++t){if(this.pos>=this.len)throw Ze(this);if(u.lo=(u.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return u}throw Ze(this)}if(this.len-this.pos>4){for(;t<5;++t)if(u.hi=(u.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return u}else for(;t<5;++t){if(this.pos>=this.len)throw Ze(this);if(u.hi=(u.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return u}throw Error("invalid varint encoding")}Pe.prototype.bool=function(){for(var t=!1,o,r=0;r<10;++r){if(this.pos>=this.len)throw Ze(this);if(o=this.buf[this.pos++],o&127&&(t=!0),o<128)return t}throw Error("invalid varint encoding")};function di(u,t){return(u[t-4]|u[t-3]<<8|u[t-2]<<16|u[t-1]<<24)>>>0}Pe.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ze(this,4);return di(this.buf,this.pos+=4)};Pe.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ze(this,4);return di(this.buf,this.pos+=4)|0};function lf(){if(this.pos+8>this.len)throw Ze(this,8);return new cf(di(this.buf,this.pos+=4),di(this.buf,this.pos+=4))}Pe.prototype.float=function(){if(this.pos+4>this.len)throw Ze(this,4);var t=Qt.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};Pe.prototype.double=function(){if(this.pos+8>this.len)throw Ze(this,4);var t=Qt.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};Pe.prototype.uint32s=function(t){t===void 0&&(t=[]);for(var o=this.uint32()+this.pos;this.pos<o;)t.push(this.uint32());return t};Pe.prototype.int32s=function(t){t===void 0&&(t=[]);for(var o=this.uint32()+this.pos;this.pos<o;)t.push(this.int32());return t};Pe.prototype.sint32s=function(t){t===void 0&&(t=[]);for(var o=this.uint32()+this.pos;this.pos<o;)t.push(this.sint32());return t};Pe.prototype.bools=function(t){t===void 0&&(t=[]);for(var o=this.uint32()+this.pos;this.pos<o;)t.push(this.bool());return t};var hf=8,df=128;function gs(u,t,o){var r=u.view;if(r||t<o)return r;var e=u.buf;return u.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}Pe.prototype.fixed32s=function(t){t===void 0&&(t=[]);var o=this.uint32(),r=this.pos+o;if(r>this.len)throw Ze(this,o);var e=o>>>2,n=t.length,i=this.pos;t.length=n+e;var s=gs(this,e,df);if(s)for(var l=0;l<e;++l,i+=4)t[n++]=s.getUint32(i,!0);else for(var c=this.buf,a=0;a<e;++a,i+=4)t[n++]=di(c,i+4);if(this.pos=i,i!==r)throw Ze(this,4);return t};Pe.prototype.sfixed32s=function(t){t===void 0&&(t=[]);var o=this.uint32(),r=this.pos+o;if(r>this.len)throw Ze(this,o);var e=o>>>2,n=t.length,i=this.pos;t.length=n+e;var s=gs(this,e,df);if(s)for(var l=0;l<e;++l,i+=4)t[n++]=s.getInt32(i,!0);else for(var c=this.buf,a=0;a<e;++a,i+=4)t[n++]=di(c,i+4)|0;if(this.pos=i,i!==r)throw Ze(this,4);return t};Pe.prototype.floats=function(t){t===void 0&&(t=[]);var o=this.uint32(),r=this.pos+o;if(r>this.len)throw Ze(this,o);var e=o>>>2,n=t.length,i=this.pos;t.length=n+e;var s=gs(this,e,hf);if(s)for(var l=0;l<e;++l,i+=4)t[n++]=s.getFloat32(i,!0);else for(var c=this.buf,a=0;a<e;++a,i+=4)t[n++]=Qt.float.readFloatLE(c,i);if(this.pos=i,i!==r)throw Ze(this,4);return t};Pe.prototype.doubles=function(t){t===void 0&&(t=[]);var o=this.uint32(),r=this.pos+o;if(r>this.len)throw Ze(this,o);var e=o>>>3,n=t.length,i=this.pos;t.length=n+e;var s=gs(this,e,hf);if(s)for(var l=0;l<e;++l,i+=8)t[n++]=s.getFloat64(i,!0);else for(var c=this.buf,a=0;a<e;++a,i+=8)t[n++]=Qt.float.readDoubleLE(c,i);if(this.pos=i,i!==r)throw Ze(this,8);return t};Pe.prototype.uint64s=function(t){t===void 0&&(t=[]);for(var o=this.uint32()+this.pos;this.pos<o;)t.push(this.uint64());return t};Pe.prototype.int64s=function(t){t===void 0&&(t=[]);for(var o=this.uint32()+this.pos;this.pos<o;)t.push(this.int64());return t};Pe.prototype.sint64s=function(t){t===void 0&&(t=[]);for(var o=this.uint32()+this.pos;this.pos<o;)t.push(this.sint64());return t};Pe.prototype.fixed64s=function(t){t===void 0&&(t=[]);var o=this.uint32(),r=this.pos+o,e=t.length;if(r>this.len)throw Ze(this,o);var n=o>>>3;t.length=e+n;for(var i=0;i<n;++i)t[e++]=this.fixed64();if(this.pos!==r)throw Ze(this,8);return t};Pe.prototype.sfixed64s=function(t){t===void 0&&(t=[]);var o=this.uint32(),r=this.pos+o,e=t.length;if(r>this.len)throw Ze(this,o);var n=o>>>3;t.length=e+n;for(var i=0;i<n;++i)t[e++]=this.sfixed64();if(this.pos!==r)throw Ze(this,8);return t};Pe.prototype.bytes=function(){var t=this.uint32(),o=this.pos,r=this.pos+t;if(r>this.len)throw Ze(this,t);return this.pos=r,this.raw(o,r)};Pe.prototype.string=function(){var t=this.uint32(),o=this.pos,r=this.pos+t;if(r>this.len)throw Ze(this,t);return this.pos=r,uf.read(this.buf,o,r)};Pe.prototype.stringVerify=function(){var t=this.uint32(),o=this.pos,r=this.pos+t;if(r>this.len)throw Ze(this,t);return this.pos=r,uf.readStrict(this.buf,o,r)};Pe.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Ze(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Ze(this);while(this.buf[this.pos++]&128);return this};Pe.recursionLimit=Qt.recursionLimit;Pe.discardUnknown=!0;Pe.prototype.skipType=function(u,t,o){if(t===void 0&&(t=0),t>Pe.recursionLimit)throw Error("max depth exceeded");if(o===0)throw Error("illegal tag: field number 0");switch(u){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){var r=this.tag(),e=r>>>3;if(u=r&7,!e)throw Error("illegal tag: field number 0");if(u===4){if(o!==void 0&&e!==o)throw Error("invalid end group tag");break}this.skipType(u,t+1,e)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+u+" at offset "+this.pos)}return this};Pe._configure=function(u){ll=u,Pe.create=ff(),ll._configure();var t=Qt.Long?"toLong":"toNumber";Qt.merge(Pe.prototype,{int64:function(){return al.call(this)[t](!1)},uint64:function(){return al.call(this)[t](!0)},sint64:function(){return al.call(this).zzDecode()[t](!1)},fixed64:function(){return lf.call(this)[t](!0)},sfixed64:function(){return lf.call(this)[t](!1)}})}});var yf=rt((Sm,bf)=>{"use strict";bf.exports=Yn;var mf=cl();Yn.prototype=Object.create(mf.prototype,{constructor:{value:Yn,writable:!0,enumerable:!1,configurable:!0}});var gf=Eo();function Yn(u){mf.call(this,u)}Yn._configure=function(){gf.Buffer&&(Yn.prototype._slice=gf.Buffer.prototype.slice)};Yn.prototype.raw=function(t,o){return this._slice.call(this.buf,t,o)};Yn.prototype.string=function(){var t=this.uint32(),o=this.pos,r=this.pos+t;if(r>this.len)throw RangeError("index out of range: "+this.pos+" + "+t+" > "+this.len);return this.pos=r,this.buf.utf8Slice?this.buf.utf8Slice(o,r):this.buf.toString("utf-8",o,r)};Yn._configure()});var wf=rt((Am,vf)=>{"use strict";vf.exports=ur;var ul=Eo();ur.prototype=Object.create(ul.EventEmitter.prototype,{constructor:{value:ur,writable:!0,enumerable:!1,configurable:!0}});function ur(u,t,o){if(typeof u!="function")throw TypeError("rpcImpl must be a function");ul.EventEmitter.call(this),this.rpcImpl=u,this.requestDelimited=!!t,this.responseDelimited=!!o}ur.prototype.rpcCall=function u(t,o,r,e,n){if(!e)throw TypeError("request must be specified");var i=this;if(!n)return ul.asPromise(u,i,t,o,r,e);if(!i.rpcImpl){setTimeout(function(){n(Error("already ended"))},0);return}try{return i.rpcImpl(t,o[i.requestDelimited?"encodeDelimited":"encode"](e).finish(),function(l,c){if(l)return i.emit("error",l,t),n(l);if(c===null){i.end(!0);return}if(!(c instanceof r))try{c=r[i.responseDelimited?"decodeDelimited":"decode"](c)}catch(a){return i.emit("error",a,t),n(a)}return i.emit("data",c,t),n(null,c)})}catch(s){i.emit("error",s,t),setTimeout(function(){n(s)},0);return}};ur.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var xf=rt(Tf=>{"use strict";var kp=Tf;kp.Service=wf()});var Sf=rt((km,Ef)=>{"use strict";Ef.exports=Object.create(null)});var Mf=rt(wt=>{"use strict";wt.build="minimal";wt.Writer=rl();wt.BufferWriter=sf();wt.Reader=cl();wt.BufferReader=yf();wt.util=Eo();wt.rpc=xf();wt.roots=Sf();wt.configure=Af;function Af(){wt.util.LongBits._configure(wt.util.Long),wt.Writer._configure(wt.BufferWriter),wt.Reader._configure(wt.BufferReader)}Af()});var Rf=rt((Im,kf)=>{"use strict";kf.exports=Mf()});var Lp={};Vf(Lp,{MockVenueProvider:()=>ls,RestVenueProvider:()=>ms,Venue:()=>qi,buildVenue:()=>os,createMap:()=>vu});var Wa=gt(Rr(),1);var kn,Ir=class{constructor(){V(this,kn,new Map)}on(t,o){let r=p(this,kn).get(t);r||(r=new Set,p(this,kn).set(t,r)),r.add(o)}off(t,o){p(this,kn).get(t)?.delete(o)}emit(t,o){let r=p(this,kn).get(t);if(r)for(let e of[...r])e(o)}removeAll(){p(this,kn).clear()}};kn=new WeakMap;function Ul(u){if(typeof HTMLElement>"u"||!(u instanceof HTMLElement))throw new TypeError("becomap: createMap(container, \u2026) requires an HTMLElement container")}var ie=gt(Ft(),1),Yc=gt(Rr(),1);function Qn(u){return{center:u,metersPerDegLat:111320,metersPerDegLng:111320*Math.cos(u[1]*Math.PI/180)}}function Rn(u,t){return[(t[0]-u.center[0])*u.metersPerDegLng,(t[1]-u.center[1])*u.metersPerDegLat]}function _r(u,t,o){return[u.center[0]+t/u.metersPerDegLng,u.center[1]+o/u.metersPerDegLat]}function Bt(u,t){let o=t.map(n=>Rn(u,n)),r=o[0],e=o[o.length-1];return o.length>1&&r&&e&&Math.hypot(r[0]-e[0],r[1]-e[1])<.01&&o.pop(),o}function Xt(u){let t=0,o=0,r=0;for(let e=0;e<u.length;e++){let n=u[e],i=u[(e+1)%u.length];if(!n||!i)continue;let s=n[0]*i[1]-i[0]*n[1];t+=s,o+=(n[0]+i[0])*s,r+=(n[1]+i[1])*s}return Math.abs(t)<1e-9?u[0]??[0,0]:(t*=.5,[o/(6*t),r/(6*t)])}function Io(u,t,o){let r=!1;for(let e=0,n=u.length-1;e<u.length;n=e++){let i=u[e],s=u[n];if(!i||!s)continue;let[l,c]=i,[a,f]=s;c>o!=f>o&&t<(a-l)*(o-c)/(f-c)+l&&(r=!r)}return r}var Ce=gt(Ft(),1);var mt=gt(Ft(),1);function Ds(u,t=!1){let o=u[0].index!==null,r=new Set(Object.keys(u[0].attributes)),e=new Set(Object.keys(u[0].morphAttributes)),n={},i={},s=u[0].morphTargetsRelative,l=new mt.BufferGeometry,c=0;for(let a=0;a<u.length;++a){let f=u[a],h=0;if(o!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+a+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in f.attributes){if(!r.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+a+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;n[d]===void 0&&(n[d]=[]),n[d].push(f.attributes[d]),h++}if(h!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+a+". Make sure all geometries have the same number of attributes."),null;if(s!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+a+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in f.morphAttributes){if(!e.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+a+". .morphAttributes must be consistent throughout all geometries."),null;i[d]===void 0&&(i[d]=[]),i[d].push(f.morphAttributes[d])}if(t){let d;if(o)d=f.index.count;else if(f.attributes.position!==void 0)d=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+a+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,a),c+=d}}if(o){let a=0,f=[];for(let h=0;h<u.length;++h){let d=u[h].index;for(let g=0;g<d.count;++g)f.push(d.getX(g)+a);a+=u[h].attributes.position.count}l.setIndex(f)}for(let a in n){let f=Dl(n[a]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+a+" attribute."),null;l.setAttribute(a,f)}for(let a in i){let f=i[a][0].length;if(f===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[a]=[];for(let h=0;h<f;++h){let d=[];for(let y=0;y<i[a].length;++y)d.push(i[a][y][h]);let g=Dl(d);if(!g)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+a+" morphAttribute."),null;l.morphAttributes[a].push(g)}}return l}function Dl(u){let t,o,r,e=-1,n=0;for(let c=0;c<u.length;++c){let a=u[c];if(t===void 0&&(t=a.array.constructor),t!==a.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(o===void 0&&(o=a.itemSize),o!==a.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(r===void 0&&(r=a.normalized),r!==a.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(e===-1&&(e=a.gpuType),e!==a.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;n+=a.count*o}let i=new t(n),s=new mt.BufferAttribute(i,o,r),l=0;for(let c=0;c<u.length;++c){let a=u[c];if(a.isInterleavedBufferAttribute){let f=l/o;for(let h=0,d=a.count;h<d;h++)for(let g=0;g<o;g++){let y=a.getComponent(h,g);s.setComponent(h+f,g,y)}}else i.set(a.array,l);l+=a.count*o}return e!==void 0&&(s.gpuType=e),s}function Ns(u,t){if(t===mt.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),u;if(t===mt.TriangleFanDrawMode||t===mt.TriangleStripDrawMode){let o=u.getIndex();if(o===null){let i=[],s=u.getAttribute("position");if(s!==void 0){for(let l=0;l<s.count;l++)i.push(l);u.setIndex(i),o=u.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),u}let r=o.count-2,e=[];if(t===mt.TriangleFanDrawMode)for(let i=1;i<=r;i++)e.push(o.getX(0)),e.push(o.getX(i)),e.push(o.getX(i+1));else for(let i=0;i<r;i++)i%2===0?(e.push(o.getX(i)),e.push(o.getX(i+1)),e.push(o.getX(i+2))):(e.push(o.getX(i+2)),e.push(o.getX(i+1)),e.push(o.getX(i)));e.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let n=u.clone();return n.setIndex(e),n.clearGroups(),n}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),u}var $e=.6,zf=3.2,Wf=1.8,Kf=3.6,Nl=["#93b7d4","#f2a65e","#f7d488","#e8968a","#9ccfc3"],Xf=new Ce.Color("#aab3d0");function _o(u){let t=2166136261;for(let o=0;o<u.length;o++)t^=u.charCodeAt(o),t=Math.imul(t,16777619);return t>>>0}function Lo(u){return zf+_o(u)%1e3*(Wf/1e3)}function qf(u,t){let o=u?.categories[0]?.colorHex;return o?new Ce.Color(o):new Ce.Color(Nl[_o(t)%Nl.length])}function Co(u,t,o,r){let e=0;for(let n=0;n<t.length;n++){let i=t[n],s=t[(n+1)%t.length];if(!i||!s)continue;let l=Math.hypot(s[0]-i[0],s[1]-i[1]);if(l<.05)continue;let c=(s[1]-i[1])/l,a=-(s[0]-i[0])/l,f=u.pos.length/3;u.pos.push(i[0],i[1],o,s[0],s[1],o,s[0],s[1],r,i[0],i[1],r),u.nrm.push(c,a,0,c,a,0,c,a,0,c,a,0);let h=e+l/Kf;u.uv.push(e,0,h,0,h,1,e,1),u.idx.push(f,f+1,f+2,f,f+2,f+3),e=h}}function Kl(u){let t=new Ce.BufferGeometry;return t.setAttribute("position",new Ce.BufferAttribute(new Float32Array(u.pos),3)),t.setAttribute("normal",new Ce.BufferAttribute(new Float32Array(u.nrm),3)),t.setAttribute("uv",new Ce.BufferAttribute(new Float32Array(u.uv),2)),t.setIndex(u.idx),t}function Ks(u){if(u.layerId==="footprint")return"base";let t=u.type.toUpperCase();if(t==="WALL")return"boundary";if(t==="INNER_WALL"||u.geometry.type==="LineString")return"partition";if(u.style){let o=u.style.height;return o!==void 0&&o>.2?"unit":"base"}return"unit"}function Xs(u,t){let o=u.style?.height;return t==="boundary"||t==="partition"?o!==void 0&&o>0?o:3:t==="unit"?o??Lo(u.id):0}function Hs(u,t){return u.style?.color?new Ce.Color(u.style.color):u.style?.fillColor?new Ce.Color(u.style.fillColor):qf(t,u.id)}var Hl=.8;function Gl(u,t,o,r,e,n){let i=[],s=t?u.length:u.length-1;for(let l=0;l<s;l++){let c=u[l],a=u[(l+1)%u.length];if(!c||!a)continue;let f=a[0]-c[0],h=a[1]-c[1],d=Math.hypot(f,h);if(d<.05)continue;let g=-h/d*e,y=f/d*e,b=f/d*e,v=h/d*e,w=[[c[0]-b+g,c[1]-v+y],[a[0]+b+g,a[1]+v+y],[a[0]+b-g,a[1]+v-y],[c[0]-b-g,c[1]-v-y]];i.push(zs([w],o,r,n)),i.push(fn([w],r,n))}return i}var Zf=new Ce.Color("#e7e6e1"),Lr=.4,Yf=2.6,Cr=.62,$f=new Ce.Color("#d9dadd"),Jf=.35,Or=.72,Vl=.4;function Xl(u,t,o,r){let e=Math.cos(r),n=Math.sin(r),i=[];for(let s=0;s<u.length;s++){let l=u[s],c=u[(s+1)%u.length];if(!l||!c)continue;let a=c[0]-l[0],f=c[1]-l[1],h=a*n-f*e;if(Math.abs(h)<1e-9)continue;let d=(e*(l[1]-o)-n*(l[0]-t))/h;if(d<0||d>1)continue;let g=Math.abs(e)>Math.abs(n)?(l[0]+d*a-t)/e:(l[1]+d*f-o)/n;i.push(g)}if(i.length<2)return null;i.sort((s,l)=>s-l);for(let s=0;s<i.length-1;s++){let l=i[s],c=i[s+1];if(l!==void 0&&c!==void 0&&l<=0&&c>=0)return[l,c]}return null}function Fr(u,t,o,r){let e=Xl(u,t,o,r);return e?e[1]-e[0]:null}function Pr(u,t,o,r){let e=Xl(u,t,o,r);return e?2*Math.min(-e[0],e[1]):null}var Qf=.14;function eh(u){let t=-1,o=1/0;for(let r=0;r<u.length;r++){if(u[r]!==" ")continue;let e=Math.abs(r-(u.length-1-r));e<o&&(o=e,t=r)}return t}function jl(u,t,o,r,e){let n=Math.cos(-e),i=Math.sin(-e),s=1/0,l=-1/0,c=1/0,a=-1/0;for(let b of u){let v=b[0]*n-b[1]*i,w=b[0]*i+b[1]*n;v<s&&(s=v),v>l&&(l=v),w<c&&(c=w),w>a&&(a=w)}let f=Fr(u,o,r,e)??l-s,h=Fr(u,o,r,e+Math.PI/2)??a-c,d=Math.max(Lr,Math.min(Yf,f*Qf,h*Vl));if(t.length*Cr*d<=f*Or)return{text:t,fontSize:d,rotation:e,alongM:f,acrossM:h};let g=Math.max(Lr,Math.min(d,f*Or/(t.length*Cr))),y=eh(t);if(y>0){let b=t.slice(0,y),v=t.slice(y+1),w=Math.max(1,b.length,v.length),T=h*Vl/2,x=Math.max(Lr,Math.min(d,f*Or/(w*Cr),T)),E=-Math.sin(e),O=Math.cos(e),A=.66*x,k=Fr(u,o+E*A,r+O*A,e)??f,M=Fr(u,o-E*A,r-O*A,e)??f,F=Math.min(f,k,M);if(x=Math.max(Lr,Math.min(x,F*Or/(w*Cr))),x>g*1.15)return{text:`${b}
|
|
2
|
+
${v}`,fontSize:x,rotation:e,alongM:f,acrossM:h}}return{text:t,fontSize:g,rotation:e,alongM:f,acrossM:h}}var th=.85;function nh(u){for(;u>Math.PI/2;)u-=Math.PI;for(;u<=-Math.PI/2;)u+=Math.PI;return u}function Gs(u,t,o,r){let e=t.trim(),n=Ii(u),i=nh(n+Math.PI/2),s=Math.abs(n)<=Math.abs(i)?n:i,l=s===n?i:n,c=jl(u,e,o,r,s);if(c.fontSize>=th)return c;let a=jl(u,e,o,r,l);return a.fontSize>c.fontSize*1.15?a:c}var zl=.65,oh=.5;function Vs(u,t,o,r,e,n){let i=Pr(u,t,o,r),s=Pr(u,t,o,r+Math.PI/2),l=zl*(i??e*.5),c=oh*(s??n*.5),a=-Math.sin(r),f=Math.cos(r);for(let h=0;h<3;h++){let d=.45*c,g=Pr(u,t+a*d,o+f*d,r),y=Pr(u,t-a*d,o-f*d,r);if(g===null||y===null){c*=.6;continue}l=Math.min(l,zl*Math.min(g,y));break}return{logoBoxW:l,logoBoxH:c}}function Ii(u){let t=0,o=0;for(let r=0;r<u.length-1;r++){let e=u[r],n=u[r+1];if(!e||!n)continue;let i=n[0]-e[0],s=n[1]-e[1],l=i*i+s*s;l>t&&(t=l,o=Math.atan2(s,i))}for(;o<=-Math.PI/2;)o+=Math.PI;for(;o>Math.PI/2;)o-=Math.PI;return o}function Wl(u,t){return t.geometry.type!=="Polygon"?[]:t.geometry.coordinates.map(o=>gh(Bt(u,o))).filter(o=>o.length>=3)}function fn(u,t,o){let r=u[0]??[],e=new Ce.Shape(r.map(([l,c])=>new Ce.Vector2(l,c)));for(let l of u.slice(1))e.holes.push(new Ce.Path(l.map(([c,a])=>new Ce.Vector2(c,a))));let n=new Ce.ShapeGeometry(e),i=n.attributes.position?.count??0,s=new Float32Array(i*3);for(let l=0;l<i;l++)s[l*3]=o.r,s[l*3+1]=o.g,s[l*3+2]=o.b;return n.setAttribute("color",new Ce.BufferAttribute(s,3)),n.translate(0,0,t),n}var ih=-.55,rh=.835,sh=.9,ah=.1;function ql(u,t){return sh+ah*Math.max(0,u*ih+t*rh)}function zs(u,t,o,r){let e={pos:[],nrm:[],uv:[],idx:[]};for(let c of u)Co(e,c,t,o);let n=Kl(e),i=n.attributes.position?.count??0,s=n.attributes.normal,l=new Float32Array(i*3);for(let c=0;c<i;c++){let a=s?ql(s.getX(c),s.getY(c)):1;l[c*3]=r.r*a,l[c*3+1]=r.g*a,l[c*3+2]=r.b*a}return n.setAttribute("color",new Ce.BufferAttribute(l,3)),n}function Ri(u,t,o,r,e){let n={pos:[],nrm:[],uv:[],idx:[]};for(let a of u)Co(n,a,t,o);let i=Kl(n),s=i.attributes.position?.count??0,l=new Float32Array(s*3),c=i.attributes.normal;for(let a=0;a<s;a++){let f=a%4>=2?r:e,h=c?ql(c.getX(a),c.getY(a)):1;l[a*3]=f.r*h,l[a*3+1]=f.g*h,l[a*3+2]=f.b*h}return i.setAttribute("color",new Ce.BufferAttribute(l,3)),i}function Ws(u){let t=0;for(let o=0;o<u.length;o++){let r=u[o],e=u[(o+1)%u.length];r&&e&&(t+=r[0]*e[1]-e[0]*r[1])}return t/2}function lh(u){let t=0;for(let o=0;o<u.length;o++){let r=u[o],e=u[(o+1)%u.length];r&&e&&(t+=Math.hypot(e[0]-r[0],e[1]-r[1]))}return t}var ch=1,uh=.2;function fh(u,t,o){let r=!1,e=o.length;for(let n=0,i=e-1;n<e;i=n++){let s=o[n],l=o[i];!s||!l||s[1]>t!=l[1]>t&&u<(l[0]-s[0])*(t-s[1])/(l[1]-s[1])+s[0]&&(r=!r)}return r}function js(u,t){let o=u.length;if(o<3)return u;let r=Ws(u);if(Math.abs(r)<1e-6)return u;let e=r>0?1:-1,n=[],i=[],s=[],l=[];for(let f=0;f<o;f++){let h=u[f],d=u[(f+1)%o];if(!h||!d){n.push(0),i.push(0),s.push(1),l.push(0);continue}let g=d[0]-h[0],y=d[1]-h[1],b=Math.hypot(g,y)||1;g/=b,y/=b,n.push(h[0]+-y*e*t),i.push(h[1]+g*e*t),s.push(g),l.push(y)}let c=[];for(let f=0;f<o;f++){let h=(f-1+o)%o,d=s[f]??1,g=l[f]??0,y=s[h]??1,b=l[h]??0,v=n[f]??0,w=i[f]??0,T=n[h]??0,x=i[h]??0,E=y*g-b*d;if(Math.abs(E)<1e-9){c.push([v,w]);continue}let O=((v-T)*g-(w-x)*d)/E;c.push([T+O*y,x+O*b])}let a=Ws(c);if(Math.sign(a)!==Math.sign(r)||Math.abs(a)<Math.abs(r)*.2)return u;for(let f of c)if(!fh(f[0],f[1],u))return u;return c}var hh=2,dh=40;function ph(u){let t=u.length,o=(r,e,n,i)=>{let s=(e[0]-r[0])*(i[1]-n[1])-(e[1]-r[1])*(i[0]-n[0]);if(Math.abs(s)<1e-12)return!1;let l=((n[0]-r[0])*(i[1]-n[1])-(n[1]-r[1])*(i[0]-n[0]))/s,c=((n[0]-r[0])*(e[1]-r[1])-(n[1]-r[1])*(e[0]-r[0]))/s;return l>1e-6&&l<1-1e-6&&c>1e-6&&c<1-1e-6};for(let r=0;r<t;r++){let e=u[r],n=u[(r+1)%t];if(!(!e||!n))for(let i=r+2;i<t;i++){if(r===0&&i===t-1)continue;let s=u[i],l=u[(i+1)%t];if(!(!s||!l)&&o(e,n,s,l))return!0}}return!1}function gh(u,t=hh,o=dh){let r=Math.cos(o*Math.PI/180),e=u;for(let n=0;n<t;n++){let i=e.length;if(i<4)break;let s=[];for(let l=0;l<i;l++){let c=e[(l-1+i)%i],a=e[l],f=e[(l+1)%i];if(!c||!a||!f){a&&s.push([a[0],a[1]]);continue}let h=a[0]-c[0],d=a[1]-c[1],g=f[0]-a[0],y=f[1]-a[1],b=Math.hypot(h,d)||1,v=Math.hypot(g,y)||1;(h*g+d*y)/(b*v)<=r?s.push([a[0],a[1]]):(s.push([a[0]-.25*h,a[1]-.25*d]),s.push([a[0]+.25*g,a[1]+.25*y]))}e=s}return ph(e)?u:e}function Zl(u,t,o){let r=[],e=[],n=[],i=[],s=(a,f)=>{for(let h of a)for(let d=0;d<h.length;d++){let g=h[d],y=h[(d+1)%h.length];g&&y&&i.push(g[0],g[1],f,y[0],y[1],f)}},l=new Map;for(let a of t.locations)a.shapeId&&l.set(a.shapeId,a);for(let a of t.shapes){let f=Ks(a),h=a.style,d=r,g=Xs(a,f),y=_o(a.id)%16*.003,b=$e+g+y;if(f==="partition"){let k=a.geometry.type==="LineString"?a.geometry.coordinates.map(C=>Rn(u,C)):Wl(u,a)[0];if(!k||k.length<2||!o.panel&&g<=0)continue;let M=o.panel,F=M?$e+M.wallHeight:b,I=M?M.wallFromData?h?.color??M.innerWall:M.innerWall:h?.color??Zf.getStyle();d.push(...Gl(k,!1,$e,F,Hl,new Ce.Color(I)));continue}let v=Wl(u,a),w=v[0];if(!w)continue;if(f==="base"){let k=l.get(a.id);if(a.layerId==="footprint")d.push(fn(v,$e,new Ce.Color(h?.fillColor??Xf.getStyle()))),d.push(zs(v,0,$e,new Ce.Color("#f2f2f5")));else{let M=$e+.03+((h?.height??0)>0?.03:0)+_o(a.id)%8*.002,F=o.panel&&!o.panel.topUpperFromData?new Ce.Color(o.panel.floor):Hs(a,k),I=v.map(C=>js(C,uh));if(d.push(fn(I,M,F)),s(I,M+.02),k&&!k.hidden&&!k.amenity){let[C,S]=Xt(w),m=Gs(w,k.name,C,S);n.push({text:m.text,x:C,y:S,z:M+.05,fontSize:m.fontSize,baseRotation:m.rotation,locationId:k.id,...k.logoUrl?{logoUrl:k.logoUrl,...Vs(w,C,S,m.rotation,m.alongM,m.acrossM)}:{}})}}continue}if(f==="boundary"){let k=o.panel,M=k?k.wallFromData?h?.fillColor??k.wallBase:k.wallBase:h?.fillColor??"#c9c9c9";r.push(fn(v,$e,new Ce.Color(M))),r.push(zs(v,0,$e,new Ce.Color("#f2f2f5")));let F=k?$e+k.wallHeight:b,I=k?k.wallFromData?h?.color??k.wall:k.wall:h?.color??"#f7f7f7";d.push(...Gl(w,!0,$e,F,Hl,new Ce.Color(I)));continue}let T=l.get(a.id),x=lh(w);if((x>0?2*Math.abs(Ws(w))/x:0)<ch){let k=$e+.12,M=new Ce.Color("#adadb6");d.push(Ri(v,$e,k,M,M)),d.push(fn(v,k,M));continue}if(o.panel){let k=o.panel,M=o.translucent?e:d,F=k.uniformHeight??g,I=$e+F+y,C=I-F*k.topFraction,S=k.topUpperFromData?Hs(a,T):new Ce.Color(k.topUpper),m=new Ce.Color(k.base),L=new Ce.Color(k.edge),D=new Ce.Color(k.topLower);M.push(fn(v.map(H=>js(H,-Jf)),$e+.015,$f));let Y=$e+Math.min(.6,Math.max(.2,(C-$e)*.3));M.push(Ri(v,$e,Y,L,m)),M.push(Ri(v,Y,C,L,L)),M.push(fn(v,C,D));let J=v.map(H=>js(H,k.rimWidth)),j=k.topUpperFromData?S:new Ce.Color(k.bevel??k.edge);if(M.push(Ri(J,C,I,j,j)),M.push(fn(J,I,S)),s(v,C+.02),T&&!T.hidden&&!T.amenity){let[H,R]=Xt(w),P=Gs(w,T.name,H,R);n.push({text:P.text,x:H,y:R,z:I+.05,fontSize:P.fontSize,baseRotation:P.rotation,locationId:T.id,...T.logoUrl?{logoUrl:T.logoUrl,...Vs(w,H,R,P.rotation,P.alongM,P.acrossM)}:{}})}continue}let O=Hs(a,T),A=o.translucent?e:d;if(A.push(Ri(v,$e,b,o.wallTop(O),o.wallBase(O))),A.push(fn(v,b,o.roof(O))),s(v,b+.02),T&&!T.hidden&&!T.amenity){let[k,M]=Xt(w),F=Gs(w,T.name,k,M);n.push({text:F.text,x:k,y:M,z:b+.08,fontSize:F.fontSize,baseRotation:F.rotation,locationId:T.id,...T.logoUrl?{logoUrl:T.logoUrl,...Vs(w,k,M,F.rotation,F.alongM,F.acrossM)}:{}})}}let c=null;return i.length&&(c=new Ce.BufferGeometry,c.setAttribute("position",new Ce.BufferAttribute(new Float32Array(i),3))),{solid:r.length?Ds(r,!1):null,translucent:e.length?Ds(e,!1):null,borders:c,labelSpecs:n}}var Dt=gt(Ft(),1);var he=gt(Ft());function mh(){var u=Object.create(null);function t(e,n){var i=e.id,s=e.name,l=e.dependencies;l===void 0&&(l=[]);var c=e.init;c===void 0&&(c=function(){});var a=e.getTransferables;if(a===void 0&&(a=null),!u[i])try{l=l.map(function(h){return h&&h.isWorkerModule&&(t(h,function(d){if(d instanceof Error)throw d}),h=u[h.id].value),h}),c=r("<"+s+">.init",c),a&&(a=r("<"+s+">.getTransferables",a));var f=null;typeof c=="function"?f=c.apply(void 0,l):console.error("worker module init function failed to rehydrate"),u[i]={id:i,value:f,getTransferables:a},n(f)}catch(h){h&&h.noLog||console.error(h),n(h)}}function o(e,n){var i,s=e.id,l=e.args;(!u[s]||typeof u[s].value!="function")&&n(new Error("Worker module "+s+": not found or its 'init' did not return a function"));try{var c=(i=u[s]).value.apply(i,l);c&&typeof c.then=="function"?c.then(a,function(f){return n(f instanceof Error?f:new Error(""+f))}):a(c)}catch(f){n(f)}function a(f){try{var h=u[s].getTransferables&&u[s].getTransferables(f);(!h||!Array.isArray(h)||!h.length)&&(h=void 0),n(f,h)}catch(d){console.error(d),n(d)}}}function r(e,n){var i=void 0;self.troikaDefine=function(l){return i=l};var s=URL.createObjectURL(new Blob(["/** "+e.replace(/\*/g,"")+` **/
|
|
3
|
+
|
|
4
|
+
troikaDefine(
|
|
5
|
+
`+n+`
|
|
6
|
+
)`],{type:"application/javascript"}));try{importScripts(s)}catch(l){console.error(l)}return URL.revokeObjectURL(s),delete self.troikaDefine,i}self.addEventListener("message",function(e){var n=e.data,i=n.messageId,s=n.action,l=n.data;try{s==="registerModule"&&t(l,function(c){c instanceof Error?postMessage({messageId:i,success:!1,error:c.message}):postMessage({messageId:i,success:!0,result:{isCallable:typeof c=="function"}})}),s==="callModule"&&o(l,function(c,a){c instanceof Error?postMessage({messageId:i,success:!1,error:c.message}):postMessage({messageId:i,success:!0,result:c},a||void 0)})}catch(c){postMessage({messageId:i,success:!1,error:c.stack})}})}function bh(u){var t=function(){for(var o=[],r=arguments.length;r--;)o[r]=arguments[r];return t._getInitResult().then(function(e){if(typeof e=="function")return e.apply(void 0,o);throw new Error("Worker module function was called but `init` did not return a callable function")})};return t._getInitResult=function(){var o=u.dependencies,r=u.init;o=Array.isArray(o)?o.map(function(n){return n&&(n=n.onMainThread||n,n._getInitResult&&(n=n._getInitResult())),n}):[];var e=Promise.all(o).then(function(n){return r.apply(null,n)});return t._getInitResult=function(){return e},e},t}var $l=function(){var u=!1;if(typeof window<"u"&&typeof window.document<"u")try{var t=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));t.terminate(),u=!0}catch(o){typeof process<"u"&&process.env.NODE_ENV==="test"||console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+o.message+"]")}return $l=function(){return u},u},yh=0,vh=0,qs=!1,_i=Object.create(null),Li=Object.create(null),Zs=Object.create(null);function eo(u){if((!u||typeof u.init!="function")&&!qs)throw new Error("requires `options.init` function");var t=u.dependencies,o=u.init,r=u.getTransferables,e=u.workerId,n=bh(u);e==null&&(e="#default");var i="workerModule"+ ++yh,s=u.name||i,l=null;t=t&&t.map(function(a){return typeof a=="function"&&!a.workerModuleData&&(qs=!0,a=eo({workerId:e,name:"<"+s+"> function dependency: "+a.name,init:`function(){return (
|
|
7
|
+
`+Ur(a)+`
|
|
8
|
+
)}`}),qs=!1),a&&a.workerModuleData&&(a=a.workerModuleData),a});function c(){for(var a=[],f=arguments.length;f--;)a[f]=arguments[f];if(!$l())return n.apply(void 0,a);if(!l){l=Yl(e,"registerModule",c.workerModuleData);var h=function(){l=null,Li[e].delete(h)};(Li[e]||(Li[e]=new Set)).add(h)}return l.then(function(d){var g=d.isCallable;if(g)return Yl(e,"callModule",{id:i,args:a});throw new Error("Worker module function was called but `init` did not return a callable function")})}return c.workerModuleData={isWorkerModule:!0,id:i,name:s,dependencies:t,init:Ur(o),getTransferables:r&&Ur(r)},c.onMainThread=n,c}function Jl(u){Li[u]&&Li[u].forEach(function(t){t()}),_i[u]&&(_i[u].terminate(),delete _i[u])}function Ur(u){var t=u.toString();return!/^function/.test(t)&&/^\w+\s*\(/.test(t)&&(t="function "+t),t}function wh(u){var t=_i[u];if(!t){var o=Ur(mh);t=_i[u]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+u.replace(/\*/g,"")+` **/
|
|
9
|
+
|
|
10
|
+
;(`+o+")()"],{type:"application/javascript"}))),t.onmessage=function(r){var e=r.data,n=e.messageId,i=Zs[n];if(!i)throw new Error("WorkerModule response with empty or unknown messageId");delete Zs[n],i(e)}}return t}function Yl(u,t,o){return new Promise(function(r,e){var n=++vh;Zs[n]=function(i){i.success?r(i.result):e(new Error("Error in worker "+t+" call: "+i.error))},wh(u).postMessage({messageId:n,action:t,data:o})})}function Ys(){var u=(function(t){function o(j,H,R,P,U,G,B,W){var K=1-B;W.x=K*K*j+2*K*B*R+B*B*U,W.y=K*K*H+2*K*B*P+B*B*G}function r(j,H,R,P,U,G,B,W,K,Z){var ne=1-K;Z.x=ne*ne*ne*j+3*ne*ne*K*R+3*ne*K*K*U+K*K*K*B,Z.y=ne*ne*ne*H+3*ne*ne*K*P+3*ne*K*K*G+K*K*K*W}function e(j,H){for(var R=/([MLQCZ])([^MLQCZ]*)/g,P,U,G,B,W;P=R.exec(j);){var K=P[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(Z){return parseFloat(Z)});switch(P[1]){case"M":B=U=K[0],W=G=K[1];break;case"L":(K[0]!==B||K[1]!==W)&&H("L",B,W,B=K[0],W=K[1]);break;case"Q":{H("Q",B,W,B=K[2],W=K[3],K[0],K[1]);break}case"C":{H("C",B,W,B=K[4],W=K[5],K[0],K[1],K[2],K[3]);break}case"Z":(B!==U||W!==G)&&H("L",B,W,U,G);break}}}function n(j,H,R){R===void 0&&(R=16);var P={x:0,y:0};e(j,function(U,G,B,W,K,Z,ne,se,Q){switch(U){case"L":H(G,B,W,K);break;case"Q":{for(var $=G,Ie=B,Ee=1;Ee<R;Ee++)o(G,B,Z,ne,W,K,Ee/(R-1),P),H($,Ie,P.x,P.y),$=P.x,Ie=P.y;break}case"C":{for(var ve=G,we=B,_e=1;_e<R;_e++)r(G,B,Z,ne,se,Q,W,K,_e/(R-1),P),H(ve,we,P.x,P.y),ve=P.x,we=P.y;break}}})}var i="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,c={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function a(j,H){var R=j.getContext?j.getContext("webgl",c):j,P=l.get(R);if(!P){let ve=function(X){var ge=G[X];if(!ge&&(ge=G[X]=R.getExtension(X),!ge))throw new Error(X+" not supported");return ge},we=function(X,ge){var te=R.createShader(ge);return R.shaderSource(te,X),R.compileShader(te),te},_e=function(X,ge,te,le){if(!B[X]){var oe={},qe={},ce=R.createProgram();R.attachShader(ce,we(ge,R.VERTEX_SHADER)),R.attachShader(ce,we(te,R.FRAGMENT_SHADER)),R.linkProgram(ce),B[X]={program:ce,transaction:function(Se){R.useProgram(ce),Se({setUniform:function(Ve,ze){for(var Re=[],ke=arguments.length-2;ke-- >0;)Re[ke]=arguments[ke+2];var ue=qe[ze]||(qe[ze]=R.getUniformLocation(ce,ze));R["uniform"+Ve].apply(R,[ue].concat(Re))},setAttribute:function(Ve,ze,Re,ke,ue){var Ne=oe[Ve];Ne||(Ne=oe[Ve]={buf:R.createBuffer(),loc:R.getAttribLocation(ce,Ve),data:null}),R.bindBuffer(R.ARRAY_BUFFER,Ne.buf),R.vertexAttribPointer(Ne.loc,ze,R.FLOAT,!1,0,0),R.enableVertexAttribArray(Ne.loc),U?R.vertexAttribDivisor(Ne.loc,ke):ve("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Ne.loc,ke),ue!==Ne.data&&(R.bufferData(R.ARRAY_BUFFER,ue,Re),Ne.data=ue)}})}}}B[X].transaction(le)},ee=function(X,ge){K++;try{R.activeTexture(R.TEXTURE0+K);var te=W[X];te||(te=W[X]=R.createTexture(),R.bindTexture(R.TEXTURE_2D,te),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.NEAREST),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MAG_FILTER,R.NEAREST)),R.bindTexture(R.TEXTURE_2D,te),ge(te,K)}finally{K--}},fe=function(X,ge,te){var le=R.createFramebuffer();Z.push(le),R.bindFramebuffer(R.FRAMEBUFFER,le),R.activeTexture(R.TEXTURE0+ge),R.bindTexture(R.TEXTURE_2D,X),R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,X,0);try{te(le)}finally{R.deleteFramebuffer(le),R.bindFramebuffer(R.FRAMEBUFFER,Z[--Z.length-1]||null)}},ae=function(){G={},B={},W={},K=-1,Z.length=0};var ne=ve,se=we,Q=_e,$=ee,Ie=fe,Ee=ae,U=typeof WebGL2RenderingContext<"u"&&R instanceof WebGL2RenderingContext,G={},B={},W={},K=-1,Z=[];R.canvas.addEventListener("webglcontextlost",function(X){ae(),X.preventDefault()},!1),l.set(R,P={gl:R,isWebGL2:U,getExtension:ve,withProgram:_e,withTexture:ee,withTextureFramebuffer:fe,handleContextLoss:ae})}H(P)}function f(j,H,R,P,U,G,B,W){B===void 0&&(B=15),W===void 0&&(W=null),a(j,function(K){var Z=K.gl,ne=K.withProgram,se=K.withTexture;se("copy",function(Q,$){Z.texImage2D(Z.TEXTURE_2D,0,Z.RGBA,U,G,0,Z.RGBA,Z.UNSIGNED_BYTE,H),ne("copy",i,s,function(Ie){var Ee=Ie.setUniform,ve=Ie.setAttribute;ve("aUV",2,Z.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),Ee("1i","image",$),Z.bindFramebuffer(Z.FRAMEBUFFER,W||null),Z.disable(Z.BLEND),Z.colorMask(B&8,B&4,B&2,B&1),Z.viewport(R,P,U,G),Z.scissor(R,P,U,G),Z.drawArrays(Z.TRIANGLES,0,3)})})})}function h(j,H,R){var P=j.width,U=j.height;a(j,function(G){var B=G.gl,W=new Uint8Array(P*U*4);B.readPixels(0,0,P,U,B.RGBA,B.UNSIGNED_BYTE,W),j.width=H,j.height=R,f(B,W,0,0,P,U)})}var d=Object.freeze({__proto__:null,withWebGLContext:a,renderImageData:f,resizeWebGLCanvasWithoutClearing:h});function g(j,H,R,P,U,G){G===void 0&&(G=1);var B=new Uint8Array(j*H),W=P[2]-P[0],K=P[3]-P[1],Z=[];n(R,function(ve,we,_e,ee){Z.push({x1:ve,y1:we,x2:_e,y2:ee,minX:Math.min(ve,_e),minY:Math.min(we,ee),maxX:Math.max(ve,_e),maxY:Math.max(we,ee)})}),Z.sort(function(ve,we){return ve.maxX-we.maxX});for(var ne=0;ne<j;ne++)for(var se=0;se<H;se++){var Q=Ie(P[0]+W*(ne+.5)/j,P[1]+K*(se+.5)/H),$=Math.pow(1-Math.abs(Q)/U,G)/2;Q<0&&($=1-$),$=Math.max(0,Math.min(255,Math.round($*255))),B[se*j+ne]=$}return B;function Ie(ve,we){for(var _e=1/0,ee=1/0,fe=Z.length;fe--;){var ae=Z[fe];if(ae.maxX+ee<=ve)break;if(ve+ee>ae.minX&&we-ee<ae.maxY&&we+ee>ae.minY){var X=v(ve,we,ae.x1,ae.y1,ae.x2,ae.y2);X<_e&&(_e=X,ee=Math.sqrt(_e))}}return Ee(ve,we)&&(ee=-ee),ee}function Ee(ve,we){for(var _e=0,ee=Z.length;ee--;){var fe=Z[ee];if(fe.maxX<=ve)break;var ae=fe.y1>we!=fe.y2>we&&ve<(fe.x2-fe.x1)*(we-fe.y1)/(fe.y2-fe.y1)+fe.x1;ae&&(_e+=fe.y1<fe.y2?1:-1)}return _e!==0}}function y(j,H,R,P,U,G,B,W,K,Z){G===void 0&&(G=1),W===void 0&&(W=0),K===void 0&&(K=0),Z===void 0&&(Z=0),b(j,H,R,P,U,G,B,null,W,K,Z)}function b(j,H,R,P,U,G,B,W,K,Z,ne){G===void 0&&(G=1),K===void 0&&(K=0),Z===void 0&&(Z=0),ne===void 0&&(ne=0);for(var se=g(j,H,R,P,U,G),Q=new Uint8Array(se.length*4),$=0;$<se.length;$++)Q[$*4+ne]=se[$];f(B,Q,K,Z,j,H,1<<3-ne,W)}function v(j,H,R,P,U,G){var B=U-R,W=G-P,K=B*B+W*W,Z=K?Math.max(0,Math.min(1,((j-R)*B+(H-P)*W)/K)):0,ne=j-(R+Z*B),se=H-(P+Z*W);return ne*ne+se*se}var w=Object.freeze({__proto__:null,generate:g,generateIntoCanvas:y,generateIntoFramebuffer:b}),T="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);}",x="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);}",E="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);}",O=new Float32Array([0,0,2,0,0,2]),A=null,k=!1,M={},F=new WeakMap;function I(j){if(!k&&!L(j))throw new Error("WebGL generation not supported")}function C(j,H,R,P,U,G,B){if(G===void 0&&(G=1),B===void 0&&(B=null),!B&&(B=A,!B)){var W=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!W)throw new Error("OffscreenCanvas or DOM canvas not supported");B=A=W.getContext("webgl",{depth:!1})}I(B);var K=new Uint8Array(j*H*4);a(B,function(Q){var $=Q.gl,Ie=Q.withTexture,Ee=Q.withTextureFramebuffer;Ie("readable",function(ve,we){$.texImage2D($.TEXTURE_2D,0,$.RGBA,j,H,0,$.RGBA,$.UNSIGNED_BYTE,null),Ee(ve,we,function(_e){m(j,H,R,P,U,G,$,_e,0,0,0),$.readPixels(0,0,j,H,$.RGBA,$.UNSIGNED_BYTE,K)})})});for(var Z=new Uint8Array(j*H),ne=0,se=0;ne<K.length;ne+=4)Z[se++]=K[ne];return Z}function S(j,H,R,P,U,G,B,W,K,Z){G===void 0&&(G=1),W===void 0&&(W=0),K===void 0&&(K=0),Z===void 0&&(Z=0),m(j,H,R,P,U,G,B,null,W,K,Z)}function m(j,H,R,P,U,G,B,W,K,Z,ne){G===void 0&&(G=1),K===void 0&&(K=0),Z===void 0&&(Z=0),ne===void 0&&(ne=0),I(B);var se=[];n(R,function(Q,$,Ie,Ee){se.push(Q,$,Ie,Ee)}),se=new Float32Array(se),a(B,function(Q){var $=Q.gl,Ie=Q.isWebGL2,Ee=Q.getExtension,ve=Q.withProgram,we=Q.withTexture,_e=Q.withTextureFramebuffer,ee=Q.handleContextLoss;if(we("rawDistances",function(fe,ae){(j!==fe._lastWidth||H!==fe._lastHeight)&&$.texImage2D($.TEXTURE_2D,0,$.RGBA,fe._lastWidth=j,fe._lastHeight=H,0,$.RGBA,$.UNSIGNED_BYTE,null),ve("main",T,x,function(X){var ge=X.setAttribute,te=X.setUniform,le=!Ie&&Ee("ANGLE_instanced_arrays"),oe=!Ie&&Ee("EXT_blend_minmax");ge("aUV",2,$.STATIC_DRAW,0,O),ge("aLineSegment",4,$.DYNAMIC_DRAW,1,se),te.apply(void 0,["4f","uGlyphBounds"].concat(P)),te("1f","uMaxDistance",U),te("1f","uExponent",G),_e(fe,ae,function(qe){$.enable($.BLEND),$.colorMask(!0,!0,!0,!0),$.viewport(0,0,j,H),$.scissor(0,0,j,H),$.blendFunc($.ONE,$.ONE),$.blendEquationSeparate($.FUNC_ADD,Ie?$.MAX:oe.MAX_EXT),$.clear($.COLOR_BUFFER_BIT),Ie?$.drawArraysInstanced($.TRIANGLES,0,3,se.length/4):le.drawArraysInstancedANGLE($.TRIANGLES,0,3,se.length/4)})}),ve("post",i,E,function(X){X.setAttribute("aUV",2,$.STATIC_DRAW,0,O),X.setUniform("1i","tex",ae),$.bindFramebuffer($.FRAMEBUFFER,W),$.disable($.BLEND),$.colorMask(ne===0,ne===1,ne===2,ne===3),$.viewport(K,Z,j,H),$.scissor(K,Z,j,H),$.drawArrays($.TRIANGLES,0,3)})}),$.isContextLost())throw ee(),new Error("webgl context lost")})}function L(j){var H=!j||j===A?M:j.canvas||j,R=F.get(H);if(R===void 0){k=!0;var P=null;try{var U=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],G=C(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,j);R=G&&U.length===G.length&&G.every(function(B,W){return B===U[W]}),R||(P="bad trial run results",console.info(U,G))}catch(B){R=!1,P=B.message}P&&console.warn("WebGL SDF generation not supported:",P),k=!1,F.set(H,R)}return R}var D=Object.freeze({__proto__:null,generate:C,generateIntoCanvas:S,generateIntoFramebuffer:m,isSupported:L});function Y(j,H,R,P,U,G){U===void 0&&(U=Math.max(P[2]-P[0],P[3]-P[1])/2),G===void 0&&(G=1);try{return C.apply(D,arguments)}catch(B){return console.info("WebGL SDF generation failed, falling back to JS",B),g.apply(w,arguments)}}function J(j,H,R,P,U,G,B,W,K,Z){U===void 0&&(U=Math.max(P[2]-P[0],P[3]-P[1])/2),G===void 0&&(G=1),W===void 0&&(W=0),K===void 0&&(K=0),Z===void 0&&(Z=0);try{return S.apply(D,arguments)}catch(ne){return console.info("WebGL SDF generation failed, falling back to JS",ne),y.apply(w,arguments)}}return t.forEachPathCommand=e,t.generate=Y,t.generateIntoCanvas=J,t.javascript=w,t.pathToLineSegments=n,t.webgl=D,t.webglUtils=d,Object.defineProperty(t,"__esModule",{value:!0}),t})({});return u}function Th(){var u=(function(t){var o={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"},r={},e={};r.L=1,e[1]="L",Object.keys(o).forEach(function(ee,fe){r[ee]=1<<fe+1,e[r[ee]]=ee}),Object.freeze(r);var n=r.LRI|r.RLI|r.FSI,i=r.L|r.R|r.AL,s=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,l=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,c=r.S|r.WS|r.B|n|r.PDI|l,a=null;function f(){if(!a){a=new Map;var ee=function(ae){if(o.hasOwnProperty(ae)){var X=0;o[ae].split(",").forEach(function(ge){var te=ge.split("+"),le=te[0],oe=te[1];le=parseInt(le,36),oe=oe?parseInt(oe,36):0,a.set(X+=le,r[ae]);for(var qe=0;qe<oe;qe++)a.set(++X,r[ae])})}};for(var fe in o)ee(fe)}}function h(ee){return f(),a.get(ee.codePointAt(0))||r.L}function d(ee){return e[h(ee)]}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 y(ee,fe){var ae=36,X=0,ge=new Map,te=fe&&new Map,le;return ee.split(",").forEach(function oe(qe){if(qe.indexOf("+")!==-1)for(var ce=+qe;ce--;)oe(le);else{le=qe;var ye=qe.split(">"),Se=ye[0],Ge=ye[1];Se=String.fromCodePoint(X+=parseInt(Se,ae)),Ge=String.fromCodePoint(X+=parseInt(Ge,ae)),ge.set(Se,Ge),fe&&te.set(Ge,Se)}}),{map:ge,reverseMap:te}}var b,v,w;function T(){if(!b){var ee=y(g.pairs,!0),fe=ee.map,ae=ee.reverseMap;b=fe,v=ae,w=y(g.canonical,!1).map}}function x(ee){return T(),b.get(ee)||null}function E(ee){return T(),v.get(ee)||null}function O(ee){return T(),w.get(ee)||null}var A=r.L,k=r.R,M=r.EN,F=r.ES,I=r.ET,C=r.AN,S=r.CS,m=r.B,L=r.S,D=r.ON,Y=r.BN,J=r.NSM,j=r.AL,H=r.LRO,R=r.RLO,P=r.LRE,U=r.RLE,G=r.PDF,B=r.LRI,W=r.RLI,K=r.FSI,Z=r.PDI;function ne(ee,fe){for(var ae=125,X=new Uint32Array(ee.length),ge=0;ge<ee.length;ge++)X[ge]=h(ee[ge]);var te=new Map;function le(Rt,Kt){var It=X[Rt];X[Rt]=Kt,te.set(It,te.get(It)-1),It&s&&te.set(s,te.get(s)-1),te.set(Kt,(te.get(Kt)||0)+1),Kt&s&&te.set(s,(te.get(s)||0)+1)}for(var oe=new Uint8Array(ee.length),qe=new Map,ce=[],ye=null,Se=0;Se<ee.length;Se++)ye||ce.push(ye={start:Se,end:ee.length-1,level:fe==="rtl"?1:fe==="ltr"?0:Ll(Se,!1)}),X[Se]&m&&(ye.end=Se,ye=null);for(var Ge=U|P|R|H|n|Z|G|m,Ve=function(Rt){return Rt+(Rt&1?1:2)},ze=function(Rt){return Rt+(Rt&1?2:1)},Re=0;Re<ce.length;Re++){ye=ce[Re];var ke=[{_level:ye.level,_override:0,_isolate:0}],ue=void 0,Ne=0,Qe=0,kt=0;te.clear();for(var Ye=ye.start;Ye<=ye.end;Ye++){var Ae=X[Ye];if(ue=ke[ke.length-1],te.set(Ae,(te.get(Ae)||0)+1),Ae&s&&te.set(s,(te.get(s)||0)+1),Ae&Ge)if(Ae&(U|P)){oe[Ye]=ue._level;var We=(Ae===U?ze:Ve)(ue._level);We<=ae&&!Ne&&!Qe?ke.push({_level:We,_override:0,_isolate:0}):Ne||Qe++}else if(Ae&(R|H)){oe[Ye]=ue._level;var xn=(Ae===R?ze:Ve)(ue._level);xn<=ae&&!Ne&&!Qe?ke.push({_level:xn,_override:Ae&R?k:A,_isolate:0}):Ne||Qe++}else if(Ae&n){Ae&K&&(Ae=Ll(Ye+1,!0)===1?W:B),oe[Ye]=ue._level,ue._override&&le(Ye,ue._override);var Ke=(Ae===W?ze:Ve)(ue._level);Ke<=ae&&Ne===0&&Qe===0?(kt++,ke.push({_level:Ke,_override:0,_isolate:1,_isolInitIndex:Ye})):Ne++}else if(Ae&Z){if(Ne>0)Ne--;else if(kt>0){for(Qe=0;!ke[ke.length-1]._isolate;)ke.pop();var De=ke[ke.length-1]._isolInitIndex;De!=null&&(qe.set(De,Ye),qe.set(Ye,De)),ke.pop(),kt--}ue=ke[ke.length-1],oe[Ye]=ue._level,ue._override&&le(Ye,ue._override)}else Ae&G?(Ne===0&&(Qe>0?Qe--:!ue._isolate&&ke.length>1&&(ke.pop(),ue=ke[ke.length-1])),oe[Ye]=ue._level):Ae&m&&(oe[Ye]=ye.level);else oe[Ye]=ue._level,ue._override&&Ae!==Y&&le(Ye,ue._override)}for(var it=[],et=null,Le=ye.start;Le<=ye.end;Le++){var tt=X[Le];if(!(tt&l)){var xt=oe[Le],pt=tt&n,at=tt===Z;et&&xt===et._level?(et._end=Le,et._endsWithIsolInit=pt):it.push(et={_start:Le,_end:Le,_level:xt,_startsWithPDI:at,_endsWithIsolInit:pt})}}for(var zt=[],En=0;En<it.length;En++){var cn=it[En];if(!cn._startsWithPDI||cn._startsWithPDI&&!qe.has(cn._start)){for(var Sn=[et=cn],$n=void 0;et&&et._endsWithIsolInit&&($n=qe.get(et._end))!=null;)for(var un=En+1;un<it.length;un++)if(it[un]._start===$n){Sn.push(et=it[un]);break}for(var Et=[],Jn=0;Jn<Sn.length;Jn++)for(var fl=Sn[Jn],bs=fl._start;bs<=fl._end;bs++)Et.push(bs);for(var Lf=oe[Et[0]],hl=ye.level,dr=Et[0]-1;dr>=0;dr--)if(!(X[dr]&l)){hl=oe[dr];break}var ys=Et[Et.length-1],Cf=oe[ys],dl=ye.level;if(!(X[ys]&n)){for(var pr=ys+1;pr<=ye.end;pr++)if(!(X[pr]&l)){dl=oe[pr];break}}zt.push({_seqIndices:Et,_sosType:Math.max(hl,Lf)%2?k:A,_eosType:Math.max(dl,Cf)%2?k:A})}}for(var vs=0;vs<zt.length;vs++){var ws=zt[vs],de=ws._seqIndices,yi=ws._sosType,Of=ws._eosType,Ao=oe[de[0]]&1?k:A;if(te.get(J))for(var gr=0;gr<de.length;gr++){var pl=de[gr];if(X[pl]&J){for(var Ts=yi,mr=gr-1;mr>=0;mr--)if(!(X[de[mr]]&l)){Ts=X[de[mr]];break}le(pl,Ts&(n|Z)?D:Ts)}}if(te.get(M))for(var br=0;br<de.length;br++){var gl=de[br];if(X[gl]&M)for(var yr=br-1;yr>=-1;yr--){var ml=yr===-1?yi:X[de[yr]];if(ml&i){ml===j&&le(gl,C);break}}}if(te.get(j))for(var xs=0;xs<de.length;xs++){var bl=de[xs];X[bl]&j&&le(bl,k)}if(te.get(F)||te.get(S))for(var vi=1;vi<de.length-1;vi++){var Es=de[vi];if(X[Es]&(F|S)){for(var Mo=0,Ss=0,As=vi-1;As>=0&&(Mo=X[de[As]],!!(Mo&l));As--);for(var Ms=vi+1;Ms<de.length&&(Ss=X[de[Ms]],!!(Ss&l));Ms++);Mo===Ss&&(X[Es]===F?Mo===M:Mo&(M|C))&&le(Es,Mo)}}if(te.get(M))for(var en=0;en<de.length;en++){var Ff=de[en];if(X[Ff]&M){for(var vr=en-1;vr>=0&&X[de[vr]]&(I|l);vr--)le(de[vr],M);for(en++;en<de.length&&X[de[en]]&(I|l|M);en++)X[de[en]]!==M&&le(de[en],M)}}if(te.get(I)||te.get(F)||te.get(S))for(var wi=0;wi<de.length;wi++){var yl=de[wi];if(X[yl]&(I|F|S)){le(yl,D);for(var wr=wi-1;wr>=0&&X[de[wr]]&l;wr--)le(de[wr],D);for(var Tr=wi+1;Tr<de.length&&X[de[Tr]]&l;Tr++)le(de[Tr],D)}}if(te.get(M))for(var ks=0,vl=yi;ks<de.length;ks++){var wl=de[ks],Rs=X[wl];Rs&M?vl===A&&le(wl,A):Rs&i&&(vl=Rs)}if(te.get(s)){var Ti=k|M|C,Tl=Ti|A,xr=[];{for(var ko=[],Ro=0;Ro<de.length;Ro++)if(X[de[Ro]]&s){var xi=ee[de[Ro]],xl=void 0;if(x(xi)!==null)if(ko.length<63)ko.push({char:xi,seqIndex:Ro});else break;else if((xl=E(xi))!==null)for(var Ei=ko.length-1;Ei>=0;Ei--){var Is=ko[Ei].char;if(Is===xl||Is===E(O(xi))||x(O(Is))===xi){xr.push([ko[Ei].seqIndex,Ro]),ko.length=Ei;break}}}xr.sort(function(Rt,Kt){return Rt[0]-Kt[0]})}for(var _s=0;_s<xr.length;_s++){for(var El=xr[_s],Er=El[0],Ls=El[1],Sl=!1,Wt=0,Cs=Er+1;Cs<Ls;Cs++){var Al=de[Cs];if(X[Al]&Tl){Sl=!0;var Ml=X[Al]&Ti?k:A;if(Ml===Ao){Wt=Ml;break}}}if(Sl&&!Wt){Wt=yi;for(var Os=Er-1;Os>=0;Os--){var kl=de[Os];if(X[kl]&Tl){var Rl=X[kl]&Ti?k:A;Rl!==Ao?Wt=Rl:Wt=Ao;break}}}if(Wt){if(X[de[Er]]=X[de[Ls]]=Wt,Wt!==Ao){for(var Si=Er+1;Si<de.length;Si++)if(!(X[de[Si]]&l)){h(ee[de[Si]])&J&&(X[de[Si]]=Wt);break}}if(Wt!==Ao){for(var Ai=Ls+1;Ai<de.length;Ai++)if(!(X[de[Ai]]&l)){h(ee[de[Ai]])&J&&(X[de[Ai]]=Wt);break}}}}for(var An=0;An<de.length;An++)if(X[de[An]]&s){for(var Il=An,Fs=An,Ps=yi,Mi=An-1;Mi>=0;Mi--)if(X[de[Mi]]&l)Il=Mi;else{Ps=X[de[Mi]]&Ti?k:A;break}for(var _l=Of,ki=An+1;ki<de.length;ki++)if(X[de[ki]]&(s|l))Fs=ki;else{_l=X[de[ki]]&Ti?k:A;break}for(var Us=Il;Us<=Fs;Us++)X[de[Us]]=Ps===_l?Ps:Ao;An=Fs}}}for(var Ot=ye.start;Ot<=ye.end;Ot++){var Pf=oe[Ot],Sr=X[Ot];if(Pf&1?Sr&(A|M|C)&&oe[Ot]++:Sr&k?oe[Ot]++:Sr&(C|M)&&(oe[Ot]+=2),Sr&l&&(oe[Ot]=Ot===0?ye.level:oe[Ot-1]),Ot===ye.end||h(ee[Ot])&(L|m))for(var Ar=Ot;Ar>=0&&h(ee[Ar])&c;Ar--)oe[Ar]=ye.level}}return{levels:oe,paragraphs:ce};function Ll(Rt,Kt){for(var It=Rt;It<ee.length;It++){var Mn=X[It];if(Mn&(k|j))return 1;if(Mn&(m|A)||Kt&&Mn===Z)return 0;if(Mn&n){var Cl=Uf(It);It=Cl===-1?ee.length:Cl}}return 0}function Uf(Rt){for(var Kt=1,It=Rt+1;It<ee.length;It++){var Mn=X[It];if(Mn&m)break;if(Mn&Z){if(--Kt===0)return It}else Mn&n&&Kt++}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",Q;function $(){if(!Q){var ee=y(se,!0),fe=ee.map,ae=ee.reverseMap;ae.forEach(function(X,ge){fe.set(ge,X)}),Q=fe}}function Ie(ee){return $(),Q.get(ee)||null}function Ee(ee,fe,ae,X){var ge=ee.length;ae=Math.max(0,ae==null?0:+ae),X=Math.min(ge-1,X==null?ge-1:+X);for(var te=new Map,le=ae;le<=X;le++)if(fe[le]&1){var oe=Ie(ee[le]);oe!==null&&te.set(le,oe)}return te}function ve(ee,fe,ae,X){var ge=ee.length;ae=Math.max(0,ae==null?0:+ae),X=Math.min(ge-1,X==null?ge-1:+X);var te=[];return fe.paragraphs.forEach(function(le){var oe=Math.max(ae,le.start),qe=Math.min(X,le.end);if(oe<qe){for(var ce=fe.levels.slice(oe,qe+1),ye=qe;ye>=oe&&h(ee[ye])&c;ye--)ce[ye]=le.level;for(var Se=le.level,Ge=1/0,Ve=0;Ve<ce.length;Ve++){var ze=ce[Ve];ze>Se&&(Se=ze),ze<Ge&&(Ge=ze|1)}for(var Re=Se;Re>=Ge;Re--)for(var ke=0;ke<ce.length;ke++)if(ce[ke]>=Re){for(var ue=ke;ke+1<ce.length&&ce[ke+1]>=Re;)ke++;ke>ue&&te.push([ue+oe,ke+oe])}}}),te}function we(ee,fe,ae,X){var ge=_e(ee,fe,ae,X),te=[].concat(ee);return ge.forEach(function(le,oe){te[oe]=(fe.levels[le]&1?Ie(ee[le]):null)||ee[le]}),te.join("")}function _e(ee,fe,ae,X){for(var ge=ve(ee,fe,ae,X),te=[],le=0;le<ee.length;le++)te[le]=le;return ge.forEach(function(oe){for(var qe=oe[0],ce=oe[1],ye=te.slice(qe,ce+1),Se=ye.length;Se--;)te[ce-Se]=ye[Se]}),te}return t.closingToOpeningBracket=E,t.getBidiCharType=h,t.getBidiCharTypeName=d,t.getCanonicalBracket=O,t.getEmbeddingLevels=ne,t.getMirroredCharacter=Ie,t.getMirroredCharactersMap=Ee,t.getReorderSegments=ve,t.getReorderedIndices=_e,t.getReorderedString=we,t.openingToClosingBracket=x,Object.defineProperty(t,"__esModule",{value:!0}),t})({});return u}var Ql=Th;var ct=gt(Ft()),Js=/\bvoid\s+main\s*\(\s*\)\s*{/g;function $s(u){let t=/^[ \t]*#include +<([\w\d./]+)>/gm;function o(r,e){let n=ct.ShaderChunk[e];return n?$s(n):r}return u.replace(t,o)}var ut=[];for(let u=0;u<256;u++)ut[u]=(u<16?"0":"")+u.toString(16);function xh(){let u=Math.random()*4294967295|0,t=Math.random()*4294967295|0,o=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(ut[u&255]+ut[u>>8&255]+ut[u>>16&255]+ut[u>>24&255]+"-"+ut[t&255]+ut[t>>8&255]+"-"+ut[t>>16&15|64]+ut[t>>24&255]+"-"+ut[o&63|128]+ut[o>>8&255]+"-"+ut[o>>16&255]+ut[o>>24&255]+ut[r&255]+ut[r>>8&255]+ut[r>>16&255]+ut[r>>24&255]).toUpperCase()}var to=Object.assign||function(){let u=arguments[0];for(let t=1,o=arguments.length;t<o;t++){let r=arguments[t];if(r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(u[e]=r[e])}return u},Eh=Date.now(),ec=new WeakMap,tc=new Map,Sh=1e10;function Oo(u,t){let o=Rh(t),r=ec.get(u);if(r||ec.set(u,r=Object.create(null)),r[o])return new r[o];let e=`_onBeforeCompile${o}`,n=function(c,a){u.onBeforeCompile.call(this,c,a);let f=this.customProgramCacheKey()+"|"+c.vertexShader+"|"+c.fragmentShader,h=tc[f];if(!h){let d=Ah(this,c,t,o);h=tc[f]=d}c.vertexShader=h.vertexShader,c.fragmentShader=h.fragmentShader,to(c.uniforms,this.uniforms),t.timeUniform&&(c.uniforms[t.timeUniform]={get value(){return Date.now()-Eh}}),this[e]&&this[e](c)},i=function(){return s(t.chained?u:u.clone())},s=function(c){let a=Object.create(c,l);return Object.defineProperty(a,"baseMaterial",{value:u}),Object.defineProperty(a,"id",{value:Sh++}),a.uuid=xh(),a.uniforms=to({},c.uniforms,t.uniforms),a.defines=to({},c.defines,t.defines),a.defines[`TROIKA_DERIVED_MATERIAL_${o}`]="",a.extensions=to({},c.extensions,t.extensions),a._listeners=void 0,a},l={constructor:{value:i},isDerivedMaterial:{value:!0},type:{get:()=>u.type,set:c=>{u.type=c}},isDerivedFrom:{writable:!0,configurable:!0,value:function(c){let a=this.baseMaterial;return c===a||a.isDerivedMaterial&&a.isDerivedFrom(c)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return u.customProgramCacheKey()+"|"+o}},onBeforeCompile:{get(){return n},set(c){this[e]=c}},copy:{writable:!0,configurable:!0,value:function(c){return u.copy.call(this,c),!u.isShaderMaterial&&!u.isDerivedMaterial&&(to(this.extensions,c.extensions),to(this.defines,c.defines),to(this.uniforms,ct.UniformsUtils.clone(c.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){let c=new u.constructor;return s(c).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let c=this._depthMaterial;return c||(c=this._depthMaterial=Oo(u.isDerivedMaterial?u.getDepthMaterial():new ct.MeshDepthMaterial({depthPacking:ct.RGBADepthPacking}),t),c.defines.IS_DEPTH_MATERIAL="",c.uniforms=this.uniforms),c}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let c=this._distanceMaterial;return c||(c=this._distanceMaterial=Oo(u.isDerivedMaterial?u.getDistanceMaterial():new ct.MeshDistanceMaterial,t),c.defines.IS_DISTANCE_MATERIAL="",c.uniforms=this.uniforms),c}},dispose:{writable:!0,configurable:!0,value(){let{_depthMaterial:c,_distanceMaterial:a}=this;c&&c.dispose(),a&&a.dispose(),u.dispose.call(this)}}};return r[o]=i,new i}function Ah(u,{vertexShader:t,fragmentShader:o},r,e){let{vertexDefs:n,vertexMainIntro:i,vertexMainOutro:s,vertexTransform:l,fragmentDefs:c,fragmentMainIntro:a,fragmentMainOutro:f,fragmentColorTransform:h,customRewriter:d,timeUniform:g}=r;if(n=n||"",i=i||"",s=s||"",c=c||"",a=a||"",f=f||"",(l||d)&&(t=$s(t)),(h||d)&&(o=o.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,`
|
|
11
|
+
//!BEGIN_POST_CHUNK $1
|
|
12
|
+
$&
|
|
13
|
+
//!END_POST_CHUNK
|
|
14
|
+
`),o=$s(o)),d){let y=d({vertexShader:t,fragmentShader:o});t=y.vertexShader,o=y.fragmentShader}if(h){let y=[];o=o.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,b=>(y.push(b),"")),f=`${h}
|
|
15
|
+
${y.join(`
|
|
16
|
+
`)}
|
|
17
|
+
${f}`}if(g){let y=`
|
|
18
|
+
uniform float ${g};
|
|
19
|
+
`;n=y+n,c=y+c}return l&&(t=`vec3 troika_position_${e};
|
|
20
|
+
vec3 troika_normal_${e};
|
|
21
|
+
vec2 troika_uv_${e};
|
|
22
|
+
${t}
|
|
23
|
+
`,n=`${n}
|
|
24
|
+
void troikaVertexTransform${e}(inout vec3 position, inout vec3 normal, inout vec2 uv) {
|
|
25
|
+
${l}
|
|
26
|
+
}
|
|
27
|
+
`,i=`
|
|
28
|
+
troika_position_${e} = vec3(position);
|
|
29
|
+
troika_normal_${e} = vec3(normal);
|
|
30
|
+
troika_uv_${e} = vec2(uv);
|
|
31
|
+
troikaVertexTransform${e}(troika_position_${e}, troika_normal_${e}, troika_uv_${e});
|
|
32
|
+
${i}
|
|
33
|
+
`,t=t.replace(/\b(position|normal|uv)\b/g,(y,b,v,w)=>/\battribute\s+vec[23]\s+$/.test(w.substr(0,v))?b:`troika_${b}_${e}`),u.map&&u.map.channel>0||(t=t.replace(/\bMAP_UV\b/g,`troika_uv_${e}`))),t=nc(t,e,n,i,s),o=nc(o,e,c,a,f),{vertexShader:t,fragmentShader:o}}function nc(u,t,o,r,e){return(r||e||o)&&(u=u.replace(Js,`
|
|
34
|
+
${o}
|
|
35
|
+
void troikaOrigMain${t}() {`),u+=`
|
|
36
|
+
void main() {
|
|
37
|
+
${r}
|
|
38
|
+
troikaOrigMain${t}();
|
|
39
|
+
${e}
|
|
40
|
+
}`),u}function Mh(u,t){return u==="uniforms"?void 0:typeof t=="function"?t.toString():t}var kh=0,oc=new Map;function Rh(u){let t=JSON.stringify(u,Mh),o=oc.get(t);return o==null&&oc.set(t,o=++kh),o}function Ih(){return typeof window>"u"&&(self.window=self),(function(u){var t={parse:function(e){var n=t._bin,i=new Uint8Array(e);if(n.readASCII(i,0,4)=="ttcf"){var s=4;n.readUshort(i,s),s+=2,n.readUshort(i,s),s+=2;var l=n.readUint(i,s);s+=4;for(var c=[],a=0;a<l;a++){var f=n.readUint(i,s);s+=4,c.push(t._readFont(i,f))}return c}return[t._readFont(i,0)]},_readFont:function(e,n){var i=t._bin,s=n;i.readFixed(e,n),n+=4;var l=i.readUshort(e,n);n+=2,i.readUshort(e,n),n+=2,i.readUshort(e,n),n+=2,i.readUshort(e,n),n+=2;for(var c=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],a={_data:e,_offset:s},f={},h=0;h<l;h++){var d=i.readASCII(e,n,4);n+=4,i.readUint(e,n),n+=4;var g=i.readUint(e,n);n+=4;var y=i.readUint(e,n);n+=4,f[d]={offset:g,length:y}}for(h=0;h<c.length;h++){var b=c[h];f[b]&&(a[b.trim()]=t[b.trim()].parse(e,f[b].offset,f[b].length,a))}return a},_tabOffset:function(e,n,i){for(var s=t._bin,l=s.readUshort(e,i+4),c=i+12,a=0;a<l;a++){var f=s.readASCII(e,c,4);c+=4,s.readUint(e,c),c+=4;var h=s.readUint(e,c);if(c+=4,s.readUint(e,c),c+=4,f==n)return h}return 0}};t._bin={readFixed:function(e,n){return(e[n]<<8|e[n+1])+(e[n+2]<<8|e[n+3])/65540},readF2dot14:function(e,n){return t._bin.readShort(e,n)/16384},readInt:function(e,n){return t._bin._view(e).getInt32(n)},readInt8:function(e,n){return t._bin._view(e).getInt8(n)},readShort:function(e,n){return t._bin._view(e).getInt16(n)},readUshort:function(e,n){return t._bin._view(e).getUint16(n)},readUshorts:function(e,n,i){for(var s=[],l=0;l<i;l++)s.push(t._bin.readUshort(e,n+2*l));return s},readUint:function(e,n){return t._bin._view(e).getUint32(n)},readUint64:function(e,n){return 4294967296*t._bin.readUint(e,n)+t._bin.readUint(e,n+4)},readASCII:function(e,n,i){for(var s="",l=0;l<i;l++)s+=String.fromCharCode(e[n+l]);return s},readUnicode:function(e,n,i){for(var s="",l=0;l<i;l++){var c=e[n++]<<8|e[n++];s+=String.fromCharCode(c)}return s},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(e,n,i){var s=t._bin._tdec;return s&&n==0&&i==e.length?s.decode(e):t._bin.readASCII(e,n,i)},readBytes:function(e,n,i){for(var s=[],l=0;l<i;l++)s.push(e[n+l]);return s},readASCIIArray:function(e,n,i){for(var s=[],l=0;l<i;l++)s.push(String.fromCharCode(e[n+l]));return s},_view:function(e){return e._dataView||(e._dataView=e.buffer?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(new Uint8Array(e).buffer))}},t._lctf={},t._lctf.parse=function(e,n,i,s,l){var c=t._bin,a={},f=n;c.readFixed(e,n),n+=4;var h=c.readUshort(e,n);n+=2;var d=c.readUshort(e,n);n+=2;var g=c.readUshort(e,n);return n+=2,a.scriptList=t._lctf.readScriptList(e,f+h),a.featureList=t._lctf.readFeatureList(e,f+d),a.lookupList=t._lctf.readLookupList(e,f+g,l),a},t._lctf.readLookupList=function(e,n,i){var s=t._bin,l=n,c=[],a=s.readUshort(e,n);n+=2;for(var f=0;f<a;f++){var h=s.readUshort(e,n);n+=2;var d=t._lctf.readLookupTable(e,l+h,i);c.push(d)}return c},t._lctf.readLookupTable=function(e,n,i){var s=t._bin,l=n,c={tabs:[]};c.ltype=s.readUshort(e,n),n+=2,c.flag=s.readUshort(e,n),n+=2;var a=s.readUshort(e,n);n+=2;for(var f=c.ltype,h=0;h<a;h++){var d=s.readUshort(e,n);n+=2;var g=i(e,f,l+d,c);c.tabs.push(g)}return c},t._lctf.numOfOnes=function(e){for(var n=0,i=0;i<32;i++)(e>>>i&1)!=0&&n++;return n},t._lctf.readClassDef=function(e,n){var i=t._bin,s=[],l=i.readUshort(e,n);if(n+=2,l==1){var c=i.readUshort(e,n);n+=2;var a=i.readUshort(e,n);n+=2;for(var f=0;f<a;f++)s.push(c+f),s.push(c+f),s.push(i.readUshort(e,n)),n+=2}if(l==2){var h=i.readUshort(e,n);for(n+=2,f=0;f<h;f++)s.push(i.readUshort(e,n)),n+=2,s.push(i.readUshort(e,n)),n+=2,s.push(i.readUshort(e,n)),n+=2}return s},t._lctf.getInterval=function(e,n){for(var i=0;i<e.length;i+=3){var s=e[i],l=e[i+1];if(e[i+2],s<=n&&n<=l)return i}return-1},t._lctf.readCoverage=function(e,n){var i=t._bin,s={};s.fmt=i.readUshort(e,n),n+=2;var l=i.readUshort(e,n);return n+=2,s.fmt==1&&(s.tab=i.readUshorts(e,n,l)),s.fmt==2&&(s.tab=i.readUshorts(e,n,3*l)),s},t._lctf.coverageIndex=function(e,n){var i=e.tab;if(e.fmt==1)return i.indexOf(n);if(e.fmt==2){var s=t._lctf.getInterval(i,n);if(s!=-1)return i[s+2]+(n-i[s])}return-1},t._lctf.readFeatureList=function(e,n){var i=t._bin,s=n,l=[],c=i.readUshort(e,n);n+=2;for(var a=0;a<c;a++){var f=i.readASCII(e,n,4);n+=4;var h=i.readUshort(e,n);n+=2;var d=t._lctf.readFeatureTable(e,s+h);d.tag=f.trim(),l.push(d)}return l},t._lctf.readFeatureTable=function(e,n){var i=t._bin,s=n,l={},c=i.readUshort(e,n);n+=2,c>0&&(l.featureParams=s+c);var a=i.readUshort(e,n);n+=2,l.tab=[];for(var f=0;f<a;f++)l.tab.push(i.readUshort(e,n+2*f));return l},t._lctf.readScriptList=function(e,n){var i=t._bin,s=n,l={},c=i.readUshort(e,n);n+=2;for(var a=0;a<c;a++){var f=i.readASCII(e,n,4);n+=4;var h=i.readUshort(e,n);n+=2,l[f.trim()]=t._lctf.readScriptTable(e,s+h)}return l},t._lctf.readScriptTable=function(e,n){var i=t._bin,s=n,l={},c=i.readUshort(e,n);n+=2,c>0&&(l.default=t._lctf.readLangSysTable(e,s+c));var a=i.readUshort(e,n);n+=2;for(var f=0;f<a;f++){var h=i.readASCII(e,n,4);n+=4;var d=i.readUshort(e,n);n+=2,l[h.trim()]=t._lctf.readLangSysTable(e,s+d)}return l},t._lctf.readLangSysTable=function(e,n){var i=t._bin,s={};i.readUshort(e,n),n+=2,s.reqFeature=i.readUshort(e,n),n+=2;var l=i.readUshort(e,n);return n+=2,s.features=i.readUshorts(e,n,l),s},t.CFF={},t.CFF.parse=function(e,n,i){var s=t._bin;(e=new Uint8Array(e.buffer,n,i))[n=0],e[++n],e[++n],e[++n],n++;var l=[];n=t.CFF.readIndex(e,n,l);for(var c=[],a=0;a<l.length-1;a++)c.push(s.readASCII(e,n+l[a],l[a+1]-l[a]));n+=l[l.length-1];var f=[];n=t.CFF.readIndex(e,n,f);var h=[];for(a=0;a<f.length-1;a++)h.push(t.CFF.readDict(e,n+f[a],n+f[a+1]));n+=f[f.length-1];var d=h[0],g=[];n=t.CFF.readIndex(e,n,g);var y=[];for(a=0;a<g.length-1;a++)y.push(s.readASCII(e,n+g[a],g[a+1]-g[a]));if(n+=g[g.length-1],t.CFF.readSubrs(e,n,d),d.CharStrings){n=d.CharStrings,g=[],n=t.CFF.readIndex(e,n,g);var b=[];for(a=0;a<g.length-1;a++)b.push(s.readBytes(e,n+g[a],g[a+1]-g[a]));d.CharStrings=b}if(d.ROS){n=d.FDArray;var v=[];for(n=t.CFF.readIndex(e,n,v),d.FDArray=[],a=0;a<v.length-1;a++){var w=t.CFF.readDict(e,n+v[a],n+v[a+1]);t.CFF._readFDict(e,w,y),d.FDArray.push(w)}n+=v[v.length-1],n=d.FDSelect,d.FDSelect=[];var T=e[n];if(n++,T!=3)throw T;var x=s.readUshort(e,n);for(n+=2,a=0;a<x+1;a++)d.FDSelect.push(s.readUshort(e,n),e[n+2]),n+=3}return d.Encoding&&(d.Encoding=t.CFF.readEncoding(e,d.Encoding,d.CharStrings.length)),d.charset&&(d.charset=t.CFF.readCharset(e,d.charset,d.CharStrings.length)),t.CFF._readFDict(e,d,y),d},t.CFF._readFDict=function(e,n,i){var s;for(var l in n.Private&&(s=n.Private[1],n.Private=t.CFF.readDict(e,s,s+n.Private[0]),n.Private.Subrs&&t.CFF.readSubrs(e,s+n.Private.Subrs,n.Private)),n)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(l)!=-1&&(n[l]=i[n[l]-426+35])},t.CFF.readSubrs=function(e,n,i){var s=t._bin,l=[];n=t.CFF.readIndex(e,n,l);var c,a=l.length;c=a<1240?107:a<33900?1131:32768,i.Bias=c,i.Subrs=[];for(var f=0;f<l.length-1;f++)i.Subrs.push(s.readBytes(e,n+l[f],l[f+1]-l[f]))},t.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],t.CFF.glyphByUnicode=function(e,n){for(var i=0;i<e.charset.length;i++)if(e.charset[i]==n)return i;return-1},t.CFF.glyphBySE=function(e,n){return n<0||n>255?-1:t.CFF.glyphByUnicode(e,t.CFF.tableSE[n])},t.CFF.readEncoding=function(e,n,i){t._bin;var s=[".notdef"],l=e[n];if(n++,l!=0)throw"error: unknown encoding format: "+l;var c=e[n];n++;for(var a=0;a<c;a++)s.push(e[n+a]);return s},t.CFF.readCharset=function(e,n,i){var s=t._bin,l=[".notdef"],c=e[n];if(n++,c==0)for(var a=0;a<i;a++){var f=s.readUshort(e,n);n+=2,l.push(f)}else{if(c!=1&&c!=2)throw"error: format: "+c;for(;l.length<i;){f=s.readUshort(e,n),n+=2;var h=0;for(c==1?(h=e[n],n++):(h=s.readUshort(e,n),n+=2),a=0;a<=h;a++)l.push(f),f++}}return l},t.CFF.readIndex=function(e,n,i){var s=t._bin,l=s.readUshort(e,n)+1,c=e[n+=2];if(n++,c==1)for(var a=0;a<l;a++)i.push(e[n+a]);else if(c==2)for(a=0;a<l;a++)i.push(s.readUshort(e,n+2*a));else if(c==3)for(a=0;a<l;a++)i.push(16777215&s.readUint(e,n+3*a-1));else if(l!=1)throw"unsupported offset size: "+c+", count: "+l;return(n+=l*c)-1},t.CFF.getCharString=function(e,n,i){var s=t._bin,l=e[n],c=e[n+1];e[n+2],e[n+3],e[n+4];var a=1,f=null,h=null;l<=20&&(f=l,a=1),l==12&&(f=100*l+c,a=2),21<=l&&l<=27&&(f=l,a=1),l==28&&(h=s.readShort(e,n+1),a=3),29<=l&&l<=31&&(f=l,a=1),32<=l&&l<=246&&(h=l-139,a=1),247<=l&&l<=250&&(h=256*(l-247)+c+108,a=2),251<=l&&l<=254&&(h=256*-(l-251)-c-108,a=2),l==255&&(h=s.readInt(e,n+1)/65535,a=5),i.val=h??"o"+f,i.size=a},t.CFF.readCharString=function(e,n,i){for(var s=n+i,l=t._bin,c=[];n<s;){var a=e[n],f=e[n+1];e[n+2],e[n+3],e[n+4];var h=1,d=null,g=null;a<=20&&(d=a,h=1),a==12&&(d=100*a+f,h=2),a!=19&&a!=20||(d=a,h=2),21<=a&&a<=27&&(d=a,h=1),a==28&&(g=l.readShort(e,n+1),h=3),29<=a&&a<=31&&(d=a,h=1),32<=a&&a<=246&&(g=a-139,h=1),247<=a&&a<=250&&(g=256*(a-247)+f+108,h=2),251<=a&&a<=254&&(g=256*-(a-251)-f-108,h=2),a==255&&(g=l.readInt(e,n+1)/65535,h=5),c.push(g??"o"+d),n+=h}return c},t.CFF.readDict=function(e,n,i){for(var s=t._bin,l={},c=[];n<i;){var a=e[n],f=e[n+1];e[n+2],e[n+3],e[n+4];var h=1,d=null,g=null;if(a==28&&(g=s.readShort(e,n+1),h=3),a==29&&(g=s.readInt(e,n+1),h=5),32<=a&&a<=246&&(g=a-139,h=1),247<=a&&a<=250&&(g=256*(a-247)+f+108,h=2),251<=a&&a<=254&&(g=256*-(a-251)-f-108,h=2),a==255)throw g=s.readInt(e,n+1)/65535,h=5,"unknown number";if(a==30){var y=[];for(h=1;;){var b=e[n+h];h++;var v=b>>4,w=15&b;if(v!=15&&y.push(v),w!=15&&y.push(w),w==15)break}for(var T="",x=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],E=0;E<y.length;E++)T+=x[y[E]];g=parseFloat(T)}a<=21&&(d=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][a],h=1,a==12&&(d=["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],h=2)),d!=null?(l[d]=c.length==1?c[0]:c,c=[]):c.push(g),n+=h}return l},t.cmap={},t.cmap.parse=function(e,n,i){e=new Uint8Array(e.buffer,n,i),n=0;var s=t._bin,l={};s.readUshort(e,n),n+=2;var c=s.readUshort(e,n);n+=2;var a=[];l.tables=[];for(var f=0;f<c;f++){var h=s.readUshort(e,n);n+=2;var d=s.readUshort(e,n);n+=2;var g=s.readUint(e,n);n+=4;var y="p"+h+"e"+d,b=a.indexOf(g);if(b==-1){var v;b=l.tables.length,a.push(g);var w=s.readUshort(e,g);w==0?v=t.cmap.parse0(e,g):w==4?v=t.cmap.parse4(e,g):w==6?v=t.cmap.parse6(e,g):w==12?v=t.cmap.parse12(e,g):console.debug("unknown format: "+w,h,d,g),l.tables.push(v)}if(l[y]!=null)throw"multiple tables for one platform+encoding";l[y]=b}return l},t.cmap.parse0=function(e,n){var i=t._bin,s={};s.format=i.readUshort(e,n),n+=2;var l=i.readUshort(e,n);n+=2,i.readUshort(e,n),n+=2,s.map=[];for(var c=0;c<l-6;c++)s.map.push(e[n+c]);return s},t.cmap.parse4=function(e,n){var i=t._bin,s=n,l={};l.format=i.readUshort(e,n),n+=2;var c=i.readUshort(e,n);n+=2,i.readUshort(e,n),n+=2;var a=i.readUshort(e,n);n+=2;var f=a/2;l.searchRange=i.readUshort(e,n),n+=2,l.entrySelector=i.readUshort(e,n),n+=2,l.rangeShift=i.readUshort(e,n),n+=2,l.endCount=i.readUshorts(e,n,f),n+=2*f,n+=2,l.startCount=i.readUshorts(e,n,f),n+=2*f,l.idDelta=[];for(var h=0;h<f;h++)l.idDelta.push(i.readShort(e,n)),n+=2;for(l.idRangeOffset=i.readUshorts(e,n,f),n+=2*f,l.glyphIdArray=[];n<s+c;)l.glyphIdArray.push(i.readUshort(e,n)),n+=2;return l},t.cmap.parse6=function(e,n){var i=t._bin,s={};s.format=i.readUshort(e,n),n+=2,i.readUshort(e,n),n+=2,i.readUshort(e,n),n+=2,s.firstCode=i.readUshort(e,n),n+=2;var l=i.readUshort(e,n);n+=2,s.glyphIdArray=[];for(var c=0;c<l;c++)s.glyphIdArray.push(i.readUshort(e,n)),n+=2;return s},t.cmap.parse12=function(e,n){var i=t._bin,s={};s.format=i.readUshort(e,n),n+=2,n+=2,i.readUint(e,n),n+=4,i.readUint(e,n),n+=4;var l=i.readUint(e,n);n+=4,s.groups=[];for(var c=0;c<l;c++){var a=n+12*c,f=i.readUint(e,a+0),h=i.readUint(e,a+4),d=i.readUint(e,a+8);s.groups.push([f,h,d])}return s},t.glyf={},t.glyf.parse=function(e,n,i,s){for(var l=[],c=0;c<s.maxp.numGlyphs;c++)l.push(null);return l},t.glyf._parseGlyf=function(e,n){var i=t._bin,s=e._data,l=t._tabOffset(s,"glyf",e._offset)+e.loca[n];if(e.loca[n]==e.loca[n+1])return null;var c={};if(c.noc=i.readShort(s,l),l+=2,c.xMin=i.readShort(s,l),l+=2,c.yMin=i.readShort(s,l),l+=2,c.xMax=i.readShort(s,l),l+=2,c.yMax=i.readShort(s,l),l+=2,c.xMin>=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var a=0;a<c.noc;a++)c.endPts.push(i.readUshort(s,l)),l+=2;var f=i.readUshort(s,l);if(l+=2,s.length-l<f)return null;c.instructions=i.readBytes(s,l,f),l+=f;var h=c.endPts[c.noc-1]+1;for(c.flags=[],a=0;a<h;a++){var d=s[l];if(l++,c.flags.push(d),(8&d)!=0){var g=s[l];l++;for(var y=0;y<g;y++)c.flags.push(d),a++}}for(c.xs=[],a=0;a<h;a++){var b=(2&c.flags[a])!=0,v=(16&c.flags[a])!=0;b?(c.xs.push(v?s[l]:-s[l]),l++):v?c.xs.push(0):(c.xs.push(i.readShort(s,l)),l+=2)}for(c.ys=[],a=0;a<h;a++)b=(4&c.flags[a])!=0,v=(32&c.flags[a])!=0,b?(c.ys.push(v?s[l]:-s[l]),l++):v?c.ys.push(0):(c.ys.push(i.readShort(s,l)),l+=2);var w=0,T=0;for(a=0;a<h;a++)w+=c.xs[a],T+=c.ys[a],c.xs[a]=w,c.ys[a]=T}else{var x;c.parts=[];do{x=i.readUshort(s,l),l+=2;var E={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(E),E.glyphIndex=i.readUshort(s,l),l+=2,1&x){var O=i.readShort(s,l);l+=2;var A=i.readShort(s,l);l+=2}else O=i.readInt8(s,l),l++,A=i.readInt8(s,l),l++;2&x?(E.m.tx=O,E.m.ty=A):(E.p1=O,E.p2=A),8&x?(E.m.a=E.m.d=i.readF2dot14(s,l),l+=2):64&x?(E.m.a=i.readF2dot14(s,l),l+=2,E.m.d=i.readF2dot14(s,l),l+=2):128&x&&(E.m.a=i.readF2dot14(s,l),l+=2,E.m.b=i.readF2dot14(s,l),l+=2,E.m.c=i.readF2dot14(s,l),l+=2,E.m.d=i.readF2dot14(s,l),l+=2)}while(32&x);if(256&x){var k=i.readUshort(s,l);for(l+=2,c.instr=[],a=0;a<k;a++)c.instr.push(s[l]),l++}}return c},t.GDEF={},t.GDEF.parse=function(e,n,i,s){var l=n;n+=4;var c=t._bin.readUshort(e,n);return{glyphClassDef:c===0?null:t._lctf.readClassDef(e,l+c)}},t.GPOS={},t.GPOS.parse=function(e,n,i,s){return t._lctf.parse(e,n,i,s,t.GPOS.subt)},t.GPOS.subt=function(e,n,i,s){var l=t._bin,c=i,a={};if(a.fmt=l.readUshort(e,i),i+=2,n==1||n==2||n==3||n==7||n==8&&a.fmt<=2){var f=l.readUshort(e,i);i+=2,a.coverage=t._lctf.readCoverage(e,f+c)}if(n==1&&a.fmt==1){var h=l.readUshort(e,i);i+=2,h!=0&&(a.pos=t.GPOS.readValueRecord(e,i,h))}else if(n==2&&a.fmt>=1&&a.fmt<=2){h=l.readUshort(e,i),i+=2;var d=l.readUshort(e,i);i+=2;var g=t._lctf.numOfOnes(h),y=t._lctf.numOfOnes(d);if(a.fmt==1){a.pairsets=[];var b=l.readUshort(e,i);i+=2;for(var v=0;v<b;v++){var w=c+l.readUshort(e,i);i+=2;var T=l.readUshort(e,w);w+=2;for(var x=[],E=0;E<T;E++){var O=l.readUshort(e,w);w+=2,h!=0&&(C=t.GPOS.readValueRecord(e,w,h),w+=2*g),d!=0&&(S=t.GPOS.readValueRecord(e,w,d),w+=2*y),x.push({gid2:O,val1:C,val2:S})}a.pairsets.push(x)}}if(a.fmt==2){var A=l.readUshort(e,i);i+=2;var k=l.readUshort(e,i);i+=2;var M=l.readUshort(e,i);i+=2;var F=l.readUshort(e,i);for(i+=2,a.classDef1=t._lctf.readClassDef(e,c+A),a.classDef2=t._lctf.readClassDef(e,c+k),a.matrix=[],v=0;v<M;v++){var I=[];for(E=0;E<F;E++){var C=null,S=null;h!=0&&(C=t.GPOS.readValueRecord(e,i,h),i+=2*g),d!=0&&(S=t.GPOS.readValueRecord(e,i,d),i+=2*y),I.push({val1:C,val2:S})}a.matrix.push(I)}}}else if(n==4&&a.fmt==1)a.markCoverage=t._lctf.readCoverage(e,l.readUshort(e,i)+c),a.baseCoverage=t._lctf.readCoverage(e,l.readUshort(e,i+2)+c),a.markClassCount=l.readUshort(e,i+4),a.markArray=t.GPOS.readMarkArray(e,l.readUshort(e,i+6)+c),a.baseArray=t.GPOS.readBaseArray(e,l.readUshort(e,i+8)+c,a.markClassCount);else if(n==6&&a.fmt==1)a.mark1Coverage=t._lctf.readCoverage(e,l.readUshort(e,i)+c),a.mark2Coverage=t._lctf.readCoverage(e,l.readUshort(e,i+2)+c),a.markClassCount=l.readUshort(e,i+4),a.mark1Array=t.GPOS.readMarkArray(e,l.readUshort(e,i+6)+c),a.mark2Array=t.GPOS.readBaseArray(e,l.readUshort(e,i+8)+c,a.markClassCount);else{if(n==9&&a.fmt==1){var m=l.readUshort(e,i);i+=2;var L=l.readUint(e,i);if(i+=4,s.ltype==9)s.ltype=m;else if(s.ltype!=m)throw"invalid extension substitution";return t.GPOS.subt(e,s.ltype,c+L)}console.debug("unsupported GPOS table LookupType",n,"format",a.fmt)}return a},t.GPOS.readValueRecord=function(e,n,i){var s=t._bin,l=[];return l.push(1&i?s.readShort(e,n):0),n+=1&i?2:0,l.push(2&i?s.readShort(e,n):0),n+=2&i?2:0,l.push(4&i?s.readShort(e,n):0),n+=4&i?2:0,l.push(8&i?s.readShort(e,n):0),n+=8&i?2:0,l},t.GPOS.readBaseArray=function(e,n,i){var s=t._bin,l=[],c=n,a=s.readUshort(e,n);n+=2;for(var f=0;f<a;f++){for(var h=[],d=0;d<i;d++)h.push(t.GPOS.readAnchorRecord(e,c+s.readUshort(e,n))),n+=2;l.push(h)}return l},t.GPOS.readMarkArray=function(e,n){var i=t._bin,s=[],l=n,c=i.readUshort(e,n);n+=2;for(var a=0;a<c;a++){var f=t.GPOS.readAnchorRecord(e,i.readUshort(e,n+2)+l);f.markClass=i.readUshort(e,n),s.push(f),n+=4}return s},t.GPOS.readAnchorRecord=function(e,n){var i=t._bin,s={};return s.fmt=i.readUshort(e,n),s.x=i.readShort(e,n+2),s.y=i.readShort(e,n+4),s},t.GSUB={},t.GSUB.parse=function(e,n,i,s){return t._lctf.parse(e,n,i,s,t.GSUB.subt)},t.GSUB.subt=function(e,n,i,s){var l=t._bin,c=i,a={};if(a.fmt=l.readUshort(e,i),i+=2,n!=1&&n!=2&&n!=4&&n!=5&&n!=6)return null;if(n==1||n==2||n==4||n==5&&a.fmt<=2||n==6&&a.fmt<=2){var f=l.readUshort(e,i);i+=2,a.coverage=t._lctf.readCoverage(e,c+f)}if(n==1&&a.fmt>=1&&a.fmt<=2){if(a.fmt==1)a.delta=l.readShort(e,i),i+=2;else if(a.fmt==2){var h=l.readUshort(e,i);i+=2,a.newg=l.readUshorts(e,i,h),i+=2*a.newg.length}}else if(n==2&&a.fmt==1){h=l.readUshort(e,i),i+=2,a.seqs=[];for(var d=0;d<h;d++){var g=l.readUshort(e,i)+c;i+=2;var y=l.readUshort(e,g);a.seqs.push(l.readUshorts(e,g+2,y))}}else if(n==4)for(a.vals=[],h=l.readUshort(e,i),i+=2,d=0;d<h;d++){var b=l.readUshort(e,i);i+=2,a.vals.push(t.GSUB.readLigatureSet(e,c+b))}else if(n==5&&a.fmt==2){if(a.fmt==2){var v=l.readUshort(e,i);i+=2,a.cDef=t._lctf.readClassDef(e,c+v),a.scset=[];var w=l.readUshort(e,i);for(i+=2,d=0;d<w;d++){var T=l.readUshort(e,i);i+=2,a.scset.push(T==0?null:t.GSUB.readSubClassSet(e,c+T))}}}else if(n==6&&a.fmt==3){if(a.fmt==3){for(d=0;d<3;d++){h=l.readUshort(e,i),i+=2;for(var x=[],E=0;E<h;E++)x.push(t._lctf.readCoverage(e,c+l.readUshort(e,i+2*E)));i+=2*h,d==0&&(a.backCvg=x),d==1&&(a.inptCvg=x),d==2&&(a.ahedCvg=x)}h=l.readUshort(e,i),i+=2,a.lookupRec=t.GSUB.readSubstLookupRecords(e,i,h)}}else{if(n==7&&a.fmt==1){var O=l.readUshort(e,i);i+=2;var A=l.readUint(e,i);if(i+=4,s.ltype==9)s.ltype=O;else if(s.ltype!=O)throw"invalid extension substitution";return t.GSUB.subt(e,s.ltype,c+A)}console.debug("unsupported GSUB table LookupType",n,"format",a.fmt)}return a},t.GSUB.readSubClassSet=function(e,n){var i=t._bin.readUshort,s=n,l=[],c=i(e,n);n+=2;for(var a=0;a<c;a++){var f=i(e,n);n+=2,l.push(t.GSUB.readSubClassRule(e,s+f))}return l},t.GSUB.readSubClassRule=function(e,n){var i=t._bin.readUshort,s={},l=i(e,n),c=i(e,n+=2);n+=2,s.input=[];for(var a=0;a<l-1;a++)s.input.push(i(e,n)),n+=2;return s.substLookupRecords=t.GSUB.readSubstLookupRecords(e,n,c),s},t.GSUB.readSubstLookupRecords=function(e,n,i){for(var s=t._bin.readUshort,l=[],c=0;c<i;c++)l.push(s(e,n),s(e,n+2)),n+=4;return l},t.GSUB.readChainSubClassSet=function(e,n){var i=t._bin,s=n,l=[],c=i.readUshort(e,n);n+=2;for(var a=0;a<c;a++){var f=i.readUshort(e,n);n+=2,l.push(t.GSUB.readChainSubClassRule(e,s+f))}return l},t.GSUB.readChainSubClassRule=function(e,n){for(var i=t._bin,s={},l=["backtrack","input","lookahead"],c=0;c<l.length;c++){var a=i.readUshort(e,n);n+=2,c==1&&a--,s[l[c]]=i.readUshorts(e,n,a),n+=2*s[l[c]].length}return a=i.readUshort(e,n),n+=2,s.subst=i.readUshorts(e,n,2*a),n+=2*s.subst.length,s},t.GSUB.readLigatureSet=function(e,n){var i=t._bin,s=n,l=[],c=i.readUshort(e,n);n+=2;for(var a=0;a<c;a++){var f=i.readUshort(e,n);n+=2,l.push(t.GSUB.readLigature(e,s+f))}return l},t.GSUB.readLigature=function(e,n){var i=t._bin,s={chain:[]};s.nglyph=i.readUshort(e,n),n+=2;var l=i.readUshort(e,n);n+=2;for(var c=0;c<l-1;c++)s.chain.push(i.readUshort(e,n)),n+=2;return s},t.head={},t.head.parse=function(e,n,i){var s=t._bin,l={};return s.readFixed(e,n),n+=4,l.fontRevision=s.readFixed(e,n),n+=4,s.readUint(e,n),n+=4,s.readUint(e,n),n+=4,l.flags=s.readUshort(e,n),n+=2,l.unitsPerEm=s.readUshort(e,n),n+=2,l.created=s.readUint64(e,n),n+=8,l.modified=s.readUint64(e,n),n+=8,l.xMin=s.readShort(e,n),n+=2,l.yMin=s.readShort(e,n),n+=2,l.xMax=s.readShort(e,n),n+=2,l.yMax=s.readShort(e,n),n+=2,l.macStyle=s.readUshort(e,n),n+=2,l.lowestRecPPEM=s.readUshort(e,n),n+=2,l.fontDirectionHint=s.readShort(e,n),n+=2,l.indexToLocFormat=s.readShort(e,n),n+=2,l.glyphDataFormat=s.readShort(e,n),n+=2,l},t.hhea={},t.hhea.parse=function(e,n,i){var s=t._bin,l={};return s.readFixed(e,n),n+=4,l.ascender=s.readShort(e,n),n+=2,l.descender=s.readShort(e,n),n+=2,l.lineGap=s.readShort(e,n),n+=2,l.advanceWidthMax=s.readUshort(e,n),n+=2,l.minLeftSideBearing=s.readShort(e,n),n+=2,l.minRightSideBearing=s.readShort(e,n),n+=2,l.xMaxExtent=s.readShort(e,n),n+=2,l.caretSlopeRise=s.readShort(e,n),n+=2,l.caretSlopeRun=s.readShort(e,n),n+=2,l.caretOffset=s.readShort(e,n),n+=2,n+=8,l.metricDataFormat=s.readShort(e,n),n+=2,l.numberOfHMetrics=s.readUshort(e,n),n+=2,l},t.hmtx={},t.hmtx.parse=function(e,n,i,s){for(var l=t._bin,c={aWidth:[],lsBearing:[]},a=0,f=0,h=0;h<s.maxp.numGlyphs;h++)h<s.hhea.numberOfHMetrics&&(a=l.readUshort(e,n),n+=2,f=l.readShort(e,n),n+=2),c.aWidth.push(a),c.lsBearing.push(f);return c},t.kern={},t.kern.parse=function(e,n,i,s){var l=t._bin,c=l.readUshort(e,n);if(n+=2,c==1)return t.kern.parseV1(e,n-2,i,s);var a=l.readUshort(e,n);n+=2;for(var f={glyph1:[],rval:[]},h=0;h<a;h++){n+=2,i=l.readUshort(e,n),n+=2;var d=l.readUshort(e,n);n+=2;var g=d>>>8;if((g&=15)!=0)throw"unknown kern table format: "+g;n=t.kern.readFormat0(e,n,f)}return f},t.kern.parseV1=function(e,n,i,s){var l=t._bin;l.readFixed(e,n),n+=4;var c=l.readUint(e,n);n+=4;for(var a={glyph1:[],rval:[]},f=0;f<c;f++){l.readUint(e,n),n+=4;var h=l.readUshort(e,n);n+=2,l.readUshort(e,n),n+=2;var d=h>>>8;if((d&=15)!=0)throw"unknown kern table format: "+d;n=t.kern.readFormat0(e,n,a)}return a},t.kern.readFormat0=function(e,n,i){var s=t._bin,l=-1,c=s.readUshort(e,n);n+=2,s.readUshort(e,n),n+=2,s.readUshort(e,n),n+=2,s.readUshort(e,n),n+=2;for(var a=0;a<c;a++){var f=s.readUshort(e,n);n+=2;var h=s.readUshort(e,n);n+=2;var d=s.readShort(e,n);n+=2,f!=l&&(i.glyph1.push(f),i.rval.push({glyph2:[],vals:[]}));var g=i.rval[i.rval.length-1];g.glyph2.push(h),g.vals.push(d),l=f}return n},t.loca={},t.loca.parse=function(e,n,i,s){var l=t._bin,c=[],a=s.head.indexToLocFormat,f=s.maxp.numGlyphs+1;if(a==0)for(var h=0;h<f;h++)c.push(l.readUshort(e,n+(h<<1))<<1);if(a==1)for(h=0;h<f;h++)c.push(l.readUint(e,n+(h<<2)));return c},t.maxp={},t.maxp.parse=function(e,n,i){var s=t._bin,l={},c=s.readUint(e,n);return n+=4,l.numGlyphs=s.readUshort(e,n),n+=2,c==65536&&(l.maxPoints=s.readUshort(e,n),n+=2,l.maxContours=s.readUshort(e,n),n+=2,l.maxCompositePoints=s.readUshort(e,n),n+=2,l.maxCompositeContours=s.readUshort(e,n),n+=2,l.maxZones=s.readUshort(e,n),n+=2,l.maxTwilightPoints=s.readUshort(e,n),n+=2,l.maxStorage=s.readUshort(e,n),n+=2,l.maxFunctionDefs=s.readUshort(e,n),n+=2,l.maxInstructionDefs=s.readUshort(e,n),n+=2,l.maxStackElements=s.readUshort(e,n),n+=2,l.maxSizeOfInstructions=s.readUshort(e,n),n+=2,l.maxComponentElements=s.readUshort(e,n),n+=2,l.maxComponentDepth=s.readUshort(e,n),n+=2),l},t.name={},t.name.parse=function(e,n,i){var s=t._bin,l={};s.readUshort(e,n),n+=2;var c=s.readUshort(e,n);n+=2,s.readUshort(e,n);for(var a,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"],h=n+=2,d=0;d<c;d++){var g=s.readUshort(e,n);n+=2;var y=s.readUshort(e,n);n+=2;var b=s.readUshort(e,n);n+=2;var v=s.readUshort(e,n);n+=2;var w=s.readUshort(e,n);n+=2;var T=s.readUshort(e,n);n+=2;var x,E=f[v],O=h+12*c+T;if(g==0)x=s.readUnicode(e,O,w/2);else if(g==3&&y==0)x=s.readUnicode(e,O,w/2);else if(y==0)x=s.readASCII(e,O,w);else if(y==1)x=s.readUnicode(e,O,w/2);else if(y==3)x=s.readUnicode(e,O,w/2);else{if(g!=1)throw"unknown encoding "+y+", platformID: "+g;x=s.readASCII(e,O,w),console.debug("reading unknown MAC encoding "+y+" as ASCII")}var A="p"+g+","+b.toString(16);l[A]==null&&(l[A]={}),l[A][E!==void 0?E:v]=x,l[A]._lang=b}for(var k in l)if(l[k].postScriptName!=null&&l[k]._lang==1033)return l[k];for(var k in l)if(l[k].postScriptName!=null&&l[k]._lang==0)return l[k];for(var k in l)if(l[k].postScriptName!=null&&l[k]._lang==3084)return l[k];for(var k in l)if(l[k].postScriptName!=null)return l[k];for(var k in l){a=k;break}return console.debug("returning name table with languageID "+l[a]._lang),l[a]},t["OS/2"]={},t["OS/2"].parse=function(e,n,i){var s=t._bin.readUshort(e,n);n+=2;var l={};if(s==0)t["OS/2"].version0(e,n,l);else if(s==1)t["OS/2"].version1(e,n,l);else if(s==2||s==3||s==4)t["OS/2"].version2(e,n,l);else{if(s!=5)throw"unknown OS/2 table version: "+s;t["OS/2"].version5(e,n,l)}return l},t["OS/2"].version0=function(e,n,i){var s=t._bin;return i.xAvgCharWidth=s.readShort(e,n),n+=2,i.usWeightClass=s.readUshort(e,n),n+=2,i.usWidthClass=s.readUshort(e,n),n+=2,i.fsType=s.readUshort(e,n),n+=2,i.ySubscriptXSize=s.readShort(e,n),n+=2,i.ySubscriptYSize=s.readShort(e,n),n+=2,i.ySubscriptXOffset=s.readShort(e,n),n+=2,i.ySubscriptYOffset=s.readShort(e,n),n+=2,i.ySuperscriptXSize=s.readShort(e,n),n+=2,i.ySuperscriptYSize=s.readShort(e,n),n+=2,i.ySuperscriptXOffset=s.readShort(e,n),n+=2,i.ySuperscriptYOffset=s.readShort(e,n),n+=2,i.yStrikeoutSize=s.readShort(e,n),n+=2,i.yStrikeoutPosition=s.readShort(e,n),n+=2,i.sFamilyClass=s.readShort(e,n),n+=2,i.panose=s.readBytes(e,n,10),n+=10,i.ulUnicodeRange1=s.readUint(e,n),n+=4,i.ulUnicodeRange2=s.readUint(e,n),n+=4,i.ulUnicodeRange3=s.readUint(e,n),n+=4,i.ulUnicodeRange4=s.readUint(e,n),n+=4,i.achVendID=[s.readInt8(e,n),s.readInt8(e,n+1),s.readInt8(e,n+2),s.readInt8(e,n+3)],n+=4,i.fsSelection=s.readUshort(e,n),n+=2,i.usFirstCharIndex=s.readUshort(e,n),n+=2,i.usLastCharIndex=s.readUshort(e,n),n+=2,i.sTypoAscender=s.readShort(e,n),n+=2,i.sTypoDescender=s.readShort(e,n),n+=2,i.sTypoLineGap=s.readShort(e,n),n+=2,i.usWinAscent=s.readUshort(e,n),n+=2,i.usWinDescent=s.readUshort(e,n),n+=2},t["OS/2"].version1=function(e,n,i){var s=t._bin;return n=t["OS/2"].version0(e,n,i),i.ulCodePageRange1=s.readUint(e,n),n+=4,i.ulCodePageRange2=s.readUint(e,n),n+=4},t["OS/2"].version2=function(e,n,i){var s=t._bin;return n=t["OS/2"].version1(e,n,i),i.sxHeight=s.readShort(e,n),n+=2,i.sCapHeight=s.readShort(e,n),n+=2,i.usDefault=s.readUshort(e,n),n+=2,i.usBreak=s.readUshort(e,n),n+=2,i.usMaxContext=s.readUshort(e,n),n+=2},t["OS/2"].version5=function(e,n,i){var s=t._bin;return n=t["OS/2"].version2(e,n,i),i.usLowerOpticalPointSize=s.readUshort(e,n),n+=2,i.usUpperOpticalPointSize=s.readUshort(e,n),n+=2},t.post={},t.post.parse=function(e,n,i){var s=t._bin,l={};return l.version=s.readFixed(e,n),n+=4,l.italicAngle=s.readFixed(e,n),n+=4,l.underlinePosition=s.readShort(e,n),n+=2,l.underlineThickness=s.readShort(e,n),n+=2,l},t==null&&(t={}),t.U==null&&(t.U={}),t.U.codeToGlyph=function(e,n){var i=e.cmap,s=-1;if(i.p0e4!=null?s=i.p0e4:i.p3e1!=null?s=i.p3e1:i.p1e0!=null?s=i.p1e0:i.p0e3!=null&&(s=i.p0e3),s==-1)throw"no familiar platform and encoding!";var l=i.tables[s];if(l.format==0)return n>=l.map.length?0:l.map[n];if(l.format==4){for(var c=-1,a=0;a<l.endCount.length;a++)if(n<=l.endCount[a]){c=a;break}return c==-1||l.startCount[c]>n?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[n-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:n+l.idDelta[c])}if(l.format==12){if(n>l.groups[l.groups.length-1][1])return 0;for(a=0;a<l.groups.length;a++){var f=l.groups[a];if(f[0]<=n&&n<=f[1])return f[2]+(n-f[0])}return 0}throw"unknown cmap table format "+l.format},t.U.glyphToPath=function(e,n){var i={cmds:[],crds:[]};if(e.SVG&&e.SVG.entries[n]){var s=e.SVG.entries[n];return s==null?i:(typeof s=="string"&&(s=t.SVG.toPath(s),e.SVG.entries[n]=s),s)}if(e.CFF){var l={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:e.CFF.Private?e.CFF.Private.defaultWidthX:0,open:!1},c=e.CFF,a=e.CFF.Private;if(c.ROS){for(var f=0;c.FDSelect[f+2]<=n;)f+=2;a=c.FDArray[c.FDSelect[f+1]].Private}t.U._drawCFF(e.CFF.CharStrings[n],l,c,a,i)}else e.glyf&&t.U._drawGlyf(n,e,i);return i},t.U._drawGlyf=function(e,n,i){var s=n.glyf[e];s==null&&(s=n.glyf[e]=t.glyf._parseGlyf(n,e)),s!=null&&(s.noc>-1?t.U._simpleGlyph(s,i):t.U._compoGlyph(s,n,i))},t.U._simpleGlyph=function(e,n){for(var i=0;i<e.noc;i++){for(var s=i==0?0:e.endPts[i-1]+1,l=e.endPts[i],c=s;c<=l;c++){var a=c==s?l:c-1,f=c==l?s:c+1,h=1&e.flags[c],d=1&e.flags[a],g=1&e.flags[f],y=e.xs[c],b=e.ys[c];if(c==s)if(h){if(!d){t.U.P.moveTo(n,y,b);continue}t.U.P.moveTo(n,e.xs[a],e.ys[a])}else d?t.U.P.moveTo(n,e.xs[a],e.ys[a]):t.U.P.moveTo(n,(e.xs[a]+y)/2,(e.ys[a]+b)/2);h?d&&t.U.P.lineTo(n,y,b):g?t.U.P.qcurveTo(n,y,b,e.xs[f],e.ys[f]):t.U.P.qcurveTo(n,y,b,(y+e.xs[f])/2,(b+e.ys[f])/2)}t.U.P.closePath(n)}},t.U._compoGlyph=function(e,n,i){for(var s=0;s<e.parts.length;s++){var l={cmds:[],crds:[]},c=e.parts[s];t.U._drawGlyf(c.glyphIndex,n,l);for(var a=c.m,f=0;f<l.crds.length;f+=2){var h=l.crds[f],d=l.crds[f+1];i.crds.push(h*a.a+d*a.b+a.tx),i.crds.push(h*a.c+d*a.d+a.ty)}for(f=0;f<l.cmds.length;f++)i.cmds.push(l.cmds[f])}},t.U._getGlyphClass=function(e,n){var i=t._lctf.getInterval(n,e);return i==-1?0:n[i+2]},t.U._applySubs=function(e,n,i,s){for(var l=e.length-n-1,c=0;c<i.tabs.length;c++)if(i.tabs[c]!=null){var a,f=i.tabs[c];if(!f.coverage||(a=t._lctf.coverageIndex(f.coverage,e[n]))!=-1){if(i.ltype==1)e[n],f.fmt==1?e[n]=e[n]+f.delta:e[n]=f.newg[a];else if(i.ltype==4)for(var h=f.vals[a],d=0;d<h.length;d++){var g=h[d],y=g.chain.length;if(!(y>l)){for(var b=!0,v=0,w=0;w<y;w++){for(;e[n+v+(1+w)]==-1;)v++;g.chain[w]!=e[n+v+(1+w)]&&(b=!1)}if(b){for(e[n]=g.nglyph,w=0;w<y+v;w++)e[n+w+1]=-1;break}}}else if(i.ltype==5&&f.fmt==2)for(var T=t._lctf.getInterval(f.cDef,e[n]),x=f.cDef[T+2],E=f.scset[x],O=0;O<E.length;O++){var A=E[O],k=A.input;if(!(k.length>l)){for(b=!0,w=0;w<k.length;w++){var M=t._lctf.getInterval(f.cDef,e[n+1+w]);if(T==-1&&f.cDef[M+2]!=k[w]){b=!1;break}}if(b){var F=A.substLookupRecords;for(d=0;d<F.length;d+=2)F[d],F[d+1]}}}else if(i.ltype==6&&f.fmt==3){if(!t.U._glsCovered(e,f.backCvg,n-f.backCvg.length)||!t.U._glsCovered(e,f.inptCvg,n)||!t.U._glsCovered(e,f.ahedCvg,n+f.inptCvg.length))continue;var I=f.lookupRec;for(O=0;O<I.length;O+=2){T=I[O];var C=s[I[O+1]];t.U._applySubs(e,n+T,C,s)}}}}},t.U._glsCovered=function(e,n,i){for(var s=0;s<n.length;s++)if(t._lctf.coverageIndex(n[s],e[i+s])==-1)return!1;return!0},t.U.glyphsToPath=function(e,n,i){for(var s={cmds:[],crds:[]},l=0,c=0;c<n.length;c++){var a=n[c];if(a!=-1){for(var f=c<n.length-1&&n[c+1]!=-1?n[c+1]:0,h=t.U.glyphToPath(e,a),d=0;d<h.crds.length;d+=2)s.crds.push(h.crds[d]+l),s.crds.push(h.crds[d+1]);for(i&&s.cmds.push(i),d=0;d<h.cmds.length;d++)s.cmds.push(h.cmds[d]);i&&s.cmds.push("X"),l+=e.hmtx.aWidth[a],c<n.length-1&&(l+=t.U.getPairAdjustment(e,a,f))}}return s},t.U.P={},t.U.P.moveTo=function(e,n,i){e.cmds.push("M"),e.crds.push(n,i)},t.U.P.lineTo=function(e,n,i){e.cmds.push("L"),e.crds.push(n,i)},t.U.P.curveTo=function(e,n,i,s,l,c,a){e.cmds.push("C"),e.crds.push(n,i,s,l,c,a)},t.U.P.qcurveTo=function(e,n,i,s,l){e.cmds.push("Q"),e.crds.push(n,i,s,l)},t.U.P.closePath=function(e){e.cmds.push("Z")},t.U._drawCFF=function(e,n,i,s,l){for(var c=n.stack,a=n.nStems,f=n.haveWidth,h=n.width,d=n.open,g=0,y=n.x,b=n.y,v=0,w=0,T=0,x=0,E=0,O=0,A=0,k=0,M=0,F=0,I={val:0,size:0};g<e.length;){t.CFF.getCharString(e,g,I);var C=I.val;if(g+=I.size,C=="o1"||C=="o18")c.length%2!=0&&!f&&(h=c.shift()+s.nominalWidthX),a+=c.length>>1,c.length=0,f=!0;else if(C=="o3"||C=="o23")c.length%2!=0&&!f&&(h=c.shift()+s.nominalWidthX),a+=c.length>>1,c.length=0,f=!0;else if(C=="o4")c.length>1&&!f&&(h=c.shift()+s.nominalWidthX,f=!0),d&&t.U.P.closePath(l),b+=c.pop(),t.U.P.moveTo(l,y,b),d=!0;else if(C=="o5")for(;c.length>0;)y+=c.shift(),b+=c.shift(),t.U.P.lineTo(l,y,b);else if(C=="o6"||C=="o7")for(var S=c.length,m=C=="o6",L=0;L<S;L++){var D=c.shift();m?y+=D:b+=D,m=!m,t.U.P.lineTo(l,y,b)}else if(C=="o8"||C=="o24"){S=c.length;for(var Y=0;Y+6<=S;)v=y+c.shift(),w=b+c.shift(),T=v+c.shift(),x=w+c.shift(),y=T+c.shift(),b=x+c.shift(),t.U.P.curveTo(l,v,w,T,x,y,b),Y+=6;C=="o24"&&(y+=c.shift(),b+=c.shift(),t.U.P.lineTo(l,y,b))}else{if(C=="o11")break;if(C=="o1234"||C=="o1235"||C=="o1236"||C=="o1237")C=="o1234"&&(w=b,T=(v=y+c.shift())+c.shift(),F=x=w+c.shift(),O=x,k=b,y=(A=(E=(M=T+c.shift())+c.shift())+c.shift())+c.shift(),t.U.P.curveTo(l,v,w,T,x,M,F),t.U.P.curveTo(l,E,O,A,k,y,b)),C=="o1235"&&(v=y+c.shift(),w=b+c.shift(),T=v+c.shift(),x=w+c.shift(),M=T+c.shift(),F=x+c.shift(),E=M+c.shift(),O=F+c.shift(),A=E+c.shift(),k=O+c.shift(),y=A+c.shift(),b=k+c.shift(),c.shift(),t.U.P.curveTo(l,v,w,T,x,M,F),t.U.P.curveTo(l,E,O,A,k,y,b)),C=="o1236"&&(v=y+c.shift(),w=b+c.shift(),T=v+c.shift(),F=x=w+c.shift(),O=x,A=(E=(M=T+c.shift())+c.shift())+c.shift(),k=O+c.shift(),y=A+c.shift(),t.U.P.curveTo(l,v,w,T,x,M,F),t.U.P.curveTo(l,E,O,A,k,y,b)),C=="o1237"&&(v=y+c.shift(),w=b+c.shift(),T=v+c.shift(),x=w+c.shift(),M=T+c.shift(),F=x+c.shift(),E=M+c.shift(),O=F+c.shift(),A=E+c.shift(),k=O+c.shift(),Math.abs(A-y)>Math.abs(k-b)?y=A+c.shift():b=k+c.shift(),t.U.P.curveTo(l,v,w,T,x,M,F),t.U.P.curveTo(l,E,O,A,k,y,b));else if(C=="o14"){if(c.length>0&&!f&&(h=c.shift()+i.nominalWidthX,f=!0),c.length==4){var J=c.shift(),j=c.shift(),H=c.shift(),R=c.shift(),P=t.CFF.glyphBySE(i,H),U=t.CFF.glyphBySE(i,R);t.U._drawCFF(i.CharStrings[P],n,i,s,l),n.x=J,n.y=j,t.U._drawCFF(i.CharStrings[U],n,i,s,l)}d&&(t.U.P.closePath(l),d=!1)}else if(C=="o19"||C=="o20")c.length%2!=0&&!f&&(h=c.shift()+s.nominalWidthX),a+=c.length>>1,c.length=0,f=!0,g+=a+7>>3;else if(C=="o21")c.length>2&&!f&&(h=c.shift()+s.nominalWidthX,f=!0),b+=c.pop(),y+=c.pop(),d&&t.U.P.closePath(l),t.U.P.moveTo(l,y,b),d=!0;else if(C=="o22")c.length>1&&!f&&(h=c.shift()+s.nominalWidthX,f=!0),y+=c.pop(),d&&t.U.P.closePath(l),t.U.P.moveTo(l,y,b),d=!0;else if(C=="o25"){for(;c.length>6;)y+=c.shift(),b+=c.shift(),t.U.P.lineTo(l,y,b);v=y+c.shift(),w=b+c.shift(),T=v+c.shift(),x=w+c.shift(),y=T+c.shift(),b=x+c.shift(),t.U.P.curveTo(l,v,w,T,x,y,b)}else if(C=="o26")for(c.length%2&&(y+=c.shift());c.length>0;)v=y,w=b+c.shift(),y=T=v+c.shift(),b=(x=w+c.shift())+c.shift(),t.U.P.curveTo(l,v,w,T,x,y,b);else if(C=="o27")for(c.length%2&&(b+=c.shift());c.length>0;)w=b,T=(v=y+c.shift())+c.shift(),x=w+c.shift(),y=T+c.shift(),b=x,t.U.P.curveTo(l,v,w,T,x,y,b);else if(C=="o10"||C=="o29"){var G=C=="o10"?s:i;if(c.length==0)console.debug("error: empty stack");else{var B=c.pop(),W=G.Subrs[B+G.Bias];n.x=y,n.y=b,n.nStems=a,n.haveWidth=f,n.width=h,n.open=d,t.U._drawCFF(W,n,i,s,l),y=n.x,b=n.y,a=n.nStems,f=n.haveWidth,h=n.width,d=n.open}}else if(C=="o30"||C=="o31"){var K=c.length,Z=(Y=0,C=="o31");for(Y+=K-(S=-3&K);Y<S;)Z?(w=b,T=(v=y+c.shift())+c.shift(),b=(x=w+c.shift())+c.shift(),S-Y==5?(y=T+c.shift(),Y++):y=T,Z=!1):(v=y,w=b+c.shift(),T=v+c.shift(),x=w+c.shift(),y=T+c.shift(),S-Y==5?(b=x+c.shift(),Y++):b=x,Z=!0),t.U.P.curveTo(l,v,w,T,x,y,b),Y+=4}else{if((C+"").charAt(0)=="o")throw console.debug("Unknown operation: "+C,e),C;c.push(C)}}}n.x=y,n.y=b,n.nStems=a,n.haveWidth=f,n.width=h,n.open=d};var o=t,r={Typr:o};return u.Typr=o,u.default=r,Object.defineProperty(u,"__esModule",{value:!0}),u})({}).Typr}function _h(){return(function(u){var t=Uint8Array,o=Uint16Array,r=Uint32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),n=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),i=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(C,S){for(var m=new o(31),L=0;L<31;++L)m[L]=S+=1<<C[L-1];var D=new r(m[30]);for(L=1;L<30;++L)for(var Y=m[L];Y<m[L+1];++Y)D[Y]=Y-m[L]<<5|L;return[m,D]},l=s(e,2),c=l[0],a=l[1];c[28]=258,a[258]=28;for(var f=s(n,0)[0],h=new o(32768),d=0;d<32768;++d){var g=(43690&d)>>>1|(21845&d)<<1;g=(61680&(g=(52428&g)>>>2|(13107&g)<<2))>>>4|(3855&g)<<4,h[d]=((65280&g)>>>8|(255&g)<<8)>>>1}var y=function(C,S,m){for(var L=C.length,D=0,Y=new o(S);D<L;++D)++Y[C[D]-1];var J,j=new o(S);for(D=0;D<S;++D)j[D]=j[D-1]+Y[D-1]<<1;if(m){J=new o(1<<S);var H=15-S;for(D=0;D<L;++D)if(C[D])for(var R=D<<4|C[D],P=S-C[D],U=j[C[D]-1]++<<P,G=U|(1<<P)-1;U<=G;++U)J[h[U]>>>H]=R}else for(J=new o(L),D=0;D<L;++D)C[D]&&(J[D]=h[j[C[D]-1]++]>>>15-C[D]);return J},b=new t(288);for(d=0;d<144;++d)b[d]=8;for(d=144;d<256;++d)b[d]=9;for(d=256;d<280;++d)b[d]=7;for(d=280;d<288;++d)b[d]=8;var v=new t(32);for(d=0;d<32;++d)v[d]=5;var w=y(b,9,1),T=y(v,5,1),x=function(C){for(var S=C[0],m=1;m<C.length;++m)C[m]>S&&(S=C[m]);return S},E=function(C,S,m){var L=S/8|0;return(C[L]|C[L+1]<<8)>>(7&S)&m},O=function(C,S){var m=S/8|0;return(C[m]|C[m+1]<<8|C[m+2]<<16)>>(7&S)},A=["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"],k=function(C,S,m){var L=new Error(S||A[C]);if(L.code=C,Error.captureStackTrace&&Error.captureStackTrace(L,k),!m)throw L;return L},M=function(C,S,m){var L=C.length;if(!L||m&&!m.l&&L<5)return S||new t(0);var D=!S||m,Y=!m||m.i;m||(m={}),S||(S=new t(3*L));var J,j=function(ue){var Ne=S.length;if(ue>Ne){var Qe=new t(Math.max(2*Ne,ue));Qe.set(S),S=Qe}},H=m.f||0,R=m.p||0,P=m.b||0,U=m.l,G=m.d,B=m.m,W=m.n,K=8*L;do{if(!U){m.f=H=E(C,R,1);var Z=E(C,R+1,3);if(R+=3,!Z){var ne=C[(ae=((J=R)/8|0)+(7&J&&1)+4)-4]|C[ae-3]<<8,se=ae+ne;if(se>L){Y&&k(0);break}D&&j(P+ne),S.set(C.subarray(ae,se),P),m.b=P+=ne,m.p=R=8*se;continue}if(Z==1)U=w,G=T,B=9,W=5;else if(Z==2){var Q=E(C,R,31)+257,$=E(C,R+10,15)+4,Ie=Q+E(C,R+5,31)+1;R+=14;for(var Ee=new t(Ie),ve=new t(19),we=0;we<$;++we)ve[i[we]]=E(C,R+3*we,7);R+=3*$;var _e=x(ve),ee=(1<<_e)-1,fe=y(ve,_e,1);for(we=0;we<Ie;){var ae,X=fe[E(C,R,ee)];if(R+=15&X,(ae=X>>>4)<16)Ee[we++]=ae;else{var ge=0,te=0;for(ae==16?(te=3+E(C,R,3),R+=2,ge=Ee[we-1]):ae==17?(te=3+E(C,R,7),R+=3):ae==18&&(te=11+E(C,R,127),R+=7);te--;)Ee[we++]=ge}}var le=Ee.subarray(0,Q),oe=Ee.subarray(Q);B=x(le),W=x(oe),U=y(le,B,1),G=y(oe,W,1)}else k(1);if(R>K){Y&&k(0);break}}D&&j(P+131072);for(var qe=(1<<B)-1,ce=(1<<W)-1,ye=R;;ye=R){var Se=(ge=U[O(C,R)&qe])>>>4;if((R+=15&ge)>K){Y&&k(0);break}if(ge||k(2),Se<256)S[P++]=Se;else{if(Se==256){ye=R,U=null;break}var Ge=Se-254;if(Se>264){var Ve=e[we=Se-257];Ge=E(C,R,(1<<Ve)-1)+c[we],R+=Ve}var ze=G[O(C,R)&ce],Re=ze>>>4;if(ze||k(3),R+=15&ze,oe=f[Re],Re>3&&(Ve=n[Re],oe+=O(C,R)&(1<<Ve)-1,R+=Ve),R>K){Y&&k(0);break}D&&j(P+131072);for(var ke=P+Ge;P<ke;P+=4)S[P]=S[P-oe],S[P+1]=S[P+1-oe],S[P+2]=S[P+2-oe],S[P+3]=S[P+3-oe];P=ke}}m.l=U,m.p=ye,m.b=P,U&&(H=1,m.m=B,m.d=G,m.n=W)}while(!H);return P==S.length?S:(function(ue,Ne,Qe){(Ne==null||Ne<0)&&(Ne=0),(Qe==null||Qe>ue.length)&&(Qe=ue.length);var kt=new(ue instanceof o?o:ue instanceof r?r:t)(Qe-Ne);return kt.set(ue.subarray(Ne,Qe)),kt})(S,0,P)},F=new t(0),I=typeof TextDecoder<"u"&&new TextDecoder;try{I.decode(F,{stream:!0})}catch{}return u.convert_streams=function(C){var S=new DataView(C),m=0;function L(){var Q=S.getUint16(m);return m+=2,Q}function D(){var Q=S.getUint32(m);return m+=4,Q}function Y(Q){ne.setUint16(se,Q),se+=2}function J(Q){ne.setUint32(se,Q),se+=4}for(var j={signature:D(),flavor:D(),length:D(),numTables:L(),reserved:L(),totalSfntSize:D(),majorVersion:L(),minorVersion:L(),metaOffset:D(),metaLength:D(),metaOrigLength:D(),privOffset:D(),privLength:D()},H=0;Math.pow(2,H)<=j.numTables;)H++;H--;for(var R=16*Math.pow(2,H),P=16*j.numTables-R,U=12,G=[],B=0;B<j.numTables;B++)G.push({tag:D(),offset:D(),compLength:D(),origLength:D(),origChecksum:D()}),U+=16;var W,K=new Uint8Array(12+16*G.length+G.reduce((function(Q,$){return Q+$.origLength+4}),0)),Z=K.buffer,ne=new DataView(Z),se=0;return J(j.flavor),Y(j.numTables),Y(R),Y(H),Y(P),G.forEach((function(Q){J(Q.tag),J(Q.origChecksum),J(U),J(Q.origLength),Q.outOffset=U,(U+=Q.origLength)%4!=0&&(U+=4-U%4)})),G.forEach((function(Q){var $,Ie=C.slice(Q.offset,Q.offset+Q.compLength);if(Q.compLength!=Q.origLength){var Ee=new Uint8Array(Q.origLength);$=new Uint8Array(Ie,2),M($,Ee)}else Ee=new Uint8Array(Ie);K.set(Ee,Q.outOffset);var ve=0;(U=Q.outOffset+Q.origLength)%4!=0&&(ve=4-U%4),K.set(new Uint8Array(ve).buffer,Q.outOffset+Q.origLength),W=U+ve})),Z.slice(0,W)},Object.defineProperty(u,"__esModule",{value:!0}),u})({}).convert_streams}function Lh(u,t){let o={M:2,L:2,Q:4,C:6,Z:0},r={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"},e=1,n=2,i=4,s=8,l=16,c=32,a;function f(A){if(!a){let k={R:n,L:e,D:i,C:l,U:c,T:s};a=new Map;for(let M in r){let F=0;r[M].split(",").forEach(I=>{let[C,S]=I.split("+");C=parseInt(C,36),S=S?parseInt(S,36):0,a.set(F+=C,k[M]);for(let m=S;m--;)a.set(++F,k[M])})}}return a.get(A)||c}let h=1,d=2,g=3,y=4,b=[null,"isol","init","fina","medi"];function v(A){let k=new Uint8Array(A.length),M=c,F=h,I=-1;for(let C=0;C<A.length;C++){let S=A.codePointAt(C),m=f(S)|0,L=h;m&s||(M&(e|i|l)?m&(n|i|l)?(L=g,(F===h||F===g)&&k[I]++):m&(e|c)&&(F===d||F===y)&&k[I]--:M&(n|c)&&(F===d||F===y)&&k[I]--,F=k[C]=L,M=m,I=C,S>65535&&C++)}return k}function w(A,k){let M=[];for(let I=0;I<k.length;I++){let C=k.codePointAt(I);C>65535&&I++,M.push(u.U.codeToGlyph(A,C))}let F=A.GSUB;if(F){let{lookupList:I,featureList:C}=F,S,m=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,L=[];C.forEach(D=>{if(m.test(D.tag))for(let Y=0;Y<D.tab.length;Y++){if(L[D.tab[Y]])continue;L[D.tab[Y]]=!0;let J=I[D.tab[Y]],j=/^(isol|init|fina|medi)$/.test(D.tag);j&&!S&&(S=v(k));for(let H=0;H<M.length;H++)(!S||!j||b[S[H]]===D.tag)&&u.U._applySubs(M,H,J,I)}})}return M}function T(A,k){let M=new Int16Array(k.length*3),F=0;for(;F<k.length;F++){let m=k[F];if(m===-1)continue;M[F*3+2]=A.hmtx.aWidth[m];let L=A.GPOS;if(L){let D=L.lookupList;for(let Y=0;Y<D.length;Y++){let J=D[Y];for(let j=0;j<J.tabs.length;j++){let H=J.tabs[j];if(J.ltype===1){if(u._lctf.coverageIndex(H.coverage,m)!==-1&&H.pos){S(H.pos,F);break}}else if(J.ltype===2){let R=null,P=I();if(P!==-1){let U=u._lctf.coverageIndex(H.coverage,k[P]);if(U!==-1){if(H.fmt===1){let G=H.pairsets[U];for(let B=0;B<G.length;B++)G[B].gid2===m&&(R=G[B])}else if(H.fmt===2){let G=u.U._getGlyphClass(k[P],H.classDef1),B=u.U._getGlyphClass(m,H.classDef2);R=H.matrix[G][B]}if(R){R.val1&&S(R.val1,P),R.val2&&S(R.val2,F);break}}}}else if(J.ltype===4){let R=u._lctf.coverageIndex(H.markCoverage,m);if(R!==-1){let P=I(C),U=P===-1?-1:u._lctf.coverageIndex(H.baseCoverage,k[P]);if(U!==-1){let G=H.markArray[R],B=H.baseArray[U][G.markClass];M[F*3]=B.x-G.x+M[P*3]-M[P*3+2],M[F*3+1]=B.y-G.y+M[P*3+1];break}}}else if(J.ltype===6){let R=u._lctf.coverageIndex(H.mark1Coverage,m);if(R!==-1){let P=I();if(P!==-1){let U=k[P];if(x(A,U)===3){let G=u._lctf.coverageIndex(H.mark2Coverage,U);if(G!==-1){let B=H.mark1Array[R],W=H.mark2Array[G][B.markClass];M[F*3]=W.x-B.x+M[P*3]-M[P*3+2],M[F*3+1]=W.y-B.y+M[P*3+1];break}}}}}}}}else if(A.kern&&!A.cff){let D=I();if(D!==-1){let Y=A.kern.glyph1.indexOf(k[D]);if(Y!==-1){let J=A.kern.rval[Y].glyph2.indexOf(m);J!==-1&&(M[D*3+2]+=A.kern.rval[Y].vals[J])}}}}return M;function I(m){for(let L=F-1;L>=0;L--)if(k[L]!==-1&&(!m||m(k[L])))return L;return-1}function C(m){return x(A,m)===1}function S(m,L){for(let D=0;D<3;D++)M[L*3+D]+=m[D]||0}}function x(A,k){let M=A.GDEF&&A.GDEF.glyphClassDef;return M?u.U._getGlyphClass(k,M):0}function E(...A){for(let k=0;k<A.length;k++)if(typeof A[k]=="number")return A[k]}function O(A){let k=Object.create(null),M=A["OS/2"],F=A.hhea,I=A.head.unitsPerEm,C=E(M&&M.sTypoAscender,F&&F.ascender,I),S={unitsPerEm:I,ascender:C,descender:E(M&&M.sTypoDescender,F&&F.descender,0),capHeight:E(M&&M.sCapHeight,C),xHeight:E(M&&M.sxHeight,C),lineGap:E(M&&M.sTypoLineGap,F&&F.lineGap),supportsCodePoint(m){return u.U.codeToGlyph(A,m)>0},forEachGlyph(m,L,D,Y){let J=0,j=1/S.unitsPerEm*L,H=w(A,m),R=0,P=T(A,H);return H.forEach((U,G)=>{if(U!==-1){let B=k[U];if(!B){let{cmds:W,crds:K}=u.U.glyphToPath(A,U),Z="",ne=0;for(let Ee=0,ve=W.length;Ee<ve;Ee++){let we=o[W[Ee]];Z+=W[Ee];for(let _e=1;_e<=we;_e++)Z+=(_e>1?",":"")+K[ne++]}let se,Q,$,Ie;if(K.length){se=Q=1/0,$=Ie=-1/0;for(let Ee=0,ve=K.length;Ee<ve;Ee+=2){let we=K[Ee],_e=K[Ee+1];we<se&&(se=we),_e<Q&&(Q=_e),we>$&&($=we),_e>Ie&&(Ie=_e)}}else se=$=Q=Ie=0;B=k[U]={index:U,advanceWidth:A.hmtx.aWidth[U],xMin:se,yMin:Q,xMax:$,yMax:Ie,path:Z}}Y.call(null,B,J+P[G*3]*j,P[G*3+1]*j,R),J+=P[G*3+2]*j,D&&(J+=D*L)}R+=m.codePointAt(R)>65535?2:1}),J}};return S}return function(k){let M=new Uint8Array(k,0,4),F=u._bin.readASCII(M,0,4);if(F==="wOFF")k=t(k);else if(F==="wOF2")throw new Error("woff2 fonts not supported");return O(u.parse(k)[0])}}var Ch=eo({name:"Typr Font Parser",dependencies:[Ih,_h,Lh],init(u,t,o){let r=u(),e=t();return o(r,e)}});function Oh(){return(function(u){var t=function(){this.buckets=new Map};t.prototype.add=function(T){var x=T>>5;this.buckets.set(x,(this.buckets.get(x)||0)|1<<(31&T))},t.prototype.has=function(T){var x=this.buckets.get(T>>5);return x!==void 0&&(x&1<<(31&T))!=0},t.prototype.serialize=function(){var T=[];return this.buckets.forEach((function(x,E){T.push((+E).toString(36)+":"+x.toString(36))})),T.join(",")},t.prototype.deserialize=function(T){var x=this;this.buckets.clear(),T.split(",").forEach((function(E){var O=E.split(":");x.buckets.set(parseInt(O[0],36),parseInt(O[1],36))}))};var o=Math.pow(2,8),r=o-1,e=~r;function n(T){var x=(function(O){return O&e})(T).toString(16),E=(function(O){return(O&e)+o-1})(T).toString(16);return"codepoint-index/plane"+(T>>16)+"/"+x+"-"+E+".json"}function i(T,x){var E=T&r,O=x.codePointAt(E/6|0);return((O=(O||48)-48)&1<<E%6)!=0}function s(T,x){var E;(E=T,E.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(O){return O.split("-").map((function(A){return parseInt(A.trim(),16)}))}))).forEach((function(O){var A=O[0],k=O[1];k===void 0&&(k=A),x(A,k)}))}function l(T,x){s(T,(function(E,O){for(var A=E;A<=O;A++)x(A)}))}var c={},a={},f=new WeakMap,h="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function d(T){var x=f.get(T);return x||(x=new t,l(T.ranges,(function(E){return x.add(E)})),f.set(T,x)),x}var g,y=new Map;function b(T,x,E){return T[x]?x:T[E]?E:(function(O){for(var A in O)return A})(T)}function v(T,x){var E=x;if(!T.includes(E)){E=1/0;for(var O=0;O<T.length;O++)Math.abs(T[O]-x)<Math.abs(E-x)&&(E=T[O])}return E}function w(T){return g||(g=new Set,l("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(x){g.add(x)}))),g.has(T)}return u.CodePointSet=t,u.clearCache=function(){c={},a={}},u.getFontsForString=function(T,x){x===void 0&&(x={});var E,O=x.lang;O===void 0&&(O=/\p{Script=Hangul}/u.test(E=T)?"ko":/\p{Script=Hiragana}|\p{Script=Katakana}/u.test(E)?"ja":"en");var A=x.category;A===void 0&&(A="sans-serif");var k=x.style;k===void 0&&(k="normal");var M=x.weight;M===void 0&&(M=400);var F=(x.dataUrl||h).replace(/\/$/g,""),I=new Map,C=new Uint8Array(T.length),S={},m={},L=new Array(T.length),D=new Map,Y=!1;function J(R){var P=y.get(R);return P||(P=fetch(F+"/"+R).then((function(U){if(!U.ok)throw new Error(U.statusText);return U.json().then((function(G){if(!Array.isArray(G)||G[0]!==1)throw new Error("Incorrect schema version; need 1, got "+G[0]);return G[1]}))})).catch((function(U){if(F!==h)return Y||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+F+'", trying default CDN. '+U.message),Y=!0),F=h,y.delete(R),J(R);throw U})),y.set(R,P)),P}for(var j=function(R){var P=T.codePointAt(R),U=n(P);L[R]=U,c[U]||D.has(U)||D.set(U,J(U).then((function(G){c[U]=G}))),P>65535&&(R++,H=R)},H=0;H<T.length;H++)j(H);return Promise.all(D.values()).then((function(){D.clear();for(var R=function(U){var G=T.codePointAt(U),B=null,W=c[L[U]],K=void 0;for(var Z in W){var ne=m[Z];if(ne===void 0&&(ne=m[Z]=new RegExp(Z).test(O||"en")),ne){for(var se in K=Z,W[Z])if(i(G,W[Z][se])){B=se;break}break}}if(!B){e:for(var Q in W)if(Q!==K){for(var $ in W[Q])if(i(G,W[Q][$])){B=$;break e}}}B||(console.debug("No font coverage for U+"+G.toString(16)),B="latin"),L[U]=B,a[B]||D.has(B)||D.set(B,J("font-meta/"+B+".json").then((function(Ie){a[B]=Ie}))),G>65535&&(U++,P=U)},P=0;P<T.length;P++)R(P);return Promise.all(D.values())})).then((function(){for(var R,P=null,U=0;U<T.length;U++){var G=T.codePointAt(U);if(P&&(w(G)||d(P).has(G)))C[U]=C[U-1];else{P=a[L[U]];var B=S[P.id];if(!B){var W=P.typeforms,K=b(W,A,"sans-serif"),Z=b(W[K],k,"normal"),ne=v((R=W[K])===null||R===void 0?void 0:R[Z],M);B=S[P.id]=F+"/font-files/"+P.id+"/"+K+"."+Z+"."+ne+".woff"}var se=I.get(B);se==null&&(se=I.size,I.set(B,se)),C[U]=se}G>65535&&(U++,C[U]=C[U-1])}return{fontUrls:Array.from(I.keys()),chars:C}}))},Object.defineProperty(u,"__esModule",{value:!0}),u})({})}function Fh(u,t){let o=Object.create(null),r=Object.create(null);function e(i,s){let l=c=>{console.error(`Failure loading font ${i}`,c)};try{let c=new XMLHttpRequest;c.open("get",i,!0),c.responseType="arraybuffer",c.onload=function(){if(c.status>=400)l(new Error(c.statusText));else if(c.status>0)try{let a=u(c.response);a.src=i,s(a)}catch(a){l(a)}},c.onerror=l,c.send()}catch(c){l(c)}}function n(i,s){let l=o[i];l?s(l):r[i]?r[i].push(s):(r[i]=[s],e(i,c=>{c.src=i,o[i]=c,r[i].forEach(a=>a(c)),delete r[i]}))}return function(i,s,{lang:l,fonts:c=[],style:a="normal",weight:f="normal",unicodeFontsURL:h}={}){let d=new Uint8Array(i.length),g=[];i.length||w();let y=new Map,b=[];if(a!=="italic"&&(a="normal"),typeof f!="number"&&(f=f==="bold"?700:400),c&&!Array.isArray(c)&&(c=[c]),c=c.slice().filter(x=>!x.lang||x.lang.test(l)).reverse(),c.length){let A=0;(function k(M=0){for(let F=M,I=i.length;F<I;F++){let C=i.codePointAt(F);if(A===1&&g[d[F-1]].supportsCodePoint(C)||F>0&&/\s/.test(i[F]))d[F]=d[F-1],A===2&&(b[b.length-1][1]=F);else for(let S=d[F],m=c.length;S<=m;S++)if(S===m){let L=A===2?b[b.length-1]:b[b.length]=[F,F];L[1]=F,A=2}else{d[F]=S;let{src:L,unicodeRange:D}=c[S];if(!D||T(C,D)){let Y=o[L];if(!Y){n(L,()=>{k(F)});return}if(Y.supportsCodePoint(C)){let J=y.get(Y);typeof J!="number"&&(J=g.length,g.push(Y),y.set(Y,J)),d[F]=J,A=1;break}}}C>65535&&F+1<I&&(d[F+1]=d[F],F++,A===2&&(b[b.length-1][1]=F))}v()})()}else b.push([0,i.length-1]),v();function v(){if(b.length){let x=b.map(E=>i.substring(E[0],E[1]+1)).join(`
|
|
41
|
+
`);t.getFontsForString(x,{lang:l||void 0,style:a,weight:f,dataUrl:h}).then(({fontUrls:E,chars:O})=>{let A=g.length,k=0;b.forEach(F=>{for(let I=0,C=F[1]-F[0];I<=C;I++)d[F[0]+I]=O[k++]+A;k++});let M=0;E.forEach((F,I)=>{n(F,C=>{g[I+A]=C,++M===E.length&&w()})})})}else w()}function w(){s({chars:d,fonts:g})}function T(x,E){for(let O=0;O<E.length;O++){let[A,k=A]=E[O];if(A<=x&&x<=k)return!0}return!1}}}var Ph=eo({name:"FontResolver",dependencies:[Fh,Ch,Oh],init(u,t,o){return u(t,o())}});function Uh(u,t){let r=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,e="[^\\S\\u00A0]",n=new RegExp(`${e}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function i({text:g,lang:y,fonts:b,style:v,weight:w,preResolvedFonts:T,unicodeFontsURL:x},E){let O=({chars:A,fonts:k})=>{let M,F,I=[];for(let C=0;C<A.length;C++)A[C]!==F?(F=A[C],I.push(M={start:C,end:C,fontObj:k[A[C]]})):M.end=C;E(I)};T?O(T):u(g,O,{lang:y,fonts:b,style:v,weight:w,unicodeFontsURL:x})}function s({text:g="",font:y,lang:b,sdfGlyphSize:v=64,fontSize:w=400,fontWeight:T=1,fontStyle:x="normal",letterSpacing:E=0,lineHeight:O="normal",maxWidth:A=1/0,direction:k,textAlign:M="left",textIndent:F=0,whiteSpace:I="normal",overflowWrap:C="normal",anchorX:S=0,anchorY:m=0,metricsOnly:L=!1,unicodeFontsURL:D,preResolvedFonts:Y=null,includeCaretPositions:J=!1,chunkedBoundsSize:j=8192,colorRanges:H=null},R){let P=f(),U={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,`
|
|
42
|
+
`).replace(/\r/g,`
|
|
43
|
+
`)),w=+w,E=+E,A=+A,O=O||"normal",F=+F,i({text:g,lang:b,style:x,weight:T,fonts:typeof y=="string"?[{src:y}]:y,unicodeFontsURL:D,preResolvedFonts:Y},G=>{U.fontLoad=f()-P;let B=isFinite(A),W=null,K=null,Z=null,ne=null,se=null,Q=null,$=null,Ie=null,Ee=0,ve=0,we=I!=="nowrap",_e=new Map,ee=f(),fe=F,ae=0,X=new h,ge=[X];G.forEach(ce=>{let{fontObj:ye}=ce,{ascender:Se,descender:Ge,unitsPerEm:Ve,lineGap:ze,capHeight:Re,xHeight:ke}=ye,ue=_e.get(ye);if(!ue){let Ae=w/Ve,We=O==="normal"?(Se-Ge+ze)*Ae:O*w,xn=(We-(Se-Ge)*Ae)/2,Ke=Math.min(We,(Se-Ge)*Ae),De=(Se+Ge)/2*Ae+Ke/2;ue={index:_e.size,src:ye.src,fontObj:ye,fontSizeMult:Ae,unitsPerEm:Ve,ascender:Se*Ae,descender:Ge*Ae,capHeight:Re*Ae,xHeight:ke*Ae,lineHeight:We,baseline:-xn-Se*Ae,caretTop:De,caretBottom:De-Ke},_e.set(ye,ue)}let{fontSizeMult:Ne}=ue,Qe=g.slice(ce.start,ce.end+1),kt,Ye;ye.forEachGlyph(Qe,w,E,(Ae,We,xn,Ke)=>{We+=ae,Ke+=ce.start,kt=We,Ye=Ae;let De=g.charAt(Ke),it=Ae.advanceWidth*Ne,et=X.count,Le;if("isEmpty"in Ae||(Ae.isWhitespace=!!De&&new RegExp(e).test(De),Ae.canBreakAfter=!!De&&n.test(De),Ae.isEmpty=Ae.xMin===Ae.xMax||Ae.yMin===Ae.yMax||r.test(De)),!Ae.isWhitespace&&!Ae.isEmpty&&ve++,we&&B&&!Ae.isWhitespace&&We+it+fe>A&&et){if(X.glyphAt(et-1).glyphObj.canBreakAfter)Le=new h,fe=-We;else for(let xt=et;xt--;)if(xt===0&&C==="break-word"){Le=new h,fe=-We;break}else if(X.glyphAt(xt).glyphObj.canBreakAfter){Le=X.splitAt(xt+1);let pt=Le.glyphAt(0).x;fe-=pt;for(let at=Le.count;at--;)Le.glyphAt(at).x-=pt;break}Le&&(X.isSoftWrapped=!0,X=Le,ge.push(X),Ee=A)}let tt=X.glyphAt(X.count);tt.glyphObj=Ae,tt.x=We+fe,tt.y=xn,tt.width=it,tt.charIndex=Ke,tt.fontData=ue,De===`
|
|
44
|
+
`&&(X=new h,ge.push(X),fe=-(We+it+E*w)+F)}),ae=kt+Ye.advanceWidth*Ne+E*w});let te=0;ge.forEach(ce=>{let ye=!0;for(let Se=ce.count;Se--;){let Ge=ce.glyphAt(Se);ye&&!Ge.glyphObj.isWhitespace&&(ce.width=Ge.x+Ge.width,ce.width>Ee&&(Ee=ce.width),ye=!1);let{lineHeight:Ve,capHeight:ze,xHeight:Re,baseline:ke}=Ge.fontData;Ve>ce.lineHeight&&(ce.lineHeight=Ve);let ue=ke-ce.baseline;ue<0&&(ce.baseline+=ue,ce.cap+=ue,ce.ex+=ue),ce.cap=Math.max(ce.cap,ce.baseline+ze),ce.ex=Math.max(ce.ex,ce.baseline+Re)}ce.baseline-=te,ce.cap-=te,ce.ex-=te,te+=ce.lineHeight});let le=0,oe=0;if(S&&(typeof S=="number"?le=-S:typeof S=="string"&&(le=-Ee*(S==="left"?0:S==="center"?.5:S==="right"?1:c(S)))),m&&(typeof m=="number"?oe=-m:typeof m=="string"&&(oe=m==="top"?0:m==="top-baseline"?-ge[0].baseline:m==="top-cap"?-ge[0].cap:m==="top-ex"?-ge[0].ex:m==="middle"?te/2:m==="bottom"?te:m==="bottom-baseline"?-ge[ge.length-1].baseline:c(m)*te)),!L){let ce=t.getEmbeddingLevels(g,k);W=new Uint16Array(ve),K=new Uint8Array(ve),Z=new Float32Array(ve*2),ne={},$=[1/0,1/0,-1/0,-1/0],Ie=[],J&&(Q=new Float32Array(g.length*4)),H&&(se=new Uint8Array(ve*3));let ye=0,Se=-1,Ge=-1,Ve,ze;if(ge.forEach((Re,ke)=>{let{count:ue,width:Ne}=Re;if(ue>0){let Qe=0;for(let Ke=ue;Ke--&&Re.glyphAt(Ke).glyphObj.isWhitespace;)Qe++;let kt=0,Ye=0;if(M==="center")kt=(Ee-Ne)/2;else if(M==="right")kt=Ee-Ne;else if(M==="justify"&&Re.isSoftWrapped){let Ke=0;for(let De=ue-Qe;De--;)Re.glyphAt(De).glyphObj.isWhitespace&&Ke++;Ye=(Ee-Ne)/Ke}if(Ye||kt){let Ke=0;for(let De=0;De<ue;De++){let it=Re.glyphAt(De),et=it.glyphObj;it.x+=kt+Ke,Ye!==0&&et.isWhitespace&&De<ue-Qe&&(Ke+=Ye,it.width+=Ye)}}let Ae=t.getReorderSegments(g,ce,Re.glyphAt(0).charIndex,Re.glyphAt(Re.count-1).charIndex);for(let Ke=0;Ke<Ae.length;Ke++){let[De,it]=Ae[Ke],et=1/0,Le=-1/0;for(let tt=0;tt<ue;tt++)if(Re.glyphAt(tt).charIndex>=De){let xt=tt,pt=tt;for(;pt<ue;pt++){let at=Re.glyphAt(pt);if(at.charIndex>it)break;pt<ue-Qe&&(et=Math.min(et,at.x),Le=Math.max(Le,at.x+at.width))}for(let at=xt;at<pt;at++){let zt=Re.glyphAt(at);zt.x=Le-(zt.x+zt.width-et)}break}}let We,xn=Ke=>We=Ke;for(let Ke=0;Ke<ue;Ke++){let De=Re.glyphAt(Ke);We=De.glyphObj;let it=We.index,et=ce.levels[De.charIndex]&1;if(et){let Le=t.getMirroredCharacter(g[De.charIndex]);Le&&De.fontData.fontObj.forEachGlyph(Le,0,0,xn)}if(J){let{charIndex:Le,fontData:tt}=De,xt=De.x+le,pt=De.x+De.width+le;Q[Le*4]=et?pt:xt,Q[Le*4+1]=et?xt:pt,Q[Le*4+2]=Re.baseline+tt.caretBottom+oe,Q[Le*4+3]=Re.baseline+tt.caretTop+oe;let at=Le-Se;at>1&&a(Q,Se,at),Se=Le}if(H){let{charIndex:Le}=De;for(;Le>Ge;)Ge++,H.hasOwnProperty(Ge)&&(ze=H[Ge])}if(!We.isWhitespace&&!We.isEmpty){let Le=ye++,{fontSizeMult:tt,src:xt,index:pt}=De.fontData,at=ne[xt]||(ne[xt]={});at[it]||(at[it]={path:We.path,pathBounds:[We.xMin,We.yMin,We.xMax,We.yMax]});let zt=De.x+le,En=De.y+Re.baseline+oe;Z[Le*2]=zt,Z[Le*2+1]=En;let cn=zt+We.xMin*tt,Sn=En+We.yMin*tt,$n=zt+We.xMax*tt,un=En+We.yMax*tt;cn<$[0]&&($[0]=cn),Sn<$[1]&&($[1]=Sn),$n>$[2]&&($[2]=$n),un>$[3]&&($[3]=un),Le%j===0&&(Ve={start:Le,end:Le,rect:[1/0,1/0,-1/0,-1/0]},Ie.push(Ve)),Ve.end++;let Et=Ve.rect;if(cn<Et[0]&&(Et[0]=cn),Sn<Et[1]&&(Et[1]=Sn),$n>Et[2]&&(Et[2]=$n),un>Et[3]&&(Et[3]=un),W[Le]=it,K[Le]=pt,H){let Jn=Le*3;se[Jn]=ze>>16&255,se[Jn+1]=ze>>8&255,se[Jn+2]=ze&255}}}}}),Q){let Re=g.length-Se;Re>1&&a(Q,Se,Re)}}let qe=[];_e.forEach(({index:ce,src:ye,unitsPerEm:Se,ascender:Ge,descender:Ve,lineHeight:ze,capHeight:Re,xHeight:ke})=>{qe[ce]={src:ye,unitsPerEm:Se,ascender:Ge,descender:Ve,lineHeight:ze,capHeight:Re,xHeight:ke}}),U.typesetting=f()-ee,R({glyphIds:W,glyphFontIndices:K,glyphPositions:Z,glyphData:ne,fontData:qe,caretPositions:Q,glyphColors:se,chunkedBounds:Ie,fontSize:w,topBaseline:oe+ge[0].baseline,blockBounds:[le,oe-te,le+Ee,oe],visibleBounds:$,timings:U})})}function l(g,y){s({...g,metricsOnly:!0},b=>{let[v,w,T,x]=b.blockBounds;y({width:T-v,height:x-w})})}function c(g){let y=g.match(/^([\d.]+)%$/),b=y?parseFloat(y[1]):NaN;return isNaN(b)?0:b/100}function a(g,y,b){let v=g[y*4],w=g[y*4+1],T=g[y*4+2],x=g[y*4+3],E=(w-v)/b;for(let O=0;O<b;O++){let A=(y+O)*4;g[A]=v+E*O,g[A+1]=v+E*(O+1),g[A+2]=T,g[A+3]=x}}function f(){return(self.performance||Date).now()}function h(){this.data=[]}let d=["glyphObj","x","y","width","charIndex","fontData"];return h.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/d.length)},glyphAt(g){let y=h.flyweight;return y.data=this.data,y.index=g,y},splitAt(g){let y=new h;return y.data=this.data.splice(g*d.length),y}},h.flyweight=d.reduce((g,y,b,v)=>(Object.defineProperty(g,y,{get(){return this.data[this.index*d.length+b]},set(w){this.data[this.index*d.length+b]=w}}),g),{data:null,index:0}),{typeset:s,measure:l}}var oo=()=>(self.performance||Date).now(),Vr=Ys(),ic;function Bh(u,t,o,r,e,n,i,s,l,c,a=!0){return a?Nh(u,t,o,r,e,n,i,s,l,c).then(null,f=>(ic||(console.warn("WebGL SDF generation failed, falling back to JS",f),ic=!0),sc(u,t,o,r,e,n,i,s,l,c))):sc(u,t,o,r,e,n,i,s,l,c)}var Nr=[],Dh=5,na=0;function gc(){let u=oo();for(;Nr.length&&oo()-u<Dh;)Nr.shift()();na=Nr.length?setTimeout(gc,0):0}var Nh=(...u)=>new Promise((t,o)=>{Nr.push(()=>{let r=oo();try{Vr.webgl.generateIntoCanvas(...u),t({timing:oo()-r})}catch(e){o(e)}}),na||(na=setTimeout(gc,0))}),Hh=4,Gh=2e3,rc={},Vh=0;function sc(u,t,o,r,e,n,i,s,l,c){let a="TroikaTextSDFGenerator_JS_"+Vh++%Hh,f=rc[a];return f||(f=rc[a]={workerModule:eo({name:a,workerId:a,dependencies:[Ys,oo],init(h,d){let g=h().javascript.generate;return function(...y){let b=d();return{textureData:g(...y),timing:d()-b}}},getTransferables(h){return[h.textureData.buffer]}}),requests:0,idleTimer:null}),f.requests++,clearTimeout(f.idleTimer),f.workerModule(u,t,o,r,e,n).then(({textureData:h,timing:d})=>{let g=oo(),y=new Uint8Array(h.length*4);for(let b=0;b<h.length;b++)y[b*4+c]=h[b];return Vr.webglUtils.renderImageData(i,y,s,l,u,t,1<<3-c),d+=oo()-g,--f.requests===0&&(f.idleTimer=setTimeout(()=>{Jl(a)},Gh)),{timing:d}})}function jh(u){u._warm||(Vr.webgl.isSupported(u),u._warm=!0)}var zh=Vr.webglUtils.resizeWebGLCanvasWithoutClearing,no={defaultFontURL:null,unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048,useWorker:!0},Wh=new he.Color,Kh=!1;function Fo(){return(self.performance||Date).now()}var ac=Object.create(null);function Xh(u,t){Kh=!0,u=Zh({},u);let o=Fo(),{defaultFontURL:r}=no,e=[];if(r&&e.push({label:"default",src:lc(r)}),u.font&&e.push({label:"user",src:lc(u.font)}),u.font=e,u.text=""+u.text,u.sdfGlyphSize=u.sdfGlyphSize||no.sdfGlyphSize,u.unicodeFontsURL=u.unicodeFontsURL||no.unicodeFontsURL,u.colorRanges!=null){let d={};for(let g in u.colorRanges)if(u.colorRanges.hasOwnProperty(g)){let y=u.colorRanges[g];typeof y!="number"&&(y=Wh.set(y).getHex()),d[g]=y}u.colorRanges=d}Object.freeze(u);let{textureWidth:n,sdfExponent:i}=no,{sdfGlyphSize:s}=u,l=n/s*4,c=ac[s];if(!c){let d=document.createElement("canvas");d.width=n,d.height=s*256/l,c=ac[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:d,sdfTexture:new he.Texture(d,void 0,void 0,void 0,he.LinearFilter,he.LinearFilter),contextLost:!1,glyphsByFont:new Map},c.sdfTexture.generateMipmaps=!1,qh(c)}let{sdfTexture:a,sdfCanvas:f}=c;(no.useWorker?yc:$h)(u).then(d=>{let{glyphIds:g,glyphFontIndices:y,fontData:b,glyphPositions:v,fontSize:w,timings:T}=d,x=[],E=new Float32Array(g.length*4),O=0,A=0,k=Fo(),M=b.map(m=>{let L=c.glyphsByFont.get(m.src);return L||c.glyphsByFont.set(m.src,L=new Map),L});g.forEach((m,L)=>{let D=y[L],{src:Y,unitsPerEm:J}=b[D],j=M[D].get(m);if(!j){let{path:G,pathBounds:B}=d.glyphData[Y][m],W=Math.max(B[2]-B[0],B[3]-B[1])/s*(no.sdfMargin*s+.5),K=c.glyphCount++,Z=[B[0]-W,B[1]-W,B[2]+W,B[3]+W];M[D].set(m,j={path:G,atlasIndex:K,sdfViewBox:Z}),x.push(j)}let{sdfViewBox:H}=j,R=v[A++],P=v[A++],U=w/J;E[O++]=R+H[0]*U,E[O++]=P+H[1]*U,E[O++]=R+H[2]*U,E[O++]=P+H[3]*U,g[L]=j.atlasIndex}),T.quads=(T.quads||0)+(Fo()-k);let F=Fo();T.sdf={};let I=f.height,C=Math.ceil(c.glyphCount/l),S=Math.pow(2,Math.ceil(Math.log2(C*s)));S>I&&(console.info(`Increasing SDF texture size ${I}->${S}`),zh(f,n,S),a.dispose()),Promise.all(x.map(m=>mc(m,c,u.gpuAccelerateSDF).then(({timing:L})=>{T.sdf[m.atlasIndex]=L}))).then(()=>{x.length&&!c.contextLost&&(bc(c),a.needsUpdate=!0),T.sdfTotal=Fo()-F,T.total=Fo()-o,t(Object.freeze({parameters:u,sdfTexture:a,sdfGlyphSize:s,sdfExponent:i,glyphBounds:E,glyphAtlasIndices:g,glyphColors:d.glyphColors,caretPositions:d.caretPositions,chunkedBounds:d.chunkedBounds,ascender:d.ascender,descender:d.descender,lineHeight:d.lineHeight,capHeight:d.capHeight,xHeight:d.xHeight,topBaseline:d.topBaseline,blockBounds:d.blockBounds,visibleBounds:d.visibleBounds,timings:d.timings}))})}),Promise.resolve().then(()=>{c.contextLost||jh(f)})}function mc({path:u,atlasIndex:t,sdfViewBox:o},{sdfGlyphSize:r,sdfCanvas:e,contextLost:n},i){if(n)return Promise.resolve({timing:-1});let{textureWidth:s,sdfExponent:l}=no,c=Math.max(o[2]-o[0],o[3]-o[1]),a=Math.floor(t/4),f=a%(s/r)*r,h=Math.floor(a/(s/r))*r,d=t%4;return Bh(r,r,u,o,c,l,e,f,h,d,i)}function qh(u){let t=u.sdfCanvas;t.addEventListener("webglcontextlost",o=>{console.log("Context Lost",o),o.preventDefault(),u.contextLost=!0}),t.addEventListener("webglcontextrestored",o=>{console.log("Context Restored",o),u.contextLost=!1;let r=[];u.glyphsByFont.forEach(e=>{e.forEach(n=>{r.push(mc(n,u,!0))})}),Promise.all(r).then(()=>{bc(u),u.sdfTexture.needsUpdate=!0})})}function Zh(u,t){for(let o in t)t.hasOwnProperty(o)&&(u[o]=t[o]);return u}var Br;function lc(u){return Br||(Br=typeof document>"u"?{}:document.createElement("a")),Br.href=u,Br.href}function bc(u){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");let{sdfCanvas:t,sdfTexture:o}=u,{width:r,height:e}=t,n=u.sdfCanvas.getContext("webgl"),i=o.image.data;(!i||i.length!==r*e*4)&&(i=new Uint8Array(r*e*4),o.image={width:r,height:e,data:i},o.flipY=!1,o.isDataTexture=!0),n.readPixels(0,0,r,e,n.RGBA,n.UNSIGNED_BYTE,i)}}var Yh=eo({name:"Typesetter",dependencies:[Uh,Ph,Ql],init(u,t,o){return u(t,o())}}),yc=eo({name:"Typesetter",dependencies:[Yh],init(u){return function(t){return new Promise(o=>{u.typeset(t,o)})}},getTransferables(u){let t=[];for(let o in u)u[o]&&u[o].buffer&&t.push(u[o].buffer);return t}}),$h=yc.onMainThread;var cc={};function Jh(u){let t=cc[u];return t||(t=cc[u]=new he.PlaneGeometry(1,1,u,u).translate(.5,.5,0)),t}var Hr="aTroikaGlyphBounds",Oi="aTroikaGlyphIndex",Qh="aTroikaGlyphColor",oa=class extends he.InstancedBufferGeometry{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 he.Sphere,this.boundingBox=new he.Box3}computeBoundingSphere(){}computeBoundingBox(){}set detail(t){if(t!==this._detail){this._detail=t,(typeof t!="number"||t<1)&&(t=1);let o=Jh(t);["position","normal","uv"].forEach(r=>{this.attributes[r]=o.attributes[r].clone()}),this.setIndex(o.getIndex().clone())}}get detail(){return this._detail}set curveRadius(t){t!==this._curveRadius&&(this._curveRadius=t,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(t,o,r,e,n){this.updateAttributeData(Hr,t,4),this.updateAttributeData(Oi,o,1),this.updateAttributeData(Qh,n,3),this._blockBounds=r,this._chunkedBounds=e,this.instanceCount=o.length,this._updateBounds()}_updateBounds(){let t=this._blockBounds;if(t){let{curveRadius:o,boundingBox:r}=this;if(o){let{PI:e,floor:n,min:i,max:s,sin:l,cos:c}=Math,a=e/2,f=e*2,h=Math.abs(o),d=t[0]/h,g=t[2]/h,y=n((d+a)/f)!==n((g+a)/f)?-h:i(l(d)*h,l(g)*h),b=n((d-a)/f)!==n((g-a)/f)?h:s(l(d)*h,l(g)*h),v=n((d+e)/f)!==n((g+e)/f)?h*2:s(h-c(d)*h,h-c(g)*h);r.min.set(y,t[1],o<0?-v:0),r.max.set(b,t[3],o<0?0:v)}else r.min.set(t[0],t[1],0),r.max.set(t[2],t[3],0);r.getBoundingSphere(this.boundingSphere)}}applyClipRect(t){let o=this.getAttribute(Oi).count,r=this._chunkedBounds;if(r)for(let e=r.length;e--;){o=r[e].end;let n=r[e].rect;if(n[1]<t.w&&n[3]>t.y&&n[0]<t.z&&n[2]>t.x)break}this.instanceCount=o}updateAttributeData(t,o,r){let e=this.getAttribute(t);o?e&&e.array.length===o.length?(e.array.set(o),e.needsUpdate=!0):(this.setAttribute(t,new he.InstancedBufferAttribute(o,r)),delete this._maxInstanceCount,this.dispose()):e&&this.deleteAttribute(t)}},ed=`
|
|
45
|
+
uniform vec2 uTroikaSDFTextureSize;
|
|
46
|
+
uniform float uTroikaSDFGlyphSize;
|
|
47
|
+
uniform vec4 uTroikaTotalBounds;
|
|
48
|
+
uniform vec4 uTroikaClipRect;
|
|
49
|
+
uniform mat3 uTroikaOrient;
|
|
50
|
+
uniform bool uTroikaUseGlyphColors;
|
|
51
|
+
uniform float uTroikaEdgeOffset;
|
|
52
|
+
uniform float uTroikaBlurRadius;
|
|
53
|
+
uniform vec2 uTroikaPositionOffset;
|
|
54
|
+
uniform float uTroikaCurveRadius;
|
|
55
|
+
attribute vec4 aTroikaGlyphBounds;
|
|
56
|
+
attribute float aTroikaGlyphIndex;
|
|
57
|
+
attribute vec3 aTroikaGlyphColor;
|
|
58
|
+
varying vec2 vTroikaGlyphUV;
|
|
59
|
+
varying vec4 vTroikaTextureUVBounds;
|
|
60
|
+
varying float vTroikaTextureChannel;
|
|
61
|
+
varying vec3 vTroikaGlyphColor;
|
|
62
|
+
varying vec2 vTroikaGlyphDimensions;
|
|
63
|
+
`,td=`
|
|
64
|
+
vec4 bounds = aTroikaGlyphBounds;
|
|
65
|
+
bounds.xz += uTroikaPositionOffset.x;
|
|
66
|
+
bounds.yw -= uTroikaPositionOffset.y;
|
|
67
|
+
|
|
68
|
+
vec4 outlineBounds = vec4(
|
|
69
|
+
bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,
|
|
70
|
+
bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius
|
|
71
|
+
);
|
|
72
|
+
vec4 clippedBounds = vec4(
|
|
73
|
+
clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),
|
|
74
|
+
clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);
|
|
78
|
+
|
|
79
|
+
position.xy = mix(bounds.xy, bounds.zw, clippedXY);
|
|
80
|
+
|
|
81
|
+
uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);
|
|
82
|
+
|
|
83
|
+
float rad = uTroikaCurveRadius;
|
|
84
|
+
if (rad != 0.0) {
|
|
85
|
+
float angle = position.x / rad;
|
|
86
|
+
position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);
|
|
87
|
+
normal.xz = vec2(sin(angle), cos(angle));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
position = uTroikaOrient * position;
|
|
91
|
+
normal = uTroikaOrient * normal;
|
|
92
|
+
|
|
93
|
+
vTroikaGlyphUV = clippedXY.xy;
|
|
94
|
+
vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;
|
|
98
|
+
vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;
|
|
99
|
+
vec2 txStartUV = txUvPerSquare * vec2(
|
|
100
|
+
mod(floor(aTroikaGlyphIndex / 4.0), txCols),
|
|
101
|
+
floor(floor(aTroikaGlyphIndex / 4.0) / txCols)
|
|
102
|
+
);
|
|
103
|
+
vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);
|
|
104
|
+
vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);
|
|
105
|
+
`,nd=`
|
|
106
|
+
uniform sampler2D uTroikaSDFTexture;
|
|
107
|
+
uniform vec2 uTroikaSDFTextureSize;
|
|
108
|
+
uniform float uTroikaSDFGlyphSize;
|
|
109
|
+
uniform float uTroikaSDFExponent;
|
|
110
|
+
uniform float uTroikaEdgeOffset;
|
|
111
|
+
uniform float uTroikaFillOpacity;
|
|
112
|
+
uniform float uTroikaBlurRadius;
|
|
113
|
+
uniform vec3 uTroikaStrokeColor;
|
|
114
|
+
uniform float uTroikaStrokeWidth;
|
|
115
|
+
uniform float uTroikaStrokeOpacity;
|
|
116
|
+
uniform bool uTroikaSDFDebug;
|
|
117
|
+
varying vec2 vTroikaGlyphUV;
|
|
118
|
+
varying vec4 vTroikaTextureUVBounds;
|
|
119
|
+
varying float vTroikaTextureChannel;
|
|
120
|
+
varying vec2 vTroikaGlyphDimensions;
|
|
121
|
+
|
|
122
|
+
float troikaSdfValueToSignedDistance(float alpha) {
|
|
123
|
+
// Inverse of exponential encoding in webgl-sdf-generator
|
|
124
|
+
|
|
125
|
+
float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);
|
|
126
|
+
float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;
|
|
127
|
+
float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);
|
|
128
|
+
return signedDist;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
float troikaGlyphUvToSdfValue(vec2 glyphUV) {
|
|
132
|
+
vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);
|
|
133
|
+
vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);
|
|
134
|
+
float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1
|
|
135
|
+
return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
float troikaGlyphUvToDistance(vec2 uv) {
|
|
139
|
+
return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
float troikaGetAADist() {
|
|
143
|
+
|
|
144
|
+
#if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300
|
|
145
|
+
return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;
|
|
146
|
+
#else
|
|
147
|
+
return vTroikaGlyphDimensions.x / 64.0;
|
|
148
|
+
#endif
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
float troikaGetFragDistValue() {
|
|
152
|
+
vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);
|
|
153
|
+
float distance = troikaGlyphUvToDistance(clampedGlyphUV);
|
|
154
|
+
|
|
155
|
+
// Extrapolate distance when outside bounds:
|
|
156
|
+
distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 :
|
|
157
|
+
length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
return distance;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {
|
|
165
|
+
#if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)
|
|
166
|
+
float alpha = step(-distanceOffset, -distance);
|
|
167
|
+
#else
|
|
168
|
+
|
|
169
|
+
float alpha = smoothstep(
|
|
170
|
+
distanceOffset + aaDist,
|
|
171
|
+
distanceOffset - aaDist,
|
|
172
|
+
distance
|
|
173
|
+
);
|
|
174
|
+
#endif
|
|
175
|
+
|
|
176
|
+
return alpha;
|
|
177
|
+
}
|
|
178
|
+
`,od=`
|
|
179
|
+
float aaDist = troikaGetAADist();
|
|
180
|
+
float fragDistance = troikaGetFragDistValue();
|
|
181
|
+
float edgeAlpha = uTroikaSDFDebug ?
|
|
182
|
+
troikaGlyphUvToSdfValue(vTroikaGlyphUV) :
|
|
183
|
+
troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));
|
|
184
|
+
|
|
185
|
+
#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)
|
|
186
|
+
vec4 fillRGBA = gl_FragColor;
|
|
187
|
+
fillRGBA.a *= uTroikaFillOpacity;
|
|
188
|
+
vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);
|
|
189
|
+
if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;
|
|
190
|
+
gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(
|
|
191
|
+
-uTroikaStrokeWidth - aaDist,
|
|
192
|
+
-uTroikaStrokeWidth + aaDist,
|
|
193
|
+
fragDistance
|
|
194
|
+
));
|
|
195
|
+
gl_FragColor.a *= edgeAlpha;
|
|
196
|
+
#endif
|
|
197
|
+
|
|
198
|
+
if (edgeAlpha == 0.0) {
|
|
199
|
+
discard;
|
|
200
|
+
}
|
|
201
|
+
`;function vc(u){let t=Oo(u,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new he.Vector2},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new he.Vector4(0,0,0,0)},uTroikaClipRect:{value:new he.Vector4(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new he.Vector2},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new he.Color},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new he.Matrix3},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:ed,vertexTransform:td,fragmentDefs:nd,fragmentColorTransform:od,customRewriter({vertexShader:o,fragmentShader:r}){let e=/\buniform\s+vec3\s+diffuse\b/;return e.test(r)&&(r=r.replace(e,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),e.test(o)||(o=o.replace(Js,`uniform vec3 diffuse;
|
|
202
|
+
$&
|
|
203
|
+
vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
|
|
204
|
+
`))),{vertexShader:o,fragmentShader:r}}});return t.transparent=!0,t.forceSinglePass=!0,Object.defineProperties(t,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),t}var ra=new he.MeshBasicMaterial({color:16777215,side:he.DoubleSide,transparent:!0}),uc=8421504,fc=new he.Matrix4,Dr=new he.Vector3,Qs=new he.Vector3,Ci=[],id=new he.Vector3,ea="+x+y";function hc(u){return Array.isArray(u)?u[0]:u}var wc=()=>{let u=new he.Mesh(new he.PlaneGeometry(1,1),ra);return wc=()=>u,u},Tc=()=>{let u=new he.Mesh(new he.PlaneGeometry(1,1,32,1),ra);return Tc=()=>u,u},rd={type:"syncstart"},sd={type:"synccomplete"},xc=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],ad=xc.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail"),hn=class extends he.Mesh{constructor(){let t=new oa;super(t,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=uc,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=ea,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(t){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(t):(this._isSyncing=!0,this.dispatchEvent(rd),Xh({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},o=>{this._isSyncing=!1,this._textRenderInfo=o,this.geometry.updateGlyphs(o.glyphBounds,o.glyphAtlasIndices,o.blockBounds,o.chunkedBounds,o.glyphColors);let r=this._queuedSyncs;r&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{r.forEach(e=>e&&e())})),this.dispatchEvent(sd),t&&t()})))}onBeforeRender(t,o,r,e,n,i){this.sync(),n.isTroikaTextMaterial&&this._prepareForRender(n)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(t){return vc(t)}get material(){let t=this._derivedMaterial,o=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=ra.clone());if((!t||!t.isDerivedFrom(o))&&(t=this._derivedMaterial=this.createDerivedMaterial(o),o.addEventListener("dispose",function r(){o.removeEventListener("dispose",r),t.dispose()})),this.hasOutline()){let r=t._outlineMtl;return r||(r=t._outlineMtl=Object.create(t,{id:{value:t.id+.1}}),r.isTextOutlineMaterial=!0,r.depthWrite=!1,r.map=null,t.addEventListener("dispose",function e(){t.removeEventListener("dispose",e),r.dispose()})),[r,t]}else return t}set material(t){t&&t.isTroikaTextMaterial?(this._derivedMaterial=t,this._baseMaterial=t.baseMaterial):this._baseMaterial=t}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(t){this.geometry.detail=t}get curveRadius(){return this.geometry.curveRadius}set curveRadius(t){this.geometry.curveRadius=t}get customDepthMaterial(){return hc(this.material).getDepthMaterial()}set customDepthMaterial(t){}get customDistanceMaterial(){return hc(this.material).getDistanceMaterial()}set customDistanceMaterial(t){}_prepareForRender(t){let o=t.isTextOutlineMaterial,r=t.uniforms,e=this.textRenderInfo;if(e){let{sdfTexture:s,blockBounds:l}=e;r.uTroikaSDFTexture.value=s,r.uTroikaSDFTextureSize.value.set(s.image.width,s.image.height),r.uTroikaSDFGlyphSize.value=e.sdfGlyphSize,r.uTroikaSDFExponent.value=e.sdfExponent,r.uTroikaTotalBounds.value.fromArray(l),r.uTroikaUseGlyphColors.value=!o&&!!e.glyphColors;let c=0,a=0,f=0,h,d,g,y=0,b=0;if(o){let{outlineWidth:w,outlineOffsetX:T,outlineOffsetY:x,outlineBlur:E,outlineOpacity:O}=this;c=this._parsePercent(w)||0,a=Math.max(0,this._parsePercent(E)||0),h=O,y=this._parsePercent(T)||0,b=this._parsePercent(x)||0}else f=Math.max(0,this._parsePercent(this.strokeWidth)||0),f&&(g=this.strokeColor,r.uTroikaStrokeColor.value.set(g??uc),d=this.strokeOpacity,d==null&&(d=1)),h=this.fillOpacity;r.uTroikaEdgeOffset.value=c,r.uTroikaPositionOffset.value.set(y,b),r.uTroikaBlurRadius.value=a,r.uTroikaStrokeWidth.value=f,r.uTroikaStrokeOpacity.value=d,r.uTroikaFillOpacity.value=h??1,r.uTroikaCurveRadius.value=this.curveRadius||0;let v=this.clipRect;if(v&&Array.isArray(v)&&v.length===4)r.uTroikaClipRect.value.fromArray(v);else{let w=(this.fontSize||.1)*100;r.uTroikaClipRect.value.set(l[0]-w,l[1]-w,l[2]+w,l[3]+w)}this.geometry.applyClipRect(r.uTroikaClipRect.value)}r.uTroikaSDFDebug.value=!!this.debugSDF,t.polygonOffset=!!this.depthOffset,t.polygonOffsetFactor=t.polygonOffsetUnits=this.depthOffset||0;let n=o?this.outlineColor||0:this.color;if(n==null)delete t.color;else{let s=t.hasOwnProperty("color")?t.color:t.color=new he.Color;(n!==s._input||typeof n=="object")&&s.set(s._input=n)}let i=this.orientation||ea;if(i!==t._orientation){let s=r.uTroikaOrient.value;i=i.replace(/[^-+xyz]/g,"");let l=i!==ea&&i.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,a,f,h]=l;Dr.set(0,0,0)[a]=c==="-"?1:-1,Qs.set(0,0,0)[h]=f==="-"?-1:1,fc.lookAt(id,Dr.cross(Qs),Qs),s.setFromMatrix4(fc)}else s.identity();t._orientation=i}}_parsePercent(t){if(typeof t=="string"){let o=t.match(/^(-?[\d.]+)%$/),r=o?parseFloat(o[1]):NaN;t=(isNaN(r)?0:r/100)*this.fontSize}return t}localPositionToTextCoords(t,o=new he.Vector2){o.copy(t);let r=this.curveRadius;return r&&(o.x=Math.atan2(t.x,Math.abs(r)-Math.abs(t.z))*Math.abs(r)),o}worldPositionToTextCoords(t,o=new he.Vector2){return Dr.copy(t),this.localPositionToTextCoords(this.worldToLocal(Dr),o)}raycast(t,o){let{textRenderInfo:r,curveRadius:e}=this;if(r){let n=r.blockBounds,i=e?Tc():wc(),s=i.geometry,{position:l,uv:c}=s.attributes;for(let a=0;a<c.count;a++){let f=n[0]+c.getX(a)*(n[2]-n[0]),h=n[1]+c.getY(a)*(n[3]-n[1]),d=0;e&&(d=e-Math.cos(f/e)*e,f=Math.sin(f/e)*e),l.setXYZ(a,f,h,d)}s.boundingSphere=this.geometry.boundingSphere,s.boundingBox=this.geometry.boundingBox,i.matrixWorld=this.matrixWorld,i.material.side=this.material.side,Ci.length=0,i.raycast(t,Ci);for(let a=0;a<Ci.length;a++)Ci[a].object=this,o.push(Ci[a])}}copy(t){let o=this.geometry;return super.copy(t),this.geometry=o,ad.forEach(r=>{this[r]=t[r]}),this}clone(){return new this.constructor().copy(this)}};xc.forEach(u=>{let t="_private_"+u;Object.defineProperty(hn.prototype,u,{get(){return this[t]},set(o){o!==this[t]&&(this[t]=o,this._needsSync=!0)}})});var ld={type:"syncstart"},cd={type:"synccomplete"},Po="aTroikaTextBatchMemberIndex",ia=32,dc=new he.Box3,pc=new he.Color,Gr=class u extends hn{constructor(){super(),this._members=new Map,this._dataTextures={},this._onMemberSynced=t=>{this._members.get(t.target).dirty=!0}}add(...t){for(let o=0;o<t.length;o++)t[o]instanceof hn?this.addText(t[o]):super.add(t[o]);return this}remove(...t){for(let o=0;o<t.length;o++)t[o]instanceof hn?this.removeText(t[o]):super.remove(t[o]);return this}addText(t){this._members.has(t)||(this._members.set(t,{index:-1,glyphCount:-1,dirty:!0}),t.addEventListener("synccomplete",this._onMemberSynced))}removeText(t){this._needsRepack=!0,t.removeEventListener("synccomplete",this._onMemberSynced),this._members.delete(t)}createDerivedMaterial(t){return ud(t)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateBounds()}updateBounds(){let t=this.geometry.boundingBox.makeEmpty();this._members.forEach((o,r)=>{r.matrixAutoUpdate&&r.updateMatrix(),dc.copy(r.geometry.boundingBox).applyMatrix4(r.matrix),t.union(dc)}),t.getBoundingSphere(this.geometry.boundingSphere)}hasOutline(){for(let t of this._members.keys())if(t.hasOutline())return!0;return!1}_prepareForRender(t){let o=t.isTextOutlineMaterial;t.uniforms.uTroikaIsOutline.value=o;let r=this._dataTextures[o?"outline":"main"],e=Math.pow(2,Math.ceil(Math.log2(this._members.size*ia)));if(!r||e!==r.image.data.length){r&&r.dispose();let s=Math.min(e/4,1024);r=this._dataTextures[o?"outline":"main"]=new he.DataTexture(new Float32Array(e),s,e/4/s,he.RGBAFormat,he.FloatType)}let n=r.image.data,i=(s,l)=>{l!==n[s]&&(n[s]=l,r.needsUpdate=!0)};this._members.forEach(({index:s,dirty:l},c)=>{if(s>-1){let a=s*ia,f=c.matrix.elements;for(let A=0;A<16;A++)i(a+A,f[A]);c._prepareForRender(t);let{uTroikaTotalBounds:h,uTroikaClipRect:d,uTroikaPositionOffset:g,uTroikaEdgeOffset:y,uTroikaBlurRadius:b,uTroikaStrokeWidth:v,uTroikaStrokeColor:w,uTroikaStrokeOpacity:T,uTroikaFillOpacity:x,uTroikaCurveRadius:E}=t.uniforms;for(let A=0;A<4;A++)i(a+16+A,h.value.getComponent(A));for(let A=0;A<4;A++)i(a+20+A,d.value.getComponent(A));let O=o?c.outlineColor||0:c.color;O==null&&(O=this.color),O==null&&(O=this.material.color),O==null&&(O=16777215),i(a+24,pc.set(O).getHex()),i(a+25,x.value),i(a+26,E.value),o?(i(a+28,g.value.x),i(a+29,g.value.y),i(a+30,y.value),i(a+31,b.value)):(i(a+28,v.value),i(a+29,pc.set(w.value).getHex()),i(a+30,T.value))}}),t.setMatrixTexture(r),super._prepareForRender(t)}sync(t){let o=this._needsRepack?[]:null;this._needsRepack=!1,this._members.forEach((r,e)=>{(r.dirty||e._needsSync)&&(r.dirty=!1,(o||(o=[])).push(new Promise(n=>{e._needsSync?e.sync(n):n()})))}),o&&(this.dispatchEvent(ld),Promise.all(o).then(()=>{let{geometry:r}=this,e=r.attributes,n=e[Po]&&e[Po].array||new Uint16Array(0),i=e[Oi]&&e[Oi].array||new Float32Array(0),s=e[Hr]&&e[Hr].array||new Float32Array(0),l=0;this._members.forEach((f,{textRenderInfo:h})=>{h&&(l+=h.glyphAtlasIndices.length,this._textRenderInfo=h)}),l!==n.length&&(n=ta(n,l),i=ta(i,l),s=ta(s,l*4));let c=0,a=0;this._members.forEach((f,{textRenderInfo:h})=>{if(h){let d=h.glyphAtlasIndices.length;n.fill(c,a,a+d),i.set(h.glyphAtlasIndices,a,a+d),s.set(h.glyphBounds,a*4,(a+d)*4),a+=d,f.index=c++}}),r.updateAttributeData(Po,n,1),r.getAttribute(Po).setUsage(he.DynamicDrawUsage),r.updateAttributeData(Oi,i,1),r.updateAttributeData(Hr,s,4),this.updateBounds(),this.dispatchEvent(cd),t&&t()}))}copy(t){return t instanceof u&&(super.copy(t),this._members.forEach((o,r)=>this.removeText(r)),t._members.forEach((o,r)=>this.addText(r))),this}dispose(){super.dispose(),Object.values(this._dataTextures).forEach(t=>t.dispose())}};function ta(u,t){let o=new u.constructor(t);return o.set(u.subarray(0,t)),o}function ud(u){let t="uTroikaMatricesTexture",o="uTroikaMatricesTextureSize",r=Oo(u,{chained:!0,uniforms:{[o]:{value:new he.Vector2},[t]:{value:null}},vertexDefs:`
|
|
205
|
+
uniform highp sampler2D ${t};
|
|
206
|
+
uniform vec2 ${o};
|
|
207
|
+
attribute float ${Po};
|
|
208
|
+
|
|
209
|
+
vec4 troikaBatchTexel(float offset) {
|
|
210
|
+
offset += ${Po} * ${ia.toFixed(1)} / 4.0;
|
|
211
|
+
float w = ${o}.x;
|
|
212
|
+
vec2 uv = (vec2(mod(offset, w), floor(offset / w)) + 0.5) / ${o};
|
|
213
|
+
return texture2D(${t}, uv);
|
|
214
|
+
}
|
|
215
|
+
`,vertexTransform:`
|
|
216
|
+
mat4 matrix = mat4(
|
|
217
|
+
troikaBatchTexel(0.0),
|
|
218
|
+
troikaBatchTexel(1.0),
|
|
219
|
+
troikaBatchTexel(2.0),
|
|
220
|
+
troikaBatchTexel(3.0)
|
|
221
|
+
);
|
|
222
|
+
position.xyz = (matrix * vec4(position, 1.0)).xyz;
|
|
223
|
+
`});return r=vc(r),r=Oo(r,{chained:!0,uniforms:{uTroikaIsOutline:{value:!1}},customRewriter(e){return["uTroikaTotalBounds","uTroikaClipRect","uTroikaPositionOffset","uTroikaEdgeOffset","uTroikaBlurRadius","uTroikaStrokeWidth","uTroikaStrokeColor","uTroikaStrokeOpacity","uTroikaFillOpacity","uTroikaCurveRadius","diffuse"].forEach(i=>{e=fd(e,i)}),e},vertexDefs:`
|
|
224
|
+
uniform bool uTroikaIsOutline;
|
|
225
|
+
vec3 troikaFloatToColor(float v) {
|
|
226
|
+
return mod(floor(vec3(v / 65536.0, v / 256.0, v)), 256.0) / 256.0;
|
|
227
|
+
}
|
|
228
|
+
`,vertexTransform:`
|
|
229
|
+
uTroikaTotalBounds = troikaBatchTexel(4.0);
|
|
230
|
+
uTroikaClipRect = troikaBatchTexel(5.0);
|
|
231
|
+
|
|
232
|
+
vec4 data = troikaBatchTexel(6.0);
|
|
233
|
+
diffuse = troikaFloatToColor(data.x);
|
|
234
|
+
uTroikaFillOpacity = data.y;
|
|
235
|
+
uTroikaCurveRadius = data.z;
|
|
236
|
+
|
|
237
|
+
data = troikaBatchTexel(7.0);
|
|
238
|
+
if (uTroikaIsOutline) {
|
|
239
|
+
if (data == vec4(0.0)) { // degenerate if zero outline
|
|
240
|
+
position = vec3(0.0);
|
|
241
|
+
} else {
|
|
242
|
+
uTroikaPositionOffset = data.xy;
|
|
243
|
+
uTroikaEdgeOffset = data.z;
|
|
244
|
+
uTroikaBlurRadius = data.w;
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
uTroikaStrokeWidth = data.x;
|
|
248
|
+
uTroikaStrokeColor = troikaFloatToColor(data.y);
|
|
249
|
+
uTroikaStrokeOpacity = data.z;
|
|
250
|
+
}
|
|
251
|
+
`}),r.setMatrixTexture=e=>{r.uniforms[t].value=e,r.uniforms[o].value.set(e.image.width,e.image.height)},r}function fd({vertexShader:u,fragmentShader:t},o,r=o){let e=new RegExp(`uniform\\s+(bool|float|vec[234]|mat[34])\\s+${o}\\b`),n,i=!1;t=t.replace(e,(l,c)=>(i=!0,`varying ${n=c} ${r}`));let s=!1;return u=u.replace(e,(l,c)=>(s=!0,`${i?"varying":""} ${n=c} ${r}`)),s||(u=`${i?"varying":""} ${n} ${r};
|
|
252
|
+
${u}`),{vertexShader:u,fragmentShader:t}}function Sc(u,t){u.color=t,u.fontWeight="bold",u.outlineWidth=0,u.anchorX="center",u.anchorY="middle",u.textAlign="center"}function Ac(u,t){let o=new hn;o.text=u.text,o.fontSize=u.fontSize,Sc(o,u.color??0),o.position.set(u.x,u.y,u.z);let r=u.baseRotation??0;return o.rotation.z=r,o.sync(t),{object:o,setFlip(e){o.rotation.z=r+(e?Math.PI:0)},dispose(){o.dispose()}}}function Ec(u,t){let o=u.base+t,r=-Math.sin(o),e=Math.cos(o);u.mesh.position.set(u.x+r*u.off,u.y+e*u.off,u.z),u.mesh.rotation.z=o}function Mc(u,t,o){let r=new Gr,e=[];for(let l of u){if(l.logoUrl)continue;let c=new hn;c.text=l.text,c.fontSize=l.fontSize,Sc(c,t),c.position.set(l.x,l.y,l.z),c.rotation.z=l.baseRotation,r.add(c),e.push({text:c,base:l.baseRotation})}r.sync(o);let n=new Dt.Group;n.add(r);let i=[],s=new Dt.TextureLoader;s.setCrossOrigin("anonymous");for(let l of u){if(!l.logoUrl)continue;let c=l.logoBoxW??5*l.fontSize,a=l.logoBoxH??1.5*l.fontSize,f=0,h=new Dt.MeshBasicMaterial({transparent:!0,opacity:0,depthWrite:!1}),d=new Dt.Mesh(new Dt.PlaneGeometry(1,1),h),g={mesh:d,x:l.x,y:l.y,z:l.z+.03,base:l.baseRotation,off:f};Ec(g,0),s.load(l.logoUrl,y=>{y.colorSpace=Dt.SRGBColorSpace;let b=y.image,v=Math.max(.05,(b.width??1)/Math.max(1,b.height??1)),w=Math.min(a,c/v);d.scale.set(w*v,w,1),h.map=y,h.opacity=1,h.needsUpdate=!0,o?.()},void 0,()=>{}),n.add(d),i.push(g)}return{object:n,setFlip(l){let c=l?Math.PI:0;for(let{text:a,base:f}of e)a.rotation.z=f+c;for(let a of i)Ec(a,c)},dispose(){r.dispose();for(let{mesh:l}of i){l.geometry.dispose();let c=l.material;c.map?.dispose(),c.dispose()}}}}function sa(u,t){let o=u%360;return o>180&&(o-=360),o<=-180&&(o+=360),t?Math.abs(o)>85:Math.abs(o)>95}var bt=gt(Ft(),1);var hd=1;function dd(u){let t=0,o=0;for(let r=0;r<u.length;r++){let e=u[r],n=u[(r+1)%u.length];!e||!n||(t+=e[0]*n[1]-n[0]*e[1],o+=Math.hypot(n[0]-e[0],n[1]-e[1]))}return o>0?Math.abs(t)/o:0}function pd(u){let t=Ii(u),o=t+Math.PI/2;for(;o>Math.PI/2;)o-=Math.PI;for(;o<=-Math.PI/2;)o+=Math.PI;return Math.abs(t)<=Math.abs(o)?t:o}var kc=2.6,Rc=2.2,gd=2.6,Oc="#5b6470",Ic="#ffffff";function md(u){let t=u.toLowerCase();return t.includes("escalator")||t.includes("stair")||t.includes("elevator")||t.includes("lift")||t.includes("travelator")||t.includes("walkway")||t.includes("ramp")}function bd(u){let t=u.toLowerCase();return t.includes("escalator")?"escalator":t.includes("stair")?"stairs":t.includes("elevator")||t.includes("lift")?"elevator":t.includes("restroom")||t.includes("washroom")||t.includes("toilet")?"restroom":t.includes("information")?"info":"default"}function _c(u){u.beginPath(),u.moveTo(36,90),u.lineTo(52,90),u.lineTo(52,74),u.lineTo(68,74),u.lineTo(68,58),u.lineTo(84,58),u.lineTo(84,42),u.lineTo(94,42),u.stroke()}var Lc=new Map;function Fc(u){let t=Lc.get(u);if(t)return t;let o=document.createElement("canvas");o.width=128,o.height=128;let r=o.getContext("2d");if(r)switch(r.beginPath(),r.arc(64,64,56,0,Math.PI*2),r.fillStyle=Oc,r.fill(),r.lineWidth=7,r.strokeStyle="rgba(255,255,255,0.95)",r.stroke(),r.strokeStyle=Ic,r.fillStyle=Ic,r.lineWidth=9,r.lineCap="round",r.lineJoin="round",r.textAlign="center",r.textBaseline="middle",u){case"stairs":_c(r);break;case"escalator":{_c(r),r.beginPath(),r.moveTo(40,62),r.lineTo(74,28),r.stroke(),r.beginPath(),r.moveTo(58,26),r.lineTo(78,24),r.lineTo(76,44),r.closePath(),r.fill();break}case"elevator":{r.lineWidth=8,r.strokeRect(38,34,52,60),r.beginPath(),r.moveTo(64,44),r.lineTo(52,58),r.lineTo(76,58),r.closePath(),r.fill(),r.beginPath(),r.moveTo(64,84),r.lineTo(52,70),r.lineTo(76,70),r.closePath(),r.fill();break}case"restroom":r.font="bold 44px system-ui, sans-serif",r.fillText("WC",64,66);break;case"info":r.font="bold italic 72px Georgia, serif",r.fillText("i",64,66);break;default:r.beginPath(),r.arc(64,64,14,0,Math.PI*2),r.fill()}let e=new bt.CanvasTexture(o);return e.colorSpace=bt.SRGBColorSpace,e.anisotropy=4,Lc.set(u,e),e}var Cc=new Map;function yd(u,t,o,r){let e=`${u}|${t}`,n=Cc.get(e);if(n)return n;let i=document.createElement("canvas");i.width=128,i.height=128;let s=i.getContext("2d"),l=new bt.CanvasTexture(i);l.colorSpace=bt.SRGBColorSpace,l.anisotropy=4;let c=()=>{s&&(s.clearRect(0,0,128,128),s.beginPath(),s.arc(64,64,56,0,Math.PI*2),s.fillStyle=t,s.fill(),s.lineWidth=7,s.strokeStyle="rgba(255,255,255,0.95)",s.stroke())};c();let a=new Image;return a.crossOrigin="anonymous",a.onload=()=>{s&&(c(),s.drawImage(a,32,32,64,64),l.needsUpdate=!0,r?.())},a.onerror=()=>{let f=Fc(o).image;s&&s.drawImage(f,0,0),l.needsUpdate=!0,r?.()},a.src=u,Cc.set(e,l),l}function Pc(u,t,o={},r){let e=new Map(t.nodes.map(f=>[f.id,f])),n=new Map(t.shapes.map(f=>[f.id,f])),i=new bt.Group,s=[],l=[],c=new bt.PlaneGeometry(1,1),a=new bt.PlaneGeometry(1,1);for(let f of t.locations){if(!f.amenity||f.hidden)continue;let h,d,g=$e+.16,y=0,b=f.shapeId?n.get(f.shapeId):void 0;if(b&&b.geometry.type==="Polygon"&&b.geometry.coordinates[0]){let A=b.geometry.coordinates[0].map(F=>Rn(u,F));[h,d]=Xt(A),y=pd(A);let k=Ks(b),M=.1;k==="unit"&&(M=dd(A)<hd?.12:Xs(b,k)),g=$e+M+.12}else if(f.nodeId){let A=e.get(f.nodeId);A&&([h,d]=Rn(u,[A.lng,A.lat]))}if(h===void 0||d===void 0)continue;let v=f.categories[0],w=v?.icon??o[f.amenity.toUpperCase()],T=v?.colorHex??Oc,x=bd(f.amenity),E=new bt.MeshBasicMaterial({map:w?yd(w,T,x,r):Fc(x),transparent:!0,depthWrite:!1});if(md(f.amenity)){let A=new bt.Mesh(a,E);A.scale.set(Rc,Rc,1),A.position.set(h,d,g+gd),A.renderOrder=6,A.frustumCulled=!1,i.add(A),l.push(A);continue}let O=new bt.Mesh(c,E);O.scale.set(kc,kc,1),O.position.set(h,d,g),O.rotation.z=y,i.add(O),s.push({mesh:O,base:y})}return!s.length&&!l.length?(c.dispose(),a.dispose(),null):{object:i,setFlip(f){let h=f?Math.PI:0;for(let d of s)d.mesh.rotation.z=d.base+h},setCameraView(f,h){let d=h*Math.PI/180,g=-f*Math.PI/180;for(let y of l)y.rotation.set(d,0,g,"ZXY")},dispose(){c.dispose(),a.dispose();for(let f of s)f.mesh.material.dispose();for(let f of l)f.material.dispose()}}}var tn=gt(Ft(),1);var _=gt(Ft(),1);var jr=class extends _.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(o){return new da(o)}),this.register(function(o){return new pa(o)}),this.register(function(o){return new Ea(o)}),this.register(function(o){return new Sa(o)}),this.register(function(o){return new Aa(o)}),this.register(function(o){return new ma(o)}),this.register(function(o){return new ba(o)}),this.register(function(o){return new ya(o)}),this.register(function(o){return new va(o)}),this.register(function(o){return new ha(o)}),this.register(function(o){return new wa(o)}),this.register(function(o){return new ga(o)}),this.register(function(o){return new xa(o)}),this.register(function(o){return new Ta(o)}),this.register(function(o){return new ua(o)}),this.register(function(o){return new Ma(o)}),this.register(function(o){return new ka(o)})}load(t,o,r,e){let n=this,i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){let c=_.LoaderUtils.extractUrlBase(t);i=_.LoaderUtils.resolveURL(c,this.path)}else i=_.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);let s=function(c){e?e(c):console.error(c),n.manager.itemError(t),n.manager.itemEnd(t)},l=new _.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,function(c){try{n.parse(c,i,function(a){o(a),n.manager.itemEnd(t)},s)}catch(a){s(a)}},r,s)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,o,r,e){let n,i={},s={},l=new TextDecoder;if(typeof t=="string")n=JSON.parse(t);else if(t instanceof ArrayBuffer)if(l.decode(new Uint8Array(t,0,4))===Hc){try{i[Be.KHR_BINARY_GLTF]=new Ra(t)}catch(f){e&&e(f);return}n=JSON.parse(i[Be.KHR_BINARY_GLTF].content)}else n=JSON.parse(l.decode(t));else n=t;if(n.asset===void 0||n.asset.version[0]<2){e&&e(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let c=new Pa(n,{path:o||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let a=0;a<this.pluginCallbacks.length;a++){let f=this.pluginCallbacks[a](c);f.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),s[f.name]=f,i[f.name]=!0}if(n.extensionsUsed)for(let a=0;a<n.extensionsUsed.length;++a){let f=n.extensionsUsed[a],h=n.extensionsRequired||[];switch(f){case Be.KHR_MATERIALS_UNLIT:i[f]=new fa;break;case Be.KHR_DRACO_MESH_COMPRESSION:i[f]=new Ia(n,this.dracoLoader);break;case Be.KHR_TEXTURE_TRANSFORM:i[f]=new _a;break;case Be.KHR_MESH_QUANTIZATION:i[f]=new La;break;default:h.indexOf(f)>=0&&s[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(i),c.setPlugins(s),c.parse(r,e)}parseAsync(t,o){let r=this;return new Promise(function(e,n){r.parse(t,o,e,n)})}};function vd(){let u={};return{get:function(t){return u[t]},add:function(t,o){u[t]=o},remove:function(t){delete u[t]},removeAll:function(){u={}}}}var Be={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},ua=class{constructor(t){this.parser=t,this.name=Be.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let t=this.parser,o=this.parser.json.nodes||[];for(let r=0,e=o.length;r<e;r++){let n=o[r];n.extensions&&n.extensions[this.name]&&n.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,n.extensions[this.name].light)}}_loadLight(t){let o=this.parser,r="light:"+t,e=o.cache.get(r);if(e)return e;let n=o.json,l=((n.extensions&&n.extensions[this.name]||{}).lights||[])[t],c,a=new _.Color(16777215);l.color!==void 0&&a.setRGB(l.color[0],l.color[1],l.color[2],_.LinearSRGBColorSpace);let f=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new _.DirectionalLight(a),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new _.PointLight(a),c.distance=f;break;case"spot":c=new _.SpotLight(a),c.distance=f,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,dn(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=o.createUniqueName(l.name||"light_"+t),e=Promise.resolve(c),o.cache.add(r,e),e}getDependency(t,o){if(t==="light")return this._loadLight(o)}createNodeAttachment(t){let o=this,r=this.parser,n=r.json.nodes[t],s=(n.extensions&&n.extensions[this.name]||{}).light;return s===void 0?null:this._loadLight(s).then(function(l){return r._getNodeRef(o.cache,s,l)})}},fa=class{constructor(){this.name=Be.KHR_MATERIALS_UNLIT}getMaterialType(){return _.MeshBasicMaterial}extendParams(t,o,r){let e=[];t.color=new _.Color(1,1,1),t.opacity=1;let n=o.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){let i=n.baseColorFactor;t.color.setRGB(i[0],i[1],i[2],_.LinearSRGBColorSpace),t.opacity=i[3]}n.baseColorTexture!==void 0&&e.push(r.assignTexture(t,"map",n.baseColorTexture,_.SRGBColorSpace))}return Promise.all(e)}},ha=class{constructor(t){this.parser=t,this.name=Be.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,o){let e=this.parser.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=e.extensions[this.name].emissiveStrength;return n!==void 0&&(o.emissiveIntensity=n),Promise.resolve()}},da=class{constructor(t){this.parser=t,this.name=Be.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:_.MeshPhysicalMaterial}extendMaterialParams(t,o){let r=this.parser,e=r.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=[],i=e.extensions[this.name];if(i.clearcoatFactor!==void 0&&(o.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&n.push(r.assignTexture(o,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(o.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&n.push(r.assignTexture(o,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(n.push(r.assignTexture(o,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){let s=i.clearcoatNormalTexture.scale;o.clearcoatNormalScale=new _.Vector2(s,s)}return Promise.all(n)}},pa=class{constructor(t){this.parser=t,this.name=Be.KHR_MATERIALS_DISPERSION}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:_.MeshPhysicalMaterial}extendMaterialParams(t,o){let e=this.parser.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=e.extensions[this.name];return o.dispersion=n.dispersion!==void 0?n.dispersion:0,Promise.resolve()}},ga=class{constructor(t){this.parser=t,this.name=Be.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:_.MeshPhysicalMaterial}extendMaterialParams(t,o){let r=this.parser,e=r.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=[],i=e.extensions[this.name];return i.iridescenceFactor!==void 0&&(o.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&n.push(r.assignTexture(o,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(o.iridescenceIOR=i.iridescenceIor),o.iridescenceThicknessRange===void 0&&(o.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(o.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(o.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&n.push(r.assignTexture(o,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(n)}},ma=class{constructor(t){this.parser=t,this.name=Be.KHR_MATERIALS_SHEEN}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:_.MeshPhysicalMaterial}extendMaterialParams(t,o){let r=this.parser,e=r.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=[];o.sheenColor=new _.Color(0,0,0),o.sheenRoughness=0,o.sheen=1;let i=e.extensions[this.name];if(i.sheenColorFactor!==void 0){let s=i.sheenColorFactor;o.sheenColor.setRGB(s[0],s[1],s[2],_.LinearSRGBColorSpace)}return i.sheenRoughnessFactor!==void 0&&(o.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&n.push(r.assignTexture(o,"sheenColorMap",i.sheenColorTexture,_.SRGBColorSpace)),i.sheenRoughnessTexture!==void 0&&n.push(r.assignTexture(o,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(n)}},ba=class{constructor(t){this.parser=t,this.name=Be.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:_.MeshPhysicalMaterial}extendMaterialParams(t,o){let r=this.parser,e=r.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=[],i=e.extensions[this.name];return i.transmissionFactor!==void 0&&(o.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&n.push(r.assignTexture(o,"transmissionMap",i.transmissionTexture)),Promise.all(n)}},ya=class{constructor(t){this.parser=t,this.name=Be.KHR_MATERIALS_VOLUME}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:_.MeshPhysicalMaterial}extendMaterialParams(t,o){let r=this.parser,e=r.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=[],i=e.extensions[this.name];o.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&n.push(r.assignTexture(o,"thicknessMap",i.thicknessTexture)),o.attenuationDistance=i.attenuationDistance||1/0;let s=i.attenuationColor||[1,1,1];return o.attenuationColor=new _.Color().setRGB(s[0],s[1],s[2],_.LinearSRGBColorSpace),Promise.all(n)}},va=class{constructor(t){this.parser=t,this.name=Be.KHR_MATERIALS_IOR}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:_.MeshPhysicalMaterial}extendMaterialParams(t,o){let e=this.parser.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=e.extensions[this.name];return o.ior=n.ior!==void 0?n.ior:1.5,Promise.resolve()}},wa=class{constructor(t){this.parser=t,this.name=Be.KHR_MATERIALS_SPECULAR}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:_.MeshPhysicalMaterial}extendMaterialParams(t,o){let r=this.parser,e=r.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=[],i=e.extensions[this.name];o.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&n.push(r.assignTexture(o,"specularIntensityMap",i.specularTexture));let s=i.specularColorFactor||[1,1,1];return o.specularColor=new _.Color().setRGB(s[0],s[1],s[2],_.LinearSRGBColorSpace),i.specularColorTexture!==void 0&&n.push(r.assignTexture(o,"specularColorMap",i.specularColorTexture,_.SRGBColorSpace)),Promise.all(n)}},Ta=class{constructor(t){this.parser=t,this.name=Be.EXT_MATERIALS_BUMP}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:_.MeshPhysicalMaterial}extendMaterialParams(t,o){let r=this.parser,e=r.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=[],i=e.extensions[this.name];return o.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&n.push(r.assignTexture(o,"bumpMap",i.bumpTexture)),Promise.all(n)}},xa=class{constructor(t){this.parser=t,this.name=Be.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:_.MeshPhysicalMaterial}extendMaterialParams(t,o){let r=this.parser,e=r.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();let n=[],i=e.extensions[this.name];return i.anisotropyStrength!==void 0&&(o.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(o.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&n.push(r.assignTexture(o,"anisotropyMap",i.anisotropyTexture)),Promise.all(n)}},Ea=class{constructor(t){this.parser=t,this.name=Be.KHR_TEXTURE_BASISU}loadTexture(t){let o=this.parser,r=o.json,e=r.textures[t];if(!e.extensions||!e.extensions[this.name])return null;let n=e.extensions[this.name],i=o.options.ktx2Loader;if(!i){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return o.loadTextureImage(t,n.source,i)}},Sa=class{constructor(t){this.parser=t,this.name=Be.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){let o=this.name,r=this.parser,e=r.json,n=e.textures[t];if(!n.extensions||!n.extensions[o])return null;let i=n.extensions[o],s=e.images[i.source],l=r.textureLoader;if(s.uri){let c=r.options.manager.getHandler(s.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(t,i.source,l);if(e.extensionsRequired&&e.extensionsRequired.indexOf(o)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){let o=new Image;o.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",o.onload=o.onerror=function(){t(o.height===1)}})),this.isSupported}},Aa=class{constructor(t){this.parser=t,this.name=Be.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){let o=this.name,r=this.parser,e=r.json,n=e.textures[t];if(!n.extensions||!n.extensions[o])return null;let i=n.extensions[o],s=e.images[i.source],l=r.textureLoader;if(s.uri){let c=r.options.manager.getHandler(s.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(t,i.source,l);if(e.extensionsRequired&&e.extensionsRequired.indexOf(o)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){let o=new Image;o.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",o.onload=o.onerror=function(){t(o.height===1)}})),this.isSupported}},Ma=class{constructor(t){this.name=Be.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){let o=this.parser.json,r=o.bufferViews[t];if(r.extensions&&r.extensions[this.name]){let e=r.extensions[this.name],n=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(o.extensionsRequired&&o.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return n.then(function(s){let l=e.byteOffset||0,c=e.byteLength||0,a=e.count,f=e.byteStride,h=new Uint8Array(s,l,c);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,f,h,e.mode,e.filter).then(function(d){return d.buffer}):i.ready.then(function(){let d=new ArrayBuffer(a*f);return i.decodeGltfBuffer(new Uint8Array(d),a,f,h,e.mode,e.filter),d})})}else return null}},ka=class{constructor(t){this.name=Be.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){let o=this.parser.json,r=o.nodes[t];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;let e=o.meshes[r.mesh];for(let c of e.primitives)if(c.mode!==Nt.TRIANGLES&&c.mode!==Nt.TRIANGLE_STRIP&&c.mode!==Nt.TRIANGLE_FAN&&c.mode!==void 0)return null;let i=r.extensions[this.name].attributes,s=[],l={};for(let c in i)s.push(this.parser.getDependency("accessor",i[c]).then(a=>(l[c]=a,l[c])));return s.length<1?null:(s.push(this.parser.createNodeMesh(t)),Promise.all(s).then(c=>{let a=c.pop(),f=a.isGroup?a.children:[a],h=c[0].count,d=[];for(let g of f){let y=new _.Matrix4,b=new _.Vector3,v=new _.Quaternion,w=new _.Vector3(1,1,1),T=new _.InstancedMesh(g.geometry,g.material,h);for(let x=0;x<h;x++)l.TRANSLATION&&b.fromBufferAttribute(l.TRANSLATION,x),l.ROTATION&&v.fromBufferAttribute(l.ROTATION,x),l.SCALE&&w.fromBufferAttribute(l.SCALE,x),T.setMatrixAt(x,y.compose(b,v,w));for(let x in l)if(x==="_COLOR_0"){let E=l[x];T.instanceColor=new _.InstancedBufferAttribute(E.array,E.itemSize,E.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&g.geometry.setAttribute(x,l[x]);_.Object3D.prototype.copy.call(T,g),this.parser.assignFinalMaterial(T),d.push(T)}return a.isGroup?(a.clear(),a.add(...d),a):d[0]}))}},Hc="glTF",Fi=12,Uc={JSON:1313821514,BIN:5130562},Ra=class{constructor(t){this.name=Be.KHR_BINARY_GLTF,this.content=null,this.body=null;let o=new DataView(t,0,Fi),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(t.slice(0,4))),version:o.getUint32(4,!0),length:o.getUint32(8,!0)},this.header.magic!==Hc)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let e=this.header.length-Fi,n=new DataView(t,Fi),i=0;for(;i<e;){let s=n.getUint32(i,!0);i+=4;let l=n.getUint32(i,!0);if(i+=4,l===Uc.JSON){let c=new Uint8Array(t,Fi+i,s);this.content=r.decode(c)}else if(l===Uc.BIN){let c=Fi+i;this.body=t.slice(c,c+s)}i+=s}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},Ia=class{constructor(t,o){if(!o)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Be.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=o,this.dracoLoader.preload()}decodePrimitive(t,o){let r=this.json,e=this.dracoLoader,n=t.extensions[this.name].bufferView,i=t.extensions[this.name].attributes,s={},l={},c={};for(let a in i){let f=Oa[a]||a.toLowerCase();s[f]=i[a]}for(let a in t.attributes){let f=Oa[a]||a.toLowerCase();if(i[a]!==void 0){let h=r.accessors[t.attributes[a]],d=Uo[h.componentType];c[f]=d.name,l[f]=h.normalized===!0}}return o.getDependency("bufferView",n).then(function(a){return new Promise(function(f,h){e.decodeDracoFile(a,function(d){for(let g in d.attributes){let y=d.attributes[g],b=l[g];b!==void 0&&(y.normalized=b)}f(d)},s,c,_.LinearSRGBColorSpace,h)})})}},_a=class{constructor(){this.name=Be.KHR_TEXTURE_TRANSFORM}extendTexture(t,o){return(o.texCoord===void 0||o.texCoord===t.channel)&&o.offset===void 0&&o.rotation===void 0&&o.scale===void 0||(t=t.clone(),o.texCoord!==void 0&&(t.channel=o.texCoord),o.offset!==void 0&&t.offset.fromArray(o.offset),o.rotation!==void 0&&(t.rotation=o.rotation),o.scale!==void 0&&t.repeat.fromArray(o.scale),t.needsUpdate=!0),t}},La=class{constructor(){this.name=Be.KHR_MESH_QUANTIZATION}},zr=class extends _.Interpolant{constructor(t,o,r,e){super(t,o,r,e)}copySampleValue_(t){let o=this.resultBuffer,r=this.sampleValues,e=this.valueSize,n=t*e*3+e;for(let i=0;i!==e;i++)o[i]=r[n+i];return o}interpolate_(t,o,r,e){let n=this.resultBuffer,i=this.sampleValues,s=this.valueSize,l=s*2,c=s*3,a=e-o,f=(r-o)/a,h=f*f,d=h*f,g=t*c,y=g-c,b=-2*d+3*h,v=d-h,w=1-b,T=v-h+f;for(let x=0;x!==s;x++){let E=i[y+x+s],O=i[y+x+l]*a,A=i[g+x+s],k=i[g+x]*a;n[x]=w*E+T*O+b*A+v*k}return n}},wd=new _.Quaternion,Ca=class extends zr{interpolate_(t,o,r,e){let n=super.interpolate_(t,o,r,e);return wd.fromArray(n).normalize().toArray(n),n}},Nt={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Uo={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Bc={9728:_.NearestFilter,9729:_.LinearFilter,9984:_.NearestMipmapNearestFilter,9985:_.LinearMipmapNearestFilter,9986:_.NearestMipmapLinearFilter,9987:_.LinearMipmapLinearFilter},Dc={33071:_.ClampToEdgeWrapping,33648:_.MirroredRepeatWrapping,10497:_.RepeatWrapping},aa={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Oa={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},In={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Td={CUBICSPLINE:void 0,LINEAR:_.InterpolateLinear,STEP:_.InterpolateDiscrete},la={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function xd(u){return u.DefaultMaterial===void 0&&(u.DefaultMaterial=new _.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:_.FrontSide})),u.DefaultMaterial}function io(u,t,o){for(let r in o.extensions)u[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=o.extensions[r])}function dn(u,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(u.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Ed(u,t,o){let r=!1,e=!1,n=!1;for(let c=0,a=t.length;c<a;c++){let f=t[c];if(f.POSITION!==void 0&&(r=!0),f.NORMAL!==void 0&&(e=!0),f.COLOR_0!==void 0&&(n=!0),r&&e&&n)break}if(!r&&!e&&!n)return Promise.resolve(u);let i=[],s=[],l=[];for(let c=0,a=t.length;c<a;c++){let f=t[c];if(r){let h=f.POSITION!==void 0?o.getDependency("accessor",f.POSITION):u.attributes.position;i.push(h)}if(e){let h=f.NORMAL!==void 0?o.getDependency("accessor",f.NORMAL):u.attributes.normal;s.push(h)}if(n){let h=f.COLOR_0!==void 0?o.getDependency("accessor",f.COLOR_0):u.attributes.color;l.push(h)}}return Promise.all([Promise.all(i),Promise.all(s),Promise.all(l)]).then(function(c){let a=c[0],f=c[1],h=c[2];return r&&(u.morphAttributes.position=a),e&&(u.morphAttributes.normal=f),n&&(u.morphAttributes.color=h),u.morphTargetsRelative=!0,u})}function Sd(u,t){if(u.updateMorphTargets(),t.weights!==void 0)for(let o=0,r=t.weights.length;o<r;o++)u.morphTargetInfluences[o]=t.weights[o];if(t.extras&&Array.isArray(t.extras.targetNames)){let o=t.extras.targetNames;if(u.morphTargetInfluences.length===o.length){u.morphTargetDictionary={};for(let r=0,e=o.length;r<e;r++)u.morphTargetDictionary[o[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Ad(u){let t,o=u.extensions&&u.extensions[Be.KHR_DRACO_MESH_COMPRESSION];if(o?t="draco:"+o.bufferView+":"+o.indices+":"+ca(o.attributes):t=u.indices+":"+ca(u.attributes)+":"+u.mode,u.targets!==void 0)for(let r=0,e=u.targets.length;r<e;r++)t+=":"+ca(u.targets[r]);return t}function ca(u){let t="",o=Object.keys(u).sort();for(let r=0,e=o.length;r<e;r++)t+=o[r]+":"+u[o[r]]+";";return t}function Fa(u){switch(u){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Md(u){return u.search(/\.jpe?g($|\?)/i)>0||u.search(/^data\:image\/jpeg/)===0?"image/jpeg":u.search(/\.webp($|\?)/i)>0||u.search(/^data\:image\/webp/)===0?"image/webp":u.search(/\.ktx2($|\?)/i)>0||u.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}var kd=new _.Matrix4,Pa=class{constructor(t={},o={}){this.json=t,this.extensions={},this.plugins={},this.options=o,this.cache=new vd,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,e=-1,n=!1,i=-1;if(typeof navigator<"u"){let s=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(s)===!0;let l=s.match(/Version\/(\d+)/);e=r&&l?parseInt(l[1],10):-1,n=s.indexOf("Firefox")>-1,i=n?s.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&e<17||n&&i<98?this.textureLoader=new _.TextureLoader(this.options.manager):this.textureLoader=new _.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new _.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,o){let r=this,e=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(i){let s={scene:i[0][e.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:e.asset,parser:r,userData:{}};return io(n,s,e),dn(s,e),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(s)})).then(function(){for(let l of s.scenes)l.updateMatrixWorld();t(s)})}).catch(o)}_markDefs(){let t=this.json.nodes||[],o=this.json.skins||[],r=this.json.meshes||[];for(let e=0,n=o.length;e<n;e++){let i=o[e].joints;for(let s=0,l=i.length;s<l;s++)t[i[s]].isBone=!0}for(let e=0,n=t.length;e<n;e++){let i=t[e];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(r[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(t,o){o!==void 0&&(t.refs[o]===void 0&&(t.refs[o]=t.uses[o]=0),t.refs[o]++)}_getNodeRef(t,o,r){if(t.refs[o]<=1)return r;let e=r.clone(),n=(i,s)=>{let l=this.associations.get(i);l!=null&&this.associations.set(s,l);for(let[c,a]of i.children.entries())n(a,s.children[c])};return n(r,e),e.name+="_instance_"+t.uses[o]++,e}_invokeOne(t){let o=Object.values(this.plugins);o.push(this);for(let r=0;r<o.length;r++){let e=t(o[r]);if(e)return e}return null}_invokeAll(t){let o=Object.values(this.plugins);o.unshift(this);let r=[];for(let e=0;e<o.length;e++){let n=t(o[e]);n&&r.push(n)}return r}getDependency(t,o){let r=t+":"+o,e=this.cache.get(r);if(!e){switch(t){case"scene":e=this.loadScene(o);break;case"node":e=this._invokeOne(function(n){return n.loadNode&&n.loadNode(o)});break;case"mesh":e=this._invokeOne(function(n){return n.loadMesh&&n.loadMesh(o)});break;case"accessor":e=this.loadAccessor(o);break;case"bufferView":e=this._invokeOne(function(n){return n.loadBufferView&&n.loadBufferView(o)});break;case"buffer":e=this.loadBuffer(o);break;case"material":e=this._invokeOne(function(n){return n.loadMaterial&&n.loadMaterial(o)});break;case"texture":e=this._invokeOne(function(n){return n.loadTexture&&n.loadTexture(o)});break;case"skin":e=this.loadSkin(o);break;case"animation":e=this._invokeOne(function(n){return n.loadAnimation&&n.loadAnimation(o)});break;case"camera":e=this.loadCamera(o);break;default:if(e=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(t,o)}),!e)throw new Error("Unknown type: "+t);break}this.cache.add(r,e)}return e}getDependencies(t){let o=this.cache.get(t);if(!o){let r=this,e=this.json[t+(t==="mesh"?"es":"s")]||[];o=Promise.all(e.map(function(n,i){return r.getDependency(t,i)})),this.cache.add(t,o)}return o}loadBuffer(t){let o=this.json.buffers[t],r=this.fileLoader;if(o.type&&o.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+o.type+" buffer type is not supported.");if(o.uri===void 0&&t===0)return Promise.resolve(this.extensions[Be.KHR_BINARY_GLTF].body);let e=this.options;return new Promise(function(n,i){r.load(_.LoaderUtils.resolveURL(o.uri,e.path),n,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+o.uri+'".'))})})}loadBufferView(t){let o=this.json.bufferViews[t];return this.getDependency("buffer",o.buffer).then(function(r){let e=o.byteLength||0,n=o.byteOffset||0;return r.slice(n,n+e)})}loadAccessor(t){let o=this,r=this.json,e=this.json.accessors[t];if(e.bufferView===void 0&&e.sparse===void 0){let i=aa[e.type],s=Uo[e.componentType],l=e.normalized===!0,c=new s(e.count*i);return Promise.resolve(new _.BufferAttribute(c,i,l))}let n=[];return e.bufferView!==void 0?n.push(this.getDependency("bufferView",e.bufferView)):n.push(null),e.sparse!==void 0&&(n.push(this.getDependency("bufferView",e.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",e.sparse.values.bufferView))),Promise.all(n).then(function(i){let s=i[0],l=aa[e.type],c=Uo[e.componentType],a=c.BYTES_PER_ELEMENT,f=a*l,h=e.byteOffset||0,d=e.bufferView!==void 0?r.bufferViews[e.bufferView].byteStride:void 0,g=e.normalized===!0,y,b;if(d&&d!==f){let v=Math.floor(h/d),w="InterleavedBuffer:"+e.bufferView+":"+e.componentType+":"+v+":"+e.count,T=o.cache.get(w);T||(y=new c(s,v*d,e.count*d/a),T=new _.InterleavedBuffer(y,d/a),o.cache.add(w,T)),b=new _.InterleavedBufferAttribute(T,l,h%d/a,g)}else s===null?y=new c(e.count*l):y=new c(s,h,e.count*l),b=new _.BufferAttribute(y,l,g);if(e.sparse!==void 0){let v=aa.SCALAR,w=Uo[e.sparse.indices.componentType],T=e.sparse.indices.byteOffset||0,x=e.sparse.values.byteOffset||0,E=new w(i[1],T,e.sparse.count*v),O=new c(i[2],x,e.sparse.count*l);s!==null&&(b=new _.BufferAttribute(b.array.slice(),b.itemSize,b.normalized)),b.normalized=!1;for(let A=0,k=E.length;A<k;A++){let M=E[A];if(b.setX(M,O[A*l]),l>=2&&b.setY(M,O[A*l+1]),l>=3&&b.setZ(M,O[A*l+2]),l>=4&&b.setW(M,O[A*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}b.normalized=g}return b})}loadTexture(t){let o=this.json,r=this.options,n=o.textures[t].source,i=o.images[n],s=this.textureLoader;if(i.uri){let l=r.manager.getHandler(i.uri);l!==null&&(s=l)}return this.loadTextureImage(t,n,s)}loadTextureImage(t,o,r){let e=this,n=this.json,i=n.textures[t],s=n.images[o],l=(s.uri||s.bufferView)+":"+i.sampler;if(this.textureCache[l])return this.textureCache[l];let c=this.loadImageSource(o,r).then(function(a){a.flipY=!1,a.name=i.name||s.name||"",a.name===""&&typeof s.uri=="string"&&s.uri.startsWith("data:image/")===!1&&(a.name=s.uri);let h=(n.samplers||{})[i.sampler]||{};return a.magFilter=Bc[h.magFilter]||_.LinearFilter,a.minFilter=Bc[h.minFilter]||_.LinearMipmapLinearFilter,a.wrapS=Dc[h.wrapS]||_.RepeatWrapping,a.wrapT=Dc[h.wrapT]||_.RepeatWrapping,a.generateMipmaps=!a.isCompressedTexture&&a.minFilter!==_.NearestFilter&&a.minFilter!==_.LinearFilter,e.associations.set(a,{textures:t}),a}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(t,o){let r=this,e=this.json,n=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(f=>f.clone());let i=e.images[t],s=self.URL||self.webkitURL,l=i.uri||"",c=!1;if(i.bufferView!==void 0)l=r.getDependency("bufferView",i.bufferView).then(function(f){c=!0;let h=new Blob([f],{type:i.mimeType});return l=s.createObjectURL(h),l});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");let a=Promise.resolve(l).then(function(f){return new Promise(function(h,d){let g=h;o.isImageBitmapLoader===!0&&(g=function(y){let b=new _.Texture(y);b.needsUpdate=!0,h(b)}),o.load(_.LoaderUtils.resolveURL(f,n.path),g,void 0,d)})}).then(function(f){return c===!0&&s.revokeObjectURL(l),dn(f,i),f.userData.mimeType=i.mimeType||Md(i.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[t]=a,a}assignTexture(t,o,r,e){let n=this;return this.getDependency("texture",r.index).then(function(i){if(!i)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(i=i.clone(),i.channel=r.texCoord),n.extensions[Be.KHR_TEXTURE_TRANSFORM]){let s=r.extensions!==void 0?r.extensions[Be.KHR_TEXTURE_TRANSFORM]:void 0;if(s){let l=n.associations.get(i);i=n.extensions[Be.KHR_TEXTURE_TRANSFORM].extendTexture(i,s),n.associations.set(i,l)}}return e!==void 0&&(i.colorSpace=e),t[o]=i,i})}assignFinalMaterial(t){let o=t.geometry,r=t.material,e=o.attributes.tangent===void 0,n=o.attributes.color!==void 0,i=o.attributes.normal===void 0;if(t.isPoints){let s="PointsMaterial:"+r.uuid,l=this.cache.get(s);l||(l=new _.PointsMaterial,_.Material.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(s,l)),r=l}else if(t.isLine){let s="LineBasicMaterial:"+r.uuid,l=this.cache.get(s);l||(l=new _.LineBasicMaterial,_.Material.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(s,l)),r=l}if(e||n||i){let s="ClonedMaterial:"+r.uuid+":";e&&(s+="derivative-tangents:"),n&&(s+="vertex-colors:"),i&&(s+="flat-shading:");let l=this.cache.get(s);l||(l=r.clone(),n&&(l.vertexColors=!0),i&&(l.flatShading=!0),e&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(s,l),this.associations.set(l,this.associations.get(r))),r=l}t.material=r}getMaterialType(){return _.MeshStandardMaterial}loadMaterial(t){let o=this,r=this.json,e=this.extensions,n=r.materials[t],i,s={},l=n.extensions||{},c=[];if(l[Be.KHR_MATERIALS_UNLIT]){let f=e[Be.KHR_MATERIALS_UNLIT];i=f.getMaterialType(),c.push(f.extendParams(s,n,o))}else{let f=n.pbrMetallicRoughness||{};if(s.color=new _.Color(1,1,1),s.opacity=1,Array.isArray(f.baseColorFactor)){let h=f.baseColorFactor;s.color.setRGB(h[0],h[1],h[2],_.LinearSRGBColorSpace),s.opacity=h[3]}f.baseColorTexture!==void 0&&c.push(o.assignTexture(s,"map",f.baseColorTexture,_.SRGBColorSpace)),s.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,s.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(o.assignTexture(s,"metalnessMap",f.metallicRoughnessTexture)),c.push(o.assignTexture(s,"roughnessMap",f.metallicRoughnessTexture))),i=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(t,s)})))}n.doubleSided===!0&&(s.side=_.DoubleSide);let a=n.alphaMode||la.OPAQUE;if(a===la.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,a===la.MASK&&(s.alphaTest=n.alphaCutoff!==void 0?n.alphaCutoff:.5)),n.normalTexture!==void 0&&i!==_.MeshBasicMaterial&&(c.push(o.assignTexture(s,"normalMap",n.normalTexture)),s.normalScale=new _.Vector2(1,1),n.normalTexture.scale!==void 0)){let f=n.normalTexture.scale;s.normalScale.set(f,f)}if(n.occlusionTexture!==void 0&&i!==_.MeshBasicMaterial&&(c.push(o.assignTexture(s,"aoMap",n.occlusionTexture)),n.occlusionTexture.strength!==void 0&&(s.aoMapIntensity=n.occlusionTexture.strength)),n.emissiveFactor!==void 0&&i!==_.MeshBasicMaterial){let f=n.emissiveFactor;s.emissive=new _.Color().setRGB(f[0],f[1],f[2],_.LinearSRGBColorSpace)}return n.emissiveTexture!==void 0&&i!==_.MeshBasicMaterial&&c.push(o.assignTexture(s,"emissiveMap",n.emissiveTexture,_.SRGBColorSpace)),Promise.all(c).then(function(){let f=new i(s);return n.name&&(f.name=n.name),dn(f,n),o.associations.set(f,{materials:t}),n.extensions&&io(e,f,n),f})}createUniqueName(t){let o=_.PropertyBinding.sanitizeNodeName(t||"");return o in this.nodeNamesUsed?o+"_"+ ++this.nodeNamesUsed[o]:(this.nodeNamesUsed[o]=0,o)}loadGeometries(t){let o=this,r=this.extensions,e=this.primitiveCache;function n(s){return r[Be.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(s,o).then(function(l){return Nc(l,s,o)})}let i=[];for(let s=0,l=t.length;s<l;s++){let c=t[s],a=Ad(c),f=e[a];if(f)i.push(f.promise);else{let h;c.extensions&&c.extensions[Be.KHR_DRACO_MESH_COMPRESSION]?h=n(c):h=Nc(new _.BufferGeometry,c,o),e[a]={primitive:c,promise:h},i.push(h)}}return Promise.all(i)}loadMesh(t){let o=this,r=this.json,e=this.extensions,n=r.meshes[t],i=n.primitives,s=[];for(let l=0,c=i.length;l<c;l++){let a=i[l].material===void 0?xd(this.cache):this.getDependency("material",i[l].material);s.push(a)}return s.push(o.loadGeometries(i)),Promise.all(s).then(function(l){let c=l.slice(0,l.length-1),a=l[l.length-1],f=[];for(let d=0,g=a.length;d<g;d++){let y=a[d],b=i[d],v,w=c[d];if(b.mode===Nt.TRIANGLES||b.mode===Nt.TRIANGLE_STRIP||b.mode===Nt.TRIANGLE_FAN||b.mode===void 0)v=n.isSkinnedMesh===!0?new _.SkinnedMesh(y,w):new _.Mesh(y,w),v.isSkinnedMesh===!0&&v.normalizeSkinWeights(),b.mode===Nt.TRIANGLE_STRIP?v.geometry=Ns(v.geometry,_.TriangleStripDrawMode):b.mode===Nt.TRIANGLE_FAN&&(v.geometry=Ns(v.geometry,_.TriangleFanDrawMode));else if(b.mode===Nt.LINES)v=new _.LineSegments(y,w);else if(b.mode===Nt.LINE_STRIP)v=new _.Line(y,w);else if(b.mode===Nt.LINE_LOOP)v=new _.LineLoop(y,w);else if(b.mode===Nt.POINTS)v=new _.Points(y,w);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+b.mode);Object.keys(v.geometry.morphAttributes).length>0&&Sd(v,n),v.name=o.createUniqueName(n.name||"mesh_"+t),dn(v,n),b.extensions&&io(e,v,b),o.assignFinalMaterial(v),f.push(v)}for(let d=0,g=f.length;d<g;d++)o.associations.set(f[d],{meshes:t,primitives:d});if(f.length===1)return n.extensions&&io(e,f[0],n),f[0];let h=new _.Group;n.extensions&&io(e,h,n),o.associations.set(h,{meshes:t});for(let d=0,g=f.length;d<g;d++)h.add(f[d]);return h})}loadCamera(t){let o,r=this.json.cameras[t],e=r[r.type];if(!e){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?o=new _.PerspectiveCamera(_.MathUtils.radToDeg(e.yfov),e.aspectRatio||1,e.znear||1,e.zfar||2e6):r.type==="orthographic"&&(o=new _.OrthographicCamera(-e.xmag,e.xmag,e.ymag,-e.ymag,e.znear,e.zfar)),r.name&&(o.name=this.createUniqueName(r.name)),dn(o,r),Promise.resolve(o)}loadSkin(t){let o=this.json.skins[t],r=[];for(let e=0,n=o.joints.length;e<n;e++)r.push(this._loadNodeShallow(o.joints[e]));return o.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",o.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(e){let n=e.pop(),i=e,s=[],l=[];for(let c=0,a=i.length;c<a;c++){let f=i[c];if(f){s.push(f);let h=new _.Matrix4;n!==null&&h.fromArray(n.array,c*16),l.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',o.joints[c])}return new _.Skeleton(s,l)})}loadAnimation(t){let o=this.json,r=this,e=o.animations[t],n=e.name?e.name:"animation_"+t,i=[],s=[],l=[],c=[],a=[];for(let f=0,h=e.channels.length;f<h;f++){let d=e.channels[f],g=e.samplers[d.sampler],y=d.target,b=y.node,v=e.parameters!==void 0?e.parameters[g.input]:g.input,w=e.parameters!==void 0?e.parameters[g.output]:g.output;y.node!==void 0&&(i.push(this.getDependency("node",b)),s.push(this.getDependency("accessor",v)),l.push(this.getDependency("accessor",w)),c.push(g),a.push(y))}return Promise.all([Promise.all(i),Promise.all(s),Promise.all(l),Promise.all(c),Promise.all(a)]).then(function(f){let h=f[0],d=f[1],g=f[2],y=f[3],b=f[4],v=[];for(let w=0,T=h.length;w<T;w++){let x=h[w],E=d[w],O=g[w],A=y[w],k=b[w];if(x===void 0)continue;x.updateMatrix&&x.updateMatrix();let M=r._createAnimationTracks(x,E,O,A,k);if(M)for(let F=0;F<M.length;F++)v.push(M[F])}return new _.AnimationClip(n,void 0,v)})}createNodeMesh(t){let o=this.json,r=this,e=o.nodes[t];return e.mesh===void 0?null:r.getDependency("mesh",e.mesh).then(function(n){let i=r._getNodeRef(r.meshCache,e.mesh,n);return e.weights!==void 0&&i.traverse(function(s){if(s.isMesh)for(let l=0,c=e.weights.length;l<c;l++)s.morphTargetInfluences[l]=e.weights[l]}),i})}loadNode(t){let o=this.json,r=this,e=o.nodes[t],n=r._loadNodeShallow(t),i=[],s=e.children||[];for(let c=0,a=s.length;c<a;c++)i.push(r.getDependency("node",s[c]));let l=e.skin===void 0?Promise.resolve(null):r.getDependency("skin",e.skin);return Promise.all([n,Promise.all(i),l]).then(function(c){let a=c[0],f=c[1],h=c[2];h!==null&&a.traverse(function(d){d.isSkinnedMesh&&d.bind(h,kd)});for(let d=0,g=f.length;d<g;d++)a.add(f[d]);return a})}_loadNodeShallow(t){let o=this.json,r=this.extensions,e=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];let n=o.nodes[t],i=n.name?e.createUniqueName(n.name):"",s=[],l=e._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return l&&s.push(l),n.camera!==void 0&&s.push(e.getDependency("camera",n.camera).then(function(c){return e._getNodeRef(e.cameraCache,n.camera,c)})),e._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){s.push(c)}),this.nodeCache[t]=Promise.all(s).then(function(c){let a;if(n.isBone===!0?a=new _.Bone:c.length>1?a=new _.Group:c.length===1?a=c[0]:a=new _.Object3D,a!==c[0])for(let f=0,h=c.length;f<h;f++)a.add(c[f]);if(n.name&&(a.userData.name=n.name,a.name=i),dn(a,n),n.extensions&&io(r,a,n),n.matrix!==void 0){let f=new _.Matrix4;f.fromArray(n.matrix),a.applyMatrix4(f)}else n.translation!==void 0&&a.position.fromArray(n.translation),n.rotation!==void 0&&a.quaternion.fromArray(n.rotation),n.scale!==void 0&&a.scale.fromArray(n.scale);return e.associations.has(a)||e.associations.set(a,{}),e.associations.get(a).nodes=t,a}),this.nodeCache[t]}loadScene(t){let o=this.extensions,r=this.json.scenes[t],e=this,n=new _.Group;r.name&&(n.name=e.createUniqueName(r.name)),dn(n,r),r.extensions&&io(o,n,r);let i=r.nodes||[],s=[];for(let l=0,c=i.length;l<c;l++)s.push(e.getDependency("node",i[l]));return Promise.all(s).then(function(l){for(let a=0,f=l.length;a<f;a++)n.add(l[a]);let c=a=>{let f=new Map;for(let[h,d]of e.associations)(h instanceof _.Material||h instanceof _.Texture)&&f.set(h,d);return a.traverse(h=>{let d=e.associations.get(h);d!=null&&f.set(h,d)}),f};return e.associations=c(n),n})}_createAnimationTracks(t,o,r,e,n){let i=[],s=t.name?t.name:t.uuid,l=[];In[n.path]===In.weights?t.traverse(function(h){h.morphTargetInfluences&&l.push(h.name?h.name:h.uuid)}):l.push(s);let c;switch(In[n.path]){case In.weights:c=_.NumberKeyframeTrack;break;case In.rotation:c=_.QuaternionKeyframeTrack;break;case In.position:case In.scale:c=_.VectorKeyframeTrack;break;default:r.itemSize===1?c=_.NumberKeyframeTrack:c=_.VectorKeyframeTrack;break}let a=e.interpolation!==void 0?Td[e.interpolation]:_.InterpolateLinear,f=this._getArrayFromAccessor(r);for(let h=0,d=l.length;h<d;h++){let g=new c(l[h]+"."+In[n.path],o.array,f,a);e.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),i.push(g)}return i}_getArrayFromAccessor(t){let o=t.array;if(t.normalized){let r=Fa(o.constructor),e=new Float32Array(o.length);for(let n=0,i=o.length;n<i;n++)e[n]=o[n]*r;o=e}return o}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(r){let e=this instanceof _.QuaternionKeyframeTrack?Ca:zr;return new e(this.times,this.values,this.getValueSize()/3,r)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function Rd(u,t,o){let r=t.attributes,e=new _.Box3;if(r.POSITION!==void 0){let s=o.json.accessors[r.POSITION],l=s.min,c=s.max;if(l!==void 0&&c!==void 0){if(e.set(new _.Vector3(l[0],l[1],l[2]),new _.Vector3(c[0],c[1],c[2])),s.normalized){let a=Fa(Uo[s.componentType]);e.min.multiplyScalar(a),e.max.multiplyScalar(a)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let n=t.targets;if(n!==void 0){let s=new _.Vector3,l=new _.Vector3;for(let c=0,a=n.length;c<a;c++){let f=n[c];if(f.POSITION!==void 0){let h=o.json.accessors[f.POSITION],d=h.min,g=h.max;if(d!==void 0&&g!==void 0){if(l.setX(Math.max(Math.abs(d[0]),Math.abs(g[0]))),l.setY(Math.max(Math.abs(d[1]),Math.abs(g[1]))),l.setZ(Math.max(Math.abs(d[2]),Math.abs(g[2]))),h.normalized){let y=Fa(Uo[h.componentType]);l.multiplyScalar(y)}s.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}e.expandByVector(s)}u.boundingBox=e;let i=new _.Sphere;e.getCenter(i.center),i.radius=e.min.distanceTo(e.max)/2,u.boundingSphere=i}function Nc(u,t,o){let r=t.attributes,e=[];function n(i,s){return o.getDependency("accessor",i).then(function(l){u.setAttribute(s,l)})}for(let i in r){let s=Oa[i]||i.toLowerCase();s in u.attributes||e.push(n(r[i],s))}if(t.indices!==void 0&&!u.index){let i=o.getDependency("accessor",t.indices).then(function(s){u.setIndex(s)});e.push(i)}return _.ColorManagement.workingColorSpace!==_.LinearSRGBColorSpace&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${_.ColorManagement.workingColorSpace}" not supported.`),dn(u,t),Rd(u,t,o),Promise.all(e).then(function(){return t.targets!==void 0?Ed(u,t.targets,o):u})}function Id(u,t,o){let r=new Map,e=new tn.Object3D;for(let n of t.mapObjects){let i=t.getNode(n.nodeId);if(!i||i.floorId!==o||!n.modelUrl)continue;let[s,l]=Rn(u,[i.lng,i.lat]);e.position.set(s,l,$e+n.altitude);let c=n.rotation!==0?Math.PI/n.rotation:0;e.rotation.set(Math.PI/2,c,0),e.scale.setScalar(n.scale||1),e.updateMatrix();let a=r.get(n.modelUrl)??[];a.push(e.matrix.clone()),r.set(n.modelUrl,a)}return r}async function Gc(u,t,o,r){let e=Id(u,t,o);if(e.size===0)return null;let n=new jr,i=new tn.Group;return await Promise.all([...e.entries()].map(async([s,l])=>{try{(await n.loadAsync(s)).scene.traverse(a=>{if(!(a instanceof tn.Mesh))return;let f=a,h=new tn.InstancedMesh(f.geometry,f.material,l.length);l.forEach((d,g)=>{h.setMatrixAt(g,new tn.Matrix4().multiplyMatrices(d,f.matrixWorld))}),h.instanceMatrix.needsUpdate=!0,i.add(h)})}catch(c){console.warn(`becomap: failed to load model ${s}`,c)}})),i}var Ba=gt(Ft(),1),_d=new Ba.Color(1,1,1),Ld=(u,t)=>u.clone().lerp(_d,t),Vc=(u,t)=>u.clone().multiplyScalar(1-t),Ua=u=>()=>new Ba.Color(u),Cd={wallHeight:1.5,topFraction:.3,rimWidth:.25},zc=u=>({...Cd,...u}),Pi={floor:"#f2efe9",base:"#ded7cb",edge:"#ece5d9",wallBase:"#efe9df",wall:"#cfc7b8",innerWall:"#ded7ca",topLower:"#d5cdbf",topUpper:"#fffdf8",bevel:"#fffdf8"},jc={name:"ivory",translucent:!1,background:"#ffffff",labelColor:0,roof:Ua(Pi.topUpper),wallTop:Ua(Pi.edge),wallBase:Ua(Pi.base),panel:zc(Pi)},Od={name:"data",translucent:!1,background:"#ffffff",labelColor:16777215,roof:u=>Ld(u,.12),wallTop:u=>Vc(u,.05),wallBase:u=>Vc(u,.34),panel:{...zc(Pi),floor:"#e8e9eb",base:"#ffffff",edge:"#ffffff",topLower:"#eaeaf4",wallBase:"#ededef",wall:"#e3e4e6",innerWall:"#e3e4e6",rimWidth:.3,topUpperFromData:!0}},Fd={ivory:jc,data:Od,neutral:jc};function _n(u){return Fd[u??"ivory"]}var nt=gt(Ft(),1),Wc=gt(Rr(),1);var Bo,Do,No,ro,Ht,Ui,nn,Bi,so,ao,Wr=class{constructor(t,o){this.id="becomap-3d";this.type="custom";this.renderingMode="3d";V(this,Bo);V(this,Do);V(this,No,new nt.Camera);V(this,ro,new nt.Scene);V(this,Ht,null);V(this,Ui,new nt.Matrix4);V(this,nn,null);V(this,Bi,{drawCalls:0,triangles:0});V(this,so,new nt.Matrix4);V(this,ao,!1);this.render=(t,o)=>{p(this,Ht)&&(p(this,No).projectionMatrix=new nt.Matrix4().fromArray(Array.from(o)).multiply(p(this,Ui)),p(this,so).copy(p(this,No).projectionMatrix),N(this,ao,!0),p(this,Ht).resetState(),p(this,Ht).render(p(this,ro),p(this,No)),N(this,Bi,{drawCalls:p(this,Ht).info.render.calls,triangles:p(this,Ht).info.render.triangles}))};N(this,Bo,t),N(this,Do,o)}onAdd(t,o){N(this,nn,t),p(this,ro).add(p(this,Bo));let r=Wc.default.MercatorCoordinate.fromLngLat({lng:p(this,Do)[0],lat:p(this,Do)[1]},0),e=r.meterInMercatorCoordinateUnits();N(this,Ui,new nt.Matrix4().makeTranslation(r.x,r.y,r.z).scale(new nt.Vector3(e,-e,e)).multiply(new nt.Matrix4().makeRotationX(Math.PI/2))),N(this,Ht,new nt.WebGLRenderer({canvas:t.getCanvas(),context:o,antialias:!0})),p(this,Ht).autoClear=!1}onRemove(){p(this,ro).remove(p(this,Bo)),p(this,Ht)?.dispose(),N(this,Ht,null),N(this,nn,null)}repaint(){p(this,nn)?.triggerRepaint()}getFrameStats(){return p(this,Bi)}debugScene(){return p(this,ro)}debugMatrix(){return p(this,ao)?p(this,so).toArray():null}projectPoint(t,o,r){if(!p(this,ao)||!p(this,nn))return null;let e=p(this,nn).getCanvas(),n=e.clientWidth,i=e.clientHeight;if(!n||!i)return null;let s=new nt.Matrix4().multiplyMatrices(p(this,so),new nt.Matrix4().makeRotationX(-Math.PI/2)),l=new nt.Vector4(t,o,r,1).applyMatrix4(s);return l.w<=0?null:{x:(l.x/l.w+1)/2*n,y:(1-l.y/l.w)/2*i}}pickRay(t,o){if(!p(this,ao)||!p(this,nn))return null;let r=p(this,nn).getCanvas(),e=r.clientWidth,n=r.clientHeight;if(!e||!n)return null;let i=t/e*2-1,s=1-o/n*2,c=new nt.Matrix4().multiplyMatrices(p(this,so),new nt.Matrix4().makeRotationX(-Math.PI/2)).invert(),a=new nt.Vector4(i,s,-1,1).applyMatrix4(c),f=new nt.Vector4(i,s,1,1).applyMatrix4(c);if(!a.w||!f.w)return null;let h=new nt.Vector3(a.x/a.w,a.y/a.w,a.z/a.w),g=new nt.Vector3(f.x/f.w,f.y/f.w,f.z/f.w).sub(h).normalize();return{origin:h,dir:g}}};Bo=new WeakMap,Do=new WeakMap,No=new WeakMap,ro=new WeakMap,Ht=new WeakMap,Ui=new WeakMap,nn=new WeakMap,Bi=new WeakMap,so=new WeakMap,ao=new WeakMap;var Oe=gt(Ft(),1);var Kc=1.6,Pd="https://backend-lightning-prod.s3.ap-southeast-1.amazonaws.com/assets/source.svg",Ud=54,Bd=$e+.35,Dd=.35,Nd=`
|
|
253
|
+
varying vec2 vUv;
|
|
254
|
+
void main() {
|
|
255
|
+
vUv = uv;
|
|
256
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
257
|
+
}
|
|
258
|
+
`,Hd=`
|
|
259
|
+
uniform float uProgress;
|
|
260
|
+
uniform float uVisited;
|
|
261
|
+
uniform float uTime;
|
|
262
|
+
uniform float uGhost;
|
|
263
|
+
varying vec2 vUv; // x = arc length in meters, y = 0..1 across the ribbon
|
|
264
|
+
void main() {
|
|
265
|
+
float u = vUv.x;
|
|
266
|
+
if (u > uProgress) discard;
|
|
267
|
+
float v = abs(vUv.y - 0.5);
|
|
268
|
+
float p = fract(u / 7.0 - uTime * 0.45);
|
|
269
|
+
float a = 0.42 - v;
|
|
270
|
+
float arrow = step(a * 0.55, p) * step(p, a * 0.55 + 0.16) * step(v, 0.42);
|
|
271
|
+
float visited = 1.0 - step(uVisited, u);
|
|
272
|
+
vec3 base = mix(vec3(0.18, 0.50, 0.93), vec3(0.66, 0.69, 0.75), visited);
|
|
273
|
+
float arrowStrength = mix(0.95, 0.25, visited);
|
|
274
|
+
vec3 col = mix(base, vec3(1.0), arrow * arrowStrength);
|
|
275
|
+
// ghost: lighten toward pale blue and cut alpha so it reads as "behind glass"
|
|
276
|
+
col = mix(col, vec3(0.60, 0.76, 0.98), uGhost * 0.6);
|
|
277
|
+
float edge = smoothstep(0.5, 0.40, v);
|
|
278
|
+
gl_FragColor = vec4(col, edge * mix(1.0, 0.30, uGhost));
|
|
279
|
+
}
|
|
280
|
+
`;function Xc(u){return new Oe.ShaderMaterial({transparent:!0,depthWrite:!1,depthTest:!u,side:Oe.DoubleSide,uniforms:{uProgress:{value:0},uVisited:{value:0},uTime:{value:0},uGhost:{value:u?1:0}},vertexShader:Nd,fragmentShader:Hd})}var lo,Ho,_t,Gt,ft,co,Di,Ni,on,Hi,Go,Gi,St,Kr,qc,Xr,Da,qr=class{constructor(t,o,r=()=>{}){V(this,St);V(this,lo,Xc(!1));V(this,Ho,Xc(!0));V(this,_t,[]);V(this,Gt,null);V(this,ft,null);V(this,co,null);V(this,Di,.8);V(this,Ni,{bearing:0,pitch:0,mpp:.05});V(this,on);V(this,Hi);V(this,Go,0);V(this,Gi);N(this,on,t),N(this,Hi,o),N(this,Gi,r)}setRoute(t){this.clear();let o=0;for(let n of t){let i=Bt(p(this,Hi),n.points);if(i.length<2)continue;let s=n.buildingId?Bd:Dd,l=new Oe.CatmullRomCurve3(i.map(([E,O])=>new Oe.Vector3(E,O,s)),!1,"catmullrom",.05),c=l.getLength(),a=Math.max(2,Math.ceil(c/1.2)),f=l.getSpacedPoints(a),h=new Float32Array((a+1)*2*3),d=new Float32Array((a+1)*2*2),g=[],y=new Oe.Vector3,b=o,v=[];for(let E=0;E<=a;E++){let O=f[E],A=f[E-1],k=f[E+1];if(!O)continue;E>0&&A&&(b+=O.distanceTo(A)),v.push(b),E===0&&k?y.subVectors(k,O):E===a&&A?y.subVectors(O,A):A&&k&&y.subVectors(k,A),y.z=0,y.normalize();let M=-y.y*Kc*.5,F=y.x*Kc*.5;if(h.set([O.x+M,O.y+F,O.z,O.x-M,O.y-F,O.z],E*6),d.set([b,0,b,1],E*4),E<a){let I=E*2;g.push(I,I+1,I+2,I+1,I+3,I+2)}}let w=new Oe.BufferGeometry;w.setAttribute("position",new Oe.BufferAttribute(h,3)),w.setAttribute("uv",new Oe.BufferAttribute(d,2)),w.setIndex(g);let T=new Oe.Mesh(w,p(this,Ho));T.renderOrder=9;let x=new Oe.Mesh(w,p(this,lo));x.renderOrder=11,p(this,on).add(T,x),p(this,_t).push({solid:x,ghost:T,segment:n,start:o,end:b,pts:f,arcs:v}),o=b}N(this,Go,o);let r=p(this,_t)[0],e=r?.pts[0];if(r&&e){let n=re(this,St,qc).call(this);n.position.set(e.x,e.y,e.z+.05),n.visible=!0,re(this,St,Xr).call(this)}return o}get totalLength(){return p(this,Go)}get active(){return p(this,_t).length>0}updateVisibility(t){for(let r of p(this,_t)){let e=r.segment.buildingId===null?!0:t(r.segment.floorId,r.segment.buildingId);r.solid.visible=e,r.ghost.visible=e}let o=p(this,_t)[0];p(this,ft)&&o&&(p(this,ft).visible=o.segment.buildingId===null?!0:t(o.segment.floorId,o.segment.buildingId))}nearestBoundary(t){let o=null;for(let r of p(this,_t))(o===null||Math.abs(r.end-t)<Math.abs(o-t))&&(o=r.end);return o}segmentAt(t){return p(this,_t).find(o=>t>=o.start&&t<o.end)?.segment}setProgress(t){re(this,St,Kr).call(this,"uProgress",t)}setVisited(t){re(this,St,Kr).call(this,"uVisited",t)}getVisited(){return p(this,lo).uniforms.uVisited?.value??0}setTime(t){re(this,St,Kr).call(this,"uTime",t)}setStartMarkerAltitude(t){let o=p(this,ft);o&&(o.position.z=t)}setStartMarkerView(t,o,r){N(this,Ni,{bearing:t,pitch:o,mpp:r}),re(this,St,Xr).call(this)}showRunner(){re(this,St,Da).call(this).visible=!0}hideRunner(){p(this,Gt)&&(p(this,Gt).visible=!1)}setRunner(t){let o=p(this,_t).find(h=>t>=h.start&&t<=h.end)??p(this,_t)[0];if(!o)return;let r=re(this,St,Da).call(this),{pts:e,arcs:n}=o,i=0;for(;i<n.length-1&&(n[i+1]??1/0)<t;)i++;let s=e[i],l=e[Math.min(i+1,e.length-1)],c=n[i]??0,a=n[Math.min(i+1,n.length-1)]??c;if(!s||!l)return;let f=a>c?Math.min(1,Math.max(0,(t-c)/(a-c))):0;r.position.set(s.x+(l.x-s.x)*f,s.y+(l.y-s.y)*f,s.z+.05)}clear(){for(let t of p(this,_t))p(this,on).remove(t.solid,t.ghost),t.solid.geometry.dispose();N(this,_t,[]),N(this,Go,0),this.hideRunner(),p(this,ft)&&(p(this,ft).visible=!1),this.setProgress(0),this.setVisited(0)}dispose(){this.clear(),p(this,Gt)&&(p(this,on).remove(p(this,Gt)),p(this,Gt).traverse(t=>{t instanceof Oe.Mesh&&(t.geometry.dispose(),t.material.dispose())}),N(this,Gt,null)),p(this,ft)&&(p(this,on).remove(p(this,ft)),p(this,ft).geometry.dispose(),p(this,ft).material.dispose(),N(this,ft,null)),p(this,co)?.dispose(),N(this,co,null),p(this,lo).dispose(),p(this,Ho).dispose()}};lo=new WeakMap,Ho=new WeakMap,_t=new WeakMap,Gt=new WeakMap,ft=new WeakMap,co=new WeakMap,Di=new WeakMap,Ni=new WeakMap,on=new WeakMap,Hi=new WeakMap,Go=new WeakMap,Gi=new WeakMap,St=new WeakSet,Kr=function(t,o){let r=p(this,lo).uniforms[t],e=p(this,Ho).uniforms[t];r&&(r.value=o),e&&(e.value=o)},qc=function(){if(p(this,ft))return p(this,ft);let t=new Oe.MeshBasicMaterial({transparent:!0,depthWrite:!1,depthTest:!1,opacity:0}),o=new Image;o.crossOrigin="anonymous",o.onload=()=>{let i=Math.max(2,Math.round(o.width/o.height*256)||256),s=document.createElement("canvas");s.width=i,s.height=256,s.getContext("2d")?.drawImage(o,0,0,i,256);let l=new Oe.CanvasTexture(s);l.colorSpace=Oe.SRGBColorSpace,l.anisotropy=4,l.generateMipmaps=!1,l.minFilter=Oe.LinearFilter,p(this,co)?.dispose(),N(this,co,l),t.map=l,t.opacity=1,t.needsUpdate=!0,N(this,Di,i/256),re(this,St,Xr).call(this),p(this,Gi).call(this)},o.src=Pd;let r=new Oe.PlaneGeometry(1,1);r.translate(0,.5,0);let e=new Oe.Mesh(r,t);return e.renderOrder=30,e.frustumCulled=!1,e.visible=!1,p(this,on).add(e),N(this,ft,e),e},Xr=function(){let t=p(this,ft);if(!t)return;let{bearing:o,pitch:r,mpp:e}=p(this,Ni),n=Ud*e;t.scale.set(n*p(this,Di),n,1),t.rotation.set(r*Math.PI/180,0,-o*Math.PI/180,"ZXY")},Da=function(){if(p(this,Gt))return p(this,Gt);let t=new Oe.Group,o=new Oe.MeshLambertMaterial({color:"#2e80ee"}),r=new Oe.ConeGeometry(.7,2,24);r.rotateX(-Math.PI/2);let e=new Oe.Mesh(r,o);e.position.z=1;let n=new Oe.Mesh(new Oe.SphereGeometry(.85,24,18),o);return n.position.z=2.4,t.add(e,n),t.traverse(i=>i.frustumCulled=!1),t.renderOrder=20,t.visible=!1,p(this,on).add(t),N(this,Gt,t),t};var Gd=!0,Vd=5,Zc=["#c7d2e8","#cfe0d8","#e8d8cd","#d8cfe8","#e8e0c8"],jd=.13,pn,qt,Lt,Je,At,yt,uo,fo,Vo,Zt,Vi,Yr,jo,rn,zo,Ln,ho,sn,Wo,Ko,gn,po,Cn,Vt,Na,$c,Ha,Jc,Zr=class{constructor(t,o,r){V(this,Vt);V(this,pn);V(this,qt);V(this,Lt);V(this,Je);V(this,At,new ie.Group);V(this,yt,new Map);V(this,uo,new Map);V(this,fo);V(this,Vo);V(this,Zt);V(this,Vi,new ie.MeshLambertMaterial({vertexColors:!0,transparent:!0,opacity:.7,side:ie.DoubleSide}));V(this,Yr,new ie.LineBasicMaterial({color:"#5a5852"}));V(this,jo,new ie.MeshBasicMaterial({color:"#10131c",transparent:!0,opacity:.34,side:ie.DoubleSide,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2}));V(this,rn,null);V(this,zo,new ie.MeshBasicMaterial({color:"#ffffff",transparent:!0,opacity:.24,side:ie.DoubleSide,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1}));V(this,Ln,null);V(this,ho,null);V(this,sn,!1);V(this,Wo);V(this,Ko);V(this,gn,1);V(this,po,1);V(this,Cn,0);N(this,Lt,t),N(this,pn,o),N(this,qt,Qn(o.center)),N(this,Zt,_n(r)),N(this,fo,new ie.MeshBasicMaterial({vertexColors:!0,side:ie.DoubleSide})),N(this,Vo,new ie.MeshLambertMaterial({color:"#f7f8fb",side:ie.DoubleSide})),p(this,At).add(new ie.HemisphereLight(16777215,14543069,1.15));let e=new ie.DirectionalLight(16777215,.8);e.position.set(-300,-400,600),p(this,At).add(e),p(this,At).rotation.x=-Math.PI/2,N(this,Je,new Wr(p(this,At),o.center)),t.addLayer(p(this,Je)),N(this,Ko,()=>{let n=sa(p(this,Lt).getBearing(),p(this,sn));if(n!==p(this,sn)){N(this,sn,n);for(let i of p(this,yt).values())i.labels?.setFlip(n),i.markers?.setFlip(n);for(let i of p(this,uo).values())i.label?.setFlip(n);p(this,Je).repaint()}}),t.on("rotate",p(this,Ko)),N(this,Wo,()=>{let n=p(this,Lt).getBearing(),i=p(this,Lt).getPitch();for(let s of p(this,yt).values())s.markers?.setCameraView(n,i)}),t.on("move",p(this,Wo)),N(this,sn,sa(t.getBearing(),!1))}setHighlight(t,o=4){if(p(this,rn)&&(p(this,At).remove(p(this,rn)),p(this,rn).traverse(r=>{r instanceof ie.Mesh&&r.geometry.dispose()}),N(this,rn,null)),t){let r=Bt(p(this,qt),t),e=new ie.Group,n={pos:[],nrm:[],uv:[],idx:[]},s=.6+(p(this,Zt).panel?.uniformHeight??o)+.05;Co(n,r,.55,s);let l=new ie.BufferGeometry;l.setAttribute("position",new ie.BufferAttribute(new Float32Array(n.pos),3)),l.setAttribute("normal",new ie.BufferAttribute(new Float32Array(n.nrm),3)),l.setIndex(n.idx),e.add(new ie.Mesh(l,p(this,jo)));let c=new ie.Shape(r.map(([f,h])=>new ie.Vector2(f,h))),a=new ie.ShapeGeometry(c);a.translate(0,0,s),e.add(new ie.Mesh(a,p(this,jo))),p(this,At).add(e),N(this,rn,e)}p(this,Je).repaint()}setHover(t,o=4){if(p(this,Ln)&&(p(this,At).remove(p(this,Ln)),p(this,Ln).traverse(r=>{r instanceof ie.Mesh&&r.geometry.dispose()}),N(this,Ln,null)),t){let r=Bt(p(this,qt),t),e=new ie.Group,n={pos:[],nrm:[],uv:[],idx:[]},s=.6+(p(this,Zt).panel?.uniformHeight??o)+.05;Co(n,r,.55,s);let l=new ie.BufferGeometry;l.setAttribute("position",new ie.BufferAttribute(new Float32Array(n.pos),3)),l.setAttribute("normal",new ie.BufferAttribute(new Float32Array(n.nrm),3)),l.setIndex(n.idx),e.add(new ie.Mesh(l,p(this,zo)));let c=new ie.Shape(r.map(([f,h])=>new ie.Vector2(f,h))),a=new ie.ShapeGeometry(c);a.translate(0,0,s),e.add(new ie.Mesh(a,p(this,zo))),p(this,At).add(e),N(this,Ln,e)}p(this,Je).repaint()}setHighlightVisible(t){p(this,rn)&&(p(this,rn).visible=t,p(this,Je).repaint())}routeRibbon(){return p(this,ho)??N(this,ho,new qr(p(this,At),p(this,qt),()=>{p(this,Je).repaint()})),p(this,ho)}repaint(){p(this,Je).repaint()}setFlattened(t){if(N(this,po,t?jd:1),p(this,Cn))return;let o=()=>{let r=p(this,po)-p(this,gn);N(this,gn,p(this,gn)+r*.18),Math.abs(r)<.005&&N(this,gn,p(this,po));for(let e of p(this,yt).values())e.group.scale.z=p(this,gn);p(this,Je).repaint(),p(this,gn)!==p(this,po)?N(this,Cn,requestAnimationFrame(o)):N(this,Cn,0)};N(this,Cn,requestAnimationFrame(o))}applyView(t,o){let r=p(this,pn).getBuilding(t);if(!r)return;let e=re(this,Vt,$c).call(this,r);e&&(e.group.visible=!o.open);for(let n of r.floors)o.open&&n.id===o.floorId?this.showFloor(n.id):this.hideFloor(n.id);re(this,Vt,Na).call(this),p(this,Je).repaint()}prepareFloor(t){let o=p(this,yt).get(t)?.group.visible??!1,r=re(this,Vt,Ha).call(this,t);r&&!o&&(r.group.visible=!1)}showFloor(t){let o=re(this,Vt,Ha).call(this,t);o&&(o.group.visible=!0),p(this,Je).repaint()}hideFloor(t){let o=p(this,yt).get(t);o&&(o.group.visible=!1),p(this,Je).repaint()}visibleFloorIds(){return[...p(this,yt).entries()].filter(([,t])=>t.group.visible).map(([t])=>t)}setTheme(t){let o=_n(t);if(o.name===p(this,Zt).name)return;N(this,Zt,o);let r=this.visibleFloorIds();for(let[e,n]of[...p(this,yt).entries()])n.labels?.dispose(),n.markers?.dispose(),n.group.traverse(i=>{i instanceof ie.Mesh&&i.geometry.dispose()}),p(this,At).remove(n.group),p(this,yt).delete(e);for(let e of r)this.showFloor(e);re(this,Vt,Na).call(this),p(this,Je).repaint()}isFloorBuilt(t){return p(this,yt).get(t)?.built??!1}projectPoint(t,o,r){return p(this,Je).projectPoint(t,o,r)}pickRay(t,o){return p(this,Je).pickRay(t,o)}getFrameStats(){return p(this,Je).getFrameStats()}focusVenue(t={}){let o=new Yc.default.LngLatBounds,r=!1;for(let e of p(this,pn).buildings)for(let n of e.floors)for(let i of n.shapes)if(i.geometry.type==="Polygon")for(let s of i.geometry.coordinates[0]??[])o.extend(s),r=!0;r&&p(this,Lt).fitBounds(o,{padding:60,pitch:t.pitch??45,duration:t.duration??800})}dispose(){cancelAnimationFrame(p(this,Cn)),p(this,Lt).off("rotate",p(this,Ko)),p(this,Lt).off("move",p(this,Wo));for(let t of p(this,yt).values())t.labels?.dispose(),t.markers?.dispose(),t.group.traverse(o=>{o instanceof ie.Mesh&&o.geometry.dispose()});for(let t of p(this,uo).values())t.label?.dispose(),t.group.traverse(o=>{o instanceof ie.Mesh&&o.geometry.dispose()});p(this,ho)?.dispose(),p(this,Lt).getLayer(p(this,Je).id)&&p(this,Lt).removeLayer(p(this,Je).id),p(this,fo).dispose(),p(this,Vo).dispose(),p(this,Vi).dispose(),p(this,Yr).dispose(),p(this,jo).dispose(),p(this,zo).dispose()}};pn=new WeakMap,qt=new WeakMap,Lt=new WeakMap,Je=new WeakMap,At=new WeakMap,yt=new WeakMap,uo=new WeakMap,fo=new WeakMap,Vo=new WeakMap,Zt=new WeakMap,Vi=new WeakMap,Yr=new WeakMap,jo=new WeakMap,rn=new WeakMap,zo=new WeakMap,Ln=new WeakMap,ho=new WeakMap,sn=new WeakMap,Wo=new WeakMap,Ko=new WeakMap,gn=new WeakMap,po=new WeakMap,Cn=new WeakMap,Vt=new WeakSet,Na=function(){p(this,ho)?.updateVisibility(t=>p(this,yt).get(t)?.group.visible??!1)},$c=function(t){let o=p(this,uo).get(t.id);if(o)return o;let e=t.floors[0]?.shapes.find(T=>(T.layerId==="footprint"||T.type.toUpperCase()==="WALL")&&T.geometry.type==="Polygon"),n=e?.geometry.type==="Polygon"?e.geometry.coordinates[0]:void 0;if(!n||n.length<3)return;let i=Bt(p(this,qt),n),s=t.floors.length*Vd+2,l=new ie.Group,c={pos:[],nrm:[],uv:[],idx:[]};Co(c,i,0,s);let a=new ie.BufferGeometry;a.setAttribute("position",new ie.BufferAttribute(new Float32Array(c.pos),3)),a.setAttribute("normal",new ie.BufferAttribute(new Float32Array(c.nrm),3)),a.setIndex(c.idx),l.add(new ie.Mesh(a,p(this,Vo)));let f=new ie.Color(Zc[_o(t.id)%Zc.length]),h=new ie.Shape(i.map(([T,x])=>new ie.Vector2(T,x))),d=new ie.ShapeGeometry(h),g=d.attributes.position?.count??0,y=new Float32Array(g*3);for(let T=0;T<g;T++)y[T*3]=f.r,y[T*3+1]=f.g,y[T*3+2]=f.b;d.setAttribute("color",new ie.BufferAttribute(y,3)),d.translate(0,0,s),l.add(new ie.Mesh(d,p(this,fo)));let[b,v]=Xt(i),w=Ac({text:t.name,x:b,y:v,z:s+.4,fontSize:15,baseRotation:Ii(i),color:p(this,Zt).labelColor},()=>{p(this,Je).repaint()});return w.setFlip(p(this,sn)),l.add(w.object),l.visible=!1,p(this,At).add(l),o={group:l,label:w},p(this,uo).set(t.id,o),o},Ha=function(t){let o=p(this,yt).get(t);if(o?.built)return o;let r=p(this,pn).getFloor(t);if(r)return o={group:new ie.Group,labels:null,markers:null,built:!1},re(this,Vt,Jc).call(this,o,r),o.built=!0,o.group.scale.z=p(this,gn),p(this,yt).set(t,o),p(this,At).add(o.group),o},Jc=function(t,o){let r=Zl(p(this,qt),o,p(this,Zt));r.solid&&t.group.add(new ie.Mesh(r.solid,p(this,fo))),r.translucent&&t.group.add(new ie.Mesh(r.translucent,p(this,Vi))),r.labelSpecs.length&&(t.labels=Mc(r.labelSpecs,p(this,Zt).labelColor,()=>{p(this,Je).repaint()}),t.labels.setFlip(p(this,sn)),t.group.add(t.labels.object)),t.markers=Pc(p(this,qt),o,p(this,pn).iconset,()=>{p(this,Je).repaint()}),t.markers&&(t.markers.setFlip(p(this,sn)),t.markers.setCameraView(p(this,Lt).getBearing(),p(this,Lt).getPitch()),t.group.add(t.markers.object)),Gc(p(this,qt),p(this,pn),o.id).then(e=>{e&&(e.visible=Gd,t.group.add(e),p(this,Je).repaint())})};var mn,Wi,Ki,Xo,qo,On,Fn,Xi,Ct,Qc,ji,zi,$r=class{constructor(t,o={}){V(this,Ct);V(this,mn);V(this,Wi);V(this,Ki);V(this,Xo,0);V(this,qo,new Map);V(this,On,new Set);V(this,Fn,null);V(this,Xi,new Map);N(this,mn,t),N(this,Wi,o.openZoom??16.2),N(this,Ki,o.closeZoom??15.4);for(let r of t.buildings){let e=r.floors[0];e&&p(this,qo).set(r.id,e.id)}N(this,Fn,t.buildings[0]?.id??null)}focusedBuildingId(){return p(this,Fn)}focusBuilding(t){p(this,mn).getBuilding(t)&&N(this,Fn,t)}viewOf(t){return re(this,Ct,ji).call(this,t)}views(){let t=new Map;for(let o of p(this,mn).buildings){let r=re(this,Ct,ji).call(this,o.id);r&&t.set(o.id,r)}return t}update(t){return N(this,Xo,t),re(this,Ct,zi).call(this)}onZoomEnd(t){return N(this,Xo,t),t<p(this,Ki)&&p(this,On).size>0&&p(this,On).clear(),re(this,Ct,zi).call(this)}clickOpen(t){return p(this,mn).getBuilding(t)?(p(this,On).add(t),N(this,Fn,t),re(this,Ct,zi).call(this)):[]}selectFloor(t){let o=p(this,mn).getFloor(t);if(!o)return[];p(this,qo).set(o.buildingId,t),N(this,Fn,o.buildingId);let r=re(this,Ct,ji).call(this,o.buildingId);return r&&!r.open&&p(this,On).add(o.buildingId),re(this,Ct,zi).call(this)}};mn=new WeakMap,Wi=new WeakMap,Ki=new WeakMap,Xo=new WeakMap,qo=new WeakMap,On=new WeakMap,Fn=new WeakMap,Xi=new WeakMap,Ct=new WeakSet,Qc=function(t){return p(this,Xo)>=p(this,Wi)||p(this,On).has(t)},ji=function(t){let o=p(this,qo).get(t);if(o!==void 0)return{open:re(this,Ct,Qc).call(this,t),floorId:o}},zi=function(){let t=[];for(let o of p(this,mn).buildings){let r=re(this,Ct,ji).call(this,o.id);if(!r)continue;let e=p(this,Xi).get(o.id);(!e||e.open!==r.open||e.floorId!==r.floorId)&&(t.push({buildingId:o.id,view:r}),p(this,Xi).set(o.id,r))}return t};function eu(u,t){let o=document.createElement("div");o.style.cssText="position:absolute;top:12px;right:12px;z-index:10;background:rgba(255,255,255,.92);border-radius:10px;padding:10px 12px;font-family:system-ui,sans-serif;font-size:12px;color:#1f2937;box-shadow:0 2px 12px rgba(0,0,0,.12);text-align:center;display:none";let r=document.createElement("div");r.style.cssText="font-weight:600;margin-bottom:6px;max-width:110px";let e=document.createElement("div");return e.style.cssText="display:flex;flex-direction:column-reverse;gap:4px",o.append(r,e),u.appendChild(o),{update(n,i){if(!n){o.style.display="none";return}o.style.display="block",r.textContent=n.name,e.replaceChildren();for(let s of n.floors){let l=document.createElement("button");l.textContent=s.name;let c=i?.open===!0&&i.floorId===s.id;l.style.cssText="width:44px;height:32px;margin:0 auto;border:1px solid #d1d5db;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;"+(c?"background:#0d9488;border-color:#0d9488;color:#fff":"background:#fff;color:#1f2937"),l.onclick=()=>{t(s.id)},e.appendChild(l)}},dispose(){o.remove()}}}function tu(u,t,o,r){for(let e of u.buildings){let n=t(e.id);if(!n)continue;let i=e.floors[0]?.shapes.find(c=>(c.layerId==="footprint"||c.type.toUpperCase()==="WALL")&&c.geometry.type==="Polygon"),s=i?.geometry.type==="Polygon"?i.geometry.coordinates[0]:void 0;if(!s||!Io(s,o,r))continue;if(!n.open)return{kind:"sealed",buildingId:e.id,ring:s};let l=e.floors.find(c=>c.id===n.floorId);if(l){let c=new Map;for(let a of l.locations)a.shapeId&&c.set(a.shapeId,a);for(let a of l.shapes){if(a.layerId==="footprint"||a.geometry.type!=="Polygon")continue;let f=a.geometry.coordinates[0];if(!f||!Io(f,o,r))continue;let h=c.get(a.id);if(h&&!h.hidden)return{kind:"store",buildingId:e.id,floorId:l.id,location:h,shape:a}}}return{kind:"corridor",buildingId:e.id}}return{kind:"outdoor"}}function Ga(u){return u.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(t=>t.length>0)}var Pn,Qr=class Qr{constructor(t){V(this,Pn,[]);for(let o of t.locations)o.hidden||p(this,Pn).push({location:o,nameTokens:Ga(o.name),categoryTokens:o.categories.flatMap(r=>Ga(r.name))})}get size(){return p(this,Pn).length}async query(t){let o=Ga(t);if(o.length===0)return[];let r=[];for(let e=0;e<p(this,Pn).length;e++){e>0&&e%Qr.CHUNK===0&&await new Promise(s=>setTimeout(s,0));let n=p(this,Pn)[e];if(!n)continue;let i=zd(n,o);i>0&&r.push({location:n.location,score:i})}return r.sort((e,n)=>n.score-e.score||e.location.sortOrder-n.location.sortOrder),r}byCategory(t){return p(this,Pn).filter(o=>o.location.categories.some(r=>r.id===t)).map(o=>o.location).sort((o,r)=>o.sortOrder-r.sortOrder)}};Pn=new WeakMap,Qr.CHUNK=500;var Jr=Qr;function zd(u,t){let o=0,r=[...u.nameTokens,...u.categoryTokens],e=new Set;for(let n of t){let i=-1;for(let s=0;s<r.length;s++){if(e.has(s))continue;let l=r[s];if(l!==void 0&&l.startsWith(n)){i=s;break}}if(i===-1)return 0;e.add(i),o+=1+(r[i]===n?.5:0)}return o}function Va(u,t,o,r){let e=u[t],n=u[o];if(!e||!n)return null;let i=6371e3,s=Math.PI/180,l=(w,T)=>{let x=(T.lat-w.lat)*s,E=(T.lng-w.lng)*s,O=Math.sin(x/2)**2+Math.cos(w.lat*s)*Math.cos(T.lat*s)*Math.sin(E/2)**2;return 2*i*Math.asin(Math.sqrt(O))},c=[],a=[],f=(w,T)=>{c.push(w),a.push(T);let x=c.length-1;for(;x>0;){let E=x-1>>1,O=a[E],A=a[x];if(O===void 0||A===void 0||O<=A)break;[a[E],a[x]]=[A,O];let k=c[E],M=c[x];k!==void 0&&M!==void 0&&(c[E]=M,c[x]=k),x=E}},h=()=>{if(c.length===0)return;let w=c[0],T=c.pop(),x=a.pop();if(c.length>0&&T!==void 0&&x!==void 0){c[0]=T,a[0]=x;let E=0;for(;;){let O=E*2+1,A=O+1,k=E,M=a[E]??1/0,F=a[O]??1/0,I=a[A]??1/0;if(O<a.length&&F<M&&(k=O),A<a.length&&I<(a[k]??1/0)&&(k=A),k===E)break;let C=c[k],S=c[E],m=a[k],L=a[E];if(C===void 0||S===void 0||m===void 0||L===void 0)break;c[E]=C,c[k]=S,a[E]=m,a[k]=L,E=k}}return w},d=new Map,g=new Map,y=new Set;for(d.set(t,0),f(t,l(e,n));;){let w=h();if(w===void 0)return null;if(w===o)break;if(y.has(w))continue;y.add(w);let T=u[w];if(!T)continue;let x=d.get(w)??1/0;for(let E of T.edges){if(r&&!E.accessible)continue;let O=u[E.to];if(!O||y.has(E.to))continue;let A=x+E.cost;A<(d.get(E.to)??1/0)&&(d.set(E.to,A),g.set(E.to,w),f(E.to,A+l(O,n)))}}let b=[o],v=o;for(;v!==t;){let w=g.get(v);if(w===void 0)return null;b.push(w),v=w}return b.reverse(),{path:b,cost:d.get(o)??0}}var Zo,jt,go,ts,Yt,ns=class ns{constructor(t){V(this,Zo);V(this,jt,null);V(this,go,new Map);V(this,ts,1);V(this,Yt,new Map);if(N(this,Zo,Wd(t)),typeof Worker<"u"&&typeof URL.createObjectURL=="function")try{let o=`const runAStar = ${Va.toString()};
|
|
281
|
+
let graph = null;
|
|
282
|
+
self.onmessage = (e) => {
|
|
283
|
+
const msg = e.data;
|
|
284
|
+
if (msg.type === 'init') { graph = msg.graph; return; }
|
|
285
|
+
const result = graph ? runAStar(graph, msg.from, msg.to, msg.accessibleOnly) : null;
|
|
286
|
+
self.postMessage({ id: msg.id, result });
|
|
287
|
+
};`,r=URL.createObjectURL(new Blob([o],{type:"text/javascript"}));N(this,jt,new Worker(r)),URL.revokeObjectURL(r),p(this,jt).onmessage=e=>{let n=p(this,go).get(e.data.id);n&&(p(this,go).delete(e.data.id),n(e.data.result))},p(this,jt).postMessage({type:"init",graph:p(this,Zo)})}catch{N(this,jt,null)}}get usingWorker(){return p(this,jt)!==null}async findPath(t,o,r={}){let e=r.accessibleOnly??!1,n=`${t}|${o}|${String(e)}`,i=p(this,Yt).get(n);if(i!==void 0)return p(this,Yt).delete(n),p(this,Yt).set(n,i),i;let s=p(this,jt)?await new Promise(l=>{let c=kr(this,ts)._++;p(this,go).set(c,l),p(this,jt)?.postMessage({id:c,from:t,to:o,accessibleOnly:e})}):Va(p(this,Zo),t,o,e);if(p(this,Yt).size>=ns.CACHE_MAX){let l=p(this,Yt).keys().next().value;l!==void 0&&p(this,Yt).delete(l)}return p(this,Yt).set(n,s),s}dispose(){p(this,jt)?.terminate(),N(this,jt,null),p(this,go).clear(),p(this,Yt).clear()}};Zo=new WeakMap,jt=new WeakMap,go=new WeakMap,ts=new WeakMap,Yt=new WeakMap,ns.CACHE_MAX=100;var es=ns;function Wd(u){let t={};for(let o of u.nodes)t[o.id]={lng:o.lng,lat:o.lat,edges:o.edges.map(r=>({to:r.toNodeId,cost:r.cost,accessible:r.accessible}))};return t}function bn(u,t,o,r){let n=Math.PI/180,i=(r-t)*n,s=(o-u)*n,l=Math.sin(i/2)**2+Math.cos(t*n)*Math.cos(r*n)*Math.sin(s/2)**2;return 2*6371e3*Math.asin(Math.sqrt(l))}var Zi,Yo,mo,$o,bo,Jo,Yi,qi=class{constructor(t){V(this,Zi,new Map);V(this,Yo,new Map);V(this,mo,new Map);V(this,$o,new Map);V(this,bo,new Map);V(this,Jo,new Map);V(this,Yi,0);this.id=t.id,this.name=t.name,this.center=t.center,this.buildings=t.buildings,this.categories=t.categories,this.mapObjects=t.mapObjects,this.iconset=t.iconset??{},N(this,Yi,t.edgeCount);for(let o of t.buildings){p(this,Zi).set(o.id,o);for(let r of o.floors)p(this,Yo).set(r.id,r)}for(let o of t.categories)p(this,Jo).set(o.id,o);for(let o of t.nodes)p(this,bo).set(o.id,o);for(let o of t.shapes)p(this,$o).set(o.id,o);for(let o of t.locations)p(this,mo).set(o.id,o)}getBuilding(t){return p(this,Zi).get(t)}getFloor(t){return p(this,Yo).get(t)}getLocation(t){return p(this,mo).get(t)}getShape(t){return p(this,$o).get(t)}getNode(t){return p(this,bo).get(t)}getCategory(t){return p(this,Jo).get(t)}get locations(){return p(this,mo).values()}get nodes(){return p(this,bo).values()}stats(){return{buildings:this.buildings.length,floors:p(this,Yo).size,locations:p(this,mo).size,shapes:p(this,$o).size,nodes:p(this,bo).size,edges:p(this,Yi),categories:p(this,Jo).size,mapObjects:this.mapObjects.length}}};Zi=new WeakMap,Yo=new WeakMap,mo=new WeakMap,$o=new WeakMap,bo=new WeakMap,Jo=new WeakMap,Yi=new WeakMap;function os(u){let t=new Map;for(let d of u.nodes)t.set(d.id,{id:d.id,lng:d.lng,lat:d.lat,floorId:d.floorId,accessible:d.accessible,privateNode:d.privateNode,edges:[]});let o=0,r=(d,g,y,b,v)=>{d.edges.some(w=>w.toNodeId===g.id)||(d.edges.push(v?{toNodeId:g.id,cost:y,accessible:b,connectionKind:v}:{toNodeId:g.id,cost:y,accessible:b}),o++)};for(let d of u.nodes){let g=t.get(d.id);if(g)for(let y of d.siblings){let b=t.get(y);b&&r(g,b,bn(g.lng,g.lat,b.lng,b.lat),!0)}}for(let d of u.floorConnections){let g=t.get(d.startNodeId),y=t.get(d.endNodeId);if(!g||!y)continue;let b=(d.weight>0?d.weight:100)*(d.multiplier||1);(d.direction==="startToEnd"||d.direction==="both")&&r(g,y,b,d.accessible,d.kind),(d.direction==="endToStart"||d.direction==="both")&&r(y,g,b,d.accessible,d.kind)}let e=new Map;for(let d of u.categories){let g={id:d.id,name:d.name,sortOrder:d.sortOrder};d.icon!==void 0&&(g.icon=d.icon),d.colorHex!==void 0&&(g.colorHex=d.colorHex),e.set(d.id,g)}let n=new Map;for(let d of u.shapes){let g={id:d.id,floorId:d.floorId,layerId:d.layerId,type:d.type,geometry:d.geometry};d.style&&(g.style=d.style),n.set(d.id,g)}let i=new Map;for(let d of u.locations){let g=d.nodeId?t.get(d.nodeId)?.floorId:void 0,y=d.shapeId?n.get(d.shapeId)?.floorId:void 0,b=g??y,v={id:d.id,name:d.name,type:d.type,categories:d.categoryIds.map(w=>e.get(w)).filter(w=>w!==void 0),hidden:d.hidden,sortOrder:d.sortOrder};d.description!==void 0&&(v.description=d.description),d.nodeId!==void 0&&(v.nodeId=d.nodeId),d.shapeId!==void 0&&(v.shapeId=d.shapeId),b!==void 0&&(v.floorId=b),d.amenity!==void 0&&(v.amenity=d.amenity),d.logoUrl!==void 0&&(v.logoUrl=d.logoUrl),i.set(d.id,v)}let s=new Map;for(let d of i.values())d.nodeId&&s.set(d.nodeId,d);for(let d of u.floorConnections)for(let g of[d.startNodeId,d.endNodeId]){let y=t.get(g);if(!y||s.has(g))continue;let b={id:`conn-${d.id}-${g}`,name:d.name??d.kind,type:"connection",nodeId:g,floorId:y.floorId,amenity:d.kind,categories:[],hidden:!1,sortOrder:0};i.set(b.id,b),s.set(g,b)}let l=new Map;for(let d of i.values()){if(!d.floorId)continue;let g=l.get(d.floorId)??[];g.push(d),l.set(d.floorId,g)}let c=new Map;for(let d of n.values()){let g=c.get(d.floorId)??[];g.push(d),c.set(d.floorId,g)}let a=new Map;for(let d of t.values()){let g=a.get(d.floorId)??[];g.push(d),a.set(d.floorId,g)}let f=u.buildings.map(d=>({id:d.id,name:d.name,floors:[...d.floors].sort((g,y)=>g.level-y.level).map(g=>({id:g.id,name:g.name,level:g.level,buildingId:g.buildingId,locations:l.get(g.id)??[],shapes:c.get(g.id)??[],nodes:a.get(g.id)??[]}))})),h=u.mapObjects.map(d=>({...d}));return new qi({id:u.site.id,name:u.site.name,center:u.site.center,buildings:f,categories:[...e.values()].sort((d,g)=>d.sortOrder-g.sortOrder),mapObjects:h,nodes:[...t.values()],shapes:[...n.values()],locations:[...i.values()],edgeCount:o,...u.iconset?{iconset:u.iconset}:{}})}function Kd(u,t){return u.getFloor(t)?.buildingId??null}function nu(u,t){let o=Math.cos((u[1]+t[1])/2*Math.PI/180);return Math.atan2((t[0]-u[0])*o,t[1]-u[1])*180/Math.PI}function Xd(u,t){return(t-u+540)%360-180}function qd(u){return u>=-10&&u<=10?"straight":u>135?"uTurnRight":u>45?"right":u>10?"slightRight":u<-135?"uTurnLeft":u<-45?"left":"slightLeft"}var Zd=25,ou=35,Yd=2,$d={slightRight:"Slight right",right:"Turn right",uTurnRight:"Make a U-turn",slightLeft:"Slight left",left:"Turn left",uTurnLeft:"Make a U-turn"};function Jd(u){return`${String(Math.max(1,Math.round(u)))} m`}function iu(u,t,o){let r=t.map(b=>u.getNode(b)).filter(b=>b!==void 0);if(r.length<2)return null;let e=[],n=null;for(let b=0;b<r.length;b++){let v=r[b];if(v){if(!n||n.floorId!==v.floorId){if(n&&b>0){let T=r[b-1]?.edges.find(x=>x.toNodeId===v.id);T?.connectionKind&&(n.exitKind=T.connectionKind)}n={floorId:v.floorId,buildingId:Kd(u,v.floorId),points:[],nodeIds:[]},e.push(n)}n.points.push([v.lng,v.lat]),n.nodeIds.push(v.id)}}let i=new Map;for(let b of u.locations)!b.nodeId||b.amenity||b.hidden||!b.name||i.has(b.nodeId)||i.set(b.nodeId,b.name);let s=[],l=0;e.forEach((b,v)=>{for(let w=0;w<b.points.length;w++){let T=b.points[w];if(!T)continue;if(w>0){let A=b.points[w-1];A&&(l+=bn(A[0],A[1],T[0],T[1]))}let x=w===0||w===b.points.length-1,E="none",O=!1;if(!x){let A=b.points[w-1],k=b.points[w+1];if(A&&k){let M=Xd(nu(A,T),nu(T,k));Math.abs(M)>Zd&&(E=qd(M),O=!0)}}s.push({lng:T[0],lat:T[1],floorId:b.floorId,buildingId:b.buildingId,segmentIndex:v,cum:l,nodeId:b.nodeIds[w]??"",direction:E,isStep:x||O})}});let c=[];s.forEach((b,v)=>{b.isStep&&c.push(v)});let a=[];for(let b=1;b<c.length;b++){let v=c[b-1],w=c[b];if(v===void 0||w===void 0)continue;let T=s[v],x=s[w];if(!T||!x)continue;let E=x.cum-T.cum;if(E<=ou)continue;let O=Math.ceil(E/ou);for(let A=1;A<O;A++){let k=T.cum+E*A/O,M,F=Yd;for(let D=v+1;D<w;D++){let Y=s[D];if(!Y)continue;let J=Math.abs(Y.cum-k);J<=F&&(F=J,M=Y)}if(M){M.isStep=!0;continue}let I=v;for(let D=v;D<w;D++)(s[D]?.cum??0)<=k&&(I=D);let C=s[I],S=s[Math.min(I+1,w)];if(!C||!S)continue;let m=S.cum-C.cum,L=m>0?(k-C.cum)/m:0;a.push({lng:C.lng+(S.lng-C.lng)*L,lat:C.lat+(S.lat-C.lat)*L,floorId:C.floorId,buildingId:C.buildingId,segmentIndex:C.segmentIndex,cum:k,nodeId:"",direction:"none",isStep:!0})}}let f=[...s,...a].sort((b,v)=>b.cum-v.cum).filter(b=>b.isStep).map(b=>({lng:b.lng,lat:b.lat,floorId:b.floorId,buildingId:b.buildingId,segmentIndex:b.segmentIndex,cumMeters:b.cum,label:"",action:"continue",direction:b.direction,distanceMeters:0,nodeId:b.nodeId,landmark:i.get(b.nodeId)??null})),h=[];for(let b of f){let v=h[h.length-1];v!==void 0&&bn(v.lng,v.lat,b.lng,b.lat)<.5&&v.floorId===b.floorId||h.push(b)}let d=b=>(b?u.getBuilding(b)?.name:void 0)??"outside",g=b=>u.getFloor(b)?.name??b,y=b=>u.getFloor(b)?.level??0;for(let b=0;b<h.length;b++){let v=h[b],w=h[b+1];if(!v)continue;v.distanceMeters=w?Math.max(0,w.cumMeters-v.cumMeters):0;let T=v.distanceMeters>=1?Jd(v.distanceMeters):"";if(b===0)v.action="depart",v.direction="none",v.label=T?`Start at ${o.origin}, then walk ${T}`:`Start at ${o.origin}`;else if(b===h.length-1)v.action="arrive",v.direction="none",v.label=`Arrive at ${o.destination}`;else if(w&&v.buildingId&&w.buildingId===v.buildingId&&w.floorId!==v.floorId){let x=e[v.segmentIndex]?.exitKind??"elevator";v.action="floorChange",v.direction=y(w.floorId)>y(v.floorId)?"up":"down",v.label=`Take the ${x} to ${g(w.floorId)}`}else if(w&&v.buildingId&&!w.buildingId)v.action="exitBuilding",v.direction="none",v.label=`Exit ${d(v.buildingId)}`;else if(!v.buildingId&&w?.buildingId)v.action="enterBuilding",v.direction="none",v.label=`Enter ${d(w.buildingId)}`;else if(v.direction!=="none"&&v.direction!=="straight"){v.action="turn";let x=$d[v.direction]??"Turn",E=v.landmark?` at ${v.landmark}`:"";v.label=T?`${x}${E}, then ${T}`:`${x}${E}`}else{v.action="continue",v.direction="straight";let x=v.buildingId?"":" outside";v.label=T?`Continue${x} for ${T}`:`Continue${x}`}}return{segments:e,steps:h,totalMeters:l}}var Qd=18,ep=18.2,ja=32,ru=4,su=1800,tp=5,np=2e3,op=12,ip=.08;function za(u,t){let o=0;for(let n of u)for(let i=1;i<n.points.length;i++){let s=n.points[i-1],l=n.points[i];if(!s||!l)continue;let c=bn(s[0],s[1],l[0],l[1]);if(o+c>=t&&c>0){let a=(t-o)/c;return[s[0]+(l[0]-s[0])*a,s[1]+(l[1]-s[1])*a]}o+=c}let r=u[u.length-1],e=r?.points[r.points.length-1];return e?[e[0],e[1]]:null}function rp(u,t,o){let r=[],e=za(u,t);e&&r.push(e);let n=0;for(let s of u)for(let l=1;l<s.points.length;l++){let c=s.points[l-1],a=s.points[l];!c||!a||(n+=bn(c[0],c[1],a[0],a[1]),n>t&&n<o&&r.push([a[0],a[1]]))}let i=za(u,o);return i&&r.push(i),r}var sp={top:90,bottom:180,left:70,right:70},ap=19;function lp(u,t,o){if(t.length<2)return null;let r=1/0,e=1/0,n=-1/0,i=-1/0;for(let[s,l]of t)s<r&&(r=s),s>n&&(n=s),l<e&&(e=l),l>i&&(i=l);return n-r<1e-9&&i-e<1e-9?null:u.cameraForBounds([[r,e],[n,i]],{bearing:o,padding:sp,maxZoom:ap})??null}var $t,ot,Un,ht,Bn,Qo,$i,Pt,Dn,Ji,ei,ti,yo,Nn,Mt,yn,ni,oi,Qi,ii,is,er,rs=class{constructor(t){V(this,ii);V(this,$t);V(this,ot);V(this,Un);V(this,ht);V(this,Bn);V(this,Qo);V(this,$i);V(this,Pt,"preview");V(this,Dn,()=>{});V(this,Ji,[]);V(this,ei,0);V(this,ti,0);V(this,yo,0);V(this,Nn,0);V(this,Mt,0);V(this,yn,0);V(this,ni,0);V(this,oi,ru);V(this,Qi,0);V(this,er,()=>{if(p(this,Pt)!=="disposed"){if(p(this,ot).setTime(performance.now()/1e3),p(this,Pt)==="preview"){let t=performance.now(),o;if(t<p(this,ti))o=p(this,yo);else{let r=(t-p(this,ni))/1e3;o=Math.max(0,Math.min(p(this,ot).totalLength,r*p(this,oi)));let e=p(this,Ji)[p(this,ei)],n=e?p(this,ot).nearestBoundary(e.cumMeters)??e.cumMeters:0,i=e?Math.min(e.cumMeters,Math.max(0,n-.05)):0;e&&o>=i&&(p(this,Dn).call(this,{kind:e.kind,toFloorId:e.toFloorId}),N(this,yo,i),N(this,ti,t+su),N(this,ni,t+su-p(this,yo)/p(this,oi)*1e3),kr(this,ei)._++,o=p(this,yo))}if(p(this,ot).setRunner(o),o>0&&o<p(this,ot).totalLength){let r=za(p(this,Un),o);r&&p(this,$t).setCenter(r);let e=p(this,ot).segmentAt(o);e?.buildingId&&p(this,Bn).call(this,e.floorId)}else if(o>=p(this,ot).totalLength)if(p(this,Nn)===0){N(this,Nn,t+np);let r=p(this,ht)[p(this,ht).length-1];r?.buildingId&&p(this,Bn).call(this,r.floorId),r&&p(this,$t).easeTo({center:[r.lng,r.lat],duration:500})}else t>=p(this,Nn)&&(N(this,Nn,0),re(this,ii,is).call(this),p(this,ot).setVisited(0),N(this,yn,0),N(this,Mt,0),p(this,Qo).call(this,this.stepInfo()))}else{let t=p(this,ot).getVisited(),o=Math.abs(t-p(this,yn))<.05?p(this,yn):t+(p(this,yn)-t)*ip;p(this,ot).setVisited(o)}p(this,$i).call(this),N(this,Qi,requestAnimationFrame(p(this,er)))}});N(this,$t,t.map),N(this,ot,t.ribbon),N(this,Un,t.segments),N(this,ht,t.steps),N(this,Bn,t.showFloor),N(this,Qo,t.onStep),N(this,$i,t.repaint),N(this,Dn,t.onTransition??(()=>{})),N(this,Ji,p(this,ht).filter(o=>o.action==="floorChange").map(o=>({cumMeters:o.cumMeters,kind:p(this,Un)[o.segmentIndex]?.exitKind??"elevator",toFloorId:p(this,Un)[o.segmentIndex+1]?.floorId??o.floorId})))}get active(){return p(this,Pt)!=="disposed"}start(){p(this,ot).setProgress(p(this,ot).totalLength),p(this,ot).setVisited(0),N(this,yn,0),this.preview(),p(this,er).call(this)}preview(){if(p(this,Pt)==="disposed")return;let t=p(this,ht)[0];if(!t||p(this,ot).totalLength<=0)return;t.buildingId&&p(this,Bn).call(this,t.floorId),p(this,$t).easeTo({center:[t.lng,t.lat],zoom:Qd,pitch:ja,duration:800});let o=p(this,ot).totalLength,r=Math.min(op,Math.max(tp,o/ru));N(this,oi,o/r),N(this,ni,performance.now()+900),p(this,ot).setRunner(0),p(this,ot).showRunner(),N(this,ei,0),N(this,ti,0),N(this,Nn,0),p(this,Dn).call(this,null),N(this,Pt,"preview")}stepInfo(){let t=p(this,ht)[p(this,Mt)];return{index:p(this,Mt),total:p(this,ht).length,label:t?.label??"",isFirst:p(this,Mt)===0,isLast:p(this,Mt)===p(this,ht).length-1,action:t?.action??"continue",direction:t?.direction??"none",distanceMeters:t?.distanceMeters??0,floorId:t?.floorId??"",landmark:t?.landmark??null}}next(){p(this,Pt)==="preview"&&re(this,ii,is).call(this),this.goToStep(p(this,Mt)+1)}previous(){p(this,Pt)==="preview"&&re(this,ii,is).call(this),this.goToStep(p(this,Mt)-1)}goToStep(t){if(p(this,Pt)!=="step")return;N(this,Mt,Math.max(0,Math.min(p(this,ht).length-1,t)));let o=p(this,ht)[p(this,Mt)];if(!o)return;N(this,yn,o.cumMeters),o.buildingId&&p(this,Bn).call(this,o.floorId);let r;for(let l=p(this,Mt)+1;l<p(this,ht).length;l++){let c=p(this,ht)[l];if(c&&bn(o.lng,o.lat,c.lng,c.lat)>1){r=Math.atan2(c.lng-o.lng,c.lat-o.lat)*180/Math.PI;break}}if(r===void 0)for(let l=p(this,Mt)-1;l>=0;l--){let c=p(this,ht)[l];if(c&&bn(c.lng,c.lat,o.lng,o.lat)>1){r=Math.atan2(o.lng-c.lng,o.lat-c.lat)*180/Math.PI;break}}let e=p(this,ht)[p(this,Mt)+1],n=e?e.cumMeters:p(this,ot).totalLength,i=rp(p(this,Un),o.cumMeters,n),s=lp(p(this,$t),i,r??p(this,$t).getBearing());s?p(this,$t).easeTo({...s,pitch:ja,duration:700}):p(this,$t).easeTo({center:[o.lng,o.lat],zoom:ep,pitch:ja,...r!==void 0?{bearing:r}:{},duration:700}),p(this,Qo).call(this,this.stepInfo())}dispose(){N(this,Pt,"disposed"),p(this,Dn).call(this,null),cancelAnimationFrame(p(this,Qi))}};$t=new WeakMap,ot=new WeakMap,Un=new WeakMap,ht=new WeakMap,Bn=new WeakMap,Qo=new WeakMap,$i=new WeakMap,Pt=new WeakMap,Dn=new WeakMap,Ji=new WeakMap,ei=new WeakMap,ti=new WeakMap,yo=new WeakMap,Nn=new WeakMap,Mt=new WeakMap,yn=new WeakMap,ni=new WeakMap,oi=new WeakMap,Qi=new WeakMap,ii=new WeakSet,is=function(){p(this,ot).hideRunner(),p(this,Dn).call(this,null),N(this,Pt,"step")},er=new WeakMap;var cp={slightLeft:"\u2196",left:"\u2190",uTurnLeft:"\u21B0",slightRight:"\u2197",right:"\u2192",uTurnRight:"\u21B1",straight:"\u2191",up:"\u21E7",down:"\u21E9"};function au(u,t){let o=document.createElement("div");o.style.cssText="position:absolute;bottom:24px;left:50%;transform:translateX(-50%);z-index:10;display:flex;align-items:center;gap:10px;background:#1f2937;color:#fff;border-radius:999px;padding:8px 14px;font-family:system-ui,sans-serif;box-shadow:0 2px 12px rgba(0,0,0,.25)";let r=(f,h,d=!1)=>{let g=document.createElement("button");return g.textContent=f,g.style.cssText=`background:${d?"#7f1d1d":"#374151"};color:#fff;border:none;border-radius:999px;width:38px;height:38px;font-size:15px;font-weight:700;cursor:pointer`,g.onclick=h,g},e=r("\u25C0",t.onPrev),n=r("\u25B6",t.onNext),i=r("\u2715",t.onClear,!0),s=document.createElement("div");s.style.cssText="text-align:center;min-width:170px;font-size:12px;line-height:1.35";let l=document.createElement("b");l.style.fontSize="13px";let c=document.createElement("span");c.style.cssText="font-size:15px;font-weight:700;margin-right:5px";let a=document.createElement("span");return s.append(l,document.createElement("br"),c,a),o.append(e,s,n,i),u.appendChild(o),{update(f){l.textContent=`Step ${String(f.index+1)} / ${String(f.total)}`,c.textContent=cp[f.direction]??"",a.textContent=f.label,e.disabled=f.isFirst,n.disabled=f.isLast,e.style.opacity=f.isFirst?"0.35":"1",n.style.opacity=f.isLast?"0.35":"1"},dispose(){o.remove()}}}function lu(u){let t=null;return{async load(){if(!u.provider)throw new Error("becomap: no venue provider configured \u2014 pass options.venue.provider to createMap");try{let o=await u.provider.fetchVenue(u.signal);return t=os(o),u.onLoaded?.(t),t.stats()}catch(o){let r=o instanceof Error?o.message:"venue load failed";throw u.emitter.emit("error",{message:r,cause:o}),o}},current:()=>t,stats:()=>t?.stats()??null}}function cu(u){return{select:u.select,focusedBuildingId:u.focusedBuildingId,viewOf:u.viewOf}}function uu(u){return{query:u.query,byCategory:u.byCategory}}function fu(u){return{...u}}function hu(u){return{focusVenue:u.focusVenue,focusTo:u.focusTo}}function up(){if(typeof document>"u"||document.getElementById("bc-chip-style"))return;let u=document.createElement("style");u.id="bc-chip-style";let t="#1b1f2a";u.textContent=`.maplibregl-popup.bc-chip .maplibregl-popup-content{background:${t};color:#fff;padding:5px 12px;border-radius:8px;font:600 13px/1.2 system-ui,-apple-system,'Segoe UI',sans-serif;box-shadow:0 4px 14px rgba(16,19,28,.32);white-space:nowrap;}.maplibregl-popup.bc-chip .maplibregl-popup-close-button{display:none;}.maplibregl-popup.bc-chip.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,.maplibregl-popup.bc-chip.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,.maplibregl-popup.bc-chip.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{border-top-color:${t};}.maplibregl-popup.bc-chip.maplibregl-popup-anchor-top .maplibregl-popup-tip,.maplibregl-popup.bc-chip.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,.maplibregl-popup.bc-chip.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{border-bottom-color:${t};}.maplibregl-popup.bc-chip.maplibregl-popup-anchor-left .maplibregl-popup-tip{border-right-color:${t};}.maplibregl-popup.bc-chip.maplibregl-popup-anchor-right .maplibregl-popup-tip{border-left-color:${t};}`,document.head.appendChild(u)}function fp(){if(typeof document>"u"||document.getElementById("bc-transition-style"))return;let u=document.createElement("style");u.id="bc-transition-style",u.textContent=".bc-transition-card{position:absolute;top:14%;left:50%;transform:translateX(-50%);z-index:30;background:rgba(8,8,10,.94);color:#fff;padding:22px 30px;border-radius:14px;font:700 20px/1.3 system-ui,-apple-system,'Segoe UI',sans-serif;text-align:center;box-shadow:0 10px 34px rgba(0,0,0,.4);pointer-events:none;}.bc-transition-icons{display:flex;gap:30px;justify-content:center;margin-top:16px;}.bc-transition-icons svg{width:38px;height:38px;stroke:#fff;fill:none;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;}",document.head.appendChild(u)}function hp(u){return u==="up"?'<svg viewBox="0 0 24 24"><path d="M12 20V5M6 11l6-6 6 6"/></svg>':'<svg viewBox="0 0 24 24"><path d="M12 4v15M6 13l6 6 6-6"/></svg>'}function dp(u){let t=u.toLowerCase();return t.includes("elevator")||t.includes("lift")?'<svg viewBox="0 0 24 24"><rect x="5" y="4" width="14" height="17" rx="1.5"/><path d="M9.5 10l2.5-3 2.5 3M9.5 15l2.5 3 2.5-3"/></svg>':t.includes("stair")?'<svg viewBox="0 0 24 24"><path d="M4 20h4v-4h4v-4h4V8h4"/></svg>':'<svg viewBox="0 0 24 24"><path d="M4 19h3l10-11h3M7 19l10-11M10 19l7.5-8.2"/></svg>'}var Fe,dt,ri,tr,vo,nr,vn,je,Xe,Vn,He,wo,vt,jn,si,ai,zn,st,Wn,li,To,or,wn,ir,Me,du,pu,Xa,gu,mu,qa,bu,Za,yu,ss,Ya,Hn,Gn,Ka=class{constructor(t,o){V(this,Me);V(this,Fe);V(this,dt,new Ir);V(this,ri,!1);V(this,tr,new AbortController);V(this,vo);V(this,nr);V(this,vn);this.search=uu({query:async t=>p(this,wo)?p(this,wo).query(t):Promise.resolve([]),byCategory:t=>p(this,wo)?.byCategory(t)??[]});this.routing=fu({route:(t,o,r)=>re(this,Me,bu).call(this,t,o,r),clear:()=>{re(this,Me,ss).call(this)},preview:()=>{p(this,st)?.preview()},next:()=>{p(this,st)?.next()},previous:()=>{p(this,st)?.previous()},stepInfo:()=>p(this,st)?.stepInfo()??null,active:()=>p(this,st)?.active??!1});this.camera=hu({focusVenue:t=>{p(this,je)?.focusVenue(t)},focusTo:t=>{re(this,Me,pu).call(this,t)}});V(this,je,null);V(this,Xe,null);V(this,Vn,null);V(this,He,null);V(this,wo,null);V(this,vt,null);V(this,jn,null);V(this,si,null);V(this,ai,!1);V(this,zn,null);V(this,st,null);V(this,Wn,null);V(this,li,null);V(this,To,null);V(this,or,!0);V(this,wn,null);V(this,ir,!0);N(this,vo,t),N(this,nr,o.ui?.floorSwitcher!==!1),N(this,ir,o.ui?.routeBar!==!1),N(this,or,o.ui?.transitionCard!==!1),N(this,vn,o.polygonTheme??"ivory"),this.venue=lu({...o.venue?.provider?{provider:o.venue.provider}:{},emitter:p(this,dt),signal:p(this,tr).signal,onLoaded:r=>{re(this,Me,du).call(this,r)}}),this.floors=cu({select:r=>{re(this,Me,Hn).call(this,p(this,Xe)?.selectFloor(r)??[])},focusedBuildingId:()=>p(this,Xe)?.focusedBuildingId()??null,viewOf:r=>p(this,Xe)?.viewOf(r)}),N(this,Fe,new Wa.default.Map({container:t,center:o.center??[0,0],zoom:o.zoom??15,pitch:o.pitch??0,bearing:o.bearing??0,antialias:!0,attributionControl:!1,style:"https://beco-lightning-backend.s3.ap-southeast-1.amazonaws.com/styles/style.json"})),p(this,Fe).on("load",()=>{p(this,Fe).getLayer("bc-dim")||p(this,Fe).addLayer({id:"bc-dim",type:"background",paint:{"background-color":"#000000","background-opacity":.08}}),N(this,ri,!0),p(this,dt).emit("load",void 0)}),p(this,Fe).on("error",r=>{let e=r.error,n=e instanceof Error?e.message:"map error";p(this,dt).emit("error",{message:n,cause:e})})}on(t,o){p(this,dt).on(t,o),t==="load"&&p(this,ri)&&o(void 0)}off(t,o){p(this,dt).off(t,o)}destroy(){p(this,tr).abort(),p(this,st)?.dispose(),N(this,st,null),p(this,wn)?.dispose(),N(this,wn,null),p(this,zn)?.dispose(),N(this,zn,null),p(this,Vn)?.dispose(),N(this,Vn,null),p(this,je)?.dispose(),N(this,je,null),p(this,Fe).remove(),p(this,dt).removeAll()}getFrameStats(){return p(this,je)?.getFrameStats()??{drawCalls:0,triangles:0}}getMapLibreMap(){return p(this,Fe)}setPolygonTheme(t){N(this,vn,t),p(this,je)?.setTheme(t),p(this,Fe).getLayer("bg")&&p(this,Fe).setPaintProperty("bg","background-color",_n(t).background)}selectLocation(t){let o=p(this,He)?.getLocation(t);o&&(o.floorId&&re(this,Me,Hn).call(this,p(this,Xe)?.selectFloor(o.floorId)??[]),re(this,Me,qa).call(this,o),re(this,Me,Gn).call(this))}clearSelection(){var t;(t=p(this,jn))==null||t.call(this),N(this,jn,null),p(this,vt)&&(p(this,vt).popup.remove(),N(this,vt,null),p(this,je)?.setHighlight(null))}};Fe=new WeakMap,dt=new WeakMap,ri=new WeakMap,tr=new WeakMap,vo=new WeakMap,nr=new WeakMap,vn=new WeakMap,je=new WeakMap,Xe=new WeakMap,Vn=new WeakMap,He=new WeakMap,wo=new WeakMap,vt=new WeakMap,jn=new WeakMap,si=new WeakMap,ai=new WeakMap,zn=new WeakMap,st=new WeakMap,Wn=new WeakMap,li=new WeakMap,To=new WeakMap,or=new WeakMap,wn=new WeakMap,ir=new WeakMap,Me=new WeakSet,du=function(t){p(this,je)?.dispose(),N(this,He,t);let o=()=>{N(this,je,new Zr(p(this,Fe),t,p(this,vn))),N(this,Xe,new $r(t)),N(this,wo,new Jr(t)),N(this,zn,new es(t)),p(this,nr)&&N(this,Vn,eu(p(this,vo),r=>{this.floors.select(r)})),re(this,Me,Hn).call(this,p(this,Xe).update(p(this,Fe).getZoom())),re(this,Me,Gn).call(this),p(this,je).focusVenue(),p(this,Fe).on("zoom",()=>{re(this,Me,Hn).call(this,p(this,Xe)?.update(p(this,Fe).getZoom())??[])}),p(this,Fe).on("zoomend",()=>{re(this,Me,Hn).call(this,p(this,Xe)?.onZoomEnd(p(this,Fe).getZoom())??[])}),p(this,Fe).on("click",r=>{re(this,Me,gu).call(this,r.point.x,r.point.y,r.lngLat.lng,r.lngLat.lat)}),p(this,Fe).on("mousemove",r=>{re(this,Me,mu).call(this,r.point.x,r.point.y,r.lngLat.lng,r.lngLat.lat)}),p(this,Fe).getCanvas().addEventListener("mouseleave",()=>{N(this,si,null),p(this,je)?.setHover(null)})};p(this,ri)?o():p(this,Fe).on("load",o)},pu=function(t){let o=p(this,He)?.getLocation(t);if(!o?.floorId||!p(this,He))return;this.selectLocation(t);let r=null;if(o.nodeId){let e=p(this,He).getNode(o.nodeId);e&&(r=[e.lng,e.lat])}if(!r&&o.shapeId){let e=p(this,He).getShape(o.shapeId)?.geometry,n=e?.type==="Polygon"?e.coordinates[0]:void 0;if(n&&n.length>=3){let i=Qn(p(this,He).center),[s,l]=Xt(Bt(i,n));r=_r(i,s,l)}}r&&p(this,Fe).easeTo({center:r,zoom:18,pitch:45,duration:900})},Xa=function(t,o,r,e){if(!p(this,He)||!p(this,Xe))return{kind:"outdoor"};let n=tu(p(this,He),a=>p(this,Xe)?.viewOf(a),r,e),i=p(this,je)?.pickRay(t,o);if(!i||Math.abs(i.dir.z)<1e-9)return n;let s=_n(p(this,vn)),l=Qn(p(this,He).center),c=null;for(let a of p(this,He).buildings){let f=p(this,Xe).viewOf(a.id);if(!f?.open)continue;let h=a.floors.find(g=>g.id===f.floorId);if(!h)continue;let d=new Map(h.locations.filter(g=>g.shapeId&&!g.hidden).map(g=>[g.shapeId,g]));for(let g of h.shapes){if(g.geometry.type!=="Polygon")continue;let y=d.get(g.id);if(!y)continue;let b=s.panel?.uniformHeight??g.style?.height??Lo(g.id);if(b<=.2)continue;let w=(.6+b-i.origin.z)/i.dir.z;if(w<=0)continue;let T=i.origin.x+i.dir.x*w,x=i.origin.y+i.dir.y*w,[E,O]=_r(l,T,x),A=g.geometry.coordinates[0];A&&A.length>=3&&Io(A,E,O)&&(!c||w<c.t)&&(c={t:w,target:{kind:"store",buildingId:a.id,floorId:h.id,location:y,shape:g}})}}return c?c.target:n},gu=function(t,o,r,e){if(!p(this,He)||!p(this,Xe))return;let n=re(this,Me,Xa).call(this,t,o,r,e);switch(n.kind){case"sealed":{re(this,Me,Hn).call(this,p(this,Xe).clickOpen(n.buildingId)),re(this,Me,Gn).call(this);let i=0,s=0;for(let l of n.ring)i+=l[0],s+=l[1];p(this,Fe).flyTo({center:[i/n.ring.length,s/n.ring.length],zoom:17,pitch:55,duration:1400});break}case"store":if(p(this,st)?.active)break;re(this,Me,qa).call(this,n.location),p(this,Xe).focusBuilding(n.buildingId),re(this,Me,Gn).call(this);break;case"corridor":p(this,Xe).focusBuilding(n.buildingId),re(this,Me,Gn).call(this);break;case"outdoor":p(this,st)?.active||this.clearSelection();break}},mu=function(t,o,r,e){if(!p(this,He)||!p(this,Xe))return;let n=re(this,Me,Xa).call(this,t,o,r,e);p(this,Fe).getCanvas().style.cursor=n.kind==="sealed"||n.kind==="store"?"pointer":"";let i=n.kind==="store"&&!p(this,st)?.active&&n.location.id!==p(this,vt)?.location.id?n.location:null;if((i?.id??null)!==p(this,si)){if(N(this,si,i?.id??null),i?.shapeId){let s=p(this,He).getShape(i.shapeId),l=s?.geometry.type==="Polygon"?s.geometry.coordinates[0]:void 0;if(s&&l&&l.length>=3){p(this,je)?.setHover(l,s.style?.height??Lo(s.id));return}}p(this,je)?.setHover(null)}},qa=function(t){if(!p(this,He)||!t.floorId)return;this.clearSelection();let o=t.shapeId?p(this,He).getShape(t.shapeId):void 0,r=null,e=null;if(o&&o.geometry.type==="Polygon"){let i=o.geometry.coordinates[0];if(i&&i.length>=3){let s=o.style?.height??Lo(o.id);p(this,je)?.setHighlight(i,s);let l=Qn(p(this,He).center),[c,a]=Xt(Bt(l,i));r=_r(l,c,a);let h=_n(p(this,vn)).panel?.uniformHeight??s;e={x:c,y:a,z:.6+Math.max(.2,h)+.1}}}if(!r&&t.nodeId){let i=p(this,He).getNode(t.nodeId);i&&(r=[i.lng,i.lat])}if(!r)return;up();let n=new Wa.default.Popup({closeOnClick:!1,closeButton:!1,offset:10,className:"bc-chip"}).setLngLat(r).setText(t.name).addTo(p(this,Fe));if(e){let i=NaN,s=NaN,l=()=>{let c=p(this,je)?.projectPoint(e.x,e.y,e.z);c&&(Math.abs(c.x-i)<.5&&Math.abs(c.y-s)<.5||(i=c.x,s=c.y,n.setLngLat(p(this,Fe).unproject([c.x,c.y]))))};p(this,Fe).on("render",l),N(this,jn,()=>{p(this,Fe).off("render",l)}),p(this,Fe).triggerRepaint()}n.on("close",()=>{var i;!p(this,ai)&&p(this,vt)?.popup===n&&((i=p(this,jn))==null||i.call(this),N(this,jn,null),N(this,vt,null),p(this,je)?.setHighlight(null))}),N(this,vt,{location:t,floorId:t.floorId,popup:n}),p(this,dt).emit("select",{locationId:t.id}),re(this,Me,Ya).call(this)},bu=async function(t,o,r={}){if(!p(this,He)||!p(this,zn)||!p(this,je)||!p(this,Xe))throw new Error("becomap: load a venue before routing");let e=p(this,He).getLocation(t),n=p(this,He).getLocation(o);if(!e?.nodeId||!n?.nodeId)throw new Error("becomap: both locations must exist and have graph nodes");let i=await p(this,zn).findPath(e.nodeId,n.nodeId,r);if(!i)throw new Error("becomap: no route found");let s=iu(p(this,He),i.path,{origin:e.name,destination:n.name});if(!s)throw new Error("becomap: route could not be built");re(this,Me,ss).call(this,!1);let l=p(this,je).routeRibbon();l.setRoute(s.segments);for(let b of s.segments)b.buildingId&&p(this,je).prepareFloor(b.floorId);l.updateVisibility((b,v)=>{let w=v?p(this,Xe)?.viewOf(v):void 0;return w?.open===!0&&w.floorId===b});let c=s.segments[0],a=c?.points[0],f=.75,h=null;if(c&&a){let b=p(this,He).getFloor(c.floorId),v=_n(p(this,vn));for(let T of b?.shapes??[]){if(T.geometry.type!=="Polygon")continue;let x=T.geometry.coordinates[0];if(!x||x.length<3||!Io(x,a[0],a[1]))continue;let E=v.panel?.uniformHeight??T.style?.height??Lo(T.id);f=Math.max(f,.6+Math.max(.2,E)+.05)}l.setStartMarkerAltitude(f);let w=Qn(p(this,He).center);h=Bt(w,[a])[0]??null}let d=s.segments[0]?.points[0]?.[1]??0,g=Math.cos(d*Math.PI/180),y=()=>{let b=p(this,Fe).getBearing(),v=p(this,Fe).getPitch(),w=g*40075016686e-3/(512*Math.pow(2,p(this,Fe).getZoom()));if(h){let T=b*Math.PI/180,x=v*Math.PI/180,E=[Math.sin(T)*Math.cos(x),Math.cos(T)*Math.cos(x),Math.sin(x)],O=p(this,je)?.projectPoint(h[0],h[1],f),A=p(this,je)?.projectPoint(h[0]+(E[0]??0),h[1]+(E[1]??0),f+(E[2]??0));if(O&&A){let k=Math.hypot(A.x-O.x,A.y-O.y);k>.001&&(w=1/k)}}l.setStartMarkerView(b,v,w)};return y(),N(this,Wn,y),p(this,Fe).on("move",y),p(this,Fe).on("render",y),p(this,ir)&&N(this,wn,au(p(this,vo),{onPrev:()=>{p(this,st)?.previous()},onNext:()=>{p(this,st)?.next()},onClear:()=>{re(this,Me,ss).call(this)}})),N(this,st,new rs({map:p(this,Fe),ribbon:l,segments:s.segments,steps:s.steps,showFloor:b=>{re(this,Me,Hn).call(this,p(this,Xe)?.selectFloor(b)??[])},onStep:b=>{p(this,wn)?.update(b),p(this,dt).emit("step",b)},onTransition:b=>{re(this,Me,Za).call(this,b)},repaint:()=>{p(this,je)?.repaint()}})),p(this,st).start(),p(this,dt).emit("routeChange",{routeId:`${t}->${o}`}),{distanceMeters:Math.round(s.totalMeters),stepCount:s.steps.length}},Za=function(t){if(p(this,To)&&(clearTimeout(p(this,To)),N(this,To,null)),p(this,li)?.remove(),N(this,li,null),!t){p(this,dt).emit("transition",null);return}let o=p(this,He)?.getFloor(t.toFloorId),r=re(this,Me,yu).call(this,t.toFloorId),e=(o?.level??0)>=r?"up":"down",n=t.kind.charAt(0).toUpperCase()+t.kind.slice(1),i=o?.name??t.toFloorId,s=`Take the ${n} to ${i}`;if(p(this,dt).emit("transition",{kind:t.kind,toFloorId:t.toFloorId,toFloorName:i,direction:e,label:s}),p(this,je)?.prepareFloor(t.toFloorId),!p(this,or))return;fp();let l=document.createElement("div");l.className="bc-transition-card";let c=hp(e);l.innerHTML=`<div class="bc-transition-title"></div><div class="bc-transition-icons">${c}${dp(t.kind)}${c}</div>`;let a=l.querySelector(".bc-transition-title");a&&(a.textContent=s),p(this,vo).appendChild(l),N(this,li,l),N(this,To,setTimeout(()=>{re(this,Me,Za).call(this,null)},1600))},yu=function(t){let o=p(this,He)?.getFloor(t)?.buildingId,r=o?p(this,Xe)?.viewOf(o):void 0;return(r?.floorId?p(this,He)?.getFloor(r.floorId):void 0)?.level??(p(this,He)?.getFloor(t)?.level??1)-1},ss=function(t=!0){let o=p(this,st)!==null;p(this,st)?.dispose(),N(this,st,null),p(this,wn)?.dispose(),N(this,wn,null),p(this,je)?.routeRibbon().clear(),p(this,Wn)&&(p(this,Fe).off("move",p(this,Wn)),p(this,Fe).off("render",p(this,Wn)),N(this,Wn,null)),p(this,je)?.repaint(),t&&o&&(p(this,dt).emit("step",null),p(this,dt).emit("routeChange",{routeId:null}))},Ya=function(){if(!p(this,vt)||!p(this,He)||!p(this,Xe))return;let t=p(this,He).getFloor(p(this,vt).floorId),o=t?p(this,Xe).viewOf(t.buildingId):void 0,r=o?.open===!0&&o.floorId===p(this,vt).floorId;p(this,je)?.setHighlightVisible(r);let e=p(this,vt).popup.isOpen();r&&!e&&p(this,vt).popup.addTo(p(this,Fe)),!r&&e&&(N(this,ai,!0),p(this,vt).popup.remove(),N(this,ai,!1))},Hn=function(t){if(!p(this,je)||t.length===0){if(t.length>0)return;re(this,Me,Gn).call(this);return}for(let o of t)p(this,je).applyView(o.buildingId,o.view),o.view.open&&p(this,dt).emit("floorChange",{floorId:o.view.floorId});re(this,Me,Ya).call(this),re(this,Me,Gn).call(this)},Gn=function(){if(!p(this,Vn)||!p(this,He)||!p(this,Xe))return;let t=p(this,Xe).focusedBuildingId(),o=t?p(this,He).getBuilding(t)??null:null;p(this,Vn).update(o,t?p(this,Xe).viewOf(t):void 0)};function vu(u,t={}){return Ul(u),new Ka(u,t)}var as=[55.2708,25.2048],wu=111320;function Ut(u,t){return[as[0]+u/(wu*Math.cos(as[1]*Math.PI/180)),as[1]+t/wu]}function pp(u){let t=u>>>0;return()=>(t=t*1664525+1013904223>>>0,t/4294967296)}function gp(u,t,o){let r=!1;for(let e=0,n=u.length-1;e<u.length;n=e++){let i=u[e],s=u[n];if(!i||!s)continue;let[l,c]=i,[a,f]=s;c>o!=f>o&&t<(a-l)*(o-c)/(f-c)+l&&(r=!r)}return r}var mp=[{id:"bldg-a",name:"North Mall",cx:-175,cy:95,w:150,d:120,floors:3},{id:"bldg-b",name:"East Wing",cx:175,cy:70,w:140,d:140,floors:4},{id:"bldg-c",name:"South Plaza",cx:-15,cy:-175,w:165,d:120,floors:2}],Tu=["G","1","2","3"],rr=[-5,-15],ci=10,$a=7,xu=4,an=5,Eu=9,bp=7,Ja=[{id:"cat-fashion",name:"Fashion",colorHex:"#93b7d4"},{id:"cat-food",name:"Food & Drink",colorHex:"#f2a65e"},{id:"cat-services",name:"Services",colorHex:"#f7d488"},{id:"cat-beauty",name:"Beauty",colorHex:"#e8968a"},{id:"cat-electronics",name:"Electronics",colorHex:"#9ccfc3"}];function yp(u){let t=u.w/2,o=u.d/2,r=[];if(u.id.startsWith("bldg-a")){let e=t-o;r.push([-e,-o],[t,-o],[t,o],[-e,o]);for(let n=1;n<16;n++){let i=Math.PI/2+n/16*Math.PI;r.push([-e+Math.cos(i)*o,Math.sin(i)*o])}}else if(u.id.startsWith("bldg-b"))r.push([-t,-o],[t,-o],[t,10],[10,10],[10,o],[-t,o]);else{r.push([-t,-o],[t,-o],[t,o-40]);for(let e=1;e<=8;e++){let n=e/8*(Math.PI/2);r.push([t-45+Math.cos(n)*45*(1-e/16),o-40+Math.sin(n)*40])}r.push([t-45,o],[-t+22,o],[-t,o-25])}return r}function Su(u){let t=u.map(([r,e])=>Ut(r,e)),o=t[0];return o&&t.push([o[0],o[1]]),{type:"Polygon",coordinates:[t]}}function vp(u,t,o,r){return[[u-o/2,t-r/2],[u+o/2,t-r/2],[u+o/2,t+r/2],[u-o/2,t+r/2]]}var sr,Kn,ls=class{constructor(t={}){V(this,sr);V(this,Kn);N(this,sr,t.seed??1337),N(this,Kn,Math.max(1,Math.floor(t.stress??1)))}async fetchVenue(){let t=[],o=[],r=[],e=[],n=[],i=(a,f)=>{a.siblings.includes(f.id)||a.siblings.push(f.id),f.siblings.includes(a.id)||f.siblings.push(a.id)},s="outdoor",l=[],c=new Map;for(let a=0;a<p(this,Kn);a++)for(let f=0;f<p(this,Kn);f++){let h=a*900,d=f*900,g=p(this,Kn)>1?`-t${String(a)}${String(f)}`:"",y=`node-plaza${g}`,b={id:y,lng:Ut(rr[0]+h,rr[1]+d)[0],lat:Ut(rr[0]+h,rr[1]+d)[1],floorId:s,accessible:!0,privateNode:!1,siblings:[]};o.push(b),c.set(y,b);for(let v of mp)l.push({...v,id:`${v.id}${g}`,name:p(this,Kn)>1?`${v.name} ${String(a)}${String(f)}`:v.name,cx:v.cx+h,cy:v.cy+d,plazaId:y,plazaY:rr[1]+d})}for(let a of l){let f=c.get(a.plazaId);if(!f)continue;let h=0;for(let T=0;T<a.id.length;T++)h=h*31+a.id.charCodeAt(T)>>>0;let d=p(this,sr)+h%1e5,y=yp(a).map(([T,x])=>[T+a.cx,x+a.cy]),b=a.plazaY-a.cy>0?1:-1,v={id:a.id,name:a.name,floors:[]},w=[];for(let T=0;T<a.floors;T++){let x=pp(d+T*7919),E=`${a.id}-f${String(T)}`;v.floors.push({id:E,name:Tu[T]??String(T),level:T,buildingId:a.id}),r.push({id:`${E}-footprint`,floorId:E,layerId:"footprint",type:"polygon",geometry:Su(y)});let O={id:`${E}-elev`,lng:Ut(a.cx,a.cy)[0],lat:Ut(a.cx,a.cy)[1],floorId:E,accessible:!0,privateNode:!1,siblings:[]};o.push(O),w.push(O.id);let A=ci+$a,k=a.cy-a.d/2+an+$a+ci/2,M=a.cy+a.d/2-an-ci/2,F=[],I=0;for(let m=k;m<=M+.01;m+=A){let L=m-ci/2-$a/2,D={id:`${E}-jn-${String(F.length)}`,lng:Ut(a.cx,L)[0],lat:Ut(a.cx,L)[1],floorId:E,accessible:!0,privateNode:!1,siblings:[]};o.push(D),F.push(D);let Y=[[a.cx-a.w/2+an,a.cx-xu],[a.cx+xu,a.cx+a.w/2-an]];for(let[J,j]of Y){let H=J+x()*3,R=D,P=m-ci/2;for(;H<j-Eu;){let U=Eu+x()*bp;if(H+U>j)break;let G=1.5+x()*2.5;if(x()<.08){H+=U*.6;continue}let B=ci*(.85+x()*.35),W=H+U/2,K=P+B/2;if(![[W-U/2-an,P-1],[W+U/2+an,P-1],[W+U/2+an,P+B+an],[W-U/2-an,P+B+an]].every(([$,Ie])=>gp(y,$,Ie))){H+=U+G;continue}I++;let ne=`${E}-s${String(I).padStart(2,"0")}`;r.push({id:`${ne}-shape`,floorId:E,layerId:"unit",type:"polygon",geometry:Su(vp(W,K,U,B))});let se={id:`${ne}-node`,lng:Ut(W,L)[0],lat:Ut(W,L)[1],floorId:E,accessible:!0,privateNode:!1,siblings:[]};o.push(se),i(R,se),R=se;let Q=Ja[Math.floor(x()*Ja.length)];e.push({id:`${ne}-loc`,name:`${a.name.split(" ")[0]??a.id} ${Tu[T]??String(T)}-${String(I).padStart(2,"0")}`,type:"tenant",nodeId:se.id,shapeId:`${ne}-shape`,categoryIds:Q?[Q.id]:[],hidden:!1,sortOrder:I}),H+=U+G}}}for(let m=1;m<F.length;m++){let L=F[m-1],D=F[m];L&&D&&i(L,D)}let C,S=1/0;for(let m of F){let L=Math.abs(m.lat-O.lat);L<S&&(S=L,C=m)}if(C&&i(O,C),T===0){let m=a.cy+b*(a.d/2),L={id:`${a.id}-door`,lng:Ut(a.cx,m)[0],lat:Ut(a.cx,m)[1],floorId:E,accessible:!0,privateNode:!1,siblings:[]},D={id:`${a.id}-apron`,lng:Ut(a.cx,m+b*10)[0],lat:Ut(a.cx,m+b*10)[1],floorId:s,accessible:!0,privateNode:!1,siblings:[]};o.push(L,D);let Y=b===-1?F[0]:F[F.length-1];Y&&i(L,Y),i(L,D),i(D,f),e.push({id:`${a.id}-entrance`,name:`${a.name} Entrance`,type:"entrance",nodeId:L.id,categoryIds:[],hidden:!1,sortOrder:0})}}for(let T=1;T<w.length;T++){let x=w[T-1],E=w[T];!x||!E||n.push({id:`${a.id}-elevator-${String(T)}`,kind:"elevator",name:`${a.name} Elevator`,accessible:!0,weight:0,multiplier:1,direction:"both",startNodeId:x,endNodeId:E})}t.push(v)}return{site:{id:"mock-site",name:"Mock Campus",center:as},buildings:t,nodes:o,shapes:r,locations:e,categories:Ja.map((a,f)=>({id:a.id,name:a.name,sortOrder:f,colorHex:a.colorHex})),mapObjects:[],floorConnections:n}}};sr=new WeakMap,Kn=new WeakMap;var pi=gt(Rf(),1),Te=pi.default.Reader,Tt=pi.default.Writer,me=pi.default.util,z=me.global.Object,q=me.global.undefined,xe=me.global.Error,Ue=pi.default.roots.default||(pi.default.roots.default={}),gi=Ue.com=(()=>{let u={};return u.beco=(function(){let t={};return t.category=(function(){let o={};return o.Category=(function(){let r=function(e){if(e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.categoryId="",r.prototype.name="",r.prototype.iconFromDefaultList="",r.prototype.sortOrder=0,r.prototype.color=null,r.prototype.externalId="",r.prototype.siteId="",r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.categoryId!=null&&z.hasOwnProperty.call(e,"categoryId")&&e.categoryId!==""&&n.uint32(10).string(e.categoryId),e.name!=null&&z.hasOwnProperty.call(e,"name")&&e.name!==""&&n.uint32(18).string(e.name),e.iconFromDefaultList!=null&&z.hasOwnProperty.call(e,"iconFromDefaultList")&&e.iconFromDefaultList!==""&&n.uint32(26).string(e.iconFromDefaultList),e.sortOrder!=null&&z.hasOwnProperty.call(e,"sortOrder")&&e.sortOrder!==0&&n.uint32(32).int32(e.sortOrder),e.color!=null&&z.hasOwnProperty.call(e,"color")&&Ue.com.beco.category.Color.encode(e.color,n.uint32(42).fork(),i+1).ldelim(),e.externalId!=null&&z.hasOwnProperty.call(e,"externalId")&&e.externalId!==""&&n.uint32(50).string(e.externalId),e.siteId!=null&&z.hasOwnProperty.call(e,"siteId")&&e.siteId!==""&&n.uint32(58).string(e.siteId),e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.category.Category,f;for(;e.pos<c;){let h=e.pos,d=e.tag();if(d===i){i=q;break}let g=d&7;switch(d>>>=3){case 1:{if(g!==2)break;(f=e.stringVerify()).length?a.categoryId=f:delete a.categoryId;continue}case 2:{if(g!==2)break;(f=e.stringVerify()).length?a.name=f:delete a.name;continue}case 3:{if(g!==2)break;(f=e.stringVerify()).length?a.iconFromDefaultList=f:delete a.iconFromDefaultList;continue}case 4:{if(g!==0)break;(f=e.int32())?a.sortOrder=f:delete a.sortOrder;continue}case 5:{if(g!==2)break;a.color=Ue.com.beco.category.Color.decode(e,e.uint32(),q,s+1,a.color);continue}case 6:{if(g!==2)break;(f=e.stringVerify()).length?a.externalId=f:delete a.externalId;continue}case 7:{if(g!==2)break;(f=e.stringVerify()).length?a.siteId=f:delete a.siteId;continue}}e.skipType(g,s,d),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(h,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.category.Category"},r})(),o.Color=(function(){let r=function(e){if(e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.rgba="",r.prototype.hex="",r.prototype.opacity=0,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.rgba!=null&&z.hasOwnProperty.call(e,"rgba")&&e.rgba!==""&&n.uint32(10).string(e.rgba),e.hex!=null&&z.hasOwnProperty.call(e,"hex")&&e.hex!==""&&n.uint32(18).string(e.hex),e.opacity!=null&&z.hasOwnProperty.call(e,"opacity")&&!z.is(e.opacity,0)&&n.uint32(25).double(e.opacity),e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.category.Color,f;for(;e.pos<c;){let h=e.pos,d=e.tag();if(d===i){i=q;break}let g=d&7;switch(d>>>=3){case 1:{if(g!==2)break;(f=e.stringVerify()).length?a.rgba=f:delete a.rgba;continue}case 2:{if(g!==2)break;(f=e.stringVerify()).length?a.hex=f:delete a.hex;continue}case 3:{if(g!==1)break;z.is(f=e.double(),0)?delete a.opacity:a.opacity=f;continue}}e.skipType(g,s,d),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(h,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.category.Color"},r})(),o.CategoryList=(function(){let r=function(e){if(this.categories=[],e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.categories=me.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.categories!=null&&e.categories.length)for(let s=0;s<e.categories.length;++s)Ue.com.beco.category.Category.encode(e.categories[s],n.uint32(10).fork(),i+1).ldelim();if(e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.category.CategoryList;for(;e.pos<c;){let f=e.pos,h=e.tag();if(h===i){i=q;break}let d=h&7;switch(h>>>=3){case 1:{if(d!==2)break;a.categories&&a.categories.length||(a.categories=[]),a.categories.push(Ue.com.beco.category.Category.decode(e,e.uint32(),q,s+1));continue}}e.skipType(d,s,h),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(f,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.category.CategoryList"},r})(),o})(),t.location=(function(){let o={};return o.Location=(function(){let r=function(e){if(this.phone={},this.social={},this.operationHours=[],this.links=[],this.siblingGroups=[],this.categories=[],this.tags=[],e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.locationId="",r.prototype.externalId="",r.prototype.name="",r.prototype.type="",r.prototype.description="",r.prototype.nodeId="",r.prototype.polygonId="",r.prototype.hidden=!1,r.prototype.sortOrder=0,r.prototype.amenity="",r.prototype.phone=me.emptyObject,r.prototype.social=me.emptyObject,r.prototype.operationHours=me.emptyArray,r.prototype.links=me.emptyArray,r.prototype.siblingGroups=me.emptyArray,r.prototype.showSmartLabelWhenImagePresent=!1,r.prototype.categories=me.emptyArray,r.prototype.stateName="",r.prototype.tags=me.emptyArray,r.prototype.address="",r.prototype.banner="",r.prototype.logo="",r.prototype.zone=null,r.prototype.topLocation=!1,r.prototype.showLogo=!1,r.prototype.minZoom=0,r.prototype.mapObject=null,r.prototype.area="",r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.locationId!=null&&z.hasOwnProperty.call(e,"locationId")&&e.locationId!==""&&n.uint32(10).string(e.locationId),e.externalId!=null&&z.hasOwnProperty.call(e,"externalId")&&e.externalId!==""&&n.uint32(18).string(e.externalId),e.name!=null&&z.hasOwnProperty.call(e,"name")&&e.name!==""&&n.uint32(26).string(e.name),e.type!=null&&z.hasOwnProperty.call(e,"type")&&e.type!==""&&n.uint32(34).string(e.type),e.description!=null&&z.hasOwnProperty.call(e,"description")&&e.description!==""&&n.uint32(42).string(e.description),e.nodeId!=null&&z.hasOwnProperty.call(e,"nodeId")&&e.nodeId!==""&&n.uint32(50).string(e.nodeId),e.polygonId!=null&&z.hasOwnProperty.call(e,"polygonId")&&e.polygonId!==""&&n.uint32(58).string(e.polygonId),e.hidden!=null&&z.hasOwnProperty.call(e,"hidden")&&e.hidden!==!1&&n.uint32(64).bool(e.hidden),e.sortOrder!=null&&z.hasOwnProperty.call(e,"sortOrder")&&e.sortOrder!==0&&n.uint32(72).int32(e.sortOrder),e.amenity!=null&&z.hasOwnProperty.call(e,"amenity")&&e.amenity!==""&&n.uint32(82).string(e.amenity),e.phone!=null&&z.hasOwnProperty.call(e,"phone"))for(let s=z.keys(e.phone),l=0;l<s.length;++l)n.uint32(90).fork().uint32(10).string(s[l]).uint32(18).string(e.phone[s[l]]).ldelim();if(e.social!=null&&z.hasOwnProperty.call(e,"social"))for(let s=z.keys(e.social),l=0;l<s.length;++l)n.uint32(98).fork().uint32(10).string(s[l]).uint32(18).string(e.social[s[l]]).ldelim();if(e.operationHours!=null&&e.operationHours.length)for(let s=0;s<e.operationHours.length;++s)Ue.com.beco.location.OperationHour.encode(e.operationHours[s],n.uint32(106).fork(),i+1).ldelim();if(e.links!=null&&e.links.length)for(let s=0;s<e.links.length;++s)Ue.com.beco.location.Link.encode(e.links[s],n.uint32(114).fork(),i+1).ldelim();if(e.siblingGroups!=null&&e.siblingGroups.length)for(let s=0;s<e.siblingGroups.length;++s)Ue.com.beco.location.SiblingGroup.encode(e.siblingGroups[s],n.uint32(122).fork(),i+1).ldelim();if(e.showSmartLabelWhenImagePresent!=null&&z.hasOwnProperty.call(e,"showSmartLabelWhenImagePresent")&&e.showSmartLabelWhenImagePresent!==!1&&n.uint32(128).bool(e.showSmartLabelWhenImagePresent),e.categories!=null&&e.categories.length)for(let s=0;s<e.categories.length;++s)n.uint32(138).string(e.categories[s]);if(e.stateName!=null&&z.hasOwnProperty.call(e,"stateName")&&e.stateName!==""&&n.uint32(146).string(e.stateName),e.tags!=null&&e.tags.length)for(let s=0;s<e.tags.length;++s)n.uint32(154).string(e.tags[s]);if(e.address!=null&&z.hasOwnProperty.call(e,"address")&&e.address!==""&&n.uint32(162).string(e.address),e.banner!=null&&z.hasOwnProperty.call(e,"banner")&&e.banner!==""&&n.uint32(170).string(e.banner),e.logo!=null&&z.hasOwnProperty.call(e,"logo")&&e.logo!==""&&n.uint32(178).string(e.logo),e.zone!=null&&z.hasOwnProperty.call(e,"zone")&&Ue.com.beco.location.Zone.encode(e.zone,n.uint32(186).fork(),i+1).ldelim(),e.topLocation!=null&&z.hasOwnProperty.call(e,"topLocation")&&e.topLocation!==!1&&n.uint32(192).bool(e.topLocation),e.showLogo!=null&&z.hasOwnProperty.call(e,"showLogo")&&e.showLogo!==!1&&n.uint32(200).bool(e.showLogo),e.minZoom!=null&&z.hasOwnProperty.call(e,"minZoom")&&e.minZoom!==0&&n.uint32(208).int32(e.minZoom),e.mapObject!=null&&z.hasOwnProperty.call(e,"mapObject")&&Ue.com.beco.location.MapObject.encode(e.mapObject,n.uint32(218).fork(),i+1).ldelim(),e.area!=null&&z.hasOwnProperty.call(e,"area")&&e.area!==""&&n.uint32(226).string(e.area),e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.location.Location,f,h;for(;e.pos<c;){let d=e.pos,g=e.tag();if(g===i){i=q;break}let y=g&7;switch(g>>>=3){case 1:{if(y!==2)break;(h=e.stringVerify()).length?a.locationId=h:delete a.locationId;continue}case 2:{if(y!==2)break;(h=e.stringVerify()).length?a.externalId=h:delete a.externalId;continue}case 3:{if(y!==2)break;(h=e.stringVerify()).length?a.name=h:delete a.name;continue}case 4:{if(y!==2)break;(h=e.stringVerify()).length?a.type=h:delete a.type;continue}case 5:{if(y!==2)break;(h=e.stringVerify()).length?a.description=h:delete a.description;continue}case 6:{if(y!==2)break;(h=e.stringVerify()).length?a.nodeId=h:delete a.nodeId;continue}case 7:{if(y!==2)break;(h=e.stringVerify()).length?a.polygonId=h:delete a.polygonId;continue}case 8:{if(y!==0)break;(h=e.bool())?a.hidden=h:delete a.hidden;continue}case 9:{if(y!==0)break;(h=e.int32())?a.sortOrder=h:delete a.sortOrder;continue}case 10:{if(y!==2)break;(h=e.stringVerify()).length?a.amenity=h:delete a.amenity;continue}case 11:{if(y!==2)break;a.phone===me.emptyObject&&(a.phone={});let b=e.uint32()+e.pos;for(f="",h="";e.pos<b;){let v=e.tag();switch(y=v&7,v>>>=3){case 1:if(y!==2)break;f=e.stringVerify();continue;case 2:if(y!==2)break;h=e.stringVerify();continue}e.skipType(y,s,v)}f==="__proto__"&&me.makeProp(a.phone,f),a.phone[f]=h;continue}case 12:{if(y!==2)break;a.social===me.emptyObject&&(a.social={});let b=e.uint32()+e.pos;for(f="",h="";e.pos<b;){let v=e.tag();switch(y=v&7,v>>>=3){case 1:if(y!==2)break;f=e.stringVerify();continue;case 2:if(y!==2)break;h=e.stringVerify();continue}e.skipType(y,s,v)}f==="__proto__"&&me.makeProp(a.social,f),a.social[f]=h;continue}case 13:{if(y!==2)break;a.operationHours&&a.operationHours.length||(a.operationHours=[]),a.operationHours.push(Ue.com.beco.location.OperationHour.decode(e,e.uint32(),q,s+1));continue}case 14:{if(y!==2)break;a.links&&a.links.length||(a.links=[]),a.links.push(Ue.com.beco.location.Link.decode(e,e.uint32(),q,s+1));continue}case 15:{if(y!==2)break;a.siblingGroups&&a.siblingGroups.length||(a.siblingGroups=[]),a.siblingGroups.push(Ue.com.beco.location.SiblingGroup.decode(e,e.uint32(),q,s+1));continue}case 16:{if(y!==0)break;(h=e.bool())?a.showSmartLabelWhenImagePresent=h:delete a.showSmartLabelWhenImagePresent;continue}case 17:{if(y!==2)break;a.categories&&a.categories.length||(a.categories=[]),a.categories.push(e.stringVerify());continue}case 18:{if(y!==2)break;(h=e.stringVerify()).length?a.stateName=h:delete a.stateName;continue}case 19:{if(y!==2)break;a.tags&&a.tags.length||(a.tags=[]),a.tags.push(e.stringVerify());continue}case 20:{if(y!==2)break;(h=e.stringVerify()).length?a.address=h:delete a.address;continue}case 21:{if(y!==2)break;(h=e.stringVerify()).length?a.banner=h:delete a.banner;continue}case 22:{if(y!==2)break;(h=e.stringVerify()).length?a.logo=h:delete a.logo;continue}case 23:{if(y!==2)break;a.zone=Ue.com.beco.location.Zone.decode(e,e.uint32(),q,s+1,a.zone);continue}case 24:{if(y!==0)break;(h=e.bool())?a.topLocation=h:delete a.topLocation;continue}case 25:{if(y!==0)break;(h=e.bool())?a.showLogo=h:delete a.showLogo;continue}case 26:{if(y!==0)break;(h=e.int32())?a.minZoom=h:delete a.minZoom;continue}case 27:{if(y!==2)break;a.mapObject=Ue.com.beco.location.MapObject.decode(e,e.uint32(),q,s+1,a.mapObject);continue}case 28:{if(y!==2)break;(h=e.stringVerify()).length?a.area=h:delete a.area;continue}}e.skipType(y,s,g),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(d,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.location.Location"},r})(),o.Zone=(function(){let r=function(e){if(e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.zoneId="",r.prototype.zoneName="",r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.zoneId!=null&&z.hasOwnProperty.call(e,"zoneId")&&e.zoneId!==""&&n.uint32(10).string(e.zoneId),e.zoneName!=null&&z.hasOwnProperty.call(e,"zoneName")&&e.zoneName!==""&&n.uint32(18).string(e.zoneName),e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.location.Zone,f;for(;e.pos<c;){let h=e.pos,d=e.tag();if(d===i){i=q;break}let g=d&7;switch(d>>>=3){case 1:{if(g!==2)break;(f=e.stringVerify()).length?a.zoneId=f:delete a.zoneId;continue}case 2:{if(g!==2)break;(f=e.stringVerify()).length?a.zoneName=f:delete a.zoneName;continue}}e.skipType(g,s,d),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(h,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.location.Zone"},r})(),o.Link=(function(){let r=function(e){if(e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.url="",r.prototype.label="",r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.url!=null&&z.hasOwnProperty.call(e,"url")&&e.url!==""&&n.uint32(10).string(e.url),e.label!=null&&z.hasOwnProperty.call(e,"label")&&e.label!==""&&n.uint32(18).string(e.label),e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.location.Link,f;for(;e.pos<c;){let h=e.pos,d=e.tag();if(d===i){i=q;break}let g=d&7;switch(d>>>=3){case 1:{if(g!==2)break;(f=e.stringVerify()).length?a.url=f:delete a.url;continue}case 2:{if(g!==2)break;(f=e.stringVerify()).length?a.label=f:delete a.label;continue}}e.skipType(g,s,d),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(h,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.location.Link"},r})(),o.SiblingGroup=(function(){let r=function(e){if(this.siblings=[],e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.label="",r.prototype.siblings=me.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.label!=null&&z.hasOwnProperty.call(e,"label")&&e.label!==""&&n.uint32(10).string(e.label),e.siblings!=null&&e.siblings.length)for(let s=0;s<e.siblings.length;++s)n.uint32(18).string(e.siblings[s]);if(e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.location.SiblingGroup,f;for(;e.pos<c;){let h=e.pos,d=e.tag();if(d===i){i=q;break}let g=d&7;switch(d>>>=3){case 1:{if(g!==2)break;(f=e.stringVerify()).length?a.label=f:delete a.label;continue}case 2:{if(g!==2)break;a.siblings&&a.siblings.length||(a.siblings=[]),a.siblings.push(e.stringVerify());continue}}e.skipType(g,s,d),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(h,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.location.SiblingGroup"},r})(),o.OperationHour=(function(){let r=function(e){if(this.dayOfWeek=[],e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.opens="",r.prototype.closes="",r.prototype.dayOfWeek=me.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.opens!=null&&z.hasOwnProperty.call(e,"opens")&&e.opens!==""&&n.uint32(10).string(e.opens),e.closes!=null&&z.hasOwnProperty.call(e,"closes")&&e.closes!==""&&n.uint32(18).string(e.closes),e.dayOfWeek!=null&&e.dayOfWeek.length)for(let s=0;s<e.dayOfWeek.length;++s)n.uint32(26).string(e.dayOfWeek[s]);if(e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.location.OperationHour,f;for(;e.pos<c;){let h=e.pos,d=e.tag();if(d===i){i=q;break}let g=d&7;switch(d>>>=3){case 1:{if(g!==2)break;(f=e.stringVerify()).length?a.opens=f:delete a.opens;continue}case 2:{if(g!==2)break;(f=e.stringVerify()).length?a.closes=f:delete a.closes;continue}case 3:{if(g!==2)break;a.dayOfWeek&&a.dayOfWeek.length||(a.dayOfWeek=[]),a.dayOfWeek.push(e.stringVerify());continue}}e.skipType(g,s,d),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(h,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.location.OperationHour"},r})(),o.MapObject=(function(){let r=function(e){if(e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.modelPath="",r.prototype.scale=0,r.prototype.rotation=0,r.prototype.modelAltitude=0,r.prototype.modelLight=0,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.modelPath!=null&&z.hasOwnProperty.call(e,"modelPath")&&e.modelPath!==""&&n.uint32(10).string(e.modelPath),e.scale!=null&&z.hasOwnProperty.call(e,"scale")&&!z.is(e.scale,0)&&n.uint32(17).double(e.scale),e.rotation!=null&&z.hasOwnProperty.call(e,"rotation")&&!z.is(e.rotation,0)&&n.uint32(25).double(e.rotation),e.modelAltitude!=null&&z.hasOwnProperty.call(e,"modelAltitude")&&!z.is(e.modelAltitude,0)&&n.uint32(33).double(e.modelAltitude),e.modelLight!=null&&z.hasOwnProperty.call(e,"modelLight")&&!z.is(e.modelLight,0)&&n.uint32(41).double(e.modelLight),e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.location.MapObject,f;for(;e.pos<c;){let h=e.pos,d=e.tag();if(d===i){i=q;break}let g=d&7;switch(d>>>=3){case 1:{if(g!==2)break;(f=e.stringVerify()).length?a.modelPath=f:delete a.modelPath;continue}case 2:{if(g!==1)break;z.is(f=e.double(),0)?delete a.scale:a.scale=f;continue}case 3:{if(g!==1)break;z.is(f=e.double(),0)?delete a.rotation:a.rotation=f;continue}case 4:{if(g!==1)break;z.is(f=e.double(),0)?delete a.modelAltitude:a.modelAltitude=f;continue}case 5:{if(g!==1)break;z.is(f=e.double(),0)?delete a.modelLight:a.modelLight=f;continue}}e.skipType(g,s,d),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(h,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.location.MapObject"},r})(),o.LocationList=(function(){let r=function(e){if(this.locations=[],e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.locations=me.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.locations!=null&&e.locations.length)for(let s=0;s<e.locations.length;++s)Ue.com.beco.location.Location.encode(e.locations[s],n.uint32(10).fork(),i+1).ldelim();if(e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.location.LocationList;for(;e.pos<c;){let f=e.pos,h=e.tag();if(h===i){i=q;break}let d=h&7;switch(h>>>=3){case 1:{if(d!==2)break;a.locations&&a.locations.length||(a.locations=[]),a.locations.push(Ue.com.beco.location.Location.decode(e,e.uint32(),q,s+1));continue}}e.skipType(d,s,h),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(f,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.location.LocationList"},r})(),o})(),t.map_object=(function(){let o={};return o.MapObject=(function(){let r=function(e){if(e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.id="",r.prototype.siteId="",r.prototype.nodeId="",r.prototype.mapObjectPath="",r.prototype.scale=0,r.prototype.rotation=0,r.prototype.altitude=0,r.prototype.light=0,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.id!=null&&z.hasOwnProperty.call(e,"id")&&e.id!==""&&n.uint32(10).string(e.id),e.siteId!=null&&z.hasOwnProperty.call(e,"siteId")&&e.siteId!==""&&n.uint32(18).string(e.siteId),e.nodeId!=null&&z.hasOwnProperty.call(e,"nodeId")&&e.nodeId!==""&&n.uint32(26).string(e.nodeId),e.mapObjectPath!=null&&z.hasOwnProperty.call(e,"mapObjectPath")&&e.mapObjectPath!==""&&n.uint32(34).string(e.mapObjectPath),e.scale!=null&&z.hasOwnProperty.call(e,"scale")&&!z.is(e.scale,0)&&n.uint32(41).double(e.scale),e.rotation!=null&&z.hasOwnProperty.call(e,"rotation")&&!z.is(e.rotation,0)&&n.uint32(49).double(e.rotation),e.altitude!=null&&z.hasOwnProperty.call(e,"altitude")&&!z.is(e.altitude,0)&&n.uint32(57).double(e.altitude),e.light!=null&&z.hasOwnProperty.call(e,"light")&&!z.is(e.light,0)&&n.uint32(65).double(e.light),e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.map_object.MapObject,f;for(;e.pos<c;){let h=e.pos,d=e.tag();if(d===i){i=q;break}let g=d&7;switch(d>>>=3){case 1:{if(g!==2)break;(f=e.stringVerify()).length?a.id=f:delete a.id;continue}case 2:{if(g!==2)break;(f=e.stringVerify()).length?a.siteId=f:delete a.siteId;continue}case 3:{if(g!==2)break;(f=e.stringVerify()).length?a.nodeId=f:delete a.nodeId;continue}case 4:{if(g!==2)break;(f=e.stringVerify()).length?a.mapObjectPath=f:delete a.mapObjectPath;continue}case 5:{if(g!==1)break;z.is(f=e.double(),0)?delete a.scale:a.scale=f;continue}case 6:{if(g!==1)break;z.is(f=e.double(),0)?delete a.rotation:a.rotation=f;continue}case 7:{if(g!==1)break;z.is(f=e.double(),0)?delete a.altitude:a.altitude=f;continue}case 8:{if(g!==1)break;z.is(f=e.double(),0)?delete a.light:a.light=f;continue}}e.skipType(g,s,d),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(h,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.map_object.MapObject"},r})(),o.MapObjectsList=(function(){let r=function(e){if(this.mapObjects=[],e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.mapObjects=me.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.mapObjects!=null&&e.mapObjects.length)for(let s=0;s<e.mapObjects.length;++s)Ue.com.beco.map_object.MapObject.encode(e.mapObjects[s],n.uint32(10).fork(),i+1).ldelim();if(e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.map_object.MapObjectsList;for(;e.pos<c;){let f=e.pos,h=e.tag();if(h===i){i=q;break}let d=h&7;switch(h>>>=3){case 1:{if(d!==2)break;a.mapObjects&&a.mapObjects.length||(a.mapObjects=[]),a.mapObjects.push(Ue.com.beco.map_object.MapObject.decode(e,e.uint32(),q,s+1));continue}}e.skipType(d,s,h),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(f,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.map_object.MapObjectsList"},r})(),o})(),t.node=(function(){let o={};return o.Node=(function(){let r=function(e){if(this.siblings=[],e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.nodeId="",r.prototype.lat=0,r.prototype.lng=0,r.prototype.accessible=!1,r.prototype.floorId="",r.prototype.siblings=me.emptyArray,r.prototype.privateNode=!1,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.nodeId!=null&&z.hasOwnProperty.call(e,"nodeId")&&e.nodeId!==""&&n.uint32(10).string(e.nodeId),e.lat!=null&&z.hasOwnProperty.call(e,"lat")&&!z.is(e.lat,0)&&n.uint32(17).double(e.lat),e.lng!=null&&z.hasOwnProperty.call(e,"lng")&&!z.is(e.lng,0)&&n.uint32(25).double(e.lng),e.accessible!=null&&z.hasOwnProperty.call(e,"accessible")&&e.accessible!==!1&&n.uint32(32).bool(e.accessible),e.floorId!=null&&z.hasOwnProperty.call(e,"floorId")&&e.floorId!==""&&n.uint32(42).string(e.floorId),e.siblings!=null&&e.siblings.length)for(let s=0;s<e.siblings.length;++s)n.uint32(50).string(e.siblings[s]);if(e.privateNode!=null&&z.hasOwnProperty.call(e,"privateNode")&&e.privateNode!==!1&&n.uint32(56).bool(e.privateNode),e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.node.Node,f;for(;e.pos<c;){let h=e.pos,d=e.tag();if(d===i){i=q;break}let g=d&7;switch(d>>>=3){case 1:{if(g!==2)break;(f=e.stringVerify()).length?a.nodeId=f:delete a.nodeId;continue}case 2:{if(g!==1)break;z.is(f=e.double(),0)?delete a.lat:a.lat=f;continue}case 3:{if(g!==1)break;z.is(f=e.double(),0)?delete a.lng:a.lng=f;continue}case 4:{if(g!==0)break;(f=e.bool())?a.accessible=f:delete a.accessible;continue}case 5:{if(g!==2)break;(f=e.stringVerify()).length?a.floorId=f:delete a.floorId;continue}case 6:{if(g!==2)break;a.siblings&&a.siblings.length||(a.siblings=[]),a.siblings.push(e.stringVerify());continue}case 7:{if(g!==0)break;(f=e.bool())?a.privateNode=f:delete a.privateNode;continue}}e.skipType(g,s,d),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(h,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.node.Node"},r})(),o.NodeList=(function(){let r=function(e){if(this.nodes=[],e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.nodes=me.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.nodes!=null&&e.nodes.length)for(let s=0;s<e.nodes.length;++s)Ue.com.beco.node.Node.encode(e.nodes[s],n.uint32(10).fork(),i+1).ldelim();if(e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.node.NodeList;for(;e.pos<c;){let f=e.pos,h=e.tag();if(h===i){i=q;break}let d=h&7;switch(h>>>=3){case 1:{if(d!==2)break;a.nodes&&a.nodes.length||(a.nodes=[]),a.nodes.push(Ue.com.beco.node.Node.decode(e,e.uint32(),q,s+1));continue}}e.skipType(d,s,h),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(f,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.node.NodeList"},r})(),o})(),t.geoshapes=(function(){let o={};return o.GeoShapes=(function(){let r=function(e){if(e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.shapeId="",r.prototype.jsonData="",r.prototype.type="",r.prototype.floorId="",r.prototype.siteId="",r.prototype.layerId="",r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.shapeId!=null&&z.hasOwnProperty.call(e,"shapeId")&&e.shapeId!==""&&n.uint32(10).string(e.shapeId),e.jsonData!=null&&z.hasOwnProperty.call(e,"jsonData")&&e.jsonData!==""&&n.uint32(18).string(e.jsonData),e.type!=null&&z.hasOwnProperty.call(e,"type")&&e.type!==""&&n.uint32(26).string(e.type),e.floorId!=null&&z.hasOwnProperty.call(e,"floorId")&&e.floorId!==""&&n.uint32(34).string(e.floorId),e.siteId!=null&&z.hasOwnProperty.call(e,"siteId")&&e.siteId!==""&&n.uint32(42).string(e.siteId),e.layerId!=null&&z.hasOwnProperty.call(e,"layerId")&&e.layerId!==""&&n.uint32(50).string(e.layerId),e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.geoshapes.GeoShapes,f;for(;e.pos<c;){let h=e.pos,d=e.tag();if(d===i){i=q;break}let g=d&7;switch(d>>>=3){case 1:{if(g!==2)break;(f=e.stringVerify()).length?a.shapeId=f:delete a.shapeId;continue}case 2:{if(g!==2)break;(f=e.stringVerify()).length?a.jsonData=f:delete a.jsonData;continue}case 3:{if(g!==2)break;(f=e.stringVerify()).length?a.type=f:delete a.type;continue}case 4:{if(g!==2)break;(f=e.stringVerify()).length?a.floorId=f:delete a.floorId;continue}case 5:{if(g!==2)break;(f=e.stringVerify()).length?a.siteId=f:delete a.siteId;continue}case 6:{if(g!==2)break;(f=e.stringVerify()).length?a.layerId=f:delete a.layerId;continue}}e.skipType(g,s,d),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(h,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.geoshapes.GeoShapes"},r})(),o.GeoShapesList=(function(){let r=function(e){if(this.shapes=[],e)for(let n=z.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&n[i]!=="__proto__"&&(this[n[i]]=e[n[i]])};return r.prototype.shapes=me.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,n,i){if(n||(n=Tt.create()),i===q&&(i=0),i>me.recursionLimit)throw xe("max depth exceeded");if(e.shapes!=null&&e.shapes.length)for(let s=0;s<e.shapes.length;++s)Ue.com.beco.geoshapes.GeoShapes.encode(e.shapes[s],n.uint32(10).fork(),i+1).ldelim();if(e.$unknowns!=null&&z.hasOwnProperty.call(e,"$unknowns"))for(let s=0;s<e.$unknowns.length;++s)n.raw(e.$unknowns[s]);return n},r.decode=function(e,n,i,s,l){if(e instanceof Te||(e=Te.create(e)),s===q&&(s=0),s>Te.recursionLimit)throw xe("max depth exceeded");let c=n===q?e.len:e.pos+n,a=l||new Ue.com.beco.geoshapes.GeoShapesList;for(;e.pos<c;){let f=e.pos,h=e.tag();if(h===i){i=q;break}let d=h&7;switch(h>>>=3){case 1:{if(d!==2)break;a.shapes&&a.shapes.length||(a.shapes=[]),a.shapes.push(Ue.com.beco.geoshapes.GeoShapes.decode(e,e.uint32(),q,s+1));continue}}e.skipType(d,s,h),e.discardUnknown||(me.makeProp(a,"$unknowns",!1),(a.$unknowns||(a.$unknowns=[])).push(e.raw(f,e.pos)))}if(i!==q)throw xe("missing end group");return a},r.getTypeUrl=function(e){return e===q&&(e="type.googleapis.com"),e+"/com.beco.geoshapes.GeoShapesList"},r})(),o})(),t})(),u})();var fr=class extends Error{constructor(t,o){super(`becomap: HTTP ${String(t)} for ${o}`),this.status=t}};function Rp(u){let t=AbortSignal.timeout(15e3);return u?AbortSignal.any([u,t]):t}async function If(u){let t=300*2**u,o=Math.random()*200;await new Promise(r=>setTimeout(r,t+o))}async function _f(u,t){let o;for(let r=0;r<=2;r++){if(t.signal?.aborted)throw o instanceof Error?o:new DOMException("aborted","AbortError");try{let e=await fetch(u,{method:t.method??"GET",headers:{...t.body!==void 0?{"Content-Type":"application/json"}:{},...t.headers},...t.body!==void 0?{body:JSON.stringify(t.body)}:{},signal:Rp(t.signal)});if(e.status>=500){o=new fr(e.status,u),await If(r);continue}if(!e.ok)throw new fr(e.status,u);return e}catch(e){if(e instanceof fr||t.signal?.aborted)throw e;o=e,r<2&&await If(r)}}throw o instanceof Error?o:new Error("becomap: request failed")}async function mi(u,t={}){return await(await _f(u,t)).json()}async function bi(u,t={}){let o=await _f(u,t);return new Uint8Array(await o.arrayBuffer())}var Ip={ELEVATOR:"elevator",ESCALATOR:"escalator",STAIRS:"stairs",PASSAGE:"passage",DOOR:"door",RAMP:"ramp"};function _p(u){try{let t=JSON.parse(u),o=t.type==="Feature"?t.geometry:t,r=null;if(o?.type==="Polygon"&&Array.isArray(o.coordinates)?r={type:"Polygon",coordinates:o.coordinates}:o?.type==="LineString"&&Array.isArray(o.coordinates)&&(r={type:"LineString",coordinates:o.coordinates}),!r)return null;let e=t.type==="Feature"?t.properties?.shapeProperties:void 0,n={};return typeof e?.height=="number"&&(n.height=e.height),typeof e?.color=="string"&&(n.color=e.color),typeof e?.fillColor=="string"&&(n.fillColor=e.fillColor),typeof e?.opacity=="number"&&(n.opacity=e.opacity),typeof e?.label?.fontSize=="number"&&(n.labelSize=e.label.fontSize),typeof e?.label?.nextRotation=="number"&&(n.labelRotation=e.label.nextRotation),{geometry:r,style:n}}catch{return null}}var hr,ms=class{constructor(t){V(this,hr);N(this,hr,t)}async fetchVenue(t){let{baseUrl:o,siteId:r,clientId:e,clientSecret:n}=p(this,hr),i=t?{signal:t}:{},l={headers:{Authorization:`Bearer ${(await mi(`${o}/api/v1/auth/sdk/generate-token`,{method:"POST",body:{clientId:e,clientSecret:n},...i})).accessToken}`},...i},c=await mi(`${o}/api/v1/sdk/site/${r}`,l),[a,f,h,d,g,y,b,v]=await Promise.all([Promise.all(c.buildings.map(M=>mi(`${o}/api/v1/sdk/floor/${r}/${M.buildingId}`,l))),bi(c.binaryUrl.route,i),bi(c.binaryUrl.shape,i),bi(c.binaryUrl.location,i),bi(c.binaryUrl.category,i),bi(c.binaryUrl.map_object,i),mi(`${o}/api/v1/sdk/connection/${r}`,l),mi(`${o}/api/v1/category/get-icons`,l).catch(()=>({}))]),w=c.buildings.map((M,F)=>({id:M.buildingId,name:M.buildingName,floors:(a[F]??[]).map(I=>({id:I.floorId,name:I.name,level:I.elevation,buildingId:M.buildingId}))})),T=gi.beco.node.NodeList.decode(f).nodes.map(M=>({id:M.nodeId??"",lat:M.lat??0,lng:M.lng??0,floorId:M.floorId??"",accessible:!0,privateNode:M.privateNode??!1,siblings:[...M.siblings??[]]})),x=[];for(let M of gi.beco.geoshapes.GeoShapesList.decode(h).shapes){let F=_p(M.jsonData??"");F&&x.push({id:M.shapeId??"",floorId:M.floorId??"",layerId:M.layerId??"",type:M.type??"",geometry:F.geometry,style:F.style})}let E=gi.beco.location.LocationList.decode(d).locations.map(M=>{let F={id:M.locationId??"",name:M.name??"",type:M.type??"",categoryIds:[...M.categories??[]],hidden:M.hidden??!1,sortOrder:M.sortOrder??0};return M.description&&(F.description=M.description),M.nodeId&&(F.nodeId=M.nodeId),M.polygonId&&(F.shapeId=M.polygonId),M.amenity&&(F.amenity=M.amenity),M.logo&&(F.logoUrl=M.logo),F}),O=gi.beco.category.CategoryList.decode(g).categories.map(M=>{let F={id:M.categoryId??"",name:M.name??"",sortOrder:M.sortOrder??0};if(M.iconFromDefaultList){let I=v[M.iconFromDefaultList];I&&(F.icon=I)}return M.color?.hex&&(F.colorHex=M.color.hex),F}),A=gi.beco.map_object.MapObjectsList.decode(y).mapObjects.map(M=>({id:M.id??"",nodeId:M.nodeId??"",modelUrl:M.mapObjectPath??"",scale:M.scale??1,rotation:M.rotation??0,altitude:M.altitude??0,light:M.light??1})),k=[];for(let M of b){let[F,I]=M.node;!F||!I||k.push({id:M.connectionId,kind:Ip[M.type]??"other",name:M.name,accessible:M.accessible,weight:M.weight,multiplier:M.multiplier,direction:M.direction==="START_TO_END"?"startToEnd":M.direction==="END_TO_START"?"endToStart":"both",startNodeId:F,endNodeId:I})}return{site:{id:c.siteId,name:c.siteName,center:[c.longitude,c.latitude]},buildings:w,nodes:T,shapes:x,locations:E,categories:O,iconset:v,mapObjects:A,floorConnections:k}}};hr=new WeakMap;return jf(Lp);})();
|
|
288
|
+
/*! Bundled license information:
|
|
289
|
+
|
|
290
|
+
long/umd/index.js:
|
|
291
|
+
(**
|
|
292
|
+
* @license
|
|
293
|
+
* Copyright 2009 The Closure Library Authors
|
|
294
|
+
* Copyright 2020 Daniel Wirtz / The long.js Authors.
|
|
295
|
+
*
|
|
296
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
297
|
+
* you may not use this file except in compliance with the License.
|
|
298
|
+
* You may obtain a copy of the License at
|
|
299
|
+
*
|
|
300
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
301
|
+
*
|
|
302
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
303
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
304
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
305
|
+
* See the License for the specific language governing permissions and
|
|
306
|
+
* limitations under the License.
|
|
307
|
+
*
|
|
308
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
309
|
+
*)
|
|
310
|
+
|
|
311
|
+
troika-three-text/dist/troika-three-text.esm.js:
|
|
312
|
+
(*!
|
|
313
|
+
Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering.
|
|
314
|
+
Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE
|
|
315
|
+
*)
|
|
316
|
+
(*!
|
|
317
|
+
Custom bundle of woff2otf (https://github.com/arty-name/woff2otf) with fflate
|
|
318
|
+
(https://github.com/101arrowz/fflate) for use in Troika text rendering.
|
|
319
|
+
Original licenses apply:
|
|
320
|
+
- fflate: https://github.com/101arrowz/fflate/blob/master/LICENSE (MIT)
|
|
321
|
+
- woff2otf.js: https://github.com/arty-name/woff2otf/blob/master/woff2otf.js (Apache2)
|
|
322
|
+
*)
|
|
323
|
+
(*!
|
|
324
|
+
Custom bundle of @unicode-font-resolver/client v1.0.2 (https://github.com/lojjic/unicode-font-resolver)
|
|
325
|
+
for use in Troika text rendering.
|
|
326
|
+
Original MIT license applies
|
|
327
|
+
*)
|
|
328
|
+
*/
|
|
329
|
+
//# sourceMappingURL=becomap.umd.js.map
|