@realsee/five 6.7.0-alpha.30 → 6.7.0-alpha.32

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/umd/five.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 12/15/2025
5
- * Version: 6.7.0-alpha.30
4
+ * Generated: 12/22/2025
5
+ * Version: 6.7.0-alpha.32
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -339,7 +339,7 @@
339
339
  *
340
340
  * https://code.google.com/p/crypto-js/wiki/License
341
341
  * PART: ext/cryptojs
342
- */var KJUR={},CryptoJS=CryptoJS||(function(n,t){var e={},r=e.lib={},o=r.Base=(function(){function h(){}return{extend:function(g){h.prototype=this;var m=new h;return g&&m.mixIn(g),m.hasOwnProperty("init")||(m.init=function(){m.$super.init.apply(this,arguments)}),m.init.prototype=m,m.$super=this,m},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var m in g)g.hasOwnProperty(m)&&(this[m]=g[m]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),s=r.WordArray=o.extend({init:function(h,g){h=this.words=h||[],g!=t?this.sigBytes=g:this.sigBytes=h.length*4},toString:function(h){return(h||l).stringify(this)},concat:function(h){var g=this.words,m=h.words,E=this.sigBytes,y=h.sigBytes;if(this.clamp(),E%4)for(var v=0;v<y;v++){var A=m[v>>>2]>>>24-v%4*8&255;g[E+v>>>2]|=A<<24-(E+v)%4*8}else for(var v=0;v<y;v+=4)g[E+v>>>2]=m[v>>>2];return this.sigBytes+=y,this},clamp:function(){var h=this.words,g=this.sigBytes;h[g>>>2]&=4294967295<<32-g%4*8,h.length=n.ceil(g/4)},clone:function(){var h=o.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var g=[],m=0;m<h;m+=4)g.push(n.random()*4294967296|0);return new s.init(g,h)}}),u=e.enc={},l=u.Hex={stringify:function(h){for(var g=h.words,m=h.sigBytes,E=[],y=0;y<m;y++){var v=g[y>>>2]>>>24-y%4*8&255;E.push((v>>>4).toString(16)),E.push((v&15).toString(16))}return E.join("")},parse:function(h){for(var g=h.length,m=[],E=0;E<g;E+=2)m[E>>>3]|=parseInt(h.substr(E,2),16)<<24-E%8*4;return new s.init(m,g/2)}},c=u.Latin1={stringify:function(h){for(var g=h.words,m=h.sigBytes,E=[],y=0;y<m;y++){var v=g[y>>>2]>>>24-y%4*8&255;E.push(String.fromCharCode(v))}return E.join("")},parse:function(h){for(var g=h.length,m=[],E=0;E<g;E++)m[E>>>2]|=(h.charCodeAt(E)&255)<<24-E%4*8;return new s.init(m,g)}},f=u.Utf8={stringify:function(h){try{return decodeURIComponent(escape(c.stringify(h)))}catch(g){throw new Error("Malformed UTF-8 data")}},parse:function(h){return c.parse(unescape(encodeURIComponent(h)))}},p=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(h){typeof h=="string"&&(h=f.parse(h)),this._data.concat(h),this._nDataBytes+=h.sigBytes},_process:function(h){var g=this._data,m=g.words,E=g.sigBytes,y=this.blockSize,v=y*4,A=E/v;h?A=n.ceil(A):A=n.max((A|0)-this._minBufferSize,0);var b=A*y,T=n.min(b*4,E);if(b){for(var _=0;_<b;_+=y)this._doProcessBlock(m,_);var S=m.splice(0,b);g.sigBytes-=T}return new s.init(S,T)},clone:function(){var h=o.clone.call(this);return h._data=this._data.clone(),h},_minBufferSize:0});r.Hasher=p.extend({cfg:o.extend(),init:function(h){this.cfg=this.cfg.extend(h),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(h){return this._append(h),this._process(),this},finalize:function(h){h&&this._append(h);var g=this._doFinalize();return g},blockSize:512/32,_createHelper:function(h){return function(g,m){return new h.init(m).finalize(g)}},_createHmacHelper:function(h){return function(g,m){return new d.HMAC.init(h,m).finalize(g)}}});var d=e.algo={};return e})(Math);(function(n){for(var t=CryptoJS,g=t.lib,e=g.WordArray,r=g.Hasher,g=t.algo,o=[],s=[],u=function(E){return 4294967296*(E-(E|0))|0},l=2,c=0;64>c;){var f;e:{f=l;for(var p=n.sqrt(f),d=2;d<=p;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(8>c&&(o[c]=u(n.pow(l,.5))),s[c]=u(n.pow(l,1/3)),c++),l++}var h=[],g=g.SHA256=r.extend({_doReset:function(){this._hash=new e.init(o.slice(0))},_doProcessBlock:function(m,E){for(var y=this._hash.words,v=y[0],A=y[1],b=y[2],T=y[3],_=y[4],S=y[5],w=y[6],R=y[7],I=0;64>I;I++){if(16>I)h[I]=m[E+I]|0;else{var H=h[I-15],C=h[I-2];h[I]=((H<<25|H>>>7)^(H<<14|H>>>18)^H>>>3)+h[I-7]+((C<<15|C>>>17)^(C<<13|C>>>19)^C>>>10)+h[I-16]}H=R+((_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25))+(_&S^~_&w)+s[I]+h[I],C=((v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&A^v&b^A&b),R=w,w=S,S=_,_=T+H|0,T=b,b=A,A=v,v=H+C|0}y[0]=y[0]+v|0,y[1]=y[1]+A|0,y[2]=y[2]+b|0,y[3]=y[3]+T|0,y[4]=y[4]+_|0,y[5]=y[5]+S|0,y[6]=y[6]+w|0,y[7]=y[7]+R|0},_doFinalize:function(){var m=this._data,E=m.words,y=8*this._nDataBytes,v=8*m.sigBytes;return E[v>>>5]|=128<<24-v%32,E[(v+64>>>9<<4)+14]=n.floor(y/4294967296),E[(v+64>>>9<<4)+15]=y,m.sigBytes=4*E.length,this._process(),this._hash},clone:function(){var m=r.clone.call(this);return m._hash=this._hash.clone(),m}});t.SHA256=r._createHelper(g),t.HmacSHA256=r._createHmacHelper(g)})(Math),CryptoJS.lib.Cipher||(function(n){var g=CryptoJS,t=g.lib,e=t.Base,r=t.WordArray,o=t.BufferedBlockAlgorithm,s=g.enc.Base64,u=g.algo.EvpKDF,l=t.Cipher=o.extend({cfg:e.extend(),createEncryptor:function(E,y){return this.create(this._ENC_XFORM_MODE,E,y)},createDecryptor:function(E,y){return this.create(this._DEC_XFORM_MODE,E,y)},init:function(E,y,v){this.cfg=this.cfg.extend(v),this._xformMode=E,this._key=y,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(E){return this._append(E),this._process()},finalize:function(E){return E&&this._append(E),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(E){return{encrypt:function(y,v,A){return(typeof v=="string"?m:h).encrypt(E,y,v,A)},decrypt:function(y,v,A){return(typeof v=="string"?m:h).decrypt(E,y,v,A)}}}});t.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=g.mode={},c=function(E,y,v){var A=this._iv;A?this._iv=n:A=this._prevBlock;for(var b=0;b<v;b++)E[y+b]^=A[b]},f=(t.BlockCipherMode=e.extend({createEncryptor:function(E,y){return this.Encryptor.create(E,y)},createDecryptor:function(E,y){return this.Decryptor.create(E,y)},init:function(E,y){this._cipher=E,this._iv=y}})).extend();f.Encryptor=f.extend({processBlock:function(E,y){var v=this._cipher,A=v.blockSize;c.call(this,E,y,A),v.encryptBlock(E,y),this._prevBlock=E.slice(y,y+A)}}),f.Decryptor=f.extend({processBlock:function(E,y){var v=this._cipher,A=v.blockSize,b=E.slice(y,y+A);v.decryptBlock(E,y),c.call(this,E,y,A),this._prevBlock=b}}),d=d.CBC=f,f=(g.pad={}).Pkcs7={pad:function(E,y){for(var v=4*y,v=v-E.sigBytes%v,A=v<<24|v<<16|v<<8|v,b=[],T=0;T<v;T+=4)b.push(A);v=r.create(b,v),E.concat(v)},unpad:function(E){E.sigBytes-=E.words[E.sigBytes-1>>>2]&255}},t.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:f}),reset:function(){l.reset.call(this);var y=this.cfg,E=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var v=y.createEncryptor;else v=y.createDecryptor,this._minBufferSize=1;this._mode=v.call(y,this,E&&E.words)},_doProcessBlock:function(E,y){this._mode.processBlock(E,y)},_doFinalize:function(){var E=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){E.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),E.unpad(y);return y},blockSize:4});var p=t.CipherParams=e.extend({init:function(E){this.mixIn(E)},toString:function(E){return(E||this.formatter).stringify(this)}}),d=(g.format={}).OpenSSL={stringify:function(E){var y=E.ciphertext;return E=E.salt,(E?r.create([1398893684,1701076831]).concat(E).concat(y):y).toString(s)},parse:function(E){E=s.parse(E);var y=E.words;if(y[0]==1398893684&&y[1]==1701076831){var v=r.create(y.slice(2,4));y.splice(0,4),E.sigBytes-=16}return p.create({ciphertext:E,salt:v})}},h=t.SerializableCipher=e.extend({cfg:e.extend({format:d}),encrypt:function(E,y,v,A){A=this.cfg.extend(A);var b=E.createEncryptor(v,A);return y=b.finalize(y),b=b.cfg,p.create({ciphertext:y,key:v,iv:b.iv,algorithm:E,mode:b.mode,padding:b.padding,blockSize:E.blockSize,formatter:A.format})},decrypt:function(E,y,v,A){return A=this.cfg.extend(A),y=this._parse(y,A.format),E.createDecryptor(v,A).finalize(y.ciphertext)},_parse:function(E,y){return typeof E=="string"?y.parse(E,this):E}}),g=(g.kdf={}).OpenSSL={execute:function(E,y,v,A){return A||(A=r.random(8)),E=u.create({keySize:y+v}).compute(E,A),v=r.create(E.words.slice(y),4*v),E.sigBytes=4*y,p.create({key:E,iv:v,salt:A})}},m=t.PasswordBasedCipher=h.extend({cfg:h.cfg.extend({kdf:g}),encrypt:function(E,y,v,A){return A=this.cfg.extend(A),v=A.kdf.execute(v,E.keySize,E.ivSize),A.iv=v.iv,E=h.encrypt.call(this,E,y,v.key,A),E.mixIn(v),E},decrypt:function(E,y,v,A){return A=this.cfg.extend(A),y=this._parse(y,A.format),v=A.kdf.execute(v,E.keySize,E.ivSize,y.salt),A.iv=v.iv,h.decrypt.call(this,E,y,v.key,A)}})})(),(function(){for(var n=CryptoJS,t=n.lib.BlockCipher,S=n.algo,e=[],r=[],o=[],s=[],u=[],l=[],c=[],f=[],p=[],d=[],h=[],g=0;256>g;g++)h[g]=128>g?g<<1:g<<1^283;for(var m=0,E=0,g=0;256>g;g++){var y=E^E<<1^E<<2^E<<3^E<<4,y=y>>>8^y&255^99;e[m]=y,r[y]=m;var v=h[m],A=h[v],b=h[A],T=257*h[y]^16843008*y;o[m]=T<<24|T>>>8,s[m]=T<<16|T>>>16,u[m]=T<<8|T>>>24,l[m]=T,T=16843009*b^65537*A^257*v^16843008*m,c[y]=T<<24|T>>>8,f[y]=T<<16|T>>>16,p[y]=T<<8|T>>>24,d[y]=T,m?(m=v^h[h[h[b^v]]],E^=h[h[E]]):m=E=1}var _=[0,1,2,4,8,16,32,64,128,27,54],S=S.AES=t.extend({_doReset:function(){for(var I=this._key,w=I.words,R=I.sigBytes/4,I=4*((this._nRounds=R+6)+1),H=this._keySchedule=[],C=0;C<I;C++)if(C<R)H[C]=w[C];else{var M=H[C-1];C%R?6<R&&C%R==4&&(M=e[M>>>24]<<24|e[M>>>16&255]<<16|e[M>>>8&255]<<8|e[M&255]):(M=M<<8|M>>>24,M=e[M>>>24]<<24|e[M>>>16&255]<<16|e[M>>>8&255]<<8|e[M&255],M^=_[C/R|0]<<24),H[C]=H[C-R]^M}for(w=this._invKeySchedule=[],R=0;R<I;R++)C=I-R,M=R%4?H[C]:H[C-4],w[R]=4>R||4>=C?M:c[e[M>>>24]]^f[e[M>>>16&255]]^p[e[M>>>8&255]]^d[e[M&255]]},encryptBlock:function(w,R){this._doCryptBlock(w,R,this._keySchedule,o,s,u,l,e)},decryptBlock:function(w,R){var I=w[R+1];w[R+1]=w[R+3],w[R+3]=I,this._doCryptBlock(w,R,this._invKeySchedule,c,f,p,d,r),I=w[R+1],w[R+1]=w[R+3],w[R+3]=I},_doCryptBlock:function(w,R,I,H,C,M,B,L){for(var O=this._nRounds,U=w[R]^I[0],j=w[R+1]^I[1],G=w[R+2]^I[2],Q=w[R+3]^I[3],k=4,D=1;D<O;D++)var q=H[U>>>24]^C[j>>>16&255]^M[G>>>8&255]^B[Q&255]^I[k++],z=H[j>>>24]^C[G>>>16&255]^M[Q>>>8&255]^B[U&255]^I[k++],V=H[G>>>24]^C[Q>>>16&255]^M[U>>>8&255]^B[j&255]^I[k++],Q=H[Q>>>24]^C[U>>>16&255]^M[j>>>8&255]^B[G&255]^I[k++],U=q,j=z,G=V;q=(L[U>>>24]<<24|L[j>>>16&255]<<16|L[G>>>8&255]<<8|L[Q&255])^I[k++],z=(L[j>>>24]<<24|L[G>>>16&255]<<16|L[Q>>>8&255]<<8|L[U&255])^I[k++],V=(L[G>>>24]<<24|L[Q>>>16&255]<<16|L[U>>>8&255]<<8|L[j&255])^I[k++],Q=(L[Q>>>24]<<24|L[U>>>16&255]<<16|L[j>>>8&255]<<8|L[G&255])^I[k++],w[R]=q,w[R+1]=z,w[R+2]=V,w[R+3]=Q},keySize:8});n.AES=t._createHelper(S)})();/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
342
+ */var KJUR={},CryptoJS=CryptoJS||(function(n,t){var e={},r=e.lib={},o=r.Base=(function(){function h(){}return{extend:function(g){h.prototype=this;var m=new h;return g&&m.mixIn(g),m.hasOwnProperty("init")||(m.init=function(){m.$super.init.apply(this,arguments)}),m.init.prototype=m,m.$super=this,m},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var m in g)g.hasOwnProperty(m)&&(this[m]=g[m]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),s=r.WordArray=o.extend({init:function(h,g){h=this.words=h||[],g!=t?this.sigBytes=g:this.sigBytes=h.length*4},toString:function(h){return(h||l).stringify(this)},concat:function(h){var g=this.words,m=h.words,E=this.sigBytes,y=h.sigBytes;if(this.clamp(),E%4)for(var v=0;v<y;v++){var A=m[v>>>2]>>>24-v%4*8&255;g[E+v>>>2]|=A<<24-(E+v)%4*8}else for(var v=0;v<y;v+=4)g[E+v>>>2]=m[v>>>2];return this.sigBytes+=y,this},clamp:function(){var h=this.words,g=this.sigBytes;h[g>>>2]&=4294967295<<32-g%4*8,h.length=n.ceil(g/4)},clone:function(){var h=o.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var g=[],m=0;m<h;m+=4)g.push(n.random()*4294967296|0);return new s.init(g,h)}}),u=e.enc={},l=u.Hex={stringify:function(h){for(var g=h.words,m=h.sigBytes,E=[],y=0;y<m;y++){var v=g[y>>>2]>>>24-y%4*8&255;E.push((v>>>4).toString(16)),E.push((v&15).toString(16))}return E.join("")},parse:function(h){for(var g=h.length,m=[],E=0;E<g;E+=2)m[E>>>3]|=parseInt(h.substr(E,2),16)<<24-E%8*4;return new s.init(m,g/2)}},c=u.Latin1={stringify:function(h){for(var g=h.words,m=h.sigBytes,E=[],y=0;y<m;y++){var v=g[y>>>2]>>>24-y%4*8&255;E.push(String.fromCharCode(v))}return E.join("")},parse:function(h){for(var g=h.length,m=[],E=0;E<g;E++)m[E>>>2]|=(h.charCodeAt(E)&255)<<24-E%4*8;return new s.init(m,g)}},f=u.Utf8={stringify:function(h){try{return decodeURIComponent(escape(c.stringify(h)))}catch(g){throw new Error("Malformed UTF-8 data")}},parse:function(h){return c.parse(unescape(encodeURIComponent(h)))}},p=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(h){typeof h=="string"&&(h=f.parse(h)),this._data.concat(h),this._nDataBytes+=h.sigBytes},_process:function(h){var g=this._data,m=g.words,E=g.sigBytes,y=this.blockSize,v=y*4,A=E/v;h?A=n.ceil(A):A=n.max((A|0)-this._minBufferSize,0);var b=A*y,T=n.min(b*4,E);if(b){for(var _=0;_<b;_+=y)this._doProcessBlock(m,_);var S=m.splice(0,b);g.sigBytes-=T}return new s.init(S,T)},clone:function(){var h=o.clone.call(this);return h._data=this._data.clone(),h},_minBufferSize:0});r.Hasher=p.extend({cfg:o.extend(),init:function(h){this.cfg=this.cfg.extend(h),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(h){return this._append(h),this._process(),this},finalize:function(h){h&&this._append(h);var g=this._doFinalize();return g},blockSize:512/32,_createHelper:function(h){return function(g,m){return new h.init(m).finalize(g)}},_createHmacHelper:function(h){return function(g,m){return new d.HMAC.init(h,m).finalize(g)}}});var d=e.algo={};return e})(Math);(function(n){for(var t=CryptoJS,g=t.lib,e=g.WordArray,r=g.Hasher,g=t.algo,o=[],s=[],u=function(E){return 4294967296*(E-(E|0))|0},l=2,c=0;64>c;){var f;e:{f=l;for(var p=n.sqrt(f),d=2;d<=p;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(8>c&&(o[c]=u(n.pow(l,.5))),s[c]=u(n.pow(l,1/3)),c++),l++}var h=[],g=g.SHA256=r.extend({_doReset:function(){this._hash=new e.init(o.slice(0))},_doProcessBlock:function(m,E){for(var y=this._hash.words,v=y[0],A=y[1],b=y[2],T=y[3],_=y[4],S=y[5],w=y[6],R=y[7],I=0;64>I;I++){if(16>I)h[I]=m[E+I]|0;else{var H=h[I-15],C=h[I-2];h[I]=((H<<25|H>>>7)^(H<<14|H>>>18)^H>>>3)+h[I-7]+((C<<15|C>>>17)^(C<<13|C>>>19)^C>>>10)+h[I-16]}H=R+((_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25))+(_&S^~_&w)+s[I]+h[I],C=((v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&A^v&b^A&b),R=w,w=S,S=_,_=T+H|0,T=b,b=A,A=v,v=H+C|0}y[0]=y[0]+v|0,y[1]=y[1]+A|0,y[2]=y[2]+b|0,y[3]=y[3]+T|0,y[4]=y[4]+_|0,y[5]=y[5]+S|0,y[6]=y[6]+w|0,y[7]=y[7]+R|0},_doFinalize:function(){var m=this._data,E=m.words,y=8*this._nDataBytes,v=8*m.sigBytes;return E[v>>>5]|=128<<24-v%32,E[(v+64>>>9<<4)+14]=n.floor(y/4294967296),E[(v+64>>>9<<4)+15]=y,m.sigBytes=4*E.length,this._process(),this._hash},clone:function(){var m=r.clone.call(this);return m._hash=this._hash.clone(),m}});t.SHA256=r._createHelper(g),t.HmacSHA256=r._createHmacHelper(g)})(Math),CryptoJS.lib.Cipher||(function(n){var g=CryptoJS,t=g.lib,e=t.Base,r=t.WordArray,o=t.BufferedBlockAlgorithm,s=g.enc.Base64,u=g.algo.EvpKDF,l=t.Cipher=o.extend({cfg:e.extend(),createEncryptor:function(E,y){return this.create(this._ENC_XFORM_MODE,E,y)},createDecryptor:function(E,y){return this.create(this._DEC_XFORM_MODE,E,y)},init:function(E,y,v){this.cfg=this.cfg.extend(v),this._xformMode=E,this._key=y,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(E){return this._append(E),this._process()},finalize:function(E){return E&&this._append(E),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(E){return{encrypt:function(y,v,A){return(typeof v=="string"?m:h).encrypt(E,y,v,A)},decrypt:function(y,v,A){return(typeof v=="string"?m:h).decrypt(E,y,v,A)}}}});t.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=g.mode={},c=function(E,y,v){var A=this._iv;A?this._iv=n:A=this._prevBlock;for(var b=0;b<v;b++)E[y+b]^=A[b]},f=(t.BlockCipherMode=e.extend({createEncryptor:function(E,y){return this.Encryptor.create(E,y)},createDecryptor:function(E,y){return this.Decryptor.create(E,y)},init:function(E,y){this._cipher=E,this._iv=y}})).extend();f.Encryptor=f.extend({processBlock:function(E,y){var v=this._cipher,A=v.blockSize;c.call(this,E,y,A),v.encryptBlock(E,y),this._prevBlock=E.slice(y,y+A)}}),f.Decryptor=f.extend({processBlock:function(E,y){var v=this._cipher,A=v.blockSize,b=E.slice(y,y+A);v.decryptBlock(E,y),c.call(this,E,y,A),this._prevBlock=b}}),d=d.CBC=f,f=(g.pad={}).Pkcs7={pad:function(E,y){for(var v=4*y,v=v-E.sigBytes%v,A=v<<24|v<<16|v<<8|v,b=[],T=0;T<v;T+=4)b.push(A);v=r.create(b,v),E.concat(v)},unpad:function(E){E.sigBytes-=E.words[E.sigBytes-1>>>2]&255}},t.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:f}),reset:function(){l.reset.call(this);var y=this.cfg,E=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var v=y.createEncryptor;else v=y.createDecryptor,this._minBufferSize=1;this._mode=v.call(y,this,E&&E.words)},_doProcessBlock:function(E,y){this._mode.processBlock(E,y)},_doFinalize:function(){var E=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){E.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),E.unpad(y);return y},blockSize:4});var p=t.CipherParams=e.extend({init:function(E){this.mixIn(E)},toString:function(E){return(E||this.formatter).stringify(this)}}),d=(g.format={}).OpenSSL={stringify:function(E){var y=E.ciphertext;return E=E.salt,(E?r.create([1398893684,1701076831]).concat(E).concat(y):y).toString(s)},parse:function(E){E=s.parse(E);var y=E.words;if(y[0]==1398893684&&y[1]==1701076831){var v=r.create(y.slice(2,4));y.splice(0,4),E.sigBytes-=16}return p.create({ciphertext:E,salt:v})}},h=t.SerializableCipher=e.extend({cfg:e.extend({format:d}),encrypt:function(E,y,v,A){A=this.cfg.extend(A);var b=E.createEncryptor(v,A);return y=b.finalize(y),b=b.cfg,p.create({ciphertext:y,key:v,iv:b.iv,algorithm:E,mode:b.mode,padding:b.padding,blockSize:E.blockSize,formatter:A.format})},decrypt:function(E,y,v,A){return A=this.cfg.extend(A),y=this._parse(y,A.format),E.createDecryptor(v,A).finalize(y.ciphertext)},_parse:function(E,y){return typeof E=="string"?y.parse(E,this):E}}),g=(g.kdf={}).OpenSSL={execute:function(E,y,v,A){return A||(A=r.random(8)),E=u.create({keySize:y+v}).compute(E,A),v=r.create(E.words.slice(y),4*v),E.sigBytes=4*y,p.create({key:E,iv:v,salt:A})}},m=t.PasswordBasedCipher=h.extend({cfg:h.cfg.extend({kdf:g}),encrypt:function(E,y,v,A){return A=this.cfg.extend(A),v=A.kdf.execute(v,E.keySize,E.ivSize),A.iv=v.iv,E=h.encrypt.call(this,E,y,v.key,A),E.mixIn(v),E},decrypt:function(E,y,v,A){return A=this.cfg.extend(A),y=this._parse(y,A.format),v=A.kdf.execute(v,E.keySize,E.ivSize,y.salt),A.iv=v.iv,h.decrypt.call(this,E,y,v.key,A)}})})(),(function(){for(var n=CryptoJS,t=n.lib.BlockCipher,S=n.algo,e=[],r=[],o=[],s=[],u=[],l=[],c=[],f=[],p=[],d=[],h=[],g=0;256>g;g++)h[g]=128>g?g<<1:g<<1^283;for(var m=0,E=0,g=0;256>g;g++){var y=E^E<<1^E<<2^E<<3^E<<4,y=y>>>8^y&255^99;e[m]=y,r[y]=m;var v=h[m],A=h[v],b=h[A],T=257*h[y]^16843008*y;o[m]=T<<24|T>>>8,s[m]=T<<16|T>>>16,u[m]=T<<8|T>>>24,l[m]=T,T=16843009*b^65537*A^257*v^16843008*m,c[y]=T<<24|T>>>8,f[y]=T<<16|T>>>16,p[y]=T<<8|T>>>24,d[y]=T,m?(m=v^h[h[h[b^v]]],E^=h[h[E]]):m=E=1}var _=[0,1,2,4,8,16,32,64,128,27,54],S=S.AES=t.extend({_doReset:function(){for(var I=this._key,w=I.words,R=I.sigBytes/4,I=4*((this._nRounds=R+6)+1),H=this._keySchedule=[],C=0;C<I;C++)if(C<R)H[C]=w[C];else{var M=H[C-1];C%R?6<R&&C%R==4&&(M=e[M>>>24]<<24|e[M>>>16&255]<<16|e[M>>>8&255]<<8|e[M&255]):(M=M<<8|M>>>24,M=e[M>>>24]<<24|e[M>>>16&255]<<16|e[M>>>8&255]<<8|e[M&255],M^=_[C/R|0]<<24),H[C]=H[C-R]^M}for(w=this._invKeySchedule=[],R=0;R<I;R++)C=I-R,M=R%4?H[C]:H[C-4],w[R]=4>R||4>=C?M:c[e[M>>>24]]^f[e[M>>>16&255]]^p[e[M>>>8&255]]^d[e[M&255]]},encryptBlock:function(w,R){this._doCryptBlock(w,R,this._keySchedule,o,s,u,l,e)},decryptBlock:function(w,R){var I=w[R+1];w[R+1]=w[R+3],w[R+3]=I,this._doCryptBlock(w,R,this._invKeySchedule,c,f,p,d,r),I=w[R+1],w[R+1]=w[R+3],w[R+3]=I},_doCryptBlock:function(w,R,I,H,C,M,B,L){for(var O=this._nRounds,U=w[R]^I[0],j=w[R+1]^I[1],K=w[R+2]^I[2],V=w[R+3]^I[3],k=4,D=1;D<O;D++)var q=H[U>>>24]^C[j>>>16&255]^M[K>>>8&255]^B[V&255]^I[k++],z=H[j>>>24]^C[K>>>16&255]^M[V>>>8&255]^B[U&255]^I[k++],J=H[K>>>24]^C[V>>>16&255]^M[U>>>8&255]^B[j&255]^I[k++],V=H[V>>>24]^C[U>>>16&255]^M[j>>>8&255]^B[K&255]^I[k++],U=q,j=z,K=J;q=(L[U>>>24]<<24|L[j>>>16&255]<<16|L[K>>>8&255]<<8|L[V&255])^I[k++],z=(L[j>>>24]<<24|L[K>>>16&255]<<16|L[V>>>8&255]<<8|L[U&255])^I[k++],J=(L[K>>>24]<<24|L[V>>>16&255]<<16|L[U>>>8&255]<<8|L[j&255])^I[k++],V=(L[V>>>24]<<24|L[U>>>16&255]<<16|L[j>>>8&255]<<8|L[K&255])^I[k++],w[R]=q,w[R+1]=z,w[R+2]=J,w[R+3]=V},keySize:8});n.AES=t._createHelper(S)})();/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
343
343
  */var dbits;function BigInteger(n,t,e){n!=null&&(typeof n=="number"?this.fromNumber(n,t,e):t==null&&typeof n!="string"?this.fromString(n,256):this.fromString(n,t))}function nbi(){return new BigInteger(null)}function am1(n,t,e,r,o,s){for(;--s>=0;){var u=t*this[n++]+e[r]+o;o=Math.floor(u/67108864),e[r++]=u&67108863}return o}function am2(n,t,e,r,o,s){for(var u=t&32767,l=t>>15;--s>=0;){var c=this[n]&32767,f=this[n++]>>15,p=l*c+f*u;c=u*c+((p&32767)<<15)+e[r]+(o&1073741823),o=(c>>>30)+(p>>>15)+l*f+(o>>>30),e[r++]=c&1073741823}return o}function am3(n,t,e,r,o,s){for(var u=t&16383,l=t>>14;--s>=0;){var c=this[n]&16383,f=this[n++]>>14,p=l*c+f*u;c=u*c+((p&16383)<<14)+e[r]+o,o=(c>>28)+(p>>14)+l*f,e[r++]=c&268435455}return o}typeof navigator!="undefined"&&navigator.appName=="Microsoft Internet Explorer"?(BigInteger.prototype.am=am2,dbits=30):typeof navigator!="undefined"&&navigator.appName!="Netscape"?(BigInteger.prototype.am=am1,dbits=26):(BigInteger.prototype.am=am3,dbits=28),BigInteger.prototype.DB=dbits,BigInteger.prototype.DM=(1<<dbits)-1,BigInteger.prototype.DV=1<<dbits;var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP),BigInteger.prototype.F1=BI_FP-dbits,BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array,rr,vv;for(rr=48,vv=0;vv<=9;++vv)BI_RC[rr++]=vv;for(rr=97,vv=10;vv<36;++vv)BI_RC[rr++]=vv;for(rr=65,vv=10;vv<36;++vv)BI_RC[rr++]=vv;function int2char(n){return BI_RM.charAt(n)}function intAt(n,t){var e=BI_RC[n.charCodeAt(t)];return e==null?-1:e}function bnpCopyTo(n){for(var t=this.t-1;t>=0;--t)n[t]=this[t];n.t=this.t,n.s=this.s}function bnpFromInt(n){this.t=1,this.s=n<0?-1:0,n>0?this[0]=n:n<-1?this[0]=n+this.DV:this.t=0}function nbv(n){var t=nbi();return t.fromInt(n),t}function bnpFromString(n,t){var e;if(t==16)e=4;else if(t==8)e=3;else if(t==256)e=8;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else{this.fromRadix(n,t);return}this.t=0,this.s=0;for(var r=n.length,o=!1,s=0;--r>=0;){var u=e==8?n[r]&255:intAt(n,r);if(u<0){n.charAt(r)=="-"&&(o=!0);continue}o=!1,s==0?this[this.t++]=u:s+e>this.DB?(this[this.t-1]|=(u&(1<<this.DB-s)-1)<<s,this[this.t++]=u>>this.DB-s):this[this.t-1]|=u<<s,s+=e,s>=this.DB&&(s-=this.DB)}e==8&&(n[0]&128)!=0&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var n=this.s&this.DM;this.t>0&&this[this.t-1]==n;)--this.t}function bnToString(n){if(this.s<0)return"-"+this.negate().toString(n);var t;if(n==16)t=4;else if(n==8)t=3;else if(n==2)t=1;else if(n==32)t=5;else if(n==4)t=2;else return this.toRadix(n);var e=(1<<t)-1,r,o=!1,s="",u=this.t,l=this.DB-u*this.DB%t;if(u-- >0)for(l<this.DB&&(r=this[u]>>l)>0&&(o=!0,s=int2char(r));u>=0;)l<t?(r=(this[u]&(1<<l)-1)<<t-l,r|=this[--u]>>(l+=this.DB-t)):(r=this[u]>>(l-=t)&e,l<=0&&(l+=this.DB,--u)),r>0&&(o=!0),o&&(s+=int2char(r));return o?s:"0"}function bnNegate(){var n=nbi();return BigInteger.ZERO.subTo(this,n),n}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(n){var t=this.s-n.s;if(t!=0)return t;var e=this.t;if(t=e-n.t,t!=0)return this.s<0?-t:t;for(;--e>=0;)if((t=this[e]-n[e])!=0)return t;return 0}function nbits(n){var t=1,e;return(e=n>>>16)!=0&&(n=e,t+=16),(e=n>>8)!=0&&(n=e,t+=8),(e=n>>4)!=0&&(n=e,t+=4),(e=n>>2)!=0&&(n=e,t+=2),(e=n>>1)!=0&&(n=e,t+=1),t}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(n,t){var e;for(e=this.t-1;e>=0;--e)t[e+n]=this[e];for(e=n-1;e>=0;--e)t[e]=0;t.t=this.t+n,t.s=this.s}function bnpDRShiftTo(n,t){for(var e=n;e<this.t;++e)t[e-n]=this[e];t.t=Math.max(this.t-n,0),t.s=this.s}function bnpLShiftTo(n,t){var e=n%this.DB,r=this.DB-e,o=(1<<r)-1,s=Math.floor(n/this.DB),u=this.s<<e&this.DM,l;for(l=this.t-1;l>=0;--l)t[l+s+1]=this[l]>>r|u,u=(this[l]&o)<<e;for(l=s-1;l>=0;--l)t[l]=0;t[s]=u,t.t=this.t+s+1,t.s=this.s,t.clamp()}function bnpRShiftTo(n,t){t.s=this.s;var e=Math.floor(n/this.DB);if(e>=this.t){t.t=0;return}var r=n%this.DB,o=this.DB-r,s=(1<<r)-1;t[0]=this[e]>>r;for(var u=e+1;u<this.t;++u)t[u-e-1]|=(this[u]&s)<<o,t[u-e]=this[u]>>r;r>0&&(t[this.t-e-1]|=(this.s&s)<<o),t.t=this.t-e,t.clamp()}function bnpSubTo(n,t){for(var e=0,r=0,o=Math.min(n.t,this.t);e<o;)r+=this[e]-n[e],t[e++]=r&this.DM,r>>=this.DB;if(n.t<this.t){for(r-=n.s;e<this.t;)r+=this[e],t[e++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;e<n.t;)r-=n[e],t[e++]=r&this.DM,r>>=this.DB;r-=n.s}t.s=r<0?-1:0,r<-1?t[e++]=this.DV+r:r>0&&(t[e++]=r),t.t=e,t.clamp()}function bnpMultiplyTo(n,t){var e=this.abs(),r=n.abs(),o=e.t;for(t.t=o+r.t;--o>=0;)t[o]=0;for(o=0;o<r.t;++o)t[o+e.t]=e.am(0,r[o],t,o,0,e.t);t.s=0,t.clamp(),this.s!=n.s&&BigInteger.ZERO.subTo(t,t)}function bnpSquareTo(n){for(var t=this.abs(),e=n.t=2*t.t;--e>=0;)n[e]=0;for(e=0;e<t.t-1;++e){var r=t.am(e,t[e],n,2*e,0,1);(n[e+t.t]+=t.am(e+1,2*t[e],n,2*e+1,r,t.t-e-1))>=t.DV&&(n[e+t.t]-=t.DV,n[e+t.t+1]=1)}n.t>0&&(n[n.t-1]+=t.am(e,t[e],n,2*e,0,1)),n.s=0,n.clamp()}function bnpDivRemTo(n,t,e){var r=n.abs();if(!(r.t<=0)){var o=this.abs();if(o.t<r.t){t!=null&&t.fromInt(0),e!=null&&this.copyTo(e);return}e==null&&(e=nbi());var s=nbi(),u=this.s,l=n.s,c=this.DB-nbits(r[r.t-1]);c>0?(r.lShiftTo(c,s),o.lShiftTo(c,e)):(r.copyTo(s),o.copyTo(e));var f=s.t,p=s[f-1];if(p!=0){var d=p*(1<<this.F1)+(f>1?s[f-2]>>this.F2:0),h=this.FV/d,g=(1<<this.F1)/d,m=1<<this.F2,E=e.t,y=E-f,v=t==null?nbi():t;for(s.dlShiftTo(y,v),e.compareTo(v)>=0&&(e[e.t++]=1,e.subTo(v,e)),BigInteger.ONE.dlShiftTo(f,v),v.subTo(s,s);s.t<f;)s[s.t++]=0;for(;--y>=0;){var A=e[--E]==p?this.DM:Math.floor(e[E]*h+(e[E-1]+m)*g);if((e[E]+=s.am(0,A,e,y,0,f))<A)for(s.dlShiftTo(y,v),e.subTo(v,e);e[E]<--A;)e.subTo(v,e)}t!=null&&(e.drShiftTo(f,t),u!=l&&BigInteger.ZERO.subTo(t,t)),e.t=f,e.clamp(),c>0&&e.rShiftTo(c,e),u<0&&BigInteger.ZERO.subTo(e,e)}}}function bnMod(n){var t=nbi();return this.abs().divRemTo(n,null,t),this.s<0&&t.compareTo(BigInteger.ZERO)>0&&n.subTo(t,t),t}function Classic(n){this.m=n}function cConvert(n){return n.s<0||n.compareTo(this.m)>=0?n.mod(this.m):n}function cRevert(n){return n}function cReduce(n){n.divRemTo(this.m,null,n)}function cMulTo(n,t,e){n.multiplyTo(t,e),this.reduce(e)}function cSqrTo(n,t){n.squareTo(t),this.reduce(t)}Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1)return 0;var n=this[0];if((n&1)==0)return 0;var t=n&3;return t=t*(2-(n&15)*t)&15,t=t*(2-(n&255)*t)&255,t=t*(2-((n&65535)*t&65535))&65535,t=t*(2-n*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Montgomery(n){this.m=n,this.mp=n.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<n.DB-15)-1,this.mt2=2*n.t}function montConvert(n){var t=nbi();return n.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),n.s<0&&t.compareTo(BigInteger.ZERO)>0&&this.m.subTo(t,t),t}function montRevert(n){var t=nbi();return n.copyTo(t),this.reduce(t),t}function montReduce(n){for(;n.t<=this.mt2;)n[n.t++]=0;for(var t=0;t<this.m.t;++t){var e=n[t]&32767,r=e*this.mpl+((e*this.mph+(n[t]>>15)*this.mpl&this.um)<<15)&n.DM;for(e=t+this.m.t,n[e]+=this.m.am(0,r,n,t,0,this.m.t);n[e]>=n.DV;)n[e]-=n.DV,n[++e]++}n.clamp(),n.drShiftTo(this.m.t,n),n.compareTo(this.m)>=0&&n.subTo(this.m,n)}function montSqrTo(n,t){n.squareTo(t),this.reduce(t)}function montMulTo(n,t,e){n.multiplyTo(t,e),this.reduce(e)}Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return(this.t>0?this[0]&1:this.s)==0}function bnpExp(n,t){if(n>4294967295||n<1)return BigInteger.ONE;var e=nbi(),r=nbi(),o=t.convert(this),s=nbits(n)-1;for(o.copyTo(e);--s>=0;)if(t.sqrTo(e,r),(n&1<<s)>0)t.mulTo(r,o,e);else{var u=e;e=r,r=u}return t.revert(e)}function bnModPowInt(n,t){var e;return n<256||t.isEven()?e=new Classic(t):e=new Montgomery(t),this.exp(n,e)}BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1);/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function bnIntValue(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function bnpChunkSize(n){return Math.floor(Math.LN2*this.DB/Math.log(n))}function bnSigNum(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function bnpToRadix(n){if(n==null&&(n=10),this.signum()==0||n<2||n>36)return"0";var t=this.chunkSize(n),e=Math.pow(n,t),r=nbv(e),o=nbi(),s=nbi(),u="";for(this.divRemTo(r,o,s);o.signum()>0;)u=(e+s.intValue()).toString(n).substr(1)+u,o.divRemTo(r,o,s);return s.intValue().toString(n)+u}BigInteger.prototype.chunkSize=bnpChunkSize,BigInteger.prototype.toRadix=bnpToRadix,BigInteger.prototype.intValue=bnIntValue,BigInteger.prototype.signum=bnSigNum;/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64pad="=";function hex2b64(n){var t,e,r="";for(t=0;t+3<=n.length;t+=3)e=parseInt(n.substring(t,t+3),16),r+=b64map.charAt(e>>6)+b64map.charAt(e&63);for(t+1==n.length?(e=parseInt(n.substring(t,t+1),16),r+=b64map.charAt(e<<2)):t+2==n.length&&(e=parseInt(n.substring(t,t+2),16),r+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4));(r.length&3)>0;)r+=b64pad;return r}function b64tohex(n){var t="",e,r=0,o,s;for(e=0;e<n.length&&n.charAt(e)!=b64pad;++e)s=b64map.indexOf(n.charAt(e)),!(s<0)&&(r==0?(t+=int2char(s>>2),o=s&3,r=1):r==1?(t+=int2char(o<<2|s>>4),o=s&15,r=2):r==2?(t+=int2char(o),t+=int2char(s>>2),o=s&3,r=3):(t+=int2char(o<<2|s>>4),t+=int2char(s&15),r=0));return r==1&&(t+=int2char(o<<2)),t}/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function parseBigInt(n,t){return new BigInteger(n,t)}function pkcs1pad2(n,t){if(t<n.length+11)throw"Message too long for RSA";for(var e=new Array,r=n.length-1;r>=0&&t>0;){var o=n.charCodeAt(r--);o<128?e[--t]=o:o>127&&o<2048?(e[--t]=o&63|128,e[--t]=o>>6|192):(e[--t]=o&63|128,e[--t]=o>>6&63|128,e[--t]=o>>12|224)}e[--t]=0;for(var s=new SecureRandom,u=new Array;t>2;){for(u[0]=0;u[0]==0;)s.nextBytes(u);e[--t]=u[0]}return e[--t]=2,e[--t]=0,new BigInteger(e)}function oaep_mgf1_arr(n,t,e){for(var r="",o=0;r.length<t;)r+=e(String.fromCharCode.apply(String,n.concat([(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))),o+=1;return r}function oaep_pad(n,t,e,r){var o=KJUR.crypto.MessageDigest,s=KJUR.crypto.Util,u=null;if(e||(e="sha1"),typeof e=="string"&&(u=o.getCanonicalAlgName(e),r=o.getHashLength(u),e=function(E){return hextorstr(s.hashHex(rstrtohex(E),u))}),n.length+2*r+2>t)throw"Message too long for RSA";var l="",c;for(c=0;c<t-n.length-2*r-2;c+=1)l+="\0";var f=e("")+l+""+n,p=new Array(r);new SecureRandom().nextBytes(p);var d=oaep_mgf1_arr(p,f.length,e),h=[];for(c=0;c<f.length;c+=1)h[c]=f.charCodeAt(c)^d.charCodeAt(c);var g=oaep_mgf1_arr(h,p.length,e),m=[0];for(c=0;c<p.length;c+=1)m[c+1]=p[c]^g.charCodeAt(c);return new BigInteger(m.concat(h))}function RSAKey(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function RSASetPublic(n,t){if(this.isPublic=!0,this.isPrivate=!1,typeof n!="string")this.n=n,this.e=t;else if(n!=null&&t!=null&&n.length>0&&t.length>0)this.n=parseBigInt(n,16),this.e=parseInt(t,16);else throw"Invalid RSA public key"}function RSADoPublic(n){return n.modPowInt(this.e,this.n)}function RSAEncrypt(n){var t=pkcs1pad2(n,this.n.bitLength()+7>>3);if(t==null)return null;var e=this.doPublic(t);if(e==null)return null;var r=e.toString(16);return(r.length&1)==0?r:"0"+r}function RSAEncryptOAEP(n,t,e){var r=oaep_pad(n,this.n.bitLength()+7>>3,t,e);if(r==null)return null;var o=this.doPublic(r);if(o==null)return null;var s=o.toString(16);return(s.length&1)==0?s:"0"+s}RSAKey.prototype.doPublic=RSADoPublic,RSAKey.prototype.setPublic=RSASetPublic,RSAKey.prototype.encrypt=RSAEncrypt,RSAKey.prototype.encryptOAEP=RSAEncryptOAEP,RSAKey.prototype.type="RSA";/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function pkcs1unpad2(n,t){for(var e=n.toByteArray(),r=0;r<e.length&&e[r]==0;)++r;if(e.length-r!=t-1||e[r]!=2)return null;for(++r;e[r]!=0;)if(++r>=e.length)return null;for(var o="";++r<e.length;){var s=e[r]&255;s<128?o+=String.fromCharCode(s):s>191&&s<224?(o+=String.fromCharCode((s&31)<<6|e[r+1]&63),++r):(o+=String.fromCharCode((s&15)<<12|(e[r+1]&63)<<6|e[r+2]&63),r+=2)}return o}function oaep_mgf1_str(n,t,e){for(var r="",o=0;r.length<t;)r+=e(n+String.fromCharCode.apply(String,[(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255])),o+=1;return r}function oaep_unpad(n,t,e,r){var o=KJUR.crypto.MessageDigest,s=KJUR.crypto.Util,u=null;e||(e="sha1"),typeof e=="string"&&(u=o.getCanonicalAlgName(e),r=o.getHashLength(u),e=function(y){return hextorstr(s.hashHex(rstrtohex(y),u))}),n=n.toByteArray();var d;for(d=0;d<n.length;d+=1)n[d]&=255;for(;n.length<t;)n.unshift(0);if(n=String.fromCharCode.apply(String,n),n.length<2*r+2)throw"Cipher too short";var l=n.substr(1,r),c=n.substr(r+1),f=oaep_mgf1_str(c,r,e),p=[],d;for(d=0;d<l.length;d+=1)p[d]=l.charCodeAt(d)^f.charCodeAt(d);var h=oaep_mgf1_str(String.fromCharCode.apply(String,p),n.length-r,e),g=[];for(d=0;d<c.length;d+=1)g[d]=c.charCodeAt(d)^h.charCodeAt(d);if(g=String.fromCharCode.apply(String,g),g.substr(0,r)!==e(""))throw"Hash mismatch";g=g.substr(r);var m=g.indexOf(""),E=m!=-1?g.substr(0,m).lastIndexOf("\0"):-1;if(E+1!=m)throw"Malformed data";return g.substr(m+1)}function RSASetPrivate(n,t,e){if(this.isPrivate=!0,typeof n!="string")this.n=n,this.e=t,this.d=e;else if(n!=null&&t!=null&&n.length>0&&t.length>0)this.n=parseBigInt(n,16),this.e=parseInt(t,16),this.d=parseBigInt(e,16);else throw"Invalid RSA private key"}function RSASetPrivateEx(n,t,e,r,o,s,u,l){if(this.isPrivate=!0,this.isPublic=!1,n==null)throw"RSASetPrivateEx N == null";if(t==null)throw"RSASetPrivateEx E == null";if(n.length==0)throw"RSASetPrivateEx N.length == 0";if(t.length==0)throw"RSASetPrivateEx E.length == 0";if(n!=null&&t!=null&&n.length>0&&t.length>0)this.n=parseBigInt(n,16),this.e=parseInt(t,16),this.d=parseBigInt(e,16),this.p=parseBigInt(r,16),this.q=parseBigInt(o,16),this.dmp1=parseBigInt(s,16),this.dmq1=parseBigInt(u,16),this.coeff=parseBigInt(l,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function RSADoPrivate(n){if(this.p==null||this.q==null)return n.modPow(this.d,this.n);for(var t=n.mod(this.p).modPow(this.dmp1,this.p),e=n.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(e)<0;)t=t.add(this.p);return t.subtract(e).multiply(this.coeff).mod(this.p).multiply(this.q).add(e)}function RSADecrypt(n){if(n.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var t=parseBigInt(n,16),e=this.doPrivate(t);return e==null?null:pkcs1unpad2(e,this.n.bitLength()+7>>3)}function RSADecryptOAEP(n,t,e){if(n.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var r=parseBigInt(n,16),o=this.doPrivate(r);return o==null?null:oaep_unpad(o,this.n.bitLength()+7>>3,t,e)}RSAKey.prototype.doPrivate=RSADoPrivate,RSAKey.prototype.setPrivate=RSASetPrivate,RSAKey.prototype.setPrivateEx=RSASetPrivateEx,RSAKey.prototype.decrypt=RSADecrypt,RSAKey.prototype.decryptOAEP=RSADecryptOAEP,(typeof KJUR.lang=="undefined"||!KJUR.lang)&&(KJUR.lang={}),KJUR.lang.String=function(){};function b64utob64(n){return n.length%4==2?n=n+"==":n.length%4==3&&(n=n+"="),n=n.replace(/-/g,"+"),n=n.replace(/_/g,"/"),n}function b64utohex(n){return b64tohex(b64utob64(n))}function hextoutf8(n){return decodeURIComponent(hextouricmp(n))}function hextorstr(n){for(var t="",e=0;e<n.length-1;e+=2)t+=String.fromCharCode(parseInt(n.substr(e,2),16));return t}function rstrtohex(n){for(var t="",e=0;e<n.length;e++)t+=("0"+n.charCodeAt(e).toString(16)).slice(-2);return t}function hextob64(n){return hex2b64(n)}function hextob64nl(n){var t=hextob64(n),e=t.replace(/(.{64})/g,`$1\r
344
344
  `);return e=e.replace(/\r\n$/,""),e}function b64nltohex(n){var t=n.replace(/[^0-9A-Za-z\/+=]*/g,""),e=b64tohex(t);return e}function hextopem(n,t){var e=hextob64nl(n);return"-----BEGIN "+t+`-----\r
345
345
  `+e+`\r
@@ -359,11 +359,11 @@
359
359
  `,I+=`\r
360
360
  `,I+=R,I+=`\r
361
361
  -----END `+m+` PRIVATE KEY-----\r
362
- `,I},parseHexOfEncryptedPKCS8:function(m){var E=ASN1HEX,y=E.getChildIdx,v=E.getV,A={},b=y(m,0);if(b.length!=2)throw"malformed format: SEQUENCE(0).items != 2: "+b.length;A.ciphertext=v(m,b[1]);var T=y(m,b[0]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0).items != 2: "+T.length;if(v(m,T[0])!="2a864886f70d01050d")throw"this only supports pkcs5PBES2";var _=y(m,T[1]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+_.length;var S=y(m,_[1]);if(S.length!=2)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+S.length;if(v(m,S[0])!="2a864886f70d0307")throw"this only supports TripleDES";A.encryptionSchemeAlg="TripleDES",A.encryptionSchemeIV=v(m,S[1]);var w=y(m,_[0]);if(w.length!=2)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+w.length;if(v(m,w[0])!="2a864886f70d01050c")throw"this only supports pkcs5PBKDF2";var R=y(m,w[1]);if(R.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+R.length;A.pbkdf2Salt=v(m,R[0]);var I=v(m,R[1]);try{A.pbkdf2Iter=parseInt(I,16)}catch(H){throw"malformed format pbkdf2Iter: "+I}return A},getPBKDF2KeyHexFromParam:function(m,E){var y=CryptoJS.enc.Hex.parse(m.pbkdf2Salt),v=m.pbkdf2Iter,A=CryptoJS.PBKDF2(E,y,{keySize:192/32,iterations:v}),b=CryptoJS.enc.Hex.stringify(A);return b},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(m,E){var y=pemtohex(m,"ENCRYPTED PRIVATE KEY"),v=this.parseHexOfEncryptedPKCS8(y),A=KEYUTIL.getPBKDF2KeyHexFromParam(v,E),b={};b.ciphertext=CryptoJS.enc.Hex.parse(v.ciphertext);var T=CryptoJS.enc.Hex.parse(A),_=CryptoJS.enc.Hex.parse(v.encryptionSchemeIV),S=CryptoJS.TripleDES.decrypt(b,T,{iv:_}),w=CryptoJS.enc.Hex.stringify(S);return w},getKeyFromEncryptedPKCS8PEM:function(m,E){var y=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(m,E),v=this.getKeyFromPlainPrivatePKCS8Hex(y);return v},parsePlainPrivatePKCS8Hex:function(m){var E=ASN1HEX,y=E.getChildIdx,v=E.getV,A={};if(A.algparam=null,m.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var b=y(m,0);if(b.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(m.substr(b[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var T=y(m,b[1]);if(T.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(m.substr(T[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(A.algoid=v(m,T[0]),m.substr(T[1],2)=="06"&&(A.algparam=v(m,T[1])),m.substr(b[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return A.keyidx=E.getVidx(m,b[2]),A},getKeyFromPlainPrivatePKCS8PEM:function(m){var E=pemtohex(m,"PRIVATE KEY"),y=this.getKeyFromPlainPrivatePKCS8Hex(E);return y},getKeyFromPlainPrivatePKCS8Hex:function(m){var E=this.parsePlainPrivatePKCS8Hex(m),y;if(E.algoid=="2a864886f70d010101")y=new RSAKey;else if(KJUR.crypto.DSA&&E.algoid=="2a8648ce380401")y=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&E.algoid=="2a8648ce3d0201")y=new KJUR.crypto.ECDSA;else throw"unsupported private key algorithm";return y.readPKCS8PrvKeyHex(m),y},_getKeyFromPublicPKCS8Hex:function(m){var E,y=ASN1HEX.getVbyList(m,0,[0,0],"06");if(y==="2a864886f70d010101")E=new RSAKey;else if(KJUR.crypto.DSA&&y==="2a8648ce380401")E=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&y==="2a8648ce3d0201")E=new KJUR.crypto.ECDSA;else throw"unsupported PKCS#8 public key hex";return E.readPKCS8PubKeyHex(m),E},parsePublicRawRSAKeyHex:function(m){var E=ASN1HEX,y=E.getChildIdx,v=E.getV,A={};if(m.substr(0,2)!="30")throw"malformed RSA key(code:001)";var b=y(m,0);if(b.length!=2)throw"malformed RSA key(code:002)";if(m.substr(b[0],2)!="02")throw"malformed RSA key(code:003)";if(A.n=v(m,b[0]),m.substr(b[1],2)!="02")throw"malformed RSA key(code:004)";return A.e=v(m,b[1]),A},parsePublicPKCS8Hex:function(m){var E=ASN1HEX,y=E.getChildIdx,v=E.getV,A={};A.algparam=null;var b=y(m,0);if(b.length!=2)throw"outer DERSequence shall have 2 elements: "+b.length;var T=b[0];if(m.substr(T,2)!="30")throw"malformed PKCS8 public key(code:001)";var _=y(m,T);if(_.length!=2)throw"malformed PKCS8 public key(code:002)";if(m.substr(_[0],2)!="06")throw"malformed PKCS8 public key(code:003)";if(A.algoid=v(m,_[0]),m.substr(_[1],2)=="06"?A.algparam=v(m,_[1]):m.substr(_[1],2)=="30"&&(A.algparam={},A.algparam.p=E.getVbyList(m,_[1],[0],"02"),A.algparam.q=E.getVbyList(m,_[1],[1],"02"),A.algparam.g=E.getVbyList(m,_[1],[2],"02")),m.substr(b[1],2)!="03")throw"malformed PKCS8 public key(code:004)";return A.key=v(m,b[1]).substr(2),A}}})();KEYUTIL.getKey=function(n,t,e){var r=ASN1HEX,o=r.getChildIdx;r.getV;var s=r.getVbyList,u=KJUR.crypto,l=u.ECDSA,c=u.DSA,f=RSAKey,p=pemtohex,d=KEYUTIL;if(typeof f!="undefined"&&n instanceof f||typeof l!="undefined"&&n instanceof l||typeof c!="undefined"&&n instanceof c)return n;if(n.curve!==void 0&&n.xy!==void 0&&n.d===void 0)return new l({pub:n.xy,curve:n.curve});if(n.curve!==void 0&&n.d!==void 0)return new l({prv:n.d,curve:n.curve});if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d===void 0){var h=new f;return h.setPublic(n.n,n.e),h}if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p!==void 0&&n.q!==void 0&&n.dp!==void 0&&n.dq!==void 0&&n.co!==void 0&&n.qi===void 0){var h=new f;return h.setPrivateEx(n.n,n.e,n.d,n.p,n.q,n.dp,n.dq,n.co),h}if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p===void 0){var h=new f;return h.setPrivate(n.n,n.e,n.d),h}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x===void 0){var h=new c;return h.setPublic(n.p,n.q,n.g,n.y),h}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x!==void 0){var h=new c;return h.setPrivate(n.p,n.q,n.g,n.y,n.x),h}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d===void 0){var h=new f;return h.setPublic(b64utohex(n.n),b64utohex(n.e)),h}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p!==void 0&&n.q!==void 0&&n.dp!==void 0&&n.dq!==void 0&&n.qi!==void 0){var h=new f;return h.setPrivateEx(b64utohex(n.n),b64utohex(n.e),b64utohex(n.d),b64utohex(n.p),b64utohex(n.q),b64utohex(n.dp),b64utohex(n.dq),b64utohex(n.qi)),h}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0){var h=new f;return h.setPrivate(b64utohex(n.n),b64utohex(n.e),b64utohex(n.d)),h}if(n.kty==="EC"&&n.crv!==void 0&&n.x!==void 0&&n.y!==void 0&&n.d===void 0){var g=new l({curve:n.crv}),m=g.ecparams.keylen/4,E=("0000000000"+b64utohex(n.x)).slice(-m),y=("0000000000"+b64utohex(n.y)).slice(-m),v="04"+E+y;return g.setPublicKeyHex(v),g}if(n.kty==="EC"&&n.crv!==void 0&&n.x!==void 0&&n.y!==void 0&&n.d!==void 0){var g=new l({curve:n.crv}),m=g.ecparams.keylen/4,E=("0000000000"+b64utohex(n.x)).slice(-m),y=("0000000000"+b64utohex(n.y)).slice(-m),v="04"+E+y,A=("0000000000"+b64utohex(n.d)).slice(-m);return g.setPublicKeyHex(v),g.setPrivateKeyHex(A),g}if(e==="pkcs5prv"){var b=n,r=ASN1HEX,T,h;if(T=o(b,0),T.length===9)h=new f,h.readPKCS5PrvKeyHex(b);else if(T.length===6)h=new c,h.readPKCS5PrvKeyHex(b);else if(T.length>2&&b.substr(T[1],2)==="04")h=new l,h.readPKCS5PrvKeyHex(b);else throw"unsupported PKCS#1/5 hexadecimal key";return h}if(e==="pkcs8prv"){var h=d.getKeyFromPlainPrivatePKCS8Hex(n);return h}if(e==="pkcs8pub")return d._getKeyFromPublicPKCS8Hex(n);if(e==="x509pub")return X509.getPublicKeyFromCertHex(n);if(n.indexOf("-END CERTIFICATE-",0)!=-1||n.indexOf("-END X509 CERTIFICATE-",0)!=-1||n.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return X509.getPublicKeyFromCertPEM(n);if(n.indexOf("-END PUBLIC KEY-")!=-1){var _=pemtohex(n,"PUBLIC KEY");return d._getKeyFromPublicPKCS8Hex(_)}if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var S=p(n,"RSA PRIVATE KEY");return d.getKey(S,null,"pkcs5prv")}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var w=p(n,"DSA PRIVATE KEY"),R=s(w,0,[1],"02"),I=s(w,0,[2],"02"),H=s(w,0,[3],"02"),C=s(w,0,[4],"02"),M=s(w,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(R,16),new BigInteger(I,16),new BigInteger(H,16),new BigInteger(C,16),new BigInteger(M,16)),h}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var S=p(n,"EC PRIVATE KEY");return d.getKey(S,null,"pkcs5prv")}if(n.indexOf("-END PRIVATE KEY-")!=-1)return d.getKeyFromPlainPrivatePKCS8PEM(n);if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var B=d.getDecryptedKeyHex(n,t),L=new RSAKey;return L.readPKCS5PrvKeyHex(B),L}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var w=d.getDecryptedKeyHex(n,t),h=s(w,0,[1],"04"),O=s(w,0,[2,0],"06"),k=s(w,0,[3,0],"03").substr(2),D="";if(KJUR.crypto.OID.oidhex2name[O]!==void 0)D=KJUR.crypto.OID.oidhex2name[O];else throw"undefined OID(hex) in KJUR.crypto.OID: "+O;var g=new l({curve:D});return g.setPublicKeyHex(k),g.setPrivateKeyHex(h),g.isPublic=!1,g}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var w=d.getDecryptedKeyHex(n,t),R=s(w,0,[1],"02"),I=s(w,0,[2],"02"),H=s(w,0,[3],"02"),C=s(w,0,[4],"02"),M=s(w,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(R,16),new BigInteger(I,16),new BigInteger(H,16),new BigInteger(C,16),new BigInteger(M,16)),h}if(n.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return d.getKeyFromEncryptedPKCS8PEM(n,t);throw new Error("not supported argument")},(typeof KJUR.asn1=="undefined"||!KJUR.asn1)&&(KJUR.asn1={}),KJUR.asn1.ASN1Util={},KJUR.asn1.ASN1Util.oidHexToInt=function(n){for(var o="",t=parseInt(n.substr(0,2),16),e=Math.floor(t/40),r=t%40,o=e+"."+r,s="",u=2;u<n.length;u+=2){var l=parseInt(n.substr(u,2),16),c=("00000000"+l.toString(2)).slice(-8);if(s=s+c.substr(1,7),c.substr(0,1)=="0"){var f=new BigInteger(s,2);o=o+"."+f.toString(10),s=""}}return o};var ASN1HEX=new function(){};ASN1HEX.getLblen=function(n,t){if(n.substr(t+2,1)!="8")return 1;var e=parseInt(n.substr(t+3,1));return e==0?-1:0<e&&e<10?e+1:-2},ASN1HEX.getL=function(n,t){var e=ASN1HEX.getLblen(n,t);return e<1?"":n.substr(t+2,e*2)},ASN1HEX.getVblen=function(n,t){var e,r;return e=ASN1HEX.getL(n,t),e==""?-1:(e.substr(0,1)==="8"?r=new BigInteger(e.substr(2),16):r=new BigInteger(e,16),r.intValue())},ASN1HEX.getVidx=function(n,t){var e=ASN1HEX.getLblen(n,t);return e<0?e:t+(e+1)*2},ASN1HEX.getV=function(n,t){var e=ASN1HEX.getVidx(n,t),r=ASN1HEX.getVblen(n,t);return n.substr(e,r*2)},ASN1HEX.getTLV=function(n,t){return n.substr(t,2)+ASN1HEX.getL(n,t)+ASN1HEX.getV(n,t)},ASN1HEX.getTLVblen=function(n,t){return 2+ASN1HEX.getLblen(n,t)*2+ASN1HEX.getVblen(n,t)*2},ASN1HEX.getNextSiblingIdx=function(n,t){var e=ASN1HEX.getVidx(n,t),r=ASN1HEX.getVblen(n,t);return e+r*2},ASN1HEX.getChildIdx=function(n,t){var e=ASN1HEX,r=[],o,s,u;o=e.getVidx(n,t),s=e.getVblen(n,t)*2,n.substr(t,2)=="03"&&(o+=2,s-=2),u=0;for(var l=o;u<=s;){var c=e.getTLVblen(n,l);if(u+=c,u<=s&&r.push(l),l+=c,u>=s)break}return r},ASN1HEX.getNthChildIdx=function(n,t,e){var r=ASN1HEX.getChildIdx(n,t);return r[e]},ASN1HEX.getIdxbyList=function(n,t,e,r){var o=ASN1HEX,s,u;return e.length==0?r!==void 0&&n.substr(t,2)!==r?-1:t:(s=e.shift(),u=o.getChildIdx(n,t),s>=u.length?-1:o.getIdxbyList(n,u[s],e,r))},ASN1HEX.getIdxbyListEx=function(n,t,e,r){var o=ASN1HEX,s,u;if(e.length==0)return r!==void 0&&n.substr(t,2)!==r?-1:t;s=e.shift(),u=o.getChildIdx(n,t);for(var l=0,c=0;c<u.length;c++){var f=n.substr(u[c],2);if(typeof s=="number"&&!o.isContextTag(f)&&l==s||typeof s=="string"&&o.isContextTag(f,s))return o.getIdxbyListEx(n,u[c],e,r);o.isContextTag(f)||l++}return-1},ASN1HEX.getTLVbyList=function(n,t,e,r){var o=ASN1HEX,s=o.getIdxbyList(n,t,e,r);return s==-1||s>=n.length?null:o.getTLV(n,s)},ASN1HEX.getTLVbyListEx=function(n,t,e,r){var o=ASN1HEX,s=o.getIdxbyListEx(n,t,e,r);return s==-1?null:o.getTLV(n,s)},ASN1HEX.getVbyList=function(n,t,e,r,o){var s=ASN1HEX,u,l;return u=s.getIdxbyList(n,t,e,r),u==-1||u>=n.length?null:(l=s.getV(n,u),o===!0&&(l=l.substr(2)),l)},ASN1HEX.getVbyListEx=function(n,t,e,r,o){var s=ASN1HEX,u,l;return u=s.getIdxbyListEx(n,t,e,r),u==-1?null:(l=s.getV(n,u),n.substr(u,2)=="03"&&o!==!1&&(l=l.substr(2)),l)},ASN1HEX.getInt=function(n,t,e){e==null&&(e=-1);try{var r=n.substr(t,2);if(r!="02"&&r!="03")return e;var o=ASN1HEX.getV(n,t);return r=="02"?parseInt(o,16):bitstrtoint(o)}catch(s){return e}},ASN1HEX.getOID=function(n,t,e){e==null&&(e=null);try{if(n.substr(t,2)!="06")return e;var r=ASN1HEX.getV(n,t);return hextooid(r)}catch(o){return e}},ASN1HEX.getOIDName=function(n,t,e){e==null&&(e=null);try{var r=ASN1HEX.getOID(n,t,e);if(r==e)return e;var o=KJUR.asn1.x509.OID.oid2name(r);return o==""?r:o}catch(s){return e}},ASN1HEX.getString=function(n,t,e){e==null&&(e=null);try{var r=ASN1HEX.getV(n,t);return hextorstr(r)}catch(o){return e}},ASN1HEX.hextooidstr=function(n){var t=function(d,h){return d.length>=h?d:new Array(h-d.length+1).join("0")+d},e=[],r=n.substr(0,2),o=parseInt(r,16);e[0]=new String(Math.floor(o/40)),e[1]=new String(o%40);for(var s=n.substr(2),u=[],l=0;l<s.length/2;l++)u.push(parseInt(s.substr(l*2,2),16));for(var c=[],f="",l=0;l<u.length;l++)u[l]&128?f=f+t((u[l]&127).toString(2),7):(f=f+t((u[l]&127).toString(2),7),c.push(new String(parseInt(f,2))),f="");var p=e.join(".");return c.length>0&&(p=p+"."+c.join(".")),p},ASN1HEX.isContextTag=function(n,t){n=n.toLowerCase();var e,r;try{e=parseInt(n,16)}catch(s){return-1}if(t===void 0)return(e&192)==128;try{var o=t.match(/^\[[0-9]+\]$/);return o==null||(r=parseInt(t.substr(1,t.length-1),10),r>31)?!1:(e&192)==128&&(e&31)==r}catch(s){return!1}},ASN1HEX.isASN1HEX=function(n){var t=ASN1HEX;if(n.length%2==1)return!1;var e=t.getVblen(n,0),r=n.substr(0,2),o=t.getL(n,0),s=n.length-r.length-o.length;return s==e*2},ASN1HEX.checkStrictDER=function(n,t,e,r,o){var s=ASN1HEX;if(e===void 0){if(typeof n!="string")throw new Error("not hex string");if(n=n.toLowerCase(),!KJUR.lang.String.isHex(n))throw new Error("not hex string");e=n.length,r=n.length/2,r<128?o=1:o=Math.ceil(r.toString(16))+1}var u=s.getL(n,t);if(u.length>o*2)throw new Error("L of TLV too long: idx="+t);var l=s.getVblen(n,t);if(l>r)throw new Error("value of L too long than hex: idx="+t);var c=s.getTLV(n,t),f=c.length-2-s.getL(n,t).length;if(f!==l*2)throw new Error("V string length and L's value not the same:"+f+"/"+l*2);if(t===0&&n.length!=c.length)throw new Error("total length and TLV length unmatch:"+n.length+"!="+c.length);var p=n.substr(t,2);if(p==="02"){var d=s.getVidx(n,t);if(n.substr(d,2)=="00"&&n.charCodeAt(d+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(p,16)&32){for(var h=s.getVblen(n,t),g=0,m=s.getChildIdx(n,t),E=0;E<m.length;E++){var y=s.getTLV(n,m[E]);g+=y.length,s.checkStrictDER(n,m[E],e,r,o)}if(h*2!=g)throw new Error("sum of children's TLV length and L unmatch: "+h*2+"!="+g)}},ASN1HEX.oidname=function(n){var t=KJUR.asn1;KJUR.lang.String.isHex(n)&&(n=t.ASN1Util.oidHexToInt(n));var e=t.x509.OID.oid2name(n);return e===""&&(e=n),e},(typeof KJUR.asn1=="undefined"||!KJUR.asn1)&&(KJUR.asn1={}),(typeof KJUR.asn1.x509=="undefined"||!KJUR.asn1.x509)&&(KJUR.asn1.x509={}),KJUR.asn1.x509.AlgorithmIdentifier={},KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},KJUR.asn1.x509.OID=new function(n){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(t){if(typeof this.objCache[t]!="undefined")return this.objCache[t];if(typeof this.name2oidList[t]=="undefined")throw"Name of ObjectIdentifier not defined: "+t;var e=this.name2oidList[t],r=new KJUR.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r},this.atype2obj=function(t){if(this.objCache[t]!==void 0)return this.objCache[t];var e;if(t.match(/^\d+\.\d+\.[0-9.]+$/))e=t;else if(this.atype2oidList[t]!==void 0)e=this.atype2oidList[t];else if(this.name2oidList[t]!==void 0)e=this.name2oidList[t];else throw"AttributeType name undefined: "+t;var r=new KJUR.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r}},KJUR.asn1.x509.OID.oid2name=function(n){var t=KJUR.asn1.x509.OID.name2oidList;for(var e in t)if(t[e]==n)return e;return""},KJUR.asn1.x509.OID.oid2atype=function(n){var t=KJUR.asn1.x509.OID.atype2oidList;for(var e in t)if(t[e]==n)return e;return n},KJUR.asn1.x509.OID.name2oid=function(n){if(n.match(/^[0-9.]+$/))return n;var t=KJUR.asn1.x509.OID.name2oidList;return t[n]===void 0?"":t[n]},RSAKey.getPosArrayOfChildrenFromHex=function(n){return ASN1HEX.getChildIdx(n,0)},RSAKey.getHexValueArrayOfChildrenFromHex=function(n){var t=ASN1HEX,e=t.getV,h=RSAKey.getPosArrayOfChildrenFromHex(n),r=e(n,h[0]),o=e(n,h[1]),s=e(n,h[2]),u=e(n,h[3]),l=e(n,h[4]),c=e(n,h[5]),f=e(n,h[6]),p=e(n,h[7]),d=e(n,h[8]),h=new Array;return h.push(r,o,s,u,l,c,f,p,d),h},RSAKey.prototype.readPrivateKeyFromPEMString=function(n){var t=pemtohex(n),e=RSAKey.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},RSAKey.prototype.readPKCS5PrvKeyHex=function(n){var t=RSAKey.getHexValueArrayOfChildrenFromHex(n);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},RSAKey.prototype.readPKCS8PrvKeyHex=function(n){var t,e,r,o,s,u,l,c,f=ASN1HEX,p=f.getVbyListEx;if(f.isASN1HEX(n)===!1)throw new Error("not ASN.1 hex string");try{t=p(n,0,[2,0,1],"02"),e=p(n,0,[2,0,2],"02"),r=p(n,0,[2,0,3],"02"),o=p(n,0,[2,0,4],"02"),s=p(n,0,[2,0,5],"02"),u=p(n,0,[2,0,6],"02"),l=p(n,0,[2,0,7],"02"),c=p(n,0,[2,0,8],"02")}catch(d){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,e,r,o,s,u,l,c)},RSAKey.prototype.readPKCS5PubKeyHex=function(n){var t=ASN1HEX,e=t.getV;if(t.isASN1HEX(n)===!1)throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(n,0);if(r.length!==2||n.substr(r[0],2)!=="02"||n.substr(r[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var o=e(n,r[0]),s=e(n,r[1]);this.setPublic(o,s)},RSAKey.prototype.readPKCS8PubKeyHex=function(n){var t=ASN1HEX;if(t.isASN1HEX(n)===!1)throw new Error("not ASN.1 hex string");if(t.getTLVbyListEx(n,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var e=t.getTLVbyListEx(n,0,[1,0]);this.readPKCS5PubKeyHex(e)},RSAKey.prototype.readCertPubKeyHex=function(n,t){var e,r;e=new X509,e.readCertHex(n),r=e.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};function _rsasign_getAlgNameAndHashFromHexDisgestInfo(n){for(var t in KJUR.crypto.Util.DIGESTINFOHEAD){var e=KJUR.crypto.Util.DIGESTINFOHEAD[t],r=e.length;if(n.substring(0,r)==e){var o=[t,n.substring(r)];return o}}return[]}RSAKey.prototype.verify=function(n,t){if(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null)return!1;var e=parseBigInt(t,16),r=this.n.bitLength();if(e.bitLength()>r)return!1;var o=this.doPublic(e),s=o.toString(16);if(s.length+3!=r/4)return!1;var u=s.replace(/^1f+00/,""),l=_rsasign_getAlgNameAndHashFromHexDisgestInfo(u);if(l.length==0)return!1;var c=l[0],f=l[1],p=function(h){return KJUR.crypto.Util.hashString(h,c)},d=p(n);return f==d},RSAKey.prototype.verifyWithMessageHash=function(n,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var e=parseBigInt(t,16);if(e.bitLength()>this.n.bitLength())return 0;var r=this.doPublic(e),o=r.toString(16).replace(/^1f+00/,""),s=_rsasign_getAlgNameAndHashFromHexDisgestInfo(o);if(s.length==0)return!1;s[0];var u=s[1];return u==n},RSAKey.prototype.verifyPSS=function(n,t,e,r){var o=function(u){return KJUR.crypto.Util.hashHex(u,e)},s=o(rstrtohex(n));return r===void 0&&(r=-1),this.verifyWithMessageHashPSS(s,t,e,r)},RSAKey.prototype.verifyWithMessageHashPSS=function(n,t,e,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var o=new BigInteger(t,16),s=function(A){return KJUR.crypto.Util.hashHex(A,e)},u=hextorstr(n),l=u.length,c=this.n.bitLength()-1,f=Math.ceil(c/8),p;if(r===-1||r===void 0)r=l;else if(r===-2)r=f-l-2;else if(r<-2)throw new Error("invalid salt length");if(f<l+r+2)throw new Error("data too long");var d=this.doPublic(o).toByteArray();for(p=0;p<d.length;p+=1)d[p]&=255;for(;d.length<f;)d.unshift(0);if(d[f-1]!==188)throw new Error("encoded message does not end in 0xbc");d=String.fromCharCode.apply(String,d);var h=d.substr(0,f-l-1),g=d.substr(h.length,l),m=65280>>8*f-c&255;if((h.charCodeAt(0)&m)!==0)throw new Error("bits beyond keysize not zero");var E=pss_mgf1_str(g,h.length,s),y=[];for(p=0;p<h.length;p+=1)y[p]=h.charCodeAt(p)^E.charCodeAt(p);y[0]&=~m;var v=f-l-r-2;for(p=0;p<v;p+=1)if(y[p]!==0)throw new Error("leftmost octets not zero");if(y[v]!==1)throw new Error("0x01 marker not found");return g===hextorstr(s(rstrtohex("\0\0\0\0\0\0\0\0"+u+String.fromCharCode.apply(String,y.slice(-r)))))},RSAKey.SALT_LEN_HLEN=-1,RSAKey.SALT_LEN_MAX=-2,RSAKey.SALT_LEN_RECOVER=-2;function X509(n){var t=ASN1HEX,e=t.getChildIdx,r=t.getV,o=t.getTLV,s=t.getVbyList,u=t.getVbyListEx,l=t.getTLVbyList,c=t.getTLVbyListEx,f=t.getIdxbyList,p=t.getIdxbyListEx,d=t.getVidx,h=t.getInt,g=t.oidname,m=t.hextooidstr,E=pemtohex,y;try{y=KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(v){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(this.hex===null||this.version!==0)return this.version;var v=l(this.hex,0,[0,0]);if(v.substr(0,2)=="a0"){var A=l(v,0,[0]),b=h(A,0);if(b<0||2<b)throw new Error("malformed version field");return this.version=b+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var v=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(v)},this.getAlgorithmIdentifierName=function(v){for(var A in y)if(v===y[A])return A;return g(u(v,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){var v=this.getIssuer();return v.str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){var v=this.getSubject();return v.str},this.getNotBefore=function(){var v=s(this.hex,0,[0,4+this.foffset,0]);return v=v.replace(/(..)/g,"%$1"),v=decodeURIComponent(v),v},this.getNotAfter=function(){var v=s(this.hex,0,[0,4+this.foffset,1]);return v=v.replace(/(..)/g,"%$1"),v=decodeURIComponent(v),v},this.getPublicKeyHex=function(){return t.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return f(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var v=this.getPublicKeyIdx();return f(this.hex,v,[1,0],"30")},this.getPublicKey=function(){return KEYUTIL.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var v=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(v)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(v){var A=this.getSignatureAlgorithmField(),b=this.getSignatureValueHex(),T=l(this.hex,0,[0],"30"),_=new KJUR.crypto.Signature({alg:A});return _.init(v),_.updateHex(T),_.verify(b)},this.parseExt=function(v){var A,b,T;if(v===void 0){if(T=this.hex,this.version!==3)return-1;A=f(T,0,[0,7,0],"30"),b=e(T,A)}else{T=pemtohex(v);var _=f(T,0,[0,3,0,0],"06");if(r(T,_)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}A=f(T,0,[0,3,0,1,0],"30"),b=e(T,A),this.hex=T}this.aExtInfo=new Array;for(var S=0;S<b.length;S++){var w={};w.critical=!1;var R=e(T,b[S]),I=0;R.length===3&&(w.critical=!0,I=1),w.oid=t.hextooidstr(s(T,b[S],[0],"06"));var H=f(T,b[S],[1+I]);w.vidx=d(T,H),this.aExtInfo.push(w)}},this.getExtInfo=function(v){var A=this.aExtInfo,b=v;if(v.match(/^[0-9.]+$/)||(b=KJUR.asn1.x509.OID.name2oid(v)),b!==""){for(var T=0;T<A.length;T++)if(A[T].oid===b)return A[T]}},this.getExtBasicConstraints=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("basicConstraints");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"basicConstraints"};if(A&&(T.critical=!0),v==="3000")return T;if(v==="30030101ff")return T.cA=!0,T;if(v.substr(0,12)==="30060101ff02"){var _=r(v,10),S=parseInt(_,16);return T.cA=!0,T.pathLen=S,T}throw new Error("hExtV parse error: "+v)},this.getExtKeyUsage=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("keyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"keyUsage"};return A&&(T.critical=!0),T.names=this.getExtKeyUsageString(v).split(","),T},this.getExtKeyUsageBin=function(v){if(v===void 0){var A=this.getExtInfo("keyUsage");if(A===void 0)return"";v=o(this.hex,A.vidx)}if(v.length!=8&&v.length!=10)throw new Error("malformed key usage value: "+v);var b="000000000000000"+parseInt(v.substr(6),16).toString(2);return v.length==8&&(b=b.slice(-8)),v.length==10&&(b=b.slice(-16)),b=b.replace(/0+$/,""),b==""&&(b="0"),b},this.getExtKeyUsageString=function(v){for(var A=this.getExtKeyUsageBin(v),b=new Array,T=0;T<A.length;T++)A.substr(T,1)=="1"&&b.push(X509.KEYUSAGE_NAME[T]);return b.join(",")},this.getExtSubjectKeyIdentifier=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("subjectKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"subjectKeyIdentifier"};A&&(T.critical=!0);var _=r(v,0);return T.kid={hex:_},T},this.getExtAuthorityKeyIdentifier=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("authorityKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"authorityKeyIdentifier"};A&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var w=v.substr(_[S],2);if(w==="80"&&(T.kid={hex:r(v,_[S])}),w==="a1"){var R=o(v,_[S]),I=this.getGeneralNames(R);T.issuer=I[0].dn}w==="82"&&(T.sn={hex:r(v,_[S])})}return T},this.getExtExtKeyUsage=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("extKeyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"extKeyUsage",array:[]};A&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++)T.array.push(g(r(v,_[S])));return T},this.getExtExtKeyUsageName=function(){var v=this.getExtInfo("extKeyUsage");if(v===void 0)return v;var A=new Array,b=o(this.hex,v.vidx);if(b==="")return A;for(var T=e(b,0),_=0;_<T.length;_++)A.push(g(r(b,T[_])));return A},this.getExtSubjectAltName=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("subjectAltName");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"subjectAltName",array:[]};return A&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getExtIssuerAltName=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("issuerAltName");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"issuerAltName",array:[]};return A&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getGeneralNames=function(v){for(var A=e(v,0),b=[],T=0;T<A.length;T++){var _=this.getGeneralName(o(v,A[T]));_!==void 0&&b.push(_)}return b},this.getGeneralName=function(v){var A=v.substr(0,2),b=r(v,0),T=hextorstr(b);if(A=="81")return{rfc822:T};if(A=="82")return{dns:T};if(A=="86")return{uri:T};if(A=="87")return{ip:hextoip(b)};if(A=="a4")return{dn:this.getX500Name(b)}},this.getExtSubjectAltName2=function(){var v,A,b,T=this.getExtInfo("subjectAltName");if(T===void 0)return T;for(var _=new Array,S=o(this.hex,T.vidx),w=e(S,0),R=0;R<w.length;R++)b=S.substr(w[R],2),v=r(S,w[R]),b==="81"&&(A=hextoutf8(v),_.push(["MAIL",A])),b==="82"&&(A=hextoutf8(v),_.push(["DNS",A])),b==="84"&&(A=X509.hex2dn(v,0),_.push(["DN",A])),b==="86"&&(A=hextoutf8(v),_.push(["URI",A])),b==="87"&&(A=hextoip(v),_.push(["IP",A]));return _},this.getExtCRLDistributionPoints=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("cRLDistributionPoints");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"cRLDistributionPoints",array:[]};A&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var w=o(v,_[S]);T.array.push(this.getDistributionPoint(w))}return T},this.getDistributionPoint=function(v){for(var A={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(A.dpname=this.getDistributionPointName(S))}return A},this.getDistributionPointName=function(v){for(var A={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(A.full=this.getGeneralNames(S))}return A},this.getExtCRLDistributionPointsURI=function(){var v=this.getExtInfo("cRLDistributionPoints");if(v===void 0)return v;for(var A=new Array,b=e(this.hex,v.vidx),T=0;T<b.length;T++)try{var _=s(this.hex,b[T],[0,0,0],"86"),S=hextoutf8(_);A.push(S)}catch(w){}return A},this.getExtAIAInfo=function(){var v=this.getExtInfo("authorityInfoAccess");if(v===void 0)return v;for(var A={ocsp:[],caissuer:[]},b=e(this.hex,v.vidx),T=0;T<b.length;T++){var _=s(this.hex,b[T],[0],"06"),S=s(this.hex,b[T],[1],"86");_==="2b06010505073001"&&A.ocsp.push(hextoutf8(S)),_==="2b06010505073002"&&A.caissuer.push(hextoutf8(S))}return A},this.getExtAuthorityInfoAccess=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("authorityInfoAccess");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"authorityInfoAccess",array:[]};A&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var w=u(v,_[S],[0],"06"),R=s(v,_[S],[1],"86"),I=hextoutf8(R);if(w=="2b06010505073001")T.array.push({ocsp:I});else if(w=="2b06010505073002")T.array.push({caissuer:I});else throw new Error("unknown method: "+w)}return T},this.getExtCertificatePolicies=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("certificatePolicies");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"certificatePolicies",array:[]};A&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var w=o(v,_[S]),R=this.getPolicyInformation(w);T.array.push(R)}return T},this.getPolicyInformation=function(v){var A={},b=s(v,0,[0],"06");A.policyoid=g(b);var T=p(v,0,[1],"30");if(T!=-1){A.array=[];for(var _=e(v,T),S=0;S<_.length;S++){var w=o(v,_[S]),R=this.getPolicyQualifierInfo(w);A.array.push(R)}}return A},this.getPolicyQualifierInfo=function(v){var A={},b=s(v,0,[0],"06");if(b==="2b06010505070201"){var T=u(v,0,[1],"16");A.cps=hextorstr(T)}else if(b==="2b06010505070202"){var _=l(v,0,[1],"30");A.unotice=this.getUserNotice(_)}return A},this.getUserNotice=function(v){for(var A={},b=e(v,0),T=0;T<b.length;T++){var _=o(v,b[T]);_.substr(0,2)!="30"&&(A.exptext=this.getDisplayText(_))}return A},this.getDisplayText=function(v){var A={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},b={};return b.type=A[v.substr(0,2)],b.str=hextorstr(r(v,0)),b},this.getExtCRLNumber=function(v,A){var b={extname:"cRLNumber"};if(A&&(b.critical=!0),v.substr(0,2)=="02")return b.num={hex:r(v,0)},b;throw new Error("hExtV parse error: "+v)},this.getExtCRLReason=function(v,A){var b={extname:"cRLReason"};if(A&&(b.critical=!0),v.substr(0,2)=="0a")return b.code=parseInt(r(v,0),16),b;throw new Error("hExtV parse error: "+v)},this.getExtOcspNonce=function(v,A){var b={extname:"ocspNonce"};A&&(b.critical=!0);var T=r(v,0);return b.hex=T,b},this.getExtOcspNoCheck=function(v,A){var b={extname:"ocspNoCheck"};return A&&(b.critical=!0),b},this.getExtAdobeTimeStamp=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("adobeTimeStamp");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"adobeTimeStamp"};A&&(T.critical=!0);var _=e(v,0);if(_.length>1){var S=o(v,_[1]),w=this.getGeneralName(S);w.uri!=null&&(T.uri=w.uri)}if(_.length>2){var R=o(v,_[2]);R=="0101ff"&&(T.reqauth=!0),R=="010100"&&(T.reqauth=!1)}return T},this.getX500NameRule=function(v){for(var A=null,b=[],T=0;T<v.length;T++)for(var _=v[T],S=0;S<_.length;S++)b.push(_[S]);for(var T=0;T<b.length;T++){var w=b[T],R=w.ds,I=w.value,H=w.type;if(R!="prn"&&R!="utf8"&&R!="ia5")return"mixed";if(R=="ia5"){if(H!="CN")return"mixed";if(KJUR.lang.String.isMail(I))continue;return"mixed"}if(H=="C"){if(R=="prn")continue;return"mixed"}if(A==null)A=R;else if(A!==R)return"mixed"}return A==null?"prn":A},this.getX500Name=function(v){var A=this.getX500NameArray(v),b=this.dnarraytostr(A);return{array:A,str:b}},this.getX500NameArray=function(v){for(var A=[],b=e(v,0),T=0;T<b.length;T++)A.push(this.getRDN(o(v,b[T])));return A},this.getRDN=function(v){for(var A=[],b=e(v,0),T=0;T<b.length;T++)A.push(this.getAttrTypeAndValue(o(v,b[T])));return A},this.getAttrTypeAndValue=function(v){var A={type:null,value:null,ds:null},b=e(v,0),T=s(v,b[0],[],"06"),_=s(v,b[1],[]),S=KJUR.asn1.ASN1Util.oidHexToInt(T);return A.type=KJUR.asn1.x509.OID.oid2atype(S),A.ds=this.HEX2STAG[v.substr(b[1],2)],A.ds!="bmp"?A.value=hextoutf8(_):A.value=ucs2hextoutf8(_),A},this.readCertPEM=function(v){this.readCertHex(E(v))},this.readCertHex=function(v){this.hex=v,this.getVersion();try{f(this.hex,0,[0,7],"a3"),this.parseExt()}catch(A){}},this.getParam=function(){var v={};return v.version=this.getVersion(),v.serial={hex:this.getSerialNumberHex()},v.sigalg=this.getSignatureAlgorithmField(),v.issuer=this.getIssuer(),v.notbefore=this.getNotBefore(),v.notafter=this.getNotAfter(),v.subject=this.getSubject(),v.sbjpubkey=hextopem(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(v.ext=this.getExtParamArray()),v.sighex=this.getSignatureValueHex(),v},this.getExtParamArray=function(v){if(v==null){var A=p(this.hex,0,[0,"[3]"]);A!=-1&&(v=c(this.hex,0,[0,"[3]",0],"30"))}for(var b=[],T=e(v,0),_=0;_<T.length;_++){var S=o(v,T[_]),w=this.getExtParam(S);w!=null&&b.push(w)}return b},this.getExtParam=function(v){var A=e(v,0),b=A.length;if(b!=2&&b!=3)throw new Error("wrong number elements in Extension: "+b+" "+v);var T=m(s(v,0,[0],"06")),_=!1;b==3&&l(v,0,[1])=="0101ff"&&(_=!0);var S=l(v,0,[b-1,0]),w=void 0;if(T=="2.5.29.14"?w=this.getExtSubjectKeyIdentifier(S,_):T=="2.5.29.15"?w=this.getExtKeyUsage(S,_):T=="2.5.29.17"?w=this.getExtSubjectAltName(S,_):T=="2.5.29.18"?w=this.getExtIssuerAltName(S,_):T=="2.5.29.19"?w=this.getExtBasicConstraints(S,_):T=="2.5.29.31"?w=this.getExtCRLDistributionPoints(S,_):T=="2.5.29.32"?w=this.getExtCertificatePolicies(S,_):T=="2.5.29.35"?w=this.getExtAuthorityKeyIdentifier(S,_):T=="2.5.29.37"?w=this.getExtExtKeyUsage(S,_):T=="1.3.6.1.5.5.7.1.1"?w=this.getExtAuthorityInfoAccess(S,_):T=="2.5.29.20"?w=this.getExtCRLNumber(S,_):T=="2.5.29.21"?w=this.getExtCRLReason(S,_):T=="1.3.6.1.5.5.7.48.1.2"?w=this.getExtOcspNonce(S,_):T=="1.3.6.1.5.5.7.48.1.5"?w=this.getExtOcspNoCheck(S,_):T=="1.2.840.113583.1.1.9.1"&&(w=this.getExtAdobeTimeStamp(S,_)),w!=null)return w;var R={extname:T,extn:S};return _&&(R.critical=!0),R},this.findExt=function(v,A){for(var b=0;b<v.length;b++)if(v[b].extname==A)return v[b];return null},this.dnarraytostr=function(v){function A(T){return T.map(function(_){return b(_).replace(/\+/,"\\+")}).join("+")}function b(T){return T.type+"="+T.value}return"/"+v.map(function(T){return A(T).replace(/\//,"\\/")}).join("/")},this.getInfo=function(){var v=function(q){var z=JSON.stringify(q.array).replace(/[\[\]\{\}\"]/g,"");return z},A=function(q){for(var z="",V=q.array,Q=0;Q<V.length;Q++){var U=V[Q];if(z+=" policy oid: "+U.policyoid+`
363
- `,U.array!==void 0)for(var j=0;j<U.array.length;j++){var G=U.array[j];G.cps!==void 0&&(z+=" cps: "+G.cps+`
364
- `)}}return z},b=function(q){for(var z="",V=q.array,Q=0;Q<V.length;Q++){var U=V[Q];try{U.dpname.full[0].uri!==void 0&&(z+=" "+U.dpname.full[0].uri+`
362
+ `,I},parseHexOfEncryptedPKCS8:function(m){var E=ASN1HEX,y=E.getChildIdx,v=E.getV,A={},b=y(m,0);if(b.length!=2)throw"malformed format: SEQUENCE(0).items != 2: "+b.length;A.ciphertext=v(m,b[1]);var T=y(m,b[0]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0).items != 2: "+T.length;if(v(m,T[0])!="2a864886f70d01050d")throw"this only supports pkcs5PBES2";var _=y(m,T[1]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+_.length;var S=y(m,_[1]);if(S.length!=2)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+S.length;if(v(m,S[0])!="2a864886f70d0307")throw"this only supports TripleDES";A.encryptionSchemeAlg="TripleDES",A.encryptionSchemeIV=v(m,S[1]);var w=y(m,_[0]);if(w.length!=2)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+w.length;if(v(m,w[0])!="2a864886f70d01050c")throw"this only supports pkcs5PBKDF2";var R=y(m,w[1]);if(R.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+R.length;A.pbkdf2Salt=v(m,R[0]);var I=v(m,R[1]);try{A.pbkdf2Iter=parseInt(I,16)}catch(H){throw"malformed format pbkdf2Iter: "+I}return A},getPBKDF2KeyHexFromParam:function(m,E){var y=CryptoJS.enc.Hex.parse(m.pbkdf2Salt),v=m.pbkdf2Iter,A=CryptoJS.PBKDF2(E,y,{keySize:192/32,iterations:v}),b=CryptoJS.enc.Hex.stringify(A);return b},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(m,E){var y=pemtohex(m,"ENCRYPTED PRIVATE KEY"),v=this.parseHexOfEncryptedPKCS8(y),A=KEYUTIL.getPBKDF2KeyHexFromParam(v,E),b={};b.ciphertext=CryptoJS.enc.Hex.parse(v.ciphertext);var T=CryptoJS.enc.Hex.parse(A),_=CryptoJS.enc.Hex.parse(v.encryptionSchemeIV),S=CryptoJS.TripleDES.decrypt(b,T,{iv:_}),w=CryptoJS.enc.Hex.stringify(S);return w},getKeyFromEncryptedPKCS8PEM:function(m,E){var y=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(m,E),v=this.getKeyFromPlainPrivatePKCS8Hex(y);return v},parsePlainPrivatePKCS8Hex:function(m){var E=ASN1HEX,y=E.getChildIdx,v=E.getV,A={};if(A.algparam=null,m.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var b=y(m,0);if(b.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(m.substr(b[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var T=y(m,b[1]);if(T.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(m.substr(T[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(A.algoid=v(m,T[0]),m.substr(T[1],2)=="06"&&(A.algparam=v(m,T[1])),m.substr(b[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return A.keyidx=E.getVidx(m,b[2]),A},getKeyFromPlainPrivatePKCS8PEM:function(m){var E=pemtohex(m,"PRIVATE KEY"),y=this.getKeyFromPlainPrivatePKCS8Hex(E);return y},getKeyFromPlainPrivatePKCS8Hex:function(m){var E=this.parsePlainPrivatePKCS8Hex(m),y;if(E.algoid=="2a864886f70d010101")y=new RSAKey;else if(KJUR.crypto.DSA&&E.algoid=="2a8648ce380401")y=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&E.algoid=="2a8648ce3d0201")y=new KJUR.crypto.ECDSA;else throw"unsupported private key algorithm";return y.readPKCS8PrvKeyHex(m),y},_getKeyFromPublicPKCS8Hex:function(m){var E,y=ASN1HEX.getVbyList(m,0,[0,0],"06");if(y==="2a864886f70d010101")E=new RSAKey;else if(KJUR.crypto.DSA&&y==="2a8648ce380401")E=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&y==="2a8648ce3d0201")E=new KJUR.crypto.ECDSA;else throw"unsupported PKCS#8 public key hex";return E.readPKCS8PubKeyHex(m),E},parsePublicRawRSAKeyHex:function(m){var E=ASN1HEX,y=E.getChildIdx,v=E.getV,A={};if(m.substr(0,2)!="30")throw"malformed RSA key(code:001)";var b=y(m,0);if(b.length!=2)throw"malformed RSA key(code:002)";if(m.substr(b[0],2)!="02")throw"malformed RSA key(code:003)";if(A.n=v(m,b[0]),m.substr(b[1],2)!="02")throw"malformed RSA key(code:004)";return A.e=v(m,b[1]),A},parsePublicPKCS8Hex:function(m){var E=ASN1HEX,y=E.getChildIdx,v=E.getV,A={};A.algparam=null;var b=y(m,0);if(b.length!=2)throw"outer DERSequence shall have 2 elements: "+b.length;var T=b[0];if(m.substr(T,2)!="30")throw"malformed PKCS8 public key(code:001)";var _=y(m,T);if(_.length!=2)throw"malformed PKCS8 public key(code:002)";if(m.substr(_[0],2)!="06")throw"malformed PKCS8 public key(code:003)";if(A.algoid=v(m,_[0]),m.substr(_[1],2)=="06"?A.algparam=v(m,_[1]):m.substr(_[1],2)=="30"&&(A.algparam={},A.algparam.p=E.getVbyList(m,_[1],[0],"02"),A.algparam.q=E.getVbyList(m,_[1],[1],"02"),A.algparam.g=E.getVbyList(m,_[1],[2],"02")),m.substr(b[1],2)!="03")throw"malformed PKCS8 public key(code:004)";return A.key=v(m,b[1]).substr(2),A}}})();KEYUTIL.getKey=function(n,t,e){var r=ASN1HEX,o=r.getChildIdx;r.getV;var s=r.getVbyList,u=KJUR.crypto,l=u.ECDSA,c=u.DSA,f=RSAKey,p=pemtohex,d=KEYUTIL;if(typeof f!="undefined"&&n instanceof f||typeof l!="undefined"&&n instanceof l||typeof c!="undefined"&&n instanceof c)return n;if(n.curve!==void 0&&n.xy!==void 0&&n.d===void 0)return new l({pub:n.xy,curve:n.curve});if(n.curve!==void 0&&n.d!==void 0)return new l({prv:n.d,curve:n.curve});if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d===void 0){var h=new f;return h.setPublic(n.n,n.e),h}if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p!==void 0&&n.q!==void 0&&n.dp!==void 0&&n.dq!==void 0&&n.co!==void 0&&n.qi===void 0){var h=new f;return h.setPrivateEx(n.n,n.e,n.d,n.p,n.q,n.dp,n.dq,n.co),h}if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p===void 0){var h=new f;return h.setPrivate(n.n,n.e,n.d),h}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x===void 0){var h=new c;return h.setPublic(n.p,n.q,n.g,n.y),h}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x!==void 0){var h=new c;return h.setPrivate(n.p,n.q,n.g,n.y,n.x),h}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d===void 0){var h=new f;return h.setPublic(b64utohex(n.n),b64utohex(n.e)),h}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p!==void 0&&n.q!==void 0&&n.dp!==void 0&&n.dq!==void 0&&n.qi!==void 0){var h=new f;return h.setPrivateEx(b64utohex(n.n),b64utohex(n.e),b64utohex(n.d),b64utohex(n.p),b64utohex(n.q),b64utohex(n.dp),b64utohex(n.dq),b64utohex(n.qi)),h}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0){var h=new f;return h.setPrivate(b64utohex(n.n),b64utohex(n.e),b64utohex(n.d)),h}if(n.kty==="EC"&&n.crv!==void 0&&n.x!==void 0&&n.y!==void 0&&n.d===void 0){var g=new l({curve:n.crv}),m=g.ecparams.keylen/4,E=("0000000000"+b64utohex(n.x)).slice(-m),y=("0000000000"+b64utohex(n.y)).slice(-m),v="04"+E+y;return g.setPublicKeyHex(v),g}if(n.kty==="EC"&&n.crv!==void 0&&n.x!==void 0&&n.y!==void 0&&n.d!==void 0){var g=new l({curve:n.crv}),m=g.ecparams.keylen/4,E=("0000000000"+b64utohex(n.x)).slice(-m),y=("0000000000"+b64utohex(n.y)).slice(-m),v="04"+E+y,A=("0000000000"+b64utohex(n.d)).slice(-m);return g.setPublicKeyHex(v),g.setPrivateKeyHex(A),g}if(e==="pkcs5prv"){var b=n,r=ASN1HEX,T,h;if(T=o(b,0),T.length===9)h=new f,h.readPKCS5PrvKeyHex(b);else if(T.length===6)h=new c,h.readPKCS5PrvKeyHex(b);else if(T.length>2&&b.substr(T[1],2)==="04")h=new l,h.readPKCS5PrvKeyHex(b);else throw"unsupported PKCS#1/5 hexadecimal key";return h}if(e==="pkcs8prv"){var h=d.getKeyFromPlainPrivatePKCS8Hex(n);return h}if(e==="pkcs8pub")return d._getKeyFromPublicPKCS8Hex(n);if(e==="x509pub")return X509.getPublicKeyFromCertHex(n);if(n.indexOf("-END CERTIFICATE-",0)!=-1||n.indexOf("-END X509 CERTIFICATE-",0)!=-1||n.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return X509.getPublicKeyFromCertPEM(n);if(n.indexOf("-END PUBLIC KEY-")!=-1){var _=pemtohex(n,"PUBLIC KEY");return d._getKeyFromPublicPKCS8Hex(_)}if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var S=p(n,"RSA PRIVATE KEY");return d.getKey(S,null,"pkcs5prv")}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var w=p(n,"DSA PRIVATE KEY"),R=s(w,0,[1],"02"),I=s(w,0,[2],"02"),H=s(w,0,[3],"02"),C=s(w,0,[4],"02"),M=s(w,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(R,16),new BigInteger(I,16),new BigInteger(H,16),new BigInteger(C,16),new BigInteger(M,16)),h}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var S=p(n,"EC PRIVATE KEY");return d.getKey(S,null,"pkcs5prv")}if(n.indexOf("-END PRIVATE KEY-")!=-1)return d.getKeyFromPlainPrivatePKCS8PEM(n);if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var B=d.getDecryptedKeyHex(n,t),L=new RSAKey;return L.readPKCS5PrvKeyHex(B),L}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var w=d.getDecryptedKeyHex(n,t),h=s(w,0,[1],"04"),O=s(w,0,[2,0],"06"),k=s(w,0,[3,0],"03").substr(2),D="";if(KJUR.crypto.OID.oidhex2name[O]!==void 0)D=KJUR.crypto.OID.oidhex2name[O];else throw"undefined OID(hex) in KJUR.crypto.OID: "+O;var g=new l({curve:D});return g.setPublicKeyHex(k),g.setPrivateKeyHex(h),g.isPublic=!1,g}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var w=d.getDecryptedKeyHex(n,t),R=s(w,0,[1],"02"),I=s(w,0,[2],"02"),H=s(w,0,[3],"02"),C=s(w,0,[4],"02"),M=s(w,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(R,16),new BigInteger(I,16),new BigInteger(H,16),new BigInteger(C,16),new BigInteger(M,16)),h}if(n.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return d.getKeyFromEncryptedPKCS8PEM(n,t);throw new Error("not supported argument")},(typeof KJUR.asn1=="undefined"||!KJUR.asn1)&&(KJUR.asn1={}),KJUR.asn1.ASN1Util={},KJUR.asn1.ASN1Util.oidHexToInt=function(n){for(var o="",t=parseInt(n.substr(0,2),16),e=Math.floor(t/40),r=t%40,o=e+"."+r,s="",u=2;u<n.length;u+=2){var l=parseInt(n.substr(u,2),16),c=("00000000"+l.toString(2)).slice(-8);if(s=s+c.substr(1,7),c.substr(0,1)=="0"){var f=new BigInteger(s,2);o=o+"."+f.toString(10),s=""}}return o};var ASN1HEX=new function(){};ASN1HEX.getLblen=function(n,t){if(n.substr(t+2,1)!="8")return 1;var e=parseInt(n.substr(t+3,1));return e==0?-1:0<e&&e<10?e+1:-2},ASN1HEX.getL=function(n,t){var e=ASN1HEX.getLblen(n,t);return e<1?"":n.substr(t+2,e*2)},ASN1HEX.getVblen=function(n,t){var e,r;return e=ASN1HEX.getL(n,t),e==""?-1:(e.substr(0,1)==="8"?r=new BigInteger(e.substr(2),16):r=new BigInteger(e,16),r.intValue())},ASN1HEX.getVidx=function(n,t){var e=ASN1HEX.getLblen(n,t);return e<0?e:t+(e+1)*2},ASN1HEX.getV=function(n,t){var e=ASN1HEX.getVidx(n,t),r=ASN1HEX.getVblen(n,t);return n.substr(e,r*2)},ASN1HEX.getTLV=function(n,t){return n.substr(t,2)+ASN1HEX.getL(n,t)+ASN1HEX.getV(n,t)},ASN1HEX.getTLVblen=function(n,t){return 2+ASN1HEX.getLblen(n,t)*2+ASN1HEX.getVblen(n,t)*2},ASN1HEX.getNextSiblingIdx=function(n,t){var e=ASN1HEX.getVidx(n,t),r=ASN1HEX.getVblen(n,t);return e+r*2},ASN1HEX.getChildIdx=function(n,t){var e=ASN1HEX,r=[],o,s,u;o=e.getVidx(n,t),s=e.getVblen(n,t)*2,n.substr(t,2)=="03"&&(o+=2,s-=2),u=0;for(var l=o;u<=s;){var c=e.getTLVblen(n,l);if(u+=c,u<=s&&r.push(l),l+=c,u>=s)break}return r},ASN1HEX.getNthChildIdx=function(n,t,e){var r=ASN1HEX.getChildIdx(n,t);return r[e]},ASN1HEX.getIdxbyList=function(n,t,e,r){var o=ASN1HEX,s,u;return e.length==0?r!==void 0&&n.substr(t,2)!==r?-1:t:(s=e.shift(),u=o.getChildIdx(n,t),s>=u.length?-1:o.getIdxbyList(n,u[s],e,r))},ASN1HEX.getIdxbyListEx=function(n,t,e,r){var o=ASN1HEX,s,u;if(e.length==0)return r!==void 0&&n.substr(t,2)!==r?-1:t;s=e.shift(),u=o.getChildIdx(n,t);for(var l=0,c=0;c<u.length;c++){var f=n.substr(u[c],2);if(typeof s=="number"&&!o.isContextTag(f)&&l==s||typeof s=="string"&&o.isContextTag(f,s))return o.getIdxbyListEx(n,u[c],e,r);o.isContextTag(f)||l++}return-1},ASN1HEX.getTLVbyList=function(n,t,e,r){var o=ASN1HEX,s=o.getIdxbyList(n,t,e,r);return s==-1||s>=n.length?null:o.getTLV(n,s)},ASN1HEX.getTLVbyListEx=function(n,t,e,r){var o=ASN1HEX,s=o.getIdxbyListEx(n,t,e,r);return s==-1?null:o.getTLV(n,s)},ASN1HEX.getVbyList=function(n,t,e,r,o){var s=ASN1HEX,u,l;return u=s.getIdxbyList(n,t,e,r),u==-1||u>=n.length?null:(l=s.getV(n,u),o===!0&&(l=l.substr(2)),l)},ASN1HEX.getVbyListEx=function(n,t,e,r,o){var s=ASN1HEX,u,l;return u=s.getIdxbyListEx(n,t,e,r),u==-1?null:(l=s.getV(n,u),n.substr(u,2)=="03"&&o!==!1&&(l=l.substr(2)),l)},ASN1HEX.getInt=function(n,t,e){e==null&&(e=-1);try{var r=n.substr(t,2);if(r!="02"&&r!="03")return e;var o=ASN1HEX.getV(n,t);return r=="02"?parseInt(o,16):bitstrtoint(o)}catch(s){return e}},ASN1HEX.getOID=function(n,t,e){e==null&&(e=null);try{if(n.substr(t,2)!="06")return e;var r=ASN1HEX.getV(n,t);return hextooid(r)}catch(o){return e}},ASN1HEX.getOIDName=function(n,t,e){e==null&&(e=null);try{var r=ASN1HEX.getOID(n,t,e);if(r==e)return e;var o=KJUR.asn1.x509.OID.oid2name(r);return o==""?r:o}catch(s){return e}},ASN1HEX.getString=function(n,t,e){e==null&&(e=null);try{var r=ASN1HEX.getV(n,t);return hextorstr(r)}catch(o){return e}},ASN1HEX.hextooidstr=function(n){var t=function(d,h){return d.length>=h?d:new Array(h-d.length+1).join("0")+d},e=[],r=n.substr(0,2),o=parseInt(r,16);e[0]=new String(Math.floor(o/40)),e[1]=new String(o%40);for(var s=n.substr(2),u=[],l=0;l<s.length/2;l++)u.push(parseInt(s.substr(l*2,2),16));for(var c=[],f="",l=0;l<u.length;l++)u[l]&128?f=f+t((u[l]&127).toString(2),7):(f=f+t((u[l]&127).toString(2),7),c.push(new String(parseInt(f,2))),f="");var p=e.join(".");return c.length>0&&(p=p+"."+c.join(".")),p},ASN1HEX.isContextTag=function(n,t){n=n.toLowerCase();var e,r;try{e=parseInt(n,16)}catch(s){return-1}if(t===void 0)return(e&192)==128;try{var o=t.match(/^\[[0-9]+\]$/);return o==null||(r=parseInt(t.substr(1,t.length-1),10),r>31)?!1:(e&192)==128&&(e&31)==r}catch(s){return!1}},ASN1HEX.isASN1HEX=function(n){var t=ASN1HEX;if(n.length%2==1)return!1;var e=t.getVblen(n,0),r=n.substr(0,2),o=t.getL(n,0),s=n.length-r.length-o.length;return s==e*2},ASN1HEX.checkStrictDER=function(n,t,e,r,o){var s=ASN1HEX;if(e===void 0){if(typeof n!="string")throw new Error("not hex string");if(n=n.toLowerCase(),!KJUR.lang.String.isHex(n))throw new Error("not hex string");e=n.length,r=n.length/2,r<128?o=1:o=Math.ceil(r.toString(16))+1}var u=s.getL(n,t);if(u.length>o*2)throw new Error("L of TLV too long: idx="+t);var l=s.getVblen(n,t);if(l>r)throw new Error("value of L too long than hex: idx="+t);var c=s.getTLV(n,t),f=c.length-2-s.getL(n,t).length;if(f!==l*2)throw new Error("V string length and L's value not the same:"+f+"/"+l*2);if(t===0&&n.length!=c.length)throw new Error("total length and TLV length unmatch:"+n.length+"!="+c.length);var p=n.substr(t,2);if(p==="02"){var d=s.getVidx(n,t);if(n.substr(d,2)=="00"&&n.charCodeAt(d+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(p,16)&32){for(var h=s.getVblen(n,t),g=0,m=s.getChildIdx(n,t),E=0;E<m.length;E++){var y=s.getTLV(n,m[E]);g+=y.length,s.checkStrictDER(n,m[E],e,r,o)}if(h*2!=g)throw new Error("sum of children's TLV length and L unmatch: "+h*2+"!="+g)}},ASN1HEX.oidname=function(n){var t=KJUR.asn1;KJUR.lang.String.isHex(n)&&(n=t.ASN1Util.oidHexToInt(n));var e=t.x509.OID.oid2name(n);return e===""&&(e=n),e},(typeof KJUR.asn1=="undefined"||!KJUR.asn1)&&(KJUR.asn1={}),(typeof KJUR.asn1.x509=="undefined"||!KJUR.asn1.x509)&&(KJUR.asn1.x509={}),KJUR.asn1.x509.AlgorithmIdentifier={},KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},KJUR.asn1.x509.OID=new function(n){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(t){if(typeof this.objCache[t]!="undefined")return this.objCache[t];if(typeof this.name2oidList[t]=="undefined")throw"Name of ObjectIdentifier not defined: "+t;var e=this.name2oidList[t],r=new KJUR.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r},this.atype2obj=function(t){if(this.objCache[t]!==void 0)return this.objCache[t];var e;if(t.match(/^\d+\.\d+\.[0-9.]+$/))e=t;else if(this.atype2oidList[t]!==void 0)e=this.atype2oidList[t];else if(this.name2oidList[t]!==void 0)e=this.name2oidList[t];else throw"AttributeType name undefined: "+t;var r=new KJUR.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r}},KJUR.asn1.x509.OID.oid2name=function(n){var t=KJUR.asn1.x509.OID.name2oidList;for(var e in t)if(t[e]==n)return e;return""},KJUR.asn1.x509.OID.oid2atype=function(n){var t=KJUR.asn1.x509.OID.atype2oidList;for(var e in t)if(t[e]==n)return e;return n},KJUR.asn1.x509.OID.name2oid=function(n){if(n.match(/^[0-9.]+$/))return n;var t=KJUR.asn1.x509.OID.name2oidList;return t[n]===void 0?"":t[n]},RSAKey.getPosArrayOfChildrenFromHex=function(n){return ASN1HEX.getChildIdx(n,0)},RSAKey.getHexValueArrayOfChildrenFromHex=function(n){var t=ASN1HEX,e=t.getV,h=RSAKey.getPosArrayOfChildrenFromHex(n),r=e(n,h[0]),o=e(n,h[1]),s=e(n,h[2]),u=e(n,h[3]),l=e(n,h[4]),c=e(n,h[5]),f=e(n,h[6]),p=e(n,h[7]),d=e(n,h[8]),h=new Array;return h.push(r,o,s,u,l,c,f,p,d),h},RSAKey.prototype.readPrivateKeyFromPEMString=function(n){var t=pemtohex(n),e=RSAKey.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},RSAKey.prototype.readPKCS5PrvKeyHex=function(n){var t=RSAKey.getHexValueArrayOfChildrenFromHex(n);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},RSAKey.prototype.readPKCS8PrvKeyHex=function(n){var t,e,r,o,s,u,l,c,f=ASN1HEX,p=f.getVbyListEx;if(f.isASN1HEX(n)===!1)throw new Error("not ASN.1 hex string");try{t=p(n,0,[2,0,1],"02"),e=p(n,0,[2,0,2],"02"),r=p(n,0,[2,0,3],"02"),o=p(n,0,[2,0,4],"02"),s=p(n,0,[2,0,5],"02"),u=p(n,0,[2,0,6],"02"),l=p(n,0,[2,0,7],"02"),c=p(n,0,[2,0,8],"02")}catch(d){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,e,r,o,s,u,l,c)},RSAKey.prototype.readPKCS5PubKeyHex=function(n){var t=ASN1HEX,e=t.getV;if(t.isASN1HEX(n)===!1)throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(n,0);if(r.length!==2||n.substr(r[0],2)!=="02"||n.substr(r[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var o=e(n,r[0]),s=e(n,r[1]);this.setPublic(o,s)},RSAKey.prototype.readPKCS8PubKeyHex=function(n){var t=ASN1HEX;if(t.isASN1HEX(n)===!1)throw new Error("not ASN.1 hex string");if(t.getTLVbyListEx(n,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var e=t.getTLVbyListEx(n,0,[1,0]);this.readPKCS5PubKeyHex(e)},RSAKey.prototype.readCertPubKeyHex=function(n,t){var e,r;e=new X509,e.readCertHex(n),r=e.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};function _rsasign_getAlgNameAndHashFromHexDisgestInfo(n){for(var t in KJUR.crypto.Util.DIGESTINFOHEAD){var e=KJUR.crypto.Util.DIGESTINFOHEAD[t],r=e.length;if(n.substring(0,r)==e){var o=[t,n.substring(r)];return o}}return[]}RSAKey.prototype.verify=function(n,t){if(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null)return!1;var e=parseBigInt(t,16),r=this.n.bitLength();if(e.bitLength()>r)return!1;var o=this.doPublic(e),s=o.toString(16);if(s.length+3!=r/4)return!1;var u=s.replace(/^1f+00/,""),l=_rsasign_getAlgNameAndHashFromHexDisgestInfo(u);if(l.length==0)return!1;var c=l[0],f=l[1],p=function(h){return KJUR.crypto.Util.hashString(h,c)},d=p(n);return f==d},RSAKey.prototype.verifyWithMessageHash=function(n,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var e=parseBigInt(t,16);if(e.bitLength()>this.n.bitLength())return 0;var r=this.doPublic(e),o=r.toString(16).replace(/^1f+00/,""),s=_rsasign_getAlgNameAndHashFromHexDisgestInfo(o);if(s.length==0)return!1;s[0];var u=s[1];return u==n},RSAKey.prototype.verifyPSS=function(n,t,e,r){var o=function(u){return KJUR.crypto.Util.hashHex(u,e)},s=o(rstrtohex(n));return r===void 0&&(r=-1),this.verifyWithMessageHashPSS(s,t,e,r)},RSAKey.prototype.verifyWithMessageHashPSS=function(n,t,e,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var o=new BigInteger(t,16),s=function(A){return KJUR.crypto.Util.hashHex(A,e)},u=hextorstr(n),l=u.length,c=this.n.bitLength()-1,f=Math.ceil(c/8),p;if(r===-1||r===void 0)r=l;else if(r===-2)r=f-l-2;else if(r<-2)throw new Error("invalid salt length");if(f<l+r+2)throw new Error("data too long");var d=this.doPublic(o).toByteArray();for(p=0;p<d.length;p+=1)d[p]&=255;for(;d.length<f;)d.unshift(0);if(d[f-1]!==188)throw new Error("encoded message does not end in 0xbc");d=String.fromCharCode.apply(String,d);var h=d.substr(0,f-l-1),g=d.substr(h.length,l),m=65280>>8*f-c&255;if((h.charCodeAt(0)&m)!==0)throw new Error("bits beyond keysize not zero");var E=pss_mgf1_str(g,h.length,s),y=[];for(p=0;p<h.length;p+=1)y[p]=h.charCodeAt(p)^E.charCodeAt(p);y[0]&=~m;var v=f-l-r-2;for(p=0;p<v;p+=1)if(y[p]!==0)throw new Error("leftmost octets not zero");if(y[v]!==1)throw new Error("0x01 marker not found");return g===hextorstr(s(rstrtohex("\0\0\0\0\0\0\0\0"+u+String.fromCharCode.apply(String,y.slice(-r)))))},RSAKey.SALT_LEN_HLEN=-1,RSAKey.SALT_LEN_MAX=-2,RSAKey.SALT_LEN_RECOVER=-2;function X509(n){var t=ASN1HEX,e=t.getChildIdx,r=t.getV,o=t.getTLV,s=t.getVbyList,u=t.getVbyListEx,l=t.getTLVbyList,c=t.getTLVbyListEx,f=t.getIdxbyList,p=t.getIdxbyListEx,d=t.getVidx,h=t.getInt,g=t.oidname,m=t.hextooidstr,E=pemtohex,y;try{y=KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(v){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(this.hex===null||this.version!==0)return this.version;var v=l(this.hex,0,[0,0]);if(v.substr(0,2)=="a0"){var A=l(v,0,[0]),b=h(A,0);if(b<0||2<b)throw new Error("malformed version field");return this.version=b+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var v=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(v)},this.getAlgorithmIdentifierName=function(v){for(var A in y)if(v===y[A])return A;return g(u(v,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){var v=this.getIssuer();return v.str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){var v=this.getSubject();return v.str},this.getNotBefore=function(){var v=s(this.hex,0,[0,4+this.foffset,0]);return v=v.replace(/(..)/g,"%$1"),v=decodeURIComponent(v),v},this.getNotAfter=function(){var v=s(this.hex,0,[0,4+this.foffset,1]);return v=v.replace(/(..)/g,"%$1"),v=decodeURIComponent(v),v},this.getPublicKeyHex=function(){return t.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return f(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var v=this.getPublicKeyIdx();return f(this.hex,v,[1,0],"30")},this.getPublicKey=function(){return KEYUTIL.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var v=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(v)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(v){var A=this.getSignatureAlgorithmField(),b=this.getSignatureValueHex(),T=l(this.hex,0,[0],"30"),_=new KJUR.crypto.Signature({alg:A});return _.init(v),_.updateHex(T),_.verify(b)},this.parseExt=function(v){var A,b,T;if(v===void 0){if(T=this.hex,this.version!==3)return-1;A=f(T,0,[0,7,0],"30"),b=e(T,A)}else{T=pemtohex(v);var _=f(T,0,[0,3,0,0],"06");if(r(T,_)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}A=f(T,0,[0,3,0,1,0],"30"),b=e(T,A),this.hex=T}this.aExtInfo=new Array;for(var S=0;S<b.length;S++){var w={};w.critical=!1;var R=e(T,b[S]),I=0;R.length===3&&(w.critical=!0,I=1),w.oid=t.hextooidstr(s(T,b[S],[0],"06"));var H=f(T,b[S],[1+I]);w.vidx=d(T,H),this.aExtInfo.push(w)}},this.getExtInfo=function(v){var A=this.aExtInfo,b=v;if(v.match(/^[0-9.]+$/)||(b=KJUR.asn1.x509.OID.name2oid(v)),b!==""){for(var T=0;T<A.length;T++)if(A[T].oid===b)return A[T]}},this.getExtBasicConstraints=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("basicConstraints");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"basicConstraints"};if(A&&(T.critical=!0),v==="3000")return T;if(v==="30030101ff")return T.cA=!0,T;if(v.substr(0,12)==="30060101ff02"){var _=r(v,10),S=parseInt(_,16);return T.cA=!0,T.pathLen=S,T}throw new Error("hExtV parse error: "+v)},this.getExtKeyUsage=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("keyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"keyUsage"};return A&&(T.critical=!0),T.names=this.getExtKeyUsageString(v).split(","),T},this.getExtKeyUsageBin=function(v){if(v===void 0){var A=this.getExtInfo("keyUsage");if(A===void 0)return"";v=o(this.hex,A.vidx)}if(v.length!=8&&v.length!=10)throw new Error("malformed key usage value: "+v);var b="000000000000000"+parseInt(v.substr(6),16).toString(2);return v.length==8&&(b=b.slice(-8)),v.length==10&&(b=b.slice(-16)),b=b.replace(/0+$/,""),b==""&&(b="0"),b},this.getExtKeyUsageString=function(v){for(var A=this.getExtKeyUsageBin(v),b=new Array,T=0;T<A.length;T++)A.substr(T,1)=="1"&&b.push(X509.KEYUSAGE_NAME[T]);return b.join(",")},this.getExtSubjectKeyIdentifier=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("subjectKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"subjectKeyIdentifier"};A&&(T.critical=!0);var _=r(v,0);return T.kid={hex:_},T},this.getExtAuthorityKeyIdentifier=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("authorityKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"authorityKeyIdentifier"};A&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var w=v.substr(_[S],2);if(w==="80"&&(T.kid={hex:r(v,_[S])}),w==="a1"){var R=o(v,_[S]),I=this.getGeneralNames(R);T.issuer=I[0].dn}w==="82"&&(T.sn={hex:r(v,_[S])})}return T},this.getExtExtKeyUsage=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("extKeyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"extKeyUsage",array:[]};A&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++)T.array.push(g(r(v,_[S])));return T},this.getExtExtKeyUsageName=function(){var v=this.getExtInfo("extKeyUsage");if(v===void 0)return v;var A=new Array,b=o(this.hex,v.vidx);if(b==="")return A;for(var T=e(b,0),_=0;_<T.length;_++)A.push(g(r(b,T[_])));return A},this.getExtSubjectAltName=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("subjectAltName");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"subjectAltName",array:[]};return A&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getExtIssuerAltName=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("issuerAltName");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"issuerAltName",array:[]};return A&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getGeneralNames=function(v){for(var A=e(v,0),b=[],T=0;T<A.length;T++){var _=this.getGeneralName(o(v,A[T]));_!==void 0&&b.push(_)}return b},this.getGeneralName=function(v){var A=v.substr(0,2),b=r(v,0),T=hextorstr(b);if(A=="81")return{rfc822:T};if(A=="82")return{dns:T};if(A=="86")return{uri:T};if(A=="87")return{ip:hextoip(b)};if(A=="a4")return{dn:this.getX500Name(b)}},this.getExtSubjectAltName2=function(){var v,A,b,T=this.getExtInfo("subjectAltName");if(T===void 0)return T;for(var _=new Array,S=o(this.hex,T.vidx),w=e(S,0),R=0;R<w.length;R++)b=S.substr(w[R],2),v=r(S,w[R]),b==="81"&&(A=hextoutf8(v),_.push(["MAIL",A])),b==="82"&&(A=hextoutf8(v),_.push(["DNS",A])),b==="84"&&(A=X509.hex2dn(v,0),_.push(["DN",A])),b==="86"&&(A=hextoutf8(v),_.push(["URI",A])),b==="87"&&(A=hextoip(v),_.push(["IP",A]));return _},this.getExtCRLDistributionPoints=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("cRLDistributionPoints");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"cRLDistributionPoints",array:[]};A&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var w=o(v,_[S]);T.array.push(this.getDistributionPoint(w))}return T},this.getDistributionPoint=function(v){for(var A={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(A.dpname=this.getDistributionPointName(S))}return A},this.getDistributionPointName=function(v){for(var A={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(A.full=this.getGeneralNames(S))}return A},this.getExtCRLDistributionPointsURI=function(){var v=this.getExtInfo("cRLDistributionPoints");if(v===void 0)return v;for(var A=new Array,b=e(this.hex,v.vidx),T=0;T<b.length;T++)try{var _=s(this.hex,b[T],[0,0,0],"86"),S=hextoutf8(_);A.push(S)}catch(w){}return A},this.getExtAIAInfo=function(){var v=this.getExtInfo("authorityInfoAccess");if(v===void 0)return v;for(var A={ocsp:[],caissuer:[]},b=e(this.hex,v.vidx),T=0;T<b.length;T++){var _=s(this.hex,b[T],[0],"06"),S=s(this.hex,b[T],[1],"86");_==="2b06010505073001"&&A.ocsp.push(hextoutf8(S)),_==="2b06010505073002"&&A.caissuer.push(hextoutf8(S))}return A},this.getExtAuthorityInfoAccess=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("authorityInfoAccess");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"authorityInfoAccess",array:[]};A&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var w=u(v,_[S],[0],"06"),R=s(v,_[S],[1],"86"),I=hextoutf8(R);if(w=="2b06010505073001")T.array.push({ocsp:I});else if(w=="2b06010505073002")T.array.push({caissuer:I});else throw new Error("unknown method: "+w)}return T},this.getExtCertificatePolicies=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("certificatePolicies");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"certificatePolicies",array:[]};A&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var w=o(v,_[S]),R=this.getPolicyInformation(w);T.array.push(R)}return T},this.getPolicyInformation=function(v){var A={},b=s(v,0,[0],"06");A.policyoid=g(b);var T=p(v,0,[1],"30");if(T!=-1){A.array=[];for(var _=e(v,T),S=0;S<_.length;S++){var w=o(v,_[S]),R=this.getPolicyQualifierInfo(w);A.array.push(R)}}return A},this.getPolicyQualifierInfo=function(v){var A={},b=s(v,0,[0],"06");if(b==="2b06010505070201"){var T=u(v,0,[1],"16");A.cps=hextorstr(T)}else if(b==="2b06010505070202"){var _=l(v,0,[1],"30");A.unotice=this.getUserNotice(_)}return A},this.getUserNotice=function(v){for(var A={},b=e(v,0),T=0;T<b.length;T++){var _=o(v,b[T]);_.substr(0,2)!="30"&&(A.exptext=this.getDisplayText(_))}return A},this.getDisplayText=function(v){var A={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},b={};return b.type=A[v.substr(0,2)],b.str=hextorstr(r(v,0)),b},this.getExtCRLNumber=function(v,A){var b={extname:"cRLNumber"};if(A&&(b.critical=!0),v.substr(0,2)=="02")return b.num={hex:r(v,0)},b;throw new Error("hExtV parse error: "+v)},this.getExtCRLReason=function(v,A){var b={extname:"cRLReason"};if(A&&(b.critical=!0),v.substr(0,2)=="0a")return b.code=parseInt(r(v,0),16),b;throw new Error("hExtV parse error: "+v)},this.getExtOcspNonce=function(v,A){var b={extname:"ocspNonce"};A&&(b.critical=!0);var T=r(v,0);return b.hex=T,b},this.getExtOcspNoCheck=function(v,A){var b={extname:"ocspNoCheck"};return A&&(b.critical=!0),b},this.getExtAdobeTimeStamp=function(v,A){if(v===void 0&&A===void 0){var b=this.getExtInfo("adobeTimeStamp");if(b===void 0)return;v=o(this.hex,b.vidx),A=b.critical}var T={extname:"adobeTimeStamp"};A&&(T.critical=!0);var _=e(v,0);if(_.length>1){var S=o(v,_[1]),w=this.getGeneralName(S);w.uri!=null&&(T.uri=w.uri)}if(_.length>2){var R=o(v,_[2]);R=="0101ff"&&(T.reqauth=!0),R=="010100"&&(T.reqauth=!1)}return T},this.getX500NameRule=function(v){for(var A=null,b=[],T=0;T<v.length;T++)for(var _=v[T],S=0;S<_.length;S++)b.push(_[S]);for(var T=0;T<b.length;T++){var w=b[T],R=w.ds,I=w.value,H=w.type;if(R!="prn"&&R!="utf8"&&R!="ia5")return"mixed";if(R=="ia5"){if(H!="CN")return"mixed";if(KJUR.lang.String.isMail(I))continue;return"mixed"}if(H=="C"){if(R=="prn")continue;return"mixed"}if(A==null)A=R;else if(A!==R)return"mixed"}return A==null?"prn":A},this.getX500Name=function(v){var A=this.getX500NameArray(v),b=this.dnarraytostr(A);return{array:A,str:b}},this.getX500NameArray=function(v){for(var A=[],b=e(v,0),T=0;T<b.length;T++)A.push(this.getRDN(o(v,b[T])));return A},this.getRDN=function(v){for(var A=[],b=e(v,0),T=0;T<b.length;T++)A.push(this.getAttrTypeAndValue(o(v,b[T])));return A},this.getAttrTypeAndValue=function(v){var A={type:null,value:null,ds:null},b=e(v,0),T=s(v,b[0],[],"06"),_=s(v,b[1],[]),S=KJUR.asn1.ASN1Util.oidHexToInt(T);return A.type=KJUR.asn1.x509.OID.oid2atype(S),A.ds=this.HEX2STAG[v.substr(b[1],2)],A.ds!="bmp"?A.value=hextoutf8(_):A.value=ucs2hextoutf8(_),A},this.readCertPEM=function(v){this.readCertHex(E(v))},this.readCertHex=function(v){this.hex=v,this.getVersion();try{f(this.hex,0,[0,7],"a3"),this.parseExt()}catch(A){}},this.getParam=function(){var v={};return v.version=this.getVersion(),v.serial={hex:this.getSerialNumberHex()},v.sigalg=this.getSignatureAlgorithmField(),v.issuer=this.getIssuer(),v.notbefore=this.getNotBefore(),v.notafter=this.getNotAfter(),v.subject=this.getSubject(),v.sbjpubkey=hextopem(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(v.ext=this.getExtParamArray()),v.sighex=this.getSignatureValueHex(),v},this.getExtParamArray=function(v){if(v==null){var A=p(this.hex,0,[0,"[3]"]);A!=-1&&(v=c(this.hex,0,[0,"[3]",0],"30"))}for(var b=[],T=e(v,0),_=0;_<T.length;_++){var S=o(v,T[_]),w=this.getExtParam(S);w!=null&&b.push(w)}return b},this.getExtParam=function(v){var A=e(v,0),b=A.length;if(b!=2&&b!=3)throw new Error("wrong number elements in Extension: "+b+" "+v);var T=m(s(v,0,[0],"06")),_=!1;b==3&&l(v,0,[1])=="0101ff"&&(_=!0);var S=l(v,0,[b-1,0]),w=void 0;if(T=="2.5.29.14"?w=this.getExtSubjectKeyIdentifier(S,_):T=="2.5.29.15"?w=this.getExtKeyUsage(S,_):T=="2.5.29.17"?w=this.getExtSubjectAltName(S,_):T=="2.5.29.18"?w=this.getExtIssuerAltName(S,_):T=="2.5.29.19"?w=this.getExtBasicConstraints(S,_):T=="2.5.29.31"?w=this.getExtCRLDistributionPoints(S,_):T=="2.5.29.32"?w=this.getExtCertificatePolicies(S,_):T=="2.5.29.35"?w=this.getExtAuthorityKeyIdentifier(S,_):T=="2.5.29.37"?w=this.getExtExtKeyUsage(S,_):T=="1.3.6.1.5.5.7.1.1"?w=this.getExtAuthorityInfoAccess(S,_):T=="2.5.29.20"?w=this.getExtCRLNumber(S,_):T=="2.5.29.21"?w=this.getExtCRLReason(S,_):T=="1.3.6.1.5.5.7.48.1.2"?w=this.getExtOcspNonce(S,_):T=="1.3.6.1.5.5.7.48.1.5"?w=this.getExtOcspNoCheck(S,_):T=="1.2.840.113583.1.1.9.1"&&(w=this.getExtAdobeTimeStamp(S,_)),w!=null)return w;var R={extname:T,extn:S};return _&&(R.critical=!0),R},this.findExt=function(v,A){for(var b=0;b<v.length;b++)if(v[b].extname==A)return v[b];return null},this.dnarraytostr=function(v){function A(T){return T.map(function(_){return b(_).replace(/\+/,"\\+")}).join("+")}function b(T){return T.type+"="+T.value}return"/"+v.map(function(T){return A(T).replace(/\//,"\\/")}).join("/")},this.getInfo=function(){var v=function(q){var z=JSON.stringify(q.array).replace(/[\[\]\{\}\"]/g,"");return z},A=function(q){for(var z="",J=q.array,V=0;V<J.length;V++){var U=J[V];if(z+=" policy oid: "+U.policyoid+`
363
+ `,U.array!==void 0)for(var j=0;j<U.array.length;j++){var K=U.array[j];K.cps!==void 0&&(z+=" cps: "+K.cps+`
364
+ `)}}return z},b=function(q){for(var z="",J=q.array,V=0;V<J.length;V++){var U=J[V];try{U.dpname.full[0].uri!==void 0&&(z+=" "+U.dpname.full[0].uri+`
365
365
  `)}catch(j){}try{U.dname.full[0].dn.hex!==void 0&&(z+=" "+X509.hex2dn(U.dpname.full[0].dn.hex)+`
366
- `)}catch(j){}}return z},T=function(q){for(var z="",V=q.array,Q=0;Q<V.length;Q++){var U=V[Q];U.caissuer!==void 0&&(z+=" caissuer: "+U.caissuer+`
366
+ `)}catch(j){}}return z},T=function(q){for(var z="",J=q.array,V=0;V<J.length;V++){var U=J[V];U.caissuer!==void 0&&(z+=" caissuer: "+U.caissuer+`
367
367
  `),U.ocsp!==void 0&&(z+=" ocsp: "+U.ocsp+`
368
368
  `)}return z},_,S,w;if(_=`Basic Fields
369
369
  `,_+=" serial number: "+this.getSerialNumberHex()+`
@@ -394,7 +394,7 @@
394
394
  `)),v.fragmentShader=v.fragmentShader.replace(/MAIN_START/g,M.map(function(U){return U.fragment.mainStart}).filter(function(U){return!!U}).join(`
395
395
  `)),v.fragmentShader=v.fragmentShader.replace(/MAIN_END/g,M.map(function(U){return U.fragment.mainEnd}).filter(function(U){return!!U}).join(`
396
396
  `)),v.fragmentShader=v.fragmentShader.replace(/MAIN_MODEL_COLOR/g,M.map(function(U){return U.fragment.mainModelColor}).filter(function(U){return!!U}).join(`
397
- `));var q=String(r.clippers.length);v.vertexShader=v.vertexShader.replace(/NUM_CLIPPERS/g,q),v.fragmentShader=v.fragmentShader.replace(/NUM_CLIPPERS/g,q);for(var z=0,V=M;z<V.length;z++){var Q=V[z];Q.onBeforeCompile&&Q.onBeforeCompile(v,A)}};var c="";r.onBeforeRender=function(v,A,b,T,_,S){var w=r.shaderType;b instanceof Camera?(l.pixelRatio.value=b.pixelRatio,l.resolution.value.copy(b.resolution)):(l.pixelRatio.value=v.getPixelRatio(),v.getViewport(scratchViewport$5),l.resolution.value.set(scratchViewport$5.width,scratchViewport$5.height));var R=r.transparent===!1&&r.blending===THREE__namespace.NormalBlending;u.USE_OPAQUE!==R&&(u.USE_OPAQUE=R,r.needsUpdate=!0);var I=r.customShaders.filter(function(C){return C.type.includes(w)}),H=I.map(function(C){return"".concat(C.id,":").concat(C.version)}).join("|");c!==H&&(c=H,r.needsUpdate=!0)},Object.defineProperty(r,"uniform",{configurable:!1,enumerable:!1,writable:!1,value:l});var f=(o=e==null?void 0:e.shaderType)!==null&&o!==void 0?o:"standard";defineProperty(r,"shaderType",{get:function(){return f},set:function(v){f!==v&&(f=v,this.needsUpdate=!0)}});var p=(s=e==null?void 0:e.combine)!==null&&s!==void 0?s:THREE__namespace.MultiplyOperation;defineProperty(r,"combine",{get:function(){return f!=="standard"?p:null},set:function(v){p=v}}),defineProperty(r,"isPBMMeshMaterial",{configurable:!1,writable:!1,value:!0}),defineProperty(r,"isShaderMaterial",{configurable:!1,writable:!1,value:!0}),defineProperty(r,"isMeshBasicMaterial",{configurable:!1,get:function(){return f==="basic"||f==="none"}}),defineProperty(r,"isMeshPhongMaterial",{configurable:!1,get:function(){return f==="phong"}}),defineProperty(r,"isMeshStandardMaterial",{configurable:!1,get:function(){return f==="standard"}}),defineProperty(r,"vertexMarks",{get:function(){return!!u.USE_VERTEX_MARK},set:function(v){u.USE_VERTEX_MARK!==v&&(u.USE_VERTEX_MARK=v,this.needsUpdate=!0)}}),defineProperty(r,"colorAlpha",{get:function(){return l.colorAlpha.value},set:function(v){l.colorAlpha.value=v}});var d=null;defineProperty(r,"pano0",{get:function(){return d},set:function(v){d!==v&&(d=v,v===null?l.pano0.value={map:null,matrix:new THREE__namespace.Matrix4,zoom:1}:l.pano0.value={map:v.map,matrix:v.matrix,zoom:v.zoom})}});var h=null;defineProperty(r,"pano1",{get:function(){return h},set:function(v){h!==v&&(h=v,v===null?l.pano1.value={map:null,matrix:new THREE__namespace.Matrix4,zoom:1}:l.pano1.value={map:v.map,matrix:v.matrix,zoom:v.zoom})}});var g=null;defineProperty(r,"pano0Depth",{get:function(){return g},set:function(v){if(g!==v){g=v,v===null?(l.pano0Depth.value.map=null,l.pano0Depth.value.maxDepth=1):(l.pano0Depth.value.map=v.map,l.pano0Depth.value.maxDepth=v.maxDepth);var A=g!==null&&m!==null;u.USE_PANO_DEPTH!==A&&(u.USE_PANO_DEPTH=A,this.needsUpdate=!0)}}});var m=null;defineProperty(r,"pano1Depth",{get:function(){return m},set:function(v){if(m!==v){m=v,v===null?l.pano1Depth.value={map:null,maxDepth:1}:l.pano1Depth.value={map:v.map,maxDepth:v.maxDepth};var A=g!==null&&m!==null;u.USE_PANO_DEPTH!==A&&(u.USE_PANO_DEPTH=A,this.needsUpdate=!0)}}});var E=null;defineProperty(r,"refinedScreen",{get:function(){return E},set:function(v){if(E!==v){E=v;var A;v===null?(A=!1,l.refinedScreen.value={matrixInverse:new THREE__namespace.Matrix4,projectionMatrix:new THREE__namespace.Matrix4,map:null,pano:0,opacity:0}):(A=!0,l.refinedScreen.value={matrixInverse:v.matrixInverse,projectionMatrix:v.projectionMatrix,map:v.map,pano:v.pano,opacity:v.opacity}),u.USE_REFINED_SCREEN!==A&&(u.USE_REFINED_SCREEN=A,this.needsUpdate=!0)}}}),defineProperty(r,"modelAlpha",{get:function(){return l.modelAlpha.value},set:function(v){l.modelAlpha.value=v}}),defineProperty(r,"progress",{get:function(){return l.progress.value},set:function(v){l.progress.value=v}}),defineProperty(r,"transition",{get:function(){return u.USE_BLACK_TRANSITION?"BLACK":u.USE_SPREAD_TRANSITION?"SPREAD":"FADE"},set:function(v){var A=u.USE_BLACK_TRANSITION,b=u.USE_SPREAD_TRANSITION,T=u.USE_FADE_TRANSITION;u.USE_BLACK_TRANSITION=!1,u.USE_SPREAD_TRANSITION=!1,u.USE_FADE_TRANSITION=!1,u["USE_".concat(v,"_TRANSITION")]=!0;var _=!1;A!==u.USE_BLACK_TRANSITION&&(_=!0),b!==u.USE_SPREAD_TRANSITION&&(_=!0),T!==u.USE_FADE_TRANSITION&&(_=!0),_&&(this.needsUpdate=!0)}}),defineProperty(r,"colorStyle",{get:function(){return u.USE_COLOR_CONSTANT?"CONSTANT":u.USE_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(v){var A=v==="CONSTANT",b=v==="ALTITUDE";u.USE_COLOR_CONSTANT!==A&&(u.USE_COLOR_CONSTANT=A,this.needsUpdate=!0),u.USE_COLOR_ALTITUDE!==b&&(u.USE_COLOR_ALTITUDE=b,this.needsUpdate=!0)}}),defineProperty(r,"constantColor",{get:function(){return l.constantColor.value},set:function(v){l.constantColor.value=v}}),defineProperty(r,"floorIndex",{get:function(){return l.floorIndex.value},set:function(v){l.floorIndex.value=v}}),defineProperty(r,"shownFloorIndex",{get:function(){return l.shownFloorIndex.value},set:function(v){l.shownFloorIndex.value=v}}),defineProperty(r,"floorStyle",{get:function(){return u.USE_FLOOR_STYLE_VISIBILITY?"VISIBILITY":"OPACITY"},set:function(v){var A=v==="VISIBILITY";u.USE_FLOOR_STYLE_VISIBILITY!==A&&(u.USE_FLOOR_STYLE_VISIBILITY=A,this.needsUpdate=!0)}}),defineProperty(r,"gradientTexture",{get:function(){return l.gradientTexture.value},set:function(v){l.gradientTexture.value=v}}),defineProperty(r,"brightness",{get:function(){return l.brightness.value},set:function(v){l.brightness.value=v}});var y=[];return defineProperty(r,"clippers",{get:function(){return y},set:function(v){y!==v&&(y=v,l.clippers.value=y.map(function(A){var b=typeof A.floorIndex=="number"?A.floorIndex:-1,T=new THREE__namespace.Matrix4().getInverse(A.clippingBoxMatrix);return{matrixInverse:T,floorIndex:b}}),this.needsUpdate=!0)}}),defineProperty(r,"colorSaturation",{get:function(){return l.colorSaturation.value},set:function(v){l.colorSaturation.value=v;var A=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==A&&(u.USE_COLOR_ADJUSTMENT=A,this.needsUpdate=!0)}}),defineProperty(r,"colorBrightness",{get:function(){return l.colorBrightness.value},set:function(v){l.colorBrightness.value=v;var A=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==A&&(u.USE_COLOR_ADJUSTMENT=A,this.needsUpdate=!0)}}),defineProperty(r,"useHQWeight",{get:function(){return u.USE_HQ_WEIGHT},set:function(v){v!==u.USE_HQ_WEIGHT&&(u.USE_HQ_WEIGHT=v,this.needsUpdate=!0)}}),defineProperty(r,"useHQDepth",{get:function(){return u.USE_HQ_DEPTH},set:function(v){v!==u.USE_HQ_DEPTH&&(u.USE_HQ_DEPTH=v,this.needsUpdate=!0)}}),defineProperty(r,"modelBoundingMin",{get:function(){return l.modelBoundingMin.value},set:function(v){l.modelBoundingMin.value=v}}),defineProperty(r,"modelBoundingMax",{get:function(){return l.modelBoundingMax.value},set:function(v){l.modelBoundingMax.value=v}}),typeof e=="object"&&r.setValues(e),toFastProperties(r),r}return t.prototype.copy=function(e){return n.prototype.copy.call(this,e),this.shaderType=e.shaderType,this.vertexMarks=e.vertexMarks,this.vertexTangents=e.vertexColors,this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.specular.copy(e.specular),this.shininess=e.shininess,this.roughnessMap=e.roughnessMap,this.roughness=e.roughness,this.metalnessMap=e.metalnessMap,this.metalness=e.metalness,this.alphaMap=e.alphaMap,this.combine=e.combine,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.emissiveMap=e.emissiveMap,this.emissive.copy(e.emissive),this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.customShaders=e.customShaders,this.colorAlpha=e.colorAlpha,this.alphaMode=e.alphaMode,this.pano0=e.pano0,this.pano1=e.pano1,this.modelAlpha=e.modelAlpha,this.progress=e.progress,this.transition=e.transition,this.colorStyle=e.colorStyle,this.constantColor.copy(e.constantColor),this.floorIndex=e.floorIndex,this.shownFloorIndex=e.shownFloorIndex,this.floorStyle=e.floorStyle,this.gradientTexture=e.gradientTexture,this.brightness=e.brightness,this.clippers=e.clippers,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.modelBoundingMin.copy(e.modelBoundingMin),this.modelBoundingMax.copy(e.modelBoundingMax),this},t.prototype.clone=function(){var e=this.constructor;return new e().copy(this)},t.prototype.refreshUniforms=function(){},t})(PBMMaterial),PBMMesh=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.onBeforeRender=function(s,u,l,c,f,p){f instanceof PBMMeshMaterial&&f.onBeforeRender&&f.onBeforeRender(s,u,l,c,o,p)},toFastProperties(o),o}return t})(THREE__namespace.Mesh),PBMSkinnedMesh=(function(n){__extends(t,n);function t(e,r,o){var s=n.call(this,e,r,o)||this;return s.onBeforeRender=function(u,l,c,f,p,d){p instanceof PBMMeshMaterial&&p.onBeforeRender&&p.onBeforeRender(u,l,c,f,s,d)},toFastProperties(s),s}return t})(THREE__namespace.SkinnedMesh);const pointCloudFragmentShader=(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)})("{vs|z-sy|n-sy||V{qr\x07H0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvsn\bv{t-sy|n-_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rpA-Sv{ny]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-u|{Sy||V{qr\x07H{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{H0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{KZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--<<-JJJ-点-大小-形状-剔除-JJJ--vs-5]|v{`v r-I-=;==>6-\n----qvpnqH--\f--sy|n-}-J-?;=-7-tyl]|v{P||q;\x07-:->;=H--sy|n-}-J-?;=-7-tyl]|v{P||q;\b-:->;=H--sy|n-}-J-}-7-}-8-}-7-}H--<<-JJJ-形状裁切-JJJ--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----vs-5]|v{`v r-K-@;=-33-}-K->;=6-\n------qvpnqH----\f--0r{qvs--<<-JJJJJJJJJJJJJ--<<-JJJ-楼层-JJJ--o||y-vPr{Sy||-J-u|{Sy||V{qr\x07-I-:=;=>-\v\v-no5sy||V{qr\x07-:-u|{Sy||V{qr\x076-I-=;FFH--sy|n-sy||\\}npv\b-J->;=H--vs-5.vPr{Sy||6-\n----0vs-qrsv{rq5b`RlSY\\\\_l`afYRlcV`VOVYVaf6------qvpnqH----0r{qvs----sy||\\}npv\b-J-pynz}5=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=69-=;=9->;=6H--\f--<<-JJJJJJJJJJJ--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----_||sZnx-K-=;==>-33----Sv{ny]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-Sv{ny]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||V{qr\x07-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--0v{pyqr-Iy|tqr}uoslsntzr{K--<<-JJJ-颜色-JJJ--rpA-qvssrP|y|-J-rpA5P|y|9-|}npv\b6H--qvssrP|y|;n-J-qvssrP|y|;n-7-sy||\\}npv\b-7-z|qryNy}unH--0vs-qrsv{rq5b`Rl\\]N^bR6----qvssrP|y|;n-J->;=H--0r{qvs--tylSntP|y|-J-qvssrP|y|H--ZNV[lZ\\QRYlP\\Y\\_--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0vs-qrsv{rq5b`RlU^ldRVTUa6----sy|n-qvn{pr-J-?;=-7-yr{tu5tyl]|v{P||q;\x07\b-:-=;B6H----sy|n-rvtu-J-zn\x075=;=9->;=-:-qvn{pr6H----rvtu-J-}|5rvtu9->;B6H----tylSntP|y|;n-J-rvtuH----tylSntP|y|;to-J-tylSntP|y|;to-7-rvtuH--0r{qvs--ZNV[lR[Q\f"),pointCloudVertexShader=(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)})("nvor-sy|n-lsrnrlvqlznxHn\bv{t-sy|n-_||sZnxH0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{ar\x07rH0r{qvs{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-sy|n-}|v{`pnyrH{vs|z-sy|n-}|v{Zv{]v\x07ryH{vs|z-sy|n-}|v{Zn\x07]v\x07ryH{vs|z-sy|n-|}npv\bH{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{H<<u调整{vs|z-sy|n-p|y|`nnv|{H{vs|z-sy|n-p|y|Ovtu{rH<<-边缘增益{vs|z-sy|n-|yv{rTnv{H{vs|z-sy|n-qvn{prTnv{Hn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rpA-Sv{ny]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07Krp@-_TOa|Yv{rn5rp@-nyr6-\n--r{-zv\x075----}|5-nyr;to-7-=;FADECD?FEC-8-rp@5-=;=B?>@?D=>A-69-rp@5-?;A-6-69----nyr;to-7-=;=DD@FF@E=E9----rp@5-yraun{R\0ny5-nyr;to9-rp@5-=;=A=AB-6-6-6--6H\frp@-to?u5rp@-p6-\n--rpA-X-J-rpA5=;=9-:>;=-<-@;=9-?;=-<-@;=9-:>;=6H--rpA-}-J-zv\x075rpA5p;ot9-X; 69-rpA5p;to9-X;\x07\b69-r}5p;o9-p;t66H--rpA-\0-J-zv\x075rpA5};\x07\b9-p;69-rpA5p;9-};\b \x0769-r}5};\x079-p;66H--sy|n-q-J-\0;\x07-:-zv{5\0;9-\0;\b6H--sy|n-r-J->;=r:>=H--r{-rp@5no5\0; -8-5\0;-:-\0;\b6-<-5C;=-7-q-8-r669-q-<-5\0;\x07-8-r69-\0;\x076H\frp@-u?to5rp@-p6-\n--rpA-X-J-rpA5>;=9-?;=-<-@;=9->;=-<-@;=9-@;=6H--rp@-}-J-no5snp5p;\x07\x07\x07-8-X;\x07\b 6-7-C;=-:-X;6H--r{-p; -7-zv\x075X;\x07\x07\x079-pynz}5}-:-X;\x07\x07\x079-=;=9->;=69-p;\b6H\frp@-trP|y|O\bUrvtu5nz}yr?Q-tnqvr{ar\x07r9-rpA-|yq]|vv|{6-\n--sy|n--J-5|yq]|vv|{;\b-:-z|qryO|{qv{tZv{;\b6-<-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6H--r{-r\x07r?Q5tnqvr{ar\x07r9-rp?59-=;B66;toH\fZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--0v{pyqr-Iortv{lrr\x07K--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--rpA-z]|vv|{-J-vrZnv\x07-7-d|yq]|vv|{H--tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--Sv{ny]|vv|{-J-d|yq]|vv|{H--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--<<传递nvor的p|y|到s里使用--<<动态调整}|v{`v r--sy|n-rny]|v{`v r-J-}|v{`pnyr-7-}v\x07ry_nv|H--0vs-qrsv{rq5b`Rl]\\V[al`VgRlNaaR[bNaV\\[6----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0r{qvs--tyl]|v{`v r-J-pynz}5rny]|v{`v r9-}|v{Zv{]v\x07ry-7-}v\x07ry_nv|9-}|v{Zn\x07]v\x07ry-7-}v\x07ry_nv|6H--]|v{`v r-J-tyl]|v{`v rH--P|y|-J-_TOa|Yv{rn5p|y|6H--<<-JJJ-高度色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6----P|y|-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-Sv{ny]|vv|{6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6----P|y|-J-p|{n{P|y|H--0r{qvs--<<-JJJJJJJJJJJ--0vs{qrs-SYNal`UNQRQ----[|zny-J-{|znyv r5zn@5z|qryZnv\x076-7-{|zny6H--0r{qvs--<<-JJJ-背面渲染-JJJ--0vs{qrs-SYNal`UNQRQ----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-Sv{ny]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------]|v{`v r-J-=;=H------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-Sv{ny]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------P|y|;\x07\b -J-P|y|;\x07\b -7-=;EH------\f----0r{qvs--0r{qvs--<<-JJJ-颜色增益调整-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNQWb`aZR[a6----rp@-uP|y|-J-to?u5P|y|6H----uP|y|;\b-8J-p|y|`nnv|{H----uP|y|; -8J-p|y|Ovtu{rH----0vs{qrs-SYNal`UNQRQ------rp@-vrQv-J-{|znyv r5v\\u|tn}uvp-L-PnzrnQvrpv|{-G-Sv{ny]|vv|{;\x07\b -:-pnzrn]|vv|{6H------<<-计算边缘增益------sy|n-p|aurn-J-q|5{|znyv r5[|zny69-vrQv6H------sy|n-n{tyr-J-np|5p|aurn6H------sy|n-|yv{rSnp|-J-}|5>;=-:-no5n{tyr-:-]VlUNYS6-<-]VlUNYS9-B;=6H------uP|y|; -8J-|yv{rTnv{-7-|yv{rSnp|H-<<-增加亮度------uP|y|; -J-pynz}5uP|y|; 9-=;=9->;=6H------<<-距离增益------rp@-o|{qv{tPr{r-J-5z|qryO|{qv{tZn\x07-8-z|qryO|{qv{tZv{6-<-?;=H------sy|n-o|{qv{tYr{tu-J-yr{tu5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6-7->;BH------sy|n-nrntrQvn{pr-J->=;=H-<<-设定一个平均距离------rp@-pnzrna|]|v{-J-Sv{ny]|vv|{;\x07\b -:-pnzrn]|vv|{H------sy|n-pnzrnO|{qv{tQvn{pr-J-zn\x075=;=9-yr{tu5pnzrn]|vv|{-:-o|{qv{tPr{r6-:-o|{qv{tYr{tu-<-?;=6H------sy|n-pnzrnQvn{pr-J-yr{tu5v\\u|tn}uvp-L-vrQv-7-q|5vrQv9-pnzrna|]|v{6-G-pnzrna|]|v{6-:-pnzrnO|{qv{tQvn{prH------sy|n-qvn{prSnp|-J-pynz}5zn\x075pnzrnQvn{pr-:-nrntrQvn{pr9-=;=6-<-o|{qv{tYr{tu9-=;=9->;=6H------qvn{prSnp|-J-5=;E-:-pynz}5>;=-:-}|5>;=-:-qvn{prSnp|9-@;=69-=;=9->;=66-7->?;=H------uP|y|; -8J-zv\x075uP|y|; -7-qvn{prTnv{-7-qvn{prSnp|9-=;=9-|yv{rSnp|6H-<<-增加透明度------uP|y|; -J-pynz}5uP|y|; 9-=;=9->;=6H----0r{qvs----P|y|-J-zn\x075u?to5uP|y|69-=;=6H--0r{qvs--<<-JJJJJJJJJJJJJJJJJJ--0vs-qrsv{rq5b`RlU^lQR]aU6----<<-sy|n-}|wSnp|-J-:=;B-7-r|yv|{;\b-<-5n{5s|-<-?;=6-7-z]|vv|{; 6H----<<-sy|n-_nqv-J-rny]|v{`v r-<-}|wSnp|H----sy|n-|vtv{nyQr}u-J-tyl]|vv|{;H----sy|n-nqwrqQr}u-J-|vtv{nyQr}u-8-=;>H----sy|n-nqw-J-nqwrqQr}u-<-|vtv{nyQr}uH----z]|vv|{;\x07\b -J-z]|vv|{;\x07\b -7-nqwH----tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--0r{qvs--_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----_||sZnx-J-z||ur}5_\\\\SlZN_X-:-ZN_Xl`aR]9-_\\\\SlZN_X9-lsrnrlvqlznx6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f");var scratchViewport$4=new THREE__namespace.Vector4,pbmUniforms={pointScale:new Uniform(1),pointMinPixel:new Uniform(1),pointMaxPixel:new Uniform(1),modelAlpha:new Uniform(1),gradientTexture:new Uniform(null),clippers:new Uniform([]),shownFloorIndex:new Uniform(-1),constantColor:new Uniform(new THREE__namespace.Vector3),floorIndex:new Uniform(0),brightness:new Uniform(1),colorSaturation:new Uniform(0),colorBrightness:new Uniform(0),outlineGain:new Uniform(0),distanceGain:new Uniform(0),pixelRatio:new Uniform(1),resolution:new Uniform(new THREE__namespace.Vector2(512,512)),modelBoundingMin:new Uniform(new THREE__namespace.Vector3),modelBoundingMax:new Uniform(new THREE__namespace.Vector3)},shaderLib={pointcloud:{vertexShader:pointCloudVertexShader,fragmentShader:pointCloudFragmentShader}},uniformsLib=mergeUniforms({opacity:{value:1}},pbmUniforms),definesLib={USE_OPAQUE:!1,USE_VERTEX_MARK:!1,USE_COLOR_CONSTANT:!1,USE_COLOR_ALTITUDE:!1,USE_COLOR_ADJUSTMENT:!1,USE_FLOOR_STYLE_VISIBILITY:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1},PBMPointCloudMaterial=(function(n){__extends(t,n);function t(e){var r=n.call(this)||this;r.shaderType="pointcloud",r.clipping=!0,r.customShaders=[],r.vertexColors=!0,r.type="PBMPointCloudMaterial";var o=Object.assign({},definesLib),s=cloneUniforms(uniformsLib);toFastProperties(s),toFastProperties(o),r.defines=o,r.onBeforeCompile=function(c,f){var p,d,h=r.shaderType;c.vertexShader=shaderLib[h].vertexShader,c.fragmentShader=shaderLib[h].fragmentShader,c.uniforms=s;for(var g=0,m=Object.keys(o);g<m.length;g++){var E=m[g];E in definesLib||(o[E]=void 0)}for(var y=0,v=Object.keys(s);y<v.length;y++){var A=v[y];A in uniformsLib||(s[A]=void 0)}for(var b=r.customShaders.filter(function(B){return B.type.includes(h)}),T=0,_=b;T<_.length;T++){var S=_[T];for(var w in S.uniforms)w in s||Object.assign(s,(p={},p[w]=S.uniforms[w],p));for(var R in S.defines)R in o||Object.assign(o,(d={},d[R]=S.defines[R],d))}toFastProperties(s),toFastProperties(o),c.vertexShader=c.vertexShader.replace(/MAIN_BEFORE/g,b.map(function(B){return B.vertex.mainBefore}).filter(function(B){return!!B}).join(`
397
+ `));var q=String(r.clippers.length);v.vertexShader=v.vertexShader.replace(/NUM_CLIPPERS/g,q),v.fragmentShader=v.fragmentShader.replace(/NUM_CLIPPERS/g,q);for(var z=0,J=M;z<J.length;z++){var V=J[z];V.onBeforeCompile&&V.onBeforeCompile(v,A)}};var c="";r.onBeforeRender=function(v,A,b,T,_,S){var w=r.shaderType;b instanceof Camera?(l.pixelRatio.value=b.pixelRatio,l.resolution.value.copy(b.resolution)):(l.pixelRatio.value=v.getPixelRatio(),v.getViewport(scratchViewport$5),l.resolution.value.set(scratchViewport$5.width,scratchViewport$5.height));var R=r.transparent===!1&&r.blending===THREE__namespace.NormalBlending;u.USE_OPAQUE!==R&&(u.USE_OPAQUE=R,r.needsUpdate=!0);var I=r.customShaders.filter(function(C){return C.type.includes(w)}),H=I.map(function(C){return"".concat(C.id,":").concat(C.version)}).join("|");c!==H&&(c=H,r.needsUpdate=!0)},Object.defineProperty(r,"uniform",{configurable:!1,enumerable:!1,writable:!1,value:l});var f=(o=e==null?void 0:e.shaderType)!==null&&o!==void 0?o:"standard";defineProperty(r,"shaderType",{get:function(){return f},set:function(v){f!==v&&(f=v,this.needsUpdate=!0)}});var p=(s=e==null?void 0:e.combine)!==null&&s!==void 0?s:THREE__namespace.MultiplyOperation;defineProperty(r,"combine",{get:function(){return f!=="standard"?p:null},set:function(v){p=v}}),defineProperty(r,"isPBMMeshMaterial",{configurable:!1,writable:!1,value:!0}),defineProperty(r,"isShaderMaterial",{configurable:!1,writable:!1,value:!0}),defineProperty(r,"isMeshBasicMaterial",{configurable:!1,get:function(){return f==="basic"||f==="none"}}),defineProperty(r,"isMeshPhongMaterial",{configurable:!1,get:function(){return f==="phong"}}),defineProperty(r,"isMeshStandardMaterial",{configurable:!1,get:function(){return f==="standard"}}),defineProperty(r,"vertexMarks",{get:function(){return!!u.USE_VERTEX_MARK},set:function(v){u.USE_VERTEX_MARK!==v&&(u.USE_VERTEX_MARK=v,this.needsUpdate=!0)}}),defineProperty(r,"colorAlpha",{get:function(){return l.colorAlpha.value},set:function(v){l.colorAlpha.value=v}});var d=null;defineProperty(r,"pano0",{get:function(){return d},set:function(v){d!==v&&(d=v,v===null?l.pano0.value={map:null,matrix:new THREE__namespace.Matrix4,zoom:1}:l.pano0.value={map:v.map,matrix:v.matrix,zoom:v.zoom})}});var h=null;defineProperty(r,"pano1",{get:function(){return h},set:function(v){h!==v&&(h=v,v===null?l.pano1.value={map:null,matrix:new THREE__namespace.Matrix4,zoom:1}:l.pano1.value={map:v.map,matrix:v.matrix,zoom:v.zoom})}});var g=null;defineProperty(r,"pano0Depth",{get:function(){return g},set:function(v){if(g!==v){g=v,v===null?(l.pano0Depth.value.map=null,l.pano0Depth.value.maxDepth=1):(l.pano0Depth.value.map=v.map,l.pano0Depth.value.maxDepth=v.maxDepth);var A=g!==null&&m!==null;u.USE_PANO_DEPTH!==A&&(u.USE_PANO_DEPTH=A,this.needsUpdate=!0)}}});var m=null;defineProperty(r,"pano1Depth",{get:function(){return m},set:function(v){if(m!==v){m=v,v===null?l.pano1Depth.value={map:null,maxDepth:1}:l.pano1Depth.value={map:v.map,maxDepth:v.maxDepth};var A=g!==null&&m!==null;u.USE_PANO_DEPTH!==A&&(u.USE_PANO_DEPTH=A,this.needsUpdate=!0)}}});var E=null;defineProperty(r,"refinedScreen",{get:function(){return E},set:function(v){if(E!==v){E=v;var A;v===null?(A=!1,l.refinedScreen.value={matrixInverse:new THREE__namespace.Matrix4,projectionMatrix:new THREE__namespace.Matrix4,map:null,pano:0,opacity:0}):(A=!0,l.refinedScreen.value={matrixInverse:v.matrixInverse,projectionMatrix:v.projectionMatrix,map:v.map,pano:v.pano,opacity:v.opacity}),u.USE_REFINED_SCREEN!==A&&(u.USE_REFINED_SCREEN=A,this.needsUpdate=!0)}}}),defineProperty(r,"modelAlpha",{get:function(){return l.modelAlpha.value},set:function(v){l.modelAlpha.value=v}}),defineProperty(r,"progress",{get:function(){return l.progress.value},set:function(v){l.progress.value=v}}),defineProperty(r,"transition",{get:function(){return u.USE_BLACK_TRANSITION?"BLACK":u.USE_SPREAD_TRANSITION?"SPREAD":"FADE"},set:function(v){var A=u.USE_BLACK_TRANSITION,b=u.USE_SPREAD_TRANSITION,T=u.USE_FADE_TRANSITION;u.USE_BLACK_TRANSITION=!1,u.USE_SPREAD_TRANSITION=!1,u.USE_FADE_TRANSITION=!1,u["USE_".concat(v,"_TRANSITION")]=!0;var _=!1;A!==u.USE_BLACK_TRANSITION&&(_=!0),b!==u.USE_SPREAD_TRANSITION&&(_=!0),T!==u.USE_FADE_TRANSITION&&(_=!0),_&&(this.needsUpdate=!0)}}),defineProperty(r,"colorStyle",{get:function(){return u.USE_COLOR_CONSTANT?"CONSTANT":u.USE_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(v){var A=v==="CONSTANT",b=v==="ALTITUDE";u.USE_COLOR_CONSTANT!==A&&(u.USE_COLOR_CONSTANT=A,this.needsUpdate=!0),u.USE_COLOR_ALTITUDE!==b&&(u.USE_COLOR_ALTITUDE=b,this.needsUpdate=!0)}}),defineProperty(r,"constantColor",{get:function(){return l.constantColor.value},set:function(v){l.constantColor.value=v}}),defineProperty(r,"floorIndex",{get:function(){return l.floorIndex.value},set:function(v){l.floorIndex.value=v}}),defineProperty(r,"shownFloorIndex",{get:function(){return l.shownFloorIndex.value},set:function(v){l.shownFloorIndex.value=v}}),defineProperty(r,"floorStyle",{get:function(){return u.USE_FLOOR_STYLE_VISIBILITY?"VISIBILITY":"OPACITY"},set:function(v){var A=v==="VISIBILITY";u.USE_FLOOR_STYLE_VISIBILITY!==A&&(u.USE_FLOOR_STYLE_VISIBILITY=A,this.needsUpdate=!0)}}),defineProperty(r,"gradientTexture",{get:function(){return l.gradientTexture.value},set:function(v){l.gradientTexture.value=v}}),defineProperty(r,"brightness",{get:function(){return l.brightness.value},set:function(v){l.brightness.value=v}});var y=[];return defineProperty(r,"clippers",{get:function(){return y},set:function(v){y!==v&&(y=v,l.clippers.value=y.map(function(A){var b=typeof A.floorIndex=="number"?A.floorIndex:-1,T=new THREE__namespace.Matrix4().getInverse(A.clippingBoxMatrix);return{matrixInverse:T,floorIndex:b}}),this.needsUpdate=!0)}}),defineProperty(r,"colorSaturation",{get:function(){return l.colorSaturation.value},set:function(v){l.colorSaturation.value=v;var A=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==A&&(u.USE_COLOR_ADJUSTMENT=A,this.needsUpdate=!0)}}),defineProperty(r,"colorBrightness",{get:function(){return l.colorBrightness.value},set:function(v){l.colorBrightness.value=v;var A=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==A&&(u.USE_COLOR_ADJUSTMENT=A,this.needsUpdate=!0)}}),defineProperty(r,"useHQWeight",{get:function(){return u.USE_HQ_WEIGHT},set:function(v){v!==u.USE_HQ_WEIGHT&&(u.USE_HQ_WEIGHT=v,this.needsUpdate=!0)}}),defineProperty(r,"useHQDepth",{get:function(){return u.USE_HQ_DEPTH},set:function(v){v!==u.USE_HQ_DEPTH&&(u.USE_HQ_DEPTH=v,this.needsUpdate=!0)}}),defineProperty(r,"modelBoundingMin",{get:function(){return l.modelBoundingMin.value},set:function(v){l.modelBoundingMin.value=v}}),defineProperty(r,"modelBoundingMax",{get:function(){return l.modelBoundingMax.value},set:function(v){l.modelBoundingMax.value=v}}),typeof e=="object"&&r.setValues(e),toFastProperties(r),r}return t.prototype.copy=function(e){return n.prototype.copy.call(this,e),this.shaderType=e.shaderType,this.vertexMarks=e.vertexMarks,this.vertexTangents=e.vertexColors,this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.specular.copy(e.specular),this.shininess=e.shininess,this.roughnessMap=e.roughnessMap,this.roughness=e.roughness,this.metalnessMap=e.metalnessMap,this.metalness=e.metalness,this.alphaMap=e.alphaMap,this.combine=e.combine,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.emissiveMap=e.emissiveMap,this.emissive.copy(e.emissive),this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.customShaders=e.customShaders,this.colorAlpha=e.colorAlpha,this.alphaMode=e.alphaMode,this.pano0=e.pano0,this.pano1=e.pano1,this.modelAlpha=e.modelAlpha,this.progress=e.progress,this.transition=e.transition,this.colorStyle=e.colorStyle,this.constantColor.copy(e.constantColor),this.floorIndex=e.floorIndex,this.shownFloorIndex=e.shownFloorIndex,this.floorStyle=e.floorStyle,this.gradientTexture=e.gradientTexture,this.brightness=e.brightness,this.clippers=e.clippers,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.modelBoundingMin.copy(e.modelBoundingMin),this.modelBoundingMax.copy(e.modelBoundingMax),this},t.prototype.clone=function(){var e=this.constructor;return new e().copy(this)},t.prototype.refreshUniforms=function(){},t})(PBMMaterial),PBMMesh=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.onBeforeRender=function(s,u,l,c,f,p){f instanceof PBMMeshMaterial&&f.onBeforeRender&&f.onBeforeRender(s,u,l,c,o,p)},toFastProperties(o),o}return t})(THREE__namespace.Mesh),PBMSkinnedMesh=(function(n){__extends(t,n);function t(e,r,o){var s=n.call(this,e,r,o)||this;return s.onBeforeRender=function(u,l,c,f,p,d){p instanceof PBMMeshMaterial&&p.onBeforeRender&&p.onBeforeRender(u,l,c,f,s,d)},toFastProperties(s),s}return t})(THREE__namespace.SkinnedMesh);const pointCloudFragmentShader=(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)})("{vs|z-sy|n-sy||V{qr\x07H0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvsn\bv{t-sy|n-_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rpA-Sv{ny]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-u|{Sy||V{qr\x07H{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{H0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{KZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--<<-JJJ-点-大小-形状-剔除-JJJ--vs-5]|v{`v r-I-=;==>6-\n----qvpnqH--\f--sy|n-}-J-?;=-7-tyl]|v{P||q;\x07-:->;=H--sy|n-}-J-?;=-7-tyl]|v{P||q;\b-:->;=H--sy|n-}-J-}-7-}-8-}-7-}H--<<-JJJ-形状裁切-JJJ--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----vs-5]|v{`v r-K-@;=-33-}-K->;=6-\n------qvpnqH----\f--0r{qvs--<<-JJJJJJJJJJJJJ--<<-JJJ-楼层-JJJ--o||y-vPr{Sy||-J-u|{Sy||V{qr\x07-I-:=;=>-\v\v-no5sy||V{qr\x07-:-u|{Sy||V{qr\x076-I-=;FFH--sy|n-sy||\\}npv\b-J->;=H--vs-5.vPr{Sy||6-\n----0vs-qrsv{rq5b`RlSY\\\\_l`afYRlcV`VOVYVaf6------qvpnqH----0r{qvs----sy||\\}npv\b-J-pynz}5=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=69-=;=9->;=6H--\f--<<-JJJJJJJJJJJ--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----_||sZnx-K-=;==>-33----Sv{ny]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-Sv{ny]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||V{qr\x07-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--0v{pyqr-Iy|tqr}uoslsntzr{K--<<-JJJ-颜色-JJJ--rpA-qvssrP|y|-J-rpA5P|y|9-|}npv\b6H--qvssrP|y|;n-J-qvssrP|y|;n-7-sy||\\}npv\b-7-z|qryNy}unH--0vs-qrsv{rq5b`Rl\\]N^bR6----qvssrP|y|;n-J->;=H--0r{qvs--tylSntP|y|-J-qvssrP|y|H--ZNV[lZ\\QRYlP\\Y\\_--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0vs-qrsv{rq5b`RlU^ldRVTUa6----sy|n-qvn{pr-J-?;=-7-yr{tu5tyl]|v{P||q;\x07\b-:-=;B6H----sy|n-rvtu-J-zn\x075=;=9->;=-:-qvn{pr6H----rvtu-J-}|5rvtu9->;B6H----tylSntP|y|;n-J-rvtuH----tylSntP|y|;to-J-tylSntP|y|;to-7-rvtuH--0r{qvs--ZNV[lR[Q\f"),pointCloudVertexShader=(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)})("nvor-sy|n-lsrnrlvqlznxHn\bv{t-sy|n-_||sZnxH0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{ar\x07rH0r{qvs{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-sy|n-}|v{`pnyrH{vs|z-sy|n-}|v{Zv{]v\x07ryH{vs|z-sy|n-}|v{Zn\x07]v\x07ryH{vs|z-sy|n-|}npv\bH{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{H<<u调整{vs|z-sy|n-p|y|`nnv|{H{vs|z-sy|n-p|y|Ovtu{rH<<-边缘增益{vs|z-sy|n-|yv{rTnv{H{vs|z-sy|n-qvn{prTnv{Hn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rpA-Sv{ny]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07Krp@-_TOa|Yv{rn5rp@-nyr6-\n--r{-zv\x075----}|5-nyr;to-7-=;FADECD?FEC-8-rp@5-=;=B?>@?D=>A-69-rp@5-?;A-6-69----nyr;to-7-=;=DD@FF@E=E9----rp@5-yraun{R\0ny5-nyr;to9-rp@5-=;=A=AB-6-6-6--6H\frp@-to?u5rp@-p6-\n--rpA-X-J-rpA5=;=9-:>;=-<-@;=9-?;=-<-@;=9-:>;=6H--rpA-}-J-zv\x075rpA5p;ot9-X; 69-rpA5p;to9-X;\x07\b69-r}5p;o9-p;t66H--rpA-\0-J-zv\x075rpA5};\x07\b9-p;69-rpA5p;9-};\b \x0769-r}5};\x079-p;66H--sy|n-q-J-\0;\x07-:-zv{5\0;9-\0;\b6H--sy|n-r-J->;=r:>=H--r{-rp@5no5\0; -8-5\0;-:-\0;\b6-<-5C;=-7-q-8-r669-q-<-5\0;\x07-8-r69-\0;\x076H\frp@-u?to5rp@-p6-\n--rpA-X-J-rpA5>;=9-?;=-<-@;=9->;=-<-@;=9-@;=6H--rp@-}-J-no5snp5p;\x07\x07\x07-8-X;\x07\b 6-7-C;=-:-X;6H--r{-p; -7-zv\x075X;\x07\x07\x079-pynz}5}-:-X;\x07\x07\x079-=;=9->;=69-p;\b6H\frp@-trP|y|O\bUrvtu5nz}yr?Q-tnqvr{ar\x07r9-rpA-|yq]|vv|{6-\n--sy|n--J-5|yq]|vv|{;\b-:-z|qryO|{qv{tZv{;\b6-<-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6H--r{-r\x07r?Q5tnqvr{ar\x07r9-rp?59-=;B66;toH\fZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--0v{pyqr-Iortv{lrr\x07K--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--rpA-z]|vv|{-J-vrZnv\x07-7-d|yq]|vv|{H--tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--Sv{ny]|vv|{-J-d|yq]|vv|{H--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--<<传递nvor的p|y|到s里使用--<<动态调整}|v{`v r--sy|n-rny]|v{`v r-J-}|v{`pnyr-7-}v\x07ry_nv|H--0vs-qrsv{rq5b`Rl]\\V[al`VgRlNaaR[bNaV\\[6----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0r{qvs--tyl]|v{`v r-J-pynz}5rny]|v{`v r9-}|v{Zv{]v\x07ry-7-}v\x07ry_nv|9-}|v{Zn\x07]v\x07ry-7-}v\x07ry_nv|6H--]|v{`v r-J-tyl]|v{`v rH--P|y|-J-_TOa|Yv{rn5p|y|6H--<<-JJJ-高度色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6----P|y|-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-Sv{ny]|vv|{6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6----P|y|-J-p|{n{P|y|H--0r{qvs--<<-JJJJJJJJJJJ--0vs{qrs-SYNal`UNQRQ----[|zny-J-{|znyv r5zn@5z|qryZnv\x076-7-{|zny6H--0r{qvs--<<-JJJ-背面渲染-JJJ--0vs{qrs-SYNal`UNQRQ----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-Sv{ny]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------]|v{`v r-J-=;=H------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-Sv{ny]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------P|y|;\x07\b -J-P|y|;\x07\b -7-=;EH------\f----0r{qvs--0r{qvs--<<-JJJ-颜色增益调整-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNQWb`aZR[a6----rp@-uP|y|-J-to?u5P|y|6H----uP|y|;\b-8J-p|y|`nnv|{H----uP|y|; -8J-p|y|Ovtu{rH----0vs{qrs-SYNal`UNQRQ------rp@-vrQv-J-{|znyv r5v\\u|tn}uvp-L-PnzrnQvrpv|{-G-Sv{ny]|vv|{;\x07\b -:-pnzrn]|vv|{6H------<<-计算边缘增益------sy|n-p|aurn-J-q|5{|znyv r5[|zny69-vrQv6H------sy|n-n{tyr-J-np|5p|aurn6H------sy|n-|yv{rSnp|-J-}|5>;=-:-no5n{tyr-:-]VlUNYS6-<-]VlUNYS9-B;=6H------uP|y|; -8J-|yv{rTnv{-7-|yv{rSnp|H-<<-增加亮度------uP|y|; -J-pynz}5uP|y|; 9-=;=9->;=6H------<<-距离增益------rp@-o|{qv{tPr{r-J-5z|qryO|{qv{tZn\x07-8-z|qryO|{qv{tZv{6-<-?;=H------sy|n-o|{qv{tYr{tu-J-yr{tu5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6-7->;BH------sy|n-nrntrQvn{pr-J->=;=H-<<-设定一个平均距离------rp@-pnzrna|]|v{-J-Sv{ny]|vv|{;\x07\b -:-pnzrn]|vv|{H------sy|n-pnzrnO|{qv{tQvn{pr-J-zn\x075=;=9-yr{tu5pnzrn]|vv|{-:-o|{qv{tPr{r6-:-o|{qv{tYr{tu-<-?;=6H------sy|n-pnzrnQvn{pr-J-yr{tu5v\\u|tn}uvp-L-vrQv-7-q|5vrQv9-pnzrna|]|v{6-G-pnzrna|]|v{6-:-pnzrnO|{qv{tQvn{prH------sy|n-qvn{prSnp|-J-pynz}5zn\x075pnzrnQvn{pr-:-nrntrQvn{pr9-=;=6-<-o|{qv{tYr{tu9-=;=9->;=6H------qvn{prSnp|-J-5=;E-:-pynz}5>;=-:-}|5>;=-:-qvn{prSnp|9-@;=69-=;=9->;=66-7->?;=H------uP|y|; -8J-zv\x075uP|y|; -7-qvn{prTnv{-7-qvn{prSnp|9-=;=9-|yv{rSnp|6H-<<-增加透明度------uP|y|; -J-pynz}5uP|y|; 9-=;=9->;=6H----0r{qvs----P|y|-J-zn\x075u?to5uP|y|69-=;=6H--0r{qvs--<<-JJJJJJJJJJJJJJJJJJ--0vs-qrsv{rq5b`RlU^lQR]aU6----<<-sy|n-}|wSnp|-J-:=;B-7-r|yv|{;\b-<-5n{5s|-<-?;=6-7-z]|vv|{; 6H----<<-sy|n-_nqv-J-rny]|v{`v r-<-}|wSnp|H----sy|n-|vtv{nyQr}u-J-tyl]|vv|{;H----sy|n-nqwrqQr}u-J-|vtv{nyQr}u-8-=;>H----sy|n-nqw-J-nqwrqQr}u-<-|vtv{nyQr}uH----z]|vv|{;\x07\b -J-z]|vv|{;\x07\b -7-nqwH----tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--0r{qvs--_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----_||sZnx-J-z||ur}5_\\\\SlZN_X-:-ZN_Xl`aR]9-_\\\\SlZN_X9-lsrnrlvqlznx6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f");var scratchViewport$4=new THREE__namespace.Vector4,pbmUniforms={pointScale:new Uniform(1),pointMinPixel:new Uniform(1),pointMaxPixel:new Uniform(1),modelAlpha:new Uniform(1),gradientTexture:new Uniform(null),clippers:new Uniform([]),shownFloorIndex:new Uniform(-1),constantColor:new Uniform(new THREE__namespace.Vector3),floorIndex:new Uniform(0),brightness:new Uniform(1),colorSaturation:new Uniform(0),colorBrightness:new Uniform(0),outlineGain:new Uniform(0),distanceGain:new Uniform(0),pixelRatio:new Uniform(1),resolution:new Uniform(new THREE__namespace.Vector2(512,512)),modelBoundingMin:new Uniform(new THREE__namespace.Vector3),modelBoundingMax:new Uniform(new THREE__namespace.Vector3)},shaderLib={pointcloud:{vertexShader:pointCloudVertexShader,fragmentShader:pointCloudFragmentShader}},uniformsLib=mergeUniforms({opacity:{value:1}},pbmUniforms),definesLib={USE_OPAQUE:!1,USE_VERTEX_MARK:!1,USE_COLOR_CONSTANT:!1,USE_COLOR_ALTITUDE:!1,USE_COLOR_ADJUSTMENT:!1,USE_FLOOR_STYLE_VISIBILITY:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1},PBMPointCloudMaterial=(function(n){__extends(t,n);function t(e){var r=n.call(this)||this;r.shaderType="pointcloud",r.clipping=!0,r.customShaders=[],r.vertexColors=!0,r.type="PBMPointCloudMaterial";var o=Object.assign({},definesLib),s=cloneUniforms(uniformsLib);toFastProperties(s),toFastProperties(o),r.defines=o,r.onBeforeCompile=function(c,f){var p,d,h=r.shaderType;c.vertexShader=shaderLib[h].vertexShader,c.fragmentShader=shaderLib[h].fragmentShader,c.uniforms=s;for(var g=0,m=Object.keys(o);g<m.length;g++){var E=m[g];E in definesLib||(o[E]=void 0)}for(var y=0,v=Object.keys(s);y<v.length;y++){var A=v[y];A in uniformsLib||(s[A]=void 0)}for(var b=r.customShaders.filter(function(B){return B.type.includes(h)}),T=0,_=b;T<_.length;T++){var S=_[T];for(var w in S.uniforms)w in s||Object.assign(s,(p={},p[w]=S.uniforms[w],p));for(var R in S.defines)R in o||Object.assign(o,(d={},d[R]=S.defines[R],d))}toFastProperties(s),toFastProperties(o),c.vertexShader=c.vertexShader.replace(/MAIN_BEFORE/g,b.map(function(B){return B.vertex.mainBefore}).filter(function(B){return!!B}).join(`
398
398
  `)),c.vertexShader=c.vertexShader.replace(/MAIN_START/g,b.map(function(B){return B.vertex.mainStart}).filter(function(B){return!!B}).join(`
399
399
  `)),c.vertexShader=c.vertexShader.replace(/MAIN_END/g,b.map(function(B){return B.vertex.mainEnd}).filter(function(B){return!!B}).join(`
400
400
  `)),c.fragmentShader=c.fragmentShader.replace(/MAIN_BEFORE/g,b.map(function(B){return B.fragment.mainBefore}).filter(function(B){return!!B}).join(`
@@ -402,7 +402,7 @@
402
402
  `)),c.fragmentShader=c.fragmentShader.replace(/MAIN_END/g,b.map(function(B){return B.fragment.mainEnd}).filter(function(B){return!!B}).join(`
403
403
  `)),c.fragmentShader=c.fragmentShader.replace(/MAIN_MODEL_COLOR/g,b.map(function(B){return B.fragment.mainModelColor}).filter(function(B){return!!B}).join(`
404
404
  `));var I=String(r.clippers.length);c.vertexShader=c.vertexShader.replace(/NUM_CLIPPERS/g,I),c.fragmentShader=c.fragmentShader.replace(/NUM_CLIPPERS/g,I);for(var H=0,C=b;H<C.length;H++){var M=C[H];M.onBeforeCompile&&M.onBeforeCompile(c,f)}};var u="";r.onBeforeRender=function(c,f,p,d,h,g){var m=r.shaderType;p instanceof Camera?(s.pixelRatio.value=p.pixelRatio,s.resolution.value.copy(p.resolution)):(s.pixelRatio.value=c.getPixelRatio(),c.getViewport(scratchViewport$4),s.resolution.value.set(scratchViewport$4.width,scratchViewport$4.height));var E=r.transparent===!1&&r.blending===THREE__namespace.NormalBlending;o.USE_OPAQUE!==E&&(o.USE_OPAQUE=E,r.needsUpdate=!0);var y=r.customShaders.filter(function(A){return A.type.includes(m)}),v=y.map(function(A){return"".concat(A.id,":").concat(A.version)}).join("|");u!==v&&(u=v,r.needsUpdate=!0)},Object.defineProperty(r,"uniform",{configurable:!1,enumerable:!1,writable:!1,value:s}),defineProperty(r,"isPBMPointCloudMaterial",{configurable:!1,writable:!1,value:!0}),defineProperty(r,"isShaderMaterial",{configurable:!1,writable:!1,value:!0}),defineProperty(r,"opacity",{get:function(){return s.opacity.value},set:function(c){s.opacity.value=c}}),defineProperty(r,"vertexMarks",{get:function(){return!!o.USE_VERTEX_MARK},set:function(c){o.USE_VERTEX_MARK!==c&&(o.USE_VERTEX_MARK=c,this.needsUpdate=!0)}}),defineProperty(r,"pointScale",{get:function(){return s.pointScale.value},set:function(c){s.pointScale.value=c}}),defineProperty(r,"pointMinPixel",{get:function(){return s.pointMinPixel.value},set:function(c){s.pointMinPixel.value=c}}),defineProperty(r,"pointMaxPixel",{get:function(){return s.pointMinPixel.value},set:function(c){s.pointMaxPixel.value=c}}),defineProperty(r,"pointSize",{get:function(){return this.defines.USE_POINT_SIZE_ATTENUATION===!0?"ATTENUATION":"FIXED"},set:function(c){var f=c==="ATTENUATION";this.defines.USE_POINT_SIZE_ATTENUATION!==f&&(this.defines.USE_POINT_SIZE_ATTENUATION=f,this.needsUpdate=!0)}}),defineProperty(r,"pointShape",{get:function(){return this.defines.USE_POINT_SHAPE_CIRCLE===!0?"CIRCLE":"SQUARE"},set:function(c){var f=c==="CIRCLE";this.defines.USE_POINT_SHAPE_CIRCLE!==f&&(this.defines.USE_POINT_SHAPE_CIRCLE=f,this.needsUpdate=!0)}}),defineProperty(r,"pointBack",{get:function(){return this.defines.USE_POINT_BACK_HIDDEN===!0?"HIDDEN":this.defines.USE_POINT_BACK_DARK===!0?"DARK":"VISIBLE"},set:function(c){var f=c==="HIDDEN",p=c==="DARK";this.defines.USE_POINT_BACK_HIDDEN!==f&&(this.defines.USE_POINT_BACK_HIDDEN=f,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==p&&(this.defines.USE_POINT_BACK_DARK=p,this.needsUpdate=!0)}}),defineProperty(r,"modelAlpha",{get:function(){return s.modelAlpha.value},set:function(c){s.modelAlpha.value=c}}),defineProperty(r,"colorStyle",{get:function(){return o.USE_COLOR_CONSTANT?"CONSTANT":o.USE_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(c){var f=c==="CONSTANT",p=c==="ALTITUDE";o.USE_COLOR_CONSTANT!==f&&(o.USE_COLOR_CONSTANT=f,this.needsUpdate=!0),o.USE_COLOR_ALTITUDE!==p&&(o.USE_COLOR_ALTITUDE=p,this.needsUpdate=!0)}}),defineProperty(r,"constantColor",{get:function(){return s.constantColor.value},set:function(c){s.constantColor.value=c}}),defineProperty(r,"floorIndex",{get:function(){return s.floorIndex.value},set:function(c){s.floorIndex.value=c}}),defineProperty(r,"shownFloorIndex",{get:function(){return s.shownFloorIndex.value},set:function(c){s.shownFloorIndex.value=c}}),defineProperty(r,"floorStyle",{get:function(){return o.USE_FLOOR_STYLE_VISIBILITY?"VISIBILITY":"OPACITY"},set:function(c){var f=c==="VISIBILITY";o.USE_FLOOR_STYLE_VISIBILITY!==f&&(o.USE_FLOOR_STYLE_VISIBILITY=f,this.needsUpdate=!0)}}),defineProperty(r,"gradientTexture",{get:function(){return s.gradientTexture.value},set:function(c){s.gradientTexture.value=c}}),defineProperty(r,"brightness",{get:function(){return s.brightness.value},set:function(c){s.brightness.value=c}});var l=[];return defineProperty(r,"clippers",{get:function(){return l},set:function(c){l!==c&&(l=c,s.clippers.value=l.map(function(f){var p=typeof f.floorIndex=="number"?f.floorIndex:-1,d=new THREE__namespace.Matrix4().getInverse(f.clippingBoxMatrix);return{matrixInverse:d,floorIndex:p}}),this.needsUpdate=!0)}}),defineProperty(r,"colorSaturation",{get:function(){return s.colorSaturation.value},set:function(c){s.colorSaturation.value=c;var f=s.colorSaturation.value!==0||s.colorBrightness.value!==0||s.outlineGain.value!==0||s.distanceGain.value!==0;o.USE_COLOR_ADJUSTMENT!==f&&(o.USE_COLOR_ADJUSTMENT=f,this.needsUpdate=!0)}}),defineProperty(r,"colorBrightness",{get:function(){return s.colorBrightness.value},set:function(c){s.colorBrightness.value=c;var f=s.colorSaturation.value!==0||s.colorBrightness.value!==0||s.outlineGain.value!==0||s.distanceGain.value!==0;o.USE_COLOR_ADJUSTMENT!==f&&(o.USE_COLOR_ADJUSTMENT=f,this.needsUpdate=!0)}}),defineProperty(r,"outlineGain",{get:function(){return s.outlineGain.value},set:function(c){s.outlineGain.value=c;var f=s.colorSaturation.value!==0||s.colorBrightness.value!==0||s.outlineGain.value!==0||s.distanceGain.value!==0;o.USE_COLOR_ADJUSTMENT!==f&&(o.USE_COLOR_ADJUSTMENT=f,this.needsUpdate=!0)}}),defineProperty(r,"distanceGain",{get:function(){return s.distanceGain.value},set:function(c){s.distanceGain.value=c;var f=s.colorSaturation.value!==0||s.colorBrightness.value!==0||s.outlineGain.value!==0||s.distanceGain.value!==0;o.USE_COLOR_ADJUSTMENT!==f&&(o.USE_COLOR_ADJUSTMENT=f,this.needsUpdate=!0)}}),defineProperty(r,"useHQWeight",{get:function(){return o.USE_HQ_WEIGHT},set:function(c){c!==o.USE_HQ_WEIGHT&&(o.USE_HQ_WEIGHT=c,this.needsUpdate=!0)}}),defineProperty(r,"useHQDepth",{get:function(){return o.USE_HQ_DEPTH},set:function(c){c!==o.USE_HQ_DEPTH&&(o.USE_HQ_DEPTH=c,this.needsUpdate=!0)}}),defineProperty(r,"modelBoundingMin",{get:function(){return s.modelBoundingMin.value},set:function(c){s.modelBoundingMin.value=c}}),defineProperty(r,"modelBoundingMax",{get:function(){return s.modelBoundingMax.value},set:function(c){s.modelBoundingMax.value=c}}),typeof e=="object"&&r.setValues(e),toFastProperties(r),r}return t.prototype.copy=function(e){return n.prototype.copy.call(this,e),this.pointScale=e.pointScale,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.customShaders=e.customShaders,this.modelAlpha=e.modelAlpha,this.colorStyle=e.colorStyle,this.constantColor.copy(e.constantColor),this.floorIndex=e.floorIndex,this.shownFloorIndex=e.shownFloorIndex,this.floorStyle=e.floorStyle,this.gradientTexture=e.gradientTexture,this.brightness=e.brightness,this.clippers=e.clippers,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this.outlineGain=e.outlineGain,this.distanceGain=e.distanceGain,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.modelBoundingMin.copy(e.modelBoundingMin),this.modelBoundingMax.copy(e.modelBoundingMax),this},t.prototype.clone=function(){var e=this.constructor;return new e().copy(this)},t.prototype.refreshUniforms=function(){},t})(PBMMaterial),PBMPointCloud=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.onBeforeRender=function(s,u,l,c,f,p){f instanceof PBMPointCloudMaterial&&f.onBeforeRender&&f.onBeforeRender(s,u,l,c,o,p)},o}return t})(THREE__namespace.Points);const gradientDataURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAABCAYAAACouxZ2AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAAQAAAAB7UD0+AAACA0lEQVRIDXWUW3YjIQxEwdnV/GT/q8kO3FO3pAJst3PSAaR6Cbszf//9XeMxxpjXmI+pVXudp2s6PC4dqHff9e6D7/PZLy46xQvG+sZvrfK8xgXUeq85yINe9bdmtOK1+kun5vjgq58a+eZPna9jvmjiserqG/+Whathvo3L3WhV89L9sXI/m18z2uene9ap/ftsuT9WZxoHXzW56/fpj8l7+tTw7P011NdpqnY19sRsfuHMA9u8oZWfDz4+fra/dfG1V60ydZ7qba1g7UNAeK0JP7ydD7/OqH6wO2f7HTq+B/lbL9qsB3/N1/UzR81XfPzw4tp5OPvRneacteq8Xo0xR3vuv/kPz0KtX0Nhg0eHuaNXdWI3X/ld427h++vzyp99V6VPrzWFhbv4ayay4oFecm198MmUXN/mL+x7npq/uJXBGb/MTw4+t+SvbLoTZnUW5uHhz7nWcTxT73OwXV7cxT9wbBf/0LnDBgcnHmtPLYba32Hp808sMy1u88yhr58n70/v4xX92GSN19l/2UsqGmiH94Hpxjcs+DO/ccpIVNVp62PUWXu//ur1GQy1Cf+GZ13rtNYN1po3/NI79fGXibHkq4z25xvV2pW3szpneXsW8SsreTe/NIPrtXMnH7wPf+LEN6tqhUVHj3XKD/72p9eafCeYB3zuonnbv7yqP8d/o4K6gRb1wbYAAAAASUVORK5CYII=";function getValueKeys(n){return Object.keys(n)}function valueEqual(n,t){return n==t}function arrayValueEqual(n,t){if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(var e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}return n===t}function vector3Equal(n,t){return n instanceof THREE__namespace.Vector3&&t instanceof THREE__namespace.Vector3?n.equals(t):n===t}function box3Equal(n,t){return n instanceof THREE__namespace.Box3&&t instanceof THREE__namespace.Box3?n.equals(t):n===t}var parameterValueEqualFn={customShaders:arrayValueEqual,castShadow:valueEqual,receiveShadow:valueEqual,vertexMarks:valueEqual,pano0:valueEqual,pano1:valueEqual,pano0Depth:valueEqual,pano1Depth:valueEqual,refinedScreen:valueEqual,modelAlpha:valueEqual,progress:valueEqual,transition:valueEqual,opacity:valueEqual,floorStyle:valueEqual,colorStyle:valueEqual,constantColor:vector3Equal,shownFloorIndex:valueEqual,clippers:arrayValueEqual,brightness:valueEqual,useHQWeight:valueEqual,useHQDepth:valueEqual,pointShape:valueEqual,pointSize:valueEqual,pointBack:valueEqual,pointScale:valueEqual,pointMinPixel:valueEqual,pointMaxPixel:valueEqual,pointAppearAnimation:valueEqual,colorSaturation:valueEqual,colorBrightness:valueEqual,useAddBlend:valueEqual,outlineGain:valueEqual,distanceGain:valueEqual,gradientTexture:valueEqual,boundingBox:box3Equal,minLevelOfDetail:valueEqual,maxLevelOfDetail:valueEqual,minGeometricError:valueEqual,maxGeometricError:valueEqual,panoramaMinGeometricError:valueEqual,skipLevelOfDetail:valueEqual,mostDetail:valueEqual,loadSiblings:valueEqual,cameraCulling:valueEqual,maxMemoryUsage:valueEqual,maxRequests:valueEqual,requestOrder:valueEqual,maxScreenSpaceError:valueEqual,memoryAdjustedScreenSpaceError:valueEqual,cacheCameras:arrayValueEqual},defaultGradientTexture=(function(){var n;return typeof document!="undefined"?n=new THREE__namespace.TextureLoader().load(gradientDataURL):n=new THREE__namespace.Texture,n.minFilter=THREE__namespace.NearestFilter,n.magFilter=THREE__namespace.NearestFilter,n.wrapS=THREE__namespace.RepeatWrapping,n.wrapT=THREE__namespace.RepeatWrapping,n})(),defineConstantColor=Object.freeze(new THREE__namespace.Vector3(.6,.6,.6)),defineClippers=Object.freeze([]),defineBoundingBox=Object.freeze(new THREE__namespace.Box3),defineCustomShaders=Object.freeze([]),defineCacheCameras=Object.freeze([]);function createUndefindValue(){return{customShaders:void 0,castShadow:void 0,receiveShadow:void 0,vertexMarks:void 0,pano0:void 0,pano1:void 0,pano0Depth:void 0,pano1Depth:void 0,refinedScreen:void 0,floorStyle:void 0,colorStyle:void 0,constantColor:void 0,shownFloorIndex:void 0,modelAlpha:void 0,opacity:void 0,progress:void 0,transition:void 0,clippers:void 0,brightness:void 0,useHQWeight:void 0,useHQDepth:void 0,pointSize:void 0,pointBack:void 0,pointShape:void 0,pointScale:void 0,pointMaxPixel:void 0,pointMinPixel:void 0,pointAppearAnimation:void 0,gradientTexture:void 0,colorSaturation:void 0,colorBrightness:void 0,outlineGain:void 0,distanceGain:void 0,useAddBlend:void 0,boundingBox:void 0,minLevelOfDetail:void 0,maxLevelOfDetail:void 0,minGeometricError:void 0,maxGeometricError:void 0,panoramaMinGeometricError:void 0,skipLevelOfDetail:void 0,mostDetail:void 0,loadSiblings:void 0,cameraCulling:void 0,maxMemoryUsage:void 0,maxRequests:void 0,requestOrder:void 0,maxScreenSpaceError:void 0,memoryAdjustedScreenSpaceError:void 0,cacheCameras:void 0}}function createDefaultValue(){return{customShaders:defineCustomShaders,castShadow:!1,receiveShadow:!1,vertexMarks:!0,pano0:null,pano1:null,pano0Depth:null,pano1Depth:null,refinedScreen:null,floorStyle:"OPACITY",colorStyle:"RGB",constantColor:defineConstantColor,shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,transition:"FADE",clippers:defineClippers,brightness:1,useHQWeight:!1,useHQDepth:!1,pointSize:"ATTENUATION",pointBack:"DARK",pointShape:"CIRCLE",pointScale:.02,pointMaxPixel:40,pointMinPixel:0,pointAppearAnimation:!0,gradientTexture:defaultGradientTexture,colorSaturation:0,colorBrightness:0,outlineGain:0,distanceGain:0,useAddBlend:!1,boundingBox:defineBoundingBox,minLevelOfDetail:0,maxLevelOfDetail:20,minGeometricError:0,maxGeometricError:1e4,panoramaMinGeometricError:.04,skipLevelOfDetail:!1,mostDetail:!1,loadSiblings:!1,cameraCulling:!0,maxMemoryUsage:64,maxRequests:6,requestOrder:"SCREEN_SPACE_ERROR",maxScreenSpaceError:4,memoryAdjustedScreenSpaceError:!1,cacheCameras:defineCacheCameras}}var parameterKeys=getValueKeys(createUndefindValue());function assignValue(n,t,e){var r=parameterValueEqualFn[t];if(!r)return!1;Array.isArray(e)&&(e=e.slice());var o=n[t];return r(o,e)?!1:(n[t]=e,!0)}function copyValue(n,t,e){return assignValue(n,e,t[e])}var Parameter=(function(){function n(t){this.id=createUuid(),this.versionNumber=0,this.value=createUndefindValue(),t&&this.copy(t);for(var e=function(l){Object.defineProperty(r,l,{get:function(){return this.value[l]}})},r=this,o=0,s=parameterKeys;o<s.length;o++){var u=s[o];e(u)}toFastProperties(this)}return n.createDefault=function(){return createDefaultValue()},n.resolveValue=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=Object.assign(this.createDefault(),{versions:[],version:""}),o=0,s=t;o<s.length;o++){var u=s[o],l=u instanceof n?u.version:createUuid();r.versions.push(l);for(var c=0,f=parameterKeys;c<f.length;c++){var p=f[c];u[p]!==void 0&&copyValue(r,u,p)}}return r.version=r.versions.toString(),r},Object.defineProperty(n.prototype,"version",{get:function(){return"".concat(this.id,":").concat(this.versionNumber)},enumerable:!1,configurable:!0}),n.prototype.resolveValue=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.resolveValue.apply(n,__spreadArray(__spreadArray([],t,!1),[this],!1))},n.prototype.set=function(t,e){var r=!1;if(typeof t=="string"){if(e!==void 0){var o=assignValue(this.value,t,e);o&&(r=!0)}}else for(var s=t,u=0,l=parameterKeys;u<l.length;u++){var c=l[u];if(s[c]!==void 0){var o=copyValue(this.value,s,c);o&&(r=!0)}}return r&&this.versionNumber++,this},n.prototype.reset=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=!1,o=0,s=t;o<s.length;o++){var u=s[o],l=assignValue(this.value,u,void 0);l&&(r=!0)}return r&&this.versionNumber++,this},n.prototype.resetAll=function(){return this.reset.apply(this,parameterKeys)},n.prototype.copy=function(t){for(var e=!0,r=0,o=parameterKeys;r<o.length;r++){var s=o[r],u=copyValue(this.value,t,s);u&&(e=!0)}return e&&this.versionNumber++,this},n})(),PBMContainer=(function(n){__extends(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.parameter=new Parameter,e.needsRender=!0,e}return Object.defineProperty(t.prototype,"materialParameters",{get:function(){return this.parameter.resolveValue()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pbmMaterialParametersVersion",{get:function(){return this.parameter.resolveValue().version},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e),this.update(),this.needsRender=!0},t.prototype.getMaterial=function(){return this.parameter.resolveValue()},t.prototype.update=function(){var e=this.parameter.resolveValue();this.traverse(function(r){r instanceof PBMMesh||r instanceof PBMSkinnedMesh?updatePBMMesh$1(r,e):r instanceof PBMPointCloud&&updatePBMPointCloud$1(r,e)})},t})(THREE__namespace.Group);function updatePBMMesh$1(n,t){var e=n.material;n.castShadow=t.castShadow,n.receiveShadow=t.receiveShadow;for(var r=0,o=e;r<o.length;r++){var s=o[r];s.customShaders=t.customShaders,s.pano0=t.pano0,s.pano1=t.pano1,s.pano0Depth=t.pano0Depth,s.pano1Depth=t.pano1Depth,s.refinedScreen=t.refinedScreen,s.modelAlpha=t.modelAlpha,s.progress=t.progress,s.transition=t.transition,s.opacity=t.opacity,s.floorStyle=t.floorStyle,s.constantColor=t.constantColor,s.shownFloorIndex=t.shownFloorIndex,s.clippers=t.clippers,s.brightness=t.brightness,s.useHQWeight=t.useHQWeight,s.useHQDepth=t.useHQDepth,s.colorSaturation=t.colorSaturation,s.colorBrightness=t.colorBrightness,s.gradientTexture=t.gradientTexture,s.shaderType==="none"?(s.transparent=!0,s.blending=THREE__namespace.NormalBlending,s.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,s.blendEquation=THREE__namespace.AddEquation,s.blendSrcAlpha=null,s.blendDstAlpha=null,s.blendEquationAlpha=null,s.depthWrite=!1,s.depthTest=!0):(s.transparent=s.alphaMode==="BLEND",s.blending=THREE__namespace.NormalBlending,s.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,s.blendEquation=THREE__namespace.AddEquation,s.blendSrcAlpha=null,s.blendDstAlpha=null,s.blendEquationAlpha=null,s.depthWrite=!0,s.depthTest=!0,t.useAddBlend&&(s.depthWrite=!1,s.depthTest=!1,s.blending=THREE__namespace.AdditiveBlending),s.shownFloorIndex>-1&&s.shownFloorIndex!==s.floorIndex&&(s.transparent=!0),s.opacity<1&&(s.transparent=!0),s.alphaMap&&(s.transparent=!0),s.brightness<1&&(s.transparent=!0),t.useAddBlend&&(s.depthWrite=!1,s.depthTest=!1,s.blending=THREE__namespace.AdditiveBlending))}}function updatePBMPointCloud$1(n,t){var e=[n.material];n.castShadow=t.castShadow,n.receiveShadow=t.receiveShadow;for(var r=0,o=e;r<o.length;r++){var s=o[r];s.customShaders=t.customShaders,s.pointScale=t.pointScale,s.pointMinPixel=t.pointMinPixel,s.pointMaxPixel=t.pointMaxPixel,s.pointSize=t.pointSize,s.pointShape=t.pointShape,s.pointBack=t.pointBack,s.modelAlpha=t.modelAlpha,s.opacity=t.opacity,s.floorStyle=t.floorStyle,s.constantColor=t.constantColor,s.shownFloorIndex=t.shownFloorIndex,s.clippers=t.clippers,s.brightness=t.brightness,s.useHQWeight=t.useHQWeight,s.useHQDepth=t.useHQDepth,s.colorSaturation=t.colorSaturation,s.colorBrightness=t.colorBrightness,s.outlineGain=t.outlineGain,s.distanceGain=t.distanceGain,s.gradientTexture=t.gradientTexture,s.transparent=!1,s.blending=THREE__namespace.NormalBlending,s.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,s.blendEquation=THREE__namespace.AddEquation,s.blendSrcAlpha=null,s.blendDstAlpha=null,s.blendEquationAlpha=null,s.depthWrite=!0,s.depthTest=!0,s.shownFloorIndex>-1&&(s.transparent=s.shownFloorIndex!==s.floorIndex),s.modelAlpha<1&&(s.transparent=!0),s.opacity<1&&(s.transparent=!0),s.brightness<1&&(s.transparent=!0),t.useAddBlend&&(s.depthWrite=!1,s.depthTest=!1,s.blending=THREE__namespace.AdditiveBlending),s.useHQWeight&&(s.depthWrite=!1,s.blending=THREE__namespace.CustomBlending,s.blendSrc=THREE__namespace.SrcAlphaFactor,s.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,s.blendDst=THREE__namespace.OneFactor,s.blendDstAlpha=THREE__namespace.OneFactor)}}var ROTATE_X_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),ROTATE_X_MATRIX_INVERSE=new THREE__namespace.Matrix4().getInverse(ROTATE_X_MATRIX);function createSymbol(n){return typeof Symbol=="undefined"?"$Symbol<".concat(n,">$"):Symbol(n)}var EVENT_SYMBOL=createSymbol("$$FIVE_EVENT$$");function __generateEventIfNotExisted(n){return n[EVENT_SYMBOL]||(n[EVENT_SYMBOL]={}),n[EVENT_SYMBOL]}function __removeEvents(n){n[EVENT_SYMBOL]&&delete n[EVENT_SYMBOL]}var Subscribe=(function(){function n(){}return n.prototype.hasListener=function(t){var e=__generateEventIfNotExisted(this);return e&&e[t]&&e[t].callbacks.length>0},n.prototype.on=function(t,e,r){var o=this,s=__generateEventIfNotExisted(this);return s[t]||(s[t]={callbacks:[]}),s[t].callbacks.push([e,r||!1]),function(){return o.off(t,e)}},n.prototype.once=function(t,e){return this.on(t,e,!0)},n.prototype.off=function(t,e){if(t===void 0){__removeEvents(this);return}var r=__generateEventIfNotExisted(this);if(r[t]||(r[t]={callbacks:[]}),e===void 0){r[t].callbacks.length=0;return}for(var o=0;o<r[t].callbacks.length&&r[t].callbacks[o][0]!==e;o++);o<r[t].callbacks.length&&r[t].callbacks.splice(o,1)},n.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var o=!1,s=__generateEventIfNotExisted(this);s[t]||(s[t]={callbacks:[]});for(var u=s[t].callbacks.slice(),l=0,c=u;l<c.length;l++){var f=c[l],p=f[0],d=f[1],h=d===void 0?!1:d,g=p.apply(void 0,e);h&&this.off(t,p),g===!1&&(o=!0)}return o},n.prototype.waitUntil=function(t,e){var r=this;return new Promise(function(o){var s=r.on(t,function(){for(var u=[],l=0;l<arguments.length;l++)u[l]=arguments[l];(!e||e.apply(void 0,u)!==!1)&&(o(u),s())})})},n})();function noop(){}var JSONP_REGEXPS=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],locationHref=typeof location!="undefined"?location.href:"",locationIsHttps=/^https\:/.test(locationHref),NetworkProxyError=(function(n){__extends(t,n);function t(e,r,o){return n.call(this,"[NETWORK]: request proxy error(type: ".concat(r,", reason: ").concat(o,"): ").concat(e))||this}return t})(Error),NetworkResponseError=(function(n){__extends(t,n);function t(e,r,o){var s=n.call(this,"[NETWORK]: response error(type: ".concat(r,", status: ").concat(o,"): ").concat(e))||this;return s.httpStatus=o,s}return t})(Error);(function(n){__extends(t,n);function t(e,r){return n.call(this,"[NETWORK]: request abort(type: ".concat(r,"): ").concat(e))||this}return t})(Error);var NetworkTimeoutError=(function(n){__extends(t,n);function t(e,r,o){return n.call(this,"[NETWORK]: request timeout(type: ".concat(r,", timeout: ").concat(o,"ms): ").concat(e))||this}return t})(Error);(function(n){__extends(t,n);function t(e,r,o){return n.call(this,"[NETWORK]: request forbidden(type: ".concat(r,", reason: ").concat(o,"): ").concat(e))||this}return t})(Error);function parseHeaders(n){if(!n)return{};for(var t={},e=n.trim().split(`
405
- `),r=0;r<e.length;r++){var o=e[r],s=o.indexOf(":"),u=o.slice(0,s).trim().toLowerCase(),l=o.slice(s+1).trim();l&&(t[u]?t[u]+=", "+l:t[u]=l)}return t}function matchJsonpFunctionName(n){for(var t=0,e=JSONP_REGEXPS;t<e.length;t++){var r=e[t],o=n.match(r);if(o)return"jsonp_"+o[1]}return null}function isJsonp(n){return matchJsonpFunctionName(n)!==null}var NetworkSubscribe=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t})(Subscribe);function ajax(n,t,e,r,o){t===void 0&&(t={}),e===void 0&&(e=noop),r===void 0&&(r=noop),o===void 0&&(o=noop);var s=now(),u=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(l){return locationIsHttps&&/^http\:/.test(l)?(console.warn("The page at '".concat(locationHref,"' was loaded over HTTPS, but requested an insecure element '").concat(l,"'. This request was automatically upgraded to HTTPS")),l.replace(/^http\:/,"https:")):l}).catch(function(l){var c;matchJsonpFunctionName(n);var f=new NetworkProxyError(u,"XMLHttpRequest",l&&l.message?String(l.message):String(l));return(c=t.networkSubscribe)===null||c===void 0||c.emit("network",n,"XMLHttpRequest","forbidden",f.message),Promise.reject(f)}).then(function(l){return new Promise(function(c,f){var p=matchJsonpFunctionName(l);if(p){var d=window,h=null,g=!1,m=document.createElement("script"),E=function(){var R;if(h=null,g!==!0){g=!0;var I=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(I),f(I),(R=t.networkSubscribe)===null||R===void 0||R.emit("network",l,"XMLHttpRequest","timeout",I.message)}},y=function(R){var I,H,C=now(),M=C-s;if(delete d[p],m.parentNode&&m.parentNode.removeChild(m),h!==null&&(window.clearTimeout(h),h=null),g!==!0){if(R.indexOf("data:")!==0){var B=new NetworkResponseError(l,"XMLHttpRequest",500);r(B),f(B),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"XMLHttpRequest","error",B.message);return}var L=R.split(","),O=(L[0].match(/:(.*?);/)||[])[1],k=L[1];if(t.responseType==="arraybuffer"||t.responseType==="blob"){for(var D=atob(L[1]),q=D.length,z=new Uint8Array(q),V=0;V<q;V++)z[V]=D.charCodeAt(V);t.responseType==="arraybuffer"?k=z.buffer:k=new Blob([z],{type:O})}var Q={},U={body:k,meta:{origin:u,source:l,requestTime:s,responseTime:C,costs:M,headers:Q}};e(U),c(U),(H=t.networkSubscribe)===null||H===void 0||H.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(U.meta)),g=!0}};d[p]=y,m.src=l,document.body.appendChild(m),typeof t.timeout=="number"&&(h=window.setTimeout(E,t.timeout))}else{var v=!1,A=new XMLHttpRequest,b=function(){A&&(A.removeEventListener("timeout",T,!1),A.removeEventListener("progress",_,!1),A.removeEventListener("load",S,!1),A.removeEventListener("error",w,!1)),A=null,b=noop},T=function(){var R;if(v!==!0){v=!0,b();var I=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(I),f(I),(R=t.networkSubscribe)===null||R===void 0||R.emit("network",l,"XMLHttpRequest","timeout",I.message)}},_=function(R){v!==!0&&R.lengthComputable&&(R.total<=0||o(R.loaded/R.total))},S=function(R){var I;if(v!==!0){var H=this.status;if(H===0||H>=200&&H<400){v=!0,b();var C=now(),M=C-s,B=parseHeaders(this.getAllResponseHeaders()),L=R.total,O={body:this.response,meta:{origin:u,source:l,requestTime:s,responseTime:C,costs:M,headers:B,size:L}};e(O),c(O),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(O.meta))}else w.call(this)}},w=function(){var R;if(v!==!0){v=!0,b();var I=new NetworkResponseError(l,"XMLHttpRequest",this.status);r(I),f(I),(R=t.networkSubscribe)===null||R===void 0||R.emit("network",l,"XMLHttpRequest","error",I.message)}};A.addEventListener("timeout",T,!1),A.addEventListener("progress",_,!1),A.addEventListener("load",S,!1),A.addEventListener("error",w,!1),t.responseType&&(A.responseType=t.responseType),typeof t.timeout=="number"&&(A.timeout=t.timeout),A.open("GET",l,!0),A.send(null)}})})}var preloadCache={};function preload(n,t){t===void 0&&(t={});var e=now(),r=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(o){return locationIsHttps&&/^http\:/.test(o)?(console.warn("The page at '".concat(locationHref,"' was loaded over HTTPS, but requested an insecure element '").concat(o,"'. This request was automatically upgraded to HTTPS")),o.replace(/^http\:/,"https:")):o}).catch(function(o){var s,u=new NetworkProxyError(r,"Link",o&&o.message?String(o.message):String(o));return(s=t.networkSubscribe)===null||s===void 0||s.emit("network",n,"Link","forbidden",u.message),Promise.reject(u)}).then(function(o){return o in preloadCache?preloadCache[o]:preloadCache[o]=new Promise(function(s,u){var l=document.head||document.getElementsByTagName("head")[0],c=document.createElement("link"),f=!1,p=null;c.onload=function(d){var h;if(p!==null&&(clearTimeout(p),p=null),f!==!0){f=!0,s(),c.onerror=noop,c.onload=noop;var g=now(),m=g-e,E={},y={origin:r,source:o,requestTime:e,responseTime:g,costs:m,headers:E};(h=t.networkSubscribe)===null||h===void 0||h.emit("network",o,"Link","preload",JSON.stringify(y))}},c.onerror=function(d){var h;if(p!==null&&(clearTimeout(p),p=null),f!==!0){f=!0,delete preloadCache[o],l&&c.parentNode===l&&l.removeChild(c);var g=new NetworkResponseError(o,"Link",0);u(g),c.onerror=noop,c.onload=noop,(h=t.networkSubscribe)===null||h===void 0||h.emit("network",o,"Link","error",g.message)}},typeof t.timeout=="number"&&(p=window.setTimeout(function(){var d;if(p=null,f!==!0){f=!0,s(),c.onerror=noop,c.onload=noop;var h=now(),g=h-e,m={},E={origin:r,source:o,requestTime:e,responseTime:h,costs:g,headers:m};(d=t.networkSubscribe)===null||d===void 0||d.emit("network",o,"Link","timeout",JSON.stringify(E))}},t.timeout)),c.rel=c.relList&&c.relList.supports("prefetch")?"prefetch":"preload",c.as="fetch",c.crossOrigin="",c.fetchPriority="high",c.href=o,l&&l.appendChild(c)})})}function loadImage(n,t,e,r,o,s){t===void 0&&(t={}),e===void 0&&(e=noop),r===void 0&&(r=noop),o===void 0&&(o=noop);var u=now(),l=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(c){return locationIsHttps&&/^http\:/.test(c)?(console.warn("The page at '".concat(locationHref,"' was loaded over HTTPS, but requested an insecure element '").concat(c,"'. This request was automatically upgraded to HTTPS")),c.replace(/^http\:/,"https:")):c}).catch(function(c){var f,p=new NetworkProxyError(l,"Image",c&&c.message?String(c.message):String(c));return(f=t.networkSubscribe)===null||f===void 0||f.emit("network",n,"Image","forbidden",p.message),Promise.reject(p)}).then(function(c){return isJsonp(c)?ajax(c,{responseType:"blob",networkSubscribe:t.networkSubscribe}).then(function(f){return URL.createObjectURL(f.body)}):c}).then(function(c){return new Promise(function(f,p){var d=s!=null?s:new Image,h=!1,g=null,m=function(){var y;if(d.onload=noop,d.onerror=noop,g!==null&&(clearTimeout(g),g=null),h!==!0){var v=now(),A={headers:{},origin:l,source:c,requestTime:u,responseTime:v,costs:v-u};h=!0;var b={body:d,meta:A};o(1),e(b),f(b),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","ok",JSON.stringify(b.meta))}},E=function(){var y;if(d.onload=noop,d.onerror=noop,g!==null&&(clearTimeout(g),g=null),h!==!0){h=!0;var v=new NetworkResponseError(c,"Image",0);r(v),p(v),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","ok",v.message)}};typeof t.timeout=="number"&&(g=window.setTimeout(function(){var y;if(d.onload=noop,d.onerror=noop,g=null,h!==!0){h=!0;var v=new NetworkTimeoutError(c,"Image",t.timeout);r(v),p(v),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","timeout",v.message)}},t.timeout)),d.onload=m,d.onerror=E,o(0),d.src=c})})}var Fetcher=(function(){function n(t){t===void 0&&(t={}),this.options=t}return n.prototype.ajax=function(t,e,r,o,s){var u;e===void 0&&(e={}),r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);var l=this.options,c={responseType:e.responseType,timeout:(u=e.timeout)!==null&&u!==void 0?u:l.timeout,get requestProxy(){var f;return(f=e.requestProxy)!==null&&f!==void 0?f:l.requestProxy},get networkSubscribe(){var f;return(f=e.networkSubscribe)!==null&&f!==void 0?f:l.networkSubscribe}};return ajax(t,c,r,o,s)},n.prototype.loadImage=function(t,e,r,o,s,u){var l;e===void 0&&(e={}),r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);var c=this.options,f={timeout:(l=e.timeout)!==null&&l!==void 0?l:c.timeout,get requestProxy(){var p;return(p=e.requestProxy)!==null&&p!==void 0?p:c.requestProxy},get networkSubscribe(){var p;return(p=e.networkSubscribe)!==null&&p!==void 0?p:c.networkSubscribe}};return loadImage(t,f,r,o,s,u)},n.prototype.preload=function(t,e){var r;e===void 0&&(e={});var o=this.options,s={timeout:(r=e.timeout)!==null&&r!==void 0?r:o.timeout,get requestProxy(){var u;return(u=e.requestProxy)!==null&&u!==void 0?u:o.requestProxy},get networkSubscribe(){var u;return(u=e.networkSubscribe)!==null&&u!==void 0?u:o.networkSubscribe}};return preload(t,s)},n})(),internalFetcher=new Fetcher;function pick(n,t){for(var e={},r=0,o=t;r<o.length;r++){var s=o[r];s in n&&(e[s]=n[s])}return e}function omit(n,t){for(var e={},r=new Set(t),o=0,s=Object.keys(n);o<s.length;o++){var u=s[o];r.has(u)||(e[u]=n[u])}return e}function omitUndefinedFields(n){var t={};for(var e in n){var r=n[e];r!==void 0&&(t[e]=r)}return t}var hrefAElement=typeof document!="undefined"?document.createElement("a"):{href:""};function isAbsoluteURL(n){return n.indexOf("/")===0||/^[0-9a-z]+\:/i.test(n)}function getFullURL(n){if(typeof URL!="undefined"&&typeof location!="undefined")return new URL(n,location.href).href;hrefAElement.href=n;var t=hrefAElement.href;return hrefAElement.href="",t}function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(l){return(l!=null?l:"").trim()}).filter(function(l){return l.length>0&&!/^\/+$/.test(l)});for(var r=0;r<n.length;r++){var o=r===0,s=r===n.length-1,u=n[r];o||(u=u.replace(/^\.\//,"").replace(/^\/+/,"")),s||(u=u.replace(/\/+$/,"")),e.push(u)}return e.join("/")}function appendSearch(n,t){if(t===void 0&&(t=""),(t[0]==="?"||t[0]==="&")&&(t=t.slice(1)),!t)return n;var e=n.indexOf("#"),r="";return e>=0&&(r=n.slice(e),n=n.slice(0,e)),(n[n.length-1]==="?"||n[n.length-1]==="&")&&(n=n.slice(0,-1)),n.indexOf("?")>=0?"".concat(n,"&").concat(t).concat(r):"".concat(n,"?").concat(t).concat(r)}function normalizeURL(n){var t,e=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(n);if(!e)return n;var r=e[1]||"",o=n.slice(r.length+2),s=o.indexOf("#");s>=0&&(n.slice(s),o=n.slice(0,s));var u=o.indexOf("?");u>=0&&(n.slice(u),o=n.slice(0,u));for(var l=o.split("/"),c=l.shift(),f=(t=l.pop())!==null&&t!==void 0?t:"",p=[],d=0,h=l;d<h.length;d++){var g=h[d];if(!(g===""||g===".")){if(g===".."){p.pop();continue}p.push(g)}}return r+"//"+c+"/"+p.join("/")+"/"+f}function getExtname(n){var t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(n);if(t){var e=String(t[1]).trim().split(".").slice(1).reverse()[0];if(e)return"."+e}return""}var webp="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAIAAUAmJaQAA3AA/vz0AAA=",avif="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAGhbWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAsaWxvYwAAAABEAAACAAEAAAABAAAB3gAAABkAAgAAAAEAAAHJAAAAFQAAAEJpaW5mAAAAAAACAAAAGmluZmUCAAAAAAEAAGF2MDFDb2xvcgAAAAAaaW5mZQIAAAAAAgAAYXYwMUFscGhhAAAAABppcmVmAAAAAAAAAA5hdXhsAAIAAQABAAAA12lwcnAAAACxaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIAAoAAAAAUaXNwZQAAAAAAAAACAAAAAgAAAA5waXhpAAAAAAEIAAAADGF2MUOBABwAAAAAOGF1eEMAAAAAdXJuOm1wZWc6bXBlZ0I6Y2ljcDpzeXN0ZW1zOmF1eGlsaWFyeTphbHBoYQAAAAAeaXBtYQAAAAAAAAACAAEEAQKDBAACBAUGhwgAAAA2bWRhdBIACgQYADLVMgsWQBhhIAQqrNj/+BIACgUYADLEoDIOFkADDDDCQAACDaqCCb4=",heif="data:image/heif;base64,AAAAGGZ0eXBoZWljAAAAAG1pZjFoZWljAAABL21ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAHBpY3QAAAAAAAAAAAAAAAAAAAAADnBpdG0AAAAAAAEAAAAjaWluZgAAAAAAAQAAABVpbmZlAgAAAAABAABodmMxAAAAAK9pcHJwAAAAkmlwY28AAAB2aHZjQwEBYAAAAAAAAAAAAADwAPz9+PgAACcDoAABAB5AAQwG//8BYAAAAwAAAwAAAwAAAwAAAwAAreTLgSChAAEAI0IBBwFgAAADAAADAAADAAADAAADAAChInJJlreTLySZNdggogABAAdEAcA98DMkAAAAFGlzcGUAAAAAAAAAAgAAAAIAAAAVaXBtYQAAAAAAAAABAAECgQIAAAAiaWxvYwAAAABEQAABAAEAAAAAAU8AAQAAAAAAAAAOAAAAFm1kYXQAAAAKJgGvLvkQwuWM4A==";function checkImage(n){return new Promise(function(t){if(typeof Image=="undefined"){t(!1);return}var e=new Image,r=setTimeout(function(){e.onload=e.onerror=function(){},clearTimeout(r),t(!1)},100);e.onload=e.onerror=function(){e.onload=e.onerror=function(){},clearTimeout(r),t(e.height===2)},e.src=n})}var imageSupportCache=null;function imageSupport(){return imageSupportCache||(imageSupportCache=Promise.all([checkImage(webp),checkImage(avif),checkImage(heif)]).then(function(n){return{webp:n[0],avif:n[1],heif:n[2]}}))}var _a$5,supportAvif=!1,supportWebp=!1,supportHeif=!1;imageSupport().then(function(n){supportAvif=n.avif,supportWebp=n.webp,supportHeif=n.heif});var IMAGE_FORMATS=["jpg","jpeg","png","heif","heic","webp","avif"];function isImageExt(n){return IMAGE_FORMATS.indexOf(n)>=0}var DEFAULT_IMAGE_URL_MAPPINGS={"vrlab-public.ljcdn.com":{type:"tencentCloud",pano:["vrlab-image1.ljcdn.com","vrlab-image2.ljcdn.com"],texture:["vrlab-image3.ljcdn.com"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["vr-image-1.realsee-cdn.cn","vr-image-2.realsee-cdn.cn"],texture:["vr-image-3.realsee-cdn.cn"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"vr-public.rscdn.cn":{type:"tencentCloud",pano:["vr-image-1.rscdn.cn","vr-image-2.rscdn.cn"],texture:["vr-image-3.rscdn.cn"],tile:["vr-tile-1.rscdn.cn","vr-tile-2.rscdn.cn"],model:["vr-model-1.rscdn.cn","vr-model-2.rscdn.cn"],default:["vr-image-4.rscdn.cn"]},"mars-public.realsee-cdn.cn":{type:"aliyun",pano:["mars-image-1.realsee-cdn.cn","mars-image-2.realsee-cdn.cn"],texture:["mars-image-3.realsee-cdn.cn"],tile:["mars-tile-1.realsee-cdn.cn","mars-tile-2.realsee-cdn.cn"],model:["mars-model-1.realsee-cdn.cn","mars-model-2.realsee-cdn.cn"],default:["mars-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{type:"tencentCloud",pano:["global-image-1.realsee-cdn.com","global-image-2.realsee-cdn.com"],texture:["global-image-3.realsee-cdn.com"],tile:["global-tile-1.realsee-cdn.com","global-tile-2.realsee-cdn.com"],model:["global-model-1.realsee-cdn.com","global-model-2.realsee-cdn.com"],default:["global-image-4.realsee-cdn.com"]},"earth-ga-public.realsee-cdn.cn":{type:"tencentCloud",pano:["earth-ga-image-1.realsee-cdn.cn","earth-ga-image-2.realsee-cdn.cn"],texture:["earth-ga-image-3.realsee-cdn.cn"],tile:["earth-ga-tile-1.realsee-cdn.cn","earth-ga-tile-2.realsee-cdn.cn"],model:["earth-ga-model-1.realsee-cdn.cn","earth-ga-model-2.realsee-cdn.cn"],default:["earth-ga-image-4.realsee-cdn.cn"]},"test-vr-public.realsee-cdn.com":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],texture:["test-vr-image.realsee-cdn.com"],tile:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],model:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],texture:["test-vr-image.realsee-cdn.cn"],tile:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],model:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],default:["test-vr-image.realsee-cdn.cn"]}},URL_DOMAIN_REGEX=/^https?\:\/\/?([^\/]+)/;function getDomain(n){var t=n.match(URL_DOMAIN_REGEX);return t===null?null:t[1]}function replaceDomain(n,t,e){var r,o,s=(o=(r=t[e])!==null&&r!==void 0?r:t[t.length-1])!==null&&o!==void 0?o:n;return n.replace(URL_DOMAIN_REGEX,function(u,l){return u.slice(0,u.length-l.length)+s})}function route(n,t,e){var r=t.split("."),o=r[0],s=r.slice(1);if(o==="texture")return replaceDomain(n,e.texture,0);if(o==="pano"){s[0];var u=s[1];switch(u){case"front":case"left":case"up":return replaceDomain(n,e.pano,0);case"down":case"right":case"back":return replaceDomain(n,e.pano,1)}}else if(o==="pano_tile"){s[0],s[1];var l=s[2],c=s[3],f=s[4],p=Math.pow(2,Number(l))*Number(c)+Number(f);if(!isNaN(p))return replaceDomain(n,e.tile,p%2)}else if(o==="model"){var d=s[0],p=Number(d);if(!isNaN(p))return replaceDomain(n,e.model,p%2)}return replaceDomain(n,e.default,0)}var tencentCloudImageProcesser=function(n,t){var e=n.split("?")[0],r=e.split(".").pop();if(r==="jpeg"&&(r="jpg"),r==="heif"&&(r="heic"),r&&!isImageExt(r))return n;var o=[],s=t.format,u=t.cut,l=t.quality,c=t.size,f=t.sharpen,p=t.forceUseExifOrientation;if(s==="jpeg"&&(s="jpg"),s==="heif"&&(s="heic"),(!supportAvif&&(s!=null?s:r)==="avif"||!supportWebp&&(s!=null?s:r)==="webp"||!supportHeif&&(s!=null?s:r)==="heic")&&(s="jpg"),s!==void 0&&s!==r&&o.push("format/".concat(s)),u!==void 0&&o.push("cut/".concat(u[2],"x").concat(u[3],"x").concat(u[0],"x").concat(u[1])),l!==void 0){var d=s!=null?s:r;d&&["jpg","webp","heic","avif"].indexOf(d)>=0&&o.push("quality/".concat(l))}if(c!==void 0){var h=n.match(/\/cube_(\d+)\//),g=h?Number(h[1]):NaN;g!==Number(c)&&o.push("thumbnail/".concat(c,"x"))}f!==void 0&&o.push("sharpen/".concat(f)),p===!0&&o.push("auto-orient");var m="";return o.length&&(m="?imageMogr2/"+o.join("/")),e+m},aliyunOOSImageProcesser=function(n,t){var e=n.split("?")[0],r=e.split(".").pop();if(r==="jpeg"&&(r="jpg"),r==="heif"&&(r="heic"),r&&!isImageExt(r))return n;var o=[],s=t.format,u=t.cut,l=t.quality,c=t.size,f=t.sharpen;if(s==="jpeg"&&(s="jpg"),s==="heif"&&(s="heic"),(!supportAvif&&(s!=null?s:r)==="avif"||!supportWebp&&(s!=null?s:r)==="webp"||!supportHeif&&(s!=null?s:r)==="heic")&&(s="jpg"),s!==void 0&&s!==r&&o.push("format,".concat(s)),u!==void 0){var p=u[0],d=u[1],h=u[2],g=u[3];o.push("crop,x_".concat(p,",y_").concat(d,",w_").concat(h,",h_").concat(g,",g_nw"))}if(l!==void 0&&l!==100){var m=s!=null?s:r;m&&["jpg","webp","heic","avif"].indexOf(m)>=0&&o.push("quality,Q_".concat(l))}c&&c!==2048&&o.push("resize,w_".concat(c)),f!==void 0&&o.push("sharpen,".concat(f));var E="";return o.length&&(E="?x-oss-process=image/"+o.join("/")),e+E},MAX_SAFE_INTEGER=9007199254740991;function formatNumber(n){var t=Math.round(n);return Math.abs(t-n)<.001?t:Math.floor(n)}function formatOptions(n){return n=Object.assign({},n),n.size!==void 0&&(n.size=formatNumber(clamp$1(n.size,0,MAX_SAFE_INTEGER))),n.quality!==void 0&&(n.quality=formatNumber(clamp$1(n.quality,0,100))),n.cut!==void 0&&(n.cut=[formatNumber(clamp$1(n.cut[0],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[1],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[2],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[3],0,MAX_SAFE_INTEGER))]),n.sharpen!==void 0&&(n.sharpen=formatNumber(clamp$1(n.sharpen,0,MAX_SAFE_INTEGER))),n}function imageURL(n,t){var e=__assign(__assign({},DEFAULT_IMAGE_URL_MAPPINGS),t.mappings),r=getDomain(n);if(r===null)return n;t=formatOptions(t);var o=e[r];return o?(n=route(n,t.key,o),/\.basis(\?|$)/.test(n)&&(n=n.replace(/\.basis(\?|$)/,".jpg$1")),o.type==="tencentCloud"?tencentCloudImageProcesser(n,t):o.type==="aliyun"?aliyunOOSImageProcesser(n,t):n):n}function applyImageURLOptions(n,t,e){t===void 0&&(t=imageURL);var r=t(n,e);if(r===n&&e.cut)throw new Error("ImageURL: cut option not applied.");return r}var IMAGE_SIZE_REG=/\/cube_(\d+)\//;function getImageSizeFromURL(n){var t=n.match(IMAGE_SIZE_REG);return t?Number(t[1]):null}function replaceImageSize(n,t){return n.replace(IMAGE_SIZE_REG,"/cube_".concat(t,"/"))}var log2=(_a$5=Math.log2)!==null&&_a$5!==void 0?_a$5:(function(n){return Math.log(n)*Math.LOG2E});function getImageSizeLevel(n){return Math.floor(Math.max(log2(n/512),0))}var windowSTOContext=(function(){var n=now();return{requestAnimationFrame:function(t){var e=now(),r=clamp$1(16+(e-n),16,33),o=setTimeout(function(){t(dateNowToDomHighResTimeStamp(e+r))},r);return n=e+r,o},cancelAnimationFrame:function(t){return clearTimeout(t)}}})(),windowRAFContext=(function(){return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?{requestAnimationFrame:function(n){return requestAnimationFrame(n)},cancelAnimationFrame:function(n){return cancelAnimationFrame(n)}}:windowSTOContext})(),DEFAULT_ORDER=5,deviceFrameTime=16,AnimationFrameLoop=(function(){function n(){var t=this;this.loopType="raf",this.frames=[],this.isAnimating=!1,this.context=null;var e=now();this.loop=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];if(t.isAnimating!==!1){var s=now(),u=Math.max(s-e,0);e=s,deviceFrameTime=u;for(var l=t.frames.slice(),c=0;c<l.length;c++){var f=l[c];if(f.delay>0){f.delay=f.delay-1;continue}try{f.callback.apply(f,__spreadArray([s,u],r,!1))}catch(p){console.error(p)}f.calls++}for(var c=t.frames.length-1;c>=0;c--){var f=t.frames[c];f.once&&f.calls>0&&t.frames.splice(c,1)}t.requestId=t.requestAnimationFrame(t.loop)}},this.start()}return Object.defineProperty(n,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new n),this.sharedInstance},enumerable:!1,configurable:!0}),n.getFrameTime=function(){return deviceFrameTime},n.prototype.start=function(){this.isAnimating!==!0&&(this.isAnimating=!0,this.requestId=this.requestAnimationFrame(this.loop))},n.prototype.stop=function(){this.isAnimating=!1,this.cancelAnimationFrame(this.requestId)},n.prototype.setContext=function(t){t!==this.context&&(this.stop(),this.context=t,this.start())},n.prototype.getContext=function(){return this.context},n.prototype.setLoopType=function(t){t!==this.loopType&&(this.stop(),this.loopType=t,this.start())},n.prototype.getLoopType=function(){return this.loopType},n.prototype.requestAnimationFrame=function(t){var e;if(this.context?e=this.context:this.loopType==="raf"?e=windowRAFContext:this.loopType==="sto"&&(e=windowSTOContext),e)return e.requestAnimationFrame(t)},n.prototype.cancelAnimationFrame=function(t){var e;this.context?e=this.context:this.loopType==="raf"?e=windowRAFContext:this.loopType==="sto"&&(e=windowSTOContext),e&&e.cancelAnimationFrame(t)},n.prototype.remove=function(t){var e=this.frames.indexOf(t);e>=0&&this.frames.splice(e,1)},n.prototype.add=function(t,e,r,o){var s=this;e===void 0&&(e=!1),r===void 0&&(r=0),o===void 0&&(o=DEFAULT_ORDER);for(var u={callback:t,once:e,delay:r,order:o,calls:0},l=this.frames.length;--l>=0;)if(this.frames[l].order<=o){this.frames.splice(l+1,0,u);break}return l<0&&this.frames.unshift(u),function(){return s.remove(u)}},n.prototype.clear=function(){this.frames.length=0},n})(),browserSupportsImageBitmapApi=typeof createImageBitmap!="undefined"&&typeof ImageBitmap!="undefined",_useNativeImageBitmap=!1;function useNativeImageBitmap(n){_useNativeImageBitmap=n}function canUseNativeImageBitmap(){return _useNativeImageBitmap===!1?!1:browserSupportsImageBitmapApi}function createImageBitmapLikeImage(n){n===void 0&&(n={});var t=n.onClose,e=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){t&&t.call(this),this.onerror=this.onload=this.close=noop,this.removeAttribute("src"),t=void 0}});return e}function createImageBitmapLike(n){if(canUseNativeImageBitmap())return createImageBitmap(n);var t=URL.createObjectURL(n),e=function(){this.src===t&&URL.revokeObjectURL(t)};return new Promise(function(r,o){var s=createImageBitmapLikeImage({onClose:e});s.onload=function(){s.src===t&&URL.revokeObjectURL(t),s.onload=s.onerror=noop,AnimationFrameLoop.shared.add(function(){r(s)},!0)},s.onerror=function(){var u=s.src;s.onload=s.onerror=noop,s.close(),o(new Error("image load error: ".concat(u)))},s.decoding="async",s.src=t})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.pop();if(e)return e.width=n,e.height=t,e;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop,canvasPool.push(r)}});return r}function imageBitmapToTexture(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=createCanvas(Math.min(n.width,t.width),Math.min(n.height,t.height)),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.drawImage(n,0,0,e.width,e.height),n.close();var o=new THREE__namespace.Texture(e);o.needsUpdate=!0,o.flipY=!0;var s=o.dispose;return o.dispose=function(){e.close(),s.call(o),o.dispose=s},o}else{var u=new THREE__namespace.Texture(n);u.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?u.flipY=!1:u.flipY=!0,u.flipY===!1&&(u.repeat.y*=-1,u.offset.y+=1,u.updateMatrix());var l=u.dispose;return u.dispose=function(){this.image&&this.image.close(),l.call(u),u.dispose=l},u}}function imageBitmapsToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){if(Array.isArray(this.images))for(var r=0,o=this.images;r<o.length;r++){var s=o[r];s.close()}e.call(t),t.dispose=e},t}var FACE_ORDER$2=["right","left","up","down","front","back"],TextureLoader=(function(){function n(){}return n.prototype.loadTexture=function(t,e,r,o,s,u){var l,c,f,p,d,h,g;r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);var m={};if(typeof e.flipY!="undefined"&&(m.flipY=e.flipY),typeof e.format!="undefined")m.format=e.format;else{var E=getExtname(t);(E===".jpg"||E===".jpeg")&&(m.format=THREE__namespace.RGBFormat)}typeof e.encoding!="undefined"&&(m.encoding=e.encoding),m.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,m.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,m.magFilter=(f=e.magFilter)!==null&&f!==void 0?f:THREE__namespace.LinearFilter;var y=(d=(p=e.imageURL)===null||p===void 0?void 0:p.options)!==null&&d!==void 0?d:{key:"unknown"};t=applyImageURLOptions(t,(h=e.imageURL)===null||h===void 0?void 0:h.transform,y);var v=(g=e.viaAjax)!==null&&g!==void 0?g:canUseNativeImageBitmap;if(v){var A=null,b="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:b},void 0,void 0,s).then(function(S){return createImageBitmapLike(S.body)}).then(function(S){return imageBitmapToTexture(S,e.maxSize)}).then(function(S){return Object.assign(S,m),S}).then(function(S){var w={meta:A,body:S};return r(w),w}).catch(function(S){return o(S),Promise.reject(S)})}else{var T=null,_;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(S){return _=S,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,s,S)}).then(function(S){return T=S.meta,imageBitmapToTexture(S.body,e.maxSize)}).then(function(S){return Object.assign(S,m),S}).then(function(S){var w={meta:T,body:S};return r(w),w}).catch(function(S){return _&&_.close(),o(S),Promise.reject(S)})}},n.prototype.loadCubeTexture=function(t,e,r,o,s,u){var l,c,f,p,d,h,g;r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);var m={};if(typeof e.format!="undefined")m.format=e.format;else{for(var E=!0,y=0,v=FACE_ORDER$2;y<v.length;y++){var A=v[y],b=getExtname(t[A]);if(b!==".jpg"&&b!==".jpeg"){E=!1;break}}E&&(m.format=THREE__namespace.RGBFormat)}m.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,m.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,m.magFilter=(f=e.magFilter)!==null&&f!==void 0?f:THREE__namespace.LinearFilter;for(var T=[t[FACE_ORDER$2[0]],t[FACE_ORDER$2[1]],t[FACE_ORDER$2[2]],t[FACE_ORDER$2[3]],t[FACE_ORDER$2[4]],t[FACE_ORDER$2[5]]],_=[],S=[0,0,0,0,0,0],w=[],R=function(H){var C=(d=(p=e.imageURL)===null||p===void 0?void 0:p.options)!==null&&d!==void 0?d:{key:"unknown"},M=applyImageURLOptions(T[H],(h=e.imageURL)===null||h===void 0?void 0:h.transform,__assign(__assign({},C),{key:C.key+"."+FACE_ORDER$2[H]})),B=function(q){S[H]=q,s(S.reduce(function(z,V){return z+V},0)/6)},L=(g=e.viaAjax)!==null&&g!==void 0?g:!1;if(L){var O="blob",k=e.fetcher.ajax(M,{timeout:e.timeout,responseType:O},void 0,void 0,B).then(function(q){return w[H]=q.meta,createImageBitmapLike(q.body)});_.push(k)}else{var D,k=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(z){return D=z,e.fetcher.loadImage(M,{timeout:e.timeout},void 0,void 0,B,z)}).then(function(z){return w[H]=z.meta,z.body}).catch(function(z){return D&&D.close(),Promise.reject(z)});_.push(k)}},I=0;I<6;I++)R(I);return Promise.all(_).then(function(H){return imageBitmapsToCubeTexture(H)}).then(function(H){return Object.assign(H,__assign({encoding:THREE__namespace.sRGBEncoding},m)),H}).then(function(H){var C={body:H,meta:w};return r(C),C}).catch(function(H){for(var C=0,M=_;C<M.length;C++){var B=M[C];B.then(function(L){return L.close()}).catch(noop)}return o(H),Promise.reject(H)})},n})(),commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},indexMinimal={},minimal$1={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=n;function n(t,e){for(var r=new Array(arguments.length-1),o=0,s=2,u=!0;s<arguments.length;)r[o++]=arguments[s++];return new Promise(function(c,f){r[o]=function(d){if(u)if(u=!1,d)f(d);else{for(var h=new Array(arguments.length-1),g=0;g<h.length;)h[g++]=arguments[g];c.apply(null,h)}};try{t.apply(e||null,r)}catch(p){u&&(u=!1,f(p))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,(function(n){var t=n;t.length=function(l){var c=l.length;if(!c)return 0;for(var f=0;--c%4>1&&l.charAt(c)==="=";)++f;return Math.ceil(l.length*3)/4-f};for(var e=new Array(64),r=new Array(123),o=0;o<64;)r[e[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(l,c,f){for(var p=null,d=[],h=0,g=0,m;c<f;){var E=l[c++];switch(g){case 0:d[h++]=e[E>>2],m=(E&3)<<4,g=1;break;case 1:d[h++]=e[m|E>>4],m=(E&15)<<2,g=2;break;case 2:d[h++]=e[m|E>>6],d[h++]=e[E&63],g=0;break}h>8191&&((p||(p=[])).push(String.fromCharCode.apply(String,d)),h=0)}return g&&(d[h++]=e[m],d[h++]=61,g===1&&(d[h++]=61)),p?(h&&p.push(String.fromCharCode.apply(String,d.slice(0,h))),p.join("")):String.fromCharCode.apply(String,d.slice(0,h))};var s="invalid encoding";t.decode=function(l,c,f){for(var p=f,d=0,h,g=0;g<l.length;){var m=l.charCodeAt(g++);if(m===61&&d>1)break;if((m=r[m])===void 0)throw Error(s);switch(d){case 0:h=m,d=1;break;case 1:c[f++]=h<<2|(m&48)>>4,h=m,d=2;break;case 2:c[f++]=(h&15)<<4|(m&60)>>2,h=m,d=3;break;case 3:c[f++]=(h&3)<<6|m,d=0;break}}if(d===1)throw Error(s);return f-p},t.test=function(l){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(l)}})(base64)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=n;function n(){this._listeners={}}return n.prototype.on=function(e,r,o){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:o||this}),this},n.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var o=this._listeners[e],s=0;s<o.length;)o[s].fn===r?o.splice(s,1):++s;return this},n.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var o=[],s=1;s<arguments.length;)o.push(arguments[s++]);for(s=0;s<r.length;)r[s].fn.apply(r[s++].ctx,o)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=n(n);function n(s){return typeof Float32Array!="undefined"?(function(){var u=new Float32Array([-0]),l=new Uint8Array(u.buffer),c=l[3]===128;function f(g,m,E){u[0]=g,m[E]=l[0],m[E+1]=l[1],m[E+2]=l[2],m[E+3]=l[3]}function p(g,m,E){u[0]=g,m[E]=l[3],m[E+1]=l[2],m[E+2]=l[1],m[E+3]=l[0]}s.writeFloatLE=c?f:p,s.writeFloatBE=c?p:f;function d(g,m){return l[0]=g[m],l[1]=g[m+1],l[2]=g[m+2],l[3]=g[m+3],u[0]}function h(g,m){return l[3]=g[m],l[2]=g[m+1],l[1]=g[m+2],l[0]=g[m+3],u[0]}s.readFloatLE=c?d:h,s.readFloatBE=c?h:d})():(function(){function u(c,f,p,d){var h=f<0?1:0;if(h&&(f=-f),f===0)c(1/f>0?0:2147483648,p,d);else if(isNaN(f))c(2143289344,p,d);else if(f>34028234663852886e22)c((h<<31|2139095040)>>>0,p,d);else if(f<11754943508222875e-54)c((h<<31|Math.round(f/1401298464324817e-60))>>>0,p,d);else{var g=Math.floor(Math.log(f)/Math.LN2),m=Math.round(f*Math.pow(2,-g)*8388608)&8388607;c((h<<31|g+127<<23|m)>>>0,p,d)}}s.writeFloatLE=u.bind(null,t),s.writeFloatBE=u.bind(null,e);function l(c,f,p){var d=c(f,p),h=(d>>31)*2+1,g=d>>>23&255,m=d&8388607;return g===255?m?NaN:h*(1/0):g===0?h*1401298464324817e-60*m:h*Math.pow(2,g-150)*(m+8388608)}s.readFloatLE=l.bind(null,r),s.readFloatBE=l.bind(null,o)})(),typeof Float64Array!="undefined"?(function(){var u=new Float64Array([-0]),l=new Uint8Array(u.buffer),c=l[7]===128;function f(g,m,E){u[0]=g,m[E]=l[0],m[E+1]=l[1],m[E+2]=l[2],m[E+3]=l[3],m[E+4]=l[4],m[E+5]=l[5],m[E+6]=l[6],m[E+7]=l[7]}function p(g,m,E){u[0]=g,m[E]=l[7],m[E+1]=l[6],m[E+2]=l[5],m[E+3]=l[4],m[E+4]=l[3],m[E+5]=l[2],m[E+6]=l[1],m[E+7]=l[0]}s.writeDoubleLE=c?f:p,s.writeDoubleBE=c?p:f;function d(g,m){return l[0]=g[m],l[1]=g[m+1],l[2]=g[m+2],l[3]=g[m+3],l[4]=g[m+4],l[5]=g[m+5],l[6]=g[m+6],l[7]=g[m+7],u[0]}function h(g,m){return l[7]=g[m],l[6]=g[m+1],l[5]=g[m+2],l[4]=g[m+3],l[3]=g[m+4],l[2]=g[m+5],l[1]=g[m+6],l[0]=g[m+7],u[0]}s.readDoubleLE=c?d:h,s.readDoubleBE=c?h:d})():(function(){function u(c,f,p,d,h,g){var m=d<0?1:0;if(m&&(d=-d),d===0)c(0,h,g+f),c(1/d>0?0:2147483648,h,g+p);else if(isNaN(d))c(0,h,g+f),c(2146959360,h,g+p);else if(d>17976931348623157e292)c(0,h,g+f),c((m<<31|2146435072)>>>0,h,g+p);else{var E;if(d<22250738585072014e-324)E=d/5e-324,c(E>>>0,h,g+f),c((m<<31|E/4294967296)>>>0,h,g+p);else{var y=Math.floor(Math.log(d)/Math.LN2);y===1024&&(y=1023),E=d*Math.pow(2,-y),c(E*4503599627370496>>>0,h,g+f),c((m<<31|y+1023<<20|E*1048576&1048575)>>>0,h,g+p)}}}s.writeDoubleLE=u.bind(null,t,0,4),s.writeDoubleBE=u.bind(null,e,4,0);function l(c,f,p,d,h){var g=c(d,h+f),m=c(d,h+p),E=(m>>31)*2+1,y=m>>>20&2047,v=4294967296*(m&1048575)+g;return y===2047?v?NaN:E*(1/0):y===0?E*5e-324*v:E*Math.pow(2,y-1075)*(v+4503599627370496)}s.readDoubleLE=l.bind(null,r,0,4),s.readDoubleBE=l.bind(null,o,4,0)})(),s}function t(s,u,l){u[l]=s&255,u[l+1]=s>>>8&255,u[l+2]=s>>>16&255,u[l+3]=s>>>24}function e(s,u,l){u[l]=s>>>24,u[l+1]=s>>>16&255,u[l+2]=s>>>8&255,u[l+3]=s&255}function r(s,u){return(s[u]|s[u+1]<<8|s[u+2]<<16|s[u+3]<<24)>>>0}function o(s,u){return(s[u]<<24|s[u+1]<<16|s[u+2]<<8|s[u+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(n){}return null}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,(function(n){var t=n;t.length=function(r){for(var o=0,s=0,u=0;u<r.length;++u)s=r.charCodeAt(u),s<128?o+=1:s<2048?o+=2:(s&64512)===55296&&(r.charCodeAt(u+1)&64512)===56320?(++u,o+=4):o+=3;return o},t.read=function(r,o,s){var u=s-o;if(u<1)return"";for(var l=null,c=[],f=0,p;o<s;)p=r[o++],p<128?c[f++]=p:p>191&&p<224?c[f++]=(p&31)<<6|r[o++]&63:p>239&&p<365?(p=((p&7)<<18|(r[o++]&63)<<12|(r[o++]&63)<<6|r[o++]&63)-65536,c[f++]=55296+(p>>10),c[f++]=56320+(p&1023)):c[f++]=(p&15)<<12|(r[o++]&63)<<6|r[o++]&63,f>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,c)),f=0);return l?(f&&l.push(String.fromCharCode.apply(String,c.slice(0,f))),l.join("")):String.fromCharCode.apply(String,c.slice(0,f))},t.write=function(r,o,s){for(var u=s,l,c,f=0;f<r.length;++f)l=r.charCodeAt(f),l<128?o[s++]=l:l<2048?(o[s++]=l>>6|192,o[s++]=l&63|128):(l&64512)===55296&&((c=r.charCodeAt(f+1))&64512)===56320?(l=65536+((l&1023)<<10)+(c&1023),++f,o[s++]=l>>18|240,o[s++]=l>>12&63|128,o[s++]=l>>6&63|128,o[s++]=l&63|128):(o[s++]=l>>12|224,o[s++]=l>>6&63|128,o[s++]=l&63|128);return s-u}})(utf8)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=n;function n(t,e,r){var o=r||8192,s=o>>>1,u=null,l=o;return function(f){if(f<1||f>s)return t(f);l+f>o&&(u=t(o),l=0);var p=e.call(u,l,l+=f);return l&7&&(l=(l|7)+1),p}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var n=requireMinimal$1();function t(s,u){this.lo=s>>>0,this.hi=u>>>0}var e=t.zero=new t(0,0);e.toNumber=function(){return 0},e.zzEncode=e.zzDecode=function(){return this},e.length=function(){return 1};var r=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(u){if(u===0)return e;var l=u<0;l&&(u=-u);var c=u>>>0,f=(u-c)/4294967296>>>0;return l&&(f=~f>>>0,c=~c>>>0,++c>4294967295&&(c=0,++f>4294967295&&(f=0))),new t(c,f)},t.from=function(u){if(typeof u=="number")return t.fromNumber(u);if(n.isString(u))if(n.Long)u=n.Long.fromString(u);else return t.fromNumber(parseInt(u,10));return u.low||u.high?new t(u.low>>>0,u.high>>>0):e},t.prototype.toNumber=function(u){if(!u&&this.hi>>>31){var l=~this.lo+1>>>0,c=~this.hi>>>0;return l||(c=c+1>>>0),-(l+c*4294967296)}return this.lo+this.hi*4294967296},t.prototype.toLong=function(u){return n.Long?new n.Long(this.lo|0,this.hi|0,!!u):{low:this.lo|0,high:this.hi|0,unsigned:!!u}};var o=String.prototype.charCodeAt;return t.fromHash=function(u){return u===r?e:new t((o.call(u,0)|o.call(u,1)<<8|o.call(u,2)<<16|o.call(u,3)<<24)>>>0,(o.call(u,4)|o.call(u,5)<<8|o.call(u,6)<<16|o.call(u,7)<<24)>>>0)},t.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)},t.prototype.zzEncode=function(){var u=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^u)>>>0,this.lo=(this.lo<<1^u)>>>0,this},t.prototype.zzDecode=function(){var u=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^u)>>>0,this.hi=(this.hi>>>1^u)>>>0,this},t.prototype.length=function(){var u=this.lo,l=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c===0?l===0?u<16384?u<128?1:2:u<2097152?3:4:l<16384?l<128?5:6:l<2097152?7:8:c<128?9:10},longbits}var hasRequiredMinimal$1;function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,(function(n){var t=n;t.asPromise=requireAspromise(),t.base64=requireBase64(),t.EventEmitter=requireEventemitter(),t.float=requireFloat(),t.inquire=requireInquire(),t.utf8=requireUtf8(),t.pool=requirePool(),t.LongBits=requireLongbits(),t.isNode=!!(typeof commonjsGlobal!="undefined"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||typeof window!="undefined"&&window||typeof self!="undefined"&&self||minimal$1,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s},t.isString=function(s){return typeof s=="string"||s instanceof String},t.isObject=function(s){return s&&typeof s=="object"},t.isset=t.isSet=function(s,u){var l=s[u];return l!=null&&s.hasOwnProperty(u)?typeof l!="object"||(Array.isArray(l)?l.length:Object.keys(l).length)>0:!1},t.Buffer=(function(){try{var o=t.inquire("buffer").Buffer;return o.prototype.utf8Write?o:null}catch(s){return null}})(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(s){return typeof s=="number"?t.Buffer?t._Buffer_allocUnsafe(s):new t.Array(s):t.Buffer?t._Buffer_from(s):typeof Uint8Array=="undefined"?s:new Uint8Array(s)},t.Array=typeof Uint8Array!="undefined"?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(s){return s?t.LongBits.from(s).toHash():t.LongBits.zeroHash},t.longFromHash=function(s,u){var l=t.LongBits.fromHash(s);return t.Long?t.Long.fromBits(l.lo,l.hi,u):l.toNumber(!!u)};function e(o,s,u){for(var l=Object.keys(s),c=0;c<l.length;++c)(o[l[c]]===void 0||!u)&&(o[l[c]]=s[l[c]]);return o}t.merge=e,t.lcFirst=function(s){return s.charAt(0).toLowerCase()+s.substring(1)};function r(o){function s(u,l){if(!(this instanceof s))return new s(u,l);Object.defineProperty(this,"message",{get:function(){return u}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:new Error().stack||""}),l&&e(this,l)}return s.prototype=Object.create(Error.prototype,{constructor:{value:s,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return o},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),s}t.newError=r,t.ProtocolError=r("ProtocolError"),t.oneOfGetter=function(s){for(var u={},l=0;l<s.length;++l)u[s[l]]=1;return function(){for(var c=Object.keys(this),f=c.length-1;f>-1;--f)if(u[c[f]]===1&&this[c[f]]!==void 0&&this[c[f]]!==null)return c[f]}},t.oneOfSetter=function(s){return function(u){for(var l=0;l<s.length;++l)s[l]!==u&&delete this[s[l]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var o=t.Buffer;if(!o){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=o.from!==Uint8Array.from&&o.from||function(u,l){return new o(u,l)},t._Buffer_allocUnsafe=o.allocUnsafe||function(u){return new o(u)}}})(minimal$1)),minimal$1}var writer,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=c;var n=requireMinimal$1(),t,e=n.LongBits,r=n.base64,o=n.utf8;function s(y,v,A){this.fn=y,this.len=v,this.next=void 0,this.val=A}function u(){}function l(y){this.head=y.head,this.tail=y.tail,this.len=y.len,this.next=y.states}function c(){this.len=0,this.head=new s(u,0,0),this.tail=this.head,this.states=null}var f=function(){return n.Buffer?function(){return(c.create=function(){return new t})()}:function(){return new c}};c.create=f(),c.alloc=function(v){return new n.Array(v)},n.Array!==Array&&(c.alloc=n.pool(c.alloc,n.Array.prototype.subarray)),c.prototype._push=function(v,A,b){return this.tail=this.tail.next=new s(v,A,b),this.len+=A,this};function p(y,v,A){v[A]=y&255}function d(y,v,A){for(;y>127;)v[A++]=y&127|128,y>>>=7;v[A]=y}function h(y,v){this.len=y,this.next=void 0,this.val=v}h.prototype=Object.create(s.prototype),h.prototype.fn=d,c.prototype.uint32=function(v){return this.len+=(this.tail=this.tail.next=new h((v=v>>>0)<128?1:v<16384?2:v<2097152?3:v<268435456?4:5,v)).len,this},c.prototype.int32=function(v){return v<0?this._push(g,10,e.fromNumber(v)):this.uint32(v)},c.prototype.sint32=function(v){return this.uint32((v<<1^v>>31)>>>0)};function g(y,v,A){for(;y.hi;)v[A++]=y.lo&127|128,y.lo=(y.lo>>>7|y.hi<<25)>>>0,y.hi>>>=7;for(;y.lo>127;)v[A++]=y.lo&127|128,y.lo=y.lo>>>7;v[A++]=y.lo}c.prototype.uint64=function(v){var A=e.from(v);return this._push(g,A.length(),A)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(v){var A=e.from(v).zzEncode();return this._push(g,A.length(),A)},c.prototype.bool=function(v){return this._push(p,1,v?1:0)};function m(y,v,A){v[A]=y&255,v[A+1]=y>>>8&255,v[A+2]=y>>>16&255,v[A+3]=y>>>24}c.prototype.fixed32=function(v){return this._push(m,4,v>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(v){var A=e.from(v);return this._push(m,4,A.lo)._push(m,4,A.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(v){return this._push(n.float.writeFloatLE,4,v)},c.prototype.double=function(v){return this._push(n.float.writeDoubleLE,8,v)};var E=n.Array.prototype.set?function(v,A,b){A.set(v,b)}:function(v,A,b){for(var T=0;T<v.length;++T)A[b+T]=v[T]};return c.prototype.bytes=function(v){var A=v.length>>>0;if(!A)return this._push(p,1,0);if(n.isString(v)){var b=c.alloc(A=r.length(v));r.decode(v,b,0),v=b}return this.uint32(A)._push(E,A,v)},c.prototype.string=function(v){var A=o.length(v);return A?this.uint32(A)._push(o.write,A,v):this._push(p,1,0)},c.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new s(u,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new s(u,0,0),this.len=0),this},c.prototype.ldelim=function(){var v=this.head,A=this.tail,b=this.len;return this.reset().uint32(b),b&&(this.tail.next=v.next,this.tail=A,this.len+=b),this},c.prototype.finish=function(){for(var v=this.head.next,A=this.constructor.alloc(this.len),b=0;v;)v.fn(v.val,A,b),b+=v.len,v=v.next;return A},c._configure=function(y){t=y,c.create=f(),t._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=e;var n=requireWriter();(e.prototype=Object.create(n.prototype)).constructor=e;var t=requireMinimal$1();function e(){n.call(this)}e._configure=function(){e.alloc=t._Buffer_allocUnsafe,e.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&t.Buffer.prototype.set.name==="set"?function(s,u,l){u.set(s,l)}:function(s,u,l){if(s.copy)s.copy(u,l,0,s.length);else for(var c=0;c<s.length;)u[l++]=s[c++]}},e.prototype.bytes=function(s){t.isString(s)&&(s=t._Buffer_from(s,"base64"));var u=s.length>>>0;return this.uint32(u),u&&this._push(e.writeBytesBuffer,u,s),this};function r(o,s,u){o.length<40?t.utf8.write(o,s,u):s.utf8Write?s.utf8Write(o,u):s.write(o,u)}return e.prototype.string=function(s){var u=t.Buffer.byteLength(s);return this.uint32(u),u&&this._push(r,u,s),this},e._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=s;var n=requireMinimal$1(),t,e=n.LongBits,r=n.utf8;function o(d,h){return RangeError("index out of range: "+d.pos+" + "+(h||1)+" > "+d.len)}function s(d){this.buf=d,this.pos=0,this.len=d.length}var u=typeof Uint8Array!="undefined"?function(h){if(h instanceof Uint8Array||Array.isArray(h))return new s(h);throw Error("illegal buffer")}:function(h){if(Array.isArray(h))return new s(h);throw Error("illegal buffer")},l=function(){return n.Buffer?function(g){return(s.create=function(E){return n.Buffer.isBuffer(E)?new t(E):u(E)})(g)}:u};s.create=l(),s.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,s.prototype.uint32=(function(){var h=4294967295;return function(){if(h=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(h=(h|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return h;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return h}})(),s.prototype.int32=function(){return this.uint32()|0},s.prototype.sint32=function(){var h=this.uint32();return h>>>1^-(h&1)|0};function c(){var d=new e(0,0),h=0;if(this.len-this.pos>4){for(;h<4;++h)if(d.lo=(d.lo|(this.buf[this.pos]&127)<<h*7)>>>0,this.buf[this.pos++]<128)return d;if(d.lo=(d.lo|(this.buf[this.pos]&127)<<28)>>>0,d.hi=(d.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return d;h=0}else{for(;h<3;++h){if(this.pos>=this.len)throw o(this);if(d.lo=(d.lo|(this.buf[this.pos]&127)<<h*7)>>>0,this.buf[this.pos++]<128)return d}return d.lo=(d.lo|(this.buf[this.pos++]&127)<<h*7)>>>0,d}if(this.len-this.pos>4){for(;h<5;++h)if(d.hi=(d.hi|(this.buf[this.pos]&127)<<h*7+3)>>>0,this.buf[this.pos++]<128)return d}else for(;h<5;++h){if(this.pos>=this.len)throw o(this);if(d.hi=(d.hi|(this.buf[this.pos]&127)<<h*7+3)>>>0,this.buf[this.pos++]<128)return d}throw Error("invalid varint encoding")}s.prototype.bool=function(){return this.uint32()!==0};function f(d,h){return(d[h-4]|d[h-3]<<8|d[h-2]<<16|d[h-1]<<24)>>>0}s.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return f(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return f(this.buf,this.pos+=4)|0};function p(){if(this.pos+8>this.len)throw o(this,8);return new e(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}return s.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var h=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,h},s.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var h=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,h},s.prototype.bytes=function(){var h=this.uint32(),g=this.pos,m=this.pos+h;if(m>this.len)throw o(this,h);if(this.pos+=h,Array.isArray(this.buf))return this.buf.slice(g,m);if(g===m){var E=n.Buffer;return E?E.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,g,m)},s.prototype.string=function(){var h=this.bytes();return r.read(h,0,h.length)},s.prototype.skip=function(h){if(typeof h=="number"){if(this.pos+h>this.len)throw o(this,h);this.pos+=h}else do if(this.pos>=this.len)throw o(this);while(this.buf[this.pos++]&128);return this},s.prototype.skipType=function(d){switch(d){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(d=this.uint32()&7)!==4;)this.skipType(d);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+d+" at offset "+this.pos)}return this},s._configure=function(d){t=d,s.create=l(),t._configure();var h=n.Long?"toLong":"toNumber";n.merge(s.prototype,{int64:function(){return c.call(this)[h](!1)},uint64:function(){return c.call(this)[h](!0)},sint64:function(){return c.call(this).zzDecode()[h](!1)},fixed64:function(){return p.call(this)[h](!0)},sfixed64:function(){return p.call(this)[h](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=e;var n=requireReader();(e.prototype=Object.create(n.prototype)).constructor=e;var t=requireMinimal$1();function e(r){n.call(this,r)}return e._configure=function(){t.Buffer&&(e.prototype._slice=t.Buffer.prototype.slice)},e.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},e._configure(),reader_buffer}var rpc={},service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=t;var n=requireMinimal$1();(t.prototype=Object.create(n.EventEmitter.prototype)).constructor=t;function t(e,r,o){if(typeof e!="function")throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!r,this.responseDelimited=!!o}return t.prototype.rpcCall=function e(r,o,s,u,l){if(!u)throw TypeError("request must be specified");var c=this;if(!l)return n.asPromise(e,c,r,o,s,u);if(!c.rpcImpl){setTimeout(function(){l(Error("already ended"))},0);return}try{return c.rpcImpl(r,o[c.requestDelimited?"encodeDelimited":"encode"](u).finish(),function(p,d){if(p)return c.emit("error",p,r),l(p);if(d===null){c.end(!0);return}if(!(d instanceof s))try{d=s[c.responseDelimited?"decodeDelimited":"decode"](d)}catch(h){return c.emit("error",h,r),l(h)}return c.emit("data",d,r),l(null,d)})}catch(f){c.emit("error",f,r),setTimeout(function(){l(f)},0);return}},t.prototype.end=function(r){return this.rpcImpl&&(r||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,(function(n){var t=n;t.Service=requireService()})(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,(function(n){var t=n;t.build="minimal",t.Writer=requireWriter(),t.BufferWriter=requireWriter_buffer(),t.Reader=requireReader(),t.BufferReader=requireReader_buffer(),t.util=requireMinimal$1(),t.rpc=requireRpc(),t.roots=requireRoots(),t.configure=e;function e(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}e()})(indexMinimal)),indexMinimal}var minimal,hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal=requireIndexMinimal()),minimal}var minimalExports=requireMinimal();const $Reader$1=minimalExports.Reader,$util$1=minimalExports.util,$root$1=minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto"]||(minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto"]={}),Model$2=$root$1.Model=(()=>{function n(t){if(this.chunks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.chunks=$util$1.emptyArray,n.prototype.createAt=$util$1.Long?$util$1.Long.fromBits(0,0,!0):0,n.prototype.description="",n.decode=function(e,r,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Model;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.chunks&&u.chunks.length||(u.chunks=[]),u.chunks.push($root$1.Chunk.decode(e,e.uint32()));break}case 2:{u.createAt=e.uint64();break}case 3:{u.description=e.string();break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root$1.Chunk=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.vertices=null,n.prototype.faces=null,n.prototype.name="",n.prototype.texture="",n.decode=function(e,r,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Chunk;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.vertices=$root$1.Vertices.decode(e,e.uint32());break}case 2:{u.faces=$root$1.Faces.decode(e,e.uint32());break}case 3:{u.name=e.string();break}case 4:{u.texture=e.string();break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("vertices"))throw $util$1.ProtocolError("missing required 'vertices'",{instance:u});if(!u.hasOwnProperty("faces"))throw $util$1.ProtocolError("missing required 'faces'",{instance:u});if(!u.hasOwnProperty("name"))throw $util$1.ProtocolError("missing required 'name'",{instance:u});return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root$1.Vertices=(()=>{function n(t){if(this.xyz=[],this.uvs=[],this.marks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.xyz=$util$1.emptyArray,n.prototype.uvs=$util$1.emptyArray,n.prototype.marks=$util$1.emptyArray,n.decode=function(e,r,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Vertices;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.xyz&&u.xyz.length||(u.xyz=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.xyz.push(e.float())}else u.xyz.push(e.float());break}case 2:{if(u.uvs&&u.uvs.length||(u.uvs=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.uvs.push(e.float())}else u.uvs.push(e.float());break}case 3:{if(u.marks&&u.marks.length||(u.marks=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.marks.push(e.int32())}else u.marks.push(e.int32());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Vertices"},n})(),$root$1.Faces=(()=>{function n(t){if(this.indices=[],this.normals=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.indices=$util$1.emptyArray,n.prototype.normals=$util$1.emptyArray,n.decode=function(e,r,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Faces;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.indices&&u.indices.length||(u.indices=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.indices.push(e.uint32())}else u.indices.push(e.uint32());break}case 2:{if(u.normals&&u.normals.length||(u.normals=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.normals.push(e.float())}else u.normals.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Faces"},n})(),$root$1.VertexMark=(()=>{const n={},t=Object.create(n);return t[n[0]="VERTEX_MARK_UNSPECIFIED"]=0,t[n[1]="VERTEX_MARK_ROOF"]=1,t})();function fixNumber(n){return isNaN(n)||!isFinite(n)?0:n}function getGeometryMemoryUsed(n){var t=0;if(n instanceof THREE__namespace.BufferGeometry){for(var e in n.attributes){var r=n.getAttribute(e),o=4;"BYTES_PER_ELEMENT"in r.array&&typeof r.array.BYTES_PER_ELEMENT=="number"&&(o=r.array.BYTES_PER_ELEMENT),t+=fixNumber(r.count*r.itemSize*o)}var s=n.getIndex();if(s){var o=4;"BYTES_PER_ELEMENT"in s.array&&typeof s.array.BYTES_PER_ELEMENT=="number"&&(o=s.array.BYTES_PER_ELEMENT),t+=fixNumber(s.count*s.itemSize*o)}}else n instanceof THREE__namespace.Geometry&&(t+=fixNumber(n.faces.length*3*3*4),t+=fixNumber(n.faceVertexUvs.length*3*2*4));return t}function makeComputeBlockRectSizeFunction(n,t,e){return function(r,o,s){var u=(r+n-1)/n|0,l=(o+t-1)/t|0;return u*l*e*s}}function makeComputePaddedRectSizeFunction(n,t,e){return function(r,o,s){return(Math.max(r,n)*Math.max(o,t)/e|0)*s}}var compressedTextureFunctions=new Map([[THREE__namespace.RGB_S3TC_DXT1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_S3TC_DXT1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_S3TC_DXT3_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_S3TC_DXT5_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGB_ETC1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGB_PVRTC_4BPPV1_Format,makeComputePaddedRectSizeFunction(8,8,2)],[THREE__namespace.RGBA_PVRTC_4BPPV1_Format,makeComputePaddedRectSizeFunction(8,8,2)],[THREE__namespace.RGB_PVRTC_2BPPV1_Format,makeComputePaddedRectSizeFunction(16,8,4)],[THREE__namespace.RGBA_PVRTC_2BPPV1_Format,makeComputePaddedRectSizeFunction(16,8,4)],[THREE__namespace.RGB_ETC2_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_ETC2_EAC_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_ASTC_4x4_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_4x4_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_ASTC_5x4_Format,makeComputeBlockRectSizeFunction(5,4,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_5x4_Format,makeComputeBlockRectSizeFunction(5,4,16)],[THREE__namespace.RGBA_ASTC_5x5_Format,makeComputeBlockRectSizeFunction(5,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_5x5_Format,makeComputeBlockRectSizeFunction(5,5,16)],[THREE__namespace.RGBA_ASTC_6x5_Format,makeComputeBlockRectSizeFunction(6,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_6x5_Format,makeComputeBlockRectSizeFunction(6,5,16)],[THREE__namespace.RGBA_ASTC_6x6_Format,makeComputeBlockRectSizeFunction(6,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_6x6_Format,makeComputeBlockRectSizeFunction(6,6,16)],[THREE__namespace.RGBA_ASTC_8x5_Format,makeComputeBlockRectSizeFunction(8,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x5_Format,makeComputeBlockRectSizeFunction(8,5,16)],[THREE__namespace.RGBA_ASTC_8x6_Format,makeComputeBlockRectSizeFunction(8,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x6_Format,makeComputeBlockRectSizeFunction(8,6,16)],[THREE__namespace.RGBA_ASTC_8x8_Format,makeComputeBlockRectSizeFunction(8,8,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x8_Format,makeComputeBlockRectSizeFunction(8,8,16)],[THREE__namespace.RGBA_ASTC_10x5_Format,makeComputeBlockRectSizeFunction(10,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x5_Format,makeComputeBlockRectSizeFunction(10,5,16)],[THREE__namespace.RGBA_ASTC_10x6_Format,makeComputeBlockRectSizeFunction(10,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x6_Format,makeComputeBlockRectSizeFunction(10,6,16)],[THREE__namespace.RGBA_ASTC_10x8_Format,makeComputeBlockRectSizeFunction(10,8,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x8_Format,makeComputeBlockRectSizeFunction(10,8,16)],[THREE__namespace.RGBA_ASTC_10x10_Format,makeComputeBlockRectSizeFunction(10,10,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x10_Format,makeComputeBlockRectSizeFunction(10,10,16)],[THREE__namespace.RGBA_ASTC_12x10_Format,makeComputeBlockRectSizeFunction(12,10,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_12x10_Format,makeComputeBlockRectSizeFunction(12,10,16)],[THREE__namespace.RGBA_ASTC_12x12_Format,makeComputeBlockRectSizeFunction(12,12,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_12x12_Format,makeComputeBlockRectSizeFunction(12,12,16)],[THREE__namespace.RGBA_BPTC_Format,makeComputeBlockRectSizeFunction(4,4,16)]]);function getTextureMemoryUsed(n){var t=0,e=1;(n.generateMipmaps===!0||n.mipmaps&&n.mipmaps.length>1)&&(e=1.33);for(var r=n instanceof THREE__namespace.CompressedTexture,o=r?compressedTextureFunctions.get(n.format):void 0,s=[].concat(n.image),u=0,l=s;u<l.length;u++){var c=l[u];if(c)if(c instanceof THREE__namespace.Texture)t+=getTextureMemoryUsed(c);else{var f=c.width,p=f===void 0?1:f,d=c.height,h=d===void 0?1:d,g=c.depth,m=g===void 0?1:g;o?t+=fixNumber(o(p,h,m)*e):t+=fixNumber(p*h*m*4*e)}}return t}var textureSet=new Set,textureNames=["map","alphaMap","bumpMap","normalMap","displacementMap","emissiveMap","specularMap","envMap","flipEnvMap","lightMap","aoMap","gradientMap","metalnessMap","roughnessMap","sheenColorMap","sheenRoughnessMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","iridescenceMap","iridescenceThicknessMap","transmissionMap","thicknessMap","anisotropyMap","specularColorMap","specularIntensityMap"];function getMaterialMemoryUsed(n){var t=0;if(textureSet.clear(),n instanceof THREE__namespace.ShaderMaterial)for(var e in n.uniforms){var r=n.uniforms[e],o=r&&r.value&&r.value instanceof THREE__namespace.Texture?r.value:void 0;o instanceof THREE__namespace.Texture&&(textureSet.has(o)||(t=getTextureMemoryUsed(o),textureSet.add(o)))}else for(var s=0,u=textureNames;s<u.length;s++){var l=u[s],o=n[l];o instanceof THREE__namespace.Texture&&(textureSet.has(o)||(t=getTextureMemoryUsed(o),textureSet.add(o)))}return textureSet.clear(),t}var sceneSet=new Set;function getMemoryUsage(n){var t=0;return sceneSet.clear(),n.traverse(function(e){if(e instanceof THREE__namespace.Mesh||e instanceof THREE__namespace.Line||e instanceof THREE__namespace.Points){var r=e.geometry;(r instanceof THREE__namespace.BufferGeometry||r instanceof THREE__namespace.Geometry)&&(sceneSet.has(r)||(t+=getGeometryMemoryUsed(r),sceneSet.add(r)));for(var o=[].concat(e.material),s=0,u=o;s<u.length;s++){var l=u[s];l instanceof THREE__namespace.Material&&(sceneSet.has(l)||(t+=getMaterialMemoryUsed(l),sceneSet.add(l)))}}}),sceneSet.clear(),t}function guessTextureBaseUriFromFileUrl(n){var t=n.lastIndexOf("/");if(t>=0){var e=n.slice(0,t+1),r=e.replace(/\/(model)(\/|$)/,function(o,s,u){return"/materials"+u});return r}return""}function loadPbm(n,t){var e,r,o,s,u,l;t===void 0&&(t={});for(var c=(e=t.upAxis)!==null&&e!==void 0?e:"Z",f=(r=t.light)!==null&&r!==void 0?r:!1,p=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,d=(s=t.textureBaseUri)!==null&&s!==void 0?s:guessTextureBaseUriFromFileUrl(n),h=t.textureBaseUri===void 0?[]:((u=t.textureArray)!==null&&u!==void 0?u:[]).slice(),g=autoRestImageOptionsByTextureLength((l=t.textureOptions)!==null&&l!==void 0?l:{},h.length),m=new Map,E=0,y=h;E<y.length;E++){var v=y[E];m.set(v,loadTexture$1(v,d,g,p))}var A={byteLength:0};return Promise.resolve().then(function(){return p.ajax(n,{responseType:"arraybuffer"})}).then(function(b){A.byteLength=b.body.byteLength;var T=new Uint8Array(b.body);return Model$2.decode(T)}).then(function(b){return parse$4(b,f,d,h,g,m,p)}).then(function(b){m.clear();var T=new THREE__namespace.Group;T.name=n;for(var _=0,S=b.objects;_<S.length;_++){var w=S[_];T.add(w)}return c==="Y"&&T.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"pbm",modelUpAxis:"Z",upAxis:c,uri:n,byteLength:A.byteLength,memoryUsage:getMemoryUsage(T),scene:T,textures:b.textures,animations:[],dispose:function(){return b.dispose()}}})}function parseFloorName(n){var t=n.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function parseChunkName(n){var t=n.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function parseSubName(n){var t=n.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}function chunkOrder(n){var t=parseFloorName(n.name),e=parseChunkName(n.name),r=parseSubName(n.name);return t*1e6+e*1e3+r}function parsePBMModel(n){for(var t,e,r,o=typeof n.createAt=="number"?n.createAt:0,s=(t=n.description)!==null&&t!==void 0?t:"",u=[],l=!0,c=!0,f=0,p=n.chunks;f<p.length;f++){var d=p[f];if(!d.vertices.marks||d.vertices.marks.length===0){c=!1;break}}for(var h=0,g=n.chunks;h<g.length;h++){var d=g[h];if(!d.faces.normals||d.faces.normals.length===0){l=!1;break}}for(var m=n.chunks.sort(function(Z,ne){return chunkOrder(Z)-chunkOrder(ne)}),E=[],y=0,v=m;y<v.length;y++){var d=v[y],A=parseFloorName(d.name);E[A]||(E[A]=[]),E[A].push(d)}for(var b=0;b<E.length;b++){var T=E[b];if(T)if(l){for(var _=0,S=0;S<T.length;S++){var d=T[S];_+=d.faces.indices.length}for(var w=new Float32Array(_*3),R=new Float32Array(_*2),I=new Float32Array(_*3),H=c?new Float32Array(_):void 0,C=[],M=[1/0,1/0,1/0,-1/0,-1/0,-1/0],B=0,L=0;L<T.length;L++){for(var O=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[L],k=d.vertices.xyz,D=d.vertices.uvs,q=d.faces.indices,z=d.faces.normals,V=d.vertices.marks,Q=q.length,S=0;S<Q;S++){var U=q[S],j=w[B*3+S*3]=k[U*3],G=w[B*3+S*3+1]=k[U*3+1],ae=w[B*3+S*3+2]=k[U*3+2];H&&(H[B+S]=V[U]),R[B*2+S*2]=D[U*2],R[B*2+S*2+1]=D[U*2+1];var re=Math.floor(S/3)*3;I[B*3+S*3]=z[re],I[B*3+S*3+1]=z[re+1],I[B*3+S*3+2]=z[re+2],j<O[0]&&(O[0]=j),G<O[1]&&(O[1]=G),ae<O[2]&&(O[2]=ae),j>O[3]&&(O[3]=j),G>O[4]&&(O[4]=G),ae>O[5]&&(O[5]=ae)}O[0]<M[0]&&(M[0]=O[0]),O[1]<M[1]&&(M[1]=O[1]),O[2]<M[2]&&(M[2]=O[2]),O[3]>M[3]&&(M[3]=O[3]),O[4]>M[4]&&(M[4]=O[4]),O[5]>M[5]&&(M[5]=O[5]),C.push({materialIndex:L,name:d.name,chunkName:parseChunkName(d.name),start:B,count:d.faces.indices.length,texture:(e=d.texture)!==null&&e!==void 0?e:void 0}),B+=Q}var $={createAt:o,description:s,vertices:w,uvs:R,normals:I,masks:H,indices:null,floorIndex:b,groups:C,extents:M};u.push($)}else{for(var _=0,ee=0,S=0;S<T.length;S++){var d=T[S];ee+=d.vertices.xyz.length/3,_+=d.faces.indices.length}for(var w=new Float32Array(ee*3),R=new Float32Array(ee*2),I=void 0,K=new Float32Array(ee),se=new Uint32Array(_),H=c?new Float32Array(_):void 0,C=[],M=[1/0,1/0,1/0,-1/0,-1/0,-1/0],W=0,B=0,L=0;L<T.length;L++){for(var O=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[L],k=d.vertices.xyz,X=d.vertices.marks,D=d.vertices.uvs,q=d.faces.indices,te=k.length/3,Q=q.length,S=0;S<te;S++){var j=w[B*3+S*3]=k[S*3],G=w[B*3+S*3+1]=k[S*3+1],ae=w[B*3+S*3+2]=k[S*3+2];H&&(H[B+S]=X[S]),R[B*2+S*2]=D[S*2],R[B*2+S*2+1]=D[S*2+1],K[B+S]=b,j<O[0]&&(O[0]=j),G<O[1]&&(O[1]=G),ae<O[2]&&(O[2]=ae),j>O[3]&&(O[3]=j),G>O[4]&&(O[4]=G),ae>O[5]&&(O[5]=ae)}O[0]<M[0]&&(M[0]=O[0]),O[1]<M[1]&&(M[1]=O[1]),O[2]<M[2]&&(M[2]=O[2]),O[3]>M[3]&&(M[3]=O[3]),O[4]>M[4]&&(M[4]=O[4]),O[5]>M[5]&&(M[5]=O[5]);for(var S=0;S<Q;S++)se[W+S]=B+q[S];C.push({materialIndex:L,name:d.name,chunkName:parseChunkName(d.name),start:W,count:d.faces.indices.length,texture:(r=d.texture)!==null&&r!==void 0?r:void 0}),B+=te,W+=Q}var $={createAt:o,description:s,vertices:w,uvs:R,normals:I,masks:H,indices:se,floorIndex:b,groups:C,extents:M};u.push($)}}return u}function loadTexture$1(n,t,e,r){var o=__assign({key:"texture.pbm"},pick(e,["format","quality","size","sharpen","forceUseExifOrientation","mappings"])),s=new TextureLoader,u=isAbsoluteURL(n)?n:pathJoin(t,n);return s.loadTexture(u,{imageURL:{transform:e.transform,options:o},encoding:THREE__namespace.sRGBEncoding,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping,minFilter:THREE__namespace.LinearFilter,maxSize:typeof o.size=="number"?new THREE__namespace.Vector2(o.size,o.size):void 0,fetcher:r}).then(function(l){var c=l.body;return c.needsUpdate=!0,c})}function parse$4(n,t,e,r,o,s,u){for(var l=parsePBMModel(n),c=0,f="",p=[],d={},h=new Set,g=0,m=0,E=l;m<E.length;m++){var y=E[m],v=y.createAt,A=y.description,b=y.vertices,T=y.masks,_=y.uvs,S=y.normals,w=y.indices,R=y.floorIndex,I=y.groups,H=y.extents,C=new THREE__namespace.Box3;C.min.x=H[0],C.min.y=H[1],C.min.z=H[2],C.max.x=H[3],C.max.y=H[4],C.max.z=H[5];var M=new THREE__namespace.BufferGeometry;M.setAttribute("position",new THREE__namespace.BufferAttribute(b,3)),M.setAttribute("uv",new THREE__namespace.BufferAttribute(_,2)),S&&M.setAttribute("normal",new THREE__namespace.BufferAttribute(S,3)),T&&M.setAttribute("_feature_id_rsmask",new THREE__namespace.BufferAttribute(T,1)),w&&M.setIndex(new THREE__namespace.BufferAttribute(w,1)),M.boundingBox=C,M.boundingSphere=C.getBoundingSphere(new THREE__namespace.Sphere);for(var B=0,L=I;B<L.length;B++){var O=L[B];M.addGroup(O.start,O.count,O.materialIndex)}h.add(M);for(var k=[],D=0,q=I;D<q.length;D++){var O=q[D],z=void 0;if(O.texture){if(z=O.texture,r.length>0&&r.indexOf(O.texture)===-1){for(var V=0,Q=r;V<Q.length;V++){var U=Q[V],j=isAbsoluteURL(U)?U:pathJoin(e,U),G=j.slice(O.texture.length*-1)===O.texture;if(G){z=U;break}}console.warn("At3d/Pbm texture not matched. Use ends-guessing mode. ".concat(O.texture," -> ").concat(z))}isAbsoluteURL(z)||(z=pathJoin(e,z))}var ae=new PBMMeshMaterial(t?"phong":"basic");ae.floorIndex=R,M.attributes.normal===void 0&&(ae.flatShading=!0),M.attributes._feature_id_rsmask&&(ae.defines.USE_VERTEX_MARK=!0),k.push(ae),z?(g++,d[z]?d[z].push(ae):d[z]=[ae]):ae.color=new THREE__namespace.Color(16777215),h.add(ae)}var re=new PBMMesh(M,k);re.name="model_floor_"+R,re.userData.createAt=v,re.userData.description=A,re.matrix.compose(re.position,re.quaternion,re.scale),re.matrixAutoUpdate=!1,re.frustumCulled=!1,c=v,f=A,p.push(re)}o=autoRestImageOptionsByTextureLength(o,g);for(var $=[],ee=function(X){var te=void 0;s&&(te=s.get(X)),te||(te=loadTexture$1(X,e,o,u),s&&s.set(X,te)),$.push(te.then(function(Z){for(var ne=0,pe=d[X];ne<pe.length;ne++){var ie=pe[ne];ie.map&&(h.delete(ie.map),ie.map.dispose()),ie.map=Z,h.add(Z)}return Z}).catch(function(){for(var Z=0,ne=d[X];Z<ne.length;Z++){var pe=ne[Z];pe.map&&(h.delete(pe.map),pe.map.dispose()),pe.map=null,pe.color=new THREE__namespace.Color(16777215)}return null}))},K=0,se=Object.keys(d);K<se.length;K++){var W=se[K];ee(W)}return Promise.all($).then(function(X){var te=X.filter(function(Z){return Z instanceof THREE__namespace.Texture});return{createAt:c,description:f,objects:p,textures:te,dispose:function(){h.forEach(function(Z){Z.dispose()}),h.clear()}}})}function autoRestImageOptionsByTextureLength(n,t){return n=Object.assign({},n),n.autoResize!==!1&&(t>96?n.size=Math.min(n.size||1/0,100):t>48?n.size=Math.min(n.size||1/0,200):t>24?n.size=Math.min(n.size||1/0,400):t>22?n.size=Math.min(n.size||1/0,800):t>5&&(n.size=Math.min(n.size||1/0,1024))),n}function createLZMA(){var n={};return n.OutWindow=function(){this._windowSize=0},n.OutWindow.prototype.create=function(t){(!this._buffer||this._windowSize!==t)&&(this._buffer=[]),this._windowSize=t,this._pos=0,this._streamPos=0},n.OutWindow.prototype.flush=function(){var t=this._pos-this._streamPos;if(t!==0){for(;t--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},n.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},n.OutWindow.prototype.setStream=function(t){this.releaseStream(),this._stream=t},n.OutWindow.prototype.init=function(t){t||(this._streamPos=0,this._pos=0)},n.OutWindow.prototype.copyBlock=function(t,e){var r=this._pos-t-1;for(r<0&&(r+=this._windowSize);e--;)r>=this._windowSize&&(r=0),this._buffer[this._pos++]=this._buffer[r++],this._pos>=this._windowSize&&this.flush()},n.OutWindow.prototype.putByte=function(t){this._buffer[this._pos++]=t,this._pos>=this._windowSize&&this.flush()},n.OutWindow.prototype.getByte=function(t){var e=this._pos-t-1;return e<0&&(e+=this._windowSize),this._buffer[e]},n.RangeDecoder=function(){},n.RangeDecoder.prototype.setStream=function(t){this._stream=t},n.RangeDecoder.prototype.releaseStream=function(){this._stream=null},n.RangeDecoder.prototype.init=function(){var t=5;for(this._code=0,this._range=-1;t--;)this._code=this._code<<8|this._stream.readByte()},n.RangeDecoder.prototype.decodeDirectBits=function(t){for(var e=0,r=t,o;r--;)this._range>>>=1,o=this._code-this._range>>>31,this._code-=this._range&o-1,e=e<<1|1-o,(this._range&4278190080)===0&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return e},n.RangeDecoder.prototype.decodeBit=function(t,e){var r=t[e],o=(this._range>>>11)*r;return(this._code^2147483648)<(o^2147483648)?(this._range=o,t[e]+=2048-r>>>5,(this._range&4278190080)===0&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=o,this._code-=o,t[e]-=r>>>5,(this._range&4278190080)===0&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},n.initBitModels=function(t,e){for(;e--;)t[e]=1024},n.BitTreeDecoder=function(t){this._models=[],this._numBitLevels=t},n.BitTreeDecoder.prototype.init=function(){n.initBitModels(this._models,1<<this._numBitLevels)},n.BitTreeDecoder.prototype.decode=function(t){for(var e=1,r=this._numBitLevels;r--;)e=e<<1|t.decodeBit(this._models,e);return e-(1<<this._numBitLevels)},n.BitTreeDecoder.prototype.reverseDecode=function(t){for(var e=1,r=0,o=0,s;o<this._numBitLevels;++o)s=t.decodeBit(this._models,e),e=e<<1|s,r|=s<<o;return r},n.reverseDecode2=function(t,e,r,o){for(var s=1,u=0,l=0,c;l<o;++l)c=r.decodeBit(t,e+s),s=s<<1|c,u|=c<<l;return u},n.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new n.BitTreeDecoder(8),this._numPosStates=0},n.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new n.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new n.BitTreeDecoder(3)},n.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(n.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},n.LenDecoder.prototype.decode=function(t,e){return t.decodeBit(this._choice,0)===0?this._lowCoder[e].decode(t):t.decodeBit(this._choice,1)===0?8+this._midCoder[e].decode(t):16+this._highCoder.decode(t)},n.Decoder2=function(){this._decoders=[]},n.Decoder2.prototype.init=function(){n.initBitModels(this._decoders,768)},n.Decoder2.prototype.decodeNormal=function(t){var e=1;do e=e<<1|t.decodeBit(this._decoders,e);while(e<256);return e&255},n.Decoder2.prototype.decodeWithMatchByte=function(t,e){var r=1,o,s;do if(o=e>>7&1,e<<=1,s=t.decodeBit(this._decoders,(1+o<<8)+r),r=r<<1|s,o!==s){for(;r<256;)r=r<<1|t.decodeBit(this._decoders,r);break}while(r<256);return r&255},n.LiteralDecoder=function(){},n.LiteralDecoder.prototype.create=function(t,e){var r;if(!(this._coders&&this._numPrevBits===e&&this._numPosBits===t))for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=e,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=new n.Decoder2},n.LiteralDecoder.prototype.init=function(){for(var t=1<<this._numPrevBits+this._numPosBits;t--;)this._coders[t].init()},n.LiteralDecoder.prototype.getDecoder=function(t,e){return this._coders[((t&this._posMask)<<this._numPrevBits)+((e&255)>>>8-this._numPrevBits)]},n.Decoder=function(){this._outWindow=new n.OutWindow,this._rangeDecoder=new n.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new n.BitTreeDecoder(4),this._lenDecoder=new n.LenDecoder,this._repLenDecoder=new n.LenDecoder,this._literalDecoder=new n.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new n.BitTreeDecoder(6),this._posSlotDecoder[1]=new n.BitTreeDecoder(6),this._posSlotDecoder[2]=new n.BitTreeDecoder(6),this._posSlotDecoder[3]=new n.BitTreeDecoder(6)},n.Decoder.prototype.setDictionarySize=function(t){return t<0?!1:(this._dictionarySize!==t&&(this._dictionarySize=t,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},n.Decoder.prototype.setLcLpPb=function(t,e,r){var o=1<<r;return t>8||e>4||r>4?!1:(this._literalDecoder.create(e,t),this._lenDecoder.create(o),this._repLenDecoder.create(o),this._posStateMask=o-1,!0)},n.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),n.initBitModels(this._isMatchDecoders,192),n.initBitModels(this._isRep0LongDecoders,192),n.initBitModels(this._isRepDecoders,12),n.initBitModels(this._isRepG0Decoders,12),n.initBitModels(this._isRepG1Decoders,12),n.initBitModels(this._isRepG2Decoders,12),n.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},n.Decoder.prototype.decode=function(t,e,r){var o=0,s=0,u=0,l=0,c=0,f=0,p=0,d,h,g,m,E,y;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(e),this.init();r<0||f<r;)if(d=f&this._posStateMask,this._rangeDecoder.decodeBit(this._isMatchDecoders,(o<<4)+d)===0)h=this._literalDecoder.getDecoder(f++,p),o>=7?p=h.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(s)):p=h.decodeNormal(this._rangeDecoder),this._outWindow.putByte(p),o=o<4?0:o-(o<10?3:6);else{if(this._rangeDecoder.decodeBit(this._isRepDecoders,o)===1)g=0,this._rangeDecoder.decodeBit(this._isRepG0Decoders,o)===0?this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(o<<4)+d)===0&&(o=o<7?9:11,g=1):(this._rangeDecoder.decodeBit(this._isRepG1Decoders,o)===0?m=u:(this._rangeDecoder.decodeBit(this._isRepG2Decoders,o)===0?m=l:(m=c,c=l),l=u),u=s,s=m),g===0&&(g=2+this._repLenDecoder.decode(this._rangeDecoder,d),o=o<7?8:11);else if(c=l,l=u,u=s,g=2+this._lenDecoder.decode(this._rangeDecoder,d),o=o<7?7:10,E=this._posSlotDecoder[g<=5?g-2:3].decode(this._rangeDecoder),E>=4){if(y=(E>>1)-1,s=(2|E&1)<<y,E<14)s+=n.reverseDecode2(this._posDecoders,s-E-1,this._rangeDecoder,y);else if(s+=this._rangeDecoder.decodeDirectBits(y-4)<<4,s+=this._posAlignDecoder.reverseDecode(this._rangeDecoder),s<0){if(s===-1)break;return!1}}else s=E;if(s>=f||s>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(s,g),f+=g,p=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},n.Decoder.prototype.setDecoderProperties=function(t){var e,r,o,s,u;return t.size<5||(e=t.readByte(),r=e%9,e=~~(e/9),o=e%5,s=~~(e/5),!this.setLcLpPb(r,o,s))?!1:(u=t.readByte(),u|=t.readByte()<<8,u|=t.readByte()<<16,u+=t.readByte()*16777216,this.setDictionarySize(u))},n.decompress=function(t,e,r,o){var s=new n.Decoder;if(!s.setDecoderProperties(t))throw"Incorrect stream properties";if(!s.decode(e,r,o))throw"Error in data stream";return!0},n.decompressFile=function(t,e){var r=new n.Decoder,o;if(!r.setDecoderProperties(t))throw"Incorrect stream properties";if(o=t.readByte(),o|=t.readByte()<<8,o|=t.readByte()<<16,o+=t.readByte()*16777216,t.readByte(),t.readByte(),t.readByte(),t.readByte(),!r.decode(t,e,o))throw"Error in data stream";return!0},n}var LZMA=createLZMA();function createWASM(){function n(e){for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=new Uint8Array(256),s=0;s<r.length;s++)o[r.charCodeAt(s)]=s;var u=e.length*.75,l=e.length,c,f=0,p,d,h,g;e[e.length-1]==="="&&(u--,e[e.length-2]==="="&&u--);var m=new ArrayBuffer(u),E=new Uint8Array(m);for(c=0;c<l;c+=4)p=o[e.charCodeAt(c)],d=o[e.charCodeAt(c+1)],h=o[e.charCodeAt(c+2)],g=o[e.charCodeAt(c+3)],E[f++]=p<<2|d>>4,E[f++]=(d&15)<<4|h>>2,E[f++]=(h&3)<<6|g&63;return m}var t="AGFzbQEAAAABSg1gAABgAX8Bf2ACf38Bf2AEf39/fwBgA39/fwBgAX8AYAJ/fwBgA39/fwF/YAR/f39/AX9gAn9/AGABfwF/YAABf2AEf39/fwF/AhsCA2VudgVhYm9ydAADA2VudgZtZW1vcnkCAAEDJiUBAQkKAgoKCwsLCwsAAgoBAgQKAQYFCAoFBQQEBwgCBwwCAQAABAQBcAABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwc9BgZtZW1vcnkCAAV0YWJsZQEABXJlc2V0AA0KbmV3VThBcnJheQAQCnVucGFja1NpemUAFAZkZWNvZGUAIwgBJAkHAQBBAAsBJQqAViVoAQN/IABBgICAgARLBEAACyMBIgEgAEEBIABBAUsbakEHakF4cSICPwAiA0EQdEsEQCADIAIgAWtB//8DakGAgHxxQRB2IgAgAyAAShtAAEEASARAIABAAEEASARAAAsLCyACJAEgAQsbAQF/QQFBICAAQQdqZ2t0EAEiASAANgIAIAELkQMBAX8gAUUEQA8LIABBADoAACAAIAFqQQFrQQA6AAAgAUECTQRADwsgAEEBakEAOgAAIABBAmpBADoAACAAIAFqIgJBAmtBADoAACACQQNrQQA6AAAgAUEGTQRADwsgAEEDakEAOgAAIAAgAWpBBGtBADoAACABQQhNBEAPC0EAIABrQQNxIgIgAGoiAEEANgIAIAEgAmtBfHEiASAAakEEa0EANgIAIAFBCE0EQA8LIABBBGpBADYCACAAQQhqQQA2AgAgACABaiICQQxrQQA2AgAgAkEIa0EANgIAIAFBGE0EQA8LIABBDGpBADYCACAAQRBqQQA2AgAgAEEUakEANgIAIABBGGpBADYCACAAIAFqIgJBHGtBADYCACACQRhrQQA2AgAgAkEUa0EANgIAIAJBEGtBADYCACAAQQRxQRhqIgIgAGohACABIAJrIQEDQCABQSBPBEAgAEIANwMAIABBCGpCADcDACAAQRBqQgA3AwAgAEEYakIANwMAIAFBIGshASAAQSBqIQAMAQsLC1EBA38gAEH+////AEsEQEEAQSBBLUEnEAAACyAAQQJ0IgMQAiECQQgQASIBQQA2AgAgAUEANgIEIAEgAjYCACABIAA2AgQgAkEIaiADEAMgAQtmAQF/IAFB/P///wFLBEBBAEHAAEEXQSIQAAALIAFBAXQiARACIgJBCGogARADIABFBEBBDBABIQALIABBADYCACAAQQA2AgQgAEEANgIIIAAgAjYCACAAQQA2AgQgACABNgIIIAALCgBBDBABIAAQBQsuAQF/QQgQASIBQQA2AgAgAUEANgIEIAEgADYCBCABQQEgASgCBHQQBjYCACABC6EBAQR/QRAQASIBQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgxBEBAEIQIDQCAAQRBIBEBBAxAHIQMgAigCACAAQQJ0aiADNgIIIABBAWohAAwBCwsgASACNgIEQRAQBCECQQAhAANAIABBEEgEQEEDEAchAyACKAIAIABBAnRqIAM2AgggAEEBaiEADAELCyABIAI2AgggAUEIEAc2AgwgAQs0AQF/QRQQASIAQQA2AgAgAEEAOgAEIABBADYCCCAAQQA2AgwgAEEANgIQIABBDTYCCCAAC0IBAX9BGRABIgBBADYCACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEANgIUIABBADoAGCAAQQA2AhAgAAu1AgEEf0HQABABIgBBADoAACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEAOgAUIABBADYCGCAAQQA2AhwgAEEANgIgIABBADYCJCAAQQA2AiggAEEANgIsIABBADYCMCAAQQA2AjQgAEEANgI4IABBADYCPCAAQQA2AkAgAEEANgJEIABBADYCSCAAQQA2AkxBBBAEIQIDQCABQQRIBEBBBhAHIQMgAigCACABQQJ0aiADNgIIIAFBAWohAQwBCwsgACACNgIkIABBBBAHNgIoIABB8wAQBjYCLCAAQcABEAY2AjAgAEEMEAY2AjQgAEEMEAY2AjggAEEMEAY2AjwgAEEMEAY2AkAgAEHAARAGNgJEIAAQCDYCSCAAEAg2AkwgABAJNgIEIAAQCjYCCCAACx8BAX9BCBABIgBBADYCACAAQQA2AgQgABALNgIAIAALCgAjACQBEAwkAwthAQF/IAFB+P///wNLBEBBAEHAAEEXQSIQAAALIAEQAiICQQhqIAEQAyAARQRAQQwQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCAAIAI2AgAgAEEANgIEIAAgATYCCCAACwoAQQwQASAAEA4LBgAgABAPCyoAIAEgACgCCE8EQEEAQcAAQSdBPxAAAAsgACgCBCABIAAoAgBqai0ACAssACABIAAoAghPBEBBAEHAAEEyQT8QAAALIAAoAgQgASAAKAIAamogAjoACAtkAQJ/QQ0QDyECA0AgAUENSARAIAIgASAAIAEQEUH/AXEQEiABQQFqIQEMAQsLQQAhAEEAIQEDQCABQQhIBEAgAiABQQVqEBFB/wFxIAFBA3R0IAByIQAgAUEBaiEBDAELCyAACwYAIAAQEwsnACAAIAEQDzYCCCAAQQA2AgwgACABNgIUIABBADoAGCAAQQA2AgALJAAgACgCCCAAKAIYEBUgAEGABiAAKAIMIAAtABRqdBAGNgIgC5UBAQR/IAEhBSAAIgYoAgAhASAAKAIEIQcgACgCCEEBdiEEIAJBAEgEfyACIARqIgBBACAAQQBKGwUgAiIAIAQgACAESBsLIQIgA0EASAR/IAMgBGoiAEEAIABBAEobBSADIgAgBCAAIARIGwshAwNAIAIgA05FBEAgAkEBdCABaiAHaiAFOwEIIAJBAWohAgwBCwsgBgssAQF/AkACQAJAIwRBAWsOAwEBAgALAAtB/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQAUanQhAQNAIAMgAUgEQCACKAIgIgQoAgAhBSAEKAIEIANBAXQgBWpqQYAIOwEIIANBAWohAwwBCwsgAiEBQQAhAgNAIAJBBEkEQCACIAEoAiQoAgAiAygCAEECdkkEfyACQQJ0IANqKAIIBQALKAIAQQEkBBAYGiACQQFqIQIMAQsLIAEoAigoAgBBASQEEBgaIAEoAixBASQEEBgaIAAoAjBBASQEEBgaIAAoAjRBASQEEBgaIAAoAjhBASQEEBgaIAAoAjxBASQEEBgaIAAoAkBBASQEEBgaIAAoAkRBASQEEBgaIAAoAkgQGSAAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAIAFBAmohASAAQQJqIQALIAJBAXEEQCAAIAEtAAA6AAALDwsgAkEgTwRAAkACQAJAIABBA3EiA0EBRwRAIANBAkYNASADQQNGDQIMAwsgASgCACEFIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAAIAJBA2shAgNAIAJBEU8EQCAAIAFBAWooAgAiA0EIdCAFQRh2cjYCACAAQQRqIAFBBWooAgAiBUEIdCADQRh2cjYCACAAQQhqIAFBCWooAgAiA0EIdCAFQRh2cjYCACAAQQxqIAFBDWooAgAiBUEIdCADQRh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsMAgsgASgCACEFIAAgAS0AADoAACAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAAgAkECayECA0AgAkESTwRAIAAgAUECaigCACIDQRB0IAVBEHZyNgIAIABBBGogAUEGaigCACIFQRB0IANBEHZyNgIAIABBCGogAUEKaigCACIDQRB0IAVBEHZyNgIAIABBDGogAUEOaigCACIFQRB0IANBEHZyNgIAIAFBEGohASAAQRBqIQAgAkEQayECDAELCwwBCyABKAIAIQUgACIEQQFqIQAgASIDQQFqIQEgBCADLQAAOgAAIAJBAWshAgNAIAJBE08EQCAAIAFBA2ooAgAiA0EYdCAFQQh2cjYCACAAQQRqIAFBB2ooAgAiBUEYdCADQQh2cjYCACAAQQhqIAFBC2ooAgAiA0EYdCAFQQh2cjYCACAAQQxqIAFBD2ooAgAiBUEYdCADQQh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsLCyACQRBxBEAgACABIgMtAAA6AAAgAEEBaiIBIAEgA0EBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiBEEBaiEAIAFBAWoiA0EBaiEBIAQgAy0AADoAAAsgAkEIcQRAIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiBEEBaiEAIAFBAWoiA0EBaiEBIAQgAy0AADoAAAsgAkEEcQRAIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAALIAJBAnEEQCAAIAEtAAA6AAAgAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAACyACQQFxBEAgACABLQAAOgAACwvVAgECfyAAIAFGBEAPCyABIAJqIABNIgNFBEAgACACaiABTSEDCyADBEAgACABIAIQGw8LIAAgAUkEQCABQQdxIABBB3FGBEADQCAAQQdxBEAgAkUEQA8LIAJBAWshAiAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAMAQsLA0AgAkEITwRAIAAgASkDADcDACACQQhrIQIgAEEIaiEAIAFBCGohAQwBCwsLA0AgAgRAIAAiBEEBaiEAIAEiA0EBaiEBIAQgAy0AADoAACACQQFrIQIMAQsLBSABQQdxIABBB3FGBEADQCAAIAJqQQdxBEAgAkUEQA8LIAJBAWsiAiAAaiABIAJqLQAAOgAADAELCwNAIAJBCE8EQCACQQhrIgIgAGogASACaikDADcDAAwBCwsLA0AgAgRAIAJBAWsiAiAAaiABIAJqLQAAOgAADAELCwsL4AoBCH8gACgCACIGIgQoAgAgBCgCBGovAQgiCCABIgcoAgxBC3ZsIQQgBygCECAESQR/QYAQIAhrQf//A3FBBXYgCGohCCAHIAQ2AgxBAAUgCCAIQf//A3FBBXZrIQggByAHKAIQIARrNgIQIAcgBygCDCAEazYCDEEBCyAGKAIEIAYoAgBqIAg7AQggByIFKAIMIwJJBEAgBSAFKAIMQQh0NgIMIAUoAhBBCHQhByAFKAIAIQYgBSAFKAIIIglBAWo2AgggBSAGIAkQEUH/AXEgB3I2AhALQf//A3FFBEAgAiAAKAIEKAIAIgAoAgBBAnZJBH8gAkECdCAAaigCCAUACyEDIAEhBEEBIQgDQCAKIAMoAgRJBEAgAygCACIHKAIAIQEgBCgCECAHKAIEIAgiBUEBdCIIIAFqai8BCCIGIAQoAgxBC3ZsIglJBH9BgBAgBmtB//8DcUEFdiAGaiEGIAQgCTYCDEEABSAGIAZB//8DcUEFdmshBiAEIAQoAhAgCWs2AhAgBCAEKAIMIAlrNgIMQQELIAcoAgQgBygCACAFQQF0amogBjsBCCAEKAIMIwJJBEAgBCAEKAIMQQh0NgIMIAQoAhBBCHQhACAEKAIAIQUgBCAEKAIIIgFBAWo2AgggBCAFIAEQEUH/AXEgAHI2AhALQf//A3EgCGohCCAKQQFqIQoMAQsLIAhBASADKAIEdGsPCyAAKAIAIgooAgAhCCAFKAIQIAooAgQgCEECamovAQgiBCABKAIMQQt2bCIDSQR/IAUgAzYCDEEAIQlBgBAgBGtB//8DcUEFdiAEagUgBSAFKAIQIANrNgIQIAUgBSgCDCADazYCDEEBIQkgBCAEQf//A3FBBXZrCyEEIAoiBygCBCAHKAIAQQJqaiAEOwEIIAUiBigCDCMCSQRAIAYgBigCDEEIdDYCDCAGKAIQQQh0IQUgBigCACEHIAYgBigCCCIIQQFqNgIIIAYgByAIEBFB/wFxIAVyNgIQCyAJQf//A3FFBEAgAiAAKAIIKAIAIgAoAgBBAnZJBH8gAkECdCAAaigCCAUACyEJIAEhA0EBIQRBACECA0AgAiAJKAIESQRAIAMoAhAgCSgCACIFKAIEIAQiBkEBdCIEIAUoAgBqai8BCCIHIAMoAgxBC3ZsIghJBH9BgBAgB2tB//8DcUEFdiAHaiEHIAMgCDYCDEEABSAHIAdB//8DcUEFdmshByADIAMoAhAgCGs2AhAgAyADKAIMIAhrNgIMQQELIAUoAgQgBSgCACAGQQF0amogBzsBCCADKAIMIwJJBEAgAyADKAIMQQh0NgIMIAMoAhBBCHQhBSADKAIAIQcgAyADKAIIIgZBAWo2AgggAyAHIAYQEUH/AXEgBXI2AhALQf//A3EgBGohBCACQQFqIQIMAQsLIARBASAJKAIEdGtBCGoPCyAAKAIMIQQgASEDQQEhCUEAIQIDQCACIAQoAgRJBEAgBCgCACIIKAIAIQogAygCECAIKAIEIAogCSIHQQF0IgFqai8BCCIFIAMoAgxBC3ZsIgZJBH8gAyAGNgIMQQAhBkGAECAFa0H//wNxQQV2IAVqBSADIAMoAhAgBms2AhAgAyADKAIMIAZrNgIMQQEhBiAFIAVB//8DcUEFdmsLIQUgCCgCBCAIKAIAIAdBAXRqaiAFOwEIIAMoAgwjAkkEQCADIAMoAgxBCHQ2AgwgAygCEEEIdCEAIAMoAgAhBSADIAMoAggiCkEBajYCCCADIAUgChARQf8BcSAAcjYCEAsgBkH//wNxIAFqIQkgAkEBaiECDAELCyAJQQEgBCgCBHRrQRBqC5YCAQh/QQEhBwNAAkAgBiABTg0AIAIoAhAgACgCBCAAKAIAIAMgB2oiCUEBdGpqLwEIIgQgAigCDEELdmwiBUkEfyACIAU2AgxBACEFQYAQIARrQf//A3FBBXYgBGoFIAIgAigCECAFazYCECACIAIoAgwgBWs2AgxBASEFIAQgBEH//wNxQQV2awshBCAAKAIEIAAoAgAgCUEBdGpqIAQ7AQggAiIEKAIMIwJJBEAgBCAEKAIMQQh0NgIMIAQoAhBBCHQhCiAEKAIAIQsgBCAEKAIIIglBAWo2AgggBCALIAkQEUH/AXEgCnI2AhALIAVB//8DcSIEIAdBAXRqIQcgBCAGdCAIciEIIAZBAWohBgwBCwsgCAvwBAEIf0EDIAEgAUEDSxsiAiAAKAIkKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACyEEIAAoAgQhAkEBIQEDQCAHIAQoAgRJBEAgBCgCACIFKAIAIQMgAigCECAFKAIEIAFBAXQiCSADamovAQgiAyACKAIMQQt2bCIGSQR/IAIgBjYCDEEAIQhBgBAgA2tB//8DcUEFdiADagUgAiACKAIQIAZrNgIQIAIgAigCDCAGazYCDEEBIQggAyADQf//A3FBBXZrCyEDIAUoAgQgBSgCACABQQF0amogAzsBCCACKAIMIwJJBEAgAiACKAIMQQh0NgIMIAIoAhBBCHQhBiACKAIAIQUgAiACKAIIIgNBAWo2AgggAiAFIAMQEUH/AXEgBnI2AhALIAhB//8DcSAJaiEBIAdBAWohBwwBCwsgAUEBIAQoAgR0ayIBQQRJBEAgAQ8LIAFBAXFBAnIgAUEBdkEBayICdCEDIAFBDkkEfyAAKAIsIAIgACgCBCADIAFrEB4gA2oFIAAoAgQhASACQQRrIQJBACEEA0AgASABKAIMQQF2NgIMIAEgASgCECABKAIMazYCECABIAEoAhBBACABKAIQQR92ayIHIAEoAgxxajYCECABKAIQIAEoAgxGBEAgAUEBOgAECyABKAIMIwJJBEAgASABKAIMQQh0NgIMIAEoAhBBCHQhBSABKAIAIQggASABKAIIIgZBAWo2AgggASAIIAYQEUH/AXEgBXI2AhALIAdBAWogBEEBdGohBCACQQFrIgINAAsgBEEEdCADaiAAKAIoIgQoAgAgBCgCBCAAKAIEQQAQHmoLC9AcAQ9/IAAQGiAAKAIEIgdBADoABCAHKAIAIAcgBygCCCIDQQFqNgIIIAMQEUH/AXEEQCAHQQE6AAQLIAdBfzYCDCAHQQA2AhBBACEDA0AgA0EESARAIAcoAhBBCHQhBSAHKAIAIQwgByAHKAIIIghBAWo2AgggByAMIAgQEUH/AXEgBXI2AhAgA0EBaiEDDAELCyAHKAIQIAcoAgxGBEAgB0EBOgAECyABBEAgACgCCCACEA82AgQFIAAoAghBBBAPNgIEC0EAIQwDQAJAIAJFIAEgARsiBwR/IAAtAABFBSAHCwRAIAAoAgQoAhBFBEBBAw8LCyAAKAIwIgUoAgAhByAFKAIEIAAoAggoAgBBASAAKAIQdEEBa3EiCyAMQQR0Qf8BcWoiBkEBdCAHamovAQghAyAGIQcgACgCBCIEKAIMQQt2IANsIQggBCgCECAISQR/IAQgCDYCDEEAIQlBgBAgA2tB//8DcUEFdiADagUgBCAEKAIQIAhrNgIQIAQgBCgCDCAIazYCDEEBIQkgAyADQf//A3FBBXZrCyEIIAUiAygCBCADKAIAIAdBAXRqaiAIOwEIIAQiBigCDCMCSQRAIAYgBigCDEEIdDYCDCAGKAIQQQh0IQggBigCACEDIAYgBigCCCIHQQFqNgIIIAYgAyAHEBFB/wFxIAhyNgIQCyAJQf//A3FFBEAgAkUgASABGw0BIAwhCEEAIQYgACgCCCIFKAIMRSIEBH8gBS0AGEUFIAQLRQRAIAAoAggiBSgCCCIGKAIEQQEgBSgCDEwEfyAFKAIMQQFrBSAFKAIMIAUoAhRBAWtqCyAGKAIAamotAAghBgtBASEEIAAoAggoAgBBASAALQAUdEEBa3EgACgCDHQgBkEIIAAoAgxrdmpBgAZsIQcgCEEHTwRAIAAoAggiBigCCCIJKAIEIA5BAWoiDSAGKAIMTAR/IAYoAgwgDWsFIAYoAgwgBigCFCANa2oLIAkoAgBqai0ACCENA0ACQCANQf8BcUEHdiEGIA1BAXQhDSAAKAIgIgkoAgAhCyAJKAIEIAZBAWpBCHQgB2ogBGoiDEEBdCALamovAQgiCyAAKAIEIgMoAgxBC3ZsIQogAygCECAKSQR/QYAQIAtrQf//A3FBBXYgC2ohCyADIAo2AgxBAAUgCyALQf//A3FBBXZrIQsgAyADKAIQIAprNgIQIAMgAygCDCAKazYCDEEBCyEFIAkoAgQgCSgCACAMQQF0amogCzsBCCADIgooAgwjAkkEQCAKIAooAgxBCHQ2AgwgCigCEEEIdCEDIAooAgAhDCAKIAooAggiC0EBajYCCCAKIAwgCxARQf8BcSADcjYCEAsgBEEBdCAFciEEIAVB//8DcSAGRw0AIARB//8DcUGAAkkNAQsLCwNAIARBgAJJBEAgBEEBdCEJIAAoAiAiBSgCACEMIAUoAgQgBCAHaiIGQQF0IAxqai8BCCILIAAoAgQiDSgCDEELdmwhCiANKAIQIApJBH9BgBAgC2tB//8DcUEFdiALaiELIA0gCjYCDEEABSALIAtB//8DcUEFdmshCyANIA0oAhAgCms2AhAgDSANKAIMIAprNgIMQQELIAUoAgQgBSgCACAGQQF0amogCzsBCCANIgooAgwjAkkEQCAKIAooAgxBCHQ2AgwgCigCEEEIdCEGIAooAgAhBSAKIAooAggiDEEBajYCCCAKIAUgDBARQf8BcSAGcjYCEAsgCXIhBAwBCwsgACgCCCIDIAMoAgBBAWo2AgAgAygCCCELIAMgAygCDCIGQQFqNgIMIAsoAgQgCygCACAGamogBEGAAmsiCjoACCADKAIMIAMoAhRGBEAgA0EANgIMIANBAToAGAsgAygCBCgCCCADKAIQRgRAIAMgAygCBCIGKAIIQQF0EA82AgQgAygCBCgCACADKAIEKAIEakEIaiAGKAIAIAYoAgRqQQhqIAYoAggQHCAGKAIAGgsgAygCBCEJIAMgAygCECIMQQFqNgIQIAkoAgQgCSgCACAMamogCjoACCAIIgVBBEkEf0EABSAFQQNrIAVBBmsgBUEKSRsLIQwgAkEBayECDAILIAAoAjQiBigCACEFIAYoAgQgDCIDQQF0IAVqai8BCCIHIAAoAgQiCigCDEELdmwhBCAKKAIQIARJBH9BgBAgB2tB//8DcUEFdiAHaiEHIAogBDYCDEEABSAHIAdB//8DcUEFdmshByAKIAooAhAgBGs2AhAgCiAKKAIMIARrNgIMQQELIAMhBSAGIgMoAgAhDSADKAIEIAVBAXQgDWpqIAc7AQggCiIJKAIMIwJJBEAgCSAJKAIMQQh0NgIMIAkoAhBBCHQhBiAJKAIAIQMgCSAJKAIIIgVBAWo2AgggCSADIAUQEUH/AXEgBnI2AhALQf//A3EEQCACRSABIAEbDQEgACgCCCIIKAIMRSIEBH8gCC0AGEUFIAQLDQEgACgCOCIDKAIAIQggAygCBCAMQQF0IAhqai8BCCIEIAAoAgQiBSgCDEELdmwhByAFKAIQIAdJBH9BgBAgBGtB//8DcUEFdiAEaiEEIAUgBzYCDEEABSAEIARB//8DcUEFdmshBCAFIAUoAhAgB2s2AhAgBSAFKAIMIAdrNgIMQQELIAMoAgQgAygCACAMQQF0amogBDsBCCAFIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEFIAkoAgAhAyAJIAkoAggiCEEBajYCCCAJIAMgCBARQf8BcSAFcjYCEAtB//8DcQRAIAAoAjwiCCgCACEHIAgoAgQgDEEBdCAHamovAQgiBCAAKAIEIgUoAgxBC3ZsIQYgBSgCECAGSQR/QYAQIARrQf//A3FBBXYgBGohBCAFIAY2AgxBAAUgBCAEQf//A3FBBXZrIQQgBSAFKAIQIAZrNgIQIAUgBSgCDCAGazYCDEEBCyAIIgMoAgQgAygCACAMQQF0amogBDsBCCAFIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEIIAkoAgAhAyAJIAkoAggiB0EBajYCCCAJIAMgBxARQf8BcSAIcjYCEAtB//8DcQRAIAAoAkAiAygCACEKIAMoAgQgDEEBdCAKamovAQgiBiAAKAIEIgcoAgxBC3ZsIQQgBygCECAESQR/QYAQIAZrQf//A3FBBXYgBmohBiAHIAQ2AgxBAAUgBiAGQf//A3FBBXZrIQYgByAHKAIQIARrNgIQIAcgBygCDCAEazYCDEEBCyADKAIEIAMoAgAgDEEBdGpqIAY7AQggByIJKAIMIwJJBEAgCSAJKAIMQQh0NgIMIAkoAhBBCHQhCCAJKAIAIQMgCSAJKAIIIgpBAWo2AgggCSADIAoQEUH/AXEgCHI2AhALQf//A3EEQCARIQMgDyERBSAPIQMLIBAhDwUgECEDCyAOIRAgAyEOBSAAKAJEIgYoAgAhCiAGKAIEIAxBBHRB/wFxIAtqIgNBAXQgCmpqLwEIIgcgACgCBCIIKAIMQQt2bCEEIAgoAhAgBEkEf0GAECAHa0H//wNxQQV2IAdqIQcgCCAENgIMQQAFIAcgB0H//wNxQQV2ayEHIAggCCgCECAEazYCECAIIAgoAgwgBGs2AgxBAQsgAyEKIAYiAygCACENIAMoAgQgCkEBdCANamogBzsBCCAIIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEIIAkoAgAhAyAJIAkoAggiCkEBajYCCCAJIAMgChARQf8BcSAIcjYCEAtB//8DcUUEQEEJQQsgDEEHSRshDCAAKAIIIQQgACgCCCIFKAIIIgMoAgQgDkEBaiIHIAUoAgxMBH8gBSgCDCAHawUgBSgCDCAFKAIUIAdragsgAygCAGpqLQAIIQcgBCAEKAIAQQFqNgIAIAQoAgghBSAEIAQoAgwiBkEBajYCDCAFKAIEIAUoAgAgBmpqIAc6AAggBCgCDCAEKAIURgRAIARBADYCDCAEQQE6ABgLIAQoAgQoAgggBCgCEEYEQCAEIAQoAgQiBigCCEEBdBAPNgIEIAQoAgQoAgAgBCgCBCgCBGpBCGogBigCACAGKAIEakEIaiAGKAIIEBwgBigCABoLIAQoAgQhAyAEIAQoAhAiCEEBajYCECADKAIEIAMoAgAgCGpqIAc6AAggAkEBayECDAQLCyAAKAJMIAAoAgQgCxAdIQtBCEELIAxBB0kbIQwFIA8hESAQIQ8gDiEQQQdBCiAMQQdJGyEMIAAgACgCSCAAKAIEIAsQHSILEB8iDkF/RgRAIAAoAgQoAhAEf0EBBUECCw8LIAJFIAEgARsNASAOIAAoAhhPIgUEfyAFBSAOIAAoAggiBCgCDEwiBgR/IAYFIAQtABgLRQsNAQtBACENIAAoAgghBSAOQQFqIQQgAiALQQJqIgtIIAEgARsEQEEBIQ0gAiELCyALIQYDQCAGQQBKBEAgBSIIKAIIIgkoAgQgBCAFKAIMTAR/IAUoAgwgBGsFIAUoAgwgBSgCFCAEa2oLIAkoAgBqai0ACCEHIAggCCgCAEEBajYCACAIKAIIIQMgCCAIKAIMIgpBAWo2AgwgAygCBCADKAIAIApqaiAHOgAIIAgoAgwgCCgCFEYEQCAIQQA2AgwgCEEBOgAYCyAIKAIEKAIIIAgoAhBGBEAgCCAIKAIEIgMoAghBAXQQDzYCBCAIKAIEKAIAIAgoAgQoAgRqQQhqIAMoAgAgAygCBGpBCGogAygCCBAcIAMoAgAaCyAIKAIEIQkgCCAIKAIQIgNBAWo2AhAgCSgCBCAJKAIAIANqaiAHOgAIIAZBAWshBgwBCwsgAiALayECIA1FDQELC0EBCyYBAX9BEBABIgQgADYCACAEIAE2AgQgBCACNgIIIAQgAzYCDCAEC7YEAQZ/IAAgATYCBEENEA8hAgNAAkAgA0ENTg0AIAIgAyABIAMQEUH/AXEQEiADQQFqIQMMAQsLIAAoAgAhBCACIQZBBBAPIgIoAgQgAigCAGogBigCBCAGKAIAai0ACCIDOgAIIANB/wFxQeEBTwRAQQBBgAFBoQFBDBAAAAsgAigCBCACKAIAQQFqaiADQf8BcUEJcCIHOgAIIAIoAgQgAigCAGogA0H/AXFBCW4iAzoACCADQQVwIQUgAigCBCACKAIAQQJqaiADQQVuIgM6AAggAigCBCACKAIAQQNqaiAFOgAIIAQgBzYCDCAEIAM2AhAgBCAFOgAUIARBADYCHEEAIQIDQAJAIAJBBE8NACAEIAQoAhwgBigCBCAGKAIAIAJBAWpqai0ACCACQQN0dHI2AhwgAkEBaiECDAELCyAEIAQoAhw2AhggBCgCGEGAIEkEQCAEQYAgNgIYC0EAIQJBACEFQQAhAwNAAkAgA0EITg0AIAYgA0EFahARQf8BcSIEQf8BRwRAQQEhBQsgBCADQQN0dCACciECIANBAWohAwwBCwsgACgCACAFRToAACAAKAIAKAIEIAE2AgAgACgCABAWAkAgACgCACAFIAIQICIBQQFGDQAgAUEDRwRAIAFBAkYEQCAFBEAgACgCACgCCCgCECACRw0DCwUMAgsLIAAoAgAoAgQtAAQaQQFBACAAKAIAKAIIKAIQIAAoAgAoAggoAgQQIQ8LQQBBAUEAQQAQIQsIACMDIAAQIgsWAEG4ASQAIwAkAUGAgIAIJAIQDCQDCwMAAQsLtwEEAEEICxcKAAAAdQBzAGUAIABzAHQAcgBpAGMAdABBIAsdDQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHMAQcAACzkbAAAAfgBsAGkAYgAvAGkAbgB0AGUAcgBuAGEAbAAvAHQAeQBwAGUAZABhAHIAcgBhAHkALgB0AHMAQYABCzMYAAAAcwByAGMALwBsAHoAbQBhAC8AbAB6AG0AYQAtAGQAZQBjAG8AZABlAHIALgB0AHM=";return n(t)}function decodeLZMA(n,t,e){try{var r={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},o=r.data.length,s={data:[],offset:0,writeByte:function(c){var f=Math.floor(this.offset/o);this.data[f]||(this.data[f]=new Uint8Array(o)),this.data[f][this.offset%o]=c,this.offset++}};n.decompressFile(r,s);for(var u=new Uint8Array(s.offset),l=0;l<s.offset;l++)u[l]=s.data[Math.floor(l/o)][l%o];e(null,u)}catch(c){e(c)}}function decodeLZMAWithWASM(n,t,e){var r=24;try{var o=new WebAssembly.Memory({initial:16}),s=new WebAssembly.Module(n),u=new WebAssembly.Instance(s,{env:{memory:o,abort:function(){e(new Error("webAssembly abort"))}}}),l=u.exports,c=l.newU8Array(t.length),f=new Uint8Array(o.buffer,c+r,t.length);f.set(t);var p=l.decode(c),d=new Uint32Array(o.buffer,p,4),h=d[0],g=d[2],m=d[3];h?e(null,new Uint8Array(o.buffer,m+r,g).slice(0,g)):e(new Error("lzma deocder error"))}catch(E){e(E)}}var lzmaWorkerSource=`
405
+ `),r=0;r<e.length;r++){var o=e[r],s=o.indexOf(":"),u=o.slice(0,s).trim().toLowerCase(),l=o.slice(s+1).trim();l&&(t[u]?t[u]+=", "+l:t[u]=l)}return t}function matchJsonpFunctionName(n){for(var t=0,e=JSONP_REGEXPS;t<e.length;t++){var r=e[t],o=n.match(r);if(o)return"jsonp_"+o[1]}return null}function isJsonp(n){return matchJsonpFunctionName(n)!==null}var NetworkSubscribe=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t})(Subscribe);function ajax(n,t,e,r,o){t===void 0&&(t={}),e===void 0&&(e=noop),r===void 0&&(r=noop),o===void 0&&(o=noop);var s=now(),u=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(l){return locationIsHttps&&/^http\:/.test(l)?(console.warn("The page at '".concat(locationHref,"' was loaded over HTTPS, but requested an insecure element '").concat(l,"'. This request was automatically upgraded to HTTPS")),l.replace(/^http\:/,"https:")):l}).catch(function(l){var c;matchJsonpFunctionName(n);var f=new NetworkProxyError(u,"XMLHttpRequest",l&&l.message?String(l.message):String(l));return(c=t.networkSubscribe)===null||c===void 0||c.emit("network",n,"XMLHttpRequest","forbidden",f.message),Promise.reject(f)}).then(function(l){return new Promise(function(c,f){var p=matchJsonpFunctionName(l);if(p){var d=window,h=null,g=!1,m=document.createElement("script"),E=function(){var R;if(h=null,g!==!0){g=!0;var I=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(I),f(I),(R=t.networkSubscribe)===null||R===void 0||R.emit("network",l,"XMLHttpRequest","timeout",I.message)}},y=function(R){var I,H,C=now(),M=C-s;if(delete d[p],m.parentNode&&m.parentNode.removeChild(m),h!==null&&(window.clearTimeout(h),h=null),g!==!0){if(R.indexOf("data:")!==0){var B=new NetworkResponseError(l,"XMLHttpRequest",500);r(B),f(B),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"XMLHttpRequest","error",B.message);return}var L=R.split(","),O=(L[0].match(/:(.*?);/)||[])[1],k=L[1];if(t.responseType==="arraybuffer"||t.responseType==="blob"){for(var D=atob(L[1]),q=D.length,z=new Uint8Array(q),J=0;J<q;J++)z[J]=D.charCodeAt(J);t.responseType==="arraybuffer"?k=z.buffer:k=new Blob([z],{type:O})}var V={},U={body:k,meta:{origin:u,source:l,requestTime:s,responseTime:C,costs:M,headers:V}};e(U),c(U),(H=t.networkSubscribe)===null||H===void 0||H.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(U.meta)),g=!0}};d[p]=y,m.src=l,document.body.appendChild(m),typeof t.timeout=="number"&&(h=window.setTimeout(E,t.timeout))}else{var v=!1,A=new XMLHttpRequest,b=function(){A&&(A.removeEventListener("timeout",T,!1),A.removeEventListener("progress",_,!1),A.removeEventListener("load",S,!1),A.removeEventListener("error",w,!1)),A=null,b=noop},T=function(){var R;if(v!==!0){v=!0,b();var I=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(I),f(I),(R=t.networkSubscribe)===null||R===void 0||R.emit("network",l,"XMLHttpRequest","timeout",I.message)}},_=function(R){v!==!0&&R.lengthComputable&&(R.total<=0||o(R.loaded/R.total))},S=function(R){var I;if(v!==!0){var H=this.status;if(H===0||H>=200&&H<400){v=!0,b();var C=now(),M=C-s,B=parseHeaders(this.getAllResponseHeaders()),L=R.total,O={body:this.response,meta:{origin:u,source:l,requestTime:s,responseTime:C,costs:M,headers:B,size:L}};e(O),c(O),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(O.meta))}else w.call(this)}},w=function(){var R;if(v!==!0){v=!0,b();var I=new NetworkResponseError(l,"XMLHttpRequest",this.status);r(I),f(I),(R=t.networkSubscribe)===null||R===void 0||R.emit("network",l,"XMLHttpRequest","error",I.message)}};A.addEventListener("timeout",T,!1),A.addEventListener("progress",_,!1),A.addEventListener("load",S,!1),A.addEventListener("error",w,!1),t.responseType&&(A.responseType=t.responseType),typeof t.timeout=="number"&&(A.timeout=t.timeout),A.open("GET",l,!0),A.send(null)}})})}var preloadCache={};function preload(n,t){t===void 0&&(t={});var e=now(),r=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(o){return locationIsHttps&&/^http\:/.test(o)?(console.warn("The page at '".concat(locationHref,"' was loaded over HTTPS, but requested an insecure element '").concat(o,"'. This request was automatically upgraded to HTTPS")),o.replace(/^http\:/,"https:")):o}).catch(function(o){var s,u=new NetworkProxyError(r,"Link",o&&o.message?String(o.message):String(o));return(s=t.networkSubscribe)===null||s===void 0||s.emit("network",n,"Link","forbidden",u.message),Promise.reject(u)}).then(function(o){return o in preloadCache?preloadCache[o]:preloadCache[o]=new Promise(function(s,u){var l=document.head||document.getElementsByTagName("head")[0],c=document.createElement("link"),f=!1,p=null;c.onload=function(d){var h;if(p!==null&&(clearTimeout(p),p=null),f!==!0){f=!0,s(),c.onerror=noop,c.onload=noop;var g=now(),m=g-e,E={},y={origin:r,source:o,requestTime:e,responseTime:g,costs:m,headers:E};(h=t.networkSubscribe)===null||h===void 0||h.emit("network",o,"Link","preload",JSON.stringify(y))}},c.onerror=function(d){var h;if(p!==null&&(clearTimeout(p),p=null),f!==!0){f=!0,delete preloadCache[o],l&&c.parentNode===l&&l.removeChild(c);var g=new NetworkResponseError(o,"Link",0);u(g),c.onerror=noop,c.onload=noop,(h=t.networkSubscribe)===null||h===void 0||h.emit("network",o,"Link","error",g.message)}},typeof t.timeout=="number"&&(p=window.setTimeout(function(){var d;if(p=null,f!==!0){f=!0,s(),c.onerror=noop,c.onload=noop;var h=now(),g=h-e,m={},E={origin:r,source:o,requestTime:e,responseTime:h,costs:g,headers:m};(d=t.networkSubscribe)===null||d===void 0||d.emit("network",o,"Link","timeout",JSON.stringify(E))}},t.timeout)),c.rel=c.relList&&c.relList.supports("prefetch")?"prefetch":"preload",c.as="fetch",c.crossOrigin="",c.fetchPriority="high",c.href=o,l&&l.appendChild(c)})})}function loadImage(n,t,e,r,o,s){t===void 0&&(t={}),e===void 0&&(e=noop),r===void 0&&(r=noop),o===void 0&&(o=noop);var u=now(),l=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(c){return locationIsHttps&&/^http\:/.test(c)?(console.warn("The page at '".concat(locationHref,"' was loaded over HTTPS, but requested an insecure element '").concat(c,"'. This request was automatically upgraded to HTTPS")),c.replace(/^http\:/,"https:")):c}).catch(function(c){var f,p=new NetworkProxyError(l,"Image",c&&c.message?String(c.message):String(c));return(f=t.networkSubscribe)===null||f===void 0||f.emit("network",n,"Image","forbidden",p.message),Promise.reject(p)}).then(function(c){return isJsonp(c)?ajax(c,{responseType:"blob",networkSubscribe:t.networkSubscribe}).then(function(f){return URL.createObjectURL(f.body)}):c}).then(function(c){return new Promise(function(f,p){var d=s!=null?s:new Image,h=!1,g=null,m=function(){var y;if(d.onload=noop,d.onerror=noop,g!==null&&(clearTimeout(g),g=null),h!==!0){var v=now(),A={headers:{},origin:l,source:c,requestTime:u,responseTime:v,costs:v-u};h=!0;var b={body:d,meta:A};o(1),e(b),f(b),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","ok",JSON.stringify(b.meta))}},E=function(){var y;if(d.onload=noop,d.onerror=noop,g!==null&&(clearTimeout(g),g=null),h!==!0){h=!0;var v=new NetworkResponseError(c,"Image",0);r(v),p(v),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","ok",v.message)}};typeof t.timeout=="number"&&(g=window.setTimeout(function(){var y;if(d.onload=noop,d.onerror=noop,g=null,h!==!0){h=!0;var v=new NetworkTimeoutError(c,"Image",t.timeout);r(v),p(v),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","timeout",v.message)}},t.timeout)),d.onload=m,d.onerror=E,o(0),d.src=c})})}var Fetcher=(function(){function n(t){t===void 0&&(t={}),this.options=t}return n.prototype.ajax=function(t,e,r,o,s){var u;e===void 0&&(e={}),r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);var l=this.options,c={responseType:e.responseType,timeout:(u=e.timeout)!==null&&u!==void 0?u:l.timeout,get requestProxy(){var f;return(f=e.requestProxy)!==null&&f!==void 0?f:l.requestProxy},get networkSubscribe(){var f;return(f=e.networkSubscribe)!==null&&f!==void 0?f:l.networkSubscribe}};return ajax(t,c,r,o,s)},n.prototype.loadImage=function(t,e,r,o,s,u){var l;e===void 0&&(e={}),r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);var c=this.options,f={timeout:(l=e.timeout)!==null&&l!==void 0?l:c.timeout,get requestProxy(){var p;return(p=e.requestProxy)!==null&&p!==void 0?p:c.requestProxy},get networkSubscribe(){var p;return(p=e.networkSubscribe)!==null&&p!==void 0?p:c.networkSubscribe}};return loadImage(t,f,r,o,s,u)},n.prototype.preload=function(t,e){var r;e===void 0&&(e={});var o=this.options,s={timeout:(r=e.timeout)!==null&&r!==void 0?r:o.timeout,get requestProxy(){var u;return(u=e.requestProxy)!==null&&u!==void 0?u:o.requestProxy},get networkSubscribe(){var u;return(u=e.networkSubscribe)!==null&&u!==void 0?u:o.networkSubscribe}};return preload(t,s)},n})(),internalFetcher=new Fetcher;function pick(n,t){for(var e={},r=0,o=t;r<o.length;r++){var s=o[r];s in n&&(e[s]=n[s])}return e}function omit(n,t){for(var e={},r=new Set(t),o=0,s=Object.keys(n);o<s.length;o++){var u=s[o];r.has(u)||(e[u]=n[u])}return e}function omitUndefinedFields(n){var t={};for(var e in n){var r=n[e];r!==void 0&&(t[e]=r)}return t}var hrefAElement=typeof document!="undefined"?document.createElement("a"):{href:""};function isAbsoluteURL(n){return n.indexOf("/")===0||/^[0-9a-z]+\:/i.test(n)}function getFullURL(n){if(typeof URL!="undefined"&&typeof location!="undefined")return new URL(n,location.href).href;hrefAElement.href=n;var t=hrefAElement.href;return hrefAElement.href="",t}function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(l){return(l!=null?l:"").trim()}).filter(function(l){return l.length>0&&!/^\/+$/.test(l)});for(var r=0;r<n.length;r++){var o=r===0,s=r===n.length-1,u=n[r];o||(u=u.replace(/^\.\//,"").replace(/^\/+/,"")),s||(u=u.replace(/\/+$/,"")),e.push(u)}return e.join("/")}function appendSearch(n,t){if(t===void 0&&(t=""),(t[0]==="?"||t[0]==="&")&&(t=t.slice(1)),!t)return n;var e=n.indexOf("#"),r="";return e>=0&&(r=n.slice(e),n=n.slice(0,e)),(n[n.length-1]==="?"||n[n.length-1]==="&")&&(n=n.slice(0,-1)),n.indexOf("?")>=0?"".concat(n,"&").concat(t).concat(r):"".concat(n,"?").concat(t).concat(r)}function normalizeURL(n){var t,e=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(n);if(!e)return n;var r=e[1]||"",o=n.slice(r.length+2),s=o.indexOf("#");s>=0&&(n.slice(s),o=n.slice(0,s));var u=o.indexOf("?");u>=0&&(n.slice(u),o=n.slice(0,u));for(var l=o.split("/"),c=l.shift(),f=(t=l.pop())!==null&&t!==void 0?t:"",p=[],d=0,h=l;d<h.length;d++){var g=h[d];if(!(g===""||g===".")){if(g===".."){p.pop();continue}p.push(g)}}return r+"//"+c+"/"+p.join("/")+"/"+f}function getExtname(n){var t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(n);if(t){var e=String(t[1]).trim().split(".").slice(1).reverse()[0];if(e)return"."+e}return""}var webp="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAIAAUAmJaQAA3AA/vz0AAA=",avif="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAGhbWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAsaWxvYwAAAABEAAACAAEAAAABAAAB3gAAABkAAgAAAAEAAAHJAAAAFQAAAEJpaW5mAAAAAAACAAAAGmluZmUCAAAAAAEAAGF2MDFDb2xvcgAAAAAaaW5mZQIAAAAAAgAAYXYwMUFscGhhAAAAABppcmVmAAAAAAAAAA5hdXhsAAIAAQABAAAA12lwcnAAAACxaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIAAoAAAAAUaXNwZQAAAAAAAAACAAAAAgAAAA5waXhpAAAAAAEIAAAADGF2MUOBABwAAAAAOGF1eEMAAAAAdXJuOm1wZWc6bXBlZ0I6Y2ljcDpzeXN0ZW1zOmF1eGlsaWFyeTphbHBoYQAAAAAeaXBtYQAAAAAAAAACAAEEAQKDBAACBAUGhwgAAAA2bWRhdBIACgQYADLVMgsWQBhhIAQqrNj/+BIACgUYADLEoDIOFkADDDDCQAACDaqCCb4=",heif="data:image/heif;base64,AAAAGGZ0eXBoZWljAAAAAG1pZjFoZWljAAABL21ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAHBpY3QAAAAAAAAAAAAAAAAAAAAADnBpdG0AAAAAAAEAAAAjaWluZgAAAAAAAQAAABVpbmZlAgAAAAABAABodmMxAAAAAK9pcHJwAAAAkmlwY28AAAB2aHZjQwEBYAAAAAAAAAAAAADwAPz9+PgAACcDoAABAB5AAQwG//8BYAAAAwAAAwAAAwAAAwAAAwAAreTLgSChAAEAI0IBBwFgAAADAAADAAADAAADAAADAAChInJJlreTLySZNdggogABAAdEAcA98DMkAAAAFGlzcGUAAAAAAAAAAgAAAAIAAAAVaXBtYQAAAAAAAAABAAECgQIAAAAiaWxvYwAAAABEQAABAAEAAAAAAU8AAQAAAAAAAAAOAAAAFm1kYXQAAAAKJgGvLvkQwuWM4A==";function checkImage(n){return new Promise(function(t){if(typeof Image=="undefined"){t(!1);return}var e=new Image,r=setTimeout(function(){e.onload=e.onerror=function(){},clearTimeout(r),t(!1)},100);e.onload=e.onerror=function(){e.onload=e.onerror=function(){},clearTimeout(r),t(e.height===2)},e.src=n})}var imageSupportCache=null;function imageSupport(){return imageSupportCache||(imageSupportCache=Promise.all([checkImage(webp),checkImage(avif),checkImage(heif)]).then(function(n){return{webp:n[0],avif:n[1],heif:n[2]}}))}var _a$5,supportAvif=!1,supportWebp=!1,supportHeif=!1;imageSupport().then(function(n){supportAvif=n.avif,supportWebp=n.webp,supportHeif=n.heif});var IMAGE_FORMATS=["jpg","jpeg","png","heif","heic","webp","avif"];function isImageExt(n){return IMAGE_FORMATS.indexOf(n)>=0}var DEFAULT_IMAGE_URL_MAPPINGS={"vrlab-public.ljcdn.com":{type:"tencentCloud",pano:["vrlab-image1.ljcdn.com","vrlab-image2.ljcdn.com"],texture:["vrlab-image3.ljcdn.com"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["vr-image-1.realsee-cdn.cn","vr-image-2.realsee-cdn.cn"],texture:["vr-image-3.realsee-cdn.cn"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"vr-public.rscdn.cn":{type:"tencentCloud",pano:["vr-image-1.rscdn.cn","vr-image-2.rscdn.cn"],texture:["vr-image-3.rscdn.cn"],tile:["vr-tile-1.rscdn.cn","vr-tile-2.rscdn.cn"],model:["vr-model-1.rscdn.cn","vr-model-2.rscdn.cn"],default:["vr-image-4.rscdn.cn"]},"mars-public.realsee-cdn.cn":{type:"aliyun",pano:["mars-image-1.realsee-cdn.cn","mars-image-2.realsee-cdn.cn"],texture:["mars-image-3.realsee-cdn.cn"],tile:["mars-tile-1.realsee-cdn.cn","mars-tile-2.realsee-cdn.cn"],model:["mars-model-1.realsee-cdn.cn","mars-model-2.realsee-cdn.cn"],default:["mars-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{type:"tencentCloud",pano:["global-image-1.realsee-cdn.com","global-image-2.realsee-cdn.com"],texture:["global-image-3.realsee-cdn.com"],tile:["global-tile-1.realsee-cdn.com","global-tile-2.realsee-cdn.com"],model:["global-model-1.realsee-cdn.com","global-model-2.realsee-cdn.com"],default:["global-image-4.realsee-cdn.com"]},"earth-ga-public.realsee-cdn.cn":{type:"tencentCloud",pano:["earth-ga-image-1.realsee-cdn.cn","earth-ga-image-2.realsee-cdn.cn"],texture:["earth-ga-image-3.realsee-cdn.cn"],tile:["earth-ga-tile-1.realsee-cdn.cn","earth-ga-tile-2.realsee-cdn.cn"],model:["earth-ga-model-1.realsee-cdn.cn","earth-ga-model-2.realsee-cdn.cn"],default:["earth-ga-image-4.realsee-cdn.cn"]},"test-vr-public.realsee-cdn.com":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],texture:["test-vr-image.realsee-cdn.com"],tile:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],model:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],texture:["test-vr-image.realsee-cdn.cn"],tile:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],model:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],default:["test-vr-image.realsee-cdn.cn"]}},URL_DOMAIN_REGEX=/^https?\:\/\/?([^\/]+)/;function getDomain(n){var t=n.match(URL_DOMAIN_REGEX);return t===null?null:t[1]}function replaceDomain(n,t,e){var r,o,s=(o=(r=t[e])!==null&&r!==void 0?r:t[t.length-1])!==null&&o!==void 0?o:n;return n.replace(URL_DOMAIN_REGEX,function(u,l){return u.slice(0,u.length-l.length)+s})}function route(n,t,e){var r=t.split("."),o=r[0],s=r.slice(1);if(o==="texture")return replaceDomain(n,e.texture,0);if(o==="pano"){s[0];var u=s[1];switch(u){case"front":case"left":case"up":return replaceDomain(n,e.pano,0);case"down":case"right":case"back":return replaceDomain(n,e.pano,1)}}else if(o==="pano_tile"){s[0],s[1];var l=s[2],c=s[3],f=s[4],p=Math.pow(2,Number(l))*Number(c)+Number(f);if(!isNaN(p))return replaceDomain(n,e.tile,p%2)}else if(o==="model"){var d=s[0],p=Number(d);if(!isNaN(p))return replaceDomain(n,e.model,p%2)}return replaceDomain(n,e.default,0)}var tencentCloudImageProcesser=function(n,t){var e=n.split("?")[0],r=e.split(".").pop();if(r==="jpeg"&&(r="jpg"),r==="heif"&&(r="heic"),r&&!isImageExt(r))return n;var o=[],s=t.format,u=t.cut,l=t.quality,c=t.size,f=t.sharpen,p=t.forceUseExifOrientation;if(s==="jpeg"&&(s="jpg"),s==="heif"&&(s="heic"),(!supportAvif&&(s!=null?s:r)==="avif"||!supportWebp&&(s!=null?s:r)==="webp"||!supportHeif&&(s!=null?s:r)==="heic")&&(s="jpg"),s!==void 0&&s!==r&&o.push("format/".concat(s)),u!==void 0&&o.push("cut/".concat(u[2],"x").concat(u[3],"x").concat(u[0],"x").concat(u[1])),l!==void 0){var d=s!=null?s:r;d&&["jpg","webp","heic","avif"].indexOf(d)>=0&&o.push("quality/".concat(l))}if(c!==void 0){var h=n.match(/\/cube_(\d+)\//),g=h?Number(h[1]):NaN;g!==Number(c)&&o.push("thumbnail/".concat(c,"x"))}f!==void 0&&o.push("sharpen/".concat(f)),p===!0&&o.push("auto-orient");var m="";return o.length&&(m="?imageMogr2/"+o.join("/")),e+m},aliyunOOSImageProcesser=function(n,t){var e=n.split("?")[0],r=e.split(".").pop();if(r==="jpeg"&&(r="jpg"),r==="heif"&&(r="heic"),r&&!isImageExt(r))return n;var o=[],s=t.format,u=t.cut,l=t.quality,c=t.size,f=t.sharpen;if(s==="jpeg"&&(s="jpg"),s==="heif"&&(s="heic"),(!supportAvif&&(s!=null?s:r)==="avif"||!supportWebp&&(s!=null?s:r)==="webp"||!supportHeif&&(s!=null?s:r)==="heic")&&(s="jpg"),s!==void 0&&s!==r&&o.push("format,".concat(s)),u!==void 0){var p=u[0],d=u[1],h=u[2],g=u[3];o.push("crop,x_".concat(p,",y_").concat(d,",w_").concat(h,",h_").concat(g,",g_nw"))}if(l!==void 0&&l!==100){var m=s!=null?s:r;m&&["jpg","webp","heic","avif"].indexOf(m)>=0&&o.push("quality,Q_".concat(l))}c&&c!==2048&&o.push("resize,w_".concat(c)),f!==void 0&&o.push("sharpen,".concat(f));var E="";return o.length&&(E="?x-oss-process=image/"+o.join("/")),e+E},MAX_SAFE_INTEGER=9007199254740991;function formatNumber(n){var t=Math.round(n);return Math.abs(t-n)<.001?t:Math.floor(n)}function formatOptions(n){return n=Object.assign({},n),n.size!==void 0&&(n.size=formatNumber(clamp$1(n.size,0,MAX_SAFE_INTEGER))),n.quality!==void 0&&(n.quality=formatNumber(clamp$1(n.quality,0,100))),n.cut!==void 0&&(n.cut=[formatNumber(clamp$1(n.cut[0],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[1],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[2],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[3],0,MAX_SAFE_INTEGER))]),n.sharpen!==void 0&&(n.sharpen=formatNumber(clamp$1(n.sharpen,0,MAX_SAFE_INTEGER))),n}function imageURL(n,t){var e=__assign(__assign({},DEFAULT_IMAGE_URL_MAPPINGS),t.mappings),r=getDomain(n);if(r===null)return n;t=formatOptions(t);var o=e[r];return o?(n=route(n,t.key,o),/\.basis(\?|$)/.test(n)&&(n=n.replace(/\.basis(\?|$)/,".jpg$1")),o.type==="tencentCloud"?tencentCloudImageProcesser(n,t):o.type==="aliyun"?aliyunOOSImageProcesser(n,t):n):n}function applyImageURLOptions(n,t,e){t===void 0&&(t=imageURL);var r=t(n,e);if(r===n&&e.cut)throw new Error("ImageURL: cut option not applied.");return r}var IMAGE_SIZE_REG=/\/cube_(\d+)\//;function getImageSizeFromURL(n){var t=n.match(IMAGE_SIZE_REG);return t?Number(t[1]):null}function replaceImageSize(n,t){return n.replace(IMAGE_SIZE_REG,"/cube_".concat(t,"/"))}var log2=(_a$5=Math.log2)!==null&&_a$5!==void 0?_a$5:(function(n){return Math.log(n)*Math.LOG2E});function getImageSizeLevel(n){return Math.floor(Math.max(log2(n/512),0))}var windowSTOContext=(function(){var n=now();return{requestAnimationFrame:function(t){var e=now(),r=clamp$1(16+(e-n),16,33),o=setTimeout(function(){t(dateNowToDomHighResTimeStamp(e+r))},r);return n=e+r,o},cancelAnimationFrame:function(t){return clearTimeout(t)}}})(),windowRAFContext=(function(){return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?{requestAnimationFrame:function(n){return requestAnimationFrame(n)},cancelAnimationFrame:function(n){return cancelAnimationFrame(n)}}:windowSTOContext})(),DEFAULT_ORDER=5,deviceFrameTime=16,AnimationFrameLoop=(function(){function n(){var t=this;this.loopType="raf",this.frames=[],this.isAnimating=!1,this.context=null;var e=now();this.loop=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];if(t.isAnimating!==!1){var s=now(),u=Math.max(s-e,0);e=s,deviceFrameTime=u;for(var l=t.frames.slice(),c=0;c<l.length;c++){var f=l[c];if(f.delay>0){f.delay=f.delay-1;continue}try{f.callback.apply(f,__spreadArray([s,u],r,!1))}catch(p){console.error(p)}f.calls++}for(var c=t.frames.length-1;c>=0;c--){var f=t.frames[c];f.once&&f.calls>0&&t.frames.splice(c,1)}t.requestId=t.requestAnimationFrame(t.loop)}},this.start()}return Object.defineProperty(n,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new n),this.sharedInstance},enumerable:!1,configurable:!0}),n.getFrameTime=function(){return deviceFrameTime},n.prototype.start=function(){this.isAnimating!==!0&&(this.isAnimating=!0,this.requestId=this.requestAnimationFrame(this.loop))},n.prototype.stop=function(){this.isAnimating=!1,this.cancelAnimationFrame(this.requestId)},n.prototype.setContext=function(t){t!==this.context&&(this.stop(),this.context=t,this.start())},n.prototype.getContext=function(){return this.context},n.prototype.setLoopType=function(t){t!==this.loopType&&(this.stop(),this.loopType=t,this.start())},n.prototype.getLoopType=function(){return this.loopType},n.prototype.requestAnimationFrame=function(t){var e;if(this.context?e=this.context:this.loopType==="raf"?e=windowRAFContext:this.loopType==="sto"&&(e=windowSTOContext),e)return e.requestAnimationFrame(t)},n.prototype.cancelAnimationFrame=function(t){var e;this.context?e=this.context:this.loopType==="raf"?e=windowRAFContext:this.loopType==="sto"&&(e=windowSTOContext),e&&e.cancelAnimationFrame(t)},n.prototype.remove=function(t){var e=this.frames.indexOf(t);e>=0&&this.frames.splice(e,1)},n.prototype.add=function(t,e,r,o){var s=this;e===void 0&&(e=!1),r===void 0&&(r=0),o===void 0&&(o=DEFAULT_ORDER);for(var u={callback:t,once:e,delay:r,order:o,calls:0},l=this.frames.length;--l>=0;)if(this.frames[l].order<=o){this.frames.splice(l+1,0,u);break}return l<0&&this.frames.unshift(u),function(){return s.remove(u)}},n.prototype.clear=function(){this.frames.length=0},n})(),browserSupportsImageBitmapApi=typeof createImageBitmap!="undefined"&&typeof ImageBitmap!="undefined",_useNativeImageBitmap=!1;function useNativeImageBitmap(n){_useNativeImageBitmap=n}function canUseNativeImageBitmap(){return _useNativeImageBitmap===!1?!1:browserSupportsImageBitmapApi}function createImageBitmapLikeImage(n){n===void 0&&(n={});var t=n.onClose,e=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){t&&t.call(this),this.onerror=this.onload=this.close=noop,this.removeAttribute("src"),t=void 0}});return e}function createImageBitmapLike(n){if(canUseNativeImageBitmap())return createImageBitmap(n);var t=URL.createObjectURL(n),e=function(){this.src===t&&URL.revokeObjectURL(t)};return new Promise(function(r,o){var s=createImageBitmapLikeImage({onClose:e});s.onload=function(){s.src===t&&URL.revokeObjectURL(t),s.onload=s.onerror=noop,AnimationFrameLoop.shared.add(function(){r(s)},!0)},s.onerror=function(){var u=s.src;s.onload=s.onerror=noop,s.close(),o(new Error("image load error: ".concat(u)))},s.decoding="async",s.src=t})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.pop();if(e)return e.width=n,e.height=t,e;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop,canvasPool.push(r)}});return r}function imageBitmapToTexture(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=createCanvas(Math.min(n.width,t.width),Math.min(n.height,t.height)),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.drawImage(n,0,0,e.width,e.height),n.close();var o=new THREE__namespace.Texture(e);o.needsUpdate=!0,o.flipY=!0;var s=o.dispose;return o.dispose=function(){e.close(),s.call(o),o.dispose=s},o}else{var u=new THREE__namespace.Texture(n);u.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?u.flipY=!1:u.flipY=!0,u.flipY===!1&&(u.repeat.y*=-1,u.offset.y+=1,u.updateMatrix());var l=u.dispose;return u.dispose=function(){this.image&&this.image.close(),l.call(u),u.dispose=l},u}}function imageBitmapsToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){if(Array.isArray(this.images))for(var r=0,o=this.images;r<o.length;r++){var s=o[r];s.close()}e.call(t),t.dispose=e},t}var FACE_ORDER$2=["right","left","up","down","front","back"],TextureLoader=(function(){function n(){}return n.prototype.loadTexture=function(t,e,r,o,s,u){var l,c,f,p,d,h,g;r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);var m={};if(typeof e.flipY!="undefined"&&(m.flipY=e.flipY),typeof e.format!="undefined")m.format=e.format;else{var E=getExtname(t);(E===".jpg"||E===".jpeg")&&(m.format=THREE__namespace.RGBFormat)}typeof e.encoding!="undefined"&&(m.encoding=e.encoding),m.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,m.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,m.magFilter=(f=e.magFilter)!==null&&f!==void 0?f:THREE__namespace.LinearFilter;var y=(d=(p=e.imageURL)===null||p===void 0?void 0:p.options)!==null&&d!==void 0?d:{key:"unknown"};t=applyImageURLOptions(t,(h=e.imageURL)===null||h===void 0?void 0:h.transform,y);var v=(g=e.viaAjax)!==null&&g!==void 0?g:canUseNativeImageBitmap;if(v){var A=null,b="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:b},void 0,void 0,s).then(function(S){return createImageBitmapLike(S.body)}).then(function(S){return imageBitmapToTexture(S,e.maxSize)}).then(function(S){return Object.assign(S,m),S}).then(function(S){var w={meta:A,body:S};return r(w),w}).catch(function(S){return o(S),Promise.reject(S)})}else{var T=null,_;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(S){return _=S,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,s,S)}).then(function(S){return T=S.meta,imageBitmapToTexture(S.body,e.maxSize)}).then(function(S){return Object.assign(S,m),S}).then(function(S){var w={meta:T,body:S};return r(w),w}).catch(function(S){return _&&_.close(),o(S),Promise.reject(S)})}},n.prototype.loadCubeTexture=function(t,e,r,o,s,u){var l,c,f,p,d,h,g;r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);var m={};if(typeof e.format!="undefined")m.format=e.format;else{for(var E=!0,y=0,v=FACE_ORDER$2;y<v.length;y++){var A=v[y],b=getExtname(t[A]);if(b!==".jpg"&&b!==".jpeg"){E=!1;break}}E&&(m.format=THREE__namespace.RGBFormat)}m.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,m.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,m.magFilter=(f=e.magFilter)!==null&&f!==void 0?f:THREE__namespace.LinearFilter;for(var T=[t[FACE_ORDER$2[0]],t[FACE_ORDER$2[1]],t[FACE_ORDER$2[2]],t[FACE_ORDER$2[3]],t[FACE_ORDER$2[4]],t[FACE_ORDER$2[5]]],_=[],S=[0,0,0,0,0,0],w=[],R=function(H){var C=(d=(p=e.imageURL)===null||p===void 0?void 0:p.options)!==null&&d!==void 0?d:{key:"unknown"},M=applyImageURLOptions(T[H],(h=e.imageURL)===null||h===void 0?void 0:h.transform,__assign(__assign({},C),{key:C.key+"."+FACE_ORDER$2[H]})),B=function(q){S[H]=q,s(S.reduce(function(z,J){return z+J},0)/6)},L=(g=e.viaAjax)!==null&&g!==void 0?g:!1;if(L){var O="blob",k=e.fetcher.ajax(M,{timeout:e.timeout,responseType:O},void 0,void 0,B).then(function(q){return w[H]=q.meta,createImageBitmapLike(q.body)});_.push(k)}else{var D,k=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(z){return D=z,e.fetcher.loadImage(M,{timeout:e.timeout},void 0,void 0,B,z)}).then(function(z){return w[H]=z.meta,z.body}).catch(function(z){return D&&D.close(),Promise.reject(z)});_.push(k)}},I=0;I<6;I++)R(I);return Promise.all(_).then(function(H){return imageBitmapsToCubeTexture(H)}).then(function(H){return Object.assign(H,__assign({encoding:THREE__namespace.sRGBEncoding},m)),H}).then(function(H){var C={body:H,meta:w};return r(C),C}).catch(function(H){for(var C=0,M=_;C<M.length;C++){var B=M[C];B.then(function(L){return L.close()}).catch(noop)}return o(H),Promise.reject(H)})},n})(),commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},indexMinimal={},minimal$1={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=n;function n(t,e){for(var r=new Array(arguments.length-1),o=0,s=2,u=!0;s<arguments.length;)r[o++]=arguments[s++];return new Promise(function(c,f){r[o]=function(d){if(u)if(u=!1,d)f(d);else{for(var h=new Array(arguments.length-1),g=0;g<h.length;)h[g++]=arguments[g];c.apply(null,h)}};try{t.apply(e||null,r)}catch(p){u&&(u=!1,f(p))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,(function(n){var t=n;t.length=function(l){var c=l.length;if(!c)return 0;for(var f=0;--c%4>1&&l.charAt(c)==="=";)++f;return Math.ceil(l.length*3)/4-f};for(var e=new Array(64),r=new Array(123),o=0;o<64;)r[e[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(l,c,f){for(var p=null,d=[],h=0,g=0,m;c<f;){var E=l[c++];switch(g){case 0:d[h++]=e[E>>2],m=(E&3)<<4,g=1;break;case 1:d[h++]=e[m|E>>4],m=(E&15)<<2,g=2;break;case 2:d[h++]=e[m|E>>6],d[h++]=e[E&63],g=0;break}h>8191&&((p||(p=[])).push(String.fromCharCode.apply(String,d)),h=0)}return g&&(d[h++]=e[m],d[h++]=61,g===1&&(d[h++]=61)),p?(h&&p.push(String.fromCharCode.apply(String,d.slice(0,h))),p.join("")):String.fromCharCode.apply(String,d.slice(0,h))};var s="invalid encoding";t.decode=function(l,c,f){for(var p=f,d=0,h,g=0;g<l.length;){var m=l.charCodeAt(g++);if(m===61&&d>1)break;if((m=r[m])===void 0)throw Error(s);switch(d){case 0:h=m,d=1;break;case 1:c[f++]=h<<2|(m&48)>>4,h=m,d=2;break;case 2:c[f++]=(h&15)<<4|(m&60)>>2,h=m,d=3;break;case 3:c[f++]=(h&3)<<6|m,d=0;break}}if(d===1)throw Error(s);return f-p},t.test=function(l){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(l)}})(base64)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=n;function n(){this._listeners={}}return n.prototype.on=function(e,r,o){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:o||this}),this},n.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var o=this._listeners[e],s=0;s<o.length;)o[s].fn===r?o.splice(s,1):++s;return this},n.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var o=[],s=1;s<arguments.length;)o.push(arguments[s++]);for(s=0;s<r.length;)r[s].fn.apply(r[s++].ctx,o)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=n(n);function n(s){return typeof Float32Array!="undefined"?(function(){var u=new Float32Array([-0]),l=new Uint8Array(u.buffer),c=l[3]===128;function f(g,m,E){u[0]=g,m[E]=l[0],m[E+1]=l[1],m[E+2]=l[2],m[E+3]=l[3]}function p(g,m,E){u[0]=g,m[E]=l[3],m[E+1]=l[2],m[E+2]=l[1],m[E+3]=l[0]}s.writeFloatLE=c?f:p,s.writeFloatBE=c?p:f;function d(g,m){return l[0]=g[m],l[1]=g[m+1],l[2]=g[m+2],l[3]=g[m+3],u[0]}function h(g,m){return l[3]=g[m],l[2]=g[m+1],l[1]=g[m+2],l[0]=g[m+3],u[0]}s.readFloatLE=c?d:h,s.readFloatBE=c?h:d})():(function(){function u(c,f,p,d){var h=f<0?1:0;if(h&&(f=-f),f===0)c(1/f>0?0:2147483648,p,d);else if(isNaN(f))c(2143289344,p,d);else if(f>34028234663852886e22)c((h<<31|2139095040)>>>0,p,d);else if(f<11754943508222875e-54)c((h<<31|Math.round(f/1401298464324817e-60))>>>0,p,d);else{var g=Math.floor(Math.log(f)/Math.LN2),m=Math.round(f*Math.pow(2,-g)*8388608)&8388607;c((h<<31|g+127<<23|m)>>>0,p,d)}}s.writeFloatLE=u.bind(null,t),s.writeFloatBE=u.bind(null,e);function l(c,f,p){var d=c(f,p),h=(d>>31)*2+1,g=d>>>23&255,m=d&8388607;return g===255?m?NaN:h*(1/0):g===0?h*1401298464324817e-60*m:h*Math.pow(2,g-150)*(m+8388608)}s.readFloatLE=l.bind(null,r),s.readFloatBE=l.bind(null,o)})(),typeof Float64Array!="undefined"?(function(){var u=new Float64Array([-0]),l=new Uint8Array(u.buffer),c=l[7]===128;function f(g,m,E){u[0]=g,m[E]=l[0],m[E+1]=l[1],m[E+2]=l[2],m[E+3]=l[3],m[E+4]=l[4],m[E+5]=l[5],m[E+6]=l[6],m[E+7]=l[7]}function p(g,m,E){u[0]=g,m[E]=l[7],m[E+1]=l[6],m[E+2]=l[5],m[E+3]=l[4],m[E+4]=l[3],m[E+5]=l[2],m[E+6]=l[1],m[E+7]=l[0]}s.writeDoubleLE=c?f:p,s.writeDoubleBE=c?p:f;function d(g,m){return l[0]=g[m],l[1]=g[m+1],l[2]=g[m+2],l[3]=g[m+3],l[4]=g[m+4],l[5]=g[m+5],l[6]=g[m+6],l[7]=g[m+7],u[0]}function h(g,m){return l[7]=g[m],l[6]=g[m+1],l[5]=g[m+2],l[4]=g[m+3],l[3]=g[m+4],l[2]=g[m+5],l[1]=g[m+6],l[0]=g[m+7],u[0]}s.readDoubleLE=c?d:h,s.readDoubleBE=c?h:d})():(function(){function u(c,f,p,d,h,g){var m=d<0?1:0;if(m&&(d=-d),d===0)c(0,h,g+f),c(1/d>0?0:2147483648,h,g+p);else if(isNaN(d))c(0,h,g+f),c(2146959360,h,g+p);else if(d>17976931348623157e292)c(0,h,g+f),c((m<<31|2146435072)>>>0,h,g+p);else{var E;if(d<22250738585072014e-324)E=d/5e-324,c(E>>>0,h,g+f),c((m<<31|E/4294967296)>>>0,h,g+p);else{var y=Math.floor(Math.log(d)/Math.LN2);y===1024&&(y=1023),E=d*Math.pow(2,-y),c(E*4503599627370496>>>0,h,g+f),c((m<<31|y+1023<<20|E*1048576&1048575)>>>0,h,g+p)}}}s.writeDoubleLE=u.bind(null,t,0,4),s.writeDoubleBE=u.bind(null,e,4,0);function l(c,f,p,d,h){var g=c(d,h+f),m=c(d,h+p),E=(m>>31)*2+1,y=m>>>20&2047,v=4294967296*(m&1048575)+g;return y===2047?v?NaN:E*(1/0):y===0?E*5e-324*v:E*Math.pow(2,y-1075)*(v+4503599627370496)}s.readDoubleLE=l.bind(null,r,0,4),s.readDoubleBE=l.bind(null,o,4,0)})(),s}function t(s,u,l){u[l]=s&255,u[l+1]=s>>>8&255,u[l+2]=s>>>16&255,u[l+3]=s>>>24}function e(s,u,l){u[l]=s>>>24,u[l+1]=s>>>16&255,u[l+2]=s>>>8&255,u[l+3]=s&255}function r(s,u){return(s[u]|s[u+1]<<8|s[u+2]<<16|s[u+3]<<24)>>>0}function o(s,u){return(s[u]<<24|s[u+1]<<16|s[u+2]<<8|s[u+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(n){}return null}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,(function(n){var t=n;t.length=function(r){for(var o=0,s=0,u=0;u<r.length;++u)s=r.charCodeAt(u),s<128?o+=1:s<2048?o+=2:(s&64512)===55296&&(r.charCodeAt(u+1)&64512)===56320?(++u,o+=4):o+=3;return o},t.read=function(r,o,s){var u=s-o;if(u<1)return"";for(var l=null,c=[],f=0,p;o<s;)p=r[o++],p<128?c[f++]=p:p>191&&p<224?c[f++]=(p&31)<<6|r[o++]&63:p>239&&p<365?(p=((p&7)<<18|(r[o++]&63)<<12|(r[o++]&63)<<6|r[o++]&63)-65536,c[f++]=55296+(p>>10),c[f++]=56320+(p&1023)):c[f++]=(p&15)<<12|(r[o++]&63)<<6|r[o++]&63,f>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,c)),f=0);return l?(f&&l.push(String.fromCharCode.apply(String,c.slice(0,f))),l.join("")):String.fromCharCode.apply(String,c.slice(0,f))},t.write=function(r,o,s){for(var u=s,l,c,f=0;f<r.length;++f)l=r.charCodeAt(f),l<128?o[s++]=l:l<2048?(o[s++]=l>>6|192,o[s++]=l&63|128):(l&64512)===55296&&((c=r.charCodeAt(f+1))&64512)===56320?(l=65536+((l&1023)<<10)+(c&1023),++f,o[s++]=l>>18|240,o[s++]=l>>12&63|128,o[s++]=l>>6&63|128,o[s++]=l&63|128):(o[s++]=l>>12|224,o[s++]=l>>6&63|128,o[s++]=l&63|128);return s-u}})(utf8)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=n;function n(t,e,r){var o=r||8192,s=o>>>1,u=null,l=o;return function(f){if(f<1||f>s)return t(f);l+f>o&&(u=t(o),l=0);var p=e.call(u,l,l+=f);return l&7&&(l=(l|7)+1),p}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var n=requireMinimal$1();function t(s,u){this.lo=s>>>0,this.hi=u>>>0}var e=t.zero=new t(0,0);e.toNumber=function(){return 0},e.zzEncode=e.zzDecode=function(){return this},e.length=function(){return 1};var r=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(u){if(u===0)return e;var l=u<0;l&&(u=-u);var c=u>>>0,f=(u-c)/4294967296>>>0;return l&&(f=~f>>>0,c=~c>>>0,++c>4294967295&&(c=0,++f>4294967295&&(f=0))),new t(c,f)},t.from=function(u){if(typeof u=="number")return t.fromNumber(u);if(n.isString(u))if(n.Long)u=n.Long.fromString(u);else return t.fromNumber(parseInt(u,10));return u.low||u.high?new t(u.low>>>0,u.high>>>0):e},t.prototype.toNumber=function(u){if(!u&&this.hi>>>31){var l=~this.lo+1>>>0,c=~this.hi>>>0;return l||(c=c+1>>>0),-(l+c*4294967296)}return this.lo+this.hi*4294967296},t.prototype.toLong=function(u){return n.Long?new n.Long(this.lo|0,this.hi|0,!!u):{low:this.lo|0,high:this.hi|0,unsigned:!!u}};var o=String.prototype.charCodeAt;return t.fromHash=function(u){return u===r?e:new t((o.call(u,0)|o.call(u,1)<<8|o.call(u,2)<<16|o.call(u,3)<<24)>>>0,(o.call(u,4)|o.call(u,5)<<8|o.call(u,6)<<16|o.call(u,7)<<24)>>>0)},t.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)},t.prototype.zzEncode=function(){var u=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^u)>>>0,this.lo=(this.lo<<1^u)>>>0,this},t.prototype.zzDecode=function(){var u=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^u)>>>0,this.hi=(this.hi>>>1^u)>>>0,this},t.prototype.length=function(){var u=this.lo,l=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c===0?l===0?u<16384?u<128?1:2:u<2097152?3:4:l<16384?l<128?5:6:l<2097152?7:8:c<128?9:10},longbits}var hasRequiredMinimal$1;function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,(function(n){var t=n;t.asPromise=requireAspromise(),t.base64=requireBase64(),t.EventEmitter=requireEventemitter(),t.float=requireFloat(),t.inquire=requireInquire(),t.utf8=requireUtf8(),t.pool=requirePool(),t.LongBits=requireLongbits(),t.isNode=!!(typeof commonjsGlobal!="undefined"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||typeof window!="undefined"&&window||typeof self!="undefined"&&self||minimal$1,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s},t.isString=function(s){return typeof s=="string"||s instanceof String},t.isObject=function(s){return s&&typeof s=="object"},t.isset=t.isSet=function(s,u){var l=s[u];return l!=null&&s.hasOwnProperty(u)?typeof l!="object"||(Array.isArray(l)?l.length:Object.keys(l).length)>0:!1},t.Buffer=(function(){try{var o=t.inquire("buffer").Buffer;return o.prototype.utf8Write?o:null}catch(s){return null}})(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(s){return typeof s=="number"?t.Buffer?t._Buffer_allocUnsafe(s):new t.Array(s):t.Buffer?t._Buffer_from(s):typeof Uint8Array=="undefined"?s:new Uint8Array(s)},t.Array=typeof Uint8Array!="undefined"?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(s){return s?t.LongBits.from(s).toHash():t.LongBits.zeroHash},t.longFromHash=function(s,u){var l=t.LongBits.fromHash(s);return t.Long?t.Long.fromBits(l.lo,l.hi,u):l.toNumber(!!u)};function e(o,s,u){for(var l=Object.keys(s),c=0;c<l.length;++c)(o[l[c]]===void 0||!u)&&(o[l[c]]=s[l[c]]);return o}t.merge=e,t.lcFirst=function(s){return s.charAt(0).toLowerCase()+s.substring(1)};function r(o){function s(u,l){if(!(this instanceof s))return new s(u,l);Object.defineProperty(this,"message",{get:function(){return u}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:new Error().stack||""}),l&&e(this,l)}return s.prototype=Object.create(Error.prototype,{constructor:{value:s,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return o},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),s}t.newError=r,t.ProtocolError=r("ProtocolError"),t.oneOfGetter=function(s){for(var u={},l=0;l<s.length;++l)u[s[l]]=1;return function(){for(var c=Object.keys(this),f=c.length-1;f>-1;--f)if(u[c[f]]===1&&this[c[f]]!==void 0&&this[c[f]]!==null)return c[f]}},t.oneOfSetter=function(s){return function(u){for(var l=0;l<s.length;++l)s[l]!==u&&delete this[s[l]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var o=t.Buffer;if(!o){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=o.from!==Uint8Array.from&&o.from||function(u,l){return new o(u,l)},t._Buffer_allocUnsafe=o.allocUnsafe||function(u){return new o(u)}}})(minimal$1)),minimal$1}var writer,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=c;var n=requireMinimal$1(),t,e=n.LongBits,r=n.base64,o=n.utf8;function s(y,v,A){this.fn=y,this.len=v,this.next=void 0,this.val=A}function u(){}function l(y){this.head=y.head,this.tail=y.tail,this.len=y.len,this.next=y.states}function c(){this.len=0,this.head=new s(u,0,0),this.tail=this.head,this.states=null}var f=function(){return n.Buffer?function(){return(c.create=function(){return new t})()}:function(){return new c}};c.create=f(),c.alloc=function(v){return new n.Array(v)},n.Array!==Array&&(c.alloc=n.pool(c.alloc,n.Array.prototype.subarray)),c.prototype._push=function(v,A,b){return this.tail=this.tail.next=new s(v,A,b),this.len+=A,this};function p(y,v,A){v[A]=y&255}function d(y,v,A){for(;y>127;)v[A++]=y&127|128,y>>>=7;v[A]=y}function h(y,v){this.len=y,this.next=void 0,this.val=v}h.prototype=Object.create(s.prototype),h.prototype.fn=d,c.prototype.uint32=function(v){return this.len+=(this.tail=this.tail.next=new h((v=v>>>0)<128?1:v<16384?2:v<2097152?3:v<268435456?4:5,v)).len,this},c.prototype.int32=function(v){return v<0?this._push(g,10,e.fromNumber(v)):this.uint32(v)},c.prototype.sint32=function(v){return this.uint32((v<<1^v>>31)>>>0)};function g(y,v,A){for(;y.hi;)v[A++]=y.lo&127|128,y.lo=(y.lo>>>7|y.hi<<25)>>>0,y.hi>>>=7;for(;y.lo>127;)v[A++]=y.lo&127|128,y.lo=y.lo>>>7;v[A++]=y.lo}c.prototype.uint64=function(v){var A=e.from(v);return this._push(g,A.length(),A)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(v){var A=e.from(v).zzEncode();return this._push(g,A.length(),A)},c.prototype.bool=function(v){return this._push(p,1,v?1:0)};function m(y,v,A){v[A]=y&255,v[A+1]=y>>>8&255,v[A+2]=y>>>16&255,v[A+3]=y>>>24}c.prototype.fixed32=function(v){return this._push(m,4,v>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(v){var A=e.from(v);return this._push(m,4,A.lo)._push(m,4,A.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(v){return this._push(n.float.writeFloatLE,4,v)},c.prototype.double=function(v){return this._push(n.float.writeDoubleLE,8,v)};var E=n.Array.prototype.set?function(v,A,b){A.set(v,b)}:function(v,A,b){for(var T=0;T<v.length;++T)A[b+T]=v[T]};return c.prototype.bytes=function(v){var A=v.length>>>0;if(!A)return this._push(p,1,0);if(n.isString(v)){var b=c.alloc(A=r.length(v));r.decode(v,b,0),v=b}return this.uint32(A)._push(E,A,v)},c.prototype.string=function(v){var A=o.length(v);return A?this.uint32(A)._push(o.write,A,v):this._push(p,1,0)},c.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new s(u,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new s(u,0,0),this.len=0),this},c.prototype.ldelim=function(){var v=this.head,A=this.tail,b=this.len;return this.reset().uint32(b),b&&(this.tail.next=v.next,this.tail=A,this.len+=b),this},c.prototype.finish=function(){for(var v=this.head.next,A=this.constructor.alloc(this.len),b=0;v;)v.fn(v.val,A,b),b+=v.len,v=v.next;return A},c._configure=function(y){t=y,c.create=f(),t._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=e;var n=requireWriter();(e.prototype=Object.create(n.prototype)).constructor=e;var t=requireMinimal$1();function e(){n.call(this)}e._configure=function(){e.alloc=t._Buffer_allocUnsafe,e.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&t.Buffer.prototype.set.name==="set"?function(s,u,l){u.set(s,l)}:function(s,u,l){if(s.copy)s.copy(u,l,0,s.length);else for(var c=0;c<s.length;)u[l++]=s[c++]}},e.prototype.bytes=function(s){t.isString(s)&&(s=t._Buffer_from(s,"base64"));var u=s.length>>>0;return this.uint32(u),u&&this._push(e.writeBytesBuffer,u,s),this};function r(o,s,u){o.length<40?t.utf8.write(o,s,u):s.utf8Write?s.utf8Write(o,u):s.write(o,u)}return e.prototype.string=function(s){var u=t.Buffer.byteLength(s);return this.uint32(u),u&&this._push(r,u,s),this},e._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=s;var n=requireMinimal$1(),t,e=n.LongBits,r=n.utf8;function o(d,h){return RangeError("index out of range: "+d.pos+" + "+(h||1)+" > "+d.len)}function s(d){this.buf=d,this.pos=0,this.len=d.length}var u=typeof Uint8Array!="undefined"?function(h){if(h instanceof Uint8Array||Array.isArray(h))return new s(h);throw Error("illegal buffer")}:function(h){if(Array.isArray(h))return new s(h);throw Error("illegal buffer")},l=function(){return n.Buffer?function(g){return(s.create=function(E){return n.Buffer.isBuffer(E)?new t(E):u(E)})(g)}:u};s.create=l(),s.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,s.prototype.uint32=(function(){var h=4294967295;return function(){if(h=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(h=(h|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return h;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return h}})(),s.prototype.int32=function(){return this.uint32()|0},s.prototype.sint32=function(){var h=this.uint32();return h>>>1^-(h&1)|0};function c(){var d=new e(0,0),h=0;if(this.len-this.pos>4){for(;h<4;++h)if(d.lo=(d.lo|(this.buf[this.pos]&127)<<h*7)>>>0,this.buf[this.pos++]<128)return d;if(d.lo=(d.lo|(this.buf[this.pos]&127)<<28)>>>0,d.hi=(d.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return d;h=0}else{for(;h<3;++h){if(this.pos>=this.len)throw o(this);if(d.lo=(d.lo|(this.buf[this.pos]&127)<<h*7)>>>0,this.buf[this.pos++]<128)return d}return d.lo=(d.lo|(this.buf[this.pos++]&127)<<h*7)>>>0,d}if(this.len-this.pos>4){for(;h<5;++h)if(d.hi=(d.hi|(this.buf[this.pos]&127)<<h*7+3)>>>0,this.buf[this.pos++]<128)return d}else for(;h<5;++h){if(this.pos>=this.len)throw o(this);if(d.hi=(d.hi|(this.buf[this.pos]&127)<<h*7+3)>>>0,this.buf[this.pos++]<128)return d}throw Error("invalid varint encoding")}s.prototype.bool=function(){return this.uint32()!==0};function f(d,h){return(d[h-4]|d[h-3]<<8|d[h-2]<<16|d[h-1]<<24)>>>0}s.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return f(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return f(this.buf,this.pos+=4)|0};function p(){if(this.pos+8>this.len)throw o(this,8);return new e(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}return s.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var h=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,h},s.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var h=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,h},s.prototype.bytes=function(){var h=this.uint32(),g=this.pos,m=this.pos+h;if(m>this.len)throw o(this,h);if(this.pos+=h,Array.isArray(this.buf))return this.buf.slice(g,m);if(g===m){var E=n.Buffer;return E?E.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,g,m)},s.prototype.string=function(){var h=this.bytes();return r.read(h,0,h.length)},s.prototype.skip=function(h){if(typeof h=="number"){if(this.pos+h>this.len)throw o(this,h);this.pos+=h}else do if(this.pos>=this.len)throw o(this);while(this.buf[this.pos++]&128);return this},s.prototype.skipType=function(d){switch(d){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(d=this.uint32()&7)!==4;)this.skipType(d);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+d+" at offset "+this.pos)}return this},s._configure=function(d){t=d,s.create=l(),t._configure();var h=n.Long?"toLong":"toNumber";n.merge(s.prototype,{int64:function(){return c.call(this)[h](!1)},uint64:function(){return c.call(this)[h](!0)},sint64:function(){return c.call(this).zzDecode()[h](!1)},fixed64:function(){return p.call(this)[h](!0)},sfixed64:function(){return p.call(this)[h](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=e;var n=requireReader();(e.prototype=Object.create(n.prototype)).constructor=e;var t=requireMinimal$1();function e(r){n.call(this,r)}return e._configure=function(){t.Buffer&&(e.prototype._slice=t.Buffer.prototype.slice)},e.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},e._configure(),reader_buffer}var rpc={},service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=t;var n=requireMinimal$1();(t.prototype=Object.create(n.EventEmitter.prototype)).constructor=t;function t(e,r,o){if(typeof e!="function")throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!r,this.responseDelimited=!!o}return t.prototype.rpcCall=function e(r,o,s,u,l){if(!u)throw TypeError("request must be specified");var c=this;if(!l)return n.asPromise(e,c,r,o,s,u);if(!c.rpcImpl){setTimeout(function(){l(Error("already ended"))},0);return}try{return c.rpcImpl(r,o[c.requestDelimited?"encodeDelimited":"encode"](u).finish(),function(p,d){if(p)return c.emit("error",p,r),l(p);if(d===null){c.end(!0);return}if(!(d instanceof s))try{d=s[c.responseDelimited?"decodeDelimited":"decode"](d)}catch(h){return c.emit("error",h,r),l(h)}return c.emit("data",d,r),l(null,d)})}catch(f){c.emit("error",f,r),setTimeout(function(){l(f)},0);return}},t.prototype.end=function(r){return this.rpcImpl&&(r||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,(function(n){var t=n;t.Service=requireService()})(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,(function(n){var t=n;t.build="minimal",t.Writer=requireWriter(),t.BufferWriter=requireWriter_buffer(),t.Reader=requireReader(),t.BufferReader=requireReader_buffer(),t.util=requireMinimal$1(),t.rpc=requireRpc(),t.roots=requireRoots(),t.configure=e;function e(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}e()})(indexMinimal)),indexMinimal}var minimal,hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal=requireIndexMinimal()),minimal}var minimalExports=requireMinimal();const $Reader$1=minimalExports.Reader,$util$1=minimalExports.util,$root$1=minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto"]||(minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto"]={}),Model$2=$root$1.Model=(()=>{function n(t){if(this.chunks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.chunks=$util$1.emptyArray,n.prototype.createAt=$util$1.Long?$util$1.Long.fromBits(0,0,!0):0,n.prototype.description="",n.decode=function(e,r,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Model;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.chunks&&u.chunks.length||(u.chunks=[]),u.chunks.push($root$1.Chunk.decode(e,e.uint32()));break}case 2:{u.createAt=e.uint64();break}case 3:{u.description=e.string();break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root$1.Chunk=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.vertices=null,n.prototype.faces=null,n.prototype.name="",n.prototype.texture="",n.decode=function(e,r,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Chunk;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.vertices=$root$1.Vertices.decode(e,e.uint32());break}case 2:{u.faces=$root$1.Faces.decode(e,e.uint32());break}case 3:{u.name=e.string();break}case 4:{u.texture=e.string();break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("vertices"))throw $util$1.ProtocolError("missing required 'vertices'",{instance:u});if(!u.hasOwnProperty("faces"))throw $util$1.ProtocolError("missing required 'faces'",{instance:u});if(!u.hasOwnProperty("name"))throw $util$1.ProtocolError("missing required 'name'",{instance:u});return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root$1.Vertices=(()=>{function n(t){if(this.xyz=[],this.uvs=[],this.marks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.xyz=$util$1.emptyArray,n.prototype.uvs=$util$1.emptyArray,n.prototype.marks=$util$1.emptyArray,n.decode=function(e,r,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Vertices;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.xyz&&u.xyz.length||(u.xyz=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.xyz.push(e.float())}else u.xyz.push(e.float());break}case 2:{if(u.uvs&&u.uvs.length||(u.uvs=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.uvs.push(e.float())}else u.uvs.push(e.float());break}case 3:{if(u.marks&&u.marks.length||(u.marks=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.marks.push(e.int32())}else u.marks.push(e.int32());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Vertices"},n})(),$root$1.Faces=(()=>{function n(t){if(this.indices=[],this.normals=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.indices=$util$1.emptyArray,n.prototype.normals=$util$1.emptyArray,n.decode=function(e,r,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Faces;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.indices&&u.indices.length||(u.indices=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.indices.push(e.uint32())}else u.indices.push(e.uint32());break}case 2:{if(u.normals&&u.normals.length||(u.normals=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.normals.push(e.float())}else u.normals.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Faces"},n})(),$root$1.VertexMark=(()=>{const n={},t=Object.create(n);return t[n[0]="VERTEX_MARK_UNSPECIFIED"]=0,t[n[1]="VERTEX_MARK_ROOF"]=1,t})();function fixNumber(n){return isNaN(n)||!isFinite(n)?0:n}function getGeometryMemoryUsed(n){var t=0;if(n instanceof THREE__namespace.BufferGeometry){for(var e in n.attributes){var r=n.getAttribute(e),o=4;"BYTES_PER_ELEMENT"in r.array&&typeof r.array.BYTES_PER_ELEMENT=="number"&&(o=r.array.BYTES_PER_ELEMENT),t+=fixNumber(r.count*r.itemSize*o)}var s=n.getIndex();if(s){var o=4;"BYTES_PER_ELEMENT"in s.array&&typeof s.array.BYTES_PER_ELEMENT=="number"&&(o=s.array.BYTES_PER_ELEMENT),t+=fixNumber(s.count*s.itemSize*o)}}else n instanceof THREE__namespace.Geometry&&(t+=fixNumber(n.faces.length*3*3*4),t+=fixNumber(n.faceVertexUvs.length*3*2*4));return t}function makeComputeBlockRectSizeFunction(n,t,e){return function(r,o,s){var u=(r+n-1)/n|0,l=(o+t-1)/t|0;return u*l*e*s}}function makeComputePaddedRectSizeFunction(n,t,e){return function(r,o,s){return(Math.max(r,n)*Math.max(o,t)/e|0)*s}}var compressedTextureFunctions=new Map([[THREE__namespace.RGB_S3TC_DXT1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_S3TC_DXT1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_S3TC_DXT3_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_S3TC_DXT5_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGB_ETC1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGB_PVRTC_4BPPV1_Format,makeComputePaddedRectSizeFunction(8,8,2)],[THREE__namespace.RGBA_PVRTC_4BPPV1_Format,makeComputePaddedRectSizeFunction(8,8,2)],[THREE__namespace.RGB_PVRTC_2BPPV1_Format,makeComputePaddedRectSizeFunction(16,8,4)],[THREE__namespace.RGBA_PVRTC_2BPPV1_Format,makeComputePaddedRectSizeFunction(16,8,4)],[THREE__namespace.RGB_ETC2_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_ETC2_EAC_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_ASTC_4x4_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_4x4_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_ASTC_5x4_Format,makeComputeBlockRectSizeFunction(5,4,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_5x4_Format,makeComputeBlockRectSizeFunction(5,4,16)],[THREE__namespace.RGBA_ASTC_5x5_Format,makeComputeBlockRectSizeFunction(5,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_5x5_Format,makeComputeBlockRectSizeFunction(5,5,16)],[THREE__namespace.RGBA_ASTC_6x5_Format,makeComputeBlockRectSizeFunction(6,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_6x5_Format,makeComputeBlockRectSizeFunction(6,5,16)],[THREE__namespace.RGBA_ASTC_6x6_Format,makeComputeBlockRectSizeFunction(6,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_6x6_Format,makeComputeBlockRectSizeFunction(6,6,16)],[THREE__namespace.RGBA_ASTC_8x5_Format,makeComputeBlockRectSizeFunction(8,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x5_Format,makeComputeBlockRectSizeFunction(8,5,16)],[THREE__namespace.RGBA_ASTC_8x6_Format,makeComputeBlockRectSizeFunction(8,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x6_Format,makeComputeBlockRectSizeFunction(8,6,16)],[THREE__namespace.RGBA_ASTC_8x8_Format,makeComputeBlockRectSizeFunction(8,8,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x8_Format,makeComputeBlockRectSizeFunction(8,8,16)],[THREE__namespace.RGBA_ASTC_10x5_Format,makeComputeBlockRectSizeFunction(10,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x5_Format,makeComputeBlockRectSizeFunction(10,5,16)],[THREE__namespace.RGBA_ASTC_10x6_Format,makeComputeBlockRectSizeFunction(10,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x6_Format,makeComputeBlockRectSizeFunction(10,6,16)],[THREE__namespace.RGBA_ASTC_10x8_Format,makeComputeBlockRectSizeFunction(10,8,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x8_Format,makeComputeBlockRectSizeFunction(10,8,16)],[THREE__namespace.RGBA_ASTC_10x10_Format,makeComputeBlockRectSizeFunction(10,10,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x10_Format,makeComputeBlockRectSizeFunction(10,10,16)],[THREE__namespace.RGBA_ASTC_12x10_Format,makeComputeBlockRectSizeFunction(12,10,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_12x10_Format,makeComputeBlockRectSizeFunction(12,10,16)],[THREE__namespace.RGBA_ASTC_12x12_Format,makeComputeBlockRectSizeFunction(12,12,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_12x12_Format,makeComputeBlockRectSizeFunction(12,12,16)],[THREE__namespace.RGBA_BPTC_Format,makeComputeBlockRectSizeFunction(4,4,16)]]);function getTextureMemoryUsed(n){var t=0,e=1;(n.generateMipmaps===!0||n.mipmaps&&n.mipmaps.length>1)&&(e=1.33);for(var r=n instanceof THREE__namespace.CompressedTexture,o=r?compressedTextureFunctions.get(n.format):void 0,s=[].concat(n.image),u=0,l=s;u<l.length;u++){var c=l[u];if(c)if(c instanceof THREE__namespace.Texture)t+=getTextureMemoryUsed(c);else{var f=c.width,p=f===void 0?1:f,d=c.height,h=d===void 0?1:d,g=c.depth,m=g===void 0?1:g;o?t+=fixNumber(o(p,h,m)*e):t+=fixNumber(p*h*m*4*e)}}return t}var textureSet=new Set,textureNames=["map","alphaMap","bumpMap","normalMap","displacementMap","emissiveMap","specularMap","envMap","flipEnvMap","lightMap","aoMap","gradientMap","metalnessMap","roughnessMap","sheenColorMap","sheenRoughnessMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","iridescenceMap","iridescenceThicknessMap","transmissionMap","thicknessMap","anisotropyMap","specularColorMap","specularIntensityMap"];function getMaterialMemoryUsed(n){var t=0;if(textureSet.clear(),n instanceof THREE__namespace.ShaderMaterial)for(var e in n.uniforms){var r=n.uniforms[e],o=r&&r.value&&r.value instanceof THREE__namespace.Texture?r.value:void 0;o instanceof THREE__namespace.Texture&&(textureSet.has(o)||(t=getTextureMemoryUsed(o),textureSet.add(o)))}else for(var s=0,u=textureNames;s<u.length;s++){var l=u[s],o=n[l];o instanceof THREE__namespace.Texture&&(textureSet.has(o)||(t=getTextureMemoryUsed(o),textureSet.add(o)))}return textureSet.clear(),t}var sceneSet=new Set;function getMemoryUsage(n){var t=0;return sceneSet.clear(),n.traverse(function(e){if(e instanceof THREE__namespace.Mesh||e instanceof THREE__namespace.Line||e instanceof THREE__namespace.Points){var r=e.geometry;(r instanceof THREE__namespace.BufferGeometry||r instanceof THREE__namespace.Geometry)&&(sceneSet.has(r)||(t+=getGeometryMemoryUsed(r),sceneSet.add(r)));for(var o=[].concat(e.material),s=0,u=o;s<u.length;s++){var l=u[s];l instanceof THREE__namespace.Material&&(sceneSet.has(l)||(t+=getMaterialMemoryUsed(l),sceneSet.add(l)))}}}),sceneSet.clear(),t}function guessTextureBaseUriFromFileUrl(n){var t=n.lastIndexOf("/");if(t>=0){var e=n.slice(0,t+1),r=e.replace(/\/(model)(\/|$)/,function(o,s,u){return"/materials"+u});return r}return""}function loadPbm(n,t){var e,r,o,s,u,l;t===void 0&&(t={});for(var c=(e=t.upAxis)!==null&&e!==void 0?e:"Z",f=(r=t.light)!==null&&r!==void 0?r:!1,p=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,d=(s=t.textureBaseUri)!==null&&s!==void 0?s:guessTextureBaseUriFromFileUrl(n),h=t.textureBaseUri===void 0?[]:((u=t.textureArray)!==null&&u!==void 0?u:[]).slice(),g=autoRestImageOptionsByTextureLength((l=t.textureOptions)!==null&&l!==void 0?l:{},h.length),m=new Map,E=0,y=h;E<y.length;E++){var v=y[E],A=isAbsoluteURL(v)?v:pathJoin(d,v);m.set(A,loadTexture$1(A,g,p))}var b={byteLength:0};return Promise.resolve().then(function(){return p.ajax(n,{responseType:"arraybuffer"})}).then(function(T){b.byteLength=T.body.byteLength;var _=new Uint8Array(T.body);return Model$2.decode(_)}).then(function(T){return parse$4(T,f,d,h,g,m,p)}).then(function(T){m.clear();var _=new THREE__namespace.Group;_.name=n;for(var S=0,w=T.objects;S<w.length;S++){var R=w[S];_.add(R)}return c==="Y"&&_.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"pbm",modelUpAxis:"Z",upAxis:c,uri:n,byteLength:b.byteLength,memoryUsage:getMemoryUsage(_),scene:_,textures:T.textures,animations:[],dispose:function(){return T.dispose()}}})}function parseFloorName(n){var t=n.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function parseChunkName(n){var t=n.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function parseSubName(n){var t=n.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}function chunkOrder(n){var t=parseFloorName(n.name),e=parseChunkName(n.name),r=parseSubName(n.name);return t*1e6+e*1e3+r}function parsePBMModel(n){for(var t,e,r,o=typeof n.createAt=="number"?n.createAt:0,s=(t=n.description)!==null&&t!==void 0?t:"",u=[],l=!0,c=!0,f=0,p=n.chunks;f<p.length;f++){var d=p[f];if(!d.vertices.marks||d.vertices.marks.length===0){c=!1;break}}for(var h=0,g=n.chunks;h<g.length;h++){var d=g[h];if(!d.faces.normals||d.faces.normals.length===0){l=!1;break}}for(var m=n.chunks.sort(function(ne,te){return chunkOrder(ne)-chunkOrder(te)}),E=[],y=0,v=m;y<v.length;y++){var d=v[y],A=parseFloorName(d.name);E[A]||(E[A]=[]),E[A].push(d)}for(var b=0;b<E.length;b++){var T=E[b];if(T)if(l){for(var _=0,S=0;S<T.length;S++){var d=T[S];_+=d.faces.indices.length}for(var w=new Float32Array(_*3),R=new Float32Array(_*2),I=new Float32Array(_*3),H=c?new Float32Array(_):void 0,C=[],M=[1/0,1/0,1/0,-1/0,-1/0,-1/0],B=0,L=0;L<T.length;L++){for(var O=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[L],k=d.vertices.xyz,D=d.vertices.uvs,q=d.faces.indices,z=d.faces.normals,J=d.vertices.marks,V=q.length,S=0;S<V;S++){var U=q[S],j=w[B*3+S*3]=k[U*3],K=w[B*3+S*3+1]=k[U*3+1],ae=w[B*3+S*3+2]=k[U*3+2];H&&(H[B+S]=J[U]),R[B*2+S*2]=D[U*2],R[B*2+S*2+1]=D[U*2+1];var re=Math.floor(S/3)*3;I[B*3+S*3]=z[re],I[B*3+S*3+1]=z[re+1],I[B*3+S*3+2]=z[re+2],j<O[0]&&(O[0]=j),K<O[1]&&(O[1]=K),ae<O[2]&&(O[2]=ae),j>O[3]&&(O[3]=j),K>O[4]&&(O[4]=K),ae>O[5]&&(O[5]=ae)}O[0]<M[0]&&(M[0]=O[0]),O[1]<M[1]&&(M[1]=O[1]),O[2]<M[2]&&(M[2]=O[2]),O[3]>M[3]&&(M[3]=O[3]),O[4]>M[4]&&(M[4]=O[4]),O[5]>M[5]&&(M[5]=O[5]),C.push({materialIndex:L,name:d.name,chunkName:parseChunkName(d.name),start:B,count:d.faces.indices.length,texture:(e=d.texture)!==null&&e!==void 0?e:void 0}),B+=V}var ee={createAt:o,description:s,vertices:w,uvs:R,normals:I,masks:H,indices:null,floorIndex:b,groups:C,extents:M};u.push(ee)}else{for(var _=0,Z=0,S=0;S<T.length;S++){var d=T[S];Z+=d.vertices.xyz.length/3,_+=d.faces.indices.length}for(var w=new Float32Array(Z*3),R=new Float32Array(Z*2),I=void 0,X=new Float32Array(Z),se=new Uint32Array(_),H=c?new Float32Array(_):void 0,C=[],M=[1/0,1/0,1/0,-1/0,-1/0,-1/0],G=0,B=0,L=0;L<T.length;L++){for(var O=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[L],k=d.vertices.xyz,W=d.vertices.marks,D=d.vertices.uvs,q=d.faces.indices,$=k.length/3,V=q.length,S=0;S<$;S++){var j=w[B*3+S*3]=k[S*3],K=w[B*3+S*3+1]=k[S*3+1],ae=w[B*3+S*3+2]=k[S*3+2];H&&(H[B+S]=W[S]),R[B*2+S*2]=D[S*2],R[B*2+S*2+1]=D[S*2+1],X[B+S]=b,j<O[0]&&(O[0]=j),K<O[1]&&(O[1]=K),ae<O[2]&&(O[2]=ae),j>O[3]&&(O[3]=j),K>O[4]&&(O[4]=K),ae>O[5]&&(O[5]=ae)}O[0]<M[0]&&(M[0]=O[0]),O[1]<M[1]&&(M[1]=O[1]),O[2]<M[2]&&(M[2]=O[2]),O[3]>M[3]&&(M[3]=O[3]),O[4]>M[4]&&(M[4]=O[4]),O[5]>M[5]&&(M[5]=O[5]);for(var S=0;S<V;S++)se[G+S]=B+q[S];C.push({materialIndex:L,name:d.name,chunkName:parseChunkName(d.name),start:G,count:d.faces.indices.length,texture:(r=d.texture)!==null&&r!==void 0?r:void 0}),B+=$,G+=V}var ee={createAt:o,description:s,vertices:w,uvs:R,normals:I,masks:H,indices:se,floorIndex:b,groups:C,extents:M};u.push(ee)}}return u}function loadTexture$1(n,t,e){var r=__assign({key:"texture.pbm"},pick(t,["format","quality","size","sharpen","forceUseExifOrientation","mappings"])),o=new TextureLoader;return o.loadTexture(n,{imageURL:{transform:t.transform,options:r},encoding:THREE__namespace.sRGBEncoding,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping,minFilter:THREE__namespace.LinearFilter,maxSize:typeof r.size=="number"?new THREE__namespace.Vector2(r.size,r.size):void 0,fetcher:e}).then(function(s){var u=s.body;return u.needsUpdate=!0,u})}function parse$4(n,t,e,r,o,s,u){for(var l=parsePBMModel(n),c=0,f="",p=[],d={},h=new Set,g=0,m=0,E=l;m<E.length;m++){var y=E[m],v=y.createAt,A=y.description,b=y.vertices,T=y.masks,_=y.uvs,S=y.normals,w=y.indices,R=y.floorIndex,I=y.groups,H=y.extents,C=new THREE__namespace.Box3;C.min.x=H[0],C.min.y=H[1],C.min.z=H[2],C.max.x=H[3],C.max.y=H[4],C.max.z=H[5];var M=new THREE__namespace.BufferGeometry;M.setAttribute("position",new THREE__namespace.BufferAttribute(b,3)),M.setAttribute("uv",new THREE__namespace.BufferAttribute(_,2)),S&&M.setAttribute("normal",new THREE__namespace.BufferAttribute(S,3)),T&&M.setAttribute("_feature_id_rsmask",new THREE__namespace.BufferAttribute(T,1)),w&&M.setIndex(new THREE__namespace.BufferAttribute(w,1)),M.boundingBox=C,M.boundingSphere=C.getBoundingSphere(new THREE__namespace.Sphere);for(var B=0,L=I;B<L.length;B++){var O=L[B];M.addGroup(O.start,O.count,O.materialIndex)}h.add(M);for(var k=[],D=0,q=I;D<q.length;D++){var O=q[D],z=void 0;if(O.texture){if(z=O.texture,r.length>0&&r.indexOf(O.texture)===-1){for(var J=0,V=r;J<V.length;J++){var U=V[J],j=isAbsoluteURL(U)?U:pathJoin(e,U),K=j.slice(O.texture.length*-1)===O.texture;if(K){z=U;break}}console.warn("At3d/Pbm texture not matched. Use ends-guessing mode. ".concat(O.texture," -> ").concat(z))}isAbsoluteURL(z)||(z=pathJoin(e,z))}var ae=new PBMMeshMaterial(t?"phong":"basic");ae.floorIndex=R,M.attributes.normal===void 0&&(ae.flatShading=!0),M.attributes._feature_id_rsmask&&(ae.defines.USE_VERTEX_MARK=!0),k.push(ae),z?(g++,d[z]?d[z].push(ae):d[z]=[ae]):ae.color=new THREE__namespace.Color(16777215),h.add(ae)}var re=new PBMMesh(M,k);re.name="model_floor_"+R,re.userData.createAt=v,re.userData.description=A,re.matrix.compose(re.position,re.quaternion,re.scale),re.matrixAutoUpdate=!1,re.frustumCulled=!1,c=v,f=A,p.push(re)}o=autoRestImageOptionsByTextureLength(o,g);for(var ee=[],Z=function(G){var W=void 0;s&&(W=s.get(G)),W||(W=loadTexture$1(G,o,u),s&&s.set(G,W)),ee.push(W.then(function($){for(var ne=0,te=d[G];ne<te.length;ne++){var ve=te[ne];ve.map&&(h.delete(ve.map),ve.map.dispose()),ve.map=$,h.add($)}return $}).catch(function(){for(var $=0,ne=d[G];$<ne.length;$++){var te=ne[$];te.map&&(h.delete(te.map),te.map.dispose()),te.map=null,te.color=new THREE__namespace.Color(16777215)}return null}))},X=0,se=Object.keys(d);X<se.length;X++){var z=se[X];Z(z)}return Promise.all(ee).then(function(G){var W=G.filter(function($){return $ instanceof THREE__namespace.Texture});return{createAt:c,description:f,objects:p,textures:W,dispose:function(){h.forEach(function($){$.dispose()}),h.clear()}}})}function autoRestImageOptionsByTextureLength(n,t){return n=Object.assign({},n),n.autoResize!==!1&&(t>96?n.size=Math.min(n.size||1/0,100):t>48?n.size=Math.min(n.size||1/0,200):t>24?n.size=Math.min(n.size||1/0,400):t>22?n.size=Math.min(n.size||1/0,800):t>5&&(n.size=Math.min(n.size||1/0,1024))),n}function createLZMA(){var n={};return n.OutWindow=function(){this._windowSize=0},n.OutWindow.prototype.create=function(t){(!this._buffer||this._windowSize!==t)&&(this._buffer=[]),this._windowSize=t,this._pos=0,this._streamPos=0},n.OutWindow.prototype.flush=function(){var t=this._pos-this._streamPos;if(t!==0){for(;t--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},n.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},n.OutWindow.prototype.setStream=function(t){this.releaseStream(),this._stream=t},n.OutWindow.prototype.init=function(t){t||(this._streamPos=0,this._pos=0)},n.OutWindow.prototype.copyBlock=function(t,e){var r=this._pos-t-1;for(r<0&&(r+=this._windowSize);e--;)r>=this._windowSize&&(r=0),this._buffer[this._pos++]=this._buffer[r++],this._pos>=this._windowSize&&this.flush()},n.OutWindow.prototype.putByte=function(t){this._buffer[this._pos++]=t,this._pos>=this._windowSize&&this.flush()},n.OutWindow.prototype.getByte=function(t){var e=this._pos-t-1;return e<0&&(e+=this._windowSize),this._buffer[e]},n.RangeDecoder=function(){},n.RangeDecoder.prototype.setStream=function(t){this._stream=t},n.RangeDecoder.prototype.releaseStream=function(){this._stream=null},n.RangeDecoder.prototype.init=function(){var t=5;for(this._code=0,this._range=-1;t--;)this._code=this._code<<8|this._stream.readByte()},n.RangeDecoder.prototype.decodeDirectBits=function(t){for(var e=0,r=t,o;r--;)this._range>>>=1,o=this._code-this._range>>>31,this._code-=this._range&o-1,e=e<<1|1-o,(this._range&4278190080)===0&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return e},n.RangeDecoder.prototype.decodeBit=function(t,e){var r=t[e],o=(this._range>>>11)*r;return(this._code^2147483648)<(o^2147483648)?(this._range=o,t[e]+=2048-r>>>5,(this._range&4278190080)===0&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=o,this._code-=o,t[e]-=r>>>5,(this._range&4278190080)===0&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},n.initBitModels=function(t,e){for(;e--;)t[e]=1024},n.BitTreeDecoder=function(t){this._models=[],this._numBitLevels=t},n.BitTreeDecoder.prototype.init=function(){n.initBitModels(this._models,1<<this._numBitLevels)},n.BitTreeDecoder.prototype.decode=function(t){for(var e=1,r=this._numBitLevels;r--;)e=e<<1|t.decodeBit(this._models,e);return e-(1<<this._numBitLevels)},n.BitTreeDecoder.prototype.reverseDecode=function(t){for(var e=1,r=0,o=0,s;o<this._numBitLevels;++o)s=t.decodeBit(this._models,e),e=e<<1|s,r|=s<<o;return r},n.reverseDecode2=function(t,e,r,o){for(var s=1,u=0,l=0,c;l<o;++l)c=r.decodeBit(t,e+s),s=s<<1|c,u|=c<<l;return u},n.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new n.BitTreeDecoder(8),this._numPosStates=0},n.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new n.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new n.BitTreeDecoder(3)},n.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(n.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},n.LenDecoder.prototype.decode=function(t,e){return t.decodeBit(this._choice,0)===0?this._lowCoder[e].decode(t):t.decodeBit(this._choice,1)===0?8+this._midCoder[e].decode(t):16+this._highCoder.decode(t)},n.Decoder2=function(){this._decoders=[]},n.Decoder2.prototype.init=function(){n.initBitModels(this._decoders,768)},n.Decoder2.prototype.decodeNormal=function(t){var e=1;do e=e<<1|t.decodeBit(this._decoders,e);while(e<256);return e&255},n.Decoder2.prototype.decodeWithMatchByte=function(t,e){var r=1,o,s;do if(o=e>>7&1,e<<=1,s=t.decodeBit(this._decoders,(1+o<<8)+r),r=r<<1|s,o!==s){for(;r<256;)r=r<<1|t.decodeBit(this._decoders,r);break}while(r<256);return r&255},n.LiteralDecoder=function(){},n.LiteralDecoder.prototype.create=function(t,e){var r;if(!(this._coders&&this._numPrevBits===e&&this._numPosBits===t))for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=e,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=new n.Decoder2},n.LiteralDecoder.prototype.init=function(){for(var t=1<<this._numPrevBits+this._numPosBits;t--;)this._coders[t].init()},n.LiteralDecoder.prototype.getDecoder=function(t,e){return this._coders[((t&this._posMask)<<this._numPrevBits)+((e&255)>>>8-this._numPrevBits)]},n.Decoder=function(){this._outWindow=new n.OutWindow,this._rangeDecoder=new n.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new n.BitTreeDecoder(4),this._lenDecoder=new n.LenDecoder,this._repLenDecoder=new n.LenDecoder,this._literalDecoder=new n.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new n.BitTreeDecoder(6),this._posSlotDecoder[1]=new n.BitTreeDecoder(6),this._posSlotDecoder[2]=new n.BitTreeDecoder(6),this._posSlotDecoder[3]=new n.BitTreeDecoder(6)},n.Decoder.prototype.setDictionarySize=function(t){return t<0?!1:(this._dictionarySize!==t&&(this._dictionarySize=t,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},n.Decoder.prototype.setLcLpPb=function(t,e,r){var o=1<<r;return t>8||e>4||r>4?!1:(this._literalDecoder.create(e,t),this._lenDecoder.create(o),this._repLenDecoder.create(o),this._posStateMask=o-1,!0)},n.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),n.initBitModels(this._isMatchDecoders,192),n.initBitModels(this._isRep0LongDecoders,192),n.initBitModels(this._isRepDecoders,12),n.initBitModels(this._isRepG0Decoders,12),n.initBitModels(this._isRepG1Decoders,12),n.initBitModels(this._isRepG2Decoders,12),n.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},n.Decoder.prototype.decode=function(t,e,r){var o=0,s=0,u=0,l=0,c=0,f=0,p=0,d,h,g,m,E,y;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(e),this.init();r<0||f<r;)if(d=f&this._posStateMask,this._rangeDecoder.decodeBit(this._isMatchDecoders,(o<<4)+d)===0)h=this._literalDecoder.getDecoder(f++,p),o>=7?p=h.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(s)):p=h.decodeNormal(this._rangeDecoder),this._outWindow.putByte(p),o=o<4?0:o-(o<10?3:6);else{if(this._rangeDecoder.decodeBit(this._isRepDecoders,o)===1)g=0,this._rangeDecoder.decodeBit(this._isRepG0Decoders,o)===0?this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(o<<4)+d)===0&&(o=o<7?9:11,g=1):(this._rangeDecoder.decodeBit(this._isRepG1Decoders,o)===0?m=u:(this._rangeDecoder.decodeBit(this._isRepG2Decoders,o)===0?m=l:(m=c,c=l),l=u),u=s,s=m),g===0&&(g=2+this._repLenDecoder.decode(this._rangeDecoder,d),o=o<7?8:11);else if(c=l,l=u,u=s,g=2+this._lenDecoder.decode(this._rangeDecoder,d),o=o<7?7:10,E=this._posSlotDecoder[g<=5?g-2:3].decode(this._rangeDecoder),E>=4){if(y=(E>>1)-1,s=(2|E&1)<<y,E<14)s+=n.reverseDecode2(this._posDecoders,s-E-1,this._rangeDecoder,y);else if(s+=this._rangeDecoder.decodeDirectBits(y-4)<<4,s+=this._posAlignDecoder.reverseDecode(this._rangeDecoder),s<0){if(s===-1)break;return!1}}else s=E;if(s>=f||s>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(s,g),f+=g,p=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},n.Decoder.prototype.setDecoderProperties=function(t){var e,r,o,s,u;return t.size<5||(e=t.readByte(),r=e%9,e=~~(e/9),o=e%5,s=~~(e/5),!this.setLcLpPb(r,o,s))?!1:(u=t.readByte(),u|=t.readByte()<<8,u|=t.readByte()<<16,u+=t.readByte()*16777216,this.setDictionarySize(u))},n.decompress=function(t,e,r,o){var s=new n.Decoder;if(!s.setDecoderProperties(t))throw"Incorrect stream properties";if(!s.decode(e,r,o))throw"Error in data stream";return!0},n.decompressFile=function(t,e){var r=new n.Decoder,o;if(!r.setDecoderProperties(t))throw"Incorrect stream properties";if(o=t.readByte(),o|=t.readByte()<<8,o|=t.readByte()<<16,o+=t.readByte()*16777216,t.readByte(),t.readByte(),t.readByte(),t.readByte(),!r.decode(t,e,o))throw"Error in data stream";return!0},n}var LZMA=createLZMA();function createWASM(){function n(e){for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=new Uint8Array(256),s=0;s<r.length;s++)o[r.charCodeAt(s)]=s;var u=e.length*.75,l=e.length,c,f=0,p,d,h,g;e[e.length-1]==="="&&(u--,e[e.length-2]==="="&&u--);var m=new ArrayBuffer(u),E=new Uint8Array(m);for(c=0;c<l;c+=4)p=o[e.charCodeAt(c)],d=o[e.charCodeAt(c+1)],h=o[e.charCodeAt(c+2)],g=o[e.charCodeAt(c+3)],E[f++]=p<<2|d>>4,E[f++]=(d&15)<<4|h>>2,E[f++]=(h&3)<<6|g&63;return m}var t="AGFzbQEAAAABSg1gAABgAX8Bf2ACf38Bf2AEf39/fwBgA39/fwBgAX8AYAJ/fwBgA39/fwF/YAR/f39/AX9gAn9/AGABfwF/YAABf2AEf39/fwF/AhsCA2VudgVhYm9ydAADA2VudgZtZW1vcnkCAAEDJiUBAQkKAgoKCwsLCwsAAgoBAgQKAQYFCAoFBQQEBwgCBwwCAQAABAQBcAABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwc9BgZtZW1vcnkCAAV0YWJsZQEABXJlc2V0AA0KbmV3VThBcnJheQAQCnVucGFja1NpemUAFAZkZWNvZGUAIwgBJAkHAQBBAAsBJQqAViVoAQN/IABBgICAgARLBEAACyMBIgEgAEEBIABBAUsbakEHakF4cSICPwAiA0EQdEsEQCADIAIgAWtB//8DakGAgHxxQRB2IgAgAyAAShtAAEEASARAIABAAEEASARAAAsLCyACJAEgAQsbAQF/QQFBICAAQQdqZ2t0EAEiASAANgIAIAELkQMBAX8gAUUEQA8LIABBADoAACAAIAFqQQFrQQA6AAAgAUECTQRADwsgAEEBakEAOgAAIABBAmpBADoAACAAIAFqIgJBAmtBADoAACACQQNrQQA6AAAgAUEGTQRADwsgAEEDakEAOgAAIAAgAWpBBGtBADoAACABQQhNBEAPC0EAIABrQQNxIgIgAGoiAEEANgIAIAEgAmtBfHEiASAAakEEa0EANgIAIAFBCE0EQA8LIABBBGpBADYCACAAQQhqQQA2AgAgACABaiICQQxrQQA2AgAgAkEIa0EANgIAIAFBGE0EQA8LIABBDGpBADYCACAAQRBqQQA2AgAgAEEUakEANgIAIABBGGpBADYCACAAIAFqIgJBHGtBADYCACACQRhrQQA2AgAgAkEUa0EANgIAIAJBEGtBADYCACAAQQRxQRhqIgIgAGohACABIAJrIQEDQCABQSBPBEAgAEIANwMAIABBCGpCADcDACAAQRBqQgA3AwAgAEEYakIANwMAIAFBIGshASAAQSBqIQAMAQsLC1EBA38gAEH+////AEsEQEEAQSBBLUEnEAAACyAAQQJ0IgMQAiECQQgQASIBQQA2AgAgAUEANgIEIAEgAjYCACABIAA2AgQgAkEIaiADEAMgAQtmAQF/IAFB/P///wFLBEBBAEHAAEEXQSIQAAALIAFBAXQiARACIgJBCGogARADIABFBEBBDBABIQALIABBADYCACAAQQA2AgQgAEEANgIIIAAgAjYCACAAQQA2AgQgACABNgIIIAALCgBBDBABIAAQBQsuAQF/QQgQASIBQQA2AgAgAUEANgIEIAEgADYCBCABQQEgASgCBHQQBjYCACABC6EBAQR/QRAQASIBQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgxBEBAEIQIDQCAAQRBIBEBBAxAHIQMgAigCACAAQQJ0aiADNgIIIABBAWohAAwBCwsgASACNgIEQRAQBCECQQAhAANAIABBEEgEQEEDEAchAyACKAIAIABBAnRqIAM2AgggAEEBaiEADAELCyABIAI2AgggAUEIEAc2AgwgAQs0AQF/QRQQASIAQQA2AgAgAEEAOgAEIABBADYCCCAAQQA2AgwgAEEANgIQIABBDTYCCCAAC0IBAX9BGRABIgBBADYCACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEANgIUIABBADoAGCAAQQA2AhAgAAu1AgEEf0HQABABIgBBADoAACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEAOgAUIABBADYCGCAAQQA2AhwgAEEANgIgIABBADYCJCAAQQA2AiggAEEANgIsIABBADYCMCAAQQA2AjQgAEEANgI4IABBADYCPCAAQQA2AkAgAEEANgJEIABBADYCSCAAQQA2AkxBBBAEIQIDQCABQQRIBEBBBhAHIQMgAigCACABQQJ0aiADNgIIIAFBAWohAQwBCwsgACACNgIkIABBBBAHNgIoIABB8wAQBjYCLCAAQcABEAY2AjAgAEEMEAY2AjQgAEEMEAY2AjggAEEMEAY2AjwgAEEMEAY2AkAgAEHAARAGNgJEIAAQCDYCSCAAEAg2AkwgABAJNgIEIAAQCjYCCCAACx8BAX9BCBABIgBBADYCACAAQQA2AgQgABALNgIAIAALCgAjACQBEAwkAwthAQF/IAFB+P///wNLBEBBAEHAAEEXQSIQAAALIAEQAiICQQhqIAEQAyAARQRAQQwQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCAAIAI2AgAgAEEANgIEIAAgATYCCCAACwoAQQwQASAAEA4LBgAgABAPCyoAIAEgACgCCE8EQEEAQcAAQSdBPxAAAAsgACgCBCABIAAoAgBqai0ACAssACABIAAoAghPBEBBAEHAAEEyQT8QAAALIAAoAgQgASAAKAIAamogAjoACAtkAQJ/QQ0QDyECA0AgAUENSARAIAIgASAAIAEQEUH/AXEQEiABQQFqIQEMAQsLQQAhAEEAIQEDQCABQQhIBEAgAiABQQVqEBFB/wFxIAFBA3R0IAByIQAgAUEBaiEBDAELCyAACwYAIAAQEwsnACAAIAEQDzYCCCAAQQA2AgwgACABNgIUIABBADoAGCAAQQA2AgALJAAgACgCCCAAKAIYEBUgAEGABiAAKAIMIAAtABRqdBAGNgIgC5UBAQR/IAEhBSAAIgYoAgAhASAAKAIEIQcgACgCCEEBdiEEIAJBAEgEfyACIARqIgBBACAAQQBKGwUgAiIAIAQgACAESBsLIQIgA0EASAR/IAMgBGoiAEEAIABBAEobBSADIgAgBCAAIARIGwshAwNAIAIgA05FBEAgAkEBdCABaiAHaiAFOwEIIAJBAWohAgwBCwsgBgssAQF/AkACQAJAIwRBAWsOAwEBAgALAAtB/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQAUanQhAQNAIAMgAUgEQCACKAIgIgQoAgAhBSAEKAIEIANBAXQgBWpqQYAIOwEIIANBAWohAwwBCwsgAiEBQQAhAgNAIAJBBEkEQCACIAEoAiQoAgAiAygCAEECdkkEfyACQQJ0IANqKAIIBQALKAIAQQEkBBAYGiACQQFqIQIMAQsLIAEoAigoAgBBASQEEBgaIAEoAixBASQEEBgaIAAoAjBBASQEEBgaIAAoAjRBASQEEBgaIAAoAjhBASQEEBgaIAAoAjxBASQEEBgaIAAoAkBBASQEEBgaIAAoAkRBASQEEBgaIAAoAkgQGSAAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAIAFBAmohASAAQQJqIQALIAJBAXEEQCAAIAEtAAA6AAALDwsgAkEgTwRAAkACQAJAIABBA3EiA0EBRwRAIANBAkYNASADQQNGDQIMAwsgASgCACEFIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAAIAJBA2shAgNAIAJBEU8EQCAAIAFBAWooAgAiA0EIdCAFQRh2cjYCACAAQQRqIAFBBWooAgAiBUEIdCADQRh2cjYCACAAQQhqIAFBCWooAgAiA0EIdCAFQRh2cjYCACAAQQxqIAFBDWooAgAiBUEIdCADQRh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsMAgsgASgCACEFIAAgAS0AADoAACAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAAgAkECayECA0AgAkESTwRAIAAgAUECaigCACIDQRB0IAVBEHZyNgIAIABBBGogAUEGaigCACIFQRB0IANBEHZyNgIAIABBCGogAUEKaigCACIDQRB0IAVBEHZyNgIAIABBDGogAUEOaigCACIFQRB0IANBEHZyNgIAIAFBEGohASAAQRBqIQAgAkEQayECDAELCwwBCyABKAIAIQUgACIEQQFqIQAgASIDQQFqIQEgBCADLQAAOgAAIAJBAWshAgNAIAJBE08EQCAAIAFBA2ooAgAiA0EYdCAFQQh2cjYCACAAQQRqIAFBB2ooAgAiBUEYdCADQQh2cjYCACAAQQhqIAFBC2ooAgAiA0EY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";return n(t)}function decodeLZMA(n,t,e){try{var r={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},o=r.data.length,s={data:[],offset:0,writeByte:function(c){var f=Math.floor(this.offset/o);this.data[f]||(this.data[f]=new Uint8Array(o)),this.data[f][this.offset%o]=c,this.offset++}};n.decompressFile(r,s);for(var u=new Uint8Array(s.offset),l=0;l<s.offset;l++)u[l]=s.data[Math.floor(l/o)][l%o];e(null,u)}catch(c){e(c)}}function decodeLZMAWithWASM(n,t,e){var r=24;try{var o=new WebAssembly.Memory({initial:16}),s=new WebAssembly.Module(n),u=new WebAssembly.Instance(s,{env:{memory:o,abort:function(){e(new Error("webAssembly abort"))}}}),l=u.exports,c=l.newU8Array(t.length),f=new Uint8Array(o.buffer,c+r,t.length);f.set(t);var p=l.decode(c),d=new Uint32Array(o.buffer,p,4),h=d[0],g=d[2],m=d[3];h?e(null,new Uint8Array(o.buffer,m+r,g).slice(0,g)):e(new Error("lzma deocder error"))}catch(E){e(E)}}var lzmaWorkerSource=`
406
406
  var decodeLZMA = (function() {
407
407
  var LZMA = (`.concat(createLZMA.toString(),`)();
408
408
  return function(data, callback) {
@@ -447,7 +447,7 @@ self.onmessage = function(event) {
447
447
  }
448
448
  postMessage({ id: packet.id, error: "type never matched." });
449
449
  };
450
- `),support=typeof Worker!="undefined"&&typeof Blob!="undefined",lzmaWorkerURL="";if(support)try{var blob$2=new Blob([lzmaWorkerSource],{type:"text/javascript"});lzmaWorkerURL=URL.createObjectURL(blob$2)}catch(n){}var LZMAWorker=(function(){function n(){var t=this;if(!support)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var e=this.worker=new Worker(lzmaWorkerURL);e.onmessage=function(r){var o=r.data,s=o.id,u=o.result,l=o.error,c=t.getKey(s);t.requests[c]&&(l?t.requests[c](new Error(l)):t.requests[c](null,u),delete t.requests[c])},e.onerror=function(r){return console.error(r)}}return n.prototype.getKey=function(t){return"key_"+String(t)},n.prototype.decompress=function(t,e){var r=++this.callCounter;this.requests[this.getKey(r)]=e,this.worker.postMessage({type:"decompress",id:r,data:t},[t.buffer])},n.prototype.terminate=function(){this.worker.terminate()},n.support=support,n})();function readUint32(n){return Array.prototype.reduce.call(n,function(t,e,r){return t|e<<r*8},0)}function binaryArrays(n){for(var t=[],e=n.length,r=function(u){var l={data:n[u],offset:0,readByte:function(){return this.data[this.offset++]}},c=l.data.length,f={data:[],offset:0,writeByte:function(d){var h=Math.floor(this.offset/c);this.data[h]||(this.data[h]=new Uint8Array(c)),this.data[h][this.offset%c]=d,this.offset++}};LZMA.decompressFile(l,f),o=new Uint8Array(f.offset);for(var p=0;p<f.offset;p++)o[p]=f.data[Math.floor(p/c)][p%c];t.push(o)},o,s=0;s<e;s++)r(s);return t}function binaryArraysWithWorker(n){for(var t=[],e=n.length,r=function(s){t.push(new Promise(function(u,l){var c=new LZMAWorker;c.decompress(n[s],function(f,p){if(c.terminate(),f)return l(f);u(p)})}))},o=0;o<e;o++)r(o);return Promise.all(t)}function lzma(n){var t=new Uint8Array(n),e=readUint32(t.slice(0,4));if(e>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var r=[],o=[],s=4+e*4,u=0;u<e;u++)o[u]=readUint32(t.slice(4+u*4,8+u*4)),u===e-1?r[u]=t.subarray(s,s+o[u]):r[u]=t.slice(s,s+o[u]),s+=o[u];return LZMAWorker.support?binaryArraysWithWorker(r):Promise.resolve(binaryArrays(r))}function loadAt3d(n,t){var e,r,o,s,u,l;t===void 0&&(t={});for(var c=(e=t.upAxis)!==null&&e!==void 0?e:"Z",f=(r=t.light)!==null&&r!==void 0?r:!1,p=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,d=(s=t.textureBaseUri)!==null&&s!==void 0?s:guessTextureBaseUriFromFileUrl(n),h=t.textureBaseUri===void 0?[]:((u=t.textureArray)!==null&&u!==void 0?u:[]).slice(),g=autoRestImageOptionsByTextureLength((l=t.textureOptions)!==null&&l!==void 0?l:{},h.length),m=new Map,E=0,y=h;E<y.length;E++){var v=y[E];m.set(v,loadTexture$1(v,d,g,p))}var A={byteLength:0};return Promise.resolve().then(function(){return p.ajax(n,{responseType:"arraybuffer"})}).then(function(b){return lzma(b.body)}).then(function(b){for(var T={chunks:[],createAt:void 0,description:void 0},_=0,S=b;_<S.length;_++){var w=S[_],R=Model$2.decode(w);if(R.chunks.length){for(var I=0;I<R.chunks.length;I++)T.chunks.push(R.chunks[I]);T.createAt=R.createAt,T.description=R.description}}return T}).then(function(b){return parse$4(b,f,d,h,g,m,p)}).then(function(b){m.clear();var T=new THREE__namespace.Group;T.name=n;for(var _=0,S=b.objects;_<S.length;_++){var w=S[_];T.add(w)}return c==="Y"&&T.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"at3d",modelUpAxis:"Z",upAxis:c,uri:n,byteLength:A.byteLength,memoryUsage:getMemoryUsage(T),scene:T,textures:b.textures,animations:[],dispose:function(){return b.dispose()}}})}const $Reader=minimalExports.Reader,$util=minimalExports.util,$root=minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto"]||(minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto"]={}),Model$1=$root.Model=(()=>{function n(t){if(this.meshes=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.meshes=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Model;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.meshes&&u.meshes.length||(u.meshes=[]),u.meshes.push($root.Mesh.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root.Mesh=(()=>{function n(t){if(this.chunks=[],this.matrix=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.name="",n.prototype.chunks=$util.emptyArray,n.prototype.matrix=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Mesh;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.name=e.string();break}case 2:{u.chunks&&u.chunks.length||(u.chunks=[]),u.chunks.push($root.Chunk.decode(e,e.uint32()));break}case 3:{u.matrix&&u.matrix.length||(u.matrix=[]),u.matrix.push($root.Matrix.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("name"))throw $util.ProtocolError("missing required 'name'",{instance:u});return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Mesh"},n})(),$root.Matrix=(()=>{function n(t){if(this.elements=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.elements=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Matrix;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.elements&&u.elements.length||(u.elements=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.elements.push(e.float())}else u.elements.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Matrix"},n})(),$root.Chunk=(()=>{function n(t){if(this.material=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.geometry=null,n.prototype.material=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Chunk;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 2:{u.geometry=$root.Geometry.decode(e,e.uint32());break}case 3:{u.material&&u.material.length||(u.material=[]),u.material.push($root.Material.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("geometry"))throw $util.ProtocolError("missing required 'geometry'",{instance:u});return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root.Geometry=(()=>{function n(t){if(this.groups=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.position=null,n.prototype.uv=null,n.prototype.uv2=null,n.prototype.normal=null,n.prototype.groups=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Geometry;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.position=$root.Position.decode(e,e.uint32());break}case 2:{u.uv=$root.UV.decode(e,e.uint32());break}case 3:{u.uv2=$root.UV.decode(e,e.uint32());break}case 4:{u.normal=$root.Normal.decode(e,e.uint32());break}case 5:{u.groups&&u.groups.length||(u.groups=[]),u.groups.push($root.Group.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("position"))throw $util.ProtocolError("missing required 'position'",{instance:u});if(!u.hasOwnProperty("normal"))throw $util.ProtocolError("missing required 'normal'",{instance:u});return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Geometry"},n})(),$root.Position=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Position;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Position"},n})(),$root.UV=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.UV;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/UV"},n})(),$root.Normal=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Normal;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Normal"},n})(),$root.Group=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.start=0,n.prototype.count=0,n.prototype.materialIndex=0,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Group;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.start=e.uint32();break}case 2:{u.count=e.uint32();break}case 3:{u.materialIndex=e.uint32();break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("start"))throw $util.ProtocolError("missing required 'start'",{instance:u});if(!u.hasOwnProperty("count"))throw $util.ProtocolError("missing required 'count'",{instance:u});if(!u.hasOwnProperty("materialIndex"))throw $util.ProtocolError("missing required 'materialIndex'",{instance:u});return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Group"},n})(),$root.Material=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.kd=null,n.prototype.ks=null,n.prototype.ke=null,n.prototype.mapkd="",n.prototype.mapks="",n.prototype.mapke="",n.prototype.norm="",n.prototype.mapbump="",n.prototype.bump="",n.prototype.mapd="",n.prototype.ns=0,n.prototype.d=0,n.prototype.tr=0,n.prototype.mapkdrepeat="",n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Material;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.kd=$root.Color.decode(e,e.uint32());break}case 2:{u.ks=$root.Color.decode(e,e.uint32());break}case 3:{u.ke=$root.Color.decode(e,e.uint32());break}case 4:{u.mapkd=e.string();break}case 5:{u.mapks=e.string();break}case 6:{u.mapke=e.string();break}case 7:{u.norm=e.string();break}case 8:{u.mapbump=e.string();break}case 9:{u.bump=e.string();break}case 10:{u.mapd=e.string();break}case 11:{u.ns=e.float();break}case 12:{u.d=e.float();break}case 13:{u.tr=e.float();break}case 14:{u.mapkdrepeat=e.string();break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Material"},n})(),$root.Color=(()=>{function n(t){if(this.rgb=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.rgb=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Color;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.rgb&&u.rgb.length||(u.rgb=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.rgb.push(e.float())}else u.rgb.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Color"},n})();function loadDome(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){var c,f;return u.byteLength=l.body.byteLength,parse$3(new Uint8Array(l.body),(c=t.light)!==null&&c!==void 0?c:!0,t.textureBaseUri||"",(f=t.textureOptions)!==null&&f!==void 0?f:{},s)}).then(function(l){var c=new THREE__namespace.Group;c.matrixAutoUpdate=!1,o==="Z"&&c.applyMatrix4(ROTATE_X_MATRIX),c.matrix.compose(c.position,c.quaternion,c.scale),c.name=n;for(var f=0,p=l.objects;f<p.length;f++){var d=p[f];c.add(d)}return{type:"dome",modelUpAxis:"Y",upAxis:o,uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:[],dispose:function(){return l.dispose()}}})}function flipBufferGeometryNormals(n){for(var t=[0,0,0],e=0;e<n.attributes.normal.array.length/9;e++)t[0]=n.attributes.normal.array[e*9],t[1]=n.attributes.normal.array[e*9+1],t[2]=n.attributes.normal.array[e*9+2],n.attributes.normal.array[e*9]=n.attributes.normal.array[e*9+6],n.attributes.normal.array[e*9+1]=n.attributes.normal.array[e*9+7],n.attributes.normal.array[e*9+2]=n.attributes.normal.array[e*9+8],n.attributes.normal.array[e*9+6]=t[0],n.attributes.normal.array[e*9+7]=t[1],n.attributes.normal.array[e*9+8]=t[2];for(var e=0;e<n.attributes.position.array.length/9;e++)t[0]=n.attributes.position.array[e*9],t[1]=n.attributes.position.array[e*9+1],t[2]=n.attributes.position.array[e*9+2],n.attributes.position.array[e*9]=n.attributes.position.array[e*9+6],n.attributes.position.array[e*9+1]=n.attributes.position.array[e*9+7],n.attributes.position.array[e*9+2]=n.attributes.position.array[e*9+8],n.attributes.position.array[e*9+6]=t[0],n.attributes.position.array[e*9+7]=t[1],n.attributes.position.array[e*9+8]=t[2];for(var e=0;e<n.attributes.uv.array.length/6;e++)t[0]=n.attributes.uv.array[e*6],t[1]=n.attributes.uv.array[e*6+1],n.attributes.uv.array[e*6]=n.attributes.uv.array[e*6+4],n.attributes.uv.array[e*6+1]=n.attributes.uv.array[e*6+5],n.attributes.uv.array[e*6+4]=t[0],n.attributes.uv.array[e*6+5]=t[1];n.attributes.normal.needsUpdate=!0,n.attributes.position.needsUpdate=!0,n.attributes.uv.needsUpdate=!0}function parseGeometry(n){var t=n.position,e=n.normal,r=n.uv,o=n.uv2,s=n.groups,u=new THREE__namespace.BufferGeometry;u.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(t.array),3)),e&&u.setAttribute("normal",new THREE__namespace.BufferAttribute(new Float32Array(e.array),3)),r&&u.setAttribute("uv",new THREE__namespace.BufferAttribute(new Float32Array(r.array),2)),o&&u.setAttribute("uv2",new THREE__namespace.BufferAttribute(new Float32Array(o.array),2));for(var l=0,c=s;l<c.length;l++){var f=c[l];u.addGroup(f.start,f.count,f.materialIndex)}return u}function loadTexture(n,t,e,r,o,s,u){if(u.hasOwnProperty(n))return u[n];n=n.split("?")[0],isAbsoluteURL(n)||(n=pathJoin(t,n)),n=n.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/"),n.indexOf("//")===0&&(n="https:"+n);var l=__assign({key:"texture.dome",size:64},pick(e,["quality","format","sharpen","forceUseExifOrientation","mappings"])),c=u[n]=o.loadTexture(n,{imageURL:{transform:e.transform,options:l},wrapS:THREE__namespace.RepeatWrapping,wrapT:THREE__namespace.RepeatWrapping,fetcher:s}).then(function(f){var p=f.body;return r&&p.repeat.copy(r),p.needsUpdate=!0,p.updateMatrix(),p});return c}function parseMaterial(n,t,e,r,o,s,u,l,c){var f=[],p=new PBMMeshMaterial(t?"phong":"basic");if(l.add(p),n.kd&&(p.color=new THREE__namespace.Color().fromArray(n.kd.rgb).convertLinearToSRGB()),n.mapkd){var d=null;if(n.mapkdrepeat){var h=n.mapkdrepeat.split(/\s+/).map(function(y){return Number(y)}),g=h[0],m=h[1];d=new THREE__namespace.Vector2(g,m)}f.push(loadTexture(n.mapkd,e,r,d,o,s,u).then(function(y){y.encoding=THREE__namespace.sRGBEncoding,p.map=y,l.add(y),c.add(y),p.needsUpdate=!0}).catch(noop))}if(n.ks&&(p.specular=new THREE__namespace.Color().fromArray(n.ks.rgb).convertLinearToSRGB()),n.mapks&&f.push(loadTexture(n.mapks,e,r,null,o,s,u).then(function(y){p.specularMap=y,l.add(y),c.add(y)}).catch(noop)),n.ke&&(p.emissive=new THREE__namespace.Color().fromArray(n.ke.rgb).convertLinearToSRGB()),n.mapke&&f.push(loadTexture(n.mapke,e,r,null,o,s,u).then(function(y){y.encoding=THREE__namespace.sRGBEncoding,p.emissiveMap=y,l.add(y),c.add(y)}).catch(noop)),n.norm&&f.push(loadTexture(n.norm,e,r,null,o,s,u).then(function(y){p.normalMap=y,l.add(y),c.add(y)}).catch(noop)),n.mapbump&&f.push(loadTexture(n.mapbump,e,r,null,o,s,u).then(function(y){p.bumpMap=y,l.add(y),c.add(y)}).catch(noop)),n.bump&&f.push(loadTexture(n.bump,e,r,null,o,s,u).then(function(y){p.bumpMap=y,l.add(y),c.add(y)}).catch(noop)),typeof n.ns=="number"&&(p.shininess=n.ns),typeof n.d=="number"){var E=n.d;E>0&&E<1&&(p.opacity=E)}return p.floorIndex=0,{material:p,textureReady:Promise.all(f).then(noop)}}function fromProtoBuf(n){return Model$1.decode(n).meshes}function parse$3(n,t,e,r,o){for(var s=[],u=[],l=new Set,c=fromProtoBuf(n),f=new TextureLoader,p=new THREE__namespace.Matrix4,d=new THREE__namespace.Vector3,h=new THREE__namespace.Quaternion,g=new THREE__namespace.Vector3,m={},E=new Set,y=0,v=c;y<v.length;y++){var A=v[y],b=A.name,T=A.chunks,_=A.matrix;if(!(b==="Ceiling"||b==="CeilingDrop"))for(var S=0,w=_;S<w.length;S++){var R=w[S];p.elements=R.elements;for(var I=new THREE__namespace.Group,H=0;H<T.length;H++){var C=parseGeometry(T[H].geometry);C.applyMatrix4(p),p.decompose(d,h,g),g.x*g.y*g.z<0&&C.attributes.normal&&C.attributes.position&&C.attributes.uv&&flipBufferGeometryNormals(C),l.add(C);for(var M=[],B=0,L=T[H].material;B<L.length;B++){var O=L[B],k=parseMaterial(O,t,e||"",r,f,o,m,l,E),D=k.material,q=k.textureReady;u.push(q),M.push(D)}var z=new PBMMesh(C,M);z.name="chunk_"+H,z.matrix.compose(z.position,z.quaternion,z.scale),z.matrixAutoUpdate=!1,z.frustumCulled=!1,I.add(z)}I.name=b,s.push(I)}}return Promise.all(u).catch(noop).then(function(){return{createAt:0,description:"",objects:s,textures:Array.from(E),dispose:function(){l.forEach(function(V){V.dispose()}),l.clear()}}})}function loadDomez(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){return u.byteLength=l.body.byteLength,lzma(l.body)}).then(function(l){var c=l.reduce(function(d,h){return d+h.length},0),f=new Uint8Array(c),p=0;return l.forEach(function(d){f.set(d,p),p+=d.length}),f}).then(function(l){var c,f;return parse$3(l,(c=t.light)!==null&&c!==void 0?c:!0,t.textureBaseUri||"",(f=t.textureOptions)!==null&&f!==void 0?f:{},s)}).then(function(l){var c=new THREE__namespace.Group;c.matrixAutoUpdate=!1,o==="Z"&&c.applyMatrix4(ROTATE_X_MATRIX),c.matrix.compose(c.position,c.quaternion,c.scale),c.name=n;for(var f=0,p=l.objects;f<p.length;f++){var d=p[f];c.add(d)}return{type:"domez",modelUpAxis:"Y",upAxis:"Z",uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:[],dispose:function(){return l.dispose()}}})}var SIZEOF_UINT32$1=4;function parseHeader$1(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.byteLength=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var _a$4,GL_TYPE;(function(n){n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.INT=5124]="INT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.DOUBLE=5130]="DOUBLE"})(GL_TYPE||(GL_TYPE={}));var GL_TYPE_TO_ARRAY_TYPE=(_a$4={},_a$4[GL_TYPE.DOUBLE]=Float64Array,_a$4[GL_TYPE.FLOAT]=Float32Array,_a$4[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$4[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$4[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$4[GL_TYPE.BYTE]=Int8Array,_a$4[GL_TYPE.SHORT]=Int16Array,_a$4[GL_TYPE.INT]=Int32Array,_a$4),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(n){var t=GL_TYPE_TO_ARRAY_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(n){var t=getArrayType(n);return t.BYTES_PER_ELEMENT}function createTypedArray(n,t,e,r){e===void 0&&(e=0);var o=getArrayType(n);if(e%getByteSize(n)!==0){var s=r?t.slice(e,e+r*getByteSize(n)):t.slice(e);return new o(s)}else return new o(t,e,r!=null?r:(t.byteLength-e)/getByteSize(n))}function glTypeFromName(n){var t=NAME_TO_GL_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=(function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return n.prototype.getExtension=function(t){return this.json.extensions&&this.json.extensions[t]},n.prototype.hasProperty=function(t){return!!this.json[t]},n.prototype.getGlobalProperty=function(t,e,r){var o=this.json[t];if(typeof o=="number"){var s=getArrayType(e);return new s([o])}else if(Array.isArray(o)){var s=getArrayType(e);return new s(o)}else if(o&&Number.isFinite(o.byteOffset))return this.getTypedArrayFromBinary(t,e,r,1,o.byteOffset);return null},n.prototype.getPropertyArray=function(t,e,r){var o=this.json[t];return o&&Number.isFinite(o.byteOffset)?("componentType"in o&&(e=glTypeFromName(o.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,o.byteOffset)):this.getTypedArrayFromArray(t,e,o)},n.prototype.getProperty=function(t,e,r,o,s){var u=this.json[t];if(!u)return null;var l=this.getPropertyArray(t,e,r);if(r===1)return s[0]=l[o],s;for(var c=0;c<r;++c)s[c]=l[r*o+c];return s},n.prototype.getTypedArrayFromBinary=function(t,e,r,o,s){var u=this.cachedTypedArrays,l=u[t];return l||(l=createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+s,o*r),u[t]=l),l},n.prototype.getTypedArrayFromArray=function(t,e,r){var o=this.cachedTypedArrays,s=o[t];return s||(s=createTypedArray(e,r),o[t]=s),s},n})(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(n,t,e){var r=new TextDecoder("utf8"),o=new Uint8Array(n,t,e),s=r.decode(o);return s}function parseTable(n,t,e){return e=parseTablesHeader(n,t,e),e=parseFeatureTable(n,t,e),e=parseBatchTable(n,t,e),e}function parseTablesHeader(n,t,e){var r=new DataView(t),o=0;n.header=n.header||{};var s=r.getUint32(e,!0);e+=SIZEOF_UINT32;var u=r.getUint32(e,!0);e+=SIZEOF_UINT32;var l=r.getUint32(e,!0);e+=SIZEOF_UINT32;var c=r.getUint32(e,!0);return e+=SIZEOF_UINT32,l>=570425344?(e-=SIZEOF_UINT32*2,o=s,l=u,c=0,s=0,u=0,console.warn(DEPRECATION_WARNING)):c>=570425344&&(e-=SIZEOF_UINT32,o=l,l=s,c=u,s=0,u=0,console.warn(DEPRECATION_WARNING)),n.header.featureTableJsonByteLength=s,n.header.featureTableBinaryByteLength=u,n.header.batchTableJsonByteLength=l,n.header.batchTableBinaryByteLength=c,n.header.batchLength=o,e}function parseFeatureTable(n,t,e){var r=n.header||{},o=r.featureTableJsonByteLength,s=r.featureTableBinaryByteLength,u=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:u||0},o&&o>0){var l=getStringFromArrayBuffer(t,e,o);n.featureTableJson=JSON.parse(l)}e+=o||0,n.featureTableBinary=new Uint8Array(t,e,s),e+=s||0;var c=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var f=c.json.RTC_CENTER;n.rtcCenter=[f[0],f[1],f[2]]}else{var f=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);f&&(n.rtcCenter=[f[0],f[1],f[2]])}return e}function parseBatchTable(n,t,e){var r=n.header||{},o=r.batchTableJsonByteLength,s=r.batchTableBinaryByteLength;if(o&&o>0){var u=getStringFromArrayBuffer(t,e,o);n.batchTableJson=JSON.parse(u),e+=o,s&&s>0&&(n.batchTableBinary=new Uint8Array(t,e,s),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=s)}return e}function sliceArrayBuffer(n,t,e){var r=e!==void 0?new Uint8Array(n).subarray(t,t+e):new Uint8Array(n).subarray(t),o=new Uint8Array(r);return o.buffer}function parseGlTFArrayBuffer(n,t,e){var r=n.byteLength-e;if(r===0)throw new Error("glTF byte length must be greater than 0.");return e%4!==0&&console.warn("".concat(n.type,": embedded glb is not aligned to a 4-byte boundary.")),n.gltfArrayBuffer=sliceArrayBuffer(t,e,r),n.byteLength}function decodeText(n){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(n);for(var t="",e=0,r=n.length;e<r;e++)t+=String.fromCharCode(n[e]);try{return decodeURIComponent(escape(t))}catch(o){return t}}var WEBGL_CONSTANTS={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",TEXCOORD_2:"uv3",TEXCOORD_3:"uv4",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(n){var t=[];for(var e in n)t.push(n[e]);return t}function composeDsiposeSet(n){var t=Array.from(n);return function(){for(var e=0,r=t;e<r.length;e++){var o=r[e];typeof o.dispose=="function"&&o.dispose(),typeof o.close=="function"&&o.close()}}}var Parser=(function(){function n(t,e,r){this.json=t,this.extensions=e,this.options=r,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}return n.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach(function(t){typeof t.dispose=="function"&&t.dispose(),typeof t.close=="function"&&t.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:"unknown"}}},n.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],o=0,s=e.length;o<s;o++)for(var u=e[o].joints,l=0,c=u.length;l<c;l++)t[u[l]].isBone=!0;for(var f=0,p=t.length;f<p;f++){var d=t[f];d.mesh!==void 0&&d.skin!==void 0&&(r[d.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.markDefs();for(var o=0,s=values(r);o<s.length;o++){var u=s[o];u.markDefs(this)}return Promise.all(values(r).map(function(l){return l.prepare(t)})).then(function(){var l,c,f;return Promise.all([Promise.all(((l=e.scenes)!==null&&l!==void 0?l:[]).map(function(p,d){return t.loadScene(d)})),Promise.all(((c=e.animations)!==null&&c!==void 0?c:[]).map(function(p,d){return t.loadAnimation(d)})),Promise.all(((f=e.cameras)!==null&&f!==void 0?f:[]).map(function(p,d){return t.loadCamera(d)}))])}).then(function(l){var c=l[0],f=l[1],p=l[2],d={json:e,scene:c[e.scene||0],scenes:c,animations:f,cameras:p,textures:[],dispose:noop};return d}).then(function(l){return Promise.all(values(r).map(function(c){return c.emitResult(l,t)})).then(function(){return l})}).then(function(l){var c=Array.from(t.textureSet),f=composeDsiposeSet(t.disposeSet);return Object.assign(l,{textures:c,dispose:f}),t.textureSet.clear(),t.disposeSet.clear(),t.dispose(),l})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadCamera(t,this),o)break}if(!o){var c=void 0,f=this.json.cameras[t],p=f[f.type];p?f.type==="perspective"?c=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(p.yfov),p.aspectRatio||1,p.znear||1,p.zfar||2e6):f.type==="orthographic"?c=new THREE__namespace.OrthographicCamera(-p.xmag,p.xmag,p.ymag,-p.ymag,p.znear,p.zfar):(console.warn("glTF: Invalid camera type ".concat(f.type,".")),c=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),c=new THREE__namespace.Camera),f.name&&(c.name=f.name),o=Promise.resolve(c)}return this.cache.set(e,o),o},n.prototype.loadSkin=function(t){var e="skin:"+t,r=this.cache.get(e);if(r)return r;var o,s=this.json.skins[t],u={joints:s.joints};return s.inverseBindMatrices===void 0?o=Promise.resolve(u):o=this.loadAccessor(s.inverseBindMatrices).then(function(l){return l&&(u.inverseBindMatrices=l),u}),this.cache.set(e,o),o},n.prototype.loadAnimation=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadAnimation(t,this),o)break}if(!o){for(var c=this.json,f=c.animations[t],p=[],d=[],h=[],g=[],m=[],E=0,y=f.channels.length;E<y;E++){var v=f.channels[E],A=f.samplers[v.sampler],b=v.target,T=b.node!==void 0?b.node:b.id,_=f.parameters!==void 0?f.parameters[A.input]:A.input,S=f.parameters!==void 0?f.parameters[A.output]:A.output;p.push(this.loadNode(T)),d.push(this.loadAccessor(_)),h.push(this.loadAccessor(S)),g.push(A),m.push(b)}o=Promise.all([Promise.all(p),Promise.all(d),Promise.all(h),Promise.all(g),Promise.all(m)]).then(function(w){for(var R=w[0],I=w[1],H=w[2],C=w[3],M=w[4],B=[],L=function(q,z){var V=R[q],Q=I[q],U=H[q],j=C[q],G=M[q];if(V===void 0)return"continue";V.updateMatrix(),V.matrixAutoUpdate=!0;var ae=void 0;switch(PATH_PROPERTIES[G.path]){case PATH_PROPERTIES.weights:ae=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:ae=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:ae=THREE__namespace.VectorKeyframeTrack;break}var re=V.name?V.name:V.uuid,$=j.interpolation!==void 0?INTERPOLATION[j.interpolation]:THREE__namespace.InterpolateLinear,ee=[];PATH_PROPERTIES[G.path]===PATH_PROPERTIES.weights?V.traverse(function(ne){ne.morphTargetInfluences&&ee.push(ne.name?ne.name:ne.uuid)}):ee.push(re);var K=U.array;if(U.normalized){for(var se=getNormalizedComponentScale(K.constructor),W=new Float32Array(K.length),X=0,te=K.length;X<te;X++)W[X]=K[X]*se;K=W}for(var X=0,te=ee.length;X<te;X++){var Z=new ae(ee[X]+"."+PATH_PROPERTIES[G.path],Q.array,K,$);B.push(Z)}},O=0,k=R.length;O<k;O++)L(O);var D=f.name?f.name:"animation_"+t;return new THREE__namespace.AnimationClip(D,void 0,B)})}return this.cache.set(e,o),o},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,o=this.cache.get(r);if(o)return o;for(var s=null,u=0,l=values(this.extensions);u<l.length;u++){var c=l[u];if(s=c.loadBuffer(t,this),s)break}if(!s){var f=this.json.buffers[t];s=this.options.fetcher.ajax(this.resolveResouce(f.uri),{responseType:"arraybuffer"}).then(function(p){return p.body})}return this.cache.set(r,s),s},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadBufferView(t,this),o)break}if(!o){var c=this.json.bufferViews[t];o=this.loadBuffer(c.buffer).then(function(f){var p=c.byteLength||0,d=c.byteOffset||0;return f.slice(d,d+p)})}return this.cache.set(e,o),o},n.prototype.loadAccessor=function(t){var e=this,r="accessor:"+t,o=this.cache.get(r);if(o)return o;var s=null;if(!s){var u=this.json.accessors[t];if(u.bufferView===void 0&&u.sparse===void 0)s=Promise.resolve(null);else{var l=[];u.bufferView!==void 0?l.push(this.loadBufferView(u.bufferView)):l.push(Promise.resolve(null)),u.sparse!==void 0&&(l.push(this.loadBufferView(u.sparse.indices.bufferView)),l.push(this.loadBufferView(u.sparse.values.bufferView))),s=Promise.all(l).then(function(c){var f=c[0],p=WEBGL_TYPE_SIZES[u.type],d=WEBGL_COMPONENT_TYPES[u.componentType],h=d.BYTES_PER_ELEMENT,g=h*p,m=u.byteOffset||0,E=u.bufferView!==void 0?e.json.bufferViews[u.bufferView].byteStride:void 0,y=u.normalized===!0,v,A;if(E&&E!==g){var b=Math.floor(m/E),T="InterleavedBuffer:"+u.bufferView+":"+u.componentType+":"+b+":"+u.count,_=e.cache.get(T);_||(v=new d(f,b*E,u.count*E/h),_=new THREE__namespace.InterleavedBuffer(v,E/h),e.cache.set(T,_)),A=new THREE__namespace.InterleavedBufferAttribute(_,p,m%E/h,y)}else f===null?v=new d(u.count*p):v=new d(f,m,u.count*p),A=new THREE__namespace.BufferAttribute(v,p,y);if(u.sparse!==void 0){var S=WEBGL_TYPE_SIZES.SCALAR,w=WEBGL_COMPONENT_TYPES[u.sparse.indices.componentType],R=u.sparse.indices.byteOffset||0,I=u.sparse.values.byteOffset||0,H=new w(c[1],R,u.sparse.count*S),C=new d(c[2],I,u.sparse.count*p);f!==null&&(A=new THREE__namespace.BufferAttribute(A.array.slice(),A.itemSize,A.normalized));for(var M=0,B=H.length;M<B;M++){var L=H[M];if(A.setX(L,C[M*p]),p>=2&&A.setY(L,C[M*p+1]),p>=3&&A.setZ(L,C[M*p+2]),p>=4&&A.setW(L,C[M*p+3]),p>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return A})}}return this.cache.set(r,s),s},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var o=r[e],s=o.createPrimitiveKey(t,this);if(s)return s}for(var u="",l=Object.keys(t.attributes).sort(),c=0,f=l.length;c<f;c++)u+=l[c]+":"+t.attributes[l[c]]+";";return t.indices+":"+u+":"+t.mode},n.prototype.loadGeometry=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadGeometry(t,this),r)break}return r||(r=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,t)),r=r.then(function(l){return e.disposeSet.add(l),l}),r},n.prototype.loadImage=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadImage(t,this),r)break}if(!r){var l=this.json.images[t];if(l.bufferView!==void 0){var c=this.json.bufferViews[l.bufferView];r=this.loadBuffer(c.buffer).then(function(p){var d=c.byteOffset||0,h=c.byteLength||0,g=new Uint8Array(p,d,h),m=new Blob([g],{type:l.mimeType});return createImageBitmapLike(m)})}else if(l.uri){var f=this.resolveResouce(l.uri);canUseNativeImageBitmap()?r=this.options.fetcher.ajax(f,{responseType:"blob"}).then(function(p){var d=p.body;return createImageBitmapLike(d)}):r=this.options.fetcher.loadImage(f,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(p){return p.body})}else throw new Error("glTF: Invalid image defs.")}return r=r.then(function(p){return e.disposeSet.add(p),p}),r},n.prototype.loadMaterialAsMeshStandardMaterial=function(t){var e=this,r=[],o=new THREE__namespace.MeshStandardMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=1,t.material!==void 0){var s=this.json.materials[t.material];s.name&&(o.name=s.name);var u=s.pbrMetallicRoughness||{};if(Array.isArray(u.baseColorFactor)){var l=u.baseColorFactor;o.color.fromArray(l),o.opacity=l[3]}u.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(u.baseColorTexture).then(function(p){p.encoding=THREE__namespace.sRGBEncoding,o.map=p,e.disposeSet.add(p)})),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(u.metallicRoughnessTexture).then(function(p){p.format=THREE__namespace.RGBFormat,o.metalnessMap=p,o.roughnessMap=p,e.disposeSet.add(p)})),s.doubleSided===!0&&(o.side=THREE__namespace.DoubleSide);var c=s.alphaMode||ALPHA_MODES.OPAQUE;if(c===ALPHA_MODES.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===ALPHA_MODES.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&(r.push(this.createMaterialTexture(s.normalTexture).then(function(p){p.format=THREE__namespace.RGBFormat,o.normalMap=p,e.disposeSet.add(p)})),o.normalScale=new THREE__namespace.Vector2(1,1),s.normalTexture.scale!==void 0)){var f=s.normalTexture.scale;o.normalScale.set(f,f)}s.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(s.occlusionTexture).then(function(p){p.format=THREE__namespace.RGBFormat,o.aoMap=p,e.disposeSet.add(p)})),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&(o.emissive=new THREE__namespace.Color().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(s.emissiveTexture).then(function(p){p.format=THREE__namespace.RGBFormat,o.emissiveMap=p,e.disposeSet.add(p)}))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterialAsMeshBasicMaterial=function(t){var e=this,r=[],o=new THREE__namespace.MeshBasicMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=1,t.material!==void 0){var s=this.json.materials[t.material];s.name&&(o.name=s.name);var u=s.pbrMetallicRoughness||{};if(Array.isArray(u.baseColorFactor)){var l=u.baseColorFactor;o.color.fromArray(l),o.opacity=l[3]}u.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(u.baseColorTexture).then(function(f){o.map=f,e.disposeSet.add(f)})),s.doubleSided===!0&&(o.side=THREE__namespace.DoubleSide);var c=s.alphaMode||ALPHA_MODES.OPAQUE;c===ALPHA_MODES.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===ALPHA_MODES.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(s.occlusionTexture).then(function(f){o.aoMap=f,e.disposeSet.add(f)})),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new THREE__namespace.LineBasicMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,t.material!==void 0){var o=this.json.materials[t.material];o.name&&(r.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;r.color.fromArray(u),r.opacity=u[3]}o.doubleSided===!0&&(r.side=THREE__namespace.DoubleSide);var l=o.alphaMode||ALPHA_MODES.OPAQUE;l===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,l===ALPHA_MODES.MASK&&(r.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(e).then(function(){return r})},n.prototype.loadMaterialAsPointsMaterial=function(t){var e=this,r=[],o=new THREE__namespace.PointsMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=1,o.sizeAttenuation=!1,t.material!==void 0){var s=this.json.materials[t.material];s.name&&(o.name=s.name);var u=s.pbrMetallicRoughness||{};if(Array.isArray(u.baseColorFactor)){var l=u.baseColorFactor;o.color.fromArray(l),o.opacity=l[3]}u.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(u.baseColorTexture).then(function(f){f.encoding=THREE__namespace.sRGBEncoding,o.map=f,e.disposeSet.add(f)})),s.doubleSided===!0&&(o.side=THREE__namespace.DoubleSide);var c=s.alphaMode||ALPHA_MODES.OPAQUE;c===ALPHA_MODES.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===ALPHA_MODES.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterial=function(t){var e=this,r,o=(r=t.mode)!==null&&r!==void 0?r:WEBGL_CONSTANTS.TRIANGLES,s="material:"+this.createPrimitiveKey(t),u=this.cache.get(s);if(u)return u;for(var l=null,c=0,f=values(this.extensions);c<f.length;c++){var p=f[c];if(l=p.loadMaterial(t,this),l)break}if(!l)if(o===WEBGL_CONSTANTS.TRIANGLES||o===WEBGL_CONSTANTS.TRIANGLE_STRIP||o===WEBGL_CONSTANTS.TRIANGLE_FAN)this.extensions.KHR_materials_unlit?l=this.loadMaterialAsMeshBasicMaterial(t):l=this.loadMaterialAsMeshStandardMaterial(t);else if(o===WEBGL_CONSTANTS.LINES||o===WEBGL_CONSTANTS.LINE_STRIP||o===WEBGL_CONSTANTS.LINE_LOOP)l=this.loadMaterialAsLineBasicMaterial(t);else if(o===WEBGL_CONSTANTS.POINTS)l=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+o);return l=l.then(function(d){return Promise.all(values(e.extensions).map(function(h){return h.extendMaterial(d,t,e)})).then(function(){return d})}),this.cache.set(s,l),l},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,o=this.cache.get(r);if(o)return o;for(var s=null,u=0,l=values(this.extensions);u<l.length;u++){var c=l[u];if(s=c.loadTexture(t,this),s)break}if(!s){var f=this.json.textures[t];s=this.loadImage(f.source).then(function(p){var d=new THREE__namespace.Texture(p);d.needsUpdate=!0,d.flipY=!1,f.name&&(d.name=f.name);var h=e.json.samplers||{},g=h[f.sampler]||{};return d.magFilter=WEBGL_FILTERS[g.magFilter]||THREE__namespace.LinearFilter,d.minFilter=WEBGL_FILTERS[g.minFilter]||THREE__namespace.LinearMipmapLinearFilter,d.wrapS=WEBGL_WRAPPINGS[g.wrapS]||THREE__namespace.RepeatWrapping,d.wrapT=WEBGL_WRAPPINGS[g.wrapT]||THREE__namespace.RepeatWrapping,d.onUpdate=function(){p.close()},d})}return s=s.then(function(p){return e.disposeSet.add(p),p}),this.cache.set(r,s),s},n.prototype.normalizeSkinWeights=function(t){var e=t.geometry,r=e.attributes.skinWeight;if(!r.normalized)t.normalizeSkinWeights();else{var o=0;if(r.array instanceof Uint8Array)o=255;else if(r.array instanceof Uint16Array)o=65535;else if(r.array instanceof Uint32Array)o=4294967295;else return;for(var s=new THREE__namespace.Vector4,u=0,l=r.count;u<l;u++){s.x=r.getX(u),s.y=r.getY(u),s.z=r.getZ(u),s.w=r.getW(u);var c=o/s.manhattanLength();c!==1&&(!isNaN(c)&&isFinite(c)?s.multiplyScalar(c):s.set(o,0,0,0),r.setXYZW(u,s.x,s.y,s.z,s.w))}}},n.prototype.loadMesh=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadMesh(t,this),r)break}if(!r){var l=this.json.meshes[t],c=l.primitives,f=Promise.all(c.map(function(d){return e.loadGeometry(d)})),p=Promise.all(c.map(function(d){return e.loadMaterial(d)}));r=Promise.all([f,p]).then(function(d){for(var h,g=d[0],m=d[1],E=[],y=0;y<c.length;y++){var v=c[y],A=g[y],b=m[y],T=(h=v.mode)!==null&&h!==void 0?h:WEBGL_CONSTANTS.TRIANGLES,_=void 0;if(T===WEBGL_CONSTANTS.TRIANGLES||T===WEBGL_CONSTANTS.TRIANGLE_STRIP||T===WEBGL_CONSTANTS.TRIANGLE_FAN)if(T===WEBGL_CONSTANTS.TRIANGLE_STRIP?A=e.toGeometryTrianglesDrawMode(A,THREE__namespace.TriangleStripDrawMode):T===WEBGL_CONSTANTS.TRIANGLE_FAN&&(A=e.toGeometryTrianglesDrawMode(A,THREE__namespace.TriangleFanDrawMode)),e.disposeSet.add(A),l.isSkinnedMesh){var S=new THREE__namespace.SkinnedMesh(A,b);e.normalizeSkinWeights(S),_=S}else _=new THREE__namespace.Mesh(A,b);else if(T===WEBGL_CONSTANTS.POINTS)_=new THREE__namespace.Points(A,b);else if(T===WEBGL_CONSTANTS.LINES)_=new THREE__namespace.LineSegments(A,b);else if(T===WEBGL_CONSTANTS.LINE_STRIP)_=new THREE__namespace.Line(A,b);else if(T===WEBGL_CONSTANTS.LINE_LOOP)_=new THREE__namespace.LineLoop(A,b);else throw new Error("glTF: Primitive mode unsupported: "+T);if(Object.keys(A.morphAttributes).length>0){if(l.weights!==void 0)for(var w=0,R=l.weights.length;w<R;w++)_.morphTargetInfluences[w]=l.weights[w];if(l.extras&&Array.isArray(l.extras.targetNames)){var I=l.extras.targetNames;if(_.morphTargetInfluences.length===I.length){_.morphTargetDictionary={};for(var w=0,R=I.length;w<R;w++)_.morphTargetDictionary[I[w]]=w}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}_.name=l.name||"mesh_"+t,g.length>1&&(_.name+="_"+y),e.assignFinalMaterial(_),E.push(_)}if(E.length===1)return E[0];for(var H=new THREE__namespace.Group,C=0,M=E;C<M.length;C++){var _=M[C];H.add(_)}return H})}return r},n.prototype.assignFinalMaterial=function(t){var e=this,r=t.geometry,o=[].concat(t.material),s=r.attributes.tangent!==void 0,u=r.attributes.color!==void 0,l=r.attributes.normal===void 0,c=t instanceof THREE__namespace.SkinnedMesh,f=Object.keys(r.morphAttributes).length>0,p=f&&r.morphAttributes.normal!==void 0;o=o.map(function(d){if(s||u||l||c||f||p){var h="cloned-material:"+d.uuid+":";s&&(h+="vertex-tangents:"),u&&(h+="vertex-colors:"),l&&(h+="flat-shading:"),c&&(h+="skinning:"),f&&(h+="morph-targets:"),p&&(h+="morph-normals:");var g=e.cache.get(h);g||(g=d.clone(),s&&(g.vertexTangents=!0),u&&(g.vertexColors=!0),l&&(g.flatShading=!0),c&&(g.skinning=!0),f&&(g.morphTargets=!0),p&&(g.morphNormals=!0),s&&(g.normalScale&&(g.normalScale.y*=-1),g.clearcoatNormalScale&&(g.clearcoatNormalScale.y*=-1)),e.cache.set(h,g)),d=g}return d}),Array.isArray(t.material)?t.material=o:t.material=o[0]},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,o=values(this.extensions);r<o.length;r++){var s=o[r],u=s.loadNodeAttachments(t,this);u&&e.push(u)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var o=this.json,s=o.nodes[t],u=[];s.mesh!==void 0&&u.push(this.loadMesh(s.mesh).then(function(h){if(s.weights!==void 0){var g=s.weights;h.traverse(function(m){if(m instanceof THREE__namespace.Mesh||m instanceof THREE__namespace.Line||m instanceof THREE__namespace.Points)for(var E=0,y=g.length;E<y;E++)m.morphTargetInfluences[E]=g[E]})}return h})),s.camera!==void 0&&u.push(this.loadCamera(s.camera));for(var l=this.loadNodeAttachments(t),c=0,f=l;c<f.length;c++){var p=f[c];u.push(p)}var d=Promise.all(u).then(function(h){var g;if(s.isBone===!0?g=new THREE__namespace.Bone:h.length>1?g=new THREE__namespace.Group:h.length===1?g=h[0]:g=new THREE__namespace.Object3D,g!==h[0])for(var m=0,E=h.length;m<E;m++)g.add(h[m]);if(s.name&&(g.userData.name=s.name,g.name=THREE__namespace.PropertyBinding.sanitizeNodeName(s.name)),s.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(s.matrix),g.applyMatrix4(y)}else s.translation!==void 0&&g.position.fromArray(s.translation),s.rotation!==void 0&&g.quaternion.fromArray(s.rotation),s.scale!==void 0&&g.scale.fromArray(s.scale);return g});return this.cache.set(e,d),d},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],o=new THREE__namespace.Group;r.name&&(o.name=r.name);for(var s=r.nodes||[],u=[],l=0,c=s.length;l<c;l++)u.push(this.buildNodeHierarchy(s[l],o));return Promise.all(u).then(function(){return o})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var o=0,s=values(e.extensions);o<s.length;o++){var u=s[o],l=u.extendTexture(r,t,e);l&&(r=l)}return e.textureSet.add(r),e.disposeSet.add(r),r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,o=e.attributes,s=[],u=function(_){var S=ATTRIBUTES[_]||_.toLowerCase();if(S in t.attributes)return"continue";s.push(l.loadAccessor(o[_]).then(function(w){w&&t.setAttribute(S,w)}))},l=this;for(var c in o)u(c);e.indices!==void 0&&!t.index&&s.push(this.loadAccessor(e.indices).then(function(_){_&&t.setIndex(_)}));var f=new THREE__namespace.Box3;if(o.POSITION!==void 0){var p=this.json.accessors[o.POSITION],d=p.min,h=p.max;if(d!==void 0&&h!==void 0){if(f.set(new THREE__namespace.Vector3(d[0],d[1],d[2]),new THREE__namespace.Vector3(h[0],h[1],h[2])),p.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[p.componentType]);f.min.multiplyScalar(g),f.max.multiplyScalar(g)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var m=e.targets;if(m!==void 0){for(var E=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,v=0,A=m.length;v<A;v++){var b=m[v];if(b.POSITION!==void 0){var p=this.json.accessors[b.POSITION],d=p.min,h=p.max;if(d!==void 0&&h!==void 0){if(y.setX(Math.max(Math.abs(d[0]),Math.abs(h[0]))),y.setY(Math.max(Math.abs(d[1]),Math.abs(h[1]))),y.setZ(Math.max(Math.abs(d[2]),Math.abs(h[2]))),p.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[p.componentType]);y.multiplyScalar(g)}E.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}f.expandByVector(E)}t.boundingBox=f;var T=new THREE__namespace.Sphere;return f.getCenter(T.center),T.radius=f.min.distanceTo(f.max)/2,t.boundingSphere=T,Promise.all(s).then(function(){var _=!1;if(e.material!==void 0){var S=r.json.materials[e.material];S.occlusionTexture&&(_=!0)}if((_||r.options.copyUV2)&&t.attributes.uv&&!t.attributes.uv2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var w=!1,R=!1,I=0,H=e.targets.length;I<H;I++){var C=e.targets[I];if(C.POSITION!==void 0&&(w=!0),C.NORMAL!==void 0&&(R=!0),w&&R)break}if(!w&&!R)return t;var M=[];t.morphTargetsRelative=!0;for(var B=function(L,O){var k=e.targets[L];w?M.push(r.loadAccessor(k.POSITION).then(function(D){D&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[L]=D)})):t.attributes.position&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[L]=t.attributes.position),R?M.push(r.loadAccessor(k.NORMAL).then(function(D){D&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[L]=D)})):t.attributes.normal&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[L]=t.attributes.normal)},I=0,H=e.targets.length;I<H;I++)B(I,H);return Promise.all(M).then(function(){return t})}else return t})},n.prototype.buildNodeHierarchy=function(t,e){var r=this,o=this.json.nodes[t];return this.loadNode(t).then(function(s){if(o.skin===void 0)return s;var u;return r.loadSkin(o.skin).then(function(l){u=l;for(var c=[],f=0,p=u.joints.length;f<p;f++)c.push(r.loadNode(u.joints[f]));return Promise.all(c)}).then(function(l){return s.traverse(function(c){if(c instanceof THREE__namespace.SkinnedMesh){for(var f=[],p=[],d=0,h=l.length;d<h;d++){var g=l[d];if(g instanceof THREE__namespace.Bone){f.push(g);var m=new THREE__namespace.Matrix4;u.inverseBindMatrices!==void 0&&m.fromArray(u.inverseBindMatrices.array,d*16),p.push(m)}else console.warn('glTF: Joint "%s" could not be found.',u.joints[d])}var E=new THREE__namespace.Skeleton(f,p);c.bind(E,c.matrixWorld)}}),s})}).then(function(s){e.add(s);var u=[];if(o.children)for(var l=o.children,c=0,f=l.length;c<f;c++){var p=l[c];u.push(r.buildNodeHierarchy(p,s))}return Promise.all(u).then(function(){return s})})},n.prototype.resolveResouce=function(t){return/^[a-z]{0,8}\:/i.test(t)?t:pathJoin(this.options.resourcePath,appendSearch(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var o=[],s=t.getAttribute("position");if(s!==void 0){for(var u=0;u<s.count;u++)o.push(u);t.setIndex(o),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var l=r.count-2,c=[];if(e===THREE__namespace.TriangleFanDrawMode)for(var u=1;u<=l;u++)c.push(r.getX(0)),c.push(r.getX(u)),c.push(r.getX(u+1));else for(var u=0;u<l;u++)u%2===0?(c.push(r.getX(u)),c.push(r.getX(u+1)),c.push(r.getX(u+2))):(c.push(r.getX(u+2)),c.push(r.getX(u+1)),c.push(r.getX(u)));c.length/3!==l&&console.error("glTF: Unable to generate correct amount of triangles.");var f=t.clone();return f.setIndex(c),this.disposeSet.add(f),f},n})();function getNormalizedComponentScale(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=(function(){function n(){}return n.prototype.markDefs=function(t){},n.prototype.prepare=function(t){},n.prototype.emitResult=function(t,e){},n.prototype.createPrimitiveKey=function(t,e){},n.prototype.extendTexture=function(t,e,r){return null},n.prototype.loadBuffer=function(t,e){return null},n.prototype.loadBufferView=function(t,e){return null},n.prototype.loadImage=function(t,e){return null},n.prototype.loadTexture=function(t,e){return null},n.prototype.loadGeometry=function(t,e){return null},n.prototype.loadMaterial=function(t,e){return null},n.prototype.extendMaterial=function(t,e,r){return Promise.resolve()},n.prototype.loadMesh=function(t,e){return null},n.prototype.loadNodeAttachments=function(t,e){return null},n.prototype.loadCamera=function(t,e){return null},n.prototype.loadAnimation=function(t,e){return null},n})(),KHR_binary_glTF=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.header={magic:"",version:0,length:0},e.content="",e.body=null,e}return t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var r=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var o=new DataView(e,t.HEADER_LENGTH),s=0,u=null,l=null;s<o.byteLength;){var c=o.getUint32(s,!0);if(s+=4,c!==0){var f=o.getUint32(s,!0);if(s+=4,f===t.CHUNK_TYPES.JSON){var p=new Uint8Array(e,t.HEADER_LENGTH+s,c);u=decodeText(p)}else if(f===t.CHUNK_TYPES.BIN){var d=t.HEADER_LENGTH+s;l=e.slice(d,d+c)}s+=c}}if(u===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=u,this.body=l},t.prototype.loadBuffer=function(e,r){var o=r.json.buffers[e];return o.uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null},t.prototype.clear=function(){this.body=null,this.content=""},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t})(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=(function(){function n(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return n.prototype.setDecoderPath=function(t){this.decoderPath=t},n.prototype.setDecoderConfig=function(t){return this.decoderConfig=t,this},n.prototype.setWorkerLimit=function(t){return this.workerLimit=t,this},n.prototype.decodeDracoFile=function(t,e,r,o){var s={attributeIDs:r||defaultAttributeIDs,attributeTypes:o||defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(t,s).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1});for(var o in e.attributeTypes){var s=e.attributeTypes[o];s.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[o]=s.name)}var u,l=this.workerNextTaskID++,c=t.byteLength,f=this._getWorker(l,c).then(function(p){return u=p,new Promise(function(d,h){u._callbacks[l]={resolve:d,reject:h},u.postMessage({type:"decode",id:l,taskConfig:e,buffer:t},[t])})}).then(function(p){return r._createGeometry(p.geometry)});return f.catch(function(){return!0}).then(function(){u&&l&&r._releaseTask(u,l)}),f},n.prototype._createGeometry=function(t){var e=new THREE__namespace.BufferGeometry;t.index&&e.setIndex(new THREE__namespace.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var o=t.attributes[r],s=o.name,u=o.array,l=o.itemSize,c=!(u instanceof Float32Array||u instanceof Float64Array);e.setAttribute(s,new THREE__namespace.BufferAttribute(u,l,c))}return e},n.prototype._initDecoder=function(){var t=this;if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!="object"||this.decoderConfig.type==="js";if(e){var r=internalFetcher.ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(s){return s.body});this.decoderPending=r.then(function(s){var u=["/* draco decoder */",s,"","/* worker */",DRACOWorker].join(`
450
+ `),support=typeof Worker!="undefined"&&typeof Blob!="undefined",lzmaWorkerURL="";if(support)try{var blob$2=new Blob([lzmaWorkerSource],{type:"text/javascript"});lzmaWorkerURL=URL.createObjectURL(blob$2)}catch(n){}var LZMAWorker=(function(){function n(){var t=this;if(!support)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var e=this.worker=new Worker(lzmaWorkerURL);e.onmessage=function(r){var o=r.data,s=o.id,u=o.result,l=o.error,c=t.getKey(s);t.requests[c]&&(l?t.requests[c](new Error(l)):t.requests[c](null,u),delete t.requests[c])},e.onerror=function(r){return console.error(r)}}return n.prototype.getKey=function(t){return"key_"+String(t)},n.prototype.decompress=function(t,e){var r=++this.callCounter;this.requests[this.getKey(r)]=e,this.worker.postMessage({type:"decompress",id:r,data:t},[t.buffer])},n.prototype.terminate=function(){this.worker.terminate()},n.support=support,n})();function readUint32(n){return Array.prototype.reduce.call(n,function(t,e,r){return t|e<<r*8},0)}function binaryArrays(n){for(var t=[],e=n.length,r=function(u){var l={data:n[u],offset:0,readByte:function(){return this.data[this.offset++]}},c=l.data.length,f={data:[],offset:0,writeByte:function(d){var h=Math.floor(this.offset/c);this.data[h]||(this.data[h]=new Uint8Array(c)),this.data[h][this.offset%c]=d,this.offset++}};LZMA.decompressFile(l,f),o=new Uint8Array(f.offset);for(var p=0;p<f.offset;p++)o[p]=f.data[Math.floor(p/c)][p%c];t.push(o)},o,s=0;s<e;s++)r(s);return t}function binaryArraysWithWorker(n){for(var t=[],e=n.length,r=function(s){t.push(new Promise(function(u,l){var c=new LZMAWorker;c.decompress(n[s],function(f,p){if(c.terminate(),f)return l(f);u(p)})}))},o=0;o<e;o++)r(o);return Promise.all(t)}function lzma(n){var t=new Uint8Array(n),e=readUint32(t.slice(0,4));if(e>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var r=[],o=[],s=4+e*4,u=0;u<e;u++)o[u]=readUint32(t.slice(4+u*4,8+u*4)),u===e-1?r[u]=t.subarray(s,s+o[u]):r[u]=t.slice(s,s+o[u]),s+=o[u];return LZMAWorker.support?binaryArraysWithWorker(r):Promise.resolve(binaryArrays(r))}function loadAt3d(n,t){var e,r,o,s,u,l;t===void 0&&(t={});for(var c=(e=t.upAxis)!==null&&e!==void 0?e:"Z",f=(r=t.light)!==null&&r!==void 0?r:!1,p=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,d=(s=t.textureBaseUri)!==null&&s!==void 0?s:guessTextureBaseUriFromFileUrl(n),h=t.textureBaseUri===void 0?[]:((u=t.textureArray)!==null&&u!==void 0?u:[]).slice(),g=autoRestImageOptionsByTextureLength((l=t.textureOptions)!==null&&l!==void 0?l:{},h.length),m=new Map,E=0,y=h;E<y.length;E++){var v=y[E],A=isAbsoluteURL(v)?v:pathJoin(d,v);m.set(A,loadTexture$1(A,g,p))}var b={byteLength:0};return Promise.resolve().then(function(){return p.ajax(n,{responseType:"arraybuffer"})}).then(function(T){return lzma(T.body)}).then(function(T){for(var _={chunks:[],createAt:void 0,description:void 0},S=0,w=T;S<w.length;S++){var R=w[S],I=Model$2.decode(R);if(I.chunks.length){for(var H=0;H<I.chunks.length;H++)_.chunks.push(I.chunks[H]);_.createAt=I.createAt,_.description=I.description}}return _}).then(function(T){return parse$4(T,f,d,h,g,m,p)}).then(function(T){m.clear();var _=new THREE__namespace.Group;_.name=n;for(var S=0,w=T.objects;S<w.length;S++){var R=w[S];_.add(R)}return c==="Y"&&_.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"at3d",modelUpAxis:"Z",upAxis:c,uri:n,byteLength:b.byteLength,memoryUsage:getMemoryUsage(_),scene:_,textures:T.textures,animations:[],dispose:function(){return T.dispose()}}})}const $Reader=minimalExports.Reader,$util=minimalExports.util,$root=minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto"]||(minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto"]={}),Model$1=$root.Model=(()=>{function n(t){if(this.meshes=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.meshes=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Model;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.meshes&&u.meshes.length||(u.meshes=[]),u.meshes.push($root.Mesh.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root.Mesh=(()=>{function n(t){if(this.chunks=[],this.matrix=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.name="",n.prototype.chunks=$util.emptyArray,n.prototype.matrix=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Mesh;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.name=e.string();break}case 2:{u.chunks&&u.chunks.length||(u.chunks=[]),u.chunks.push($root.Chunk.decode(e,e.uint32()));break}case 3:{u.matrix&&u.matrix.length||(u.matrix=[]),u.matrix.push($root.Matrix.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("name"))throw $util.ProtocolError("missing required 'name'",{instance:u});return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Mesh"},n})(),$root.Matrix=(()=>{function n(t){if(this.elements=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.elements=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Matrix;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.elements&&u.elements.length||(u.elements=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.elements.push(e.float())}else u.elements.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Matrix"},n})(),$root.Chunk=(()=>{function n(t){if(this.material=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.geometry=null,n.prototype.material=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Chunk;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 2:{u.geometry=$root.Geometry.decode(e,e.uint32());break}case 3:{u.material&&u.material.length||(u.material=[]),u.material.push($root.Material.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("geometry"))throw $util.ProtocolError("missing required 'geometry'",{instance:u});return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root.Geometry=(()=>{function n(t){if(this.groups=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.position=null,n.prototype.uv=null,n.prototype.uv2=null,n.prototype.normal=null,n.prototype.groups=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Geometry;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.position=$root.Position.decode(e,e.uint32());break}case 2:{u.uv=$root.UV.decode(e,e.uint32());break}case 3:{u.uv2=$root.UV.decode(e,e.uint32());break}case 4:{u.normal=$root.Normal.decode(e,e.uint32());break}case 5:{u.groups&&u.groups.length||(u.groups=[]),u.groups.push($root.Group.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("position"))throw $util.ProtocolError("missing required 'position'",{instance:u});if(!u.hasOwnProperty("normal"))throw $util.ProtocolError("missing required 'normal'",{instance:u});return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Geometry"},n})(),$root.Position=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Position;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Position"},n})(),$root.UV=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.UV;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/UV"},n})(),$root.Normal=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Normal;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Normal"},n})(),$root.Group=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.start=0,n.prototype.count=0,n.prototype.materialIndex=0,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Group;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.start=e.uint32();break}case 2:{u.count=e.uint32();break}case 3:{u.materialIndex=e.uint32();break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("start"))throw $util.ProtocolError("missing required 'start'",{instance:u});if(!u.hasOwnProperty("count"))throw $util.ProtocolError("missing required 'count'",{instance:u});if(!u.hasOwnProperty("materialIndex"))throw $util.ProtocolError("missing required 'materialIndex'",{instance:u});return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Group"},n})(),$root.Material=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.kd=null,n.prototype.ks=null,n.prototype.ke=null,n.prototype.mapkd="",n.prototype.mapks="",n.prototype.mapke="",n.prototype.norm="",n.prototype.mapbump="",n.prototype.bump="",n.prototype.mapd="",n.prototype.ns=0,n.prototype.d=0,n.prototype.tr=0,n.prototype.mapkdrepeat="",n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Material;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.kd=$root.Color.decode(e,e.uint32());break}case 2:{u.ks=$root.Color.decode(e,e.uint32());break}case 3:{u.ke=$root.Color.decode(e,e.uint32());break}case 4:{u.mapkd=e.string();break}case 5:{u.mapks=e.string();break}case 6:{u.mapke=e.string();break}case 7:{u.norm=e.string();break}case 8:{u.mapbump=e.string();break}case 9:{u.bump=e.string();break}case 10:{u.mapd=e.string();break}case 11:{u.ns=e.float();break}case 12:{u.d=e.float();break}case 13:{u.tr=e.float();break}case 14:{u.mapkdrepeat=e.string();break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Material"},n})(),$root.Color=(()=>{function n(t){if(this.rgb=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.rgb=$util.emptyArray,n.decode=function(e,r,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Color;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.rgb&&u.rgb.length||(u.rgb=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.rgb.push(e.float())}else u.rgb.push(e.float());break}default:e.skipType(l&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Color"},n})();function loadDome(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){var c,f;return u.byteLength=l.body.byteLength,parse$3(new Uint8Array(l.body),(c=t.light)!==null&&c!==void 0?c:!0,t.textureBaseUri||"",(f=t.textureOptions)!==null&&f!==void 0?f:{},s)}).then(function(l){var c=new THREE__namespace.Group;c.matrixAutoUpdate=!1,o==="Z"&&c.applyMatrix4(ROTATE_X_MATRIX),c.matrix.compose(c.position,c.quaternion,c.scale),c.name=n;for(var f=0,p=l.objects;f<p.length;f++){var d=p[f];c.add(d)}return{type:"dome",modelUpAxis:"Y",upAxis:o,uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:[],dispose:function(){return l.dispose()}}})}function flipBufferGeometryNormals(n){for(var t=[0,0,0],e=0;e<n.attributes.normal.array.length/9;e++)t[0]=n.attributes.normal.array[e*9],t[1]=n.attributes.normal.array[e*9+1],t[2]=n.attributes.normal.array[e*9+2],n.attributes.normal.array[e*9]=n.attributes.normal.array[e*9+6],n.attributes.normal.array[e*9+1]=n.attributes.normal.array[e*9+7],n.attributes.normal.array[e*9+2]=n.attributes.normal.array[e*9+8],n.attributes.normal.array[e*9+6]=t[0],n.attributes.normal.array[e*9+7]=t[1],n.attributes.normal.array[e*9+8]=t[2];for(var e=0;e<n.attributes.position.array.length/9;e++)t[0]=n.attributes.position.array[e*9],t[1]=n.attributes.position.array[e*9+1],t[2]=n.attributes.position.array[e*9+2],n.attributes.position.array[e*9]=n.attributes.position.array[e*9+6],n.attributes.position.array[e*9+1]=n.attributes.position.array[e*9+7],n.attributes.position.array[e*9+2]=n.attributes.position.array[e*9+8],n.attributes.position.array[e*9+6]=t[0],n.attributes.position.array[e*9+7]=t[1],n.attributes.position.array[e*9+8]=t[2];for(var e=0;e<n.attributes.uv.array.length/6;e++)t[0]=n.attributes.uv.array[e*6],t[1]=n.attributes.uv.array[e*6+1],n.attributes.uv.array[e*6]=n.attributes.uv.array[e*6+4],n.attributes.uv.array[e*6+1]=n.attributes.uv.array[e*6+5],n.attributes.uv.array[e*6+4]=t[0],n.attributes.uv.array[e*6+5]=t[1];n.attributes.normal.needsUpdate=!0,n.attributes.position.needsUpdate=!0,n.attributes.uv.needsUpdate=!0}function parseGeometry(n){var t=n.position,e=n.normal,r=n.uv,o=n.uv2,s=n.groups,u=new THREE__namespace.BufferGeometry;u.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(t.array),3)),e&&u.setAttribute("normal",new THREE__namespace.BufferAttribute(new Float32Array(e.array),3)),r&&u.setAttribute("uv",new THREE__namespace.BufferAttribute(new Float32Array(r.array),2)),o&&u.setAttribute("uv2",new THREE__namespace.BufferAttribute(new Float32Array(o.array),2));for(var l=0,c=s;l<c.length;l++){var f=c[l];u.addGroup(f.start,f.count,f.materialIndex)}return u}function loadTexture(n,t,e,r,o,s,u){if(u.hasOwnProperty(n))return u[n];n=n.split("?")[0],isAbsoluteURL(n)||(n=pathJoin(t,n)),n=n.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/"),n.indexOf("//")===0&&(n="https:"+n);var l=__assign({key:"texture.dome",size:64},pick(e,["quality","format","sharpen","forceUseExifOrientation","mappings"])),c=u[n]=o.loadTexture(n,{imageURL:{transform:e.transform,options:l},wrapS:THREE__namespace.RepeatWrapping,wrapT:THREE__namespace.RepeatWrapping,fetcher:s}).then(function(f){var p=f.body;return r&&p.repeat.copy(r),p.needsUpdate=!0,p.updateMatrix(),p});return c}function parseMaterial(n,t,e,r,o,s,u,l,c){var f=[],p=new PBMMeshMaterial(t?"phong":"basic");if(l.add(p),n.kd&&(p.color=new THREE__namespace.Color().fromArray(n.kd.rgb).convertLinearToSRGB()),n.mapkd){var d=null;if(n.mapkdrepeat){var h=n.mapkdrepeat.split(/\s+/).map(function(y){return Number(y)}),g=h[0],m=h[1];d=new THREE__namespace.Vector2(g,m)}f.push(loadTexture(n.mapkd,e,r,d,o,s,u).then(function(y){y.encoding=THREE__namespace.sRGBEncoding,p.map=y,l.add(y),c.add(y),p.needsUpdate=!0}).catch(noop))}if(n.ks&&(p.specular=new THREE__namespace.Color().fromArray(n.ks.rgb).convertLinearToSRGB()),n.mapks&&f.push(loadTexture(n.mapks,e,r,null,o,s,u).then(function(y){p.specularMap=y,l.add(y),c.add(y)}).catch(noop)),n.ke&&(p.emissive=new THREE__namespace.Color().fromArray(n.ke.rgb).convertLinearToSRGB()),n.mapke&&f.push(loadTexture(n.mapke,e,r,null,o,s,u).then(function(y){y.encoding=THREE__namespace.sRGBEncoding,p.emissiveMap=y,l.add(y),c.add(y)}).catch(noop)),n.norm&&f.push(loadTexture(n.norm,e,r,null,o,s,u).then(function(y){p.normalMap=y,l.add(y),c.add(y)}).catch(noop)),n.mapbump&&f.push(loadTexture(n.mapbump,e,r,null,o,s,u).then(function(y){p.bumpMap=y,l.add(y),c.add(y)}).catch(noop)),n.bump&&f.push(loadTexture(n.bump,e,r,null,o,s,u).then(function(y){p.bumpMap=y,l.add(y),c.add(y)}).catch(noop)),typeof n.ns=="number"&&(p.shininess=n.ns),typeof n.d=="number"){var E=n.d;E>0&&E<1&&(p.opacity=E)}return p.floorIndex=0,{material:p,textureReady:Promise.all(f).then(noop)}}function fromProtoBuf(n){return Model$1.decode(n).meshes}function parse$3(n,t,e,r,o){for(var s=[],u=[],l=new Set,c=fromProtoBuf(n),f=new TextureLoader,p=new THREE__namespace.Matrix4,d=new THREE__namespace.Vector3,h=new THREE__namespace.Quaternion,g=new THREE__namespace.Vector3,m={},E=new Set,y=0,v=c;y<v.length;y++){var A=v[y],b=A.name,T=A.chunks,_=A.matrix;if(!(b==="Ceiling"||b==="CeilingDrop"))for(var S=0,w=_;S<w.length;S++){var R=w[S];p.elements=R.elements;for(var I=new THREE__namespace.Group,H=0;H<T.length;H++){var C=parseGeometry(T[H].geometry);C.applyMatrix4(p),p.decompose(d,h,g),g.x*g.y*g.z<0&&C.attributes.normal&&C.attributes.position&&C.attributes.uv&&flipBufferGeometryNormals(C),l.add(C);for(var M=[],B=0,L=T[H].material;B<L.length;B++){var O=L[B],k=parseMaterial(O,t,e||"",r,f,o,m,l,E),D=k.material,q=k.textureReady;u.push(q),M.push(D)}var z=new PBMMesh(C,M);z.name="chunk_"+H,z.matrix.compose(z.position,z.quaternion,z.scale),z.matrixAutoUpdate=!1,z.frustumCulled=!1,I.add(z)}I.name=b,s.push(I)}}return Promise.all(u).catch(noop).then(function(){return{createAt:0,description:"",objects:s,textures:Array.from(E),dispose:function(){l.forEach(function(J){J.dispose()}),l.clear()}}})}function loadDomez(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){return u.byteLength=l.body.byteLength,lzma(l.body)}).then(function(l){var c=l.reduce(function(d,h){return d+h.length},0),f=new Uint8Array(c),p=0;return l.forEach(function(d){f.set(d,p),p+=d.length}),f}).then(function(l){var c,f;return parse$3(l,(c=t.light)!==null&&c!==void 0?c:!0,t.textureBaseUri||"",(f=t.textureOptions)!==null&&f!==void 0?f:{},s)}).then(function(l){var c=new THREE__namespace.Group;c.matrixAutoUpdate=!1,o==="Z"&&c.applyMatrix4(ROTATE_X_MATRIX),c.matrix.compose(c.position,c.quaternion,c.scale),c.name=n;for(var f=0,p=l.objects;f<p.length;f++){var d=p[f];c.add(d)}return{type:"domez",modelUpAxis:"Y",upAxis:"Z",uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:[],dispose:function(){return l.dispose()}}})}var SIZEOF_UINT32$1=4;function parseHeader$1(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.byteLength=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var _a$4,GL_TYPE;(function(n){n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.INT=5124]="INT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.DOUBLE=5130]="DOUBLE"})(GL_TYPE||(GL_TYPE={}));var GL_TYPE_TO_ARRAY_TYPE=(_a$4={},_a$4[GL_TYPE.DOUBLE]=Float64Array,_a$4[GL_TYPE.FLOAT]=Float32Array,_a$4[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$4[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$4[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$4[GL_TYPE.BYTE]=Int8Array,_a$4[GL_TYPE.SHORT]=Int16Array,_a$4[GL_TYPE.INT]=Int32Array,_a$4),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(n){var t=GL_TYPE_TO_ARRAY_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(n){var t=getArrayType(n);return t.BYTES_PER_ELEMENT}function createTypedArray(n,t,e,r){e===void 0&&(e=0);var o=getArrayType(n);if(e%getByteSize(n)!==0){var s=r?t.slice(e,e+r*getByteSize(n)):t.slice(e);return new o(s)}else return new o(t,e,r!=null?r:(t.byteLength-e)/getByteSize(n))}function glTypeFromName(n){var t=NAME_TO_GL_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=(function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return n.prototype.getExtension=function(t){return this.json.extensions&&this.json.extensions[t]},n.prototype.hasProperty=function(t){return!!this.json[t]},n.prototype.getGlobalProperty=function(t,e,r){var o=this.json[t];if(typeof o=="number"){var s=getArrayType(e);return new s([o])}else if(Array.isArray(o)){var s=getArrayType(e);return new s(o)}else if(o&&Number.isFinite(o.byteOffset))return this.getTypedArrayFromBinary(t,e,r,1,o.byteOffset);return null},n.prototype.getPropertyArray=function(t,e,r){var o=this.json[t];return o&&Number.isFinite(o.byteOffset)?("componentType"in o&&(e=glTypeFromName(o.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,o.byteOffset)):this.getTypedArrayFromArray(t,e,o)},n.prototype.getProperty=function(t,e,r,o,s){var u=this.json[t];if(!u)return null;var l=this.getPropertyArray(t,e,r);if(r===1)return s[0]=l[o],s;for(var c=0;c<r;++c)s[c]=l[r*o+c];return s},n.prototype.getTypedArrayFromBinary=function(t,e,r,o,s){var u=this.cachedTypedArrays,l=u[t];return l||(l=createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+s,o*r),u[t]=l),l},n.prototype.getTypedArrayFromArray=function(t,e,r){var o=this.cachedTypedArrays,s=o[t];return s||(s=createTypedArray(e,r),o[t]=s),s},n})(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(n,t,e){var r=new TextDecoder("utf8"),o=new Uint8Array(n,t,e),s=r.decode(o);return s}function parseTable(n,t,e){return e=parseTablesHeader(n,t,e),e=parseFeatureTable(n,t,e),e=parseBatchTable(n,t,e),e}function parseTablesHeader(n,t,e){var r=new DataView(t),o=0;n.header=n.header||{};var s=r.getUint32(e,!0);e+=SIZEOF_UINT32;var u=r.getUint32(e,!0);e+=SIZEOF_UINT32;var l=r.getUint32(e,!0);e+=SIZEOF_UINT32;var c=r.getUint32(e,!0);return e+=SIZEOF_UINT32,l>=570425344?(e-=SIZEOF_UINT32*2,o=s,l=u,c=0,s=0,u=0,console.warn(DEPRECATION_WARNING)):c>=570425344&&(e-=SIZEOF_UINT32,o=l,l=s,c=u,s=0,u=0,console.warn(DEPRECATION_WARNING)),n.header.featureTableJsonByteLength=s,n.header.featureTableBinaryByteLength=u,n.header.batchTableJsonByteLength=l,n.header.batchTableBinaryByteLength=c,n.header.batchLength=o,e}function parseFeatureTable(n,t,e){var r=n.header||{},o=r.featureTableJsonByteLength,s=r.featureTableBinaryByteLength,u=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:u||0},o&&o>0){var l=getStringFromArrayBuffer(t,e,o);n.featureTableJson=JSON.parse(l)}e+=o||0,n.featureTableBinary=new Uint8Array(t,e,s),e+=s||0;var c=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var f=c.json.RTC_CENTER;n.rtcCenter=[f[0],f[1],f[2]]}else{var f=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);f&&(n.rtcCenter=[f[0],f[1],f[2]])}return e}function parseBatchTable(n,t,e){var r=n.header||{},o=r.batchTableJsonByteLength,s=r.batchTableBinaryByteLength;if(o&&o>0){var u=getStringFromArrayBuffer(t,e,o);n.batchTableJson=JSON.parse(u),e+=o,s&&s>0&&(n.batchTableBinary=new Uint8Array(t,e,s),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=s)}return e}function sliceArrayBuffer(n,t,e){var r=e!==void 0?new Uint8Array(n).subarray(t,t+e):new Uint8Array(n).subarray(t),o=new Uint8Array(r);return o.buffer}function parseGlTFArrayBuffer(n,t,e){var r=n.byteLength-e;if(r===0)throw new Error("glTF byte length must be greater than 0.");return e%4!==0&&console.warn("".concat(n.type,": embedded glb is not aligned to a 4-byte boundary.")),n.gltfArrayBuffer=sliceArrayBuffer(t,e,r),n.byteLength}function decodeText(n){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(n);for(var t="",e=0,r=n.length;e<r;e++)t+=String.fromCharCode(n[e]);try{return decodeURIComponent(escape(t))}catch(o){return t}}var WEBGL_CONSTANTS={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",TEXCOORD_2:"uv3",TEXCOORD_3:"uv4",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(n){var t=[];for(var e in n)t.push(n[e]);return t}function composeDsiposeSet(n){var t=Array.from(n);return function(){for(var e=0,r=t;e<r.length;e++){var o=r[e];typeof o.dispose=="function"&&o.dispose(),typeof o.close=="function"&&o.close()}}}var Parser=(function(){function n(t,e,r){this.json=t,this.extensions=e,this.options=r,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}return n.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach(function(t){typeof t.dispose=="function"&&t.dispose(),typeof t.close=="function"&&t.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:"unknown"}}},n.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],o=0,s=e.length;o<s;o++)for(var u=e[o].joints,l=0,c=u.length;l<c;l++)t[u[l]].isBone=!0;for(var f=0,p=t.length;f<p;f++){var d=t[f];d.mesh!==void 0&&d.skin!==void 0&&(r[d.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.markDefs();for(var o=0,s=values(r);o<s.length;o++){var u=s[o];u.markDefs(this)}return Promise.all(values(r).map(function(l){return l.prepare(t)})).then(function(){var l,c,f;return Promise.all([Promise.all(((l=e.scenes)!==null&&l!==void 0?l:[]).map(function(p,d){return t.loadScene(d)})),Promise.all(((c=e.animations)!==null&&c!==void 0?c:[]).map(function(p,d){return t.loadAnimation(d)})),Promise.all(((f=e.cameras)!==null&&f!==void 0?f:[]).map(function(p,d){return t.loadCamera(d)}))])}).then(function(l){var c=l[0],f=l[1],p=l[2],d={json:e,scene:c[e.scene||0],scenes:c,animations:f,cameras:p,textures:[],dispose:noop};return d}).then(function(l){return Promise.all(values(r).map(function(c){return c.emitResult(l,t)})).then(function(){return l})}).then(function(l){var c=Array.from(t.textureSet),f=composeDsiposeSet(t.disposeSet);return Object.assign(l,{textures:c,dispose:f}),t.textureSet.clear(),t.disposeSet.clear(),t.dispose(),l})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadCamera(t,this),o)break}if(!o){var c=void 0,f=this.json.cameras[t],p=f[f.type];p?f.type==="perspective"?c=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(p.yfov),p.aspectRatio||1,p.znear||1,p.zfar||2e6):f.type==="orthographic"?c=new THREE__namespace.OrthographicCamera(-p.xmag,p.xmag,p.ymag,-p.ymag,p.znear,p.zfar):(console.warn("glTF: Invalid camera type ".concat(f.type,".")),c=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),c=new THREE__namespace.Camera),f.name&&(c.name=f.name),o=Promise.resolve(c)}return this.cache.set(e,o),o},n.prototype.loadSkin=function(t){var e="skin:"+t,r=this.cache.get(e);if(r)return r;var o,s=this.json.skins[t],u={joints:s.joints};return s.inverseBindMatrices===void 0?o=Promise.resolve(u):o=this.loadAccessor(s.inverseBindMatrices).then(function(l){return l&&(u.inverseBindMatrices=l),u}),this.cache.set(e,o),o},n.prototype.loadAnimation=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadAnimation(t,this),o)break}if(!o){for(var c=this.json,f=c.animations[t],p=[],d=[],h=[],g=[],m=[],E=0,y=f.channels.length;E<y;E++){var v=f.channels[E],A=f.samplers[v.sampler],b=v.target,T=b.node!==void 0?b.node:b.id,_=f.parameters!==void 0?f.parameters[A.input]:A.input,S=f.parameters!==void 0?f.parameters[A.output]:A.output;p.push(this.loadNode(T)),d.push(this.loadAccessor(_)),h.push(this.loadAccessor(S)),g.push(A),m.push(b)}o=Promise.all([Promise.all(p),Promise.all(d),Promise.all(h),Promise.all(g),Promise.all(m)]).then(function(w){for(var R=w[0],I=w[1],H=w[2],C=w[3],M=w[4],B=[],L=function(q,z){var J=R[q],V=I[q],U=H[q],j=C[q],K=M[q];if(J===void 0)return"continue";J.updateMatrix(),J.matrixAutoUpdate=!0;var ae=void 0;switch(PATH_PROPERTIES[K.path]){case PATH_PROPERTIES.weights:ae=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:ae=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:ae=THREE__namespace.VectorKeyframeTrack;break}var re=J.name?J.name:J.uuid,ee=j.interpolation!==void 0?INTERPOLATION[j.interpolation]:THREE__namespace.InterpolateLinear,Z=[];PATH_PROPERTIES[K.path]===PATH_PROPERTIES.weights?J.traverse(function(te){te.morphTargetInfluences&&Z.push(te.name?te.name:te.uuid)}):Z.push(re);var X=U.array;if(U.normalized){for(var se=getNormalizedComponentScale(X.constructor),G=new Float32Array(X.length),W=0,$=X.length;W<$;W++)G[W]=X[W]*se;X=G}for(var W=0,$=Z.length;W<$;W++){var ne=new ae(Z[W]+"."+PATH_PROPERTIES[K.path],V.array,X,ee);B.push(ne)}},O=0,k=R.length;O<k;O++)L(O);var D=f.name?f.name:"animation_"+t;return new THREE__namespace.AnimationClip(D,void 0,B)})}return this.cache.set(e,o),o},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,o=this.cache.get(r);if(o)return o;for(var s=null,u=0,l=values(this.extensions);u<l.length;u++){var c=l[u];if(s=c.loadBuffer(t,this),s)break}if(!s){var f=this.json.buffers[t];s=this.options.fetcher.ajax(this.resolveResouce(f.uri),{responseType:"arraybuffer"}).then(function(p){return p.body})}return this.cache.set(r,s),s},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadBufferView(t,this),o)break}if(!o){var c=this.json.bufferViews[t];o=this.loadBuffer(c.buffer).then(function(f){var p=c.byteLength||0,d=c.byteOffset||0;return f.slice(d,d+p)})}return this.cache.set(e,o),o},n.prototype.loadAccessor=function(t){var e=this,r="accessor:"+t,o=this.cache.get(r);if(o)return o;var s=null;if(!s){var u=this.json.accessors[t];if(u.bufferView===void 0&&u.sparse===void 0)s=Promise.resolve(null);else{var l=[];u.bufferView!==void 0?l.push(this.loadBufferView(u.bufferView)):l.push(Promise.resolve(null)),u.sparse!==void 0&&(l.push(this.loadBufferView(u.sparse.indices.bufferView)),l.push(this.loadBufferView(u.sparse.values.bufferView))),s=Promise.all(l).then(function(c){var f=c[0],p=WEBGL_TYPE_SIZES[u.type],d=WEBGL_COMPONENT_TYPES[u.componentType],h=d.BYTES_PER_ELEMENT,g=h*p,m=u.byteOffset||0,E=u.bufferView!==void 0?e.json.bufferViews[u.bufferView].byteStride:void 0,y=u.normalized===!0,v,A;if(E&&E!==g){var b=Math.floor(m/E),T="InterleavedBuffer:"+u.bufferView+":"+u.componentType+":"+b+":"+u.count,_=e.cache.get(T);_||(v=new d(f,b*E,u.count*E/h),_=new THREE__namespace.InterleavedBuffer(v,E/h),e.cache.set(T,_)),A=new THREE__namespace.InterleavedBufferAttribute(_,p,m%E/h,y)}else f===null?v=new d(u.count*p):v=new d(f,m,u.count*p),A=new THREE__namespace.BufferAttribute(v,p,y);if(u.sparse!==void 0){var S=WEBGL_TYPE_SIZES.SCALAR,w=WEBGL_COMPONENT_TYPES[u.sparse.indices.componentType],R=u.sparse.indices.byteOffset||0,I=u.sparse.values.byteOffset||0,H=new w(c[1],R,u.sparse.count*S),C=new d(c[2],I,u.sparse.count*p);f!==null&&(A=new THREE__namespace.BufferAttribute(A.array.slice(),A.itemSize,A.normalized));for(var M=0,B=H.length;M<B;M++){var L=H[M];if(A.setX(L,C[M*p]),p>=2&&A.setY(L,C[M*p+1]),p>=3&&A.setZ(L,C[M*p+2]),p>=4&&A.setW(L,C[M*p+3]),p>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return A})}}return this.cache.set(r,s),s},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var o=r[e],s=o.createPrimitiveKey(t,this);if(s)return s}for(var u="",l=Object.keys(t.attributes).sort(),c=0,f=l.length;c<f;c++)u+=l[c]+":"+t.attributes[l[c]]+";";return t.indices+":"+u+":"+t.mode},n.prototype.loadGeometry=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadGeometry(t,this),r)break}return r||(r=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,t)),r=r.then(function(l){return e.disposeSet.add(l),l}),r},n.prototype.loadImage=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadImage(t,this),r)break}if(!r){var l=this.json.images[t];if(l.bufferView!==void 0){var c=this.json.bufferViews[l.bufferView];r=this.loadBuffer(c.buffer).then(function(p){var d=c.byteOffset||0,h=c.byteLength||0,g=new Uint8Array(p,d,h),m=new Blob([g],{type:l.mimeType});return createImageBitmapLike(m)})}else if(l.uri){var f=this.resolveResouce(l.uri);canUseNativeImageBitmap()?r=this.options.fetcher.ajax(f,{responseType:"blob"}).then(function(p){var d=p.body;return createImageBitmapLike(d)}):r=this.options.fetcher.loadImage(f,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(p){return p.body})}else throw new Error("glTF: Invalid image defs.")}return r=r.then(function(p){return e.disposeSet.add(p),p}),r},n.prototype.loadMaterialAsMeshStandardMaterial=function(t){var e=this,r=[],o=new THREE__namespace.MeshStandardMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=1,t.material!==void 0){var s=this.json.materials[t.material];s.name&&(o.name=s.name);var u=s.pbrMetallicRoughness||{};if(Array.isArray(u.baseColorFactor)){var l=u.baseColorFactor;o.color.fromArray(l),o.opacity=l[3]}u.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(u.baseColorTexture).then(function(p){p.encoding=THREE__namespace.sRGBEncoding,o.map=p,e.disposeSet.add(p)})),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(u.metallicRoughnessTexture).then(function(p){p.format=THREE__namespace.RGBFormat,o.metalnessMap=p,o.roughnessMap=p,e.disposeSet.add(p)})),s.doubleSided===!0&&(o.side=THREE__namespace.DoubleSide);var c=s.alphaMode||ALPHA_MODES.OPAQUE;if(c===ALPHA_MODES.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===ALPHA_MODES.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&(r.push(this.createMaterialTexture(s.normalTexture).then(function(p){p.format=THREE__namespace.RGBFormat,o.normalMap=p,e.disposeSet.add(p)})),o.normalScale=new THREE__namespace.Vector2(1,1),s.normalTexture.scale!==void 0)){var f=s.normalTexture.scale;o.normalScale.set(f,f)}s.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(s.occlusionTexture).then(function(p){p.format=THREE__namespace.RGBFormat,o.aoMap=p,e.disposeSet.add(p)})),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&(o.emissive=new THREE__namespace.Color().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(s.emissiveTexture).then(function(p){p.format=THREE__namespace.RGBFormat,o.emissiveMap=p,e.disposeSet.add(p)}))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterialAsMeshBasicMaterial=function(t){var e=this,r=[],o=new THREE__namespace.MeshBasicMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=1,t.material!==void 0){var s=this.json.materials[t.material];s.name&&(o.name=s.name);var u=s.pbrMetallicRoughness||{};if(Array.isArray(u.baseColorFactor)){var l=u.baseColorFactor;o.color.fromArray(l),o.opacity=l[3]}u.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(u.baseColorTexture).then(function(f){o.map=f,e.disposeSet.add(f)})),s.doubleSided===!0&&(o.side=THREE__namespace.DoubleSide);var c=s.alphaMode||ALPHA_MODES.OPAQUE;c===ALPHA_MODES.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===ALPHA_MODES.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(s.occlusionTexture).then(function(f){o.aoMap=f,e.disposeSet.add(f)})),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new THREE__namespace.LineBasicMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,t.material!==void 0){var o=this.json.materials[t.material];o.name&&(r.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;r.color.fromArray(u),r.opacity=u[3]}o.doubleSided===!0&&(r.side=THREE__namespace.DoubleSide);var l=o.alphaMode||ALPHA_MODES.OPAQUE;l===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,l===ALPHA_MODES.MASK&&(r.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(e).then(function(){return r})},n.prototype.loadMaterialAsPointsMaterial=function(t){var e=this,r=[],o=new THREE__namespace.PointsMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=1,o.sizeAttenuation=!1,t.material!==void 0){var s=this.json.materials[t.material];s.name&&(o.name=s.name);var u=s.pbrMetallicRoughness||{};if(Array.isArray(u.baseColorFactor)){var l=u.baseColorFactor;o.color.fromArray(l),o.opacity=l[3]}u.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(u.baseColorTexture).then(function(f){f.encoding=THREE__namespace.sRGBEncoding,o.map=f,e.disposeSet.add(f)})),s.doubleSided===!0&&(o.side=THREE__namespace.DoubleSide);var c=s.alphaMode||ALPHA_MODES.OPAQUE;c===ALPHA_MODES.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===ALPHA_MODES.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterial=function(t){var e=this,r,o=(r=t.mode)!==null&&r!==void 0?r:WEBGL_CONSTANTS.TRIANGLES,s="material:"+this.createPrimitiveKey(t),u=this.cache.get(s);if(u)return u;for(var l=null,c=0,f=values(this.extensions);c<f.length;c++){var p=f[c];if(l=p.loadMaterial(t,this),l)break}if(!l)if(o===WEBGL_CONSTANTS.TRIANGLES||o===WEBGL_CONSTANTS.TRIANGLE_STRIP||o===WEBGL_CONSTANTS.TRIANGLE_FAN)this.extensions.KHR_materials_unlit?l=this.loadMaterialAsMeshBasicMaterial(t):l=this.loadMaterialAsMeshStandardMaterial(t);else if(o===WEBGL_CONSTANTS.LINES||o===WEBGL_CONSTANTS.LINE_STRIP||o===WEBGL_CONSTANTS.LINE_LOOP)l=this.loadMaterialAsLineBasicMaterial(t);else if(o===WEBGL_CONSTANTS.POINTS)l=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+o);return l=l.then(function(d){return Promise.all(values(e.extensions).map(function(h){return h.extendMaterial(d,t,e)})).then(function(){return d})}),this.cache.set(s,l),l},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,o=this.cache.get(r);if(o)return o;for(var s=null,u=0,l=values(this.extensions);u<l.length;u++){var c=l[u];if(s=c.loadTexture(t,this),s)break}if(!s){var f=this.json.textures[t];s=this.loadImage(f.source).then(function(p){var d=new THREE__namespace.Texture(p);d.needsUpdate=!0,d.flipY=!1,f.name&&(d.name=f.name);var h=e.json.samplers||{},g=h[f.sampler]||{};return d.magFilter=WEBGL_FILTERS[g.magFilter]||THREE__namespace.LinearFilter,d.minFilter=WEBGL_FILTERS[g.minFilter]||THREE__namespace.LinearMipmapLinearFilter,d.wrapS=WEBGL_WRAPPINGS[g.wrapS]||THREE__namespace.RepeatWrapping,d.wrapT=WEBGL_WRAPPINGS[g.wrapT]||THREE__namespace.RepeatWrapping,d.onUpdate=function(){p.close()},d})}return s=s.then(function(p){return e.disposeSet.add(p),p}),this.cache.set(r,s),s},n.prototype.normalizeSkinWeights=function(t){var e=t.geometry,r=e.attributes.skinWeight;if(!r.normalized)t.normalizeSkinWeights();else{var o=0;if(r.array instanceof Uint8Array)o=255;else if(r.array instanceof Uint16Array)o=65535;else if(r.array instanceof Uint32Array)o=4294967295;else return;for(var s=new THREE__namespace.Vector4,u=0,l=r.count;u<l;u++){s.x=r.getX(u),s.y=r.getY(u),s.z=r.getZ(u),s.w=r.getW(u);var c=o/s.manhattanLength();c!==1&&(!isNaN(c)&&isFinite(c)?s.multiplyScalar(c):s.set(o,0,0,0),r.setXYZW(u,s.x,s.y,s.z,s.w))}}},n.prototype.loadMesh=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadMesh(t,this),r)break}if(!r){var l=this.json.meshes[t],c=l.primitives,f=Promise.all(c.map(function(d){return e.loadGeometry(d)})),p=Promise.all(c.map(function(d){return e.loadMaterial(d)}));r=Promise.all([f,p]).then(function(d){for(var h,g=d[0],m=d[1],E=[],y=0;y<c.length;y++){var v=c[y],A=g[y],b=m[y],T=(h=v.mode)!==null&&h!==void 0?h:WEBGL_CONSTANTS.TRIANGLES,_=void 0;if(T===WEBGL_CONSTANTS.TRIANGLES||T===WEBGL_CONSTANTS.TRIANGLE_STRIP||T===WEBGL_CONSTANTS.TRIANGLE_FAN)if(T===WEBGL_CONSTANTS.TRIANGLE_STRIP?A=e.toGeometryTrianglesDrawMode(A,THREE__namespace.TriangleStripDrawMode):T===WEBGL_CONSTANTS.TRIANGLE_FAN&&(A=e.toGeometryTrianglesDrawMode(A,THREE__namespace.TriangleFanDrawMode)),e.disposeSet.add(A),l.isSkinnedMesh){var S=new THREE__namespace.SkinnedMesh(A,b);e.normalizeSkinWeights(S),_=S}else _=new THREE__namespace.Mesh(A,b);else if(T===WEBGL_CONSTANTS.POINTS)_=new THREE__namespace.Points(A,b);else if(T===WEBGL_CONSTANTS.LINES)_=new THREE__namespace.LineSegments(A,b);else if(T===WEBGL_CONSTANTS.LINE_STRIP)_=new THREE__namespace.Line(A,b);else if(T===WEBGL_CONSTANTS.LINE_LOOP)_=new THREE__namespace.LineLoop(A,b);else throw new Error("glTF: Primitive mode unsupported: "+T);if(Object.keys(A.morphAttributes).length>0){if(l.weights!==void 0)for(var w=0,R=l.weights.length;w<R;w++)_.morphTargetInfluences[w]=l.weights[w];if(l.extras&&Array.isArray(l.extras.targetNames)){var I=l.extras.targetNames;if(_.morphTargetInfluences.length===I.length){_.morphTargetDictionary={};for(var w=0,R=I.length;w<R;w++)_.morphTargetDictionary[I[w]]=w}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}_.name=l.name||"mesh_"+t,g.length>1&&(_.name+="_"+y),e.assignFinalMaterial(_),E.push(_)}if(E.length===1)return E[0];for(var H=new THREE__namespace.Group,C=0,M=E;C<M.length;C++){var _=M[C];H.add(_)}return H})}return r},n.prototype.assignFinalMaterial=function(t){var e=this,r=t.geometry,o=[].concat(t.material),s=r.attributes.tangent!==void 0,u=r.attributes.color!==void 0,l=r.attributes.normal===void 0,c=t instanceof THREE__namespace.SkinnedMesh,f=Object.keys(r.morphAttributes).length>0,p=f&&r.morphAttributes.normal!==void 0;o=o.map(function(d){if(s||u||l||c||f||p){var h="cloned-material:"+d.uuid+":";s&&(h+="vertex-tangents:"),u&&(h+="vertex-colors:"),l&&(h+="flat-shading:"),c&&(h+="skinning:"),f&&(h+="morph-targets:"),p&&(h+="morph-normals:");var g=e.cache.get(h);g||(g=d.clone(),s&&(g.vertexTangents=!0),u&&(g.vertexColors=!0),l&&(g.flatShading=!0),c&&(g.skinning=!0),f&&(g.morphTargets=!0),p&&(g.morphNormals=!0),s&&(g.normalScale&&(g.normalScale.y*=-1),g.clearcoatNormalScale&&(g.clearcoatNormalScale.y*=-1)),e.cache.set(h,g)),d=g}return d}),Array.isArray(t.material)?t.material=o:t.material=o[0]},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,o=values(this.extensions);r<o.length;r++){var s=o[r],u=s.loadNodeAttachments(t,this);u&&e.push(u)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var o=this.json,s=o.nodes[t],u=[];s.mesh!==void 0&&u.push(this.loadMesh(s.mesh).then(function(h){if(s.weights!==void 0){var g=s.weights;h.traverse(function(m){if(m instanceof THREE__namespace.Mesh||m instanceof THREE__namespace.Line||m instanceof THREE__namespace.Points)for(var E=0,y=g.length;E<y;E++)m.morphTargetInfluences[E]=g[E]})}return h})),s.camera!==void 0&&u.push(this.loadCamera(s.camera));for(var l=this.loadNodeAttachments(t),c=0,f=l;c<f.length;c++){var p=f[c];u.push(p)}var d=Promise.all(u).then(function(h){var g;if(s.isBone===!0?g=new THREE__namespace.Bone:h.length>1?g=new THREE__namespace.Group:h.length===1?g=h[0]:g=new THREE__namespace.Object3D,g!==h[0])for(var m=0,E=h.length;m<E;m++)g.add(h[m]);if(s.name&&(g.userData.name=s.name,g.name=THREE__namespace.PropertyBinding.sanitizeNodeName(s.name)),s.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(s.matrix),g.applyMatrix4(y)}else s.translation!==void 0&&g.position.fromArray(s.translation),s.rotation!==void 0&&g.quaternion.fromArray(s.rotation),s.scale!==void 0&&g.scale.fromArray(s.scale);return g});return this.cache.set(e,d),d},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],o=new THREE__namespace.Group;r.name&&(o.name=r.name);for(var s=r.nodes||[],u=[],l=0,c=s.length;l<c;l++)u.push(this.buildNodeHierarchy(s[l],o));return Promise.all(u).then(function(){return o})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var o=0,s=values(e.extensions);o<s.length;o++){var u=s[o],l=u.extendTexture(r,t,e);l&&(r=l)}return e.textureSet.add(r),e.disposeSet.add(r),r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,o=e.attributes,s=[],u=function(_){var S=ATTRIBUTES[_]||_.toLowerCase();if(S in t.attributes)return"continue";s.push(l.loadAccessor(o[_]).then(function(w){w&&t.setAttribute(S,w)}))},l=this;for(var c in o)u(c);e.indices!==void 0&&!t.index&&s.push(this.loadAccessor(e.indices).then(function(_){_&&t.setIndex(_)}));var f=new THREE__namespace.Box3;if(o.POSITION!==void 0){var p=this.json.accessors[o.POSITION],d=p.min,h=p.max;if(d!==void 0&&h!==void 0){if(f.set(new THREE__namespace.Vector3(d[0],d[1],d[2]),new THREE__namespace.Vector3(h[0],h[1],h[2])),p.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[p.componentType]);f.min.multiplyScalar(g),f.max.multiplyScalar(g)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var m=e.targets;if(m!==void 0){for(var E=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,v=0,A=m.length;v<A;v++){var b=m[v];if(b.POSITION!==void 0){var p=this.json.accessors[b.POSITION],d=p.min,h=p.max;if(d!==void 0&&h!==void 0){if(y.setX(Math.max(Math.abs(d[0]),Math.abs(h[0]))),y.setY(Math.max(Math.abs(d[1]),Math.abs(h[1]))),y.setZ(Math.max(Math.abs(d[2]),Math.abs(h[2]))),p.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[p.componentType]);y.multiplyScalar(g)}E.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}f.expandByVector(E)}t.boundingBox=f;var T=new THREE__namespace.Sphere;return f.getCenter(T.center),T.radius=f.min.distanceTo(f.max)/2,t.boundingSphere=T,Promise.all(s).then(function(){var _=!1;if(e.material!==void 0){var S=r.json.materials[e.material];S.occlusionTexture&&(_=!0)}if((_||r.options.copyUV2)&&t.attributes.uv&&!t.attributes.uv2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var w=!1,R=!1,I=0,H=e.targets.length;I<H;I++){var C=e.targets[I];if(C.POSITION!==void 0&&(w=!0),C.NORMAL!==void 0&&(R=!0),w&&R)break}if(!w&&!R)return t;var M=[];t.morphTargetsRelative=!0;for(var B=function(L,O){var k=e.targets[L];w?M.push(r.loadAccessor(k.POSITION).then(function(D){D&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[L]=D)})):t.attributes.position&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[L]=t.attributes.position),R?M.push(r.loadAccessor(k.NORMAL).then(function(D){D&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[L]=D)})):t.attributes.normal&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[L]=t.attributes.normal)},I=0,H=e.targets.length;I<H;I++)B(I,H);return Promise.all(M).then(function(){return t})}else return t})},n.prototype.buildNodeHierarchy=function(t,e){var r=this,o=this.json.nodes[t];return this.loadNode(t).then(function(s){if(o.skin===void 0)return s;var u;return r.loadSkin(o.skin).then(function(l){u=l;for(var c=[],f=0,p=u.joints.length;f<p;f++)c.push(r.loadNode(u.joints[f]));return Promise.all(c)}).then(function(l){return s.traverse(function(c){if(c instanceof THREE__namespace.SkinnedMesh){for(var f=[],p=[],d=0,h=l.length;d<h;d++){var g=l[d];if(g instanceof THREE__namespace.Bone){f.push(g);var m=new THREE__namespace.Matrix4;u.inverseBindMatrices!==void 0&&m.fromArray(u.inverseBindMatrices.array,d*16),p.push(m)}else console.warn('glTF: Joint "%s" could not be found.',u.joints[d])}var E=new THREE__namespace.Skeleton(f,p);c.bind(E,c.matrixWorld)}}),s})}).then(function(s){e.add(s);var u=[];if(o.children)for(var l=o.children,c=0,f=l.length;c<f;c++){var p=l[c];u.push(r.buildNodeHierarchy(p,s))}return Promise.all(u).then(function(){return s})})},n.prototype.resolveResouce=function(t){return/^[a-z]{0,8}\:/i.test(t)?t:pathJoin(this.options.resourcePath,appendSearch(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var o=[],s=t.getAttribute("position");if(s!==void 0){for(var u=0;u<s.count;u++)o.push(u);t.setIndex(o),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var l=r.count-2,c=[];if(e===THREE__namespace.TriangleFanDrawMode)for(var u=1;u<=l;u++)c.push(r.getX(0)),c.push(r.getX(u)),c.push(r.getX(u+1));else for(var u=0;u<l;u++)u%2===0?(c.push(r.getX(u)),c.push(r.getX(u+1)),c.push(r.getX(u+2))):(c.push(r.getX(u+2)),c.push(r.getX(u+1)),c.push(r.getX(u)));c.length/3!==l&&console.error("glTF: Unable to generate correct amount of triangles.");var f=t.clone();return f.setIndex(c),this.disposeSet.add(f),f},n})();function getNormalizedComponentScale(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=(function(){function n(){}return n.prototype.markDefs=function(t){},n.prototype.prepare=function(t){},n.prototype.emitResult=function(t,e){},n.prototype.createPrimitiveKey=function(t,e){},n.prototype.extendTexture=function(t,e,r){return null},n.prototype.loadBuffer=function(t,e){return null},n.prototype.loadBufferView=function(t,e){return null},n.prototype.loadImage=function(t,e){return null},n.prototype.loadTexture=function(t,e){return null},n.prototype.loadGeometry=function(t,e){return null},n.prototype.loadMaterial=function(t,e){return null},n.prototype.extendMaterial=function(t,e,r){return Promise.resolve()},n.prototype.loadMesh=function(t,e){return null},n.prototype.loadNodeAttachments=function(t,e){return null},n.prototype.loadCamera=function(t,e){return null},n.prototype.loadAnimation=function(t,e){return null},n})(),KHR_binary_glTF=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.header={magic:"",version:0,length:0},e.content="",e.body=null,e}return t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var r=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var o=new DataView(e,t.HEADER_LENGTH),s=0,u=null,l=null;s<o.byteLength;){var c=o.getUint32(s,!0);if(s+=4,c!==0){var f=o.getUint32(s,!0);if(s+=4,f===t.CHUNK_TYPES.JSON){var p=new Uint8Array(e,t.HEADER_LENGTH+s,c);u=decodeText(p)}else if(f===t.CHUNK_TYPES.BIN){var d=t.HEADER_LENGTH+s;l=e.slice(d,d+c)}s+=c}}if(u===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=u,this.body=l},t.prototype.loadBuffer=function(e,r){var o=r.json.buffers[e];return o.uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null},t.prototype.clear=function(){this.body=null,this.content=""},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t})(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=(function(){function n(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return n.prototype.setDecoderPath=function(t){this.decoderPath=t},n.prototype.setDecoderConfig=function(t){return this.decoderConfig=t,this},n.prototype.setWorkerLimit=function(t){return this.workerLimit=t,this},n.prototype.decodeDracoFile=function(t,e,r,o){var s={attributeIDs:r||defaultAttributeIDs,attributeTypes:o||defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(t,s).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1});for(var o in e.attributeTypes){var s=e.attributeTypes[o];s.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[o]=s.name)}var u,l=this.workerNextTaskID++,c=t.byteLength,f=this._getWorker(l,c).then(function(p){return u=p,new Promise(function(d,h){u._callbacks[l]={resolve:d,reject:h},u.postMessage({type:"decode",id:l,taskConfig:e,buffer:t},[t])})}).then(function(p){return r._createGeometry(p.geometry)});return f.catch(function(){return!0}).then(function(){u&&l&&r._releaseTask(u,l)}),f},n.prototype._createGeometry=function(t){var e=new THREE__namespace.BufferGeometry;t.index&&e.setIndex(new THREE__namespace.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var o=t.attributes[r],s=o.name,u=o.array,l=o.itemSize,c=!(u instanceof Float32Array||u instanceof Float64Array);e.setAttribute(s,new THREE__namespace.BufferAttribute(u,l,c))}return e},n.prototype._initDecoder=function(){var t=this;if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!="object"||this.decoderConfig.type==="js";if(e){var r=internalFetcher.ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(s){return s.body});this.decoderPending=r.then(function(s){var u=["/* draco decoder */",s,"","/* worker */",DRACOWorker].join(`
451
451
  `);t.workerSourceURL=URL.createObjectURL(new Blob([u]))})}else{var r=internalFetcher.ajax(this.decoderPath+"draco_wasm_wrapper.js",{responseType:"text"}).then(function(u){return u.body}),o=internalFetcher.ajax(this.decoderPath+"draco_decoder.wasm",{responseType:"arraybuffer"}).then(function(u){return u.body});this.decoderPending=Promise.all([r,o]).then(function(u){var l=u[0],c=u[1];t.decoderConfig.wasmBinary=c;var f=["/* draco decoder */",l,"","/* worker */",DRACOWorker].join(`
452
452
  `);t.workerSourceURL=URL.createObjectURL(new Blob([f]))})}return this.decoderPending},n.prototype._getWorker=function(t,e){var r=this;return this._initDecoder().then(function(){if(r.workerPool.length<r.workerLimit){var o=new Worker(r.workerSourceURL);o._callbacks={},o._taskCosts={},o._taskLoad=0,o.postMessage({type:"init",decoderConfig:r.decoderConfig}),o.onmessage=function(u){var l=u.data;switch(l.type){case"decode":o._callbacks[l.id].resolve(l);break;case"error":o._callbacks[l.id].reject(l);break;default:console.error('DRACO: Unexpected message, "'+l.type+'"')}},r.workerPool.push(o)}else r.workerPool.sort(function(u,l){return u._taskLoad>l._taskLoad?-1:1});var s=r.workerPool[r.workerPool.length-1];return s._taskCosts[t]=e,s._taskLoad+=e,s})},n.prototype._releaseTask=function(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]},n.prototype.dispose=function(){for(var t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this},n})(),draco=new Draco,DRACOWorker=`
453
453
  let decoderConfig;
@@ -915,7 +915,7 @@ self.onmessage = function(event) {
915
915
  }
916
916
  `,EXTENSION_NAME$5="KHR_texture_basisu",KHR_texture_basisu=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.loadTexture=function(e,r){var o=r.json.textures[e];if(!o.extensions||!o.extensions[EXTENSION_NAME$5])return null;var s=o.extensions[EXTENSION_NAME$5],u=r.json.images[s.source],l=null;if(u.bufferView!==void 0)l=r.loadBufferView(u.bufferView).then(function(p){return ktx2.parse(p)});else if(u.uri)l=r.options.fetcher.ajax(r.resolveResouce(u.uri),{responseType:"arraybuffer"}).then(function(p){return ktx2.parse(p.body)});else throw new Error("glTF: Invalid image defs.");var c=r.json.samplers||{},f=c[o.sampler]||{};return l=l.then(function(p){return p.magFilter=THREE__namespace.LinearFilter,p.minFilter=THREE__namespace.LinearFilter,p.wrapS=WEBGL_WRAPPINGS[f.wrapS]||THREE__namespace.RepeatWrapping,p.wrapT=WEBGL_WRAPPINGS[f.wrapT]||THREE__namespace.RepeatWrapping,p}),l},t})(BaseExtension),EXTENSION_NAME$4="KHR_texture_transform",KHR_texture_transform=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.extendTexture=function(e,r,o){var s=r.extensions!==void 0?r.extensions[EXTENSION_NAME$4]:void 0;return s?(s.texCoord!==void 0&&console.warn('glTF: Custom UV sets in "'+EXTENSION_NAME$4+'" extension not yet supported.'),s.offset===void 0&&s.rotation===void 0&&s.scale===void 0||(e=e.clone(),e.needsUpdate=!0,s.offset!==void 0&&e.offset.fromArray(s.offset),s.rotation!==void 0&&(e.rotation=s.rotation),s.scale!==void 0&&e.repeat.fromArray(s.scale)),e):null},t})(BaseExtension),KHR_mesh_quantization=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t})(BaseExtension),KHR_materials_unlit=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t})(BaseExtension),meshoptDecoder=(function(){var n="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:78Yqdbk:qzezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlinalgic9Wfglawcj;cbffhOdndndndndnaHalco4fRbbalci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOaoRblaoRbbgAco4glalciSgCE86bbawcj;cbfaifglcGfaoclfaCfgORbbaAcl4ciGgCaCciSgCE86bbalcVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbalc7faOaCfgORbbaAciGgAaAciSgAE86bbalctfaOaAfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkaOaoRbwaoRbbgAcl4glalcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgORbbaAcsGgAaAcsSgAE86bbalcVfaOaAfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekaOao8Pbb83bbaOcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhPdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkaCcefhCamcefgmad6hsamad9hmbkaPhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaPhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj;8ifcjjj98G::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",t="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;a9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;d8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgAclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var o=WebAssembly.validate(e)?t:n,s,u=WebAssembly.instantiate(l(o),{}).then(function(v){s=v.instance,s.exports.__wasm_call_ctors()});function l(v){for(var A=new Uint8Array(v.length),b=0;b<v.length;++b){var T=v.charCodeAt(b);A[b]=T>96?T-97:T>64?T-39:T+4}for(var _=0,b=0;b<v.length;++b)A[_++]=A[b]<60?r[A[b]]:(A[b]-60)*64+A[++b];return A.buffer.slice(0,_)}function c(v,A,b,T,_,S){var w=s.exports.sbrk,R=b+3&-4,I=w(R*T),H=w(_.length),C=new Uint8Array(s.exports.memory.buffer);C.set(_,H);var M=v(I,b,T,H,_.length);if(M==0&&S&&S(I,R,T),A.set(C.subarray(I,I+b*T)),w(I-w(0)),M!=0)throw new Error("Malformed buffer data: "+M)}var f={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},p={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},d=[],h=0;function g(v){var A={object:new Worker(v),pending:0,requests:{}};return A.object.onmessage=function(b){var T=b.data;A.pending-=T.count,A.requests[T.id][T.action](T.value),delete A.requests[T.id]},A}function m(v){for(var A="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(l(o))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+c.toString()+y.toString(),b=new Blob([A],{type:"text/javascript"}),T=URL.createObjectURL(b),_=0;_<v;++_)d[_]=g(T);URL.revokeObjectURL(T)}function E(v,A,b,T,_){for(var S=d[0],w=1;w<d.length;++w)d[w].pending<S.pending&&(S=d[w]);return new Promise(function(R,I){var H=new Uint8Array(b),C=h++;S.pending+=v,S.requests[C]={resolve:R,reject:I},S.object.postMessage({id:C,count:v,size:A,source:H,mode:T,filter:_},[H.buffer])})}function y(v){u.then(function(){var A=v.data;try{var b=new Uint8Array(A.count*A.size);c(s.exports[A.mode],b,A.count,A.size,A.source,s.exports[A.filter]),self.postMessage({id:A.id,count:A.count,action:"resolve",value:b},[b.buffer])}catch(T){self.postMessage({id:A.id,count:A.count,action:"reject",value:T})}})}return{ready:u,supported:!0,useWorkers:function(v){m(v)},decodeVertexBuffer:function(v,A,b,T,_){c(s.exports.meshopt_decodeVertexBuffer,v,A,b,T,s.exports[f[_]])},decodeIndexBuffer:function(v,A,b,T){c(s.exports.meshopt_decodeIndexBuffer,v,A,b,T)},decodeIndexSequence:function(v,A,b,T){c(s.exports.meshopt_decodeIndexSequence,v,A,b,T)},decodeGltfBuffer:function(v,A,b,T,_,S){c(s.exports[p[_]],v,A,b,T,s.exports[f[S]])},decodeGltfBufferAsync:function(v,A,b,T,_){return d.length>0?E(v,A,b,p[T],f[_]):u.then(function(){var S=new Uint8Array(v*A);return c(s.exports[p[T]],S,v,A,b,s.exports[f[_]]),S})}}})(),EXTENSION_NAME$3="EXT_meshopt_compression",EXT_meshopt_compression=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.loadBufferView=function(e,r){var o=r.json,s=o.bufferViews[e];if(s.extensions&&s.extensions[EXTENSION_NAME$3]){var u=s.extensions[EXTENSION_NAME$3],l=r.loadBuffer(u.buffer);if(!meshoptDecoder.supported){if(o.extensionsRequired&&o.extensionsRequired.indexOf(EXTENSION_NAME$3)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([l,meshoptDecoder.ready]).then(function(c){var f=c[0],p=u.byteOffset||0,d=u.byteLength||0,h=u.count,g=u.byteStride,m=new ArrayBuffer(h*g),E=new Uint8Array(f,p,d);return meshoptDecoder.decodeGltfBuffer(new Uint8Array(m),h,g,E,u.mode,u.filter),m})}else return null},t})(BaseExtension),EXTENSION_NAME$2="EXT_texture_webp",EXT_texture_webp=(function(n){__extends(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.supportsWep=!1,e}return t.prototype.prepare=function(e){var r=this;return imageSupport().then(function(o){r.supportsWep=o.webp})},t.prototype.loadTexture=function(e,r){var o=r.json,s=o.textures[e];if(!s.extensions||!s.extensions[EXTENSION_NAME$2]||!this.supportsWep)return null;var u=s.extensions[EXTENSION_NAME$2];return r.loadImage(u.source).then(function(l){var c=new THREE__namespace.Texture(l);c.needsUpdate=!0,c.flipY=!1,s.name&&(c.name=s.name);var f=r.json.samplers||{},p=f[s.sampler]||{};return c.magFilter=WEBGL_FILTERS[p.magFilter]||THREE__namespace.LinearFilter,c.minFilter=WEBGL_FILTERS[p.minFilter]||THREE__namespace.LinearMipmapLinearFilter,c.wrapS=WEBGL_WRAPPINGS[p.wrapS]||THREE__namespace.RepeatWrapping,c.wrapT=WEBGL_WRAPPINGS[p.wrapT]||THREE__namespace.RepeatWrapping,c.onUpdate=function(){l.close()},c})},t})(BaseExtension),EXTENSION_NAME$1="CESIUM_RTC",CESIUM_RTC=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.emitResult=function(e,r){if(r.json.extensions[EXTENSION_NAME$1]&&r.json.extensions[EXTENSION_NAME$1].center){var o=r.json.extensions[EXTENSION_NAME$1].center;e.CESIUM_RTC={center:new THREE__namespace.Vector3().fromArray(o)}}},t})(BaseExtension),PBM_mesh=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.loadMesh=function(e,r){var o=this,s=r.json.meshes[e],u=s.primitives,l=Promise.all(u.map(function(p){return r.loadGeometry(p)})),c=Promise.all(u.map(function(p){return o.loadPBMMaterial(p,r)})),f=Promise.all([l,c]).then(function(p){for(var d,h=p[0],g=p[1],m=[],E=0;E<u.length;E++){var y=u[E],v=h[E],A=g[E],b=(d=y.mode)!==null&&d!==void 0?d:WEBGL_CONSTANTS.TRIANGLES,T=void 0;if(b===WEBGL_CONSTANTS.TRIANGLES||b===WEBGL_CONSTANTS.TRIANGLE_STRIP||b===WEBGL_CONSTANTS.TRIANGLE_FAN)if(b===WEBGL_CONSTANTS.TRIANGLE_STRIP?v=r.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleStripDrawMode):b===WEBGL_CONSTANTS.TRIANGLE_FAN&&(v=r.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleFanDrawMode)),v.clearGroups(),v.addGroup(0,v.index?v.index.count:v.attributes.position.count,0),r.disposeSet.add(v),s.isSkinnedMesh){var _=new PBMSkinnedMesh(v,[A]);r.normalizeSkinWeights(_),T=_}else T=new PBMMesh(v,[A]);else if(b===WEBGL_CONSTANTS.POINTS)T=new PBMPointCloud(v,A);else throw new Error("glTF: Primitive mode unsupported: "+b);if(Object.keys(v.morphAttributes).length>0){if(s.weights!==void 0)for(var S=0,w=s.weights.length;S<w;S++)T.morphTargetInfluences[S]=s.weights[S];if(s.extras&&Array.isArray(s.extras.targetNames)){var R=s.extras.targetNames;if(T.morphTargetInfluences.length===R.length){T.morphTargetDictionary={};for(var S=0,w=R.length;S<w;S++)T.morphTargetDictionary[R[S]]=S}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}T.name=s.name||"mesh_"+e,r.assignFinalMaterial(T),m.push(T)}if(m.length===1)return m[0];for(var I=new THREE__namespace.Group,H=0,C=m;H<C.length;H++){var T=C[H];I.add(T)}return I});return f},t.prototype.loadPBMMaterial=function(e,r){var o,s=(o=e.mode)!==null&&o!==void 0?o:WEBGL_CONSTANTS.TRIANGLES,u=null;if(s===WEBGL_CONSTANTS.TRIANGLES||s===WEBGL_CONSTANTS.TRIANGLE_STRIP||s===WEBGL_CONSTANTS.TRIANGLE_FAN)u=this.loadPBMMeshMaterial(e,r);else if(s===WEBGL_CONSTANTS.POINTS)u=this.loadPBMPointCloudMaterial(e,r);else throw new Error("glTF: Primitive mode unsupported: "+s);return u=u.then(function(l){return Promise.all(values(r.extensions).map(function(c){return c.extendMaterial(l,e,r)})).then(function(){return l})}),u},t.prototype.extendTexture=function(e,r,o){return e instanceof THREE__namespace.CompressedTexture||(e.minFilter=THREE__namespace.LinearFilter,e.magFilter=THREE__namespace.LinearFilter,e.generateMipmaps=!1),e},t.prototype.loadPBMPointCloudMaterial=function(e,r){var o=new PBMPointCloudMaterial;return r.disposeSet.add(o),Promise.resolve(o)},t.prototype.loadPBMMeshMaterial=function(e,r){var o=[],s=r.extensions.KHR_materials_unlit?"basic":"standard",u=new PBMMeshMaterial(s);if(u.color=new THREE__namespace.Color(1,1,1),u.opacity=1,u.colorAlpha=1,e.material!==void 0){var l=r.json.materials[e.material];l.name&&(u.name=l.name);var c=l.pbrMetallicRoughness||{};if(Array.isArray(c.baseColorFactor)){var f=c.baseColorFactor;u.color=new THREE__namespace.Color().fromArray(f),u.colorAlpha=f[3]}c.baseColorTexture!==void 0&&o.push(r.createMaterialTexture(c.baseColorTexture).then(function(h){h.encoding=THREE__namespace.sRGBEncoding,u.map=h,l.alphaMode===ALPHA_MODES.MASK&&!(h instanceof THREE__namespace.CompressedTexture)&&h.minFilter!==THREE__namespace.LinearMipmapLinearFilter&&(h.minFilter=THREE__namespace.LinearMipmapLinearFilter,h.generateMipmaps=!0),r.disposeSet.add(h)})),u.metalness=c.metallicFactor!==void 0?c.metallicFactor:1,u.roughness=c.roughnessFactor!==void 0?c.roughnessFactor:1,c.metallicRoughnessTexture!==void 0&&o.push(r.createMaterialTexture(c.metallicRoughnessTexture).then(function(h){h.format=THREE__namespace.RGBFormat,u.roughnessMap=h,u.metalnessMap=h,r.disposeSet.add(h)})),l.doubleSided===!0&&(u.side=THREE__namespace.DoubleSide);var p=l.alphaMode||ALPHA_MODES.OPAQUE;if(u.alphaMode="OPAQUE",p===ALPHA_MODES.BLEND?(u.alphaMode="BLEND",u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,p===ALPHA_MODES.MASK&&(u.alphaMode="MASK",u.alphaTest=l.alphaCutoff!==void 0?l.alphaCutoff:.5)),l.normalTexture!==void 0&&(o.push(r.createMaterialTexture(l.normalTexture).then(function(h){r.disposeSet.add(h),u.normalMap=h})),u.normalScale=new THREE__namespace.Vector2(1,1),l.normalTexture.scale!==void 0)){var d=l.normalTexture.scale;u.normalScale.set(d,d)}l.occlusionTexture!==void 0&&(o.push(r.createMaterialTexture(l.occlusionTexture).then(function(h){h.format=THREE__namespace.RGBFormat,u.aoMap=h,r.disposeSet.add(h)})),l.occlusionTexture.strength!==void 0&&(u.aoMapIntensity=l.occlusionTexture.strength)),l.emissiveFactor!==void 0&&(u.emissive=new THREE__namespace.Color().fromArray(l.emissiveFactor)),l.emissiveTexture!==void 0&&o.push(r.createMaterialTexture(l.emissiveTexture).then(function(h){h.format=THREE__namespace.RGBFormat,u.emissiveMap=h,r.disposeSet.add(h)}))}return r.disposeSet.add(u),Promise.all(o).then(function(){return u})},t})(BaseExtension),EXTENSION_NAME="REALSEE_materials_lightmap",REALSEE_materials_lightmap=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.extendMaterial=function(e,r,o){var s=[];if(o.json.materials&&r.material!==void 0){var u=o.json.materials[r.material],l=u.extensions[EXTENSION_NAME];l&&(l.lightMapTexture!==void 0&&s.push(o.createMaterialTexture(l.lightMapTexture).then(function(c){e.lightMap=c})),l.lightMapIntensity!==void 0&&(e.lightMapIntensity=l.lightMapIntensity))}return Promise.all(s).then(function(){})},t})(BaseExtension),EXTENSIONS={KHR_binary_glTF,KHR_draco_mesh_compression,KHR_texture_basisu,KHR_texture_transform,KHR_mesh_quantization,KHR_materials_unlit,EXT_meshopt_compression,EXT_texture_webp,CESIUM_RTC,REALSEE_materials_lightmap,PBM_mesh};function parseGltf(n,t){var e,r,o,s={},u,l;if(typeof n=="string")l=n;else{var c=EXTENSIONS.KHR_binary_glTF.getMagic(n);if(c===EXTENSIONS.KHR_binary_glTF.HEADER_MAGIC){u=new EXTENSIONS.KHR_binary_glTF;try{u.loadGlbBinary(n)}catch(m){return Promise.reject(m)}s.KHR_binary_glTF=u,l=u.content}else l=decodeText(new Uint8Array(n))}var f=JSON.parse(l);if(t.jsonModify&&(f=t.jsonModify(f)),f.asset===void 0||Number(f.asset.version[0])<2)return Promise.reject(new Error("glTF: Unsupported asset. glTF versions >=2.0 are supported."));if(f.extensionsUsed)for(var p=f.extensionsRequired||[],d=0;d<f.extensionsUsed.length;d++){var h=f.extensionsUsed[d];s[h]||(EXTENSIONS[h]?s[h]=new EXTENSIONS[h]:p.indexOf(h)>=0&&console.warn('glTF: Unknown extension "'+h+'".'))}var g=new Parser(f,s,{copyUV2:(e=t.copyUV2)!==null&&e!==void 0?e:!1,resourcePath:(r=t.resourcePath)!==null&&r!==void 0?r:"",search:(o=t.search)!==null&&o!==void 0?o:"",fetcher:t.fetcher});return g.parse().then(function(m){return u&&u.clear(),m})}function loadB3dm(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.modelUpAxis)!==null&&e!==void 0?e:"Y",u=(r=t.upAxis)!==null&&r!==void 0?r:"Z",l=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,c={uri:n};return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"}).then(function(f){return f.body})}).then(function(f){return Promise.resolve(0).then(function(p){return parseHeader$1(c,f,p)}).then(function(p){return parseTable(c,f,p)}).then(function(p){return parseGlTFArrayBuffer(c,f,p)})}).then(function(){var f;return parseGltf(c.gltfArrayBuffer,{copyUV2:!1,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(f=n.split("?")[1])!==null&&f!==void 0?f:"",jsonModify:function(p){var d;if(p.extensionsUsed=(d=p.extensionsUsed)!==null&&d!==void 0?d:[],typeof t.light=="boolean"){var h="KHR_materials_unlit";if(t.light){var g=p.extensionsUsed.indexOf(h);g>=0&&p.extensionsUsed.splice(g,1)}else{var g=p.extensionsUsed.indexOf(h);g===-1&&p.extensionsUsed.push(h)}}{var h="PBM_mesh",g=p.extensionsUsed.indexOf(h);g===-1&&p.extensionsUsed.push(h)}return p},fetcher:l}).then(function(p){var d=new THREE__namespace.Matrix4;s==="Y"&&d.premultiply(ROTATE_X_MATRIX);var h;if(c.rtcCenter?h=new THREE__namespace.Vector3().fromArray(c.rtcCenter):p.CESIUM_RTC&&(h=new THREE__namespace.Vector3().copy(p.CESIUM_RTC.center)),h){var g=new THREE__namespace.Matrix4().setPosition(h);d.premultiply(g)}return u==="Y"&&d.premultiply(ROTATE_X_MATRIX_INVERSE),p.scene.applyMatrix4(d),c.featureTableBinary=void 0,c.batchTableBinary=void 0,c.gltfArrayBuffer=void 0,{type:"b3dm",modelUpAxis:s,upAxis:"Z",uri:c.uri,byteLength:c.byteLength,memoryUsage:getMemoryUsage(p.scene),scene:p.scene,textures:p.textures,animations:[],rtcCenter:h,dispose:function(){return p.dispose()}}})})}const jsContent$1=`(function(){"use strict";function B(a){onmessage=function(r){Promise.resolve(r.data).then(function(n){return a(n)}).then(function(n){var e=n.output,t=n.transfer;return postMessage(e,t)}).catch(function(n){return postMessage({$$error:n})})}}var u,y;(function(a){a[a.BYTE=5120]="BYTE",a[a.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",a[a.SHORT=5122]="SHORT",a[a.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",a[a.INT=5124]="INT",a[a.UNSIGNED_INT=5125]="UNSIGNED_INT",a[a.FLOAT=5126]="FLOAT",a[a.DOUBLE=5130]="DOUBLE"})(y||(y={}));var c=(u={},u[y.DOUBLE]=Float64Array,u[y.FLOAT]=Float32Array,u[y.UNSIGNED_SHORT]=Uint16Array,u[y.UNSIGNED_INT]=Uint32Array,u[y.UNSIGNED_BYTE]=Uint8Array,u[y.BYTE]=Int8Array,u[y.SHORT]=Int16Array,u[y.INT]=Int32Array,u),F={DOUBLE:y.DOUBLE,FLOAT:y.FLOAT,UNSIGNED_SHORT:y.UNSIGNED_SHORT,UNSIGNED_INT:y.UNSIGNED_INT,UNSIGNED_BYTE:y.UNSIGNED_BYTE,BYTE:y.BYTE,SHORT:y.SHORT,INT:y.INT};function O(a){var r=c[a];if(!r)throw new Error("Failed to convert GL type");return r}function p(a){var r=O(a);return r.BYTES_PER_ELEMENT}function _(a,r,n,e){n===void 0&&(n=0);var t=O(a);if(n%p(a)!==0){var i=e?r.slice(n,n+e*p(a)):r.slice(n);return new t(i)}else return new t(r,n,e!=null?e:(r.byteLength-n)/p(a))}function l(a){var r=F[a];if(!r)throw new Error("Failed to convert GL type");return r}var R=(function(){function a(r,n){this.featuresLength=0,this.cachedTypedArrays={},this.json=r,this.buffer=n;var e=this.getGlobalProperty("POINTS_LENGTH",y.UNSIGNED_INT,1);e&&e.length&&(this.featuresLength=e[0])}return a.prototype.getExtension=function(r){return this.json.extensions&&this.json.extensions[r]},a.prototype.hasProperty=function(r){return!!this.json[r]},a.prototype.getGlobalProperty=function(r,n,e){var t=this.json[r];if(typeof t=="number"){var i=O(n);return new i([t])}else if(Array.isArray(t)){var i=O(n);return new i(t)}else if(t&&Number.isFinite(t.byteOffset))return this.getTypedArrayFromBinary(r,n,e,1,t.byteOffset);return null},a.prototype.getPropertyArray=function(r,n,e){var t=this.json[r];return t&&Number.isFinite(t.byteOffset)?("componentType"in t&&(n=l(t.componentType)),this.getTypedArrayFromBinary(r,n,e,this.featuresLength,t.byteOffset)):this.getTypedArrayFromArray(r,n,t)},a.prototype.getProperty=function(r,n,e,t,i){var o=this.json[r];if(!o)return null;var v=this.getPropertyArray(r,n,e);if(e===1)return i[0]=v[t],i;for(var A=0;A<e;++A)i[A]=v[e*t+A];return i},a.prototype.getTypedArrayFromBinary=function(r,n,e,t,i){var o=this.cachedTypedArrays,v=o[r];return v||(v=_(n,this.buffer.buffer,this.buffer.byteOffset+i,t*e),o[r]=v),v},a.prototype.getTypedArrayFromArray=function(r,n,e){var t=this.cachedTypedArrays,i=t[r];return i||(i=_(n,e),t[r]=i),i},a})();B(function(a){return Promise.resolve(a).then(function(r){var n=new R(r.featureTableJson,r.featureTableBinary),e=d(n),t=g(n),i=P(n),o=[];return e&&o.push(e.array.buffer),t&&o.push(t.array.buffer),i&&o.push(i.array.buffer),{output:{position:e,color:t,normal:i},transfer:o}})});var U=65535;function d(a){if(a.hasProperty("POSITION")){var r=a.getPropertyArray("POSITION",y.FLOAT,3);return{array:r,itemSize:3,normalized:!1}}else if(a.hasProperty("POSITION_QUANTIZED")){var n=a.getPropertyArray("POSITION_QUANTIZED",y.UNSIGNED_SHORT,3),e=a.getGlobalProperty("QUANTIZED_VOLUME_SCALE",y.FLOAT,3),t=a.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",y.FLOAT,3);if(!e||!t)throw new Error("QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.");for(var i=new Float32Array(n.length),o=n.length/3,v=e[0]/U,A=e[1]/U,N=e[2]/U,E=t[0],S=t[1],s=t[2],T=0,I=void 0;T<o;T++)I=T*3,i[I]=n[I]*v+E,i[++I]=n[I]*A+S,i[++I]=n[I]*N+s;return{array:i,itemSize:3,normalized:!1}}return null}function g(a){if(a.hasProperty("RGB")){for(var r=a.getPropertyArray("RGB",y.UNSIGNED_BYTE,3),n=r.length/3,e=new Uint8Array(n*4),t=0,i=void 0,o=void 0;t<n;t++)o=t*4,i=t*3,e[o]=r[i],e[++o]=r[++i],e[++o]=r[++i];return{array:e,itemSize:4,normalized:!0}}else if(a.hasProperty("RGBA")){var r=a.getPropertyArray("RGBA",y.UNSIGNED_BYTE,4);return{array:r,itemSize:4,normalized:!0}}else if(a.hasProperty("RGB565")){for(var r=a.getPropertyArray("RGB565",y.UNSIGNED_SHORT,1),n=r.length,e=new Uint8Array(n*4),t=0,v=void 0,A=void 0;t<n;t++)A=r[t],v=t*4,e[v]=(A>>11&31)<<3,e[++v]=(A>>5&63)<<2,e[++v]=(A&31)<<3;return{array:e,itemSize:4,normalized:!0}}return null}var G=255,h=127,D=2/G;function P(a){if(a.hasProperty("NORMAL")){for(var r=a.getPropertyArray("NORMAL",y.FLOAT,3),n=r.length/3,e=new Int8Array(n*4),t=0,i=void 0,o=void 0;t<n;t++)o=t*4,i=t*3,e[o]=r[i]*h,e[++o]=r[++i]*h,e[++o]=r[++i]*h;return{array:e,itemSize:4,normalized:!0}}else if(a.hasProperty("NORMAL_OCT16P")){for(var r=a.getPropertyArray("NORMAL_OCT16P",y.UNSIGNED_BYTE,2),n=r.length/2,e=new Int8Array(n*4),t=0,v=void 0,A=void 0,N=void 0,E=void 0,S=void 0,s=void 0,T=void 0;t<n;t++)v=t*2,A=r[v]*D-1,N=r[++v]*D-1,S=A<0?-A:A,s=N<0?-N:N,E=1-(S+s),E<0&&(A=(1-s)*(A<0?-1:1),N=(1-S)*(N<0?-1:1)),T=Math.sqrt(A*A+N*N+E*E),v=t*4,e[v]=A/T*h,e[++v]=N/T*h,e[++v]=E/T*h;return{array:e,itemSize:4,normalized:!0}}return null}})();
917
917
  `,blob$1=typeof self!="undefined"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",jsContent$1],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(n){let t;try{if(t=blob$1&&(self.URL||self.webkitURL).createObjectURL(blob$1),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(jsContent$1),{name:n==null?void 0:n.name})}}var attributeWorkerPool=new WorkerPool(function(){return new WorkerWrapper$1},2);function parsePointCloud(n,t,e){var r=new FeatureTable(n.featureTableJson,n.featureTableBinary);return Promise.resolve().then(function(){var o=r.getExtension("3DTILES_draco_point_compression");return o?parseDraco(o,r):attributeWorkerPool.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(function(o){return n.attributes=o,e})}function parseDraco(n,t){return __awaiter(this,void 0,void 0,function(){var e,r,o,s,u,l;return __generator(this,function(c){if(e=n.properties||{},r=n.byteOffset,o=n.byteLength,!e||!Number.isFinite(r)||!o)throw new Error("Draco properties, byteOffset, and byteLength must be defined");return s=t.buffer.slice(r,r+o),u=n.properties,l={POSITION:"Float32Array",NORMAL:"Float32Array",RGB:"Uint8Array",RGBA:"Uint8Array"},[2,draco.decodeGeometry(s.buffer,{attributeIDs:u,attributeTypes:l,useUniqueIDs:!0}).then(function(f){var p=f.getAttribute("POSITION"),d=f.getAttribute("RGB"),h=f.getAttribute("RGBA"),g=f.getAttribute("NORMAL"),m;if(h)m=h;else if(d){for(var E=d.count,y=d.array,v=new Uint8Array(E*4),A=0,b=void 0,T=void 0;A<E;A++)T=A*4,b=A*3,v[T]=y[b],v[++T]=y[++b],v[++T]=y[++b];m=new THREE__namespace.BufferAttribute(v,4,d.normalized)}return{position:p?{array:p.array,itemSize:p.itemSize,normalized:p.normalized}:null,color:m?{array:m.array,itemSize:m.itemSize,normalized:m.normalized}:null,normal:g?{array:g.array,itemSize:g.itemSize,normalized:g.normalized}:null}})]})})}function loadPnts(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u={uri:n};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return l.body})}).then(function(l){return Promise.resolve(0).then(function(c){return parseHeader$1(u,l,c)}).then(function(c){return parseTable(u,l,c)}).then(function(c){return parsePointCloud(u,l,c)})}).then(function(){var l;return createPoints(u.attributes,{computeBoundingBox:(l=t.computeBoundingBox)!==null&&l!==void 0?l:!0})}).then(function(l){var c=new THREE__namespace.Matrix4,f;if(u.rtcCenter&&(f=new THREE__namespace.Vector3().fromArray(u.rtcCenter)),f){var p=new THREE__namespace.Matrix4().setPosition(f);c.premultiply(p)}return o==="Y"&&c.premultiply(ROTATE_X_MATRIX_INVERSE),l.object.applyMatrix4(c),u.gltfArrayBuffer=void 0,u.featureTableBinary=void 0,u.batchTableBinary=void 0,{type:"pnts",modelUpAxis:"Z",upAxis:o,uri:u.uri,byteLength:u.byteLength,memoryUsage:getMemoryUsage(l.object),scene:l.object,textures:[],animations:[],rtcCenter:f,dispose:function(){return l.dispose()}}})}function createPoints(n,t){var e=new Set,r=new THREE__namespace.BufferGeometry;e.add(r);var o=new PBMPointCloudMaterial;e.add(o),n.position&&r.setAttribute("position",new THREE__namespace.BufferAttribute(n.position.array,n.position.itemSize,n.position.normalized)),n.color&&r.setAttribute("color",new THREE__namespace.BufferAttribute(n.color.array,n.color.itemSize,n.color.normalized)),n.normal?r.setAttribute("normal",new THREE__namespace.BufferAttribute(n.normal.array,n.normal.itemSize,n.normal.normalized)):o.flatShading=!0,t.computeBoundingBox&&r.computeBoundingBox();var s=new PBMPointCloud(r,o);return s.matrix.compose(s.position,s.quaternion,s.scale),s.matrixAutoUpdate=!1,s.frustumCulled=!1,Promise.resolve({object:s,dispose:function(){e.forEach(function(u){u.dispose()}),e.clear()}})}function loadGltf(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.modelUpAxis)!==null&&e!==void 0?e:"Y",u=(r=t.upAxis)!==null&&r!==void 0?r:"Z",l=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,c=0;return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"}).then(function(f){return c=f.body.byteLength,f.body})}).then(function(f){var p;return parseGltf(f,{copyUV2:!1,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(p=n.split("?")[1])!==null&&p!==void 0?p:"",jsonModify:function(d){var h;if(d.extensionsUsed=(h=d.extensionsUsed)!==null&&h!==void 0?h:[],typeof t.light=="boolean"){var g="KHR_materials_unlit";if(t.light){var m=d.extensionsUsed.indexOf(g);m>=0&&d.extensionsUsed.splice(m,1)}else{var m=d.extensionsUsed.indexOf(g);m===-1&&d.extensionsUsed.push(g)}}{var g="PBM_mesh",m=d.extensionsUsed.indexOf(g);m===-1&&d.extensionsUsed.push(g)}return d},fetcher:l})}).then(function(f){var p,d=new THREE__namespace.Matrix4;if(s==="Y"&&d.premultiply(ROTATE_X_MATRIX),f.CESIUM_RTC){var h=new THREE__namespace.Matrix4().setPosition(f.CESIUM_RTC.center);d.premultiply(h)}return u==="Y"&&d.premultiply(ROTATE_X_MATRIX_INVERSE),f.scene.applyMatrix4(d),{type:"gltf",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(f.scene),scene:f.scene,textures:f.textures,animations:f.animations,rtcCenter:(p=f.CESIUM_RTC)===null||p===void 0?void 0:p.center,dispose:function(){return f.dispose()}}})}var scratchColor=new THREE__namespace.Color;function loadPly(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.modelUpAxis)!==null&&e!==void 0?e:"Z",u=(r=t.upAxis)!==null&&r!==void 0?r:"Z",l=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,c=0;return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"}).then(function(f){return c=f.body.byteLength,f.body})}).then(function(f){var p,d;return parsePly(f,{propertyNameMapping:(p=t.propertyNameMapping)!==null&&p!==void 0?p:{},customPropertyMapping:(d=t.customPropertyMapping)!==null&&d!==void 0?d:{}})}).then(function(f){var p=f.geometry;switch(t.type){case"geometry":{var d=p;return s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getGeometryMemoryUsed(d),scene:d,textures:[],animations:[],dispose:function(){p.dispose()}}}case"line":{var h="color"in p.attributes,g=new THREE__namespace.LineBasicMaterial({vertexColors:h}),d=new THREE__namespace.Line(p,g);return d.computeLineDistances(),s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(d),scene:d,textures:[],animations:[],dispose:function(){p.dispose(),g.dispose()}}}case"pbmMesh":{var m=new PBMMeshMaterial(t.light?"phong":"basic");m.vertexColors="color"in p.attributes;var d=new THREE__namespace.Mesh(p,m);return s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(d),scene:d,textures:[],animations:[],dispose:function(){p.dispose(),m.dispose()}}}case"pbmPointCloud":{var E=new PBMPointCloudMaterial,d=new PBMPointCloud(p,E);return s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(d),scene:d,textures:[],animations:[],dispose:function(){p.dispose(),E.dispose()}}}}throw new Error("Invalid Type: ".concat(t.type))})}function parsePly(n,t){var e=new Uint8Array(n),r=extractHeaderText(e),o=r.headerText,s=r.headerLength,u=parseHeader(o,s,t);if(u.format==="ascii"){var l=new TextDecoder().decode(e);return{header:u,geometry:parseASCII(l,u,t)}}else return{header:u,geometry:parseBinary(n,u,t)}}function makePlyElementProperty(n,t){var e={name:"",type:n[0]};return e.type==="list"?(e.name=n[3],e.countType=n[1],e.itemType=n[2]):e.name=n[1],e.name in t.propertyNameMapping&&(e.name=t.propertyNameMapping[e.name]),e}function parseHeader(n,t,e){t===void 0&&(t=0);var r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,o="",s=r.exec(n);s!==null&&(o=s[1]);for(var u={format:"",version:"",comments:[],elements:[],headerLength:t,objInfo:""},l=o.split(/\r\n|\r|\n/),c=null,f=0;f<l.length;f++){var p=l[f];if(p=p.trim(),p!==""){var d=p.split(/\s+/),h=d.shift();switch(p=d.join(" "),h){case"format":u.format=d[0],u.version=d[1];break;case"comment":u.comments.push(p);break;case"element":c&&u.elements.push(c),c={name:d[0],count:parseInt(d[1]),properties:[]};break;case"property":c&&c.properties.push(makePlyElementProperty(d,e));break;case"obj_info":u.objInfo=p;break;default:console.log("unhandled",h,d)}}}return c&&u.elements.push(c),u}function parseASCIINumber(n,t){switch(t){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(n);case"float":case"double":case"float32":case"float64":return parseFloat(n);default:throw new Error("unspport type: "+t)}}function parseASCIIElement(n,t){for(var e={},r=0;r<n.length;r++){if(t.empty())return null;if(n[r].type==="list"){for(var o=[],s=parseASCIINumber(t.next(),n[r].countType),u=0;u<s;u++){if(t.empty())return null;o.push(parseASCIINumber(t.next(),n[r].itemType))}e[n[r].name]=o}else e[n[r].name]=parseASCIINumber(t.next(),n[r].type)}return e}function createBuffer(n){for(var t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]},e=0,r=Object.keys(n.customPropertyMapping);e<r.length;e++){var o=r[e];t[o]=[]}return t}function mapElementAttributes(n){var t=n.map(function(r){return r.name});function e(r){for(var o=0,s=r.length;o<s;o++){var u=r[o];if(t.includes(u))return u}return null}return{attrX:e(["x","px","posx"])||"x",attrY:e(["y","py","posy"])||"y",attrZ:e(["z","pz","posz"])||"z",attrNX:e(["nx","normalx"]),attrNY:e(["ny","normaly"]),attrNZ:e(["nz","normalz"]),attrS:e(["s","u","texture_u","tx"]),attrT:e(["t","v","texture_v","ty"]),attrR:e(["red","diffuse_red","r","diffuse_r"]),attrG:e(["green","diffuse_green","g","diffuse_g"]),attrB:e(["blue","diffuse_blue","b","diffuse_b"])}}function parseASCII(n,t,e){var r=createBuffer(e),o=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,s,u=null;(u=o.exec(n))!==null?s=u[1].split(/\s+/):s=[];var l=new ArrayStream(s);e:for(var c=0;c<t.elements.length;c++)for(var f=t.elements[c],p=mapElementAttributes(f.properties),d=0;d<f.count;d++){var h=parseASCIIElement(f.properties,l);if(!h)break e;handleElement(r,f.name,h,p,e)}return postProcess(r,e)}function postProcess(n,t){var e=new THREE__namespace.BufferGeometry;n.indices.length>0&&e.setIndex(n.indices),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(n.vertices,3)),n.normals.length>0&&e.setAttribute("normal",new THREE__namespace.Float32BufferAttribute(n.normals,3)),n.uvs.length>0&&e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(n.uvs,2)),n.colors.length>0&&e.setAttribute("color",new THREE__namespace.Float32BufferAttribute(n.colors,3)),(n.faceVertexUvs.length>0||n.faceVertexColors.length>0)&&(e=e.toNonIndexed(),n.faceVertexUvs.length>0&&e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(n.faceVertexUvs,2)),n.faceVertexColors.length>0&&e.setAttribute("color",new THREE__namespace.Float32BufferAttribute(n.faceVertexColors,3)));for(var r=0,o=Object.keys(t.customPropertyMapping);r<o.length;r++){var s=o[r];if(n[s].length>0){var u=t.customPropertyMapping[s],l=u.itemType,c=u.itemNames,f=u.normalized,p=c.length,d=void 0;switch(l){case"float32":d=new THREE__namespace.Float32BufferAttribute(n[s],p,f);break;case"uint32":d=new THREE__namespace.Uint32BufferAttribute(n[s],p,f);break;case"int32":d=new THREE__namespace.Int32BufferAttribute(n[s],p,f);break;case"uint16":d=new THREE__namespace.Uint16BufferAttribute(n[s],p,f);break;case"int16":d=new THREE__namespace.Int16BufferAttribute(n[s],p,f);break;case"uint8":d=new THREE__namespace.Uint8BufferAttribute(n[s],p,f);break;case"int8":d=new THREE__namespace.Int8BufferAttribute(n[s],p,f);break;default:d=new THREE__namespace.Float32BufferAttribute(n[s],p,f);break}e.setAttribute(s,d)}}return e.computeBoundingSphere(),e}function handleElement(n,t,e,r,o){if(t==="vertex"){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&n.vertices.push(e[r.attrX],e[r.attrY],e[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&n.normals.push(e[r.attrNX],e[r.attrNY],e[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&n.uvs.push(e[r.attrS],e[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(scratchColor.setRGB(e[r.attrR]/255,e[r.attrG]/255,e[r.attrB]/255),n.colors.push(scratchColor.r,scratchColor.g,scratchColor.b));for(var s=0,u=Object.keys(o.customPropertyMapping);s<u.length;s++)for(var l=u[s],c=0,f=o.customPropertyMapping[l].itemNames;c<f.length;c++){var p=f[c];n[l].push(e[p])}}else if(t==="face"){var d=e.vertex_indices||e.vertex_index,h=e.texcoord;d.length===3?(n.indices.push(d[0],d[1],d[2]),h&&h.length===6&&(n.faceVertexUvs.push(h[0],h[1]),n.faceVertexUvs.push(h[2],h[3]),n.faceVertexUvs.push(h[4],h[5]))):d.length===4&&(n.indices.push(d[0],d[1],d[3]),n.indices.push(d[1],d[2],d[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(scratchColor.setRGB(e[r.attrR]/255,e[r.attrG]/255,e[r.attrB]/255),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b))}}function binaryReadElement(n,t){for(var e={},r=0,o=0;o<t.length;o++){var s=t[o],u=s.valueReader;if(s.type==="list"){var l=[],c=s.countReader.read(n+r);r+=s.countReader.size;for(var f=0;f<c;f++)l.push(u.read(n+r)),r+=u.size;e[s.name]=l}else e[s.name]=u.read(n+r),r+=u.size}return[e,r]}function setPropertyBinaryReaders(n,t,e){function r(l,c,f){switch(c){case"int8":case"char":return{read:function(p){return l.getInt8(p)},size:1};case"uint8":case"uchar":return{read:function(p){return l.getUint8(p)},size:1};case"int16":case"short":return{read:function(p){return l.getInt16(p,f)},size:2};case"uint16":case"ushort":return{read:function(p){return l.getUint16(p,f)},size:2};case"int32":case"int":return{read:function(p){return l.getInt32(p,f)},size:4};case"uint32":case"uint":return{read:function(p){return l.getUint32(p,f)},size:4};case"float32":case"float":return{read:function(p){return l.getFloat32(p,f)},size:4};case"float64":case"double":return{read:function(p){return l.getFloat64(p,f)},size:8};default:throw new Error("not support type: "+c)}}for(var o=0,s=n.length;o<s;o++){var u=n[o];u.type==="list"?(u.countReader=r(t,u.countType,e),u.valueReader=r(t,u.itemType,e)):u.valueReader=r(t,u.type,e)}}function parseBinary(n,t,e){for(var r=createBuffer(e),o=t.format==="binary_little_endian",s=new DataView(n,t.headerLength),u,l=0,c=0;c<t.elements.length;c++){var f=t.elements[c],p=f.properties,d=mapElementAttributes(p);setPropertyBinaryReaders(p,s,o);for(var h=0;h<f.count;h++){u=binaryReadElement(l,p),l+=u[1];var g=u[0];handleElement(r,f.name,g,d,e)}}return postProcess(r,e)}function extractHeaderText(n){var t=0,e=!0,r="",o=[],s=new TextDecoder().decode(n.subarray(0,5)),u=/^ply\r\n/.test(s);do{var l=String.fromCharCode(n[t++]);l!==`
918
- `&&l!=="\r"?r+=l:(r==="end_header"&&(e=!1),r!==""&&(o.push(r),r=""))}while(e&&t<n.length);return u===!0&&t++,{headerText:o.join("\r")+"\r",headerLength:t}}var ArrayStream=(function(){function n(t){this.arr=t,this.i=0}return n.prototype.empty=function(){return this.i>=this.arr.length},n.prototype.next=function(){return this.arr[this.i++]},n})(),u8=Uint8Array,u16=Uint16Array,i32=Int32Array,fleb=new u8([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]),fdeb=new u8([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]),clim=new u8([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(n,t){for(var e=new u16(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var o=new i32(e[30]),r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)o[s]=s-e[r]<<5|r;return{b:e,r:o}},_a$3=freb(fleb,2),fl=_a$3.b,revfl=_a$3.r;fl[28]=258,revfl[258]=28;for(var _b=freb(fdeb,0),fd=_b.b,rev=new u16(32768),i=0;i<32768;++i){var x=(i&43690)>>1|(i&21845)<<1;x=(x&52428)>>2|(x&13107)<<2,x=(x&61680)>>4|(x&3855)<<4,rev[i]=((x&65280)>>8|(x&255)<<8)>>1}for(var hMap=(function(n,t,e){for(var r=n.length,o=0,s=new u16(t);o<r;++o)n[o]&&++s[n[o]-1];var u=new u16(t);for(o=1;o<t;++o)u[o]=u[o-1]+s[o-1]<<1;var l;if(e){l=new u16(1<<t);var c=15-t;for(o=0;o<r;++o)if(n[o])for(var f=o<<4|n[o],p=t-n[o],d=u[n[o]-1]++<<p,h=d|(1<<p)-1;d<=h;++d)l[rev[d]>>c]=f}else for(l=new u16(r),o=0;o<r;++o)n[o]&&(l[o]=rev[u[n[o]-1]++]>>15-n[o]);return l}),flt=new u8(288),i=0;i<144;++i)flt[i]=8;for(var i=144;i<256;++i)flt[i]=9;for(var i=256;i<280;++i)flt[i]=7;for(var i=280;i<288;++i)flt[i]=8;for(var fdt=new u8(32),i=0;i<32;++i)fdt[i]=5;var flrm=hMap(flt,9,1),fdrm=hMap(fdt,5,1),max=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},bits=function(n,t,e){var r=t/8|0;return(n[r]|n[r+1]<<8)>>(t&7)&e},bits16=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},shft=function(n){return(n+7)/8|0},slc=function(n,t,e){return(t==null||t<0)&&(t=0),(e==null||e>n.length)&&(e=n.length),new u8(n.subarray(t,e))},ec=["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"],err=function(n,t,e){var r=new Error(t||ec[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,err),!e)throw r;return r},inflt=function(n,t,e,r){var o=n.length,s=r?r.length:0;if(!o||t.f&&!t.l)return e||new u8(0);var u=!e,l=u||t.i!=2,c=t.i;u&&(e=new u8(o*3));var f=function(W){var X=e.length;if(W>X){var te=new u8(Math.max(X*2,W));te.set(e),e=te}},p=t.f||0,d=t.p||0,h=t.b||0,g=t.l,m=t.d,E=t.m,y=t.n,v=o*8;do{if(!g){p=bits(n,d,1);var A=bits(n,d+1,3);if(d+=3,A)if(A==1)g=flrm,m=fdrm,E=9,y=5;else if(A==2){var S=bits(n,d,31)+257,w=bits(n,d+10,15)+4,R=S+bits(n,d+5,31)+1;d+=14;for(var I=new u8(R),H=new u8(19),C=0;C<w;++C)H[clim[C]]=bits(n,d+C*3,7);d+=w*3;for(var M=max(H),B=(1<<M)-1,L=hMap(H,M,1),C=0;C<R;){var O=L[bits(n,d,B)];d+=O&15;var b=O>>4;if(b<16)I[C++]=b;else{var k=0,D=0;for(b==16?(D=3+bits(n,d,3),d+=2,k=I[C-1]):b==17?(D=3+bits(n,d,7),d+=3):b==18&&(D=11+bits(n,d,127),d+=7);D--;)I[C++]=k}}var q=I.subarray(0,S),z=I.subarray(S);E=max(q),y=max(z),g=hMap(q,E,1),m=hMap(z,y,1)}else err(1);else{var b=shft(d)+4,T=n[b-4]|n[b-3]<<8,_=b+T;if(_>o){c&&err(0);break}l&&f(h+T),e.set(n.subarray(b,_),h),t.b=h+=T,t.p=d=_*8,t.f=p;continue}if(d>v){c&&err(0);break}}l&&f(h+131072);for(var V=(1<<E)-1,Q=(1<<y)-1,U=d;;U=d){var k=g[bits16(n,d)&V],j=k>>4;if(d+=k&15,d>v){c&&err(0);break}if(k||err(2),j<256)e[h++]=j;else if(j==256){U=d,g=null;break}else{var G=j-254;if(j>264){var C=j-257,ae=fleb[C];G=bits(n,d,(1<<ae)-1)+fl[C],d+=ae}var re=m[bits16(n,d)&Q],$=re>>4;re||err(3),d+=re&15;var z=fd[$];if($>3){var ae=fdeb[$];z+=bits16(n,d)&(1<<ae)-1,d+=ae}if(d>v){c&&err(0);break}l&&f(h+131072);var ee=h+G;if(h<z){var K=s-z,se=Math.min(z,ee);for(K+h<0&&err(3);h<se;++h)e[h]=r[K+h]}for(;h<ee;++h)e[h]=e[h-z]}}t.l=g,t.p=U,t.b=h,t.f=p,g&&(p=1,t.m=E,t.d=m,t.n=y)}while(!p);return h!=e.length&&u?slc(e,0,h):e.subarray(0,h)},et=new u8(0),b2=function(n,t){return n[t]|n[t+1]<<8},b4=function(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0},b8=function(n,t){return b4(n,t)+b4(n,t+4)*4294967296},zls=function(n,t){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&err(6,"invalid zlib data"),(n[1]>>5&1)==1&&err(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function inflateSync(n,t){return inflt(n,{i:2},t&&t.out,t&&t.dictionary)}function unzlibSync(n,t){return inflt(n.subarray(zls(n),-4),{i:2},t,t)}var td=typeof TextDecoder!="undefined"&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0}),tds=1}catch(n){}var dutf8=function(n){for(var t="",e=0;;){var r=n[e++],o=(r>127)+(r>223)+(r>239);if(e+o>n.length)return{s:t,r:slc(n,e-1)};o?o==3?(r=((r&15)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):o&1?t+=String.fromCharCode((r&31)<<6|n[e++]&63):t+=String.fromCharCode((r&15)<<12|(n[e++]&63)<<6|n[e++]&63):t+=String.fromCharCode(r)}};function strFromU8(n,t){if(t){for(var e="",r=0;r<n.length;r+=16384)e+=String.fromCharCode.apply(null,n.subarray(r,r+16384));return e}else{if(td)return td.decode(n);var o=dutf8(n),s=o.s,e=o.r;return e.length&&err(8),s}}var slzh=function(n,t){return t+30+b2(n,t+26)+b2(n,t+28)},zh=function(n,t,e){var r=b2(n,t+28),o=strFromU8(n.subarray(t+46,t+46+r),!(b2(n,t+8)&2048)),s=t+46+r,u=b4(n,t+20),l=e&&u==4294967295?z64e(n,s):[u,b4(n,t+24),b4(n,t+42)],c=l[0],f=l[1],p=l[2];return[b2(n,t+10),c,f,o,s+b2(n,t+30)+b2(n,t+32),p]},z64e=function(n,t){for(;b2(n,t)!=1;t+=4+b2(n,t+2));return[b8(n,t+12),b8(n,t+4),b8(n,t+20)]};function unzipSync(n,t){for(var e={},r=n.length-22;b4(n,r)!=101010256;--r)(!r||n.length-r>65558)&&err(13);var o=b2(n,r+8);if(!o)return{};var s=b4(n,r+16),u=s==4294967295||o==65535;if(u){var l=b4(n,r-12);u=b4(n,l)==101075792,u&&(o=b4(n,l+32),s=b4(n,l+48))}for(var c=0;c<o;++c){var f=zh(n,s,u),p=f[0],d=f[1],h=f[2],g=f[3],m=f[4],E=f[5],y=slzh(n,E);s=m,p?p==8?e[g]=inflateSync(n.subarray(y,y+d),{out:new u8(h)}):err(14,"unknown compression type "+p):e[g]=slc(n,y,y+d)}return e}function loadFbx(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u=0;return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return u=l.body.byteLength,l.body})}).then(function(l){var c;return parse$2(l,{light:t.light,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(c=n.split("?")[1])!==null&&c!==void 0?c:"",fetcher:s})}).then(function(l){var c=l.scene,f=l.unitScale/100,p=new THREE__namespace.Matrix4;if(p.makeScale(f,f,f),l.upAxis==="X")throw new Error("Cannot load fbx x upAxis");return l.upAxis==="Y"&&p.premultiply(ROTATE_X_MATRIX),o==="Y"&&p.premultiply(ROTATE_X_MATRIX_INVERSE),c.applyMatrix4(p),{type:"fbx",modelUpAxis:l.upAxis,upAxis:o,uri:n,byteLength:u,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:l.animations,dispose:function(){return l.dispose()}}})}function parse$2(n,t){var e;if(isFbxFormatBinary(n))e=new BinaryParser().parse(n);else{var r=convertArrayBufferToString(n);if(!isFbxFormatASCII(r))throw new Error("THREE.FBXLoader: Unknown format.");if(getFbxVersion(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+getFbxVersion(r));e=new TextParser().parse(r)}return new FBXTreeParser(t).parse(e)}var FBXTreeParser=(function(){function n(t){var e,r,o;this.light=(e=t.light)!==null&&e!==void 0?e:!0,this.resourcePath=(r=t.resourcePath)!==null&&r!==void 0?r:"",this.search=(o=t.search)!==null&&o!==void 0?o:"",this.fetcher=t.fetcher}return n.prototype.parse=function(t){var e,r,o,s,u,l,c=this.parseConnections(t),f=Object.assign(new THREE__namespace.Group,{animations:[]}),p=[],d=this.parseImages(t),h=this.parseTextures(t,d,c,p),g=this.parseMaterials(t,h,c),m=this.parseDeformers(t,c),E=new GeometryParser().parse(t,m,c);this.parseScene(t,m,E,g,c,f);var y=(r=(e=t.GlobalSettings.UpAxis)===null||e===void 0?void 0:e.value)!==null&&r!==void 0?r:1,v=(s=(o=t.GlobalSettings.FrontAxis)===null||o===void 0?void 0:o.value)!==null&&s!==void 0?s:2,A=(l=(u=t.GlobalSettings.UnitScaleFactor)===null||u===void 0?void 0:u.value)!==null&&l!==void 0?l:1,b;if(t.GlobalSettings.AmbientColor){var T=t.GlobalSettings.AmbientColor.value,_=T[0],S=T[1],w=T[2];if(_!==0||S!==0||w!==0){var R=new THREE__namespace.Color().setRGB(_,S,w);b=new THREE__namespace.AmbientLight(R,1)}}return Promise.all(p).then(function(I){var H;return{scene:f,textures:I,ambientLight:b,upAxis:["X","Y","Z"][y],frontAxis:["X","Y","Z"][v],unitScale:A,animations:(H=f.animations)!==null&&H!==void 0?H:[],dispose:function(){I.forEach(function(C){return C.dispose()}),g.forEach(function(C){return C.dispose()}),E.forEach(function(C){return C.dispose()})}}})},n.prototype.parseConnections=function(t){var e=new Map;if("Connections"in t){var r=t.Connections.connections;r.forEach(function(o){var s=o[0],u=o[1],l=o[2];e.has(s)||e.set(s,{parents:[],children:[]});var c={ID:u,relationship:l};e.get(s).parents.push(c),e.has(u)||e.set(u,{parents:[],children:[]});var f={ID:s,relationship:l};e.get(u).children.push(f)})}return e},n.prototype.parseImages=function(t){var e={},r={};if("Video"in t.Objects){var o=t.Objects.Video;for(var s in o){var u=o[s],l=parseInt(s);if(e[l]=u.RelativeFilename||u.Filename,"Content"in u){var c=u.Content instanceof ArrayBuffer&&u.Content.byteLength>0,f=typeof u.Content=="string"&&u.Content!=="";if(c||f){var p=this.parseImage(o[s]);r[u.RelativeFilename||u.Filename]=p}}}}for(var l in e){var d=e[l];r[d]!==void 0?e[l]=r[d]:e[l]=e[l].split("\\").pop()}return e},n.prototype.parseImage=function(t){var e=t.Content,r=t.RelativeFilename||t.Filename,o=r.slice(r.lastIndexOf(".")+1).toLowerCase(),s;switch(o){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":s="image/tga";break;default:return}if(typeof e=="string")return"data:"+s+";base64,"+e;var u=new Uint8Array(e);return window.URL.createObjectURL(new Blob([u],{type:s}))},n.prototype.parseTextures=function(t,e,r,o){var s=new Map;if("Texture"in t.Objects){var u=t.Objects.Texture;for(var l in u){var c=this.parseTexture(u[l],e,r,o);s.set(parseInt(l),c)}}return s},n.prototype.parseTexture=function(t,e,r,o){var s=this.loadTexture(t,e,r,o);s.ID=t.id,s.name=t.attrName;var u=t.WrapModeU,l=t.WrapModeV,c=u!==void 0?u.value:0,f=l!==void 0?l.value:0;if(s.wrapS=c===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,s.wrapT=f===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,t.Scaling){var p=t.Scaling.value;s.repeat.x=p[0],s.repeat.y=p[1]}if(t.Translation){var p=t.Translation.value;s.offset.x=p[0],s.offset.y=p[1]}return s},n.prototype.loadTexture=function(t,e,r,o){var s=r.get(t.id).children,u="";s!==void 0&&s.length>0&&e[s[0].ID]!==void 0&&(u=e[s[0].ID]),u=pathJoin(this.resourcePath,appendSearch(u,this.search));var l=Object.assign(new THREE__namespace.Texture,{ID:0}),c;canUseNativeImageBitmap()?c=this.fetcher.ajax(u,{responseType:"blob"}).then(function(p){var d=p.body;return createImageBitmapLike(d)}):c=this.fetcher.loadImage(u,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(p){return p.body});var f=c.then(function(p){return l.image=p,l.needsUpdate=!0,l}).catch(function(p){return console.warn(p),l});return o.push(f),l},n.prototype.parseMaterials=function(t,e,r){var o=new Map;if("Material"in t.Objects){var s=t.Objects.Material;for(var u in s){var l=this.parseMaterial(t,s[u],e,r);l!==null&&o.set(parseInt(u),l)}}return o},n.prototype.parseMaterial=function(t,e,r,o){var s=e.id,u=e.attrName,l=e.ShadingModel;if(typeof l=="object"&&(l=l.value),l=l.toLowerCase(),!o.has(s))return null;var c=new PBMMeshMaterial(this.light?"phong":"basic");c.name=u,e.BumpFactor&&(c.bumpScale=e.BumpFactor.value),e.Diffuse?c.color=new THREE__namespace.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(c.color=new THREE__namespace.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(c.displacementScale=e.DisplacementFactor.value),e.Emissive?c.emissive=new THREE__namespace.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(c.emissive=new THREE__namespace.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(c.emissiveIntensity=parseFloat(e.EmissiveFactor.value));var f=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0);(f===1||f===0)&&(f=e.Opacity?parseFloat(e.Opacity.value):null,f===null&&(f=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),c.opacity=f,c.opacity<1&&(c.transparent=!0),e.ReflectionFactor&&(c.reflectivity=e.ReflectionFactor.value),e.Shininess&&(c.shininess=e.Shininess.value),e.Specular?c.specular=new THREE__namespace.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(c.specular=new THREE__namespace.Color().fromArray(e.SpecularColor.value));var p=this;return o.get(s).children.forEach(function(d){var h=d.relationship;switch(h){case"Bump":c.bumpMap=p.getTexture(t,r,d.ID,o);break;case"Maya|TEX_ao_map":c.aoMap=p.getTexture(t,r,d.ID,o);break;case"DiffuseColor":case"Maya|TEX_color_map":c.map=p.getTexture(t,r,d.ID,o),c.map!==void 0&&(c.map.encoding=THREE__namespace.sRGBEncoding);break;case"DisplacementColor":c.displacementMap=p.getTexture(t,r,d.ID,o);break;case"EmissiveColor":c.emissiveMap=p.getTexture(t,r,d.ID,o),c.emissiveMap!==void 0&&(c.emissiveMap.encoding=THREE__namespace.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":c.normalMap=p.getTexture(t,r,d.ID,o);break;case"ReflectionColor":c.envMap=p.getTexture(t,r,d.ID,o),c.envMap!==void 0&&(c.envMap.mapping=THREE__namespace.EquirectangularReflectionMapping,c.envMap.encoding=THREE__namespace.sRGBEncoding);break;case"SpecularColor":c.specularMap=p.getTexture(t,r,d.ID,o),c.specularMap!==void 0&&(c.specularMap.encoding=THREE__namespace.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":c.alphaMap=p.getTexture(t,r,d.ID,o),c.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",h);break}}),c},n.prototype.getTexture=function(t,e,r,o){return t.Objects.LayeredTexture&&r in t.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=o.get(r).children[0].ID),e.get(r)},n.prototype.parseDeformers=function(t,e){var r={},o={};if("Deformer"in t.Objects){var s=t.Objects.Deformer;for(var u in s){var l=s[u],c=e.get(parseInt(u));if(l.attrType==="Skin"){var f=this.parseSkeleton(c,s);f.ID=u,c.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),f.geometryID=c.parents[0].ID,r[u]=f}else if(l.attrType==="BlendShape"){var p={id:u};p.rawTargets=this.parseMorphTargets(c,s,e),p.id=u,c.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),o[u]=p}}}return{skeletons:r,morphTargets:o}},n.prototype.parseSkeleton=function(t,e){var r=[];return t.children.forEach(function(o){var s=e[o.ID];if(s.attrType==="Cluster"){var u={ID:o.ID,indices:[],weights:[],transformLink:new THREE__namespace.Matrix4().fromArray(s.TransformLink.a)};s.Indexes&&(u.indices=s.Indexes.a,u.weights=s.Weights.a),r.push(u)}}),{ID:"",geometryID:0,rawBones:r,bones:[]}},n.prototype.parseMorphTargets=function(t,e,r){for(var o=[],s=0;s<t.children.length;s++){var u=t.children[s],l=e[u.ID],c={name:l.attrName,initialWeight:l.DeformPercent,id:l.id,fullWeights:l.FullWeights.a,geoID:0};if(l.attrType!=="BlendShapeChannel")return;c.geoID=r.get(parseInt(u.ID)).children.filter(function(f){return f.relationship===void 0})[0].ID,o.push(c)}return o},n.prototype.parseScene=function(t,e,r,o,s,u){var l=this.parseModels(t,e.skeletons,r,o,s),c=t.Objects.Model,f=this;l.forEach(function(d){var h=c[d.ID];f.setLookAtProperties(t,d,h,s,u);var g=s.get(d.ID).parents;g.forEach(function(m){var E=l.get(m.ID);E!==void 0&&E.add(d)}),d.parent===null&&u.add(d)}),this.bindSkeleton(t,e.skeletons,r,l,s),u.traverse(function(d){if(d.userData.transformData){d.parent&&(d.userData.transformData.parentMatrix=d.parent.matrix,d.userData.transformData.parentMatrixWorld=d.parent.matrixWorld);var h=generateTransform(d.userData.transformData);d.applyMatrix4(h),d.updateWorldMatrix(!0,!0)}});var p=new AnimationParser().parse(t,s,u);u.children.length===1&&u.children[0]instanceof THREE__namespace.Group&&(u=u.children[0]),u.animations=p},n.prototype.parseModels=function(t,e,r,o,s){var u=new Map,l=t.Objects.Model;for(var c in l){var f=parseInt(c),p=l[c],d=s.get(f),h=this.buildSkeleton(d,e,f,p.attrName);if(!h){switch(p.attrType){case"Camera":h=this.createCamera(t,d);break;case"Light":h=this.createLight(t,d);break;case"Mesh":h=this.createMesh(d,r,o);break;case"NurbsCurve":case"LimbNode":case"Root":h=new THREE__namespace.Bone;break;case"Null":default:h=new THREE__namespace.Group;break}h.name=p.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(p.attrName):"",h.userData.originalName=p.attrName,h.ID=f}this.getTransformData(h,p),u.set(f,h)}return u},n.prototype.buildSkeleton=function(t,e,r,o){var s=null;return t.parents.forEach(function(u){var l=function(f){var p=e[f];p.rawBones.forEach(function(d,h){if(d.ID===u.ID){var g=s;s=new THREE__namespace.Bone,s.matrixWorld.copy(d.transformLink),s.name=o?THREE__namespace.PropertyBinding.sanitizeNodeName(o):"",s.userData.originalName=o,s.ID=r,p.bones[h]=s,g!==null&&s.add(g)}})};for(var c in e)l(c)}),s},n.prototype.createCamera=function(t,e){var r,o;if(e.children.forEach(function(g){var m=t.Objects.NodeAttribute[g.ID];m!==void 0&&(o=m)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=0;o.CameraProjectionType!==void 0&&o.CameraProjectionType.value===1&&(s=1);var u=1;o.NearPlane!==void 0&&(u=o.NearPlane.value/1e3);var l=1e3;o.FarPlane!==void 0&&(l=o.FarPlane.value/1e3);var c=window.innerWidth,f=window.innerHeight;o.AspectWidth!==void 0&&o.AspectHeight!==void 0&&(c=o.AspectWidth.value,f=o.AspectHeight.value);var p=c/f,d=45;o.FieldOfView!==void 0&&(d=o.FieldOfView.value);var h=o.FocalLength?o.FocalLength.value:null;switch(s){case 0:r=new THREE__namespace.PerspectiveCamera(d,p,u,l),h!==null&&r.setFocalLength(h);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),r=new THREE__namespace.Object3D;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),r=new THREE__namespace.Object3D;break}}return r},n.prototype.createLight=function(t,e){var r,o;if(e.children.forEach(function(h){var g=t.Objects.NodeAttribute[h.ID];g!==void 0&&(o=g)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=void 0;o.LightType===void 0?s=0:s=o.LightType.value;var u=new THREE__namespace.Color(16777215);o.Color!==void 0&&(u=new THREE__namespace.Color().fromArray(o.Color.value));var l=o.Intensity===void 0?1:o.Intensity.value/100;o.CastLightOnObject!==void 0&&o.CastLightOnObject.value===0&&(l=0);var c=0;o.FarAttenuationEnd!==void 0&&(o.EnableFarAttenuation!==void 0&&o.EnableFarAttenuation.value===0?c=0:c=o.FarAttenuationEnd.value);var f=1;switch(s){case 0:r=new THREE__namespace.PointLight(u,l,c,f);break;case 1:r=new THREE__namespace.DirectionalLight(u,l);break;case 2:var p=Math.PI/3;o.InnerAngle!==void 0&&(p=THREE__namespace.MathUtils.degToRad(o.InnerAngle.value));var d=0;o.OuterAngle!==void 0&&(d=THREE__namespace.MathUtils.degToRad(o.OuterAngle.value),d=Math.max(d,1)),r=new THREE__namespace.SpotLight(u,l,c,p,d,f);break;default:console.warn("THREE.FBXLoader: Unknown light type "+o.LightType.value+", defaulting to a PointLight."),r=new THREE__namespace.PointLight(u,l);break}o.CastShadows!==void 0&&o.CastShadows.value===1&&(r.castShadow=!0)}return r},n.prototype.createMesh=function(t,e,r){var o,s=null,u=[];if(t.children.forEach(function(c){e.has(c.ID)&&(s=e.get(c.ID)),r.has(c.ID)&&u.push(r.get(c.ID))}),u.length===0){var l=new PBMMeshMaterial(this.light?"phong":"basic");l.color=new THREE__namespace.Color(13421772),u.push(l)}return"color"in s.attributes&&u.forEach(function(c){c.vertexColors=!0}),(!s.groups||s.groups.length===0)&&s.addGroup(0,s.index?s.index.count:s.attributes.position.count,0),s.FBX_Deformer?(u.forEach(function(c){c.skinning=!0}),o=new PBMSkinnedMesh(s,u),o.normalizeSkinWeights()):o=new PBMMesh(s,u),o},n.prototype.createCurve=function(t,e){var r=t.children.reduce(function(s,u){return e.has(u.ID)&&(s=e.get(u.ID)),s},null),o=new THREE__namespace.LineBasicMaterial({name:"",color:3342591,linewidth:1});return new THREE__namespace.Line(r,o)},n.prototype.getTransformData=function(t,e){var r={};e.InheritType&&(r.inheritType=parseInt(e.InheritType.value)),e.RotationOrder?r.eulerOrder=getEulerOrder(e.RotationOrder.value):r.eulerOrder=getEulerOrder(0),e.Lcl_Translation&&(r.translation=e.Lcl_Translation.value),e.PreRotation&&(r.preRotation=e.PreRotation.value),e.Lcl_Rotation&&(r.rotation=e.Lcl_Rotation.value),e.PostRotation&&(r.postRotation=e.PostRotation.value),e.Lcl_Scaling&&(r.scale=e.Lcl_Scaling.value),e.ScalingOffset&&(r.scalingOffset=e.ScalingOffset.value),e.ScalingPivot&&(r.scalingPivot=e.ScalingPivot.value),e.RotationOffset&&(r.rotationOffset=e.RotationOffset.value),e.RotationPivot&&(r.rotationPivot=e.RotationPivot.value),t.userData.transformData=r},n.prototype.setLookAtProperties=function(t,e,r,o,s){if("LookAtProperty"in r){var u=o.get(e.ID).children;u.forEach(function(l){if(l.relationship==="LookAtProperty"){var c=t.Objects.Model[l.ID];if(c.Lcl_Translation){var f=c.Lcl_Translation.value;"target"in e&&e.target instanceof THREE__namespace.Object3D?(e.target.position.fromArray(f),s.add(e.target)):e.lookAt(new THREE__namespace.Vector3().fromArray(f))}}})}},n.prototype.bindSkeleton=function(t,e,r,o,s){var u=this.parsePoseNodes(t),l=function(f){var p=e[f],d=s.get(parseInt(p.ID)).parents;d.forEach(function(h){if(r.has(h.ID)){var g=h.ID,m=s.get(g);m.parents.forEach(function(E){if(o.has(E.ID)){var y=o.get(E.ID);y instanceof THREE__namespace.SkinnedMesh&&y.bind(new THREE__namespace.Skeleton(p.bones),u[E.ID])}})}})};for(var c in e)l(c)},n.prototype.parsePoseNodes=function(t){var e={};if(t.Objects.Pose){var r=t.Objects.Pose;for(var o in r)if(r[o].attrType==="BindPose"&&r[o].NbPoseNodes>0){var s=r[o].PoseNode;Array.isArray(s)?s.forEach(function(u){e[u.Node]=new THREE__namespace.Matrix4().fromArray(u.Matrix.a)}):e[s.Node]=new THREE__namespace.Matrix4().fromArray(s.Matrix.a)}}return e},n})(),GeometryParser=(function(){function n(){this.negativeMaterialIndices=!1}return n.prototype.parse=function(t,e,r){var o=new Map;if("Geometry"in t.Objects){var s=t.Objects.Geometry;for(var u in s){var l=r.get(parseInt(u)),c=this.parseGeometry(t,l,s[u],e);o.set(parseInt(u),c)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),o},n.prototype.parseGeometry=function(t,e,r,o){switch(r.attrType){case"Mesh":return this.parseMeshGeometry(t,e,r,o);case"NurbsCurve":return this.parseNurbsGeometry(r)}},n.prototype.parseMeshGeometry=function(t,e,r,o){var s=o.skeletons,u=[],l=e.parents.map(function(h){return t.Objects.Model[h.ID]});if(l.length!==0){var c=e.children.reduce(function(h,g){return s[g.ID]!==void 0&&(h=s[g.ID]),h},null);e.children.forEach(function(h){o.morphTargets[h.ID]!==void 0&&u.push(o.morphTargets[h.ID])});var f=l[0],p={};f.RotationOrder&&(p.eulerOrder=getEulerOrder(f.RotationOrder.value)),f.InheritType&&(p.inheritType=parseInt(f.InheritType.value)),f.GeometricTranslation&&(p.translation=f.GeometricTranslation.value),f.GeometricRotation&&(p.rotation=f.GeometricRotation.value),f.GeometricScaling&&(p.scale=f.GeometricScaling.value);var d=generateTransform(p);return this.genGeometry(t,r,c,u,d)}},n.prototype.genGeometry=function(t,e,r,o,s){var u=new THREE__namespace.BufferGeometry;e.attrName&&(u.name=e.attrName);var l=this.parseGeoNode(e,r),c=this.genBuffers(l),f=new THREE__namespace.Float32BufferAttribute(c.vertex,3);if(f.applyMatrix4(s),u.setAttribute("position",f),c.colors.length>0&&u.setAttribute("color",new THREE__namespace.Float32BufferAttribute(c.colors,3)),r&&(u.setAttribute("skinIndex",new THREE__namespace.Uint16BufferAttribute(c.weightsIndices,4)),u.setAttribute("skinWeight",new THREE__namespace.Float32BufferAttribute(c.vertexWeights,4)),u.FBX_Deformer=r),c.normal.length>0){var p=new THREE__namespace.Matrix3().getNormalMatrix(s),d=new THREE__namespace.Float32BufferAttribute(c.normal,3);d.applyNormalMatrix(p),u.setAttribute("normal",d)}if(c.uvs.forEach(function(y,v){var A=v===0?"uv":"uv".concat(v+1);u.setAttribute(A,new THREE__namespace.Float32BufferAttribute(c.uvs[v],2))}),l.material&&l.material.mappingType!=="AllSame"){var h=c.materialIndex[0],g=0;if(c.materialIndex.forEach(function(y,v){y!==h&&(u.addGroup(g,v-g,h),h=y,g=v)}),u.groups.length>0){var m=u.groups[u.groups.length-1],E=m.start+m.count;E!==c.materialIndex.length&&u.addGroup(E,c.materialIndex.length-E,h)}u.groups.length===0&&u.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(t,u,e,o,s),u},n.prototype.parseGeoNode=function(t,e){var r={};if(r.vertexPositions=t.Vertices!==void 0?t.Vertices.a:[],r.vertexIndices=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(r.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(r.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(r.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){r.uv=[];for(var o=0;t.LayerElementUV[o];)t.LayerElementUV[o].UV&&r.uv.push(this.parseUVs(t.LayerElementUV[o])),o++}return r.weightTable={},e!==null&&(r.skeleton=e,e.rawBones.forEach(function(s,u){s.indices.forEach(function(l,c){r.weightTable[l]===void 0&&(r.weightTable[l]=[]),r.weightTable[l].push({id:u,weight:s.weights[c]})})})),r},n.prototype.genBuffers=function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,o=0,s=!1,u=[],l=[],c=[],f=[],p=[],d=[],h=this;return t.vertexIndices.forEach(function(g,m){var E=0,y=!1;g<0&&(g=g^-1,y=!0);var v=[],A=[];if(u.push(g*3,g*3+1,g*3+2),t.color){var b=getData(m,r,g,t.color);c.push(b[0],b[1],b[2])}if(t.skeleton){if(t.weightTable[g]!==void 0&&t.weightTable[g].forEach(function(w){A.push(w.weight),v.push(w.id)}),A.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);var T=[0,0,0,0],_=[0,0,0,0];A.forEach(function(w,R){var I=w,H=v[R];_.forEach(function(C,M,B){if(I>C){B[M]=I,I=C;var L=T[M];T[M]=H,H=L}})}),v=T,A=_}for(;A.length<4;)A.push(0),v.push(0);for(var S=0;S<4;++S)p.push(A[S]),d.push(v[S])}if(t.normal){var b=getData(m,r,g,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(E=getData(m,r,g,t.material)[0],E<0&&(h.negativeMaterialIndices=!0,E=0)),t.uv&&t.uv.forEach(function(w,R){var I=getData(m,r,g,w);f[R]===void 0&&(f[R]=[]),f[R].push(I[0]),f[R].push(I[1])}),o++,y&&(h.genFace(e,t,u,E,l,c,f,p,d,o),r++,o=0,u=[],l=[],c=[],f=[],p=[],d=[])}),e},n.prototype.getNormalNewell=function(t){for(var e=new THREE__namespace.Vector3(0,0,0),r=0;r<t.length;r++){var o=t[r],s=t[(r+1)%t.length];e.x+=(o.y-s.y)*(o.z+s.z),e.y+=(o.z-s.z)*(o.x+s.x),e.z+=(o.x-s.x)*(o.y+s.y)}return e.normalize(),e},n.prototype.getNormalTangentAndBitangent=function(t){var e=this.getNormalNewell(t),r=Math.abs(e.z)>.5?new THREE__namespace.Vector3(0,1,0):new THREE__namespace.Vector3(0,0,1),o=r.cross(e).normalize(),s=e.clone().cross(o).normalize();return{normal:e,tangent:o,bitangent:s}},n.prototype.flattenVertex=function(t,e,r){return new THREE__namespace.Vector2(t.dot(e),t.dot(r))},n.prototype.genFace=function(t,e,r,o,s,u,l,c,f,p){var d;if(p>3){for(var h=[],g=e.baseVertexPositions||e.vertexPositions,m=0;m<r.length;m+=3)h.push(new THREE__namespace.Vector3(g[r[m]],g[r[m+1]],g[r[m+2]]));for(var E=this.getNormalTangentAndBitangent(h),y=E.tangent,v=E.bitangent,A=[],b=0,T=h;b<T.length;b++){var _=T[b];A.push(this.flattenVertex(_,y,v))}d=THREE__namespace.ShapeUtils.triangulateShape(A,[])}else d=[[0,1,2]];for(var S=function(B,L,O){t.vertex.push(e.vertexPositions[r[B*3]]),t.vertex.push(e.vertexPositions[r[B*3+1]]),t.vertex.push(e.vertexPositions[r[B*3+2]]),t.vertex.push(e.vertexPositions[r[L*3]]),t.vertex.push(e.vertexPositions[r[L*3+1]]),t.vertex.push(e.vertexPositions[r[L*3+2]]),t.vertex.push(e.vertexPositions[r[O*3]]),t.vertex.push(e.vertexPositions[r[O*3+1]]),t.vertex.push(e.vertexPositions[r[O*3+2]]),e.skeleton&&(t.vertexWeights.push(c[B*4]),t.vertexWeights.push(c[B*4+1]),t.vertexWeights.push(c[B*4+2]),t.vertexWeights.push(c[B*4+3]),t.vertexWeights.push(c[L*4]),t.vertexWeights.push(c[L*4+1]),t.vertexWeights.push(c[L*4+2]),t.vertexWeights.push(c[L*4+3]),t.vertexWeights.push(c[O*4]),t.vertexWeights.push(c[O*4+1]),t.vertexWeights.push(c[O*4+2]),t.vertexWeights.push(c[O*4+3]),t.weightsIndices.push(f[B*4]),t.weightsIndices.push(f[B*4+1]),t.weightsIndices.push(f[B*4+2]),t.weightsIndices.push(f[B*4+3]),t.weightsIndices.push(f[L*4]),t.weightsIndices.push(f[L*4+1]),t.weightsIndices.push(f[L*4+2]),t.weightsIndices.push(f[L*4+3]),t.weightsIndices.push(f[O*4]),t.weightsIndices.push(f[O*4+1]),t.weightsIndices.push(f[O*4+2]),t.weightsIndices.push(f[O*4+3])),e.color&&(t.colors.push(u[B*3]),t.colors.push(u[B*3+1]),t.colors.push(u[B*3+2]),t.colors.push(u[L*3]),t.colors.push(u[L*3+1]),t.colors.push(u[L*3+2]),t.colors.push(u[O*3]),t.colors.push(u[O*3+1]),t.colors.push(u[O*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(o),t.materialIndex.push(o),t.materialIndex.push(o)),e.normal&&(t.normal.push(s[B*3]),t.normal.push(s[B*3+1]),t.normal.push(s[B*3+2]),t.normal.push(s[L*3]),t.normal.push(s[L*3+1]),t.normal.push(s[L*3+2]),t.normal.push(s[O*3]),t.normal.push(s[O*3+1]),t.normal.push(s[O*3+2])),e.uv&&e.uv.forEach(function(k,D){t.uvs[D]===void 0&&(t.uvs[D]=[]),t.uvs[D].push(l[D][B*2]),t.uvs[D].push(l[D][B*2+1]),t.uvs[D].push(l[D][L*2]),t.uvs[D].push(l[D][L*2+1]),t.uvs[D].push(l[D][O*2]),t.uvs[D].push(l[D][O*2+1])})},w=0,R=d;w<R.length;w++){var I=R[w],H=I[0],C=I[1],M=I[2];S(H,C,M)}},n.prototype.addMorphTargets=function(t,e,r,o,s){if(o.length!==0){e.morphTargetsRelative=!0,e.morphAttributes.position=[];var u=this;o.forEach(function(l){l.rawTargets.forEach(function(c){var f=t.Objects.Geometry[c.geoID];f!==void 0&&u.genMorphGeometry(e,r,f,s,c.name)})})}},n.prototype.genMorphGeometry=function(t,e,r,o,s){for(var u=e.Vertices!==void 0?e.Vertices.a:[],l=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],c=r.Vertices!==void 0?r.Vertices.a:[],f=r.Indexes?r.Indexes.a:[],p=t.attributes.position.count*3,d=new Float32Array(p),h=0;h<f.length;h++){var g=f[h]*3;d[g]=c[h*3],d[g+1]=c[h*3+1],d[g+2]=c[h*3+2]}var m={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},E=this.genBuffers(m),y=new THREE__namespace.Float32BufferAttribute(E.vertex,3);y.name=s||r.attrName,y.applyMatrix4(o),t.morphAttributes.position.push(y)},n.prototype.parseNormals=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Normals.a,s=[];return r==="IndexToDirect"&&(t.NormalIndex?s=t.NormalIndex.a:t.NormalsIndex&&(s=t.NormalsIndex.a)),{dataSize:3,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseUVs=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.UV.a,s=[];return r==="IndexToDirect"&&(s=t.UVIndex.a),{dataSize:2,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseVertexColors=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Colors.a,s=[];r==="IndexToDirect"&&(s=t.ColorIndex.a);for(var u=0,l=new THREE__namespace.Color;u<o.length;u+=4)l.fromArray(o,u),l.toArray(o,u);return{dataSize:4,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseMaterialIndices=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var o=t.Materials.a,s=[],u=0;u<o.length;++u)s.push(u);return{dataSize:1,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseNurbsGeometry=function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new THREE__namespace.BufferGeometry;for(var r=e-1,o=t.KnotVector.a,s=[],u=t.Points.a,l=0,c=u.length;l<c;l+=4)s.push(new THREE__namespace.Vector4().fromArray(u,l));var f,p;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){f=r,p=o.length-1-f;for(var l=0;l<r;++l)s.push(s[l])}var d=new NURBSCurve(r,o,s,f,p),h=d.getPoints(s.length*12);return new THREE__namespace.BufferGeometry().setFromPoints(h)},n})(),AnimationParser=(function(){function n(){}return n.prototype.parse=function(t,e,r){var o=[],s=this.parseClips(t,e,r);if(s!==void 0)for(var u in s){var l=s[u],c=this.addClip(l,r);o.push(c)}return o},n.prototype.parseClips=function(t,e,r){if(t.Objects.AnimationCurve!==void 0){var o=this.parseAnimationCurveNodes(t);this.parseAnimationCurves(t,o,e);var s=this.parseAnimationLayers(t,o,e,r),u=this.parseAnimStacks(t,s,e);return u}},n.prototype.parseAnimationCurveNodes=function(t){var e=t.Objects.AnimationCurveNode,r=new Map;for(var o in e){var s=e[o];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){var u={id:s.id,attr:s.attrName,curves:{}};r.set(u.id,u)}}return r},n.prototype.parseAnimationCurves=function(t,e,r){var o=t.Objects.AnimationCurve;for(var s in o){var u={id:o[s].id,times:o[s].KeyTime.a.map(convertFBXTimeToSeconds),values:o[s].KeyValueFloat.a},l=r.get(u.id);if(l!==void 0){var c=l.parents[0].ID,f=l.parents[0].relationship,p=e.get(c);p&&(f.match(/X/)?p.curves.x=u:f.match(/Y/)?p.curves.y=u:f.match(/Z/)?p.curves.z=u:f.match(/DeformPercent/)&&e.has(c)&&(p.curves.morph=u))}}},n.prototype.parseAnimationLayers=function(t,e,r,o){var s=t.Objects.AnimationLayer,u=new Map,l=function(f){var p=[],d=r.get(parseInt(f));if(d!==void 0){var h=d.children;h.forEach(function(g,m){if(e.has(g.ID)){var E=e.get(g.ID);if(E.curves.x!==void 0||E.curves.y!==void 0||E.curves.z!==void 0){if(p[m]===void 0){var y=r.get(g.ID).parents.filter(function(R){return R.relationship!==void 0})[0].ID;if(y!==void 0){var v=t.Objects.Model[y.toString()];if(v===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",g);return}var A={modelName:v.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(v.attrName):"",ID:v.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new THREE__namespace.Matrix4,eulerOrder:"",preRotation:[0,0,0],postRotation:[0,0,0]};o.traverse(function(R){R.ID===v.id&&(A.transform=R.matrix,R.userData.transformData&&(A.eulerOrder=R.userData.transformData.eulerOrder))}),A.transform||(A.transform=new THREE__namespace.Matrix4),v.PreRotation&&(A.preRotation=v.PreRotation.value),v.PostRotation&&(A.postRotation=v.PostRotation.value),p[m]=A}}p[m]&&(p[m][E.attr]=E)}else if(E.curves.morph!==void 0){if(p[m]===void 0){var b=r.get(g.ID).parents.filter(function(I){return I.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,y=r.get(_).parents[0].ID,S=t.Objects.Model[y],w={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};p[m]=w}p[m][E.attr]=E}}}),u.set(parseInt(f),p)}};for(var c in s)l(c);return u},n.prototype.parseAnimStacks=function(t,e,r){var o=t.Objects.AnimationStack,s={};for(var u in o){var l=r.get(parseInt(u)).children;l.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var c=e.get(l[0].ID);s[u]={name:o[u].attrName,layer:c}}return s},n.prototype.addClip=function(t,e){var r=[],o=this;return t.layer.forEach(function(s){r=r.concat(o.generateTracks(s,e))}),new THREE__namespace.AnimationClip(t.name,-1,r)},n.prototype.generateTracks=function(t,e){var r=[],o=new THREE__namespace.Vector3,s=new THREE__namespace.Vector3;t.transform&&t.transform.decompose(o,new THREE__namespace.Quaternion,s);var u=o.toArray(),l=s.toArray();if(t.T!==void 0&&Object.keys(t.T.curves).length>0){var c=this.generateVectorTrack(t.modelName,t.T.curves,u,"position");c!==void 0&&r.push(c)}if(t.R!==void 0&&Object.keys(t.R.curves).length>0){var f=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);f!==void 0&&r.push(f)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){var p=this.generateVectorTrack(t.modelName,t.S.curves,l,"scale");p!==void 0&&r.push(p)}if(t.DeformPercent!==void 0){var d=this.generateMorphTrack(t,e);d!==void 0&&r.push(d)}return r},n.prototype.generateVectorTrack=function(t,e,r,o){var s=this.getTimesForAllAxes(e),u=this.getKeyframeTrackValues(s,e,r);return new THREE__namespace.VectorKeyframeTrack(t+"."+o,s,u)},n.prototype.generateRotationTrack=function(t,e,r,o,s){var u,l;if(e.x!==void 0&&e.y!==void 0&&e.z!==void 0){var c=this.interpolateRotations(e.x,e.y,e.z,s);u=c[0],l=c[1]}var f=getEulerOrder(0),p=new THREE__namespace.Quaternion,d=new THREE__namespace.Quaternion;r!==void 0&&(r=r.map(THREE__namespace.MathUtils.degToRad),r.push(f),p.setFromEuler(new THREE__namespace.Euler().fromArray(r))),o!==void 0&&(o=o.map(THREE__namespace.MathUtils.degToRad),o.push(f),d.setFromEuler(new THREE__namespace.Euler().fromArray(o)),d.inverse());var h=new THREE__namespace.Quaternion,g=new THREE__namespace.Euler,m=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var E=0;E<l.length;E+=3){if(g.set(l[E],l[E+1],l[E+2],s),h.setFromEuler(g),h.premultiply(p),h.multiply(d),E>2){var y=new THREE__namespace.Quaternion().fromArray(m,(E-3)/3*4);y.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(m,E/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,m)},n.prototype.generateMorphTrack=function(t,e){var r=t.DeformPercent.curves.morph,o=r.values.map(function(u){return u/100}),s=e.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new THREE__namespace.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+s+"]",r.times,o)},n.prototype.getTimesForAllAxes=function(t){var e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(l,c){return l-c}),e.length>1){for(var r=1,o=e[0],s=1;s<e.length;s++){var u=e[s];u!==o&&(e[r]=u,o=u,r++)}e=e.slice(0,r)}return e},n.prototype.getKeyframeTrackValues=function(t,e,r){var o=r,s=[],u=-1,l=-1,c=-1;return t.forEach(function(f){if(e.x&&(u=e.x.times.indexOf(f)),e.y&&(l=e.y.times.indexOf(f)),e.z&&(c=e.z.times.indexOf(f)),u!==-1){var p=e.x.values[u];s.push(p),o[0]=p}else s.push(o[0]);if(l!==-1){var d=e.y.values[l];s.push(d),o[1]=d}else s.push(o[1]);if(c!==-1){var h=e.z.values[c];s.push(h),o[2]=h}else s.push(o[2])}),s},n.prototype.interpolateRotations=function(t,e,r,o){var s=[],u=[];s.push(t.times[0]),u.push(THREE__namespace.MathUtils.degToRad(t.values[0])),u.push(THREE__namespace.MathUtils.degToRad(e.values[0])),u.push(THREE__namespace.MathUtils.degToRad(r.values[0]));for(var l=1;l<t.values.length;l++){var c=[t.values[l-1],e.values[l-1],r.values[l-1]];if(!(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))){var f=c.map(THREE__namespace.MathUtils.degToRad),p=[t.values[l],e.values[l],r.values[l]];if(!(isNaN(p[0])||isNaN(p[1])||isNaN(p[2]))){p.map(THREE__namespace.MathUtils.degToRad);var d=[p[0]-c[0],p[1]-c[1],p[2]-c[2]],h=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(h[0]>=180||h[1]>=180||h[2]>=180){var g=Math.max.apply(Math,h),m=g/180,E=new THREE__namespace.Euler(f[0],f[1],f[2],o),y=new THREE__namespace.Euler(f[0],f[1],f[2],o),v=new THREE__namespace.Quaternion().setFromEuler(E),A=new THREE__namespace.Quaternion().setFromEuler(y);v.dot(A)&&A.set(-A.x,-A.y,-A.z,-A.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,w=0;w<1;w+=1/m)_.copy(v.clone().slerp(A.clone(),w)),s.push(b+w*T),S.setFromQuaternion(_,o),u.push(S.x),u.push(S.y),u.push(S.z)}else s.push(t.times[l]),u.push(THREE__namespace.MathUtils.degToRad(t.values[l])),u.push(THREE__namespace.MathUtils.degToRad(e.values[l])),u.push(THREE__namespace.MathUtils.degToRad(r.values[l]))}}}return[s,u]},n})(),TextParser=(function(){function n(){this.allNodes=new FBXTree,this.nodeStack=[],this.currentIndent=0,this.currentPropName=""}return n.prototype.getPrevNode=function(){return this.nodeStack[this.currentIndent-2]},n.prototype.getCurrentNode=function(){return this.nodeStack[this.currentIndent-1]},n.prototype.getCurrentProp=function(){return this.currentProp},n.prototype.pushStack=function(t){this.nodeStack.push(t),this.currentIndent+=1},n.prototype.popStack=function(){this.nodeStack.pop(),this.currentIndent-=1},n.prototype.setCurrentProp=function(t,e){this.currentProp=t,this.currentPropName=e},n.prototype.parse=function(t){this.currentIndent=0,this.allNodes=new FBXTree,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach(function(o,s){var u=o.match(/^[\s\t]*;/),l=o.match(/^[\s\t]*$/);if(!(u||l)){var c=o.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){"),f=o.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),p=o.match("^\\t{"+(e.currentIndent-1)+"}}");c?e.parseNodeBegin(o,c):f?e.parseNodeProperty(o,f,r[++s]):p?e.popStack():o.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(o)}}),this.allNodes},n.prototype.parseNodeBegin=function(t,e){var r=e[1].trim().replace(/^"/,"").replace(/"$/,""),o=e[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},u=this.parseNodeAttr(o),l=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in l?(r==="PoseNode"?l.PoseNode.push(s):l[r].id!==void 0&&(l[r]={},l[r][l[r].id]=l[r]),u.id!==""&&(l[r][u.id]=s)):typeof u.id=="number"?(l[r]={},l[r][u.id]=s):r!=="Properties70"&&(r==="PoseNode"?l[r]=[s]:l[r]=s),typeof u.id=="number"&&(s.id=u.id),u.name!==""&&(s.attrName=u.name),u.type!==""&&(s.attrType=u.type),this.pushStack(s)},n.prototype.parseNodeAttr=function(t){var e=t[0];t[0]!==""&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",o="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),o=t[2]),{id:e,name:r,type:o}},n.prototype.parseNodeProperty=function(t,e,r){var o=e[1].replace(/^"/,"").replace(/"$/,"").trim(),s=e[2].replace(/^"/,"").replace(/"$/,"").trim();o==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());var u=this.getCurrentNode(),l=u.name;if(l==="Properties70"){this.parseNodeSpecialProperty(t,o,s);return}if(o==="C"){var c=s.split(",").slice(1),f=parseInt(c[0]),p=parseInt(c[1]),d=s.split(",").slice(3);d=d.map(function(h){return h.trim().replace(/^"/,"")}),o="connections",s=[f,p],append(s,d),u[o]===void 0&&(u[o]=[])}o==="Node"&&(u.id=s),o in u&&Array.isArray(u[o])?u[o].push(s):o!=="a"?u[o]=s:u.a=s,this.setCurrentProp(u,o),o==="a"&&s.slice(-1)!==","&&(u.a=parseNumberArray(s))},n.prototype.parseNodePropertyContinued=function(t){var e=this.getCurrentNode();e.a+=t,t.slice(-1)!==","&&(e.a=parseNumberArray(e.a))},n.prototype.parseNodeSpecialProperty=function(t,e,r){var o=r.split('",').map(function(p){return p.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=o[0],u=o[1],l=o[2],c=o[3],f=o[4];switch(u){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":f=parseFloat(f);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":f=parseNumberArray(f);break}this.getPrevNode()[s]={type:u,type2:l,flag:c,value:f},this.setCurrentProp(this.getPrevNode(),s)},n})(),BinaryParser=(function(){function n(){}return n.prototype.parse=function(t){var e=new BinaryReader(t);e.skip(23);var r=e.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var o=new FBXTree;!this.endOfContent(e);){var s=this.parseNode(e,r);s!==null&&o.add(s.name,s)}return o},n.prototype.endOfContent=function(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()},n.prototype.parseNode=function(t,e){var r={},o=e>=7500?t.getUint64():t.getUint32(),s=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();var u=t.getUint8(),l=t.getString(u);if(o===0)return null;for(var c=[],f=0;f<s;f++)c.push(this.parseProperty(t));var p=c.length>0?c[0]:"",d=c.length>1?c[1]:"",h=c.length>2?c[2]:"";for(r.singleProperty=s===1&&t.getOffset()===o;o>t.getOffset();){var g=this.parseNode(t,e);g!==null&&this.parseSubNode(l,r,g)}return r.propertyList=c,typeof p=="number"&&(r.id=p),d!==""&&(r.attrName=d),h!==""&&(r.attrType=h),l!==""&&(r.name=l),r},n.prototype.parseSubNode=function(t,e,r){if(r.singleProperty===!0){var o=r.propertyList[0];Array.isArray(o)?(e[r.name]=r,r.a=o):e[r.name]=o}else if(t==="Connections"&&r.name==="C"){var s=[];r.propertyList.forEach(function(h,g){g!==0&&s.push(h)}),e.connections===void 0&&(e.connections=[]),e.connections.push(s)}else if(r.name==="Properties70"){var u=Object.keys(r);u.forEach(function(h){e[h]=r[h]})}else if(t==="Properties70"&&r.name==="P"){var l=r.propertyList[0],c=r.propertyList[1],f=r.propertyList[2],p=r.propertyList[3],d=void 0;l.indexOf("Lcl ")===0&&(l=l.replace("Lcl ","Lcl_")),c.indexOf("Lcl ")===0&&(c=c.replace("Lcl ","Lcl_")),c==="Color"||c==="ColorRGB"||c==="Vector"||c==="Vector3D"||c.indexOf("Lcl_")===0?d=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:d=r.propertyList[4],e[l]={type:c,type2:f,flag:p,value:d}}else e[r.name]===void 0?typeof r.id=="number"?(e[r.name]={},e[r.name][r.id]=r):e[r.name]=r:r.name==="PoseNode"?(Array.isArray(e[r.name])||(e[r.name]=[e[r.name]]),e[r.name].push(r)):e[r.name][r.id]===void 0&&(e[r.name][r.id]=r)},n.prototype.parseProperty=function(t){var e=t.getString(1),r;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return r=t.getUint32(),t.getArrayBuffer(r);case"S":return r=t.getUint32(),t.getString(r);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var o=t.getUint32(),s=t.getUint32(),u=t.getUint32();if(s===0)switch(e){case"b":case"c":return t.getBooleanArray(o);case"d":return t.getFloat64Array(o);case"f":return t.getFloat32Array(o);case"i":return t.getInt32Array(o);case"l":return t.getInt64Array(o)}var l=unzlibSync(new Uint8Array(t.getArrayBuffer(u))),c=new BinaryReader(l.buffer);switch(e){case"b":case"c":return c.getBooleanArray(o);case"d":return c.getFloat64Array(o);case"f":return c.getFloat32Array(o);case"i":return c.getInt32Array(o);case"l":return c.getInt64Array(o)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}},n})(),BinaryReader=(function(){function n(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0,this._textDecoder=new TextDecoder}return n.prototype.getOffset=function(){return this.offset},n.prototype.size=function(){return this.dv.buffer.byteLength},n.prototype.skip=function(t){this.offset+=t},n.prototype.getBoolean=function(){return(this.getUint8()&1)===1},n.prototype.getBooleanArray=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e},n.prototype.getUint8=function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t},n.prototype.getInt16=function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},n.prototype.getInt32=function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e},n.prototype.getUint32=function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e&2147483648?(e=~e&4294967295,t=~t&4294967295,t===4294967295&&(e=e+1&4294967295),t=t+1&4294967295,-(e*4294967296+t)):e*4294967296+t},n.prototype.getInt64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e},n.prototype.getUint64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e*4294967296+t},n.prototype.getFloat32=function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getFloat32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e},n.prototype.getFloat64=function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},n.prototype.getFloat64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e},n.prototype.getArrayBuffer=function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},n.prototype.getString=function(t){var e=this.offset,r=new Uint8Array(this.dv.buffer,e,t);this.skip(t);var o=r.indexOf(0);return o>=0&&(r=new Uint8Array(this.dv.buffer,e,o)),this._textDecoder.decode(r)},n})(),FBXTree=(function(){function n(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}return n.prototype.add=function(t,e){this[t]=e},n})();function isFbxFormatBinary(n){var t="Kaydara FBX Binary \0";return n.byteLength>=t.length&&t===convertArrayBufferToString(n,0,t.length)}function isFbxFormatASCII(n){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],e=0;function r(u){var l=n[u-1];return n=n.slice(e+u),e++,l}for(var o=0;o<t.length;++o){var s=r(1);if(s===t[o])return!1}return!0}function getFbxVersion(n){var t=/FBXVersion: (\d+)/,e=n.match(t);if(e){var r=parseInt(e[1]);return r}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function convertFBXTimeToSeconds(n){return n/46186158e3}var dataArray=[];function getData(n,t,e,r){var o;switch(r.mappingType){case"ByPolygonVertex":o=n;break;case"ByPolygon":o=t;break;case"ByVertice":o=e;break;case"AllSame":o=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType),o=0}r.referenceType==="IndexToDirect"&&(o=r.indices[o]);var s=o*r.dataSize,u=s+r.dataSize;return slice(dataArray,r.buffer,s,u)}var tempEuler=new THREE__namespace.Euler,tempVec=new THREE__namespace.Vector3;function generateTransform(n){var t=new THREE__namespace.Matrix4,e=new THREE__namespace.Matrix4,r=new THREE__namespace.Matrix4,o=new THREE__namespace.Matrix4,s=new THREE__namespace.Matrix4,u=new THREE__namespace.Matrix4,l=new THREE__namespace.Matrix4,c=new THREE__namespace.Matrix4,f=new THREE__namespace.Matrix4,p=new THREE__namespace.Matrix4,d=new THREE__namespace.Matrix4,h=new THREE__namespace.Matrix4,g=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var m=getEulerOrder(0);if(n.preRotation){var E=n.preRotation.map(THREE__namespace.MathUtils.degToRad);E.push(m),e.makeRotationFromEuler(tempEuler.fromArray(E))}if(n.rotation){var E=n.rotation.map(THREE__namespace.MathUtils.degToRad);E.push(n.eulerOrder||m),r.makeRotationFromEuler(tempEuler.fromArray(E))}if(n.postRotation){var E=n.postRotation.map(THREE__namespace.MathUtils.degToRad);E.push(m),o.makeRotationFromEuler(tempEuler.fromArray(E)),o.copy(new THREE__namespace.Matrix4().getInverse(o))}n.scale&&s.scale(tempVec.fromArray(n.scale)),n.scalingOffset&&l.setPosition(tempVec.fromArray(n.scalingOffset)),n.scalingPivot&&u.setPosition(tempVec.fromArray(n.scalingPivot)),n.rotationOffset&&c.setPosition(tempVec.fromArray(n.rotationOffset)),n.rotationPivot&&f.setPosition(tempVec.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(d.copy(n.parentMatrix),p.copy(n.parentMatrixWorld));var y=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(p);var A=new THREE__namespace.Matrix4;A.copyPosition(p);var b=new THREE__namespace.Matrix4().getInverse(A).multiply(p),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(g===0)S.copy(v).multiply(y).multiply(T).multiply(_);else if(g===1)S.copy(v).multiply(T).multiply(y).multiply(_);else{var w=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),R=new THREE__namespace.Matrix4().getInverse(w),I=T.clone().multiply(R);S.copy(v).multiply(y).multiply(I).multiply(_)}var H=new THREE__namespace.Matrix4().getInverse(f),C=new THREE__namespace.Matrix4().getInverse(u),M=t.clone().multiply(c).multiply(f).multiply(e).multiply(r).multiply(o).multiply(H).multiply(l).multiply(u).multiply(s).multiply(C),B=new THREE__namespace.Matrix4().copyPosition(M),L=p.clone().multiply(B);return h.copyPosition(L),M=h.clone().multiply(S),M.premultiply(new THREE__namespace.Matrix4().getInverse(p)),M}function getEulerOrder(n){n=n||0;var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return n===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[n]}function parseNumberArray(n){var t=n.split(",").map(function(e){return parseFloat(e)});return t}function convertArrayBufferToString(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=n.byteLength),new TextDecoder().decode(new Uint8Array(n,t,e))}function append(n,t){for(var e=0,r=n.length,o=t.length;e<o;e++,r++)n[r]=t[e]}function slice(n,t,e,r){for(var o=e,s=0;o<r;o++,s++)n[s]=t[o];return n}var NURBSCurve=(function(n){__extends(t,n);function t(e,r,o,s,u){var l=n.call(this)||this,c=r?r.length-1:0,f=o?o.length:0;l.degree=e,l.knots=r,l.controlPoints=[],l.startKnot=s||0,l.endKnot=u||c;for(var p=0;p<f;++p){var d=o[p];l.controlPoints[p]=new THREE__namespace.Vector4(d.x,d.y,d.z,d.w)}return l}return t.prototype.getPoint=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),u=calcBSplinePoint(this.degree,this.knots,this.controlPoints,s);return u.w!==1&&u.divideScalar(u.w),o.set(u.x,u.y,u.z)},t.prototype.getTangent=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),u=calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,s,1);return o.copy(u[1]).normalize(),o},t.prototype.toJSON=function(){var e=n.prototype.toJSON.call(this);return e.degree=this.degree,e.knots=__spreadArray([],this.knots,!0),e.controlPoints=this.controlPoints.map(function(r){return r.toArray()}),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e},t.prototype.fromJSON=function(e){return n.prototype.fromJSON.call(this,e),this.degree=e.degree,this.knots=__spreadArray([],e.knots,!0),this.controlPoints=e.controlPoints.map(function(r){return new THREE__namespace.Vector4(r[0],r[1],r[2],r[3])}),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this},t})(THREE__namespace.Curve);function findSpan(n,t,e){var r=e.length-n-1;if(t>=e[r])return r-1;if(t<=e[n])return n;for(var o=n,s=r,u=Math.floor((o+s)/2);t<e[u]||t>=e[u+1];)t<e[u]?s=u:o=u,u=Math.floor((o+s)/2);return u}function calcBasisFunctions(n,t,e,r){var o=[],s=[],u=[];o[0]=1;for(var l=1;l<=e;++l){s[l]=t-r[n+1-l],u[l]=r[n+l]-t;for(var c=0,f=0;f<l;++f){var p=u[f+1],d=s[l-f],h=o[f]/(p+d);o[f]=c+p*h,c=d*h}o[l]=c}return o}function calcBSplinePoint(n,t,e,r){for(var o=findSpan(n,r,t),s=calcBasisFunctions(o,r,n,t),u=new THREE__namespace.Vector4(0,0,0,0),l=0;l<=n;++l){var c=e[o-n+l],f=s[l],p=c.w*f;u.x+=c.x*p,u.y+=c.y*p,u.z+=c.z*p,u.w+=c.w*f}return u}function calcBasisFunctionDerivatives(n,t,e,r,o){for(var s=[],u=0;u<=e;++u)s[u]=0;for(var l=[],u=0;u<=r;++u)l[u]=s.slice(0);for(var c=[],u=0;u<=e;++u)c[u]=s.slice(0);c[0][0]=1;for(var f=s.slice(0),p=s.slice(0),d=1;d<=e;++d){f[d]=t-o[n+1-d],p[d]=o[n+d]-t;for(var h=0,g=0;g<d;++g){var m=p[g+1],E=f[d-g];c[d][g]=m+E;var y=c[g][d-1]/c[d][g];c[g][d]=h+m*y,h=E*y}c[d][d]=h}for(var d=0;d<=e;++d)l[0][d]=c[d][e];for(var v=0;v<=e;++v){for(var A=0,b=1,T=[],u=0;u<=e;++u)T[u]=s.slice(0);T[0][0]=1;for(var _=1;_<=r;++_){var S=0,w=v-_,R=e-_;v>=_&&(T[b][0]=T[A][0]/c[R+1][w],S=T[b][0]*c[w][R]);for(var I=w>=-1?1:-w,H=v-1<=R?_-1:e-v,C=I;C<=H;++C)T[b][C]=(T[A][C]-T[A][C-1])/c[R+1][w+C],S+=T[b][C]*c[w+C][R];v<=R&&(T[b][_]=-T[A][_-1]/c[R+1][v],S+=T[b][_]*c[v][R]),l[_][v]=S;var d=A;A=b,b=d}}for(var M=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=M;M*=e-_}return l}function calcBSplineDerivatives(n,t,e,r,o){for(var s=o<n?o:n,u=[],l=findSpan(n,r,t),c=calcBasisFunctionDerivatives(l,r,n,s,t),f=[],p=0;p<e.length;++p){var d=e[p].clone(),h=d.w;d.x*=h,d.y*=h,d.z*=h,f[p]=d}for(var g=0;g<=s;++g){for(var d=f[l-n].clone().multiplyScalar(c[g][0]),m=1;m<=n;++m)d.add(f[l-n+m].clone().multiplyScalar(c[g][m]));u[g]=d}for(var g=s+1;g<=o+1;++g)u[g]=new THREE__namespace.Vector4(0,0,0);return u}function calcKoverI(n,t){for(var e=1,r=2;r<=n;++r)e*=r;for(var o=1,r=2;r<=t;++r)o*=r;for(var r=2;r<=n-t;++r)o*=r;return e/o}function calcRationalCurveDerivatives(n){for(var t=n.length,e=[],r=[],o=0;o<t;++o){var s=n[o];e[o]=new THREE__namespace.Vector3(s.x,s.y,s.z),r[o]=s.w}for(var u=[],l=0;l<t;++l){for(var c=e[l].clone(),o=1;o<=l;++o)c.sub(u[l-o].clone().multiplyScalar(calcKoverI(l,o)*r[o]));u[l]=c.divideScalar(r[0])}return u}function calcNURBSDerivatives(n,t,e,r,o){var s=calcBSplineDerivatives(n,t,e,r,o);return calcRationalCurveDerivatives(s)}var _vector=new THREE__namespace.Vector3;function getPointArray(n,t){switch(t){case"D":return new Float64Array(n);case"F":return new Float32Array(n);case"L":return new Int32Array(n);case"I":return new Int16Array(n);default:return new Uint8Array(n)}}function loadX3p(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){var c,f;return u.byteLength=l.body.byteLength,parse$1(new Uint8Array(l.body),{light:(c=t.light)!==null&&c!==void 0?c:!0,color:t.color,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(f=n.split("?")[1])!==null&&f!==void 0?f:""})}).then(function(l){var c=new THREE__namespace.Group;return c.name=n,c.add(l.object),o==="Y"&&c.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"x3p",modelUpAxis:"Z",upAxis:o,uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:[],animations:[],dispose:function(){return l.dispose()}}})}function parse$1(n,t){for(var e,r,o,s,u,l,c,f,p,d,h,g,m,E,y,v,A,b,T,_,S,w,R,I,H,C,M,B,L,O,k,D,q,z,V,Q,U,j,G,ae,re,$,ee,K,se,W,X,te,Z,ne,pe,ie,ue,be,oe=unzipSync(n),le="",me=null,ge=0,Ae=Object.keys(oe);ge<Ae.length;ge++){var xe=Ae[ge];/(^|\/)main\.xml$/i.test(xe)&&(me=oe[xe],le=xe.slice(0,xe.lastIndexOf("/")+1))}if(!me)throw new Error("X3p: main.xml not found.");if(typeof DOMParser=="undefined")throw new Error("X3p: DOMParser not found.");var he=(e=t.color)!==null&&e!==void 0?e:new THREE__namespace.Color(10066329),_e=new DOMParser,He=decodeText(me),Ee=_e.parseFromString(He,"text/xml"),de=Ee.querySelector("Record1 Axes"),Ve={x:{type:(s=(o=(r=de==null?void 0:de.querySelector("CX AxisType"))===null||r===void 0?void 0:r.textContent)===null||o===void 0?void 0:o.toUpperCase())!==null&&s!==void 0?s:"I",dataType:(c=(l=(u=de==null?void 0:de.querySelector("CX DataType"))===null||u===void 0?void 0:u.textContent)===null||l===void 0?void 0:l.toUpperCase())!==null&&c!==void 0?c:"D",increment:Number((p=(f=de==null?void 0:de.querySelector("CX Increment"))===null||f===void 0?void 0:f.textContent)!==null&&p!==void 0?p:"1"),offset:Number((h=(d=de==null?void 0:de.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(E=(m=(g=de==null?void 0:de.querySelector("CY AxisType"))===null||g===void 0?void 0:g.textContent)===null||m===void 0?void 0:m.toUpperCase())!==null&&E!==void 0?E:"I",dataType:(A=(v=(y=de==null?void 0:de.querySelector("CY DataType"))===null||y===void 0?void 0:y.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&A!==void 0?A:"D",increment:Number((T=(b=de==null?void 0:de.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=de==null?void 0:de.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(I=(R=(w=de==null?void 0:de.querySelector("CZ AxisType"))===null||w===void 0?void 0:w.textContent)===null||R===void 0?void 0:R.toUpperCase())!==null&&I!==void 0?I:"A",dataType:(M=(C=(H=de==null?void 0:de.querySelector("CZ DataType"))===null||H===void 0?void 0:H.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&M!==void 0?M:"D",increment:Number((L=(B=de==null?void 0:de.querySelector("CZ Increment"))===null||B===void 0?void 0:B.textContent)!==null&&L!==void 0?L:"1"),offset:Number((k=(O=de==null?void 0:de.querySelector("CZ Offset"))===null||O===void 0?void 0:O.textContent)!==null&&k!==void 0?k:"0")}},ye=null,Pe=Ee.querySelector("Record1 Axes Rotation");Pe&&(ye=new THREE__namespace.Matrix3,ye.set(Number((q=(D=Pe.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&q!==void 0?q:0),Number((V=(z=Pe.querySelector("r12"))===null||z===void 0?void 0:z.textContent)!==null&&V!==void 0?V:0),Number((U=(Q=Pe.querySelector("r13"))===null||Q===void 0?void 0:Q.textContent)!==null&&U!==void 0?U:0),Number((G=(j=Pe.querySelector("r21"))===null||j===void 0?void 0:j.textContent)!==null&&G!==void 0?G:0),Number((re=(ae=Pe.querySelector("r22"))===null||ae===void 0?void 0:ae.textContent)!==null&&re!==void 0?re:0),Number((ee=($=Pe.querySelector("r23"))===null||$===void 0?void 0:$.textContent)!==null&&ee!==void 0?ee:0),Number((se=(K=Pe.querySelector("r31"))===null||K===void 0?void 0:K.textContent)!==null&&se!==void 0?se:0),Number((X=(W=Pe.querySelector("r32"))===null||W===void 0?void 0:W.textContent)!==null&&X!==void 0?X:0),Number((Z=(te=Pe.querySelector("r33"))===null||te===void 0?void 0:te.textContent)!==null&&Z!==void 0?Z:0)));var Ce=(ne=Ee.querySelector("Record3 DataLink PointDataLink"))===null||ne===void 0?void 0:ne.textContent;if(typeof Ce!="string")throw new Error("X3p: PointDataLink not found.");Ce=pathJoin(le,Ce);var $e=oe[Ce];if(!$e)throw new Error("X3p: ".concat($e," not found."));for(var Se=getPointArray($e.buffer,Ve.z.dataType),ze=Number((ie=(pe=Ee.querySelector("Record3 MatrixDimension SizeX"))===null||pe===void 0?void 0:pe.textContent)!==null&&ie!==void 0?ie:"0"),Fe=Number((be=(ue=Ee.querySelector("Record3 MatrixDimension SizeY"))===null||ue===void 0?void 0:ue.textContent)!==null&&be!==void 0?be:"0"),Oe=Math.floor(ze-1),Le=Math.floor(Fe-1),Ue=Oe+1,tt=Le+1,lt=new Float32Array(Ue*tt*3),nt=new Float32Array(Ue*tt*2),ot=new Uint32Array(Oe*Le*6),At=new THREE__namespace.Box3,We=0;We<tt;We++)for(var Mt=We*Ve.y.increment+Ve.y.offset,Be=0;Be<Ue;Be++){var Ne=We*Ue+Be,bt=Be*Ve.x.increment+Ve.x.offset,Ct=Se[Ne],xt=!isNaN(Ct),yt=xt?Ct:NaN;_vector.set(bt,-Mt,yt),ye&&_vector.applyMatrix3(ye),xt&&At.expandByPoint(_vector),lt[Ne*3+0]=_vector.x,lt[Ne*3+1]=_vector.y,lt[Ne*3+2]=_vector.z,nt[Ne*2+0]=Be/Oe,nt[Ne*2+1]=1-We/Le}for(var We=0;We<Le;We++)for(var Be=0;Be<Oe;Be++){var St=Be+Ue*We,rt=Be+Ue*(We+1),at=Be+1+Ue*(We+1),ct=Be+1+Ue*We,Xe=(We*Oe+Be)*6;ot[Xe+0]=St,ot[Xe+1]=rt,ot[Xe+2]=ct,ot[Xe+3]=rt,ot[Xe+4]=at,ot[Xe+5]=ct}var fe=new THREE__namespace.BufferGeometry;fe.setAttribute("position",new THREE__namespace.BufferAttribute(lt,3)),fe.setAttribute("uv",new THREE__namespace.BufferAttribute(nt,2)),fe.setIndex(new THREE__namespace.BufferAttribute(ot,1)),(!fe.groups||fe.groups.length===0)&&fe.addGroup(0,fe.index?fe.index.count:fe.attributes.position.count,0),fe.boundingBox=At;var we=new PBMMeshMaterial(t.light?"phong":"basic");we.flatShading=!0,we.color.copy(he);var Me=new PBMMesh(fe,[we]);return{object:Me,dispose:function(){fe.dispose(),we.dispose()}}}var VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,identityMatrix4$1=new THREE__namespace.Matrix4().identity(),scratchVector=new THREE__namespace.Vector3,scratchMatrix4$5=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3$1=new THREE__namespace.Box3,scratchSphere$2=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$5.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=(function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$5.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$5),this.setFromFrustum(scratchFrustum),this},n.prototype.applyMatrix4=function(t){for(var e=0,r=this.planes;e<r.length;e++){var o=r[e];o.applyMatrix4(t)}},n.prototype.copy=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,o=this.planes;r<o.length;r++){var s=o[r],u=t.intersectPlane(s);switch(u){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,o=Math.min(32,this.planes.length),s=0;s<o;++s){var u=1<<s;if((e&u)!==0){var l=this.planes[s],c=t.intersectPlane(l);if(c===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=u)}}return r},n})(),BoxBoundingVolume=(function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],o=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],p=e[10],d=e[11],h=Math.max(Math.sqrt(r*r+o*o+s*s),.001),g=Math.max(Math.sqrt(u*u+l*l+c*c),.001),m=Math.max(Math.sqrt(f*f+p*p+d*d),.001);this.halfSize.set(h,g,m);var E=this.halfSize.toArray().reduce(function(y,v){return y+v},0);return(isNaN(E)||E<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/g,l/g,c/g,f/m,p/m,d/m]),isNaN(this.rotation.toArray().reduce(function(y,v){return y+v},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return t.equals(identityMatrix4$1)?this:(scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$5.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this)},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.rotation.elements,r=t.x-this.center.x,o=t.y-this.center.y,s=t.z-this.center.z,u=0,l;return l=r*e[0]+o*e[1]+s*e[2],l<0&&(l=-l),l-=this.halfSize.x,l>0&&(u+=l*l),l=r*e[3]+o*e[4]+s*e[5],l<0&&(l=-l),l-=this.halfSize.y,l>0&&(u+=l*l),l=r*e[6]+o*e[7]+s*e[8],l<0&&(l=-l),l-=this.halfSize.z,l>0&&(u+=l*l),u},n.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSquaredToPoint(t))},n.prototype.distanceToPlane=function(t){var e=t.projectPoint(this.center,new THREE__namespace.Vector3);return this.distanceToPoint(e)},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),e=new Float32Array(24);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,o=this.rotation.elements,s=this.halfSize,u=r.x,l=r.y,c=r.z,f=Math.abs(u*o[0]*s.x+l*o[1]*s.x+c*o[2]*s.x)+Math.abs(u*o[3]*s.y+l*o[4]*s.y+c*o[5]*s.y)+Math.abs(u*o[6]*s.z+l*o[7]*s.z+c*o[8]*s.z),p=r.dot(e)+t.constant;return p<=-f?VolumePlaneIntersect.Outside:p>=f?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e,r){if(e===void 0&&(e=0),scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3$1.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),scratchBox3$1.expandByScalar(e),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$5),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3$1.containsPoint(scratchRay$1.origin))return!0;var o=scratchRay$1.intersectBox(scratchBox3$1,scratchVector);return o?r!==void 0?(r+=e,o.distanceToSquared(scratchRay$1.origin)<=r*r):!0:!1},n})(),SphereBoundingVolume=(function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+Math.sin(o)*this.radius,e[r*6+2]=this.center.z+0,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+Math.sin(o)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(o)*this.radius,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(o)*this.radius}var s=new THREE__namespace.BufferGeometry;return s.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),s.computeBoundingBox(),s.computeBoundingSphere(),s},n.prototype.applyMatrix4=function(t){return t.equals(identityMatrix4$1)?this:(this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this)},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.distanceToPoint(t);return e*e},n.prototype.distanceToPoint=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.distanceToPlane=function(t){var e=Math.abs(t.distanceToPoint(this.center));return Math.max(0,e-this.radius)},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,o=t.normal,s=o.dot(e)+t.constant;return s<-r?VolumePlaneIntersect.Outside:s<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e,r){if(e===void 0&&(e=0),scratchSphere$2.set(this.center,this.radius+e),scratchSphere$2.containsPoint(t.origin))return!0;var o=t.intersectSphere(scratchSphere$2,scratchVector);return o?r!==void 0?(r+=e,t.origin.distanceToSquared(o)<=r*r):!0:!1},n})(),RegionBoundingVolume=(function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceToPlane=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r){throw new Error("not implemented")},n})();function isBoundingVolume(n){return n instanceof BoxBoundingVolume||n instanceof SphereBoundingVolume||n instanceof RegionBoundingVolume}function makeBoundingVolume(n){if(isBoundingVolume(n))return n;if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})}),debugBoxGeometry=(function(){var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e})(),debugSphereGeometry=(function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o})();function createDebugBoundingMesh(n,t){if(t===void 0&&(t=0),n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}return null}var scratchVector3$a=new THREE__namespace.Vector3,scratchPlane=new THREE__namespace.Plane,scratchSphereBoundingVolume$1=new SphereBoundingVolume,scratchBoxBoundingVolume$1=new BoxBoundingVolume,Tile=(function(){function n(t,e,r,o){var s=this,u,l,c,f;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,centerScreenY:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=o!=null?o:null,this.contentParent=o?o.hasRenderContent?o:o.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(u=e.refine)!==null&&u!==void 0?u:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(l=this.parent)===null||l===void 0?void 0:l.geometricError)!==null&&c!==void 0?c:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,byteLength:0,memoryUsage:0},e.content.group!==void 0&&(this.content.group=e.content.group),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type==="SCENEGRAPH"&&(this.levelOfContent=this.levelOfContent+1),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(f=e.extras)!==null&&f!==void 0?f:{},typeof this.extras.floor!="number"&&o&&typeof o.extras.floor=="number"&&(this.extras.floor=o.extras.floor),typeof this.extras.floor=="number"&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),e.children?this.children=e.children.map(function(p,d){return new n("".concat(s.id,".").concat(d),p,r,s)}):this.children=[]}return n.prototype.traverse=function(t){t(this);for(var e=0,r=this.children;e<r.length;e++){var o=r[e];o.traverse(t)}},n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transform;if(this.boundingVolume){var r=void 0;this.boundingVolume instanceof BoxBoundingVolume?r=scratchBoxBoundingVolume$1.copy(this.boundingVolume):this.boundingVolume instanceof SphereBoundingVolume?r=scratchSphereBoundingVolume$1.copy(this.boundingVolume):r=this.boundingVolume.clone(),r.applyMatrix4(e),t.camera.type==="OrthographicCamera"?(scratchPlane.setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position),this.state.distanceToCamera=r.distanceToPlane(scratchPlane)):this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var o=r.getCenter(scratchVector3$a).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(o),this.state.centerScreenY=t.camera.up.dot(o);var s=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,s),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,t.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if((this.levelOfContent<=t.minLevelOfDetail||this.geometricError>=t.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){var u=void 0;this.viewerRequestVolume instanceof BoxBoundingVolume?u=scratchBoxBoundingVolume$1.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof SphereBoundingVolume?u=scratchSphereBoundingVolume$1.copy(this.viewerRequestVolume):u=this.viewerRequestVolume.clone(),u.applyMatrix4(e),this.state.inRequestVolume=u.distanceSquaredToPoint(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentMemoryUsage",{get:function(){return this.content?this.content.memoryUsage:0},enumerable:!1,configurable:!0}),n.prototype.getScreenSpaceError=function(t,e,r){var o=this.tileset.transform.getMaxScaleOnAxis(),s=this.parent?this.parent.geometricError:this.tileset.geometricError,u=o*(r?s:this.geometricError);if(u===0)return 0;var l=t.height,c=t.sseDenominator;if(t.camera.type==="OrthographicCamera"){var f=t.camera.projectionMatrix.elements,p=1/(f[5]/2),d=.9,h=p/l*d,g=u/h;return g}else{var m=Math.max(e,.001),h=m*c/l,g=u/h;return g}},n.prototype.getPriority=function(t){var e=this.refine==="ADD"||t.skipLevelOfDetail;if(e&&!this.state.visible||t.frameNumber-this.state.touchedFrameNumber>=1)return-1;var r=this.parent,o=r&&(!e||this.state.screenSpaceError===0),s=o?r.state.screenSpaceError:this.state.screenSpaceError,u=this.tileset.root?this.tileset.root.state.screenSpaceError:0,l=Math.max(u-s,0);return l},n})(),defaultIterator=function(n){return Number(n)};function arrayMin(n,t,e){var r;t===void 0&&(t=defaultIterator),e===void 0&&(e=!1);for(var o,s=1/0,u=0,l=n;u<l.length;u++){var c=l[u],f=t(c);f<=s&&(r=[c,f],o=r[0],s=r[1])}return isFinite(s)||(s=0),e?[o,s]:o}function arrayEqual(n,t,e){e===void 0&&(e=function(s,u){return s===u});var r=n.length;if(r!==t.length)return!1;for(var o=0;o<r;o++)if(e(n[o],t[o])===!1)return!1;return!0}var arrayUniqueSet=new Set;function arrayUnique(n){arrayUniqueSet.clear();for(var t=[],e=n.length,r=0;r<e;r++){var o=n[r];arrayUniqueSet.has(o)||(t.push(o),arrayUniqueSet.add(o))}return arrayUniqueSet.clear(),t}var arrayMinCallback=function(n){return n.distance},intersectDistanceSortCallback=function(n,t){return n.distance-t.distance};function sortIntersects(n,t,e){if(t===void 0&&(t=!0),e===void 0&&(e=!1),e&&n.length>1){var r=arrayMin(n,arrayMinCallback);r?(n[0]=r,n.length=1):n.length=0}return t&&n.length>1&&n.sort(intersectDistanceSortCallback),n}var BVHObject=(function(){function n(t,e){this.position=t,this.indices=e}return n.prototype.getPositionCount=function(){var t,e,r=this.indices,o=this.position;return r?r.array.length/((t=r.stride)!==null&&t!==void 0?t:1):o.array.length/((e=o.stride)!==null&&e!==void 0?e:3)},n.prototype.getPositionByIndex=function(t,e){var r,o,s,u,l=this.indices,c=this.position,f=t;if(l){var p=l.array,d=(r=l.stride)!==null&&r!==void 0?r:1,h=(o=l.offset)!==null&&o!==void 0?o:0;f=p[t*d+h]}var g=c.array,m=(s=c.stride)!==null&&s!==void 0?s:3,E=(u=c.offset)!==null&&u!==void 0?u:0;return f=f*m+E,e.x=g[f],e.y=g[f+1],e.z=g[f+2],e},n.prototype.createTree=function(t,e,r){throw new Error("not implemented")},n.prototype.trianglesInSphere=function(t,e){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r,o,s){throw new Error("not implemented")},n})(),BVHNode=(function(){function n(t,e,r,o,s){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=o,this.deepth=s}return n})(),BYTES_PER_NODE=36;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),o=new Uint32Array(e),s=new Uint16Array(e),u=[n],l,c;l=u.pop();)c=l.id*BYTES_PER_NODE/4,r[c]=l.extents[0],r[c+1]=l.extents[1],r[c+2]=l.extents[2],r[c+3]=l.extents[3],r[c+4]=l.extents[4],r[c+5]=l.extents[5],o[c+6]=l.startIndex,o[c+7]=l.endIndex,c=l.id*BYTES_PER_NODE/2,l.node0&&(s[c+16]=l.node0.id,u.push(l.node0)),l.node1&&(s[c+17]=l.node1.id,u.push(l.node1));return e}function intersectNodeBox(n,t,e,r){r===void 0&&(r=0);var o=e.min.x-r,s=e.min.y-r,u=e.min.z-r,l=e.max.x+r,c=e.max.y+r,f=e.max.z+r,p=0,d=0,h=0,g=0,m=0,E=0;return t.x>=0?(p=(o-n.x)*t.x,d=(l-n.x)*t.x):(p=(l-n.x)*t.x,d=(o-n.x)*t.x),t.y>=0?(h=(s-n.y)*t.y,g=(c-n.y)*t.y):(h=(c-n.y)*t.y,g=(s-n.y)*t.y),p>g||h>d||((h>p||p!==p)&&(p=h),(g<d||d!==d)&&(d=g),t.z>=0?(m=(u-n.z)*t.z,E=(f-n.z)*t.z):(m=(f-n.z)*t.z,E=(u-n.z)*t.z),p>E||m>d)||((m>p||p!==p)&&(p=m),(E<d||d!==d)&&(d=E),d<0)?null:p>=0?p:d}var BVHVector3=(function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,o=this.z;return this.x=r*t.z-o*t.y,this.y=o*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,o=t.y,s=t.z,u=e.x,l=e.y,c=e.z;return this.x=o*c-s*l,this.y=s*u-r*c,this.z=r*l-o*u,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,o=this.z-t.z;return e*e+r*r+o*o},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n})(),BVHIntersect=(function(){function n(t,e,r,o,s){this.pointA=t,this.pointB=e,this.pointC=r,this.index=o,this.intersectionPoint=s}return n})(),BVHBox3=(function(){function n(t,e){this.min=t,this.max=e}return n})(),EPSILON$1=1e-6,scratchVector3$9=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionCount()/3,u=s>65535?new Uint32Array(s):new Uint16Array(s),l=new Float32Array(s*6),c=[],f=0,p=-1;if(o)for(var d=0;d<s;d+=1){var h=d*3,g=d*6,m=void 0,E=void 0,y=void 0,v=void 0,A=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),m=v=scratchVector3A.x,T=scratchVector3B.x,T<m&&(m=T),T>v&&(v=T),T=scratchVector3C.x,T<m&&(m=T),T>v&&(v=T),E=A=scratchVector3A.y,T=scratchVector3B.y,T<E&&(E=T),T>A&&(A=T),T=scratchVector3C.y,T<E&&(E=T),T>A&&(A=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=m,l[g+1]=E,l[g+2]=y,l[g+3]=v,l[g+4]=A,l[g+5]=b}else{for(var _=1/0,S=1/0,w=1/0,R=-1/0,I=-1/0,H=-1/0,d=0;d<s;d+=1){var h=d*3,g=d*6,m=void 0,E=void 0,y=void 0,v=void 0,A=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),m=v=scratchVector3A.x,T=scratchVector3B.x,T<m&&(m=T),T>v&&(v=T),T=scratchVector3C.x,T<m&&(m=T),T>v&&(v=T),E=A=scratchVector3A.y,T=scratchVector3B.y,T<E&&(E=T),T>A&&(A=T),T=scratchVector3C.y,T<E&&(E=T),T>A&&(A=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=m,l[g+1]=E,l[g+2]=y,l[g+3]=v,l[g+4]=A,l[g+5]=b,m<_&&(_=m),v>R&&(R=v),E<S&&(S=E),A>I&&(I=A),y<w&&(w=y),b>H&&(H=b)}o=[_,S,w,R,I,H]}var C=new BVHNode(++p,o,0,s,0);c[f++]=C;var M=[],B=[0,1,2],L=function(k,D){return M[D]-M[k]};function O(k){var D=k.startIndex,q=k.endIndex,z=k.extents;M[0]=z[3]-z[0],M[1]=z[4]-z[1],M[2]=z[5]-z[2],B.sort(L);for(var V=0;V<3;V++){for(var Q=B[V],U=z[Q]+z[Q+3],j=D,G=q-1,ae=-1,re=void 0;j<=G;)ae===-1?(re=u[j],l[re*6+Q]+l[re*6+Q+3]<U?j++:ae=re):(re=u[G],l[re*6+Q]+l[re*6+Q+3]>=U||(u[j]=re,u[G]=ae,ae=-1,j++),G--);if(j>D&&j<q){var $=new BVHNode(++p,calcExtents(u,l,D,j,EPSILON$1),D,j,k.deepth+1);$.deepth<r&&$.endIndex-$.startIndex>e&&(c[f++]=$);var ee=new BVHNode(++p,calcExtents(u,l,j,q,EPSILON$1),j,q,k.deepth+1);ee.deepth<r&&ee.endIndex-ee.startIndex>e&&(c[f++]=ee),k.node0=$,k.node1=ee,k.startIndex=0,k.endIndex=0;break}}}for(;f;)O(c[--f]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(C,p+1),c.length=0,this},t.prototype.trianglesInSphere=function(e,r){for(var o=this.offsetArray,s=this.rootNodePacked,u=new Float32Array(s),l=new Uint32Array(s),c=new Uint16Array(s),f=[0],p=[],d;(d=f.pop())!==void 0;){var h=d*BYTES_PER_NODE/4,g=clamp(e.x,u[h],u[h+3])-e.x,m=clamp(e.y,u[h+1],u[h+4])-e.y,E=clamp(e.z,u[h+2],u[h+5])-e.z;if(g*g+m*m+E*E<=r*r){for(var y=l[h+6],v=l[h+7],A=y;A<v;A++){var b=o[A];p.push(b)}var T=d*BYTES_PER_NODE/2,_=c[T+16],S=c[T+17];_&&f.push(_),S&&f.push(S)}}for(var w=p.length,R=new Float32Array(w*9),A=0;A<w;A++){var b=p[A],I=b*3;this.getPositionByIndex(I,scratchVector3$9),R[A*9]=scratchVector3$9.x,R[A*9+1]=scratchVector3$9.y,R[A*9+2]=scratchVector3$9.z,this.getPositionByIndex(I+1,scratchVector3$9),R[A*9+3]=scratchVector3$9.x,R[A*9+4]=scratchVector3$9.y,R[A*9+5]=scratchVector3$9.z,this.getPositionByIndex(I+2,scratchVector3$9),R[A*9+6]=scratchVector3$9.x,R[A*9+7]=scratchVector3$9.y,R[A*9+8]=scratchVector3$9.z}return R},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,f=this.rootNodePacked,p=new Float32Array(f),d=new Uint32Array(f),h=new Uint16Array(f),g=new BVHVector3(1/r.x,1/r.y,1/r.z),m=[0],E,y=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),v=1/0;(E=m.pop())!==void 0;){var A=E*BYTES_PER_NODE/4;y.min.x=p[A],y.min.y=p[A+1],y.min.z=p[A+2],y.max.x=p[A+3],y.max.y=p[A+4],y.max.z=p[A+5];var b=intersectNodeBox(e,g,y,o);if(b!==null&&!(s&&b>v)){for(var T=e.x,_=e.y,S=e.z,w=r.x,R=r.y,I=r.z,H=d[A+6],C=d[A+7],M=H;M<C;M++){var B=c[M],L=B*3,O=new BVHVector3(0,0,0);this.getPositionByIndex(L,O);var k=O.x,D=O.y,q=O.z,z=new BVHVector3(0,0,0);this.getPositionByIndex(L+1,z);var V=z.x,Q=z.y,U=z.z,j=new BVHVector3(0,0,0);this.getPositionByIndex(L+2,j);var G=j.x,ae=j.y,re=j.z,$=V-k,ee=Q-D,K=U-q,se=G-k,W=ae-D,X=re-q,te=ee*X-K*W,Z=K*se-$*X,ne=$*W-ee*se,pe=w*te+R*Z+I*ne,ie=void 0;if(pe>0)ie=1;else if(pe<0)ie=-1,pe=-pe;else continue;var ue=T-k,be=_-D,oe=S-q,le=ie*(w*(be*X-oe*W)+R*(oe*se-ue*X)+I*(ue*W-be*se));if(!(le<0)){var me=ie*(w*(ee*oe-K*be)+R*(K*ue-$*oe)+I*($*be-ee*ue));if(!(me<0)&&!(le+me>pe)){var ge=-ie*(ue*te+be*Z+oe*ne);if(!(ge<0)){var Ae=ge/pe,xe=new BVHVector3(T+w*Ae,_+R*Ae,S+I*Ae),he=new BVHIntersect(O,z,j,B,xe);(!u||u(he))&&(s?Ae<v&&(v=Ae,l.length>0&&(l.length=0),l.push(he)):l.push(he))}}}}var _e=E*BYTES_PER_NODE/2,He=h[_e+16],Ee=h[_e+17];He&&m.push(He),Ee&&m.push(Ee)}}return l},t})(BVHObject);function clamp(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,o){if(e>=r)return[0,0,0,0,0,0];for(var s=1/0,u=1/0,l=1/0,c=-1/0,f=-1/0,p=-1/0,d=e;d<r;d++){var h=n[d]*6,g=t[h];g<s&&(s=g),g=t[h+1],g<u&&(u=g),g=t[h+2],g<l&&(l=g),g=t[h+3],g>c&&(c=g),g=t[h+4],g>f&&(f=g),g=t[h+5],g>p&&(p=g)}return[s-o,u-o,l-o,c+o,f+o,p+o]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$8=new BVHVector3(0,0,0),BVHPoints=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionByIndex.bind(this),u=this.getPositionCount(),l=u>65535?new Uint32Array(u):new Uint16Array(u),c=[],f=0,p=-1;if(o)for(var d=0;d<u;d+=1)l[d]=d;else{s(0,scratchVector3$8);for(var h=scratchVector3$8.x,g=scratchVector3$8.y,m=scratchVector3$8.z,E=h,y=g,v=m,d=0;d<u;d+=1){l[d]=d,s(d,scratchVector3$8);var A=scratchVector3$8.x,b=scratchVector3$8.y,T=scratchVector3$8.z;A<h?h=A:A>E&&(E=A),b<g?g=b:b>y&&(y=b),T<m?m=T:T>v&&(v=T)}o=[h,g,m,E,y,v]}var _=new BVHNode(++p,o,0,u,0);c[f++]=_;var S=[],w=[0,1,2],R=function(H,C){return S[C]-S[H]};function I(H){var C=H.startIndex,M=H.endIndex,B=H.extents;S[0]=B[3]-B[0],S[1]=B[4]-B[1],S[2]=B[5]-B[2];for(var L=w.sort(R)[0],O=ORDER_AXISES[L],k=(B[L]+B[L+3])/2,D=C,q=M-1,z=-1,V;D<=q;)z===-1?(V=l[D],s(V,scratchVector3$8),scratchVector3$8[O]<k?D++:z=V):(V=l[q],s(V,scratchVector3$8),scratchVector3$8[O]>=k||(l[D]=V,l[q]=z,z=-1,D++),q--);if(D>C){var Q=B.slice();Q[L+3]=k+EPSILON;var U=new BVHNode(++p,Q,C,D,H.deepth+1);U.deepth<r&&U.endIndex-U.startIndex>e&&(c[f++]=U),H.node0=U}if(M>D){var j=B.slice();j[L]=k-EPSILON;var G=new BVHNode(++p,j,D,M,H.deepth+1);G.deepth<r&&G.endIndex-G.startIndex>e&&(c[f++]=G),H.node1=G}H.startIndex=0,H.endIndex=0}for(;f;)I(c[--f]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,p+1),c.length=0,this},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,f=this.rootNodePacked,p=new Float32Array(f),d=new Uint32Array(f),h=new Uint16Array(f),g=o*o,m=new BVHVector3(1/r.x,1/r.y,1/r.z),E=[0],y,v=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),A=1/0;(y=E.pop())!==void 0;){var b=y*BYTES_PER_NODE/4;v.min.x=p[b],v.min.y=p[b+1],v.min.z=p[b+2],v.max.x=p[b+3],v.max.y=p[b+4],v.max.z=p[b+5];var T=intersectNodeBox(e,m,v,o);if(T!==null&&!(s&&T>A)){for(var _=d[b+6],S=d[b+7],w=_;w<S;w++){var R=c[w],I=new BVHVector3(0,0,0);this.getPositionByIndex(R,I);var H=I.x,C=I.y,M=I.z,B=e.x,L=e.y,O=e.z,k=r.x,D=r.y,q=r.z,z=k*(H-B)+D*(C-L)+q*(M-O);if(z>0?(B+=k*z,L+=D*z,O+=q*z):z<0&&(z=0),k=H-B,D=C-L,q=M-O,k*k+D*D+q*q<=g){var V=new BVHVector3(B,L,O),Q=new BVHIntersect(I,I,I,R,V);(!u||u(Q))&&(s?z<A&&(A=z,l.length>0&&(l.length=0),l.push(Q)):l.push(Q))}}var U=y*BYTES_PER_NODE/2,j=h[U+16],G=h[U+17];j&&E.push(j),G&&E.push(G)}}return l},t})(BVHObject);const jsContent=`(function(){"use strict";var ur=function(o,r){return ur=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},ur(o,r)};function yr(o,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");ur(o,r);function t(){this.constructor=o}o.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}typeof SuppressedError=="function"&&SuppressedError;var cr=(function(){function o(r,t){this.position=r,this.indices=t}return o.prototype.getPositionCount=function(){var r,t,n=this.indices,e=this.position;return n?n.array.length/((r=n.stride)!==null&&r!==void 0?r:1):e.array.length/((t=e.stride)!==null&&t!==void 0?t:3)},o.prototype.getPositionByIndex=function(r,t){var n,e,h,v,i=this.indices,f=this.position,l=r;if(i){var y=i.array,s=(n=i.stride)!==null&&n!==void 0?n:1,d=(e=i.offset)!==null&&e!==void 0?e:0;l=y[r*s+d]}var u=f.array,x=(h=f.stride)!==null&&h!==void 0?h:3,w=(v=f.offset)!==null&&v!==void 0?v:0;return l=l*x+w,t.x=u[l],t.y=u[l+1],t.z=u[l+2],t},o.prototype.createTree=function(r,t,n){throw new Error("not implemented")},o.prototype.trianglesInSphere=function(r,t){throw new Error("not implemented")},o.prototype.intersectRay=function(r,t,n,e,h){throw new Error("not implemented")},o})(),D=(function(){function o(r,t,n,e,h){this.id=r,this.extents=t,this.startIndex=n,this.endIndex=e,this.deepth=h}return o})(),X=36;function lr(o,r){for(var t=new ArrayBuffer(r*X),n=new Float32Array(t),e=new Uint32Array(t),h=new Uint16Array(t),v=[o],i,f;i=v.pop();)f=i.id*X/4,n[f]=i.extents[0],n[f+1]=i.extents[1],n[f+2]=i.extents[2],n[f+3]=i.extents[3],n[f+4]=i.extents[4],n[f+5]=i.extents[5],e[f+6]=i.startIndex,e[f+7]=i.endIndex,f=i.id*X/2,i.node0&&(h[f+16]=i.node0.id,v.push(i.node0)),i.node1&&(h[f+17]=i.node1.id,v.push(i.node1));return t}function dr(o,r,t,n){n===void 0&&(n=0);var e=t.min.x-n,h=t.min.y-n,v=t.min.z-n,i=t.max.x+n,f=t.max.y+n,l=t.max.z+n,y=0,s=0,d=0,u=0,x=0,w=0;return r.x>=0?(y=(e-o.x)*r.x,s=(i-o.x)*r.x):(y=(i-o.x)*r.x,s=(e-o.x)*r.x),r.y>=0?(d=(h-o.y)*r.y,u=(f-o.y)*r.y):(d=(f-o.y)*r.y,u=(h-o.y)*r.y),y>u||d>s||((d>y||y!==y)&&(y=d),(u<s||s!==s)&&(s=u),r.z>=0?(x=(v-o.z)*r.z,w=(l-o.z)*r.z):(x=(l-o.z)*r.z,w=(v-o.z)*r.z),y>w||x>s)||((x>y||y!==y)&&(y=x),(w<s||s!==s)&&(s=w),s<0)?null:y>=0?y:s}var H=(function(){function o(r,t,n){this.x=r,this.y=t,this.z=n}return o.prototype.copy=function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this},o.prototype.set=function(r,t,n){return this.x=r,this.y=t,this.z=n,this},o.prototype.fromArray=function(r,t){return t===void 0&&(t=0),this.x=r[t],this.y=r[t+1],this.z=r[t+2],this},o.prototype.toArray=function(r,t){return r===void 0&&(r=[]),t===void 0&&(t=0),r[t]=this.x,r[t+1]=this.y,r[t+2]=this.z,r},o.prototype.add=function(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this},o.prototype.multiplyScalar=function(r){return this.x*=r,this.y*=r,this.z*=r,this},o.prototype.subVectors=function(r,t){return this.x=r.x-t.x,this.y=r.y-t.y,this.z=r.z-t.z,this},o.prototype.addScaledVector=function(r,t){return this.x+=r.x*t,this.y+=r.y*t,this.z+=r.z*t,this},o.prototype.dot=function(r){return this.x*r.x+this.y*r.y+this.z*r.z},o.prototype.cross=function(r){var t=this.x,n=this.y,e=this.z;return this.x=n*r.z-e*r.y,this.y=e*r.x-t*r.z,this.z=t*r.y-n*r.x,this},o.prototype.crossVectors=function(r,t){var n=r.x,e=r.y,h=r.z,v=t.x,i=t.y,f=t.z;return this.x=e*f-h*i,this.y=h*v-n*f,this.z=n*i-e*v,this},o.prototype.distanceTo=function(r){return Math.sqrt(this.distanceToSquared(r))},o.prototype.distanceToSquared=function(r){var t=this.x-r.x,n=this.y-r.y,e=this.z-r.z;return t*t+n*n+e*e},o.prototype.clone=function(){return new o(this.x,this.y,this.z)},o})(),wr=(function(){function o(r,t,n,e,h){this.pointA=r,this.pointB=t,this.pointC=n,this.index=e,this.intersectionPoint=h}return o})(),xr=(function(){function o(r,t){this.min=r,this.max=t}return o})(),pr=1e-6,J=new H(0,0,0),Y=new H(0,0,0),g=new H(0,0,0),Z=new H(0,0,0),Hr=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionCount()/3,v=h>65535?new Uint32Array(h):new Uint16Array(h),i=new Float32Array(h*6),f=[],l=0,y=-1;if(e)for(var s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p}else{for(var F=1/0,k=1/0,E=1/0,S=-1/0,V=-1/0,U=-1/0,s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p,x<F&&(F=x),I>S&&(S=I),w<k&&(k=w),c>V&&(V=c),z<E&&(E=z),p>U&&(U=p)}e=[F,k,E,S,V,U]}var W=new D(++y,e,0,h,0);f[l++]=W;var M=[],T=[0,1,2],j=function(P,B){return M[B]-M[P]};function q(P){var B=P.startIndex,_=P.endIndex,A=P.extents;M[0]=A[3]-A[0],M[1]=A[4]-A[1],M[2]=A[5]-A[2],T.sort(j);for(var $=0;$<3;$++){for(var C=T[$],G=A[C]+A[C+3],N=B,L=_-1,O=-1,Q=void 0;N<=L;)O===-1?(Q=v[N],i[Q*6+C]+i[Q*6+C+3]<G?N++:O=Q):(Q=v[L],i[Q*6+C]+i[Q*6+C+3]>=G||(v[N]=Q,v[L]=O,O=-1,N++),L--);if(N>B&&N<_){var R=new D(++y,zr(v,i,B,N,pr),B,N,P.deepth+1);R.deepth<n&&R.endIndex-R.startIndex>t&&(f[l++]=R);var b=new D(++y,zr(v,i,N,_,pr),N,_,P.deepth+1);b.deepth<n&&b.endIndex-b.startIndex>t&&(f[l++]=b),P.node0=R,P.node1=b,P.startIndex=0,P.endIndex=0;break}}}for(;l;)q(f[--l]);return this.offsetArray=v,this.rootNodePacked=lr(W,y+1),f.length=0,this},r.prototype.trianglesInSphere=function(t,n){for(var e=this.offsetArray,h=this.rootNodePacked,v=new Float32Array(h),i=new Uint32Array(h),f=new Uint16Array(h),l=[0],y=[],s;(s=l.pop())!==void 0;){var d=s*X/4,u=fr(t.x,v[d],v[d+3])-t.x,x=fr(t.y,v[d+1],v[d+4])-t.y,w=fr(t.z,v[d+2],v[d+5])-t.z;if(u*u+x*x+w*w<=n*n){for(var z=i[d+6],I=i[d+7],c=z;c<I;c++){var p=e[c];y.push(p)}var a=s*X/2,F=f[a+16],k=f[a+17];F&&l.push(F),k&&l.push(k)}}for(var E=y.length,S=new Float32Array(E*9),c=0;c<E;c++){var p=y[c],V=p*3;this.getPositionByIndex(V,J),S[c*9]=J.x,S[c*9+1]=J.y,S[c*9+2]=J.z,this.getPositionByIndex(V+1,J),S[c*9+3]=J.x,S[c*9+4]=J.y,S[c*9+5]=J.z,this.getPositionByIndex(V+2,J),S[c*9+6]=J.x,S[c*9+7]=J.y,S[c*9+8]=J.z}return S},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=new H(1/n.x,1/n.y,1/n.z),x=[0],w,z=new xr(new H(0,0,0),new H(0,0,0)),I=1/0;(w=x.pop())!==void 0;){var c=w*X/4;z.min.x=y[c],z.min.y=y[c+1],z.min.z=y[c+2],z.max.x=y[c+3],z.max.y=y[c+4],z.max.z=y[c+5];var p=dr(t,u,z,e);if(p!==null&&!(h&&p>I)){for(var a=t.x,F=t.y,k=t.z,E=n.x,S=n.y,V=n.z,U=s[c+6],W=s[c+7],M=U;M<W;M++){var T=f[M],j=T*3,q=new H(0,0,0);this.getPositionByIndex(j,q);var P=q.x,B=q.y,_=q.z,A=new H(0,0,0);this.getPositionByIndex(j+1,A);var $=A.x,C=A.y,G=A.z,N=new H(0,0,0);this.getPositionByIndex(j+2,N);var L=N.x,O=N.y,Q=N.z,R=$-P,b=C-B,or=G-_,er=L-P,vr=O-B,sr=Q-_,Ar=b*sr-or*vr,Pr=or*er-R*sr,Br=R*vr-b*er,m=E*Ar+S*Pr+V*Br,rr=void 0;if(m>0)rr=1;else if(m<0)rr=-1,m=-m;else continue;var tr=a-P,nr=F-B,ir=k-_,Sr=rr*(E*(nr*sr-ir*vr)+S*(ir*er-tr*sr)+V*(tr*vr-nr*er));if(!(Sr<0)){var Nr=rr*(E*(b*ir-or*nr)+S*(or*tr-R*ir)+V*(R*nr-b*tr));if(!(Nr<0)&&!(Sr+Nr>m)){var Vr=-rr*(tr*Ar+nr*Pr+ir*Br);if(!(Vr<0)){var ar=Vr/m,jr=new H(a+E*ar,F+S*ar,k+V*ar),hr=new wr(q,A,N,T,jr);(!v||v(hr))&&(h?ar<I&&(I=ar,i.length>0&&(i.length=0),i.push(hr)):i.push(hr))}}}}var Tr=w*X/2,Ur=d[Tr+16],_r=d[Tr+17];Ur&&x.push(Ur),_r&&x.push(_r)}}return i},r})(cr);function fr(o,r,t){return o<r?r:o>t?t:o}function zr(o,r,t,n,e){if(t>=n)return[0,0,0,0,0,0];for(var h=1/0,v=1/0,i=1/0,f=-1/0,l=-1/0,y=-1/0,s=t;s<n;s++){var d=o[s]*6,u=r[d];u<h&&(h=u),u=r[d+1],u<v&&(v=u),u=r[d+2],u<i&&(i=u),u=r[d+3],u>f&&(f=u),u=r[d+4],u>l&&(l=u),u=r[d+5],u>y&&(y=u)}return[h-e,v-e,i-e,f+e,l+e,y+e]}var Ir=1e-6,kr=["x","y","z"],K=new H(0,0,0),Er=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionByIndex.bind(this),v=this.getPositionCount(),i=v>65535?new Uint32Array(v):new Uint16Array(v),f=[],l=0,y=-1;if(e)for(var s=0;s<v;s+=1)i[s]=s;else{h(0,K);for(var d=K.x,u=K.y,x=K.z,w=d,z=u,I=x,s=0;s<v;s+=1){i[s]=s,h(s,K);var c=K.x,p=K.y,a=K.z;c<d?d=c:c>w&&(w=c),p<u?u=p:p>z&&(z=p),a<x?x=a:a>I&&(I=a)}e=[d,u,x,w,z,I]}var F=new D(++y,e,0,v,0);f[l++]=F;var k=[],E=[0,1,2],S=function(U,W){return k[W]-k[U]};function V(U){var W=U.startIndex,M=U.endIndex,T=U.extents;k[0]=T[3]-T[0],k[1]=T[4]-T[1],k[2]=T[5]-T[2];for(var j=E.sort(S)[0],q=kr[j],P=(T[j]+T[j+3])/2,B=W,_=M-1,A=-1,$;B<=_;)A===-1?($=i[B],h($,K),K[q]<P?B++:A=$):($=i[_],h($,K),K[q]>=P||(i[B]=$,i[_]=A,A=-1,B++),_--);if(B>W){var C=T.slice();C[j+3]=P+Ir;var G=new D(++y,C,W,B,U.deepth+1);G.deepth<n&&G.endIndex-G.startIndex>t&&(f[l++]=G),U.node0=G}if(M>B){var N=T.slice();N[j]=P-Ir;var L=new D(++y,N,B,M,U.deepth+1);L.deepth<n&&L.endIndex-L.startIndex>t&&(f[l++]=L),U.node1=L}U.startIndex=0,U.endIndex=0}for(;l;)V(f[--l]);return this.offsetArray=i,this.rootNodePacked=lr(F,y+1),f.length=0,this},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=e*e,x=new H(1/n.x,1/n.y,1/n.z),w=[0],z,I=new xr(new H(0,0,0),new H(0,0,0)),c=1/0;(z=w.pop())!==void 0;){var p=z*X/4;I.min.x=y[p],I.min.y=y[p+1],I.min.z=y[p+2],I.max.x=y[p+3],I.max.y=y[p+4],I.max.z=y[p+5];var a=dr(t,x,I,e);if(a!==null&&!(h&&a>c)){for(var F=s[p+6],k=s[p+7],E=F;E<k;E++){var S=f[E],V=new H(0,0,0);this.getPositionByIndex(S,V);var U=V.x,W=V.y,M=V.z,T=t.x,j=t.y,q=t.z,P=n.x,B=n.y,_=n.z,A=P*(U-T)+B*(W-j)+_*(M-q);if(A>0?(T+=P*A,j+=B*A,q+=_*A):A<0&&(A=0),P=U-T,B=W-j,_=M-q,P*P+B*B+_*_<=u){var $=new H(T,j,q),C=new wr(V,V,V,S,$);(!v||v(C))&&(h?A<c&&(c=A,i.length>0&&(i.length=0),i.push(C)):i.push(C))}}var G=z*X/2,N=d[G+16],L=d[G+17];N&&w.push(N),L&&w.push(L)}}return i},r})(cr);function Mr(o){onmessage=function(r){Promise.resolve(r.data).then(function(t){return o(t)}).then(function(t){var n=t.output,e=t.transfer;return postMessage(n,e)}).catch(function(t){return postMessage({$$error:t})})}}Mr(function(o){return Promise.resolve(o).then(function(r){for(var t=[],n=new Set,e=0,h=r;e<h.length;e++){var v=h[e],i=void 0;if(v.type==="mesh")i=new Hr(v.attributes.position,v.indices);else if(v.type==="points")i=new Er(v.attributes.position,v.indices);else throw new Error("Invalid Type");i.createTree(v.maxItemPerNode,v.maxTreeDepth,v.extents);var f={type:v.type,attributes:v.attributes,indices:v.indices,offsetArray:i.offsetArray,rootNodePacked:i.rootNodePacked};t.push(f);var l=void 0;for(var y in f.attributes){var s=f.attributes[y];s&&s.buffer instanceof ArrayBuffer&&n.add(s.buffer)}l=f.indices,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),l=f.offsetArray,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),n.add(f.rootNodePacked)}return{output:t,transfer:Array.from(n)}})})})();
918
+ `&&l!=="\r"?r+=l:(r==="end_header"&&(e=!1),r!==""&&(o.push(r),r=""))}while(e&&t<n.length);return u===!0&&t++,{headerText:o.join("\r")+"\r",headerLength:t}}var ArrayStream=(function(){function n(t){this.arr=t,this.i=0}return n.prototype.empty=function(){return this.i>=this.arr.length},n.prototype.next=function(){return this.arr[this.i++]},n})(),u8=Uint8Array,u16=Uint16Array,i32=Int32Array,fleb=new u8([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]),fdeb=new u8([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]),clim=new u8([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(n,t){for(var e=new u16(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var o=new i32(e[30]),r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)o[s]=s-e[r]<<5|r;return{b:e,r:o}},_a$3=freb(fleb,2),fl=_a$3.b,revfl=_a$3.r;fl[28]=258,revfl[258]=28;for(var _b=freb(fdeb,0),fd=_b.b,rev=new u16(32768),i=0;i<32768;++i){var x=(i&43690)>>1|(i&21845)<<1;x=(x&52428)>>2|(x&13107)<<2,x=(x&61680)>>4|(x&3855)<<4,rev[i]=((x&65280)>>8|(x&255)<<8)>>1}for(var hMap=(function(n,t,e){for(var r=n.length,o=0,s=new u16(t);o<r;++o)n[o]&&++s[n[o]-1];var u=new u16(t);for(o=1;o<t;++o)u[o]=u[o-1]+s[o-1]<<1;var l;if(e){l=new u16(1<<t);var c=15-t;for(o=0;o<r;++o)if(n[o])for(var f=o<<4|n[o],p=t-n[o],d=u[n[o]-1]++<<p,h=d|(1<<p)-1;d<=h;++d)l[rev[d]>>c]=f}else for(l=new u16(r),o=0;o<r;++o)n[o]&&(l[o]=rev[u[n[o]-1]++]>>15-n[o]);return l}),flt=new u8(288),i=0;i<144;++i)flt[i]=8;for(var i=144;i<256;++i)flt[i]=9;for(var i=256;i<280;++i)flt[i]=7;for(var i=280;i<288;++i)flt[i]=8;for(var fdt=new u8(32),i=0;i<32;++i)fdt[i]=5;var flrm=hMap(flt,9,1),fdrm=hMap(fdt,5,1),max=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},bits=function(n,t,e){var r=t/8|0;return(n[r]|n[r+1]<<8)>>(t&7)&e},bits16=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},shft=function(n){return(n+7)/8|0},slc=function(n,t,e){return(t==null||t<0)&&(t=0),(e==null||e>n.length)&&(e=n.length),new u8(n.subarray(t,e))},ec=["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"],err=function(n,t,e){var r=new Error(t||ec[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,err),!e)throw r;return r},inflt=function(n,t,e,r){var o=n.length,s=r?r.length:0;if(!o||t.f&&!t.l)return e||new u8(0);var u=!e,l=u||t.i!=2,c=t.i;u&&(e=new u8(o*3));var f=function(G){var W=e.length;if(G>W){var $=new u8(Math.max(W*2,G));$.set(e),e=$}},p=t.f||0,d=t.p||0,h=t.b||0,g=t.l,m=t.d,E=t.m,y=t.n,v=o*8;do{if(!g){p=bits(n,d,1);var A=bits(n,d+1,3);if(d+=3,A)if(A==1)g=flrm,m=fdrm,E=9,y=5;else if(A==2){var S=bits(n,d,31)+257,w=bits(n,d+10,15)+4,R=S+bits(n,d+5,31)+1;d+=14;for(var I=new u8(R),H=new u8(19),C=0;C<w;++C)H[clim[C]]=bits(n,d+C*3,7);d+=w*3;for(var M=max(H),B=(1<<M)-1,L=hMap(H,M,1),C=0;C<R;){var O=L[bits(n,d,B)];d+=O&15;var b=O>>4;if(b<16)I[C++]=b;else{var k=0,D=0;for(b==16?(D=3+bits(n,d,3),d+=2,k=I[C-1]):b==17?(D=3+bits(n,d,7),d+=3):b==18&&(D=11+bits(n,d,127),d+=7);D--;)I[C++]=k}}var q=I.subarray(0,S),z=I.subarray(S);E=max(q),y=max(z),g=hMap(q,E,1),m=hMap(z,y,1)}else err(1);else{var b=shft(d)+4,T=n[b-4]|n[b-3]<<8,_=b+T;if(_>o){c&&err(0);break}l&&f(h+T),e.set(n.subarray(b,_),h),t.b=h+=T,t.p=d=_*8,t.f=p;continue}if(d>v){c&&err(0);break}}l&&f(h+131072);for(var J=(1<<E)-1,V=(1<<y)-1,U=d;;U=d){var k=g[bits16(n,d)&J],j=k>>4;if(d+=k&15,d>v){c&&err(0);break}if(k||err(2),j<256)e[h++]=j;else if(j==256){U=d,g=null;break}else{var K=j-254;if(j>264){var C=j-257,ae=fleb[C];K=bits(n,d,(1<<ae)-1)+fl[C],d+=ae}var re=m[bits16(n,d)&V],ee=re>>4;re||err(3),d+=re&15;var z=fd[ee];if(ee>3){var ae=fdeb[ee];z+=bits16(n,d)&(1<<ae)-1,d+=ae}if(d>v){c&&err(0);break}l&&f(h+131072);var Z=h+K;if(h<z){var X=s-z,se=Math.min(z,Z);for(X+h<0&&err(3);h<se;++h)e[h]=r[X+h]}for(;h<Z;++h)e[h]=e[h-z]}}t.l=g,t.p=U,t.b=h,t.f=p,g&&(p=1,t.m=E,t.d=m,t.n=y)}while(!p);return h!=e.length&&u?slc(e,0,h):e.subarray(0,h)},et=new u8(0),b2=function(n,t){return n[t]|n[t+1]<<8},b4=function(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0},b8=function(n,t){return b4(n,t)+b4(n,t+4)*4294967296},zls=function(n,t){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&err(6,"invalid zlib data"),(n[1]>>5&1)==1&&err(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function inflateSync(n,t){return inflt(n,{i:2},t&&t.out,t&&t.dictionary)}function unzlibSync(n,t){return inflt(n.subarray(zls(n),-4),{i:2},t,t)}var td=typeof TextDecoder!="undefined"&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0}),tds=1}catch(n){}var dutf8=function(n){for(var t="",e=0;;){var r=n[e++],o=(r>127)+(r>223)+(r>239);if(e+o>n.length)return{s:t,r:slc(n,e-1)};o?o==3?(r=((r&15)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):o&1?t+=String.fromCharCode((r&31)<<6|n[e++]&63):t+=String.fromCharCode((r&15)<<12|(n[e++]&63)<<6|n[e++]&63):t+=String.fromCharCode(r)}};function strFromU8(n,t){if(t){for(var e="",r=0;r<n.length;r+=16384)e+=String.fromCharCode.apply(null,n.subarray(r,r+16384));return e}else{if(td)return td.decode(n);var o=dutf8(n),s=o.s,e=o.r;return e.length&&err(8),s}}var slzh=function(n,t){return t+30+b2(n,t+26)+b2(n,t+28)},zh=function(n,t,e){var r=b2(n,t+28),o=strFromU8(n.subarray(t+46,t+46+r),!(b2(n,t+8)&2048)),s=t+46+r,u=b4(n,t+20),l=e&&u==4294967295?z64e(n,s):[u,b4(n,t+24),b4(n,t+42)],c=l[0],f=l[1],p=l[2];return[b2(n,t+10),c,f,o,s+b2(n,t+30)+b2(n,t+32),p]},z64e=function(n,t){for(;b2(n,t)!=1;t+=4+b2(n,t+2));return[b8(n,t+12),b8(n,t+4),b8(n,t+20)]};function unzipSync(n,t){for(var e={},r=n.length-22;b4(n,r)!=101010256;--r)(!r||n.length-r>65558)&&err(13);var o=b2(n,r+8);if(!o)return{};var s=b4(n,r+16),u=s==4294967295||o==65535;if(u){var l=b4(n,r-12);u=b4(n,l)==101075792,u&&(o=b4(n,l+32),s=b4(n,l+48))}for(var c=0;c<o;++c){var f=zh(n,s,u),p=f[0],d=f[1],h=f[2],g=f[3],m=f[4],E=f[5],y=slzh(n,E);s=m,p?p==8?e[g]=inflateSync(n.subarray(y,y+d),{out:new u8(h)}):err(14,"unknown compression type "+p):e[g]=slc(n,y,y+d)}return e}function loadFbx(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u=0;return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return u=l.body.byteLength,l.body})}).then(function(l){var c;return parse$2(l,{light:t.light,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(c=n.split("?")[1])!==null&&c!==void 0?c:"",fetcher:s})}).then(function(l){var c=l.scene,f=l.unitScale/100,p=new THREE__namespace.Matrix4;if(p.makeScale(f,f,f),l.upAxis==="X")throw new Error("Cannot load fbx x upAxis");return l.upAxis==="Y"&&p.premultiply(ROTATE_X_MATRIX),o==="Y"&&p.premultiply(ROTATE_X_MATRIX_INVERSE),c.applyMatrix4(p),{type:"fbx",modelUpAxis:l.upAxis,upAxis:o,uri:n,byteLength:u,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:l.animations,dispose:function(){return l.dispose()}}})}function parse$2(n,t){var e;if(isFbxFormatBinary(n))e=new BinaryParser().parse(n);else{var r=convertArrayBufferToString(n);if(!isFbxFormatASCII(r))throw new Error("THREE.FBXLoader: Unknown format.");if(getFbxVersion(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+getFbxVersion(r));e=new TextParser().parse(r)}return new FBXTreeParser(t).parse(e)}var FBXTreeParser=(function(){function n(t){var e,r,o;this.light=(e=t.light)!==null&&e!==void 0?e:!0,this.resourcePath=(r=t.resourcePath)!==null&&r!==void 0?r:"",this.search=(o=t.search)!==null&&o!==void 0?o:"",this.fetcher=t.fetcher}return n.prototype.parse=function(t){var e,r,o,s,u,l,c=this.parseConnections(t),f=Object.assign(new THREE__namespace.Group,{animations:[]}),p=[],d=this.parseImages(t),h=this.parseTextures(t,d,c,p),g=this.parseMaterials(t,h,c),m=this.parseDeformers(t,c),E=new GeometryParser().parse(t,m,c);this.parseScene(t,m,E,g,c,f);var y=(r=(e=t.GlobalSettings.UpAxis)===null||e===void 0?void 0:e.value)!==null&&r!==void 0?r:1,v=(s=(o=t.GlobalSettings.FrontAxis)===null||o===void 0?void 0:o.value)!==null&&s!==void 0?s:2,A=(l=(u=t.GlobalSettings.UnitScaleFactor)===null||u===void 0?void 0:u.value)!==null&&l!==void 0?l:1,b;if(t.GlobalSettings.AmbientColor){var T=t.GlobalSettings.AmbientColor.value,_=T[0],S=T[1],w=T[2];if(_!==0||S!==0||w!==0){var R=new THREE__namespace.Color().setRGB(_,S,w);b=new THREE__namespace.AmbientLight(R,1)}}return Promise.all(p).then(function(I){var H;return{scene:f,textures:I,ambientLight:b,upAxis:["X","Y","Z"][y],frontAxis:["X","Y","Z"][v],unitScale:A,animations:(H=f.animations)!==null&&H!==void 0?H:[],dispose:function(){I.forEach(function(C){return C.dispose()}),g.forEach(function(C){return C.dispose()}),E.forEach(function(C){return C.dispose()})}}})},n.prototype.parseConnections=function(t){var e=new Map;if("Connections"in t){var r=t.Connections.connections;r.forEach(function(o){var s=o[0],u=o[1],l=o[2];e.has(s)||e.set(s,{parents:[],children:[]});var c={ID:u,relationship:l};e.get(s).parents.push(c),e.has(u)||e.set(u,{parents:[],children:[]});var f={ID:s,relationship:l};e.get(u).children.push(f)})}return e},n.prototype.parseImages=function(t){var e={},r={};if("Video"in t.Objects){var o=t.Objects.Video;for(var s in o){var u=o[s],l=parseInt(s);if(e[l]=u.RelativeFilename||u.Filename,"Content"in u){var c=u.Content instanceof ArrayBuffer&&u.Content.byteLength>0,f=typeof u.Content=="string"&&u.Content!=="";if(c||f){var p=this.parseImage(o[s]);r[u.RelativeFilename||u.Filename]=p}}}}for(var l in e){var d=e[l];r[d]!==void 0?e[l]=r[d]:e[l]=e[l].split("\\").pop()}return e},n.prototype.parseImage=function(t){var e=t.Content,r=t.RelativeFilename||t.Filename,o=r.slice(r.lastIndexOf(".")+1).toLowerCase(),s;switch(o){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":s="image/tga";break;default:return}if(typeof e=="string")return"data:"+s+";base64,"+e;var u=new Uint8Array(e);return window.URL.createObjectURL(new Blob([u],{type:s}))},n.prototype.parseTextures=function(t,e,r,o){var s=new Map;if("Texture"in t.Objects){var u=t.Objects.Texture;for(var l in u){var c=this.parseTexture(u[l],e,r,o);s.set(parseInt(l),c)}}return s},n.prototype.parseTexture=function(t,e,r,o){var s=this.loadTexture(t,e,r,o);s.ID=t.id,s.name=t.attrName;var u=t.WrapModeU,l=t.WrapModeV,c=u!==void 0?u.value:0,f=l!==void 0?l.value:0;if(s.wrapS=c===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,s.wrapT=f===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,t.Scaling){var p=t.Scaling.value;s.repeat.x=p[0],s.repeat.y=p[1]}if(t.Translation){var p=t.Translation.value;s.offset.x=p[0],s.offset.y=p[1]}return s},n.prototype.loadTexture=function(t,e,r,o){var s=r.get(t.id).children,u="";s!==void 0&&s.length>0&&e[s[0].ID]!==void 0&&(u=e[s[0].ID]),u=pathJoin(this.resourcePath,appendSearch(u,this.search));var l=Object.assign(new THREE__namespace.Texture,{ID:0}),c;canUseNativeImageBitmap()?c=this.fetcher.ajax(u,{responseType:"blob"}).then(function(p){var d=p.body;return createImageBitmapLike(d)}):c=this.fetcher.loadImage(u,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(p){return p.body});var f=c.then(function(p){return l.image=p,l.needsUpdate=!0,l}).catch(function(p){return console.warn(p),l});return o.push(f),l},n.prototype.parseMaterials=function(t,e,r){var o=new Map;if("Material"in t.Objects){var s=t.Objects.Material;for(var u in s){var l=this.parseMaterial(t,s[u],e,r);l!==null&&o.set(parseInt(u),l)}}return o},n.prototype.parseMaterial=function(t,e,r,o){var s=e.id,u=e.attrName,l=e.ShadingModel;if(typeof l=="object"&&(l=l.value),l=l.toLowerCase(),!o.has(s))return null;var c=new PBMMeshMaterial(this.light?"phong":"basic");c.name=u,e.BumpFactor&&(c.bumpScale=e.BumpFactor.value),e.Diffuse?c.color=new THREE__namespace.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(c.color=new THREE__namespace.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(c.displacementScale=e.DisplacementFactor.value),e.Emissive?c.emissive=new THREE__namespace.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(c.emissive=new THREE__namespace.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(c.emissiveIntensity=parseFloat(e.EmissiveFactor.value));var f=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0);(f===1||f===0)&&(f=e.Opacity?parseFloat(e.Opacity.value):null,f===null&&(f=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),c.opacity=f,c.opacity<1&&(c.transparent=!0),e.ReflectionFactor&&(c.reflectivity=e.ReflectionFactor.value),e.Shininess&&(c.shininess=e.Shininess.value),e.Specular?c.specular=new THREE__namespace.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(c.specular=new THREE__namespace.Color().fromArray(e.SpecularColor.value));var p=this;return o.get(s).children.forEach(function(d){var h=d.relationship;switch(h){case"Bump":c.bumpMap=p.getTexture(t,r,d.ID,o);break;case"Maya|TEX_ao_map":c.aoMap=p.getTexture(t,r,d.ID,o);break;case"DiffuseColor":case"Maya|TEX_color_map":c.map=p.getTexture(t,r,d.ID,o),c.map!==void 0&&(c.map.encoding=THREE__namespace.sRGBEncoding);break;case"DisplacementColor":c.displacementMap=p.getTexture(t,r,d.ID,o);break;case"EmissiveColor":c.emissiveMap=p.getTexture(t,r,d.ID,o),c.emissiveMap!==void 0&&(c.emissiveMap.encoding=THREE__namespace.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":c.normalMap=p.getTexture(t,r,d.ID,o);break;case"ReflectionColor":c.envMap=p.getTexture(t,r,d.ID,o),c.envMap!==void 0&&(c.envMap.mapping=THREE__namespace.EquirectangularReflectionMapping,c.envMap.encoding=THREE__namespace.sRGBEncoding);break;case"SpecularColor":c.specularMap=p.getTexture(t,r,d.ID,o),c.specularMap!==void 0&&(c.specularMap.encoding=THREE__namespace.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":c.alphaMap=p.getTexture(t,r,d.ID,o),c.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",h);break}}),c},n.prototype.getTexture=function(t,e,r,o){return t.Objects.LayeredTexture&&r in t.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=o.get(r).children[0].ID),e.get(r)},n.prototype.parseDeformers=function(t,e){var r={},o={};if("Deformer"in t.Objects){var s=t.Objects.Deformer;for(var u in s){var l=s[u],c=e.get(parseInt(u));if(l.attrType==="Skin"){var f=this.parseSkeleton(c,s);f.ID=u,c.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),f.geometryID=c.parents[0].ID,r[u]=f}else if(l.attrType==="BlendShape"){var p={id:u};p.rawTargets=this.parseMorphTargets(c,s,e),p.id=u,c.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),o[u]=p}}}return{skeletons:r,morphTargets:o}},n.prototype.parseSkeleton=function(t,e){var r=[];return t.children.forEach(function(o){var s=e[o.ID];if(s.attrType==="Cluster"){var u={ID:o.ID,indices:[],weights:[],transformLink:new THREE__namespace.Matrix4().fromArray(s.TransformLink.a)};s.Indexes&&(u.indices=s.Indexes.a,u.weights=s.Weights.a),r.push(u)}}),{ID:"",geometryID:0,rawBones:r,bones:[]}},n.prototype.parseMorphTargets=function(t,e,r){for(var o=[],s=0;s<t.children.length;s++){var u=t.children[s],l=e[u.ID],c={name:l.attrName,initialWeight:l.DeformPercent,id:l.id,fullWeights:l.FullWeights.a,geoID:0};if(l.attrType!=="BlendShapeChannel")return;c.geoID=r.get(parseInt(u.ID)).children.filter(function(f){return f.relationship===void 0})[0].ID,o.push(c)}return o},n.prototype.parseScene=function(t,e,r,o,s,u){var l=this.parseModels(t,e.skeletons,r,o,s),c=t.Objects.Model,f=this;l.forEach(function(d){var h=c[d.ID];f.setLookAtProperties(t,d,h,s,u);var g=s.get(d.ID).parents;g.forEach(function(m){var E=l.get(m.ID);E!==void 0&&E.add(d)}),d.parent===null&&u.add(d)}),this.bindSkeleton(t,e.skeletons,r,l,s),u.traverse(function(d){if(d.userData.transformData){d.parent&&(d.userData.transformData.parentMatrix=d.parent.matrix,d.userData.transformData.parentMatrixWorld=d.parent.matrixWorld);var h=generateTransform(d.userData.transformData);d.applyMatrix4(h),d.updateWorldMatrix(!0,!0)}});var p=new AnimationParser().parse(t,s,u);u.children.length===1&&u.children[0]instanceof THREE__namespace.Group&&(u=u.children[0]),u.animations=p},n.prototype.parseModels=function(t,e,r,o,s){var u=new Map,l=t.Objects.Model;for(var c in l){var f=parseInt(c),p=l[c],d=s.get(f),h=this.buildSkeleton(d,e,f,p.attrName);if(!h){switch(p.attrType){case"Camera":h=this.createCamera(t,d);break;case"Light":h=this.createLight(t,d);break;case"Mesh":h=this.createMesh(d,r,o);break;case"NurbsCurve":case"LimbNode":case"Root":h=new THREE__namespace.Bone;break;case"Null":default:h=new THREE__namespace.Group;break}h.name=p.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(p.attrName):"",h.userData.originalName=p.attrName,h.ID=f}this.getTransformData(h,p),u.set(f,h)}return u},n.prototype.buildSkeleton=function(t,e,r,o){var s=null;return t.parents.forEach(function(u){var l=function(f){var p=e[f];p.rawBones.forEach(function(d,h){if(d.ID===u.ID){var g=s;s=new THREE__namespace.Bone,s.matrixWorld.copy(d.transformLink),s.name=o?THREE__namespace.PropertyBinding.sanitizeNodeName(o):"",s.userData.originalName=o,s.ID=r,p.bones[h]=s,g!==null&&s.add(g)}})};for(var c in e)l(c)}),s},n.prototype.createCamera=function(t,e){var r,o;if(e.children.forEach(function(g){var m=t.Objects.NodeAttribute[g.ID];m!==void 0&&(o=m)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=0;o.CameraProjectionType!==void 0&&o.CameraProjectionType.value===1&&(s=1);var u=1;o.NearPlane!==void 0&&(u=o.NearPlane.value/1e3);var l=1e3;o.FarPlane!==void 0&&(l=o.FarPlane.value/1e3);var c=window.innerWidth,f=window.innerHeight;o.AspectWidth!==void 0&&o.AspectHeight!==void 0&&(c=o.AspectWidth.value,f=o.AspectHeight.value);var p=c/f,d=45;o.FieldOfView!==void 0&&(d=o.FieldOfView.value);var h=o.FocalLength?o.FocalLength.value:null;switch(s){case 0:r=new THREE__namespace.PerspectiveCamera(d,p,u,l),h!==null&&r.setFocalLength(h);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),r=new THREE__namespace.Object3D;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),r=new THREE__namespace.Object3D;break}}return r},n.prototype.createLight=function(t,e){var r,o;if(e.children.forEach(function(h){var g=t.Objects.NodeAttribute[h.ID];g!==void 0&&(o=g)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=void 0;o.LightType===void 0?s=0:s=o.LightType.value;var u=new THREE__namespace.Color(16777215);o.Color!==void 0&&(u=new THREE__namespace.Color().fromArray(o.Color.value));var l=o.Intensity===void 0?1:o.Intensity.value/100;o.CastLightOnObject!==void 0&&o.CastLightOnObject.value===0&&(l=0);var c=0;o.FarAttenuationEnd!==void 0&&(o.EnableFarAttenuation!==void 0&&o.EnableFarAttenuation.value===0?c=0:c=o.FarAttenuationEnd.value);var f=1;switch(s){case 0:r=new THREE__namespace.PointLight(u,l,c,f);break;case 1:r=new THREE__namespace.DirectionalLight(u,l);break;case 2:var p=Math.PI/3;o.InnerAngle!==void 0&&(p=THREE__namespace.MathUtils.degToRad(o.InnerAngle.value));var d=0;o.OuterAngle!==void 0&&(d=THREE__namespace.MathUtils.degToRad(o.OuterAngle.value),d=Math.max(d,1)),r=new THREE__namespace.SpotLight(u,l,c,p,d,f);break;default:console.warn("THREE.FBXLoader: Unknown light type "+o.LightType.value+", defaulting to a PointLight."),r=new THREE__namespace.PointLight(u,l);break}o.CastShadows!==void 0&&o.CastShadows.value===1&&(r.castShadow=!0)}return r},n.prototype.createMesh=function(t,e,r){var o,s=null,u=[];if(t.children.forEach(function(c){e.has(c.ID)&&(s=e.get(c.ID)),r.has(c.ID)&&u.push(r.get(c.ID))}),u.length===0){var l=new PBMMeshMaterial(this.light?"phong":"basic");l.color=new THREE__namespace.Color(13421772),u.push(l)}return"color"in s.attributes&&u.forEach(function(c){c.vertexColors=!0}),(!s.groups||s.groups.length===0)&&s.addGroup(0,s.index?s.index.count:s.attributes.position.count,0),s.FBX_Deformer?(u.forEach(function(c){c.skinning=!0}),o=new PBMSkinnedMesh(s,u),o.normalizeSkinWeights()):o=new PBMMesh(s,u),o},n.prototype.createCurve=function(t,e){var r=t.children.reduce(function(s,u){return e.has(u.ID)&&(s=e.get(u.ID)),s},null),o=new THREE__namespace.LineBasicMaterial({name:"",color:3342591,linewidth:1});return new THREE__namespace.Line(r,o)},n.prototype.getTransformData=function(t,e){var r={};e.InheritType&&(r.inheritType=parseInt(e.InheritType.value)),e.RotationOrder?r.eulerOrder=getEulerOrder(e.RotationOrder.value):r.eulerOrder=getEulerOrder(0),e.Lcl_Translation&&(r.translation=e.Lcl_Translation.value),e.PreRotation&&(r.preRotation=e.PreRotation.value),e.Lcl_Rotation&&(r.rotation=e.Lcl_Rotation.value),e.PostRotation&&(r.postRotation=e.PostRotation.value),e.Lcl_Scaling&&(r.scale=e.Lcl_Scaling.value),e.ScalingOffset&&(r.scalingOffset=e.ScalingOffset.value),e.ScalingPivot&&(r.scalingPivot=e.ScalingPivot.value),e.RotationOffset&&(r.rotationOffset=e.RotationOffset.value),e.RotationPivot&&(r.rotationPivot=e.RotationPivot.value),t.userData.transformData=r},n.prototype.setLookAtProperties=function(t,e,r,o,s){if("LookAtProperty"in r){var u=o.get(e.ID).children;u.forEach(function(l){if(l.relationship==="LookAtProperty"){var c=t.Objects.Model[l.ID];if(c.Lcl_Translation){var f=c.Lcl_Translation.value;"target"in e&&e.target instanceof THREE__namespace.Object3D?(e.target.position.fromArray(f),s.add(e.target)):e.lookAt(new THREE__namespace.Vector3().fromArray(f))}}})}},n.prototype.bindSkeleton=function(t,e,r,o,s){var u=this.parsePoseNodes(t),l=function(f){var p=e[f],d=s.get(parseInt(p.ID)).parents;d.forEach(function(h){if(r.has(h.ID)){var g=h.ID,m=s.get(g);m.parents.forEach(function(E){if(o.has(E.ID)){var y=o.get(E.ID);y instanceof THREE__namespace.SkinnedMesh&&y.bind(new THREE__namespace.Skeleton(p.bones),u[E.ID])}})}})};for(var c in e)l(c)},n.prototype.parsePoseNodes=function(t){var e={};if(t.Objects.Pose){var r=t.Objects.Pose;for(var o in r)if(r[o].attrType==="BindPose"&&r[o].NbPoseNodes>0){var s=r[o].PoseNode;Array.isArray(s)?s.forEach(function(u){e[u.Node]=new THREE__namespace.Matrix4().fromArray(u.Matrix.a)}):e[s.Node]=new THREE__namespace.Matrix4().fromArray(s.Matrix.a)}}return e},n})(),GeometryParser=(function(){function n(){this.negativeMaterialIndices=!1}return n.prototype.parse=function(t,e,r){var o=new Map;if("Geometry"in t.Objects){var s=t.Objects.Geometry;for(var u in s){var l=r.get(parseInt(u)),c=this.parseGeometry(t,l,s[u],e);o.set(parseInt(u),c)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),o},n.prototype.parseGeometry=function(t,e,r,o){switch(r.attrType){case"Mesh":return this.parseMeshGeometry(t,e,r,o);case"NurbsCurve":return this.parseNurbsGeometry(r)}},n.prototype.parseMeshGeometry=function(t,e,r,o){var s=o.skeletons,u=[],l=e.parents.map(function(h){return t.Objects.Model[h.ID]});if(l.length!==0){var c=e.children.reduce(function(h,g){return s[g.ID]!==void 0&&(h=s[g.ID]),h},null);e.children.forEach(function(h){o.morphTargets[h.ID]!==void 0&&u.push(o.morphTargets[h.ID])});var f=l[0],p={};f.RotationOrder&&(p.eulerOrder=getEulerOrder(f.RotationOrder.value)),f.InheritType&&(p.inheritType=parseInt(f.InheritType.value)),f.GeometricTranslation&&(p.translation=f.GeometricTranslation.value),f.GeometricRotation&&(p.rotation=f.GeometricRotation.value),f.GeometricScaling&&(p.scale=f.GeometricScaling.value);var d=generateTransform(p);return this.genGeometry(t,r,c,u,d)}},n.prototype.genGeometry=function(t,e,r,o,s){var u=new THREE__namespace.BufferGeometry;e.attrName&&(u.name=e.attrName);var l=this.parseGeoNode(e,r),c=this.genBuffers(l),f=new THREE__namespace.Float32BufferAttribute(c.vertex,3);if(f.applyMatrix4(s),u.setAttribute("position",f),c.colors.length>0&&u.setAttribute("color",new THREE__namespace.Float32BufferAttribute(c.colors,3)),r&&(u.setAttribute("skinIndex",new THREE__namespace.Uint16BufferAttribute(c.weightsIndices,4)),u.setAttribute("skinWeight",new THREE__namespace.Float32BufferAttribute(c.vertexWeights,4)),u.FBX_Deformer=r),c.normal.length>0){var p=new THREE__namespace.Matrix3().getNormalMatrix(s),d=new THREE__namespace.Float32BufferAttribute(c.normal,3);d.applyNormalMatrix(p),u.setAttribute("normal",d)}if(c.uvs.forEach(function(y,v){var A=v===0?"uv":"uv".concat(v+1);u.setAttribute(A,new THREE__namespace.Float32BufferAttribute(c.uvs[v],2))}),l.material&&l.material.mappingType!=="AllSame"){var h=c.materialIndex[0],g=0;if(c.materialIndex.forEach(function(y,v){y!==h&&(u.addGroup(g,v-g,h),h=y,g=v)}),u.groups.length>0){var m=u.groups[u.groups.length-1],E=m.start+m.count;E!==c.materialIndex.length&&u.addGroup(E,c.materialIndex.length-E,h)}u.groups.length===0&&u.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(t,u,e,o,s),u},n.prototype.parseGeoNode=function(t,e){var r={};if(r.vertexPositions=t.Vertices!==void 0?t.Vertices.a:[],r.vertexIndices=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(r.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(r.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(r.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){r.uv=[];for(var o=0;t.LayerElementUV[o];)t.LayerElementUV[o].UV&&r.uv.push(this.parseUVs(t.LayerElementUV[o])),o++}return r.weightTable={},e!==null&&(r.skeleton=e,e.rawBones.forEach(function(s,u){s.indices.forEach(function(l,c){r.weightTable[l]===void 0&&(r.weightTable[l]=[]),r.weightTable[l].push({id:u,weight:s.weights[c]})})})),r},n.prototype.genBuffers=function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,o=0,s=!1,u=[],l=[],c=[],f=[],p=[],d=[],h=this;return t.vertexIndices.forEach(function(g,m){var E=0,y=!1;g<0&&(g=g^-1,y=!0);var v=[],A=[];if(u.push(g*3,g*3+1,g*3+2),t.color){var b=getData(m,r,g,t.color);c.push(b[0],b[1],b[2])}if(t.skeleton){if(t.weightTable[g]!==void 0&&t.weightTable[g].forEach(function(w){A.push(w.weight),v.push(w.id)}),A.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);var T=[0,0,0,0],_=[0,0,0,0];A.forEach(function(w,R){var I=w,H=v[R];_.forEach(function(C,M,B){if(I>C){B[M]=I,I=C;var L=T[M];T[M]=H,H=L}})}),v=T,A=_}for(;A.length<4;)A.push(0),v.push(0);for(var S=0;S<4;++S)p.push(A[S]),d.push(v[S])}if(t.normal){var b=getData(m,r,g,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(E=getData(m,r,g,t.material)[0],E<0&&(h.negativeMaterialIndices=!0,E=0)),t.uv&&t.uv.forEach(function(w,R){var I=getData(m,r,g,w);f[R]===void 0&&(f[R]=[]),f[R].push(I[0]),f[R].push(I[1])}),o++,y&&(h.genFace(e,t,u,E,l,c,f,p,d,o),r++,o=0,u=[],l=[],c=[],f=[],p=[],d=[])}),e},n.prototype.getNormalNewell=function(t){for(var e=new THREE__namespace.Vector3(0,0,0),r=0;r<t.length;r++){var o=t[r],s=t[(r+1)%t.length];e.x+=(o.y-s.y)*(o.z+s.z),e.y+=(o.z-s.z)*(o.x+s.x),e.z+=(o.x-s.x)*(o.y+s.y)}return e.normalize(),e},n.prototype.getNormalTangentAndBitangent=function(t){var e=this.getNormalNewell(t),r=Math.abs(e.z)>.5?new THREE__namespace.Vector3(0,1,0):new THREE__namespace.Vector3(0,0,1),o=r.cross(e).normalize(),s=e.clone().cross(o).normalize();return{normal:e,tangent:o,bitangent:s}},n.prototype.flattenVertex=function(t,e,r){return new THREE__namespace.Vector2(t.dot(e),t.dot(r))},n.prototype.genFace=function(t,e,r,o,s,u,l,c,f,p){var d;if(p>3){for(var h=[],g=e.baseVertexPositions||e.vertexPositions,m=0;m<r.length;m+=3)h.push(new THREE__namespace.Vector3(g[r[m]],g[r[m+1]],g[r[m+2]]));for(var E=this.getNormalTangentAndBitangent(h),y=E.tangent,v=E.bitangent,A=[],b=0,T=h;b<T.length;b++){var _=T[b];A.push(this.flattenVertex(_,y,v))}d=THREE__namespace.ShapeUtils.triangulateShape(A,[])}else d=[[0,1,2]];for(var S=function(B,L,O){t.vertex.push(e.vertexPositions[r[B*3]]),t.vertex.push(e.vertexPositions[r[B*3+1]]),t.vertex.push(e.vertexPositions[r[B*3+2]]),t.vertex.push(e.vertexPositions[r[L*3]]),t.vertex.push(e.vertexPositions[r[L*3+1]]),t.vertex.push(e.vertexPositions[r[L*3+2]]),t.vertex.push(e.vertexPositions[r[O*3]]),t.vertex.push(e.vertexPositions[r[O*3+1]]),t.vertex.push(e.vertexPositions[r[O*3+2]]),e.skeleton&&(t.vertexWeights.push(c[B*4]),t.vertexWeights.push(c[B*4+1]),t.vertexWeights.push(c[B*4+2]),t.vertexWeights.push(c[B*4+3]),t.vertexWeights.push(c[L*4]),t.vertexWeights.push(c[L*4+1]),t.vertexWeights.push(c[L*4+2]),t.vertexWeights.push(c[L*4+3]),t.vertexWeights.push(c[O*4]),t.vertexWeights.push(c[O*4+1]),t.vertexWeights.push(c[O*4+2]),t.vertexWeights.push(c[O*4+3]),t.weightsIndices.push(f[B*4]),t.weightsIndices.push(f[B*4+1]),t.weightsIndices.push(f[B*4+2]),t.weightsIndices.push(f[B*4+3]),t.weightsIndices.push(f[L*4]),t.weightsIndices.push(f[L*4+1]),t.weightsIndices.push(f[L*4+2]),t.weightsIndices.push(f[L*4+3]),t.weightsIndices.push(f[O*4]),t.weightsIndices.push(f[O*4+1]),t.weightsIndices.push(f[O*4+2]),t.weightsIndices.push(f[O*4+3])),e.color&&(t.colors.push(u[B*3]),t.colors.push(u[B*3+1]),t.colors.push(u[B*3+2]),t.colors.push(u[L*3]),t.colors.push(u[L*3+1]),t.colors.push(u[L*3+2]),t.colors.push(u[O*3]),t.colors.push(u[O*3+1]),t.colors.push(u[O*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(o),t.materialIndex.push(o),t.materialIndex.push(o)),e.normal&&(t.normal.push(s[B*3]),t.normal.push(s[B*3+1]),t.normal.push(s[B*3+2]),t.normal.push(s[L*3]),t.normal.push(s[L*3+1]),t.normal.push(s[L*3+2]),t.normal.push(s[O*3]),t.normal.push(s[O*3+1]),t.normal.push(s[O*3+2])),e.uv&&e.uv.forEach(function(k,D){t.uvs[D]===void 0&&(t.uvs[D]=[]),t.uvs[D].push(l[D][B*2]),t.uvs[D].push(l[D][B*2+1]),t.uvs[D].push(l[D][L*2]),t.uvs[D].push(l[D][L*2+1]),t.uvs[D].push(l[D][O*2]),t.uvs[D].push(l[D][O*2+1])})},w=0,R=d;w<R.length;w++){var I=R[w],H=I[0],C=I[1],M=I[2];S(H,C,M)}},n.prototype.addMorphTargets=function(t,e,r,o,s){if(o.length!==0){e.morphTargetsRelative=!0,e.morphAttributes.position=[];var u=this;o.forEach(function(l){l.rawTargets.forEach(function(c){var f=t.Objects.Geometry[c.geoID];f!==void 0&&u.genMorphGeometry(e,r,f,s,c.name)})})}},n.prototype.genMorphGeometry=function(t,e,r,o,s){for(var u=e.Vertices!==void 0?e.Vertices.a:[],l=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],c=r.Vertices!==void 0?r.Vertices.a:[],f=r.Indexes?r.Indexes.a:[],p=t.attributes.position.count*3,d=new Float32Array(p),h=0;h<f.length;h++){var g=f[h]*3;d[g]=c[h*3],d[g+1]=c[h*3+1],d[g+2]=c[h*3+2]}var m={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},E=this.genBuffers(m),y=new THREE__namespace.Float32BufferAttribute(E.vertex,3);y.name=s||r.attrName,y.applyMatrix4(o),t.morphAttributes.position.push(y)},n.prototype.parseNormals=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Normals.a,s=[];return r==="IndexToDirect"&&(t.NormalIndex?s=t.NormalIndex.a:t.NormalsIndex&&(s=t.NormalsIndex.a)),{dataSize:3,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseUVs=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.UV.a,s=[];return r==="IndexToDirect"&&(s=t.UVIndex.a),{dataSize:2,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseVertexColors=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Colors.a,s=[];r==="IndexToDirect"&&(s=t.ColorIndex.a);for(var u=0,l=new THREE__namespace.Color;u<o.length;u+=4)l.fromArray(o,u),l.toArray(o,u);return{dataSize:4,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseMaterialIndices=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var o=t.Materials.a,s=[],u=0;u<o.length;++u)s.push(u);return{dataSize:1,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseNurbsGeometry=function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new THREE__namespace.BufferGeometry;for(var r=e-1,o=t.KnotVector.a,s=[],u=t.Points.a,l=0,c=u.length;l<c;l+=4)s.push(new THREE__namespace.Vector4().fromArray(u,l));var f,p;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){f=r,p=o.length-1-f;for(var l=0;l<r;++l)s.push(s[l])}var d=new NURBSCurve(r,o,s,f,p),h=d.getPoints(s.length*12);return new THREE__namespace.BufferGeometry().setFromPoints(h)},n})(),AnimationParser=(function(){function n(){}return n.prototype.parse=function(t,e,r){var o=[],s=this.parseClips(t,e,r);if(s!==void 0)for(var u in s){var l=s[u],c=this.addClip(l,r);o.push(c)}return o},n.prototype.parseClips=function(t,e,r){if(t.Objects.AnimationCurve!==void 0){var o=this.parseAnimationCurveNodes(t);this.parseAnimationCurves(t,o,e);var s=this.parseAnimationLayers(t,o,e,r),u=this.parseAnimStacks(t,s,e);return u}},n.prototype.parseAnimationCurveNodes=function(t){var e=t.Objects.AnimationCurveNode,r=new Map;for(var o in e){var s=e[o];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){var u={id:s.id,attr:s.attrName,curves:{}};r.set(u.id,u)}}return r},n.prototype.parseAnimationCurves=function(t,e,r){var o=t.Objects.AnimationCurve;for(var s in o){var u={id:o[s].id,times:o[s].KeyTime.a.map(convertFBXTimeToSeconds),values:o[s].KeyValueFloat.a},l=r.get(u.id);if(l!==void 0){var c=l.parents[0].ID,f=l.parents[0].relationship,p=e.get(c);p&&(f.match(/X/)?p.curves.x=u:f.match(/Y/)?p.curves.y=u:f.match(/Z/)?p.curves.z=u:f.match(/DeformPercent/)&&e.has(c)&&(p.curves.morph=u))}}},n.prototype.parseAnimationLayers=function(t,e,r,o){var s=t.Objects.AnimationLayer,u=new Map,l=function(f){var p=[],d=r.get(parseInt(f));if(d!==void 0){var h=d.children;h.forEach(function(g,m){if(e.has(g.ID)){var E=e.get(g.ID);if(E.curves.x!==void 0||E.curves.y!==void 0||E.curves.z!==void 0){if(p[m]===void 0){var y=r.get(g.ID).parents.filter(function(R){return R.relationship!==void 0})[0].ID;if(y!==void 0){var v=t.Objects.Model[y.toString()];if(v===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",g);return}var A={modelName:v.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(v.attrName):"",ID:v.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new THREE__namespace.Matrix4,eulerOrder:"",preRotation:[0,0,0],postRotation:[0,0,0]};o.traverse(function(R){R.ID===v.id&&(A.transform=R.matrix,R.userData.transformData&&(A.eulerOrder=R.userData.transformData.eulerOrder))}),A.transform||(A.transform=new THREE__namespace.Matrix4),v.PreRotation&&(A.preRotation=v.PreRotation.value),v.PostRotation&&(A.postRotation=v.PostRotation.value),p[m]=A}}p[m]&&(p[m][E.attr]=E)}else if(E.curves.morph!==void 0){if(p[m]===void 0){var b=r.get(g.ID).parents.filter(function(I){return I.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,y=r.get(_).parents[0].ID,S=t.Objects.Model[y],w={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};p[m]=w}p[m][E.attr]=E}}}),u.set(parseInt(f),p)}};for(var c in s)l(c);return u},n.prototype.parseAnimStacks=function(t,e,r){var o=t.Objects.AnimationStack,s={};for(var u in o){var l=r.get(parseInt(u)).children;l.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var c=e.get(l[0].ID);s[u]={name:o[u].attrName,layer:c}}return s},n.prototype.addClip=function(t,e){var r=[],o=this;return t.layer.forEach(function(s){r=r.concat(o.generateTracks(s,e))}),new THREE__namespace.AnimationClip(t.name,-1,r)},n.prototype.generateTracks=function(t,e){var r=[],o=new THREE__namespace.Vector3,s=new THREE__namespace.Vector3;t.transform&&t.transform.decompose(o,new THREE__namespace.Quaternion,s);var u=o.toArray(),l=s.toArray();if(t.T!==void 0&&Object.keys(t.T.curves).length>0){var c=this.generateVectorTrack(t.modelName,t.T.curves,u,"position");c!==void 0&&r.push(c)}if(t.R!==void 0&&Object.keys(t.R.curves).length>0){var f=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);f!==void 0&&r.push(f)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){var p=this.generateVectorTrack(t.modelName,t.S.curves,l,"scale");p!==void 0&&r.push(p)}if(t.DeformPercent!==void 0){var d=this.generateMorphTrack(t,e);d!==void 0&&r.push(d)}return r},n.prototype.generateVectorTrack=function(t,e,r,o){var s=this.getTimesForAllAxes(e),u=this.getKeyframeTrackValues(s,e,r);return new THREE__namespace.VectorKeyframeTrack(t+"."+o,s,u)},n.prototype.generateRotationTrack=function(t,e,r,o,s){var u,l;if(e.x!==void 0&&e.y!==void 0&&e.z!==void 0){var c=this.interpolateRotations(e.x,e.y,e.z,s);u=c[0],l=c[1]}var f=getEulerOrder(0),p=new THREE__namespace.Quaternion,d=new THREE__namespace.Quaternion;r!==void 0&&(r=r.map(THREE__namespace.MathUtils.degToRad),r.push(f),p.setFromEuler(new THREE__namespace.Euler().fromArray(r))),o!==void 0&&(o=o.map(THREE__namespace.MathUtils.degToRad),o.push(f),d.setFromEuler(new THREE__namespace.Euler().fromArray(o)),d.inverse());var h=new THREE__namespace.Quaternion,g=new THREE__namespace.Euler,m=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var E=0;E<l.length;E+=3){if(g.set(l[E],l[E+1],l[E+2],s),h.setFromEuler(g),h.premultiply(p),h.multiply(d),E>2){var y=new THREE__namespace.Quaternion().fromArray(m,(E-3)/3*4);y.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(m,E/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,m)},n.prototype.generateMorphTrack=function(t,e){var r=t.DeformPercent.curves.morph,o=r.values.map(function(u){return u/100}),s=e.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new THREE__namespace.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+s+"]",r.times,o)},n.prototype.getTimesForAllAxes=function(t){var e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(l,c){return l-c}),e.length>1){for(var r=1,o=e[0],s=1;s<e.length;s++){var u=e[s];u!==o&&(e[r]=u,o=u,r++)}e=e.slice(0,r)}return e},n.prototype.getKeyframeTrackValues=function(t,e,r){var o=r,s=[],u=-1,l=-1,c=-1;return t.forEach(function(f){if(e.x&&(u=e.x.times.indexOf(f)),e.y&&(l=e.y.times.indexOf(f)),e.z&&(c=e.z.times.indexOf(f)),u!==-1){var p=e.x.values[u];s.push(p),o[0]=p}else s.push(o[0]);if(l!==-1){var d=e.y.values[l];s.push(d),o[1]=d}else s.push(o[1]);if(c!==-1){var h=e.z.values[c];s.push(h),o[2]=h}else s.push(o[2])}),s},n.prototype.interpolateRotations=function(t,e,r,o){var s=[],u=[];s.push(t.times[0]),u.push(THREE__namespace.MathUtils.degToRad(t.values[0])),u.push(THREE__namespace.MathUtils.degToRad(e.values[0])),u.push(THREE__namespace.MathUtils.degToRad(r.values[0]));for(var l=1;l<t.values.length;l++){var c=[t.values[l-1],e.values[l-1],r.values[l-1]];if(!(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))){var f=c.map(THREE__namespace.MathUtils.degToRad),p=[t.values[l],e.values[l],r.values[l]];if(!(isNaN(p[0])||isNaN(p[1])||isNaN(p[2]))){p.map(THREE__namespace.MathUtils.degToRad);var d=[p[0]-c[0],p[1]-c[1],p[2]-c[2]],h=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(h[0]>=180||h[1]>=180||h[2]>=180){var g=Math.max.apply(Math,h),m=g/180,E=new THREE__namespace.Euler(f[0],f[1],f[2],o),y=new THREE__namespace.Euler(f[0],f[1],f[2],o),v=new THREE__namespace.Quaternion().setFromEuler(E),A=new THREE__namespace.Quaternion().setFromEuler(y);v.dot(A)&&A.set(-A.x,-A.y,-A.z,-A.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,w=0;w<1;w+=1/m)_.copy(v.clone().slerp(A.clone(),w)),s.push(b+w*T),S.setFromQuaternion(_,o),u.push(S.x),u.push(S.y),u.push(S.z)}else s.push(t.times[l]),u.push(THREE__namespace.MathUtils.degToRad(t.values[l])),u.push(THREE__namespace.MathUtils.degToRad(e.values[l])),u.push(THREE__namespace.MathUtils.degToRad(r.values[l]))}}}return[s,u]},n})(),TextParser=(function(){function n(){this.allNodes=new FBXTree,this.nodeStack=[],this.currentIndent=0,this.currentPropName=""}return n.prototype.getPrevNode=function(){return this.nodeStack[this.currentIndent-2]},n.prototype.getCurrentNode=function(){return this.nodeStack[this.currentIndent-1]},n.prototype.getCurrentProp=function(){return this.currentProp},n.prototype.pushStack=function(t){this.nodeStack.push(t),this.currentIndent+=1},n.prototype.popStack=function(){this.nodeStack.pop(),this.currentIndent-=1},n.prototype.setCurrentProp=function(t,e){this.currentProp=t,this.currentPropName=e},n.prototype.parse=function(t){this.currentIndent=0,this.allNodes=new FBXTree,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach(function(o,s){var u=o.match(/^[\s\t]*;/),l=o.match(/^[\s\t]*$/);if(!(u||l)){var c=o.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){"),f=o.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),p=o.match("^\\t{"+(e.currentIndent-1)+"}}");c?e.parseNodeBegin(o,c):f?e.parseNodeProperty(o,f,r[++s]):p?e.popStack():o.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(o)}}),this.allNodes},n.prototype.parseNodeBegin=function(t,e){var r=e[1].trim().replace(/^"/,"").replace(/"$/,""),o=e[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},u=this.parseNodeAttr(o),l=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in l?(r==="PoseNode"?l.PoseNode.push(s):l[r].id!==void 0&&(l[r]={},l[r][l[r].id]=l[r]),u.id!==""&&(l[r][u.id]=s)):typeof u.id=="number"?(l[r]={},l[r][u.id]=s):r!=="Properties70"&&(r==="PoseNode"?l[r]=[s]:l[r]=s),typeof u.id=="number"&&(s.id=u.id),u.name!==""&&(s.attrName=u.name),u.type!==""&&(s.attrType=u.type),this.pushStack(s)},n.prototype.parseNodeAttr=function(t){var e=t[0];t[0]!==""&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",o="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),o=t[2]),{id:e,name:r,type:o}},n.prototype.parseNodeProperty=function(t,e,r){var o=e[1].replace(/^"/,"").replace(/"$/,"").trim(),s=e[2].replace(/^"/,"").replace(/"$/,"").trim();o==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());var u=this.getCurrentNode(),l=u.name;if(l==="Properties70"){this.parseNodeSpecialProperty(t,o,s);return}if(o==="C"){var c=s.split(",").slice(1),f=parseInt(c[0]),p=parseInt(c[1]),d=s.split(",").slice(3);d=d.map(function(h){return h.trim().replace(/^"/,"")}),o="connections",s=[f,p],append(s,d),u[o]===void 0&&(u[o]=[])}o==="Node"&&(u.id=s),o in u&&Array.isArray(u[o])?u[o].push(s):o!=="a"?u[o]=s:u.a=s,this.setCurrentProp(u,o),o==="a"&&s.slice(-1)!==","&&(u.a=parseNumberArray(s))},n.prototype.parseNodePropertyContinued=function(t){var e=this.getCurrentNode();e.a+=t,t.slice(-1)!==","&&(e.a=parseNumberArray(e.a))},n.prototype.parseNodeSpecialProperty=function(t,e,r){var o=r.split('",').map(function(p){return p.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=o[0],u=o[1],l=o[2],c=o[3],f=o[4];switch(u){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":f=parseFloat(f);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":f=parseNumberArray(f);break}this.getPrevNode()[s]={type:u,type2:l,flag:c,value:f},this.setCurrentProp(this.getPrevNode(),s)},n})(),BinaryParser=(function(){function n(){}return n.prototype.parse=function(t){var e=new BinaryReader(t);e.skip(23);var r=e.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var o=new FBXTree;!this.endOfContent(e);){var s=this.parseNode(e,r);s!==null&&o.add(s.name,s)}return o},n.prototype.endOfContent=function(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()},n.prototype.parseNode=function(t,e){var r={},o=e>=7500?t.getUint64():t.getUint32(),s=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();var u=t.getUint8(),l=t.getString(u);if(o===0)return null;for(var c=[],f=0;f<s;f++)c.push(this.parseProperty(t));var p=c.length>0?c[0]:"",d=c.length>1?c[1]:"",h=c.length>2?c[2]:"";for(r.singleProperty=s===1&&t.getOffset()===o;o>t.getOffset();){var g=this.parseNode(t,e);g!==null&&this.parseSubNode(l,r,g)}return r.propertyList=c,typeof p=="number"&&(r.id=p),d!==""&&(r.attrName=d),h!==""&&(r.attrType=h),l!==""&&(r.name=l),r},n.prototype.parseSubNode=function(t,e,r){if(r.singleProperty===!0){var o=r.propertyList[0];Array.isArray(o)?(e[r.name]=r,r.a=o):e[r.name]=o}else if(t==="Connections"&&r.name==="C"){var s=[];r.propertyList.forEach(function(h,g){g!==0&&s.push(h)}),e.connections===void 0&&(e.connections=[]),e.connections.push(s)}else if(r.name==="Properties70"){var u=Object.keys(r);u.forEach(function(h){e[h]=r[h]})}else if(t==="Properties70"&&r.name==="P"){var l=r.propertyList[0],c=r.propertyList[1],f=r.propertyList[2],p=r.propertyList[3],d=void 0;l.indexOf("Lcl ")===0&&(l=l.replace("Lcl ","Lcl_")),c.indexOf("Lcl ")===0&&(c=c.replace("Lcl ","Lcl_")),c==="Color"||c==="ColorRGB"||c==="Vector"||c==="Vector3D"||c.indexOf("Lcl_")===0?d=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:d=r.propertyList[4],e[l]={type:c,type2:f,flag:p,value:d}}else e[r.name]===void 0?typeof r.id=="number"?(e[r.name]={},e[r.name][r.id]=r):e[r.name]=r:r.name==="PoseNode"?(Array.isArray(e[r.name])||(e[r.name]=[e[r.name]]),e[r.name].push(r)):e[r.name][r.id]===void 0&&(e[r.name][r.id]=r)},n.prototype.parseProperty=function(t){var e=t.getString(1),r;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return r=t.getUint32(),t.getArrayBuffer(r);case"S":return r=t.getUint32(),t.getString(r);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var o=t.getUint32(),s=t.getUint32(),u=t.getUint32();if(s===0)switch(e){case"b":case"c":return t.getBooleanArray(o);case"d":return t.getFloat64Array(o);case"f":return t.getFloat32Array(o);case"i":return t.getInt32Array(o);case"l":return t.getInt64Array(o)}var l=unzlibSync(new Uint8Array(t.getArrayBuffer(u))),c=new BinaryReader(l.buffer);switch(e){case"b":case"c":return c.getBooleanArray(o);case"d":return c.getFloat64Array(o);case"f":return c.getFloat32Array(o);case"i":return c.getInt32Array(o);case"l":return c.getInt64Array(o)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}},n})(),BinaryReader=(function(){function n(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0,this._textDecoder=new TextDecoder}return n.prototype.getOffset=function(){return this.offset},n.prototype.size=function(){return this.dv.buffer.byteLength},n.prototype.skip=function(t){this.offset+=t},n.prototype.getBoolean=function(){return(this.getUint8()&1)===1},n.prototype.getBooleanArray=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e},n.prototype.getUint8=function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t},n.prototype.getInt16=function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},n.prototype.getInt32=function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e},n.prototype.getUint32=function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e&2147483648?(e=~e&4294967295,t=~t&4294967295,t===4294967295&&(e=e+1&4294967295),t=t+1&4294967295,-(e*4294967296+t)):e*4294967296+t},n.prototype.getInt64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e},n.prototype.getUint64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e*4294967296+t},n.prototype.getFloat32=function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getFloat32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e},n.prototype.getFloat64=function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},n.prototype.getFloat64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e},n.prototype.getArrayBuffer=function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},n.prototype.getString=function(t){var e=this.offset,r=new Uint8Array(this.dv.buffer,e,t);this.skip(t);var o=r.indexOf(0);return o>=0&&(r=new Uint8Array(this.dv.buffer,e,o)),this._textDecoder.decode(r)},n})(),FBXTree=(function(){function n(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}return n.prototype.add=function(t,e){this[t]=e},n})();function isFbxFormatBinary(n){var t="Kaydara FBX Binary \0";return n.byteLength>=t.length&&t===convertArrayBufferToString(n,0,t.length)}function isFbxFormatASCII(n){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],e=0;function r(u){var l=n[u-1];return n=n.slice(e+u),e++,l}for(var o=0;o<t.length;++o){var s=r(1);if(s===t[o])return!1}return!0}function getFbxVersion(n){var t=/FBXVersion: (\d+)/,e=n.match(t);if(e){var r=parseInt(e[1]);return r}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function convertFBXTimeToSeconds(n){return n/46186158e3}var dataArray=[];function getData(n,t,e,r){var o;switch(r.mappingType){case"ByPolygonVertex":o=n;break;case"ByPolygon":o=t;break;case"ByVertice":o=e;break;case"AllSame":o=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType),o=0}r.referenceType==="IndexToDirect"&&(o=r.indices[o]);var s=o*r.dataSize,u=s+r.dataSize;return slice(dataArray,r.buffer,s,u)}var tempEuler=new THREE__namespace.Euler,tempVec=new THREE__namespace.Vector3;function generateTransform(n){var t=new THREE__namespace.Matrix4,e=new THREE__namespace.Matrix4,r=new THREE__namespace.Matrix4,o=new THREE__namespace.Matrix4,s=new THREE__namespace.Matrix4,u=new THREE__namespace.Matrix4,l=new THREE__namespace.Matrix4,c=new THREE__namespace.Matrix4,f=new THREE__namespace.Matrix4,p=new THREE__namespace.Matrix4,d=new THREE__namespace.Matrix4,h=new THREE__namespace.Matrix4,g=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var m=getEulerOrder(0);if(n.preRotation){var E=n.preRotation.map(THREE__namespace.MathUtils.degToRad);E.push(m),e.makeRotationFromEuler(tempEuler.fromArray(E))}if(n.rotation){var E=n.rotation.map(THREE__namespace.MathUtils.degToRad);E.push(n.eulerOrder||m),r.makeRotationFromEuler(tempEuler.fromArray(E))}if(n.postRotation){var E=n.postRotation.map(THREE__namespace.MathUtils.degToRad);E.push(m),o.makeRotationFromEuler(tempEuler.fromArray(E)),o.copy(new THREE__namespace.Matrix4().getInverse(o))}n.scale&&s.scale(tempVec.fromArray(n.scale)),n.scalingOffset&&l.setPosition(tempVec.fromArray(n.scalingOffset)),n.scalingPivot&&u.setPosition(tempVec.fromArray(n.scalingPivot)),n.rotationOffset&&c.setPosition(tempVec.fromArray(n.rotationOffset)),n.rotationPivot&&f.setPosition(tempVec.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(d.copy(n.parentMatrix),p.copy(n.parentMatrixWorld));var y=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(p);var A=new THREE__namespace.Matrix4;A.copyPosition(p);var b=new THREE__namespace.Matrix4().getInverse(A).multiply(p),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(g===0)S.copy(v).multiply(y).multiply(T).multiply(_);else if(g===1)S.copy(v).multiply(T).multiply(y).multiply(_);else{var w=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),R=new THREE__namespace.Matrix4().getInverse(w),I=T.clone().multiply(R);S.copy(v).multiply(y).multiply(I).multiply(_)}var H=new THREE__namespace.Matrix4().getInverse(f),C=new THREE__namespace.Matrix4().getInverse(u),M=t.clone().multiply(c).multiply(f).multiply(e).multiply(r).multiply(o).multiply(H).multiply(l).multiply(u).multiply(s).multiply(C),B=new THREE__namespace.Matrix4().copyPosition(M),L=p.clone().multiply(B);return h.copyPosition(L),M=h.clone().multiply(S),M.premultiply(new THREE__namespace.Matrix4().getInverse(p)),M}function getEulerOrder(n){n=n||0;var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return n===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[n]}function parseNumberArray(n){var t=n.split(",").map(function(e){return parseFloat(e)});return t}function convertArrayBufferToString(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=n.byteLength),new TextDecoder().decode(new Uint8Array(n,t,e))}function append(n,t){for(var e=0,r=n.length,o=t.length;e<o;e++,r++)n[r]=t[e]}function slice(n,t,e,r){for(var o=e,s=0;o<r;o++,s++)n[s]=t[o];return n}var NURBSCurve=(function(n){__extends(t,n);function t(e,r,o,s,u){var l=n.call(this)||this,c=r?r.length-1:0,f=o?o.length:0;l.degree=e,l.knots=r,l.controlPoints=[],l.startKnot=s||0,l.endKnot=u||c;for(var p=0;p<f;++p){var d=o[p];l.controlPoints[p]=new THREE__namespace.Vector4(d.x,d.y,d.z,d.w)}return l}return t.prototype.getPoint=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),u=calcBSplinePoint(this.degree,this.knots,this.controlPoints,s);return u.w!==1&&u.divideScalar(u.w),o.set(u.x,u.y,u.z)},t.prototype.getTangent=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),u=calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,s,1);return o.copy(u[1]).normalize(),o},t.prototype.toJSON=function(){var e=n.prototype.toJSON.call(this);return e.degree=this.degree,e.knots=__spreadArray([],this.knots,!0),e.controlPoints=this.controlPoints.map(function(r){return r.toArray()}),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e},t.prototype.fromJSON=function(e){return n.prototype.fromJSON.call(this,e),this.degree=e.degree,this.knots=__spreadArray([],e.knots,!0),this.controlPoints=e.controlPoints.map(function(r){return new THREE__namespace.Vector4(r[0],r[1],r[2],r[3])}),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this},t})(THREE__namespace.Curve);function findSpan(n,t,e){var r=e.length-n-1;if(t>=e[r])return r-1;if(t<=e[n])return n;for(var o=n,s=r,u=Math.floor((o+s)/2);t<e[u]||t>=e[u+1];)t<e[u]?s=u:o=u,u=Math.floor((o+s)/2);return u}function calcBasisFunctions(n,t,e,r){var o=[],s=[],u=[];o[0]=1;for(var l=1;l<=e;++l){s[l]=t-r[n+1-l],u[l]=r[n+l]-t;for(var c=0,f=0;f<l;++f){var p=u[f+1],d=s[l-f],h=o[f]/(p+d);o[f]=c+p*h,c=d*h}o[l]=c}return o}function calcBSplinePoint(n,t,e,r){for(var o=findSpan(n,r,t),s=calcBasisFunctions(o,r,n,t),u=new THREE__namespace.Vector4(0,0,0,0),l=0;l<=n;++l){var c=e[o-n+l],f=s[l],p=c.w*f;u.x+=c.x*p,u.y+=c.y*p,u.z+=c.z*p,u.w+=c.w*f}return u}function calcBasisFunctionDerivatives(n,t,e,r,o){for(var s=[],u=0;u<=e;++u)s[u]=0;for(var l=[],u=0;u<=r;++u)l[u]=s.slice(0);for(var c=[],u=0;u<=e;++u)c[u]=s.slice(0);c[0][0]=1;for(var f=s.slice(0),p=s.slice(0),d=1;d<=e;++d){f[d]=t-o[n+1-d],p[d]=o[n+d]-t;for(var h=0,g=0;g<d;++g){var m=p[g+1],E=f[d-g];c[d][g]=m+E;var y=c[g][d-1]/c[d][g];c[g][d]=h+m*y,h=E*y}c[d][d]=h}for(var d=0;d<=e;++d)l[0][d]=c[d][e];for(var v=0;v<=e;++v){for(var A=0,b=1,T=[],u=0;u<=e;++u)T[u]=s.slice(0);T[0][0]=1;for(var _=1;_<=r;++_){var S=0,w=v-_,R=e-_;v>=_&&(T[b][0]=T[A][0]/c[R+1][w],S=T[b][0]*c[w][R]);for(var I=w>=-1?1:-w,H=v-1<=R?_-1:e-v,C=I;C<=H;++C)T[b][C]=(T[A][C]-T[A][C-1])/c[R+1][w+C],S+=T[b][C]*c[w+C][R];v<=R&&(T[b][_]=-T[A][_-1]/c[R+1][v],S+=T[b][_]*c[v][R]),l[_][v]=S;var d=A;A=b,b=d}}for(var M=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=M;M*=e-_}return l}function calcBSplineDerivatives(n,t,e,r,o){for(var s=o<n?o:n,u=[],l=findSpan(n,r,t),c=calcBasisFunctionDerivatives(l,r,n,s,t),f=[],p=0;p<e.length;++p){var d=e[p].clone(),h=d.w;d.x*=h,d.y*=h,d.z*=h,f[p]=d}for(var g=0;g<=s;++g){for(var d=f[l-n].clone().multiplyScalar(c[g][0]),m=1;m<=n;++m)d.add(f[l-n+m].clone().multiplyScalar(c[g][m]));u[g]=d}for(var g=s+1;g<=o+1;++g)u[g]=new THREE__namespace.Vector4(0,0,0);return u}function calcKoverI(n,t){for(var e=1,r=2;r<=n;++r)e*=r;for(var o=1,r=2;r<=t;++r)o*=r;for(var r=2;r<=n-t;++r)o*=r;return e/o}function calcRationalCurveDerivatives(n){for(var t=n.length,e=[],r=[],o=0;o<t;++o){var s=n[o];e[o]=new THREE__namespace.Vector3(s.x,s.y,s.z),r[o]=s.w}for(var u=[],l=0;l<t;++l){for(var c=e[l].clone(),o=1;o<=l;++o)c.sub(u[l-o].clone().multiplyScalar(calcKoverI(l,o)*r[o]));u[l]=c.divideScalar(r[0])}return u}function calcNURBSDerivatives(n,t,e,r,o){var s=calcBSplineDerivatives(n,t,e,r,o);return calcRationalCurveDerivatives(s)}var _vector=new THREE__namespace.Vector3;function getPointArray(n,t){switch(t){case"D":return new Float64Array(n);case"F":return new Float32Array(n);case"L":return new Int32Array(n);case"I":return new Int16Array(n);default:return new Uint8Array(n)}}function loadX3p(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){var c,f;return u.byteLength=l.body.byteLength,parse$1(new Uint8Array(l.body),{light:(c=t.light)!==null&&c!==void 0?c:!0,color:t.color,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(f=n.split("?")[1])!==null&&f!==void 0?f:""})}).then(function(l){var c=new THREE__namespace.Group;return c.name=n,c.add(l.object),o==="Y"&&c.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"x3p",modelUpAxis:"Z",upAxis:o,uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:[],animations:[],dispose:function(){return l.dispose()}}})}function parse$1(n,t){for(var e,r,o,s,u,l,c,f,p,d,h,g,m,E,y,v,A,b,T,_,S,w,R,I,H,C,M,B,L,O,k,D,q,z,J,V,U,j,K,ae,re,ee,Z,X,se,G,W,$,ne,te,ve,oe,fe,be,ie=unzipSync(n),ue="",me=null,ge=0,Ae=Object.keys(ie);ge<Ae.length;ge++){var xe=Ae[ge];/(^|\/)main\.xml$/i.test(xe)&&(me=ie[xe],ue=xe.slice(0,xe.lastIndexOf("/")+1))}if(!me)throw new Error("X3p: main.xml not found.");if(typeof DOMParser=="undefined")throw new Error("X3p: DOMParser not found.");var de=(e=t.color)!==null&&e!==void 0?e:new THREE__namespace.Color(10066329),_e=new DOMParser,He=decodeText(me),Ee=_e.parseFromString(He,"text/xml"),pe=Ee.querySelector("Record1 Axes"),Ve={x:{type:(s=(o=(r=pe==null?void 0:pe.querySelector("CX AxisType"))===null||r===void 0?void 0:r.textContent)===null||o===void 0?void 0:o.toUpperCase())!==null&&s!==void 0?s:"I",dataType:(c=(l=(u=pe==null?void 0:pe.querySelector("CX DataType"))===null||u===void 0?void 0:u.textContent)===null||l===void 0?void 0:l.toUpperCase())!==null&&c!==void 0?c:"D",increment:Number((p=(f=pe==null?void 0:pe.querySelector("CX Increment"))===null||f===void 0?void 0:f.textContent)!==null&&p!==void 0?p:"1"),offset:Number((h=(d=pe==null?void 0:pe.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(E=(m=(g=pe==null?void 0:pe.querySelector("CY AxisType"))===null||g===void 0?void 0:g.textContent)===null||m===void 0?void 0:m.toUpperCase())!==null&&E!==void 0?E:"I",dataType:(A=(v=(y=pe==null?void 0:pe.querySelector("CY DataType"))===null||y===void 0?void 0:y.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&A!==void 0?A:"D",increment:Number((T=(b=pe==null?void 0:pe.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=pe==null?void 0:pe.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(I=(R=(w=pe==null?void 0:pe.querySelector("CZ AxisType"))===null||w===void 0?void 0:w.textContent)===null||R===void 0?void 0:R.toUpperCase())!==null&&I!==void 0?I:"A",dataType:(M=(C=(H=pe==null?void 0:pe.querySelector("CZ DataType"))===null||H===void 0?void 0:H.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&M!==void 0?M:"D",increment:Number((L=(B=pe==null?void 0:pe.querySelector("CZ Increment"))===null||B===void 0?void 0:B.textContent)!==null&&L!==void 0?L:"1"),offset:Number((k=(O=pe==null?void 0:pe.querySelector("CZ Offset"))===null||O===void 0?void 0:O.textContent)!==null&&k!==void 0?k:"0")}},ye=null,Pe=Ee.querySelector("Record1 Axes Rotation");Pe&&(ye=new THREE__namespace.Matrix3,ye.set(Number((q=(D=Pe.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&q!==void 0?q:0),Number((J=(z=Pe.querySelector("r12"))===null||z===void 0?void 0:z.textContent)!==null&&J!==void 0?J:0),Number((U=(V=Pe.querySelector("r13"))===null||V===void 0?void 0:V.textContent)!==null&&U!==void 0?U:0),Number((K=(j=Pe.querySelector("r21"))===null||j===void 0?void 0:j.textContent)!==null&&K!==void 0?K:0),Number((re=(ae=Pe.querySelector("r22"))===null||ae===void 0?void 0:ae.textContent)!==null&&re!==void 0?re:0),Number((Z=(ee=Pe.querySelector("r23"))===null||ee===void 0?void 0:ee.textContent)!==null&&Z!==void 0?Z:0),Number((se=(X=Pe.querySelector("r31"))===null||X===void 0?void 0:X.textContent)!==null&&se!==void 0?se:0),Number((W=(G=Pe.querySelector("r32"))===null||G===void 0?void 0:G.textContent)!==null&&W!==void 0?W:0),Number((ne=($=Pe.querySelector("r33"))===null||$===void 0?void 0:$.textContent)!==null&&ne!==void 0?ne:0)));var Ce=(te=Ee.querySelector("Record3 DataLink PointDataLink"))===null||te===void 0?void 0:te.textContent;if(typeof Ce!="string")throw new Error("X3p: PointDataLink not found.");Ce=pathJoin(ue,Ce);var $e=ie[Ce];if(!$e)throw new Error("X3p: ".concat($e," not found."));for(var Se=getPointArray($e.buffer,Ve.z.dataType),ze=Number((oe=(ve=Ee.querySelector("Record3 MatrixDimension SizeX"))===null||ve===void 0?void 0:ve.textContent)!==null&&oe!==void 0?oe:"0"),Fe=Number((be=(fe=Ee.querySelector("Record3 MatrixDimension SizeY"))===null||fe===void 0?void 0:fe.textContent)!==null&&be!==void 0?be:"0"),Oe=Math.floor(ze-1),Le=Math.floor(Fe-1),Ue=Oe+1,tt=Le+1,lt=new Float32Array(Ue*tt*3),nt=new Float32Array(Ue*tt*2),ot=new Uint32Array(Oe*Le*6),At=new THREE__namespace.Box3,We=0;We<tt;We++)for(var Mt=We*Ve.y.increment+Ve.y.offset,Be=0;Be<Ue;Be++){var Ne=We*Ue+Be,bt=Be*Ve.x.increment+Ve.x.offset,Ct=Se[Ne],xt=!isNaN(Ct),yt=xt?Ct:NaN;_vector.set(bt,-Mt,yt),ye&&_vector.applyMatrix3(ye),xt&&At.expandByPoint(_vector),lt[Ne*3+0]=_vector.x,lt[Ne*3+1]=_vector.y,lt[Ne*3+2]=_vector.z,nt[Ne*2+0]=Be/Oe,nt[Ne*2+1]=1-We/Le}for(var We=0;We<Le;We++)for(var Be=0;Be<Oe;Be++){var St=Be+Ue*We,rt=Be+Ue*(We+1),at=Be+1+Ue*(We+1),ct=Be+1+Ue*We,Xe=(We*Oe+Be)*6;ot[Xe+0]=St,ot[Xe+1]=rt,ot[Xe+2]=ct,ot[Xe+3]=rt,ot[Xe+4]=at,ot[Xe+5]=ct}var ce=new THREE__namespace.BufferGeometry;ce.setAttribute("position",new THREE__namespace.BufferAttribute(lt,3)),ce.setAttribute("uv",new THREE__namespace.BufferAttribute(nt,2)),ce.setIndex(new THREE__namespace.BufferAttribute(ot,1)),(!ce.groups||ce.groups.length===0)&&ce.addGroup(0,ce.index?ce.index.count:ce.attributes.position.count,0),ce.boundingBox=At;var we=new PBMMeshMaterial(t.light?"phong":"basic");we.flatShading=!0,we.color.copy(de);var Me=new PBMMesh(ce,[we]);return{object:Me,dispose:function(){ce.dispose(),we.dispose()}}}var VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,identityMatrix4$1=new THREE__namespace.Matrix4().identity(),scratchVector=new THREE__namespace.Vector3,scratchMatrix4$5=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3$1=new THREE__namespace.Box3,scratchSphere$2=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$5.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=(function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$5.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$5),this.setFromFrustum(scratchFrustum),this},n.prototype.applyMatrix4=function(t){for(var e=0,r=this.planes;e<r.length;e++){var o=r[e];o.applyMatrix4(t)}},n.prototype.copy=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,o=this.planes;r<o.length;r++){var s=o[r],u=t.intersectPlane(s);switch(u){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,o=Math.min(32,this.planes.length),s=0;s<o;++s){var u=1<<s;if((e&u)!==0){var l=this.planes[s],c=t.intersectPlane(l);if(c===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=u)}}return r},n})(),BoxBoundingVolume=(function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],o=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],p=e[10],d=e[11],h=Math.max(Math.sqrt(r*r+o*o+s*s),.001),g=Math.max(Math.sqrt(u*u+l*l+c*c),.001),m=Math.max(Math.sqrt(f*f+p*p+d*d),.001);this.halfSize.set(h,g,m);var E=this.halfSize.toArray().reduce(function(y,v){return y+v},0);return(isNaN(E)||E<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/g,l/g,c/g,f/m,p/m,d/m]),isNaN(this.rotation.toArray().reduce(function(y,v){return y+v},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return t.equals(identityMatrix4$1)?this:(scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$5.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this)},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.rotation.elements,r=t.x-this.center.x,o=t.y-this.center.y,s=t.z-this.center.z,u=0,l;return l=r*e[0]+o*e[1]+s*e[2],l<0&&(l=-l),l-=this.halfSize.x,l>0&&(u+=l*l),l=r*e[3]+o*e[4]+s*e[5],l<0&&(l=-l),l-=this.halfSize.y,l>0&&(u+=l*l),l=r*e[6]+o*e[7]+s*e[8],l<0&&(l=-l),l-=this.halfSize.z,l>0&&(u+=l*l),u},n.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSquaredToPoint(t))},n.prototype.distanceToPlane=function(t){var e=t.projectPoint(this.center,new THREE__namespace.Vector3);return this.distanceToPoint(e)},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),e=new Float32Array(24);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,o=this.rotation.elements,s=this.halfSize,u=r.x,l=r.y,c=r.z,f=Math.abs(u*o[0]*s.x+l*o[1]*s.x+c*o[2]*s.x)+Math.abs(u*o[3]*s.y+l*o[4]*s.y+c*o[5]*s.y)+Math.abs(u*o[6]*s.z+l*o[7]*s.z+c*o[8]*s.z),p=r.dot(e)+t.constant;return p<=-f?VolumePlaneIntersect.Outside:p>=f?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e,r){if(e===void 0&&(e=0),scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3$1.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),scratchBox3$1.expandByScalar(e),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$5),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3$1.containsPoint(scratchRay$1.origin))return!0;var o=scratchRay$1.intersectBox(scratchBox3$1,scratchVector);return o?r!==void 0?(r+=e,o.distanceToSquared(scratchRay$1.origin)<=r*r):!0:!1},n})(),SphereBoundingVolume=(function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+Math.sin(o)*this.radius,e[r*6+2]=this.center.z+0,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+Math.sin(o)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(o)*this.radius,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(o)*this.radius}var s=new THREE__namespace.BufferGeometry;return s.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),s.computeBoundingBox(),s.computeBoundingSphere(),s},n.prototype.applyMatrix4=function(t){return t.equals(identityMatrix4$1)?this:(this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this)},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.distanceToPoint(t);return e*e},n.prototype.distanceToPoint=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.distanceToPlane=function(t){var e=Math.abs(t.distanceToPoint(this.center));return Math.max(0,e-this.radius)},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,o=t.normal,s=o.dot(e)+t.constant;return s<-r?VolumePlaneIntersect.Outside:s<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e,r){if(e===void 0&&(e=0),scratchSphere$2.set(this.center,this.radius+e),scratchSphere$2.containsPoint(t.origin))return!0;var o=t.intersectSphere(scratchSphere$2,scratchVector);return o?r!==void 0?(r+=e,t.origin.distanceToSquared(o)<=r*r):!0:!1},n})(),RegionBoundingVolume=(function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceToPlane=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r){throw new Error("not implemented")},n})();function isBoundingVolume(n){return n instanceof BoxBoundingVolume||n instanceof SphereBoundingVolume||n instanceof RegionBoundingVolume}function makeBoundingVolume(n){if(isBoundingVolume(n))return n;if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})}),debugBoxGeometry=(function(){var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e})(),debugSphereGeometry=(function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o})();function createDebugBoundingMesh(n,t){if(t===void 0&&(t=0),n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}return null}var scratchVector3$a=new THREE__namespace.Vector3,scratchPlane=new THREE__namespace.Plane,scratchSphereBoundingVolume$1=new SphereBoundingVolume,scratchBoxBoundingVolume$1=new BoxBoundingVolume,Tile=(function(){function n(t,e,r,o){var s=this,u,l,c,f;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,centerScreenY:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=o!=null?o:null,this.contentParent=o?o.hasRenderContent?o:o.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(u=e.refine)!==null&&u!==void 0?u:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(l=this.parent)===null||l===void 0?void 0:l.geometricError)!==null&&c!==void 0?c:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,byteLength:0,memoryUsage:0},e.content.group!==void 0&&(this.content.group=e.content.group),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type==="SCENEGRAPH"&&(this.levelOfContent=this.levelOfContent+1),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(f=e.extras)!==null&&f!==void 0?f:{},typeof this.extras.floor!="number"&&o&&typeof o.extras.floor=="number"&&(this.extras.floor=o.extras.floor),typeof this.extras.floor=="number"&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),e.children?this.children=e.children.map(function(p,d){return new n("".concat(s.id,".").concat(d),p,r,s)}):this.children=[]}return n.prototype.traverse=function(t){t(this);for(var e=0,r=this.children;e<r.length;e++){var o=r[e];o.traverse(t)}},n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transform;if(this.boundingVolume){var r=void 0;this.boundingVolume instanceof BoxBoundingVolume?r=scratchBoxBoundingVolume$1.copy(this.boundingVolume):this.boundingVolume instanceof SphereBoundingVolume?r=scratchSphereBoundingVolume$1.copy(this.boundingVolume):r=this.boundingVolume.clone(),r.applyMatrix4(e),t.camera.type==="OrthographicCamera"?(scratchPlane.setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position),this.state.distanceToCamera=r.distanceToPlane(scratchPlane)):this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var o=r.getCenter(scratchVector3$a).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(o),this.state.centerScreenY=t.camera.up.dot(o);var s=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,s),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,t.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if((this.levelOfContent<=t.minLevelOfDetail||this.geometricError>=t.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){var u=void 0;this.viewerRequestVolume instanceof BoxBoundingVolume?u=scratchBoxBoundingVolume$1.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof SphereBoundingVolume?u=scratchSphereBoundingVolume$1.copy(this.viewerRequestVolume):u=this.viewerRequestVolume.clone(),u.applyMatrix4(e),this.state.inRequestVolume=u.distanceSquaredToPoint(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentMemoryUsage",{get:function(){return this.content?this.content.memoryUsage:0},enumerable:!1,configurable:!0}),n.prototype.getScreenSpaceError=function(t,e,r){var o=this.tileset.transform.getMaxScaleOnAxis(),s=this.parent?this.parent.geometricError:this.tileset.geometricError,u=o*(r?s:this.geometricError);if(u===0)return 0;var l=t.height,c=t.sseDenominator;if(t.camera.type==="OrthographicCamera"){var f=t.camera.projectionMatrix.elements,p=1/(f[5]/2),d=.9,h=p/l*d,g=u/h;return g}else{var m=Math.max(e,.001),h=m*c/l,g=u/h;return g}},n.prototype.getPriority=function(t){var e=this.refine==="ADD"||t.skipLevelOfDetail;if(e&&!this.state.visible||t.frameNumber-this.state.touchedFrameNumber>=1)return-1;var r=this.parent,o=r&&(!e||this.state.screenSpaceError===0),s=o?r.state.screenSpaceError:this.state.screenSpaceError,u=this.tileset.root?this.tileset.root.state.screenSpaceError:0,l=Math.max(u-s,0);return l},n})(),defaultIterator=function(n){return Number(n)};function arrayMin(n,t,e){var r;t===void 0&&(t=defaultIterator),e===void 0&&(e=!1);for(var o,s=1/0,u=0,l=n;u<l.length;u++){var c=l[u],f=t(c);f<=s&&(r=[c,f],o=r[0],s=r[1])}return isFinite(s)||(s=0),e?[o,s]:o}function arrayEqual(n,t,e){e===void 0&&(e=function(s,u){return s===u});var r=n.length;if(r!==t.length)return!1;for(var o=0;o<r;o++)if(e(n[o],t[o])===!1)return!1;return!0}var arrayUniqueSet=new Set;function arrayUnique(n){arrayUniqueSet.clear();for(var t=[],e=n.length,r=0;r<e;r++){var o=n[r];arrayUniqueSet.has(o)||(t.push(o),arrayUniqueSet.add(o))}return arrayUniqueSet.clear(),t}var arrayMinCallback=function(n){return n.distance},intersectDistanceSortCallback=function(n,t){return n.distance-t.distance};function sortIntersects(n,t,e){if(t===void 0&&(t=!0),e===void 0&&(e=!1),e&&n.length>1){var r=arrayMin(n,arrayMinCallback);r?(n[0]=r,n.length=1):n.length=0}return t&&n.length>1&&n.sort(intersectDistanceSortCallback),n}var BVHObject=(function(){function n(t,e){this.position=t,this.indices=e}return n.prototype.getPositionCount=function(){var t,e,r=this.indices,o=this.position;return r?r.array.length/((t=r.stride)!==null&&t!==void 0?t:1):o.array.length/((e=o.stride)!==null&&e!==void 0?e:3)},n.prototype.getPositionByIndex=function(t,e){var r,o,s,u,l=this.indices,c=this.position,f=t;if(l){var p=l.array,d=(r=l.stride)!==null&&r!==void 0?r:1,h=(o=l.offset)!==null&&o!==void 0?o:0;f=p[t*d+h]}var g=c.array,m=(s=c.stride)!==null&&s!==void 0?s:3,E=(u=c.offset)!==null&&u!==void 0?u:0;return f=f*m+E,e.x=g[f],e.y=g[f+1],e.z=g[f+2],e},n.prototype.createTree=function(t,e,r){throw new Error("not implemented")},n.prototype.trianglesInSphere=function(t,e){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r,o,s){throw new Error("not implemented")},n})(),BVHNode=(function(){function n(t,e,r,o,s){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=o,this.deepth=s}return n})(),BYTES_PER_NODE=36;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),o=new Uint32Array(e),s=new Uint16Array(e),u=[n],l,c;l=u.pop();)c=l.id*BYTES_PER_NODE/4,r[c]=l.extents[0],r[c+1]=l.extents[1],r[c+2]=l.extents[2],r[c+3]=l.extents[3],r[c+4]=l.extents[4],r[c+5]=l.extents[5],o[c+6]=l.startIndex,o[c+7]=l.endIndex,c=l.id*BYTES_PER_NODE/2,l.node0&&(s[c+16]=l.node0.id,u.push(l.node0)),l.node1&&(s[c+17]=l.node1.id,u.push(l.node1));return e}function intersectNodeBox(n,t,e,r){r===void 0&&(r=0);var o=e.min.x-r,s=e.min.y-r,u=e.min.z-r,l=e.max.x+r,c=e.max.y+r,f=e.max.z+r,p=0,d=0,h=0,g=0,m=0,E=0;return t.x>=0?(p=(o-n.x)*t.x,d=(l-n.x)*t.x):(p=(l-n.x)*t.x,d=(o-n.x)*t.x),t.y>=0?(h=(s-n.y)*t.y,g=(c-n.y)*t.y):(h=(c-n.y)*t.y,g=(s-n.y)*t.y),p>g||h>d||((h>p||p!==p)&&(p=h),(g<d||d!==d)&&(d=g),t.z>=0?(m=(u-n.z)*t.z,E=(f-n.z)*t.z):(m=(f-n.z)*t.z,E=(u-n.z)*t.z),p>E||m>d)||((m>p||p!==p)&&(p=m),(E<d||d!==d)&&(d=E),d<0)?null:p>=0?p:d}var BVHVector3=(function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,o=this.z;return this.x=r*t.z-o*t.y,this.y=o*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,o=t.y,s=t.z,u=e.x,l=e.y,c=e.z;return this.x=o*c-s*l,this.y=s*u-r*c,this.z=r*l-o*u,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,o=this.z-t.z;return e*e+r*r+o*o},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n})(),BVHIntersect=(function(){function n(t,e,r,o,s){this.pointA=t,this.pointB=e,this.pointC=r,this.index=o,this.intersectionPoint=s}return n})(),BVHBox3=(function(){function n(t,e){this.min=t,this.max=e}return n})(),EPSILON$1=1e-6,scratchVector3$9=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionCount()/3,u=s>65535?new Uint32Array(s):new Uint16Array(s),l=new Float32Array(s*6),c=[],f=0,p=-1;if(o)for(var d=0;d<s;d+=1){var h=d*3,g=d*6,m=void 0,E=void 0,y=void 0,v=void 0,A=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),m=v=scratchVector3A.x,T=scratchVector3B.x,T<m&&(m=T),T>v&&(v=T),T=scratchVector3C.x,T<m&&(m=T),T>v&&(v=T),E=A=scratchVector3A.y,T=scratchVector3B.y,T<E&&(E=T),T>A&&(A=T),T=scratchVector3C.y,T<E&&(E=T),T>A&&(A=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=m,l[g+1]=E,l[g+2]=y,l[g+3]=v,l[g+4]=A,l[g+5]=b}else{for(var _=1/0,S=1/0,w=1/0,R=-1/0,I=-1/0,H=-1/0,d=0;d<s;d+=1){var h=d*3,g=d*6,m=void 0,E=void 0,y=void 0,v=void 0,A=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),m=v=scratchVector3A.x,T=scratchVector3B.x,T<m&&(m=T),T>v&&(v=T),T=scratchVector3C.x,T<m&&(m=T),T>v&&(v=T),E=A=scratchVector3A.y,T=scratchVector3B.y,T<E&&(E=T),T>A&&(A=T),T=scratchVector3C.y,T<E&&(E=T),T>A&&(A=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=m,l[g+1]=E,l[g+2]=y,l[g+3]=v,l[g+4]=A,l[g+5]=b,m<_&&(_=m),v>R&&(R=v),E<S&&(S=E),A>I&&(I=A),y<w&&(w=y),b>H&&(H=b)}o=[_,S,w,R,I,H]}var C=new BVHNode(++p,o,0,s,0);c[f++]=C;var M=[],B=[0,1,2],L=function(k,D){return M[D]-M[k]};function O(k){var D=k.startIndex,q=k.endIndex,z=k.extents;M[0]=z[3]-z[0],M[1]=z[4]-z[1],M[2]=z[5]-z[2],B.sort(L);for(var J=0;J<3;J++){for(var V=B[J],U=z[V]+z[V+3],j=D,K=q-1,ae=-1,re=void 0;j<=K;)ae===-1?(re=u[j],l[re*6+V]+l[re*6+V+3]<U?j++:ae=re):(re=u[K],l[re*6+V]+l[re*6+V+3]>=U||(u[j]=re,u[K]=ae,ae=-1,j++),K--);if(j>D&&j<q){var ee=new BVHNode(++p,calcExtents(u,l,D,j,EPSILON$1),D,j,k.deepth+1);ee.deepth<r&&ee.endIndex-ee.startIndex>e&&(c[f++]=ee);var Z=new BVHNode(++p,calcExtents(u,l,j,q,EPSILON$1),j,q,k.deepth+1);Z.deepth<r&&Z.endIndex-Z.startIndex>e&&(c[f++]=Z),k.node0=ee,k.node1=Z,k.startIndex=0,k.endIndex=0;break}}}for(;f;)O(c[--f]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(C,p+1),c.length=0,this},t.prototype.trianglesInSphere=function(e,r){for(var o=this.offsetArray,s=this.rootNodePacked,u=new Float32Array(s),l=new Uint32Array(s),c=new Uint16Array(s),f=[0],p=[],d;(d=f.pop())!==void 0;){var h=d*BYTES_PER_NODE/4,g=clamp(e.x,u[h],u[h+3])-e.x,m=clamp(e.y,u[h+1],u[h+4])-e.y,E=clamp(e.z,u[h+2],u[h+5])-e.z;if(g*g+m*m+E*E<=r*r){for(var y=l[h+6],v=l[h+7],A=y;A<v;A++){var b=o[A];p.push(b)}var T=d*BYTES_PER_NODE/2,_=c[T+16],S=c[T+17];_&&f.push(_),S&&f.push(S)}}for(var w=p.length,R=new Float32Array(w*9),A=0;A<w;A++){var b=p[A],I=b*3;this.getPositionByIndex(I,scratchVector3$9),R[A*9]=scratchVector3$9.x,R[A*9+1]=scratchVector3$9.y,R[A*9+2]=scratchVector3$9.z,this.getPositionByIndex(I+1,scratchVector3$9),R[A*9+3]=scratchVector3$9.x,R[A*9+4]=scratchVector3$9.y,R[A*9+5]=scratchVector3$9.z,this.getPositionByIndex(I+2,scratchVector3$9),R[A*9+6]=scratchVector3$9.x,R[A*9+7]=scratchVector3$9.y,R[A*9+8]=scratchVector3$9.z}return R},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,f=this.rootNodePacked,p=new Float32Array(f),d=new Uint32Array(f),h=new Uint16Array(f),g=new BVHVector3(1/r.x,1/r.y,1/r.z),m=[0],E,y=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),v=1/0;(E=m.pop())!==void 0;){var A=E*BYTES_PER_NODE/4;y.min.x=p[A],y.min.y=p[A+1],y.min.z=p[A+2],y.max.x=p[A+3],y.max.y=p[A+4],y.max.z=p[A+5];var b=intersectNodeBox(e,g,y,o);if(b!==null&&!(s&&b>v)){for(var T=e.x,_=e.y,S=e.z,w=r.x,R=r.y,I=r.z,H=d[A+6],C=d[A+7],M=H;M<C;M++){var B=c[M],L=B*3,O=new BVHVector3(0,0,0);this.getPositionByIndex(L,O);var k=O.x,D=O.y,q=O.z,z=new BVHVector3(0,0,0);this.getPositionByIndex(L+1,z);var J=z.x,V=z.y,U=z.z,j=new BVHVector3(0,0,0);this.getPositionByIndex(L+2,j);var K=j.x,ae=j.y,re=j.z,ee=J-k,Z=V-D,X=U-q,se=K-k,G=ae-D,W=re-q,$=Z*W-X*G,ne=X*se-ee*W,te=ee*G-Z*se,ve=w*$+R*ne+I*te,oe=void 0;if(ve>0)oe=1;else if(ve<0)oe=-1,ve=-ve;else continue;var fe=T-k,be=_-D,ie=S-q,ue=oe*(w*(be*W-ie*G)+R*(ie*se-fe*W)+I*(fe*G-be*se));if(!(ue<0)){var me=oe*(w*(Z*ie-X*be)+R*(X*fe-ee*ie)+I*(ee*be-Z*fe));if(!(me<0)&&!(ue+me>ve)){var ge=-oe*(fe*$+be*ne+ie*te);if(!(ge<0)){var Ae=ge/ve,xe=new BVHVector3(T+w*Ae,_+R*Ae,S+I*Ae),de=new BVHIntersect(O,z,j,B,xe);(!u||u(de))&&(s?Ae<v&&(v=Ae,l.length>0&&(l.length=0),l.push(de)):l.push(de))}}}}var _e=E*BYTES_PER_NODE/2,He=h[_e+16],Ee=h[_e+17];He&&m.push(He),Ee&&m.push(Ee)}}return l},t})(BVHObject);function clamp(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,o){if(e>=r)return[0,0,0,0,0,0];for(var s=1/0,u=1/0,l=1/0,c=-1/0,f=-1/0,p=-1/0,d=e;d<r;d++){var h=n[d]*6,g=t[h];g<s&&(s=g),g=t[h+1],g<u&&(u=g),g=t[h+2],g<l&&(l=g),g=t[h+3],g>c&&(c=g),g=t[h+4],g>f&&(f=g),g=t[h+5],g>p&&(p=g)}return[s-o,u-o,l-o,c+o,f+o,p+o]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$8=new BVHVector3(0,0,0),BVHPoints=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionByIndex.bind(this),u=this.getPositionCount(),l=u>65535?new Uint32Array(u):new Uint16Array(u),c=[],f=0,p=-1;if(o)for(var d=0;d<u;d+=1)l[d]=d;else{s(0,scratchVector3$8);for(var h=scratchVector3$8.x,g=scratchVector3$8.y,m=scratchVector3$8.z,E=h,y=g,v=m,d=0;d<u;d+=1){l[d]=d,s(d,scratchVector3$8);var A=scratchVector3$8.x,b=scratchVector3$8.y,T=scratchVector3$8.z;A<h?h=A:A>E&&(E=A),b<g?g=b:b>y&&(y=b),T<m?m=T:T>v&&(v=T)}o=[h,g,m,E,y,v]}var _=new BVHNode(++p,o,0,u,0);c[f++]=_;var S=[],w=[0,1,2],R=function(H,C){return S[C]-S[H]};function I(H){var C=H.startIndex,M=H.endIndex,B=H.extents;S[0]=B[3]-B[0],S[1]=B[4]-B[1],S[2]=B[5]-B[2];for(var L=w.sort(R)[0],O=ORDER_AXISES[L],k=(B[L]+B[L+3])/2,D=C,q=M-1,z=-1,J;D<=q;)z===-1?(J=l[D],s(J,scratchVector3$8),scratchVector3$8[O]<k?D++:z=J):(J=l[q],s(J,scratchVector3$8),scratchVector3$8[O]>=k||(l[D]=J,l[q]=z,z=-1,D++),q--);if(D>C){var V=B.slice();V[L+3]=k+EPSILON;var U=new BVHNode(++p,V,C,D,H.deepth+1);U.deepth<r&&U.endIndex-U.startIndex>e&&(c[f++]=U),H.node0=U}if(M>D){var j=B.slice();j[L]=k-EPSILON;var K=new BVHNode(++p,j,D,M,H.deepth+1);K.deepth<r&&K.endIndex-K.startIndex>e&&(c[f++]=K),H.node1=K}H.startIndex=0,H.endIndex=0}for(;f;)I(c[--f]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,p+1),c.length=0,this},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,f=this.rootNodePacked,p=new Float32Array(f),d=new Uint32Array(f),h=new Uint16Array(f),g=o*o,m=new BVHVector3(1/r.x,1/r.y,1/r.z),E=[0],y,v=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),A=1/0;(y=E.pop())!==void 0;){var b=y*BYTES_PER_NODE/4;v.min.x=p[b],v.min.y=p[b+1],v.min.z=p[b+2],v.max.x=p[b+3],v.max.y=p[b+4],v.max.z=p[b+5];var T=intersectNodeBox(e,m,v,o);if(T!==null&&!(s&&T>A)){for(var _=d[b+6],S=d[b+7],w=_;w<S;w++){var R=c[w],I=new BVHVector3(0,0,0);this.getPositionByIndex(R,I);var H=I.x,C=I.y,M=I.z,B=e.x,L=e.y,O=e.z,k=r.x,D=r.y,q=r.z,z=k*(H-B)+D*(C-L)+q*(M-O);if(z>0?(B+=k*z,L+=D*z,O+=q*z):z<0&&(z=0),k=H-B,D=C-L,q=M-O,k*k+D*D+q*q<=g){var J=new BVHVector3(B,L,O),V=new BVHIntersect(I,I,I,R,J);(!u||u(V))&&(s?z<A&&(A=z,l.length>0&&(l.length=0),l.push(V)):l.push(V))}}var U=y*BYTES_PER_NODE/2,j=h[U+16],K=h[U+17];j&&E.push(j),K&&E.push(K)}}return l},t})(BVHObject);const jsContent=`(function(){"use strict";var ur=function(o,r){return ur=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},ur(o,r)};function yr(o,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");ur(o,r);function t(){this.constructor=o}o.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}typeof SuppressedError=="function"&&SuppressedError;var cr=(function(){function o(r,t){this.position=r,this.indices=t}return o.prototype.getPositionCount=function(){var r,t,n=this.indices,e=this.position;return n?n.array.length/((r=n.stride)!==null&&r!==void 0?r:1):e.array.length/((t=e.stride)!==null&&t!==void 0?t:3)},o.prototype.getPositionByIndex=function(r,t){var n,e,h,v,i=this.indices,f=this.position,l=r;if(i){var y=i.array,s=(n=i.stride)!==null&&n!==void 0?n:1,d=(e=i.offset)!==null&&e!==void 0?e:0;l=y[r*s+d]}var u=f.array,x=(h=f.stride)!==null&&h!==void 0?h:3,w=(v=f.offset)!==null&&v!==void 0?v:0;return l=l*x+w,t.x=u[l],t.y=u[l+1],t.z=u[l+2],t},o.prototype.createTree=function(r,t,n){throw new Error("not implemented")},o.prototype.trianglesInSphere=function(r,t){throw new Error("not implemented")},o.prototype.intersectRay=function(r,t,n,e,h){throw new Error("not implemented")},o})(),D=(function(){function o(r,t,n,e,h){this.id=r,this.extents=t,this.startIndex=n,this.endIndex=e,this.deepth=h}return o})(),X=36;function lr(o,r){for(var t=new ArrayBuffer(r*X),n=new Float32Array(t),e=new Uint32Array(t),h=new Uint16Array(t),v=[o],i,f;i=v.pop();)f=i.id*X/4,n[f]=i.extents[0],n[f+1]=i.extents[1],n[f+2]=i.extents[2],n[f+3]=i.extents[3],n[f+4]=i.extents[4],n[f+5]=i.extents[5],e[f+6]=i.startIndex,e[f+7]=i.endIndex,f=i.id*X/2,i.node0&&(h[f+16]=i.node0.id,v.push(i.node0)),i.node1&&(h[f+17]=i.node1.id,v.push(i.node1));return t}function dr(o,r,t,n){n===void 0&&(n=0);var e=t.min.x-n,h=t.min.y-n,v=t.min.z-n,i=t.max.x+n,f=t.max.y+n,l=t.max.z+n,y=0,s=0,d=0,u=0,x=0,w=0;return r.x>=0?(y=(e-o.x)*r.x,s=(i-o.x)*r.x):(y=(i-o.x)*r.x,s=(e-o.x)*r.x),r.y>=0?(d=(h-o.y)*r.y,u=(f-o.y)*r.y):(d=(f-o.y)*r.y,u=(h-o.y)*r.y),y>u||d>s||((d>y||y!==y)&&(y=d),(u<s||s!==s)&&(s=u),r.z>=0?(x=(v-o.z)*r.z,w=(l-o.z)*r.z):(x=(l-o.z)*r.z,w=(v-o.z)*r.z),y>w||x>s)||((x>y||y!==y)&&(y=x),(w<s||s!==s)&&(s=w),s<0)?null:y>=0?y:s}var H=(function(){function o(r,t,n){this.x=r,this.y=t,this.z=n}return o.prototype.copy=function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this},o.prototype.set=function(r,t,n){return this.x=r,this.y=t,this.z=n,this},o.prototype.fromArray=function(r,t){return t===void 0&&(t=0),this.x=r[t],this.y=r[t+1],this.z=r[t+2],this},o.prototype.toArray=function(r,t){return r===void 0&&(r=[]),t===void 0&&(t=0),r[t]=this.x,r[t+1]=this.y,r[t+2]=this.z,r},o.prototype.add=function(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this},o.prototype.multiplyScalar=function(r){return this.x*=r,this.y*=r,this.z*=r,this},o.prototype.subVectors=function(r,t){return this.x=r.x-t.x,this.y=r.y-t.y,this.z=r.z-t.z,this},o.prototype.addScaledVector=function(r,t){return this.x+=r.x*t,this.y+=r.y*t,this.z+=r.z*t,this},o.prototype.dot=function(r){return this.x*r.x+this.y*r.y+this.z*r.z},o.prototype.cross=function(r){var t=this.x,n=this.y,e=this.z;return this.x=n*r.z-e*r.y,this.y=e*r.x-t*r.z,this.z=t*r.y-n*r.x,this},o.prototype.crossVectors=function(r,t){var n=r.x,e=r.y,h=r.z,v=t.x,i=t.y,f=t.z;return this.x=e*f-h*i,this.y=h*v-n*f,this.z=n*i-e*v,this},o.prototype.distanceTo=function(r){return Math.sqrt(this.distanceToSquared(r))},o.prototype.distanceToSquared=function(r){var t=this.x-r.x,n=this.y-r.y,e=this.z-r.z;return t*t+n*n+e*e},o.prototype.clone=function(){return new o(this.x,this.y,this.z)},o})(),wr=(function(){function o(r,t,n,e,h){this.pointA=r,this.pointB=t,this.pointC=n,this.index=e,this.intersectionPoint=h}return o})(),xr=(function(){function o(r,t){this.min=r,this.max=t}return o})(),pr=1e-6,J=new H(0,0,0),Y=new H(0,0,0),g=new H(0,0,0),Z=new H(0,0,0),Hr=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionCount()/3,v=h>65535?new Uint32Array(h):new Uint16Array(h),i=new Float32Array(h*6),f=[],l=0,y=-1;if(e)for(var s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p}else{for(var F=1/0,k=1/0,E=1/0,S=-1/0,V=-1/0,U=-1/0,s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p,x<F&&(F=x),I>S&&(S=I),w<k&&(k=w),c>V&&(V=c),z<E&&(E=z),p>U&&(U=p)}e=[F,k,E,S,V,U]}var W=new D(++y,e,0,h,0);f[l++]=W;var M=[],T=[0,1,2],j=function(P,B){return M[B]-M[P]};function q(P){var B=P.startIndex,_=P.endIndex,A=P.extents;M[0]=A[3]-A[0],M[1]=A[4]-A[1],M[2]=A[5]-A[2],T.sort(j);for(var $=0;$<3;$++){for(var C=T[$],G=A[C]+A[C+3],N=B,L=_-1,O=-1,Q=void 0;N<=L;)O===-1?(Q=v[N],i[Q*6+C]+i[Q*6+C+3]<G?N++:O=Q):(Q=v[L],i[Q*6+C]+i[Q*6+C+3]>=G||(v[N]=Q,v[L]=O,O=-1,N++),L--);if(N>B&&N<_){var R=new D(++y,zr(v,i,B,N,pr),B,N,P.deepth+1);R.deepth<n&&R.endIndex-R.startIndex>t&&(f[l++]=R);var b=new D(++y,zr(v,i,N,_,pr),N,_,P.deepth+1);b.deepth<n&&b.endIndex-b.startIndex>t&&(f[l++]=b),P.node0=R,P.node1=b,P.startIndex=0,P.endIndex=0;break}}}for(;l;)q(f[--l]);return this.offsetArray=v,this.rootNodePacked=lr(W,y+1),f.length=0,this},r.prototype.trianglesInSphere=function(t,n){for(var e=this.offsetArray,h=this.rootNodePacked,v=new Float32Array(h),i=new Uint32Array(h),f=new Uint16Array(h),l=[0],y=[],s;(s=l.pop())!==void 0;){var d=s*X/4,u=fr(t.x,v[d],v[d+3])-t.x,x=fr(t.y,v[d+1],v[d+4])-t.y,w=fr(t.z,v[d+2],v[d+5])-t.z;if(u*u+x*x+w*w<=n*n){for(var z=i[d+6],I=i[d+7],c=z;c<I;c++){var p=e[c];y.push(p)}var a=s*X/2,F=f[a+16],k=f[a+17];F&&l.push(F),k&&l.push(k)}}for(var E=y.length,S=new Float32Array(E*9),c=0;c<E;c++){var p=y[c],V=p*3;this.getPositionByIndex(V,J),S[c*9]=J.x,S[c*9+1]=J.y,S[c*9+2]=J.z,this.getPositionByIndex(V+1,J),S[c*9+3]=J.x,S[c*9+4]=J.y,S[c*9+5]=J.z,this.getPositionByIndex(V+2,J),S[c*9+6]=J.x,S[c*9+7]=J.y,S[c*9+8]=J.z}return S},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=new H(1/n.x,1/n.y,1/n.z),x=[0],w,z=new xr(new H(0,0,0),new H(0,0,0)),I=1/0;(w=x.pop())!==void 0;){var c=w*X/4;z.min.x=y[c],z.min.y=y[c+1],z.min.z=y[c+2],z.max.x=y[c+3],z.max.y=y[c+4],z.max.z=y[c+5];var p=dr(t,u,z,e);if(p!==null&&!(h&&p>I)){for(var a=t.x,F=t.y,k=t.z,E=n.x,S=n.y,V=n.z,U=s[c+6],W=s[c+7],M=U;M<W;M++){var T=f[M],j=T*3,q=new H(0,0,0);this.getPositionByIndex(j,q);var P=q.x,B=q.y,_=q.z,A=new H(0,0,0);this.getPositionByIndex(j+1,A);var $=A.x,C=A.y,G=A.z,N=new H(0,0,0);this.getPositionByIndex(j+2,N);var L=N.x,O=N.y,Q=N.z,R=$-P,b=C-B,or=G-_,er=L-P,vr=O-B,sr=Q-_,Ar=b*sr-or*vr,Pr=or*er-R*sr,Br=R*vr-b*er,m=E*Ar+S*Pr+V*Br,rr=void 0;if(m>0)rr=1;else if(m<0)rr=-1,m=-m;else continue;var tr=a-P,nr=F-B,ir=k-_,Sr=rr*(E*(nr*sr-ir*vr)+S*(ir*er-tr*sr)+V*(tr*vr-nr*er));if(!(Sr<0)){var Nr=rr*(E*(b*ir-or*nr)+S*(or*tr-R*ir)+V*(R*nr-b*tr));if(!(Nr<0)&&!(Sr+Nr>m)){var Vr=-rr*(tr*Ar+nr*Pr+ir*Br);if(!(Vr<0)){var ar=Vr/m,jr=new H(a+E*ar,F+S*ar,k+V*ar),hr=new wr(q,A,N,T,jr);(!v||v(hr))&&(h?ar<I&&(I=ar,i.length>0&&(i.length=0),i.push(hr)):i.push(hr))}}}}var Tr=w*X/2,Ur=d[Tr+16],_r=d[Tr+17];Ur&&x.push(Ur),_r&&x.push(_r)}}return i},r})(cr);function fr(o,r,t){return o<r?r:o>t?t:o}function zr(o,r,t,n,e){if(t>=n)return[0,0,0,0,0,0];for(var h=1/0,v=1/0,i=1/0,f=-1/0,l=-1/0,y=-1/0,s=t;s<n;s++){var d=o[s]*6,u=r[d];u<h&&(h=u),u=r[d+1],u<v&&(v=u),u=r[d+2],u<i&&(i=u),u=r[d+3],u>f&&(f=u),u=r[d+4],u>l&&(l=u),u=r[d+5],u>y&&(y=u)}return[h-e,v-e,i-e,f+e,l+e,y+e]}var Ir=1e-6,kr=["x","y","z"],K=new H(0,0,0),Er=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionByIndex.bind(this),v=this.getPositionCount(),i=v>65535?new Uint32Array(v):new Uint16Array(v),f=[],l=0,y=-1;if(e)for(var s=0;s<v;s+=1)i[s]=s;else{h(0,K);for(var d=K.x,u=K.y,x=K.z,w=d,z=u,I=x,s=0;s<v;s+=1){i[s]=s,h(s,K);var c=K.x,p=K.y,a=K.z;c<d?d=c:c>w&&(w=c),p<u?u=p:p>z&&(z=p),a<x?x=a:a>I&&(I=a)}e=[d,u,x,w,z,I]}var F=new D(++y,e,0,v,0);f[l++]=F;var k=[],E=[0,1,2],S=function(U,W){return k[W]-k[U]};function V(U){var W=U.startIndex,M=U.endIndex,T=U.extents;k[0]=T[3]-T[0],k[1]=T[4]-T[1],k[2]=T[5]-T[2];for(var j=E.sort(S)[0],q=kr[j],P=(T[j]+T[j+3])/2,B=W,_=M-1,A=-1,$;B<=_;)A===-1?($=i[B],h($,K),K[q]<P?B++:A=$):($=i[_],h($,K),K[q]>=P||(i[B]=$,i[_]=A,A=-1,B++),_--);if(B>W){var C=T.slice();C[j+3]=P+Ir;var G=new D(++y,C,W,B,U.deepth+1);G.deepth<n&&G.endIndex-G.startIndex>t&&(f[l++]=G),U.node0=G}if(M>B){var N=T.slice();N[j]=P-Ir;var L=new D(++y,N,B,M,U.deepth+1);L.deepth<n&&L.endIndex-L.startIndex>t&&(f[l++]=L),U.node1=L}U.startIndex=0,U.endIndex=0}for(;l;)V(f[--l]);return this.offsetArray=i,this.rootNodePacked=lr(F,y+1),f.length=0,this},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=e*e,x=new H(1/n.x,1/n.y,1/n.z),w=[0],z,I=new xr(new H(0,0,0),new H(0,0,0)),c=1/0;(z=w.pop())!==void 0;){var p=z*X/4;I.min.x=y[p],I.min.y=y[p+1],I.min.z=y[p+2],I.max.x=y[p+3],I.max.y=y[p+4],I.max.z=y[p+5];var a=dr(t,x,I,e);if(a!==null&&!(h&&a>c)){for(var F=s[p+6],k=s[p+7],E=F;E<k;E++){var S=f[E],V=new H(0,0,0);this.getPositionByIndex(S,V);var U=V.x,W=V.y,M=V.z,T=t.x,j=t.y,q=t.z,P=n.x,B=n.y,_=n.z,A=P*(U-T)+B*(W-j)+_*(M-q);if(A>0?(T+=P*A,j+=B*A,q+=_*A):A<0&&(A=0),P=U-T,B=W-j,_=M-q,P*P+B*B+_*_<=u){var $=new H(T,j,q),C=new wr(V,V,V,S,$);(!v||v(C))&&(h?A<c&&(c=A,i.length>0&&(i.length=0),i.push(C)):i.push(C))}}var G=z*X/2,N=d[G+16],L=d[G+17];N&&w.push(N),L&&w.push(L)}}return i},r})(cr);function Mr(o){onmessage=function(r){Promise.resolve(r.data).then(function(t){return o(t)}).then(function(t){var n=t.output,e=t.transfer;return postMessage(n,e)}).catch(function(t){return postMessage({$$error:t})})}}Mr(function(o){return Promise.resolve(o).then(function(r){for(var t=[],n=new Set,e=0,h=r;e<h.length;e++){var v=h[e],i=void 0;if(v.type==="mesh")i=new Hr(v.attributes.position,v.indices);else if(v.type==="points")i=new Er(v.attributes.position,v.indices);else throw new Error("Invalid Type");i.createTree(v.maxItemPerNode,v.maxTreeDepth,v.extents);var f={type:v.type,attributes:v.attributes,indices:v.indices,offsetArray:i.offsetArray,rootNodePacked:i.rootNodePacked};t.push(f);var l=void 0;for(var y in f.attributes){var s=f.attributes[y];s&&s.buffer instanceof ArrayBuffer&&n.add(s.buffer)}l=f.indices,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),l=f.offsetArray,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),n.add(f.rootNodePacked)}return{output:t,transfer:Array.from(n)}})})})();
919
919
  `,blob=typeof self!="undefined"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",jsContent],{type:"text/javascript;charset=utf-8"});function WorkerWrapper(n){let t;try{if(t=blob&&(self.URL||self.webkitURL).createObjectURL(blob),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(jsContent),{name:n==null?void 0:n.name})}}var bvhWorkerPool=new WorkerPool(function(){return new WorkerWrapper},4),defaultHitFilter=function(){return!0},scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,intersectsMap=new Map;function raycastMesh(n,t,e,r){var o,s,u=n.matrixWorld;scratchInverseMatrix.getInverse(u),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);var l=(o=e.hitFilter)!==null&&o!==void 0?o:defaultHitFilter,c=(s=e.firstHitOnly)!==null&&s!==void 0?s:!1,f=n.geometry,p=n.material,d=f.groups,h=f.index;intersectsMap.clear();for(var g=t.intersectRay(scratchRay.origin,scratchRay.direction,0,c,function(v){var A,b=v.index,T=b*3,_;if(Array.isArray(p)){if(d)for(var S=0,w=d;S<w.length;S++){var R=w[S];if(T>=R.start&&T-R.start<R.count){_=p[(A=R.materialIndex)!==null&&A!==void 0?A:0];break}}}else _=p;if(!_)return!1;var I=v.intersectionPoint,H=new THREE__namespace.Vector3(I.x,I.y,I.z).applyMatrix4(u),C=e.ray.origin.distanceTo(H);if(C<e.near||C>e.far)return!1;var M=v.pointA,B=v.pointB,L=v.pointC,O=THREE__namespace.Triangle.getNormal(scratchIntersectionFaceA.set(M.x,M.y,M.z).applyMatrix4(u),scratchIntersectionFaceB.set(B.x,B.y,B.z).applyMatrix4(u),scratchIntersectionFaceC.set(L.x,L.y,L.z).applyMatrix4(u),new THREE__namespace.Vector3),k=e.ray.direction.dot(O);if(_.side===THREE__namespace.FrontSide&&k>=0||_.side===THREE__namespace.BackSide&&k<=0)return!1;var D=new THREE__namespace.Face3(h?h.array[T]:T,h?h.array[T+1]:T+1,h?h.array[T+2]:T+2,O),q={distance:C,object:n,face:D,point:H,distanceToRay:0,faceIndex:b};return intersectsMap.set(v,q),l(q)}),m=g.length,E=0;E<m;E++){var y=intersectsMap.get(g[E]);y&&r.push(y)}intersectsMap.clear()}function raycastPoints(n,t,e,r){var o,s,u,l,c=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(c),scratchInverseMatrix.getInverse(c),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);var f=((s=(o=e.params.Points)===null||o===void 0?void 0:o.threshold)!==null&&s!==void 0?s:1)*scratchInverseMatrix.getMaxScaleOnAxis(),p=(u=e.hitFilter)!==null&&u!==void 0?u:defaultHitFilter,d=(l=e.firstHitOnly)!==null&&l!==void 0?l:!1,h=n.geometry,g=h.index,m=h.getAttribute("normal"),E=m instanceof THREE__namespace.BufferAttribute;intersectsMap.clear();for(var y=t.intersectRay(scratchRay.origin,scratchRay.direction,f,d,function(T){var _=T.intersectionPoint,S=new THREE__namespace.Vector3(_.x,_.y,_.z).applyMatrix4(c),w=e.ray.origin.distanceTo(S);if(w<e.near||w>e.far)return!1;var R=T.pointA,I=scratchIntersectionFaceA.set(R.x,R.y,R.z).applyMatrix4(c),H=T.index,C=g?g.array[H]:H,M;if(E){var B=new THREE__namespace.Vector3().fromBufferAttribute(m,C).applyNormalMatrix(scratchNormalMatrix);M=new THREE__namespace.Face3(C,C,C,B)}var L={distance:w,object:n,face:M,point:S,distanceToRay:S.distanceTo(I),index:H};return intersectsMap.set(T,L),p(L)}),v=y.length,A=0;A<v;A++){var b=intersectsMap.get(y[A]);b&&r.push(b)}intersectsMap.clear()}var BVH_MESH_PROP="__bvh_mesh__",originMeshRaycast=THREE__namespace.Mesh.prototype.raycast;function overrideMeshRaycast(n,t){var e=getBvhTreeForMesh(this);e?raycastMesh(this,e,n,t):originMeshRaycast.call(this,n,t)}function getBvhTreeForMesh(n){var t=n[BVH_MESH_PROP];return t instanceof BVHMesh,t}function bindBvhTreeForMesh(n,t){var e;Object.assign(n,(e={},e[BVH_MESH_PROP]=t,e.raycast=overrideMeshRaycast,e))}var BVH_POINTS_PROP="__bvh_points__",originPointsRaycast=THREE__namespace.Points.prototype.raycast;function overridePointsRaycast(n,t){var e=getBvhTreeForPoints(this);e?raycastPoints(this,e,n,t):originPointsRaycast.call(this,n,t)}function getBvhTreeForPoints(n){var t=n[BVH_POINTS_PROP];return t instanceof BVHPoints,t}function bindBvhTreeForPoints(n,t){var e;Object.assign(n,(e={},e[BVH_POINTS_PROP]=t,e.raycast=overridePointsRaycast,e))}function generateBvhTree(n,t,e,r){var o=[];return n.traverse(function(s){(s instanceof THREE__namespace.Mesh||s instanceof THREE__namespace.Points)&&s.geometry instanceof THREE__namespace.BufferGeometry&&o.push(s)}),Promise.resolve().then(function(){for(var s=[],u=new Set,l=null,c=0;c<o.length;c++){var f=o[c],p=f.geometry;if(p instanceof THREE__namespace.BufferGeometry){var d=void 0;if(f instanceof THREE__namespace.Mesh?d="mesh":f instanceof THREE__namespace.Points&&(d="points"),!!d){var h=p.boundingBox,g=h?[h.min.x,h.min.y,h.min.z,h.max.x,h.max.y,h.max.z]:void 0,m={};for(var E in p.attributes){var y=p.attributes[E];y instanceof THREE__namespace.InterleavedBufferAttribute?(m[E]={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(m[E]={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var v=void 0,A=p.getIndex();A&&(A instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:A.data.array,stride:A.data.stride,offset:A.offset},l=A.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(v={array:A.array},l=A.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:d,attributes:m,indices:v,maxItemPerNode:e,maxTreeDepth:r,extents:g};s.push(b)}}}return bvhWorkerPool.postMessage(s,Array.from(u))}).then(function(s){for(var u=0;u<o.length;u++){var l=o[u],c=l.geometry,f=s[u];if(c instanceof THREE__namespace.BufferGeometry){for(var p in f.attributes){var d=f.attributes[p].array,h=c.attributes[p];h instanceof THREE__namespace.InterleavedBufferAttribute?h.data.array=d:h.array=d}var g=c.getIndex();if(g&&f.indices){var d=f.indices.array;g instanceof THREE__namespace.InterleavedBufferAttribute?g.data.array=d:g.array=d}if(l instanceof THREE__namespace.Mesh){var m=new BVHMesh(f.attributes.position,f.indices);m.offsetArray=f.offsetArray,m.rootNodePacked=f.rootNodePacked,bindBvhTreeForMesh(l,m)}else if(l instanceof THREE__namespace.Points){var m=new BVHPoints(f.attributes.position,f.indices);m.offsetArray=f.offsetArray,m.rootNodePacked=f.rootNodePacked,bindBvhTreeForPoints(l,m)}}}return n})}function mixNumber(n,t,e){return n+(t-n)*e}function value(n,t,e,r){var o=(t*e+2*n)/Math.pow(e,3),s=-(2*t*e+3*n)/Math.pow(e,2),u=t,l=n;return o*Math.pow(r,3)+s*Math.pow(r,2)+u*r+l}function velocity(n,t,e,r){var o=(t*e+2*n)/Math.pow(e,3),s=-(2*t*e+3*n)/Math.pow(e,2),u=t;return 3*o*Math.pow(r,2)+2*s*r+u}function mixCircle(n,t,e,r){var o=r[1]-r[0];return n=circleValue(n,r),t=circleValue(t,r),t-n>o/2?mixNumber(n+o,t,e):n-t>o/2?mixNumber(n-o,t,e):mixNumber(n,t,e)}function circleValue(n,t){var e=t[1]-t[0];return n<t[0]?circleValue(n+e,t):n>=t[1]?circleValue(n-e,t):n}function mixValue(n,t,e,r){return r?mixCircle(n,t,e,r):mixNumber(n,t,e)}function toNumber(n){var t=Number(n);return isNaN(t)||!isFinite(t)?0:t}var Motion=(function(){function n(t){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=now(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var e in t){var r=t[e];typeof r=="object"?(this.value[e]=toNumber(r.value),this.config[e]={circle:r.circle}):(this.value[e]=toNumber(r),this.config[e]={circle:!1})}this.keyframes=[{progress:0,value:__assign({},this.value)},{progress:1,value:__assign({},this.value)}]}return n.prototype.getProgress=function(t){var e=t-this.startTime;return e<0?0:e>=this.duration?1:1-value(1,this.startVelocity,this.duration,e)},n.prototype.getValue=function(t){for(var e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t){var r=this.keyframes[e-1],o=this.keyframes[e],s={};for(var u in this.config){var l=(t-r.progress)/(o.progress-r.progress);s[u]=mixValue(r.value[u],o.value[u],l,this.config[u].circle)}return s}return __assign({},this.keyframes[this.keyframes.length-1].value)},n.prototype.getProgressVelocity=function(t){var e=t-this.startTime;return e>=this.duration?0:velocity(1,this.startVelocity,this.duration,e)},n.prototype.update=function(t){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(t))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},n.prototype.getKeyFrameSegment=function(t){for(var e=this.getProgress(t),r=1;r<this.keyframes.length;r++)if(this.keyframes[r].progress>e)return[this.keyframes[r-1],this.keyframes[r]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},n.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},n.prototype.set=function(t,e,r,o){var s;r===void 0&&(r=0),isNaN(e)&&(e=0),isNaN(r)&&(r=0),o=o!=null?o:now();var u=this.getProgress(o),l=this.getValue(u),c={};for(var f in this.config)c[f]=(s=t[f])!==null&&s!==void 0?s:l[f];var p=[{progress:0,value:l},{progress:1,value:c}];return this.setKeyframes(p,e,r,o)},n.prototype.setKeyframes=function(t,e,r,o){var s=this;if(r===void 0&&(r=0),t.length<2)throw new Error("keyframes invalid.");return isNaN(e)&&(e=0),isNaN(r)&&(r=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(u,l){o=o!=null?o:now(),s.progress=0,s.ended=!1,s.startTime=o,s.startVelocity=r,s.keyframes=t,s.duration=e,e===0?(s.progress=1,s.value=__assign({},t[t.length-1].value)):s.value=__assign({},t[0].value),s.callbacks=[u,l]})},n.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},n})(),easeInCubic=function(n){return n*n*n},easeInQuart=function(n){return n*n*n*n},APPEAR_ANIMATION_DURATION=500,versionMap$1=new WeakMap,scratchIntersectPoint=new THREE__namespace.Vector3,scratchClippingBoxMatrixInverse=new THREE__namespace.Matrix4,TileNode=(function(n){__extends(t,n);function t(e,r,o,s){s===void 0&&(s=noop);var u=n.call(this)||this;return u.name=e,u.materials=[],u.pbmObjects=[],u.contentObject=r,u.animations=o,u.appearMotion=new Motion({appear:0}),u.disposers=[s],u.add(r),r.traverse(function(l){if(l instanceof THREE__namespace.Mesh||l instanceof THREE__namespace.Points){var c=l.material;if(Array.isArray(c))for(var f=0;f<c.length;f++)u.materials.push(c[f]);else u.materials.push(c)}(l instanceof PBMMesh||l instanceof PBMSkinnedMesh||l instanceof PBMPointCloud)&&u.pbmObjects.push(l)}),u}return t.prototype.generateBvhTree=function(){return generateBvhTree(this,!0,200,20)},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=e.hitFilter;e.hitFilter=function(p){if(p.object instanceof PBMPointCloud&&p.object.material.pointBack==="HIDDEN"&&p.face&&p.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;var d=0,h=-1;if((p.object instanceof PBMMesh||p.object instanceof PBMSkinnedMesh||p.object instanceof PBMPointCloud)&&p.face){var g=Array.isArray(p.object.material)?p.object.material[p.face.materialIndex]:p.object.material;if(g){d=g.floorIndex,h=g.shownFloorIndex;for(var m=0,E=g.clippers;m<E.length;m++){var y=E[m];if(!(typeof y.floorIndex=="number"&&y.floorIndex!==d)&&(scratchClippingBoxMatrixInverse.getInverse(y.clippingBoxMatrix),scratchIntersectPoint.copy(p.point).applyMatrix4(scratchClippingBoxMatrixInverse),Math.abs(scratchIntersectPoint.x)<.5&&Math.abs(scratchIntersectPoint.y)<.5&&Math.abs(scratchIntersectPoint.z)<.5))return!1}}}var v=h;return e.floorIndex!==void 0?v=e.floorIndex:e.floor!==void 0&&(v=e.floor===null?-1:e.floor),v>=0&&d!==v?!1:(Object.assign(p,{floorIndex:d,floor:d}),s?s.call(e,p):!0)};for(var u=this.children.slice(),l;l=u.pop();)if(l.visible){l.raycast(e,o);for(var c=0,f=l.children.length;c<f;c++)u.push(l.children[c])}return e.hitFilter=s,sortIntersects(o,e.sortByDistance,e.firstHitOnly),o},t.prototype.update=function(e,r,o,s,u,l){var c=!1,f=s.visible&&u.state.selectedFrameNumber===u.tileset.frameNumber;if(f){var p=1;this.appearMotion.getTargetKeyframe().value.appear!==p&&this.appearMotion.set({appear:p},APPEAR_ANIMATION_DURATION).catch(noop)}else{var p=0;this.appearMotion.getTargetKeyframe().value.appear!==p&&this.appearMotion.set({appear:p},0).catch(noop)}this.appearMotion.ended!==!0&&this.appearMotion.update(r.time);for(var d=0,h=this.pbmObjects;d<h.length;d++){var g=h[d];if(g instanceof PBMMesh||g instanceof PBMSkinnedMesh){var m=updatePBMMesh(g,this.appearMotion,e,r,o,u,l);m===!0&&(c=!0)}else if(g instanceof PBMPointCloud){var m=updatePBMPointCloud(g,this.appearMotion,e,r,o,u,l);m===!0&&(c=!0)}}return c},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var o=r[e];o()}this.disposers.length=0,this.pbmObjects.length=0},t.prototype.clone=function(){return new t(this.name,this.contentObject.clone(),this.animations)},t})(THREE__namespace.Object3D);function updatePBMMesh(n,t,e,r,o,s,u){var l=!1;if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),l=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var c=n.material,f=0,p=c;f<p.length;f++){var d=p[f];d.customShaders=u.customShaders,d.pano0=u.pano0,d.pano1=u.pano1,d.pano0Depth=u.pano0Depth,d.pano1Depth=u.pano1Depth,d.refinedScreen=u.refinedScreen,d.modelAlpha=u.modelAlpha,d.progress=u.progress,d.transition=u.transition,d.opacity=u.opacity,d.floorStyle=u.floorStyle,d.constantColor=u.constantColor,d.shownFloorIndex=u.shownFloorIndex,d.clippers=u.clippers,d.brightness=u.brightness,d.useHQWeight=u.useHQWeight,d.useHQDepth=u.useHQDepth,d.colorSaturation=u.colorSaturation,d.colorBrightness=u.colorBrightness,d.gradientTexture=u.gradientTexture,d.vertexMarks=u.vertexMarks,d.modelBoundingMax.copy(u.boundingBox.max),d.modelBoundingMin.copy(u.boundingBox.min),d.shaderType==="none"?(d.transparent=!0,d.blending=THREE__namespace.NormalBlending,d.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,d.blendEquation=THREE__namespace.AddEquation,d.blendSrcAlpha=null,d.blendDstAlpha=null,d.blendEquationAlpha=null,d.depthWrite=!1,d.depthTest=!0):(d.transparent=d.alphaMode==="BLEND",d.blending=THREE__namespace.NormalBlending,d.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,d.blendEquation=THREE__namespace.AddEquation,d.blendSrcAlpha=null,d.blendDstAlpha=null,d.blendEquationAlpha=null,d.depthWrite=!0,d.depthTest=!0,u.useAddBlend&&(d.depthWrite=!1,d.depthTest=!1,d.blending=THREE__namespace.AdditiveBlending),d.shownFloorIndex>-1&&d.shownFloorIndex!==d.floorIndex&&(d.transparent=!0),d.opacity<1&&(d.transparent=!0),d.alphaMap&&(d.transparent=!0),d.brightness<1&&(d.transparent=!0),d.modelAlpha<=0&&(d.transparent=!1),d.depthWrite=!d.transparent,u.useAddBlend&&(d.depthWrite=!1,d.depthTest=!1,d.blending=THREE__namespace.AdditiveBlending))}}return l}function updatePBMPointCloud(n,t,e,r,o,s,u){var l,c,f=!1;if(u.pointAppearAnimation===!0&&s.refine==="ADD"&&s.tileset.rootMeta.pntsOrder==="RANDOM"){var p=n.geometry,d=s.tileset.currentMaxScreenSpaceError,h=s.state.screenSpaceError,g=(c=(l=s.parent)===null||l===void 0?void 0:l.state.screenSpaceError)!==null&&c!==void 0?c:h,m=1;g!==h&&(m=(g-d)/(g-h)),m=clamp$1(m,0,1),m=easeInCubic(m);var E=p.index?p.index.count:p.attributes.position?p.attributes.position.count:1/0,y=Math.floor(E*m*t.value.appear);p.drawRange.count!==y&&(p.setDrawRange(0,y),f=!0)}if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),f=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var v=[n.material],A=0,b=v;A<b.length;A++){var T=b[A];T.customShaders=u.customShaders,T.pointScale=u.pointScale,T.pointMinPixel=u.pointMinPixel,T.pointMaxPixel=u.pointMaxPixel,T.pointSize=u.pointSize,T.pointShape=u.pointShape,T.pointBack=u.pointBack,T.modelAlpha=u.modelAlpha,T.opacity=u.opacity,T.floorStyle=u.floorStyle,T.constantColor=u.constantColor,T.shownFloorIndex=u.shownFloorIndex,T.clippers=u.clippers,T.brightness=u.brightness,T.useHQWeight=u.useHQWeight,T.useHQDepth=u.useHQDepth,T.colorSaturation=u.colorSaturation,T.colorBrightness=u.colorBrightness,T.outlineGain=u.outlineGain,T.distanceGain=u.distanceGain,T.gradientTexture=u.gradientTexture,T.transparent=!1,T.blending=THREE__namespace.NormalBlending,T.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,T.blendEquation=THREE__namespace.AddEquation,T.blendSrcAlpha=null,T.blendDstAlpha=null,T.blendEquationAlpha=null,T.colorWrite=!0,T.depthWrite=!0,T.depthTest=!0,T.modelBoundingMax.copy(u.boundingBox.max),T.modelBoundingMin.copy(u.boundingBox.min),T.shownFloorIndex>-1&&(T.transparent=T.shownFloorIndex!==T.floorIndex),T.modelAlpha<1&&(T.transparent=!0),T.opacity<1&&(T.transparent=!0),T.brightness<1&&(T.transparent=!0),u.useAddBlend&&(T.depthWrite=!1,T.depthTest=!1,T.blending=THREE__namespace.AdditiveBlending),T.useHQWeight&&(T.depthWrite=!1,T.blending=THREE__namespace.CustomBlending,T.blendSrc=THREE__namespace.SrcAlphaFactor,T.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,T.blendDst=THREE__namespace.OneFactor,T.blendDstAlpha=THREE__namespace.OneFactor),T.useHQDepth&&(T.colorWrite=!1)}}return f}var Trajectory=(function(){function n(t,e,r){this.id=t,this.name=e.name,this.visible=!1,this.tileset=r,this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.transform.premultiply(this.tileset.root.transform),this.content={uri:e.file,byteLength:0,memoryUsage:0,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,data:void 0}}return n})(),TrajectoryNode=(function(n){__extends(t,n);function t(e,r,o){o===void 0&&(o=noop);var s=n.call(this)||this;return s.name=e,s.contentObject=r,s.name=e,s.add(r),s.disposers=[o],s}return t.prototype.update=function(e,r,o,s,u,l){var c=this.contentObject.material[2];return c.uniforms.dashOffset.value=(c.uniforms.dashOffset.value-.003)%(c.uniforms.dashSize.value.x+c.uniforms.dashSize.value.y),!0},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var o=r[e];o()}this.disposers.length=0},t.prototype.clone=function(){return new t(this.name,this.contentObject.clone())},t})(THREE__namespace.Object3D),priorityCache=new Map;function getPriority(n,t,e){if(e&&e.has(t))return e.get(t);var r=t.refine==="ADD"||n.skipLevelOfDetail,o=t.parent,s=o&&(!r||t.state.screenSpaceError===0),u=s?o.state.screenSpaceError:t.state.screenSpaceError,l=t.tileset.root?t.tileset.root.state.screenSpaceError:0,c=Math.max(l-u,0);return e&&e.set(t,c),c}var TileRequestScheduler=(function(){function n(t,e){this.tileset=t,this.options=e,this.activeRequests=0,this.requestQueue=[]}return n.prototype.reset=function(){for(var t=0,e=this.requestQueue;t<e.length;t++){var r=e[t];this.options.onTileSkip&&(r.tile.content&&this.tileset.options.tileUnloader(r.tile),this.options.onTileSkip(r.tile))}this.requestQueue.length=0},n.prototype.update=function(t,e,r){for(var o=this,s=r.time,u=this.requestQueue,l=new Set(t),c=0;c<u.length;c++){var f=u[c];if(l.has(f.tile)){l.delete(f.tile);continue}f.status==="WAITING"&&(u.splice(c,1),c--,this.options.onTileSkip&&this.options.onTileSkip(f.tile))}l.size>0&&(l.forEach(function(v){u.push({tile:v,status:"WAITING",time:s,error:null})}),l.clear());for(var p=r.maxRequests,c=0;c<u.length&&p>0;c++){var f=u[c];if(f.status==="DONE")f.error!==null?this.options.onTileError&&this.options.onTileError(f.tile,f.error):(p--,f.tile.content&&(f.tile.content.loadState="READY"),this.options.onTileLoad&&this.options.onTileLoad(f.tile)),u.splice(c,1),c--;else if(f.status==="PENDING"&&s-f.time<1e3)break}switch(priorityCache.clear(),e){case"SCREEN_SPACE_ERROR":{u.sort(function(v,A){if(v.tile.state.requestedFrameNumber!==A.tile.state.requestedFrameNumber)return A.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber;if(v.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(r,v.tile,priorityCache),T=getPriority(r,A.tile,priorityCache);return b-T}else return v.tile.level!==A.tile.level?v.tile.level-A.tile.level:v.tile.state.distanceToCamera-A.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(v,A){return v.tile.state.requestedFrameNumber!==A.tile.state.requestedFrameNumber?A.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.state.centerScreenY!==A.tile.state.centerScreenY?v.tile.state.centerScreenY-A.tile.state.centerScreenY:v.tile.state.centerZDepth!==A.tile.state.centerZDepth?v.tile.state.centerZDepth-A.tile.state.centerZDepth:v.tile.level!==A.tile.level?v.tile.level-A.tile.level:v.tile.state.distanceToCamera-A.tile.state.distanceToCamera:v.tile.level!==A.tile.level?v.tile.level-A.tile.level:v.tile.state.distanceToCamera-A.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(v,A){return v.tile.state.requestedFrameNumber!==A.tile.state.requestedFrameNumber?A.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.level!==A.tile.level?v.tile.level-A.tile.level:v.tile.state.centerScreenY!==A.tile.state.centerScreenY?v.tile.state.centerScreenY-A.tile.state.centerScreenY:v.tile.state.centerZDepth!==A.tile.state.centerZDepth?v.tile.state.centerZDepth-A.tile.state.centerZDepth:v.tile.state.distanceToCamera-A.tile.state.distanceToCamera:v.tile.level!==A.tile.level?v.tile.level-A.tile.level:v.tile.state.distanceToCamera-A.tile.state.distanceToCamera});break}}if(p=Math.max(r.maxRequests-this.activeRequests,0),!r.skipLevelOfDetail)for(var d=0,h=u.length,c=0;c<h;c++){var g=u[c].tile;if(g.hasTilesetContent||g.contentParent===null||g.contentParent.state.selectedFrameNumber===r.frameNumber){var m=u.splice(c,1);u.splice.apply(u,__spreadArray([d++,0],m,!1))}}for(var E=function(v){var A=u[v];A.status==="WAITING"&&(p--,A.status="PENDING",A.time=s,y.activeRequests++,y.tileset.options.tileLoader(A.tile).catch(function(b){A.error=b}).then(function(){A.status="DONE",A.tile.content&&A.tile.content.loadState==="READY"&&(A.tile.content.loadState="LOADING"),o.activeRequests--}))},y=this,c=0;c<u.length&&p>0;c++)E(c)},n})(),CacheNode=(function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n})(),CacheNodeList=(function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n})(),TileCache=(function(){function n(t){t===void 0&&(t={}),this.options=t,this.cacheNodeMap=new WeakMap,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touchTile=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.loadTile=function(t){if(!this.cacheNodeMap.has(t)){var e=this.list.add(t);this.cacheNodeMap.set(t,e),this.options.onTileLoad&&this.options.onTileLoad(t)}},n.prototype.unloadTile=function(t){var e=this.cacheNodeMap.get(t);e&&(this.list.remove(e),this.cacheNodeMap.delete(t),this.options.onTileUnload&&this.options.onTileUnload(t))},n.prototype.unloadTiles=function(t){for(var e=this.list.head;e!==this.sentinel&&t();){var r=e.item;e=e.next,this.unloadTile(r)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var o=r[e];o.item!=="sentinel"&&t.push(o.item)}return t},n})(),ManagedArray=(function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),this.array[this._length]=void 0,t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n.prototype.peek=function(){return this.array[this._length-1]},n})(),TilesetBaseTraverser=(function(){function n(t){this.tileset=t,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new ManagedArray}return n.prototype.traverse=function(t,e,r){this.reset()},n.prototype.reset=function(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e),t.state.shouldSelect=!1,t.state.finalResolution=!0},n.prototype.selectTile=function(t,e){var r=t.contentAvailable&&this._canSelectTile;r&&t.state.selectedFrameNumber<e.frameNumber&&(t.state.selectedFrameNumber=e.frameNumber,this.tileset.selectedTiles.push(t),this.tileset.needsRefinedTiles.add(t))},n.prototype.loadTile=function(t,e){t.state.requestedFrameNumber<e.frameNumber&&(t.state.requestedFrameNumber=e.frameNumber,t.content&&(t.content.loadState==="FAILED"&&e.time-t.content.loadStateUpdateTime>t.content.loadfailRetryDelay&&(t.content.loadState="UNLOADED",t.content.loadStateUpdateTime=e.time),t.content.loadState==="UNLOADED"&&this.tileset.requestedTiles.push(t))),this.tileset.needsRefinedTiles.add(t)},n.prototype.touchTile=function(t,e){this.tileset.cache.touchTile(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e){return!t.state.inRequestVolume||t.hasRenderContent&&(t.levelOfContent>=e.maxLevelOfDetail||t.levelOfContent>=0&&t.geometricError<=e.minGeometricError)||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.geometricError>=e.maxGeometricError||t.hasTilesetContent?!0:t.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var o=t.children[0];this.updateTileVisibility(o,e),t.state.visible=o.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}var s=t.refine==="REPLACE";if(s&&r&&!this.anyChildrenVisible(t,e)){t.state.visible=!1;return}}},n.prototype.anyChildrenVisible=function(t,e){for(var r=!1,o=t.children,s=0,u=o;s<u.length;s++){var l=u[s];l.updateState(e),r=r||l.state.visible}return r},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"||r.levelOfContent<e.minLevelOfDetail||r.geometricError>e.maxGeometricError?!1:r.levelOfContent>e.maxLevelOfDetail||r.levelOfContent>=0&&r.geometricError<e.minGeometricError?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError},n.prototype.sortTilesByDistanceToCamera=function(t){t.sort(function(e,r){return r.state.distanceToCamera===0&&e.state.distanceToCamera===0?r.state.centerZDepth-e.state.centerZDepth:r.state.distanceToCamera-e.state.distanceToCamera})},n})(),TilesetNormalTraverser=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r._traversalStack=new ManagedArray,r._emptyTraversalStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,o){o===void 0&&(o=[]),n.prototype.traverse.call(this,e,r,o);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),this._emptyTraversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,this.updateTile(e,l),this.executeTraversal(e,l))}this._traversalStack.reset(),this._emptyTraversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._emptyTraversalStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&o.push(e);o.length>0;){var s=o.pop(),u=s.parent,l=!u||u.state.shouldRefine,c=!1;this.canTraverse(s,r)&&(c=this.updateAndPushChildren(s,r,o)&&l);var f=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)):(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)),this.touchTile(s,r),s.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0,l=s;u<l.length;u++){var c=l[u];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(s);for(var f=e.refine==="REPLACE"&&e.hasRenderContent,p=!1,d=!0,h=0,g=s;h<g.length;h++){var c=g[h];if(c.levelOfContent<=r.minLevelOfDetail||c.geometricError>=r.maxGeometricError||c.state.visible&&c.state.inRequestVolume?(o.find(c)&&o.delete(c),o.push(c),p===!1&&(p=!0)):(f||r.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),f){var m=void 0;c.state.inRequestVolume?c.hasRenderContent?m=c.contentAvailable:m=this.executeEmptyTraversal(c,r):m=!1,d=d&&m}}return p||(d=!1),d},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t.prototype.executeEmptyTraversal=function(e,r){var o=!0,s=this._emptyTraversalStack;for(s.push(e);s.length>0&&o;){var u=s.pop(),l=!u.hasRenderContent&&this.canTraverse(u,r);if(!l&&!u.contentAvailable&&(o=!1),this.updateTile(u,r),u.state.visible||(this.loadTile(u,r),this.touchTile(u,r)),l)for(var c=u.children,f=0,p=c;f<p.length;f++){var d=p[f];s.find(d)&&s.delete(d),s.push(d)}}return o},t})(TilesetBaseTraverser),TilesetSkipTraverser=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.baseScreenSpaceError=1024,r.skipScreenSpaceErrorFactor=16,r.skipLevels=1,r._traversalStack=new ManagedArray,r._descendantTraversalStack=new ManagedArray,r._selectionTraversalStack=new ManagedArray,r._selectionTraversalancestorStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,o){o===void 0&&(o=[]),n.prototype.traverse.call(this,e,r,o);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,this.updateTile(e,l),this.executeTraversal(e,l),this.traverseAndSelect(e,l))}this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r),this.traverseAndSelect(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&o.push(e);o.length>0;){var s=o.pop();this.updateTileAncestorContentLinks(s,r);var u=s.parent,l=!u||u.state.shouldRefine,c=!1;this.canTraverse(s,r)&&(c=this.updateAndPushChildren(s,r,o)&&l);var f=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.inBaseTraversal(s,this.baseScreenSpaceError)?(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)):f?(this.loadTile(s,r),this.selectDesiredTile(s,r)):this.reachedSkippingThreshold(s)&&this.loadTile(s,r)):(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)),this.touchTile(s,r),s.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0,l=s;u<l.length;u++){var c=l[u];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(s);for(var f=!1,p=0,d=s;p<d.length;p++){var c=d[p];c.levelOfContent<=r.minLevelOfDetail||c.geometricError>=r.maxGeometricError||c.state.visible&&c.state.inRequestVolume?(o.push(c),f===!1&&(f=!0)):r.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return f},t.prototype.selectDesiredTile=function(e,r){var o=e.contentAvailable?e:e.state.ancestorWithContentAvailable;o&&(o.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,r)},t.prototype.selectDescendants=function(e,r){var o=this._descendantTraversalStack;for(o.push(e);o.length>0;)for(var s=o.pop(),u=s.children,l=0,c=u;l<c.length;l++){var f=c[l];f.state.visible&&(f.contentAvailable?(this.updateTile(f,r),this.touchTile(f,r),this.selectTile(f,r)):o.push(f))}},t.prototype.reachedSkippingThreshold=function(e){var r=e.state.ancestorWithContent,o=r!==null&&e.state.screenSpaceError<r.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>r.levelOfContent+this.skipLevels;return o},t.prototype.updateTileAncestorContentLinks=function(e,r){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;var o=e.parent;if(o){var s=!(o.hasRenderContent&&o.hasUnloadedContent)||o.state.requestedFrameNumber===r.frameNumber;e.state.ancestorWithContent=s?o:o.state.ancestorWithContent,e.state.ancestorWithContentAvailable=o.contentAvailable?o:o.state.ancestorWithContentAvailable}},t.prototype.inBaseTraversal=function(e,r){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>r:e.state.screenSpaceError>r:!0},t.prototype.traverseAndSelect=function(e,r){var o=this._selectionTraversalStack,s=this._selectionTraversalancestorStack,u;for(o.push(e);o.length>0||s.length>0;){if(s.length>0){var l=s.peek();if(l.state.stackLength===o.length){s.pop(),l!==u&&(l.state.finalResolution=!1),this.selectTile(l,r);continue}}var c=o.pop();if(c){var f=this.canTraverse(c,r);if(c.state.shouldSelect)if(c.refine==="ADD")this.selectTile(c,r);else{if(c.state.selectionDepth=s.length,c.state.selectionDepth>0&&(c.tileset.hasMixedContent=!0),u=c,!f){this.selectTile(c,r);continue}s.push(c),c.state.stackLength=o.length}if(f)for(var p=0,d=c.children;p<d.length;p++){var h=d[p];h.state.visible&&o.push(h)}}}},t})(TilesetBaseTraverser),TilesetMostDetailTraverser=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r._traversalStack=new ManagedArray,r}return t.prototype.canTraverse=function(e,r){return!(!e.state.inRequestVolume||e.levelOfContent>=r.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=r.minGeometricError||e.children.length===0)},t.prototype.traverse=function(e,r,o){n.prototype.traverse.call(this,e,r,[]),this._traversalStack.reset(),e.updateState(r);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,e.updateState(l),this.executeTraversal(e,l))}this._traversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,e.updateState(r),this.executeTraversal(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(o.push(e);o.length>0;){var s=o.pop(),u=s.refine==="ADD",l=s.refine==="REPLACE",c=this.canTraverse(s,r);c&&this.updateAndPushChildren(s,r,o),(u||l&&!c)&&(this.loadTile(s,r),this.touchTile(s,r),this.selectDesiredTile(s,r))}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0;u<s.length;++u){var l=s[u];l.updateState(r),l.state.visible&&o.push(l)}},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t})(TilesetBaseTraverser),Tileset=(function(){function n(t,e){var r=this,o,s,u,l,c,f,p;if(this.id=t.tilesetUrl,this.transform=new THREE__namespace.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.asset={version:t.asset.version,tilesetVersion:t.asset.tilesetVersion||"",gltfUpAxis:(o=t.asset.gltfUpAxis)!==null&&o!==void 0?o:"Y",overview:t.asset.overview,trajectories:(u=(s=t.asset.trajectories)===null||s===void 0?void 0:s.list)!==null&&u!==void 0?u:[],extras:t.asset.extras},this.rootMeta=(l=t.rootMeta)!==null&&l!==void 0?l:{},this.pointLength=(c=this.rootMeta.numTotalPoints)!==null&&c!==void 0?c:1/0,this.floorLength=(f=this.rootMeta.numFloors)!==null&&f!==void 0?f:1,this.properties=(p=t.properties)!==null&&p!==void 0?p:{},this.options=e,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new TilesetNormalTraverser(this),this.skipTraverser=new TilesetSkipTraverser(this),this.mostDetailTraverser=new TilesetMostDetailTraverser(this),this.cache=new TileCache({onTileLoad:function(g){r.cacheMemoryUsageInBytes+=g.contentMemoryUsage},onTileUnload:function(g){r.cacheMemoryUsageInBytes-=g.contentMemoryUsage,r.unloadTiles.push(g)}}),this.requestScheduler=new TileRequestScheduler(this,{onTileSkip:function(g){},onTileLoad:function(g){var m;!((m=g.content)===null||m===void 0)&&m.data&&(r.loadedTiles.add(g),r.cache.loadTile(g)),r.options.onTileLoad(g)},onTileError:function(g,m){r.options.onTileError(g,m)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new Tile("".concat(this.id,"#tile:0"),t.root,this),this.geometricError=t.geometricError,this.trajectories=[],this.asset.trajectories)for(var d=0;d<this.asset.trajectories.length;d++){var h=new Trajectory("".concat(this.id,"#trajectory:").concat(d),this.asset.trajectories[d],this);this.trajectories.push(h)}}return n.prototype.adjustScreenSpaceError=function(t){if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=t.maxScreenSpaceError),t.memoryAdjustedScreenSpaceError){var e=0,r=0,o=0;if(this.needsRefinedTiles.forEach(function(h){h.content&&(r++,e+=h.content.memoryUsage,h.content.loadState==="READY"&&o++)}),o<2||r<2)this.currentMaxScreenSpaceError=t.maxScreenSpaceError;else{var s=1048576,u=e/o*r,l=t.maxMemoryUsage*s,c=l-clamp$1(l*.1,8*s,64*s),f=this.currentMaxScreenSpaceError;if(u<c){var p=1-u/c,d=.5*p;f-=d}else if(u>l){var d=.3;f+=d}f=clamp$1(f,1,t.maxScreenSpaceError),Math.abs(f-this.currentMaxScreenSpaceError)>=.1&&(this.currentMaxScreenSpaceError=f)}}else this.currentMaxScreenSpaceError=t.maxScreenSpaceError},n.prototype.getTraverser=function(t){return t.mostDetail?this.mostDetailTraverser:t.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},n.prototype.reset=function(){var t=this;this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();for(var e=[this.root],r;r=e.pop();){for(var o=0,s=r.children.length;o<s;o++)e.push(r.children[o]);this.cache.unloadTile(r)}for(var u=function(){var p=l.unloadTiles.pop();p&&(l.loadedTiles.delete(p),l.cacheMemoryUsageInBytes-=p.contentMemoryUsage,l.options.tileUnloader(p).catch(function(){}).then(function(){t.options.onTileUnload&&t.options.onTileUnload(p)}))},l=this;this.unloadTiles.length;)u();this.loadedTiles.clear();for(var c=function(){var p=f.trajectories.pop();p&&f.options.trajectoryUnloader(p).catch(function(){}).then(function(){t.options.onTrajectoryUnload&&t.options.onTrajectoryUnload(p)})},f=this;this.trajectories.length;)c()},n.prototype.update=function(t,e){var r=this,o;e===void 0&&(e=[]),this.frameNumber=t.frameNumber,this.adjustScreenSpaceError(t),this.cache.reset(),this.getTraverser(t).traverse(this.root,t,e),this.cache.unloadTiles(function(){var h=r.cacheMemoryUsageInBytes>t.maxMemoryUsage*1024*1024;return h}),this.requestScheduler.update(this.requestedTiles,t.requestOrder,t);for(var s=function(){var h=u.unloadTiles.pop();h&&(u.loadedTiles.delete(h),u.options.tileUnloader(h).catch(function(){}).then(function(){r.options.onTileUnload&&r.options.onTileUnload(h)}))},u=this;this.unloadTiles.length;)s();this.selectedTrajectories.length=0;for(var l=function(h){h.visible===!0&&h.content.loadState==="READY"&&(!((o=h.content.data)===null||o===void 0)&&o.object)?c.selectedTrajectories.push(h):h.visible===!0&&(h.content.loadState==="FAILED"&&t.time-h.content.loadStateUpdateTime>h.content.loadfailRetryDelay&&(h.content.loadState="UNLOADED",h.content.loadStateUpdateTime=t.time),h.content.loadState==="UNLOADED"&&c.options.trajectoryLoader(h).then(function(){r.options.onTrajectoryLoad(h)}).catch(function(g){r.options.onTrajectoryError(h,g)}))},c=this,f=0,p=this.trajectories;f<p.length;f++){var d=p[f];l(d)}},n})();function normalizeTileHeader(n,t){var e;if(n.content){var r=(e=n.content.uri)!==null&&e!==void 0?e:n.content.url;typeof r=="string"&&!isAbsoluteURL(r)&&(n.content.uri=normalizeURL(pathJoin(t,r)))}if(n.transform){for(var o=!1,s=0;s<16;s++){var u=n.transform[s];if(typeof u!="number"||isNaN(u)||!isFinite(u)){o=!0;break}}if(n.transform[15]===0&&(o=!0),o)throw new Error("Invalid Tile Transform: "+JSON.stringify(n.transform))}if(n.children)for(var l=0,c=n.children;l<c.length;l++){var f=c[l];normalizeTileHeader(f,t)}return n}function normalizeTilesetHeader(n,t){n.tilesetUrl=t;var e=/^blob\:/.test(t)?"":t.slice(0,t.lastIndexOf("/")+1);if(n.asset||(n.asset={}),n.rootMeta||(n.rootMeta={}),n.rootMeta.taskParameters||(n.rootMeta.taskParameters={}),n.asset.overview){var r=n.asset.overview;isAbsoluteURL(r.imageFile)||(r.imageFile=normalizeURL(pathJoin(e,r.imageFile))),isAbsoluteURL(r.worldFile)||(r.worldFile=normalizeURL(pathJoin(e,r.worldFile)))}if(n.asset.trajectories)for(var o=0;o<n.asset.trajectories.list.length;o++){var s=n.asset.trajectories.list[o];s.file=normalizeURL(pathJoin(e,s.file))}return normalizeTileHeader(n.root,e),n}function delay(n){return new Promise(function(t){return setTimeout(t,n)})}var AsyncTaskQueue=(function(){function n(t){this.queue=[],this.concurrency=t,this.dequeuing=0}return n.prototype.add=function(t,e){e===void 0&&(e=1e3);var r,o,s=new Promise(function(l,c){r=l,o=c}),u=function(){var l=Promise.resolve().then(t);l.then(r,o);var c=delay(e);return Promise.race([l,c]).then(noop,noop)};return this.queue.unshift(u),this.dequeue(),s},n.prototype.dequeue=function(){for(var t=this;this.dequeuing<this.concurrency&&this.queue.length>0;){var e=this.queue.pop();this.dequeuing++,e().catch(noop).then(function(){t.dequeuing--,t.dequeue()})}},n})(),initTextureQueue=new AsyncTaskQueue(1),skipImageSize=256;function canInit(n){return typeof n.image=="object"&&n.image.width>0&&n.image.height>0}function initTexture(n,t){if(!canInit(n))return Promise.resolve(n);if(n.image.width<skipImageSize&&n.image.width<skipImageSize)return t.initTexture(n),Promise.resolve(n);var e=!1,r=function(){e=!0,n.removeEventListener("dispose",r)};return n.addEventListener("dispose",r),initTextureQueue.add(function(){return new Promise(function(o){AnimationFrameLoop.shared.add(function(){canInit(n)&&e===!1&&t.initTexture(n),n.removeEventListener("dispose",r),o(n)},!0)})})}function initTextures(n,t){return Promise.all(n.map(function(e){return initTexture(e,t)}))}var _object_pattern=/^[og]\s*(.+)?/,_material_library_pattern=/^mtllib /,_material_use_pattern=/^usemtl /,_map_use_pattern=/^usemap /,_face_vertex_data_separator_pattern=/\s+/,_color=new THREE__namespace.Color,ObjState=(function(){function n(){this.objects=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materials={},this.materialLibraries=[],this.startObject("",!1)}return n.prototype.startObject=function(t,e){if(this.object&&this.object.fromDeclaration===!1){this.object.name=t,this.object.fromDeclaration=e!==!1;return}var r=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:e!==!1,geometry:{vertices:[],hasNormal:!0,normals:[],hasColor:!0,colors:[],hasUV:!0,uvs:[],index:[],indexMap:{}},materials:[],smooth:!0,startMaterial:function(s,u){var l,c,f=this._finalize(!1);f&&(f.inherited||((l=f.groupCount)!==null&&l!==void 0?l:0)<=0)&&this.materials.splice((c=f.index)!==null&&c!==void 0?c:0,1);var p={index:this.materials.length,name:s||"",mtllib:Array.isArray(u)&&u.length>0?u[u.length-1]:"",smooth:f!==void 0?f.smooth:this.smooth,groupStart:f!==void 0?f.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(d){var h={index:typeof d=="number"?d:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(){return this}};return h.clone=this.clone.bind(h),h}};return this.materials.push(p),p},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(s){var u,l,c=this.currentMaterial();if(c&&c.groupEnd===-1&&(c.groupEnd=this.geometry.index.length,c.groupCount=c.groupEnd-((u=c.groupStart)!==null&&u!==void 0?u:0),c.inherited=!1),s&&this.materials.length>1)for(var f=this.materials.length-1;f>=0;f--)((l=this.materials[f].groupCount)!==null&&l!==void 0?l:0)<=0&&this.materials.splice(f,1);return s&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),c}},r&&r.name&&typeof r.clone=="function"){var o=r.clone(0);o.inherited=!0,this.object.materials.push(o)}this.objects.push(this.object)},n.prototype.finalize=function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},n.prototype.parseVertexIndex=function(t,e){var r=parseInt(t,10);return(r>=0?r-1:r+e/3)*3},n.prototype.parseNormalIndex=function(t,e){var r=parseInt(t,10);return(r>=0?r-1:r+e/3)*3},n.prototype.parseUVIndex=function(t,e){var r=parseInt(t,10);return(r>=0?r-1:r+e/2)*2},n.prototype.addFace=function(t,e,r,o,s,u,l,c,f){var p=this.object.geometry,d=this.vertices.length,h=this.normals.length,g=this.uvs.length,m=this.parseVertexIndex(t,d),E=this.parseVertexIndex(e,d),y=this.parseVertexIndex(r,d),v=l!==void 0?this.parseNormalIndex(l,h):void 0,A=c!==void 0?this.parseNormalIndex(c,h):void 0,b=f!==void 0?this.parseNormalIndex(f,h):void 0,T=o!==void 0?this.parseUVIndex(o,g):void 0,_=s!==void 0?this.parseUVIndex(s,g):void 0,S=u!==void 0?this.parseUVIndex(u,g):void 0;(p.hasNormal===!0&&v===void 0||A===void 0||b===void 0)&&(p.hasNormal=!1),(p.hasUV===!0&&T===void 0||_===void 0||S===void 0)&&(p.hasUV=!1);var w=[m,T,v].join(":"),R=p.indexMap[w];R===void 0&&(R=p.vertices.length/3,p.indexMap[w]=R,p.vertices.push(this.vertices[m+0],this.vertices[m+1],this.vertices[m+2]),p.hasColor&&(this.colors[m]===void 0?p.hasColor=!1:p.colors.push(this.colors[m+0],this.colors[m+1],this.colors[m+2])),p.hasNormal&&p.normals.push(this.normals[m+0],this.normals[m+1],this.normals[m+2]),p.hasUV&&p.uvs.push(this.uvs[T+0],this.uvs[T+1])),p.index.push(R);var I=[E,_,A].join(":"),H=p.indexMap[I];H===void 0&&(H=p.vertices.length/3,p.indexMap[I]=H,p.vertices.push(this.vertices[E+0],this.vertices[E+1],this.vertices[E+2]),p.hasColor&&(this.colors[E]===void 0?p.hasColor=!1:p.colors.push(this.colors[E+0],this.colors[E+1],this.colors[E+2])),p.hasNormal&&p.normals.push(this.normals[E+0],this.normals[E+1],this.normals[E+2]),p.hasUV&&p.uvs.push(this.uvs[_+0],this.uvs[_+1])),p.index.push(H);var C=[y,S,b].join(":"),M=p.indexMap[C];M===void 0&&(M=p.vertices.length/3,p.indexMap[C]=M,p.vertices.push(this.vertices[y+0],this.vertices[y+1],this.vertices[y+2]),p.hasColor&&(this.colors[y]===void 0?p.hasColor=!1:p.colors.push(this.colors[y+0],this.colors[y+1],this.colors[y+2])),p.hasNormal&&p.normals.push(this.normals[y+0],this.normals[y+1],this.normals[y+2]),p.hasUV&&p.uvs.push(this.uvs[S+0],this.uvs[S+1])),p.index.push(M)},n})();function parseObj(n){var t=new ObjState;n.indexOf(`\r
920
920
  `)!==-1&&(n=n.replace(/\r\n/g,`
921
921
  `)),n.indexOf(`\\
@@ -1023,7 +1023,7 @@ void main() {
1023
1023
  #include <fog_fragment>
1024
1024
  #include <premultiplied_alpha_fragment>
1025
1025
  }
1026
- `,uniforms:{diffuse:{value:new THREE__namespace.Color},opacity:{value:1},displacementScalar:{value:0}}};function createPipeBufferGeometry(n,t,e,r){for(var o=new Float32Array((e+1)*(r+1)*3),s=new Float32Array((e+1)*(r+1)*3),u=new Float32Array((e+1)*(r+1)*2),l=new Uint32Array(e*r*6),c=n.computeFrenetFrames(e),f=new THREE__namespace.Vector3,p=new THREE__namespace.Vector3,d=new THREE__namespace.Vector2,h=new THREE__namespace.Vector3,g=0;g<=e;g++){h=n.getPointAt(g/e,h);for(var m=c.normals[g],E=c.binormals[g],y=0;y<=r;y++){var v=g*(r+1)+y,A=y/r*Math.PI*2,b=Math.sin(A),T=-Math.cos(A);p.x=T*m.x+b*E.x,p.y=T*m.y+b*E.y,p.z=T*m.z+b*E.z,p.normalize(),p.toArray(s,v*3),f.x=h.x+t*p.x,f.y=h.y+t*p.y,f.z=h.z+t*p.z,f.toArray(o,v*3),d.x=g/e,d.y=y/r,d.toArray(u,v*2)}}for(var g=0;g<e;g++)for(var y=0;y<r;y++){var _=(g*r+y)*6,S=(r+1)*g+y,w=(r+1)*(g+1)+y,R=(r+1)*(g+1)+(y+1),I=(r+1)*g+(y+1);l[_]=S,l[_+1]=w,l[_+2]=I,l[_+3]=w,l[_+4]=R,l[_+5]=I}var H=new THREE__namespace.BufferGeometry;return H.setIndex(new THREE__namespace.BufferAttribute(l,1)),H.setAttribute("position",new THREE__namespace.BufferAttribute(o,3)),H.setAttribute("normal",new THREE__namespace.BufferAttribute(s,3)),H.setAttribute("uv",new THREE__namespace.BufferAttribute(u,2)),H}function parseTrajectoryObject(n,t){for(var e=new THREE__namespace.Color(0).convertSRGBToLinear(),r=new THREE__namespace.Color(52949).convertSRGBToLinear(),o=new THREE__namespace.Color(3370495).convertSRGBToLinear(),s=new THREE__namespace.Color(16777215).convertSRGBToLinear(),u=0,l=new THREE__namespace.CurvePath,c=n.length,f=3;f<c;f+=3){var p=new THREE__namespace.Vector3().fromArray(n,f-3),d=new THREE__namespace.Vector3().fromArray(n,f);u+=p.distanceTo(d);var h=new THREE__namespace.LineCurve3(p,d);l.add(h)}var g=.03,m=Math.ceil(u*100),E=6,y=createPipeBufferGeometry(l,g,m,E);y.clearGroups(),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,1),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,2);var v=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});v.uniforms.totalLength.value=u,v.uniforms.diffuse.value=e,v.uniforms.diffuse2.value=e,v.uniforms.opacity.value=.5,v.transparent=!0;var A=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});A.uniforms.totalLength.value=u,A.uniforms.displacementScalar.value=-.01,A.uniforms.diffuse.value=r,A.uniforms.diffuse2.value=o;var b=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.DoubleSide});b.uniforms.totalLength.value=u,b.uniforms.displacementScalar.value=-.026,b.uniforms.dashSize.value=new THREE__namespace.Vector2(.06,.09),b.uniforms.diffuse.value=s,b.uniforms.diffuse2.value=s;var T=new THREE__namespace.Mesh(y,[v,A,b]),_=.08,S=24,w=new THREE__namespace.SphereBufferGeometry(_,S,S);w.clearGroups(),w.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),w.addGroup(0,y.index?y.index.count:y.attributes.position.count,1);var R=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.BackSide});R.uniforms.diffuse.value=e,R.uniforms.opacity.value=.5,R.transparent=!0;var I=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});I.uniforms.displacementScalar.value=-.01,I.uniforms.diffuse.value=r;var H=new THREE__namespace.Mesh(w,[R,I]);H.position.fromArray(n,0),T.add(H);var C=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});C.uniforms.displacementScalar.value=-.01,C.uniforms.diffuse.value=o;var M=new THREE__namespace.Mesh(w,[R,C]);return M.position.fromArray(n,n.length-3),T.add(M),{scene:T,dispose:function(){y.dispose(),v.dispose(),A.dispose(),b.dispose(),w.dispose(),R.dispose(),I.dispose(),C.dispose()}}}function loadTrajectory(n,t){var e=n.name,r=appendSearch(n.content.uri,t.search),o=imageURL(r,{key:"model.0"});return n.content.loadState="LOADING",n.content.loadStateUpdateTime=now(),loadPly(o,{type:"geometry",customPropertyMapping:{time:{itemType:"uint32",itemNames:["time_milisec"]}},fetcher:t.fetcher}).then(function(s){var u,l,c,f,p=(l=(u=s.scene.attributes)===null||u===void 0?void 0:u.time.array)!==null&&l!==void 0?l:[],d=(f=(c=s.scene.attributes)===null||c===void 0?void 0:c.position.array)!==null&&f!==void 0?f:[],h=s.byteLength,g=s.memoryUsage,m=parseTrajectoryObject(d);m.scene.applyMatrix4(n.transform),m.scene.updateWorldMatrix(!1,!0),m.scene.matrixAutoUpdate=!1;var E=new TrajectoryNode(e,m.scene);return n.content.data={uri:o,byteLength:h,memoryUsage:g,positionArray:d,timeArray:p,object:E},n.content.byteLength=h,n.content.memoryUsage=g,n.content.loadState="READY",n.content.loadStateUpdateTime=now(),n}).catch(function(s){return n.content.data=void 0,n.content.loadState="FAILED",n.content.loadStateUpdateTime=now(),s instanceof NetworkResponseError&&s.httpStatus===0||s instanceof NetworkTimeoutError||s instanceof NetworkProxyError?n.content.loadfailRetryDelay=clamp$1(n.content.loadfailRetryDelay+RETRY_DELAY_STEP,RETRY_DELAY_STEP,MAX_RETRY_DELAY):n.content.loadfailRetryDelay=1/0,Promise.reject(s)})}function unloadTrajectory(n){n.content&&(n.content.data&&n.content.data.object.dispose(),n.content.data=void 0,n.content.loadState="UNLOADED",n.content.loadStateUpdateTime=now(),n.content.byteLength=0,n.content.memoryUsage=0)}var scratchVector3$7=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$3=new THREE__namespace.Matrix4,a=6378137,invF=298.257223563;function ecefToLla(n){for(var t=a-a/invF,e=(a*a-t*t)/(a*a),r=Math.sqrt(n.x*n.x+n.y*n.y),o=1e-12,s=1e3,u=0,l=Math.atan2(n.z,r),c=0;u++<s;){var f=Math.sin(l),p=a/Math.sqrt(1-e*f*f);c=r/Math.cos(l)-p;var d=Math.atan2(n.z/(p*(1-e)+c),r/(p+c));if(isNaN(d))break;var h=Math.abs(d-l);if(h<o)break;l=d}return n.set(l,Math.atan2(n.y,n.x),c)}function llaToEcef(n){var t=n.x,e=n.y,r=n.z,o=a-a/invF,s=(a*a-o*o)/(a*a),u=Math.sin(t),l=Math.cos(t),c=Math.sin(e),f=Math.cos(e),p=a/Math.sqrt(1-s*u*u),d=(p+r)*l*f,h=(p+r)*l*c,g=(o*o/(a*a)*p+r)*u;return n.set(d,h,g)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$7.copy(n)),r=e.x,o=e.y,s=e.z,u=Math.sin(r),l=Math.sin(o),c=Math.cos(r),f=Math.cos(o);t.fromArray([-l,-u*f,c*f,0,+f,-u*l,c*l,0,0,c,u,0,0,0,0,1]);var p=scratchMatrix3.setFromMatrix4(t),d=scratchVector3$7.copy(n).applyMatrix3(p).multiplyScalar(-1);t.setPosition(d);var h=scratchMatrix4$3.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,s,1]);return t.premultiply(h),t}var ROTATE_X_90_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),ROTATE_X_90_MATRIX_INVERSE=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),enuToLocalMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),localToEnuMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE);function getRecommendTile3dProps(n,t){var e,r,o;t===void 0&&(t={});var s,u,l,c=typeof n.tileset.rootMeta.creationTime=="string";if(c){var f=typeof n.tileset.rootMeta.numTotalPoints=="number"&&n.tileset.rootMeta.numTotalPoints>0;if(f){l=4,t.powerPreference==="high"&&(l=2),s=l/1.6;var p=0;if(((e=n.tileset.rootMeta.taskParameters)===null||e===void 0?void 0:e.point_homogenization)==="1"&&(!((r=n.tileset.rootMeta.taskParameters)===null||r===void 0)&&r.homo_point_density)){var d=Number((o=n.tileset.rootMeta.taskParameters)===null||o===void 0?void 0:o.homo_point_density);isFinite(d)&&!isNaN(d)&&(p=d)}p<=0&&(p=.02),u=p*1.4}else l=5,t.powerPreference==="high"&&(l=4),s=0,u=.03}else l=6,s=0,u=.03,n.name==="aerophoto"?(l=12,t.powerPreference==="high"&&(l=10)):n.tileset.asset.extras&&typeof n.tileset.asset.extras.name=="string"&&/^matterport\b/i.test(n.tileset.asset.extras.name)&&(l=5,t.powerPreference==="high"&&(l=4));return{pointScale:u,pointMinPixel:s,maxScreenSpaceError:l}}var scratchVector3$6=new THREE__namespace.Vector3,scratchSphereBoundingVolume=new SphereBoundingVolume,scratchBoxBoundingVolume=new BoxBoundingVolume,parameterVersionMap=new WeakMap,tileVersionMap=new WeakMap,trajectoryVersionMap=new WeakMap,STENCIL_CONSTANT={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4},SKIP_BACKFACE_MATERIAL=(function(){var n=new THREE__namespace.MeshBasicMaterial;return n.side=THREE__namespace.BackSide,n.color.setHex(16711935),n.colorWrite=!1,n.stencilWrite=!0,n.polygonOffset=!0,n.polygonOffsetFactor=2,n.polygonOffsetUnits=2,n.stencilRef=STENCIL_CONSTANT.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=STENCIL_CONSTANT.TILE_MASK,n})(),SKIP_BACKFACE_TRANSPARENT_MATERIAL=(function(){var n=new THREE__namespace.MeshBasicMaterial;return n.visible=!1,n})(),CLEAR_STENCIL_GEOMETRY=new THREE__namespace.BufferGeometry,CLEAR_STENCIL_MATERIAL=new THREE__namespace.MeshBasicMaterial;function cloneSkipBackfaceObject(n){var t;n instanceof THREE__namespace.Mesh?t=new THREE__namespace.Mesh(n.geometry,Array.isArray(n.material)?n.material.map(function(s){return s.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):n.material&&n.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):n instanceof THREE__namespace.Group?t=new THREE__namespace.Group:t=new THREE__namespace.Object3D,t.position.copy(n.position),t.quaternion.copy(n.quaternion),t.scale.copy(n.scale),t.matrix.compose(n.position,n.quaternion,n.scale),t.matrixAutoUpdate=!1,t.frustumCulled=n.frustumCulled,t.visible=n.visible;for(var e=0,r=n.children;e<r.length;e++){var o=r[e];t.add(cloneSkipBackfaceObject(o))}return t}var Tile3D=(function(n){__extends(t,n);function t(e,r){var o,s,u=n.call(this)||this;return u.parameter=new Parameter,u.renderObjects=[],u.backfaceObjects=[],u.tileObjects=[],u.frameNumber=0,u.error=(o=r.error)!==null&&o!==void 0?o:null,u.name=r.name,u.type=r.type,u.upAxis=r.upAxis,u.light=r.light,u.fetcher=r.fetcher,u.search=(s=r.search)!==null&&s!==void 0?s:"",u.groundHeight=r.groundHeight,u.coordinateSystem=r.coordinateSystem,u.boundingBox=new THREE__namespace.Box3,u.autoRefine=!0,u.refined=!1,u.refineProgress=[0,0],u.loaded=!1,u.disposed=!1,u.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),u.clearStencilObject.frustumCulled=!1,u.clearStencilObject.onAfterRender=function(l){return l.clearStencil()},u.tileset=new Tileset(e,{tileLoader:function(l){return u.loadContent(l)},tileUnloader:function(l){return u.unloadContent(l)},onTileLoad:function(){},onTileUnload:function(l){},onTileError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Tile error",l.id,c)},trajectoryLoader:function(l){return u.loadTrajectory(l)},trajectoryUnloader:function(l){return u.unloadTrajectory(l)},onTrajectoryLoad:function(){},onTrajectoryUnload:function(l){},onTrajectoryError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Trajectory error",l,c)}}),u.tileset.root.boundingVolume&&u.tileset.root.boundingVolume.getBoundingBox(u.boundingBox),u}return Object.defineProperty(t.prototype,"viewerRequestVolume",{get:function(){return this.tileset.root.viewerRequestVolume},set:function(e){this.tileset.root.viewerRequestVolume=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tiles",{get:function(){return this.tileset.selectedTiles},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trajectories",{get:function(){return this.tileset.trajectories},enumerable:!1,configurable:!0}),t.prototype.getRecommendProps=function(e){return e===void 0&&(e={}),getRecommendTile3dProps(this,e)},t.prototype.loadContent=function(e){var r=this;return loadTileContent(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){e.type==="SCENEGRAPH"&&(r.disposed||!e.content?unloadTileContent(e):e.content.data&&r.boundingBox.expandByObject(e.content.data.object))})},t.prototype.unloadContent=function(e){return unloadTileContent(e),Promise.resolve()},t.prototype.loadAllTilesets=function(){var e=this,r=function(o){var s=[];return e.tileset.root.traverse(function(u){var l;u.type==="TILESET"&&((l=u.content)===null||l===void 0?void 0:l.loadState)!=="READY"&&s.push(u)}),Promise.all(s.map(function(u){return e.loadContent(u).then(function(){return r()})})).then(function(){})};return r(this.tileset.root)},t.prototype.loadTrajectory=function(e){var r=this;return loadTrajectory(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){r.disposed&&unloadTrajectory(o)})},t.prototype.unloadTrajectory=function(e){return unloadTrajectory(e),Promise.resolve()},t.prototype.intersectRaycaster=function(e,r){var o=this,s,u,l=r!=null?r:[],c=[this.tileset.root],f=this.tileset.transform,p=(u=(s=e.params.Points)===null||s===void 0?void 0:s.threshold)!==null&&u!==void 0?u:0,d=e.hitFilter;e.hitFilter=function(T){var _;return Object.assign(T,{model:(_=o.parent)!==null&&_!==void 0?_:void 0,viewLayer:o}),d?d.call(e,T):!0};var h=e.sortByDistance;e.sortByDistance=!1;for(var g,m=1/0;g=c.pop();){var E=void 0;if(g.boundingVolume){var y=void 0;g.boundingVolume instanceof BoxBoundingVolume?y=scratchBoxBoundingVolume.copy(g.boundingVolume):g.boundingVolume instanceof SphereBoundingVolume?y=scratchSphereBoundingVolume.copy(g.boundingVolume):y=g.boundingVolume.clone(),y.applyMatrix4(f),E=y.intersectRay(e.ray,p,m)}else E=!0;if(E){for(var v=0,A=g.children.length;v<A;v++)c.push(g.children[v]);if(g.selected&&g.content&&g.content.data&&g.content.data.object.visible&&(g.content.data.object.intersectRaycaster(e,l),e.firstHitOnly)){var b=l[0];b&&m>b.distance&&(m=b.distance)}}}return e.hitFilter=d,e.sortByDistance=h,sortIntersects(l,e.sortByDistance,e.firstHitOnly),l},t.prototype.update=function(e,r,o,s){var u=this,l,c,f,p,d,h,g;this.renderer=e,this.frameNumber++;var m=!1,E=this.parameter.resolveValue(o.parameter,s.parameter);parameterVersionMap.get(this)!==E.version&&(parameterVersionMap.set(this,E.version),m=!0);var y=(p=this.visible&&((l=this.parent)===null||l===void 0?void 0:l.visible)&&((f=(c=this.parent)===null||c===void 0?void 0:c.parent)===null||f===void 0?void 0:f.visible))!==null&&p!==void 0?p:!1,v=E.maxLevelOfDetail;v=Math.max(v,0);var A=Math.min(E.minLevelOfDetail,v);(!y||!this.loaded||!o.loaded)&&(v=Math.max(A,0));var b=E.minGeometricError,T=E.maxRequests,_=E.memoryAdjustedScreenSpaceError,S=r.controllerMode;(S==="Panorama"||S==="VRPanorama"||S==="XRPanorama")&&(E.modelAlpha<.1&&(b=E.panoramaMinGeometricError,_=!1),E.progress>=.01&&E.progress<=.99&&(T=0));var w=E.maxGeometricError;w=Math.max(b,w);var R={time:r.time,camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(r.up).applyQuaternion(r.quaternion),projectionMatrix:r.projectionMatrix.clone(),visible:r.visible,refine:r.refineModel},height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r),minLevelOfDetail:A,maxLevelOfDetail:v,minGeometricError:b,maxGeometricError:w,skipLevelOfDetail:E.skipLevelOfDetail,mostDetail:E.mostDetail,loadSiblings:E.loadSiblings,cameraCulling:E.cameraCulling,maxMemoryUsage:E.maxMemoryUsage,maxRequests:T,requestOrder:E.requestOrder,maxScreenSpaceError:E.maxScreenSpaceError,memoryAdjustedScreenSpaceError:_},I=E.cacheCameras.map(function(he){return he.updateProjectionMatrix(),__assign(__assign({},R),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(he.position),direction:he.getWorldDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(he.up),projectionMatrix:he.projectionMatrix.clone(),visible:he.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(he)})});this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),m=!0);var H=!this.autoRefine;if(H===!1){var C=E.progress>=.01&&E.progress<=.99;if(C){var M=new THREE__namespace.Vector3;E.pano0&&M.setFromMatrixPosition(E.pano0.matrix);var B=M.clone();E.pano1&&B.setFromMatrixPosition(E.pano1.matrix),M.distanceTo(B)<10&&(H=!0)}}if(H||this.tileset.update(R,I),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(he){if(u.refineProgress[1]++,he.content){var _e=he.content.loadState;if(_e==="UNLOADED"||_e==="LOADING"){u.refined=!1;return}}u.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;var L=!1;this.tileset.needsRefinedTiles.forEach(function(he){if(u.loaded!==!1&&he.content&&(he.state.visible&&(L=!0),E.minLevelOfDetail>=0)){if(R.skipLevelOfDetail){if(he.state.finalResolution){var _e=he.state.ancestorWithContentAvailable,He=_e&&_e.content?_e.content:he.content,Ee=He.loadState;(Ee==="UNLOADED"||Ee==="LOADING")&&(u.loaded=!1)}}else if(he.state.visible&&he.levelOfContent<=0){var Ee=he.content.loadState;(Ee==="UNLOADED"||Ee==="LOADING")&&(u.loaded=!1)}}}),L&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0;for(var O=this.children.length-1;O>=0;O--)this.remove(this.children[O]);R.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(he,_e){return he.floor!==_e.floor?he.floor-_e.floor:he.levelOfContent!==_e.levelOfContent?_e.levelOfContent-he.levelOfContent:he.state.distanceToCamera!==_e.state.distanceToCamera?he.state.distanceToCamera-_e.state.distanceToCamera:he.state.centerZDepth-_e.state.centerZDepth});for(var k=[],D=0,q=this.tileset.selectedTiles;D<q.length;D++){var z=q[D],V=(h=(d=z.content)===null||d===void 0?void 0:d.data)===null||h===void 0?void 0:h.object;if(V){var Q=V.update(e,r,o,this,z,E);if(k.push(z.id),Q&&(m=!0),this.tileset.hasMixedContent&&R.skipLevelOfDetail){if(!z.state.finalResolution){var U=cloneSkipBackfaceObject(V);U.name="skipBackface:"+V.name,this.backfaceObjects.push(U)}for(var j=z.state.selectionDepth,G=STENCIL_CONSTANT.TILE_MASK|j<<STENCIL_CONSTANT.SKIP_LOD_BIT_SHIFT,ae=THREE__namespace.GreaterEqualStencilFunc,re=STENCIL_CONSTANT.SKIP_LOD_MASK,$=THREE__namespace.ReplaceStencilOp,ee=STENCIL_CONSTANT.TILE_MASK|STENCIL_CONSTANT.SKIP_LOD_MASK,K=0,se=V.materials;K<se.length;K++){var W=se[K];W.stencilWrite=!0,W.stencilRef=G,W.stencilFunc=ae,W.stencilFuncMask=re,W.stencilZPass=$,W.stencilWriteMask=ee}}else for(var X=0,te=V.materials;X<te.length;X++){var W=te[X];W.stencilWrite=!1,W.stencilRef=STENCIL_CONSTANT.TILE_MASK,W.stencilFunc=THREE__namespace.AlwaysStencilFunc,W.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,W.stencilZPass=THREE__namespace.ReplaceStencilOp,W.stencilWriteMask=STENCIL_CONSTANT.TILE_MASK}this.tileObjects.push(V)}}var Z=k.toString();if(tileVersionMap.get(this)!==Z&&(tileVersionMap.set(this,Z),m=!0),R.skipLevelOfDetail&&this.backfaceObjects.length)for(var O=0;O<this.backfaceObjects.length;O++)this.renderObjects.push(this.backfaceObjects[O]);if(this.tileObjects.length)for(var O=0;O<this.tileObjects.length;O++)this.renderObjects.push(this.tileObjects[O]);R.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var ne=[],pe=0,ie=this.tileset.selectedTrajectories;pe<ie.length;pe++){var ue=ie[pe],be=(g=ue.content.data)===null||g===void 0?void 0:g.object;if(be){var Q=be.update(e,r,o,this,ue,E);ne.push(ue.id),Q&&(m=!0),this.renderObjects.push(be)}}var oe=ne.toString();if(trajectoryVersionMap.get(this)!==oe&&(trajectoryVersionMap.set(this,oe),m=!0),this.parent)for(var le=this.parent.children.length+1,me=Math.min(0,this.parent.children.indexOf(this)),ge=(me-le)*1e4+1,Ae=function(he){var _e=xe.renderObjects[he],He=he+ge;_e.traverse(function(Ee){(Ee instanceof THREE__namespace.Mesh||Ee instanceof THREE__namespace.Line||Ee instanceof THREE__namespace.Points)&&(Ee.renderOrder=He)})},xe=this,O=0;O<this.renderObjects.length;O++)Ae(O);if(this.loaded)for(var O=0;O<this.renderObjects.length;O++)this.add(this.renderObjects[O]);return m},t.prototype.dispose=function(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id);for(var e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0,this.error=null,this.onError=void 0,this.renderer=void 0},Object.defineProperty(t.prototype,"model",{get:function(){return this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scene",{get:function(){return this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayer",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.enuToEcef=function(e){return e.applyMatrix4(this.coordinateSystem.enuToEcefMatrix)},t.prototype.ecefToEnu=function(e){return e.applyMatrix4(this.coordinateSystem.ecefToEnuMatrix)},t.prototype.localToEcef=function(e){return this.enuToEcef(this.localToEnu(e))},t.prototype.ecefToLocal=function(e){return this.enuToLocal(this.ecefToEnu(e))},t.prototype.localToLla=function(e){return ecefToLla(this.enuToEcef(this.localToEnu(e)))},t.prototype.llaToLocal=function(e){return this.enuToLocal(this.ecefToEnu(llaToEcef(e)))},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},t.prototype.worldToEcef=function(e){return this.localToEcef(this.worldToLocal(e))},t.prototype.ecefToWorld=function(e){return this.localToWorld(this.ecefToLocal(e))},t.prototype.worldToLla=function(e){return this.localToLla(this.worldToLocal(e))},t.prototype.llaToWorld=function(e){return this.localToWorld(this.llaToLocal(e))},Object.defineProperty(t.prototype,"coordinates",{get:function(){scratchVector3$6.setScalar(0);var e=this.localToLla(scratchVector3$6),r=e.x,o=e.y;return[r,o].map(function(s){return(s/Math.PI*180).toFixed(6)}).join(",")},enumerable:!1,configurable:!0}),t.prototype.getTransformMatrix4=function(e){return e===void 0&&(e=new THREE__namespace.Matrix4),e.copy(this.coordinateSystem.ecefToEnuMatrix),e.premultiply(enuToLocalMatrix),e.premultiply(this.matrixWorld),e},t.prototype.coordinatesToWorldPoint=function(e){var r=new THREE__namespace.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(r)},t.prototype.worldPointToCoordinates=function(e){return scratchVector3$6.copy(e),this.worldToLla(scratchVector3$6),{latitude:scratchVector3$6.x,longitude:scratchVector3$6.y,altitude:scratchVector3$6.z}},t.prototype.resetBrightness=function(){this.parameter.reset("brightness")},Object.defineProperty(t.prototype,"minLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minLevelOfDetail},set:function(e){this.parameter.set("minLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxLevelOfDetail},set:function(e){this.parameter.set("maxLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minGeometricError},set:function(e){this.parameter.set("minGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxGeometricError},set:function(e){this.parameter.set("maxGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoramaMinGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).panoramaMinGeometricError},set:function(e){this.parameter.set("panoramaMinGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).skipLevelOfDetail},set:function(e){this.parameter.set("skipLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mostDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).mostDetail},set:function(e){this.parameter.set("mostDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).loadSiblings},set:function(e){this.parameter.set("loadSiblings",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxMemoryUsage},set:function(e){this.parameter.set("maxMemoryUsage",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxRequests},set:function(e){this.parameter.set("maxRequests",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestOrder",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).requestOrder},set:function(e){this.parameter.set("requestOrder",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxScreenSpaceError},set:function(e){this.parameter.set("maxScreenSpaceError",e)},enumerable:!1,configurable:!0}),t})(THREE__namespace.Object3D),fetchers={};function getFetcher(n,t){var e=fetchers[n];if(e){var r=e.get(t);if(r)return r}throw new Error("fetcher workCode:".concat(t.workCode," never registered."))}function registerFetcher(n,t,e){var r=fetchers[n];r||(r=fetchers[n]=new WeakMap),r.has(t)||r.set(t,e)}var identityMatrix4=new THREE__namespace.Matrix4,scratchVector3$5=new THREE__namespace.Vector3,scratchMatrix4$2=new THREE__namespace.Matrix4;function getEcefToEnuMatrixFromUpAxis(n,t,e){switch(n){case"Z":e.identity();break;case"WGS84":case"GCJ02":case"BD09":getEcefToEnuMatrix(t,e);break;default:e.identity();break}return e}function loadViewLayer(n){var t,e=n.tilesetUrl.split("#"),r=e[0],o=e[1],s=(t=(o||r).split("?")[1])!==null&&t!==void 0?t:"";return n.fetcher.ajax(n.tilesetUrl,{responseType:"text"}).catch(function(u){return{error:u,body:JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{geometricError:0}})}}).then(function(u){var l,c="error"in u?u.error:null,f=normalizeTilesetHeader(JSON.parse(u.body),n.tilesetUrl),p=f.root,d=f.rootMeta,h=d===void 0?{}:d,g=n.upAxis;h.upAxis&&h.upAxis!==g&&(g=h.upAxis),"lodVersion"in f&&(g="-Y","floorInfo"in f&&(f.properties=f.properties||{},f.properties.floorInfo=f.floorInfo.map(function(_){return{ground:-_.ground,height:_.height}}),f.floorInfo=void 0),f.asset.tilesetVersion=String(f.lodVersion),f.lodVersion=void 0);var m=g,E=new THREE__namespace.Matrix4;m==="Y"?(m="Z",E.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1])):m==="-Y"&&(m="Z",E.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]));var y=p.boundingVolume?makeBoundingVolume(p.boundingVolume):void 0;y&&p.transform&&y.applyMatrix4(scratchMatrix4$2.fromArray(p.transform));var v=null,A=new THREE__namespace.Matrix4,b=new THREE__namespace.Matrix4;h.coordinate?(v=h.coordinate.ground_height,A.fromArray(h.coordinate.pose_ecef_to_enu),b.fromArray(h.coordinate.pose_enu_to_ecef)):(y?y.getCenter(scratchVector3$5):scratchVector3$5.setScalar(0),scratchVector3$5.applyMatrix4(E),getEcefToEnuMatrixFromUpAxis(m,scratchVector3$5,A),b.getInverse(A)),f.root={refine:(l=p.refine)!==null&&l!==void 0?l:"REPLACE",geometricError:p.geometricError,transform:scratchMatrix4$2.copy(E).premultiply(m==="Z"?identityMatrix4:A).premultiply(enuToLocalMatrix).toArray(),boundingVolume:y?y.toJson():void 0,children:[p]};var T=new Tile3D(f,{name:n.name,type:n.type,upAxis:g,light:n.light,fetcher:n.fetcher,search:s,groundHeight:v,coordinateSystem:{enuToEcefMatrix:b,ecefToEnuMatrix:A},error:c});return T})}function loadViewLayers(n,t){var e,r,o=n.layers.map(function(d){return{tilesetUrl:d.work.getURL(d.tileset),name:d.name,type:d.type,upAxis:d.upAxis,light:t.light,fetcher:t.fetcher}});if(n.file){for(var s=!1,u=0,l=o;u<l.length;u++){var c=l[u];if(c.type==="mesh"){s=!0;break}}if(s===!1){var f=getExtname(n.file)||".at3d",p=JSON.stringify({tilesetUrl:"",asset:{version:"0.0"},geometricError:0,root:{refine:"REPLACE",geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:n.work.getURL(n.file)},extras:(e={},e[f.slice(1)]={upAxis:n.upAxis,textureBaseUri:typeof n.textureBase=="string"?n.work.getURL(n.textureBase):void 0,textureArray:n.textures,textureOptions:(r=t.textureOptions)!==null&&r!==void 0?r:{}},e)},rootMeta:{coordinate:n.coordinate}});o.push({name:"fallback",type:"mesh",upAxis:"Z",tilesetUrl:URL.createObjectURL(new Blob([p],{type:"application/json"})),fetcher:t.fetcher,light:t.light})}}return o.map(function(d){return loadViewLayer(d).then(function(h){return t.onError&&(h.error&&t.onError(h.error),h.onError=t.onError),h})})}function createSimpleBoxBufferGeometry(n,t,e){n===void 0&&(n=1),t===void 0&&(t=1),e===void 0&&(e=1);var r=n/2,o=t/2,s=e/2,u=new Float32Array([-r,+o,+s,+r,+o,+s,+r,+o,-s,-r,+o,-s,-r,-o,+s,+r,-o,+s,+r,-o,-s,-r,-o,-s]),l=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),c=new THREE__namespace.BufferGeometry;return c.setAttribute("position",new THREE__namespace.BufferAttribute(u,3)),c.setIndex(new THREE__namespace.BufferAttribute(l,1)),c.addGroup(0,c.index.count,0),c.computeBoundingBox(),c.computeBoundingSphere(),c}function mergeBufferGeometries(n,t){for(var e=n[0].index!==null,r=new Set(Object.keys(n[0].attributes)),o=new Set(Object.keys(n[0].morphAttributes)),s={},u={},l=new THREE__namespace.BufferGeometry,c=0;c<n.length;++c){var f=n[c];if(e!==(f.index!==null))return null;for(var p in f.attributes){if(!r.has(p))return null;s[p]===void 0&&(s[p]=[]),s[p].push(f.attributes[p])}for(var p in f.morphAttributes){if(!o.has(p))return null;u[p]===void 0&&(u[p]=[]),u[p].push(f.morphAttributes[p])}l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(f.userData)}if(e){for(var d=0,h=[],c=0;c<n.length;++c){for(var g=n[c].index,m=0;m<g.count;++m)h.push(g.getX(m)+d);d+=n[c].attributes.position.count}l.setIndex(h)}for(var p in s){var E=mergeBufferAttributes(s[p]);if(!E)return null;l.setAttribute(p,E)}for(var p in u){var y=u[p][0].length;if(y===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[p]=[];for(var c=0;c<y;++c){for(var v=[],m=0;m<u[p].length;++m)v.push(u[p][m][c]);var A=mergeBufferAttributes(v);if(!A)return null;l.morphAttributes[p].push(A)}}return l}function mergeBufferAttributes(n){for(var t,e,r,o=0,s=0;s<n.length;++s){var u=n[s];if(u.isInterleavedBufferAttribute||(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)||(e===void 0&&(e=u.itemSize),e!==u.itemSize)||(r===void 0&&(r=u.normalized),r!==u.normalized))return null;o+=u.array.length}for(var l=new t(o),c=0,s=0;s<n.length;++s)l.set(n[s].array,c),c+=n[s].array.length;return new THREE__namespace.BufferAttribute(l,e,r)}function mergeVertices(n,t){t===void 0&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var e={},r=n.getIndex(),o=n.getAttribute("position"),s=r?r.count:o.count,u=0,l=Object.keys(n.attributes),c={},f={},p=[],d=["getX","getY","getZ","getW"],h=0,g=l.length;h<g;h++){var m=l[h];c[m]=[];var E=n.morphAttributes[m];E&&(f[m]=new Array(E.length).fill().map(function(){return[]}))}for(var y=Math.log10(1/t),v=Math.pow(10,y),h=0;h<s;h++){for(var A=r?r.getX(h):h,b="",T=0,g=l.length;T<g;T++)for(var m=l[T],_=n.getAttribute(m),S=_.itemSize,w=0;w<S;w++)b+="".concat(~~(_[d[w]](A)*v),",");if(b in e)p.push(e[b]);else{for(var T=0,g=l.length;T<g;T++)for(var m=l[T],_=n.getAttribute(m),E=n.morphAttributes[m],S=_.itemSize,R=c[m],I=f[m],w=0;w<S;w++){var H=d[w];if(R.push(_[H](A)),E)for(var C=0,M=E.length;C<M;C++)I[C].push(E[C][H](A))}e[b]=u,p.push(u),u++}}for(var B=n.clone(),h=0,g=l.length;h<g;h++){var m=l[h],L=n.getAttribute(m),O=new L.array.constructor(c[m]),_=new THREE__namespace.BufferAttribute(O,L.itemSize,L.normalized);if(B.setAttribute(m,_),m in f)for(var T=0;T<f[m].length;T++){var k=n.morphAttributes[m][T],O=new k.array.constructor(f[m][T]),D=new THREE__namespace.BufferAttribute(O,k.itemSize,k.normalized);B.morphAttributes[m][T]=D}}return B.setIndex(p),B}var scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4$1=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4;function getEdgesBySphere(n,t,e){e===void 0&&(e=30/180*Math.PI);for(var r=Math.cos(e),o=[],s=0,u=n.children;s<u.length;s++){var l=u[s];l instanceof Tile3D&&l.tileset.selectedTiles.forEach(function(c){var f,p,d,h=(p=(f=c.content)===null||f===void 0?void 0:f.data)===null||p===void 0?void 0:p.object;if(h&&h.visible){var g=[];if(h.traverseVisible(function(Q){if(Q instanceof THREE__namespace.Mesh){var U=getBvhTreeForMesh(Q);if(U){scratchMatrix4$1.copy(Q.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4$1),scratchSphere$1.copy(t).applyMatrix4(scratchMatrix4Inverse);var j=U.trianglesInSphere(scratchSphere$1.center,scratchSphere$1.radius),G=new THREE__namespace.BufferGeometry;G.setAttribute("position",new THREE__namespace.BufferAttribute(j,3)),G.applyMatrix4(Q.matrixWorld),G=mergeVertices(G,.01),g.push(G)}}}),g.length===0)return;for(var m=["a","b","c"],E=mergeBufferGeometries(g),y=E.getAttribute("position").array,v=((d=E.getIndex())===null||d===void 0?void 0:d.array)||[],A=[],b=[],T=0,_=y.length;T<_;T+=3){var S=new THREE__namespace.Vector3(y[T],y[T+1],y[T+2]);A.push(S)}for(var T=0,_=v.length;T<_;T+=3){var w=v[T],R=v[T+1],I=v[T+2],H=new THREE__namespace.Vector3().crossVectors(A[R].clone().sub(A[w]),A[I].clone().sub(A[w])).normalize();b.push({a:w,b:R,c:I,normal:H})}for(var C={},T=0,_=b.length;T<_;T++)for(var M=b[T],B=0;B<3;B++){var L=M[m[B]],O=M[m[(B+1)%3]],k=[Math.min(L,O),Math.max(L,O)],D=k[0]+"-"+k[1];C[D]===void 0?C[D]={index1:k[0],index2:k[1],face1:T}:C[D].face2=T}for(var D in C){var q=C[D];if(q.face2===void 0||b[q.face1].normal.dot(b[q.face2].normal)<=r){var z=A[q.index1],V=A[q.index2];o.push(new THREE__namespace.Line3(z,V))}}A.length=0,b.length=0}})}return o}var scratchBoundingBox$1=new THREE__namespace.Box3,scratchViewLayerBox=new THREE__namespace.Box3,scratchObserverBox$3=new THREE__namespace.Box3,Model=(function(n){__extends(t,n);function t(e,r,o){o===void 0&&(o={});var s,u=n.call(this)||this;u.disposed=!1,u.parameter=new Parameter,u.outdated=!1,u.autoRefine=!0,u.metaPending=!1,u.loaded=!1,u.refined=!1,u.refineProgress=[0,0],u.boundingBox=new THREE__namespace.Box3,u.fiveId=e,u.needsRender=!1,u.work=r,u.name=r.workCode;for(var l=0,c=0,f=r.observers;c<f.length;c++){var p=f[c];l=Math.max(l,p.floorIndex)}if(u.floorLength=l+1,r.model){u.metaPending=!0;var d=loadViewLayers(r.model,{fetcher:getFetcher(u.fiveId,r),light:(s=o.light)!==null&&s!==void 0?s:!1,textureOptions:o.textureOptions,onError:function(h){return u.dispatchEvent({type:"error",error:h})}});u.initReady=Promise.all(d).then(function(h){if(u.metaPending=!1,h.length)if(u.disposed)for(var g=0,m=h;g<m.length;g++){var E=m[g];E.dispose()}else u.add.apply(u,h);return u}),u.loadedReady=new Promise(function(h){var g=function(){h(u),u.removeEventListener("load",g),u.removeEventListener("dispose",g)};u.addEventListener("load",g),u.addEventListener("dispose",g)})}else u.refined=!0,u.loaded=!0,u.initReady=Promise.resolve(u),u.loadedReady=Promise.resolve(u);return u.parameter.set("boundingBox",u.boundingBox.clone()),u}return t.prototype.dispose=function(){this.disposed=!0;for(var e;e=this.children[0];)typeof e.dispose=="function"&&e.dispose(),this.remove(e);this.dispatchEvent({type:"dispose"})},Object.defineProperty(t.prototype,"empty",{get:function(){return this.children.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayers",{get:function(){return this.children},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,r){return r===void 0&&(r=30/180*Math.PI),getEdgesBySphere(this,e,r)},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=e.sortByDistance;e.sortByDistance=!1;for(var u=0,l=this.children.length;u<l;u++){var c=this.children[u];c.visible&&typeof c.intersectRaycaster=="function"&&c.intersectRaycaster(e,o)}return e.sortByDistance=s,sortIntersects(o,e.sortByDistance,e.firstHitOnly),o},t.prototype.update=function(e,r,o){var s=!1;this.needsRender===!0&&(this.needsRender=!1,s=!0);var u=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,s=!0);for(var l=0,c=this.children;l<c.length;l++){var f=c[l];f.autoRefine=this.autoRefine;var p=f.update(e,r,o,this);p&&(s=!0),f.refined===!1&&(this.refined=!1),f.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=f.refineProgress[0],this.refineProgress[1]+=f.refineProgress[1]}scratchBoundingBox$1.makeEmpty(),scratchObserverBox$3.copy(this.work.observerBox),scratchObserverBox$3.isEmpty()||(scratchObserverBox$3.max.x+=1,scratchObserverBox$3.max.z+=1,scratchObserverBox$3.max.y+=1,scratchObserverBox$3.min.x-=1,scratchObserverBox$3.min.z-=1,scratchBoundingBox$1.union(scratchObserverBox$3));for(var d=0,h=this.viewLayers;d<h.length;d++){var f=h[d];f.boundingBox.isEmpty()||(scratchViewLayerBox.copy(f.boundingBox),scratchBoundingBox$1.union(scratchViewLayerBox))}return scratchBoundingBox$1.applyMatrix4(this.matrix),scratchBoundingBox$1.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox$1),this.parameter.set("boundingBox",scratchBoundingBox$1.clone())),u===!1&&this.loaded===!0&&this.dispatchEvent({type:"load"}),s},t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},Object.defineProperty(t.prototype,"shownFloor",{get:function(){return this.shownFloorIndex===-1?null:this.shownFloorIndex},set:function(e){this.shownFloorIndex=e===null?-1:e},enumerable:!1,configurable:!0}),t.prototype.show=function(e){this.shownFloor=e!=null?e:null,this.dispatchEvent({type:"changeShownFloor",shownFloor:e})},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r)},Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).shownFloorIndex},set:function(e){this.parameter.set("shownFloorIndex",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"brightness",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).brightness},set:function(e){this.parameter.set("brightness",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clippers",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).clippers},set:function(e){this.parameter.set("clippers",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customShaders",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).customShaders},set:function(e){this.parameter.set("customShaders",e)},enumerable:!1,configurable:!0}),t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.viewLayers;e<r.length;e++){var o=r[e];o.resetBrightness()}},t})(THREE__namespace.Object3D),scratchGeometry=createSimpleBoxBufferGeometry(1,1,1);scratchGeometry.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var versionMap=new WeakMap,cameraBoxSize=new THREE__namespace.Vector3(1,1,1),scratchBoundingBox=new THREE__namespace.Box3,scratchBoundingBoxSize=new THREE__namespace.Vector3,scratchCameraBox=new THREE__namespace.Box3,scratchPosition=new THREE__namespace.Vector3,scratchScale=new THREE__namespace.Vector3,BoundingMesh$1=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r=this,o,s=new PBMMeshMaterial("none");return s.flatShading=!0,s.depthWrite=!1,s.transparent=!1,s.blending=THREE__namespace.CustomBlending,s.blendSrc=THREE__namespace.SrcAlphaFactor,s.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,s.blendSrcAlpha=THREE__namespace.OneFactor,s.blendDstAlpha=THREE__namespace.OneMinusSrcAlphaFactor,s.floorIndex=-1,r=n.call(this,scratchGeometry,[s])||this,r.name=(o=e.name)!==null&&o!==void 0?o:"",r.frustumCulled=!1,r.renderOrder=-999999,r}return t.prototype.update=function(e,r,o){var s=!1,u=Parameter.resolveValue(o.parameter);scratchBoundingBox.copy(u.boundingBox),scratchBoundingBox.getSize(scratchBoundingBoxSize);var l=Math.min(scratchBoundingBoxSize.x/2,500);scratchBoundingBox.min.x-=l,scratchBoundingBox.max.x+=l;var c=Math.min(scratchBoundingBoxSize.y/2,500);scratchBoundingBox.min.z-=c,scratchBoundingBox.max.z+=c;var f=scratchBoundingBoxSize.length()/2;if(scratchBoundingBox.max.y=Math.max(scratchBoundingBox.max.y,f),scratchBoundingBox.union(scratchCameraBox.setFromCenterAndSize(r.position,cameraBoxSize)),scratchBoundingBox.expandByScalar(1),scratchBoundingBox.getCenter(scratchPosition),scratchBoundingBox.getSize(scratchScale),scratchPosition.equals(this.position)||(this.position.copy(scratchPosition),s=!0),scratchScale.equals(this.scale)||(this.scale.copy(scratchScale),s=!0),versionMap.get(this)!==u.version){versionMap.set(this,u.version),s=!0;for(var p=this.material,d=0,h=p;d<h.length;d++){var g=h[d];g.customShaders=u.customShaders,g.pano0=u.pano0,g.pano1=u.pano1,g.refinedScreen=u.refinedScreen,g.modelAlpha=u.modelAlpha,g.progress=u.progress,g.transition=u.transition,g.opacity=u.opacity,g.floorStyle=u.floorStyle,g.constantColor=u.constantColor,g.shownFloorIndex=u.shownFloorIndex,g.clippers=u.clippers,g.brightness=u.brightness,g.useHQWeight=u.useHQWeight,g.useHQDepth=u.useHQDepth,g.colorSaturation=u.colorSaturation,g.colorBrightness=u.colorBrightness,g.gradientTexture=u.gradientTexture,g.transparent=!1,g.modelBoundingMax.copy(u.boundingBox.max),g.modelBoundingMin.copy(u.boundingBox.min),u.useAddBlend&&(g.opacity=0),g.opacity===0&&(g.visible=!1)}}return s},t.prototype.dispose=function(){for(var e=0,r=this.material;e<r.length;e++){var o=r[e];o.dispose(),o.pano0=null,o.pano1=null}},t})(PBMMesh),scratchBoundingBox3=new THREE__namespace.Box3,ModelScene=(function(n){__extends(t,n);function t(e){var r=n.call(this)||this;r.needsRender=!0,r.autoRefine=!0,r.boundingBox=new THREE__namespace.Box3,r.loaded=!1,r.refined=!1,r.refineProgress=[0,0],r.parameter=new Parameter,r.fiveId=e.fiveId,r.boundingMesh=new BoundingMesh$1({name:"bounding"}),r.add(r.boundingMesh);var o=r.models=[];r.shownModels=[],r.updateModelMap=new Map,r.parameter.set("boundingBox",r.boundingBox.clone());var s=r;return defineProperty(o,"autoUpdate",{get:function(){return s.autoRefine},set:function(u){s.autoRefine=u}}),defineProperty(o,"bounding",{get:function(){return s.boundingBox}}),defineProperty(o,"loaded",{get:function(){return s.loaded}}),defineProperty(o,"refined",{get:function(){return s.refined}}),defineProperty(o,"refineProgress",{get:function(){return s.refineProgress}}),defineProperty(o,"cacheCameras",{get:function(){return s.parameter.resolveValue().cacheCameras},set:function(u){s.parameter.set("cacheCameras",u)}}),defineProperty(o,"intersectRaycaster",{value:function(u){return s.intersectRaycaster(u)}}),defineProperty(o,"setMaterial",{value:function(u){return s.setMaterial(u)}}),defineProperty(o,"getMaterial",{value:function(){return s.getMaterial()}}),defineProperty(o,"resetBrightness",{value:function(){return s.resetBrightness()}}),r}return t.prototype.setModels=function(e,r){for(var o=this,s=e.map(function(c){var f=o.shownModels.filter(function(d){return d.work.workCode===c.workCode})[0];if(f||(f=o.models.filter(function(d){return d.work.workCode===c.workCode})[0],f))return f.work=c,f;f=new Model(o.fiveId,c,{light:r.light,textureOptions:r.textureOptions});var p=r["3d-tiles"];return f.initReady.then(function(){if(p)if(typeof p=="function")for(var d=0,h=f.viewLayers;d<h.length;d++){var g=h[d],m=p(g,f);m&&(m.viewerRequestVolume&&(g.viewerRequestVolume=makeBoundingVolume(m.viewerRequestVolume)),g.parameter.set(omit(m,["showLayers"])),m.showLayers===!1?g.visible=!1:Array.isArray(m.showLayers)&&(g.visible=m.showLayers.includes(g.name)))}else for(var E=0,y=f.viewLayers;E<y.length;E++){var g=y[E];p.viewerRequestVolume&&(g.viewerRequestVolume=makeBoundingVolume(p.viewerRequestVolume)),g.parameter.set(omit(p,["showLayers"])),p.showLayers===!1?g.visible=!1:Array.isArray(p.showLayers)&&(g.visible=p.showLayers.includes(g.name))}}),o.dispatchEvent({type:"model.create",model:f}),f}),u=0;u<this.models.length;u++){var l=this.models[u];s.indexOf(l)===-1&&this.shownModels.indexOf(l)===-1&&(l.dispose(),this.dispatchEvent({type:"model.dispose",model:l}))}this.models.length=0;for(var u=0;u<s.length;u++){var l=s[u];this.models.push(l)}if(r.forceReplaceImmediately&&!arrayEqual(this.models,this.shownModels)){for(var u=0;u<this.shownModels.length;u++){var l=this.shownModels[u];this.models.indexOf(l)===-1&&(l.dispose(),this.dispatchEvent({type:"model.dispose",model:l}))}this.shownModels.length=0;for(var u=0;u<this.models.length;u++)this.shownModels.push(this.models[u])}return this.loaded=!1,this.refined=!1,this.models},Object.defineProperty(t.prototype,"empty",{get:function(){return this.boundingBox.isEmpty()},enumerable:!1,configurable:!0}),t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=this.shownModels.filter(function(p){return p.visible});if(s.length===1)s[0].intersectRaycaster(e,o);else{var u=e.sortByDistance;e.sortByDistance=!1;for(var l=0,c=s;l<c.length;l++){var f=c[l];f.intersectRaycaster(e,o)}e.sortByDistance=u,sortIntersects(o,e.sortByDistance,e.firstHitOnly)}return o},t.prototype.update=function(e,r){var o=!1;scratchBoundingBox3.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.updateModelMap.clear();for(var s=0;s<this.models.length;s++){var u=this.models[s];if(!this.updateModelMap.has(u)){var l=u.autoRefine;this.autoRefine===!1&&(u.autoRefine=!1);var c=u.update(e,r,this);u.autoRefine=l,this.updateModelMap.set(u,c)}u.loaded===!1&&(this.loaded=!1),u.refined===!1&&(this.refined=!1),this.refineProgress[0]+=u.refineProgress[0],this.refineProgress[1]+=u.refineProgress[1]}if((this.loaded===!0||this.models.length===0)&&!arrayEqual(this.models,this.shownModels)){for(var s=0;s<this.shownModels.length;s++){var u=this.shownModels[s];this.models.indexOf(u)===-1&&(u.dispose(),this.dispatchEvent({type:"model.dispose",model:u}))}this.shownModels.length=0;for(var s=0;s<this.models.length;s++)this.shownModels.push(this.models[s]);o=!0}for(var s=0;s<this.shownModels.length;s++){var u=this.shownModels[s];if(!this.updateModelMap.has(u)){var l=u.autoRefine;(this.autoRefine===!1||this.models.indexOf(u)<0)&&(u.autoRefine=!1);var c=u.update(e,r,this);u.autoRefine=l,this.updateModelMap.set(u,c)}}for(var s=this.children.length-1;s>=0;s--){var u=this.children[s];u instanceof Model&&this.remove(u)}for(var s=0;s<this.shownModels.length;s++){var u=this.shownModels[s];this.updateModelMap.get(u)===!0&&(o=!0),scratchBoundingBox3.union(u.boundingBox),this.add(u)}for(var s=0;s<this.models.length;s++){var u=this.models[s];this.shownModels.indexOf(u)===-1&&scratchBoundingBox3.union(u.boundingBox)}scratchBoundingBox3.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox3),this.parameter.set("boundingBox",this.boundingBox.clone()),o=!0);var f=this.boundingMesh.update(e,r,this);return f&&(o=!0),this.updateModelMap.clear(),this.needsRender=o,o},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){return this.parameter.resolveValue()},t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.models;e<r.length;e++){var o=r[e];o.resetBrightness()}},t.prototype.dispose=function(){this.remove(this.boundingMesh),this.boundingMesh.dispose();for(var e=this.children.length-1;e>=0;e--){var r=this.children[e];r instanceof Model&&this.remove(r)}for(var o=arrayUnique(this.models.concat(this.shownModels)),e=0;e<this.shownModels.length;e++)o[e].dispose();this.models.length=0,this.shownModels.length=0,n.prototype.dispose.call(this)},t})(THREE__namespace.Scene);function workInitialToJson(n){var t={};return typeof n.mode!="undefined"&&(t.mode=n.mode),typeof n.panoIndex!="undefined"&&(t.pano_index=n.panoIndex),typeof n.longitude!="undefined"&&(t.longitude=n.longitude),typeof n.latitude!="undefined"&&(t.latitude=n.latitude),typeof n.fov!="undefined"&&(t.fov=n.fov),typeof n.distance!="undefined"&&(t.distance=n.distance),typeof n.offset!="undefined"&&(t.offset=n.offset.toArray()),t}function workModelToJson(n){var t;if(n)return{file_url:n.file,material_base_url:n.textureBase,material_textures:(t=n.textures)===null||t===void 0?void 0:t.slice(),up_axis:n.upAxis,layers:n.layers.map(function(e){return{tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}})}}function workObserverToObserverJson(n){return{index:n.index,derived_id:n.derivedId,derived_id_str:n.derivedIdStr,floor_index:n.floorIndex,position:n.position.toArray(),standing_position:n.standingPosition.toArray(),quaternion:{x:n.quaternion.x,y:n.quaternion.y,z:n.quaternion.z,w:n.quaternion.w},visible_nodes:n.accessibleNodes.slice(),accessible_nodes:n.accessibleNodes.slice()}}function workObserverToPanoramaJson(n){return{index:n.index,active:n.active,loadable:n.loadable,derived_id:n.derivedId,derived_id_str:n.derivedIdStr,size_list:n.images.sizeList.slice(),up:n.images.up,down:n.images.down,right:n.images.right,left:n.images.left,front:n.images.front,back:n.images.back,video:n.images.video?{matrix:n.images.video.matrix.toArray(),size:n.images.video.size.toArray(),source:n.images.video.source}:void 0}}function workToJson(n){return{allow_hosts:n.allowHosts.slice(),expire_at:n.expire.getTime().toString(),project_id:n.projectId,code:n.workCode,name:n.name,base_url:n.baseURL,initial:workInitialToJson(n.initial),model:workModelToJson(n.model),observers:n.observers.map(function(t){return workObserverToObserverJson(t)}),panorama:{count:n.observers.length,list:n.observers.map(function(t){return workObserverToPanoramaJson(t)})}}}function isNumber(n){return typeof n=="number"}function jsonClone(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return n.map(function(o){return typeof o!="object"||o===null?o:jsonClone(o)});var t={};for(var e in n){var r=n[e];t[e]=typeof r!="object"||r===null?r:jsonClone(r)}return t}function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function jsonMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return jsonClone(t);if(r==="array")for(var o=0;o<t.length;o++)n[o]=jsonMerge(n[o],t[o]);else if(r==="dict")for(var s in t)n[s]=jsonMerge(n[s],t[s]);return n}function jsonStableStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":return JSON.stringify(n.toString());case"undefined":return t?void 0:null;case"number":return n;default:return isFinite(n)?n:null}}function jsonStableStrinfiy(n){return jsonStableStrinfiy_(n,!1)}function jsonHash(n){return"hash::".concat(sha256(jsonStableStrinfiy(n)))}var PANO_ID_REG=/^(.*)\[(\d+)\]$/;function panoStringify(n){if(!isNaN(n.panoIndex)&&isFinite(n.panoIndex))return"".concat(n.workCode,"[").concat(n.panoIndex,"]");throw new Error("Invalid Pano")}function panoParse(n){var t=n.match(PANO_ID_REG);if(t){t[0];var e=t[1],r=t[2],o=Math.floor(Number(r));if(!isNaN(o)&&isFinite(o))return{workCode:e,panoIndex:o}}throw new Error("Invalid PanoId")}function panoEqual(n,t){return panoStringify(n)===panoStringify(t)}function isPanoId(n){return typeof n=="string"&&PANO_ID_REG.test(n)}var REG_STR="\\{([^\\}]+)\\}";function escapeRegexp(n){return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function createRegExp(n){return new RegExp("^"+n.map(function(t){return escapeRegexp(t)}).join("(.+)")+"$")}var StringPattern=(function(){function n(t){this.strings=[],this.keys=[];for(var e=new RegExp(REG_STR,"g"),r,o=0;(r=e.exec(t))!==null;)this.strings.push(t.slice(o,r.index)),this.keys.push(r[1]),o=r.index+r[0].length;this.strings.push(t.slice(o))}return n.prototype.stringify=function(t){for(var e=[this.strings[0]],r=0;r<this.keys.length;r++){var o=t[this.keys[r]];e.push(String(o),this.strings[r+1])}return e.join("")},n.prototype.match=function(t){var e;this.matchRegexp=(e=this.matchRegexp)!==null&&e!==void 0?e:createRegExp(this.strings);var r=t.match(this.matchRegexp);if(!r)return null;for(var o={},s=0;s<this.keys.length;s++){var u=this.keys[s],l=r[s+1];if(o[u]!==l){if(o[u]!==void 0)return null;o[u]=l}}return o},n})();function deepFreeze(n){Object.freeze(n);var t=typeof n=="function",e=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(n).forEach(function(r){e.call(n,r)&&(!t||r!=="caller"&&r!=="callee"&&r!=="arguments")&&n[r]!==null&&(typeof n[r]=="object"||typeof n[r]=="function")&&!Object.isFrozen(n[r])&&deepFreeze(n[r])}),n}var URL_REGEXP=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,BUILDIN_ALLOW_HOST=deepFreeze(JSON.parse((function n(){var t=113,e=126,r=0,o="";return arguments[r].split(o).map(function(s){return s.charCodeAt(r)>e?s:String.fromCharCode((s.charCodeAt(r)+t)%e)}).join(o)})("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j"))),domainRegex=/^([^.]+)(\.([^.]+))*$/,currentHostname=typeof location!="undefined"?location.hostname:"localhost";function isIPDomain(n){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(n)}function matchDomain(n,t){if(!domainRegex.test(n)||!domainRegex.test(t))return!1;if(n==="*")return!0;var e=n.split(".").reverse(),r=t.split(".").reverse();if(e.length<=1)return n===t;for(var o=0;o<e.length;o++)if(e[o]!==r[o])return!1;return!0}function hostnameFromURL(n){if(/^blob\:/i.test(n)||/^data\:/i.test(n))return currentHostname;var t=n.match(URL_REGEXP);return t?t[2]:currentHostname}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(n){return new Error("Date(".concat(n.toString(),") expired."))},error_host_not_allowed=function(n){return new Error("Host(".concat(JSON.stringify(n),") is not allowed."))};function ObjectOmit(n,t){for(var e={},r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];t.indexOf(s)===-1&&(e[s]=n[s])}return e}function jsonStableNoneNumberStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableNoneNumberStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableNoneNumberStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableNoneNumberStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableNoneNumberStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(n)?n:null}}function jsonStableNoneNumberStrinfiy(n){return String(jsonStableNoneNumberStrinfiy_(n,!1))}function verify(n){var t,e,r,o={};try{o=typeof n=="string"?JSON.parse(n):n}catch(y){return error_invalid_input()}if(typeof o!="object")return error_invalid_input();var s=currentHostname,u=Date.now(),l=new Date(typeof o.expire_at=="string"&&/^\d+$/.test(o.expire_at)?Number(o.expire_at):o.expire_at),c=Array.isArray(o.allow_hosts)?o.allow_hosts:[];if(s.length===0||isIPDomain(s)||BUILDIN_ALLOW_HOST.filter(function(y){return matchDomain(y,s)}).length>0){var f=String((t=o.certificate)!==null&&t!==void 0?t:"");if(f)try{var p=new X509;return p.readCertPEM(f),deepFreeze({issuer:p.getSubjectString(),expire:l,allowHosts:c})}catch(y){var d=y instanceof Error?y.message:String(y);console.warn("[PARSE Error]: Invalid Certificate. "+d)}return deepFreeze({issuer:"none",expire:l,allowHosts:c})}var h=String((e=o.certificate)!==null&&e!==void 0?e:"");if(!h)return error_invalid_certificate();var g=new X509;g.readCertPEM(h);var m=String((r=o._signature)!==null&&r!==void 0?r:"");if(!m)return error_invalid_signature();var E=jsonStableNoneNumberStrinfiy(ObjectOmit(o,["_signature"]));return verifyMessage(E,m,g)===!1?error_invalid_signature():u<l.getTime()?BUILDIN_ALLOW_HOST.concat(c).filter(function(y){return matchDomain(y,s)}).length===0?error_host_not_allowed(s):deepFreeze({issuer:g.getSubjectString(),expire:l,allowHosts:c}):error_date_expired(l)}function verifyURL(n,t){var e=hostnameFromURL(n);return currentHostname.length!==0&&!isIPDomain(currentHostname)&&BUILDIN_ALLOW_HOST.filter(function(r){return matchDomain(r,currentHostname)}).length===0&&!isIPDomain(e)&&BUILDIN_ALLOW_HOST.concat(t).filter(function(r){return matchDomain(r,e)}).length===0?error_host_not_allowed(e):n}var accessibleNodesSet=new Set,PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(1,1,1),FACE_ORDER$1=["right","left","up","down","front","back"];function relativeURL(n,t){if(!isAbsoluteURL(n))return n;if(n.indexOf(t)===0)return n.slice(t.length);var e=t.replace(/^https\:/,"http:");if(n.indexOf(e)===0)return n.slice(e.length);var r=t.replace(/^http\:/,"https:");return n.indexOf(r)===0?n.slice(r.length):(console.warn("".concat(n," is not start with base_url(").concat(t,").")),n)}function panoURL(n,t,e){return!isAbsoluteURL(n)&&typeof t=="string"&&t.length>0&&(n=pathJoin(t,String(e),n)),n}function getTileLevel(n){for(var t=10;t>=0;t--){var e=512*Math.pow(2,t);if(e<=n)return t}return null}function sortTile(n){n=n.slice().sort(function(u,l){return u.level-l.level});for(var t=[],e=0,r=n;e<r.length;e++){var o=r[e];if(t.length===0){t.push(o);continue}var s=t[t.length-1];if(o.level>s.level){t.push(o);continue}if(o.size>s.size){t[t.length-1]=o;continue}}return t}function parse(n,t){for(var e,r,o,s,u,l,c,f,p,d,h,g,m,E,y,v,A,b,T,_=[],S=null,w=0,R=[].concat(n);w<R.length;w++){var I=R[w];if("getURL"in I)S={allowHosts:I.allowHosts,expire:I.expire,issuer:I.issuer},_.push(workToJson(I));else{var H=typeof I=="string"?JSON.parse(I):jsonClone(I),C=verify(H);if(C instanceof Error)return C;S===null&&(S=C),_.push(H)}}if(S===null)return new Error("Empty");defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:S.issuer}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(S.expire)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(S.allowHosts)});var M=_.reduce(function(W,X){return jsonMerge(W,X)});defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:String((e=M.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{enumerable:!0,writable:!0,value:String(M.resource_code||M.basic_code||M.vr_code||M.code||M.project_id||M.work_code||M.workCode||createUuid())}),defineProperty(t,"projectId",{enumerable:!0,writable:!0,value:M.project_id}),defineProperty(t,"baseURL",{enumerable:!0,writable:!0,value:(function(){var W,X=(W=M.base_url)!==null&&W!==void 0?W:"";return X&&X[X.length-1]!=="/"&&(X+="/"),X})()});var B=void 0;typeof M.model=="object"&&(B={},defineProperty(B,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(B,"file",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var W=M.model.file_url;if(W)return relativeURL(W,t.baseURL)})()}),defineProperty(B,"textureBase",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var W=M.model.material_base_url;return W&&(W=relativeURL(W,t.baseURL)),W})()}),defineProperty(B,"textures",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var W=void 0;return Array.isArray(M.model.material_textures)&&(W=M.model.material_textures.slice(),Object.freeze(W)),W})()}),defineProperty(B,"upAxis",{enumerable:!0,configurable:!1,writable:!1,value:M.model.up_axis}),defineProperty(B,"coordinate",{enumerable:!0,configurable:!1,writable:!1,value:(function(){return jsonClone(M.model.coordinate)})()}),defineProperty(B,"layers",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var W,X,te,Z=[];if(Array.isArray(M.model.layers))for(var ne=0,pe=M.model.layers;ne<pe.length;ne++){var ie=pe[ne];if(ie&&ie.tileset_url){var ue={};defineProperty(ue,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(ue,"name",{enumerable:!0,configurable:!1,writable:!1,value:(W=ie.name)!==null&&W!==void 0?W:""}),defineProperty(ue,"type",{enumerable:!0,configurable:!1,writable:!1,value:(X=ie.type)!==null&&X!==void 0?X:"mesh"}),defineProperty(ue,"upAxis",{enumerable:!0,configurable:!1,writable:!1,value:(te=ie.up_axis)!==null&&te!==void 0?te:"Z"}),defineProperty(ue,"tileset",{enumerable:!0,configurable:!1,writable:!1,value:relativeURL(ie.tileset_url,t.baseURL)}),Z.push(ue)}}if(typeof M.model.tiles=="object"){var ie=M.model.tiles;if(ie&&ie.tileset_url){var ue={};defineProperty(ue,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(ue,"name",{enumerable:!0,configurable:!1,writable:!1,value:"lod"}),defineProperty(ue,"type",{enumerable:!0,configurable:!1,writable:!1,value:"mesh"}),defineProperty(ue,"upAxis",{enumerable:!0,configurable:!1,writable:!1,value:"-Y"}),defineProperty(ue,"tileset",{enumerable:!0,configurable:!1,writable:!1,value:relativeURL(ie.tileset_url,t.baseURL)}),Z.push(ue)}}return Object.freeze(Z)})()})),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:B});var L=[];if(Array.isArray(M.observers)&&M.panorama&&Array.isArray(M.panorama.list||M.panorama.info)){for(var O=M.observers,k=(r=M.panorama.list||M.panorama.info)!==null&&r!==void 0?r:[],D=(f=(l=(s=(o=M.panorama)===null||o===void 0?void 0:o.pano_high_cube_base_url)!==null&&s!==void 0?s:(u=M.panorama)===null||u===void 0?void 0:u.pano_cube_base_url)!==null&&l!==void 0?l:(c=M.panorama)===null||c===void 0?void 0:c.base_url)!==null&&f!==void 0?f:"",q=Math.min(O.length,k.length),z={},V=function(W){var X=W,te=M.panorama.pattern[X];if(typeof te=="string"){var Z=new StringPattern(te);z[X]=function(ne){return Z.stringify(ne)}}else z[X]=function(){return te}},Q=0,U=Object.keys((p=M.panorama.pattern)!==null&&p!==void 0?p:{});Q<U.length;Q++){var j=U[Q];V(j)}for(var G=function(W,X){var te,Z=z[X];return(te=W[X])!==null&&te!==void 0?te:Z?Z(W):void 0},ae=function(W){var X=O[W],te=k[W],Z={};defineProperty(Z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(Z,"index",{enumerable:!0,configurable:!1,writable:!1,value:W}),defineProperty(Z,"panoIndex",{enumerable:!0,configurable:!1,writable:!1,value:W}),defineProperty(Z,"panoId",{enumerable:!0,configurable:!1,writable:!1,value:panoStringify({workCode:t.workCode,panoIndex:W})}),defineProperty(Z,"floorIndex",{enumerable:!0,configurable:!1,writable:!1,value:(d=X.floor_index)!==null&&d!==void 0?d:X.floor}),defineProperty(Z,"derivedId",{enumerable:!0,configurable:!1,writable:!1,value:(g=(h=X.derived_id)!==null&&h!==void 0?h:G(te,"derived_id"))!==null&&g!==void 0?g:0}),defineProperty(Z,"derivedIdStr",{enumerable:!0,configurable:!1,writable:!1,value:(E=(m=X.derived_id_str)!==null&&m!==void 0?m:G(te,"derived_id_str"))!==null&&E!==void 0?E:String(Z.derivedId)}),defineProperty(Z,"active",{enumerable:!0,configurable:!1,writable:!1,value:X.active!==!1&&G(te,"active")!==!1}),defineProperty(Z,"loadable",{enumerable:!0,configurable:!1,writable:!1,value:(v=(y=X.loadable)!==null&&y!==void 0?y:G(te,"loadable"))!==null&&v!==void 0?v:!1}),defineProperty(Z,"position",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((A=X.position)!==null&&A!==void 0?A:[0,0,0]))}),defineProperty(Z,"standingPosition",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((T=(b=X.standing_position)!==null&&b!==void 0?b:X.standingPosition)!==null&&T!==void 0?T:[0,0,0]))}),defineProperty(Z,"quaternion",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Quaternion().fromArray(X.quaternion?[X.quaternion.x,X.quaternion.y,X.quaternion.z,X.quaternion.w]:[0,0,0,1]))}),defineProperty(Z,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Matrix4().compose(Z.position,Z.quaternion,PANO_TEXTURE_SCALE))}),defineProperty(Z,"accessibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:(function(){if(accessibleNodesSet.clear(),X.accessible_nodes&&Array.isArray(X.accessible_nodes))for(var ne=0,pe=X.accessible_nodes;ne<pe.length;ne++){var ie=pe[ne];ie>=q||ie===W||accessibleNodesSet.add(ie)}else if(X.accessibleNodes&&Array.isArray(X.accessibleNodes))for(var ue=0,be=X.accessibleNodes;ue<be.length;ue++){var ie=be[ue];ie>=q||ie===W||accessibleNodesSet.add(ie)}else if(X.visible_nodes&&Array.isArray(X.visible_nodes))for(var oe=0,le=X.visible_nodes;oe<le.length;oe++){var ie=le[oe];ie>=q||ie===W||accessibleNodesSet.add(ie)}else if(X.visibleNodes&&Array.isArray(X.visibleNodes))for(var me=0,ge=X.visibleNodes;me<ge.length;me++){var ie=ge[me];ie>=q||ie===W||accessibleNodesSet.add(ie)}if(accessibleNodesSet.size===0)for(var Ae=0;Ae<q;Ae++)Ae!==W&&accessibleNodesSet.add(Ae);var xe=Array.from(accessibleNodesSet);return accessibleNodesSet.clear(),Object.freeze(xe)})()}),defineProperty(Z,"visibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:Z.accessibleNodes}),defineProperty(Z,"images",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var ne={};defineProperty(ne,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var pe=function(oe){defineProperty(ne,oe,{enumerable:!0,configurable:!1,writable:!1,value:(function(){var le;return relativeURL(panoURL((le=G(te,oe))!==null&&le!==void 0?le:"",D,W),t.baseURL)})()})},ie=0,ue=FACE_ORDER$1;ie<ue.length;ie++){var be=ue[ie];pe(be)}return defineProperty(ne,"sizeList",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var oe=getImageSizeFromURL(ne[FACE_ORDER$1[0]]),le=G(te,"size_list"),me=G(te,"tiles");if(oe){if(le){var ge=le.slice().sort(function(Ee,de){return Ee-de});return Object.freeze(ge)}else if(me){for(var ge=[oe],Ae=me.slice().sort(function(de,Ve){return de-Ve}),xe=0,he=Ae;xe<he.length;xe++){var _e=he[xe],He=512*Math.pow(2,_e);He>oe&&ge.push(He)}return Object.freeze(ge)}return Object.freeze([oe])}return Object.freeze([])})()}),defineProperty(ne,"tiles",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var oe=getImageSizeFromURL(ne.front);if(oe){var le=ne.sizeList.slice();if(le[0]){var me=getTileLevel(le[0]);if(me)for(var ge=me-1;ge>=0;ge--)le.unshift(512*Math.pow(2,ge))}if(!(le.length<=0)){for(var Ae=[],xe=0,he=le;xe<he.length;xe++){var _e=he[xe],He=getTileLevel(_e);if(typeof He=="number"){var Ee={};if(defineProperty(Ee,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(Ee,"level",{enumerable:!0,configurable:!1,writable:!1,value:He}),_e>oe){defineProperty(Ee,"size",{enumerable:!0,configurable:!1,writable:!1,value:_e}),defineProperty(Ee,"scale",{enumerable:!0,configurable:!1,writable:!1,value:1});for(var de=0,Ve=FACE_ORDER$1;de<Ve.length;de++){var ye=Ve[de];defineProperty(Ee,ye,{enumerable:!0,configurable:!1,writable:!1,value:replaceImageSize(ne[ye],_e)})}}else{defineProperty(Ee,"size",{enumerable:!0,configurable:!1,writable:!1,value:oe}),defineProperty(Ee,"scale",{enumerable:!0,configurable:!1,writable:!1,value:_e/oe});for(var Pe=0,Ce=FACE_ORDER$1;Pe<Ce.length;Pe++){var ye=Ce[Pe];defineProperty(Ee,ye,{enumerable:!0,configurable:!1,writable:!1,value:ne[ye]})}}Ae.push(Ee)}}return Ae=sortTile(Ae),Object.freeze(Ae)}}})()}),defineProperty(ne,"video",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var oe=G(te,"video"),le=void 0;return oe&&(le={},defineProperty(le,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(le,"source",{enumerable:!0,configurable:!1,writable:!1,value:oe.source}),defineProperty(le,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().fromArray(oe.matrix)}),defineProperty(le,"size",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector2().fromArray(oe.size)})),le})()}),ne})()}),L.push(Z)},re=0;re<q;re++)ae(re)}defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(L)});var $={};if(defineProperty($,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),M.initial){if(t.observers.length>0){var ee=void 0;isNumber(M.initial.panoIndex)?ee=M.initial.panoIndex:isNumber(M.initial.pano_index)?ee=M.initial.pano_index:isNumber(M.initial.pano)&&(ee=M.initial.pano),typeof ee=="number"&&(ee=clamp$1(ee,0,t.observers.length-1),defineProperty($,"panoIndex",{enumerable:!0,writable:!0,value:ee}))}if(M.initial.mode==="Panorama"&&t.observers.length===0||M.initial.mode==="Floorplan"||M.initial.mode==="Topview"||M.initial.mode==="Model"||M.initial.mode==="Mapview"?defineProperty($,"mode",{enumerable:!0,writable:!0,value:M.initial.mode}):typeof $.panoIndex=="number"?defineProperty($,"mode",{enumerable:!0,writable:!0,value:"Panorama"}):defineProperty($,"mode",{enumerable:!0,writable:!0,value:"Mapview"}),isNumber(M.initial.latitude)&&defineProperty($,"latitude",{enumerable:!0,writable:!0,value:M.initial.latitude}),isNumber(M.initial.longitude)?defineProperty($,"longitude",{enumerable:!0,writable:!0,value:M.initial.longitude}):isNumber(M.initial.heading)&&defineProperty($,"longitude",{enumerable:!0,writable:!0,value:headingToLongitude(M.initial.heading)}),isNumber(M.initial.fov)&&defineProperty($,"fov",{enumerable:!0,writable:!0,value:M.initial.fov}),isNumber(M.initial.distance)&&defineProperty($,"distance",{enumerable:!0,writable:!0,value:M.initial.distance}),Array.isArray(M.initial.offset)){var K=M.initial.offset,se=[0,0,0].map(function(W,X){var te=Number(K[X]);return isNaN(te)||!isFinite(te)?0:te});defineProperty($,"offset",{enumerable:!0,writable:!0,value:new THREE__namespace.Vector3().fromArray(se)})}else typeof M.initial.offset=="object"&&typeof M.initial.offset.x=="number"&&typeof M.initial.offset.y=="number"&&typeof M.initial.offset.z=="number"&&defineProperty($,"offset",{enumerable:!0,writable:!0,value:new THREE__namespace.Vector3().fromArray([M.initial.offset.x,M.initial.offset.y,M.initial.offset.z])})}return defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:$}),t}function parseNull(n,t){return defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:"Null"}),defineProperty(t,"workCode",{enumerable:!0,value:"null-"+createUuid()}),defineProperty(t,"baseURL",{enumerable:!0,value:"/"}),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var e={};return defineProperty(e,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(e,"mode",{enumerable:!0,writable:!0,value:"Mapview"}),e})()}),t}function parsePano(n,t){var e,r;return defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:String((e=n.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{enumerable:!0,writable:!0,value:(r=n.code)!==null&&r!==void 0?r:createUuid()}),defineProperty(t,"baseURL",{enumerable:!0,writable:!0,value:"/"}),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"index",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"panoIndex",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"panoId",{enumerable:!0,configurable:!1,writable:!1,value:panoStringify({workCode:t.workCode,panoIndex:0})}),defineProperty(o,"floorIndex",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"derivedId",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(o,"derivedIdStr",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(o,"active",{enumerable:!0,configurable:!1,writable:!1,value:!0}),defineProperty(o,"loadable",{enumerable:!0,configurable:!1,writable:!1,value:!1}),defineProperty(o,"position",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,1.5,0)}),defineProperty(o,"standingPosition",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,0,0)}),defineProperty(o,"quaternion",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Quaternion(0,1,0,0)}),defineProperty(o,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().compose(o.position,o.quaternion,PANO_TEXTURE_SCALE)}),defineProperty(o,"accessibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(o,"visibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:o.accessibleNodes}),defineProperty(o,"images",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var s={};defineProperty(s,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var u=0,l=FACE_ORDER$1;u<l.length;u++){var c=l[u];defineProperty(s,c,{enumerable:!0,configurable:!1,writable:!1,value:n[c]})}return defineProperty(s,"sizeList",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([n.size])}),defineProperty(s,"tiles",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var f=getImageSizeFromURL(s.front);if(f){var p=s.sizeList.slice();if(p[0]){var d=getTileLevel(p[0]);if(d)for(var h=d-1;h>=0;h--)p.unshift(512*Math.pow(2,h))}if(!(p.length<=0)){for(var g=[],m=0,E=p;m<E.length;m++){var y=E[m],v=getTileLevel(y);if(typeof v=="number"){var A={};if(defineProperty(A,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(A,"level",{enumerable:!0,configurable:!1,writable:!1,value:v}),y>f){defineProperty(A,"size",{enumerable:!0,configurable:!1,writable:!1,value:y}),defineProperty(A,"scale",{enumerable:!0,configurable:!1,writable:!1,value:1});for(var b=0,T=FACE_ORDER$1;b<T.length;b++){var _=T[b];defineProperty(A,_,{enumerable:!0,configurable:!1,writable:!1,value:replaceImageSize(s[_],y)})}}else{defineProperty(A,"size",{enumerable:!0,configurable:!1,writable:!1,value:f}),defineProperty(A,"scale",{enumerable:!0,configurable:!1,writable:!1,value:y/f});for(var S=0,w=FACE_ORDER$1;S<w.length;S++){var _=w[S];defineProperty(A,_,{enumerable:!0,configurable:!1,writable:!1,value:s[_]})}}g.push(A)}}return g=sortTile(g),Object.freeze(g)}}})()}),defineProperty(s,"video",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),s})()}),Object.freeze([o])})()}),defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"mode",{enumerable:!0,writable:!0,value:"Panorama"}),defineProperty(o,"panoIndex",{enumerable:!0,writable:!0,value:0}),o})()}),t}var workVerifySet=new WeakSet,Work=(function(){function n(t,e){this.observerBox=new THREE__namespace.Box3,this.observerBox=new THREE__namespace.Box3,this.transform=new THREE__namespace.Matrix4,this.shortPath=!1,this.jsonp=!1;var r;if(t!==null?typeof t=="object"&&typeof t.size=="number"&&typeof t.up=="string"&&typeof t.down=="string"&&typeof t.right=="string"&&typeof t.left=="string"&&typeof t.front=="string"&&typeof t.back=="string"?r=parsePano(t,this):r=parse(t,this):r=parseNull(t,this),r instanceof Error)throw new Error("[PARSE FAILED]: "+r.message+`
1026
+ `,uniforms:{diffuse:{value:new THREE__namespace.Color},opacity:{value:1},displacementScalar:{value:0}}};function createPipeBufferGeometry(n,t,e,r){for(var o=new Float32Array((e+1)*(r+1)*3),s=new Float32Array((e+1)*(r+1)*3),u=new Float32Array((e+1)*(r+1)*2),l=new Uint32Array(e*r*6),c=n.computeFrenetFrames(e),f=new THREE__namespace.Vector3,p=new THREE__namespace.Vector3,d=new THREE__namespace.Vector2,h=new THREE__namespace.Vector3,g=0;g<=e;g++){h=n.getPointAt(g/e,h);for(var m=c.normals[g],E=c.binormals[g],y=0;y<=r;y++){var v=g*(r+1)+y,A=y/r*Math.PI*2,b=Math.sin(A),T=-Math.cos(A);p.x=T*m.x+b*E.x,p.y=T*m.y+b*E.y,p.z=T*m.z+b*E.z,p.normalize(),p.toArray(s,v*3),f.x=h.x+t*p.x,f.y=h.y+t*p.y,f.z=h.z+t*p.z,f.toArray(o,v*3),d.x=g/e,d.y=y/r,d.toArray(u,v*2)}}for(var g=0;g<e;g++)for(var y=0;y<r;y++){var _=(g*r+y)*6,S=(r+1)*g+y,w=(r+1)*(g+1)+y,R=(r+1)*(g+1)+(y+1),I=(r+1)*g+(y+1);l[_]=S,l[_+1]=w,l[_+2]=I,l[_+3]=w,l[_+4]=R,l[_+5]=I}var H=new THREE__namespace.BufferGeometry;return H.setIndex(new THREE__namespace.BufferAttribute(l,1)),H.setAttribute("position",new THREE__namespace.BufferAttribute(o,3)),H.setAttribute("normal",new THREE__namespace.BufferAttribute(s,3)),H.setAttribute("uv",new THREE__namespace.BufferAttribute(u,2)),H}function parseTrajectoryObject(n,t){for(var e=new THREE__namespace.Color(0).convertSRGBToLinear(),r=new THREE__namespace.Color(52949).convertSRGBToLinear(),o=new THREE__namespace.Color(3370495).convertSRGBToLinear(),s=new THREE__namespace.Color(16777215).convertSRGBToLinear(),u=0,l=new THREE__namespace.CurvePath,c=n.length,f=3;f<c;f+=3){var p=new THREE__namespace.Vector3().fromArray(n,f-3),d=new THREE__namespace.Vector3().fromArray(n,f);u+=p.distanceTo(d);var h=new THREE__namespace.LineCurve3(p,d);l.add(h)}var g=.03,m=Math.ceil(u*100),E=6,y=createPipeBufferGeometry(l,g,m,E);y.clearGroups(),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,1),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,2);var v=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});v.uniforms.totalLength.value=u,v.uniforms.diffuse.value=e,v.uniforms.diffuse2.value=e,v.uniforms.opacity.value=.5,v.transparent=!0;var A=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});A.uniforms.totalLength.value=u,A.uniforms.displacementScalar.value=-.01,A.uniforms.diffuse.value=r,A.uniforms.diffuse2.value=o;var b=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.DoubleSide});b.uniforms.totalLength.value=u,b.uniforms.displacementScalar.value=-.026,b.uniforms.dashSize.value=new THREE__namespace.Vector2(.06,.09),b.uniforms.diffuse.value=s,b.uniforms.diffuse2.value=s;var T=new THREE__namespace.Mesh(y,[v,A,b]),_=.08,S=24,w=new THREE__namespace.SphereBufferGeometry(_,S,S);w.clearGroups(),w.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),w.addGroup(0,y.index?y.index.count:y.attributes.position.count,1);var R=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.BackSide});R.uniforms.diffuse.value=e,R.uniforms.opacity.value=.5,R.transparent=!0;var I=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});I.uniforms.displacementScalar.value=-.01,I.uniforms.diffuse.value=r;var H=new THREE__namespace.Mesh(w,[R,I]);H.position.fromArray(n,0),T.add(H);var C=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});C.uniforms.displacementScalar.value=-.01,C.uniforms.diffuse.value=o;var M=new THREE__namespace.Mesh(w,[R,C]);return M.position.fromArray(n,n.length-3),T.add(M),{scene:T,dispose:function(){y.dispose(),v.dispose(),A.dispose(),b.dispose(),w.dispose(),R.dispose(),I.dispose(),C.dispose()}}}function loadTrajectory(n,t){var e=n.name,r=appendSearch(n.content.uri,t.search),o=imageURL(r,{key:"model.0"});return n.content.loadState="LOADING",n.content.loadStateUpdateTime=now(),loadPly(o,{type:"geometry",customPropertyMapping:{time:{itemType:"uint32",itemNames:["time_milisec"]}},fetcher:t.fetcher}).then(function(s){var u,l,c,f,p=(l=(u=s.scene.attributes)===null||u===void 0?void 0:u.time.array)!==null&&l!==void 0?l:[],d=(f=(c=s.scene.attributes)===null||c===void 0?void 0:c.position.array)!==null&&f!==void 0?f:[],h=s.byteLength,g=s.memoryUsage,m=parseTrajectoryObject(d);m.scene.applyMatrix4(n.transform),m.scene.updateWorldMatrix(!1,!0),m.scene.matrixAutoUpdate=!1;var E=new TrajectoryNode(e,m.scene);return n.content.data={uri:o,byteLength:h,memoryUsage:g,positionArray:d,timeArray:p,object:E},n.content.byteLength=h,n.content.memoryUsage=g,n.content.loadState="READY",n.content.loadStateUpdateTime=now(),n}).catch(function(s){return n.content.data=void 0,n.content.loadState="FAILED",n.content.loadStateUpdateTime=now(),s instanceof NetworkResponseError&&s.httpStatus===0||s instanceof NetworkTimeoutError||s instanceof NetworkProxyError?n.content.loadfailRetryDelay=clamp$1(n.content.loadfailRetryDelay+RETRY_DELAY_STEP,RETRY_DELAY_STEP,MAX_RETRY_DELAY):n.content.loadfailRetryDelay=1/0,Promise.reject(s)})}function unloadTrajectory(n){n.content&&(n.content.data&&n.content.data.object.dispose(),n.content.data=void 0,n.content.loadState="UNLOADED",n.content.loadStateUpdateTime=now(),n.content.byteLength=0,n.content.memoryUsage=0)}var scratchVector3$7=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$3=new THREE__namespace.Matrix4,a=6378137,invF=298.257223563;function ecefToLla(n){for(var t=a-a/invF,e=(a*a-t*t)/(a*a),r=Math.sqrt(n.x*n.x+n.y*n.y),o=1e-12,s=1e3,u=0,l=Math.atan2(n.z,r),c=0;u++<s;){var f=Math.sin(l),p=a/Math.sqrt(1-e*f*f);c=r/Math.cos(l)-p;var d=Math.atan2(n.z/(p*(1-e)+c),r/(p+c));if(isNaN(d))break;var h=Math.abs(d-l);if(h<o)break;l=d}return n.set(l,Math.atan2(n.y,n.x),c)}function llaToEcef(n){var t=n.x,e=n.y,r=n.z,o=a-a/invF,s=(a*a-o*o)/(a*a),u=Math.sin(t),l=Math.cos(t),c=Math.sin(e),f=Math.cos(e),p=a/Math.sqrt(1-s*u*u),d=(p+r)*l*f,h=(p+r)*l*c,g=(o*o/(a*a)*p+r)*u;return n.set(d,h,g)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$7.copy(n)),r=e.x,o=e.y,s=e.z,u=Math.sin(r),l=Math.sin(o),c=Math.cos(r),f=Math.cos(o);t.fromArray([-l,-u*f,c*f,0,+f,-u*l,c*l,0,0,c,u,0,0,0,0,1]);var p=scratchMatrix3.setFromMatrix4(t),d=scratchVector3$7.copy(n).applyMatrix3(p).multiplyScalar(-1);t.setPosition(d);var h=scratchMatrix4$3.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,s,1]);return t.premultiply(h),t}var ROTATE_X_90_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),ROTATE_X_90_MATRIX_INVERSE=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),enuToLocalMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),localToEnuMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE);function getRecommendTile3dProps(n,t){var e,r,o;t===void 0&&(t={});var s,u,l,c=typeof n.tileset.rootMeta.creationTime=="string";if(c){var f=typeof n.tileset.rootMeta.numTotalPoints=="number"&&n.tileset.rootMeta.numTotalPoints>0;if(f){l=4,t.powerPreference==="high"&&(l=2),s=l/1.6;var p=0;if(((e=n.tileset.rootMeta.taskParameters)===null||e===void 0?void 0:e.point_homogenization)==="1"&&(!((r=n.tileset.rootMeta.taskParameters)===null||r===void 0)&&r.homo_point_density)){var d=Number((o=n.tileset.rootMeta.taskParameters)===null||o===void 0?void 0:o.homo_point_density);isFinite(d)&&!isNaN(d)&&(p=d)}p<=0&&(p=.02),u=p*1.4}else l=5,t.powerPreference==="high"&&(l=4),s=0,u=.03}else l=6,s=0,u=.03,n.name==="aerophoto"?(l=12,t.powerPreference==="high"&&(l=10)):n.tileset.asset.extras&&typeof n.tileset.asset.extras.name=="string"&&/^matterport\b/i.test(n.tileset.asset.extras.name)&&(l=5,t.powerPreference==="high"&&(l=4));return{pointScale:u,pointMinPixel:s,maxScreenSpaceError:l}}var scratchVector3$6=new THREE__namespace.Vector3,scratchSphereBoundingVolume=new SphereBoundingVolume,scratchBoxBoundingVolume=new BoxBoundingVolume,parameterVersionMap=new WeakMap,tileVersionMap=new WeakMap,trajectoryVersionMap=new WeakMap,STENCIL_CONSTANT={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4},SKIP_BACKFACE_MATERIAL=(function(){var n=new THREE__namespace.MeshBasicMaterial;return n.side=THREE__namespace.BackSide,n.color.setHex(16711935),n.colorWrite=!1,n.stencilWrite=!0,n.polygonOffset=!0,n.polygonOffsetFactor=2,n.polygonOffsetUnits=2,n.stencilRef=STENCIL_CONSTANT.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=STENCIL_CONSTANT.TILE_MASK,n})(),SKIP_BACKFACE_TRANSPARENT_MATERIAL=(function(){var n=new THREE__namespace.MeshBasicMaterial;return n.visible=!1,n})(),CLEAR_STENCIL_GEOMETRY=new THREE__namespace.BufferGeometry,CLEAR_STENCIL_MATERIAL=new THREE__namespace.MeshBasicMaterial;function cloneSkipBackfaceObject(n){var t;n instanceof THREE__namespace.Mesh?t=new THREE__namespace.Mesh(n.geometry,Array.isArray(n.material)?n.material.map(function(s){return s.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):n.material&&n.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):n instanceof THREE__namespace.Group?t=new THREE__namespace.Group:t=new THREE__namespace.Object3D,t.position.copy(n.position),t.quaternion.copy(n.quaternion),t.scale.copy(n.scale),t.matrix.compose(n.position,n.quaternion,n.scale),t.matrixAutoUpdate=!1,t.frustumCulled=n.frustumCulled,t.visible=n.visible;for(var e=0,r=n.children;e<r.length;e++){var o=r[e];t.add(cloneSkipBackfaceObject(o))}return t}var Tile3D=(function(n){__extends(t,n);function t(e,r){var o,s,u=n.call(this)||this;return u.parameter=new Parameter,u.renderObjects=[],u.backfaceObjects=[],u.tileObjects=[],u.frameNumber=0,u.error=(o=r.error)!==null&&o!==void 0?o:null,u.name=r.name,u.type=r.type,u.upAxis=r.upAxis,u.light=r.light,u.fetcher=r.fetcher,u.search=(s=r.search)!==null&&s!==void 0?s:"",u.groundHeight=r.groundHeight,u.coordinateSystem=r.coordinateSystem,u.boundingBox=new THREE__namespace.Box3,u.autoRefine=!0,u.refined=!1,u.refineProgress=[0,0],u.loaded=!1,u.disposed=!1,u.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),u.clearStencilObject.frustumCulled=!1,u.clearStencilObject.onAfterRender=function(l){return l.clearStencil()},u.tileset=new Tileset(e,{tileLoader:function(l){return u.loadContent(l)},tileUnloader:function(l){return u.unloadContent(l)},onTileLoad:function(){},onTileUnload:function(l){},onTileError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Tile error",l.id,c)},trajectoryLoader:function(l){return u.loadTrajectory(l)},trajectoryUnloader:function(l){return u.unloadTrajectory(l)},onTrajectoryLoad:function(){},onTrajectoryUnload:function(l){},onTrajectoryError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Trajectory error",l,c)}}),u.tileset.root.boundingVolume&&u.tileset.root.boundingVolume.getBoundingBox(u.boundingBox),u}return Object.defineProperty(t.prototype,"viewerRequestVolume",{get:function(){return this.tileset.root.viewerRequestVolume},set:function(e){this.tileset.root.viewerRequestVolume=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tiles",{get:function(){return this.tileset.selectedTiles},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trajectories",{get:function(){return this.tileset.trajectories},enumerable:!1,configurable:!0}),t.prototype.getRecommendProps=function(e){return e===void 0&&(e={}),getRecommendTile3dProps(this,e)},t.prototype.loadContent=function(e){var r=this;return loadTileContent(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){e.type==="SCENEGRAPH"&&(r.disposed||!e.content?unloadTileContent(e):e.content.data&&r.boundingBox.expandByObject(e.content.data.object))})},t.prototype.unloadContent=function(e){return unloadTileContent(e),Promise.resolve()},t.prototype.loadAllTilesets=function(){var e=this,r=function(o){var s=[];return e.tileset.root.traverse(function(u){var l;u.type==="TILESET"&&((l=u.content)===null||l===void 0?void 0:l.loadState)!=="READY"&&s.push(u)}),Promise.all(s.map(function(u){return e.loadContent(u).then(function(){return r()})})).then(function(){})};return r(this.tileset.root)},t.prototype.loadTrajectory=function(e){var r=this;return loadTrajectory(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){r.disposed&&unloadTrajectory(o)})},t.prototype.unloadTrajectory=function(e){return unloadTrajectory(e),Promise.resolve()},t.prototype.intersectRaycaster=function(e,r){var o=this,s,u,l=r!=null?r:[],c=[this.tileset.root],f=this.tileset.transform,p=(u=(s=e.params.Points)===null||s===void 0?void 0:s.threshold)!==null&&u!==void 0?u:0,d=e.hitFilter;e.hitFilter=function(T){var _;return Object.assign(T,{model:(_=o.parent)!==null&&_!==void 0?_:void 0,viewLayer:o}),d?d.call(e,T):!0};var h=e.sortByDistance;e.sortByDistance=!1;for(var g,m=1/0;g=c.pop();){var E=void 0;if(g.boundingVolume){var y=void 0;g.boundingVolume instanceof BoxBoundingVolume?y=scratchBoxBoundingVolume.copy(g.boundingVolume):g.boundingVolume instanceof SphereBoundingVolume?y=scratchSphereBoundingVolume.copy(g.boundingVolume):y=g.boundingVolume.clone(),y.applyMatrix4(f),E=y.intersectRay(e.ray,p,m)}else E=!0;if(E){for(var v=0,A=g.children.length;v<A;v++)c.push(g.children[v]);if(g.selected&&g.content&&g.content.data&&g.content.data.object.visible&&(g.content.data.object.intersectRaycaster(e,l),e.firstHitOnly)){var b=l[0];b&&m>b.distance&&(m=b.distance)}}}return e.hitFilter=d,e.sortByDistance=h,sortIntersects(l,e.sortByDistance,e.firstHitOnly),l},t.prototype.update=function(e,r,o,s){var u=this,l,c,f,p,d,h,g;this.renderer=e,this.frameNumber++;var m=!1,E=this.parameter.resolveValue(o.parameter,s.parameter);parameterVersionMap.get(this)!==E.version&&(parameterVersionMap.set(this,E.version),m=!0);var y=(p=this.visible&&((l=this.parent)===null||l===void 0?void 0:l.visible)&&((f=(c=this.parent)===null||c===void 0?void 0:c.parent)===null||f===void 0?void 0:f.visible))!==null&&p!==void 0?p:!1,v=E.maxLevelOfDetail;v=Math.max(v,0);var A=Math.min(E.minLevelOfDetail,v);(!y||!this.loaded||!o.loaded)&&(v=Math.max(A,0));var b=E.minGeometricError,T=E.maxRequests,_=E.memoryAdjustedScreenSpaceError,S=r.controllerMode;(S==="Panorama"||S==="VRPanorama"||S==="XRPanorama")&&(E.modelAlpha<.1&&(b=E.panoramaMinGeometricError,_=!1),E.progress>=.01&&E.progress<=.99&&(T=0));var w=E.maxGeometricError;w=Math.max(b,w);var R={time:r.time,camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(r.up).applyQuaternion(r.quaternion),projectionMatrix:r.projectionMatrix.clone(),visible:r.visible,refine:r.refineModel},height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r),minLevelOfDetail:A,maxLevelOfDetail:v,minGeometricError:b,maxGeometricError:w,skipLevelOfDetail:E.skipLevelOfDetail,mostDetail:E.mostDetail,loadSiblings:E.loadSiblings,cameraCulling:E.cameraCulling,maxMemoryUsage:E.maxMemoryUsage,maxRequests:T,requestOrder:E.requestOrder,maxScreenSpaceError:E.maxScreenSpaceError,memoryAdjustedScreenSpaceError:_},I=E.cacheCameras.map(function(de){return de.updateProjectionMatrix(),__assign(__assign({},R),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(de.position),direction:de.getWorldDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(de.up),projectionMatrix:de.projectionMatrix.clone(),visible:de.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(de)})});this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),m=!0);var H=!this.autoRefine;if(H===!1){var C=E.progress>=.01&&E.progress<=.99;if(C){var M=new THREE__namespace.Vector3;E.pano0&&M.setFromMatrixPosition(E.pano0.matrix);var B=M.clone();E.pano1&&B.setFromMatrixPosition(E.pano1.matrix),M.distanceTo(B)<10&&(H=!0)}}if(H||this.tileset.update(R,I),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(de){if(u.refineProgress[1]++,de.content){var _e=de.content.loadState;if(_e==="UNLOADED"||_e==="LOADING"){u.refined=!1;return}}u.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;var L=!1;this.tileset.needsRefinedTiles.forEach(function(de){if(u.loaded!==!1&&de.content&&(de.state.visible&&(L=!0),E.minLevelOfDetail>=0)){if(R.skipLevelOfDetail){if(de.state.finalResolution){var _e=de.state.ancestorWithContentAvailable,He=_e&&_e.content?_e.content:de.content,Ee=He.loadState;(Ee==="UNLOADED"||Ee==="LOADING")&&(u.loaded=!1)}}else if(de.state.visible&&de.levelOfContent<=0){var Ee=de.content.loadState;(Ee==="UNLOADED"||Ee==="LOADING")&&(u.loaded=!1)}}}),L&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0;for(var O=this.children.length-1;O>=0;O--)this.remove(this.children[O]);R.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(de,_e){return de.floor!==_e.floor?de.floor-_e.floor:de.levelOfContent!==_e.levelOfContent?_e.levelOfContent-de.levelOfContent:de.state.distanceToCamera!==_e.state.distanceToCamera?de.state.distanceToCamera-_e.state.distanceToCamera:de.state.centerZDepth-_e.state.centerZDepth});for(var k=[],D=0,q=this.tileset.selectedTiles;D<q.length;D++){var z=q[D],J=(h=(d=z.content)===null||d===void 0?void 0:d.data)===null||h===void 0?void 0:h.object;if(J){var V=J.update(e,r,o,this,z,E);if(k.push(z.id),V&&(m=!0),this.tileset.hasMixedContent&&R.skipLevelOfDetail){if(!z.state.finalResolution){var U=cloneSkipBackfaceObject(J);U.name="skipBackface:"+J.name,this.backfaceObjects.push(U)}for(var j=z.state.selectionDepth,K=STENCIL_CONSTANT.TILE_MASK|j<<STENCIL_CONSTANT.SKIP_LOD_BIT_SHIFT,ae=THREE__namespace.GreaterEqualStencilFunc,re=STENCIL_CONSTANT.SKIP_LOD_MASK,ee=THREE__namespace.ReplaceStencilOp,Z=STENCIL_CONSTANT.TILE_MASK|STENCIL_CONSTANT.SKIP_LOD_MASK,X=0,se=J.materials;X<se.length;X++){var G=se[X];G.stencilWrite=!0,G.stencilRef=K,G.stencilFunc=ae,G.stencilFuncMask=re,G.stencilZPass=ee,G.stencilWriteMask=Z}}else for(var W=0,$=J.materials;W<$.length;W++){var G=$[W];G.stencilWrite=!1,G.stencilRef=STENCIL_CONSTANT.TILE_MASK,G.stencilFunc=THREE__namespace.AlwaysStencilFunc,G.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,G.stencilZPass=THREE__namespace.ReplaceStencilOp,G.stencilWriteMask=STENCIL_CONSTANT.TILE_MASK}this.tileObjects.push(J)}}var ne=k.toString();if(tileVersionMap.get(this)!==ne&&(tileVersionMap.set(this,ne),m=!0),R.skipLevelOfDetail&&this.backfaceObjects.length)for(var O=0;O<this.backfaceObjects.length;O++)this.renderObjects.push(this.backfaceObjects[O]);if(this.tileObjects.length)for(var O=0;O<this.tileObjects.length;O++)this.renderObjects.push(this.tileObjects[O]);R.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var te=[],ve=0,oe=this.tileset.selectedTrajectories;ve<oe.length;ve++){var fe=oe[ve],be=(g=fe.content.data)===null||g===void 0?void 0:g.object;if(be){var V=be.update(e,r,o,this,fe,E);te.push(fe.id),V&&(m=!0),this.renderObjects.push(be)}}var ie=te.toString();if(trajectoryVersionMap.get(this)!==ie&&(trajectoryVersionMap.set(this,ie),m=!0),this.parent)for(var ue=this.parent.children.length+1,me=Math.min(0,this.parent.children.indexOf(this)),ge=(me-ue)*1e4+1,Ae=function(de){var _e=xe.renderObjects[de],He=de+ge;_e.traverse(function(Ee){(Ee instanceof THREE__namespace.Mesh||Ee instanceof THREE__namespace.Line||Ee instanceof THREE__namespace.Points)&&(Ee.renderOrder=He)})},xe=this,O=0;O<this.renderObjects.length;O++)Ae(O);if(this.loaded)for(var O=0;O<this.renderObjects.length;O++)this.add(this.renderObjects[O]);return m},t.prototype.dispose=function(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id);for(var e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0,this.error=null,this.onError=void 0,this.renderer=void 0},Object.defineProperty(t.prototype,"model",{get:function(){return this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scene",{get:function(){return this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayer",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.enuToEcef=function(e){return e.applyMatrix4(this.coordinateSystem.enuToEcefMatrix)},t.prototype.ecefToEnu=function(e){return e.applyMatrix4(this.coordinateSystem.ecefToEnuMatrix)},t.prototype.localToEcef=function(e){return this.enuToEcef(this.localToEnu(e))},t.prototype.ecefToLocal=function(e){return this.enuToLocal(this.ecefToEnu(e))},t.prototype.localToLla=function(e){return ecefToLla(this.enuToEcef(this.localToEnu(e)))},t.prototype.llaToLocal=function(e){return this.enuToLocal(this.ecefToEnu(llaToEcef(e)))},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},t.prototype.worldToEcef=function(e){return this.localToEcef(this.worldToLocal(e))},t.prototype.ecefToWorld=function(e){return this.localToWorld(this.ecefToLocal(e))},t.prototype.worldToLla=function(e){return this.localToLla(this.worldToLocal(e))},t.prototype.llaToWorld=function(e){return this.localToWorld(this.llaToLocal(e))},Object.defineProperty(t.prototype,"coordinates",{get:function(){scratchVector3$6.setScalar(0);var e=this.localToLla(scratchVector3$6),r=e.x,o=e.y;return[r,o].map(function(s){return(s/Math.PI*180).toFixed(6)}).join(",")},enumerable:!1,configurable:!0}),t.prototype.getTransformMatrix4=function(e){return e===void 0&&(e=new THREE__namespace.Matrix4),e.copy(this.coordinateSystem.ecefToEnuMatrix),e.premultiply(enuToLocalMatrix),e.premultiply(this.matrixWorld),e},t.prototype.coordinatesToWorldPoint=function(e){var r=new THREE__namespace.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(r)},t.prototype.worldPointToCoordinates=function(e){return scratchVector3$6.copy(e),this.worldToLla(scratchVector3$6),{latitude:scratchVector3$6.x,longitude:scratchVector3$6.y,altitude:scratchVector3$6.z}},t.prototype.resetBrightness=function(){this.parameter.reset("brightness")},Object.defineProperty(t.prototype,"minLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minLevelOfDetail},set:function(e){this.parameter.set("minLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxLevelOfDetail},set:function(e){this.parameter.set("maxLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minGeometricError},set:function(e){this.parameter.set("minGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxGeometricError},set:function(e){this.parameter.set("maxGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoramaMinGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).panoramaMinGeometricError},set:function(e){this.parameter.set("panoramaMinGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).skipLevelOfDetail},set:function(e){this.parameter.set("skipLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mostDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).mostDetail},set:function(e){this.parameter.set("mostDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).loadSiblings},set:function(e){this.parameter.set("loadSiblings",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxMemoryUsage},set:function(e){this.parameter.set("maxMemoryUsage",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxRequests},set:function(e){this.parameter.set("maxRequests",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestOrder",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).requestOrder},set:function(e){this.parameter.set("requestOrder",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxScreenSpaceError},set:function(e){this.parameter.set("maxScreenSpaceError",e)},enumerable:!1,configurable:!0}),t})(THREE__namespace.Object3D),fetchers={};function getFetcher(n,t){var e=fetchers[n];if(e){var r=e.get(t);if(r)return r}throw new Error("fetcher workCode:".concat(t.workCode," never registered."))}function registerFetcher(n,t,e){var r=fetchers[n];r||(r=fetchers[n]=new WeakMap),r.has(t)||r.set(t,e)}var identityMatrix4=new THREE__namespace.Matrix4,scratchVector3$5=new THREE__namespace.Vector3,scratchMatrix4$2=new THREE__namespace.Matrix4;function getEcefToEnuMatrixFromUpAxis(n,t,e){switch(n){case"Z":e.identity();break;case"WGS84":case"GCJ02":case"BD09":getEcefToEnuMatrix(t,e);break;default:e.identity();break}return e}function loadViewLayer(n){var t,e=n.tilesetUrl.split("#"),r=e[0],o=e[1],s=(t=(o||r).split("?")[1])!==null&&t!==void 0?t:"";return n.fetcher.ajax(n.tilesetUrl,{responseType:"text"}).catch(function(u){return{error:u,body:JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{geometricError:0}})}}).then(function(u){var l,c="error"in u?u.error:null,f=normalizeTilesetHeader(JSON.parse(u.body),n.tilesetUrl),p=f.root,d=f.rootMeta,h=d===void 0?{}:d,g=n.upAxis;h.upAxis&&h.upAxis!==g&&(g=h.upAxis),"lodVersion"in f&&(g="-Y","floorInfo"in f&&(f.properties=f.properties||{},f.properties.floorInfo=f.floorInfo.map(function(_){return{ground:-_.ground,height:_.height}}),f.floorInfo=void 0),f.asset.tilesetVersion=String(f.lodVersion),f.lodVersion=void 0);var m=g,E=new THREE__namespace.Matrix4;m==="Y"?(m="Z",E.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1])):m==="-Y"&&(m="Z",E.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]));var y=p.boundingVolume?makeBoundingVolume(p.boundingVolume):void 0;y&&p.transform&&y.applyMatrix4(scratchMatrix4$2.fromArray(p.transform));var v=null,A=new THREE__namespace.Matrix4,b=new THREE__namespace.Matrix4;h.coordinate?(v=h.coordinate.ground_height,A.fromArray(h.coordinate.pose_ecef_to_enu),b.fromArray(h.coordinate.pose_enu_to_ecef)):(y?y.getCenter(scratchVector3$5):scratchVector3$5.setScalar(0),scratchVector3$5.applyMatrix4(E),getEcefToEnuMatrixFromUpAxis(m,scratchVector3$5,A),b.getInverse(A)),f.root={refine:(l=p.refine)!==null&&l!==void 0?l:"REPLACE",geometricError:p.geometricError,transform:scratchMatrix4$2.copy(E).premultiply(m==="Z"?identityMatrix4:A).premultiply(enuToLocalMatrix).toArray(),boundingVolume:y?y.toJson():void 0,children:[p]};var T=new Tile3D(f,{name:n.name,type:n.type,upAxis:g,light:n.light,fetcher:n.fetcher,search:s,groundHeight:v,coordinateSystem:{enuToEcefMatrix:b,ecefToEnuMatrix:A},error:c});return T})}function loadViewLayers(n,t){var e,r,o=n.layers.map(function(d){return{tilesetUrl:d.work.getURL(d.tileset),name:d.name,type:d.type,upAxis:d.upAxis,light:t.light,fetcher:t.fetcher}});if(n.file){for(var s=!1,u=0,l=o;u<l.length;u++){var c=l[u];if(c.type==="mesh"){s=!0;break}}if(s===!1){var f=getExtname(n.file)||".at3d",p=JSON.stringify({tilesetUrl:"",asset:{version:"0.0"},geometricError:0,root:{refine:"REPLACE",geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:n.work.getURL(n.file)},extras:(e={},e[f.slice(1)]={upAxis:n.upAxis,textureBaseUri:typeof n.textureBase=="string"?n.work.getURL(n.textureBase):void 0,textureArray:n.textures,textureOptions:(r=t.textureOptions)!==null&&r!==void 0?r:{}},e)},rootMeta:{coordinate:n.coordinate}});o.push({name:"fallback",type:"mesh",upAxis:"Z",tilesetUrl:URL.createObjectURL(new Blob([p],{type:"application/json"})),fetcher:t.fetcher,light:t.light})}}return o.map(function(d){return loadViewLayer(d).then(function(h){return t.onError&&(h.error&&t.onError(h.error),h.onError=t.onError),h})})}function createSimpleBoxBufferGeometry(n,t,e){n===void 0&&(n=1),t===void 0&&(t=1),e===void 0&&(e=1);var r=n/2,o=t/2,s=e/2,u=new Float32Array([-r,+o,+s,+r,+o,+s,+r,+o,-s,-r,+o,-s,-r,-o,+s,+r,-o,+s,+r,-o,-s,-r,-o,-s]),l=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),c=new THREE__namespace.BufferGeometry;return c.setAttribute("position",new THREE__namespace.BufferAttribute(u,3)),c.setIndex(new THREE__namespace.BufferAttribute(l,1)),c.addGroup(0,c.index.count,0),c.computeBoundingBox(),c.computeBoundingSphere(),c}function mergeBufferGeometries(n,t){for(var e=n[0].index!==null,r=new Set(Object.keys(n[0].attributes)),o=new Set(Object.keys(n[0].morphAttributes)),s={},u={},l=new THREE__namespace.BufferGeometry,c=0;c<n.length;++c){var f=n[c];if(e!==(f.index!==null))return null;for(var p in f.attributes){if(!r.has(p))return null;s[p]===void 0&&(s[p]=[]),s[p].push(f.attributes[p])}for(var p in f.morphAttributes){if(!o.has(p))return null;u[p]===void 0&&(u[p]=[]),u[p].push(f.morphAttributes[p])}l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(f.userData)}if(e){for(var d=0,h=[],c=0;c<n.length;++c){for(var g=n[c].index,m=0;m<g.count;++m)h.push(g.getX(m)+d);d+=n[c].attributes.position.count}l.setIndex(h)}for(var p in s){var E=mergeBufferAttributes(s[p]);if(!E)return null;l.setAttribute(p,E)}for(var p in u){var y=u[p][0].length;if(y===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[p]=[];for(var c=0;c<y;++c){for(var v=[],m=0;m<u[p].length;++m)v.push(u[p][m][c]);var A=mergeBufferAttributes(v);if(!A)return null;l.morphAttributes[p].push(A)}}return l}function mergeBufferAttributes(n){for(var t,e,r,o=0,s=0;s<n.length;++s){var u=n[s];if(u.isInterleavedBufferAttribute||(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)||(e===void 0&&(e=u.itemSize),e!==u.itemSize)||(r===void 0&&(r=u.normalized),r!==u.normalized))return null;o+=u.array.length}for(var l=new t(o),c=0,s=0;s<n.length;++s)l.set(n[s].array,c),c+=n[s].array.length;return new THREE__namespace.BufferAttribute(l,e,r)}function mergeVertices(n,t){t===void 0&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var e={},r=n.getIndex(),o=n.getAttribute("position"),s=r?r.count:o.count,u=0,l=Object.keys(n.attributes),c={},f={},p=[],d=["getX","getY","getZ","getW"],h=0,g=l.length;h<g;h++){var m=l[h];c[m]=[];var E=n.morphAttributes[m];E&&(f[m]=new Array(E.length).fill().map(function(){return[]}))}for(var y=Math.log10(1/t),v=Math.pow(10,y),h=0;h<s;h++){for(var A=r?r.getX(h):h,b="",T=0,g=l.length;T<g;T++)for(var m=l[T],_=n.getAttribute(m),S=_.itemSize,w=0;w<S;w++)b+="".concat(~~(_[d[w]](A)*v),",");if(b in e)p.push(e[b]);else{for(var T=0,g=l.length;T<g;T++)for(var m=l[T],_=n.getAttribute(m),E=n.morphAttributes[m],S=_.itemSize,R=c[m],I=f[m],w=0;w<S;w++){var H=d[w];if(R.push(_[H](A)),E)for(var C=0,M=E.length;C<M;C++)I[C].push(E[C][H](A))}e[b]=u,p.push(u),u++}}for(var B=n.clone(),h=0,g=l.length;h<g;h++){var m=l[h],L=n.getAttribute(m),O=new L.array.constructor(c[m]),_=new THREE__namespace.BufferAttribute(O,L.itemSize,L.normalized);if(B.setAttribute(m,_),m in f)for(var T=0;T<f[m].length;T++){var k=n.morphAttributes[m][T],O=new k.array.constructor(f[m][T]),D=new THREE__namespace.BufferAttribute(O,k.itemSize,k.normalized);B.morphAttributes[m][T]=D}}return B.setIndex(p),B}var scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4$1=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4;function getEdgesBySphere(n,t,e){e===void 0&&(e=30/180*Math.PI);for(var r=Math.cos(e),o=[],s=0,u=n.children;s<u.length;s++){var l=u[s];l instanceof Tile3D&&l.tileset.selectedTiles.forEach(function(c){var f,p,d,h=(p=(f=c.content)===null||f===void 0?void 0:f.data)===null||p===void 0?void 0:p.object;if(h&&h.visible){var g=[];if(h.traverseVisible(function(V){if(V instanceof THREE__namespace.Mesh){var U=getBvhTreeForMesh(V);if(U){scratchMatrix4$1.copy(V.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4$1),scratchSphere$1.copy(t).applyMatrix4(scratchMatrix4Inverse);var j=U.trianglesInSphere(scratchSphere$1.center,scratchSphere$1.radius),K=new THREE__namespace.BufferGeometry;K.setAttribute("position",new THREE__namespace.BufferAttribute(j,3)),K.applyMatrix4(V.matrixWorld),K=mergeVertices(K,.01),g.push(K)}}}),g.length===0)return;for(var m=["a","b","c"],E=mergeBufferGeometries(g),y=E.getAttribute("position").array,v=((d=E.getIndex())===null||d===void 0?void 0:d.array)||[],A=[],b=[],T=0,_=y.length;T<_;T+=3){var S=new THREE__namespace.Vector3(y[T],y[T+1],y[T+2]);A.push(S)}for(var T=0,_=v.length;T<_;T+=3){var w=v[T],R=v[T+1],I=v[T+2],H=new THREE__namespace.Vector3().crossVectors(A[R].clone().sub(A[w]),A[I].clone().sub(A[w])).normalize();b.push({a:w,b:R,c:I,normal:H})}for(var C={},T=0,_=b.length;T<_;T++)for(var M=b[T],B=0;B<3;B++){var L=M[m[B]],O=M[m[(B+1)%3]],k=[Math.min(L,O),Math.max(L,O)],D=k[0]+"-"+k[1];C[D]===void 0?C[D]={index1:k[0],index2:k[1],face1:T}:C[D].face2=T}for(var D in C){var q=C[D];if(q.face2===void 0||b[q.face1].normal.dot(b[q.face2].normal)<=r){var z=A[q.index1],J=A[q.index2];o.push(new THREE__namespace.Line3(z,J))}}A.length=0,b.length=0}})}return o}var scratchBoundingBox$1=new THREE__namespace.Box3,scratchViewLayerBox=new THREE__namespace.Box3,scratchObserverBox$3=new THREE__namespace.Box3,Model=(function(n){__extends(t,n);function t(e,r,o){o===void 0&&(o={});var s,u=n.call(this)||this;u.disposed=!1,u.parameter=new Parameter,u.outdated=!1,u.autoRefine=!0,u.metaPending=!1,u.loaded=!1,u.refined=!1,u.refineProgress=[0,0],u.boundingBox=new THREE__namespace.Box3,u.fiveId=e,u.needsRender=!1,u.work=r,u.name=r.workCode;for(var l=0,c=0,f=r.observers;c<f.length;c++){var p=f[c];l=Math.max(l,p.floorIndex)}if(u.floorLength=l+1,r.model){u.metaPending=!0;var d=loadViewLayers(r.model,{fetcher:getFetcher(u.fiveId,r),light:(s=o.light)!==null&&s!==void 0?s:!1,textureOptions:o.textureOptions,onError:function(h){return u.dispatchEvent({type:"error",error:h})}});u.initReady=Promise.all(d).then(function(h){if(u.metaPending=!1,h.length)if(u.disposed)for(var g=0,m=h;g<m.length;g++){var E=m[g];E.dispose()}else u.add.apply(u,h);return u}),u.loadedReady=new Promise(function(h){var g=function(){h(u),u.removeEventListener("load",g),u.removeEventListener("dispose",g)};u.addEventListener("load",g),u.addEventListener("dispose",g)})}else u.refined=!0,u.loaded=!0,u.initReady=Promise.resolve(u),u.loadedReady=Promise.resolve(u);return u.parameter.set("boundingBox",u.boundingBox.clone()),u}return t.prototype.dispose=function(){this.disposed=!0;for(var e;e=this.children[0];)typeof e.dispose=="function"&&e.dispose(),this.remove(e);this.dispatchEvent({type:"dispose"})},Object.defineProperty(t.prototype,"empty",{get:function(){return this.children.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayers",{get:function(){return this.children},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,r){return r===void 0&&(r=30/180*Math.PI),getEdgesBySphere(this,e,r)},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=e.sortByDistance;e.sortByDistance=!1;for(var u=0,l=this.children.length;u<l;u++){var c=this.children[u];c.visible&&typeof c.intersectRaycaster=="function"&&c.intersectRaycaster(e,o)}return e.sortByDistance=s,sortIntersects(o,e.sortByDistance,e.firstHitOnly),o},t.prototype.update=function(e,r,o){var s=!1;this.needsRender===!0&&(this.needsRender=!1,s=!0);var u=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,s=!0);for(var l=0,c=this.children;l<c.length;l++){var f=c[l];f.autoRefine=this.autoRefine;var p=f.update(e,r,o,this);p&&(s=!0),f.refined===!1&&(this.refined=!1),f.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=f.refineProgress[0],this.refineProgress[1]+=f.refineProgress[1]}scratchBoundingBox$1.makeEmpty(),scratchObserverBox$3.copy(this.work.observerBox),scratchObserverBox$3.isEmpty()||(scratchObserverBox$3.max.x+=1,scratchObserverBox$3.max.z+=1,scratchObserverBox$3.max.y+=1,scratchObserverBox$3.min.x-=1,scratchObserverBox$3.min.z-=1,scratchBoundingBox$1.union(scratchObserverBox$3));for(var d=0,h=this.viewLayers;d<h.length;d++){var f=h[d];f.boundingBox.isEmpty()||(scratchViewLayerBox.copy(f.boundingBox),scratchBoundingBox$1.union(scratchViewLayerBox))}return scratchBoundingBox$1.applyMatrix4(this.matrix),scratchBoundingBox$1.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox$1),this.parameter.set("boundingBox",scratchBoundingBox$1.clone())),u===!1&&this.loaded===!0&&this.dispatchEvent({type:"load"}),s},t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},Object.defineProperty(t.prototype,"shownFloor",{get:function(){return this.shownFloorIndex===-1?null:this.shownFloorIndex},set:function(e){this.shownFloorIndex=e===null?-1:e},enumerable:!1,configurable:!0}),t.prototype.show=function(e){this.shownFloor=e!=null?e:null,this.dispatchEvent({type:"changeShownFloor",shownFloor:e})},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r)},Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).shownFloorIndex},set:function(e){this.parameter.set("shownFloorIndex",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"brightness",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).brightness},set:function(e){this.parameter.set("brightness",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clippers",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).clippers},set:function(e){this.parameter.set("clippers",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customShaders",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).customShaders},set:function(e){this.parameter.set("customShaders",e)},enumerable:!1,configurable:!0}),t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.viewLayers;e<r.length;e++){var o=r[e];o.resetBrightness()}},t})(THREE__namespace.Object3D),scratchGeometry=createSimpleBoxBufferGeometry(1,1,1);scratchGeometry.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var versionMap=new WeakMap,cameraBoxSize=new THREE__namespace.Vector3(1,1,1),scratchBoundingBox=new THREE__namespace.Box3,scratchBoundingBoxSize=new THREE__namespace.Vector3,scratchCameraBox=new THREE__namespace.Box3,scratchPosition=new THREE__namespace.Vector3,scratchScale=new THREE__namespace.Vector3,BoundingMesh$1=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r=this,o,s=new PBMMeshMaterial("none");return s.flatShading=!0,s.depthWrite=!1,s.transparent=!1,s.blending=THREE__namespace.CustomBlending,s.blendSrc=THREE__namespace.SrcAlphaFactor,s.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,s.blendSrcAlpha=THREE__namespace.OneFactor,s.blendDstAlpha=THREE__namespace.OneMinusSrcAlphaFactor,s.floorIndex=-1,r=n.call(this,scratchGeometry,[s])||this,r.name=(o=e.name)!==null&&o!==void 0?o:"",r.frustumCulled=!1,r.renderOrder=-999999,r}return t.prototype.update=function(e,r,o){var s=!1,u=Parameter.resolveValue(o.parameter);scratchBoundingBox.copy(u.boundingBox),scratchBoundingBox.getSize(scratchBoundingBoxSize);var l=Math.min(scratchBoundingBoxSize.x/2,500);scratchBoundingBox.min.x-=l,scratchBoundingBox.max.x+=l;var c=Math.min(scratchBoundingBoxSize.y/2,500);scratchBoundingBox.min.z-=c,scratchBoundingBox.max.z+=c;var f=scratchBoundingBoxSize.length()/2;if(scratchBoundingBox.max.y=Math.max(scratchBoundingBox.max.y,f),scratchBoundingBox.union(scratchCameraBox.setFromCenterAndSize(r.position,cameraBoxSize)),scratchBoundingBox.expandByScalar(1),scratchBoundingBox.getCenter(scratchPosition),scratchBoundingBox.getSize(scratchScale),scratchPosition.equals(this.position)||(this.position.copy(scratchPosition),s=!0),scratchScale.equals(this.scale)||(this.scale.copy(scratchScale),s=!0),versionMap.get(this)!==u.version){versionMap.set(this,u.version),s=!0;for(var p=this.material,d=0,h=p;d<h.length;d++){var g=h[d];g.customShaders=u.customShaders,g.pano0=u.pano0,g.pano1=u.pano1,g.refinedScreen=u.refinedScreen,g.modelAlpha=u.modelAlpha,g.progress=u.progress,g.transition=u.transition,g.opacity=u.opacity,g.floorStyle=u.floorStyle,g.constantColor=u.constantColor,g.shownFloorIndex=u.shownFloorIndex,g.clippers=u.clippers,g.brightness=u.brightness,g.useHQWeight=u.useHQWeight,g.useHQDepth=u.useHQDepth,g.colorSaturation=u.colorSaturation,g.colorBrightness=u.colorBrightness,g.gradientTexture=u.gradientTexture,g.transparent=!1,g.modelBoundingMax.copy(u.boundingBox.max),g.modelBoundingMin.copy(u.boundingBox.min),u.useAddBlend&&(g.opacity=0),g.opacity===0&&(g.visible=!1)}}return s},t.prototype.dispose=function(){for(var e=0,r=this.material;e<r.length;e++){var o=r[e];o.dispose(),o.pano0=null,o.pano1=null}},t})(PBMMesh),scratchBoundingBox3=new THREE__namespace.Box3,ModelScene=(function(n){__extends(t,n);function t(e){var r=n.call(this)||this;r.needsRender=!0,r.autoRefine=!0,r.boundingBox=new THREE__namespace.Box3,r.loaded=!1,r.refined=!1,r.refineProgress=[0,0],r.parameter=new Parameter,r.fiveId=e.fiveId,r.boundingMesh=new BoundingMesh$1({name:"bounding"}),r.add(r.boundingMesh);var o=r.models=[];r.shownModels=[],r.updateModelMap=new Map,r.parameter.set("boundingBox",r.boundingBox.clone());var s=r;return defineProperty(o,"autoUpdate",{get:function(){return s.autoRefine},set:function(u){s.autoRefine=u}}),defineProperty(o,"bounding",{get:function(){return s.boundingBox}}),defineProperty(o,"loaded",{get:function(){return s.loaded}}),defineProperty(o,"refined",{get:function(){return s.refined}}),defineProperty(o,"refineProgress",{get:function(){return s.refineProgress}}),defineProperty(o,"cacheCameras",{get:function(){return s.parameter.resolveValue().cacheCameras},set:function(u){s.parameter.set("cacheCameras",u)}}),defineProperty(o,"intersectRaycaster",{value:function(u){return s.intersectRaycaster(u)}}),defineProperty(o,"setMaterial",{value:function(u){return s.setMaterial(u)}}),defineProperty(o,"getMaterial",{value:function(){return s.getMaterial()}}),defineProperty(o,"resetBrightness",{value:function(){return s.resetBrightness()}}),r}return t.prototype.setModels=function(e,r){for(var o=this,s=e.map(function(c){var f=o.shownModels.filter(function(d){return d.work.workCode===c.workCode})[0];if(f||(f=o.models.filter(function(d){return d.work.workCode===c.workCode})[0],f))return f.work=c,f;f=new Model(o.fiveId,c,{light:r.light,textureOptions:r.textureOptions});var p=r["3d-tiles"];return f.initReady.then(function(){if(p)if(typeof p=="function")for(var d=0,h=f.viewLayers;d<h.length;d++){var g=h[d],m=p(g,f);m&&(m.viewerRequestVolume&&(g.viewerRequestVolume=makeBoundingVolume(m.viewerRequestVolume)),g.parameter.set(omit(m,["showLayers"])),m.showLayers===!1?g.visible=!1:Array.isArray(m.showLayers)&&(g.visible=m.showLayers.includes(g.name)))}else for(var E=0,y=f.viewLayers;E<y.length;E++){var g=y[E];p.viewerRequestVolume&&(g.viewerRequestVolume=makeBoundingVolume(p.viewerRequestVolume)),g.parameter.set(omit(p,["showLayers"])),p.showLayers===!1?g.visible=!1:Array.isArray(p.showLayers)&&(g.visible=p.showLayers.includes(g.name))}}),o.dispatchEvent({type:"model.create",model:f}),f}),u=0;u<this.models.length;u++){var l=this.models[u];s.indexOf(l)===-1&&this.shownModels.indexOf(l)===-1&&(l.dispose(),this.dispatchEvent({type:"model.dispose",model:l}))}this.models.length=0;for(var u=0;u<s.length;u++){var l=s[u];this.models.push(l)}if(r.forceReplaceImmediately&&!arrayEqual(this.models,this.shownModels)){for(var u=0;u<this.shownModels.length;u++){var l=this.shownModels[u];this.models.indexOf(l)===-1&&(l.dispose(),this.dispatchEvent({type:"model.dispose",model:l}))}this.shownModels.length=0;for(var u=0;u<this.models.length;u++)this.shownModels.push(this.models[u])}return this.loaded=!1,this.refined=!1,this.models},Object.defineProperty(t.prototype,"empty",{get:function(){return this.boundingBox.isEmpty()},enumerable:!1,configurable:!0}),t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=this.shownModels.filter(function(p){return p.visible});if(s.length===1)s[0].intersectRaycaster(e,o);else{var u=e.sortByDistance;e.sortByDistance=!1;for(var l=0,c=s;l<c.length;l++){var f=c[l];f.intersectRaycaster(e,o)}e.sortByDistance=u,sortIntersects(o,e.sortByDistance,e.firstHitOnly)}return o},t.prototype.update=function(e,r){var o=!1;scratchBoundingBox3.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.updateModelMap.clear();for(var s=0;s<this.models.length;s++){var u=this.models[s];if(!this.updateModelMap.has(u)){var l=u.autoRefine;this.autoRefine===!1&&(u.autoRefine=!1);var c=u.update(e,r,this);u.autoRefine=l,this.updateModelMap.set(u,c)}u.loaded===!1&&(this.loaded=!1),u.refined===!1&&(this.refined=!1),this.refineProgress[0]+=u.refineProgress[0],this.refineProgress[1]+=u.refineProgress[1]}if((this.loaded===!0||this.models.length===0)&&!arrayEqual(this.models,this.shownModels)){for(var s=0;s<this.shownModels.length;s++){var u=this.shownModels[s];this.models.indexOf(u)===-1&&(u.dispose(),this.dispatchEvent({type:"model.dispose",model:u}))}this.shownModels.length=0;for(var s=0;s<this.models.length;s++)this.shownModels.push(this.models[s]);o=!0}for(var s=0;s<this.shownModels.length;s++){var u=this.shownModels[s];if(!this.updateModelMap.has(u)){var l=u.autoRefine;(this.autoRefine===!1||this.models.indexOf(u)<0)&&(u.autoRefine=!1);var c=u.update(e,r,this);u.autoRefine=l,this.updateModelMap.set(u,c)}}for(var s=this.children.length-1;s>=0;s--){var u=this.children[s];u instanceof Model&&this.remove(u)}for(var s=0;s<this.shownModels.length;s++){var u=this.shownModels[s];this.updateModelMap.get(u)===!0&&(o=!0),scratchBoundingBox3.union(u.boundingBox),this.add(u)}for(var s=0;s<this.models.length;s++){var u=this.models[s];this.shownModels.indexOf(u)===-1&&scratchBoundingBox3.union(u.boundingBox)}scratchBoundingBox3.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox3),this.parameter.set("boundingBox",this.boundingBox.clone()),o=!0);var f=this.boundingMesh.update(e,r,this);return f&&(o=!0),this.updateModelMap.clear(),this.needsRender=o,o},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){return this.parameter.resolveValue()},t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.models;e<r.length;e++){var o=r[e];o.resetBrightness()}},t.prototype.dispose=function(){this.remove(this.boundingMesh),this.boundingMesh.dispose();for(var e=this.children.length-1;e>=0;e--){var r=this.children[e];r instanceof Model&&this.remove(r)}for(var o=arrayUnique(this.models.concat(this.shownModels)),e=0;e<this.shownModels.length;e++)o[e].dispose();this.models.length=0,this.shownModels.length=0,n.prototype.dispose.call(this)},t})(THREE__namespace.Scene);function workInitialToJson(n){var t={};return typeof n.mode!="undefined"&&(t.mode=n.mode),typeof n.panoIndex!="undefined"&&(t.pano_index=n.panoIndex),typeof n.longitude!="undefined"&&(t.longitude=n.longitude),typeof n.latitude!="undefined"&&(t.latitude=n.latitude),typeof n.fov!="undefined"&&(t.fov=n.fov),typeof n.distance!="undefined"&&(t.distance=n.distance),typeof n.offset!="undefined"&&(t.offset=n.offset.toArray()),t}function workModelToJson(n){var t;if(n)return{file_url:n.file,material_base_url:n.textureBase,material_textures:(t=n.textures)===null||t===void 0?void 0:t.slice(),up_axis:n.upAxis,layers:n.layers.map(function(e){return{tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}})}}function workObserverToObserverJson(n){return{index:n.index,derived_id:n.derivedId,derived_id_str:n.derivedIdStr,floor_index:n.floorIndex,position:n.position.toArray(),standing_position:n.standingPosition.toArray(),quaternion:{x:n.quaternion.x,y:n.quaternion.y,z:n.quaternion.z,w:n.quaternion.w},visible_nodes:n.accessibleNodes.slice(),accessible_nodes:n.accessibleNodes.slice()}}function workObserverToPanoramaJson(n){return{index:n.index,active:n.active,loadable:n.loadable,derived_id:n.derivedId,derived_id_str:n.derivedIdStr,size_list:n.images.sizeList.slice(),up:n.images.up,down:n.images.down,right:n.images.right,left:n.images.left,front:n.images.front,back:n.images.back,video:n.images.video?{matrix:n.images.video.matrix.toArray(),size:n.images.video.size.toArray(),source:n.images.video.source}:void 0}}function workToJson(n){return{allow_hosts:n.allowHosts.slice(),expire_at:n.expire.getTime().toString(),project_id:n.projectId,code:n.workCode,name:n.name,base_url:n.baseURL,initial:workInitialToJson(n.initial),model:workModelToJson(n.model),observers:n.observers.map(function(t){return workObserverToObserverJson(t)}),panorama:{count:n.observers.length,list:n.observers.map(function(t){return workObserverToPanoramaJson(t)})}}}function isNumber(n){return typeof n=="number"}function jsonClone(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return n.map(function(o){return typeof o!="object"||o===null?o:jsonClone(o)});var t={};for(var e in n){var r=n[e];t[e]=typeof r!="object"||r===null?r:jsonClone(r)}return t}function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function jsonMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return jsonClone(t);if(r==="array")for(var o=0;o<t.length;o++)n[o]=jsonMerge(n[o],t[o]);else if(r==="dict")for(var s in t)n[s]=jsonMerge(n[s],t[s]);return n}function jsonStableStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":return JSON.stringify(n.toString());case"undefined":return t?void 0:null;case"number":return n;default:return isFinite(n)?n:null}}function jsonStableStrinfiy(n){return jsonStableStrinfiy_(n,!1)}function jsonHash(n){return"hash::".concat(sha256(jsonStableStrinfiy(n)))}var PANO_ID_REG=/^(.*)\[(\d+)\]$/;function panoStringify(n){if(!isNaN(n.panoIndex)&&isFinite(n.panoIndex))return"".concat(n.workCode,"[").concat(n.panoIndex,"]");throw new Error("Invalid Pano")}function panoParse(n){var t=n.match(PANO_ID_REG);if(t){t[0];var e=t[1],r=t[2],o=Math.floor(Number(r));if(!isNaN(o)&&isFinite(o))return{workCode:e,panoIndex:o}}throw new Error("Invalid PanoId")}function panoEqual(n,t){return panoStringify(n)===panoStringify(t)}function isPanoId(n){return typeof n=="string"&&PANO_ID_REG.test(n)}var REG_STR="\\{([^\\}]+)\\}";function escapeRegexp(n){return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function createRegExp(n){return new RegExp("^"+n.map(function(t){return escapeRegexp(t)}).join("(.+)")+"$")}var StringPattern=(function(){function n(t){this.strings=[],this.keys=[];for(var e=new RegExp(REG_STR,"g"),r,o=0;(r=e.exec(t))!==null;)this.strings.push(t.slice(o,r.index)),this.keys.push(r[1]),o=r.index+r[0].length;this.strings.push(t.slice(o))}return n.prototype.stringify=function(t){for(var e=[this.strings[0]],r=0;r<this.keys.length;r++){var o=t[this.keys[r]];e.push(String(o),this.strings[r+1])}return e.join("")},n.prototype.match=function(t){var e;this.matchRegexp=(e=this.matchRegexp)!==null&&e!==void 0?e:createRegExp(this.strings);var r=t.match(this.matchRegexp);if(!r)return null;for(var o={},s=0;s<this.keys.length;s++){var u=this.keys[s],l=r[s+1];if(o[u]!==l){if(o[u]!==void 0)return null;o[u]=l}}return o},n})();function deepFreeze(n){Object.freeze(n);var t=typeof n=="function",e=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(n).forEach(function(r){e.call(n,r)&&(!t||r!=="caller"&&r!=="callee"&&r!=="arguments")&&n[r]!==null&&(typeof n[r]=="object"||typeof n[r]=="function")&&!Object.isFrozen(n[r])&&deepFreeze(n[r])}),n}var URL_REGEXP=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,BUILDIN_ALLOW_HOST=deepFreeze(JSON.parse((function n(){var t=113,e=126,r=0,o="";return arguments[r].split(o).map(function(s){return s.charCodeAt(r)>e?s:String.fromCharCode((s.charCodeAt(r)+t)%e)}).join(o)})("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j"))),domainRegex=/^([^.]+)(\.([^.]+))*$/,currentHostname=typeof location!="undefined"?location.hostname:"localhost";function isIPDomain(n){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(n)}function matchDomain(n,t){if(!domainRegex.test(n)||!domainRegex.test(t))return!1;if(n==="*")return!0;var e=n.split(".").reverse(),r=t.split(".").reverse();if(e.length<=1)return n===t;for(var o=0;o<e.length;o++)if(e[o]!==r[o])return!1;return!0}function hostnameFromURL(n){if(/^blob\:/i.test(n)||/^data\:/i.test(n))return currentHostname;var t=n.match(URL_REGEXP);return t?t[2]:currentHostname}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(n){return new Error("Date(".concat(n.toString(),") expired."))},error_host_not_allowed=function(n){return new Error("Host(".concat(JSON.stringify(n),") is not allowed."))};function ObjectOmit(n,t){for(var e={},r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];t.indexOf(s)===-1&&(e[s]=n[s])}return e}function jsonStableNoneNumberStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableNoneNumberStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableNoneNumberStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableNoneNumberStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableNoneNumberStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(n)?n:null}}function jsonStableNoneNumberStrinfiy(n){return String(jsonStableNoneNumberStrinfiy_(n,!1))}function verify(n){var t,e,r,o={};try{o=typeof n=="string"?JSON.parse(n):n}catch(y){return error_invalid_input()}if(typeof o!="object")return error_invalid_input();var s=currentHostname,u=Date.now(),l=new Date(typeof o.expire_at=="string"&&/^\d+$/.test(o.expire_at)?Number(o.expire_at):o.expire_at),c=Array.isArray(o.allow_hosts)?o.allow_hosts:[];if(s.length===0||isIPDomain(s)||BUILDIN_ALLOW_HOST.filter(function(y){return matchDomain(y,s)}).length>0){var f=String((t=o.certificate)!==null&&t!==void 0?t:"");if(f)try{var p=new X509;return p.readCertPEM(f),deepFreeze({issuer:p.getSubjectString(),expire:l,allowHosts:c})}catch(y){var d=y instanceof Error?y.message:String(y);console.warn("[PARSE Error]: Invalid Certificate. "+d)}return deepFreeze({issuer:"none",expire:l,allowHosts:c})}var h=String((e=o.certificate)!==null&&e!==void 0?e:"");if(!h)return error_invalid_certificate();var g=new X509;g.readCertPEM(h);var m=String((r=o._signature)!==null&&r!==void 0?r:"");if(!m)return error_invalid_signature();var E=jsonStableNoneNumberStrinfiy(ObjectOmit(o,["_signature"]));return verifyMessage(E,m,g)===!1?error_invalid_signature():u<l.getTime()?BUILDIN_ALLOW_HOST.concat(c).filter(function(y){return matchDomain(y,s)}).length===0?error_host_not_allowed(s):deepFreeze({issuer:g.getSubjectString(),expire:l,allowHosts:c}):error_date_expired(l)}function verifyURL(n,t){var e=hostnameFromURL(n);return currentHostname.length!==0&&!isIPDomain(currentHostname)&&BUILDIN_ALLOW_HOST.filter(function(r){return matchDomain(r,currentHostname)}).length===0&&!isIPDomain(e)&&BUILDIN_ALLOW_HOST.concat(t).filter(function(r){return matchDomain(r,e)}).length===0?error_host_not_allowed(e):n}var accessibleNodesSet=new Set,PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(1,1,1),FACE_ORDER$1=["right","left","up","down","front","back"];function relativeURL(n,t){if(!isAbsoluteURL(n))return n;if(n.indexOf(t)===0)return n.slice(t.length);var e=t.replace(/^https\:/,"http:");if(n.indexOf(e)===0)return n.slice(e.length);var r=t.replace(/^http\:/,"https:");return n.indexOf(r)===0?n.slice(r.length):(console.warn("".concat(n," is not start with base_url(").concat(t,").")),n)}function panoURL(n,t,e){return!isAbsoluteURL(n)&&typeof t=="string"&&t.length>0&&(n=pathJoin(t,String(e),n)),n}function getTileLevel(n){for(var t=10;t>=0;t--){var e=512*Math.pow(2,t);if(e<=n)return t}return null}function sortTile(n){n=n.slice().sort(function(u,l){return u.level-l.level});for(var t=[],e=0,r=n;e<r.length;e++){var o=r[e];if(t.length===0){t.push(o);continue}var s=t[t.length-1];if(o.level>s.level){t.push(o);continue}if(o.size>s.size){t[t.length-1]=o;continue}}return t}function parse(n,t){for(var e,r,o,s,u,l,c,f,p,d,h,g,m,E,y,v,A,b,T,_=[],S=null,w=0,R=[].concat(n);w<R.length;w++){var I=R[w];if("getURL"in I)S={allowHosts:I.allowHosts,expire:I.expire,issuer:I.issuer},_.push(workToJson(I));else{var H=typeof I=="string"?JSON.parse(I):jsonClone(I),C=verify(H);if(C instanceof Error)return C;S===null&&(S=C),_.push(H)}}if(S===null)return new Error("Empty");defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:S.issuer}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(S.expire)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(S.allowHosts)});var M=_.reduce(function(G,W){return jsonMerge(G,W)});defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:String((e=M.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{enumerable:!0,writable:!0,value:String(M.resource_code||M.basic_code||M.vr_code||M.code||M.project_id||M.work_code||M.workCode||createUuid())}),defineProperty(t,"projectId",{enumerable:!0,writable:!0,value:M.project_id}),defineProperty(t,"baseURL",{enumerable:!0,writable:!0,value:(function(){var G,W=(G=M.base_url)!==null&&G!==void 0?G:"";return W&&W[W.length-1]!=="/"&&(W+="/"),W})()});var B=void 0;typeof M.model=="object"&&(B={},defineProperty(B,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(B,"file",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var G=M.model.file_url;if(G)return relativeURL(G,t.baseURL)})()}),defineProperty(B,"textureBase",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var G=M.model.material_base_url;return G&&(G=relativeURL(G,t.baseURL)),G})()}),defineProperty(B,"textures",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var G=void 0;return Array.isArray(M.model.material_textures)&&(G=M.model.material_textures.slice(),Object.freeze(G)),G})()}),defineProperty(B,"upAxis",{enumerable:!0,configurable:!1,writable:!1,value:M.model.up_axis}),defineProperty(B,"coordinate",{enumerable:!0,configurable:!1,writable:!1,value:(function(){return jsonClone(M.model.coordinate)})()}),defineProperty(B,"layers",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var G,W,$,ne=[];if(Array.isArray(M.model.layers))for(var te=0,ve=M.model.layers;te<ve.length;te++){var oe=ve[te];if(oe&&oe.tileset_url){var fe={};defineProperty(fe,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(fe,"name",{enumerable:!0,configurable:!1,writable:!1,value:(G=oe.name)!==null&&G!==void 0?G:""}),defineProperty(fe,"type",{enumerable:!0,configurable:!1,writable:!1,value:(W=oe.type)!==null&&W!==void 0?W:"mesh"}),defineProperty(fe,"upAxis",{enumerable:!0,configurable:!1,writable:!1,value:($=oe.up_axis)!==null&&$!==void 0?$:"Z"}),defineProperty(fe,"tileset",{enumerable:!0,configurable:!1,writable:!1,value:relativeURL(oe.tileset_url,t.baseURL)}),ne.push(fe)}}if(typeof M.model.tiles=="object"){var oe=M.model.tiles;if(oe&&oe.tileset_url){var fe={};defineProperty(fe,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(fe,"name",{enumerable:!0,configurable:!1,writable:!1,value:"lod"}),defineProperty(fe,"type",{enumerable:!0,configurable:!1,writable:!1,value:"mesh"}),defineProperty(fe,"upAxis",{enumerable:!0,configurable:!1,writable:!1,value:"-Y"}),defineProperty(fe,"tileset",{enumerable:!0,configurable:!1,writable:!1,value:relativeURL(oe.tileset_url,t.baseURL)}),ne.push(fe)}}return Object.freeze(ne)})()})),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:B});var L=[];if(Array.isArray(M.observers)&&M.panorama&&Array.isArray(M.panorama.list||M.panorama.info)){for(var O=M.observers,k=(r=M.panorama.list||M.panorama.info)!==null&&r!==void 0?r:[],D=(f=(l=(s=(o=M.panorama)===null||o===void 0?void 0:o.pano_high_cube_base_url)!==null&&s!==void 0?s:(u=M.panorama)===null||u===void 0?void 0:u.pano_cube_base_url)!==null&&l!==void 0?l:(c=M.panorama)===null||c===void 0?void 0:c.base_url)!==null&&f!==void 0?f:"",q=Math.min(O.length,k.length),z={},J=function(G){var W=G,$=M.panorama.pattern[W];if(typeof $=="string"){var ne=new StringPattern($);z[W]=function(te){return ne.stringify(te)}}else z[W]=function(){return $}},V=0,U=Object.keys((p=M.panorama.pattern)!==null&&p!==void 0?p:{});V<U.length;V++){var j=U[V];J(j)}for(var K=function(G,W){var $,ne=z[W];return($=G[W])!==null&&$!==void 0?$:ne?ne(G):void 0},ae=function(G){var W=O[G],$=k[G],ne={};defineProperty(ne,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(ne,"index",{enumerable:!0,configurable:!1,writable:!1,value:G}),defineProperty(ne,"panoIndex",{enumerable:!0,configurable:!1,writable:!1,value:G}),defineProperty(ne,"panoId",{enumerable:!0,configurable:!1,writable:!1,value:panoStringify({workCode:t.workCode,panoIndex:G})}),defineProperty(ne,"floorIndex",{enumerable:!0,configurable:!1,writable:!1,value:(d=W.floor_index)!==null&&d!==void 0?d:W.floor}),defineProperty(ne,"derivedId",{enumerable:!0,configurable:!1,writable:!1,value:(g=(h=W.derived_id)!==null&&h!==void 0?h:K($,"derived_id"))!==null&&g!==void 0?g:0}),defineProperty(ne,"derivedIdStr",{enumerable:!0,configurable:!1,writable:!1,value:(E=(m=W.derived_id_str)!==null&&m!==void 0?m:K($,"derived_id_str"))!==null&&E!==void 0?E:String(ne.derivedId)}),defineProperty(ne,"active",{enumerable:!0,configurable:!1,writable:!1,value:W.active!==!1&&K($,"active")!==!1}),defineProperty(ne,"loadable",{enumerable:!0,configurable:!1,writable:!1,value:(v=(y=W.loadable)!==null&&y!==void 0?y:K($,"loadable"))!==null&&v!==void 0?v:!1}),defineProperty(ne,"position",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((A=W.position)!==null&&A!==void 0?A:[0,0,0]))}),defineProperty(ne,"standingPosition",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((T=(b=W.standing_position)!==null&&b!==void 0?b:W.standingPosition)!==null&&T!==void 0?T:[0,0,0]))}),defineProperty(ne,"quaternion",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Quaternion().fromArray(W.quaternion?[W.quaternion.x,W.quaternion.y,W.quaternion.z,W.quaternion.w]:[0,0,0,1]))}),defineProperty(ne,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Matrix4().compose(ne.position,ne.quaternion,PANO_TEXTURE_SCALE))}),defineProperty(ne,"accessibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:(function(){if(accessibleNodesSet.clear(),W.accessible_nodes&&Array.isArray(W.accessible_nodes))for(var te=0,ve=W.accessible_nodes;te<ve.length;te++){var oe=ve[te];oe>=q||oe===G||accessibleNodesSet.add(oe)}else if(W.accessibleNodes&&Array.isArray(W.accessibleNodes))for(var fe=0,be=W.accessibleNodes;fe<be.length;fe++){var oe=be[fe];oe>=q||oe===G||accessibleNodesSet.add(oe)}else if(W.visible_nodes&&Array.isArray(W.visible_nodes))for(var ie=0,ue=W.visible_nodes;ie<ue.length;ie++){var oe=ue[ie];oe>=q||oe===G||accessibleNodesSet.add(oe)}else if(W.visibleNodes&&Array.isArray(W.visibleNodes))for(var me=0,ge=W.visibleNodes;me<ge.length;me++){var oe=ge[me];oe>=q||oe===G||accessibleNodesSet.add(oe)}if(accessibleNodesSet.size===0)for(var Ae=0;Ae<q;Ae++)Ae!==G&&accessibleNodesSet.add(Ae);var xe=Array.from(accessibleNodesSet);return accessibleNodesSet.clear(),Object.freeze(xe)})()}),defineProperty(ne,"visibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:ne.accessibleNodes}),defineProperty(ne,"images",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var te={};defineProperty(te,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var ve=function(ie){defineProperty(te,ie,{enumerable:!0,configurable:!1,writable:!1,value:(function(){var ue;return relativeURL(panoURL((ue=K($,ie))!==null&&ue!==void 0?ue:"",D,G),t.baseURL)})()})},oe=0,fe=FACE_ORDER$1;oe<fe.length;oe++){var be=fe[oe];ve(be)}return defineProperty(te,"sizeList",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var ie=getImageSizeFromURL(te[FACE_ORDER$1[0]]),ue=K($,"size_list"),me=K($,"tiles");if(ie){if(ue){var ge=ue.slice().sort(function(Ee,pe){return Ee-pe});return Object.freeze(ge)}else if(me){for(var ge=[ie],Ae=me.slice().sort(function(pe,Ve){return pe-Ve}),xe=0,de=Ae;xe<de.length;xe++){var _e=de[xe],He=512*Math.pow(2,_e);He>ie&&ge.push(He)}return Object.freeze(ge)}return Object.freeze([ie])}return Object.freeze([])})()}),defineProperty(te,"tiles",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var ie=getImageSizeFromURL(te.front);if(ie){var ue=te.sizeList.slice();if(ue[0]){var me=getTileLevel(ue[0]);if(me)for(var ge=me-1;ge>=0;ge--)ue.unshift(512*Math.pow(2,ge))}if(!(ue.length<=0)){for(var Ae=[],xe=0,de=ue;xe<de.length;xe++){var _e=de[xe],He=getTileLevel(_e);if(typeof He=="number"){var Ee={};if(defineProperty(Ee,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(Ee,"level",{enumerable:!0,configurable:!1,writable:!1,value:He}),_e>ie){defineProperty(Ee,"size",{enumerable:!0,configurable:!1,writable:!1,value:_e}),defineProperty(Ee,"scale",{enumerable:!0,configurable:!1,writable:!1,value:1});for(var pe=0,Ve=FACE_ORDER$1;pe<Ve.length;pe++){var ye=Ve[pe];defineProperty(Ee,ye,{enumerable:!0,configurable:!1,writable:!1,value:replaceImageSize(te[ye],_e)})}}else{defineProperty(Ee,"size",{enumerable:!0,configurable:!1,writable:!1,value:ie}),defineProperty(Ee,"scale",{enumerable:!0,configurable:!1,writable:!1,value:_e/ie});for(var Pe=0,Ce=FACE_ORDER$1;Pe<Ce.length;Pe++){var ye=Ce[Pe];defineProperty(Ee,ye,{enumerable:!0,configurable:!1,writable:!1,value:te[ye]})}}Ae.push(Ee)}}return Ae=sortTile(Ae),Object.freeze(Ae)}}})()}),defineProperty(te,"video",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var ie=K($,"video"),ue=void 0;return ie&&(ue={},defineProperty(ue,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(ue,"source",{enumerable:!0,configurable:!1,writable:!1,value:ie.source}),defineProperty(ue,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().fromArray(ie.matrix)}),defineProperty(ue,"size",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector2().fromArray(ie.size)})),ue})()}),te})()}),L.push(ne)},re=0;re<q;re++)ae(re)}defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(L)});var ee={};if(defineProperty(ee,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),M.initial){if(t.observers.length>0){var Z=void 0;isNumber(M.initial.panoIndex)?Z=M.initial.panoIndex:isNumber(M.initial.pano_index)?Z=M.initial.pano_index:isNumber(M.initial.pano)&&(Z=M.initial.pano),typeof Z=="number"&&(Z=clamp$1(Z,0,t.observers.length-1),defineProperty(ee,"panoIndex",{enumerable:!0,writable:!0,value:Z}))}if(M.initial.mode==="Panorama"&&t.observers.length===0||M.initial.mode==="Floorplan"||M.initial.mode==="Topview"||M.initial.mode==="Model"||M.initial.mode==="Mapview"?defineProperty(ee,"mode",{enumerable:!0,writable:!0,value:M.initial.mode}):typeof ee.panoIndex=="number"?defineProperty(ee,"mode",{enumerable:!0,writable:!0,value:"Panorama"}):defineProperty(ee,"mode",{enumerable:!0,writable:!0,value:"Mapview"}),isNumber(M.initial.latitude)&&defineProperty(ee,"latitude",{enumerable:!0,writable:!0,value:M.initial.latitude}),isNumber(M.initial.longitude)?defineProperty(ee,"longitude",{enumerable:!0,writable:!0,value:M.initial.longitude}):isNumber(M.initial.heading)&&defineProperty(ee,"longitude",{enumerable:!0,writable:!0,value:headingToLongitude(M.initial.heading)}),isNumber(M.initial.fov)&&defineProperty(ee,"fov",{enumerable:!0,writable:!0,value:M.initial.fov}),isNumber(M.initial.distance)&&defineProperty(ee,"distance",{enumerable:!0,writable:!0,value:M.initial.distance}),Array.isArray(M.initial.offset)){var X=M.initial.offset,se=[0,0,0].map(function(G,W){var $=Number(X[W]);return isNaN($)||!isFinite($)?0:$});defineProperty(ee,"offset",{enumerable:!0,writable:!0,value:new THREE__namespace.Vector3().fromArray(se)})}else typeof M.initial.offset=="object"&&typeof M.initial.offset.x=="number"&&typeof M.initial.offset.y=="number"&&typeof M.initial.offset.z=="number"&&defineProperty(ee,"offset",{enumerable:!0,writable:!0,value:new THREE__namespace.Vector3().fromArray([M.initial.offset.x,M.initial.offset.y,M.initial.offset.z])})}return defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:ee}),t}function parseNull(n,t){return defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:"Null"}),defineProperty(t,"workCode",{enumerable:!0,value:"null-"+createUuid()}),defineProperty(t,"baseURL",{enumerable:!0,value:"/"}),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var e={};return defineProperty(e,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(e,"mode",{enumerable:!0,writable:!0,value:"Mapview"}),e})()}),t}function parsePano(n,t){var e,r;return defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:String((e=n.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{enumerable:!0,writable:!0,value:(r=n.code)!==null&&r!==void 0?r:createUuid()}),defineProperty(t,"baseURL",{enumerable:!0,writable:!0,value:"/"}),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"index",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"panoIndex",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"panoId",{enumerable:!0,configurable:!1,writable:!1,value:panoStringify({workCode:t.workCode,panoIndex:0})}),defineProperty(o,"floorIndex",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"derivedId",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(o,"derivedIdStr",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(o,"active",{enumerable:!0,configurable:!1,writable:!1,value:!0}),defineProperty(o,"loadable",{enumerable:!0,configurable:!1,writable:!1,value:!1}),defineProperty(o,"position",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,1.5,0)}),defineProperty(o,"standingPosition",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,0,0)}),defineProperty(o,"quaternion",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Quaternion(0,1,0,0)}),defineProperty(o,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().compose(o.position,o.quaternion,PANO_TEXTURE_SCALE)}),defineProperty(o,"accessibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(o,"visibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:o.accessibleNodes}),defineProperty(o,"images",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var s={};defineProperty(s,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var u=0,l=FACE_ORDER$1;u<l.length;u++){var c=l[u];defineProperty(s,c,{enumerable:!0,configurable:!1,writable:!1,value:n[c]})}return defineProperty(s,"sizeList",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([n.size])}),defineProperty(s,"tiles",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var f=getImageSizeFromURL(s.front);if(f){var p=s.sizeList.slice();if(p[0]){var d=getTileLevel(p[0]);if(d)for(var h=d-1;h>=0;h--)p.unshift(512*Math.pow(2,h))}if(!(p.length<=0)){for(var g=[],m=0,E=p;m<E.length;m++){var y=E[m],v=getTileLevel(y);if(typeof v=="number"){var A={};if(defineProperty(A,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(A,"level",{enumerable:!0,configurable:!1,writable:!1,value:v}),y>f){defineProperty(A,"size",{enumerable:!0,configurable:!1,writable:!1,value:y}),defineProperty(A,"scale",{enumerable:!0,configurable:!1,writable:!1,value:1});for(var b=0,T=FACE_ORDER$1;b<T.length;b++){var _=T[b];defineProperty(A,_,{enumerable:!0,configurable:!1,writable:!1,value:replaceImageSize(s[_],y)})}}else{defineProperty(A,"size",{enumerable:!0,configurable:!1,writable:!1,value:f}),defineProperty(A,"scale",{enumerable:!0,configurable:!1,writable:!1,value:y/f});for(var S=0,w=FACE_ORDER$1;S<w.length;S++){var _=w[S];defineProperty(A,_,{enumerable:!0,configurable:!1,writable:!1,value:s[_]})}}g.push(A)}}return g=sortTile(g),Object.freeze(g)}}})()}),defineProperty(s,"video",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),s})()}),Object.freeze([o])})()}),defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"mode",{enumerable:!0,writable:!0,value:"Panorama"}),defineProperty(o,"panoIndex",{enumerable:!0,writable:!0,value:0}),o})()}),t}var workVerifySet=new WeakSet,Work=(function(){function n(t,e){this.observerBox=new THREE__namespace.Box3,this.observerBox=new THREE__namespace.Box3,this.transform=new THREE__namespace.Matrix4,this.shortPath=!1,this.jsonp=!1;var r;if(t!==null?typeof t=="object"&&typeof t.size=="number"&&typeof t.up=="string"&&typeof t.down=="string"&&typeof t.right=="string"&&typeof t.left=="string"&&typeof t.front=="string"&&typeof t.back=="string"?r=parsePano(t,this):r=parse(t,this):r=parseNull(t,this),r instanceof Error)throw new Error("[PARSE FAILED]: "+r.message+`
1027
1027
  Error work input:
1028
1028
  `+JSON.stringify(t));workVerifySet.add(this);for(var o=0,s=this.observers;o<s.length;o++){var u=s[o];this.observerBox.expandByPoint(u.position),this.observerBox.expandByPoint(u.standingPosition)}e.baseURL&&(this.baseURL=e.baseURL),e.transform&&(Array.isArray(e.transform)?this.transform.fromArray(e.transform):this.transform.copy(e.transform)),typeof e.jsonp=="boolean"&&(this.jsonp=e.jsonp),typeof e.shortPath=="boolean"&&(this.shortPath=e.shortPath),e.workCode&&(typeof e.workCode=="string"?this.workCode=e.workCode:typeof e.workCode=="function"&&(this.workCode=e.workCode(t)));{var l=this;this.options={get transform(){return l.transform}},this.raw={get works(){return[JSON.stringify(workToJson(l))]}}}}return n.prototype.getURL=function(t){var e;if(!isAbsoluteURL(t)){if(this.jsonp===!0){t=t.replace(/([\?\#].*)?$/i,"");var r=sha256("".concat(t)).slice(0,7);t="".concat(t,".").concat(r,".jsonp")}if(this.shortPath===!0){var o=t.replace(t,"").split("."),s=(e=o.shift())!==null&&e!==void 0?e:"",u=o.join(".");t=sha256(s)+(u?"."+u:"")}t=pathJoin(this.baseURL,t)}return t=getFullURL(t),t},n.prototype.verifyURL=function(t){return typeof verifyURL(this.getURL(t),this.allowHosts)=="string"},n.prototype.toJSON=function(){return workToJson(this)},n.parse=parseWork,n})();function parseWork(n,t){typeof n=="string"&&n.trim()[0]==="{"&&(n=JSON.parse(n));try{return new Work(n,t!=null?t:{})}catch(r){console.log(r);var e=r instanceof Error?r.message:String(r);throw new Error("[PARSE Error]: "+e+`
1029
1029
  Error work input:
@@ -1605,9 +1605,9 @@ void main() {
1605
1605
  * http://hammerjs.github.io/
1606
1606
  *
1607
1607
  * Copyright (c) 2016 Jorik Tangelder;
1608
- * Licensed under the MIT license */var Hammer=(function(n,t,e,r){var o=["","webkit","Moz","MS","ms","o"],s=t.createElement?t.createElement("div"):r,u="function",l=Math.round,c=Math.abs,f=Date.now;function p(P,F,N){return setTimeout(A(P,N),F)}function d(P,F,N){return Array.isArray(P)?(h(P,N[F],N),!0):!1}function h(P,F,N){var J;if(P)if(P.forEach)P.forEach(F,N);else if(P.length!==r)for(J=0;J<P.length;)F.call(N,P[J],J,P),J++;else for(J in P)P.hasOwnProperty(J)&&F.call(N,P[J],J,P)}function g(P,F,N){var J="DEPRECATED METHOD: "+F+`
1608
+ * Licensed under the MIT license */var Hammer=(function(n,t,e,r){var o=["","webkit","Moz","MS","ms","o"],s=t.createElement?t.createElement("div"):r,u="function",l=Math.round,c=Math.abs,f=Date.now;function p(P,F,N){return setTimeout(A(P,N),F)}function d(P,F,N){return Array.isArray(P)?(h(P,N[F],N),!0):!1}function h(P,F,N){var Q;if(P)if(P.forEach)P.forEach(F,N);else if(P.length!==r)for(Q=0;Q<P.length;)F.call(N,P[Q],Q,P),Q++;else for(Q in P)P.hasOwnProperty(Q)&&F.call(N,P[Q],Q,P)}function g(P,F,N){var Q="DEPRECATED METHOD: "+F+`
1609
1609
  `+N+` AT
1610
- `;return function(){var Y=new Error("get-stack-trace"),ce=Y&&Y.stack?Y.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Te=n.console&&(n.console.warn||n.console.log);return Te&&Te.call(n.console,J,ce),P.apply(this,arguments)}}var m;typeof Object.assign!="function"?m=function(F){if(F===r||F===null)throw new TypeError("Cannot convert undefined or null to object");for(var N=Object(F),J=1;J<arguments.length;J++){var Y=arguments[J];if(Y!==r&&Y!==null)for(var ce in Y)Y.hasOwnProperty(ce)&&(N[ce]=Y[ce])}return N}:m=Object.assign;var E=g(function(F,N,J){for(var Y=Object.keys(N),ce=0;ce<Y.length;)(!J||J&&F[Y[ce]]===r)&&(F[Y[ce]]=N[Y[ce]]),ce++;return F},"extend","Use `assign`."),y=g(function(F,N){return E(F,N,!0)},"merge","Use `assign`.");function v(P,F,N){var J=F.prototype,Y;Y=P.prototype=Object.create(J),Y.constructor=P,Y._super=J,N&&m(Y,N)}function A(P,F){return function(){return P.apply(F,arguments)}}function b(P,F){return typeof P==u?P.apply(F&&F[0]||r,F):P}function T(P,F){return P===r?F:P}function _(P,F,N){h(I(F),function(J){P.addEventListener(J,N,!1)})}function S(P,F,N){h(I(F),function(J){P.removeEventListener(J,N,!1)})}function w(P,F){for(;P;){if(P==F)return!0;P=P.parentNode}return!1}function R(P,F){return P.indexOf(F)>-1}function I(P){return P.trim().split(/\s+/g)}function H(P,F,N){if(P.indexOf&&!N)return P.indexOf(F);for(var J=0;J<P.length;){if(N&&P[J][N]==F||!N&&P[J]===F)return J;J++}return-1}function C(P){return Array.prototype.slice.call(P,0)}function M(P,F,N){for(var J=[],Y=[],ce=0;ce<P.length;){var Te=P[ce][F];H(Y,Te)<0&&J.push(P[ce]),Y[ce]=Te,ce++}return J=J.sort(function(Ze,De){return Ze[F]>De[F]}),J}function B(P,F){for(var N,J,Y=F[0].toUpperCase()+F.slice(1),ce=0;ce<o.length;){if(N=o[ce],J=N?N+Y:F,J in P)return J;ce++}return r}var L=1;function O(){return L++}function k(P){var F=P.ownerDocument||P;return F.defaultView||F.parentWindow||n}var D=/mobile|tablet|ip(ad|hone|od)|android/i,q="ontouchstart"in n,z=B(n,"PointerEvent")!==r,V=q&&D.test(navigator.userAgent),Q="touch",U="pen",j="mouse",G="kinect",ae=25,re=1,$=2,ee=4,K=8,se=1,W=2,X=4,te=8,Z=16,ne=W|X,pe=te|Z,ie=ne|pe,ue=["x","y"],be=["clientX","clientY"];function oe(P,F){var N=this;this.manager=P,this.callback=F,this.element=P.element,this.target=P.options.inputTarget,this.domHandler=function(J){b(P.options.enable,[P])&&N.handler(J)},this.init()}oe.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(k(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(k(this.element),this.evWin,this.domHandler)}};function le(P){var F,N=P.options.inputClass;return N?F=N:z?F=tt:V?F=Ne:q?F=yt:F=ze,new F(P,me)}function me(P,F,N){var J=N.pointers.length,Y=N.changedPointers.length,ce=F&re&&J-Y===0,Te=F&(ee|K)&&J-Y===0;N.isFirst=!!ce,N.isFinal=!!Te,ce&&(P.session={}),N.eventType=F,ge(P,N),P.emit("hammer.input",N),P.recognize(N),P.session.prevInput=N}function ge(P,F){var N=P.session,J=F.pointers,Y=J.length;N.firstInput||(N.firstInput=he(F)),Y>1&&!N.firstMultiple?N.firstMultiple=he(F):Y===1&&(N.firstMultiple=!1);var ce=N.firstInput,Te=N.firstMultiple,Ge=Te?Te.center:ce.center,Ze=F.center=_e(J);F.timeStamp=f(),F.deltaTime=F.timeStamp-ce.timeStamp,F.angle=Ve(Ge,Ze),F.distance=de(Ge,Ze),Ae(N,F),F.offsetDirection=Ee(F.deltaX,F.deltaY);var De=He(F.deltaTime,F.deltaX,F.deltaY);F.overallVelocityX=De.x,F.overallVelocityY=De.y,F.overallVelocity=c(De.x)>c(De.y)?De.x:De.y,F.scale=Te?Pe(Te.pointers,J):1,F.rotation=Te?ye(Te.pointers,J):0,F.maxPointers=N.prevInput?F.pointers.length>N.prevInput.maxPointers?F.pointers.length:N.prevInput.maxPointers:F.pointers.length,xe(N,F);var _t=P.element;w(F.srcEvent.target,_t)&&(_t=F.srcEvent.target),F.target=_t}function Ae(P,F){var N=F.center,J=P.offsetDelta||{},Y=P.prevDelta||{},ce=P.prevInput||{};(F.eventType===re||ce.eventType===ee)&&(Y=P.prevDelta={x:ce.deltaX||0,y:ce.deltaY||0},J=P.offsetDelta={x:N.x,y:N.y}),F.deltaX=Y.x+(N.x-J.x),F.deltaY=Y.y+(N.y-J.y)}function xe(P,F){var N=P.lastInterval||F,J=F.timeStamp-N.timeStamp,Y,ce,Te,Ge;if(F.eventType!=K&&(J>ae||N.velocity===r)){var Ze=F.deltaX-N.deltaX,De=F.deltaY-N.deltaY,_t=He(J,Ze,De);ce=_t.x,Te=_t.y,Y=c(_t.x)>c(_t.y)?_t.x:_t.y,Ge=Ee(Ze,De),P.lastInterval=F}else Y=N.velocity,ce=N.velocityX,Te=N.velocityY,Ge=N.direction;F.velocity=Y,F.velocityX=ce,F.velocityY=Te,F.direction=Ge}function he(P){for(var F=[],N=0;N<P.pointers.length;)F[N]={clientX:l(P.pointers[N].clientX),clientY:l(P.pointers[N].clientY)},N++;return{timeStamp:f(),pointers:F,center:_e(F),deltaX:P.deltaX,deltaY:P.deltaY}}function _e(P){var F=P.length;if(F===1)return{x:l(P[0].clientX),y:l(P[0].clientY)};for(var N=0,J=0,Y=0;Y<F;)N+=P[Y].clientX,J+=P[Y].clientY,Y++;return{x:l(N/F),y:l(J/F)}}function He(P,F,N){return{x:F/P||0,y:N/P||0}}function Ee(P,F){return P===F?se:c(P)>=c(F)?P<0?W:X:F<0?te:Z}function de(P,F,N){N||(N=ue);var J=F[N[0]]-P[N[0]],Y=F[N[1]]-P[N[1]];return Math.sqrt(J*J+Y*Y)}function Ve(P,F,N){N||(N=ue);var J=F[N[0]]-P[N[0]],Y=F[N[1]]-P[N[1]];return Math.atan2(Y,J)*180/Math.PI}function ye(P,F){return Ve(F[1],F[0],be)+Ve(P[1],P[0],be)}function Pe(P,F){return de(F[0],F[1],be)/de(P[0],P[1],be)}var Ce={mousedown:re,mousemove:$,mouseup:ee},$e="mousedown",Se="mousemove mouseup";function ze(){this.evEl=$e,this.evWin=Se,this.pressed=!1,oe.apply(this,arguments)}v(ze,oe,{handler:function(F){var N=Ce[F.type];N&re&&(F.button===0||F.button===2)&&(this.pressed=!0),N&$&&F.which!==1&&(N=ee),this.pressed&&(N&ee&&(this.pressed=!1),this.callback(this.manager,N,{pointers:[F],changedPointers:[F],pointerType:j,srcEvent:F}))}});var Fe={pointerdown:re,pointermove:$,pointerup:ee,pointercancel:K,pointerout:K},Oe={2:Q,3:U,4:j,5:G},Le="pointerdown",Ue="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(Le="MSPointerDown",Ue="MSPointerMove MSPointerUp MSPointerCancel");function tt(){this.evEl=Le,this.evWin=Ue,oe.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}v(tt,oe,{handler:function(F){var N=this.store,J=!1,Y=!1,ce=F.type.toLowerCase().replace("ms",""),Te=Fe[ce],Ge=Oe[F.pointerType]||F.pointerType,Ze=Ge==Q,De=H(N,F.pointerId,"pointerId");Te&re&&(F.button===0||F.button===2||Ze)?De<0&&(N.push(F),De=N.length-1):Te&(ee|K)?J=!0:!Ze&&F.buttons===0&&(J=!0,Y=!0,Te=Fe.pointerup),!(De<0)&&(Y||(N[De]=F),this.callback(this.manager,Te,{pointers:N,changedPointers:[F],pointerType:Ge,srcEvent:N[De]}),J&&N.splice(De,1))}});var lt={touchstart:re,touchmove:$,touchend:ee,touchcancel:K},nt="touchstart",ot="touchstart touchmove touchend touchcancel";function At(){this.evTarget=nt,this.evWin=ot,this.started=!1,oe.apply(this,arguments)}v(At,oe,{handler:function(F){var N=lt[F.type];if(N===re&&(this.started=!0),!!this.started){var J=We.call(this,F,N);N&(ee|K)&&J[0].length-J[1].length===0&&(this.started=!1),this.callback(this.manager,N,{pointers:J[0],changedPointers:J[1],pointerType:Q,srcEvent:F})}}});function We(P,F){var N=C(P.touches),J=C(P.changedTouches);return F&(ee|K)&&(N=M(N.concat(J),"identifier")),[N,J]}var Mt={touchstart:re,touchmove:$,touchend:ee,touchcancel:K},Be="touchstart touchmove touchend touchcancel";function Ne(){this.evTarget=Be,this.targetIds={},oe.apply(this,arguments)}v(Ne,oe,{handler:function(F){var N=Mt[F.type],J=bt.call(this,F,N);J&&this.callback(this.manager,N,{pointers:J[0],changedPointers:J[1],pointerType:Q,srcEvent:F})}});function bt(P,F){var N=C(P.touches),J=this.targetIds;if(F&(re|$)&&N.length===1)return J[N[0].identifier]=!0,[N,N];var Y,ce,Te=C(P.changedTouches),Ge=[],Ze=this.target;if(ce=N.filter(function(De){return w(De.target,Ze)}),F===re)for(Y=0;Y<ce.length;)J[ce[Y].identifier]=!0,Y++;for(Y=0;Y<Te.length;)J[Te[Y].identifier]&&Ge.push(Te[Y]),F&(ee|K)&&delete J[Te[Y].identifier],Y++;if(Ge.length)return[M(ce.concat(Ge),"identifier"),Ge]}var Ct=2500,xt=25;function yt(){oe.apply(this,arguments);var P=A(this.handler,this);this.touch=new Ne(this.manager,P),this.mouse=new ze(this.manager,P),this.primaryTouch=null,this.lastTouches=[]}v(yt,oe,{handler:function(F,N,J){var Y=J.pointerType==Q,ce=J.pointerType==j;if(!(ce&&J.sourceCapabilities&&J.sourceCapabilities.firesTouchEvents)){if(Y)St.call(this,N,J);else if(ce&&at.call(this,J))return;this.callback(F,N,J)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function St(P,F){P&re?(this.primaryTouch=F.changedPointers[0].identifier,rt.call(this,F)):P&(ee|K)&&rt.call(this,F)}function rt(P){var F=P.changedPointers[0];if(F.identifier===this.primaryTouch){var N={x:F.clientX,y:F.clientY};this.lastTouches.push(N);var J=this.lastTouches,Y=function(){var ce=J.indexOf(N);ce>-1&&J.splice(ce,1)};setTimeout(Y,Ct)}}function at(P){for(var F=P.srcEvent.clientX,N=P.srcEvent.clientY,J=0;J<this.lastTouches.length;J++){var Y=this.lastTouches[J],ce=Math.abs(F-Y.x),Te=Math.abs(N-Y.y);if(ce<=xt&&Te<=xt)return!0}return!1}var ct=s?B(s.style,"touchAction"):r,Xe=ct!==r,fe="compute",we="auto",Me="manipulation",ke="none",je="pan-x",st="pan-y",Qe=Bt();function Je(P,F){this.manager=P,this.set(F)}Je.prototype={set:function(P){P==fe&&(P=this.compute()),Xe&&this.manager.element.style&&Qe[P]&&(this.manager.element.style[ct]=P),this.actions=P.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var P=[];return h(this.manager.recognizers,function(F){b(F.options.enable,[F])&&(P=P.concat(F.getTouchAction()))}),ft(P.join(" "))},preventDefaults:function(P){var F=P.srcEvent,N=P.offsetDirection;if(this.manager.session.prevented){F.preventDefault();return}var J=this.actions,Y=R(J,ke)&&!Qe[ke],ce=R(J,st)&&!Qe[st],Te=R(J,je)&&!Qe[je];if(Y){var Ge=P.pointers.length===1,Ze=P.distance<2,De=P.deltaTime<250;if(Ge&&Ze&&De)return}if(!(Te&&ce)&&(Y||ce&&N&ne||Te&&N&pe))return this.preventSrc(F)},preventSrc:function(P){this.manager.session.prevented=!0,P.preventDefault()}};function ft(P){if(R(P,ke))return ke;var F=R(P,je),N=R(P,st);return F&&N?ke:F||N?F?je:st:R(P,Me)?Me:we}function Bt(){if(!Xe)return!1;var P={},F=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(N){P[N]=F?n.CSS.supports("touch-action",N):!0}),P}var Ft=1,pt=2,It=4,Tt=8,ht=Tt,mt=16,gt=32;function Et(P){this.options=m({},this.defaults,P||{}),this.id=O(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=Ft,this.simultaneous={},this.requireFail=[]}Et.prototype={defaults:{},set:function(P){return m(this.options,P),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(P){if(d(P,"recognizeWith",this))return this;var F=this.simultaneous;return P=Ht(P,this),F[P.id]||(F[P.id]=P,P.recognizeWith(this)),this},dropRecognizeWith:function(P){return d(P,"dropRecognizeWith",this)?this:(P=Ht(P,this),delete this.simultaneous[P.id],this)},requireFailure:function(P){if(d(P,"requireFailure",this))return this;var F=this.requireFail;return P=Ht(P,this),H(F,P)===-1&&(F.push(P),P.requireFailure(this)),this},dropRequireFailure:function(P){if(d(P,"dropRequireFailure",this))return this;P=Ht(P,this);var F=H(this.requireFail,P);return F>-1&&this.requireFail.splice(F,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(P){return!!this.simultaneous[P.id]},emit:function(P){var F=this,N=this.state;function J(Y){F.manager.emit(Y,P)}N<Tt&&J(F.options.event+Lt(N)),J(F.options.event),P.additionalEvent&&J(P.additionalEvent),N>=Tt&&J(F.options.event+Lt(N))},tryEmit:function(P){if(this.canEmit())return this.emit(P);this.state=gt},canEmit:function(){for(var P=0;P<this.requireFail.length;){if(!(this.requireFail[P].state&(gt|Ft)))return!1;P++}return!0},recognize:function(P){var F=m({},P);if(!b(this.options.enable,[this,F])){this.reset(),this.state=gt;return}this.state&(ht|mt|gt)&&(this.state=Ft),this.state=this.process(F),this.state&(pt|It|Tt|mt)&&this.tryEmit(F)},process:function(P){},getTouchAction:function(){},reset:function(){}};function Lt(P){return P&mt?"cancel":P&Tt?"end":P&It?"move":P&pt?"start":""}function Ot(P){return P==Z?"down":P==te?"up":P==W?"left":P==X?"right":""}function Ht(P,F){var N=F.manager;return N?N.get(P):P}function it(){Et.apply(this,arguments)}v(it,Et,{defaults:{pointers:1},attrTest:function(P){var F=this.options.pointers;return F===0||P.pointers.length===F},process:function(P){var F=this.state,N=P.eventType,J=F&(pt|It),Y=this.attrTest(P);return J&&(N&K||!Y)?F|mt:J||Y?N&ee?F|Tt:F&pt?F|It:pt:gt}});function vt(){it.apply(this,arguments),this.pX=null,this.pY=null}v(vt,it,{defaults:{event:"pan",threshold:10,pointers:1,direction:ie},getTouchAction:function(){var P=this.options.direction,F=[];return P&ne&&F.push(st),P&pe&&F.push(je),F},directionTest:function(P){var F=this.options,N=!0,J=P.distance,Y=P.direction,ce=P.deltaX,Te=P.deltaY;return Y&F.direction||(F.direction&ne?(Y=ce===0?se:ce<0?W:X,N=ce!=this.pX,J=Math.abs(P.deltaX)):(Y=Te===0?se:Te<0?te:Z,N=Te!=this.pY,J=Math.abs(P.deltaY))),P.direction=Y,N&&J>F.threshold&&Y&F.direction},attrTest:function(P){return it.prototype.attrTest.call(this,P)&&(this.state&pt||!(this.state&pt)&&this.directionTest(P))},emit:function(P){this.pX=P.deltaX,this.pY=P.deltaY;var F=Ot(P.direction);F&&(P.additionalEvent=this.options.event+F),this._super.emit.call(this,P)}});function Rt(){it.apply(this,arguments)}v(Rt,it,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ke]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.scale-1)>this.options.threshold||this.state&pt)},emit:function(P){if(P.scale!==1){var F=P.scale<1?"in":"out";P.additionalEvent=this.options.event+F}this._super.emit.call(this,P)}});function wt(){Et.apply(this,arguments),this._timer=null,this._input=null}v(wt,Et,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[we]},process:function(P){var F=this.options,N=P.pointers.length===F.pointers,J=P.distance<F.threshold,Y=P.deltaTime>F.time;if(this._input=P,!J||!N||P.eventType&(ee|K)&&!Y)this.reset();else if(P.eventType&re)this.reset(),this._timer=p(function(){this.state=ht,this.tryEmit()},F.time,this);else if(P.eventType&ee)return ht;return gt},reset:function(){clearTimeout(this._timer)},emit:function(P){this.state===ht&&(P&&P.eventType&ee?this.manager.emit(this.options.event+"up",P):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}});function ve(){it.apply(this,arguments)}v(ve,it,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ke]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.rotation)>this.options.threshold||this.state&pt)}});function Ie(){it.apply(this,arguments)}v(Ie,it,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ne|pe,pointers:1},getTouchAction:function(){return vt.prototype.getTouchAction.call(this)},attrTest:function(P){var F=this.options.direction,N;return F&(ne|pe)?N=P.overallVelocity:F&ne?N=P.overallVelocityX:F&pe&&(N=P.overallVelocityY),this._super.attrTest.call(this,P)&&F&P.offsetDirection&&P.distance>this.options.threshold&&P.maxPointers==this.options.pointers&&c(N)>this.options.velocity&&P.eventType&ee},emit:function(P){var F=Ot(P.offsetDirection);F&&this.manager.emit(this.options.event+F,P),this.manager.emit(this.options.event,P)}});function Re(){Et.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}v(Re,Et,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Me]},process:function(P){var F=this.options,N=P.pointers.length===F.pointers,J=P.distance<F.threshold,Y=P.deltaTime<F.time;if(this.reset(),P.eventType&re&&this.count===0)return this.failTimeout();if(J&&Y&&N){if(P.eventType!=ee)return this.failTimeout();var ce=this.pTime?P.timeStamp-this.pTime<F.interval:!0,Te=!this.pCenter||de(this.pCenter,P.center)<F.posThreshold;this.pTime=P.timeStamp,this.pCenter=P.center,!Te||!ce?this.count=1:this.count+=1,this._input=P;var Ge=this.count%F.taps;if(Ge===0)return this.hasRequireFailures()?(this._timer=p(function(){this.state=ht,this.tryEmit()},F.interval,this),pt):ht}return gt},failTimeout:function(){return this._timer=p(function(){this.state=gt},this.options.interval,this),gt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ht&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function qe(P,F){return F=F||{},F.recognizers=T(F.recognizers,qe.defaults.preset),new Ke(P,F)}qe.VERSION="2.0.7",qe.defaults={domEvents:!1,touchAction:fe,enable:!0,inputTarget:null,inputClass:null,preset:[[ve,{enable:!1}],[Rt,{enable:!1},["rotate"]],[Ie,{direction:ne}],[vt,{direction:ne},["swipe"]],[Re],[Re,{event:"doubletap",taps:2},["tap"]],[wt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Ye=1,ut=2;function Ke(P,F){this.options=m({},qe.defaults,F||{}),this.options.inputTarget=this.options.inputTarget||P,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=P,this.input=le(this),this.touchAction=new Je(this,this.options.touchAction),dt(this,!0),h(this.options.recognizers,function(N){var J=this.add(new N[0](N[1]));N[2]&&J.recognizeWith(N[2]),N[3]&&J.requireFailure(N[3])},this)}Ke.prototype={set:function(P){return m(this.options,P),P.touchAction&&this.touchAction.update(),P.inputTarget&&(this.input.destroy(),this.input.target=P.inputTarget,this.input.init()),this},stop:function(P){this.session.stopped=P?ut:Ye},recognize:function(P){var F=this.session;if(!F.stopped){this.touchAction.preventDefaults(P);var N,J=this.recognizers,Y=F.curRecognizer;(!Y||Y&&Y.state&ht)&&(Y=F.curRecognizer=null);for(var ce=0;ce<J.length;)N=J[ce],F.stopped!==ut&&(!Y||N==Y||N.canRecognizeWith(Y))?N.recognize(P):N.reset(),!Y&&N.state&(pt|It|Tt)&&(Y=F.curRecognizer=N),ce++}},get:function(P){if(P instanceof Et)return P;for(var F=this.recognizers,N=0;N<F.length;N++)if(F[N].options.event==P)return F[N];return null},add:function(P){if(d(P,"add",this))return this;var F=this.get(P.options.event);return F&&this.remove(F),this.recognizers.push(P),P.manager=this,this.touchAction.update(),P},remove:function(P){if(d(P,"remove",this))return this;if(P=this.get(P),P){var F=this.recognizers,N=H(F,P);N!==-1&&(F.splice(N,1),this.touchAction.update())}return this},on:function(P,F){if(P!==r&&F!==r){var N=this.handlers;return h(I(P),function(J){N[J]=N[J]||[],N[J].push(F)}),this}},off:function(P,F){if(P!==r){var N=this.handlers;return h(I(P),function(J){F?N[J]&&N[J].splice(H(N[J],F),1):delete N[J]}),this}},emit:function(P,F){this.options.domEvents&&Pt(P,F);var N=this.handlers[P]&&this.handlers[P].slice();if(!(!N||!N.length)){F.type=P,F.preventDefault=function(){F.srcEvent.preventDefault()};for(var J=0;J<N.length;)N[J](F),J++}},destroy:function(){this.element&&dt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function dt(P,F){var N=P.element;if(N.style){var J;h(P.options.cssProps,function(Y,ce){J=B(N.style,ce),F?(P.oldCssProps[J]=N.style[J],N.style[J]=Y):N.style[J]=P.oldCssProps[J]||""}),F||(P.oldCssProps={})}}function Pt(P,F){var N=t.createEvent("Event");N.initEvent(P,!0,!0),N.gesture=F,F.target.dispatchEvent(N)}return m(qe,{INPUT_START:re,INPUT_MOVE:$,INPUT_END:ee,INPUT_CANCEL:K,STATE_POSSIBLE:Ft,STATE_BEGAN:pt,STATE_CHANGED:It,STATE_ENDED:Tt,STATE_RECOGNIZED:ht,STATE_CANCELLED:mt,STATE_FAILED:gt,DIRECTION_NONE:se,DIRECTION_LEFT:W,DIRECTION_RIGHT:X,DIRECTION_UP:te,DIRECTION_DOWN:Z,DIRECTION_HORIZONTAL:ne,DIRECTION_VERTICAL:pe,DIRECTION_ALL:ie,Manager:Ke,Input:oe,TouchAction:Je,TouchInput:Ne,MouseInput:ze,PointerEventInput:tt,TouchMouseInput:yt,SingleTouchInput:At,Recognizer:Et,AttrRecognizer:it,Tap:Re,Pan:vt,Swipe:Ie,Pinch:Rt,Rotate:ve,Press:wt,on:_,off:S,each:h,merge:y,extend:E,assign:m,inherit:v,bindFn:A,prefixed:B}),qe})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),BaseController=(function(n){__extends(t,n);function t(e){var r,o,s,u=n.call(this)||this,l=t.parseArgs(e);return u.mode="",u.pending=new Set,u.userAction=l.initial.userAction,u.destroyed=!1,u.fiveId=l.fiveId,u.scene=l.scene,u.modelScene=l.modelScene,u.xrCustomObjectsScene=l.xrCustomObjectsScene,u.helper=l.helper,u.camera=l.camera,u.renderer=l.renderer,u.viewport=l.viewport,u.element=l.element,u.enableWheel=l.enableWheel,u.works=l.works,u.imageOptions=l.imageOptions,u.videoTexture=l.videoTexture,u.extraElements=l.extraElements,u.initial=l.initial,u.currentPano=typeof u.initial.state.panoIndex=="number"?{workCode:(s=(r=u.initial.state.workCode)!==null&&r!==void 0?r:(o=l.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:u.initial.state.panoIndex}:{workCode:u.initial.currentState.workCode,panoIndex:u.initial.currentState.panoIndex},u.needsRender=!0,u.cameraMotion=new Motion({longitude:{value:u.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:u.camera.pose.latitude,fov:u.camera.pose.fov}),u.inMomentumMovement=null,u.eventUnbinds=[l.element].concat(l.extraElements||[]).map(function(c){return u.bindEvents(c)}),u.initAnimationIsReady=!1,u.pending.add("init-animation"),u.initAnimationReady=new Promise(function(c){AnimationFrameLoop.shared.add(function(){u.initAnimation().then(function(){u.initAnimationIsReady=!0,u.pending.delete("init-animation"),c()})},!0,0)}),u}return t.parseArgs=function(e){return e instanceof t?e:__assign({},e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,p,d=this.parseArgs(e),h=d.initial,g=h.state,m=h.currentState,E=typeof g.panoIndex=="number"?{workCode:(s=(r=g.workCode)!==null&&r!==void 0?r:(o=d.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:g.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex};return __assign(__assign({},E),{mode:"",longitude:(u=g.longitude)!==null&&u!==void 0?u:m.longitude,latitude:(l=g.latitude)!==null&&l!==void 0?l:m.latitude,fov:(c=g.fov)!==null&&c!==void 0?c:m.fov,offset:(f=g.offset)!==null&&f!==void 0?f:m.offset,distance:(p=g.distance)!==null&&p!==void 0?p:m.distance})},t.prototype.updateConfiguration=function(e){return!0},t.prototype.destroy=function(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];s()}this.panState=void 0,(e=this.pressState)===null||e===void 0||e.stop(),this.pressState=void 0},t.prototype.isReady=function(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0},t.prototype.bindExtraElement=function(e){for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];if(s.element===e)return}this.eventUnbinds.push(this.bindEvents(e))},t.prototype.unbindExtraElement=function(e){for(var r=[],o=0,s=this.eventUnbinds;o<s.length;o++){var u=s[o];u.element===e?u():r.push(u)}this.eventUnbinds=r},t.prototype.updateModel=function(e){this.needsRender=!0},t.prototype.updateWork=function(e,r,o,s){return this.works=e,this.userAction=s,!1},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={};this.cameraMotion.ended&&(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),isEmptyObject(o)&&this.setCamera(o)}},t.prototype.render=function(){return!1},t.prototype.postProcessing=function(e,r){this.destroyed},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={};return e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),s.cameraMotion.set(u,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=0,c=e;l<c.length;l++){var f=c[l];u.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.value.fov}})}return s.cameraMotion.setKeyframes(u,r)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})},t.prototype.initAnimation=function(){var e=this.initial;e.state,e.currentState,e.duration;var r=e.userAction,o=t.initAnimationEndState(this);return this.userAction=r,this.emit("initAnimation.start",createEvent("initAnimation.start",{state:o,userAction:this.userAction})),this.emit("initAnimation.end",createEvent("initAnimation.end",{state:o,userAction:this.userAction})),Promise.resolve()},t.prototype.setCamera=function(e){var r,o,s,u,l;e===void 0&&(e={});var c=(r=e.longitude)!==null&&r!==void 0?r:this.camera.pose.longitude,f=(o=e.latitude)!==null&&o!==void 0?o:this.camera.pose.latitude,p=(s=e.fov)!==null&&s!==void 0?s:this.camera.pose.fov,d=(u=e.distance)!==null&&u!==void 0?u:this.camera.pose.distance,h=(l=e.offset)!==null&&l!==void 0?l:this.camera.pose.offset,g=notSimilarValue(c,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(f,this.camera.pose.latitude),m=notSimilarValue(p,this.camera.pose.fov),E=notSimilarValue(d,this.camera.pose.distance),y=notSimilarVector3(h,this.camera.pose.offset);(m||g||y||E)&&(this.camera.setFromPose({longitude:c,latitude:f,fov:p,distance:d,offset:h}),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:p,offset:h,distance:d})})),this.needsRender=!0)},t.prototype.stopMomentumMovement=function(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){var e=createEvent("gesture.momentum",__assign(__assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit("gesture.momentum",e)}this.inMomentumMovement=null},t.prototype.onPanGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pan",e)},t.prototype.onTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.tap",e)},t.prototype.onDblTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.dbltap",e),!e.defaultPrevented&&(e.type="gesture.tap",this.onTapGesture(e))},t.prototype.onPressGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.press",e)},t.prototype.onPinchGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pinch",e)},t.prototype.onMouseWheel=function(e){this.stopMomentumMovement(),this.emit("gesture.mousewheel",e)},t.prototype.onMouseMove=function(e){this.stopMomentumMovement(),this.emit("gesture.mousemove",e)},t.prototype.relativeClientPosition=function(e){var r=this.element.getBoundingClientRect(),o=r.top,s=r.left,u=r.width,l=r.height;return s=s+u*this.viewport.left,o=o+l*(1-this.viewport.bottom-this.viewport.height),u=u*this.viewport.width,l=l*this.viewport.height,new THREE__namespace.Vector2((e.x-s)/u*2-1,-(e.y-o)/l*2+1)},t.prototype.createRaycasterFromCamera=function(e,r){var o=new THREE__namespace.Raycaster;return o.params.Points={threshold:.1},o.firstHitOnly=!0,o.near=r.near,o.far=r.far,o.setFromCamera(e,this.camera),o},t.prototype.bindEvents=function(e){var r=this,o=function(C){var M=r.relativeClientPosition(C);return!(Math.abs(M.x)>1||Math.abs(M.y)>1)},s=new Hammer.Manager(e),u=function(C){var M=C.session;return M.firstInput||null},l=new Hammer.Pan({threshold:10,pointers:0}),c=new Hammer.Tap({interval:410}),f=new Hammer.Pinch({threshold:0,pointers:2});s.add([l,c,f]),s.on("panstart pan",function(C){var M=u(s);if(!(M&&!o(M.center))){var B=createEvent("gesture.pan",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}}),isFirst:C.isFirst,isFinal:C.isFinal,scale:C.scale,center:(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPanGesture(B),b()}}),s.on("tap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var M=u(s);if(!(M&&!o(M.center))){var B=createEvent("gesture.tap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onTapGesture(B),b()}}}),s.on("pinchstart pinch pinchend",function(C){var M=u(s);if(!(M&&!o(M.center))){var B=createEvent("gesture.pinch",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var O,k=r.relativeClientPosition(L),D=new THREE__namespace.Raycaster;return D.params.Points={threshold:.1},D.setFromCamera(k,r.camera),{x:L.x,y:L.y,delta:(O=L.delta)!==null&&O!==void 0?O:0,buttons:0,coords:k,raycaster:D}}),isFirst:C.type==="pinchstart",isFinal:C.type==="pinchend",scale:C.scale,center:(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPinchGesture(B),b()}}),s.on("dbltap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var M=u(s);if(!(M&&!o(M.center))){var B=createEvent("gesture.dbltap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onDblTapGesture(B),b()}}});var p=null,d=null,h=function(C,M,B){var L={x:B.clientX,y:B.clientY},O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera),D=__assign(__assign({},L),{coords:O,raycaster:k,buttons:B.buttons,delta:0}),q=C==="pinchend"?M:M-B.deltaY/280,z=createEvent("gesture.pinch",{target:B.target,pointerType:"mouse",srcEvent:B,pointers:[__assign({},D)],isFirst:C==="pinchstart",isFinal:C==="pinchend",scale:clamp$1(q,.1,10),center:__assign({},D),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return z},g=function(C){var M,B={x:C.clientX,y:C.clientY};if(o(B)){if(C.preventDefault(),C.ctrlKey){var L=(M=p==null?void 0:p.prevEvent.scale)!==null&&M!==void 0?M:1,O=h(p?"pinch":"pinchstart",L,C);p===null?p={firstEvent:O,prevEvent:O}:p.prevEvent=O,r.onPinchGesture(O),d!==null&&window.clearTimeout(d),d=window.setTimeout(function(){var U;d=null;var j=(U=p==null?void 0:p.prevEvent.scale)!==null&&U!==void 0?U:1,G=h("pinchend",j,C);p=null,r.onPinchGesture(G)},200)}else{var k=(Math.abs(C.deltaY)>Math.abs(C.deltaX)?C.deltaY:C.deltaX)/-60,D=r.mouseWheelState!==void 0,q={x:C.clientX,y:C.clientY},z=r.relativeClientPosition(q),V=r.createRaycasterFromCamera(z,r.camera),Q=__assign(__assign({},q),{coords:z,raycaster:V,buttons:C.buttons,delta:k}),O=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},Q)],isFirst:D,isFinal:!1,scale:0,center:__assign({},Q),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(O),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout(function(){r.mouseWheelState=void 0;var j=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign(__assign({},Q),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},Q),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(j)},100)}}b()}},m=function(C){if(!isMobile){if(!o({x:C.clientX,y:C.clientY})){E();return}var M=!1;r.mouseMoveState||(M=!0);var B={x:C.clientX,y:C.clientY},L=r.relativeClientPosition(B),O=r.createRaycasterFromCamera(L,r.camera),k=__assign(__assign({},B),{coords:L,raycaster:O,buttons:C.buttons,delta:0}),D=createEvent("gesture.mousemove",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},k)],isFirst:M,isFinal:!1,scale:0,center:__assign({},k),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.mouseMoveState={timeStamp:now(),event:D},r.onMouseMove(D),r.pressState&&Math.abs(C.clientX-r.pressState.event.center.y)>10&&Math.abs(C.clientY-r.pressState.event.center.y)>10&&b()}},E=function(){if(r.mouseMoveState){var C=createEvent(r.mouseMoveState.event.type,__assign(__assign({},r.mouseMoveState.event),{isFinal:!0}));r.mouseMoveState=void 0,r.onMouseMove(C)}b()},y=function(C){if(!o(C.center)){b();return}var M=!1;r.pressState||(M=!0,r.pressState={event:C,timeStamp:now(),stop:noop});var B=now()-r.pressState.timeStamp,L=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{isFirst:M,isFinal:!1,center:__assign(__assign({},r.pressState.event.center),{delta:B}),pointers:r.pressState.event.pointers.map(function(O){return __assign(__assign({},O),{delta:B})})}));r.onPressGesture(L),r.pressState&&(r.pressState.stop=AnimationFrameLoop.shared.add(function(O){y(C)},!0,1))},v=function(C){if(b(),!(C.touches.length>1||C.changedTouches.length<=0)){var M={x:C.changedTouches[0].clientX,y:C.changedTouches[0].clientY},B=r.relativeClientPosition(M),L=r.createRaycasterFromCamera(B,r.camera),O=__assign(__assign({},M),{coords:B,raycaster:L,buttons:0,delta:0}),k=createEvent("gesture.press",{target:C.target,pointerType:"touch",srcEvent:C,pointers:[__assign({},O)],isFirst:!1,isFinal:!1,scale:0,center:O,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(k)}},A=function(C){b();var M={x:C.clientX,y:C.clientY},B=r.relativeClientPosition(M),L=r.createRaycasterFromCamera(B,r.camera),O=__assign(__assign({},M),{coords:B,raycaster:L,buttons:C.buttons,delta:0}),k=createEvent("gesture.press",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},O)],isFirst:!1,isFinal:!1,scale:0,center:O,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(k)},b=function(){var C;if(r.pressState){var M=now()-r.pressState.timeStamp,B=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{center:__assign(__assign({},r.pressState.event.center),{delta:M}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map(function(L){return __assign(__assign({},L),{delta:M})})}));r.onPressGesture(B),(C=r.pressState)===null||C===void 0||C.stop(),r.pressState=void 0}},T=null,_=function(C){var M,B=!1,L=!1;switch(C.type){case"gesturestart":B=!0;break;case"gestureend":L=!0;break}var O={x:C.clientX,y:C.clientY},k=r.relativeClientPosition(O),D=r.createRaycasterFromCamera(k,r.camera),q=__assign(__assign({},O),{coords:k,raycaster:D,buttons:0,delta:0}),z=createEvent("gesture.pinch",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},q)],isFirst:B,isFinal:L,scale:(M=C.scale)!==null&&M!==void 0?M:1,center:__assign({},q),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return z},S=function(C){if(C.preventDefault(),!isMobile){var M=_(C);T={firstEvent:M};var B=T.firstEvent;B&&!o(B.center)||r.onPinchGesture(M)}},w=function(C){if(C.preventDefault(),!isMobile&&T){var M=_(C),B=T.firstEvent;B&&!o(B.center)||r.onPinchGesture(M)}},R=function(C){if(C.preventDefault(),!isMobile&&T){var M=_(C),B=T.firstEvent;T=null,!(B&&!o(B.center))&&r.onPinchGesture(M)}},I=function(C){if(C&&typeof C.preventDefault=="function"&&C.currentTarget===e&&C.preventDefault(),typeof getSelection=="function"){var M=getSelection();M&&M.focusNode&&(M.removeAllRanges&&M.removeAllRanges(),M.empty&&M.empty())}};this.enableWheel&&e.addEventListener("wheel",g,{passive:!1}),e.addEventListener("mousemove",m,!1),e.addEventListener("mouseout",E,!1),e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchend",b,!1),e.addEventListener("touchcancel",b,!1),e.addEventListener("mousedown",A,!1),e.addEventListener("mouseup",b,!1),e.addEventListener("gesturestart",S,{passive:!1}),e.addEventListener("gesturechange",w,{passive:!1}),e.addEventListener("gestureend",R,{passive:!1}),e.addEventListener("touchstart",I,{passive:!1}),e.addEventListener("contextmenu",I,!1);var H=function(){s.destroy(),e.removeEventListener("wheel",g,!1),e.removeEventListener("mousemove",m,!1),e.removeEventListener("mouseout",E,!1),e.removeEventListener("touchstart",v,!1),e.removeEventListener("touchend",b,!1),e.removeEventListener("touchcancel",b,!1),e.removeEventListener("mousedown",A,!1),e.removeEventListener("mouseup",b,!1),e.removeEventListener("gesturestart",S,!1),e.removeEventListener("gesturechange",w,!1),e.removeEventListener("gestureend",R,!1),e.removeEventListener("touchstart",I,!1),e.removeEventListener("contextmenu",I,!1)};return Object.assign(H,{element:e})},t})(Subscribe),sharedGeometry$2=new THREE__namespace.CircleBufferGeometry(.1,16),vertexShader$1=`
1610
+ `;return function(){var Y=new Error("get-stack-trace"),le=Y&&Y.stack?Y.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Te=n.console&&(n.console.warn||n.console.log);return Te&&Te.call(n.console,Q,le),P.apply(this,arguments)}}var m;typeof Object.assign!="function"?m=function(F){if(F===r||F===null)throw new TypeError("Cannot convert undefined or null to object");for(var N=Object(F),Q=1;Q<arguments.length;Q++){var Y=arguments[Q];if(Y!==r&&Y!==null)for(var le in Y)Y.hasOwnProperty(le)&&(N[le]=Y[le])}return N}:m=Object.assign;var E=g(function(F,N,Q){for(var Y=Object.keys(N),le=0;le<Y.length;)(!Q||Q&&F[Y[le]]===r)&&(F[Y[le]]=N[Y[le]]),le++;return F},"extend","Use `assign`."),y=g(function(F,N){return E(F,N,!0)},"merge","Use `assign`.");function v(P,F,N){var Q=F.prototype,Y;Y=P.prototype=Object.create(Q),Y.constructor=P,Y._super=Q,N&&m(Y,N)}function A(P,F){return function(){return P.apply(F,arguments)}}function b(P,F){return typeof P==u?P.apply(F&&F[0]||r,F):P}function T(P,F){return P===r?F:P}function _(P,F,N){h(I(F),function(Q){P.addEventListener(Q,N,!1)})}function S(P,F,N){h(I(F),function(Q){P.removeEventListener(Q,N,!1)})}function w(P,F){for(;P;){if(P==F)return!0;P=P.parentNode}return!1}function R(P,F){return P.indexOf(F)>-1}function I(P){return P.trim().split(/\s+/g)}function H(P,F,N){if(P.indexOf&&!N)return P.indexOf(F);for(var Q=0;Q<P.length;){if(N&&P[Q][N]==F||!N&&P[Q]===F)return Q;Q++}return-1}function C(P){return Array.prototype.slice.call(P,0)}function M(P,F,N){for(var Q=[],Y=[],le=0;le<P.length;){var Te=P[le][F];H(Y,Te)<0&&Q.push(P[le]),Y[le]=Te,le++}return Q=Q.sort(function(Ze,De){return Ze[F]>De[F]}),Q}function B(P,F){for(var N,Q,Y=F[0].toUpperCase()+F.slice(1),le=0;le<o.length;){if(N=o[le],Q=N?N+Y:F,Q in P)return Q;le++}return r}var L=1;function O(){return L++}function k(P){var F=P.ownerDocument||P;return F.defaultView||F.parentWindow||n}var D=/mobile|tablet|ip(ad|hone|od)|android/i,q="ontouchstart"in n,z=B(n,"PointerEvent")!==r,J=q&&D.test(navigator.userAgent),V="touch",U="pen",j="mouse",K="kinect",ae=25,re=1,ee=2,Z=4,X=8,se=1,G=2,W=4,$=8,ne=16,te=G|W,ve=$|ne,oe=te|ve,fe=["x","y"],be=["clientX","clientY"];function ie(P,F){var N=this;this.manager=P,this.callback=F,this.element=P.element,this.target=P.options.inputTarget,this.domHandler=function(Q){b(P.options.enable,[P])&&N.handler(Q)},this.init()}ie.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(k(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(k(this.element),this.evWin,this.domHandler)}};function ue(P){var F,N=P.options.inputClass;return N?F=N:z?F=tt:J?F=Ne:q?F=yt:F=ze,new F(P,me)}function me(P,F,N){var Q=N.pointers.length,Y=N.changedPointers.length,le=F&re&&Q-Y===0,Te=F&(Z|X)&&Q-Y===0;N.isFirst=!!le,N.isFinal=!!Te,le&&(P.session={}),N.eventType=F,ge(P,N),P.emit("hammer.input",N),P.recognize(N),P.session.prevInput=N}function ge(P,F){var N=P.session,Q=F.pointers,Y=Q.length;N.firstInput||(N.firstInput=de(F)),Y>1&&!N.firstMultiple?N.firstMultiple=de(F):Y===1&&(N.firstMultiple=!1);var le=N.firstInput,Te=N.firstMultiple,Ge=Te?Te.center:le.center,Ze=F.center=_e(Q);F.timeStamp=f(),F.deltaTime=F.timeStamp-le.timeStamp,F.angle=Ve(Ge,Ze),F.distance=pe(Ge,Ze),Ae(N,F),F.offsetDirection=Ee(F.deltaX,F.deltaY);var De=He(F.deltaTime,F.deltaX,F.deltaY);F.overallVelocityX=De.x,F.overallVelocityY=De.y,F.overallVelocity=c(De.x)>c(De.y)?De.x:De.y,F.scale=Te?Pe(Te.pointers,Q):1,F.rotation=Te?ye(Te.pointers,Q):0,F.maxPointers=N.prevInput?F.pointers.length>N.prevInput.maxPointers?F.pointers.length:N.prevInput.maxPointers:F.pointers.length,xe(N,F);var _t=P.element;w(F.srcEvent.target,_t)&&(_t=F.srcEvent.target),F.target=_t}function Ae(P,F){var N=F.center,Q=P.offsetDelta||{},Y=P.prevDelta||{},le=P.prevInput||{};(F.eventType===re||le.eventType===Z)&&(Y=P.prevDelta={x:le.deltaX||0,y:le.deltaY||0},Q=P.offsetDelta={x:N.x,y:N.y}),F.deltaX=Y.x+(N.x-Q.x),F.deltaY=Y.y+(N.y-Q.y)}function xe(P,F){var N=P.lastInterval||F,Q=F.timeStamp-N.timeStamp,Y,le,Te,Ge;if(F.eventType!=X&&(Q>ae||N.velocity===r)){var Ze=F.deltaX-N.deltaX,De=F.deltaY-N.deltaY,_t=He(Q,Ze,De);le=_t.x,Te=_t.y,Y=c(_t.x)>c(_t.y)?_t.x:_t.y,Ge=Ee(Ze,De),P.lastInterval=F}else Y=N.velocity,le=N.velocityX,Te=N.velocityY,Ge=N.direction;F.velocity=Y,F.velocityX=le,F.velocityY=Te,F.direction=Ge}function de(P){for(var F=[],N=0;N<P.pointers.length;)F[N]={clientX:l(P.pointers[N].clientX),clientY:l(P.pointers[N].clientY)},N++;return{timeStamp:f(),pointers:F,center:_e(F),deltaX:P.deltaX,deltaY:P.deltaY}}function _e(P){var F=P.length;if(F===1)return{x:l(P[0].clientX),y:l(P[0].clientY)};for(var N=0,Q=0,Y=0;Y<F;)N+=P[Y].clientX,Q+=P[Y].clientY,Y++;return{x:l(N/F),y:l(Q/F)}}function He(P,F,N){return{x:F/P||0,y:N/P||0}}function Ee(P,F){return P===F?se:c(P)>=c(F)?P<0?G:W:F<0?$:ne}function pe(P,F,N){N||(N=fe);var Q=F[N[0]]-P[N[0]],Y=F[N[1]]-P[N[1]];return Math.sqrt(Q*Q+Y*Y)}function Ve(P,F,N){N||(N=fe);var Q=F[N[0]]-P[N[0]],Y=F[N[1]]-P[N[1]];return Math.atan2(Y,Q)*180/Math.PI}function ye(P,F){return Ve(F[1],F[0],be)+Ve(P[1],P[0],be)}function Pe(P,F){return pe(F[0],F[1],be)/pe(P[0],P[1],be)}var Ce={mousedown:re,mousemove:ee,mouseup:Z},$e="mousedown",Se="mousemove mouseup";function ze(){this.evEl=$e,this.evWin=Se,this.pressed=!1,ie.apply(this,arguments)}v(ze,ie,{handler:function(F){var N=Ce[F.type];N&re&&(F.button===0||F.button===2)&&(this.pressed=!0),N&ee&&F.which!==1&&(N=Z),this.pressed&&(N&Z&&(this.pressed=!1),this.callback(this.manager,N,{pointers:[F],changedPointers:[F],pointerType:j,srcEvent:F}))}});var Fe={pointerdown:re,pointermove:ee,pointerup:Z,pointercancel:X,pointerout:X},Oe={2:V,3:U,4:j,5:K},Le="pointerdown",Ue="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(Le="MSPointerDown",Ue="MSPointerMove MSPointerUp MSPointerCancel");function tt(){this.evEl=Le,this.evWin=Ue,ie.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}v(tt,ie,{handler:function(F){var N=this.store,Q=!1,Y=!1,le=F.type.toLowerCase().replace("ms",""),Te=Fe[le],Ge=Oe[F.pointerType]||F.pointerType,Ze=Ge==V,De=H(N,F.pointerId,"pointerId");Te&re&&(F.button===0||F.button===2||Ze)?De<0&&(N.push(F),De=N.length-1):Te&(Z|X)?Q=!0:!Ze&&F.buttons===0&&(Q=!0,Y=!0,Te=Fe.pointerup),!(De<0)&&(Y||(N[De]=F),this.callback(this.manager,Te,{pointers:N,changedPointers:[F],pointerType:Ge,srcEvent:N[De]}),Q&&N.splice(De,1))}});var lt={touchstart:re,touchmove:ee,touchend:Z,touchcancel:X},nt="touchstart",ot="touchstart touchmove touchend touchcancel";function At(){this.evTarget=nt,this.evWin=ot,this.started=!1,ie.apply(this,arguments)}v(At,ie,{handler:function(F){var N=lt[F.type];if(N===re&&(this.started=!0),!!this.started){var Q=We.call(this,F,N);N&(Z|X)&&Q[0].length-Q[1].length===0&&(this.started=!1),this.callback(this.manager,N,{pointers:Q[0],changedPointers:Q[1],pointerType:V,srcEvent:F})}}});function We(P,F){var N=C(P.touches),Q=C(P.changedTouches);return F&(Z|X)&&(N=M(N.concat(Q),"identifier")),[N,Q]}var Mt={touchstart:re,touchmove:ee,touchend:Z,touchcancel:X},Be="touchstart touchmove touchend touchcancel";function Ne(){this.evTarget=Be,this.targetIds={},ie.apply(this,arguments)}v(Ne,ie,{handler:function(F){var N=Mt[F.type],Q=bt.call(this,F,N);Q&&this.callback(this.manager,N,{pointers:Q[0],changedPointers:Q[1],pointerType:V,srcEvent:F})}});function bt(P,F){var N=C(P.touches),Q=this.targetIds;if(F&(re|ee)&&N.length===1)return Q[N[0].identifier]=!0,[N,N];var Y,le,Te=C(P.changedTouches),Ge=[],Ze=this.target;if(le=N.filter(function(De){return w(De.target,Ze)}),F===re)for(Y=0;Y<le.length;)Q[le[Y].identifier]=!0,Y++;for(Y=0;Y<Te.length;)Q[Te[Y].identifier]&&Ge.push(Te[Y]),F&(Z|X)&&delete Q[Te[Y].identifier],Y++;if(Ge.length)return[M(le.concat(Ge),"identifier"),Ge]}var Ct=2500,xt=25;function yt(){ie.apply(this,arguments);var P=A(this.handler,this);this.touch=new Ne(this.manager,P),this.mouse=new ze(this.manager,P),this.primaryTouch=null,this.lastTouches=[]}v(yt,ie,{handler:function(F,N,Q){var Y=Q.pointerType==V,le=Q.pointerType==j;if(!(le&&Q.sourceCapabilities&&Q.sourceCapabilities.firesTouchEvents)){if(Y)St.call(this,N,Q);else if(le&&at.call(this,Q))return;this.callback(F,N,Q)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function St(P,F){P&re?(this.primaryTouch=F.changedPointers[0].identifier,rt.call(this,F)):P&(Z|X)&&rt.call(this,F)}function rt(P){var F=P.changedPointers[0];if(F.identifier===this.primaryTouch){var N={x:F.clientX,y:F.clientY};this.lastTouches.push(N);var Q=this.lastTouches,Y=function(){var le=Q.indexOf(N);le>-1&&Q.splice(le,1)};setTimeout(Y,Ct)}}function at(P){for(var F=P.srcEvent.clientX,N=P.srcEvent.clientY,Q=0;Q<this.lastTouches.length;Q++){var Y=this.lastTouches[Q],le=Math.abs(F-Y.x),Te=Math.abs(N-Y.y);if(le<=xt&&Te<=xt)return!0}return!1}var ct=s?B(s.style,"touchAction"):r,Xe=ct!==r,ce="compute",we="auto",Me="manipulation",ke="none",je="pan-x",st="pan-y",Qe=Bt();function Je(P,F){this.manager=P,this.set(F)}Je.prototype={set:function(P){P==ce&&(P=this.compute()),Xe&&this.manager.element.style&&Qe[P]&&(this.manager.element.style[ct]=P),this.actions=P.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var P=[];return h(this.manager.recognizers,function(F){b(F.options.enable,[F])&&(P=P.concat(F.getTouchAction()))}),ft(P.join(" "))},preventDefaults:function(P){var F=P.srcEvent,N=P.offsetDirection;if(this.manager.session.prevented){F.preventDefault();return}var Q=this.actions,Y=R(Q,ke)&&!Qe[ke],le=R(Q,st)&&!Qe[st],Te=R(Q,je)&&!Qe[je];if(Y){var Ge=P.pointers.length===1,Ze=P.distance<2,De=P.deltaTime<250;if(Ge&&Ze&&De)return}if(!(Te&&le)&&(Y||le&&N&te||Te&&N&ve))return this.preventSrc(F)},preventSrc:function(P){this.manager.session.prevented=!0,P.preventDefault()}};function ft(P){if(R(P,ke))return ke;var F=R(P,je),N=R(P,st);return F&&N?ke:F||N?F?je:st:R(P,Me)?Me:we}function Bt(){if(!Xe)return!1;var P={},F=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(N){P[N]=F?n.CSS.supports("touch-action",N):!0}),P}var Ft=1,pt=2,It=4,Tt=8,ht=Tt,mt=16,gt=32;function Et(P){this.options=m({},this.defaults,P||{}),this.id=O(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=Ft,this.simultaneous={},this.requireFail=[]}Et.prototype={defaults:{},set:function(P){return m(this.options,P),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(P){if(d(P,"recognizeWith",this))return this;var F=this.simultaneous;return P=Ht(P,this),F[P.id]||(F[P.id]=P,P.recognizeWith(this)),this},dropRecognizeWith:function(P){return d(P,"dropRecognizeWith",this)?this:(P=Ht(P,this),delete this.simultaneous[P.id],this)},requireFailure:function(P){if(d(P,"requireFailure",this))return this;var F=this.requireFail;return P=Ht(P,this),H(F,P)===-1&&(F.push(P),P.requireFailure(this)),this},dropRequireFailure:function(P){if(d(P,"dropRequireFailure",this))return this;P=Ht(P,this);var F=H(this.requireFail,P);return F>-1&&this.requireFail.splice(F,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(P){return!!this.simultaneous[P.id]},emit:function(P){var F=this,N=this.state;function Q(Y){F.manager.emit(Y,P)}N<Tt&&Q(F.options.event+Lt(N)),Q(F.options.event),P.additionalEvent&&Q(P.additionalEvent),N>=Tt&&Q(F.options.event+Lt(N))},tryEmit:function(P){if(this.canEmit())return this.emit(P);this.state=gt},canEmit:function(){for(var P=0;P<this.requireFail.length;){if(!(this.requireFail[P].state&(gt|Ft)))return!1;P++}return!0},recognize:function(P){var F=m({},P);if(!b(this.options.enable,[this,F])){this.reset(),this.state=gt;return}this.state&(ht|mt|gt)&&(this.state=Ft),this.state=this.process(F),this.state&(pt|It|Tt|mt)&&this.tryEmit(F)},process:function(P){},getTouchAction:function(){},reset:function(){}};function Lt(P){return P&mt?"cancel":P&Tt?"end":P&It?"move":P&pt?"start":""}function Ot(P){return P==ne?"down":P==$?"up":P==G?"left":P==W?"right":""}function Ht(P,F){var N=F.manager;return N?N.get(P):P}function it(){Et.apply(this,arguments)}v(it,Et,{defaults:{pointers:1},attrTest:function(P){var F=this.options.pointers;return F===0||P.pointers.length===F},process:function(P){var F=this.state,N=P.eventType,Q=F&(pt|It),Y=this.attrTest(P);return Q&&(N&X||!Y)?F|mt:Q||Y?N&Z?F|Tt:F&pt?F|It:pt:gt}});function vt(){it.apply(this,arguments),this.pX=null,this.pY=null}v(vt,it,{defaults:{event:"pan",threshold:10,pointers:1,direction:oe},getTouchAction:function(){var P=this.options.direction,F=[];return P&te&&F.push(st),P&ve&&F.push(je),F},directionTest:function(P){var F=this.options,N=!0,Q=P.distance,Y=P.direction,le=P.deltaX,Te=P.deltaY;return Y&F.direction||(F.direction&te?(Y=le===0?se:le<0?G:W,N=le!=this.pX,Q=Math.abs(P.deltaX)):(Y=Te===0?se:Te<0?$:ne,N=Te!=this.pY,Q=Math.abs(P.deltaY))),P.direction=Y,N&&Q>F.threshold&&Y&F.direction},attrTest:function(P){return it.prototype.attrTest.call(this,P)&&(this.state&pt||!(this.state&pt)&&this.directionTest(P))},emit:function(P){this.pX=P.deltaX,this.pY=P.deltaY;var F=Ot(P.direction);F&&(P.additionalEvent=this.options.event+F),this._super.emit.call(this,P)}});function Rt(){it.apply(this,arguments)}v(Rt,it,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ke]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.scale-1)>this.options.threshold||this.state&pt)},emit:function(P){if(P.scale!==1){var F=P.scale<1?"in":"out";P.additionalEvent=this.options.event+F}this._super.emit.call(this,P)}});function wt(){Et.apply(this,arguments),this._timer=null,this._input=null}v(wt,Et,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[we]},process:function(P){var F=this.options,N=P.pointers.length===F.pointers,Q=P.distance<F.threshold,Y=P.deltaTime>F.time;if(this._input=P,!Q||!N||P.eventType&(Z|X)&&!Y)this.reset();else if(P.eventType&re)this.reset(),this._timer=p(function(){this.state=ht,this.tryEmit()},F.time,this);else if(P.eventType&Z)return ht;return gt},reset:function(){clearTimeout(this._timer)},emit:function(P){this.state===ht&&(P&&P.eventType&Z?this.manager.emit(this.options.event+"up",P):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}});function he(){it.apply(this,arguments)}v(he,it,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ke]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.rotation)>this.options.threshold||this.state&pt)}});function Ie(){it.apply(this,arguments)}v(Ie,it,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:te|ve,pointers:1},getTouchAction:function(){return vt.prototype.getTouchAction.call(this)},attrTest:function(P){var F=this.options.direction,N;return F&(te|ve)?N=P.overallVelocity:F&te?N=P.overallVelocityX:F&ve&&(N=P.overallVelocityY),this._super.attrTest.call(this,P)&&F&P.offsetDirection&&P.distance>this.options.threshold&&P.maxPointers==this.options.pointers&&c(N)>this.options.velocity&&P.eventType&Z},emit:function(P){var F=Ot(P.offsetDirection);F&&this.manager.emit(this.options.event+F,P),this.manager.emit(this.options.event,P)}});function Re(){Et.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}v(Re,Et,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Me]},process:function(P){var F=this.options,N=P.pointers.length===F.pointers,Q=P.distance<F.threshold,Y=P.deltaTime<F.time;if(this.reset(),P.eventType&re&&this.count===0)return this.failTimeout();if(Q&&Y&&N){if(P.eventType!=Z)return this.failTimeout();var le=this.pTime?P.timeStamp-this.pTime<F.interval:!0,Te=!this.pCenter||pe(this.pCenter,P.center)<F.posThreshold;this.pTime=P.timeStamp,this.pCenter=P.center,!Te||!le?this.count=1:this.count+=1,this._input=P;var Ge=this.count%F.taps;if(Ge===0)return this.hasRequireFailures()?(this._timer=p(function(){this.state=ht,this.tryEmit()},F.interval,this),pt):ht}return gt},failTimeout:function(){return this._timer=p(function(){this.state=gt},this.options.interval,this),gt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ht&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function qe(P,F){return F=F||{},F.recognizers=T(F.recognizers,qe.defaults.preset),new Ke(P,F)}qe.VERSION="2.0.7",qe.defaults={domEvents:!1,touchAction:ce,enable:!0,inputTarget:null,inputClass:null,preset:[[he,{enable:!1}],[Rt,{enable:!1},["rotate"]],[Ie,{direction:te}],[vt,{direction:te},["swipe"]],[Re],[Re,{event:"doubletap",taps:2},["tap"]],[wt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Ye=1,ut=2;function Ke(P,F){this.options=m({},qe.defaults,F||{}),this.options.inputTarget=this.options.inputTarget||P,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=P,this.input=ue(this),this.touchAction=new Je(this,this.options.touchAction),dt(this,!0),h(this.options.recognizers,function(N){var Q=this.add(new N[0](N[1]));N[2]&&Q.recognizeWith(N[2]),N[3]&&Q.requireFailure(N[3])},this)}Ke.prototype={set:function(P){return m(this.options,P),P.touchAction&&this.touchAction.update(),P.inputTarget&&(this.input.destroy(),this.input.target=P.inputTarget,this.input.init()),this},stop:function(P){this.session.stopped=P?ut:Ye},recognize:function(P){var F=this.session;if(!F.stopped){this.touchAction.preventDefaults(P);var N,Q=this.recognizers,Y=F.curRecognizer;(!Y||Y&&Y.state&ht)&&(Y=F.curRecognizer=null);for(var le=0;le<Q.length;)N=Q[le],F.stopped!==ut&&(!Y||N==Y||N.canRecognizeWith(Y))?N.recognize(P):N.reset(),!Y&&N.state&(pt|It|Tt)&&(Y=F.curRecognizer=N),le++}},get:function(P){if(P instanceof Et)return P;for(var F=this.recognizers,N=0;N<F.length;N++)if(F[N].options.event==P)return F[N];return null},add:function(P){if(d(P,"add",this))return this;var F=this.get(P.options.event);return F&&this.remove(F),this.recognizers.push(P),P.manager=this,this.touchAction.update(),P},remove:function(P){if(d(P,"remove",this))return this;if(P=this.get(P),P){var F=this.recognizers,N=H(F,P);N!==-1&&(F.splice(N,1),this.touchAction.update())}return this},on:function(P,F){if(P!==r&&F!==r){var N=this.handlers;return h(I(P),function(Q){N[Q]=N[Q]||[],N[Q].push(F)}),this}},off:function(P,F){if(P!==r){var N=this.handlers;return h(I(P),function(Q){F?N[Q]&&N[Q].splice(H(N[Q],F),1):delete N[Q]}),this}},emit:function(P,F){this.options.domEvents&&Pt(P,F);var N=this.handlers[P]&&this.handlers[P].slice();if(!(!N||!N.length)){F.type=P,F.preventDefault=function(){F.srcEvent.preventDefault()};for(var Q=0;Q<N.length;)N[Q](F),Q++}},destroy:function(){this.element&&dt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function dt(P,F){var N=P.element;if(N.style){var Q;h(P.options.cssProps,function(Y,le){Q=B(N.style,le),F?(P.oldCssProps[Q]=N.style[Q],N.style[Q]=Y):N.style[Q]=P.oldCssProps[Q]||""}),F||(P.oldCssProps={})}}function Pt(P,F){var N=t.createEvent("Event");N.initEvent(P,!0,!0),N.gesture=F,F.target.dispatchEvent(N)}return m(qe,{INPUT_START:re,INPUT_MOVE:ee,INPUT_END:Z,INPUT_CANCEL:X,STATE_POSSIBLE:Ft,STATE_BEGAN:pt,STATE_CHANGED:It,STATE_ENDED:Tt,STATE_RECOGNIZED:ht,STATE_CANCELLED:mt,STATE_FAILED:gt,DIRECTION_NONE:se,DIRECTION_LEFT:G,DIRECTION_RIGHT:W,DIRECTION_UP:$,DIRECTION_DOWN:ne,DIRECTION_HORIZONTAL:te,DIRECTION_VERTICAL:ve,DIRECTION_ALL:oe,Manager:Ke,Input:ie,TouchAction:Je,TouchInput:Ne,MouseInput:ze,PointerEventInput:tt,TouchMouseInput:yt,SingleTouchInput:At,Recognizer:Et,AttrRecognizer:it,Tap:Re,Pan:vt,Swipe:Ie,Pinch:Rt,Rotate:he,Press:wt,on:_,off:S,each:h,merge:y,extend:E,assign:m,inherit:v,bindFn:A,prefixed:B}),qe})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),BaseController=(function(n){__extends(t,n);function t(e){var r,o,s,u=n.call(this)||this,l=t.parseArgs(e);return u.mode="",u.pending=new Set,u.userAction=l.initial.userAction,u.destroyed=!1,u.fiveId=l.fiveId,u.scene=l.scene,u.modelScene=l.modelScene,u.xrCustomObjectsScene=l.xrCustomObjectsScene,u.helper=l.helper,u.camera=l.camera,u.renderer=l.renderer,u.viewport=l.viewport,u.element=l.element,u.enableWheel=l.enableWheel,u.works=l.works,u.imageOptions=l.imageOptions,u.videoTexture=l.videoTexture,u.extraElements=l.extraElements,u.initial=l.initial,u.currentPano=typeof u.initial.state.panoIndex=="number"?{workCode:(s=(r=u.initial.state.workCode)!==null&&r!==void 0?r:(o=l.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:u.initial.state.panoIndex}:{workCode:u.initial.currentState.workCode,panoIndex:u.initial.currentState.panoIndex},u.needsRender=!0,u.cameraMotion=new Motion({longitude:{value:u.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:u.camera.pose.latitude,fov:u.camera.pose.fov}),u.inMomentumMovement=null,u.eventUnbinds=[l.element].concat(l.extraElements||[]).map(function(c){return u.bindEvents(c)}),u.initAnimationIsReady=!1,u.pending.add("init-animation"),u.initAnimationReady=new Promise(function(c){AnimationFrameLoop.shared.add(function(){u.initAnimation().then(function(){u.initAnimationIsReady=!0,u.pending.delete("init-animation"),c()})},!0,0)}),u}return t.parseArgs=function(e){return e instanceof t?e:__assign({},e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,p,d=this.parseArgs(e),h=d.initial,g=h.state,m=h.currentState,E=typeof g.panoIndex=="number"?{workCode:(s=(r=g.workCode)!==null&&r!==void 0?r:(o=d.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:g.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex};return __assign(__assign({},E),{mode:"",longitude:(u=g.longitude)!==null&&u!==void 0?u:m.longitude,latitude:(l=g.latitude)!==null&&l!==void 0?l:m.latitude,fov:(c=g.fov)!==null&&c!==void 0?c:m.fov,offset:(f=g.offset)!==null&&f!==void 0?f:m.offset,distance:(p=g.distance)!==null&&p!==void 0?p:m.distance})},t.prototype.updateConfiguration=function(e){return!0},t.prototype.destroy=function(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];s()}this.panState=void 0,(e=this.pressState)===null||e===void 0||e.stop(),this.pressState=void 0},t.prototype.isReady=function(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0},t.prototype.bindExtraElement=function(e){for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];if(s.element===e)return}this.eventUnbinds.push(this.bindEvents(e))},t.prototype.unbindExtraElement=function(e){for(var r=[],o=0,s=this.eventUnbinds;o<s.length;o++){var u=s[o];u.element===e?u():r.push(u)}this.eventUnbinds=r},t.prototype.updateModel=function(e){this.needsRender=!0},t.prototype.updateWork=function(e,r,o,s){return this.works=e,this.userAction=s,!1},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={};this.cameraMotion.ended&&(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),isEmptyObject(o)&&this.setCamera(o)}},t.prototype.render=function(){return!1},t.prototype.postProcessing=function(e,r){this.destroyed},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={};return e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),s.cameraMotion.set(u,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=0,c=e;l<c.length;l++){var f=c[l];u.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.value.fov}})}return s.cameraMotion.setKeyframes(u,r)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})},t.prototype.initAnimation=function(){var e=this.initial;e.state,e.currentState,e.duration;var r=e.userAction,o=t.initAnimationEndState(this);return this.userAction=r,this.emit("initAnimation.start",createEvent("initAnimation.start",{state:o,userAction:this.userAction})),this.emit("initAnimation.end",createEvent("initAnimation.end",{state:o,userAction:this.userAction})),Promise.resolve()},t.prototype.setCamera=function(e){var r,o,s,u,l;e===void 0&&(e={});var c=(r=e.longitude)!==null&&r!==void 0?r:this.camera.pose.longitude,f=(o=e.latitude)!==null&&o!==void 0?o:this.camera.pose.latitude,p=(s=e.fov)!==null&&s!==void 0?s:this.camera.pose.fov,d=(u=e.distance)!==null&&u!==void 0?u:this.camera.pose.distance,h=(l=e.offset)!==null&&l!==void 0?l:this.camera.pose.offset,g=notSimilarValue(c,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(f,this.camera.pose.latitude),m=notSimilarValue(p,this.camera.pose.fov),E=notSimilarValue(d,this.camera.pose.distance),y=notSimilarVector3(h,this.camera.pose.offset);(m||g||y||E)&&(this.camera.setFromPose({longitude:c,latitude:f,fov:p,distance:d,offset:h}),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:p,offset:h,distance:d})})),this.needsRender=!0)},t.prototype.stopMomentumMovement=function(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){var e=createEvent("gesture.momentum",__assign(__assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit("gesture.momentum",e)}this.inMomentumMovement=null},t.prototype.onPanGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pan",e)},t.prototype.onTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.tap",e)},t.prototype.onDblTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.dbltap",e),!e.defaultPrevented&&(e.type="gesture.tap",this.onTapGesture(e))},t.prototype.onPressGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.press",e)},t.prototype.onPinchGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pinch",e)},t.prototype.onMouseWheel=function(e){this.stopMomentumMovement(),this.emit("gesture.mousewheel",e)},t.prototype.onMouseMove=function(e){this.stopMomentumMovement(),this.emit("gesture.mousemove",e)},t.prototype.relativeClientPosition=function(e){var r=this.element.getBoundingClientRect(),o=r.top,s=r.left,u=r.width,l=r.height;return s=s+u*this.viewport.left,o=o+l*(1-this.viewport.bottom-this.viewport.height),u=u*this.viewport.width,l=l*this.viewport.height,new THREE__namespace.Vector2((e.x-s)/u*2-1,-(e.y-o)/l*2+1)},t.prototype.createRaycasterFromCamera=function(e,r){var o=new THREE__namespace.Raycaster;return o.params.Points={threshold:.1},o.firstHitOnly=!0,o.near=r.near,o.far=r.far,o.setFromCamera(e,this.camera),o},t.prototype.bindEvents=function(e){var r=this,o=function(C){var M=r.relativeClientPosition(C);return!(Math.abs(M.x)>1||Math.abs(M.y)>1)},s=new Hammer.Manager(e),u=function(C){var M=C.session;return M.firstInput||null},l=new Hammer.Pan({threshold:10,pointers:0}),c=new Hammer.Tap({interval:410}),f=new Hammer.Pinch({threshold:0,pointers:2});s.add([l,c,f]),s.on("panstart pan",function(C){var M=u(s);if(!(M&&!o(M.center))){var B=createEvent("gesture.pan",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}}),isFirst:C.isFirst,isFinal:C.isFinal,scale:C.scale,center:(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPanGesture(B),b()}}),s.on("tap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var M=u(s);if(!(M&&!o(M.center))){var B=createEvent("gesture.tap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onTapGesture(B),b()}}}),s.on("pinchstart pinch pinchend",function(C){var M=u(s);if(!(M&&!o(M.center))){var B=createEvent("gesture.pinch",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var O,k=r.relativeClientPosition(L),D=new THREE__namespace.Raycaster;return D.params.Points={threshold:.1},D.setFromCamera(k,r.camera),{x:L.x,y:L.y,delta:(O=L.delta)!==null&&O!==void 0?O:0,buttons:0,coords:k,raycaster:D}}),isFirst:C.type==="pinchstart",isFinal:C.type==="pinchend",scale:C.scale,center:(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPinchGesture(B),b()}}),s.on("dbltap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var M=u(s);if(!(M&&!o(M.center))){var B=createEvent("gesture.dbltap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(L){var O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:O,raycaster:k}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onDblTapGesture(B),b()}}});var p=null,d=null,h=function(C,M,B){var L={x:B.clientX,y:B.clientY},O=r.relativeClientPosition(L),k=r.createRaycasterFromCamera(O,r.camera),D=__assign(__assign({},L),{coords:O,raycaster:k,buttons:B.buttons,delta:0}),q=C==="pinchend"?M:M-B.deltaY/280,z=createEvent("gesture.pinch",{target:B.target,pointerType:"mouse",srcEvent:B,pointers:[__assign({},D)],isFirst:C==="pinchstart",isFinal:C==="pinchend",scale:clamp$1(q,.1,10),center:__assign({},D),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return z},g=function(C){var M,B={x:C.clientX,y:C.clientY};if(o(B)){if(C.preventDefault(),C.ctrlKey){var L=(M=p==null?void 0:p.prevEvent.scale)!==null&&M!==void 0?M:1,O=h(p?"pinch":"pinchstart",L,C);p===null?p={firstEvent:O,prevEvent:O}:p.prevEvent=O,r.onPinchGesture(O),d!==null&&window.clearTimeout(d),d=window.setTimeout(function(){var U;d=null;var j=(U=p==null?void 0:p.prevEvent.scale)!==null&&U!==void 0?U:1,K=h("pinchend",j,C);p=null,r.onPinchGesture(K)},200)}else{var k=(Math.abs(C.deltaY)>Math.abs(C.deltaX)?C.deltaY:C.deltaX)/-60,D=r.mouseWheelState!==void 0,q={x:C.clientX,y:C.clientY},z=r.relativeClientPosition(q),J=r.createRaycasterFromCamera(z,r.camera),V=__assign(__assign({},q),{coords:z,raycaster:J,buttons:C.buttons,delta:k}),O=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},V)],isFirst:D,isFinal:!1,scale:0,center:__assign({},V),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(O),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout(function(){r.mouseWheelState=void 0;var j=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign(__assign({},V),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},V),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(j)},100)}}b()}},m=function(C){if(!isMobile){if(!o({x:C.clientX,y:C.clientY})){E();return}var M=!1;r.mouseMoveState||(M=!0);var B={x:C.clientX,y:C.clientY},L=r.relativeClientPosition(B),O=r.createRaycasterFromCamera(L,r.camera),k=__assign(__assign({},B),{coords:L,raycaster:O,buttons:C.buttons,delta:0}),D=createEvent("gesture.mousemove",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},k)],isFirst:M,isFinal:!1,scale:0,center:__assign({},k),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.mouseMoveState={timeStamp:now(),event:D},r.onMouseMove(D),r.pressState&&Math.abs(C.clientX-r.pressState.event.center.y)>10&&Math.abs(C.clientY-r.pressState.event.center.y)>10&&b()}},E=function(){if(r.mouseMoveState){var C=createEvent(r.mouseMoveState.event.type,__assign(__assign({},r.mouseMoveState.event),{isFinal:!0}));r.mouseMoveState=void 0,r.onMouseMove(C)}b()},y=function(C){if(!o(C.center)){b();return}var M=!1;r.pressState||(M=!0,r.pressState={event:C,timeStamp:now(),stop:noop});var B=now()-r.pressState.timeStamp,L=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{isFirst:M,isFinal:!1,center:__assign(__assign({},r.pressState.event.center),{delta:B}),pointers:r.pressState.event.pointers.map(function(O){return __assign(__assign({},O),{delta:B})})}));r.onPressGesture(L),r.pressState&&(r.pressState.stop=AnimationFrameLoop.shared.add(function(O){y(C)},!0,1))},v=function(C){if(b(),!(C.touches.length>1||C.changedTouches.length<=0)){var M={x:C.changedTouches[0].clientX,y:C.changedTouches[0].clientY},B=r.relativeClientPosition(M),L=r.createRaycasterFromCamera(B,r.camera),O=__assign(__assign({},M),{coords:B,raycaster:L,buttons:0,delta:0}),k=createEvent("gesture.press",{target:C.target,pointerType:"touch",srcEvent:C,pointers:[__assign({},O)],isFirst:!1,isFinal:!1,scale:0,center:O,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(k)}},A=function(C){b();var M={x:C.clientX,y:C.clientY},B=r.relativeClientPosition(M),L=r.createRaycasterFromCamera(B,r.camera),O=__assign(__assign({},M),{coords:B,raycaster:L,buttons:C.buttons,delta:0}),k=createEvent("gesture.press",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},O)],isFirst:!1,isFinal:!1,scale:0,center:O,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(k)},b=function(){var C;if(r.pressState){var M=now()-r.pressState.timeStamp,B=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{center:__assign(__assign({},r.pressState.event.center),{delta:M}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map(function(L){return __assign(__assign({},L),{delta:M})})}));r.onPressGesture(B),(C=r.pressState)===null||C===void 0||C.stop(),r.pressState=void 0}},T=null,_=function(C){var M,B=!1,L=!1;switch(C.type){case"gesturestart":B=!0;break;case"gestureend":L=!0;break}var O={x:C.clientX,y:C.clientY},k=r.relativeClientPosition(O),D=r.createRaycasterFromCamera(k,r.camera),q=__assign(__assign({},O),{coords:k,raycaster:D,buttons:0,delta:0}),z=createEvent("gesture.pinch",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},q)],isFirst:B,isFinal:L,scale:(M=C.scale)!==null&&M!==void 0?M:1,center:__assign({},q),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return z},S=function(C){if(C.preventDefault(),!isMobile){var M=_(C);T={firstEvent:M};var B=T.firstEvent;B&&!o(B.center)||r.onPinchGesture(M)}},w=function(C){if(C.preventDefault(),!isMobile&&T){var M=_(C),B=T.firstEvent;B&&!o(B.center)||r.onPinchGesture(M)}},R=function(C){if(C.preventDefault(),!isMobile&&T){var M=_(C),B=T.firstEvent;T=null,!(B&&!o(B.center))&&r.onPinchGesture(M)}},I=function(C){if(C&&typeof C.preventDefault=="function"&&C.currentTarget===e&&C.preventDefault(),typeof getSelection=="function"){var M=getSelection();M&&M.focusNode&&(M.removeAllRanges&&M.removeAllRanges(),M.empty&&M.empty())}};this.enableWheel&&e.addEventListener("wheel",g,{passive:!1}),e.addEventListener("mousemove",m,!1),e.addEventListener("mouseout",E,!1),e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchend",b,!1),e.addEventListener("touchcancel",b,!1),e.addEventListener("mousedown",A,!1),e.addEventListener("mouseup",b,!1),e.addEventListener("gesturestart",S,{passive:!1}),e.addEventListener("gesturechange",w,{passive:!1}),e.addEventListener("gestureend",R,{passive:!1}),e.addEventListener("touchstart",I,{passive:!1}),e.addEventListener("contextmenu",I,!1);var H=function(){s.destroy(),e.removeEventListener("wheel",g,!1),e.removeEventListener("mousemove",m,!1),e.removeEventListener("mouseout",E,!1),e.removeEventListener("touchstart",v,!1),e.removeEventListener("touchend",b,!1),e.removeEventListener("touchcancel",b,!1),e.removeEventListener("mousedown",A,!1),e.removeEventListener("mouseup",b,!1),e.removeEventListener("gesturestart",S,!1),e.removeEventListener("gesturechange",w,!1),e.removeEventListener("gestureend",R,!1),e.removeEventListener("touchstart",I,!1),e.removeEventListener("contextmenu",I,!1)};return Object.assign(H,{element:e})},t})(Subscribe),sharedGeometry$2=new THREE__namespace.CircleBufferGeometry(.1,16),vertexShader$1=`
1611
1611
  varying vec2 vUv;
1612
1612
  #include <common>
1613
1613
  #include <logdepthbuf_pars_vertex>
@@ -1672,7 +1672,7 @@ void main() {
1672
1672
  vec3 panoToVertex = normalize(vFinalPosition.xyz);
1673
1673
  gl_FragColor = textureCube(map, vec3(FLIP_CUBE_MAP * panoToVertex.x, panoToVertex.yz));
1674
1674
  }
1675
- `,BoudningMaterial=(function(n){__extends(t,n);function t(){var e=n.call(this,{defines:{},uniforms:{map:{value:null}},vertexShader:BOUNDING_MATERIAL_VERTEX_SHADER,fragmentShader:BOUNDING_MATERIAL_FRAGMENT_SHADER,transparent:!1})||this;return defineProperty(e,"map",{get:function(){return this.uniforms.map.value},set:function(r){this.uniforms.map.value=r}}),e}return t})(THREE__namespace.ShaderMaterial),BoundingMesh=(function(n){__extends(t,n);function t(){var e=n.call(this,boundingGeometry,new BoudningMaterial)||this;return e.disposed=!1,e.frustumCulled=!1,e.renderOrder=9999,e}return t.prototype.update=function(e,r){if(this.disposed){this.material.map=null,this.material.visible=!1;return}this.material.map=r,this.material.visible=r!==null},t.prototype.dispose=function(){this.disposed=!0,this.material.dispose()},t})(THREE__namespace.Mesh),Tiling=(function(){function n(t){this.forceRenderWhenNextUpdate=!0,this.fiveId=t.fiveId,this.disposed=!1,this.level=0,this.pedding=0,this.maxRequest=1,this.appearDuration=.5,this.maxCacheTile=48,this.imageOptions={},this.boundingMesh=new BoundingMesh,this.boundingMesh.frustumCulled=!1,this.textureLoader=new TextureLoader,this.observer=null,this.tileTree=createTileCubeTree(0),this.tileMeshes=new Map,this.frustum=new THREE__namespace.Frustum,this.scene=new THREE__namespace.Scene,this.camera=new THREE__namespace.PerspectiveCamera(90,1,.1,100),this.scene.add(this.boundingMesh),this.renderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1,generateMipmaps:!1,magFilter:THREE__namespace.LinearFilter,minFilter:THREE__namespace.LinearFilter,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping})}return n.prototype.dispose=function(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.scene.dispose(),this.disposed=!0},n.prototype.cleanup=function(){var t=this;this.tileMeshes.forEach(function(e){e.dispose(),t.scene.remove(e)}),this.tileMeshes.clear(),this.forceRenderWhenNextUpdate=!0},n.prototype.setObserver=function(t){var e,r,o,s;if(!this.disposed&&this.observer!==t){this.cleanup(),this.observer=t;var u=(s=(o=(r=(e=this.observer)===null||e===void 0?void 0:e.images.tiles)===null||r===void 0?void 0:r.slice().sort(function(l,c){return c.level-l.level})[0])===null||o===void 0?void 0:o.level)!==null&&s!==void 0?s:0;this.tileTree=createTileCubeTree(u)}},n.prototype.update=function(t){var e=this,r=this.forceRenderWhenNextUpdate;if(this.disposed)return r;var o=t.time,s=t.resolution,u=t.pixelRatio,l=t.renderer,c=t.cameraMatrix,f=t.cameraProjectionMatrix,p=t.panoMap,d=t.panoMatrix,h=t.panoZoom,g=t.minLevel,m=t.level;if(this.boundingMesh.update(o,p),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),r=!0),!1;this.level=clamp$1(m,0,this.tileTree.maxLevel);var E=Math.floor(s.width*u),y=Math.floor(s.height*u),v=Math.max(E,y),A=l.capabilities.maxTextureSize;v>A&&(E=Math.floor(E/v*A),y=Math.floor(y/v*A)),(this.renderTarget.width!==E||this.renderTarget.height!==y)&&this.renderTarget.setSize(E,y),this.scene.matrix.equals(d)||(this.scene.matrix.copy(d),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,r=!0);var b=scratchCameraQuaternion.setFromRotationMatrix(c),T=scratchCameraMatrix.compose(this.scene.position,b,this.scene.scale);this.camera.matrix.equals(T)||(this.camera.matrix.copy(T),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(b),this.camera.scale.copy(this.scene.scale),r=!0);var _=scratchCameraProjectMatrix.copy(f);_.elements[0]*=h,_.elements[5]*=h,this.camera.projectionMatrix.equals(_)||(this.camera.projectionMatrix.copy(_),this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix),r=!0),scratchSceneQuaternionInverse.copy(this.scene.quaternion).inverse(),scratchSceneMatrixInverse.makeRotationFromQuaternion(scratchSceneQuaternionInverse),scratchFrustumMatrix.copy(this.camera.matrix),scratchFrustumMatrix.setPosition(0,0,0),scratchFrustumMatrix.premultiply(scratchSceneMatrixInverse),scratchFrustumMatrixInverse.getInverse(scratchFrustumMatrix),scratchFrustumProjectMatrix.multiplyMatrices(this.camera.projectionMatrix,scratchFrustumMatrixInverse),this.frustum.setFromProjectionMatrix(scratchFrustumProjectMatrix);var S=this.frustum.planes[5].normal,w=[];m>=g&&traverseTileCubeNode(this.tileTree,function(K){if(!(K.level<g)){if(K.level>m||!e.frustum.intersectsBox(K.box))return!1;w.push(K)}});var R=new WeakMap;w.sort(function(K,se){if(K.level!==se.level)return K.level-se.level;var W=R.get(K);W===void 0&&(W=K.box.getCenter(scratchSortVector3).angleTo(S),R.set(K,W));var X=R.get(se);return X===void 0&&(X=se.box.getCenter(scratchSortVector3).angleTo(S),R.set(se,X)),W-X});var I=new WeakSet,H=this.observer.images.tiles;if(H)for(var C=function(K){var se=H.find(function(me){return me.level===K.level});if(!se)return"continue";I.add(K);var W=M.tileMeshes.get(K);if(W){W.appearDuration=M.appearDuration;var X=W.updateTime(o);return X&&(r=!0),"continue"}if(M.pedding>=M.maxRequest)return"continue";var te=Math.pow(2,K.level)*K.position.y,Z=Math.pow(2,K.level)*K.position.x,ne=panoStringify({panoIndex:M.observer.panoIndex,workCode:M.observer.work.workCode}),pe="".concat(ne,".").concat(K.face,".").concat(K.level,".").concat(te,".").concat(Z),ie=se.work.getURL(se[K.face]),ue=se.size,be=M.imageOptions.transform,oe=__assign(__assign({},pick(M.imageOptions,["format","sharpen","forceUseExifOrientation","mappings"])),{key:"pano_tile.".concat(pe),size:se.scale>=1?void 0:ue*K.size*se.scale,cut:K.size===1?void 0:[ue*K.position.x,ue*K.position.y,ue*K.size,ue*K.size]});K.level===1&&se.scale>=.5&&(oe.format==="jpg"||/\.jpg$/.test(ie))&&(oe.size=void 0,oe.quality||(oe.quality=70)),K.size===1&&console.warn("tile: ".concat(oe.key," should not appear.")),M.pedding++;var le=M.textureLoader.loadTexture(ie,{imageURL:{transform:be,options:oe},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(M.fiveId,M.observer.work)}).then(function(me){return me.body});le.then(function(me){return initTexture(me,l)}).then(function(me){return e.pedding--,me},function(me){return e.pedding--,Promise.reject(me)}),W=new TileMesh(K,le),W.name="tiling:tile-".concat(pe),W.visible=!1,W.appearDuration=M.appearDuration,M.tileMeshes.set(K,W),M.scene.add(W),W.updateTime(o),r=!0},M=this,B=0,L=w;B<L.length;B++){var O=L[B];C(O)}var k=[],D=[];this.tileMeshes.forEach(function(K,se){I.has(se)?k.push(K):D.push(K);var W=se.level>=g&&se.level<=m;K.visible!==W&&(K.visible=W,r=!0)});for(var q=D.sort(function(K,se){return se.activeTime-K.activeTime}).slice(Math.max(0,this.maxCacheTile-k.length)),z=0,V=q;z<V.length;z++){var Q=V[z];this.tileMeshes.delete(Q.node),this.scene.remove(Q),Q.dispose(),r=!0}if(r){var U=l.getRenderTarget();scratchPrevClearColor$1.copy(l.getClearColor());var j=l.getClearAlpha(),G=l.autoClear,ae=l.autoClearColor,re=l.autoClearDepth,$=l.autoClearStencil,ee=l.clippingPlanes;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,l.clippingPlanes=clippingPlanes,l.setRenderTarget(this.renderTarget),l.setClearColor(clearColor$1,clearAlpha),l.render(this.scene,this.camera),l.setRenderTarget(U),l.setClearColor(scratchPrevClearColor$1,j),l.autoClear=G,l.autoClearColor=ae,l.autoClearDepth=re,l.autoClearStencil=$,l.clippingPlanes=ee}return this.forceRenderWhenNextUpdate=!1,r},n})(),ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),sharedGeometry$1=createSimpleBoxBufferGeometry(2,2,2);sharedGeometry$1.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var PANO_VIDEO_MATERIAL_VERTEX_SHADER=`
1675
+ `,BoudningMaterial=(function(n){__extends(t,n);function t(){var e=n.call(this,{defines:{},uniforms:{map:{value:null}},vertexShader:BOUNDING_MATERIAL_VERTEX_SHADER,fragmentShader:BOUNDING_MATERIAL_FRAGMENT_SHADER,transparent:!1})||this;return defineProperty(e,"map",{get:function(){return this.uniforms.map.value},set:function(r){this.uniforms.map.value=r}}),e}return t})(THREE__namespace.ShaderMaterial),BoundingMesh=(function(n){__extends(t,n);function t(){var e=n.call(this,boundingGeometry,new BoudningMaterial)||this;return e.disposed=!1,e.frustumCulled=!1,e.renderOrder=9999,e}return t.prototype.update=function(e,r){if(this.disposed){this.material.map=null,this.material.visible=!1;return}this.material.map=r,this.material.visible=r!==null},t.prototype.dispose=function(){this.disposed=!0,this.material.dispose()},t})(THREE__namespace.Mesh),Tiling=(function(){function n(t){this.forceRenderWhenNextUpdate=!0,this.fiveId=t.fiveId,this.disposed=!1,this.level=0,this.pedding=0,this.maxRequest=1,this.appearDuration=.5,this.maxCacheTile=48,this.imageOptions={},this.boundingMesh=new BoundingMesh,this.boundingMesh.frustumCulled=!1,this.textureLoader=new TextureLoader,this.observer=null,this.tileTree=createTileCubeTree(0),this.tileMeshes=new Map,this.frustum=new THREE__namespace.Frustum,this.scene=new THREE__namespace.Scene,this.camera=new THREE__namespace.PerspectiveCamera(90,1,.1,100),this.scene.add(this.boundingMesh),this.renderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1,generateMipmaps:!1,magFilter:THREE__namespace.LinearFilter,minFilter:THREE__namespace.LinearFilter,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping})}return n.prototype.dispose=function(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.scene.dispose(),this.disposed=!0},n.prototype.cleanup=function(){var t=this;this.tileMeshes.forEach(function(e){e.dispose(),t.scene.remove(e)}),this.tileMeshes.clear(),this.forceRenderWhenNextUpdate=!0},n.prototype.setObserver=function(t){var e,r,o,s;if(!this.disposed&&this.observer!==t){this.cleanup(),this.observer=t;var u=(s=(o=(r=(e=this.observer)===null||e===void 0?void 0:e.images.tiles)===null||r===void 0?void 0:r.slice().sort(function(l,c){return c.level-l.level})[0])===null||o===void 0?void 0:o.level)!==null&&s!==void 0?s:0;this.tileTree=createTileCubeTree(u)}},n.prototype.update=function(t){var e=this,r=this.forceRenderWhenNextUpdate;if(this.disposed)return r;var o=t.time,s=t.resolution,u=t.pixelRatio,l=t.renderer,c=t.cameraMatrix,f=t.cameraProjectionMatrix,p=t.panoMap,d=t.panoMatrix,h=t.panoZoom,g=t.minLevel,m=t.level;if(this.boundingMesh.update(o,p),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),r=!0),!1;this.level=clamp$1(m,0,this.tileTree.maxLevel);var E=Math.floor(s.width*u),y=Math.floor(s.height*u),v=Math.max(E,y),A=l.capabilities.maxTextureSize;v>A&&(E=Math.floor(E/v*A),y=Math.floor(y/v*A)),(this.renderTarget.width!==E||this.renderTarget.height!==y)&&this.renderTarget.setSize(E,y),this.scene.matrix.equals(d)||(this.scene.matrix.copy(d),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,r=!0);var b=scratchCameraQuaternion.setFromRotationMatrix(c),T=scratchCameraMatrix.compose(this.scene.position,b,this.scene.scale);this.camera.matrix.equals(T)||(this.camera.matrix.copy(T),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(b),this.camera.scale.copy(this.scene.scale),r=!0);var _=scratchCameraProjectMatrix.copy(f);_.elements[0]*=h,_.elements[5]*=h,this.camera.projectionMatrix.equals(_)||(this.camera.projectionMatrix.copy(_),this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix),r=!0),scratchSceneQuaternionInverse.copy(this.scene.quaternion).inverse(),scratchSceneMatrixInverse.makeRotationFromQuaternion(scratchSceneQuaternionInverse),scratchFrustumMatrix.copy(this.camera.matrix),scratchFrustumMatrix.setPosition(0,0,0),scratchFrustumMatrix.premultiply(scratchSceneMatrixInverse),scratchFrustumMatrixInverse.getInverse(scratchFrustumMatrix),scratchFrustumProjectMatrix.multiplyMatrices(this.camera.projectionMatrix,scratchFrustumMatrixInverse),this.frustum.setFromProjectionMatrix(scratchFrustumProjectMatrix);var S=this.frustum.planes[5].normal,w=[];m>=g&&traverseTileCubeNode(this.tileTree,function(X){if(!(X.level<g)){if(X.level>m||!e.frustum.intersectsBox(X.box))return!1;w.push(X)}});var R=new WeakMap;w.sort(function(X,se){if(X.level!==se.level)return X.level-se.level;var G=R.get(X);G===void 0&&(G=X.box.getCenter(scratchSortVector3).angleTo(S),R.set(X,G));var W=R.get(se);return W===void 0&&(W=se.box.getCenter(scratchSortVector3).angleTo(S),R.set(se,W)),G-W});var I=new WeakSet,H=this.observer.images.tiles;if(H)for(var C=function(X){var se=H.find(function(me){return me.level===X.level});if(!se)return"continue";I.add(X);var G=M.tileMeshes.get(X);if(G){G.appearDuration=M.appearDuration;var W=G.updateTime(o);return W&&(r=!0),"continue"}if(M.pedding>=M.maxRequest)return"continue";var $=Math.pow(2,X.level)*X.position.y,ne=Math.pow(2,X.level)*X.position.x,te=panoStringify({panoIndex:M.observer.panoIndex,workCode:M.observer.work.workCode}),ve="".concat(te,".").concat(X.face,".").concat(X.level,".").concat($,".").concat(ne),oe=se.work.getURL(se[X.face]),fe=se.size,be=M.imageOptions.transform,ie=__assign(__assign({},pick(M.imageOptions,["format","sharpen","forceUseExifOrientation","mappings"])),{key:"pano_tile.".concat(ve),size:se.scale>=1?void 0:fe*X.size*se.scale,cut:X.size===1?void 0:[fe*X.position.x,fe*X.position.y,fe*X.size,fe*X.size]});X.level===1&&se.scale>=.5&&(ie.format==="jpg"||/\.jpg$/.test(oe))&&(ie.size=void 0,ie.quality||(ie.quality=70)),X.size===1&&console.warn("tile: ".concat(ie.key," should not appear.")),M.pedding++;var ue=M.textureLoader.loadTexture(oe,{imageURL:{transform:be,options:ie},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(M.fiveId,M.observer.work)}).then(function(me){return me.body});ue.then(function(me){return initTexture(me,l)}).then(function(me){return e.pedding--,me},function(me){return e.pedding--,Promise.reject(me)}),G=new TileMesh(X,ue),G.name="tiling:tile-".concat(ve),G.visible=!1,G.appearDuration=M.appearDuration,M.tileMeshes.set(X,G),M.scene.add(G),G.updateTime(o),r=!0},M=this,B=0,L=w;B<L.length;B++){var O=L[B];C(O)}var k=[],D=[];this.tileMeshes.forEach(function(X,se){I.has(se)?k.push(X):D.push(X);var G=se.level>=g&&se.level<=m;X.visible!==G&&(X.visible=G,r=!0)});for(var q=D.sort(function(X,se){return se.activeTime-X.activeTime}).slice(Math.max(0,this.maxCacheTile-k.length)),z=0,J=q;z<J.length;z++){var V=J[z];this.tileMeshes.delete(V.node),this.scene.remove(V),V.dispose(),r=!0}if(r){var U=l.getRenderTarget();scratchPrevClearColor$1.copy(l.getClearColor());var j=l.getClearAlpha(),K=l.autoClear,ae=l.autoClearColor,re=l.autoClearDepth,ee=l.autoClearStencil,Z=l.clippingPlanes;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,l.clippingPlanes=clippingPlanes,l.setRenderTarget(this.renderTarget),l.setClearColor(clearColor$1,clearAlpha),l.render(this.scene,this.camera),l.setRenderTarget(U),l.setClearColor(scratchPrevClearColor$1,j),l.autoClear=K,l.autoClearColor=ae,l.autoClearDepth=re,l.autoClearStencil=ee,l.clippingPlanes=Z}return this.forceRenderWhenNextUpdate=!1,r},n})(),ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),sharedGeometry$1=createSimpleBoxBufferGeometry(2,2,2);sharedGeometry$1.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var PANO_VIDEO_MATERIAL_VERTEX_SHADER=`
1676
1676
 
1677
1677
  #if defined(USE_PANO_VIDEO)
1678
1678
  varying vec3 worldPosition;
@@ -1787,7 +1787,7 @@ void main() {
1787
1787
  float cameraDepth = length(cameraVertex);
1788
1788
  gl_FragColor = packDepthToRGBA(clamp(cameraDepth / maxDepth, 0.0, 1.0));
1789
1789
  }
1790
- `,depthMaterial=new THREE__namespace.ShaderMaterial({vertexShader:depthVertexShader,fragmentShader:depthFragmentShader,uniforms:{maxDepth:new THREE__namespace.Uniform(0)}});function renderDepthCube(n,t,e,r){r===void 0&&(r=1e3),depthMaterial.uniforms.maxDepth.value=r,scratchPrevClearColor.copy(n.getClearColor());var o=n.getClearAlpha(),s=t.overrideMaterial;t.overrideMaterial=depthMaterial,n.setClearColor(clearColor,0),e.update(n,t),n.setClearColor(scratchPrevClearColor,o),t.overrideMaterial=s}function defaultEffectEase(n){return n}var scratchRaycaster$1=new THREE__namespace.Raycaster,scratchVector3$3=new THREE__namespace.Vector3,adjustPanoCircleMeshVectors=[new THREE__namespace.Vector3(0,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(1,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,+Math.sqrt(3)/2).multiplyScalar(.1)],defaultPanoramaControllerCustomInitArgs=__assign(__assign({},defaultPanoramaLikeControllerCustomInitArgs),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:function(n,t){var e=n.position.distanceTo(n.standingPosition);return e>t.aerialObserverMinHeight?new PanoCircleMeshSolid:new PanoCircleMesh},adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:(function(n,t){var e,r=function(l){return l/180*Math.PI},o=(e=Math.log2)!==null&&e!==void 0?e:(function(l){return Math.log(l)*Math.LOG2E}),s=t.height/2/Math.tan(r(n/2))*Math.tan(r(45))*2,u=Math.max(o(s/512),0);return u<2.3&&u>.1&&(u=1),u=u%1>.75?Math.ceil(u):Math.floor(u),u}),tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),PanoramaController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="Panorama",r.initAnimationed=!1,r.maxAccessibleDistance=o.maxAccessibleDistance,r.panoTapTriggerRadius=o.panoTapTriggerRadius,r.panoCircleMeshCreator=o.panoCircleMeshCreator,r.adjustPanoCircleMeshPositionBasedOnModel=o.adjustPanoCircleMeshPositionBasedOnModel,r.tileLevelForFov=o.tileLevelForFov,r.tileAppearDuration=o.tileAppearDuration,r.tileMaxRequest=o.tileMaxRequest,r.flyEffectUseDepthBuffer=o.flyEffectUseDepthBuffer,r.adjustPanoCircleMeshPositionFix=new Map;var s=r.modelScene.parameter.resolveValue(),u=s.pano0,l=s.pano1;u&&(l==null?void 0:l.map)!==u.map&&(r.modelScene.parameter.set({pano0:l}),u.map.dispose());var c=new Set;return u&&c.add(u),l&&c.add(l),r.panoMeshes=new Map,r.locationMotion=new Motion({count:0,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),panoPicture:r.modelScene.parameter.resolveValue().pano1,position:r.camera.pose.offset.clone(),effect:"fly",effectEasing:defaultEffectEase,fixCameraTransform:new THREE__namespace.Matrix4},r.panoPictureObserverMap=new WeakMap,r.textureLoader=new TextureLoader,r.tiling=new Tiling({fiveId:r.fiveId}),r.panoVideo=new PanoVideo,r.scene.add(r.panoVideo.object),r.accessibleObserverFloorCheckCount=0,r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,p;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{maxAccessibleDistance:(r=e.maxAccessibleDistance)!==null&&r!==void 0?r:defaultPanoramaControllerCustomInitArgs.maxAccessibleDistance,panoTapTriggerRadius:(o=e.panoTapTriggerRadius)!==null&&o!==void 0?o:defaultPanoramaControllerCustomInitArgs.panoTapTriggerRadius,panoCircleMeshCreator:(s=e.panoCircleMeshCreator)!==null&&s!==void 0?s:defaultPanoramaControllerCustomInitArgs.panoCircleMeshCreator,adjustPanoCircleMeshPositionBasedOnModel:(u=e.adjustPanoCircleMeshPositionBasedOnModel)!==null&&u!==void 0?u:defaultPanoramaControllerCustomInitArgs.adjustPanoCircleMeshPositionBasedOnModel,tileLevelForFov:(l=e.tileLevelForFov)!==null&&l!==void 0?l:defaultPanoramaControllerCustomInitArgs.tileLevelForFov,tileAppearDuration:(c=e.tileAppearDuration)!==null&&c!==void 0?c:defaultPanoramaControllerCustomInitArgs.tileAppearDuration,tileMaxRequest:(f=e.tileMaxRequest)!==null&&f!==void 0?f:defaultPanoramaControllerCustomInitArgs.tileMaxRequest,flyEffectUseDepthBuffer:(p=e.flyEffectUseDepthBuffer)!==null&&p!==void 0?p:defaultPanoramaControllerCustomInitArgs.flyEffectUseDepthBuffer})},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"Panorama"})},Object.defineProperty(t.prototype,"tileLevel",{get:function(){return this.tiling.level},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e){var r=this,o=n.prototype.updateConfiguration.call(this,e);return o===!1?!1:(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,this.panoMeshes&&(this.panoMeshes.forEach(function(s){r.helper.remove(s),s.dispose()}),this.panoMeshes.clear())),e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)},t.prototype.destroy=function(){var e=this;n.prototype.destroy.call(this),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),this.pendingTextureTask=void 0,this.panoMeshes&&(this.panoMeshes.forEach(function(h){e.helper.remove(h),h.dispose()}),this.panoMeshes.clear());var r=this.videoTexture.image;r.pause(),r.oncanplay=noop,r.ontimeupdate=noop,this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=this.modelScene.parameter.resolveValue(),s=o.pano0,u=o.pano1,l=0,c=Object.keys(this.panoResources);l<c.length;l++){var f=c[l],p=this.panoResources[f];if(p.panoPicture){var d=p.panoPicture.map;d&&d!==(s==null?void 0:s.map)&&d!==(u==null?void 0:u.map)&&(d.dispose(),p.panoPicture=null)}delete this.panoResources[f]}},t.prototype.isReady=function(){return this.locationMotion.ended!==!0?!1:n.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e=this.tiling.pedding,r=e<=0;return this.initAnimationed&&r},t.prototype.updateWork=function(e,r,o,s){var u=this;this.userAction=s,this.works=e;var l=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));return(l.workCode!==this.currentPano.workCode||l.panoIndex!==this.currentPano.panoIndex||l.longitude!==this.cameraMotion.value.longitude||l.latitude!==this.cameraMotion.value.latitude||l.fov!==this.cameraMotion.value.fov)&&(this.initAnimationed=!1,this.moveToPano({workCode:l.workCode,panoIndex:l.panoIndex},{effect:o.effect,duration:o.duration,longitude:l.longitude,latitude:l.latitude,fov:l.fov,moveEndCallback:function(){u.initAnimationed=!0},moveCancelCallback:function(){u.initAnimationed=!0}},s)),!0},t.prototype.updateModel=function(e){this.modelScene=e,this.hideIntersectMesh()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,p;if(!this.destroyed){var d={},h={},g=this.camera.getDirection(new THREE__namespace.Vector3),m=this.locationMotion.keyframes[0],E=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],y=this.locationMotion.getKeyFrameSegment(e),v=y[0],A=y[1],b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(A),_=this.panoResourceFromLocationMotionKeyframe(m),S=this.panoResourceFromLocationMotionKeyframe(E),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),h.longitude=this.cameraMotion.value.longitude,h.latitude=this.cameraMotion.value.latitude,h.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var R=this.locationMotion.value.count-A.value.count+1,I=new THREE__namespace.Vector3().copy(b.position),H=new THREE__namespace.Vector3().copy(T.position);if(d.progress=T.effectEasing(R),R>=.01&&R<=.99&&(d.progress=clamp$1(T.effectEasing(R),.01,.99)),T.panoPicture&&(R<1?b.panoPicture&&(d.pano0=b.panoPicture):d.pano0=T.panoPicture,d.pano1=T.panoPicture),T.effect==="montage"?d.transition="BLACK":T.effect==="spread"?d.transition="SPREAD":d.transition="FADE",T.effect==="zoomin"||T.effect==="zoomout")d.progress=Math.pow(R,3);else if(T.effect==="model"&&this.camera.pose.distance<.01){var C=1-Math.pow(clamp$1(Math.abs(R-.5)*2,0,1),4);d.modelAlpha=C}if(R<1&&T.effect!=="fly"&&T.effect!=="model"){if(d.pano0&&b.panoPicture){var M={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:b.panoPicture.matrix.clone().premultiply(b.fixCameraTransform).setPosition(T.position)},B=this.panoPictureObserverMap.get(d.pano0);B&&this.panoPictureObserverMap.set(M,B),d.pano0=M}I.copy(H),w=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(I.x+(H.x-I.x)*R,I.y+(H.y-I.y)*R,I.z+(H.z-I.z)*R);for(var L=[],O=[],k=0,D=this.locationMotion.keyframes;k<D.length;k++){var q=D[k],z=q.key,V=q.progress;z!==void 0&&(L.push(z),V>this.locationMotion.progress&&O.push(z))}for(var Q=0,U=Object.keys(this.panoResources);Q<U.length;Q++){var j=U[Q];if(!(O.indexOf(j)>=0)){var G=this.panoResources[j];if(G.panoPicture){var ae=G.panoPicture.map;if(ae){if(ae===((s=d.pano0)===null||s===void 0?void 0:s.map)||ae===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;ae.dispose(),G.panoPicture=null}}L.indexOf(j)>=0||delete this.panoResources[j]}}var re=panoParse(T.panoId);re!==this.currentPano&&(this.currentPano=re,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(_.panoId),state:__assign(__assign(__assign(__assign({},panoParse(S.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),isEmptyObject(h)===!1&&this.setCamera(h);var $=this.works.getObserver(this.currentPano),ee=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,K=this.works.getObserver(b.panoId),se=this.works.getObserver(T.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&$){for(var W=[],X=$.work.observers,te=0,Z=$.accessibleNodes;te<Z.length;te++){var ne=Z[te],B=X[ne];B&&W.push(B)}var pe=new Map;if(W.sort(function(fe,we){var Me=pe.get(fe);typeof Me=="undefined"&&(Me=fe.standingPosition.distanceTo($.standingPosition),pe.set(fe,Me));var ke=pe.get(fe);return typeof ke=="undefined"&&(ke=we.standingPosition.distanceTo($.standingPosition),pe.set(we,ke)),Me-ke}),W.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%W.length;var ie=W[this.accessibleObserverFloorCheckCount],ue=this.modelScene.models.find(function(fe){return fe.work===(ie==null?void 0:ie.work)});if(ie&&ue&&ue.visible){var be=.3,oe=.05,le=.005,me=ie.standingPosition.clone().applyMatrix4(ie.work.transform),ge=panoStringify({panoIndex:ie.panoIndex,workCode:ie.work.workCode}),Ae=adjustPanoCircleMeshVectors.map(function(fe){scratchRaycaster$1.ray.origin.copy(me),scratchRaycaster$1.ray.origin.add(scratchVector3$3.copy(fe).setY(be)),scratchRaycaster$1.ray.direction.set(0,-1,0),scratchRaycaster$1.firstHitOnly=!0,scratchRaycaster$1.floorIndex=-1;var we=ue.intersectRaycaster(scratchRaycaster$1)[0];return we&&we.distance-le<=be?new THREE__namespace.Vector3().copy(me).setY(we.point.y+le):me});Ae.sort(function(fe,we){return we.y-fe.y});var xe=Ae[Math.floor(Ae.length/2)],he=Ae.filter(function(fe){return fe.distanceTo(xe)<=oe})[0];if(he){var _e=new THREE__namespace.Vector4(me.x,me.y,me.z,he.y-me.y),He=this.adjustPanoCircleMeshPositionFix.get(ge);He&&!_e.equals(He)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(ge,_e)}}this.accessibleObserverFloorCheckCount++}}var Ee=new Map;if(K)for(var de=0,Ve=K.accessibleNodes;de<Ve.length;de++){var ne=Ve[de],B=K.work.observers[ne];if(B){var ge=panoStringify({panoIndex:B.panoIndex,workCode:B.work.workCode});Ee.set(ge,B)}}if(se)for(var ye=0,Pe=se.accessibleNodes;ye<Pe.length;ye++){var ne=Pe[ye],B=se.work.observers[ne];if(B){var ge=panoStringify({panoIndex:B.panoIndex,workCode:B.work.workCode});Ee.set(ge,B)}}if(this.panoMeshes.forEach(function(fe,we){var Me=Ee.get(we);Me?Ee.delete(we):(o.helper.remove(fe),fe.dispose(),o.panoMeshes.delete(we))}),Ee.forEach(function(fe,we){var Me=o.panoCircleMeshCreator(fe,{aerialObserverMinHeight:o.aerialObserverMinHeight});o.panoMeshes.set(we,Me),o.helper.add(Me),Ee.delete(we)}),this.panoMeshes.forEach(function(fe,we){var Me=o.works.getObserver(we);if(Me){var ke=Me.position.distanceTo(Me.standingPosition)>o.aerialObserverMinHeight;if(ke)fe.position.copy(Me.position).applyMatrix4(Me.work.transform),fe.scale.setScalar(18);else{fe.position.copy(Me.standingPosition).applyMatrix4(Me.work.transform);var je=o.adjustPanoCircleMeshPositionFix.get(Me.panoId);je&&(scratchVector3$3.set(je.x,je.y,je.z),scratchVector3$3.equals(fe.position)&&(fe.position.y+=je.w)),fe.scale.setScalar(1.2)}var st=o.camera.position.clone().setY(fe.position.y),Qe=new THREE__namespace.Vector3().copy(fe.position).sub(st).normalize();if(we===panoStringify(o.currentPano)){var Je=clamp$1((.5-st.distanceTo(fe.position))/.5,0,1);Qe.multiplyScalar(1-Je).add(g.clone().multiplyScalar(Je))}if(Qe.length()>0){var ft=ke?-Math.PI/2:0,Bt=Math.atan2(Qe.x,Qe.z);fe.quaternion.setFromEuler(new THREE__namespace.Euler(ft,Bt,0,"YXZ"))}}else fe.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(function(fe){fe.setOpacity(0),fe.setCurrent(!1),fe.updateTime&&fe.updateTime(e,r),fe.visible=!1});else if($){var Ce=$.work.observers,$e=arrayMin($.accessibleNodes,function(fe){var we=Ce[fe];return we?$.standingPosition.distanceTo(we.standingPosition):1/0},!0),Se=$e[1];Se=clamp$1(Se,3,1/0);var ze=$.accessibleNodes.concat($.panoIndex).map(function(fe){return panoStringify({panoIndex:fe,workCode:$.work.workCode})});this.panoMeshes.forEach(function(fe,we){var Me=o.works.getObserver(we),ke=!1,je=1;if(ze.indexOf(we)===-1)ke=!1,je=0;else if(!Me)ke=!1,je=0;else if(!Me.loadable&&!Me.active)ke=!1,je=0;else{var st=fe.position.clone().project(o.camera),Qe=Math.abs(st.x)<1&&Math.abs(st.y)<1&&Math.abs(st.z)<1;ke=Qe&&!fe.loading&&fe.progress===0&&ee!==null&&panoStringify({panoIndex:ee.panoIndex,workCode:ee.work.workCode})===we;var Je=fe.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);je=Je<.01?0:clamp$1(Se/Je,.1,.85)}if(Me&&Me===se){var ft=Me.position.distanceTo(Me.standingPosition)>o.aerialObserverMinHeight;if(ft){var Je=fe.position.distanceTo(o.camera.position);Je<35&&(je=0)}}o.modelScene.parameter.resolveValue().modelAlpha>0&&(je=0),fe.setCurrent(ke),fe.setOpacity(je),fe.updateTime&&fe.updateTime(e,r)})}{var R=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,Fe=Math.round(R),Oe=this.modelScene.parameter.pano0,Le=this.modelScene.parameter.pano1,Ue=Fe===0?Oe:Le,B=void 0;if(Ue&&(B=this.works.getObserver(Ue.panoId),B||(B=this.panoPictureObserverMap.get(Ue))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=R<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!B||!Ue||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var tt={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(tt),this.modelScene.parameter.set("refinedScreen",null)}else{var lt=getImageSizeLevel(Ue.mapSize),nt=lt+1,ot=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),At=Math.floor(this.tileLevelForFov(this.camera.fov,ot)),We=At>lt?At:0;this.tiling.setObserver(B);var tt={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:Ue.map,panoMatrix:Ue.matrix,panoZoom:Ue.zoom,minLevel:nt,level:We},Mt=this.tiling.update(tt),Be={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Fe,opacity:(Oe==null?void 0:Oe.panoId)===(Le==null?void 0:Le.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Ne=this.modelScene.parameter.refinedScreen;(Mt||Be.pano!==(Ne==null?void 0:Ne.pano)||Be.opacity!==(Ne==null?void 0:Ne.opacity))&&this.modelScene.parameter.set("refinedScreen",Be)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),$&&$.images.video&&(this.needsRender=!0),this.intersectMesh&&this.intersectMesh.parent&&$&&$.position.y-$.standingPosition.y>10){var bt=this.camera.position.distanceTo(this.intersectMesh.position),Ct=2*Math.tan(.5*this.camera.fov/180*Math.PI),xt=bt*Ct/5;this.intersectMesh.scale.setScalar(xt)}else this.intersectMesh.scale.setScalar(1);{var yt=T.effect,St=this.modelScene.parameter,Oe=St.pano0,Le=St.pano1;if(Oe&&Le&&Oe!==Le&&(yt==="fly"||yt==="model")&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==Oe.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==Le.panoId){var rt=500,at=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==at&&this.pano0DepthCubeRenderTarget.setSize(at,at):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(at,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==at&&this.pano1DepthCubeRenderTarget.setSize(at,at):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(at,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var ct=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);ct.matrix.copy(Oe.matrix),ct.matrixWorld.copy(ct.matrix),ct.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,ct,rt);var Xe=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);Xe.matrix.copy(Le.matrix),Xe.matrixWorld.copy(Xe.matrix),Xe.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Xe,rt),this.modelScene.parameter.set({pano0Depth:{panoId:Oe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:rt},pano1Depth:{panoId:Le.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:rt}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1],o=this.panoResourceFromLocationMotionKeyframe(r),s=this.works.getObserver(o.panoId);return{workCode:s?s.work.workCode:this.currentPano.workCode,panoIndex:s?s.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:s?s.position.clone().applyMatrix4(s.work.transform):this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f=(u=r.effect)!==null&&u!==void 0?u:"fly";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),d=this.works.getObserver(e);if(!d)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));getImageSizeFromURL(d.images.up),this.imageOptions.size;var h=this.imageOptions.transform,g=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality","sharpen","forceUseExifOrientation","mappings"])),m={right:d.images.work.getURL(d.images.right),left:d.images.work.getURL(d.images.left),up:d.images.work.getURL(d.images.up),down:d.images.work.getURL(d.images.down),front:d.images.work.getURL(d.images.front),back:d.images.work.getURL(d.images.back)},E="pano:"+jsonHash([m,g,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===E)return;var y=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(y))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:{panoIndex:d.panoIndex,workCode:d.work.workCode}}))}var v="move-to-pano-"+p;this.pending.add(v);var A=this.modelScene.parameter,b;if(A.pano0&&A.pano0.map.name===E?b=A.pano0:A.pano1&&A.pano1.map.name===E&&(b=A.pano1),b){var T={panoId:p,effect:f,effectEasing:(c=r.effectEasing)!==null&&c!==void 0?c:defaultEffectEase,panoPicture:{panoId:b.panoId,map:b.map,mapSize:b.mapSize,matrix:d.matrix.clone().premultiply(d.work.transform),zoom:1},position:d.position.clone().applyMatrix4(d.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};T.panoPicture&&this.panoPictureObserverMap.set(T.panoPicture,d),this.pendingTextureTask=void 0,AnimationFrameLoop.shared.add(function(){s.pending.delete(v),s.doMoveToPano(e,T,r)},!0,1);return}this.pendingTextureTask={panoId:p,hash:E,onLoad:function(S){var w,R,I=S.body;if(s.destroyed)I.dispose();else{I.name=E;var H=Array.isArray(I.image)?I.image[0]:I.image,C=(w=H==null?void 0:H.width)!==null&&w!==void 0?w:2048,M={panoId:p,effect:f,effectEasing:(R=r.effectEasing)!==null&&R!==void 0?R:defaultEffectEase,panoPicture:{panoId:p,map:I,mapSize:C,matrix:d.matrix.clone().premultiply(d.work.transform),zoom:1},position:d.position.clone().applyMatrix4(d.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};M.panoPicture&&s.panoPictureObserverMap.set(M.panoPicture,d),s.doMoveToPano(e,M,r)}},onError:function(S){var w=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:S,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:S,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("error",S),r.moveCancelCallback&&r.moveCancelCallback()}};var _=this.panoMeshes.get(p);_&&_.tap&&_.tap(),this.textureLoader.loadCubeTexture(m,{imageURL:{transform:h,options:g},format:THREE__namespace.RGBFormat,viaAjax:!0,fetcher:getFetcher(this.fiveId,d.work)},void 0,void 0,function(S){var w,R;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:S,meta:null,pano:e})),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===E&&((R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(S))},this.renderer).then(function(S){var w,R;s.pending.delete(v),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===E?(s.pendingTextureTask.onLoad(S),s.pendingTextureTask=void 0,(R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(0)):S.body.dispose(),s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:S.meta,pano:e}))}).catch(function(S){var w,R;s.pending.delete(v),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===E&&(s.pendingTextureTask.onError(S),s.pendingTextureTask=void 0,(R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(0)),s.emit("pano.texture.error",createEvent("pano.texture.error",{error:S,progress:0,meta:null,pano:e})),s.emit("error",S)}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial,s=o.duration,u=o.effect,l=o.userAction;e.userAction=l;var c=t.initAnimationEndState(e),f={workCode:c.workCode,panoIndex:c.panoIndex},p={modelAlpha:0},d={perspToOrtho:0},h=!1;e.moveToPano(f,{longitude:c.longitude,latitude:c.latitude,fov:c.fov,effect:u,duration:s,moveStartCallback:function(g){h=!0,e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:p}],s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction}))},moveEndCallback:function(g){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()},moveCancelCallback:function(){var g=__assign(__assign(__assign({},f),{mode:e.mode}),clonePose(e.camera.pose));h===!1&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()}},l)})},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var r=0,o=1;o<e.length;o++){var s=this.panoResourceFromLocationMotionKeyframe(e[o-1]).position,u=this.panoResourceFromLocationMotionKeyframe(e[o]).position,l=s.distanceTo(u)*(e[o].value.count-e[o-1].value.count);r+=l}return r},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,m,E,y;o===void 0&&(o={});var v=now(),A=createUuid();this.panoResources[A]=r;var b=1,T,_,S;if(this.locationMotion.ended){var w=this.locationMotion.getKeyFrameSegment(v);w[0];var R=w[1],I=this.locationMotion.value,H=((u=this.panoResourceFromLocationMotionKeyframe(R))!==null&&u!==void 0?u:this.camera).position,C=r.position;T=Math.max(H.distanceTo(C),b),_=[{key:R.key,progress:0,value:__assign(__assign({},I),{count:0})},{key:A,progress:1,value:{distance:0,count:1}}],S=0}else{var M=this.locationMotion.getKeyFrameSegment(v),B=M[0],R=M[1],I=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(B).position,H=this.panoResourceFromLocationMotionKeyframe(R).position,C=r.position,O=R.value.count-I.count,k=Math.max(L.distanceTo(H),b)*O,D=Math.max(H.distanceTo(C),b);T=k+D,_=[{key:B.key,progress:0,value:__assign({},I)},{key:R.key,progress:k/T,value:R.value},{key:A,progress:1,value:{count:R.value.count+1,distance:0}}];var q=this.locationMotionKeyframesLength(this.locationMotion.keyframes),z=this.locationMotionKeyframesLength(_);q===0||q===0?S=0:S=this.locationMotion.getProgressVelocity(v)*q/z}var V=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"||r.effect==="model"?T:0),Q={longitude:o.longitude,latitude:o.latitude,fov:o.fov},U=__assign(__assign({},e),{mode:this.mode,longitude:(l=Q.longitude)!==null&&l!==void 0?l:this.camera.pose.longitude,latitude:(c=Q.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(f=Q.fov)!==null&&f!==void 0?f:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),j=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:j,progress:0,state:U,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(U),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly"||r.effect==="model")this.cameraMotion.set(Q,V).catch(noop);else{var G=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),ae=coordinatesToVector({longitude:(p=Q.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(d=Q.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),re=new THREE__namespace.Object3D;re.lookAt(G);var $=new THREE__namespace.Matrix4().makeRotationFromQuaternion(re.quaternion);re.lookAt(ae);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(re.quaternion),K=new THREE__namespace.Matrix4().getInverse($).premultiply(ee),se=this.cameraMotion.value.fov,W=(h=Q.fov)!==null&&h!==void 0?h:this.cameraMotion.value.fov,X=1;r.effect==="zoomin"?X=1.5:r.effect==="zoomout"&&(X=.4);for(var te=clamp$1(W*X,1,170),Z=0;Z<_.length-1;Z++){var ne=_[Z].key;if(ne){var pe=this.panoResources[ne];pe&&(pe.fixCameraTransform.copy(K),pe.panoPicture&&(pe.panoPicture.zoom=Math.tan(te/2/180*Math.PI)/Math.tan(se/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(g=Q.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(m=Q.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:te}},{progress:1,value:{longitude:(E=Q.longitude)!==null&&E!==void 0?E:this.cameraMotion.value.longitude,latitude:(y=Q.latitude)!==null&&y!==void 0?y:this.cameraMotion.value.latitude,fov:W}}],V).catch(noop)}var ie=this.locationMotion.setKeyframes(_,V,S);ie.then(function(){for(var ue=0,be=s.modelScene.children;ue<be.length;ue++){var oe=be[ue];oe instanceof Model&&oe.show()}var le=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:s.camera.pose.distance});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:j,progress:1,state:le,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(le);var me=s.works.getObserver(e);if(me&&me.images.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var ge={map:s.videoTexture,size:me.images.video.size.clone(),matrix:me.images.video.matrix.clone(),panoMatrix:me.matrix.clone().premultiply(me.work.transform),alpha:1},Ae=createUuid(),xe=s.videoTexture.image;xe.setAttribute("uuid",Ae),xe.oncanplay=noop,xe.ontimeupdate=noop,canplayVideo().then(function(_e){_e&&me.images.video&&xe.getAttribute("uuid")===Ae&&(xe.oncanplay=function(){xe.oncanplay=noop,xe.play()},xe.ontimeupdate=function(){xe.currentTime>.5&&(xe.ontimeupdate=noop,s.panoVideo.setMaterial(ge))},xe.src=me.images.video.source)}).catch((function(){xe.removeAttribute("uuid")}))}else{var he=s.videoTexture.image;he.removeAttribute("uuid"),he.oncanplay=noop,he.ontimeupdate=noop}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:j,progress:0,state:U,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.getForwardObserverOrNot=function(e,r){var o=this,s=this.works.getObserver(this.currentPano);if(!s)return null;var u=r!=null?r:new THREE__namespace.Raycaster(e.position.clone(),e.getWorldDirection(new THREE__namespace.Vector3));u.params.Points={threshold:.1},u.firstHitOnly=!0,u.floorIndex=-1;var l=s.standingPosition.clone().applyMatrix4(s.work.transform),c=s.position.clone().applyMatrix4(s.work.transform);if(c.distanceTo(u.ray.origin)>1){var f=new THREE__namespace.Raycaster(u.ray.origin,new THREE__namespace.Vector3(0,-1,0));f.firstHitOnly=u.firstHitOnly,f.floorIndex=u.floorIndex;var p=this.modelScene.intersectRaycaster(f)[0];p&&p.distance<=2?l.copy(p.point):l.copy(u.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var d=this.modelScene.intersectRaycaster(u)[0],h=d?d.point:u.ray.origin.clone().add(u.ray.direction.clone().normalize().multiplyScalar(3)),g=h.clone().sub(l).normalize();if(g.length()===0)return null;var m=s.work.observers,E=s.accessibleNodes.filter(function(q){if(q===o.currentPano.panoIndex&&s.work.workCode===o.currentPano.workCode)return!1;var z=m[q];if(!z)return!1;var V=z.standingPosition.clone().applyMatrix4(z.work.transform).project(e);return Math.abs(V.z)>1||Math.abs(V.x)>1||Math.abs(V.y)>1?!1:z.loadable||z.active}),y=new Map,v=E.slice().sort(function(q,z){var V=m[q],Q=y.get(V);typeof Q=="undefined"&&(Q=scratchVector3$3.copy(V.standingPosition).applyMatrix4(V.work.transform).distanceTo(l),y.set(V,Q));var U=m[z],j=y.get(U);return typeof j=="undefined"&&(j=scratchVector3$3.copy(U.standingPosition).applyMatrix4(U.work.transform).distanceTo(l),y.set(U,j)),Q-j});y.clear();for(var A=0,b=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];A<b.length;A++)for(var T=b[A],_=0,S=v;_<S.length;_++){var w=S[_],R=m[w];if(R){var I=scratchVector3$3.copy(R.standingPosition).applyMatrix4(R.work.transform).sub(l);if(I&&I.length()!==0&&g.angleTo(I)<T)return R}}var H=null;if(r){var C=r.ray.intersectBox(this.modelScene.boundingBox,scratchVector3$3);C&&(C.project(e),Math.abs(C.z)<=1&&(H=C.clone()))}else H=new THREE__namespace.Vector3(0,0,0);if(H){var M=.4,B=s.accessibleNodes.filter(function(q){if(q===o.currentPano.panoIndex&&s.work.workCode===o.currentPano.workCode)return!1;var z=m[q];if(!z)return!1;var V=z.position.clone().applyMatrix4(z.work.transform).project(e);return Math.abs(V.z)>1||Math.abs(V.x)>1||Math.abs(V.y)>1?!1:z.loadable||z.active}),L=new Map,O=B.slice().sort(function(q,z){var V=m[q],Q=L.get(V);typeof Q=="undefined"&&(Q=scratchVector3$3.copy(V.position).applyMatrix4(V.work.transform).distanceTo(e.position),L.set(V,Q));var U=m[z],j=L.get(U);return typeof j=="undefined"&&(j=scratchVector3$3.copy(U.position).applyMatrix4(U.work.transform).distanceTo(e.position),L.set(U,j)),Q-j});L.clear();for(var k=0,D=O;k<D.length;k++){var w=D[k],R=m[w];if(R){var C=scratchVector3$3.copy(R.position).applyMatrix4(R.work.transform);if(C.project(e),Math.abs(C.z)>1)continue;if(Math.pow(H.x-C.x,2)+Math.pow(H.y-C.y,2)<Math.pow(M,2))return R}}}return null},t.prototype.onTapGesture=function(e){var r=this,o;if(this.userAction=e.userAction,this.stopMomentumMovement(),!!this.initAnimationed){var s=e.center.raycaster;s.floorIndex=-1;var u=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),l=null,c=this.works.getObserver(this.currentPano);if(c){var f=c.work.observers,p=c.accessibleNodes.filter(function(j){if(j===r.currentPano.panoIndex&&c.work.workCode===r.currentPano.workCode)return!1;var G=f[j];if(!G)return!1;var ae=scratchVector3$3.copy(G.position).applyMatrix4(G.work.transform);return ae.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:G.loadable||G.active}),d=this.modelScene.intersectRaycaster(s)[0];if(d){var h=arrayMin(p,function(j){var G=f[j];if(!G)return 1/0;var ae=scratchVector3$3.copy(G.standingPosition).applyMatrix4(G.work.transform);return ae.distanceTo(d.point)},!0),g=h[0],m=h[1];typeof g=="number"&&m<this.panoTapTriggerRadius&&(l=(o=f[g])!==null&&o!==void 0?o:null)}if(l||(l=this.getForwardObserverOrNot(this.camera,s)),l&&l.panoId===panoStringify(this.currentPano)&&(l=null),l&&!this.locationMotion.ended)for(var E=0,y=this.locationMotion.keyframes;E<y.length;E++){var v=y[E],A=this.panoResourceFromLocationMotionKeyframe(v);if(A.panoId===l.panoId){l=null;break}}if(!l)this.emit("gesture.tap",e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{for(var b={},T=Math.PI/6,_=Math.PI/12,S=l.position.clone().applyMatrix4(l.work.transform).setY(0).sub(c.position.clone().applyMatrix4(l.work.transform).setY(0)).normalize(),w=[],R=[],I=[],H=l.work.observers,C=0,M=l.accessibleNodes;C<M.length;C++){var g=M[C];if(l.panoIndex!==g&&!(g===this.currentPano.panoIndex&&l.work.workCode===this.currentPano.workCode)){var B=H[g];if(B){var L=B.position.clone().applyMatrix4(B.work.transform).sub(l.position.clone().applyMatrix4(l.work.transform)).setY(0).normalize();S.angleTo(L)<T&&I.push(L)}}}var O=I.length>0?I:__spreadArray(__spreadArray([],w,!0),R,!0),k=O.slice().sort(function(j,G){return j.angleTo(S)-G.angleTo(S)})[0];if(k&&k.angleTo(u)>_&&(b.longitude=Math.atan2(-k.x,-k.z)),this.cameraMotion.value.latitude<-Math.PI/4){var D=e.state.fov,q=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(D):this.minLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(D):this.maxLatitude,-Math.PI/2,Math.PI/2);b.latitude=clamp$1(0,q,z)}var V=__assign({},e.state);if(V.workCode=l.work.workCode,V.panoIndex=l.panoIndex,b.longitude!==void 0&&(V.longitude=b.longitude),b.latitude!==void 0&&(V.latitude=b.latitude),b.fov!==void 0&&(V.fov=b.fov),V.distance=0,V.offset=l.position.clone(),e.state=V,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:V,userAction:e.userAction,options:b,progress:0,error:null})),l&&!l.active){var Q=panoStringify({panoIndex:l.panoIndex,workCode:l.work.workCode}),U=this.panoMeshes.get(Q);U&&(U.setDisabled(!1),U.setLoading(!0))}l&&l.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:V,options:b,error:null}))}}}}},t})(PanoramaLikeController),DEG_TO_RAD=Math.PI/180,RAD_TO_DEG=180/Math.PI,MIN_TIMESTEP=.001,MAX_TIMESTEP=1,isIOS=(function(){var n=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return n}})(),isSafari=(function(){var n=typeof navigator!="undefined"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return n}})(),isFirefoxAndroid=(function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("Firefox")!==-1&&navigator.userAgent.indexOf("Android")!==-1;return function(){return n}})(),getChromeVersion=(function(){var n=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=n?parseInt(n[1],10):null;return function(){return t}})(),isChromeWithoutDeviceMotion=(function(){var n=!1;if(getChromeVersion()===65){var t=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var e=t[1].split(".");e[0],e[1];var r=e[2],o=e[3];n=parseInt(r,10)===3325&&parseInt(o,10)<148}}return function(){return n}})(),isSafariWithoutDeviceMotion=(function(){var n=isIOS()&&isSafari()&&typeof navigator!="undefined"&&navigator.userAgent.indexOf("13_4")!==-1;return function(){return n}})(),isR7=(function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("R7 Build")!==-1;return function(){return n}})();function isLandscapeMode(){var n=typeof window!="undefined"&&(window.orientation==90||window.orientation==-90);return isR7()?!n:n}function isTimestampDeltaValid(n){return!(isNaN(n)||n<=MIN_TIMESTEP||n>MAX_TIMESTEP)}function getQuaternionAngle(n){if(n.w>1)return 0;var t=2*Math.acos(n.w);return t}var warnOnce=(function(){var n={};return function(t,e){n[t]===void 0&&(console.warn("cardboard: "+e),n[t]=!0)}})();function getOriginFromUrl(n){var t,e=n.indexOf("://");e!==-1?t=e+3:t=0;var r=n.indexOf("/",t);return r===-1&&(r=n.length),n.substring(0,r)}function isInsideCrossOriginIFrame(){if(typeof window=="undefined"||typeof document=="undefined")return!1;var n=window.self!==window.top,t=getOriginFromUrl(document.referrer),e=getOriginFromUrl(window.location.href);return n&&t!==e}var updateEyeViewMatrices=(function(){function n(r,o,s){var u=o?o[0]:0,l=o?o[1]:0,c=o?o[2]:0,f=o?o[3]:1,p=u+u,d=l+l,h=c+c,g=u*p,m=u*d,E=u*h,y=l*d,v=l*h,A=c*h,b=f*p,T=f*d,_=f*h;return r[0]=1-(y+A),r[1]=m+_,r[2]=E-T,r[3]=0,r[4]=m-_,r[5]=1-(g+A),r[6]=v+b,r[7]=0,r[8]=E+T,r[9]=v-b,r[10]=1-(g+y),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function t(r,o,s){var u=s[0],l=s[1],c=s[2],f,p,d,h,g,m,E,y,v,A,b,T;return o===r?(r[12]=o[0]*u+o[4]*l+o[8]*c+o[12],r[13]=o[1]*u+o[5]*l+o[9]*c+o[13],r[14]=o[2]*u+o[6]*l+o[10]*c+o[14],r[15]=o[3]*u+o[7]*l+o[11]*c+o[15]):(f=o[0],p=o[1],d=o[2],h=o[3],g=o[4],m=o[5],E=o[6],y=o[7],v=o[8],A=o[9],b=o[10],T=o[11],r[0]=f,r[1]=p,r[2]=d,r[3]=h,r[4]=g,r[5]=m,r[6]=E,r[7]=y,r[8]=v,r[9]=A,r[10]=b,r[11]=T,r[12]=f*u+g*l+v*c+o[12],r[13]=p*u+m*l+A*c+o[13],r[14]=d*u+E*l+b*c+o[14],r[15]=h*u+y*l+T*c+o[15]),r}function e(r,o){var s=o[0],u=o[1],l=o[2],c=o[3],f=o[4],p=o[5],d=o[6],h=o[7],g=o[8],m=o[9],E=o[10],y=o[11],v=o[12],A=o[13],b=o[14],T=o[15],_=s*p-u*f,S=s*d-l*f,w=s*h-c*f,R=u*d-l*p,I=u*h-c*p,H=l*h-c*d,C=g*A-m*v,M=g*b-E*v,B=g*T-y*v,L=m*b-E*A,O=m*T-y*A,k=E*T-y*b,D=_*k-S*O+w*L+R*B-I*M+H*C;return D?(D=1/D,r[0]=(p*k-d*O+h*L)*D,r[1]=(l*O-u*k-c*L)*D,r[2]=(A*H-b*I+T*R)*D,r[3]=(E*I-m*H-y*R)*D,r[4]=(d*B-f*k-h*M)*D,r[5]=(s*k-l*B+c*M)*D,r[6]=(b*w-v*H-T*S)*D,r[7]=(g*H-E*w+y*S)*D,r[8]=(f*O-p*B+h*C)*D,r[9]=(u*B-s*O-c*C)*D,r[10]=(v*I-A*w+T*_)*D,r[11]=(m*w-g*I-y*_)*D,r[12]=(p*M-f*L-d*C)*D,r[13]=(s*L-u*M+l*C)*D,r[14]=(A*S-v*R-b*_)*D,r[15]=(g*R-m*S+E*_)*D,r):null}return function(r,o,s){n(r,o),s&&t(r,r,s),e(r,r)}})(),SensorSample=(function(){function n(t,e){t===void 0&&(t=new THREE__namespace.Vector3),e===void 0&&(e=0),this.sample=t,this.timestampS=e}return n.prototype.set=function(t,e){this.sample=t,this.timestampS=e},n.prototype.copy=function(t){this.set(t.sample,t.timestampS)},n})(),ComplementaryFilter=(function(){function n(t,e){this.kFilter=t,this.isDebug=e,this.currentAccelMeasurement=new SensorSample,this.currentGyroMeasurement=new SensorSample,this.previousGyroMeasurement=new SensorSample,isIOS()?this.filterQ=new THREE__namespace.Quaternion(-1,0,0,1):this.filterQ=new THREE__namespace.Quaternion(1,0,0,1),this.previousFilterQ=new THREE__namespace.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new THREE__namespace.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new THREE__namespace.Vector3,this.measuredGravity=new THREE__namespace.Vector3,this.gyroIntegralQ=new THREE__namespace.Quaternion}return n.prototype.addAccelMeasurement=function(t,e){this.currentAccelMeasurement.set(t,e)},n.prototype.addGyroMeasurement=function(t,e){this.currentGyroMeasurement.set(t,e);var r=e-this.previousGyroMeasurement.timestampS;isTimestampDeltaValid(r)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},n.prototype.getOrientation=function(){return this.filterQ},n.prototype.run_=function(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);var r=new THREE__namespace.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var o=new THREE__namespace.Quaternion;o.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),o.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",RAD_TO_DEG*getQuaternionAngle(o),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var s=new THREE__namespace.Quaternion;s.copy(this.filterQ),s.multiply(o),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},n.prototype.accelToQuaternion_=function(t){var e=new THREE__namespace.Vector3;e.copy(t),e.normalize();var r=new THREE__namespace.Quaternion;return r.setFromUnitVectors(new THREE__namespace.Vector3(0,0,-1),e),r.inverse(),r},n.prototype.gyroToQuaternionDelta_=function(t,e){var r=new THREE__namespace.Quaternion,o=new THREE__namespace.Vector3;return o.copy(t),o.normalize(),r.setFromAxisAngle(o,t.length()*e),r},n})(),PosePredictor=(function(){function n(t,e){this.predictionTimeS=t,this.isDebug=e,this.previousQ=new THREE__namespace.Quaternion,this.previousTimestampS=null,this.deltaQ=new THREE__namespace.Quaternion,this.outQ=new THREE__namespace.Quaternion}return n.prototype.getPrediction=function(t,e,r){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=r,t;var o=new THREE__namespace.Vector3;o.copy(e),o.normalize();var s=e.length();if(s<DEG_TO_RAD*20)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(RAD_TO_DEG*s).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var u=s*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(o,u),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=r,this.outQ},n})(),Distortion=(function(){function n(t){this.coefficients=t}return n.prototype.distortInverse=function(t){for(var e=0,r=1,o=t-this.distort(e);Math.abs(r-e)>1e-4;){var s=t-this.distort(r),u=r-s*((r-e)/(s-o));e=r,r=u,o=s}return r},n.prototype.distort=function(t){for(var e=t*t,r=0,o=0;o<this.coefficients.length;o++)r=e*(r+this.coefficients[o]);return(r+1)*t},n})(),Pose=(function(){function n(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}return n})(),FieldOfView=(function(){function n(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}return n})(),Sensor=(function(){function n(t,e,r,o){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new THREE__namespace.Vector3,this.gyroscope=new THREE__namespace.Vector3,this.filter=new ComplementaryFilter(t,o),this.posePredictor=new PosePredictor(e,o),this.isFirefoxAndroid=isFirefoxAndroid(),this.isIOS=isIOS();var s=getChromeVersion();this.isDeviceMotionInRadians=!this.isIOS&&s!==null&&s<66,this.isWithoutDeviceMotion=isChromeWithoutDeviceMotion()||isSafariWithoutDeviceMotion(),this.filterToWorldQ=new THREE__namespace.Quaternion,isIOS()?this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new THREE__namespace.Quaternion,this.worldToScreenQ=new THREE__namespace.Quaternion,this.originalPoseAdjustQ=new THREE__namespace.Quaternion;var u=typeof window!="undefined"?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),u),this.setScreenTransform_(),isLandscapeMode()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new THREE__namespace.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return n.prototype.getPosition=function(){return null},n.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(function(){var s=new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,0,-1),0),u=new THREE__namespace.Quaternion;return typeof window!="undefined"&&window.orientation===-90?u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/-2):u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/2),s.multiply(u)})(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||(function(){var s=new THREE__namespace.Quaternion;return s.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),s})(),t=this._deviceOrientationQ;var e=new THREE__namespace.Quaternion;return e.copy(t),e.multiply(this.deviceOrientationFilterToWorldQ),e.multiply(this.resetQ),e.multiply(this.worldToScreenQ),e.multiplyQuaternions(this.deviceOrientationFixQ,e),this.yawOnly&&(e.x=0,e.z=0,e.normalize()),this.orientationOut_[0]=e.x,this.orientationOut_[1]=e.y,this.orientationOut_[2]=e.z,this.orientationOut_[3]=e.w,this.orientationOut_}else{var r=this.filter.getOrientation();t=this.posePredictor.getPrediction(r,this.gyroscope,this.previousTimestampS)}var o=new THREE__namespace.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(t),o.multiply(this.worldToScreenQ),this.yawOnly&&(o.x=0,o.z=0,o.normalize()),this.orientationOut_[0]=o.x,this.orientationOut_[1]=o.y,this.orientationOut_[2]=o.z,this.orientationOut_[3]=o.w,this.orientationOut_},n.prototype.getPose=function(){var t=new Pose;return t.orientation=this.getOrientation(),t},n.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),isLandscapeMode()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},n.prototype.getFrameData=function(t){var e=this.getOrientation(),r=this.getEyeOffset(),o=this.getEyeProjectionMatrix();return t.pose.angularAcceleration=null,t.pose.angularVelocity=null,t.pose.linearAcceleration=null,t.pose.linearVelocity=null,t.pose.orientation=e,t.pose.position=null,t.timestamp=this.previousTimestampS,t.leftProjectionMatrix.set(o.left),t.rightProjectionMatrix.set(o.right),updateEyeViewMatrices(t.leftViewMatrix,e,r.left),updateEyeViewMatrices(t.rightViewMatrix,e,r.right),t},n.prototype.start=function(){if(typeof window=="undefined")return function(){};var t=this.onDeviceMotion_.bind(this),e=this.onOrientationChange_.bind(this),r=this.onMessage_.bind(this),o=this.onDeviceOrientation_.bind(this);return isIOS()&&isInsideCrossOriginIFrame()&&window.addEventListener("message",r),window.addEventListener("orientationchange",e),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",o):window.addEventListener("devicemotion",t),function(){window.removeEventListener("devicemotion",t),window.removeEventListener("deviceorientation",e),window.removeEventListener("orientationchange",e),window.removeEventListener("message",r)}},n.prototype.getEyeOffset=function(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}},n.prototype.getEyeProjectionMatrix=function(){var t=this.getEyeFieldOfView(),e=this.depthNear,r=this.depthFar,o={left:[],right:[]};{var s=t.left.upDegrees*DEG_TO_RAD,u=t.left.downDegrees*DEG_TO_RAD,l=t.left.leftDegrees*DEG_TO_RAD,c=t.left.rightDegrees*DEG_TO_RAD,f=2/(l+c),p=2/(s+u);o.left[0]=f,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=p,o.left[6]=0,o.left[7]=0,o.left[8]=-((l-c)*f*.5),o.left[9]=(s-u)*p*.5,o.left[10]=r/(e-r),o.left[11]=-1,o.left[12]=0,o.left[13]=0,o.left[14]=r*e/(e-r),o.left[15]=0}{var s=t.right.upDegrees*DEG_TO_RAD,u=t.right.downDegrees*DEG_TO_RAD,l=t.right.leftDegrees*DEG_TO_RAD,c=t.right.rightDegrees*DEG_TO_RAD,f=2/(l+c),p=2/(s+u);o.right[0]=f,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=p,o.right[6]=0,o.right[7]=0,o.right[8]=-((l-c)*f*.5),o.right[9]=(s-u)*p*.5,o.right[10]=r/(e-r),o.right[11]=-1,o.right[12]=0,o.right[13]=0,o.right[14]=r*e/(e-r),o.right[15]=0}return o},n.prototype.getEyeFieldOfView=function(){var t=this.viewer,e=this.device,r=new Distortion(t.distortionCoefficients),o=t.screenLensDistance,s=(e.widthMeters-t.interLensDistance)/2,u=t.interLensDistance/2,l=t.baselineLensDistance-e.bevelMeters,c=e.heightMeters-l,f=RAD_TO_DEG*Math.atan(r.distort(s/o)),p=RAD_TO_DEG*Math.atan(r.distort(u/o)),d=RAD_TO_DEG*Math.atan(r.distort(l/o)),h=RAD_TO_DEG*Math.atan(r.distort(c/o)),g=new FieldOfView,m=new FieldOfView;return g.leftDegrees=Math.min(f,t.fov),g.rightDegrees=Math.min(p,t.fov),g.downDegrees=Math.min(d,t.fov),g.upDegrees=Math.min(h,t.fov),m.leftDegrees=g.rightDegrees,m.rightDegrees=g.leftDegrees,m.upDegrees=g.upDegrees,m.downDegrees=g.downDegrees,{left:g,right:m}},n.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new THREE__namespace.Quaternion;var e=t.alpha,r=t.beta,o=t.gamma;e=(e||0)*Math.PI/180,r=(r||0)*Math.PI/180,o=(o||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new THREE__namespace.Euler(e,r,-o,"YXZ"))},n.prototype.onDeviceMotion_=function(t){this.updateDeviceMotion_(t)},n.prototype.updateDeviceMotion_=function(t){var e=t.accelerationIncludingGravity,r=t.rotationRate,o=t.timeStamp/1e3,s=o-this.previousTimestampS;if(s<0){warnOnce("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),this.previousTimestampS=o;return}else if(s<=MIN_TIMESTEP||s>MAX_TIMESTEP){warnOnce("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),this.previousTimestampS=o;return}e&&(this.accelerometer.set(-e.x,-e.y,-e.z),r&&(isR7()?this.gyroscope.set(-r.beta,r.alpha,r.gamma):this.gyroscope.set(r.alpha,r.beta,r.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,o)),this.filter.addAccelMeasurement(this.accelerometer,o)),this.previousTimestampS=o},n.prototype.onOrientationChange_=function(){this.setScreenTransform_()},n.prototype.onMessage_=function(t){var e=t.data;if(!(!e||!e.type)){var r=e.type.toLowerCase();r==="devicemotion"&&this.updateDeviceMotion_(e.deviceMotionEvent)}},n.prototype.setScreenTransform_=function(){this.worldToScreenQ.set(0,0,0,1);var t=typeof window!="undefined"?window.orientation:0;switch(t){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),Math.PI/2);break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},n})(),defaultLeftBounds=[0,0,.5,1],defaultRightBounds=[.5,0,.5,1],Cardboard=(function(){function n(t){var e=this;this.renderer=t,this.sensor=new Sensor(.98,.04,!1,!1),this.scale=1,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera;var r=this.sensor.start();this.dispose=function(){var o=e.renderer.getSize(new THREE__namespace.Vector2);e.renderer.setScissor(0,0,o.width,o.height),e.renderer.setViewport(0,0,o.width,o.height),e.renderer.setScissorTest(!1),r()}}return n.prototype.render=function(t,e){var r=this.renderer.getSize(new THREE__namespace.Vector2);if(r.width>r.height){var o=t.autoUpdate;o&&(t.updateMatrixWorld(),t.autoUpdate=!1);var s={x:Math.round(r.width*defaultLeftBounds[0]),y:Math.round(r.height*defaultLeftBounds[1]),width:Math.round(r.width*defaultLeftBounds[2]),height:Math.round(r.height*defaultLeftBounds[3])},u={x:Math.round(r.width*defaultRightBounds[0]),y:Math.round(r.height*defaultRightBounds[1]),width:Math.round(r.width*defaultRightBounds[2]),height:Math.round(r.height*defaultRightBounds[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),e.parent===null&&e.updateMatrixWorld(),e.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),e.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var l=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.left),this.scale),this.cameraR.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.right),this.scale);var c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(s.x,s.y,s.width,s.height),this.renderer.setScissor(s.x,s.y,s.width,s.height),this.renderer.render(t,this.cameraL),this.renderer.setViewport(u.x,u.y,u.width,u.height),this.renderer.setScissor(u.x,u.y,u.width,u.height),this.renderer.render(t,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),o&&(t.autoUpdate=!0)}else this.renderer.render(t,e)},n.prototype.dispose=function(){},n})();const cardboard="data:image/png;base64,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",phone="data:image/png;base64,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";var _a,LOCALE={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},TEXT=typeof navigator!="undefined"&&(_a=LOCALE[navigator.language.split("-")[0]])!==null&&_a!==void 0?_a:LOCALE.zh,CONTENTS=`
1790
+ `,depthMaterial=new THREE__namespace.ShaderMaterial({vertexShader:depthVertexShader,fragmentShader:depthFragmentShader,uniforms:{maxDepth:new THREE__namespace.Uniform(0)}});function renderDepthCube(n,t,e,r){r===void 0&&(r=1e3),depthMaterial.uniforms.maxDepth.value=r,scratchPrevClearColor.copy(n.getClearColor());var o=n.getClearAlpha(),s=t.overrideMaterial;t.overrideMaterial=depthMaterial,n.setClearColor(clearColor,0),e.update(n,t),n.setClearColor(scratchPrevClearColor,o),t.overrideMaterial=s}function defaultEffectEase(n){return n}var scratchRaycaster$1=new THREE__namespace.Raycaster,scratchVector3$3=new THREE__namespace.Vector3,adjustPanoCircleMeshVectors=[new THREE__namespace.Vector3(0,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(1,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,+Math.sqrt(3)/2).multiplyScalar(.1)],defaultPanoramaControllerCustomInitArgs=__assign(__assign({},defaultPanoramaLikeControllerCustomInitArgs),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:function(n,t){var e=n.position.distanceTo(n.standingPosition);return e>t.aerialObserverMinHeight?new PanoCircleMeshSolid:new PanoCircleMesh},adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:(function(n,t){var e,r=function(l){return l/180*Math.PI},o=(e=Math.log2)!==null&&e!==void 0?e:(function(l){return Math.log(l)*Math.LOG2E}),s=t.height/2/Math.tan(r(n/2))*Math.tan(r(45))*2,u=Math.max(o(s/512),0);return u<2.3&&u>.1&&(u=1),u=u%1>.75?Math.ceil(u):Math.floor(u),u}),tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),PanoramaController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="Panorama",r.initAnimationed=!1,r.maxAccessibleDistance=o.maxAccessibleDistance,r.panoTapTriggerRadius=o.panoTapTriggerRadius,r.panoCircleMeshCreator=o.panoCircleMeshCreator,r.adjustPanoCircleMeshPositionBasedOnModel=o.adjustPanoCircleMeshPositionBasedOnModel,r.tileLevelForFov=o.tileLevelForFov,r.tileAppearDuration=o.tileAppearDuration,r.tileMaxRequest=o.tileMaxRequest,r.flyEffectUseDepthBuffer=o.flyEffectUseDepthBuffer,r.adjustPanoCircleMeshPositionFix=new Map;var s=r.modelScene.parameter.resolveValue(),u=s.pano0,l=s.pano1;u&&(l==null?void 0:l.map)!==u.map&&(r.modelScene.parameter.set({pano0:l}),u.map.dispose());var c=new Set;return u&&c.add(u),l&&c.add(l),r.panoMeshes=new Map,r.locationMotion=new Motion({count:0,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),panoPicture:r.modelScene.parameter.resolveValue().pano1,position:r.camera.pose.offset.clone(),effect:"fly",effectEasing:defaultEffectEase,fixCameraTransform:new THREE__namespace.Matrix4},r.panoPictureObserverMap=new WeakMap,r.textureLoader=new TextureLoader,r.tiling=new Tiling({fiveId:r.fiveId}),r.panoVideo=new PanoVideo,r.scene.add(r.panoVideo.object),r.accessibleObserverFloorCheckCount=0,r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,p;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{maxAccessibleDistance:(r=e.maxAccessibleDistance)!==null&&r!==void 0?r:defaultPanoramaControllerCustomInitArgs.maxAccessibleDistance,panoTapTriggerRadius:(o=e.panoTapTriggerRadius)!==null&&o!==void 0?o:defaultPanoramaControllerCustomInitArgs.panoTapTriggerRadius,panoCircleMeshCreator:(s=e.panoCircleMeshCreator)!==null&&s!==void 0?s:defaultPanoramaControllerCustomInitArgs.panoCircleMeshCreator,adjustPanoCircleMeshPositionBasedOnModel:(u=e.adjustPanoCircleMeshPositionBasedOnModel)!==null&&u!==void 0?u:defaultPanoramaControllerCustomInitArgs.adjustPanoCircleMeshPositionBasedOnModel,tileLevelForFov:(l=e.tileLevelForFov)!==null&&l!==void 0?l:defaultPanoramaControllerCustomInitArgs.tileLevelForFov,tileAppearDuration:(c=e.tileAppearDuration)!==null&&c!==void 0?c:defaultPanoramaControllerCustomInitArgs.tileAppearDuration,tileMaxRequest:(f=e.tileMaxRequest)!==null&&f!==void 0?f:defaultPanoramaControllerCustomInitArgs.tileMaxRequest,flyEffectUseDepthBuffer:(p=e.flyEffectUseDepthBuffer)!==null&&p!==void 0?p:defaultPanoramaControllerCustomInitArgs.flyEffectUseDepthBuffer})},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"Panorama"})},Object.defineProperty(t.prototype,"tileLevel",{get:function(){return this.tiling.level},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e){var r=this,o=n.prototype.updateConfiguration.call(this,e);return o===!1?!1:(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,this.panoMeshes&&(this.panoMeshes.forEach(function(s){r.helper.remove(s),s.dispose()}),this.panoMeshes.clear())),e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)},t.prototype.destroy=function(){var e=this;n.prototype.destroy.call(this),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),this.pendingTextureTask=void 0,this.panoMeshes&&(this.panoMeshes.forEach(function(h){e.helper.remove(h),h.dispose()}),this.panoMeshes.clear());var r=this.videoTexture.image;r.pause(),r.oncanplay=noop,r.ontimeupdate=noop,this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=this.modelScene.parameter.resolveValue(),s=o.pano0,u=o.pano1,l=0,c=Object.keys(this.panoResources);l<c.length;l++){var f=c[l],p=this.panoResources[f];if(p.panoPicture){var d=p.panoPicture.map;d&&d!==(s==null?void 0:s.map)&&d!==(u==null?void 0:u.map)&&(d.dispose(),p.panoPicture=null)}delete this.panoResources[f]}},t.prototype.isReady=function(){return this.locationMotion.ended!==!0?!1:n.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e=this.tiling.pedding,r=e<=0;return this.initAnimationed&&r},t.prototype.updateWork=function(e,r,o,s){var u=this;this.userAction=s,this.works=e;var l=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));return(l.workCode!==this.currentPano.workCode||l.panoIndex!==this.currentPano.panoIndex||l.longitude!==this.cameraMotion.value.longitude||l.latitude!==this.cameraMotion.value.latitude||l.fov!==this.cameraMotion.value.fov)&&(this.initAnimationed=!1,this.moveToPano({workCode:l.workCode,panoIndex:l.panoIndex},{effect:o.effect,duration:o.duration,longitude:l.longitude,latitude:l.latitude,fov:l.fov,moveEndCallback:function(){u.initAnimationed=!0},moveCancelCallback:function(){u.initAnimationed=!0}},s)),!0},t.prototype.updateModel=function(e){this.modelScene=e,this.hideIntersectMesh()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,p;if(!this.destroyed){var d={},h={},g=this.camera.getDirection(new THREE__namespace.Vector3),m=this.locationMotion.keyframes[0],E=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],y=this.locationMotion.getKeyFrameSegment(e),v=y[0],A=y[1],b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(A),_=this.panoResourceFromLocationMotionKeyframe(m),S=this.panoResourceFromLocationMotionKeyframe(E),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),h.longitude=this.cameraMotion.value.longitude,h.latitude=this.cameraMotion.value.latitude,h.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var R=this.locationMotion.value.count-A.value.count+1,I=new THREE__namespace.Vector3().copy(b.position),H=new THREE__namespace.Vector3().copy(T.position);if(d.progress=T.effectEasing(R),R>=.01&&R<=.99&&(d.progress=clamp$1(T.effectEasing(R),.01,.99)),T.panoPicture&&(R<1?b.panoPicture&&(d.pano0=b.panoPicture):d.pano0=T.panoPicture,d.pano1=T.panoPicture),T.effect==="montage"?d.transition="BLACK":T.effect==="spread"?d.transition="SPREAD":d.transition="FADE",T.effect==="zoomin"||T.effect==="zoomout")d.progress=Math.pow(R,3);else if(T.effect==="model"&&this.camera.pose.distance<.01){var C=1-Math.pow(clamp$1(Math.abs(R-.5)*2,0,1),4);d.modelAlpha=C}if(R<1&&T.effect!=="fly"&&T.effect!=="model"){if(d.pano0&&b.panoPicture){var M={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:b.panoPicture.matrix.clone().premultiply(b.fixCameraTransform).setPosition(T.position)},B=this.panoPictureObserverMap.get(d.pano0);B&&this.panoPictureObserverMap.set(M,B),d.pano0=M}I.copy(H),w=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(I.x+(H.x-I.x)*R,I.y+(H.y-I.y)*R,I.z+(H.z-I.z)*R);for(var L=[],O=[],k=0,D=this.locationMotion.keyframes;k<D.length;k++){var q=D[k],z=q.key,J=q.progress;z!==void 0&&(L.push(z),J>this.locationMotion.progress&&O.push(z))}for(var V=0,U=Object.keys(this.panoResources);V<U.length;V++){var j=U[V];if(!(O.indexOf(j)>=0)){var K=this.panoResources[j];if(K.panoPicture){var ae=K.panoPicture.map;if(ae){if(ae===((s=d.pano0)===null||s===void 0?void 0:s.map)||ae===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;ae.dispose(),K.panoPicture=null}}L.indexOf(j)>=0||delete this.panoResources[j]}}var re=panoParse(T.panoId);re!==this.currentPano&&(this.currentPano=re,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(_.panoId),state:__assign(__assign(__assign(__assign({},panoParse(S.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),isEmptyObject(h)===!1&&this.setCamera(h);var ee=this.works.getObserver(this.currentPano),Z=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,X=this.works.getObserver(b.panoId),se=this.works.getObserver(T.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&ee){for(var G=[],W=ee.work.observers,$=0,ne=ee.accessibleNodes;$<ne.length;$++){var te=ne[$],B=W[te];B&&G.push(B)}var ve=new Map;if(G.sort(function(ce,we){var Me=ve.get(ce);typeof Me=="undefined"&&(Me=ce.standingPosition.distanceTo(ee.standingPosition),ve.set(ce,Me));var ke=ve.get(ce);return typeof ke=="undefined"&&(ke=we.standingPosition.distanceTo(ee.standingPosition),ve.set(we,ke)),Me-ke}),G.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%G.length;var oe=G[this.accessibleObserverFloorCheckCount],fe=this.modelScene.models.find(function(ce){return ce.work===(oe==null?void 0:oe.work)});if(oe&&fe&&fe.visible){var be=.3,ie=.05,ue=.005,me=oe.standingPosition.clone().applyMatrix4(oe.work.transform),ge=panoStringify({panoIndex:oe.panoIndex,workCode:oe.work.workCode}),Ae=adjustPanoCircleMeshVectors.map(function(ce){scratchRaycaster$1.ray.origin.copy(me),scratchRaycaster$1.ray.origin.add(scratchVector3$3.copy(ce).setY(be)),scratchRaycaster$1.ray.direction.set(0,-1,0),scratchRaycaster$1.firstHitOnly=!0,scratchRaycaster$1.floorIndex=-1;var we=fe.intersectRaycaster(scratchRaycaster$1)[0];return we&&we.distance-ue<=be?new THREE__namespace.Vector3().copy(me).setY(we.point.y+ue):me});Ae.sort(function(ce,we){return we.y-ce.y});var xe=Ae[Math.floor(Ae.length/2)],de=Ae.filter(function(ce){return ce.distanceTo(xe)<=ie})[0];if(de){var _e=new THREE__namespace.Vector4(me.x,me.y,me.z,de.y-me.y),He=this.adjustPanoCircleMeshPositionFix.get(ge);He&&!_e.equals(He)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(ge,_e)}}this.accessibleObserverFloorCheckCount++}}var Ee=new Map;if(X)for(var pe=0,Ve=X.accessibleNodes;pe<Ve.length;pe++){var te=Ve[pe],B=X.work.observers[te];if(B){var ge=panoStringify({panoIndex:B.panoIndex,workCode:B.work.workCode});Ee.set(ge,B)}}if(se)for(var ye=0,Pe=se.accessibleNodes;ye<Pe.length;ye++){var te=Pe[ye],B=se.work.observers[te];if(B){var ge=panoStringify({panoIndex:B.panoIndex,workCode:B.work.workCode});Ee.set(ge,B)}}if(this.panoMeshes.forEach(function(ce,we){var Me=Ee.get(we);Me?Ee.delete(we):(o.helper.remove(ce),ce.dispose(),o.panoMeshes.delete(we))}),Ee.forEach(function(ce,we){var Me=o.panoCircleMeshCreator(ce,{aerialObserverMinHeight:o.aerialObserverMinHeight});o.panoMeshes.set(we,Me),o.helper.add(Me),Ee.delete(we)}),this.panoMeshes.forEach(function(ce,we){var Me=o.works.getObserver(we);if(Me){var ke=Me.position.distanceTo(Me.standingPosition)>o.aerialObserverMinHeight;if(ke)ce.position.copy(Me.position).applyMatrix4(Me.work.transform),ce.scale.setScalar(18);else{ce.position.copy(Me.standingPosition).applyMatrix4(Me.work.transform);var je=o.adjustPanoCircleMeshPositionFix.get(Me.panoId);je&&(scratchVector3$3.set(je.x,je.y,je.z),scratchVector3$3.equals(ce.position)&&(ce.position.y+=je.w)),ce.scale.setScalar(1.2)}var st=o.camera.position.clone().setY(ce.position.y),Qe=new THREE__namespace.Vector3().copy(ce.position).sub(st).normalize();if(we===panoStringify(o.currentPano)){var Je=clamp$1((.5-st.distanceTo(ce.position))/.5,0,1);Qe.multiplyScalar(1-Je).add(g.clone().multiplyScalar(Je))}if(Qe.length()>0){var ft=ke?-Math.PI/2:0,Bt=Math.atan2(Qe.x,Qe.z);ce.quaternion.setFromEuler(new THREE__namespace.Euler(ft,Bt,0,"YXZ"))}}else ce.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(function(ce){ce.setOpacity(0),ce.setCurrent(!1),ce.updateTime&&ce.updateTime(e,r),ce.visible=!1});else if(ee){var Ce=ee.work.observers,$e=arrayMin(ee.accessibleNodes,function(ce){var we=Ce[ce];return we?ee.standingPosition.distanceTo(we.standingPosition):1/0},!0),Se=$e[1];Se=clamp$1(Se,3,1/0);var ze=ee.accessibleNodes.concat(ee.panoIndex).map(function(ce){return panoStringify({panoIndex:ce,workCode:ee.work.workCode})});this.panoMeshes.forEach(function(ce,we){var Me=o.works.getObserver(we),ke=!1,je=1;if(ze.indexOf(we)===-1)ke=!1,je=0;else if(!Me)ke=!1,je=0;else if(!Me.loadable&&!Me.active)ke=!1,je=0;else{var st=ce.position.clone().project(o.camera),Qe=Math.abs(st.x)<1&&Math.abs(st.y)<1&&Math.abs(st.z)<1;ke=Qe&&!ce.loading&&ce.progress===0&&Z!==null&&panoStringify({panoIndex:Z.panoIndex,workCode:Z.work.workCode})===we;var Je=ce.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);je=Je<.01?0:clamp$1(Se/Je,.1,.85)}if(Me&&Me===se){var ft=Me.position.distanceTo(Me.standingPosition)>o.aerialObserverMinHeight;if(ft){var Je=ce.position.distanceTo(o.camera.position);Je<35&&(je=0)}}o.modelScene.parameter.resolveValue().modelAlpha>0&&(je=0),ce.setCurrent(ke),ce.setOpacity(je),ce.updateTime&&ce.updateTime(e,r)})}{var R=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,Fe=Math.round(R),Oe=this.modelScene.parameter.pano0,Le=this.modelScene.parameter.pano1,Ue=Fe===0?Oe:Le,B=void 0;if(Ue&&(B=this.works.getObserver(Ue.panoId),B||(B=this.panoPictureObserverMap.get(Ue))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=R<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!B||!Ue||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var tt={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(tt),this.modelScene.parameter.set("refinedScreen",null)}else{var lt=getImageSizeLevel(Ue.mapSize),nt=lt+1,ot=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),At=Math.floor(this.tileLevelForFov(this.camera.fov,ot)),We=At>lt?At:0;this.tiling.setObserver(B);var tt={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:Ue.map,panoMatrix:Ue.matrix,panoZoom:Ue.zoom,minLevel:nt,level:We},Mt=this.tiling.update(tt),Be={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Fe,opacity:(Oe==null?void 0:Oe.panoId)===(Le==null?void 0:Le.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Ne=this.modelScene.parameter.refinedScreen;(Mt||Be.pano!==(Ne==null?void 0:Ne.pano)||Be.opacity!==(Ne==null?void 0:Ne.opacity))&&this.modelScene.parameter.set("refinedScreen",Be)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),ee&&ee.images.video&&(this.needsRender=!0),this.intersectMesh&&this.intersectMesh.parent&&ee&&ee.position.y-ee.standingPosition.y>10){var bt=this.camera.position.distanceTo(this.intersectMesh.position),Ct=2*Math.tan(.5*this.camera.fov/180*Math.PI),xt=bt*Ct/5;this.intersectMesh.scale.setScalar(xt)}else this.intersectMesh.scale.setScalar(1);{var yt=T.effect,St=this.modelScene.parameter,Oe=St.pano0,Le=St.pano1;if(Oe&&Le&&Oe!==Le&&(yt==="fly"||yt==="model")&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==Oe.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==Le.panoId){var rt=500,at=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==at&&this.pano0DepthCubeRenderTarget.setSize(at,at):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(at,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==at&&this.pano1DepthCubeRenderTarget.setSize(at,at):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(at,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var ct=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);ct.matrix.copy(Oe.matrix),ct.matrixWorld.copy(ct.matrix),ct.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,ct,rt);var Xe=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);Xe.matrix.copy(Le.matrix),Xe.matrixWorld.copy(Xe.matrix),Xe.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Xe,rt),this.modelScene.parameter.set({pano0Depth:{panoId:Oe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:rt},pano1Depth:{panoId:Le.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:rt}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1],o=this.panoResourceFromLocationMotionKeyframe(r),s=this.works.getObserver(o.panoId);return{workCode:s?s.work.workCode:this.currentPano.workCode,panoIndex:s?s.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:s?s.position.clone().applyMatrix4(s.work.transform):this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f=(u=r.effect)!==null&&u!==void 0?u:"fly";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),d=this.works.getObserver(e);if(!d)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));getImageSizeFromURL(d.images.up),this.imageOptions.size;var h=this.imageOptions.transform,g=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality","sharpen","forceUseExifOrientation","mappings"])),m={right:d.images.work.getURL(d.images.right),left:d.images.work.getURL(d.images.left),up:d.images.work.getURL(d.images.up),down:d.images.work.getURL(d.images.down),front:d.images.work.getURL(d.images.front),back:d.images.work.getURL(d.images.back)},E="pano:"+jsonHash([m,g,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===E)return;var y=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(y))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:{panoIndex:d.panoIndex,workCode:d.work.workCode}}))}var v="move-to-pano-"+p;this.pending.add(v);var A=this.modelScene.parameter,b;if(A.pano0&&A.pano0.map.name===E?b=A.pano0:A.pano1&&A.pano1.map.name===E&&(b=A.pano1),b){var T={panoId:p,effect:f,effectEasing:(c=r.effectEasing)!==null&&c!==void 0?c:defaultEffectEase,panoPicture:{panoId:b.panoId,map:b.map,mapSize:b.mapSize,matrix:d.matrix.clone().premultiply(d.work.transform),zoom:1},position:d.position.clone().applyMatrix4(d.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};T.panoPicture&&this.panoPictureObserverMap.set(T.panoPicture,d),this.pendingTextureTask=void 0,AnimationFrameLoop.shared.add(function(){s.pending.delete(v),s.doMoveToPano(e,T,r)},!0,1);return}this.pendingTextureTask={panoId:p,hash:E,onLoad:function(S){var w,R,I=S.body;if(s.destroyed)I.dispose();else{I.name=E;var H=Array.isArray(I.image)?I.image[0]:I.image,C=(w=H==null?void 0:H.width)!==null&&w!==void 0?w:2048,M={panoId:p,effect:f,effectEasing:(R=r.effectEasing)!==null&&R!==void 0?R:defaultEffectEase,panoPicture:{panoId:p,map:I,mapSize:C,matrix:d.matrix.clone().premultiply(d.work.transform),zoom:1},position:d.position.clone().applyMatrix4(d.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};M.panoPicture&&s.panoPictureObserverMap.set(M.panoPicture,d),s.doMoveToPano(e,M,r)}},onError:function(S){var w=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:S,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:S,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("error",S),r.moveCancelCallback&&r.moveCancelCallback()}};var _=this.panoMeshes.get(p);_&&_.tap&&_.tap(),this.textureLoader.loadCubeTexture(m,{imageURL:{transform:h,options:g},format:THREE__namespace.RGBFormat,viaAjax:!0,fetcher:getFetcher(this.fiveId,d.work)},void 0,void 0,function(S){var w,R;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:S,meta:null,pano:e})),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===E&&((R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(S))},this.renderer).then(function(S){var w,R;s.pending.delete(v),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===E?(s.pendingTextureTask.onLoad(S),s.pendingTextureTask=void 0,(R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(0)):S.body.dispose(),s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:S.meta,pano:e}))}).catch(function(S){var w,R;s.pending.delete(v),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===E&&(s.pendingTextureTask.onError(S),s.pendingTextureTask=void 0,(R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(0)),s.emit("pano.texture.error",createEvent("pano.texture.error",{error:S,progress:0,meta:null,pano:e})),s.emit("error",S)}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial,s=o.duration,u=o.effect,l=o.userAction;e.userAction=l;var c=t.initAnimationEndState(e),f={workCode:c.workCode,panoIndex:c.panoIndex},p={modelAlpha:0},d={perspToOrtho:0},h=!1;e.moveToPano(f,{longitude:c.longitude,latitude:c.latitude,fov:c.fov,effect:u,duration:s,moveStartCallback:function(g){h=!0,e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:p}],s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction}))},moveEndCallback:function(g){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()},moveCancelCallback:function(){var g=__assign(__assign(__assign({},f),{mode:e.mode}),clonePose(e.camera.pose));h===!1&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()}},l)})},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var r=0,o=1;o<e.length;o++){var s=this.panoResourceFromLocationMotionKeyframe(e[o-1]).position,u=this.panoResourceFromLocationMotionKeyframe(e[o]).position,l=s.distanceTo(u)*(e[o].value.count-e[o-1].value.count);r+=l}return r},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,m,E,y;o===void 0&&(o={});var v=now(),A=createUuid();this.panoResources[A]=r;var b=1,T,_,S;if(this.locationMotion.ended){var w=this.locationMotion.getKeyFrameSegment(v);w[0];var R=w[1],I=this.locationMotion.value,H=((u=this.panoResourceFromLocationMotionKeyframe(R))!==null&&u!==void 0?u:this.camera).position,C=r.position;T=Math.max(H.distanceTo(C),b),_=[{key:R.key,progress:0,value:__assign(__assign({},I),{count:0})},{key:A,progress:1,value:{distance:0,count:1}}],S=0}else{var M=this.locationMotion.getKeyFrameSegment(v),B=M[0],R=M[1],I=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(B).position,H=this.panoResourceFromLocationMotionKeyframe(R).position,C=r.position,O=R.value.count-I.count,k=Math.max(L.distanceTo(H),b)*O,D=Math.max(H.distanceTo(C),b);T=k+D,_=[{key:B.key,progress:0,value:__assign({},I)},{key:R.key,progress:k/T,value:R.value},{key:A,progress:1,value:{count:R.value.count+1,distance:0}}];var q=this.locationMotionKeyframesLength(this.locationMotion.keyframes),z=this.locationMotionKeyframesLength(_);q===0||q===0?S=0:S=this.locationMotion.getProgressVelocity(v)*q/z}var J=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"||r.effect==="model"?T:0),V={longitude:o.longitude,latitude:o.latitude,fov:o.fov},U=__assign(__assign({},e),{mode:this.mode,longitude:(l=V.longitude)!==null&&l!==void 0?l:this.camera.pose.longitude,latitude:(c=V.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(f=V.fov)!==null&&f!==void 0?f:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),j=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:j,progress:0,state:U,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(U),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly"||r.effect==="model")this.cameraMotion.set(V,J).catch(noop);else{var K=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),ae=coordinatesToVector({longitude:(p=V.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(d=V.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),re=new THREE__namespace.Object3D;re.lookAt(K);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(re.quaternion);re.lookAt(ae);var Z=new THREE__namespace.Matrix4().makeRotationFromQuaternion(re.quaternion),X=new THREE__namespace.Matrix4().getInverse(ee).premultiply(Z),se=this.cameraMotion.value.fov,G=(h=V.fov)!==null&&h!==void 0?h:this.cameraMotion.value.fov,W=1;r.effect==="zoomin"?W=1.5:r.effect==="zoomout"&&(W=.4);for(var $=clamp$1(G*W,1,170),ne=0;ne<_.length-1;ne++){var te=_[ne].key;if(te){var ve=this.panoResources[te];ve&&(ve.fixCameraTransform.copy(X),ve.panoPicture&&(ve.panoPicture.zoom=Math.tan($/2/180*Math.PI)/Math.tan(se/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(g=V.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(m=V.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:$}},{progress:1,value:{longitude:(E=V.longitude)!==null&&E!==void 0?E:this.cameraMotion.value.longitude,latitude:(y=V.latitude)!==null&&y!==void 0?y:this.cameraMotion.value.latitude,fov:G}}],J).catch(noop)}var oe=this.locationMotion.setKeyframes(_,J,S);oe.then(function(){for(var fe=0,be=s.modelScene.children;fe<be.length;fe++){var ie=be[fe];ie instanceof Model&&ie.show()}var ue=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:s.camera.pose.distance});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:j,progress:1,state:ue,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ue);var me=s.works.getObserver(e);if(me&&me.images.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var ge={map:s.videoTexture,size:me.images.video.size.clone(),matrix:me.images.video.matrix.clone(),panoMatrix:me.matrix.clone().premultiply(me.work.transform),alpha:1},Ae=createUuid(),xe=s.videoTexture.image;xe.setAttribute("uuid",Ae),xe.oncanplay=noop,xe.ontimeupdate=noop,canplayVideo().then(function(_e){_e&&me.images.video&&xe.getAttribute("uuid")===Ae&&(xe.oncanplay=function(){xe.oncanplay=noop,xe.play()},xe.ontimeupdate=function(){xe.currentTime>.5&&(xe.ontimeupdate=noop,s.panoVideo.setMaterial(ge))},xe.src=me.images.video.source)}).catch((function(){xe.removeAttribute("uuid")}))}else{var de=s.videoTexture.image;de.removeAttribute("uuid"),de.oncanplay=noop,de.ontimeupdate=noop}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:j,progress:0,state:U,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.getForwardObserverOrNot=function(e,r){var o=this,s=this.works.getObserver(this.currentPano);if(!s)return null;var u=r!=null?r:new THREE__namespace.Raycaster(e.position.clone(),e.getWorldDirection(new THREE__namespace.Vector3));u.params.Points={threshold:.1},u.firstHitOnly=!0,u.floorIndex=-1;var l=s.standingPosition.clone().applyMatrix4(s.work.transform),c=s.position.clone().applyMatrix4(s.work.transform);if(c.distanceTo(u.ray.origin)>1){var f=new THREE__namespace.Raycaster(u.ray.origin,new THREE__namespace.Vector3(0,-1,0));f.firstHitOnly=u.firstHitOnly,f.floorIndex=u.floorIndex;var p=this.modelScene.intersectRaycaster(f)[0];p&&p.distance<=2?l.copy(p.point):l.copy(u.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var d=this.modelScene.intersectRaycaster(u)[0],h=d?d.point:u.ray.origin.clone().add(u.ray.direction.clone().normalize().multiplyScalar(3)),g=h.clone().sub(l).normalize();if(g.length()===0)return null;var m=s.work.observers,E=s.accessibleNodes.filter(function(q){if(q===o.currentPano.panoIndex&&s.work.workCode===o.currentPano.workCode)return!1;var z=m[q];if(!z)return!1;var J=z.standingPosition.clone().applyMatrix4(z.work.transform).project(e);return Math.abs(J.z)>1||Math.abs(J.x)>1||Math.abs(J.y)>1?!1:z.loadable||z.active}),y=new Map,v=E.slice().sort(function(q,z){var J=m[q],V=y.get(J);typeof V=="undefined"&&(V=scratchVector3$3.copy(J.standingPosition).applyMatrix4(J.work.transform).distanceTo(l),y.set(J,V));var U=m[z],j=y.get(U);return typeof j=="undefined"&&(j=scratchVector3$3.copy(U.standingPosition).applyMatrix4(U.work.transform).distanceTo(l),y.set(U,j)),V-j});y.clear();for(var A=0,b=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];A<b.length;A++)for(var T=b[A],_=0,S=v;_<S.length;_++){var w=S[_],R=m[w];if(R){var I=scratchVector3$3.copy(R.standingPosition).applyMatrix4(R.work.transform).sub(l);if(I&&I.length()!==0&&g.angleTo(I)<T)return R}}var H=null;if(r){var C=r.ray.intersectBox(this.modelScene.boundingBox,scratchVector3$3);C&&(C.project(e),Math.abs(C.z)<=1&&(H=C.clone()))}else H=new THREE__namespace.Vector3(0,0,0);if(H){var M=.4,B=s.accessibleNodes.filter(function(q){if(q===o.currentPano.panoIndex&&s.work.workCode===o.currentPano.workCode)return!1;var z=m[q];if(!z)return!1;var J=z.position.clone().applyMatrix4(z.work.transform).project(e);return Math.abs(J.z)>1||Math.abs(J.x)>1||Math.abs(J.y)>1?!1:z.loadable||z.active}),L=new Map,O=B.slice().sort(function(q,z){var J=m[q],V=L.get(J);typeof V=="undefined"&&(V=scratchVector3$3.copy(J.position).applyMatrix4(J.work.transform).distanceTo(e.position),L.set(J,V));var U=m[z],j=L.get(U);return typeof j=="undefined"&&(j=scratchVector3$3.copy(U.position).applyMatrix4(U.work.transform).distanceTo(e.position),L.set(U,j)),V-j});L.clear();for(var k=0,D=O;k<D.length;k++){var w=D[k],R=m[w];if(R){var C=scratchVector3$3.copy(R.position).applyMatrix4(R.work.transform);if(C.project(e),Math.abs(C.z)>1)continue;if(Math.pow(H.x-C.x,2)+Math.pow(H.y-C.y,2)<Math.pow(M,2))return R}}}return null},t.prototype.onTapGesture=function(e){var r=this,o;if(this.userAction=e.userAction,this.stopMomentumMovement(),!!this.initAnimationed){var s=e.center.raycaster;s.floorIndex=-1;var u=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),l=null,c=this.works.getObserver(this.currentPano);if(c){var f=c.work.observers,p=c.accessibleNodes.filter(function(j){if(j===r.currentPano.panoIndex&&c.work.workCode===r.currentPano.workCode)return!1;var K=f[j];if(!K)return!1;var ae=scratchVector3$3.copy(K.position).applyMatrix4(K.work.transform);return ae.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:K.loadable||K.active}),d=this.modelScene.intersectRaycaster(s)[0];if(d){var h=arrayMin(p,function(j){var K=f[j];if(!K)return 1/0;var ae=scratchVector3$3.copy(K.standingPosition).applyMatrix4(K.work.transform);return ae.distanceTo(d.point)},!0),g=h[0],m=h[1];typeof g=="number"&&m<this.panoTapTriggerRadius&&(l=(o=f[g])!==null&&o!==void 0?o:null)}if(l||(l=this.getForwardObserverOrNot(this.camera,s)),l&&l.panoId===panoStringify(this.currentPano)&&(l=null),l&&!this.locationMotion.ended)for(var E=0,y=this.locationMotion.keyframes;E<y.length;E++){var v=y[E],A=this.panoResourceFromLocationMotionKeyframe(v);if(A.panoId===l.panoId){l=null;break}}if(!l)this.emit("gesture.tap",e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{for(var b={},T=Math.PI/6,_=Math.PI/12,S=l.position.clone().applyMatrix4(l.work.transform).setY(0).sub(c.position.clone().applyMatrix4(l.work.transform).setY(0)).normalize(),w=[],R=[],I=[],H=l.work.observers,C=0,M=l.accessibleNodes;C<M.length;C++){var g=M[C];if(l.panoIndex!==g&&!(g===this.currentPano.panoIndex&&l.work.workCode===this.currentPano.workCode)){var B=H[g];if(B){var L=B.position.clone().applyMatrix4(B.work.transform).sub(l.position.clone().applyMatrix4(l.work.transform)).setY(0).normalize();S.angleTo(L)<T&&I.push(L)}}}var O=I.length>0?I:__spreadArray(__spreadArray([],w,!0),R,!0),k=O.slice().sort(function(j,K){return j.angleTo(S)-K.angleTo(S)})[0];if(k&&k.angleTo(u)>_&&(b.longitude=Math.atan2(-k.x,-k.z)),this.cameraMotion.value.latitude<-Math.PI/4){var D=e.state.fov,q=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(D):this.minLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(D):this.maxLatitude,-Math.PI/2,Math.PI/2);b.latitude=clamp$1(0,q,z)}var J=__assign({},e.state);if(J.workCode=l.work.workCode,J.panoIndex=l.panoIndex,b.longitude!==void 0&&(J.longitude=b.longitude),b.latitude!==void 0&&(J.latitude=b.latitude),b.fov!==void 0&&(J.fov=b.fov),J.distance=0,J.offset=l.position.clone(),e.state=J,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:J,userAction:e.userAction,options:b,progress:0,error:null})),l&&!l.active){var V=panoStringify({panoIndex:l.panoIndex,workCode:l.work.workCode}),U=this.panoMeshes.get(V);U&&(U.setDisabled(!1),U.setLoading(!0))}l&&l.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:J,options:b,error:null}))}}}}},t})(PanoramaLikeController),DEG_TO_RAD=Math.PI/180,RAD_TO_DEG=180/Math.PI,MIN_TIMESTEP=.001,MAX_TIMESTEP=1,isIOS=(function(){var n=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return n}})(),isSafari=(function(){var n=typeof navigator!="undefined"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return n}})(),isFirefoxAndroid=(function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("Firefox")!==-1&&navigator.userAgent.indexOf("Android")!==-1;return function(){return n}})(),getChromeVersion=(function(){var n=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=n?parseInt(n[1],10):null;return function(){return t}})(),isChromeWithoutDeviceMotion=(function(){var n=!1;if(getChromeVersion()===65){var t=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var e=t[1].split(".");e[0],e[1];var r=e[2],o=e[3];n=parseInt(r,10)===3325&&parseInt(o,10)<148}}return function(){return n}})(),isSafariWithoutDeviceMotion=(function(){var n=isIOS()&&isSafari()&&typeof navigator!="undefined"&&navigator.userAgent.indexOf("13_4")!==-1;return function(){return n}})(),isR7=(function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("R7 Build")!==-1;return function(){return n}})();function isLandscapeMode(){var n=typeof window!="undefined"&&(window.orientation==90||window.orientation==-90);return isR7()?!n:n}function isTimestampDeltaValid(n){return!(isNaN(n)||n<=MIN_TIMESTEP||n>MAX_TIMESTEP)}function getQuaternionAngle(n){if(n.w>1)return 0;var t=2*Math.acos(n.w);return t}var warnOnce=(function(){var n={};return function(t,e){n[t]===void 0&&(console.warn("cardboard: "+e),n[t]=!0)}})();function getOriginFromUrl(n){var t,e=n.indexOf("://");e!==-1?t=e+3:t=0;var r=n.indexOf("/",t);return r===-1&&(r=n.length),n.substring(0,r)}function isInsideCrossOriginIFrame(){if(typeof window=="undefined"||typeof document=="undefined")return!1;var n=window.self!==window.top,t=getOriginFromUrl(document.referrer),e=getOriginFromUrl(window.location.href);return n&&t!==e}var updateEyeViewMatrices=(function(){function n(r,o,s){var u=o?o[0]:0,l=o?o[1]:0,c=o?o[2]:0,f=o?o[3]:1,p=u+u,d=l+l,h=c+c,g=u*p,m=u*d,E=u*h,y=l*d,v=l*h,A=c*h,b=f*p,T=f*d,_=f*h;return r[0]=1-(y+A),r[1]=m+_,r[2]=E-T,r[3]=0,r[4]=m-_,r[5]=1-(g+A),r[6]=v+b,r[7]=0,r[8]=E+T,r[9]=v-b,r[10]=1-(g+y),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function t(r,o,s){var u=s[0],l=s[1],c=s[2],f,p,d,h,g,m,E,y,v,A,b,T;return o===r?(r[12]=o[0]*u+o[4]*l+o[8]*c+o[12],r[13]=o[1]*u+o[5]*l+o[9]*c+o[13],r[14]=o[2]*u+o[6]*l+o[10]*c+o[14],r[15]=o[3]*u+o[7]*l+o[11]*c+o[15]):(f=o[0],p=o[1],d=o[2],h=o[3],g=o[4],m=o[5],E=o[6],y=o[7],v=o[8],A=o[9],b=o[10],T=o[11],r[0]=f,r[1]=p,r[2]=d,r[3]=h,r[4]=g,r[5]=m,r[6]=E,r[7]=y,r[8]=v,r[9]=A,r[10]=b,r[11]=T,r[12]=f*u+g*l+v*c+o[12],r[13]=p*u+m*l+A*c+o[13],r[14]=d*u+E*l+b*c+o[14],r[15]=h*u+y*l+T*c+o[15]),r}function e(r,o){var s=o[0],u=o[1],l=o[2],c=o[3],f=o[4],p=o[5],d=o[6],h=o[7],g=o[8],m=o[9],E=o[10],y=o[11],v=o[12],A=o[13],b=o[14],T=o[15],_=s*p-u*f,S=s*d-l*f,w=s*h-c*f,R=u*d-l*p,I=u*h-c*p,H=l*h-c*d,C=g*A-m*v,M=g*b-E*v,B=g*T-y*v,L=m*b-E*A,O=m*T-y*A,k=E*T-y*b,D=_*k-S*O+w*L+R*B-I*M+H*C;return D?(D=1/D,r[0]=(p*k-d*O+h*L)*D,r[1]=(l*O-u*k-c*L)*D,r[2]=(A*H-b*I+T*R)*D,r[3]=(E*I-m*H-y*R)*D,r[4]=(d*B-f*k-h*M)*D,r[5]=(s*k-l*B+c*M)*D,r[6]=(b*w-v*H-T*S)*D,r[7]=(g*H-E*w+y*S)*D,r[8]=(f*O-p*B+h*C)*D,r[9]=(u*B-s*O-c*C)*D,r[10]=(v*I-A*w+T*_)*D,r[11]=(m*w-g*I-y*_)*D,r[12]=(p*M-f*L-d*C)*D,r[13]=(s*L-u*M+l*C)*D,r[14]=(A*S-v*R-b*_)*D,r[15]=(g*R-m*S+E*_)*D,r):null}return function(r,o,s){n(r,o),s&&t(r,r,s),e(r,r)}})(),SensorSample=(function(){function n(t,e){t===void 0&&(t=new THREE__namespace.Vector3),e===void 0&&(e=0),this.sample=t,this.timestampS=e}return n.prototype.set=function(t,e){this.sample=t,this.timestampS=e},n.prototype.copy=function(t){this.set(t.sample,t.timestampS)},n})(),ComplementaryFilter=(function(){function n(t,e){this.kFilter=t,this.isDebug=e,this.currentAccelMeasurement=new SensorSample,this.currentGyroMeasurement=new SensorSample,this.previousGyroMeasurement=new SensorSample,isIOS()?this.filterQ=new THREE__namespace.Quaternion(-1,0,0,1):this.filterQ=new THREE__namespace.Quaternion(1,0,0,1),this.previousFilterQ=new THREE__namespace.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new THREE__namespace.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new THREE__namespace.Vector3,this.measuredGravity=new THREE__namespace.Vector3,this.gyroIntegralQ=new THREE__namespace.Quaternion}return n.prototype.addAccelMeasurement=function(t,e){this.currentAccelMeasurement.set(t,e)},n.prototype.addGyroMeasurement=function(t,e){this.currentGyroMeasurement.set(t,e);var r=e-this.previousGyroMeasurement.timestampS;isTimestampDeltaValid(r)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},n.prototype.getOrientation=function(){return this.filterQ},n.prototype.run_=function(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);var r=new THREE__namespace.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var o=new THREE__namespace.Quaternion;o.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),o.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",RAD_TO_DEG*getQuaternionAngle(o),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var s=new THREE__namespace.Quaternion;s.copy(this.filterQ),s.multiply(o),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},n.prototype.accelToQuaternion_=function(t){var e=new THREE__namespace.Vector3;e.copy(t),e.normalize();var r=new THREE__namespace.Quaternion;return r.setFromUnitVectors(new THREE__namespace.Vector3(0,0,-1),e),r.inverse(),r},n.prototype.gyroToQuaternionDelta_=function(t,e){var r=new THREE__namespace.Quaternion,o=new THREE__namespace.Vector3;return o.copy(t),o.normalize(),r.setFromAxisAngle(o,t.length()*e),r},n})(),PosePredictor=(function(){function n(t,e){this.predictionTimeS=t,this.isDebug=e,this.previousQ=new THREE__namespace.Quaternion,this.previousTimestampS=null,this.deltaQ=new THREE__namespace.Quaternion,this.outQ=new THREE__namespace.Quaternion}return n.prototype.getPrediction=function(t,e,r){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=r,t;var o=new THREE__namespace.Vector3;o.copy(e),o.normalize();var s=e.length();if(s<DEG_TO_RAD*20)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(RAD_TO_DEG*s).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var u=s*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(o,u),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=r,this.outQ},n})(),Distortion=(function(){function n(t){this.coefficients=t}return n.prototype.distortInverse=function(t){for(var e=0,r=1,o=t-this.distort(e);Math.abs(r-e)>1e-4;){var s=t-this.distort(r),u=r-s*((r-e)/(s-o));e=r,r=u,o=s}return r},n.prototype.distort=function(t){for(var e=t*t,r=0,o=0;o<this.coefficients.length;o++)r=e*(r+this.coefficients[o]);return(r+1)*t},n})(),Pose=(function(){function n(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}return n})(),FieldOfView=(function(){function n(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}return n})(),Sensor=(function(){function n(t,e,r,o){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new THREE__namespace.Vector3,this.gyroscope=new THREE__namespace.Vector3,this.filter=new ComplementaryFilter(t,o),this.posePredictor=new PosePredictor(e,o),this.isFirefoxAndroid=isFirefoxAndroid(),this.isIOS=isIOS();var s=getChromeVersion();this.isDeviceMotionInRadians=!this.isIOS&&s!==null&&s<66,this.isWithoutDeviceMotion=isChromeWithoutDeviceMotion()||isSafariWithoutDeviceMotion(),this.filterToWorldQ=new THREE__namespace.Quaternion,isIOS()?this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new THREE__namespace.Quaternion,this.worldToScreenQ=new THREE__namespace.Quaternion,this.originalPoseAdjustQ=new THREE__namespace.Quaternion;var u=typeof window!="undefined"?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),u),this.setScreenTransform_(),isLandscapeMode()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new THREE__namespace.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return n.prototype.getPosition=function(){return null},n.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(function(){var s=new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,0,-1),0),u=new THREE__namespace.Quaternion;return typeof window!="undefined"&&window.orientation===-90?u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/-2):u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/2),s.multiply(u)})(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||(function(){var s=new THREE__namespace.Quaternion;return s.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),s})(),t=this._deviceOrientationQ;var e=new THREE__namespace.Quaternion;return e.copy(t),e.multiply(this.deviceOrientationFilterToWorldQ),e.multiply(this.resetQ),e.multiply(this.worldToScreenQ),e.multiplyQuaternions(this.deviceOrientationFixQ,e),this.yawOnly&&(e.x=0,e.z=0,e.normalize()),this.orientationOut_[0]=e.x,this.orientationOut_[1]=e.y,this.orientationOut_[2]=e.z,this.orientationOut_[3]=e.w,this.orientationOut_}else{var r=this.filter.getOrientation();t=this.posePredictor.getPrediction(r,this.gyroscope,this.previousTimestampS)}var o=new THREE__namespace.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(t),o.multiply(this.worldToScreenQ),this.yawOnly&&(o.x=0,o.z=0,o.normalize()),this.orientationOut_[0]=o.x,this.orientationOut_[1]=o.y,this.orientationOut_[2]=o.z,this.orientationOut_[3]=o.w,this.orientationOut_},n.prototype.getPose=function(){var t=new Pose;return t.orientation=this.getOrientation(),t},n.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),isLandscapeMode()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},n.prototype.getFrameData=function(t){var e=this.getOrientation(),r=this.getEyeOffset(),o=this.getEyeProjectionMatrix();return t.pose.angularAcceleration=null,t.pose.angularVelocity=null,t.pose.linearAcceleration=null,t.pose.linearVelocity=null,t.pose.orientation=e,t.pose.position=null,t.timestamp=this.previousTimestampS,t.leftProjectionMatrix.set(o.left),t.rightProjectionMatrix.set(o.right),updateEyeViewMatrices(t.leftViewMatrix,e,r.left),updateEyeViewMatrices(t.rightViewMatrix,e,r.right),t},n.prototype.start=function(){if(typeof window=="undefined")return function(){};var t=this.onDeviceMotion_.bind(this),e=this.onOrientationChange_.bind(this),r=this.onMessage_.bind(this),o=this.onDeviceOrientation_.bind(this);return isIOS()&&isInsideCrossOriginIFrame()&&window.addEventListener("message",r),window.addEventListener("orientationchange",e),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",o):window.addEventListener("devicemotion",t),function(){window.removeEventListener("devicemotion",t),window.removeEventListener("deviceorientation",e),window.removeEventListener("orientationchange",e),window.removeEventListener("message",r)}},n.prototype.getEyeOffset=function(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}},n.prototype.getEyeProjectionMatrix=function(){var t=this.getEyeFieldOfView(),e=this.depthNear,r=this.depthFar,o={left:[],right:[]};{var s=t.left.upDegrees*DEG_TO_RAD,u=t.left.downDegrees*DEG_TO_RAD,l=t.left.leftDegrees*DEG_TO_RAD,c=t.left.rightDegrees*DEG_TO_RAD,f=2/(l+c),p=2/(s+u);o.left[0]=f,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=p,o.left[6]=0,o.left[7]=0,o.left[8]=-((l-c)*f*.5),o.left[9]=(s-u)*p*.5,o.left[10]=r/(e-r),o.left[11]=-1,o.left[12]=0,o.left[13]=0,o.left[14]=r*e/(e-r),o.left[15]=0}{var s=t.right.upDegrees*DEG_TO_RAD,u=t.right.downDegrees*DEG_TO_RAD,l=t.right.leftDegrees*DEG_TO_RAD,c=t.right.rightDegrees*DEG_TO_RAD,f=2/(l+c),p=2/(s+u);o.right[0]=f,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=p,o.right[6]=0,o.right[7]=0,o.right[8]=-((l-c)*f*.5),o.right[9]=(s-u)*p*.5,o.right[10]=r/(e-r),o.right[11]=-1,o.right[12]=0,o.right[13]=0,o.right[14]=r*e/(e-r),o.right[15]=0}return o},n.prototype.getEyeFieldOfView=function(){var t=this.viewer,e=this.device,r=new Distortion(t.distortionCoefficients),o=t.screenLensDistance,s=(e.widthMeters-t.interLensDistance)/2,u=t.interLensDistance/2,l=t.baselineLensDistance-e.bevelMeters,c=e.heightMeters-l,f=RAD_TO_DEG*Math.atan(r.distort(s/o)),p=RAD_TO_DEG*Math.atan(r.distort(u/o)),d=RAD_TO_DEG*Math.atan(r.distort(l/o)),h=RAD_TO_DEG*Math.atan(r.distort(c/o)),g=new FieldOfView,m=new FieldOfView;return g.leftDegrees=Math.min(f,t.fov),g.rightDegrees=Math.min(p,t.fov),g.downDegrees=Math.min(d,t.fov),g.upDegrees=Math.min(h,t.fov),m.leftDegrees=g.rightDegrees,m.rightDegrees=g.leftDegrees,m.upDegrees=g.upDegrees,m.downDegrees=g.downDegrees,{left:g,right:m}},n.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new THREE__namespace.Quaternion;var e=t.alpha,r=t.beta,o=t.gamma;e=(e||0)*Math.PI/180,r=(r||0)*Math.PI/180,o=(o||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new THREE__namespace.Euler(e,r,-o,"YXZ"))},n.prototype.onDeviceMotion_=function(t){this.updateDeviceMotion_(t)},n.prototype.updateDeviceMotion_=function(t){var e=t.accelerationIncludingGravity,r=t.rotationRate,o=t.timeStamp/1e3,s=o-this.previousTimestampS;if(s<0){warnOnce("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),this.previousTimestampS=o;return}else if(s<=MIN_TIMESTEP||s>MAX_TIMESTEP){warnOnce("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),this.previousTimestampS=o;return}e&&(this.accelerometer.set(-e.x,-e.y,-e.z),r&&(isR7()?this.gyroscope.set(-r.beta,r.alpha,r.gamma):this.gyroscope.set(r.alpha,r.beta,r.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,o)),this.filter.addAccelMeasurement(this.accelerometer,o)),this.previousTimestampS=o},n.prototype.onOrientationChange_=function(){this.setScreenTransform_()},n.prototype.onMessage_=function(t){var e=t.data;if(!(!e||!e.type)){var r=e.type.toLowerCase();r==="devicemotion"&&this.updateDeviceMotion_(e.deviceMotionEvent)}},n.prototype.setScreenTransform_=function(){this.worldToScreenQ.set(0,0,0,1);var t=typeof window!="undefined"?window.orientation:0;switch(t){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),Math.PI/2);break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},n})(),defaultLeftBounds=[0,0,.5,1],defaultRightBounds=[.5,0,.5,1],Cardboard=(function(){function n(t){var e=this;this.renderer=t,this.sensor=new Sensor(.98,.04,!1,!1),this.scale=1,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera;var r=this.sensor.start();this.dispose=function(){var o=e.renderer.getSize(new THREE__namespace.Vector2);e.renderer.setScissor(0,0,o.width,o.height),e.renderer.setViewport(0,0,o.width,o.height),e.renderer.setScissorTest(!1),r()}}return n.prototype.render=function(t,e){var r=this.renderer.getSize(new THREE__namespace.Vector2);if(r.width>r.height){var o=t.autoUpdate;o&&(t.updateMatrixWorld(),t.autoUpdate=!1);var s={x:Math.round(r.width*defaultLeftBounds[0]),y:Math.round(r.height*defaultLeftBounds[1]),width:Math.round(r.width*defaultLeftBounds[2]),height:Math.round(r.height*defaultLeftBounds[3])},u={x:Math.round(r.width*defaultRightBounds[0]),y:Math.round(r.height*defaultRightBounds[1]),width:Math.round(r.width*defaultRightBounds[2]),height:Math.round(r.height*defaultRightBounds[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),e.parent===null&&e.updateMatrixWorld(),e.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),e.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var l=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.left),this.scale),this.cameraR.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.right),this.scale);var c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(s.x,s.y,s.width,s.height),this.renderer.setScissor(s.x,s.y,s.width,s.height),this.renderer.render(t,this.cameraL),this.renderer.setViewport(u.x,u.y,u.width,u.height),this.renderer.setScissor(u.x,u.y,u.width,u.height),this.renderer.render(t,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),o&&(t.autoUpdate=!0)}else this.renderer.render(t,e)},n.prototype.dispose=function(){},n})();const cardboard="data:image/png;base64,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",phone="data:image/png;base64,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";var _a,LOCALE={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},TEXT=typeof navigator!="undefined"&&(_a=LOCALE[navigator.language.split("-")[0]])!==null&&_a!==void 0?_a:LOCALE.zh,CONTENTS=`
1791
1791
  <style>
1792
1792
  .$id {
1793
1793
  all: initial;
@@ -2148,7 +2148,7 @@ void main() {
2148
2148
 
2149
2149
  gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);
2150
2150
  }
2151
- `,PanoSphereMesh=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.progress=0,e.opacity=0,e.loading=!1,e.current=!1,e.disabled=!1,e.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),e.opacityMotion=new Motion({opacity:0}),e.loadingMotion=new Motion({opacity:0}),e.disableMotion=new Motion({opacity:0});var r={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return e.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},r),{color:0,opacity:0}))),e.hitTestMesh.scale.set(1.5,1.5,1.5),e.ringMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),e.panoMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader,fragmentShader,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),e.add(e.hitTestMesh),e.add(e.ringMesh),e.add(e.panoMesh),e.renderOrder=1e4,e.needsRender=!0,e}return t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var r=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}];this.currentMotion.setKeyframes(r,1500).catch(noop)}else{var r=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(r,200).catch(noop)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(noop):this.loadingMotion.set({opacity:0},0).catch(noop),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,r){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var o=this.opacityMotion.value.opacity;this.visible=o!==0;var s=this.currentMotion.value,u=s.ringScale,l=s.ringOpacity,c=s.circleFade,f=s.circleOpacity,p=s.circleScale;this.ringMesh.scale.set(u,1,u),this.ringMesh.material.uniforms.opacity.value=l*o,this.panoMesh.material.uniforms.opacity.value=o,this.panoMesh.material.uniforms.circleOpacity.value=f,this.panoMesh.material.uniforms.circleScale.value=p,this.panoMesh.material.uniforms.circleFade.value=c,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t})(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,defaultVRPanoramaControllerCustomInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"])),VRPanoramaController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var s=createHelper();r.helperElement=s;var u=new Hammer(s);return r.element.parentNode&&(r.element.parentNode.insertBefore(s,r.element),r.updateHelperElementSize(),u.on("tap",function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))})),r.destroyHelper=function(){u.destroy(),s.parentNode&&s.parentNode.removeChild(s),r.helperElement=void 0},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"VRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper()},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,p;if(!this.destroyed){this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0;var d={},h={},g=this.locationMotion.keyframes[0],m=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],E=this.locationMotion.getKeyFrameSegment(e),y=E[0],v=E[1],A=this.panoResourceFromLocationMotionKeyframe(y),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(g),_=this.panoResourceFromLocationMotionKeyframe(m),S=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var w=this.locationMotion.value.count-v.value.count+1,R=new THREE__namespace.Vector3().copy(A.position),I=new THREE__namespace.Vector3().copy(b.position);if(d.progress=w,w>=.01&&w<=.99&&(d.progress=clamp$1(b.effectEasing(w),.01,.99)),b.panoPicture&&(w<1?A.panoPicture&&(d.pano0=A.panoPicture):d.pano0=b.panoPicture,d.pano1=b.panoPicture),b.effect==="montage"?d.transition="BLACK":b.effect==="spread"?d.transition="SPREAD":d.transition="FADE",b.effect==="zoomin"||b.effect==="zoomout")d.progress=Math.pow(w,3);else if(b.effect==="model"&&this.camera.pose.distance<.01){var H=1-Math.pow(clamp$1(Math.abs(w-.5)*2,0,1),4);d.modelAlpha=H}if(w<1&&b.effect!=="fly"){if(d.pano0&&A.panoPicture){var C={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:A.panoPicture.matrix.clone().setPosition(b.position)},M=this.panoPictureObserverMap.get(d.pano0);M&&this.panoPictureObserverMap.set(C,M),d.pano0=C}R.copy(I),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(R.x+(I.x-R.x)*w,R.y+(I.y-R.y)*w,R.z+(I.z-R.z)*w);for(var B=[],L=[],O=0,k=this.locationMotion.keyframes;O<k.length;O++){var D=k[O],q=D.key,z=D.progress;q!==void 0&&(B.push(q),z>this.locationMotion.progress&&L.push(q))}for(var V=0,Q=Object.keys(this.panoResources);V<Q.length;V++){var U=Q[V];if(!(L.indexOf(U)>=0)){var j=this.panoResources[U];if(j.panoPicture){var G=j.panoPicture.map;if(G){if(G===((s=d.pano0)===null||s===void 0?void 0:s.map)||G===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;G.dispose(),j.panoPicture=null}}B.indexOf(U)>=0||delete this.panoResources[U]}}this.currentPano=panoParse(b.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(T.panoId),state:__assign(__assign(__assign(__assign({},panoParse(_.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),h.offset&&this.camera.position.copy(h.offset);var ae=this.camera.pose.longitude,re=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(ae!==this.camera.pose.longitude||re!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}))),this.works.getObserver(this.currentPano);var $=this.works.getObserver(A.panoId),ee=this.works.getObserver(b.panoId),K=new Map;if($)for(var se=0,W=$.accessibleNodes;se<W.length;se++){var X=W[se],M=$.work.observers[X];if(M){var te=panoStringify({panoIndex:M.panoIndex,workCode:M.work.workCode});K.set(te,M)}}if(ee)for(var Z=0,ne=ee.accessibleNodes;Z<ne.length;Z++){var X=ne[Z],M=ee.work.observers[X];if(M){var te=panoStringify({panoIndex:M.panoIndex,workCode:M.work.workCode});K.set(te,M)}}if(this.panoMeshes.forEach(function(Se,ze){var Fe=K.get(ze);Fe?(Se.position.copy(Fe.position).applyMatrix4(Fe.work.transform),K.delete(ze)):(o.helper.remove(Se),Se.dispose(),o.panoMeshes.delete(ze))}),K.forEach(function(Se,ze){var Fe=new PanoSphereMesh;Fe.position.copy(Se.position).applyMatrix4(Se.work.transform);var Oe=Se.position.distanceTo(Se.standingPosition)>o.aerialObserverMinHeight;Oe?Fe.scale.setScalar(15):Fe.scale.setScalar(1),o.panoMeshes.set(ze,Fe),o.helper.add(Fe),K.delete(ze)}),this.camera.pose.distance>.1||S?this.panoMeshes.forEach(function(Se,ze){Se.setOpacity(0),Se.updateTime&&Se.updateTime(e,r),Se.visible=!1}):this.panoMeshes.forEach(function(Se,ze){var Fe=panoParse(ze),Oe=o.works.getObserver(Fe);if(Oe){if(!Oe.loadable&&!Oe.active){Se.setOpacity(0);return}var Le=Se.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Le<.05?Se.setOpacity(0):Se.setOpacity(clamp$1(1.5/Le,0,1)),panoEqual(o.currentPano,Fe)&&Se.setOpacity(0),Se.lookAt(o.camera.position)}}),this.locationMotion.ended){var pe=this.intersect(e);this.panoMeshes.forEach(function(Se,ze){Se.setCurrent(Se===pe),Se.updateTime&&Se.updateTime(e,r)})}{var w=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,ie=Math.round(w),ue=this.modelScene.parameter.pano0,be=this.modelScene.parameter.pano1,oe=ie===0?ue:be,M=void 0;if(oe&&(M=this.works.getObserver(oe.panoId),M||(M=this.panoPictureObserverMap.get(oe))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=w<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!M||!oe||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var le={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(le),this.modelScene.parameter.set("refinedScreen",null)}else{var me=getImageSizeLevel(oe.mapSize),ge=me+1,Ae=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),xe=Math.floor(this.tileLevelForFov(this.camera.fov,Ae)),he=xe>me?xe:0;this.tiling.setObserver(M);var le={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:oe.map,panoMatrix:oe.matrix,panoZoom:oe.zoom,minLevel:ge,level:he},_e=this.tiling.update(le),He={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:ie,opacity:(ue==null?void 0:ue.panoId)===(be==null?void 0:be.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Ee=this.modelScene.parameter.refinedScreen;(_e||He.pano!==(Ee==null?void 0:Ee.pano)||He.opacity!==(Ee==null?void 0:Ee.opacity))&&this.modelScene.parameter.set("refinedScreen",He)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var de=b.effect,Ve=this.modelScene.parameter,ue=Ve.pano0,be=Ve.pano1;if(ue&&be&&ue!==be&&(de==="fly"||de==="model")&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==ue.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==be.panoId){var ye=500,Pe=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Pe&&this.pano0DepthCubeRenderTarget.setSize(Pe,Pe):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Pe,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Pe&&this.pano1DepthCubeRenderTarget.setSize(Pe,Pe):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Pe,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Ce=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Ce.matrix.copy(ue.matrix),Ce.matrixWorld.copy(Ce.matrix),Ce.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Ce,ye);var $e=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);$e.matrix.copy(be.matrix),$e.matrixWorld.copy($e.matrix),$e.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,$e,ye),this.modelScene.parameter.set({pano0Depth:{panoId:ue.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:ye},pano1Depth:{panoId:be.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:ye}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},t.prototype.render=function(){return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.cardboard.render(this.scene,this.camera),!0},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.updateHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.viewport.left,o=e.y*(1-this.viewport.bottom-this.viewport.height),s=e.x*this.viewport.width,u=e.y*this.viewport.height;this.helperElement.style.marginLeft!==r+"px"&&(this.helperElement.style.marginLeft=r+"px"),this.helperElement.style.marginTop!==o+"px"&&(this.helperElement.style.marginTop=o+"px"),this.helperElement.style.width!==s+"px"&&(this.helperElement.style.width=s+"px"),this.helperElement.style.height!==u+"px"&&(this.helperElement.style.height=u+"px")}},t.prototype.intersect=function(e){var r,o;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,this.activePanoMesh=void 0,this.activeTime=void 0;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){var s=this.activePanoMesh,u=null;return this.panoMeshes.forEach(function(R,I){R===s&&(u=I)}),u!==null&&this.moveToPano(panoParse(u),{},!0),this.activePanoMesh=void 0,this.activeTime=void 0,s}var l=this.camera.getDirection(new THREE__namespace.Vector3),c=new THREE__namespace.Raycaster(this.camera.position,l);c.params.Points={threshold:.1},c.firstHitOnly=!0,c.floorIndex=-1;for(var f=void 0,p=[],d=this.works.getObserver(this.currentPano),h=d?d.accessibleNodes.map(function(R){return panoStringify({panoIndex:R,workCode:d.work.workCode})}):[],g=0,m=h;g<m.length;g++){var E=m[g],y=this.panoMeshes.get(E);if(y){var v=c.intersectObject((r=y.hitTestMesh)!==null&&r!==void 0?r:y,!0)[0];if(v){var A=(o=d==null?void 0:d.floorIndex)!==null&&o!==void 0?o:0;p.push({panoMesh:y,intersection:__assign({floorIndex:A,floor:A},v)})}}}var b=p.sort(function(R,I){return R.intersection.distance-I.intersection.distance})[0];b?(f=b.intersection,this.activePanoMesh!==b.panoMesh&&(this.activePanoMesh=b.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(b.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),f||(f=this.modelScene.intersectRaycaster(c)[0]);var T=createEvent("intersect.update",{raycaster:c,intersection:f!=null?f:null,object:this.intersectMesh});if(this.emit("intersect.update",T),T.defaultPrevented){this.hideIntersectMesh();return}if(f&&f.face){var _=f.face.normal,S=new THREE__namespace.Quaternion;S.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),_),this.intersectMesh.quaternion.copy(S);var w=f.point.clone();this.intersectMesh.position.copy(w),b?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return b==null?void 0:b.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t})(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),scratchObserverBox$1=new THREE__namespace.Box3,scratchVector3$2=new THREE__namespace.Vector3,defaultModelControllerCustomInitArgs=__assign({},defaultPanoramaLikeControllerCustomInitArgs),ModelController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Model",r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r}return t.parseArgs=function(e){return e instanceof t?e:n.parseArgs.call(this,e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f=this.parseArgs(e),p=f.works,d=e.initial,h=d.state,g=d.currentState,m=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},E=p.getObserver(m),y=clamp$1((u=h.fov)!==null&&u!==void 0?u:!E||isFristPersonMode(g.mode)?g.fov:f.defaultFov,f.minFov,f.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:g.longitude,A=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(y):f.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(y):f.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:!E||isFristPersonMode(g.mode)?g.latitude:f.defaultLatitude,A,b),_=new THREE__namespace.Vector3;if(f.initial.state.offset)_.copy(f.initial.state.offset);else if(E)_.copy(E.position).applyMatrix4(E.work.transform);else{var S=coordinatesToVector(g).setLength(g.distance);_.copy(f.initial.currentState.offset).sub(S)}return{workCode:m.workCode,panoIndex:m.panoIndex,mode:"Model",longitude:v,latitude:T,fov:y,offset:_,distance:0}},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,e)},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));return(u.workCode!==this.currentPano.workCode||u.panoIndex!==this.currentPano.panoIndex||u.longitude!==this.cameraMotion.value.longitude||u.latitude!==this.cameraMotion.value.latitude||u.fov!==this.cameraMotion.value.fov)&&this.moveToPosition(u.offset,{duration:0,longitude:u.longitude,latitude:u.latitude,fov:u.fov},s),!0},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return u.distance=0,e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:0,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);for(var f=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=[],d=function(_){var S=h.modelScene.models.find(function(H){return H.work===_});if(!S||S.visible===!1||_.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(_.observerBox).expandByScalar(10).applyMatrix4(_.transform),scratchObserverBox$1.containsPoint(f))for(var w=0,R=_.observers;w<R.length;w++){var I=R[w];p.push(I)}},h=this,g=0,m=this.works;g<m.length;g++){var E=m[g];d(E)}var y=arrayMin(p,function(_){return scratchVector3$2.copy(_.position).applyMatrix4(_.work.transform).distanceTo(f)});this.currentPano=y?{workCode:y.work.workCode,panoIndex:y.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s);var v=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&v&&v.position.y-v.standingPosition.y>10){var A=this.camera.position.distanceTo(this.intersectMesh.position),b=2*Math.tan(.5*this.camera.fov/180*Math.PI),T=A*b/5;this.intersectMesh.scale.setScalar(T)}else this.intersectMesh.scale.setScalar(1)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={modelAlpha:1},f={perspToOrtho:0},p={longitude:l.longitude,latitude:l.latitude,fov:l.fov,duration:s,moveStartCallback:function(d){e.perspToOrthoMotion.set(f,s).catch(noop),e.modelAlphaMotion.set(c,s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:d,userAction:e.userAction}))},moveEndCallback:function(d){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:d,userAction:e.userAction})),r()},moveCancelCallback:function(){var d=e.currentPano,h=__assign(__assign({},d),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:h,userAction:e.userAction})),r()}};e.moveToPosition(l.offset,p,u)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={});var s=this.works.getObserver(e);if(s){var u=new THREE__namespace.Vector3().copy(s.position).applyMatrix4(s.work.transform);this.moveToPosition(u,r,o)}},t.prototype.moveToPosition=function(e,r,o){var s=this,u,l,c;r===void 0&&(r={}),this.userAction=o,this.stopMomentumMovement();for(var f=now(),p=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),d=p.distanceTo(e),h=this.locationMotion.getProgressVelocity(f),g=0,m=1;m<this.locationMotion.keyframes.length;m++){var E=this.locationMotion.keyframes[m-1].value,y=E.x,v=E.y,A=E.z,b=this.locationMotion.keyframes[m].value,T=b.x,_=b.y,S=b.z;g+=Math.sqrt(Math.pow(T-y,2)+Math.pow(_-v,2)+Math.pow(S-A,2))}for(var w=d===0?0:h*g/d,R=this.calculateMovingDuration(r.duration,d),I={x:e.x,y:e.y,z:e.z,distance:0},H={longitude:r.longitude,latitude:r.latitude,fov:r.fov},C=[],M=function(Q){var U=B.modelScene.models.find(function(re){return re.work===Q});if(!U||U.visible===!1||Q.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(Q.observerBox).expandByScalar(10).applyMatrix4(Q.transform),scratchObserverBox$1.containsPoint(p))for(var j=0,G=Q.observers;j<G.length;j++){var ae=G[j];C.push(ae)}},B=this,L=0,O=this.works;L<O.length;L++){var k=O[L];M(k)}var D=arrayMin(C,function(Q){return scratchVector3$2.copy(Q.position).applyMatrix4(Q.work.transform).distanceTo(p)}),q=D?{workCode:D.work.workCode,panoIndex:D.panoIndex}:{workCode:"",panoIndex:0},z=__assign(__assign({},q),{mode:this.mode,longitude:(u=H.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=H.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=H.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),V=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:V,progress:0,state:z,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(z),this.cameraMotion.set(H,R).catch(noop),this.locationMotion.set(I,R,w).then(function(){for(var Q=0,U=s.modelScene.children;Q<U.length;Q++){var j=U[Q];j instanceof Model&&j.show()}var G=__assign(__assign(__assign({},q),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:V,progress:0,state:G,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(G)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:V,progress:0,state:z,userAction:s.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var o=this.modelScene.intersectRaycaster(r)[0];if(o&&o.face){var s=o.face.normal,u=o.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(s)>Math.PI/3){var l=new THREE__namespace.Raycaster;l.firstHitOnly=!0;var c=s.clone().setLength(.3).add(u);l.set(c,new THREE__namespace.Vector3(0,-1,0)),o=this.modelScene.intersectRaycaster(l)[0]}}if(o){for(var f=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),p=[],d=function(T){var _=h.modelScene.models.find(function(I){return I.work===T});if(!_||_.visible===!1||T.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(T.observerBox).expandByScalar(10).applyMatrix4(T.transform),scratchObserverBox$1.containsPoint(f))for(var S=0,w=T.observers;S<w.length;S++){var R=w[S];p.push(R)}},h=this,g=0,m=this.works;g<m.length;g++){var E=m[g];d(E)}var y=arrayMin(p,function(T){return scratchVector3$2.copy(T.position).applyMatrix4(T.work.transform).distanceTo(f)},!0),v=y[0],A=y[1];if(v&&A<5){var b=scratchVector3$2.copy(v.position).applyMatrix4(v.work.transform);f.y=b.y}e.state.offset.copy(f),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(f,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t})(PanoramaLikeController),scratchObserverBox=new THREE__namespace.Box3,scratchVector3$1=new THREE__namespace.Vector3,minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,defaultMapviewControllerCustomInitArgs={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:+Math.PI/2,minLatitude:0,cameraType:"auto",cameraFence:null,intersectMeshCreator:function(){return new IntersectMesh}},MapviewController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.cameraFence=o.cameraFence,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.pendingTextureId=null,r.textureLoader=new TextureLoader,r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,p;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:defaultMapviewControllerCustomInitArgs.defaultLongitude,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:defaultMapviewControllerCustomInitArgs.defaultLatitude,defaultDistance:(s=e.defaultDistance)!==null&&s!==void 0?s:defaultMapviewControllerCustomInitArgs.defaultDistance,maxLatitude:(u=e.maxLatitude)!==null&&u!==void 0?u:defaultMapviewControllerCustomInitArgs.maxLatitude,minLatitude:(l=e.minLatitude)!==null&&l!==void 0?l:defaultMapviewControllerCustomInitArgs.minLatitude,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:defaultMapviewControllerCustomInitArgs.cameraType,cameraFence:(f=e.cameraFence)!==null&&f!==void 0?f:defaultMapviewControllerCustomInitArgs.cameraFence,intersectMeshCreator:(p=e.intersectMeshCreator)!==null&&p!==void 0?p:defaultMapviewControllerCustomInitArgs.intersectMeshCreator})},t.distanceFromModel=function(e,r,o){var s=e.boundingBox,u=s.isEmpty()?10:Math.pow(Math.pow(s.max.x-s.min.x+1,2)+Math.pow(s.max.y-s.min.y+1,2)+Math.pow(s.max.z-s.min.z+1,2),1/2);u=isNaN(u)||!isFinite(u)?1:u;var l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)||!isFinite(l)?u:l},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,p=this.parseArgs(e),d=p.works,h=p.modelScene,g=e.initial,m=g.state,E=g.currentState,y=typeof m.panoIndex=="number"?{workCode:(s=(r=m.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:m.panoIndex}:{workCode:E.workCode,panoIndex:E.panoIndex},v=(u=m.fov)!==null&&u!==void 0?u:60,A=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(v):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(v):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((l=m.latitude)!==null&&l!==void 0?l:isThirdPersonMode(E.mode)?E.latitude:p.defaultLatitude,A,b),_=t.distanceFromModel(p.modelScene,v,p.camera.aspect),S=new THREE__namespace.Vector3,w=(c=m.distance)!==null&&c!==void 0?c:Math.min(p.defaultDistance,_),R=(f=m.longitude)!==null&&f!==void 0?f:isThirdPersonMode(E.mode)?E.longitude:p.defaultLongitude;if(m.offset)S.copy(m.offset);else{var I=d.getObserver(y);p.defaultDistance<_&&I?(S.copy(I.position).applyMatrix4(I.work.transform),m.longitude===void 0&&(R=E.longitude)):(h.boundingBox.getCenter(S),w=_)}return __assign(__assign({},y),{mode:"Mapview",longitude:R,latitude:T,fov:v,offset:S,distance:w})},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof THREE__namespace.Box3&&e.cameraFence instanceof THREE__namespace.Box3?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):this.cameraFence instanceof THREE__namespace.Sphere&&e.cameraFence instanceof THREE__namespace.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!0},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.userAction=s,this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));this.currentPano={workCode:u.workCode,panoIndex:u.panoIndex};var l={longitude:u.longitude,latitude:u.latitude,fov:u.fov},c={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance};return(l.longitude!==this.cameraMotion.value.longitude||l.latitude!==this.cameraMotion.value.latitude||l.fov!==this.cameraMotion.value.fov)&&this.cameraMotion.set(l,o.duration).catch(noop),(c.x!==this.locationMotion.value.x||c.y!==this.locationMotion.value.y||c.z!==this.locationMotion.value.z||c.distance!==this.locationMotion.value.distance)&&this.locationMotion.set(c,o.duration).catch(noop),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e),this.hideIntersectMesh()},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return e.distance!==void 0&&(u.distance=e.distance),e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:p.value.distance,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.locationMotion.ended||(this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}var f=0;if(this.cameraType==="auto"?f=Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02?1:0:this.cameraType==="perspective"?f=0:this.cameraType==="orthographic"&&(f=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==f&&this.perspToOrthoMotion.set({perspToOrtho:f},500).catch(noop),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){var p=coordinatesToVector(this.camera.pose,new THREE__namespace.Vector3),d=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(p.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(d)>.01){var h=this.cameraFence.clampPoint(d,new THREE__namespace.Vector3),g=this.camera.pose.offset.clone().add(h).sub(d),m=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:g,distance:this.camera.pose.distance});this.fixFinalState(m),this.locationMotion.set({x:m.offset.x,y:m.offset.y,z:m.offset.z,distance:m.distance},300).catch(noop)}}if(this.intersectMesh&&this.intersectMesh.parent){var E=this.camera.position.distanceTo(this.intersectMesh.position),y=2*Math.tan(.5*this.camera.fov/180*Math.PI),v=E*y/5;this.intersectMesh.scale.setScalar(v)}else this.intersectMesh.scale.setScalar(1)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={longitude:l.longitude,latitude:l.latitude,fov:l.fov},f={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},p={modelAlpha:1},d={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.set(p,s/3).catch(noop),e.cameraMotion.set(c,s).catch(noop),e.locationMotion.set(f,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){var g=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this.modelScene.intersectRaycaster(e)[0];if(!r)return null;for(var o=[],s=function(g){var m=u.modelScene.models.find(function(A){return A.work===g});if(!m||m.visible===!1||g.observers.length<=0)return"continue";if(scratchObserverBox.copy(g.observerBox).expandByScalar(10).applyMatrix4(g.transform),scratchObserverBox.containsPoint(e.ray.origin)||e.ray.intersectsBox(scratchObserverBox))for(var E=0,y=g.observers;E<y.length;E++){var v=y[E];o.push(v)}},u=this,l=0,c=this.works;l<c.length;l++){var f=c[l];s(f)}var p=arrayMin(o,function(g){return scratchVector3$1.copy(g.standingPosition).applyMatrix4(g.work.transform).distanceTo(r.point)},!0),d=p[0],h=p[1];return d&&h<Math.max(d.standingPosition.distanceTo(this.camera.position)/5,10)?d:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.viewport.width),latitude:2*e.y/(r.y*this.viewport.height)}},t.prototype.requestMomentumMovement=function(e,r,o,s){var u=this;if(this.inMomentumMovement!==null){s=Math.max(s,1);for(var l=__assign({},o),c={longitude:0,latitude:0,x:0,y:0,z:0},f=0;f<s;f++)l.longitude*=.996,l.latitude*=.996*.998,l.x*=.99,l.y*=.99,l.z*=.99,c.longitude+=l.longitude,c.latitude+=l.latitude,c.x+=l.x,c.y+=l.y,c.z+=l.z;var p=this.cameraMotion.value.fov,d=formatRad$1(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(p):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(p):this.maxLatitude,-Math.PI/2,Math.PI/2),m=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),E=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),y=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:m,offset:E,fov:p,distance:this.locationMotion.value.distance}),v=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(y.distance)),A=!(Math.abs(l.longitude)>1e-4||Math.abs(l.latitude)>1e-4||Math.abs(l.x)>1e-4||Math.abs(l.y)>1e-4||Math.abs(l.z)>1e-4),b=this.cameraFence?this.cameraFence.containsPoint(v):!0;b===!1&&(A=!0);var T=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:A,state:y}));if(this.inMomentumMovement.event=T,this.emit("gesture.momentum",T),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:m},0).catch(noop),this.locationMotion.set({x:y.offset.x,y:y.offset.y,z:y.offset.z,distance:y.distance},0).catch(noop),A?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(_,S){u.requestMomentumMovement(e,!1,l,S)},!0))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),o=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),s=new THREE__namespace.Raycaster(o,r);s.params.Points={threshold:.1},s.firstHitOnly=!0,s.near=this.camera.near,s.far=this.camera.far;var u;if(u=this.modelScene.intersectRaycaster(s).filter(function(d){var h,g=(h=d.face)===null||h===void 0?void 0:h.normal;return g&&s.ray.direction.dot(g)>=0?!1:d.distance>minDistance+s.near})[0],!u){var l=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),c=s.ray.intersectPlane(l,new THREE__namespace.Vector3);if(c){var f=c.distanceTo(s.ray.origin);f<1e3&&f>=s.near&&(u={distance:f,floorIndex:0,floor:0,point:c,object:this.scene,face:null})}}if(!u){var p=Math.max(e.distance,3);u={distance:p,floorIndex:0,floor:0,point:s.ray.direction.clone().setLength(p).add(s.ray.origin),object:this.scene,face:null}}u&&(e.distance=clamp$1(u.distance,0,1/0),e.offset.copy(o).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,o=this.panState,s=0,u=!1;e.pointerType==="mouse"&&(s=e.srcEvent.buttons,u=e.srcEvent.shiftKey),o&&s===0&&o.buttons!==0&&(s=o.buttons);var l=o==null?void 0:o.target;if(!l){var c=this.relativeClientPosition(e.center),f=this.createRaycasterFromCamera(c,this.camera);l=new THREE__namespace.Vector3().copy(f.ray.direction).multiplyScalar(3).add(f.ray.origin);var p=this.modelScene.intersectRaycaster(f)[0];if(!p&&f.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),h=f.ray.intersectPlane(d,new THREE__namespace.Vector3);if(h){var g=h.distanceTo(f.ray.origin);g<1e4&&g>=f.near&&(p={distance:g,floorIndex:0,floor:0,point:h,object:this.scene})}}if(p)l.copy(p.point);else{var m=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(m,this.camera.pose.offset);f.ray.intersectPlane(d,l)}}if(e.isFinal?this.panState=void 0:this.panState={target:l,buttons:s,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof o=="undefined"||o.pointerLength!==r)){var E=r>1||s===2||u;if(E){var y={x:e.center.x-o.x,y:e.center.y-o.y},v=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),A=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(v),b=new THREE__namespace.Vector3().copy(A).sub(o.target).length();b*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var T=this.renderer.getSize(new THREE__namespace.Vector2),_=2*y.x*b/T.y,S=2*y.y*b/T.y,w=new THREE__namespace.Vector3;w.setFromMatrixColumn(this.camera.matrix,0),w.multiplyScalar(-_),v.add(w),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?w.setFromMatrixColumn(this.camera.matrix,1):(w.setFromMatrixColumn(this.camera.matrix,0),w.crossVectors(this.camera.up,w)),w.multiplyScalar(S),v.add(w);var R=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:v,distance:this.camera.pose.distance});if(e.state=R,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop),e.isFinal&&(this.fixFinalState(R),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:R.distance,x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop)),e.isFinal){var I=this.renderer.getSize(new THREE__namespace.Vector2),H=2*e.velocityX*b/I.y,C=2*e.velocityY*b/I.y,M=new THREE__namespace.Vector3,B=new THREE__namespace.Vector3;M.setFromMatrixColumn(this.camera.matrix,0),M.multiplyScalar(-H),B.add(M),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?M.setFromMatrixColumn(this.camera.matrix,1):(M.setFromMatrixColumn(this.camera.matrix,0),M.crossVectors(this.camera.up,M)),M.multiplyScalar(C),B.add(M),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:B.x,y:B.y,z:B.z},0)}}else{var y={x:e.center.x-o.x,y:e.center.y-o.y},L=this.coordinatesForOffset(y),O=formatRad$1(this.cameraMotion.value.longitude+L.longitude),k=this.camera.pose.fov,D=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(k):this.minLatitude,-Math.PI/2,Math.PI/2),q=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(k):this.maxLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(this.cameraMotion.value.latitude+L.latitude,D,q);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(z=this.cameraMotion.value.latitude);var R=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:O,latitude:z,fov:k,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=R,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:R.distance,x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop):this.cameraMotion.set({longitude:R.longitude,latitude:R.latitude},0).catch(noop),e.isFinal){var V=e.velocityX,Q=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:V,y:Q})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var o=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof o!="undefined"){var s=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),l=clamp$1(o/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(l)),f=this.modelScene.boundingBox.containsPoint(c),p;if(!f&&this.pinchState&&this.pinchState.scale>e.scale&&s.distanceTo(c)>u?p=e.state.distance:(p=l,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=p,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var d=e.state;this.fixFinalState(e.state);var h={x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance};this.locationMotion.set(h,0).catch(noop)}this.panState=void 0,this.pinchState=void 0}}}},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var s=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var u=this.modelScene.intersectRaycaster(s)[0],l=createEvent("intersect.update",{raycaster:s,intersection:u!=null?u:null,object:this.intersectMesh});if(this.emit("intersect.update",l),l.defaultPrevented){this.hideIntersectMesh();return}if(u){var c=(o=(r=u.face)===null||r===void 0?void 0:r.normal)!==null&&o!==void 0?o:new THREE__namespace.Vector3().copy(s.ray.direction).multiplyScalar(-1),f=c.clone(),p=u.point.clone();this.intersectMesh.position.copy(p);var d=p.clone().add(f);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(p);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var o={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(o,0).catch(noop)}else{var s=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),u=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=coordinatesToVector(this.cameraMotion.value,new THREE__namespace.Vector3).negate(),c=new THREE__namespace.Ray(u,l).intersectBox(this.modelScene.boundingBox,new THREE__namespace.Vector3);c&&(s+=c.distanceTo(u));var f=Math.max(this.locationMotion.value.distance-this.camera.near,0),p=e.center.delta/10*Math.max(f/5,.1);if(f<=s||p>0)if(this.locationMotion.value.distance-p>=minDistance){var d=this.locationMotion.value.distance-p;e.state.distance=d}else{var h=coordinatesToVector(this.cameraMotion.value);h.setLength(p),e.state.offset.add(h)}if(this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:e.state.distance,x:e.state.offset.x,y:e.state.offset.y,z:e.state.offset.z},0).catch(noop)}},t.prototype.onTapGesture=function(e){var r=this,o;this.userAction=e.userAction,this.stopMomentumMovement();var s=e.center.raycaster,u=this.getForwardObserverOrNot(s);if(!u)this.emit("gesture.tap",e);else{var l={longitude:this.camera.pose.longitude,latitude:0},c=__assign(__assign({},e.state),{mode:"Panorama",workCode:u.work.workCode,panoIndex:u.panoIndex,longitude:l.longitude,latitude:l.latitude,offset:u?u.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=c,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:c,userAction:e.userAction,options:l,progress:0,error:null})),u&&u.active)){var f=this.pendingTextureId=createUuid(),p={panoIndex:u.panoIndex,workCode:u.work.workCode},d=panoStringify(p),h={right:u.images.work.getURL(u.images.right),left:u.images.work.getURL(u.images.left),up:u.images.work.getURL(u.images.up),down:u.images.work.getURL(u.images.down),front:u.images.work.getURL(u.images.front),back:u.images.work.getURL(u.images.back)},g=this.imageOptions.transform,m=__assign({key:"pano.".concat(d)},pick(this.imageOptions,["format","size","quality","sharpen","forceUseExifOrientation","mappings"])),E="pano:"+jsonHash([h,m,g]),y=this.modelScene.parameter,v=void 0;y.pano0&&y.pano0.map.name===E?v=y.pano0:y.pano1&&y.pano1.map.name===E&&(v=y.pano1),v?(y.pano0&&y.pano0.map!==v.map&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==v.map&&y.pano1.map!==((o=y.pano0)===null||o===void 0?void 0:o.map)&&y.pano1.map.dispose(),y.set({pano0:v,pano1:v}),this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:c,options:l,error:null}))):this.textureLoader.loadCubeTexture(h,{imageURL:{transform:g,options:m},format:THREE__namespace.RGBFormat,viaAjax:!0,fetcher:getFetcher(this.fiveId,u.work)},void 0,void 0,void 0,this.renderer).then(function(A){var b,T,_=A.body;if(r.destroyed||r.pendingTextureId!==f){_.dispose();return}r.pendingTextureId=null,_.name=E;var S=Array.isArray(_.image)?_.image[0]:_.image,w=(b=S==null?void 0:S.width)!==null&&b!==void 0?b:2048,R={panoId:d,map:_,mapSize:w,matrix:u.matrix.clone().premultiply(u.work.transform),zoom:1};y.pano0&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==((T=y.pano0)===null||T===void 0?void 0:T.map)&&y.pano1.map.dispose(),y.set({pano0:R,pano1:R}),r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:c,options:l,error:null}))}).catch(function(A){r.destroyed||r.pendingTextureId!==f||(r.pendingTextureId=null)})}}},t.prototype.onDblTapGesture=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.state,o=e.center.raycaster,s=o.ray.origin.clone().add(o.ray.direction.clone().setLength(3)),u=1,l=3,c=u,f=this.modelScene.intersectRaycaster(o)[0];if(f&&(s=f.point.clone(),f.distance>(u+l)/2?c=u:c=l),e.state.distance=c,e.state.offset=s,this.emit("gesture.dbltap",e),!e.defaultPrevented){var p={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(p,360).catch(noop),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)},t})(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=(function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var o=null,s=null,u=null,l=this._targetRay,c=this._grip,f=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(l!==null&&(o=e.getPose(t.targetRaySpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),f&&t.hand){u=!0;for(var p=0,d=t.hand.values();p<d.length;p++){var h=d[p],g=e.getJointPose(h,r);if(f.joints[h.jointName]===void 0){var m=new THREE__namespace.Group;m.matrixAutoUpdate=!1,m.visible=!1,f.joints[h.jointName]=m,f.add(m)}var E=f.joints[h.jointName];g!==null&&(E.matrix.fromArray(g.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.jointRadius=g.radius),E.visible=g!==null}var y=f.joints["index-finger-tip"],v=f.joints["thumb-tip"],A=y.position.distanceTo(v.position),b=.02,T=.005;f.inputState.pinching&&A>b+T?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&A<=b-T&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));return l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),f!==null&&(f.visible=u!==null),this},n})(),framebufferScaleFactor=1,isAppleVisionPro=function(){try{var n=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return n&&t}catch(e){return console.error("Error determining if the device is an Apple Vision Pro: ",e),!1}},isOculus=function(){try{return/Oculus/i.test(navigator.userAgent)}catch(n){return console.error("Error determining if the device is an Oculus: ",n),!1}},XRManager=(function(){function n(t,e,r){var o,s,u,l,c;this.isPanorama=(o=r==null?void 0:r.isPanorama)!==null&&o!==void 0?o:!0,navigator.userAgent.toLowerCase();var f;isAppleVisionPro()?f="VP":isOculus()?f="Oculus":f="Pico",this.machineType=(s=r==null?void 0:r.machineType)!==null&&s!==void 0?s:f,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(u=r==null?void 0:r.referenceSpaceType)!==null&&u!==void 0?u:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(l=r==null?void 0:r.onSessionStart)!==null&&l!==void 0?l:noop,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraVR.cameras.push(this.cameraL,this.cameraR),this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var o=this.cameraLPos.distanceTo(this.cameraRPos),s=e.projectionMatrix.elements,u=r.projectionMatrix.elements,l=s[14]/(s[10]-1),c=s[14]/(s[10]+1),f=(s[9]+1)/s[5],p=(s[9]-1)/s[5],d=(s[8]-1)/s[0],h=(u[8]+1)/u[0],g=l*d,m=l*h,E=o/(-d+h),y=E*-d;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(E),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=l+E,A=c+E,b=g-y,T=m+(o-y),_=f*c/A*v,S=p*c/A*v;t.projectionMatrix.makePerspective(b,T,_,S,v,A)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var o=0;o<r.length;o++)this.updateCamera(r[o],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var s=t.children,o=0,u=s.length;o<u;o++)s[o].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var o=t.removed[r],s=this.inputSourcesMap.get(o);s&&(s.dispatchEvent({type:"disconnected",data:o}),this.inputSourcesMap.delete(o))}for(var r=0;r<t.added.length;r++){var o=t.added[r],s=this.inputSourcesMap.get(o);s&&s.dispatchEvent({type:"connected",data:o})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectstart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeeze",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezestart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezeend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("end",function(o){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var o={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;case"Oculus":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(s){e.onRequestReferenceSpace(s)}),e.session.addEventListener("inputsourceschange",function(s){e.updateInputSources(s)})})}},n})(),LineSegmentsGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],o=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(s),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(o,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,o=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),o.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),o.setFromBufferAttribute(r),this.boundingBox.union(o)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=this.boundingSphere.center;this.boundingBox.getCenter(o);for(var s=0,u=new THREE__namespace.Vector3,l=0,c=e.count;l<c;l++)u.fromBufferAttribute(e,l),s=Math.max(s,o.distanceToSquared(u)),u.fromBufferAttribute(r,l),s=Math.max(s,o.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t})(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
2151
+ `,PanoSphereMesh=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.progress=0,e.opacity=0,e.loading=!1,e.current=!1,e.disabled=!1,e.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),e.opacityMotion=new Motion({opacity:0}),e.loadingMotion=new Motion({opacity:0}),e.disableMotion=new Motion({opacity:0});var r={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return e.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},r),{color:0,opacity:0}))),e.hitTestMesh.scale.set(1.5,1.5,1.5),e.ringMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),e.panoMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader,fragmentShader,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),e.add(e.hitTestMesh),e.add(e.ringMesh),e.add(e.panoMesh),e.renderOrder=1e4,e.needsRender=!0,e}return t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var r=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}];this.currentMotion.setKeyframes(r,1500).catch(noop)}else{var r=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(r,200).catch(noop)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(noop):this.loadingMotion.set({opacity:0},0).catch(noop),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,r){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var o=this.opacityMotion.value.opacity;this.visible=o!==0;var s=this.currentMotion.value,u=s.ringScale,l=s.ringOpacity,c=s.circleFade,f=s.circleOpacity,p=s.circleScale;this.ringMesh.scale.set(u,1,u),this.ringMesh.material.uniforms.opacity.value=l*o,this.panoMesh.material.uniforms.opacity.value=o,this.panoMesh.material.uniforms.circleOpacity.value=f,this.panoMesh.material.uniforms.circleScale.value=p,this.panoMesh.material.uniforms.circleFade.value=c,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t})(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,defaultVRPanoramaControllerCustomInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"])),VRPanoramaController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var s=createHelper();r.helperElement=s;var u=new Hammer(s);return r.element.parentNode&&(r.element.parentNode.insertBefore(s,r.element),r.updateHelperElementSize(),u.on("tap",function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))})),r.destroyHelper=function(){u.destroy(),s.parentNode&&s.parentNode.removeChild(s),r.helperElement=void 0},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"VRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper()},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,p;if(!this.destroyed){this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0;var d={},h={},g=this.locationMotion.keyframes[0],m=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],E=this.locationMotion.getKeyFrameSegment(e),y=E[0],v=E[1],A=this.panoResourceFromLocationMotionKeyframe(y),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(g),_=this.panoResourceFromLocationMotionKeyframe(m),S=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var w=this.locationMotion.value.count-v.value.count+1,R=new THREE__namespace.Vector3().copy(A.position),I=new THREE__namespace.Vector3().copy(b.position);if(d.progress=w,w>=.01&&w<=.99&&(d.progress=clamp$1(b.effectEasing(w),.01,.99)),b.panoPicture&&(w<1?A.panoPicture&&(d.pano0=A.panoPicture):d.pano0=b.panoPicture,d.pano1=b.panoPicture),b.effect==="montage"?d.transition="BLACK":b.effect==="spread"?d.transition="SPREAD":d.transition="FADE",b.effect==="zoomin"||b.effect==="zoomout")d.progress=Math.pow(w,3);else if(b.effect==="model"&&this.camera.pose.distance<.01){var H=1-Math.pow(clamp$1(Math.abs(w-.5)*2,0,1),4);d.modelAlpha=H}if(w<1&&b.effect!=="fly"){if(d.pano0&&A.panoPicture){var C={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:A.panoPicture.matrix.clone().setPosition(b.position)},M=this.panoPictureObserverMap.get(d.pano0);M&&this.panoPictureObserverMap.set(C,M),d.pano0=C}R.copy(I),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(R.x+(I.x-R.x)*w,R.y+(I.y-R.y)*w,R.z+(I.z-R.z)*w);for(var B=[],L=[],O=0,k=this.locationMotion.keyframes;O<k.length;O++){var D=k[O],q=D.key,z=D.progress;q!==void 0&&(B.push(q),z>this.locationMotion.progress&&L.push(q))}for(var J=0,V=Object.keys(this.panoResources);J<V.length;J++){var U=V[J];if(!(L.indexOf(U)>=0)){var j=this.panoResources[U];if(j.panoPicture){var K=j.panoPicture.map;if(K){if(K===((s=d.pano0)===null||s===void 0?void 0:s.map)||K===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;K.dispose(),j.panoPicture=null}}B.indexOf(U)>=0||delete this.panoResources[U]}}this.currentPano=panoParse(b.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(T.panoId),state:__assign(__assign(__assign(__assign({},panoParse(_.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),h.offset&&this.camera.position.copy(h.offset);var ae=this.camera.pose.longitude,re=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(ae!==this.camera.pose.longitude||re!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}))),this.works.getObserver(this.currentPano);var ee=this.works.getObserver(A.panoId),Z=this.works.getObserver(b.panoId),X=new Map;if(ee)for(var se=0,G=ee.accessibleNodes;se<G.length;se++){var W=G[se],M=ee.work.observers[W];if(M){var $=panoStringify({panoIndex:M.panoIndex,workCode:M.work.workCode});X.set($,M)}}if(Z)for(var ne=0,te=Z.accessibleNodes;ne<te.length;ne++){var W=te[ne],M=Z.work.observers[W];if(M){var $=panoStringify({panoIndex:M.panoIndex,workCode:M.work.workCode});X.set($,M)}}if(this.panoMeshes.forEach(function(Se,ze){var Fe=X.get(ze);Fe?(Se.position.copy(Fe.position).applyMatrix4(Fe.work.transform),X.delete(ze)):(o.helper.remove(Se),Se.dispose(),o.panoMeshes.delete(ze))}),X.forEach(function(Se,ze){var Fe=new PanoSphereMesh;Fe.position.copy(Se.position).applyMatrix4(Se.work.transform);var Oe=Se.position.distanceTo(Se.standingPosition)>o.aerialObserverMinHeight;Oe?Fe.scale.setScalar(15):Fe.scale.setScalar(1),o.panoMeshes.set(ze,Fe),o.helper.add(Fe),X.delete(ze)}),this.camera.pose.distance>.1||S?this.panoMeshes.forEach(function(Se,ze){Se.setOpacity(0),Se.updateTime&&Se.updateTime(e,r),Se.visible=!1}):this.panoMeshes.forEach(function(Se,ze){var Fe=panoParse(ze),Oe=o.works.getObserver(Fe);if(Oe){if(!Oe.loadable&&!Oe.active){Se.setOpacity(0);return}var Le=Se.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Le<.05?Se.setOpacity(0):Se.setOpacity(clamp$1(1.5/Le,0,1)),panoEqual(o.currentPano,Fe)&&Se.setOpacity(0),Se.lookAt(o.camera.position)}}),this.locationMotion.ended){var ve=this.intersect(e);this.panoMeshes.forEach(function(Se,ze){Se.setCurrent(Se===ve),Se.updateTime&&Se.updateTime(e,r)})}{var w=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,oe=Math.round(w),fe=this.modelScene.parameter.pano0,be=this.modelScene.parameter.pano1,ie=oe===0?fe:be,M=void 0;if(ie&&(M=this.works.getObserver(ie.panoId),M||(M=this.panoPictureObserverMap.get(ie))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=w<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!M||!ie||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var ue={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(ue),this.modelScene.parameter.set("refinedScreen",null)}else{var me=getImageSizeLevel(ie.mapSize),ge=me+1,Ae=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),xe=Math.floor(this.tileLevelForFov(this.camera.fov,Ae)),de=xe>me?xe:0;this.tiling.setObserver(M);var ue={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:ie.map,panoMatrix:ie.matrix,panoZoom:ie.zoom,minLevel:ge,level:de},_e=this.tiling.update(ue),He={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:oe,opacity:(fe==null?void 0:fe.panoId)===(be==null?void 0:be.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Ee=this.modelScene.parameter.refinedScreen;(_e||He.pano!==(Ee==null?void 0:Ee.pano)||He.opacity!==(Ee==null?void 0:Ee.opacity))&&this.modelScene.parameter.set("refinedScreen",He)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var pe=b.effect,Ve=this.modelScene.parameter,fe=Ve.pano0,be=Ve.pano1;if(fe&&be&&fe!==be&&(pe==="fly"||pe==="model")&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==fe.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==be.panoId){var ye=500,Pe=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Pe&&this.pano0DepthCubeRenderTarget.setSize(Pe,Pe):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Pe,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Pe&&this.pano1DepthCubeRenderTarget.setSize(Pe,Pe):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Pe,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Ce=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Ce.matrix.copy(fe.matrix),Ce.matrixWorld.copy(Ce.matrix),Ce.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Ce,ye);var $e=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);$e.matrix.copy(be.matrix),$e.matrixWorld.copy($e.matrix),$e.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,$e,ye),this.modelScene.parameter.set({pano0Depth:{panoId:fe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:ye},pano1Depth:{panoId:be.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:ye}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},t.prototype.render=function(){return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.cardboard.render(this.scene,this.camera),!0},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.updateHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.viewport.left,o=e.y*(1-this.viewport.bottom-this.viewport.height),s=e.x*this.viewport.width,u=e.y*this.viewport.height;this.helperElement.style.marginLeft!==r+"px"&&(this.helperElement.style.marginLeft=r+"px"),this.helperElement.style.marginTop!==o+"px"&&(this.helperElement.style.marginTop=o+"px"),this.helperElement.style.width!==s+"px"&&(this.helperElement.style.width=s+"px"),this.helperElement.style.height!==u+"px"&&(this.helperElement.style.height=u+"px")}},t.prototype.intersect=function(e){var r,o;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,this.activePanoMesh=void 0,this.activeTime=void 0;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){var s=this.activePanoMesh,u=null;return this.panoMeshes.forEach(function(R,I){R===s&&(u=I)}),u!==null&&this.moveToPano(panoParse(u),{},!0),this.activePanoMesh=void 0,this.activeTime=void 0,s}var l=this.camera.getDirection(new THREE__namespace.Vector3),c=new THREE__namespace.Raycaster(this.camera.position,l);c.params.Points={threshold:.1},c.firstHitOnly=!0,c.floorIndex=-1;for(var f=void 0,p=[],d=this.works.getObserver(this.currentPano),h=d?d.accessibleNodes.map(function(R){return panoStringify({panoIndex:R,workCode:d.work.workCode})}):[],g=0,m=h;g<m.length;g++){var E=m[g],y=this.panoMeshes.get(E);if(y){var v=c.intersectObject((r=y.hitTestMesh)!==null&&r!==void 0?r:y,!0)[0];if(v){var A=(o=d==null?void 0:d.floorIndex)!==null&&o!==void 0?o:0;p.push({panoMesh:y,intersection:__assign({floorIndex:A,floor:A},v)})}}}var b=p.sort(function(R,I){return R.intersection.distance-I.intersection.distance})[0];b?(f=b.intersection,this.activePanoMesh!==b.panoMesh&&(this.activePanoMesh=b.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(b.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),f||(f=this.modelScene.intersectRaycaster(c)[0]);var T=createEvent("intersect.update",{raycaster:c,intersection:f!=null?f:null,object:this.intersectMesh});if(this.emit("intersect.update",T),T.defaultPrevented){this.hideIntersectMesh();return}if(f&&f.face){var _=f.face.normal,S=new THREE__namespace.Quaternion;S.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),_),this.intersectMesh.quaternion.copy(S);var w=f.point.clone();this.intersectMesh.position.copy(w),b?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return b==null?void 0:b.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t})(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),scratchObserverBox$1=new THREE__namespace.Box3,scratchVector3$2=new THREE__namespace.Vector3,defaultModelControllerCustomInitArgs=__assign({},defaultPanoramaLikeControllerCustomInitArgs),ModelController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Model",r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r}return t.parseArgs=function(e){return e instanceof t?e:n.parseArgs.call(this,e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f=this.parseArgs(e),p=f.works,d=e.initial,h=d.state,g=d.currentState,m=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},E=p.getObserver(m),y=clamp$1((u=h.fov)!==null&&u!==void 0?u:!E||isFristPersonMode(g.mode)?g.fov:f.defaultFov,f.minFov,f.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:g.longitude,A=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(y):f.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(y):f.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:!E||isFristPersonMode(g.mode)?g.latitude:f.defaultLatitude,A,b),_=new THREE__namespace.Vector3;if(f.initial.state.offset)_.copy(f.initial.state.offset);else if(E)_.copy(E.position).applyMatrix4(E.work.transform);else{var S=coordinatesToVector(g).setLength(g.distance);_.copy(f.initial.currentState.offset).sub(S)}return{workCode:m.workCode,panoIndex:m.panoIndex,mode:"Model",longitude:v,latitude:T,fov:y,offset:_,distance:0}},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,e)},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));return(u.workCode!==this.currentPano.workCode||u.panoIndex!==this.currentPano.panoIndex||u.longitude!==this.cameraMotion.value.longitude||u.latitude!==this.cameraMotion.value.latitude||u.fov!==this.cameraMotion.value.fov)&&this.moveToPosition(u.offset,{duration:0,longitude:u.longitude,latitude:u.latitude,fov:u.fov},s),!0},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return u.distance=0,e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:0,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);for(var f=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=[],d=function(_){var S=h.modelScene.models.find(function(H){return H.work===_});if(!S||S.visible===!1||_.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(_.observerBox).expandByScalar(10).applyMatrix4(_.transform),scratchObserverBox$1.containsPoint(f))for(var w=0,R=_.observers;w<R.length;w++){var I=R[w];p.push(I)}},h=this,g=0,m=this.works;g<m.length;g++){var E=m[g];d(E)}var y=arrayMin(p,function(_){return scratchVector3$2.copy(_.position).applyMatrix4(_.work.transform).distanceTo(f)});this.currentPano=y?{workCode:y.work.workCode,panoIndex:y.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s);var v=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&v&&v.position.y-v.standingPosition.y>10){var A=this.camera.position.distanceTo(this.intersectMesh.position),b=2*Math.tan(.5*this.camera.fov/180*Math.PI),T=A*b/5;this.intersectMesh.scale.setScalar(T)}else this.intersectMesh.scale.setScalar(1)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={modelAlpha:1},f={perspToOrtho:0},p={longitude:l.longitude,latitude:l.latitude,fov:l.fov,duration:s,moveStartCallback:function(d){e.perspToOrthoMotion.set(f,s).catch(noop),e.modelAlphaMotion.set(c,s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:d,userAction:e.userAction}))},moveEndCallback:function(d){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:d,userAction:e.userAction})),r()},moveCancelCallback:function(){var d=e.currentPano,h=__assign(__assign({},d),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:h,userAction:e.userAction})),r()}};e.moveToPosition(l.offset,p,u)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={});var s=this.works.getObserver(e);if(s){var u=new THREE__namespace.Vector3().copy(s.position).applyMatrix4(s.work.transform);this.moveToPosition(u,r,o)}},t.prototype.moveToPosition=function(e,r,o){var s=this,u,l,c;r===void 0&&(r={}),this.userAction=o,this.stopMomentumMovement();for(var f=now(),p=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),d=p.distanceTo(e),h=this.locationMotion.getProgressVelocity(f),g=0,m=1;m<this.locationMotion.keyframes.length;m++){var E=this.locationMotion.keyframes[m-1].value,y=E.x,v=E.y,A=E.z,b=this.locationMotion.keyframes[m].value,T=b.x,_=b.y,S=b.z;g+=Math.sqrt(Math.pow(T-y,2)+Math.pow(_-v,2)+Math.pow(S-A,2))}for(var w=d===0?0:h*g/d,R=this.calculateMovingDuration(r.duration,d),I={x:e.x,y:e.y,z:e.z,distance:0},H={longitude:r.longitude,latitude:r.latitude,fov:r.fov},C=[],M=function(V){var U=B.modelScene.models.find(function(re){return re.work===V});if(!U||U.visible===!1||V.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(V.observerBox).expandByScalar(10).applyMatrix4(V.transform),scratchObserverBox$1.containsPoint(p))for(var j=0,K=V.observers;j<K.length;j++){var ae=K[j];C.push(ae)}},B=this,L=0,O=this.works;L<O.length;L++){var k=O[L];M(k)}var D=arrayMin(C,function(V){return scratchVector3$2.copy(V.position).applyMatrix4(V.work.transform).distanceTo(p)}),q=D?{workCode:D.work.workCode,panoIndex:D.panoIndex}:{workCode:"",panoIndex:0},z=__assign(__assign({},q),{mode:this.mode,longitude:(u=H.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=H.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=H.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),J=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:J,progress:0,state:z,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(z),this.cameraMotion.set(H,R).catch(noop),this.locationMotion.set(I,R,w).then(function(){for(var V=0,U=s.modelScene.children;V<U.length;V++){var j=U[V];j instanceof Model&&j.show()}var K=__assign(__assign(__assign({},q),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:J,progress:0,state:K,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(K)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:J,progress:0,state:z,userAction:s.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var o=this.modelScene.intersectRaycaster(r)[0];if(o&&o.face){var s=o.face.normal,u=o.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(s)>Math.PI/3){var l=new THREE__namespace.Raycaster;l.firstHitOnly=!0;var c=s.clone().setLength(.3).add(u);l.set(c,new THREE__namespace.Vector3(0,-1,0)),o=this.modelScene.intersectRaycaster(l)[0]}}if(o){for(var f=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),p=[],d=function(T){var _=h.modelScene.models.find(function(I){return I.work===T});if(!_||_.visible===!1||T.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(T.observerBox).expandByScalar(10).applyMatrix4(T.transform),scratchObserverBox$1.containsPoint(f))for(var S=0,w=T.observers;S<w.length;S++){var R=w[S];p.push(R)}},h=this,g=0,m=this.works;g<m.length;g++){var E=m[g];d(E)}var y=arrayMin(p,function(T){return scratchVector3$2.copy(T.position).applyMatrix4(T.work.transform).distanceTo(f)},!0),v=y[0],A=y[1];if(v&&A<5){var b=scratchVector3$2.copy(v.position).applyMatrix4(v.work.transform);f.y=b.y}e.state.offset.copy(f),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(f,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t})(PanoramaLikeController),scratchObserverBox=new THREE__namespace.Box3,scratchVector3$1=new THREE__namespace.Vector3,minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,defaultMapviewControllerCustomInitArgs={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:+Math.PI/2,minLatitude:0,cameraType:"auto",cameraFence:null,intersectMeshCreator:function(){return new IntersectMesh}},MapviewController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.cameraFence=o.cameraFence,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.pendingTextureId=null,r.textureLoader=new TextureLoader,r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,p;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:defaultMapviewControllerCustomInitArgs.defaultLongitude,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:defaultMapviewControllerCustomInitArgs.defaultLatitude,defaultDistance:(s=e.defaultDistance)!==null&&s!==void 0?s:defaultMapviewControllerCustomInitArgs.defaultDistance,maxLatitude:(u=e.maxLatitude)!==null&&u!==void 0?u:defaultMapviewControllerCustomInitArgs.maxLatitude,minLatitude:(l=e.minLatitude)!==null&&l!==void 0?l:defaultMapviewControllerCustomInitArgs.minLatitude,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:defaultMapviewControllerCustomInitArgs.cameraType,cameraFence:(f=e.cameraFence)!==null&&f!==void 0?f:defaultMapviewControllerCustomInitArgs.cameraFence,intersectMeshCreator:(p=e.intersectMeshCreator)!==null&&p!==void 0?p:defaultMapviewControllerCustomInitArgs.intersectMeshCreator})},t.distanceFromModel=function(e,r,o){var s=e.boundingBox,u=s.isEmpty()?10:Math.pow(Math.pow(s.max.x-s.min.x+1,2)+Math.pow(s.max.y-s.min.y+1,2)+Math.pow(s.max.z-s.min.z+1,2),1/2);u=isNaN(u)||!isFinite(u)?1:u;var l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)||!isFinite(l)?u:l},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,p=this.parseArgs(e),d=p.works,h=p.modelScene,g=e.initial,m=g.state,E=g.currentState,y=typeof m.panoIndex=="number"?{workCode:(s=(r=m.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:m.panoIndex}:{workCode:E.workCode,panoIndex:E.panoIndex},v=(u=m.fov)!==null&&u!==void 0?u:60,A=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(v):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(v):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((l=m.latitude)!==null&&l!==void 0?l:isThirdPersonMode(E.mode)?E.latitude:p.defaultLatitude,A,b),_=t.distanceFromModel(p.modelScene,v,p.camera.aspect),S=new THREE__namespace.Vector3,w=(c=m.distance)!==null&&c!==void 0?c:Math.min(p.defaultDistance,_),R=(f=m.longitude)!==null&&f!==void 0?f:isThirdPersonMode(E.mode)?E.longitude:p.defaultLongitude;if(m.offset)S.copy(m.offset);else{var I=d.getObserver(y);p.defaultDistance<_&&I?(S.copy(I.position).applyMatrix4(I.work.transform),m.longitude===void 0&&(R=E.longitude)):(h.boundingBox.getCenter(S),w=_)}return __assign(__assign({},y),{mode:"Mapview",longitude:R,latitude:T,fov:v,offset:S,distance:w})},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof THREE__namespace.Box3&&e.cameraFence instanceof THREE__namespace.Box3?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):this.cameraFence instanceof THREE__namespace.Sphere&&e.cameraFence instanceof THREE__namespace.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!0},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.userAction=s,this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));this.currentPano={workCode:u.workCode,panoIndex:u.panoIndex};var l={longitude:u.longitude,latitude:u.latitude,fov:u.fov},c={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance};return(l.longitude!==this.cameraMotion.value.longitude||l.latitude!==this.cameraMotion.value.latitude||l.fov!==this.cameraMotion.value.fov)&&this.cameraMotion.set(l,o.duration).catch(noop),(c.x!==this.locationMotion.value.x||c.y!==this.locationMotion.value.y||c.z!==this.locationMotion.value.z||c.distance!==this.locationMotion.value.distance)&&this.locationMotion.set(c,o.duration).catch(noop),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e),this.hideIntersectMesh()},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return e.distance!==void 0&&(u.distance=e.distance),e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:p.value.distance,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.locationMotion.ended||(this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}var f=0;if(this.cameraType==="auto"?f=Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02?1:0:this.cameraType==="perspective"?f=0:this.cameraType==="orthographic"&&(f=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==f&&this.perspToOrthoMotion.set({perspToOrtho:f},500).catch(noop),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){var p=coordinatesToVector(this.camera.pose,new THREE__namespace.Vector3),d=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(p.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(d)>.01){var h=this.cameraFence.clampPoint(d,new THREE__namespace.Vector3),g=this.camera.pose.offset.clone().add(h).sub(d),m=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:g,distance:this.camera.pose.distance});this.fixFinalState(m),this.locationMotion.set({x:m.offset.x,y:m.offset.y,z:m.offset.z,distance:m.distance},300).catch(noop)}}if(this.intersectMesh&&this.intersectMesh.parent){var E=this.camera.position.distanceTo(this.intersectMesh.position),y=2*Math.tan(.5*this.camera.fov/180*Math.PI),v=E*y/5;this.intersectMesh.scale.setScalar(v)}else this.intersectMesh.scale.setScalar(1)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={longitude:l.longitude,latitude:l.latitude,fov:l.fov},f={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},p={modelAlpha:1},d={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.set(p,s/3).catch(noop),e.cameraMotion.set(c,s).catch(noop),e.locationMotion.set(f,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){var g=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this.modelScene.intersectRaycaster(e)[0];if(!r)return null;for(var o=[],s=function(g){var m=u.modelScene.models.find(function(A){return A.work===g});if(!m||m.visible===!1||g.observers.length<=0)return"continue";if(scratchObserverBox.copy(g.observerBox).expandByScalar(10).applyMatrix4(g.transform),scratchObserverBox.containsPoint(e.ray.origin)||e.ray.intersectsBox(scratchObserverBox))for(var E=0,y=g.observers;E<y.length;E++){var v=y[E];o.push(v)}},u=this,l=0,c=this.works;l<c.length;l++){var f=c[l];s(f)}var p=arrayMin(o,function(g){return scratchVector3$1.copy(g.standingPosition).applyMatrix4(g.work.transform).distanceTo(r.point)},!0),d=p[0],h=p[1];return d&&h<Math.max(d.standingPosition.distanceTo(this.camera.position)/5,10)?d:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.viewport.width),latitude:2*e.y/(r.y*this.viewport.height)}},t.prototype.requestMomentumMovement=function(e,r,o,s){var u=this;if(this.inMomentumMovement!==null){s=Math.max(s,1);for(var l=__assign({},o),c={longitude:0,latitude:0,x:0,y:0,z:0},f=0;f<s;f++)l.longitude*=.996,l.latitude*=.996*.998,l.x*=.99,l.y*=.99,l.z*=.99,c.longitude+=l.longitude,c.latitude+=l.latitude,c.x+=l.x,c.y+=l.y,c.z+=l.z;var p=this.cameraMotion.value.fov,d=formatRad$1(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(p):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(p):this.maxLatitude,-Math.PI/2,Math.PI/2),m=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),E=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),y=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:m,offset:E,fov:p,distance:this.locationMotion.value.distance}),v=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(y.distance)),A=!(Math.abs(l.longitude)>1e-4||Math.abs(l.latitude)>1e-4||Math.abs(l.x)>1e-4||Math.abs(l.y)>1e-4||Math.abs(l.z)>1e-4),b=this.cameraFence?this.cameraFence.containsPoint(v):!0;b===!1&&(A=!0);var T=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:A,state:y}));if(this.inMomentumMovement.event=T,this.emit("gesture.momentum",T),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:m},0).catch(noop),this.locationMotion.set({x:y.offset.x,y:y.offset.y,z:y.offset.z,distance:y.distance},0).catch(noop),A?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(_,S){u.requestMomentumMovement(e,!1,l,S)},!0))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),o=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),s=new THREE__namespace.Raycaster(o,r);s.params.Points={threshold:.1},s.firstHitOnly=!0,s.near=this.camera.near,s.far=this.camera.far;var u;if(u=this.modelScene.intersectRaycaster(s).filter(function(d){var h,g=(h=d.face)===null||h===void 0?void 0:h.normal;return g&&s.ray.direction.dot(g)>=0?!1:d.distance>minDistance+s.near})[0],!u){var l=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),c=s.ray.intersectPlane(l,new THREE__namespace.Vector3);if(c){var f=c.distanceTo(s.ray.origin);f<1e3&&f>=s.near&&(u={distance:f,floorIndex:0,floor:0,point:c,object:this.scene,face:null})}}if(!u){var p=Math.max(e.distance,3);u={distance:p,floorIndex:0,floor:0,point:s.ray.direction.clone().setLength(p).add(s.ray.origin),object:this.scene,face:null}}u&&(e.distance=clamp$1(u.distance,0,1/0),e.offset.copy(o).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,o=this.panState,s=0,u=!1;e.pointerType==="mouse"&&(s=e.srcEvent.buttons,u=e.srcEvent.shiftKey),o&&s===0&&o.buttons!==0&&(s=o.buttons);var l=o==null?void 0:o.target;if(!l){var c=this.relativeClientPosition(e.center),f=this.createRaycasterFromCamera(c,this.camera);l=new THREE__namespace.Vector3().copy(f.ray.direction).multiplyScalar(3).add(f.ray.origin);var p=this.modelScene.intersectRaycaster(f)[0];if(!p&&f.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),h=f.ray.intersectPlane(d,new THREE__namespace.Vector3);if(h){var g=h.distanceTo(f.ray.origin);g<1e4&&g>=f.near&&(p={distance:g,floorIndex:0,floor:0,point:h,object:this.scene})}}if(p)l.copy(p.point);else{var m=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(m,this.camera.pose.offset);f.ray.intersectPlane(d,l)}}if(e.isFinal?this.panState=void 0:this.panState={target:l,buttons:s,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof o=="undefined"||o.pointerLength!==r)){var E=r>1||s===2||u;if(E){var y={x:e.center.x-o.x,y:e.center.y-o.y},v=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),A=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(v),b=new THREE__namespace.Vector3().copy(A).sub(o.target).length();b*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var T=this.renderer.getSize(new THREE__namespace.Vector2),_=2*y.x*b/T.y,S=2*y.y*b/T.y,w=new THREE__namespace.Vector3;w.setFromMatrixColumn(this.camera.matrix,0),w.multiplyScalar(-_),v.add(w),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?w.setFromMatrixColumn(this.camera.matrix,1):(w.setFromMatrixColumn(this.camera.matrix,0),w.crossVectors(this.camera.up,w)),w.multiplyScalar(S),v.add(w);var R=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:v,distance:this.camera.pose.distance});if(e.state=R,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop),e.isFinal&&(this.fixFinalState(R),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:R.distance,x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop)),e.isFinal){var I=this.renderer.getSize(new THREE__namespace.Vector2),H=2*e.velocityX*b/I.y,C=2*e.velocityY*b/I.y,M=new THREE__namespace.Vector3,B=new THREE__namespace.Vector3;M.setFromMatrixColumn(this.camera.matrix,0),M.multiplyScalar(-H),B.add(M),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?M.setFromMatrixColumn(this.camera.matrix,1):(M.setFromMatrixColumn(this.camera.matrix,0),M.crossVectors(this.camera.up,M)),M.multiplyScalar(C),B.add(M),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:B.x,y:B.y,z:B.z},0)}}else{var y={x:e.center.x-o.x,y:e.center.y-o.y},L=this.coordinatesForOffset(y),O=formatRad$1(this.cameraMotion.value.longitude+L.longitude),k=this.camera.pose.fov,D=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(k):this.minLatitude,-Math.PI/2,Math.PI/2),q=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(k):this.maxLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(this.cameraMotion.value.latitude+L.latitude,D,q);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(z=this.cameraMotion.value.latitude);var R=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:O,latitude:z,fov:k,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=R,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:R.distance,x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop):this.cameraMotion.set({longitude:R.longitude,latitude:R.latitude},0).catch(noop),e.isFinal){var J=e.velocityX,V=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:J,y:V})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var o=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof o!="undefined"){var s=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),l=clamp$1(o/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(l)),f=this.modelScene.boundingBox.containsPoint(c),p;if(!f&&this.pinchState&&this.pinchState.scale>e.scale&&s.distanceTo(c)>u?p=e.state.distance:(p=l,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=p,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var d=e.state;this.fixFinalState(e.state);var h={x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance};this.locationMotion.set(h,0).catch(noop)}this.panState=void 0,this.pinchState=void 0}}}},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var s=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var u=this.modelScene.intersectRaycaster(s)[0],l=createEvent("intersect.update",{raycaster:s,intersection:u!=null?u:null,object:this.intersectMesh});if(this.emit("intersect.update",l),l.defaultPrevented){this.hideIntersectMesh();return}if(u){var c=(o=(r=u.face)===null||r===void 0?void 0:r.normal)!==null&&o!==void 0?o:new THREE__namespace.Vector3().copy(s.ray.direction).multiplyScalar(-1),f=c.clone(),p=u.point.clone();this.intersectMesh.position.copy(p);var d=p.clone().add(f);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(p);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var o={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(o,0).catch(noop)}else{var s=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),u=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=coordinatesToVector(this.cameraMotion.value,new THREE__namespace.Vector3).negate(),c=new THREE__namespace.Ray(u,l).intersectBox(this.modelScene.boundingBox,new THREE__namespace.Vector3);c&&(s+=c.distanceTo(u));var f=Math.max(this.locationMotion.value.distance-this.camera.near,0),p=e.center.delta/10*Math.max(f/5,.1);if(f<=s||p>0)if(this.locationMotion.value.distance-p>=minDistance){var d=this.locationMotion.value.distance-p;e.state.distance=d}else{var h=coordinatesToVector(this.cameraMotion.value);h.setLength(p),e.state.offset.add(h)}if(this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:e.state.distance,x:e.state.offset.x,y:e.state.offset.y,z:e.state.offset.z},0).catch(noop)}},t.prototype.onTapGesture=function(e){var r=this,o;this.userAction=e.userAction,this.stopMomentumMovement();var s=e.center.raycaster,u=this.getForwardObserverOrNot(s);if(!u)this.emit("gesture.tap",e);else{var l={longitude:this.camera.pose.longitude,latitude:0},c=__assign(__assign({},e.state),{mode:"Panorama",workCode:u.work.workCode,panoIndex:u.panoIndex,longitude:l.longitude,latitude:l.latitude,offset:u?u.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=c,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:c,userAction:e.userAction,options:l,progress:0,error:null})),u&&u.active)){var f=this.pendingTextureId=createUuid(),p={panoIndex:u.panoIndex,workCode:u.work.workCode},d=panoStringify(p),h={right:u.images.work.getURL(u.images.right),left:u.images.work.getURL(u.images.left),up:u.images.work.getURL(u.images.up),down:u.images.work.getURL(u.images.down),front:u.images.work.getURL(u.images.front),back:u.images.work.getURL(u.images.back)},g=this.imageOptions.transform,m=__assign({key:"pano.".concat(d)},pick(this.imageOptions,["format","size","quality","sharpen","forceUseExifOrientation","mappings"])),E="pano:"+jsonHash([h,m,g]),y=this.modelScene.parameter,v=void 0;y.pano0&&y.pano0.map.name===E?v=y.pano0:y.pano1&&y.pano1.map.name===E&&(v=y.pano1),v?(y.pano0&&y.pano0.map!==v.map&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==v.map&&y.pano1.map!==((o=y.pano0)===null||o===void 0?void 0:o.map)&&y.pano1.map.dispose(),y.set({pano0:v,pano1:v}),this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:c,options:l,error:null}))):this.textureLoader.loadCubeTexture(h,{imageURL:{transform:g,options:m},format:THREE__namespace.RGBFormat,viaAjax:!0,fetcher:getFetcher(this.fiveId,u.work)},void 0,void 0,void 0,this.renderer).then(function(A){var b,T,_=A.body;if(r.destroyed||r.pendingTextureId!==f){_.dispose();return}r.pendingTextureId=null,_.name=E;var S=Array.isArray(_.image)?_.image[0]:_.image,w=(b=S==null?void 0:S.width)!==null&&b!==void 0?b:2048,R={panoId:d,map:_,mapSize:w,matrix:u.matrix.clone().premultiply(u.work.transform),zoom:1};y.pano0&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==((T=y.pano0)===null||T===void 0?void 0:T.map)&&y.pano1.map.dispose(),y.set({pano0:R,pano1:R}),r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:c,options:l,error:null}))}).catch(function(A){r.destroyed||r.pendingTextureId!==f||(r.pendingTextureId=null)})}}},t.prototype.onDblTapGesture=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.state,o=e.center.raycaster,s=o.ray.origin.clone().add(o.ray.direction.clone().setLength(3)),u=1,l=3,c=u,f=this.modelScene.intersectRaycaster(o)[0];if(f&&(s=f.point.clone(),f.distance>(u+l)/2?c=u:c=l),e.state.distance=c,e.state.offset=s,this.emit("gesture.dbltap",e),!e.defaultPrevented){var p={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(p,360).catch(noop),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)},t})(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=(function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var o=null,s=null,u=null,l=this._targetRay,c=this._grip,f=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(l!==null&&(o=e.getPose(t.targetRaySpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),f&&t.hand){u=!0;for(var p=0,d=t.hand.values();p<d.length;p++){var h=d[p],g=e.getJointPose(h,r);if(f.joints[h.jointName]===void 0){var m=new THREE__namespace.Group;m.matrixAutoUpdate=!1,m.visible=!1,f.joints[h.jointName]=m,f.add(m)}var E=f.joints[h.jointName];g!==null&&(E.matrix.fromArray(g.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.jointRadius=g.radius),E.visible=g!==null}var y=f.joints["index-finger-tip"],v=f.joints["thumb-tip"],A=y.position.distanceTo(v.position),b=.02,T=.005;f.inputState.pinching&&A>b+T?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&A<=b-T&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));return l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),f!==null&&(f.visible=u!==null),this},n})(),framebufferScaleFactor=1,isAppleVisionPro=function(){try{var n=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return n&&t}catch(e){return console.error("Error determining if the device is an Apple Vision Pro: ",e),!1}},isOculus=function(){try{return/Oculus/i.test(navigator.userAgent)}catch(n){return console.error("Error determining if the device is an Oculus: ",n),!1}},XRManager=(function(){function n(t,e,r){var o,s,u,l,c;this.isPanorama=(o=r==null?void 0:r.isPanorama)!==null&&o!==void 0?o:!0,navigator.userAgent.toLowerCase();var f;isAppleVisionPro()?f="VP":isOculus()?f="Oculus":f="Pico",this.machineType=(s=r==null?void 0:r.machineType)!==null&&s!==void 0?s:f,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(u=r==null?void 0:r.referenceSpaceType)!==null&&u!==void 0?u:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(l=r==null?void 0:r.onSessionStart)!==null&&l!==void 0?l:noop,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraVR.cameras.push(this.cameraL,this.cameraR),this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session||!this.session.inputSources)return null;var t=void 0;if(this.session.inputSources.forEach(function(r,o){r.handedness==="right"&&(t=o)}),t===void 0)return console.warn("no inputSource for right hand"),null;var e=this.controllers[t];return e?e.getTargetRaySpace():(console.warn("right controller not find"),null)},n.prototype.getLeftController=function(){if(!this.session||!this.session.inputSources)return null;var t=void 0;if(this.session.inputSources.forEach(function(r,o){r.handedness==="left"&&(t=o)}),t===void 0)return console.warn("no inputSource for left hand"),null;var e=this.controllers[t];return e?e.getTargetRaySpace():(console.warn("left controller not find"),null)},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var o=this.cameraLPos.distanceTo(this.cameraRPos),s=e.projectionMatrix.elements,u=r.projectionMatrix.elements,l=s[14]/(s[10]-1),c=s[14]/(s[10]+1),f=(s[9]+1)/s[5],p=(s[9]-1)/s[5],d=(s[8]-1)/s[0],h=(u[8]+1)/u[0],g=l*d,m=l*h,E=o/(-d+h),y=E*-d;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(E),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=l+E,A=c+E,b=g-y,T=m+(o-y),_=f*c/A*v,S=p*c/A*v;t.projectionMatrix.makePerspective(b,T,_,S,v,A)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var o=0;o<r.length;o++)this.updateCamera(r[o],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var s=t.children,o=0,u=s.length;o<u;o++)s[o].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var o=t.removed[r],s=this.inputSourcesMap.get(o);s&&(s.dispatchEvent({type:"disconnected",data:o}),this.inputSourcesMap.delete(o))}for(var r=0;r<t.added.length;r++){var o=t.added[r],s=this.inputSourcesMap.get(o);s&&s.dispatchEvent({type:"connected",data:o})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectstart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeeze",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezestart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezeend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("end",function(o){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var o={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;case"Oculus":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(s){e.onRequestReferenceSpace(s)}),e.session.addEventListener("inputsourceschange",function(s){e.updateInputSources(s)})})}},n})(),LineSegmentsGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],o=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(s),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(o,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,o=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),o.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),o.setFromBufferAttribute(r),this.boundingBox.union(o)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=this.boundingSphere.center;this.boundingBox.getCenter(o);for(var s=0,u=new THREE__namespace.Vector3,l=0,c=e.count;l<c;l++)u.fromBufferAttribute(e,l),s=Math.max(s,o.distanceToSquared(u)),u.fromBufferAttribute(r,l),s=Math.max(s,o.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t})(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
2152
2152
  #include <common>
2153
2153
  #include <color_pars_vertex>
2154
2154
  #include <fog_pars_vertex>
@@ -2347,4 +2347,4 @@ void main() {
2347
2347
  #include <premultiplied_alpha_fragment>
2348
2348
 
2349
2349
  }
2350
- `},LineMaterial=(function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(o){this.uniforms.diffuse.value=o}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(o){this.uniforms.linewidth.value=o}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(o){this.uniforms.dashScale.value=o}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(o){this.uniforms.dashSize.value=o}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(o){this.uniforms.gapSize.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}}}),r.setValues(e),r}return t})(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this)||this;return o.type="LineSegments2",o.geometry=e!==void 0?e:new LineSegmentsGeometry,o.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),o}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,o=e.attributes.instanceEnd,s=new Float32Array(2*r.count),u=new THREE__namespace.Vector3,l=new THREE__namespace.Vector3,c=0,f=0,p=r.count;c<p;c++,f+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[f]=f===0?0:s[f-1],s[f+1]=s[f]+u.distanceTo(l);var d=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(d,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(d,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var o=e.ray,s=e.camera,u=s.projectionMatrix,l=this.geometry,c=this.material,f=c.resolution,p=c.linewidth,d=l.attributes.instanceStart,h=l.attributes.instanceEnd,g=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,E=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,A=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,E),E.w=1,E.applyMatrix4(s.matrixWorldInverse),E.applyMatrix4(u),E.multiplyScalar(1/E.w),E.x*=f.x/2,E.y*=f.y/2,E.z=0,y.copy(E);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){g.fromBufferAttribute(d,_),m.fromBufferAttribute(h,_),g.w=1,m.w=1,g.applyMatrix4(v),m.applyMatrix4(v),g.applyMatrix4(u),m.applyMatrix4(u),g.multiplyScalar(1/g.w),m.multiplyScalar(1/m.w);var w=g.z<-1&&m.z<-1,R=g.z>1&&m.z>1;if(!(w||R)){g.x*=f.x/2,g.y*=f.y/2,m.x*=f.x/2,m.y*=f.y/2,A.start.copy(g),A.start.z=0,A.end.copy(m),A.end.z=0;var I=A.closestPointToPointParameter(y,!0);A.at(I,b);var H=THREE__namespace.MathUtils.lerp(g.z,m.z,I),C=H>=-1&&H<=1,M=y.distanceTo(b)<p*.5;if(C&&M){A.start.fromBufferAttribute(d,_),A.end.fromBufferAttribute(h,_),A.start.applyMatrix4(T),A.end.applyMatrix4(T);var B=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;o.distanceSqToSegment(A.start,A.end,L,B),r.push({point:L,pointOnLine:B,distance:o.origin.distanceTo(L),object:this,faceIndex:_})}}}},t})(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.type="Line2",o}return t})(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setPositions.call(this,o),this},t.prototype.setColors=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setColors.call(this,o),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t})(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=(function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var o=n.call(this)||this;o.type="FiveLine",o.needsRender=!0;var s=new LineGeometry,u=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});o.line=new Line2(s,u);var l=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return o.points=new THREE__namespace.Points(l,c),o.points.renderOrder=11,o.points.frustumCulled=!1,o.setPoints(e,r),o.add(o.line,o.points),o}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.30"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var o=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(o),3)),this.line.geometry.setPositions(o),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o];o==="dashed"?(r.dashed=s,s?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[o]=e[o]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var o=this.line.material.resolution;(o.x!==e||o.y!==r)&&(o.set(e,r),this.needsRender=!0)},t})(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,f,p,d;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(h){switch(h.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(u=h.sent(),e.profiles.some(function(g){var m=u[g];return m&&(l={profileId:g,profilePath:"".concat(r,"/").concat(m.path),deprecated:!!m.deprecated}),!!l}),!l){if(!o)throw new Error("No matching profile name found");if(c=u[o],!c)throw new Error('No matching profile name found and default profile "'.concat(o,'" missing.'));l={profileId:o,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(l.profilePath)];case 2:if(f=h.sent(),s){if(d=void 0,d=f.layouts[e.handedness],!d)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));d.assetPath&&(p=l.profilePath.replace("profile.json",d.assetPath))}return[2,{profile:f,assetPath:p}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,o=Math.sqrt(n*n+t*t);if(o>1){var s=Math.atan2(t,n);e=Math.cos(s),r=Math.sin(s)}var u={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return u}var VisualResponse=(function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,o=t.button,s=t.state,u=normalizeAxes(e,r),l=u.normalizedXAxis,c=u.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?l:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(s)?o:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n})(),Component=(function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(o){var s=new VisualResponse(e.visualResponses[o]);r.visualResponses[o]=s}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(o){o.updateFromComponent(e.values)})},n})(),MotionController=(function(){function n(t,e,r){var o=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(s){var u=o.layoutDescription.components[s];o.components[s]=new Component(s,u)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n})(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(o){o instanceof THREE__namespace.Mesh&&o.isMesh&&(o.material.envMap=r.envMap,o.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(o){var s=o.valueNode,u=o.minNode,l=o.maxNode,c=o.value,f=o.valueNodeProperty;s&&(f===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:f===Constants.VisualResponseProperty.TRANSFORM&&(s.quaternion.copy(u.quaternion).slerp(l.quaternion,c),s.position.lerpVectors(u.position,l.position,c)))})}))},t})(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,o=e.touchPointNodeName,s=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(o),e.touchPointNode){var u=new THREE.SphereGeometry(.001),l=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(u,l);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(s).forEach(function(f){var p=f.valueNodeName,d=f.minNodeName,h=f.maxNodeName,g=f.valueNodeProperty;if(g===Constants.VisualResponseProperty.TRANSFORM){if(f.minNode=t.getObjectByName(d),f.maxNode=t.getObjectByName(h),!f.minNode){console.warn("Could not find ".concat(d," in the model"));return}if(!f.maxNode){console.warn("Could not find ".concat(h," in the model"));return}}f.valueNode=t.getObjectByName(p),f.valueNode||console.warn("Could not find ".concat(p," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=(function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,o=null;return t.addEventListener("connected",function(s){var u=s.data;u.targetRayMode!=="tracked-pointer"||!u.gamepad||fetchProfile(u,e.path,DEFAULT_PROFILE).then(function(l){var c=l.profile,f=l.assetPath;r.motionController=new MotionController(u,c,f);var p=e._assetCache[r.motionController.assetUrl];if(p)o=p.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(d){e._assetCache[r.motionController.assetUrl]=d,o=d.scene.clone(),addAssetSceneToControllerModel(r,o)})}}).catch(function(l){console.warn(l)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(o),o=null}),r},n})(),defaultXRPanoramaControllerInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"]));function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,scratchRaycaster=new THREE__namespace.Raycaster,scratchVector3=new THREE__namespace.Vector3,XRPanoramaController=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.left.firstHitOnly=!0,r.xrControllerRay.left.floorIndex=-1,r.xrControllerRay.right.params.Points={threshold:.1},r.xrControllerRay.right.firstHitOnly=!0,r.xrControllerRay.right.floorIndex=-1,r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var s=r.xrManager.getController(1);r.controllerWrappers[1].add(s);var u=new XRControllerModelFactory;u.gltfLoader={load:function(c,f){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(p){var d;return parseGltf(p.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(d=c.split("?")[1])!==null&&d!==void 0?d:"",fetcher:internalFetcher})}).then(function(p){return f(p)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",effectEasing:defaultEffectEase,fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var l=AnimationFrameLoop.shared.getContext();return l?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(l),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(u.createControllerModel(c)),r.controllerWrappers[0].add(c);var f=r.xrManager.getControllerGrip(1);f.add(u.createControllerModel(f)),r.controllerWrappers[1].add(f)}),r.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"XRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),d=this.works.getObserver(e);if(!d)throw new Error("Invalid PanoIndex");getImageSizeFromURL(d.images.up),this.imageOptions.size;var h=this.imageOptions.transform,g=function(I,H){return mapPanoResource(applyImageURLOptions(I,h,H))},m=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality"])),E={right:d.images.work.getURL(d.images.right),left:d.images.work.getURL(d.images.left),up:d.images.work.getURL(d.images.up),down:d.images.work.getURL(d.images.down),front:d.images.work.getURL(d.images.front),back:d.images.work.getURL(d.images.back)},y="pano:"+jsonHash([E,m,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===y)return;var v=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(v))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:e}))}var A=this.modelScene.parameter.resolveValue(),b=A.pano0,T=A.pano1,_;if((b==null?void 0:b.map.name)===y?_=b:(T==null?void 0:T.map.name)===y&&(_=T),_){var S={panoId:p,effect:f,effectEasing:(c=r.effectEasing)!==null&&c!==void 0?c:defaultEffectEase,leftPanoPicture:{panoId:_.panoId,map:_.map,mapSize:_.mapSize,matrix:d.matrix.clone().premultiply(d.work.transform),zoom:1},position:d.position.clone().applyMatrix4(d.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,S,r);return}var w="move-to-pano-"+p;this.pending.add(w),this.pendingTextureTask={panoId:p,hash:y,onLoad:function(I){var H,C,M=I.body;if(s.destroyed)M.dispose();else{M.name=y;var B=Array.isArray(M.image)?M.image[0]:M.image,L=(H=B==null?void 0:B.width)!==null&&H!==void 0?H:2048,O={panoId:p,effect:f,effectEasing:(C=r.effectEasing)!==null&&C!==void 0?C:defaultEffectEase,leftPanoPicture:{panoId:p,map:M,mapSize:L,matrix:d.matrix.clone(),zoom:1},position:d.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,O,r)}},onError:function(I){var H=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:I,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),r.moveCancelCallback&&r.moveCancelCallback()}};var R=this.panoMeshes.get(p);R&&R.tap&&R.tap(),this.textureLoader.loadCubeTexture(E,{imageURL:{transform:g,options:m},format:THREE__namespace.RGBFormat,fetcher:getFetcher(this.fiveId,d.work)},void 0,void 0,function(I){var H,C;((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&((C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(I)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:I,meta:null,pano:e}))},this.renderer).then(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y?(s.pendingTextureTask.onLoad(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)):I.body.dispose(),s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:I.meta,pano:e}))}).catch(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&(s.pendingTextureTask.onError(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)),s.emit("pano.texture.error",createEvent("pano.texture.error",{error:I,progress:0,meta:null,pano:e})),s.emit("error",I)}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,m,E;o===void 0&&(o={});var y=now(),v=createUuid();this.panoResources[v]=r;var A=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(y);S[0];var w=S[1],R=this.locationMotion.value,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position;b=Math.max(I.distanceTo(H),A),T=[{key:w.key,progress:0,value:__assign(__assign({},R),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(y),M=C[0],w=C[1],R=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(M).position,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position,L=w.value.count-R.count,O=Math.max(B.distanceTo(I),A)*L,k=Math.max(I.distanceTo(H),A);b=O+k,T=[{key:M.key,progress:0,value:__assign({},R)},{key:w.key,progress:O/b,value:w.value},{key:v,progress:1,value:{count:w.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),q=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*D/q}var z=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"||r.effect==="model"?b:0),V={longitude:o.longitude,latitude:o.latitude,fov:o.fov},Q=__assign(__assign({},e),{mode:this.mode,longitude:(u=V.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=V.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=V.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),U=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:U,progress:0,state:Q,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(Q),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly"||r.effect==="model")this.cameraMotion.set(V,z).catch(noop);else{var j=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),G=coordinatesToVector({longitude:(f=V.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(p=V.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude}),ae=new THREE__namespace.Object3D;ae.lookAt(j);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion);ae.lookAt(G);var $=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion),ee=new THREE__namespace.Matrix4().getInverse(re).premultiply($),K=this.cameraMotion.value.fov,se=(d=V.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,W=1;r.effect==="zoomin"?W=1.5:r.effect==="zoomout"&&(W=.4);for(var X=se*W,te=0;te<T.length-1;te++){var Z=T[te].key;if(Z){var ne=this.panoResources[Z];ne&&(ne.fixCameraTransform.copy(ee),ne.leftPanoPicture&&(ne.leftPanoPicture.zoom=Math.tan(X/2/180*Math.PI)/Math.tan(K/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(h=V.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(g=V.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:X}},{progress:1,value:{longitude:(m=V.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(E=V.latitude)!==null&&E!==void 0?E:this.cameraMotion.value.latitude,fov:se}}],z).catch(noop)}var pe=this.locationMotion.setKeyframes(T,z,_);pe.then(function(){for(var ie=0,ue=s.modelScene.children;ie<ue.length;ie++){var be=ue[ie];be instanceof Model&&be.show()}var oe=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:U,progress:1,state:oe,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(oe);var le=s.works.getObserver(s.currentPano);if(le&&le.images.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var me={map:s.videoTexture,size:le.images.video.size.clone(),matrix:le.images.video.matrix.clone(),panoMatrix:le.matrix.clone().premultiply(le.work.transform),alpha:1},ge=createUuid(),Ae=s.videoTexture.image;Ae.setAttribute("uuid",ge),canplayVideo().then(function(xe){xe&&le.images.video&&Ae.getAttribute("uuid")===ge&&(Ae.oncanplay=function(){Ae.oncanplay=noop,Ae.play()},Ae.ontimeupdate=function(){Ae.currentTime>.5&&(Ae.ontimeupdate=noop,s.panoVideo.setMaterial(me))},Ae.src=le.images.video.source)}).catch((function(){Ae.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:U,progress:0,state:Q,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o;this.stopMomentumMovement(),this.camera.getDirection(new THREE__namespace.Vector3).setY(0);var s=null,u=this.works.getObserver(this.currentPano);if(!u)return null;var l=u.work.observers,c=u.accessibleNodes.filter(function(_){if(_===r.currentPano.panoIndex&&u.work.workCode===r.currentPano.workCode)return!1;var S=l[_];if(!S)return!1;var w=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return w.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),f=this.modelScene.intersectRaycaster(e)[0];if(f){var p=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var w=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return w.distanceTo(f.point)},!0),d=p[0],h=p[1];typeof d=="number"&&h<this.panoTapTriggerRadius&&(s=(o=l[d])!==null&&o!==void 0?o:null)}if(isNil(s)){var g=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);g&&(s=g)}for(var m=0,E=this.locationMotion.keyframes;m<E.length;m++){var y=E[m],v=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&s){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===A){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(A);b&&(b.setDisabled(!1),b.setLoading(!0))}var T={workCode:s.work.workCode,panoIndex:s.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:s?s.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:T,userAction:!0,options:{},progress:0,error:null})),s&&s.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:T,options:{},error:null})),{workCode:s.work.workCode,panoIndex:s.panoIndex}):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var o=this,s,u,l,c,f,p,d,h,g,m=[],E=2;E<arguments.length;E++)m[E-2]=arguments[E];this.userAction=!0;var y={},v={},A=this.camera.getDirection(new THREE__namespace.Vector3),b=this.locationMotion.keyframes[0],T=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],_=this.locationMotion.getKeyFrameSegment(e),S=_[0],w=_[1],R=this.panoResourceFromLocationMotionKeyframe(S),I=this.panoResourceFromLocationMotionKeyframe(w),H=this.panoResourceFromLocationMotionKeyframe(b),C=this.panoResourceFromLocationMotionKeyframe(T),M=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),v.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var B=this.locationMotion.value.count-w.value.count+1,L=new THREE__namespace.Vector3().copy(R.position),O=new THREE__namespace.Vector3().copy(I.position);if(y.progress=B,B>=.01&&B<=.99&&(y.progress=clamp$1(I.effectEasing(B),.01,.99)),I.leftPanoPicture&&(B<1?R.leftPanoPicture&&(y.pano0=R.leftPanoPicture):y.pano0=I.leftPanoPicture,y.pano1=I.leftPanoPicture),I.effect==="montage"?y.transition="BLACK":I.effect==="spread"?y.transition="SPREAD":y.transition="FADE",I.effect==="zoomin"||I.effect==="zoomout")y.progress=Math.pow(B,3);else if(I.effect==="model"&&this.camera.pose.distance<.01){var k=1-Math.pow(clamp$1(Math.abs(B-.5)*2,0,1),4);y.modelAlpha=k}if(B<1&&I.effect!=="fly"){if(y.pano0&&R.leftPanoPicture){var D={panoId:y.pano0.panoId,map:y.pano0.map,mapSize:y.pano0.mapSize,zoom:y.pano0.zoom,matrix:R.leftPanoPicture.matrix.clone().setPosition(I.position)},q=this.panoPictureObserverMap.get(y.pano0);q&&this.panoPictureObserverMap.set(D,q),y.pano0=D}L.copy(O),M=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(L.x+(O.x-L.x)*B,L.y+(O.y-L.y)*B,L.z+(O.z-L.z)*B);for(var z=[],V=[],Q=0,U=this.locationMotion.keyframes;Q<U.length;Q++){var j=U[Q],G=j.key,ae=j.progress;G!==void 0&&(z.push(G),ae>this.locationMotion.progress&&V.push(G))}for(var re=0,$=Object.keys(this.panoResources);re<$.length;re++){var ee=$[re];if(!(V.indexOf(ee)>=0)){var K=this.panoResources[ee];if(K.leftPanoPicture){var se=K.leftPanoPicture.map;if(se){if(se===((s=y.pano0)===null||s===void 0?void 0:s.map)||se===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;se.dispose(),K.leftPanoPicture=null}}z.indexOf(ee)>=0||delete this.panoResources[ee]}}var W=panoParse(I.panoId);W!==this.currentPano&&(this.currentPano=W,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(H.panoId),state:__assign(__assign(__assign(__assign({},panoParse(C.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(v),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);var X=m,te=X[1],Z=new THREE__namespace.Vector3(0,0,0),ne=new THREE__namespace.Vector2().copy(this.camera.resolution);if(te&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){for(var pe=this.xrManager.cameraVR,ie=this.xrManager.referenceSpace,ue=this.xrManager.session.renderState.baseLayer,be=te.getViewerPose(ie),oe=(l=be==null?void 0:be.views)!==null&&l!==void 0?l:[],le=0;le<oe.length;le++){var me=oe[le],ge=pe.cameras[le],Ae=ue.getViewport(me);Ae&&(ge.projectionMatrix.fromArray(me.projectionMatrix),ge.projectionMatrixInverse.getInverse(ge.projectionMatrix),ge.matrix.fromArray(me.transform.matrix),ge.matrix.setPosition(this.camera.position),ge.matrix.decompose(ge.position,ge.quaternion,ge.scale),ge.matrixWorld.copy(ge.matrix),ge.matrixWorldInverse.getInverse(ge.matrixWorld),ge.matrixAutoUpdate=!1,Z.copy(ge.position),ge.viewport.set(Ae.x,Ae.y,Ae.width,Ae.height),ne.set(Ae.width,Ae.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((c=v.distance)!==null&&c!==void 0?c:this.camera.pose.distance),this.xrManager.session.inputSources){for(var le=0;le<this.xrManager.session.inputSources.length;le++)if(this.xrManager.session.inputSources[le]&&this.xrManager.session.inputSources[le].targetRayMode==="transient-pointer"){var xe=te.getPose(this.xrManager.session.inputSources[le].targetRaySpace,ie);if(xe){var he=xe.transform.orientation,_e=new THREE__namespace.Quaternion(he.x,he.y,he.z,he.w),He=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(_e),Ee=new THREE__namespace.Raycaster(this.camera.position,He);this.gazeRay=Ee}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var de=this.xrManager.session.inputSources,Ve=function(ve){var Ie=ye.xrManager.controllers[ve],Re=de[ve];if(!Re)return"continue";Ie&&Ie.update(Re,te,ie);var qe=ye.xrManager.getController(ve),Ye=new THREE__namespace.Vector3(0,1.2,0),ut=qe.position.clone().add(Z).sub(Ye);Re.handedness==="left"?ye.xrControllerRay.left.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)):Re.handedness==="right"&&ye.xrControllerRay.right.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)),ye.controllerWrappers[ve].position.copy(new THREE__namespace.Vector3(0,0,0).add(Z).sub(Ye));var Ke=ye.modelScene.intersectRaycaster(ye.xrControllerRay.right);if(Ke.length===0){var dt=ye.works.getResolvedObserver(ye.currentPano);Ke=ye.xrControllerRay.right.intersectObject(ye.modelScene.boundingMesh,!0).map(function(Ge){var Ze,De=(Ze=dt==null?void 0:dt.floorIndex)!==null&&Ze!==void 0?Ze:0;return __assign({floorIndex:De,floor:De},Ge)})}if(Ke.length>=1&&Ke[0].face)if(Re.handedness==="right"){var Pt=ye.xrControllerRay.right.intersectObject(ye.xrCustomObjectsScene,!0),P=Ke[0].face.normal,F=P.clone(),N=Ke[0].point.clone();ye.intersectMesh.position.copy(N);var J=N.clone().add(F);if(ye.intersectMesh.lookAt(J),Math.abs(P.y)>.99){var Y=ye.camera.position.clone().sub(N);ye.intersectMesh.rotation.z=-Math.atan2(Y.z,Y.x)}ye.intersectMesh.visible=!0,ye.needsRender=!0,Pt.length>0?(ye.pointerLines.right.setPoints(ut,Pt[0].point),ye.pointerLines.right.points.visible=!0,ye.intersectMesh.visible=!1):(ye.pointerLines.right.points.visible=!1,ye.pointerLines.right.setPoints(ut,Ke[0].point));var ce=Ke[0],Te=createEvent("intersect.update",{raycaster:(f=ye.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:ce!=null?ce:null,object:ye.intersectMesh});if(ye.emit("intersect.update",Te),Te.defaultPrevented)return ye.hideIntersectMesh(),{value:void 0}}else ye.pointerLines.left.setPoints(ut,Ke[0].point)},ye=this,le=0;le<de.length;le++){var Pe=Ve(le);if(typeof Pe=="object")return Pe.value}this.updateControllerHelper(de,e,r)}}else te||console.error("xrFrame丢失,请重试"),this.xrManager.session||console.error("session丢失,请重试"),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error("no layer found");isEmptyObject(y)===!1&&this.modelScene.parameter.set(y),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));var Ce=this.works.getResolvedObserver(this.currentPano),$e=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,Se=this.works.getObserver(R.panoId),ze=this.works.getObserver(I.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Ce){for(var Fe=[],Oe=Ce.work.observers,Le=0,Ue=Ce.accessibleNodes;Le<Ue.length;Le++){var tt=Ue[Le],q=Oe[tt];q&&Fe.push(q)}var lt=new Map;if(Fe.sort(function(ve,Ie){var Re=lt.get(ve);typeof Re=="undefined"&&(Re=ve.standingPosition.distanceTo(Ce.standingPosition),lt.set(ve,Re));var qe=lt.get(ve);return typeof qe=="undefined"&&(qe=Ie.standingPosition.distanceTo(Ce.standingPosition),lt.set(Ie,qe)),Re-qe}),Fe.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Fe.length;var nt=Fe[this.accessibleObserverFloorCheckCount],ot=this.modelScene.models.find(function(ve){return ve.work===(nt==null?void 0:nt.work)});if(nt&&ot&&ot.visible){var At=.3,We=.05,Mt=.005,Be=nt.standingPosition.clone().applyMatrix4(nt.work.transform),Ne=panoStringify({panoIndex:nt.panoIndex,workCode:nt.work.workCode}),bt=adjustPanoCircleMeshVectors.map(function(ve){scratchRaycaster.ray.origin.copy(Be),scratchRaycaster.ray.origin.add(scratchVector3.copy(ve).setY(At)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var Ie=ot.intersectRaycaster(scratchRaycaster)[0];return Ie&&Ie.distance-Mt<=At?new THREE__namespace.Vector3().copy(Be).setY(Ie.point.y+Mt):Be});bt.sort(function(ve,Ie){return Ie.y-ve.y});var Ct=bt[Math.floor(bt.length/2)],xt=bt.filter(function(ve){return ve.distanceTo(Ct)<=We})[0];if(xt){var yt=new THREE__namespace.Vector4(Be.x,Be.y,Be.z,xt.y-Be.y),St=this.adjustPanoCircleMeshPositionFix.get(Ne);St&&!yt.equals(St)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Ne,yt)}}this.accessibleObserverFloorCheckCount++}}var rt=new Map;if(Se)for(var at=0,ct=Se.accessibleNodes;at<ct.length;at++){var tt=ct[at],q=Se.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(ze)for(var Xe=0,fe=ze.accessibleNodes;Xe<fe.length;Xe++){var tt=fe[Xe],q=ze.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(this.panoMeshes.forEach(function(ve,Ie){var Re=rt.get(Ie);Re?rt.delete(Ie):(o.helper.remove(ve),ve.dispose(),o.panoMeshes.delete(Ie))}),rt.forEach(function(ve,Ie){var Re=o.panoCircleMeshCreator(ve,{aerialObserverMinHeight:o.aerialObserverMinHeight});o.panoMeshes.set(Ie,Re),o.helper.add(Re),rt.delete(Ie)}),this.panoMeshes.forEach(function(ve,Ie){var Re=o.works.getObserver(Ie);if(Re){var qe=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(qe)ve.position.copy(Re.position).applyMatrix4(Re.work.transform),ve.scale.setScalar(18);else{ve.position.copy(Re.standingPosition).applyMatrix4(Re.work.transform);var Ye=o.adjustPanoCircleMeshPositionFix.get(Re.panoId);Ye&&(scratchVector3.set(Ye.x,Ye.y,Ye.z),scratchVector3.equals(ve.position)&&(ve.position.y+=Ye.w)),ve.scale.setScalar(1.2)}var ut=o.camera.position.clone().setY(ve.position.y),Ke=new THREE__namespace.Vector3().copy(ve.position).sub(ut).normalize();if(Ie===panoStringify(o.currentPano)){var dt=clamp$1((.5-ut.distanceTo(ve.position))/.5,0,1);Ke.multiplyScalar(1-dt).add(A.clone().multiplyScalar(dt))}if(Ke.length()>0){var Pt=qe?-Math.PI/2:0,P=Math.atan2(Ke.x,Ke.z);ve.quaternion.setFromEuler(new THREE__namespace.Euler(Pt,P,0,"YXZ"))}}else ve.visible=!1}),this.camera.pose.distance>.1||M)this.panoMeshes.forEach(function(ve){ve.setOpacity(0),ve.setCurrent(!1),ve.updateTime&&ve.updateTime(e,r),ve.visible=!1});else if(Ce){var we=Ce.work.observers,Me=arrayMin(Ce.accessibleNodes,function(ve){var Ie=we[ve];return Ie?Ce.standingPosition.distanceTo(Ie.standingPosition):1/0},!0),ke=Me[1];ke=clamp$1(ke,2.5,1/0);var je=Ce.accessibleNodes.concat(Ce.panoIndex).map(function(ve){return panoStringify({panoIndex:ve,workCode:Ce.work.workCode})});this.panoMeshes.forEach(function(ve,Ie){var Re=o.works.getObserver(Ie),qe=!1,Ye=1;if(je.indexOf(Ie)===-1)qe=!1,Ye=0;else if(!Re)qe=!1,Ye=0;else if(!Re.loadable&&!Re.active)qe=!1,Ye=0;else{var ut=ve.position.clone().project(o.camera),Ke=Math.abs(ut.x)<1&&Math.abs(ut.y)<1&&Math.abs(ut.z)<1;qe=Ke&&!ve.loading&&ve.progress===0&&$e!==null&&panoStringify({panoIndex:$e.panoIndex,workCode:$e.work.workCode})===Ie;var dt=ve.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Ye=dt<.01?0:clamp$1(ke/dt,.1,.85)}if(Re&&Re===ze){var Pt=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(Pt){var dt=ve.position.distanceTo(o.camera.position);dt<35&&(Ye=0)}}o.modelScene.parameter.resolveValue().modelAlpha>0&&(Ye=0),ve.setCurrent(qe),ve.setOpacity(Ye),ve.updateTime&&ve.updateTime(e,r)})}{var B=(p=this.modelScene.parameter.progress)!==null&&p!==void 0?p:1,st=Math.round(B),Qe=this.modelScene.parameter.pano0,Je=this.modelScene.parameter.pano1,ft=st===0?Qe:Je,q=void 0;if(ft&&(q=this.works.getObserver(ft.panoId),q||(q=this.panoPictureObserverMap.get(ft))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=B<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!q||!ft||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var Bt={renderer:this.renderer,resolution:ne,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(Bt),this.modelScene.parameter.set("refinedScreen",null)}else{var Ft=getImageSizeLevel(ft.mapSize),pt=Ft+1,It=4;this.tiling.setObserver(q);var Bt={renderer:this.renderer,resolution:ne,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:ft.map,panoMatrix:ft.matrix,panoZoom:ft.zoom,minLevel:pt,level:It},Tt=this.tiling.update(Bt),ht={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:st,opacity:(Qe==null?void 0:Qe.panoId)===(Je==null?void 0:Je.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},mt=this.modelScene.parameter.refinedScreen;(Tt||ht.pano!==(mt==null?void 0:mt.pano)||ht.opacity!==(mt==null?void 0:mt.opacity))&&this.modelScene.parameter.set("refinedScreen",ht)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&Ce&&Ce.position.y-Ce.standingPosition.y>10){var gt=this.camera.position.distanceTo(this.intersectMesh.position),Et=2*Math.tan(.5*this.camera.fov/180*Math.PI),Lt=gt*Et/5;this.intersectMesh.scale.setScalar(Lt)}else this.intersectMesh.scale.setScalar(1);{var Ot=I.effect,Ht=this.modelScene.parameter,Qe=Ht.pano0,Je=Ht.pano1;if(Qe&&Je&&Qe!==Je&&(Ot==="fly"||Ot==="model")&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==Qe.panoId||((g=this.modelScene.parameter.pano1Depth)===null||g===void 0?void 0:g.panoId)!==Je.panoId){var it=500,vt=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==vt&&this.pano0DepthCubeRenderTarget.setSize(vt,vt):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==vt&&this.pano1DepthCubeRenderTarget.setSize(vt,vt):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Rt.matrix.copy(Qe.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,it);var wt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);wt.matrix.copy(Je.matrix),wt.matrixWorld.copy(wt.matrix),wt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,wt,it),this.modelScene.parameter.set({pano0Depth:{panoId:Qe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:it},pano1Depth:{panoId:Je.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:it}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}},t.prototype.render=function(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){var e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var l={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var f=e[c].handedness,p=e[c].gamepad;switch(f){case"left":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"LeftAxesDown",r)),p!=null&&p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"X",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"Y",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"LeftTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"LeftPinch",r));var d={raycaster:s,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.buttons.X=p.buttons&&p.buttons[4]?p.buttons[4].pressed:!1,l.buttons.Y=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.LeftTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.LeftPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1,l.left=d;break;case"right":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"RightAxesDown",r)),p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"A",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"B",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"RightTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"RightPinch",r));var h={raycaster:u,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.right=h,l.buttons.A=p.buttons&&p.buttons[4]?p==null?void 0:p.buttons[4].pressed:!1,l.buttons.B=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.RightTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.RightPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",l))}},t.prototype.emitHandleEvent=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=o,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}));else{var l=o-this.xrHandleState[r].touchStartTime;l>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}));var l=o-this.xrHandleState[r].touchStartTime;if(l<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}),f=this.emit("xr.gesture.tap",c);!f&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t})(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},controllersDefaultInitArgs={Floorplan:defaultFloorplanControllerCustomInitArgs,Topview:defaultTopviewControllerCustomInitArgs,Panorama:defaultPanoramaControllerCustomInitArgs,VRPanorama:defaultVRPanoramaControllerCustomInitArgs,Model:defaultModelControllerCustomInitArgs,Mapview:defaultMapviewControllerCustomInitArgs,XRPanorama:defaultXRPanoramaControllerInitArgs},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.dbltap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.dbltap",function(t){var e=!1;e=n.emit("wantsGesture","dbltap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsDblTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","dbltap",t.pointers,t.isFinal),n.emit("dblTapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],n.getCurrentState())}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],n.getCurrentState())}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(){var n=new THREE__namespace.Group;n.name="internalLights";{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction0",t.position.copy(new THREE__namespace.Vector3(0,1,0)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction1",t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.name="direction2",t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);t.name="ambient0",n.add(t)}return n}function parseKeyValue(n){for(var t,e,r={},o=n.split(/(\;|\,)/),s=0,u=o;s<u.length;s++){var l=u[s],c=l.split("="),f=(t=c[0])===null||t===void 0?void 0:t.trim(),p=(e=c[1])===null||e===void 0?void 0:e.trim();f&&p&&(r[f]=p)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1}const textureURL="data:image/png;base64,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";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),o=n.getScissor(prevScissor),s=n.getScissorTest(),u=n.autoClear,l=o.x+imageOffset[0]/3,c=o.y+imageOffset[1]/3,f=imageSize[0]/3,p=imageSize[1]/3;n.setViewport(l,c,f,p),n.setScissor(l,c,f,p),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(o),n.setScissorTest(s),n.autoClear=u}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=1e3,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},scratchSphere=new THREE__namespace.Sphere,scratchBox3=new THREE__namespace.Box3,scratchViewport=new THREE__namespace.Vector4,scratchScissor=new THREE__namespace.Vector4,scratchClearColor=new THREE__namespace.Color,scratchRenderSize=new THREE__namespace.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five_Instances={},Five=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,p,d,h,g,m=n.call(this)||this;if(m.fiveId=createUuid(),Five_Instances[m.fiveId]=m,m.currentUpdateArgs={time:now(),args:[]},m.currentMode="Panorama",m.pano={workCode:"",panoIndex:0},m.needsRender=!1,m.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,m.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),m.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),m.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,m.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),m.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,m.extraElements=[],m.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},m.fps={testCount:0,testTime:now()},m.modeChangeDuration=(f=e.modeChangeDuration)!==null&&f!==void 0?f:DEFAULT_MODE_CHANGE_DURATION,m.enableWheel=(p=e.enableWheel)!==null&&p!==void 0?p:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&m.throwError(new Error("cannot render a internal renderer")),m.renderer=e.renderer;else try{m.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var E=getViewportScale();m.renderer.setPixelRatio(E===1?window.devicePixelRatio:1),m.renderer.setSize(512,512),m.renderer.setClearColor(m.backgroundColor,m.backgroundAlpha)}catch(M){var y=M instanceof Error?M:new Error(String(M));m.throwError(y)}m.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=m.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),m.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),m.camera=new Camera(DEFAULT_CAMERA_FOV),m.scene=new Scene,m.xrCustomObjectsScene=new THREE__namespace.Scene,m.scene.add(m.xrCustomObjectsScene),m.scene.matrixAutoUpdate=!1,m.loadWorkTask=Promise.resolve(),m.requestProxy=(g=e.requestProxy)!==null&&g!==void 0?g:DEFAULT_REQUEST_PROXY,m.networkSubscribe=new NetworkSubscribe,m.networkSubscribe.on("network",function(M,B,L,O){var k;m.emit("network.resource",createEvent("network.resource",{source:M,requestType:B,requestState:L,detail:O})),(k=m.analysis)===null||k===void 0||k.network(m.works,M,B,L,O)}),m.readyCallbacks=[],m.syncingState=!1,m.helperGroup=new THREE__namespace.Group,m.helperGroup.name="helper",m.helperGroup.matrixAutoUpdate=!1,m.scene.add(m.helperGroup),worksMap.set(m,emptyWorks),m.modelScene=new ModelScene({fiveId:m.fiveId}),m.modelScene.addEventListener("model.create",function(M){m.bindModel(M.model)}),m.scene.add(m.modelScene);var v=m.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0})[0];defineProperty(v,"loaded",{get:function(){return!1},set:function(M){}}),m.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var A=initLights();m.scene.add(A),m.state={mode:m.currentMode,workCode:m.pano.workCode,panoIndex:m.pano.panoIndex,longitude:m.camera.pose.longitude,latitude:m.camera.pose.latitude,fov:m.camera.pose.fov,offset:m.camera.pose.offset.clone(),distance:m.camera.pose.distance},m.stateSynced=!1,m.destroyed=!1,m.paused=!0,typeof window!="undefined"&&(e.play!==!1&&m.play(),m.stopAnimationLoop=AnimationFrameLoop.shared.add(function(M,B){for(var L=[],O=2;O<arguments.length;O++)L[O-2]=arguments[O];m.updateTime.apply(m,__spreadArray([M,B],L,!1))},!1,0,10));var b=function(){typeof document!="undefined"&&document.fullscreenElement===null&&m.currentMode==="VRPanorama"&&m.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},T=function(){m.needsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.addEventListener("webglcontextrestored",T,!1),m.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.removeEventListener("webglcontextrestored",T,!1)},m.plugins={},e.plugins&&e.plugins.length)for(var _=0,S=e.plugins;_<S.length;_++){var w=S[_];if(typeof w=="function")w(m);else if(Array.isArray(w)){var R=w[0],I=w[1],H=w[2];if(typeof R=="function"){var C=R(m,H);typeof I=="string"&&(m.plugins[I]?m.throwError(new Error("plugin name ".concat(I," is exists."))):m.plugins[I]=C)}}}return initLegacyEvent(m),m.fiveRenderer=new FiveRenderer,m.adaptiveLuminancePass=new AdaptiveLuminancePass,m.adaptiveLuminancePass.enabled=!1,m.fiveRenderer.composer.addPass(m.adaptiveLuminancePass),m.eyeDomeLightingPass=new EyeDomeLightingPass(m.camera),m.eyeDomeLightingPass.enabled=!1,m.fiveRenderer.composer.addPass(m.eyeDomeLightingPass),m}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.30"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"useNativeImageBitmap",{get:function(){return canUseNativeImageBitmap()},set:function(e){useNativeImageBitmap(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ident",{get:function(){return this.fiveId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e;if(this.destroyed!==!0){delete Five_Instances[this.fiveId],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var r=this.getElement();r&&r.parentNode&&r.parentNode.removeChild(r);var o=this.modelScene.parameter;o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((e=o.pano0)===null||e===void 0?void 0:e.map)&&o.pano1.map.dispose(),o.reset("pano0","pano1"),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),worksMap.set(this,emptyWorks),this.renderer&&this.renderer.render(new THREE__namespace.Scene,new THREE__namespace.Camera),this.fiveRenderer.dispose(),this.renderer instanceof InternalWebGLRenderer&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}},t.prototype.setViewport=function(e){Object.assign(this.viewport,e),this.needsRender=!0},Object.defineProperty(t.prototype,"boundingMesh",{get:function(){return this.modelScene.boundingMesh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1,s=!1;if(e.panorama&&(Object.assign(this.controllerInits.Panorama,omitUndefinedFields(e.panorama)),this.currentMode==="Panorama"&&(o=!0)),e.model&&(Object.assign(this.controllerInits.Model,omitUndefinedFields(e.model)),this.currentMode==="Model"&&(o=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,omitUndefinedFields(e.floorplan)),this.currentMode==="Floorplan"&&(o=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,omitUndefinedFields(e.topview)),this.currentMode==="Topview"&&(o=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,omitUndefinedFields(e.mapview)),this.currentMode==="Mapview"&&(o=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,omitUndefinedFields(e.vrPanorama)),this.currentMode==="VRPanorama"&&(o=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(s=!0,o=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&o&&this.controller&&this.currentMode){var u=this.controller.updateConfiguration(this.controllerInits[this.currentMode]);(!u||s)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var o=this.getElement();if(o){e.appendChild(o),this.refresh(r);var s=window.getComputedStyle(e).position;s!=="relative"&&s!=="absolute"&&s!=="fixed"&&s!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){var o,s,u;if(e===void 0&&(e={}),!!this.renderer){var l=this.renderer.domElement,c=l.parentNode,f=e.width,p=f===void 0?(o=c==null?void 0:c.offsetWidth)!==null&&o!==void 0?o:512:f,d=e.height,h=d===void 0?(s=c==null?void 0:c.offsetHeight)!==null&&s!==void 0?s:512:d;if(p=Math.max(1,p),h=Math.max(1,h),!r){var g=getViewportScale(),m=typeof window!="undefined"?window.devicePixelRatio:1;if(r=(u=g===1?m:1)!==null&&u!==void 0?u:1,r>1){var E=Math.max(p,h)*r,y=Math.min(this.renderer.capabilities.maxTextureSize,4096);E>y&&(r=Math.max(r/E*y,1),r=Math.floor(r*100)/100)}}this.renderer.setPixelRatio(r),this.renderer.setSize(p,h),this.needsRender=!0;var v=now(),A=v-this.currentUpdateArgs.time,b=this.currentUpdateArgs.args;this.updateTime.apply(this,__spreadArray([v,A],b,!1))}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.updateCamera=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCamera(e,r,o)},t.prototype.updateCameraWithKeyframes=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCameraWithKeyframes(e,r,o)},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);return e||emptyWorks},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"observers",{get:function(){return this.work.observers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"models",{get:function(){return this.modelScene.models},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.modelScene.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,o,s){var u=this;if(s===void 0&&(s=!0),!this.renderer)throw new Error("renderer is not initialized");var l=this.loadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return u.load_(c,r,o,s)}):u.load_(e,r,o,s)});return this.loadWorkTask=l.catch(function(c){u.throwError(c)}),l},t.prototype.load_=function(e,r,o,s){var u=this,l,c,f,p,d,h,g,m,E,y,v;s===void 0&&(s=!0);var A={};typeof o=="number"?A.duration=o:typeof o=="object"&&Object.assign(A,o),this.works===emptyWorks&&(A.duration===void 0&&(A.duration=0),A.effect===void 0&&(A.effect="instant"));var b={};Object.assign(b,A.model),!b["3d-tiles"]&&A["3d-tiles"]&&(b["3d-tiles"]=A["3d-tiles"]),!b.textureOptions&&A.textureOptions&&(b.textureOptions=A.textureOptions),!b.textureOptions&&this.textureOptions&&(b.textureOptions=this.textureOptions);var T=[];if(Array.isArray(e))for(var _=0,S=e;_<S.length;_++){var w=S[_];w instanceof Work?T.push(w):typeof w!="string"&&"work"in w?T.push(parseWork(w.work,w)):T.push(parseWork(w))}else e instanceof Work?T.push(e):T.push(parseWork(e));A.mode==="add"&&(T=[].concat(this.works,T));var R;try{R=createWorks(T)}catch(K){return this.throwError(K),Promise.reject(K)}for(var I=0,H=R;I<H.length;I++){var C=H[I];this.bindWorkFetcher(C)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var M=this.currentMode,B=R.initial,L=B.work.observers[0],O=L?{workCode:L.work.workCode,panoIndex:L.panoIndex}:{workCode:B.work.workCode,panoIndex:0},k=(l=B.mode)!==null&&l!==void 0?l:L?"Panorama":"Mapview",D={};if(r==="inherit"){var q=this.getCurrentState(),z=R.filter(function(K){return K.workCode===q.workCode})[0];if(z)O={workCode:q.workCode,panoIndex:q.panoIndex},k=q.mode,D={longitude:q.latitude,latitude:q.latitude,fov:q.fov,distance:q.distance,offset:q.offset.clone()};else{r={mode:M};var V=(f=(c=R[0])===null||c===void 0?void 0:c.observers)===null||f===void 0?void 0:f[this.panoIndex];V?(r.workCode=V.work.workCode,r.panoIndex=V.panoIndex):typeof R.initial.panoIndex=="number"?(r.workCode=R.initial.work.workCode,r.panoIndex=R.initial.panoIndex):(r.mode==="Panorama"||r.mode==="VRPanorama"||r.mode==="XRPanorama")&&(r.mode="Mapview"),r.mode===M&&(r.longitude=this.camera.pose.longitude,r.latitude=this.camera.pose.latitude,r.fov=this.camera.pose.fov)}}if(r==="initial"&&(typeof B.panoIndex=="number"&&(O={workCode:B.work.workCode,panoIndex:B.panoIndex}),B.mode&&(k=B.mode),D={longitude:B.longitude,latitude:B.latitude,fov:B.fov,distance:B.distance,offset:(p=B.offset)===null||p===void 0?void 0:p.clone()}),typeof r=="object"){if(k=(d=r.mode)!==null&&d!==void 0?d:M,typeof r.panoIndex=="number"){var V=R.getObserver({workCode:(g=(h=r.workCode)!==null&&h!==void 0?h:B.work.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex});V&&(O={workCode:V.work.workCode,panoIndex:V.panoIndex})}D={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:(m=r.offset)===null||m===void 0?void 0:m.clone()}}var Q=(E=A.duration)!==null&&E!==void 0?E:this.modeChangeDuration;(k==="Floorplan"||k==="Topview"||k==="Mapview")&&M===k&&(Q=0);var U="fly";(k==="Panorama"||k==="VRPanorama"||k==="XRPanorama")&&M===k&&(U=(y=A.effect)!==null&&y!==void 0?y:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:R,userAction:s}));var j=function(K,se,W){var X=u.getCurrentState(),te=__assign(__assign({mode:K},se),W);r==="inherit"&&(te=u.getCurrentState()),u.pano=se;var Z=__assign(__assign({initial:{state:te,currentState:X,duration:Q,effect:U,userAction:s}},u.commonParams()),u.controllerInits[K]),ne=Controllers[te.mode].initAnimationEndState(Z);if(u.controller&&M===K)u.controller.updateWork(R,ne,{effect:U,duration:Q},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(K,Z));else{if(u.controller)u.controller.destroy();else{var pe=Controllers[K].initAnimationEndState(Z);u.camera.setFromPose(pe),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(K,Z);var ie=createEvent("mode.change",{prevMode:M,mode:K,state:ne,userAction:s});try{u.emit("mode.change",ie)}catch(ue){console.error(ue)}}u.updateTime.apply(u,__spreadArray([u.currentUpdateArgs.time,0],u.currentUpdateArgs.args,!1))};worksMap.set(this,R);var G=Promise.resolve();if(k===t.Mode.Floorplan||k===t.Mode.Topview||k===t.Mode.Mapview||k===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(D),assignPose(this.state,this.camera.pose));var ae=this.modelScene.setModels(R,b);G=Promise.all(ae.map(function(K){return K.loadedReady})).then(function(){u.needsRender=!0,j(k,O,D),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{j(k,O,D);var re=this.controller,$=!1;this.modelScene.autoRefine=!1;var ee=function(){u.works===R&&$===!1&&(u.needsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),$=!0,u.modelScene.autoRefine=!0),re.off("pano.arrived",ee),re.off("pano.cancel",ee)},ae=this.modelScene.setModels(R,b);G=Promise.all(ae.map(function(se){return se.initReady})).then(noop),re.once("pano.arrived",ee),re.once("pano.cancel",ee),setTimeout(ee,((v=A.duration)!==null&&v!==void 0?v:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,userAction:s,works:R})),G.then(function(){return u.ready()}).then(function(){var K;u.emit("works.ready",createEvent("works.ready",{input:e,userAction:s,works:R})),(K=u.analysis)===null||K===void 0||K.work(R)})},t.prototype.reset=function(){var e=this,r=this.loadWorkTask.then(function(){return e.reset_()});return this.loadWorkTask=r.catch(function(o){e.throwError(o)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var o;e.controller&&(e.controller.destroy(),e.controller=void 0);var s=e.modelScene.parameter;s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((o=s.pano0)===null||o===void 0?void 0:o.map)&&s.pano1.map.dispose(),s.set({pano0:null,pano1:null,modelAlpha:1}),worksMap.set(e,emptyWorks),e.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0}),e.renderer&&e.modelScene.update(e.renderer,e.camera),e.needsRender=!0,e.currentMode="Panorama",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.camera.needsRender=!1,e.needsRender=!1,r()})},t.prototype.changeMode=function(e,r,o,s,u){var l=this;return r===void 0&&(r={}),s===void 0&&(s=!0),u===void 0&&(u=!1),new Promise(function(c,f){var p,d,h,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var m=0;l.controller&&(typeof o=="number"?m=o:m=(p=o==null?void 0:o.duration)!==null&&p!==void 0?p:l.modeChangeDuration);var E="fly";l.controller&&typeof o=="object"&&o.effect&&(E=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(g=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));l.throwError(v),f(v);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!l.works.getObserver(y)){var v=new Error("PanoId ".concat(panoStringify(y)," not existed."));l.throwError(v),f(v);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&l.modelScene.empty&&(m=0);var A=l.controller,b=l.currentMode,T=function(){if(l.controller&&l.controller.stopMomentumMovement(),l.controller&&u===!1&&b===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?!panoEqual(l.pano,y)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(y,__assign({duration:m},r),s):l.controller.updateCamera(r,m,s).catch(noop):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,m,s).catch(noop));else{var S=__assign(__assign({},r),y),w=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:m,effect:E,userAction:s}},l.commonParams()),l.controllerInits[e]),R=Controllers[e].initAnimationEndState(w),I=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:R,userAction:s});if(l.emit("mode.change.request",I),!I.defaultPrevented){A&&A.destroy(),l.controller=l.applyController(e,w);var H=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:R,userAction:s});l.emit("mode.change",H)}}c()},_=AnimationFrameLoop.shared.getContext();_&&(typeof XRSession!="undefined"&&_ instanceof XRSession&&_.end(),AnimationFrameLoop.shared.setContext(null)),e===t.Mode.VRPanorama?(l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.exitFullscreen(),l.throwError(w),f(w)})):e===t.Mode.XRPanorama?requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),u=!0,T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.throwError(w),f(w)}):T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var f=now(),p=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),h=this.getSize(new THREE__namespace.Vector2),g=0,m=0,E=1,y=1,v,A,b,T,_;typeof e=="number"?(g=e,typeof r=="number"&&(m=r),typeof o=="number"&&(E=o),typeof s=="number"&&(y=s),v=u,A=l,_=c):(g=e.x,m=e.y,E=e.width,y=e.height,v=e.pixelRatio,A=e.flipY,b=e.helperVisible,T=e.skipPanorama,_=e.buffer),g=Math.ceil(g),m=Math.ceil(m),E=Math.ceil(E),y=Math.ceil(y),v=Math.ceil(v!=null?v:p),A=A!=null?A:!1;var S=this.helperVisible,w=this.modelScene.parameter.modelAlpha;this.helperVisible=b!=null?b:this.helperVisible,T&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&T===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(E*v,y*v),this.renderer.setRenderTarget(R),this.camera.pixelRatio=v,this.camera.resolution.set(E,y),this.camera.setViewOffset(h.width,h.height,g,h.height-m-y,E,y),this.camera.aspect=h.width/h.height,this.camera.updateTime(f),this.scene.update(this.renderer,this.camera);var I=this.renderer.autoClear,H=this.renderer.autoClearColor,C=this.renderer.autoClearDepth,M=this.renderer.autoClearStencil,B=scratchClearColor.copy(this.renderer.getClearColor()),L=this.renderer.getClearAlpha(),O=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);var k=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:k,this.renderer.render(this.scene,this.camera),this.scene.background=k,this.renderer.autoClear=I,this.renderer.autoClearColor=H,this.renderer.autoClearDepth=C,this.renderer.autoClearStencil=M,this.renderer.setClearColor(B,L),this.renderer.setScissorTest(O),this.helperVisible=S,w===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",w),this.renderer.setRenderTarget(d),this.camera.clearViewOffset(),this.camera.pixelRatio=p,this.camera.resolution.copy(h),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(f),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var D=E*v,q=y*v,z=D*q,V=z*4;if(_){if(_.length!==V)throw new Error("buffer length is not equals pixels ".concat(V))}else _=new Uint8Array(V);if(this.renderer.readRenderTargetPixels(R,0,0,E*v,y*v,_),A)for(var Q=z/2,U=0,j=0,G=0,ae=0;j<Q;j++)for(ae=(q-Math.floor(j/D)-1)*D+j%D,G=0;G<4;G++)U=_[j*4+G],_[j*4+G]=_[ae*4+G],_[ae*4+G]=U;return _},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},t.prototype.render=function(e){var r=this.renderer;if(r){var o=r.getRenderTarget();r.setRenderTarget(null);var s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,f=scratchClearColor.copy(r.getClearColor()),p=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),g=r.getScissorTest();r.autoClear=!0,r.autoClearColor=!0,r.autoClearDepth=!0,r.autoClearStencil=!0;var m=r.getSize(scratchRenderSize),E=Math.floor(m.x*this.viewport.left),y=Math.floor(m.y*this.viewport.bottom),v=Math.floor(m.x*this.viewport.width),A=Math.floor(m.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(E,y,v,A),r.setScissor(E,y,v,A);var b=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(b);var T=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:T;var _=!0;if(this.controller){var S=this.controller.render();S&&(_=!1)}if(_){var w=this.fiveRenderer.render(r,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&w&&renderPoweredByRealsee(r)}this.scene.background=T,r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(f,p),r.setViewport(d),r.setScissor(h),r.setScissorTest(g),r.setRenderTarget(o),e&&AnimationFrameLoop.shared.add(e,!0)}},t.prototype.updateTime=function(e,r){for(var o,s=this,u=[],l=2;l<arguments.length;l++)u[l-2]=arguments[l];if(this.currentUpdateArgs={time:e,args:u},!this.destroyed){if(this.renderer&&ktx2.detectSupport(this.renderer),this.syncingState=this.syncState(e,r),this.controller&&(o=this.controller).updateTime.apply(o,__spreadArray([e,r],u,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var c=this.modelScene.loaded,f=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),c===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),AnimationFrameLoop.shared.add(function(){s.emit("models.load",createEvent("models.load",{modelScene:s.modelScene}))},!0,0,10)),f===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.modelScene.boundingMesh);var p=scratchBox3.getBoundingSphere(scratchSphere),d=p.radius*2;p.containsPoint(this.camera.position)||(d=this.camera.position.distanceTo(p.center)+p.radius),d=clamp$1(d,800);var h=d/1e4;h=clamp$1(h,.03,.1),this.camera.near!==h&&(this.camera.near=h),this.camera.far!==d&&(this.camera.far=d),this.camera.updateTime(e)}if(this.renderer){var g=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=g}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused!==!0){var m=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",m),m.defaultPrevented&&(this.needsRender=!1);var E=this.needsRender;this.render(),this.needsRender=!1,this.emit("render",createEvent("render",{needsRender:E})),this.hasListener("fps")&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={}),o===void 0&&(o=!0);var s=this,u=s.controller,l=s.renderer;if(!u)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!l)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();typeof e=="number"&&this.pano.workCode&&(e={workCode:this.pano.workCode,panoIndex:e});var c=this.works.getObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var f={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(f,r,o):c&&(this.pano=f,this.once("initAnimation.start",function(p){r.moveStartCallback&&r.moveStartCallback(p.state)}),this.once("initAnimation.end",function(p){r.moveEndCallback&&r.moveEndCallback(p.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},o)),this.ready()},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop);var s=this.works.getObserver(e);if(!s)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var u=["right","left","up","down","front","back"],l=now();return Promise.all(u.map(function(c){var f=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),p=__assign({key:"pano.".concat(f,".").concat(c)},pick(o.imageOptions,["size","format","quality","forceUseExifOrientation","mappings"])),d=s.work.getURL(s.images[c]),h=o.imageOptions.transform?o.imageOptions.transform(d,p):imageURL(d,p);return getFetcher(o.fiveId,s.work).preload(h)})).then(function(){var c=now()-l;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.camera.position,s=e.clone().sub(o),u=new THREE__namespace.Raycaster(o,s.clone().normalize());u.params.Points={threshold:.1};var l=this.modelScene.intersectRaycaster(u)[0];if(l&&l.distance+.01<s.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var f=this.renderer.getSize(new THREE__namespace.Vector2),p=f.x*this.viewport.width,d=f.y*this.viewport.height,h=f.x*this.viewport.left+(c.x+1)/2*p,g=f.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,g)},t.prototype.getCurrentState=function(){return __assign(__assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,o){var s,u,l,c,f,p,d,h,g,m;r===void 0&&(r=!1),o===void 0&&(o=!0),e=pick(e,["mode","workCode","panoIndex","longitude","latitude","fov","offset","distance"]),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var E;if(typeof e.panoIndex=="number")if(e.workCode)E={workCode:e.workCode,panoIndex:e.panoIndex};else{var y=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",v=this.state.workCode;this.works.filter(function(M){return M.workCode===v}).length>0&&(y=v),E={workCode:y,panoIndex:e.panoIndex}}var A=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,w;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==A){if(A==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var R={workCode:E==null?void 0:E.workCode,panoIndex:E==null?void 0:E.panoIndex};typeof e.longitude=="number"&&(R.longitude=e.longitude),typeof e.latitude=="number"&&(R.latitude=e.latitude),typeof e.fov=="number"&&(R.fov=e.fov),typeof e.distance=="number"&&(R.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(R.offset=e.offset);var I=__assign(__assign({initial:{state:R,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[A]),H=Controllers[A].initAnimationEndState(I);b=H.longitude,T=H.latitude,_=H.fov,S=H.offset,w=H.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(f=e.latitude)!==null&&f!==void 0?f:this.state.latitude,_=(p=e.fov)!==null&&p!==void 0?p:this.state.fov,S=(d=e.offset)!==null&&d!==void 0?d:this.state.offset,w=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(E!=null?E:this.pano).workCode,panoIndex:(E!=null?E:this.pano).panoIndex,mode:A,longitude:b,latitude:T,fov:_,offset:S,distance:w};this.emit("state.set",createEvent("state.set",{userAction:o,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode==="VRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("VRPanorama")):this.controller&&C.mode==="XRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("XRPanorama")):(assignState(this.state,C),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===C.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((g=this.controller)===null||g===void 0||g.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:o,state:this.state})),(m=this.analysis)===null||m===void 0||m.state(this.works,this.state)))},t.prototype.syncState=function(e,r,o){o===void 0&&(o=!1);var s=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){var u={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,u,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},l),{duration:o?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,l,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var f=1,p=.2,d=.2,h=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,f),m=Math.abs(this.camera.pose.distance-this.state.distance),E=m>d*15?m/15:p,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,E),v=this.camera.pose.offset.distanceTo(this.state.offset),A=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,A),T=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},h),_=T.longitude,S=T.latitude;if(notSimilarValue(g,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var w={x:b.x,y:b.y,z:b.z},R={fov:g};return Object.assign(w,{distance:y}),Object.assign(R,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(R,0).catch(noop),this.controller.locationMotion.set(w,0).catch(noop),!0}}else{var I=1,H=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,I),C=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},H),_=C.longitude,S=C.latitude,y=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(b,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)||notSimilarValue(g,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,fov:g},0).catch(noop),!0}if(this.stateSynced=!0,s===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var M=this.currentMode,B=M===t.Mode.Floorplan||M===t.Mode.Topview||M===t.Mode.Mapview||M===t.Mode.Model;if(!B||this.modelScene.loaded){var L=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var O=0,k=L;O<k.length;O++){var D=k[O];this.controller instanceof Controllers.Panorama&&D.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(D):D()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(o){var s;r.readyCallbacks.push(Object.assign(o,{tile:(s=e.tile)!==null&&s!==void 0?s:!1}))}).then(function(){return r.model.initReady}).then(noop)},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.bindModel=function(e){var r=this,o=function(){AnimationFrameLoop.shared.add(function(){r.emit("model.load",createEvent("model.load",{work:e.work,model:e,error:null}))},!0)},s=function(c){var f=c.error;r.emit("model.error",createEvent("model.error",{work:e.work,model:e,error:f})),r.throwError(f)},u=function(){r.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:e.work,model:e,error:null}))},l=function(){e.removeEventListener("load",o),e.removeEventListener("error",s),e.removeEventListener("changeShownFloor",u),e.removeEventListener("dispose",l)};e.addEventListener("load",o),e.addEventListener("error",s),e.addEventListener("changeShownFloor",u),e.addEventListener("dispose",l),this.emit("model.request",createEvent("model.request",{work:e.work,model:e,error:null}))},t.prototype.bindWorkFetcher=function(e){var r=this,o=e.workCode,s=e.allowHosts,u=new Fetcher({get networkSubscribe(){return r.networkSubscribe},requestProxy:function(l){return Promise.resolve(l).then(function(c){return r.requestProxy(c,o)}).then(function(c){var f=verifyURL(c,s);return f instanceof Error?Promise.reject(f):f})}});registerFetcher(this.fiveId,e,u)},t.prototype.commonParams=function(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var m=[],E=0;E<arguments.length;E++)m[E]=arguments[E];var y=o.emit.apply(o,__spreadArray([g],m,!1));if(y)return!1})},c=0,f=PROXY_CONTROLLER_EVENT_NAMES;c<f.length;c++){var p=f[c];l(p)}{var d=Controllers[e].initAnimationEndState(r),h=r.initial.userAction;stateEqual(this.state,d)||(assignState(this.state,d),this.emit("state.change",createEvent("state.change",{userAction:h,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:this.getCurrentState()}))}return u.on("camera.update",function(g){var m;if(o.controller){var E=o.controller.getTargetState();g.userAction&&o.syncingState===!1&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:g.userAction,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:g.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.arrived",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.cancel",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:m,state:o.getCurrentState()}))}),u.on("pano.request",function(g){o.emit("pano.request",g),g.defaultPrevented||o.moveToPano(g.state,g.options,g.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(g){return o.throwError(g)}),u},t.prototype.removeEventListeners=function(){},Object.defineProperty(t.prototype,"internalLightsEnabled",{get:function(){var e=this.scene.children.find(function(r){return r.name==="internalLights"});return e?e.visible:!1},set:function(e){var r=this.scene.children.find(function(o){return o.name==="internalLights"});r&&(r.visible=e),r=this.modelScene.children.find(function(o){return o.name==="internalLights"}),r&&(r.visible=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scissor",{get:function(){return this.viewport},enumerable:!1,configurable:!0}),t.prototype.setScissor=function(e){return this.setViewport(e)},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,o=e.latitude,s=e.fov,u=e.offset,l=e.distance;return{longitude:r,latitude:o,fov:s,offset:u.clone(),distance:l}},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,o=e.latitude;return{longitude:r,latitude:o}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;r.matrix.copy(e.matrix).premultiply(e.work.transform),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1;var o=new THREE__namespace.Vector3(0,0,-1);o.applyQuaternion(this.camera.quaternion);var s=r.quaternion.clone().inverse();o.applyQuaternion(s);var u=Math.atan2(o.x,-o.z),l=-Math.asin(o.y);return{theta:u,phi:l,lookAtVector:o}}}return null},t.prototype.addPass=function(e){this.fiveRenderer.composer.addPass(e)},t.prototype.removePass=function(e){var r=this.fiveRenderer.composer.passes.indexOf(e);r!==-1&&this.fiveRenderer.composer.passes.splice(r,1)},t.prototype.insertPass=function(e,r){this.fiveRenderer.composer.insertPass(e,r)},Object.defineProperty(t.prototype,"renderMode",{get:function(){return this.fiveRenderer.renderMode},set:function(e){this.fiveRenderer.renderMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.fiveRenderer.renderMode==="point-cloud-high-quality"},set:function(e){this.fiveRenderer.renderMode=e?"point-cloud-high-quality":"default",this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.eyeDomeLightingPass.enabled},set:function(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableAdaptiveLuminance",{get:function(){return this.adaptiveLuminancePass.enabled},set:function(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelSceneNeedsRender",{get:function(){return this.modelScene.needsRender},set:function(e){this.modelScene.needsRender=e},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t})(Subscribe);if(typeof window!="undefined"){var __FIVE_DEBUG__={THREE:THREE__namespace,constructor:Five,instances:Five_Instances};Object.assign(window,{__FIVE_DEBUG__})}var XRButton=(function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function o(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function s(){o(),e.textContent="VR NOT SUPPORTED"}function u(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",u(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():s()}),e;var l=document.createElement("a");return window.isSecureContext===!1?(l.href=document.location.href.replace(/^http:/,"https:"),l.innerHTML="WEBXR NEEDS HTTPS"):(l.href="https://immersiveweb.dev/",l.innerHTML="WEBXR NOT AVAILABLE"),l.style.left="calc(50% - 90px)",l.style.width="180px",l.style.textDecoration="none",u(l),l},n})();exports.AdaptiveLuminancePass=AdaptiveLuminancePass,exports.AnimationFrameLoop=AnimationFrameLoop,exports.BoundingMesh=BoundingMesh$1,exports.Camera=Camera,exports.CustomShader=PBMCustomShader,exports.EffectComposer=EffectComposer,exports.EyeDomeLightingPass=EyeDomeLightingPass,exports.Fetcher=Fetcher,exports.Five=Five,exports.FivePass=FivePass,exports.FiveRenderer=FiveRenderer,exports.FullScreenQuad=FullScreenQuad,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.Model=Model,exports.ModelScene=ModelScene,exports.Motion=Motion,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMCustomShader=PBMCustomShader,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PBMPointCloud=PBMPointCloud,exports.PBMPointCloudMaterial=PBMPointCloudMaterial,exports.PBMSkinnedMesh=PBMSkinnedMesh,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.Parameter=Parameter,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3D=Tile3D,exports.Tile3DModel=Tile3D,exports.TileCache=TileCache,exports.TileNode=TileNode,exports.TileRequestScheduler=TileRequestScheduler,exports.Tileset=Tileset,exports.Trajectory=Trajectory,exports.TrajectoryNode=TrajectoryNode,exports.Work=Work,exports.WorkResolvedObserver=WorkResolvedObserver,exports.XRButton=XRButton,exports.controllersDefaultInitArgs=controllersDefaultInitArgs,exports.coordinatesToVector=coordinatesToVector,exports.createDebugBoundingMesh=createDebugBoundingMesh,exports.createWorks=createWorks,exports.defaultImageURLTransform=imageURL,exports.draco=draco,exports.getViewportScale=getViewportScale,exports.headingToLongitude=headingToLongitude,exports.imageSupport=imageSupport,exports.isBoundingVolume=isBoundingVolume,exports.isPanoId=isPanoId,exports.ktx2=ktx2,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadFbx=loadFbx,exports.loadGltf=loadGltf,exports.loadPbm=loadPbm,exports.loadPly=loadPly,exports.loadPnts=loadPnts,exports.loadX3p=loadX3p,exports.longitudeToHeading=longitudeToHeading,exports.makeBoundingVolume=makeBoundingVolume,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,exports.vectorToCoordinates=vectorToCoordinates,exports.workToJson=workToJson,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));
2350
+ `},LineMaterial=(function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(o){this.uniforms.diffuse.value=o}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(o){this.uniforms.linewidth.value=o}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(o){this.uniforms.dashScale.value=o}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(o){this.uniforms.dashSize.value=o}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(o){this.uniforms.gapSize.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}}}),r.setValues(e),r}return t})(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this)||this;return o.type="LineSegments2",o.geometry=e!==void 0?e:new LineSegmentsGeometry,o.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),o}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,o=e.attributes.instanceEnd,s=new Float32Array(2*r.count),u=new THREE__namespace.Vector3,l=new THREE__namespace.Vector3,c=0,f=0,p=r.count;c<p;c++,f+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[f]=f===0?0:s[f-1],s[f+1]=s[f]+u.distanceTo(l);var d=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(d,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(d,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var o=e.ray,s=e.camera,u=s.projectionMatrix,l=this.geometry,c=this.material,f=c.resolution,p=c.linewidth,d=l.attributes.instanceStart,h=l.attributes.instanceEnd,g=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,E=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,A=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,E),E.w=1,E.applyMatrix4(s.matrixWorldInverse),E.applyMatrix4(u),E.multiplyScalar(1/E.w),E.x*=f.x/2,E.y*=f.y/2,E.z=0,y.copy(E);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){g.fromBufferAttribute(d,_),m.fromBufferAttribute(h,_),g.w=1,m.w=1,g.applyMatrix4(v),m.applyMatrix4(v),g.applyMatrix4(u),m.applyMatrix4(u),g.multiplyScalar(1/g.w),m.multiplyScalar(1/m.w);var w=g.z<-1&&m.z<-1,R=g.z>1&&m.z>1;if(!(w||R)){g.x*=f.x/2,g.y*=f.y/2,m.x*=f.x/2,m.y*=f.y/2,A.start.copy(g),A.start.z=0,A.end.copy(m),A.end.z=0;var I=A.closestPointToPointParameter(y,!0);A.at(I,b);var H=THREE__namespace.MathUtils.lerp(g.z,m.z,I),C=H>=-1&&H<=1,M=y.distanceTo(b)<p*.5;if(C&&M){A.start.fromBufferAttribute(d,_),A.end.fromBufferAttribute(h,_),A.start.applyMatrix4(T),A.end.applyMatrix4(T);var B=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;o.distanceSqToSegment(A.start,A.end,L,B),r.push({point:L,pointOnLine:B,distance:o.origin.distanceTo(L),object:this,faceIndex:_})}}}},t})(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.type="Line2",o}return t})(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setPositions.call(this,o),this},t.prototype.setColors=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setColors.call(this,o),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t})(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=(function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var o=n.call(this)||this;o.type="FiveLine",o.needsRender=!0;var s=new LineGeometry,u=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});o.line=new Line2(s,u);var l=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return o.points=new THREE__namespace.Points(l,c),o.points.renderOrder=11,o.points.frustumCulled=!1,o.setPoints(e,r),o.add(o.line,o.points),o}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.32"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var o=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(o),3)),this.line.geometry.setPositions(o),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o];o==="dashed"?(r.dashed=s,s?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[o]=e[o]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var o=this.line.material.resolution;(o.x!==e||o.y!==r)&&(o.set(e,r),this.needsRender=!0)},t})(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,f,p,d;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(h){switch(h.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(u=h.sent(),e.profiles.some(function(g){var m=u[g];return m&&(l={profileId:g,profilePath:"".concat(r,"/").concat(m.path),deprecated:!!m.deprecated}),!!l}),!l){if(!o)throw new Error("No matching profile name found");if(c=u[o],!c)throw new Error('No matching profile name found and default profile "'.concat(o,'" missing.'));l={profileId:o,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(l.profilePath)];case 2:if(f=h.sent(),s){if(d=void 0,d=f.layouts[e.handedness],!d)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));d.assetPath&&(p=l.profilePath.replace("profile.json",d.assetPath))}return[2,{profile:f,assetPath:p}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,o=Math.sqrt(n*n+t*t);if(o>1){var s=Math.atan2(t,n);e=Math.cos(s),r=Math.sin(s)}var u={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return u}var VisualResponse=(function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,o=t.button,s=t.state,u=normalizeAxes(e,r),l=u.normalizedXAxis,c=u.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?l:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(s)?o:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n})(),Component=(function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(o){var s=new VisualResponse(e.visualResponses[o]);r.visualResponses[o]=s}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(o){o.updateFromComponent(e.values)})},n})(),MotionController=(function(){function n(t,e,r){var o=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(s){var u=o.layoutDescription.components[s];o.components[s]=new Component(s,u)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n})(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(o){o instanceof THREE__namespace.Mesh&&o.isMesh&&(o.material.envMap=r.envMap,o.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(o){var s=o.valueNode,u=o.minNode,l=o.maxNode,c=o.value,f=o.valueNodeProperty;s&&(f===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:f===Constants.VisualResponseProperty.TRANSFORM&&(s.quaternion.copy(u.quaternion).slerp(l.quaternion,c),s.position.lerpVectors(u.position,l.position,c)))})}))},t})(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,o=e.touchPointNodeName,s=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(o),e.touchPointNode){var u=new THREE.SphereGeometry(.001),l=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(u,l);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(s).forEach(function(f){var p=f.valueNodeName,d=f.minNodeName,h=f.maxNodeName,g=f.valueNodeProperty;if(g===Constants.VisualResponseProperty.TRANSFORM){if(f.minNode=t.getObjectByName(d),f.maxNode=t.getObjectByName(h),!f.minNode){console.warn("Could not find ".concat(d," in the model"));return}if(!f.maxNode){console.warn("Could not find ".concat(h," in the model"));return}}f.valueNode=t.getObjectByName(p),f.valueNode||console.warn("Could not find ".concat(p," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=(function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,o=null;return t.addEventListener("connected",function(s){var u=s.data;u.targetRayMode!=="tracked-pointer"||!u.gamepad||fetchProfile(u,e.path,DEFAULT_PROFILE).then(function(l){var c=l.profile,f=l.assetPath;r.motionController=new MotionController(u,c,f);var p=e._assetCache[r.motionController.assetUrl];if(p)o=p.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(d){e._assetCache[r.motionController.assetUrl]=d,o=d.scene.clone(),addAssetSceneToControllerModel(r,o)})}}).catch(function(l){console.warn(l)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(o),o=null}),r},n})(),defaultXRPanoramaControllerInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"]));function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,scratchRaycaster=new THREE__namespace.Raycaster,scratchVector3=new THREE__namespace.Vector3,XRPanoramaController=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.left.firstHitOnly=!0,r.xrControllerRay.left.floorIndex=-1,r.xrControllerRay.right.params.Points={threshold:.1},r.xrControllerRay.right.firstHitOnly=!0,r.xrControllerRay.right.floorIndex=-1,r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var s=r.xrManager.getController(1);r.controllerWrappers[1].add(s);var u=new XRControllerModelFactory;u.gltfLoader={load:function(c,f){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(p){var d;return parseGltf(p.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(d=c.split("?")[1])!==null&&d!==void 0?d:"",fetcher:internalFetcher})}).then(function(p){return f(p)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",effectEasing:defaultEffectEase,fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var l=AnimationFrameLoop.shared.getContext();return l?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(l),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(u.createControllerModel(c)),r.controllerWrappers[0].add(c);var f=r.xrManager.getControllerGrip(1);f.add(u.createControllerModel(f)),r.controllerWrappers[1].add(f)}),r.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"XRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),d=this.works.getObserver(e);if(!d)throw new Error("Invalid PanoIndex");getImageSizeFromURL(d.images.up),this.imageOptions.size;var h=this.imageOptions.transform,g=function(I,H){return mapPanoResource(applyImageURLOptions(I,h,H))},m=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality"])),E={right:d.images.work.getURL(d.images.right),left:d.images.work.getURL(d.images.left),up:d.images.work.getURL(d.images.up),down:d.images.work.getURL(d.images.down),front:d.images.work.getURL(d.images.front),back:d.images.work.getURL(d.images.back)},y="pano:"+jsonHash([E,m,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===y)return;var v=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(v))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:e}))}var A=this.modelScene.parameter.resolveValue(),b=A.pano0,T=A.pano1,_;if((b==null?void 0:b.map.name)===y?_=b:(T==null?void 0:T.map.name)===y&&(_=T),_){var S={panoId:p,effect:f,effectEasing:(c=r.effectEasing)!==null&&c!==void 0?c:defaultEffectEase,leftPanoPicture:{panoId:_.panoId,map:_.map,mapSize:_.mapSize,matrix:d.matrix.clone().premultiply(d.work.transform),zoom:1},position:d.position.clone().applyMatrix4(d.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,S,r);return}var w="move-to-pano-"+p;this.pending.add(w),this.pendingTextureTask={panoId:p,hash:y,onLoad:function(I){var H,C,M=I.body;if(s.destroyed)M.dispose();else{M.name=y;var B=Array.isArray(M.image)?M.image[0]:M.image,L=(H=B==null?void 0:B.width)!==null&&H!==void 0?H:2048,O={panoId:p,effect:f,effectEasing:(C=r.effectEasing)!==null&&C!==void 0?C:defaultEffectEase,leftPanoPicture:{panoId:p,map:M,mapSize:L,matrix:d.matrix.clone(),zoom:1},position:d.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,O,r)}},onError:function(I){var H=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:I,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),r.moveCancelCallback&&r.moveCancelCallback()}};var R=this.panoMeshes.get(p);R&&R.tap&&R.tap(),this.textureLoader.loadCubeTexture(E,{imageURL:{transform:g,options:m},format:THREE__namespace.RGBFormat,fetcher:getFetcher(this.fiveId,d.work)},void 0,void 0,function(I){var H,C;((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&((C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(I)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:I,meta:null,pano:e}))},this.renderer).then(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y?(s.pendingTextureTask.onLoad(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)):I.body.dispose(),s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:I.meta,pano:e}))}).catch(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&(s.pendingTextureTask.onError(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)),s.emit("pano.texture.error",createEvent("pano.texture.error",{error:I,progress:0,meta:null,pano:e})),s.emit("error",I)}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,m,E;o===void 0&&(o={});var y=now(),v=createUuid();this.panoResources[v]=r;var A=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(y);S[0];var w=S[1],R=this.locationMotion.value,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position;b=Math.max(I.distanceTo(H),A),T=[{key:w.key,progress:0,value:__assign(__assign({},R),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(y),M=C[0],w=C[1],R=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(M).position,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position,L=w.value.count-R.count,O=Math.max(B.distanceTo(I),A)*L,k=Math.max(I.distanceTo(H),A);b=O+k,T=[{key:M.key,progress:0,value:__assign({},R)},{key:w.key,progress:O/b,value:w.value},{key:v,progress:1,value:{count:w.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),q=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*D/q}var z=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"||r.effect==="model"?b:0),J={longitude:o.longitude,latitude:o.latitude,fov:o.fov},V=__assign(__assign({},e),{mode:this.mode,longitude:(u=J.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=J.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=J.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),U=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:U,progress:0,state:V,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(V),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly"||r.effect==="model")this.cameraMotion.set(J,z).catch(noop);else{var j=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),K=coordinatesToVector({longitude:(f=J.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(p=J.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude}),ae=new THREE__namespace.Object3D;ae.lookAt(j);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion);ae.lookAt(K);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion),Z=new THREE__namespace.Matrix4().getInverse(re).premultiply(ee),X=this.cameraMotion.value.fov,se=(d=J.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,G=1;r.effect==="zoomin"?G=1.5:r.effect==="zoomout"&&(G=.4);for(var W=se*G,$=0;$<T.length-1;$++){var ne=T[$].key;if(ne){var te=this.panoResources[ne];te&&(te.fixCameraTransform.copy(Z),te.leftPanoPicture&&(te.leftPanoPicture.zoom=Math.tan(W/2/180*Math.PI)/Math.tan(X/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(h=J.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(g=J.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:W}},{progress:1,value:{longitude:(m=J.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(E=J.latitude)!==null&&E!==void 0?E:this.cameraMotion.value.latitude,fov:se}}],z).catch(noop)}var ve=this.locationMotion.setKeyframes(T,z,_);ve.then(function(){for(var oe=0,fe=s.modelScene.children;oe<fe.length;oe++){var be=fe[oe];be instanceof Model&&be.show()}var ie=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:U,progress:1,state:ie,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ie);var ue=s.works.getObserver(s.currentPano);if(ue&&ue.images.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var me={map:s.videoTexture,size:ue.images.video.size.clone(),matrix:ue.images.video.matrix.clone(),panoMatrix:ue.matrix.clone().premultiply(ue.work.transform),alpha:1},ge=createUuid(),Ae=s.videoTexture.image;Ae.setAttribute("uuid",ge),canplayVideo().then(function(xe){xe&&ue.images.video&&Ae.getAttribute("uuid")===ge&&(Ae.oncanplay=function(){Ae.oncanplay=noop,Ae.play()},Ae.ontimeupdate=function(){Ae.currentTime>.5&&(Ae.ontimeupdate=noop,s.panoVideo.setMaterial(me))},Ae.src=ue.images.video.source)}).catch((function(){Ae.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:U,progress:0,state:V,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o;this.stopMomentumMovement(),this.camera.getDirection(new THREE__namespace.Vector3).setY(0);var s=null,u=this.works.getObserver(this.currentPano);if(!u)return null;var l=u.work.observers,c=u.accessibleNodes.filter(function(_){if(_===r.currentPano.panoIndex&&u.work.workCode===r.currentPano.workCode)return!1;var S=l[_];if(!S)return!1;var w=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return w.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),f=this.modelScene.intersectRaycaster(e)[0];if(f){var p=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var w=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return w.distanceTo(f.point)},!0),d=p[0],h=p[1];typeof d=="number"&&h<this.panoTapTriggerRadius&&(s=(o=l[d])!==null&&o!==void 0?o:null)}if(isNil(s)){var g=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);g&&(s=g)}for(var m=0,E=this.locationMotion.keyframes;m<E.length;m++){var y=E[m],v=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&s){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===A){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(A);b&&(b.setDisabled(!1),b.setLoading(!0))}var T={workCode:s.work.workCode,panoIndex:s.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:s?s.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:T,userAction:!0,options:{},progress:0,error:null})),s&&s.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:T,options:{},error:null})),{workCode:s.work.workCode,panoIndex:s.panoIndex}):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var o=this,s,u,l,c,f,p,d,h,g,m=[],E=2;E<arguments.length;E++)m[E-2]=arguments[E];this.userAction=!0;var y={},v={},A=this.camera.getDirection(new THREE__namespace.Vector3),b=this.locationMotion.keyframes[0],T=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],_=this.locationMotion.getKeyFrameSegment(e),S=_[0],w=_[1],R=this.panoResourceFromLocationMotionKeyframe(S),I=this.panoResourceFromLocationMotionKeyframe(w),H=this.panoResourceFromLocationMotionKeyframe(b),C=this.panoResourceFromLocationMotionKeyframe(T),M=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),v.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var B=this.locationMotion.value.count-w.value.count+1,L=new THREE__namespace.Vector3().copy(R.position),O=new THREE__namespace.Vector3().copy(I.position);if(y.progress=B,B>=.01&&B<=.99&&(y.progress=clamp$1(I.effectEasing(B),.01,.99)),I.leftPanoPicture&&(B<1?R.leftPanoPicture&&(y.pano0=R.leftPanoPicture):y.pano0=I.leftPanoPicture,y.pano1=I.leftPanoPicture),I.effect==="montage"?y.transition="BLACK":I.effect==="spread"?y.transition="SPREAD":y.transition="FADE",I.effect==="zoomin"||I.effect==="zoomout")y.progress=Math.pow(B,3);else if(I.effect==="model"&&this.camera.pose.distance<.01){var k=1-Math.pow(clamp$1(Math.abs(B-.5)*2,0,1),4);y.modelAlpha=k}if(B<1&&I.effect!=="fly"){if(y.pano0&&R.leftPanoPicture){var D={panoId:y.pano0.panoId,map:y.pano0.map,mapSize:y.pano0.mapSize,zoom:y.pano0.zoom,matrix:R.leftPanoPicture.matrix.clone().setPosition(I.position)},q=this.panoPictureObserverMap.get(y.pano0);q&&this.panoPictureObserverMap.set(D,q),y.pano0=D}L.copy(O),M=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(L.x+(O.x-L.x)*B,L.y+(O.y-L.y)*B,L.z+(O.z-L.z)*B);for(var z=[],J=[],V=0,U=this.locationMotion.keyframes;V<U.length;V++){var j=U[V],K=j.key,ae=j.progress;K!==void 0&&(z.push(K),ae>this.locationMotion.progress&&J.push(K))}for(var re=0,ee=Object.keys(this.panoResources);re<ee.length;re++){var Z=ee[re];if(!(J.indexOf(Z)>=0)){var X=this.panoResources[Z];if(X.leftPanoPicture){var se=X.leftPanoPicture.map;if(se){if(se===((s=y.pano0)===null||s===void 0?void 0:s.map)||se===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;se.dispose(),X.leftPanoPicture=null}}z.indexOf(Z)>=0||delete this.panoResources[Z]}}var G=panoParse(I.panoId);G!==this.currentPano&&(this.currentPano=G,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(H.panoId),state:__assign(__assign(__assign(__assign({},panoParse(C.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(v),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);var W=m,$=W[1],ne=new THREE__namespace.Vector3(0,0,0),te=new THREE__namespace.Vector2().copy(this.camera.resolution);if($&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){for(var ve=this.xrManager.cameraVR,oe=this.xrManager.referenceSpace,fe=this.xrManager.session.renderState.baseLayer,be=$.getViewerPose(oe),ie=(l=be==null?void 0:be.views)!==null&&l!==void 0?l:[],ue=0;ue<ie.length;ue++){var me=ie[ue],ge=ve.cameras[ue],Ae=fe.getViewport(me);Ae&&(ge.projectionMatrix.fromArray(me.projectionMatrix),ge.projectionMatrixInverse.getInverse(ge.projectionMatrix),ge.matrix.fromArray(me.transform.matrix),ge.matrix.setPosition(this.camera.position),ge.matrix.decompose(ge.position,ge.quaternion,ge.scale),ge.matrixWorld.copy(ge.matrix),ge.matrixWorldInverse.getInverse(ge.matrixWorld),ge.matrixAutoUpdate=!1,ne.copy(ge.position),ge.viewport.set(Ae.x,Ae.y,Ae.width,Ae.height),te.set(Ae.width,Ae.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((c=v.distance)!==null&&c!==void 0?c:this.camera.pose.distance),this.xrManager.session.inputSources){for(var ue=0;ue<this.xrManager.session.inputSources.length;ue++)if(this.xrManager.session.inputSources[ue]&&this.xrManager.session.inputSources[ue].targetRayMode==="transient-pointer"){var xe=$.getPose(this.xrManager.session.inputSources[ue].targetRaySpace,oe);if(xe){var de=xe.transform.orientation,_e=new THREE__namespace.Quaternion(de.x,de.y,de.z,de.w),He=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(_e),Ee=new THREE__namespace.Raycaster(this.camera.position,He);this.gazeRay=Ee}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var pe=this.xrManager.session.inputSources,Ve=function(he){var Ie=ye.xrManager.controllers[he],Re=pe[he];if(!Re)return"continue";Ie&&Ie.update(Re,$,oe);var qe=ye.xrManager.getController(he),Ye=new THREE__namespace.Vector3(0,1.2,0),ut=qe.position.clone().add(ne).sub(Ye);Re.handedness==="left"?ye.xrControllerRay.left.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)):Re.handedness==="right"&&ye.xrControllerRay.right.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)),ye.controllerWrappers[he].position.copy(new THREE__namespace.Vector3(0,0,0).add(ne).sub(Ye));var Ke=ye.modelScene.intersectRaycaster(ye.xrControllerRay.right);if(Ke.length===0){var dt=ye.works.getResolvedObserver(ye.currentPano);Ke=ye.xrControllerRay.right.intersectObject(ye.modelScene.boundingMesh,!0).map(function(Ge){var Ze,De=(Ze=dt==null?void 0:dt.floorIndex)!==null&&Ze!==void 0?Ze:0;return __assign({floorIndex:De,floor:De},Ge)})}if(Ke.length>=1&&Ke[0].face)if(Re.handedness==="right"){var Pt=ye.xrControllerRay.right.intersectObject(ye.xrCustomObjectsScene,!0),P=Ke[0].face.normal,F=P.clone(),N=Ke[0].point.clone();ye.intersectMesh.position.copy(N);var Q=N.clone().add(F);if(ye.intersectMesh.lookAt(Q),Math.abs(P.y)>.99){var Y=ye.camera.position.clone().sub(N);ye.intersectMesh.rotation.z=-Math.atan2(Y.z,Y.x)}ye.intersectMesh.visible=!0,ye.needsRender=!0,Pt.length>0?(ye.pointerLines.right.setPoints(ut,Pt[0].point),ye.pointerLines.right.points.visible=!0,ye.intersectMesh.visible=!1):(ye.pointerLines.right.points.visible=!1,ye.pointerLines.right.setPoints(ut,Ke[0].point));var le=Ke[0],Te=createEvent("intersect.update",{raycaster:(f=ye.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:le!=null?le:null,object:ye.intersectMesh});if(ye.emit("intersect.update",Te),Te.defaultPrevented)return ye.hideIntersectMesh(),{value:void 0}}else ye.pointerLines.left.setPoints(ut,Ke[0].point)},ye=this,ue=0;ue<pe.length;ue++){var Pe=Ve(ue);if(typeof Pe=="object")return Pe.value}this.updateControllerHelper(pe,e,r)}}else $||console.error("xrFrame丢失,请重试"),this.xrManager.session||console.error("session丢失,请重试"),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error("no layer found");isEmptyObject(y)===!1&&this.modelScene.parameter.set(y),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));var Ce=this.works.getResolvedObserver(this.currentPano),$e=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,Se=this.works.getObserver(R.panoId),ze=this.works.getObserver(I.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Ce){for(var Fe=[],Oe=Ce.work.observers,Le=0,Ue=Ce.accessibleNodes;Le<Ue.length;Le++){var tt=Ue[Le],q=Oe[tt];q&&Fe.push(q)}var lt=new Map;if(Fe.sort(function(he,Ie){var Re=lt.get(he);typeof Re=="undefined"&&(Re=he.standingPosition.distanceTo(Ce.standingPosition),lt.set(he,Re));var qe=lt.get(he);return typeof qe=="undefined"&&(qe=Ie.standingPosition.distanceTo(Ce.standingPosition),lt.set(Ie,qe)),Re-qe}),Fe.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Fe.length;var nt=Fe[this.accessibleObserverFloorCheckCount],ot=this.modelScene.models.find(function(he){return he.work===(nt==null?void 0:nt.work)});if(nt&&ot&&ot.visible){var At=.3,We=.05,Mt=.005,Be=nt.standingPosition.clone().applyMatrix4(nt.work.transform),Ne=panoStringify({panoIndex:nt.panoIndex,workCode:nt.work.workCode}),bt=adjustPanoCircleMeshVectors.map(function(he){scratchRaycaster.ray.origin.copy(Be),scratchRaycaster.ray.origin.add(scratchVector3.copy(he).setY(At)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var Ie=ot.intersectRaycaster(scratchRaycaster)[0];return Ie&&Ie.distance-Mt<=At?new THREE__namespace.Vector3().copy(Be).setY(Ie.point.y+Mt):Be});bt.sort(function(he,Ie){return Ie.y-he.y});var Ct=bt[Math.floor(bt.length/2)],xt=bt.filter(function(he){return he.distanceTo(Ct)<=We})[0];if(xt){var yt=new THREE__namespace.Vector4(Be.x,Be.y,Be.z,xt.y-Be.y),St=this.adjustPanoCircleMeshPositionFix.get(Ne);St&&!yt.equals(St)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Ne,yt)}}this.accessibleObserverFloorCheckCount++}}var rt=new Map;if(Se)for(var at=0,ct=Se.accessibleNodes;at<ct.length;at++){var tt=ct[at],q=Se.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(ze)for(var Xe=0,ce=ze.accessibleNodes;Xe<ce.length;Xe++){var tt=ce[Xe],q=ze.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(this.panoMeshes.forEach(function(he,Ie){var Re=rt.get(Ie);Re?rt.delete(Ie):(o.helper.remove(he),he.dispose(),o.panoMeshes.delete(Ie))}),rt.forEach(function(he,Ie){var Re=o.panoCircleMeshCreator(he,{aerialObserverMinHeight:o.aerialObserverMinHeight});o.panoMeshes.set(Ie,Re),o.helper.add(Re),rt.delete(Ie)}),this.panoMeshes.forEach(function(he,Ie){var Re=o.works.getObserver(Ie);if(Re){var qe=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(qe)he.position.copy(Re.position).applyMatrix4(Re.work.transform),he.scale.setScalar(18);else{he.position.copy(Re.standingPosition).applyMatrix4(Re.work.transform);var Ye=o.adjustPanoCircleMeshPositionFix.get(Re.panoId);Ye&&(scratchVector3.set(Ye.x,Ye.y,Ye.z),scratchVector3.equals(he.position)&&(he.position.y+=Ye.w)),he.scale.setScalar(1.2)}var ut=o.camera.position.clone().setY(he.position.y),Ke=new THREE__namespace.Vector3().copy(he.position).sub(ut).normalize();if(Ie===panoStringify(o.currentPano)){var dt=clamp$1((.5-ut.distanceTo(he.position))/.5,0,1);Ke.multiplyScalar(1-dt).add(A.clone().multiplyScalar(dt))}if(Ke.length()>0){var Pt=qe?-Math.PI/2:0,P=Math.atan2(Ke.x,Ke.z);he.quaternion.setFromEuler(new THREE__namespace.Euler(Pt,P,0,"YXZ"))}}else he.visible=!1}),this.camera.pose.distance>.1||M)this.panoMeshes.forEach(function(he){he.setOpacity(0),he.setCurrent(!1),he.updateTime&&he.updateTime(e,r),he.visible=!1});else if(Ce){var we=Ce.work.observers,Me=arrayMin(Ce.accessibleNodes,function(he){var Ie=we[he];return Ie?Ce.standingPosition.distanceTo(Ie.standingPosition):1/0},!0),ke=Me[1];ke=clamp$1(ke,2.5,1/0);var je=Ce.accessibleNodes.concat(Ce.panoIndex).map(function(he){return panoStringify({panoIndex:he,workCode:Ce.work.workCode})});this.panoMeshes.forEach(function(he,Ie){var Re=o.works.getObserver(Ie),qe=!1,Ye=1;if(je.indexOf(Ie)===-1)qe=!1,Ye=0;else if(!Re)qe=!1,Ye=0;else if(!Re.loadable&&!Re.active)qe=!1,Ye=0;else{var ut=he.position.clone().project(o.camera),Ke=Math.abs(ut.x)<1&&Math.abs(ut.y)<1&&Math.abs(ut.z)<1;qe=Ke&&!he.loading&&he.progress===0&&$e!==null&&panoStringify({panoIndex:$e.panoIndex,workCode:$e.work.workCode})===Ie;var dt=he.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Ye=dt<.01?0:clamp$1(ke/dt,.1,.85)}if(Re&&Re===ze){var Pt=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(Pt){var dt=he.position.distanceTo(o.camera.position);dt<35&&(Ye=0)}}o.modelScene.parameter.resolveValue().modelAlpha>0&&(Ye=0),he.setCurrent(qe),he.setOpacity(Ye),he.updateTime&&he.updateTime(e,r)})}{var B=(p=this.modelScene.parameter.progress)!==null&&p!==void 0?p:1,st=Math.round(B),Qe=this.modelScene.parameter.pano0,Je=this.modelScene.parameter.pano1,ft=st===0?Qe:Je,q=void 0;if(ft&&(q=this.works.getObserver(ft.panoId),q||(q=this.panoPictureObserverMap.get(ft))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=B<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!q||!ft||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var Bt={renderer:this.renderer,resolution:te,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(Bt),this.modelScene.parameter.set("refinedScreen",null)}else{var Ft=getImageSizeLevel(ft.mapSize),pt=Ft+1,It=4;this.tiling.setObserver(q);var Bt={renderer:this.renderer,resolution:te,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:ft.map,panoMatrix:ft.matrix,panoZoom:ft.zoom,minLevel:pt,level:It},Tt=this.tiling.update(Bt),ht={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:st,opacity:(Qe==null?void 0:Qe.panoId)===(Je==null?void 0:Je.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},mt=this.modelScene.parameter.refinedScreen;(Tt||ht.pano!==(mt==null?void 0:mt.pano)||ht.opacity!==(mt==null?void 0:mt.opacity))&&this.modelScene.parameter.set("refinedScreen",ht)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&Ce&&Ce.position.y-Ce.standingPosition.y>10){var gt=this.camera.position.distanceTo(this.intersectMesh.position),Et=2*Math.tan(.5*this.camera.fov/180*Math.PI),Lt=gt*Et/5;this.intersectMesh.scale.setScalar(Lt)}else this.intersectMesh.scale.setScalar(1);{var Ot=I.effect,Ht=this.modelScene.parameter,Qe=Ht.pano0,Je=Ht.pano1;if(Qe&&Je&&Qe!==Je&&(Ot==="fly"||Ot==="model")&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==Qe.panoId||((g=this.modelScene.parameter.pano1Depth)===null||g===void 0?void 0:g.panoId)!==Je.panoId){var it=500,vt=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==vt&&this.pano0DepthCubeRenderTarget.setSize(vt,vt):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==vt&&this.pano1DepthCubeRenderTarget.setSize(vt,vt):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Rt.matrix.copy(Qe.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,it);var wt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);wt.matrix.copy(Je.matrix),wt.matrixWorld.copy(wt.matrix),wt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,wt,it),this.modelScene.parameter.set({pano0Depth:{panoId:Qe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:it},pano1Depth:{panoId:Je.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:it}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}},t.prototype.render=function(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){var e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var l={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var f=e[c].handedness,p=e[c].gamepad;switch(f){case"left":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"LeftAxesDown",r)),p!=null&&p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"X",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"Y",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"LeftTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"LeftPinch",r));var d={raycaster:s,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.buttons.X=p.buttons&&p.buttons[4]?p.buttons[4].pressed:!1,l.buttons.Y=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.LeftTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.LeftPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1,l.left=d;break;case"right":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"RightAxesDown",r)),p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"A",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"B",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"RightTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"RightPinch",r));var h={raycaster:u,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.right=h,l.buttons.A=p.buttons&&p.buttons[4]?p==null?void 0:p.buttons[4].pressed:!1,l.buttons.B=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.RightTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.RightPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",l))}},t.prototype.emitHandleEvent=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=o,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}));else{var l=o-this.xrHandleState[r].touchStartTime;l>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}));var l=o-this.xrHandleState[r].touchStartTime;if(l<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}),f=this.emit("xr.gesture.tap",c);!f&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t})(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},controllersDefaultInitArgs={Floorplan:defaultFloorplanControllerCustomInitArgs,Topview:defaultTopviewControllerCustomInitArgs,Panorama:defaultPanoramaControllerCustomInitArgs,VRPanorama:defaultVRPanoramaControllerCustomInitArgs,Model:defaultModelControllerCustomInitArgs,Mapview:defaultMapviewControllerCustomInitArgs,XRPanorama:defaultXRPanoramaControllerInitArgs},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.dbltap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.dbltap",function(t){var e=!1;e=n.emit("wantsGesture","dbltap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsDblTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","dbltap",t.pointers,t.isFinal),n.emit("dblTapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],n.getCurrentState())}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],n.getCurrentState())}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(){var n=new THREE__namespace.Group;n.name="internalLights";{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction0",t.position.copy(new THREE__namespace.Vector3(0,1,0)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction1",t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.name="direction2",t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);t.name="ambient0",n.add(t)}return n}function parseKeyValue(n){for(var t,e,r={},o=n.split(/(\;|\,)/),s=0,u=o;s<u.length;s++){var l=u[s],c=l.split("="),f=(t=c[0])===null||t===void 0?void 0:t.trim(),p=(e=c[1])===null||e===void 0?void 0:e.trim();f&&p&&(r[f]=p)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1}const textureURL="data:image/png;base64,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";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),o=n.getScissor(prevScissor),s=n.getScissorTest(),u=n.autoClear,l=o.x+imageOffset[0]/3,c=o.y+imageOffset[1]/3,f=imageSize[0]/3,p=imageSize[1]/3;n.setViewport(l,c,f,p),n.setScissor(l,c,f,p),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(o),n.setScissorTest(s),n.autoClear=u}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=1e3,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},scratchSphere=new THREE__namespace.Sphere,scratchBox3=new THREE__namespace.Box3,scratchViewport=new THREE__namespace.Vector4,scratchScissor=new THREE__namespace.Vector4,scratchClearColor=new THREE__namespace.Color,scratchRenderSize=new THREE__namespace.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five_Instances={},Five=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,p,d,h,g,m=n.call(this)||this;if(m.fiveId=createUuid(),Five_Instances[m.fiveId]=m,m.currentUpdateArgs={time:now(),args:[]},m.currentMode="Panorama",m.pano={workCode:"",panoIndex:0},m.needsRender=!1,m.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,m.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),m.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),m.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,m.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),m.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,m.extraElements=[],m.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},m.fps={testCount:0,testTime:now()},m.modeChangeDuration=(f=e.modeChangeDuration)!==null&&f!==void 0?f:DEFAULT_MODE_CHANGE_DURATION,m.enableWheel=(p=e.enableWheel)!==null&&p!==void 0?p:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&m.throwError(new Error("cannot render a internal renderer")),m.renderer=e.renderer;else try{m.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var E=getViewportScale();m.renderer.setPixelRatio(E===1?window.devicePixelRatio:1),m.renderer.setSize(512,512),m.renderer.setClearColor(m.backgroundColor,m.backgroundAlpha)}catch(M){var y=M instanceof Error?M:new Error(String(M));m.throwError(y)}m.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=m.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),m.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),m.camera=new Camera(DEFAULT_CAMERA_FOV),m.scene=new Scene,m.xrCustomObjectsScene=new THREE__namespace.Scene,m.scene.add(m.xrCustomObjectsScene),m.scene.matrixAutoUpdate=!1,m.loadWorkTask=Promise.resolve(),m.requestProxy=(g=e.requestProxy)!==null&&g!==void 0?g:DEFAULT_REQUEST_PROXY,m.networkSubscribe=new NetworkSubscribe,m.networkSubscribe.on("network",function(M,B,L,O){var k;m.emit("network.resource",createEvent("network.resource",{source:M,requestType:B,requestState:L,detail:O})),(k=m.analysis)===null||k===void 0||k.network(m.works,M,B,L,O)}),m.readyCallbacks=[],m.syncingState=!1,m.helperGroup=new THREE__namespace.Group,m.helperGroup.name="helper",m.helperGroup.matrixAutoUpdate=!1,m.scene.add(m.helperGroup),worksMap.set(m,emptyWorks),m.modelScene=new ModelScene({fiveId:m.fiveId}),m.modelScene.addEventListener("model.create",function(M){m.bindModel(M.model)}),m.scene.add(m.modelScene);var v=m.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0})[0];defineProperty(v,"loaded",{get:function(){return!1},set:function(M){}}),m.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var A=initLights();m.scene.add(A),m.state={mode:m.currentMode,workCode:m.pano.workCode,panoIndex:m.pano.panoIndex,longitude:m.camera.pose.longitude,latitude:m.camera.pose.latitude,fov:m.camera.pose.fov,offset:m.camera.pose.offset.clone(),distance:m.camera.pose.distance},m.stateSynced=!1,m.destroyed=!1,m.paused=!0,typeof window!="undefined"&&(e.play!==!1&&m.play(),m.stopAnimationLoop=AnimationFrameLoop.shared.add(function(M,B){for(var L=[],O=2;O<arguments.length;O++)L[O-2]=arguments[O];m.updateTime.apply(m,__spreadArray([M,B],L,!1))},!1,0,10));var b=function(){typeof document!="undefined"&&document.fullscreenElement===null&&m.currentMode==="VRPanorama"&&m.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},T=function(){m.needsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.addEventListener("webglcontextrestored",T,!1),m.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.removeEventListener("webglcontextrestored",T,!1)},m.plugins={},e.plugins&&e.plugins.length)for(var _=0,S=e.plugins;_<S.length;_++){var w=S[_];if(typeof w=="function")w(m);else if(Array.isArray(w)){var R=w[0],I=w[1],H=w[2];if(typeof R=="function"){var C=R(m,H);typeof I=="string"&&(m.plugins[I]?m.throwError(new Error("plugin name ".concat(I," is exists."))):m.plugins[I]=C)}}}return initLegacyEvent(m),m.fiveRenderer=new FiveRenderer,m.adaptiveLuminancePass=new AdaptiveLuminancePass,m.adaptiveLuminancePass.enabled=!1,m.fiveRenderer.composer.addPass(m.adaptiveLuminancePass),m.eyeDomeLightingPass=new EyeDomeLightingPass(m.camera),m.eyeDomeLightingPass.enabled=!1,m.fiveRenderer.composer.addPass(m.eyeDomeLightingPass),m}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.32"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"useNativeImageBitmap",{get:function(){return canUseNativeImageBitmap()},set:function(e){useNativeImageBitmap(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ident",{get:function(){return this.fiveId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e;if(this.destroyed!==!0){delete Five_Instances[this.fiveId],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var r=this.getElement();r&&r.parentNode&&r.parentNode.removeChild(r);var o=this.modelScene.parameter;o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((e=o.pano0)===null||e===void 0?void 0:e.map)&&o.pano1.map.dispose(),o.reset("pano0","pano1"),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),worksMap.set(this,emptyWorks),this.renderer&&this.renderer.render(new THREE__namespace.Scene,new THREE__namespace.Camera),this.fiveRenderer.dispose(),this.renderer instanceof InternalWebGLRenderer&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}},t.prototype.setViewport=function(e){Object.assign(this.viewport,e),this.needsRender=!0},Object.defineProperty(t.prototype,"boundingMesh",{get:function(){return this.modelScene.boundingMesh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1,s=!1;if(e.panorama&&(Object.assign(this.controllerInits.Panorama,omitUndefinedFields(e.panorama)),this.currentMode==="Panorama"&&(o=!0)),e.model&&(Object.assign(this.controllerInits.Model,omitUndefinedFields(e.model)),this.currentMode==="Model"&&(o=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,omitUndefinedFields(e.floorplan)),this.currentMode==="Floorplan"&&(o=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,omitUndefinedFields(e.topview)),this.currentMode==="Topview"&&(o=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,omitUndefinedFields(e.mapview)),this.currentMode==="Mapview"&&(o=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,omitUndefinedFields(e.vrPanorama)),this.currentMode==="VRPanorama"&&(o=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(s=!0,o=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&o&&this.controller&&this.currentMode){var u=this.controller.updateConfiguration(this.controllerInits[this.currentMode]);(!u||s)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var o=this.getElement();if(o){e.appendChild(o),this.refresh(r);var s=window.getComputedStyle(e).position;s!=="relative"&&s!=="absolute"&&s!=="fixed"&&s!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){var o,s,u;if(e===void 0&&(e={}),!!this.renderer){var l=this.renderer.domElement,c=l.parentNode,f=e.width,p=f===void 0?(o=c==null?void 0:c.offsetWidth)!==null&&o!==void 0?o:512:f,d=e.height,h=d===void 0?(s=c==null?void 0:c.offsetHeight)!==null&&s!==void 0?s:512:d;if(p=Math.max(1,p),h=Math.max(1,h),!r){var g=getViewportScale(),m=typeof window!="undefined"?window.devicePixelRatio:1;if(r=(u=g===1?m:1)!==null&&u!==void 0?u:1,r>1){var E=Math.max(p,h)*r,y=Math.min(this.renderer.capabilities.maxTextureSize,4096);E>y&&(r=Math.max(r/E*y,1),r=Math.floor(r*100)/100)}}this.renderer.setPixelRatio(r),this.renderer.setSize(p,h),this.needsRender=!0;var v=now(),A=v-this.currentUpdateArgs.time,b=this.currentUpdateArgs.args;this.updateTime.apply(this,__spreadArray([v,A],b,!1))}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.updateCamera=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCamera(e,r,o)},t.prototype.updateCameraWithKeyframes=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCameraWithKeyframes(e,r,o)},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);return e||emptyWorks},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"observers",{get:function(){return this.work.observers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"models",{get:function(){return this.modelScene.models},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.modelScene.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,o,s){var u=this;if(s===void 0&&(s=!0),!this.renderer)throw new Error("renderer is not initialized");var l=this.loadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return u.load_(c,r,o,s)}):u.load_(e,r,o,s)});return this.loadWorkTask=l.catch(function(c){u.throwError(c)}),l},t.prototype.load_=function(e,r,o,s){var u=this,l,c,f,p,d,h,g,m,E,y;s===void 0&&(s=!0);var v={};typeof o=="number"?v.duration=o:typeof o=="object"&&Object.assign(v,o),this.works===emptyWorks&&(v.duration===void 0&&(v.duration=0),v.effect===void 0&&(v.effect="instant"));var A={};Object.assign(A,v.model),!A["3d-tiles"]&&v["3d-tiles"]&&(A["3d-tiles"]=v["3d-tiles"]),!A.textureOptions&&v.textureOptions&&(A.textureOptions=v.textureOptions),!A.textureOptions&&this.textureOptions&&(A.textureOptions=this.textureOptions);var b=[];if(Array.isArray(e))for(var T=0,_=e;T<_.length;T++){var S=_[T];S instanceof Work?b.push(S):typeof S!="string"&&"work"in S?b.push(parseWork(S.work,S)):b.push(parseWork(S))}else e instanceof Work?b.push(e):b.push(parseWork(e));v.mode==="add"&&(b=[].concat(this.works,b));var w;try{w=createWorks(b)}catch(Z){return this.throwError(Z),Promise.reject(Z)}for(var R=0,I=w;R<I.length;R++){var H=I[R];this.bindWorkFetcher(H)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var C=this.currentMode,M=w.initial,B=M.work.observers[0],L=B?{workCode:B.work.workCode,panoIndex:B.panoIndex}:{workCode:M.work.workCode,panoIndex:0},O=(l=M.mode)!==null&&l!==void 0?l:B?"Panorama":"Mapview",k={};if(r==="inherit"){var D=this.getCurrentState(),q=w.filter(function(Z){return Z.workCode===D.workCode})[0];if(q)L={workCode:D.workCode,panoIndex:D.panoIndex},O=D.mode,k={longitude:D.latitude,latitude:D.latitude,fov:D.fov,distance:D.distance,offset:D.offset.clone()};else{r={mode:C};var z=(f=(c=w[0])===null||c===void 0?void 0:c.observers)===null||f===void 0?void 0:f[this.panoIndex];z?(r.workCode=z.work.workCode,r.panoIndex=z.panoIndex):typeof w.initial.panoIndex=="number"?(r.workCode=w.initial.work.workCode,r.panoIndex=w.initial.panoIndex):(r.mode==="Panorama"||r.mode==="VRPanorama"||r.mode==="XRPanorama")&&(r.mode="Mapview"),r.mode===C&&(r.longitude=this.camera.pose.longitude,r.latitude=this.camera.pose.latitude,r.fov=this.camera.pose.fov)}}if(r==="initial"&&(typeof M.panoIndex=="number"&&(L={workCode:M.work.workCode,panoIndex:M.panoIndex}),M.mode&&(O=M.mode),k={longitude:M.longitude,latitude:M.latitude,fov:M.fov,distance:M.distance,offset:(p=M.offset)===null||p===void 0?void 0:p.clone()}),typeof r=="object"){if(O=(d=r.mode)!==null&&d!==void 0?d:C,typeof r.panoIndex=="number"){var z=w.getObserver({workCode:(g=(h=r.workCode)!==null&&h!==void 0?h:M.work.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex});z&&(L={workCode:z.work.workCode,panoIndex:z.panoIndex})}k={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset?new THREE__namespace.Vector3().copy(r.offset):void 0}}var J=(m=v.duration)!==null&&m!==void 0?m:this.modeChangeDuration;(O==="Floorplan"||O==="Topview"||O==="Mapview")&&C===O&&(J=0);var V="fly";(O==="Panorama"||O==="VRPanorama"||O==="XRPanorama")&&C===O&&(V=(E=v.effect)!==null&&E!==void 0?E:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:w,userAction:s}));var U=function(Z,X,se){var G=u.getCurrentState(),W=__assign(__assign({mode:Z},X),se);r==="inherit"&&(W=u.getCurrentState()),u.pano=X;var $=__assign(__assign({initial:{state:W,currentState:G,duration:J,effect:V,userAction:s}},u.commonParams()),u.controllerInits[Z]),ne=Controllers[W.mode].initAnimationEndState($);if(u.controller&&C===Z)u.controller.updateWork(w,ne,{effect:V,duration:J},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(Z,$));else{if(u.controller)u.controller.destroy();else{var te=Controllers[Z].initAnimationEndState($);u.camera.setFromPose(te),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(Z,$);var ve=createEvent("mode.change",{prevMode:C,mode:Z,state:ne,userAction:s});try{u.emit("mode.change",ve)}catch(oe){console.error(oe)}}u.updateTime.apply(u,__spreadArray([u.currentUpdateArgs.time,0],u.currentUpdateArgs.args,!1))};worksMap.set(this,w);var j=Promise.resolve();if(O===t.Mode.Floorplan||O===t.Mode.Topview||O===t.Mode.Mapview||O===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(k),assignPose(this.state,this.camera.pose));var K=this.modelScene.setModels(w,A);j=Promise.all(K.map(function(Z){return Z.loadedReady})).then(function(){u.needsRender=!0,U(O,L,k),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{U(O,L,k);var ae=this.controller,re=!1;this.modelScene.autoRefine=!1;var ee=function(){u.works===w&&re===!1&&(u.needsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),re=!0,u.modelScene.autoRefine=!0),ae.off("pano.arrived",ee),ae.off("pano.cancel",ee)},K=this.modelScene.setModels(w,A);j=Promise.all(K.map(function(X){return X.initReady})).then(noop),ae.once("pano.arrived",ee),ae.once("pano.cancel",ee),setTimeout(ee,((y=v.duration)!==null&&y!==void 0?y:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,userAction:s,works:w})),j.then(function(){return u.ready()}).then(function(){var Z;u.emit("works.ready",createEvent("works.ready",{input:e,userAction:s,works:w})),(Z=u.analysis)===null||Z===void 0||Z.work(w)})},t.prototype.reset=function(){var e=this,r=this.loadWorkTask.then(function(){return e.reset_()});return this.loadWorkTask=r.catch(function(o){e.throwError(o)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var o;e.controller&&(e.controller.destroy(),e.controller=void 0);var s=e.modelScene.parameter;s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((o=s.pano0)===null||o===void 0?void 0:o.map)&&s.pano1.map.dispose(),s.set({pano0:null,pano1:null,modelAlpha:1}),worksMap.set(e,emptyWorks),e.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0}),e.renderer&&e.modelScene.update(e.renderer,e.camera),e.needsRender=!0,e.currentMode="Panorama",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.camera.needsRender=!1,e.needsRender=!1,r()})},t.prototype.changeMode=function(e,r,o,s,u){var l=this;return r===void 0&&(r={}),s===void 0&&(s=!0),u===void 0&&(u=!1),new Promise(function(c,f){var p,d,h,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var m=0;l.controller&&(typeof o=="number"?m=o:m=(p=o==null?void 0:o.duration)!==null&&p!==void 0?p:l.modeChangeDuration);var E="fly";l.controller&&typeof o=="object"&&o.effect&&(E=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(g=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));l.throwError(v),f(v);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!l.works.getObserver(y)){var v=new Error("PanoId ".concat(panoStringify(y)," not existed."));l.throwError(v),f(v);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&l.modelScene.empty&&(m=0);var A=l.controller,b=l.currentMode,T=function(){if(l.controller&&l.controller.stopMomentumMovement(),l.controller&&u===!1&&b===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?!panoEqual(l.pano,y)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(y,__assign({duration:m},r),s):l.controller.updateCamera(r,m,s).catch(noop):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,m,s).catch(noop));else{var S=__assign(__assign({},r),y),w=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:m,effect:E,userAction:s}},l.commonParams()),l.controllerInits[e]),R=Controllers[e].initAnimationEndState(w),I=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:R,userAction:s});if(l.emit("mode.change.request",I),!I.defaultPrevented){A&&A.destroy(),l.controller=l.applyController(e,w);var H=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:R,userAction:s});l.emit("mode.change",H)}}c()},_=AnimationFrameLoop.shared.getContext();_&&(typeof XRSession!="undefined"&&_ instanceof XRSession&&_.end(),AnimationFrameLoop.shared.setContext(null)),e===t.Mode.VRPanorama?(l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.exitFullscreen(),l.throwError(w),f(w)})):e===t.Mode.XRPanorama?requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),u=!0,T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.throwError(w),f(w)}):T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var f=now(),p=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),h=this.getSize(new THREE__namespace.Vector2),g=0,m=0,E=1,y=1,v,A,b,T,_;typeof e=="number"?(g=e,typeof r=="number"&&(m=r),typeof o=="number"&&(E=o),typeof s=="number"&&(y=s),v=u,A=l,_=c):(g=e.x,m=e.y,E=e.width,y=e.height,v=e.pixelRatio,A=e.flipY,b=e.helperVisible,T=e.skipPanorama,_=e.buffer),g=Math.floor(g),m=Math.floor(m),E=Math.floor(E),y=Math.floor(y),v=Math.floor(v!=null?v:p),A=A!=null?A:!1;var S=this.helperVisible,w=this.modelScene.parameter.modelAlpha;this.helperVisible=b!=null?b:this.helperVisible,T&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&T===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(E*v,y*v),this.renderer.setRenderTarget(R),this.camera.pixelRatio=v,this.camera.resolution.set(E,y),this.camera.setViewOffset(h.width,h.height,g,h.height-m-y,E,y),this.camera.aspect=h.width/h.height,this.camera.updateTime(f),this.scene.update(this.renderer,this.camera);var I=this.renderer.autoClear,H=this.renderer.autoClearColor,C=this.renderer.autoClearDepth,M=this.renderer.autoClearStencil,B=scratchClearColor.copy(this.renderer.getClearColor()),L=this.renderer.getClearAlpha(),O=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);var k=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:k,this.renderer.render(this.scene,this.camera),this.scene.background=k,this.renderer.autoClear=I,this.renderer.autoClearColor=H,this.renderer.autoClearDepth=C,this.renderer.autoClearStencil=M,this.renderer.setClearColor(B,L),this.renderer.setScissorTest(O),this.helperVisible=S,w===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",w),this.renderer.setRenderTarget(d),this.camera.clearViewOffset(),this.camera.pixelRatio=p,this.camera.resolution.copy(h),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(f),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var D=E*v,q=y*v,z=D*q,J=z*4;if(_){if(_.length!==J)throw new Error("buffer length is not equals pixels ".concat(J))}else _=new Uint8Array(J);if(this.renderer.readRenderTargetPixels(R,0,0,E*v,y*v,_),A)for(var V=z/2,U=0,j=0,K=0,ae=0;j<V;j++)for(ae=(q-Math.floor(j/D)-1)*D+j%D,K=0;K<4;K++)U=_[j*4+K],_[j*4+K]=_[ae*4+K],_[ae*4+K]=U;return _},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},t.prototype.render=function(e){var r=this.renderer;if(r){var o=r.getRenderTarget();r.setRenderTarget(null);var s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,f=scratchClearColor.copy(r.getClearColor()),p=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),g=r.getScissorTest();r.autoClear=!0,r.autoClearColor=!0,r.autoClearDepth=!0,r.autoClearStencil=!0;var m=r.getSize(scratchRenderSize),E=Math.floor(m.x*this.viewport.left),y=Math.floor(m.y*this.viewport.bottom),v=Math.floor(m.x*this.viewport.width),A=Math.floor(m.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(E,y,v,A),r.setScissor(E,y,v,A);var b=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(b);var T=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:T;var _=!0;if(this.controller){var S=this.controller.render();S&&(_=!1)}if(_){var w=this.fiveRenderer.render(r,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&w&&renderPoweredByRealsee(r)}this.scene.background=T,r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(f,p),r.setViewport(d),r.setScissor(h),r.setScissorTest(g),r.setRenderTarget(o),e&&AnimationFrameLoop.shared.add(e,!0)}},t.prototype.updateTime=function(e,r){for(var o,s=this,u=[],l=2;l<arguments.length;l++)u[l-2]=arguments[l];if(this.currentUpdateArgs={time:e,args:u},!this.destroyed){if(this.renderer&&ktx2.detectSupport(this.renderer),this.syncingState=this.syncState(e,r),this.controller&&(o=this.controller).updateTime.apply(o,__spreadArray([e,r],u,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var c=this.modelScene.loaded,f=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),c===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),AnimationFrameLoop.shared.add(function(){s.emit("models.load",createEvent("models.load",{modelScene:s.modelScene}))},!0,0,10)),f===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.modelScene.boundingMesh);var p=scratchBox3.getBoundingSphere(scratchSphere),d=p.radius*2;p.containsPoint(this.camera.position)||(d=this.camera.position.distanceTo(p.center)+p.radius),d=clamp$1(d,800);var h=d/1e4;h=clamp$1(h,.03,.1),this.camera.near!==h&&(this.camera.near=h),this.camera.far!==d&&(this.camera.far=d),this.camera.updateTime(e)}if(this.renderer){var g=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=g}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused!==!0){var m=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",m),m.defaultPrevented&&(this.needsRender=!1);var E=this.needsRender;this.render(),this.needsRender=!1,this.emit("render",createEvent("render",{needsRender:E})),this.hasListener("fps")&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={}),o===void 0&&(o=!0);var s=this,u=s.controller,l=s.renderer;if(!u)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!l)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();typeof e=="number"&&this.pano.workCode&&(e={workCode:this.pano.workCode,panoIndex:e});var c=this.works.getObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var f={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(f,r,o):c&&(this.pano=f,this.once("initAnimation.start",function(p){r.moveStartCallback&&r.moveStartCallback(p.state)}),this.once("initAnimation.end",function(p){r.moveEndCallback&&r.moveEndCallback(p.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},o)),this.ready()},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop);var s=this.works.getObserver(e);if(!s)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var u=["right","left","up","down","front","back"],l=now();return Promise.all(u.map(function(c){var f=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),p=__assign({key:"pano.".concat(f,".").concat(c)},pick(o.imageOptions,["size","format","quality","forceUseExifOrientation","mappings"])),d=s.work.getURL(s.images[c]),h=o.imageOptions.transform?o.imageOptions.transform(d,p):imageURL(d,p);return getFetcher(o.fiveId,s.work).preload(h)})).then(function(){var c=now()-l;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.camera.position,s=e.clone().sub(o),u=new THREE__namespace.Raycaster(o,s.clone().normalize());u.params.Points={threshold:.1};var l=this.modelScene.intersectRaycaster(u)[0];if(l&&l.distance+.01<s.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var f=this.renderer.getSize(new THREE__namespace.Vector2),p=f.x*this.viewport.width,d=f.y*this.viewport.height,h=f.x*this.viewport.left+(c.x+1)/2*p,g=f.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,g)},t.prototype.getCurrentState=function(){return __assign(__assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,o){var s,u,l,c,f,p,d,h,g,m;r===void 0&&(r=!1),o===void 0&&(o=!0),e=pick(e,["mode","workCode","panoIndex","longitude","latitude","fov","offset","distance"]),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var E;if(typeof e.panoIndex=="number")if(e.workCode)E={workCode:e.workCode,panoIndex:e.panoIndex};else{var y=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",v=this.state.workCode;this.works.filter(function(M){return M.workCode===v}).length>0&&(y=v),E={workCode:y,panoIndex:e.panoIndex}}var A=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,w;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==A){if(A==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var R={workCode:E==null?void 0:E.workCode,panoIndex:E==null?void 0:E.panoIndex};typeof e.longitude=="number"&&(R.longitude=e.longitude),typeof e.latitude=="number"&&(R.latitude=e.latitude),typeof e.fov=="number"&&(R.fov=e.fov),typeof e.distance=="number"&&(R.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(R.offset=e.offset);var I=__assign(__assign({initial:{state:R,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[A]),H=Controllers[A].initAnimationEndState(I);b=H.longitude,T=H.latitude,_=H.fov,S=H.offset,w=H.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(f=e.latitude)!==null&&f!==void 0?f:this.state.latitude,_=(p=e.fov)!==null&&p!==void 0?p:this.state.fov,S=(d=e.offset)!==null&&d!==void 0?d:this.state.offset,w=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(E!=null?E:this.pano).workCode,panoIndex:(E!=null?E:this.pano).panoIndex,mode:A,longitude:b,latitude:T,fov:_,offset:S,distance:w};this.emit("state.set",createEvent("state.set",{userAction:o,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode==="VRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("VRPanorama")):this.controller&&C.mode==="XRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("XRPanorama")):(assignState(this.state,C),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===C.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((g=this.controller)===null||g===void 0||g.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:o,state:this.state})),(m=this.analysis)===null||m===void 0||m.state(this.works,this.state)))},t.prototype.syncState=function(e,r,o){o===void 0&&(o=!1);var s=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){var u={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,u,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},l),{duration:o?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,l,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var f=1,p=.2,d=.2,h=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,f),m=Math.abs(this.camera.pose.distance-this.state.distance),E=m>d*15?m/15:p,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,E),v=this.camera.pose.offset.distanceTo(this.state.offset),A=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,A),T=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},h),_=T.longitude,S=T.latitude;if(notSimilarValue(g,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var w={x:b.x,y:b.y,z:b.z},R={fov:g};return Object.assign(w,{distance:y}),Object.assign(R,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(R,0).catch(noop),this.controller.locationMotion.set(w,0).catch(noop),!0}}else{var I=1,H=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,I),C=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},H),_=C.longitude,S=C.latitude,y=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(b,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)||notSimilarValue(g,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,fov:g},0).catch(noop),!0}if(this.stateSynced=!0,s===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var M=this.currentMode,B=M===t.Mode.Floorplan||M===t.Mode.Topview||M===t.Mode.Mapview||M===t.Mode.Model;if(!B||this.modelScene.loaded){var L=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var O=0,k=L;O<k.length;O++){var D=k[O];this.controller instanceof Controllers.Panorama&&D.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(D):D()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(o){var s;r.readyCallbacks.push(Object.assign(o,{tile:(s=e.tile)!==null&&s!==void 0?s:!1}))}).then(function(){return r.model.initReady}).then(noop)},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.bindModel=function(e){var r=this,o=function(){AnimationFrameLoop.shared.add(function(){r.emit("model.load",createEvent("model.load",{work:e.work,model:e,error:null}))},!0)},s=function(c){var f=c.error;r.emit("model.error",createEvent("model.error",{work:e.work,model:e,error:f})),r.throwError(f)},u=function(){r.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:e.work,model:e,error:null}))},l=function(){e.removeEventListener("load",o),e.removeEventListener("error",s),e.removeEventListener("changeShownFloor",u),e.removeEventListener("dispose",l)};e.addEventListener("load",o),e.addEventListener("error",s),e.addEventListener("changeShownFloor",u),e.addEventListener("dispose",l),this.emit("model.request",createEvent("model.request",{work:e.work,model:e,error:null}))},t.prototype.bindWorkFetcher=function(e){var r=this,o=e.workCode,s=e.allowHosts,u=new Fetcher({get networkSubscribe(){return r.networkSubscribe},requestProxy:function(l){return Promise.resolve(l).then(function(c){return r.requestProxy(c,o)}).then(function(c){var f=verifyURL(c,s);return f instanceof Error?Promise.reject(f):f})}});registerFetcher(this.fiveId,e,u)},t.prototype.commonParams=function(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var m=[],E=0;E<arguments.length;E++)m[E]=arguments[E];var y=o.emit.apply(o,__spreadArray([g],m,!1));if(y)return!1})},c=0,f=PROXY_CONTROLLER_EVENT_NAMES;c<f.length;c++){var p=f[c];l(p)}{var d=Controllers[e].initAnimationEndState(r),h=r.initial.userAction;stateEqual(this.state,d)||(assignState(this.state,d),this.emit("state.change",createEvent("state.change",{userAction:h,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:this.getCurrentState()}))}return u.on("camera.update",function(g){var m;if(o.controller){var E=o.controller.getTargetState();g.userAction&&o.syncingState===!1&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:g.userAction,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:g.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.arrived",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.cancel",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:m,state:o.getCurrentState()}))}),u.on("pano.request",function(g){o.emit("pano.request",g),g.defaultPrevented||o.moveToPano(g.state,g.options,g.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(g){return o.throwError(g)}),u},t.prototype.removeEventListeners=function(){},Object.defineProperty(t.prototype,"internalLightsEnabled",{get:function(){var e=this.scene.children.find(function(r){return r.name==="internalLights"});return e?e.visible:!1},set:function(e){var r=this.scene.children.find(function(o){return o.name==="internalLights"});r&&(r.visible=e),r=this.modelScene.children.find(function(o){return o.name==="internalLights"}),r&&(r.visible=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scissor",{get:function(){return this.viewport},enumerable:!1,configurable:!0}),t.prototype.setScissor=function(e){return this.setViewport(e)},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,o=e.latitude,s=e.fov,u=e.offset,l=e.distance;return{longitude:r,latitude:o,fov:s,offset:u.clone(),distance:l}},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,o=e.latitude;return{longitude:r,latitude:o}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;r.matrix.copy(e.matrix).premultiply(e.work.transform),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1;var o=new THREE__namespace.Vector3(0,0,-1);o.applyQuaternion(this.camera.quaternion);var s=r.quaternion.clone().inverse();o.applyQuaternion(s);var u=Math.atan2(o.x,-o.z),l=-Math.asin(o.y);return{theta:u,phi:l,lookAtVector:o}}}return null},t.prototype.addPass=function(e){this.fiveRenderer.composer.addPass(e)},t.prototype.removePass=function(e){var r=this.fiveRenderer.composer.passes.indexOf(e);r!==-1&&this.fiveRenderer.composer.passes.splice(r,1)},t.prototype.insertPass=function(e,r){this.fiveRenderer.composer.insertPass(e,r)},Object.defineProperty(t.prototype,"renderMode",{get:function(){return this.fiveRenderer.renderMode},set:function(e){this.fiveRenderer.renderMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.fiveRenderer.renderMode==="point-cloud-high-quality"},set:function(e){this.fiveRenderer.renderMode=e?"point-cloud-high-quality":"default",this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.eyeDomeLightingPass.enabled},set:function(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableAdaptiveLuminance",{get:function(){return this.adaptiveLuminancePass.enabled},set:function(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelSceneNeedsRender",{get:function(){return this.modelScene.needsRender},set:function(e){this.modelScene.needsRender=e},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t})(Subscribe);if(typeof window!="undefined"){var __FIVE_DEBUG__={THREE:THREE__namespace,constructor:Five,instances:Five_Instances};Object.assign(window,{__FIVE_DEBUG__})}var XRButton=(function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function o(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function s(){o(),e.textContent="VR NOT SUPPORTED"}function u(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",u(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():s()}),e;var l=document.createElement("a");return window.isSecureContext===!1?(l.href=document.location.href.replace(/^http:/,"https:"),l.innerHTML="WEBXR NEEDS HTTPS"):(l.href="https://immersiveweb.dev/",l.innerHTML="WEBXR NOT AVAILABLE"),l.style.left="calc(50% - 90px)",l.style.width="180px",l.style.textDecoration="none",u(l),l},n})();exports.AdaptiveLuminancePass=AdaptiveLuminancePass,exports.AnimationFrameLoop=AnimationFrameLoop,exports.BoundingMesh=BoundingMesh$1,exports.Camera=Camera,exports.CustomShader=PBMCustomShader,exports.EffectComposer=EffectComposer,exports.EyeDomeLightingPass=EyeDomeLightingPass,exports.Fetcher=Fetcher,exports.Five=Five,exports.FivePass=FivePass,exports.FiveRenderer=FiveRenderer,exports.FullScreenQuad=FullScreenQuad,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.Model=Model,exports.ModelScene=ModelScene,exports.Motion=Motion,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMCustomShader=PBMCustomShader,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PBMPointCloud=PBMPointCloud,exports.PBMPointCloudMaterial=PBMPointCloudMaterial,exports.PBMSkinnedMesh=PBMSkinnedMesh,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.Parameter=Parameter,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3D=Tile3D,exports.Tile3DModel=Tile3D,exports.TileCache=TileCache,exports.TileNode=TileNode,exports.TileRequestScheduler=TileRequestScheduler,exports.Tileset=Tileset,exports.Trajectory=Trajectory,exports.TrajectoryNode=TrajectoryNode,exports.Work=Work,exports.WorkResolvedObserver=WorkResolvedObserver,exports.XRButton=XRButton,exports.controllersDefaultInitArgs=controllersDefaultInitArgs,exports.coordinatesToVector=coordinatesToVector,exports.createDebugBoundingMesh=createDebugBoundingMesh,exports.createWorks=createWorks,exports.defaultImageURLTransform=imageURL,exports.draco=draco,exports.getViewportScale=getViewportScale,exports.headingToLongitude=headingToLongitude,exports.imageSupport=imageSupport,exports.isBoundingVolume=isBoundingVolume,exports.isPanoId=isPanoId,exports.ktx2=ktx2,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadFbx=loadFbx,exports.loadGltf=loadGltf,exports.loadPbm=loadPbm,exports.loadPly=loadPly,exports.loadPnts=loadPnts,exports.loadX3p=loadX3p,exports.longitudeToHeading=longitudeToHeading,exports.makeBoundingVolume=makeBoundingVolume,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,exports.vectorToCoordinates=vectorToCoordinates,exports.workToJson=workToJson,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));