@realsee/five 6.7.0-alpha.7 → 6.7.0-alpha.8

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/five/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 10/17/2025
5
- * Version: 6.7.0-alpha.7
4
+ * Generated: 10/23/2025
5
+ * Version: 6.7.0-alpha.8
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -916,7 +916,7 @@ self.onmessage = function(event) {
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(f){return ktx2.parse(f)});else if(u.uri)l=r.options.fetcher.ajax(r.resolveResouce(u.uri),{responseType:"arraybuffer"}).then(function(f){return ktx2.parse(f.body)});else throw new Error("glTF: Invalid image defs.");var c=r.json.samplers||{},p=c[o.sampler]||{};return l=l.then(function(f){return f.magFilter=THREE__namespace.LinearFilter,f.minFilter=THREE__namespace.LinearFilter,f.wrapS=WEBGL_WRAPPINGS[p.wrapS]||THREE__namespace.RepeatWrapping,f.wrapT=WEBGL_WRAPPINGS[p.wrapT]||THREE__namespace.RepeatWrapping,f}),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 E=new Uint8Array(v.length),b=0;b<v.length;++b){var T=v.charCodeAt(b);E[b]=T>96?T-97:T>64?T-39:T+4}for(var _=0,b=0;b<v.length;++b)E[_++]=E[b]<60?r[E[b]]:(E[b]-60)*64+E[++b];return E.buffer.slice(0,_)}function c(v,E,b,T,_,S){var R=s.exports.sbrk,w=b+3&-4,M=R(w*T),B=R(_.length),C=new Uint8Array(s.exports.memory.buffer);C.set(_,B);var I=v(M,b,T,B,_.length);if(I==0&&S&&S(M,w,T),E.set(C.subarray(M,M+b*T)),R(M-R(0)),I!=0)throw new Error("Malformed buffer data: "+I)}var p={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},f={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},d=[],h=0;function m(v){var E={object:new Worker(v),pending:0,requests:{}};return E.object.onmessage=function(b){var T=b.data;E.pending-=T.count,E.requests[T.id][T.action](T.value),delete E.requests[T.id]},E}function A(v){for(var E="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([E],{type:"text/javascript"}),T=URL.createObjectURL(b),_=0;_<v;++_)d[_]=m(T);URL.revokeObjectURL(T)}function g(v,E,b,T,_){for(var S=d[0],R=1;R<d.length;++R)d[R].pending<S.pending&&(S=d[R]);return new Promise(function(w,M){var B=new Uint8Array(b),C=h++;S.pending+=v,S.requests[C]={resolve:w,reject:M},S.object.postMessage({id:C,count:v,size:E,source:B,mode:T,filter:_},[B.buffer])})}function y(v){u.then(function(){var E=v.data;try{var b=new Uint8Array(E.count*E.size);c(s.exports[E.mode],b,E.count,E.size,E.source,s.exports[E.filter]),self.postMessage({id:E.id,count:E.count,action:"resolve",value:b},[b.buffer])}catch(T){self.postMessage({id:E.id,count:E.count,action:"reject",value:T})}})}return{ready:u,supported:!0,useWorkers:function(v){A(v)},decodeVertexBuffer:function(v,E,b,T,_){c(s.exports.meshopt_decodeVertexBuffer,v,E,b,T,s.exports[p[_]])},decodeIndexBuffer:function(v,E,b,T){c(s.exports.meshopt_decodeIndexBuffer,v,E,b,T)},decodeIndexSequence:function(v,E,b,T){c(s.exports.meshopt_decodeIndexSequence,v,E,b,T)},decodeGltfBuffer:function(v,E,b,T,_,S){c(s.exports[f[_]],v,E,b,T,s.exports[p[S]])},decodeGltfBufferAsync:function(v,E,b,T,_){return d.length>0?g(v,E,b,f[T],p[_]):u.then(function(){var S=new Uint8Array(v*E);return c(s.exports[f[T]],S,v,E,b,s.exports[p[_]]),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 p=c[0],f=u.byteOffset||0,d=u.byteLength||0,h=u.count,m=u.byteStride,A=new ArrayBuffer(h*m),g=new Uint8Array(p,f,d);return meshoptDecoder.decodeGltfBuffer(new Uint8Array(A),h,m,g,u.mode,u.filter),A})}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 p=r.json.samplers||{},f=p[s.sampler]||{};return c.magFilter=WEBGL_FILTERS[f.magFilter]||THREE__namespace.LinearFilter,c.minFilter=WEBGL_FILTERS[f.minFilter]||THREE__namespace.LinearMipmapLinearFilter,c.wrapS=WEBGL_WRAPPINGS[f.wrapS]||THREE__namespace.RepeatWrapping,c.wrapT=WEBGL_WRAPPINGS[f.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(f){return r.loadGeometry(f)})),c=Promise.all(u.map(function(f){return o.loadPBMMaterial(f,r)})),p=Promise.all([l,c]).then(function(f){for(var d=f[0],h=f[1],m=[],A=0;A<u.length;A++){var g=u[A],y=d[A],v=h[A],E=g.mode||WEBGL_CONSTANTS.TRIANGLES,b=void 0;if(E===WEBGL_CONSTANTS.TRIANGLES||E===WEBGL_CONSTANTS.TRIANGLE_STRIP||E===WEBGL_CONSTANTS.TRIANGLE_FAN)if(E===WEBGL_CONSTANTS.TRIANGLE_STRIP?y=r.toGeometryTrianglesDrawMode(y,THREE__namespace.TriangleStripDrawMode):E===WEBGL_CONSTANTS.TRIANGLE_FAN&&(y=r.toGeometryTrianglesDrawMode(y,THREE__namespace.TriangleFanDrawMode)),y.clearGroups(),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),r.disposeSet.add(y),s.isSkinnedMesh){var T=new PBMSkinnedMesh(y,[v]);y.attributes.skinWeight.normalized||T.normalizeSkinWeights(),b=T}else b=new PBMMesh(y,[v]);else if(E===WEBGL_CONSTANTS.POINTS)b=new PBMPointCloud(y,v);else throw new Error("glTF: Primitive mode unsupported: "+E);if(Object.keys(y.morphAttributes).length>0){if(s.weights!==void 0)for(var _=0,S=s.weights.length;_<S;_++)b.morphTargetInfluences[_]=s.weights[_];if(s.extras&&Array.isArray(s.extras.targetNames)){var R=s.extras.targetNames;if(b.morphTargetInfluences.length===R.length){b.morphTargetDictionary={};for(var _=0,S=R.length;_<S;_++)b.morphTargetDictionary[R[_]]=_}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}b.name=s.name||"mesh_"+e,r.assignFinalMaterial(b),m.push(b)}if(m.length===1)return m[0];for(var w=new THREE__namespace.Group,M=0,B=m;M<B.length;M++){var b=B[M];w.add(b)}return w});return p},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.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 p=c.baseColorFactor;u.color=new THREE__namespace.Color().fromArray(p),u.colorAlpha=p[3]}c.baseColorTexture!==void 0&&o.push(r.createMaterialTexture(c.baseColorTexture).then(function(h){r.disposeSet.add(h),h.encoding=THREE__namespace.sRGBEncoding,u.map=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){r.disposeSet.add(h),h.encoding=THREE__namespace.sRGBEncoding,u.roughnessMap=h,u.metalnessMap=h})),l.doubleSided===!0&&(u.side=THREE__namespace.DoubleSide);var f=l.alphaMode||ALPHA_MODES.OPAQUE;if(u.alphaMode="OPAQUE",f===ALPHA_MODES.BLEND?(u.alphaMode="BLEND",u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,f===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){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){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(A){return Promise.reject(A)}s.KHR_binary_glTF=u,l=u.content}else l=decodeText(new Uint8Array(n))}var p=JSON.parse(l);if(t.jsonModify&&(p=t.jsonModify(p)),p.asset===void 0||Number(p.asset.version[0])<2)return Promise.reject(new Error("glTF: Unsupported asset. glTF versions >=2.0 are supported."));if(p.extensionsUsed)for(var f=p.extensionsRequired||[],d=0;d<p.extensionsUsed.length;d++){var h=p.extensionsUsed[d];s[h]||(EXTENSIONS[h]?s[h]=new EXTENSIONS[h]:f.indexOf(h)>=0&&console.warn('glTF: Unknown extension "'+h+'".'))}var m=new Parser(p,s,{copyUV2:(e=t.copyUV2)!==null&&e!==void 0?e:!0,resourcePath:(r=t.resourcePath)!==null&&r!==void 0?r:"",search:(o=t.search)!==null&&o!==void 0?o:"",fetcher:t.fetcher});return m.parse().then(function(A){return u&&u.clear(),A})}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(p){return p.body})}).then(function(p){return Promise.resolve(0).then(function(f){return parseHeader$1(c,p,f)}).then(function(f){return parseTable(c,p,f)}).then(function(f){return parseGlTFArrayBuffer(c,p,f)})}).then(function(){var p;return parseGltf(c.gltfArrayBuffer,{copyUV2:!1,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(p=n.split("?")[1])!==null&&p!==void 0?p:"",jsonModify:function(f){var d;if(f.extensionsUsed=(d=f.extensionsUsed)!==null&&d!==void 0?d:[],typeof t.light=="boolean"){var h="KHR_materials_unlit";if(t.light){var m=f.extensionsUsed.indexOf(h);m>=0&&f.extensionsUsed.splice(m,1)}else{var m=f.extensionsUsed.indexOf(h);m===-1&&f.extensionsUsed.push(h)}}{var h="PBM_mesh",m=f.extensionsUsed.indexOf(h);m===-1&&f.extensionsUsed.push(h)}return f},fetcher:l}).then(function(f){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):f.CESIUM_RTC&&(h=new THREE__namespace.Vector3().copy(f.CESIUM_RTC.center)),h){var m=new THREE__namespace.Matrix4().setPosition(h);d.premultiply(m)}return u==="Y"&&d.premultiply(ROTATE_X_MATRIX_INVERSE),f.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(f.scene),scene:f.scene,textures:f.textures,animations:[],rtcCenter:h,dispose:function(){return f.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(p){var f=p.getAttribute("POSITION"),d=p.getAttribute("RGB"),h=p.getAttribute("RGBA"),m=p.getAttribute("NORMAL"),A;if(h)A=h;else if(d){for(var g=d.count,y=d.array,v=new Uint8Array(g*4),E=0,b=void 0,T=void 0;E<g;E++)T=E*4,b=E*3,v[T]=y[b],v[++T]=y[++b],v[++T]=y[++b];A=new THREE__namespace.BufferAttribute(v,4,d.normalized)}return{position:f?{array:f.array,itemSize:f.itemSize,normalized:f.normalized}:null,color:A?{array:A.array,itemSize:A.itemSize,normalized:A.normalized}:null,normal:m?{array:m.array,itemSize:m.itemSize,normalized:m.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,p;if(u.rtcCenter&&(p=new THREE__namespace.Vector3().fromArray(u.rtcCenter)),p){var f=new THREE__namespace.Matrix4().setPosition(p);c.premultiply(f)}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:p,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(p){return c=p.body.byteLength,p.body})}).then(function(p){var f;return parseGltf(p,{copyUV2:!1,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(f=n.split("?")[1])!==null&&f!==void 0?f:"",jsonModify:function(d){var h;if(d.extensionsUsed=(h=d.extensionsUsed)!==null&&h!==void 0?h:[],typeof t.light=="boolean"){var m="KHR_materials_unlit";if(t.light){var A=d.extensionsUsed.indexOf(m);A>=0&&d.extensionsUsed.splice(A,1)}else{var A=d.extensionsUsed.indexOf(m);A===-1&&d.extensionsUsed.push(m)}}{var m="PBM_mesh",A=d.extensionsUsed.indexOf(m);A===-1&&d.extensionsUsed.push(m)}return d},fetcher:l})}).then(function(p){var f,d=new THREE__namespace.Matrix4;if(s==="Y"&&d.premultiply(ROTATE_X_MATRIX),p.CESIUM_RTC){var h=new THREE__namespace.Matrix4().setPosition(p.CESIUM_RTC.center);d.premultiply(h)}return u==="Y"&&d.premultiply(ROTATE_X_MATRIX_INVERSE),p.scene.applyMatrix4(d),{type:"gltf",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(p.scene),scene:p.scene,textures:p.textures,animations:p.animations,rtcCenter:(f=p.CESIUM_RTC)===null||f===void 0?void 0:f.center,dispose:function(){return p.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(p){return c=p.body.byteLength,p.body})}).then(function(p){var f,d;return parsePly(p,{propertyNameMapping:(f=t.propertyNameMapping)!==null&&f!==void 0?f:{},customPropertyMapping:(d=t.customPropertyMapping)!==null&&d!==void 0?d:{}})}).then(function(p){var f=p.geometry;switch(t.type){case"geometry":{var d=f;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(){f.dispose()}}}case"line":{var h="color"in f.attributes,m=new THREE__namespace.LineBasicMaterial({vertexColors:h}),d=new THREE__namespace.Line(f,m);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(){f.dispose(),m.dispose()}}}case"pbmMesh":{var A=new PBMMeshMaterial(t.light?"phong":"basic");A.vertexColors="color"in f.attributes;var d=new THREE__namespace.Mesh(f,A);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(){f.dispose(),A.dispose()}}}case"pbmPointCloud":{var g=new PBMPointCloudMaterial,d=new PBMPointCloud(f,g);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(){f.dispose(),g.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,p=0;p<l.length;p++){var f=l[p];if(f=f.trim(),f!==""){var d=f.split(/\s+/),h=d.shift();switch(f=d.join(" "),h){case"format":u.format=d[0],u.version=d[1];break;case"comment":u.comments.push(f);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=f;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 p=t.elements[c],f=mapElementAttributes(p.properties),d=0;d<p.count;d++){var h=parseASCIIElement(p.properties,l);if(!h)break e;handleElement(r,p.name,h,f,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,p=u.normalized,f=c.length,d=void 0;switch(l){case"float32":d=new THREE__namespace.Float32BufferAttribute(n[s],f,p);break;case"uint32":d=new THREE__namespace.Uint32BufferAttribute(n[s],f,p);break;case"int32":d=new THREE__namespace.Int32BufferAttribute(n[s],f,p);break;case"uint16":d=new THREE__namespace.Uint16BufferAttribute(n[s],f,p);break;case"int16":d=new THREE__namespace.Int16BufferAttribute(n[s],f,p);break;case"uint8":d=new THREE__namespace.Uint8BufferAttribute(n[s],f,p);break;case"int8":d=new THREE__namespace.Int8BufferAttribute(n[s],f,p);break;default:d=new THREE__namespace.Float32BufferAttribute(n[s],f,p);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,p=o.customPropertyMapping[l].itemNames;c<p.length;c++){var f=p[c];n[l].push(e[f])}}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 p=0;p<c;p++)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,p){switch(c){case"int8":case"char":return{read:function(f){return l.getInt8(f)},size:1};case"uint8":case"uchar":return{read:function(f){return l.getUint8(f)},size:1};case"int16":case"short":return{read:function(f){return l.getInt16(f,p)},size:2};case"uint16":case"ushort":return{read:function(f){return l.getUint16(f,p)},size:2};case"int32":case"int":return{read:function(f){return l.getInt32(f,p)},size:4};case"uint32":case"uint":return{read:function(f){return l.getUint32(f,p)},size:4};case"float32":case"float":return{read:function(f){return l.getFloat32(f,p)},size:4};case"float64":case"double":return{read:function(f){return l.getFloat64(f,p)},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 p=t.elements[c],f=p.properties,d=mapElementAttributes(f);setPropertyBinaryReaders(f,s,o);for(var h=0;h<p.count;h++){u=binaryReadElement(l,f),l+=u[1];var m=u[0];handleElement(r,p.name,m,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
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;var _b=freb(fdeb,0),fd=_b.b,rev=new u16(32768);for(var 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}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 p=o<<4|n[o],f=t-n[o],d=u[n[o]-1]++<<f,h=d|(1<<f)-1;d<=h;++d)l[rev[d]>>c]=p}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);for(var 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;var fdt=new u8(32);for(var 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 p=function(re){var ne=e.length;if(re>ne){var ae=new u8(Math.max(ne*2,re));ae.set(e),e=ae}},f=t.f||0,d=t.p||0,h=t.b||0,m=t.l,A=t.d,g=t.m,y=t.n,v=o*8;do{if(!m){f=bits(n,d,1);var E=bits(n,d+1,3);if(d+=3,E)if(E==1)m=flrm,A=fdrm,g=9,y=5;else if(E==2){var S=bits(n,d,31)+257,R=bits(n,d+10,15)+4,w=S+bits(n,d+5,31)+1;d+=14;for(var M=new u8(w),B=new u8(19),C=0;C<R;++C)B[clim[C]]=bits(n,d+C*3,7);d+=R*3;for(var I=max(B),L=(1<<I)-1,O=hMap(B,I,1),C=0;C<w;){var F=O[bits(n,d,L)];d+=F&15;var b=F>>4;if(b<16)M[C++]=b;else{var N=0,D=0;for(b==16?(D=3+bits(n,d,3),d+=2,N=M[C-1]):b==17?(D=3+bits(n,d,7),d+=3):b==18&&(D=11+bits(n,d,127),d+=7);D--;)M[C++]=N}}var q=M.subarray(0,S),z=M.subarray(S);g=max(q),y=max(z),m=hMap(q,g,1),A=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&&p(h+T),e.set(n.subarray(b,_),h),t.b=h+=T,t.p=d=_*8,t.f=f;continue}if(d>v){c&&err(0);break}}l&&p(h+131072);for(var j=(1<<g)-1,J=(1<<y)-1,V=d;;V=d){var N=m[bits16(n,d)&j],U=N>>4;if(d+=N&15,d>v){c&&err(0);break}if(N||err(2),U<256)e[h++]=U;else if(U==256){V=d,m=null;break}else{var G=U-254;if(U>264){var C=U-257,Z=fleb[C];G=bits(n,d,(1<<Z)-1)+fl[C],d+=Z}var W=A[bits16(n,d)&J],ee=W>>4;W||err(3),d+=W&15;var z=fd[ee];if(ee>3){var Z=fdeb[ee];z+=bits16(n,d)&(1<<Z)-1,d+=Z}if(d>v){c&&err(0);break}l&&p(h+131072);var X=h+G;if(h<z){var K=s-z,$=Math.min(z,X);for(K+h<0&&err(3);h<$;++h)e[h]=r[K+h]}for(;h<X;++h)e[h]=e[h-z]}}t.l=m,t.p=V,t.b=h,t.f=f,m&&(f=1,t.m=g,t.d=A,t.n=y)}while(!f);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],p=l[1],f=l[2];return[b2(n,t+10),c,p,o,s+b2(n,t+30)+b2(n,t+32),f]},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 p=zh(n,s,u),f=p[0],d=p[1],h=p[2],m=p[3],A=p[4],g=p[5],y=slzh(n,g);s=A,f?f==8?e[m]=inflateSync(n.subarray(y,y+d),{out:new u8(h)}):err(14,"unknown compression type "+f):e[m]=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,p=l.unitScale/100,f=new THREE__namespace.Matrix4;if(f.makeScale(p,p,p),l.upAxis==="X")throw new Error("Cannot load fbx x upAxis");return l.upAxis==="Y"&&f.premultiply(ROTATE_X_MATRIX),o==="Y"&&f.premultiply(ROTATE_X_MATRIX_INVERSE),c.applyMatrix4(f),{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),p=Object.assign(new THREE__namespace.Group,{animations:[]}),f=[],d=this.parseImages(t),h=this.parseTextures(t,d,c,f),m=this.parseMaterials(t,h,c),A=this.parseDeformers(t,c),g=new GeometryParser().parse(t,A,c);this.parseScene(t,A,g,m,c,p);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,E=(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],R=T[2];if(_!==0||S!==0||R!==0){var w=new THREE__namespace.Color().setRGB(_,S,R);b=new THREE__namespace.AmbientLight(w,1)}}return Promise.all(f).then(function(M){var B;return{scene:p,textures:M,ambientLight:b,upAxis:["X","Y","Z"][y],frontAxis:["X","Y","Z"][v],unitScale:E,animations:(B=p.animations)!==null&&B!==void 0?B:[],dispose:function(){M.forEach(function(C){return C.dispose()}),m.forEach(function(C){return C.dispose()}),g.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 p={ID:s,relationship:l};e.get(u).children.push(p)})}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,p=typeof u.Content=="string"&&u.Content!=="";if(c||p){var f=this.parseImage(o[s]);r[u.RelativeFilename||u.Filename]=f}}}}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,p=l!==void 0?l.value:0;if(s.wrapS=c===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,s.wrapT=p===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,t.Scaling){var f=t.Scaling.value;s.repeat.x=f[0],s.repeat.y=f[1]}if(t.Translation){var f=t.Translation.value;s.offset.x=f[0],s.offset.y=f[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(f){var d=f.body;return createImageBitmapLike(d)}):c=this.fetcher.loadImage(u,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(f){return f.body});var p=c.then(function(f){return l.image=f,l.needsUpdate=!0,l}).catch(function(f){return console.warn(f),l});return o.push(p),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 p=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0);(p===1||p===0)&&(p=e.Opacity?parseFloat(e.Opacity.value):null,p===null&&(p=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),c.opacity=p,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 f=this;return o.get(s).children.forEach(function(d){var h=d.relationship;switch(h){case"Bump":c.bumpMap=f.getTexture(t,r,d.ID,o);break;case"Maya|TEX_ao_map":c.aoMap=f.getTexture(t,r,d.ID,o);break;case"DiffuseColor":case"Maya|TEX_color_map":c.map=f.getTexture(t,r,d.ID,o),c.map!==void 0&&(c.map.encoding=THREE__namespace.sRGBEncoding);break;case"DisplacementColor":c.displacementMap=f.getTexture(t,r,d.ID,o);break;case"EmissiveColor":c.emissiveMap=f.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=f.getTexture(t,r,d.ID,o);break;case"ReflectionColor":c.envMap=f.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=f.getTexture(t,r,d.ID,o),c.specularMap!==void 0&&(c.specularMap.encoding=THREE__namespace.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":c.alphaMap=f.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 p=this.parseSkeleton(c,s);p.ID=u,c.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),p.geometryID=c.parents[0].ID,r[u]=p}else if(l.attrType==="BlendShape"){var f={id:u};f.rawTargets=this.parseMorphTargets(c,s,e),f.id=u,c.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),o[u]=f}}}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(p){return p.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,p=this;l.forEach(function(d){var h=c[d.ID];p.setLookAtProperties(t,d,h,s,u);var m=s.get(d.ID).parents;m.forEach(function(A){var g=l.get(A.ID);g!==void 0&&g.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 f=new AnimationParser().parse(t,s,u);u.children.length===1&&u.children[0]instanceof THREE__namespace.Group&&(u=u.children[0]),u.animations=f},n.prototype.parseModels=function(t,e,r,o,s){var u=new Map,l=t.Objects.Model;for(var c in l){var p=parseInt(c),f=l[c],d=s.get(p),h=this.buildSkeleton(d,e,p,f.attrName);if(!h){switch(f.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=f.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(f.attrName):"",h.userData.originalName=f.attrName,h.ID=p}this.getTransformData(h,f),u.set(p,h)}return u},n.prototype.buildSkeleton=function(t,e,r,o){var s=null;return t.parents.forEach(function(u){var l=function(p){var f=e[p];f.rawBones.forEach(function(d,h){if(d.ID===u.ID){var m=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,f.bones[h]=s,m!==null&&s.add(m)}})};for(var c in e)l(c)}),s},n.prototype.createCamera=function(t,e){var r,o;if(e.children.forEach(function(m){var A=t.Objects.NodeAttribute[m.ID];A!==void 0&&(o=A)}),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,p=window.innerHeight;o.AspectWidth!==void 0&&o.AspectHeight!==void 0&&(c=o.AspectWidth.value,p=o.AspectHeight.value);var f=c/p,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,f,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 m=t.Objects.NodeAttribute[h.ID];m!==void 0&&(o=m)}),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 p=1;switch(s){case 0:r=new THREE__namespace.PointLight(u,l,c,p);break;case 1:r=new THREE__namespace.DirectionalLight(u,l);break;case 2:var f=Math.PI/3;o.InnerAngle!==void 0&&(f=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,f,d,p);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 p=c.Lcl_Translation.value;"target"in e&&e.target instanceof THREE__namespace.Object3D?(e.target.position.fromArray(p),s.add(e.target)):e.lookAt(new THREE__namespace.Vector3().fromArray(p))}}})}},n.prototype.bindSkeleton=function(t,e,r,o,s){var u=this.parsePoseNodes(t),l=function(p){var f=e[p],d=s.get(parseInt(f.ID)).parents;d.forEach(function(h){if(r.has(h.ID)){var m=h.ID,A=s.get(m);A.parents.forEach(function(g){if(o.has(g.ID)){var y=o.get(g.ID);y instanceof THREE__namespace.SkinnedMesh&&y.bind(new THREE__namespace.Skeleton(f.bones),u[g.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,m){return s[m.ID]!==void 0&&(h=s[m.ID]),h},null);e.children.forEach(function(h){o.morphTargets[h.ID]!==void 0&&u.push(o.morphTargets[h.ID])});var p=l[0],f={};p.RotationOrder&&(f.eulerOrder=getEulerOrder(p.RotationOrder.value)),p.InheritType&&(f.inheritType=parseInt(p.InheritType.value)),p.GeometricTranslation&&(f.translation=p.GeometricTranslation.value),p.GeometricRotation&&(f.rotation=p.GeometricRotation.value),p.GeometricScaling&&(f.scale=p.GeometricScaling.value);var d=generateTransform(f);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),p=new THREE__namespace.Float32BufferAttribute(c.vertex,3);if(p.applyMatrix4(s),u.setAttribute("position",p),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 f=new THREE__namespace.Matrix3().getNormalMatrix(s),d=new THREE__namespace.Float32BufferAttribute(c.normal,3);d.applyNormalMatrix(f),u.setAttribute("normal",d)}if(c.uvs.forEach(function(y,v){var E=v===0?"uv":"uv".concat(v+1);u.setAttribute(E,new THREE__namespace.Float32BufferAttribute(c.uvs[v],2))}),l.material&&l.material.mappingType!=="AllSame"){var h=c.materialIndex[0],m=0;if(c.materialIndex.forEach(function(y,v){y!==h&&(u.addGroup(m,v-m,h),h=y,m=v)}),u.groups.length>0){var A=u.groups[u.groups.length-1],g=A.start+A.count;g!==c.materialIndex.length&&u.addGroup(g,c.materialIndex.length-g,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=[],p=[],f=[],d=[],h=this;return t.vertexIndices.forEach(function(m,A){var g=0,y=!1;m<0&&(m=m^-1,y=!0);var v=[],E=[];if(u.push(m*3,m*3+1,m*3+2),t.color){var b=getData(A,r,m,t.color);c.push(b[0],b[1],b[2])}if(t.skeleton){if(t.weightTable[m]!==void 0&&t.weightTable[m].forEach(function(R){E.push(R.weight),v.push(R.id)}),E.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];E.forEach(function(R,w){var M=R,B=v[w];_.forEach(function(C,I,L){if(M>C){L[I]=M,M=C;var O=T[I];T[I]=B,B=O}})}),v=T,E=_}for(;E.length<4;)E.push(0),v.push(0);for(var S=0;S<4;++S)f.push(E[S]),d.push(v[S])}if(t.normal){var b=getData(A,r,m,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(g=getData(A,r,m,t.material)[0],g<0&&(h.negativeMaterialIndices=!0,g=0)),t.uv&&t.uv.forEach(function(R,w){var M=getData(A,r,m,R);p[w]===void 0&&(p[w]=[]),p[w].push(M[0]),p[w].push(M[1])}),o++,y&&(h.genFace(e,t,u,g,l,c,p,f,d,o),r++,o=0,u=[],l=[],c=[],p=[],f=[],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,p,f){var d;if(f>3){for(var h=[],m=e.baseVertexPositions||e.vertexPositions,A=0;A<r.length;A+=3)h.push(new THREE__namespace.Vector3(m[r[A]],m[r[A+1]],m[r[A+2]]));for(var g=this.getNormalTangentAndBitangent(h),y=g.tangent,v=g.bitangent,E=[],b=0,T=h;b<T.length;b++){var _=T[b];E.push(this.flattenVertex(_,y,v))}d=THREE__namespace.ShapeUtils.triangulateShape(E,[])}else d=[[0,1,2]];for(var S=function(L,O,F){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]]),t.vertex.push(e.vertexPositions[r[F*3]]),t.vertex.push(e.vertexPositions[r[F*3+1]]),t.vertex.push(e.vertexPositions[r[F*3+2]]),e.skeleton&&(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.vertexWeights.push(c[F*4]),t.vertexWeights.push(c[F*4+1]),t.vertexWeights.push(c[F*4+2]),t.vertexWeights.push(c[F*4+3]),t.weightsIndices.push(p[L*4]),t.weightsIndices.push(p[L*4+1]),t.weightsIndices.push(p[L*4+2]),t.weightsIndices.push(p[L*4+3]),t.weightsIndices.push(p[O*4]),t.weightsIndices.push(p[O*4+1]),t.weightsIndices.push(p[O*4+2]),t.weightsIndices.push(p[O*4+3]),t.weightsIndices.push(p[F*4]),t.weightsIndices.push(p[F*4+1]),t.weightsIndices.push(p[F*4+2]),t.weightsIndices.push(p[F*4+3])),e.color&&(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]),t.colors.push(u[F*3]),t.colors.push(u[F*3+1]),t.colors.push(u[F*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[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]),t.normal.push(s[F*3]),t.normal.push(s[F*3+1]),t.normal.push(s[F*3+2])),e.uv&&e.uv.forEach(function(N,D){t.uvs[D]===void 0&&(t.uvs[D]=[]),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]),t.uvs[D].push(l[D][F*2]),t.uvs[D].push(l[D][F*2+1])})},R=0,w=d;R<w.length;R++){var M=w[R],B=M[0],C=M[1],I=M[2];S(B,C,I)}},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 p=t.Objects.Geometry[c.geoID];p!==void 0&&u.genMorphGeometry(e,r,p,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:[],p=r.Indexes?r.Indexes.a:[],f=t.attributes.position.count*3,d=new Float32Array(f),h=0;h<p.length;h++){var m=p[h]*3;d[m]=c[h*3],d[m+1]=c[h*3+1],d[m+2]=c[h*3+2]}var A={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},g=this.genBuffers(A),y=new THREE__namespace.Float32BufferAttribute(g.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 p,f;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){p=r,f=o.length-1-p;for(var l=0;l<r;++l)s.push(s[l])}var d=new NURBSCurve(r,o,s,p,f),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,p=l.parents[0].relationship,f=e.get(c);f&&(p.match(/X/)?f.curves.x=u:p.match(/Y/)?f.curves.y=u:p.match(/Z/)?f.curves.z=u:p.match(/DeformPercent/)&&e.has(c)&&(f.curves.morph=u))}}},n.prototype.parseAnimationLayers=function(t,e,r,o){var s=t.Objects.AnimationLayer,u=new Map,l=function(p){var f=[],d=r.get(parseInt(p));if(d!==void 0){var h=d.children;h.forEach(function(m,A){if(e.has(m.ID)){var g=e.get(m.ID);if(g.curves.x!==void 0||g.curves.y!==void 0||g.curves.z!==void 0){if(f[A]===void 0){var y=r.get(m.ID).parents.filter(function(w){return w.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.",m);return}var E={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(w){w.ID===v.id&&(E.transform=w.matrix,w.userData.transformData&&(E.eulerOrder=w.userData.transformData.eulerOrder))}),E.transform||(E.transform=new THREE__namespace.Matrix4),v.PreRotation&&(E.preRotation=v.PreRotation.value),v.PostRotation&&(E.postRotation=v.PostRotation.value),f[A]=E}}f[A]&&(f[A][g.attr]=g)}else if(g.curves.morph!==void 0){if(f[A]===void 0){var b=r.get(m.ID).parents.filter(function(M){return M.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],R={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};f[A]=R}f[A][g.attr]=g}}}),u.set(parseInt(p),f)}};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 p=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);p!==void 0&&r.push(p)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){var f=this.generateVectorTrack(t.modelName,t.S.curves,l,"scale");f!==void 0&&r.push(f)}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 p=getEulerOrder(0),f=new THREE__namespace.Quaternion,d=new THREE__namespace.Quaternion;r!==void 0&&(r=r.map(THREE__namespace.MathUtils.degToRad),r.push(p),f.setFromEuler(new THREE__namespace.Euler().fromArray(r))),o!==void 0&&(o=o.map(THREE__namespace.MathUtils.degToRad),o.push(p),d.setFromEuler(new THREE__namespace.Euler().fromArray(o)),d.inverse());var h=new THREE__namespace.Quaternion,m=new THREE__namespace.Euler,A=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var g=0;g<l.length;g+=3){if(m.set(l[g],l[g+1],l[g+2],s),h.setFromEuler(m),h.premultiply(f),h.multiply(d),g>2){var y=new THREE__namespace.Quaternion().fromArray(A,(g-3)/3*4);y.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(A,g/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,A)},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(p){if(e.x&&(u=e.x.times.indexOf(p)),e.y&&(l=e.y.times.indexOf(p)),e.z&&(c=e.z.times.indexOf(p)),u!==-1){var f=e.x.values[u];s.push(f),o[0]=f}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 p=c.map(THREE__namespace.MathUtils.degToRad),f=[t.values[l],e.values[l],r.values[l]];if(!(isNaN(f[0])||isNaN(f[1])||isNaN(f[2]))){f.map(THREE__namespace.MathUtils.degToRad);var d=[f[0]-c[0],f[1]-c[1],f[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 m=Math.max.apply(Math,h),A=m/180,g=new THREE__namespace.Euler(p[0],p[1],p[2],o),y=new THREE__namespace.Euler(p[0],p[1],p[2],o),v=new THREE__namespace.Quaternion().setFromEuler(g),E=new THREE__namespace.Quaternion().setFromEuler(y);v.dot(E)&&E.set(-E.x,-E.y,-E.z,-E.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,R=0;R<1;R+=1/A)_.copy(v.clone().slerp(E.clone(),R)),s.push(b+R*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+):(.*){"),p=o.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),f=o.match("^\\t{"+(e.currentIndent-1)+"}}");c?e.parseNodeBegin(o,c):p?e.parseNodeProperty(o,p,r[++s]):f?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),p=parseInt(c[0]),f=parseInt(c[1]),d=s.split(",").slice(3);d=d.map(function(h){return h.trim().replace(/^"/,"")}),o="connections",s=[p,f],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(f){return f.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=o[0],u=o[1],l=o[2],c=o[3],p=o[4];switch(u){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":p=parseFloat(p);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":p=parseNumberArray(p);break}this.getPrevNode()[s]={type:u,type2:l,flag:c,value:p},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=[],p=0;p<s;p++)c.push(this.parseProperty(t));var f=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 m=this.parseNode(t,e);m!==null&&this.parseSubNode(l,r,m)}return r.propertyList=c,typeof f=="number"&&(r.id=f),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,m){m!==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],p=r.propertyList[2],f=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:p,flag:f,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,p=new THREE__namespace.Matrix4,f=new THREE__namespace.Matrix4,d=new THREE__namespace.Matrix4,h=new THREE__namespace.Matrix4,m=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var A=getEulerOrder(0);if(n.preRotation){var g=n.preRotation.map(THREE__namespace.MathUtils.degToRad);g.push(A),e.makeRotationFromEuler(tempEuler.fromArray(g))}if(n.rotation){var g=n.rotation.map(THREE__namespace.MathUtils.degToRad);g.push(n.eulerOrder||A),r.makeRotationFromEuler(tempEuler.fromArray(g))}if(n.postRotation){var g=n.postRotation.map(THREE__namespace.MathUtils.degToRad);g.push(A),o.makeRotationFromEuler(tempEuler.fromArray(g)),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&&p.setPosition(tempVec.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(d.copy(n.parentMatrix),f.copy(n.parentMatrixWorld));var y=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(f);var E=new THREE__namespace.Matrix4;E.copyPosition(f);var b=new THREE__namespace.Matrix4().getInverse(E).multiply(f),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(m===0)S.copy(v).multiply(y).multiply(T).multiply(_);else if(m===1)S.copy(v).multiply(T).multiply(y).multiply(_);else{var R=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),w=new THREE__namespace.Matrix4().getInverse(R),M=T.clone().multiply(w);S.copy(v).multiply(y).multiply(M).multiply(_)}var B=new THREE__namespace.Matrix4().getInverse(p),C=new THREE__namespace.Matrix4().getInverse(u),I=t.clone().multiply(c).multiply(p).multiply(e).multiply(r).multiply(o).multiply(B).multiply(l).multiply(u).multiply(s).multiply(C),L=new THREE__namespace.Matrix4().copyPosition(I),O=f.clone().multiply(L);return h.copyPosition(O),I=h.clone().multiply(S),I.premultiply(new THREE__namespace.Matrix4().getInverse(f)),I}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,p=o?o.length:0;l.degree=e,l.knots=r,l.controlPoints=[],l.startKnot=s||0,l.endKnot=u||c;for(var f=0;f<p;++f){var d=o[f];l.controlPoints[f]=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,p=0;p<l;++p){var f=u[p+1],d=s[l-p],h=o[p]/(f+d);o[p]=c+f*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],p=s[l],f=c.w*p;u.x+=c.x*f,u.y+=c.y*f,u.z+=c.z*f,u.w+=c.w*p}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 p=s.slice(0),f=s.slice(0),d=1;d<=e;++d){p[d]=t-o[n+1-d],f[d]=o[n+d]-t;for(var h=0,m=0;m<d;++m){var A=f[m+1],g=p[d-m];c[d][m]=A+g;var y=c[m][d-1]/c[d][m];c[m][d]=h+A*y,h=g*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 E=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,R=v-_,w=e-_;v>=_&&(T[b][0]=T[E][0]/c[w+1][R],S=T[b][0]*c[R][w]);for(var M=R>=-1?1:-R,B=v-1<=w?_-1:e-v,C=M;C<=B;++C)T[b][C]=(T[E][C]-T[E][C-1])/c[w+1][R+C],S+=T[b][C]*c[R+C][w];v<=w&&(T[b][_]=-T[E][_-1]/c[w+1][v],S+=T[b][_]*c[v][w]),l[_][v]=S;var d=E;E=b,b=d}}for(var I=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=I;I*=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),p=[],f=0;f<e.length;++f){var d=e[f].clone(),h=d.w;d.x*=h,d.y*=h,d.z*=h,p[f]=d}for(var m=0;m<=s;++m){for(var d=p[l-n].clone().multiplyScalar(c[m][0]),A=1;A<=n;++A)d.add(p[l-n+A].clone().multiplyScalar(c[m][A]));u[m]=d}for(var m=s+1;m<=o+1;++m)u[m]=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,p;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:(p=n.split("?")[1])!==null&&p!==void 0?p:""})}).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,p,f,d,h,m,A,g,y,v,E,b,T,_,S,R,w,M,B,C,I,L,O,F,N,D,q,z,j,J,V,U,G,Z,W,ee,X,K,$,re,ne,ae,le,se,ce,me,Ae,be,de=unzipSync(n),he="",fe=null,te=0,ue=Object.keys(de);te<ue.length;te++){var Te=ue[te];/(^|\/)main\.xml$/i.test(Te)&&(fe=de[Te],he=Te.slice(0,Te.lastIndexOf("/")+1))}if(!fe)throw new Error("X3p: main.xml not found.");if(typeof DOMParser=="undefined")throw new Error("X3p: DOMParser not found.");var xe=(e=t.color)!==null&&e!==void 0?e:new THREE__namespace.Color(10066329),Xe=new DOMParser,Je=decodeText(fe),ze=Xe.parseFromString(Je,"text/xml"),ve=ze.querySelector("Record1 Axes"),Ge={x:{type:(s=(o=(r=ve==null?void 0:ve.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=ve==null?void 0:ve.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((f=(p=ve==null?void 0:ve.querySelector("CX Increment"))===null||p===void 0?void 0:p.textContent)!==null&&f!==void 0?f:"1"),offset:Number((h=(d=ve==null?void 0:ve.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(g=(A=(m=ve==null?void 0:ve.querySelector("CY AxisType"))===null||m===void 0?void 0:m.textContent)===null||A===void 0?void 0:A.toUpperCase())!==null&&g!==void 0?g:"I",dataType:(E=(v=(y=ve==null?void 0:ve.querySelector("CY DataType"))===null||y===void 0?void 0:y.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&E!==void 0?E:"D",increment:Number((T=(b=ve==null?void 0:ve.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=ve==null?void 0:ve.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(M=(w=(R=ve==null?void 0:ve.querySelector("CZ AxisType"))===null||R===void 0?void 0:R.textContent)===null||w===void 0?void 0:w.toUpperCase())!==null&&M!==void 0?M:"A",dataType:(I=(C=(B=ve==null?void 0:ve.querySelector("CZ DataType"))===null||B===void 0?void 0:B.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&I!==void 0?I:"D",increment:Number((O=(L=ve==null?void 0:ve.querySelector("CZ Increment"))===null||L===void 0?void 0:L.textContent)!==null&&O!==void 0?O:"1"),offset:Number((N=(F=ve==null?void 0:ve.querySelector("CZ Offset"))===null||F===void 0?void 0:F.textContent)!==null&&N!==void 0?N:"0")}},ye=null,Ne=ze.querySelector("Record1 Axes Rotation");Ne&&(ye=new THREE__namespace.Matrix3,ye.set(Number((q=(D=Ne.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&q!==void 0?q:0),Number((j=(z=Ne.querySelector("r12"))===null||z===void 0?void 0:z.textContent)!==null&&j!==void 0?j:0),Number((V=(J=Ne.querySelector("r13"))===null||J===void 0?void 0:J.textContent)!==null&&V!==void 0?V:0),Number((G=(U=Ne.querySelector("r21"))===null||U===void 0?void 0:U.textContent)!==null&&G!==void 0?G:0),Number((W=(Z=Ne.querySelector("r22"))===null||Z===void 0?void 0:Z.textContent)!==null&&W!==void 0?W:0),Number((X=(ee=Ne.querySelector("r23"))===null||ee===void 0?void 0:ee.textContent)!==null&&X!==void 0?X:0),Number(($=(K=Ne.querySelector("r31"))===null||K===void 0?void 0:K.textContent)!==null&&$!==void 0?$:0),Number((ne=(re=Ne.querySelector("r32"))===null||re===void 0?void 0:re.textContent)!==null&&ne!==void 0?ne:0),Number((le=(ae=Ne.querySelector("r33"))===null||ae===void 0?void 0:ae.textContent)!==null&&le!==void 0?le:0)));var Be=(se=ze.querySelector("Record3 DataLink PointDataLink"))===null||se===void 0?void 0:se.textContent;if(typeof Be!="string")throw new Error("X3p: PointDataLink not found.");Be=pathJoin(he,Be);var Ye=de[Be];if(!Ye)throw new Error("X3p: ".concat(Ye," not found."));for(var nt=getPointArray(Ye.buffer,Ge.z.dataType),De=Number((me=(ce=ze.querySelector("Record3 MatrixDimension SizeX"))===null||ce===void 0?void 0:ce.textContent)!==null&&me!==void 0?me:"0"),qe=Number((be=(Ae=ze.querySelector("Record3 MatrixDimension SizeY"))===null||Ae===void 0?void 0:Ae.textContent)!==null&&be!==void 0?be:"0"),He=Math.floor(De-1),ge=Math.floor(qe-1),Se=He+1,Me=ge+1,je=new Float32Array(Se*Me*3),Ue=new Float32Array(Se*Me*2),tt=new Uint32Array(He*ge*6),dt=new THREE__namespace.Box3,Ve=0;Ve<Me;Ve++)for(var Ct=Ve*Ge.y.increment+Ge.y.offset,Ie=0;Ie<Se;Ie++){var Oe=Ve*Se+Ie,gt=Ie*Ge.x.increment+Ge.x.offset,Mt=nt[Oe],At=!isNaN(Mt),ht=At?Mt:NaN;_vector.set(gt,-Ct,ht),ye&&_vector.applyMatrix3(ye),At&&dt.expandByPoint(_vector),je[Oe*3+0]=_vector.x,je[Oe*3+1]=_vector.y,je[Oe*3+2]=_vector.z,Ue[Oe*2+0]=Ie/He,Ue[Oe*2+1]=1-Ve/ge}for(var Ve=0;Ve<ge;Ve++)for(var Ie=0;Ie<He;Ie++){var _t=Ie+Se*Ve,Ke=Ie+Se*(Ve+1),Ze=Ie+1+Se*(Ve+1),at=Ie+1+Se*Ve,Qe=(Ve*He+Ie)*6;tt[Qe+0]=_t,tt[Qe+1]=Ke,tt[Qe+2]=at,tt[Qe+3]=Ke,tt[Qe+4]=Ze,tt[Qe+5]=at}var ie=new THREE__namespace.BufferGeometry;ie.setAttribute("position",new THREE__namespace.BufferAttribute(je,3)),ie.setAttribute("uv",new THREE__namespace.BufferAttribute(Ue,2)),ie.setIndex(new THREE__namespace.BufferAttribute(tt,1)),(!ie.groups||ie.groups.length===0)&&ie.addGroup(0,ie.index?ie.index.count:ie.attributes.position.count,0),ie.boundingBox=dt;var _e=new PBMMeshMaterial(t.light?"phong":"basic");_e.flatShading=!0,_e.color.copy(xe);var Pe=new PBMMesh(ie,[_e]);return{object:Pe,dispose:function(){ie.dispose(),_e.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],p=e[9],f=e[10],d=e[11],h=Math.max(Math.sqrt(r*r+o*o+s*s),.001),m=Math.max(Math.sqrt(u*u+l*l+c*c),.001),A=Math.max(Math.sqrt(p*p+f*f+d*d),.001);this.halfSize.set(h,m,A);var g=this.halfSize.toArray().reduce(function(y,v){return y+v},0);return(isNaN(g)||g<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/m,l/m,c/m,p/A,f/A,d/A]),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,p=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),f=r.dot(e)+t.constant;return f<=-p?VolumePlaneIntersect.Outside:f>=p?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,p;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=(p=e.extras)!==null&&p!==void 0?p:{},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(f,d){return new n("".concat(s.id,".").concat(d),f,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 p=t.camera.projectionMatrix.elements,f=1/(p[5]/2),d=.9,h=f/l*d,m=u/h;return m}else{var A=Math.max(e,.001),h=A*c/l,m=u/h;return m}},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],p=t(c);p<=s&&(r=[c,p],o=r[0],s=r[1])}return isFinite(s)||(s=0),e?[o,s]:o}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,p=t;if(l){var f=l.array,d=(r=l.stride)!==null&&r!==void 0?r:1,h=(o=l.offset)!==null&&o!==void 0?o:0;p=f[t*d+h]}var m=c.array,A=(s=c.stride)!==null&&s!==void 0?s:3,g=(u=c.offset)!==null&&u!==void 0?u:0;return p=p*A+g,e.x=m[p],e.y=m[p+1],e.z=m[p+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,p=e.max.z+r,f=0,d=0,h=0,m=0,A=0,g=0;return t.x>=0?(f=(o-n.x)*t.x,d=(l-n.x)*t.x):(f=(l-n.x)*t.x,d=(o-n.x)*t.x),t.y>=0?(h=(s-n.y)*t.y,m=(c-n.y)*t.y):(h=(c-n.y)*t.y,m=(s-n.y)*t.y),f>m||h>d||((h>f||f!==f)&&(f=h),(m<d||d!==d)&&(d=m),t.z>=0?(A=(u-n.z)*t.z,g=(p-n.z)*t.z):(A=(p-n.z)*t.z,g=(u-n.z)*t.z),f>g||A>d)||((A>f||f!==f)&&(f=A),(g<d||d!==d)&&(d=g),d<0)?null:f>=0?f: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=[],p=0,f=-1;if(o)for(var d=0;d<s;d+=1){var h=d*3,m=d*6,A=void 0,g=void 0,y=void 0,v=void 0,E=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),A=v=scratchVector3A.x,T=scratchVector3B.x,T<A&&(A=T),T>v&&(v=T),T=scratchVector3C.x,T<A&&(A=T),T>v&&(v=T),g=E=scratchVector3A.y,T=scratchVector3B.y,T<g&&(g=T),T>E&&(E=T),T=scratchVector3C.y,T<g&&(g=T),T>E&&(E=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[m]=A,l[m+1]=g,l[m+2]=y,l[m+3]=v,l[m+4]=E,l[m+5]=b}else{for(var _=1/0,S=1/0,R=1/0,w=-1/0,M=-1/0,B=-1/0,d=0;d<s;d+=1){var h=d*3,m=d*6,A=void 0,g=void 0,y=void 0,v=void 0,E=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),A=v=scratchVector3A.x,T=scratchVector3B.x,T<A&&(A=T),T>v&&(v=T),T=scratchVector3C.x,T<A&&(A=T),T>v&&(v=T),g=E=scratchVector3A.y,T=scratchVector3B.y,T<g&&(g=T),T>E&&(E=T),T=scratchVector3C.y,T<g&&(g=T),T>E&&(E=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[m]=A,l[m+1]=g,l[m+2]=y,l[m+3]=v,l[m+4]=E,l[m+5]=b,A<_&&(_=A),v>w&&(w=v),g<S&&(S=g),E>M&&(M=E),y<R&&(R=y),b>B&&(B=b)}o=[_,S,R,w,M,B]}var C=new BVHNode(++f,o,0,s,0);c[p++]=C;var I=[],L=[0,1,2],O=function(N,D){return I[D]-I[N]};function F(N){var D=N.startIndex,q=N.endIndex,z=N.extents;I[0]=z[3]-z[0],I[1]=z[4]-z[1],I[2]=z[5]-z[2],L.sort(O);for(var j=0;j<3;j++){for(var J=L[j],V=z[J]+z[J+3],U=D,G=q-1,Z=-1,W=void 0;U<=G;)Z===-1?(W=u[U],l[W*6+J]+l[W*6+J+3]<V?U++:Z=W):(W=u[G],l[W*6+J]+l[W*6+J+3]>=V||(u[U]=W,u[G]=Z,Z=-1,U++),G--);if(U>D&&U<q){var ee=new BVHNode(++f,calcExtents(u,l,D,U,EPSILON$1),D,U,N.deepth+1);ee.deepth<r&&ee.endIndex-ee.startIndex>e&&(c[p++]=ee);var X=new BVHNode(++f,calcExtents(u,l,U,q,EPSILON$1),U,q,N.deepth+1);X.deepth<r&&X.endIndex-X.startIndex>e&&(c[p++]=X),N.node0=ee,N.node1=X,N.startIndex=0,N.endIndex=0;break}}}for(;p;)F(c[--p]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(C,f+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),p=[0],f=[],d;(d=p.pop())!==void 0;){var h=d*BYTES_PER_NODE/4,m=clamp(e.x,u[h],u[h+3])-e.x,A=clamp(e.y,u[h+1],u[h+4])-e.y,g=clamp(e.z,u[h+2],u[h+5])-e.z;if(m*m+A*A+g*g<=r*r){for(var y=l[h+6],v=l[h+7],E=y;E<v;E++){var b=o[E];f.push(b)}var T=d*BYTES_PER_NODE/2,_=c[T+16],S=c[T+17];_&&p.push(_),S&&p.push(S)}}for(var R=f.length,w=new Float32Array(R*9),E=0;E<R;E++){var b=f[E],M=b*3;this.getPositionByIndex(M,scratchVector3$9),w[E*9]=scratchVector3$9.x,w[E*9+1]=scratchVector3$9.y,w[E*9+2]=scratchVector3$9.z,this.getPositionByIndex(M+1,scratchVector3$9),w[E*9+3]=scratchVector3$9.x,w[E*9+4]=scratchVector3$9.y,w[E*9+5]=scratchVector3$9.z,this.getPositionByIndex(M+2,scratchVector3$9),w[E*9+6]=scratchVector3$9.x,w[E*9+7]=scratchVector3$9.y,w[E*9+8]=scratchVector3$9.z}return w},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,p=this.rootNodePacked,f=new Float32Array(p),d=new Uint32Array(p),h=new Uint16Array(p),m=new BVHVector3(1/r.x,1/r.y,1/r.z),A=[0],g,y=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),v=1/0;(g=A.pop())!==void 0;){var E=g*BYTES_PER_NODE/4;y.min.x=f[E],y.min.y=f[E+1],y.min.z=f[E+2],y.max.x=f[E+3],y.max.y=f[E+4],y.max.z=f[E+5];var b=intersectNodeBox(e,m,y,o);if(b!==null&&!(s&&b>v)){for(var T=e.x,_=e.y,S=e.z,R=r.x,w=r.y,M=r.z,B=d[E+6],C=d[E+7],I=B;I<C;I++){var L=c[I],O=L*3,F=new BVHVector3(0,0,0);this.getPositionByIndex(O,F);var N=F.x,D=F.y,q=F.z,z=new BVHVector3(0,0,0);this.getPositionByIndex(O+1,z);var j=z.x,J=z.y,V=z.z,U=new BVHVector3(0,0,0);this.getPositionByIndex(O+2,U);var G=U.x,Z=U.y,W=U.z,ee=j-N,X=J-D,K=V-q,$=G-N,re=Z-D,ne=W-q,ae=X*ne-K*re,le=K*$-ee*ne,se=ee*re-X*$,ce=R*ae+w*le+M*se,me=void 0;if(ce>0)me=1;else if(ce<0)me=-1,ce=-ce;else continue;var Ae=T-N,be=_-D,de=S-q,he=me*(R*(be*ne-de*re)+w*(de*$-Ae*ne)+M*(Ae*re-be*$));if(!(he<0)){var fe=me*(R*(X*de-K*be)+w*(K*Ae-ee*de)+M*(ee*be-X*Ae));if(!(fe<0)&&!(he+fe>ce)){var te=-me*(Ae*ae+be*le+de*se);if(!(te<0)){var ue=te/ce,Te=new BVHVector3(T+R*ue,_+w*ue,S+M*ue),xe=new BVHIntersect(F,z,U,L,Te);(!u||u(xe))&&(s?ue<v&&(v=ue,l.length>0&&(l.length=0),l.push(xe)):l.push(xe))}}}}var Xe=g*BYTES_PER_NODE/2,Je=h[Xe+16],ze=h[Xe+17];Je&&A.push(Je),ze&&A.push(ze)}}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,p=-1/0,f=-1/0,d=e;d<r;d++){var h=n[d]*6,m=t[h];m<s&&(s=m),m=t[h+1],m<u&&(u=m),m=t[h+2],m<l&&(l=m),m=t[h+3],m>c&&(c=m),m=t[h+4],m>p&&(p=m),m=t[h+5],m>f&&(f=m)}return[s-o,u-o,l-o,c+o,p+o,f+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=[],p=0,f=-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,m=scratchVector3$8.y,A=scratchVector3$8.z,g=h,y=m,v=A,d=0;d<u;d+=1){l[d]=d,s(d,scratchVector3$8);var E=scratchVector3$8.x,b=scratchVector3$8.y,T=scratchVector3$8.z;E<h?h=E:E>g&&(g=E),b<m?m=b:b>y&&(y=b),T<A?A=T:T>v&&(v=T)}o=[h,m,A,g,y,v]}var _=new BVHNode(++f,o,0,u,0);c[p++]=_;var S=[],R=[0,1,2],w=function(B,C){return S[C]-S[B]};function M(B){var C=B.startIndex,I=B.endIndex,L=B.extents;S[0]=L[3]-L[0],S[1]=L[4]-L[1],S[2]=L[5]-L[2];for(var O=R.sort(w)[0],F=ORDER_AXISES[O],N=(L[O]+L[O+3])/2,D=C,q=I-1,z=-1,j;D<=q;)z===-1?(j=l[D],s(j,scratchVector3$8),scratchVector3$8[F]<N?D++:z=j):(j=l[q],s(j,scratchVector3$8),scratchVector3$8[F]>=N||(l[D]=j,l[q]=z,z=-1,D++),q--);if(D>C){var J=L.slice();J[O+3]=N+EPSILON;var V=new BVHNode(++f,J,C,D,B.deepth+1);V.deepth<r&&V.endIndex-V.startIndex>e&&(c[p++]=V),B.node0=V}if(I>D){var U=L.slice();U[O]=N-EPSILON;var G=new BVHNode(++f,U,D,I,B.deepth+1);G.deepth<r&&G.endIndex-G.startIndex>e&&(c[p++]=G),B.node1=G}B.startIndex=0,B.endIndex=0}for(;p;)M(c[--p]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,f+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,p=this.rootNodePacked,f=new Float32Array(p),d=new Uint32Array(p),h=new Uint16Array(p),m=o*o,A=new BVHVector3(1/r.x,1/r.y,1/r.z),g=[0],y,v=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),E=1/0;(y=g.pop())!==void 0;){var b=y*BYTES_PER_NODE/4;v.min.x=f[b],v.min.y=f[b+1],v.min.z=f[b+2],v.max.x=f[b+3],v.max.y=f[b+4],v.max.z=f[b+5];var T=intersectNodeBox(e,A,v,o);if(T!==null&&!(s&&T>E)){for(var _=d[b+6],S=d[b+7],R=_;R<S;R++){var w=c[R],M=new BVHVector3(0,0,0);this.getPositionByIndex(w,M);var B=M.x,C=M.y,I=M.z,L=e.x,O=e.y,F=e.z,N=r.x,D=r.y,q=r.z,z=N*(B-L)+D*(C-O)+q*(I-F);if(z>0?(L+=N*z,O+=D*z,F+=q*z):z<0&&(z=0),N=B-L,D=C-O,q=I-F,N*N+D*D+q*q<=m){var j=new BVHVector3(L,O,F),J=new BVHIntersect(M,M,M,w,j);(!u||u(J))&&(s?z<E&&(E=z,l.length>0&&(l.length=0),l.push(J)):l.push(J))}}var V=y*BYTES_PER_NODE/2,U=h[V+16],G=h[V+17];U&&g.push(U),G&&g.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)}})})})();
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,p=n.geometry,f=n.material,d=p.groups,h=p.index;intersectsMap.clear();for(var m=t.intersectRay(scratchRay.origin,scratchRay.direction,0,c,function(v){var E,b=v.index,T=b*3,_;if(Array.isArray(f)){if(d)for(var S=0,R=d;S<R.length;S++){var w=R[S];if(T>=w.start&&T-w.start<w.count){_=f[(E=w.materialIndex)!==null&&E!==void 0?E:0];break}}}else _=f;if(!_)return!1;var M=v.intersectionPoint,B=new THREE__namespace.Vector3(M.x,M.y,M.z).applyMatrix4(u),C=e.ray.origin.distanceTo(B);if(C<e.near||C>e.far)return!1;var I=v.pointA,L=v.pointB,O=v.pointC,F=THREE__namespace.Triangle.getNormal(scratchIntersectionFaceA.set(I.x,I.y,I.z).applyMatrix4(u),scratchIntersectionFaceB.set(L.x,L.y,L.z).applyMatrix4(u),scratchIntersectionFaceC.set(O.x,O.y,O.z).applyMatrix4(u),new THREE__namespace.Vector3),N=e.ray.direction.dot(F);if(_.side===THREE__namespace.FrontSide&&N>=0||_.side===THREE__namespace.BackSide&&N<=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,F),q={distance:C,object:n,face:D,point:B,distanceToRay:0,faceIndex:b};return intersectsMap.set(v,q),l(q)}),A=m.length,g=0;g<A;g++){var y=intersectsMap.get(m[g]);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 p=((s=(o=e.params.Points)===null||o===void 0?void 0:o.threshold)!==null&&s!==void 0?s:1)*scratchInverseMatrix.getMaxScaleOnAxis(),f=(u=e.hitFilter)!==null&&u!==void 0?u:defaultHitFilter,d=(l=e.firstHitOnly)!==null&&l!==void 0?l:!1,h=n.geometry,m=h.index,A=h.getAttribute("normal"),g=A instanceof THREE__namespace.BufferAttribute;intersectsMap.clear();for(var y=t.intersectRay(scratchRay.origin,scratchRay.direction,p,d,function(T){var _=T.intersectionPoint,S=new THREE__namespace.Vector3(_.x,_.y,_.z).applyMatrix4(c),R=e.ray.origin.distanceTo(S);if(R<e.near||R>e.far)return!1;var w=T.pointA,M=scratchIntersectionFaceA.set(w.x,w.y,w.z).applyMatrix4(c),B=T.index,C=m?m.array[B]:B,I;if(g){var L=new THREE__namespace.Vector3().fromBufferAttribute(A,C).applyNormalMatrix(scratchNormalMatrix);I=new THREE__namespace.Face3(C,C,C,L)}var O={distance:R,object:n,face:I,point:S,distanceToRay:S.distanceTo(M),index:B};return intersectsMap.set(T,O),f(O)}),v=y.length,E=0;E<v;E++){var b=intersectsMap.get(y[E]);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 p=o[c],f=p.geometry;if(f instanceof THREE__namespace.BufferGeometry){var d=void 0;if(p instanceof THREE__namespace.Mesh?d="mesh":p instanceof THREE__namespace.Points&&(d="points"),!!d){var h=f.boundingBox,m=h?[h.min.x,h.min.y,h.min.z,h.max.x,h.max.y,h.max.z]:void 0,A={};for(var g in f.attributes){var y=f.attributes[g];y instanceof THREE__namespace.InterleavedBufferAttribute?(A[g]={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(A[g]={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var v=void 0,E=f.getIndex();E&&(E instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:E.data.array,stride:E.data.stride,offset:E.offset},l=E.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(v={array:E.array},l=E.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:d,attributes:A,indices:v,maxItemPerNode:e,maxTreeDepth:r,extents:m};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,p=s[u];if(c instanceof THREE__namespace.BufferGeometry){for(var f in p.attributes){var d=p.attributes[f].array,h=c.attributes[f];h instanceof THREE__namespace.InterleavedBufferAttribute?h.data.array=d:h.array=d}var m=c.getIndex();if(m&&p.indices){var d=p.indices.array;m instanceof THREE__namespace.InterleavedBufferAttribute?m.data.array=d:m.array=d}if(l instanceof THREE__namespace.Mesh){var A=new BVHMesh(p.attributes.position,p.indices);A.offsetArray=p.offsetArray,A.rootNodePacked=p.rootNodePacked,bindBvhTreeForMesh(l,A)}else if(l instanceof THREE__namespace.Points){var A=new BVHPoints(p.attributes.position,p.indices);A.offsetArray=p.offsetArray,A.rootNodePacked=p.rootNodePacked,bindBvhTreeForPoints(l,A)}}}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 p in this.config)c[p]=(s=t[p])!==null&&s!==void 0?s:l[p];var f=[{progress:0,value:l},{progress:1,value:c}];return this.setKeyframes(f,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,TileNode=(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.materials=[],s.pbmObjects=[],s.contentObject=r,s.appearMotion=new Motion({appear:0}),s.disposers=[o],s.add(r),r.traverse(function(u){var l;if(u instanceof THREE__namespace.Mesh||u instanceof THREE__namespace.Points){var c=u.material;Array.isArray(c)?(l=s.materials).push.apply(l,c):s.materials.push(c)}(u instanceof PBMMesh||u instanceof PBMSkinnedMesh||u instanceof PBMPointCloud)&&s.pbmObjects.push(u)}),s}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(f){if(f.object instanceof PBMPointCloud&&f.object.material.pointBack==="HIDDEN"&&f.face&&f.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;var d=0,h=-1;if((f.object instanceof PBMMesh||f.object instanceof PBMSkinnedMesh||f.object instanceof PBMPointCloud)&&f.face){var m=Array.isArray(f.object.material)?f.object.material[f.face.materialIndex]:f.object.material;m&&(d=m.floorIndex,h=m.shownFloorIndex)}var A=h;return e.floorIndex!==void 0?A=e.floorIndex:e.floor!==void 0&&(A=e.floor===null?-1:e.floor),A>=0&&d!==A?!1:(Object.assign(f,{floorIndex:d,floor:d}),s?s.call(e,f):!0)};for(var u=this.children.slice(),l;l=u.pop();)if(l.visible){l.raycast(e,o);for(var c=0,p=l.children.length;c<p;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,p=s.visible&&u.state.selectedFrameNumber===u.tileset.frameNumber;if(p){var f=1;this.appearMotion.getTargetKeyframe().value.appear!==f&&this.appearMotion.set({appear:f},APPEAR_ANIMATION_DURATION).catch(noop)}else{var f=0;this.appearMotion.getTargetKeyframe().value.appear!==f&&this.appearMotion.set({appear:f},0).catch(noop)}this.appearMotion.ended!==!0&&this.appearMotion.update(r.time);for(var d=0,h=this.pbmObjects;d<h.length;d++){var m=h[d];if(m instanceof PBMMesh||m instanceof PBMSkinnedMesh){var A=updatePBMMesh(m,this.appearMotion,e,r,o,u,l);A===!0&&(c=!0)}else if(m instanceof PBMPointCloud){var A=updatePBMPointCloud(m,this.appearMotion,e,r,o,u,l);A===!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())},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,p=0,f=c;p<f.length;p++){var d=f[p];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.logDepthAlpha=u.logDepthAlpha,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.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.depthWrite=!d.transparent,d.logDepthAlpha>0?d.transparent=!1: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,p=!1;if(u.pointAppearAnimation===!0&&s.refine==="ADD"&&s.tileset.rootMeta.pntsOrder==="RANDOM"){var f=n.geometry,d=s.tileset.currentMaxScreenSpaceError,h=s.state.screenSpaceError,m=(c=(l=s.parent)===null||l===void 0?void 0:l.state.screenSpaceError)!==null&&c!==void 0?c:h,A=1;m!==h&&(A=(m-d)/(m-h)),A=clamp$1(A,0,1),A=easeInCubic(A);var g=f.index?f.index.count:f.attributes.position?f.attributes.position.count:1/0,y=Math.floor(g*A*t.value.appear);f.drawRange.count!==y&&(f.setDrawRange(0,y),p=!0)}if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),p=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var v=[n.material],E=0,b=v;E<b.length;E++){var T=b[E];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.logDepthAlpha=u.logDepthAlpha,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.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),T.logDepthAlpha>0?T.transparent=!1: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)}}return p}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 p=u[c];if(l.has(p.tile)){l.delete(p.tile);continue}p.status==="WAITING"&&(u.splice(c,1),c--,this.options.onTileSkip&&this.options.onTileSkip(p.tile))}l.size>0&&(l.forEach(function(v){u.push({tile:v,status:"WAITING",time:s,error:null})}),l.clear());for(var f=r.maxRequests,c=0;c<u.length&&f>0;c++){var p=u[c];if(p.status==="DONE")p.error!==null?this.options.onTileError&&this.options.onTileError(p.tile,p.error):(f--,p.tile.content&&(p.tile.content.loadState="READY"),this.options.onTileLoad&&this.options.onTileLoad(p.tile)),u.splice(c,1),c--;else if(p.status==="PENDING"&&s-p.time<1e3)break}switch(priorityCache.clear(),e){case"SCREEN_SPACE_ERROR":{u.sort(function(v,E){if(v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber)return E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber;if(v.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(r,v.tile,priorityCache),T=getPriority(r,E.tile,priorityCache);return b-T}else return v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(v,E){return v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.state.centerScreenY!==E.tile.state.centerScreenY?v.tile.state.centerScreenY-E.tile.state.centerScreenY:v.tile.state.centerZDepth!==E.tile.state.centerZDepth?v.tile.state.centerZDepth-E.tile.state.centerZDepth:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(v,E){return v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.centerScreenY!==E.tile.state.centerScreenY?v.tile.state.centerScreenY-E.tile.state.centerScreenY:v.tile.state.centerZDepth!==E.tile.state.centerZDepth?v.tile.state.centerZDepth-E.tile.state.centerZDepth:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}}if(f=Math.max(r.maxRequests-this.activeRequests,0),!r.skipLevelOfDetail)for(var d=0,h=u.length,c=0;c<h;c++){var m=u[c].tile;if(m.hasTilesetContent||m.contentParent===null||m.contentParent.state.selectedFrameNumber===r.frameNumber){var A=u.splice(c,1);u.splice.apply(u,__spreadArray([d++,0],A,!1))}}for(var g=function(v){var E=u[v];E.status==="WAITING"&&(f--,E.status="PENDING",E.time=s,y.activeRequests++,y.tileset.options.tileLoader(E.tile).catch(function(b){E.error=b}).then(function(){E.status="DONE",E.tile.content&&E.tile.content.loadState==="READY"&&(E.tile.content.loadState="LOADING"),o.activeRequests--}))},y=this,c=0;c<u.length&&f>0;c++)g(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 Map,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.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 p=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.loadTile(s,r),p&&this.selectDesiredTile(s,r)):(this.loadTile(s,r),p&&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 p=e.refine==="REPLACE"&&e.hasRenderContent,f=!1,d=!0,h=0,m=s;h<m.length;h++){var c=m[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),f===!1&&(f=!0)):(p||r.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),p){var A=void 0;c.state.inRequestVolume?c.hasRenderContent?A=c.contentAvailable:A=this.executeEmptyTraversal(c,r):A=!1,d=d&&A}}return f||(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,p=0,f=c;p<f.length;p++){var d=f[p];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 p=!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),p&&this.selectDesiredTile(s,r)):p?(this.loadTile(s,r),this.selectDesiredTile(s,r)):this.reachedSkippingThreshold(s)&&this.loadTile(s,r)):(this.loadTile(s,r),p&&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 p=!1,f=0,d=s;f<d.length;f++){var c=d[f];c.levelOfContent<=r.minLevelOfDetail||c.geometricError>=r.maxGeometricError||c.state.visible&&c.state.inRequestVolume?(o.push(c),p===!1&&(p=!0)):r.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return p},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 p=c[l];p.state.visible&&(p.contentAvailable?(this.updateTile(p,r),this.touchTile(p,r),this.selectTile(p,r)):o.push(p))}},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 p=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,!p){this.selectTile(c,r);continue}s.push(c),c.state.stackLength=o.length}if(p)for(var f=0,d=c.children;f<d.length;f++){var h=d[f];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,p,f;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=(p=this.rootMeta.numFloors)!==null&&p!==void 0?p:1,this.properties=(f=t.properties)!==null&&f!==void 0?f:{},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(m){r.cacheMemoryUsageInBytes+=m.contentMemoryUsage},onTileUnload:function(m){r.cacheMemoryUsageInBytes-=m.contentMemoryUsage,r.unloadTiles.push(m)}}),this.requestScheduler=new TileRequestScheduler(this,{onTileSkip:function(m){},onTileLoad:function(m){var A;!((A=m.content)===null||A===void 0)&&A.data&&(r.loadedTiles.add(m),r.cache.loadTile(m)),r.options.onTileLoad(m)},onTileError:function(m,A){r.options.onTileError(m,A)}}),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;this.needsRefinedTiles.forEach(function(s){s.content&&(e+=s.content.memoryUsage)});var r=(t.maxMemoryUsage-t.memoryAdjustedOverflow)*1024*1024,o=t.maxMemoryUsage*1024*1024;e<r?this.currentMaxScreenSpaceError=Math.max(this.currentMaxScreenSpaceError/1.02,t.maxScreenSpaceError):e>o&&this.selectedTiles.length>0&&(this.currentMaxScreenSpaceError*=1.02)}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 f=l.unloadTiles.pop();f&&(l.loadedTiles.delete(f),l.cacheMemoryUsageInBytes-=f.contentMemoryUsage,l.options.tileUnloader(f).catch(function(){}).then(function(){t.options.onTileUnload&&t.options.onTileUnload(f)}))},l=this;this.unloadTiles.length;)u();this.loadedTiles.clear();for(var c=function(){var f=p.trajectories.pop();f&&p.options.trajectoryUnloader(f).catch(function(){}).then(function(){t.options.onTrajectoryUnload&&t.options.onTrajectoryUnload(f)})},p=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(m){r.options.onTrajectoryError(h,m)}))},c=this,p=0,f=this.trajectories;p<f.length;p++){var d=f[p];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 p=c[l];normalizeTileHeader(p,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,p=this._finalize(!1);p&&(p.inherited||((l=p.groupCount)!==null&&l!==void 0?l:0)<=0)&&this.materials.splice((c=p.index)!==null&&c!==void 0?c:0,1);var f={index:this.materials.length,name:s||"",mtllib:Array.isArray(u)&&u.length>0?u[u.length-1]:"",smooth:p!==void 0?p.smooth:this.smooth,groupStart:p!==void 0?p.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(f),f},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 p=this.materials.length-1;p>=0;p--)((l=this.materials[p].groupCount)!==null&&l!==void 0?l:0)<=0&&this.materials.splice(p,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,p){var f=this.object.geometry,d=this.vertices.length,h=this.normals.length,m=this.uvs.length,A=this.parseVertexIndex(t,d),g=this.parseVertexIndex(e,d),y=this.parseVertexIndex(r,d),v=l!==void 0?this.parseNormalIndex(l,h):void 0,E=c!==void 0?this.parseNormalIndex(c,h):void 0,b=p!==void 0?this.parseNormalIndex(p,h):void 0,T=o!==void 0?this.parseUVIndex(o,m):void 0,_=s!==void 0?this.parseUVIndex(s,m):void 0,S=u!==void 0?this.parseUVIndex(u,m):void 0;(f.hasNormal===!0&&v===void 0||E===void 0||b===void 0)&&(f.hasNormal=!1),(f.hasUV===!0&&T===void 0||_===void 0||S===void 0)&&(f.hasUV=!1);var R=[A,T,v].join(":"),w=f.indexMap[R];w===void 0&&(w=f.vertices.length/3,f.indexMap[R]=w,f.vertices.push(this.vertices[A+0],this.vertices[A+1],this.vertices[A+2]),f.hasColor&&(this.colors[A]===void 0?f.hasColor=!1:f.colors.push(this.colors[A+0],this.colors[A+1],this.colors[A+2])),f.hasNormal&&f.normals.push(this.normals[A+0],this.normals[A+1],this.normals[A+2]),f.hasUV&&f.uvs.push(this.uvs[T+0],this.uvs[T+1])),f.index.push(w);var M=[g,_,E].join(":"),B=f.indexMap[M];B===void 0&&(B=f.vertices.length/3,f.indexMap[M]=B,f.vertices.push(this.vertices[g+0],this.vertices[g+1],this.vertices[g+2]),f.hasColor&&(this.colors[g]===void 0?f.hasColor=!1:f.colors.push(this.colors[g+0],this.colors[g+1],this.colors[g+2])),f.hasNormal&&f.normals.push(this.normals[g+0],this.normals[g+1],this.normals[g+2]),f.hasUV&&f.uvs.push(this.uvs[_+0],this.uvs[_+1])),f.index.push(B);var C=[y,S,b].join(":"),I=f.indexMap[C];I===void 0&&(I=f.vertices.length/3,f.indexMap[C]=I,f.vertices.push(this.vertices[y+0],this.vertices[y+1],this.vertices[y+2]),f.hasColor&&(this.colors[y]===void 0?f.hasColor=!1:f.colors.push(this.colors[y+0],this.colors[y+1],this.colors[y+2])),f.hasNormal&&f.normals.push(this.normals[y+0],this.normals[y+1],this.normals[y+2]),f.hasUV&&f.uvs.push(this.uvs[S+0],this.uvs[S+1])),f.index.push(I)},n})();function parseObj(n){var t=new ObjState;n.indexOf(`\r
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,p=n.geometry,f=n.material,d=p.groups,h=p.index;intersectsMap.clear();for(var m=t.intersectRay(scratchRay.origin,scratchRay.direction,0,c,function(v){var E,b=v.index,T=b*3,_;if(Array.isArray(f)){if(d)for(var S=0,R=d;S<R.length;S++){var w=R[S];if(T>=w.start&&T-w.start<w.count){_=f[(E=w.materialIndex)!==null&&E!==void 0?E:0];break}}}else _=f;if(!_)return!1;var M=v.intersectionPoint,B=new THREE__namespace.Vector3(M.x,M.y,M.z).applyMatrix4(u),C=e.ray.origin.distanceTo(B);if(C<e.near||C>e.far)return!1;var I=v.pointA,L=v.pointB,O=v.pointC,F=THREE__namespace.Triangle.getNormal(scratchIntersectionFaceA.set(I.x,I.y,I.z).applyMatrix4(u),scratchIntersectionFaceB.set(L.x,L.y,L.z).applyMatrix4(u),scratchIntersectionFaceC.set(O.x,O.y,O.z).applyMatrix4(u),new THREE__namespace.Vector3),N=e.ray.direction.dot(F);if(_.side===THREE__namespace.FrontSide&&N>=0||_.side===THREE__namespace.BackSide&&N<=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,F),q={distance:C,object:n,face:D,point:B,distanceToRay:0,faceIndex:b};return intersectsMap.set(v,q),l(q)}),A=m.length,g=0;g<A;g++){var y=intersectsMap.get(m[g]);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 p=((s=(o=e.params.Points)===null||o===void 0?void 0:o.threshold)!==null&&s!==void 0?s:1)*scratchInverseMatrix.getMaxScaleOnAxis(),f=(u=e.hitFilter)!==null&&u!==void 0?u:defaultHitFilter,d=(l=e.firstHitOnly)!==null&&l!==void 0?l:!1,h=n.geometry,m=h.index,A=h.getAttribute("normal"),g=A instanceof THREE__namespace.BufferAttribute;intersectsMap.clear();for(var y=t.intersectRay(scratchRay.origin,scratchRay.direction,p,d,function(T){var _=T.intersectionPoint,S=new THREE__namespace.Vector3(_.x,_.y,_.z).applyMatrix4(c),R=e.ray.origin.distanceTo(S);if(R<e.near||R>e.far)return!1;var w=T.pointA,M=scratchIntersectionFaceA.set(w.x,w.y,w.z).applyMatrix4(c),B=T.index,C=m?m.array[B]:B,I;if(g){var L=new THREE__namespace.Vector3().fromBufferAttribute(A,C).applyNormalMatrix(scratchNormalMatrix);I=new THREE__namespace.Face3(C,C,C,L)}var O={distance:R,object:n,face:I,point:S,distanceToRay:S.distanceTo(M),index:B};return intersectsMap.set(T,O),f(O)}),v=y.length,E=0;E<v;E++){var b=intersectsMap.get(y[E]);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 p=o[c],f=p.geometry;if(f instanceof THREE__namespace.BufferGeometry){var d=void 0;if(p instanceof THREE__namespace.Mesh?d="mesh":p instanceof THREE__namespace.Points&&(d="points"),!!d){var h=f.boundingBox,m=h?[h.min.x,h.min.y,h.min.z,h.max.x,h.max.y,h.max.z]:void 0,A={};for(var g in f.attributes){var y=f.attributes[g];y instanceof THREE__namespace.InterleavedBufferAttribute?(A[g]={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(A[g]={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var v=void 0,E=f.getIndex();E&&(E instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:E.data.array,stride:E.data.stride,offset:E.offset},l=E.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(v={array:E.array},l=E.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:d,attributes:A,indices:v,maxItemPerNode:e,maxTreeDepth:r,extents:m};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,p=s[u];if(c instanceof THREE__namespace.BufferGeometry){for(var f in p.attributes){var d=p.attributes[f].array,h=c.attributes[f];h instanceof THREE__namespace.InterleavedBufferAttribute?h.data.array=d:h.array=d}var m=c.getIndex();if(m&&p.indices){var d=p.indices.array;m instanceof THREE__namespace.InterleavedBufferAttribute?m.data.array=d:m.array=d}if(l instanceof THREE__namespace.Mesh){var A=new BVHMesh(p.attributes.position,p.indices);A.offsetArray=p.offsetArray,A.rootNodePacked=p.rootNodePacked,bindBvhTreeForMesh(l,A)}else if(l instanceof THREE__namespace.Points){var A=new BVHPoints(p.attributes.position,p.indices);A.offsetArray=p.offsetArray,A.rootNodePacked=p.rootNodePacked,bindBvhTreeForPoints(l,A)}}}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 p in this.config)c[p]=(s=t[p])!==null&&s!==void 0?s:l[p];var f=[{progress:0,value:l},{progress:1,value:c}];return this.setKeyframes(f,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,TileNode=(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.materials=[],s.pbmObjects=[],s.contentObject=r,s.appearMotion=new Motion({appear:0}),s.disposers=[o],s.add(r),r.traverse(function(u){var l;if(u instanceof THREE__namespace.Mesh||u instanceof THREE__namespace.Points){var c=u.material;Array.isArray(c)?(l=s.materials).push.apply(l,c):s.materials.push(c)}(u instanceof PBMMesh||u instanceof PBMSkinnedMesh||u instanceof PBMPointCloud)&&s.pbmObjects.push(u)}),s}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(f){if(f.object instanceof PBMPointCloud&&f.object.material.pointBack==="HIDDEN"&&f.face&&f.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;var d=0,h=-1;if((f.object instanceof PBMMesh||f.object instanceof PBMSkinnedMesh||f.object instanceof PBMPointCloud)&&f.face){var m=Array.isArray(f.object.material)?f.object.material[f.face.materialIndex]:f.object.material;m&&(d=m.floorIndex,h=m.shownFloorIndex)}var A=h;return e.floorIndex!==void 0?A=e.floorIndex:e.floor!==void 0&&(A=e.floor===null?-1:e.floor),A>=0&&d!==A?!1:(Object.assign(f,{floorIndex:d,floor:d}),s?s.call(e,f):!0)};for(var u=this.children.slice(),l;l=u.pop();)if(l.visible){l.raycast(e,o);for(var c=0,p=l.children.length;c<p;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,p=s.visible&&u.state.selectedFrameNumber===u.tileset.frameNumber;if(p){var f=1;this.appearMotion.getTargetKeyframe().value.appear!==f&&this.appearMotion.set({appear:f},APPEAR_ANIMATION_DURATION).catch(noop)}else{var f=0;this.appearMotion.getTargetKeyframe().value.appear!==f&&this.appearMotion.set({appear:f},0).catch(noop)}this.appearMotion.ended!==!0&&this.appearMotion.update(r.time);for(var d=0,h=this.pbmObjects;d<h.length;d++){var m=h[d];if(m instanceof PBMMesh||m instanceof PBMSkinnedMesh){var A=updatePBMMesh(m,this.appearMotion,e,r,o,u,l);A===!0&&(c=!0)}else if(m instanceof PBMPointCloud){var A=updatePBMPointCloud(m,this.appearMotion,e,r,o,u,l);A===!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())},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,p=0,f=c;p<f.length;p++){var d=f[p];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.logDepthAlpha=u.logDepthAlpha,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.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.depthWrite=!d.transparent,d.logDepthAlpha>0?d.transparent=!1: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,p=!1;if(u.pointAppearAnimation===!0&&s.refine==="ADD"&&s.tileset.rootMeta.pntsOrder==="RANDOM"){var f=n.geometry,d=s.tileset.currentMaxScreenSpaceError,h=s.state.screenSpaceError,m=(c=(l=s.parent)===null||l===void 0?void 0:l.state.screenSpaceError)!==null&&c!==void 0?c:h,A=1;m!==h&&(A=(m-d)/(m-h)),A=clamp$1(A,0,1),A=easeInCubic(A);var g=f.index?f.index.count:f.attributes.position?f.attributes.position.count:1/0,y=Math.floor(g*A*t.value.appear);f.drawRange.count!==y&&(f.setDrawRange(0,y),p=!0)}if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),p=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var v=[n.material],E=0,b=v;E<b.length;E++){var T=b[E];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.logDepthAlpha=u.logDepthAlpha,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.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),T.logDepthAlpha>0?T.transparent=!1: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)}}return p}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 p=u[c];if(l.has(p.tile)){l.delete(p.tile);continue}p.status==="WAITING"&&(u.splice(c,1),c--,this.options.onTileSkip&&this.options.onTileSkip(p.tile))}l.size>0&&(l.forEach(function(v){u.push({tile:v,status:"WAITING",time:s,error:null})}),l.clear());for(var f=r.maxRequests,c=0;c<u.length&&f>0;c++){var p=u[c];if(p.status==="DONE")p.error!==null?this.options.onTileError&&this.options.onTileError(p.tile,p.error):(f--,p.tile.content&&(p.tile.content.loadState="READY"),this.options.onTileLoad&&this.options.onTileLoad(p.tile)),u.splice(c,1),c--;else if(p.status==="PENDING"&&s-p.time<1e3)break}switch(priorityCache.clear(),e){case"SCREEN_SPACE_ERROR":{u.sort(function(v,E){if(v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber)return E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber;if(v.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(r,v.tile,priorityCache),T=getPriority(r,E.tile,priorityCache);return b-T}else return v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(v,E){return v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.state.centerScreenY!==E.tile.state.centerScreenY?v.tile.state.centerScreenY-E.tile.state.centerScreenY:v.tile.state.centerZDepth!==E.tile.state.centerZDepth?v.tile.state.centerZDepth-E.tile.state.centerZDepth:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(v,E){return v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.centerScreenY!==E.tile.state.centerScreenY?v.tile.state.centerScreenY-E.tile.state.centerScreenY:v.tile.state.centerZDepth!==E.tile.state.centerZDepth?v.tile.state.centerZDepth-E.tile.state.centerZDepth:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}}if(f=Math.max(r.maxRequests-this.activeRequests,0),!r.skipLevelOfDetail)for(var d=0,h=u.length,c=0;c<h;c++){var m=u[c].tile;if(m.hasTilesetContent||m.contentParent===null||m.contentParent.state.selectedFrameNumber===r.frameNumber){var A=u.splice(c,1);u.splice.apply(u,__spreadArray([d++,0],A,!1))}}for(var g=function(v){var E=u[v];E.status==="WAITING"&&(f--,E.status="PENDING",E.time=s,y.activeRequests++,y.tileset.options.tileLoader(E.tile).catch(function(b){E.error=b}).then(function(){E.status="DONE",E.tile.content&&E.tile.content.loadState==="READY"&&(E.tile.content.loadState="LOADING"),o.activeRequests--}))},y=this,c=0;c<u.length&&f>0;c++)g(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 Map,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 p=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.loadTile(s,r),p&&this.selectDesiredTile(s,r)):(this.loadTile(s,r),p&&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 p=e.refine==="REPLACE"&&e.hasRenderContent,f=!1,d=!0,h=0,m=s;h<m.length;h++){var c=m[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),f===!1&&(f=!0)):(p||r.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),p){var A=void 0;c.state.inRequestVolume?c.hasRenderContent?A=c.contentAvailable:A=this.executeEmptyTraversal(c,r):A=!1,d=d&&A}}return f||(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,p=0,f=c;p<f.length;p++){var d=f[p];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 p=!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),p&&this.selectDesiredTile(s,r)):p?(this.loadTile(s,r),this.selectDesiredTile(s,r)):this.reachedSkippingThreshold(s)&&this.loadTile(s,r)):(this.loadTile(s,r),p&&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 p=!1,f=0,d=s;f<d.length;f++){var c=d[f];c.levelOfContent<=r.minLevelOfDetail||c.geometricError>=r.maxGeometricError||c.state.visible&&c.state.inRequestVolume?(o.push(c),p===!1&&(p=!0)):r.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return p},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 p=c[l];p.state.visible&&(p.contentAvailable?(this.updateTile(p,r),this.touchTile(p,r),this.selectTile(p,r)):o.push(p))}},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 p=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,!p){this.selectTile(c,r);continue}s.push(c),c.state.stackLength=o.length}if(p)for(var f=0,d=c.children;f<d.length;f++){var h=d[f];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,p,f;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=(p=this.rootMeta.numFloors)!==null&&p!==void 0?p:1,this.properties=(f=t.properties)!==null&&f!==void 0?f:{},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(m){r.cacheMemoryUsageInBytes+=m.contentMemoryUsage},onTileUnload:function(m){r.cacheMemoryUsageInBytes-=m.contentMemoryUsage,r.unloadTiles.push(m)}}),this.requestScheduler=new TileRequestScheduler(this,{onTileSkip:function(m){},onTileLoad:function(m){var A;!((A=m.content)===null||A===void 0)&&A.data&&(r.loadedTiles.add(m),r.cache.loadTile(m)),r.options.onTileLoad(m)},onTileError:function(m,A){r.options.onTileError(m,A)}}),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;this.needsRefinedTiles.forEach(function(s){s.content&&(e+=s.content.memoryUsage)});var r=(t.maxMemoryUsage-t.memoryAdjustedOverflow)*1024*1024,o=t.maxMemoryUsage*1024*1024;e<r?this.currentMaxScreenSpaceError=Math.max(this.currentMaxScreenSpaceError/1.02,t.maxScreenSpaceError):e>o&&this.selectedTiles.length>0&&(this.currentMaxScreenSpaceError*=1.02)}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 f=l.unloadTiles.pop();f&&(l.loadedTiles.delete(f),l.cacheMemoryUsageInBytes-=f.contentMemoryUsage,l.options.tileUnloader(f).catch(function(){}).then(function(){t.options.onTileUnload&&t.options.onTileUnload(f)}))},l=this;this.unloadTiles.length;)u();this.loadedTiles.clear();for(var c=function(){var f=p.trajectories.pop();f&&p.options.trajectoryUnloader(f).catch(function(){}).then(function(){t.options.onTrajectoryUnload&&t.options.onTrajectoryUnload(f)})},p=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(m){r.options.onTrajectoryError(h,m)}))},c=this,p=0,f=this.trajectories;p<f.length;p++){var d=f[p];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 p=c[l];normalizeTileHeader(p,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,p=this._finalize(!1);p&&(p.inherited||((l=p.groupCount)!==null&&l!==void 0?l:0)<=0)&&this.materials.splice((c=p.index)!==null&&c!==void 0?c:0,1);var f={index:this.materials.length,name:s||"",mtllib:Array.isArray(u)&&u.length>0?u[u.length-1]:"",smooth:p!==void 0?p.smooth:this.smooth,groupStart:p!==void 0?p.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(f),f},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 p=this.materials.length-1;p>=0;p--)((l=this.materials[p].groupCount)!==null&&l!==void 0?l:0)<=0&&this.materials.splice(p,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,p){var f=this.object.geometry,d=this.vertices.length,h=this.normals.length,m=this.uvs.length,A=this.parseVertexIndex(t,d),g=this.parseVertexIndex(e,d),y=this.parseVertexIndex(r,d),v=l!==void 0?this.parseNormalIndex(l,h):void 0,E=c!==void 0?this.parseNormalIndex(c,h):void 0,b=p!==void 0?this.parseNormalIndex(p,h):void 0,T=o!==void 0?this.parseUVIndex(o,m):void 0,_=s!==void 0?this.parseUVIndex(s,m):void 0,S=u!==void 0?this.parseUVIndex(u,m):void 0;(f.hasNormal===!0&&v===void 0||E===void 0||b===void 0)&&(f.hasNormal=!1),(f.hasUV===!0&&T===void 0||_===void 0||S===void 0)&&(f.hasUV=!1);var R=[A,T,v].join(":"),w=f.indexMap[R];w===void 0&&(w=f.vertices.length/3,f.indexMap[R]=w,f.vertices.push(this.vertices[A+0],this.vertices[A+1],this.vertices[A+2]),f.hasColor&&(this.colors[A]===void 0?f.hasColor=!1:f.colors.push(this.colors[A+0],this.colors[A+1],this.colors[A+2])),f.hasNormal&&f.normals.push(this.normals[A+0],this.normals[A+1],this.normals[A+2]),f.hasUV&&f.uvs.push(this.uvs[T+0],this.uvs[T+1])),f.index.push(w);var M=[g,_,E].join(":"),B=f.indexMap[M];B===void 0&&(B=f.vertices.length/3,f.indexMap[M]=B,f.vertices.push(this.vertices[g+0],this.vertices[g+1],this.vertices[g+2]),f.hasColor&&(this.colors[g]===void 0?f.hasColor=!1:f.colors.push(this.colors[g+0],this.colors[g+1],this.colors[g+2])),f.hasNormal&&f.normals.push(this.normals[g+0],this.normals[g+1],this.normals[g+2]),f.hasUV&&f.uvs.push(this.uvs[_+0],this.uvs[_+1])),f.index.push(B);var C=[y,S,b].join(":"),I=f.indexMap[C];I===void 0&&(I=f.vertices.length/3,f.indexMap[C]=I,f.vertices.push(this.vertices[y+0],this.vertices[y+1],this.vertices[y+2]),f.hasColor&&(this.colors[y]===void 0?f.hasColor=!1:f.colors.push(this.colors[y+0],this.colors[y+1],this.colors[y+2])),f.hasNormal&&f.normals.push(this.normals[y+0],this.normals[y+1],this.normals[y+2]),f.hasUV&&f.uvs.push(this.uvs[S+0],this.uvs[S+1])),f.index.push(I)},n})();function parseObj(n){var t=new ObjState;n.indexOf(`\r
920
920
  `)!==-1&&(n=n.replace(/\r\n/g,`
921
921
  `)),n.indexOf(`\\
922
922
  `)!==-1&&(n=n.replace(/\\\n/g,""));for(var e=n.split(`
@@ -2130,7 +2130,7 @@ void main() {
2130
2130
  #include <premultiplied_alpha_fragment>
2131
2131
 
2132
2132
  }
2133
- `},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,p=0,f=r.count;c<f;c++,p+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[p]=p===0?0:s[p-1],s[p+1]=s[p]+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,p=c.resolution,f=c.linewidth,d=l.attributes.instanceStart,h=l.attributes.instanceEnd,m=new THREE__namespace.Vector4,A=new THREE__namespace.Vector4,g=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,E=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,g),g.w=1,g.applyMatrix4(s.matrixWorldInverse),g.applyMatrix4(u),g.multiplyScalar(1/g.w),g.x*=p.x/2,g.y*=p.y/2,g.z=0,y.copy(g);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){m.fromBufferAttribute(d,_),A.fromBufferAttribute(h,_),m.w=1,A.w=1,m.applyMatrix4(v),A.applyMatrix4(v),m.applyMatrix4(u),A.applyMatrix4(u),m.multiplyScalar(1/m.w),A.multiplyScalar(1/A.w);var R=m.z<-1&&A.z<-1,w=m.z>1&&A.z>1;if(!(R||w)){m.x*=p.x/2,m.y*=p.y/2,A.x*=p.x/2,A.y*=p.y/2,E.start.copy(m),E.start.z=0,E.end.copy(A),E.end.z=0;var M=E.closestPointToPointParameter(y,!0);E.at(M,b);var B=THREE__namespace.MathUtils.lerp(m.z,A.z,M),C=B>=-1&&B<=1,I=y.distanceTo(b)<f*.5;if(C&&I){E.start.fromBufferAttribute(d,_),E.end.fromBufferAttribute(h,_),E.start.applyMatrix4(T),E.end.applyMatrix4(T);var L=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3;o.distanceSqToSegment(E.start,E.end,O,L),r.push({point:O,pointOnLine:L,distance:o.origin.distanceTo(O),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.7"},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,p,f,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(m){var A=u[m];return A&&(l={profileId:m,profilePath:"".concat(r,"/").concat(A.path),deprecated:!!A.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(p=h.sent(),s){if(d=void 0,d=p.layouts[e.handedness],!d)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));d.assetPath&&(f=l.profilePath.replace("profile.json",d.assetPath))}return[2,{profile:p,assetPath:f}]}})})}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,p=o.valueNodeProperty;s&&(p===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:p===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(p){var f=p.valueNodeName,d=p.minNodeName,h=p.maxNodeName,m=p.valueNodeProperty;if(m===Constants.VisualResponseProperty.TRANSFORM){if(p.minNode=t.getObjectByName(d),p.maxNode=t.getObjectByName(h),!p.minNode){console.warn("Could not find ".concat(d," in the model"));return}if(!p.maxNode){console.warn("Could not find ".concat(h," in the model"));return}}p.valueNode=t.getObjectByName(f),p.valueNode||console.warn("Could not find ".concat(f," 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,p=l.assetPath;r.motionController=new MotionController(u,c,p);var f=e._assetCache[r.motionController.assetUrl];if(f)o=f.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,p){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(f){var d;return parseGltf(f.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(d=c.split("?")[1])!==null&&d!==void 0?d:"",fetcher:internalFetcher})}).then(function(f){return p(f)})}},(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",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 p=r.xrManager.getControllerGrip(1);p.add(u.createControllerModel(p)),r.controllerWrappers[1].add(p)}),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=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),f=this.works.getObserver(e);if(!f)throw new Error("Invalid PanoIndex");getImageSizeFromURL(f.images.up),this.imageOptions.size;var d=this.imageOptions.transform,h=function(R,w){return mapPanoResource(applyImageURLOptions(R,d,w))},m=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality"])),A={right:f.images.work.getURL(f.images.right),left:f.images.work.getURL(f.images.left),up:f.images.work.getURL(f.images.up),down:f.images.work.getURL(f.images.down),front:f.images.work.getURL(f.images.front),back:f.images.work.getURL(f.images.back)},g="pano:"+jsonHash([A,m,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)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:e}))}var v=this.modelScene.parameter.resolveValue(),E=v.pano0,b=v.pano1,T;if((E==null?void 0:E.map.name)===g?T=E:(b==null?void 0:b.map.name)===g&&(T=b),T){var _={panoId:p,effect:c,leftPanoPicture:{panoId:T.panoId,map:T.map,mapSize:T.mapSize,matrix:f.matrix.clone().premultiply(f.work.transform),zoom:1},position:f.position.clone().applyMatrix4(f.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,_,r);return}var S="move-to-pano-"+p;this.pending.add(S),this.pendingTextureTask={panoId:p,hash:g,onLoad:function(R){var w,M=R.body;if(s.destroyed)M.dispose();else{M.name=g;var B=Array.isArray(M.image)?M.image[0]:M.image,C=(w=B==null?void 0:B.width)!==null&&w!==void 0?w:2048,I={panoId:p,effect:c,leftPanoPicture:{panoId:p,map:M,mapSize:C,matrix:f.matrix.clone(),zoom:1},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,I,r)}},onError:function(R){var w=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:R,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),r.moveCancelCallback&&r.moveCancelCallback()}},this.textureLoader.loadCubeTexture(A,{imageURL:{transform:h,options:m},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(f.work)},void 0,void 0,function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g&&((M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(R)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:R,meta:null,pano:e}))},this.renderer).then(function(R){var w,M;s.pending.delete(S),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g?(s.pendingTextureTask.onLoad(R),s.pendingTextureTask=void 0,(M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(0)):R.body.dispose(),s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:R.meta,pano:e}))}).catch(function(R){var w,M;s.pending.delete(S),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g&&(s.pendingTextureTask.onError(R),s.pendingTextureTask=void 0,(M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(0)),s.emit("pano.texture.error",createEvent("pano.texture.error",{error:R,progress:0,meta:null,pano:e})),s.emit("error",R)}),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,p,f,d,h,m,A,g;o===void 0&&(o={});var y=now(),v=createUuid();this.panoResources[v]=r;var E=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(y);S[0];var R=S[1],w=this.locationMotion.value,M=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position;b=Math.max(M.distanceTo(B),E),T=[{key:R.key,progress:0,value:__assign(__assign({},w),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(y),I=C[0],R=C[1],w=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(I).position,M=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position,O=R.value.count-w.count,F=Math.max(L.distanceTo(M),E)*O,N=Math.max(M.distanceTo(B),E);b=F+N,T=[{key:I.key,progress:0,value:__assign({},w)},{key:R.key,progress:F/b,value:R.value},{key:v,progress:1,value:{count:R.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"?b:0),j={longitude:o.longitude,latitude:o.latitude,fov:o.fov},J=__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}),V=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:V,progress:0,state:J,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(J),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")this.cameraMotion.set(j,z).catch(noop);else{var U=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),G=coordinatesToVector({longitude:(p=j.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(f=j.latitude)!==null&&f!==void 0?f:this.cameraMotion.value.latitude}),Z=new THREE__namespace.Object3D;Z.lookAt(U);var W=new THREE__namespace.Matrix4().makeRotationFromQuaternion(Z.quaternion);Z.lookAt(G);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(Z.quaternion),X=new THREE__namespace.Matrix4().getInverse(W).premultiply(ee),K=this.cameraMotion.value.fov,$=(d=j.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,re=1;r.effect==="zoomin"?re=1.5:r.effect==="zoomout"&&(re=.4);for(var ne=$*re,ae=0;ae<T.length-1;ae++){var le=T[ae].key;if(le){var se=this.panoResources[le];se&&(se.fixCameraTransform.copy(X),se.leftPanoPicture&&(se.leftPanoPicture.zoom=Math.tan(ne/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=j.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(m=j.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:ne}},{progress:1,value:{longitude:(A=j.longitude)!==null&&A!==void 0?A:this.cameraMotion.value.longitude,latitude:(g=j.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:$}}],z).catch(noop)}var ce=this.locationMotion.setKeyframes(T,z,_);ce.then(function(){for(var me=0,Ae=s.modelScene.children;me<Ae.length;me++){var be=Ae[me];be instanceof Model&&be.show()}var de=__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:V,progress:1,state:de,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(de);var he=s.works.getObserver(s.currentPano);if(he&&he.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var fe={map:s.videoTexture,size:he.video.size.clone(),matrix:he.video.matrix.clone(),panoMatrix:he.matrix.clone().premultiply(he.work.transform),alpha:1},te=createUuid(),ue=s.videoTexture.image;ue.setAttribute("uuid",te),canplayVideo().then(function(Te){Te&&he.video&&ue.getAttribute("uuid")===te&&(ue.oncanplay=function(){ue.oncanplay=noop,ue.play()},ue.ontimeupdate=function(){ue.currentTime>.5&&(ue.ontimeupdate=noop,s.panoVideo.setMaterial(fe))},ue.src=he.video.source)}).catch((function(){ue.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:V,progress:0,state:J,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 R=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return R.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),p=this.modelScene.intersectRaycaster(e)[0];if(p){var f=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var R=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return R.distanceTo(p.point)},!0),d=f[0],h=f[1];typeof d=="number"&&h<this.panoTapTriggerRadius&&(s=(o=l[d])!==null&&o!==void 0?o:null)}if(isNil(s)){var m=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);m&&(s=m)}for(var A=0,g=this.locationMotion.keyframes;A<g.length;A++){var y=g[A],v=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&s){var E=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===E){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var E=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(E);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,p,f,d,h,m,A=[],g=2;g<arguments.length;g++)A[g-2]=arguments[g];this.userAction=!0;var y={},v={},E=this.locationMotion.keyframes[0],b=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],T=this.locationMotion.getKeyFrameSegment(e),_=T[0],S=T[1],R=this.panoResourceFromLocationMotionKeyframe(_),w=this.panoResourceFromLocationMotionKeyframe(S),M=this.panoResourceFromLocationMotionKeyframe(E),B=this.panoResourceFromLocationMotionKeyframe(b),C=!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 I=this.locationMotion.getKeyFrameSegment(e);I[0];var L=I[1],O=new THREE__namespace.Vector3().copy(R.position),F=new THREE__namespace.Vector3().copy(w.position),N=this.locationMotion.value.count-L.value.count+1;if(y.progress=N,w.leftPanoPicture&&(N<1?R.leftPanoPicture&&(y.pano0=R.leftPanoPicture):y.pano0=w.leftPanoPicture,y.pano1=w.leftPanoPicture),w.effect==="montage"?y.transition="BLACK":w.effect==="spread"?y.transition="SPREAD":y.transition="FADE",(w.effect==="zoomin"||w.effect==="zoomout")&&(y.progress=Math.pow(N,3)),N<1&&w.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(w.position)},q=this.panoPictureObserverMap.get(y.pano0);q&&this.panoPictureObserverMap.set(D,q),y.pano0=D}O.copy(F),C=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(O.x+(F.x-O.x)*N,O.y+(F.y-O.y)*N,O.z+(F.z-O.z)*N);for(var z=[],j=[],J=0,V=this.locationMotion.keyframes;J<V.length;J++){var U=V[J],G=U.key,Z=U.progress;G!==void 0&&(z.push(G),Z>this.locationMotion.progress&&j.push(G))}for(var W=0,ee=Object.keys(this.panoResources);W<ee.length;W++){var X=ee[W];if(!(j.indexOf(X)>=0)){var K=this.panoResources[X];if(K.leftPanoPicture){var $=K.leftPanoPicture.map;if($){if($===((s=y.pano0)===null||s===void 0?void 0:s.map)||$===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;$.dispose(),K.leftPanoPicture=null}}z.indexOf(X)>=0||delete this.panoResources[X]}}var re=panoParse(w.panoId);re!==this.currentPano&&(this.currentPano=re,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(M.panoId),state:__assign(__assign(__assign(__assign({},panoParse(B.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 ne=A,ae=ne[1],le=new THREE__namespace.Vector3(0,0,0),se=new THREE__namespace.Vector2().copy(this.camera.resolution);if(ae&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){var ce=this.xrManager.cameraVR,me=this.xrManager.referenceSpace,Ae=this.xrManager.session.renderState.baseLayer,be=ae.getViewerPose(me),de=(l=be==null?void 0:be.views)!==null&&l!==void 0?l:[];this.renderer.setFramebuffer(Ae.framebuffer);for(var he=0;he<de.length;he++){var fe=de[he],te=ce.cameras[he],ue=Ae.getViewport(fe);ue&&(te.projectionMatrix.fromArray(fe.projectionMatrix),te.projectionMatrixInverse.getInverse(te.projectionMatrix),te.matrix.fromArray(fe.transform.matrix),te.matrix.setPosition(this.camera.position),te.matrix.decompose(te.position,te.quaternion,te.scale),te.matrixWorld.copy(te.matrix),te.matrixWorldInverse.getInverse(te.matrixWorld),te.matrixAutoUpdate=!1,le.copy(te.position),te.viewport.set(ue.x,ue.y,ue.width,ue.height),se.set(ue.width,ue.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&&this.xrManager.session.inputSources){for(var he=0;he<this.xrManager.session.inputSources.length;he++)if(this.xrManager.session.inputSources[he]&&this.xrManager.session.inputSources[he].targetRayMode==="transient-pointer"){var Te=ae.getPose(this.xrManager.session.inputSources[he].targetRaySpace,me);if(Te){var xe=Te.transform.orientation,Xe=new THREE__namespace.Quaternion(xe.x,xe.y,xe.z,xe.w),Je=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(Xe),ze=new THREE__namespace.Raycaster(this.camera.position,Je);this.gazeRay=ze}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var ve=this.xrManager.session.inputSources,Ge=function(pe){var Re=ye.xrManager.controllers[pe],we=ve[pe];if(!we)return"continue";Re&&Re.update(we,ae,me);var Le=ye.xrManager.getController(pe),Bt=new THREE__namespace.Vector3(0,1.2,0),ut=Le.position.clone().add(le).sub(Bt);we.handedness==="left"?ye.xrControllerRay.left.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(Le.rotation)):we.handedness==="right"&&ye.xrControllerRay.right.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(Le.rotation)),ye.controllerWrappers[pe].position.copy(new THREE__namespace.Vector3(0,0,0).add(le).sub(Bt));var rt=ye.modelScene.intersectRaycaster(ye.xrControllerRay.right);if(rt.length===0){var Ft=ye.works.getResolvedObserver(ye.currentPano);rt=ye.xrControllerRay.right.intersectObject(ye.boundingMesh,!0).map(function($e){var Fe,lt=(Fe=Ft==null?void 0:Ft.floorIndex)!==null&&Fe!==void 0?Fe:0;return __assign({floorIndex:lt,floor:lt},$e)})}if(rt.length>=1&&rt[0].face)if(we.handedness==="right"){var P=ye.xrControllerRay.right.intersectObject(ye.xrCustomObjectsScene,!0),H=rt[0].face.normal,k=H.clone(),Q=rt[0].point.clone();ye.intersectMesh.position.copy(Q);var Y=Q.clone().add(k);if(ye.intersectMesh.lookAt(Y),Math.abs(H.y)>.99){var oe=ye.camera.position.clone().sub(Q);ye.intersectMesh.rotation.z=-Math.atan2(oe.z,oe.x)}ye.intersectMesh.visible=!0,ye.needsRender=!0,P.length>0?(ye.pointerLines.right.setPoints(ut,P[0].point),ye.pointerLines.right.points.visible=!0,ye.intersectMesh.visible=!1):(ye.pointerLines.right.points.visible=!1,ye.pointerLines.right.setPoints(ut,rt[0].point));var Ee=rt[0],ke=createEvent("intersect.update",{raycaster:(p=ye.xrControllerRay.right)!==null&&p!==void 0?p:null,intersection:Ee!=null?Ee:null,object:ye.intersectMesh});if(ye.emit("intersect.update",ke),ke.defaultPrevented)return ye.hideIntersectMesh(),{value:void 0}}else ye.pointerLines.left.setPoints(ut,rt[0].point)},ye=this,he=0;he<ve.length;he++){var Ne=Ge(he);if(typeof Ne=="object")return Ne.value}this.updateControllerHelper(ve,e,r)}}else ae||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 Be=this.works.getResolvedObserver(this.currentPano),Ye=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,nt=this.works.getObserver(R.panoId),De=this.works.getObserver(w.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Be){for(var qe=[],He=Be.work.observers,ge=0,Se=Be.accessibleNodes;ge<Se.length;ge++){var Me=Se[ge],q=He[Me];q&&qe.push(q)}var je=new Map;if(qe.sort(function(pe,Re){var we=je.get(pe);typeof we=="undefined"&&(we=pe.standingPosition.distanceTo(Be.standingPosition),je.set(pe,we));var Le=je.get(pe);return typeof Le=="undefined"&&(Le=Re.standingPosition.distanceTo(Be.standingPosition),je.set(Re,Le)),we-Le}),qe.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%qe.length;var Ue=qe[this.accessibleObserverFloorCheckCount],tt=this.modelScene.models.find(function(pe){return pe.work===(Ue==null?void 0:Ue.work)});if(Ue&&tt&&tt.visible){var dt=.3,Ve=.05,Ct=.005,Ie=Ue.standingPosition.clone().applyMatrix4(Ue.work.transform),Oe=panoStringify({panoIndex:Ue.panoIndex,workCode:Ue.work.workCode}),gt=adjustPanoCircleMeshVectors.map(function(pe){scratchRaycaster.ray.origin.copy(Ie),scratchRaycaster.ray.origin.add(scratchVector3.copy(pe).setY(dt)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var Re=tt.intersectRaycaster(scratchRaycaster)[0];return Re&&Re.distance-Ct<=dt?new THREE__namespace.Vector3().copy(Ie).setY(Re.point.y+Ct):Ie});gt.sort(function(pe,Re){return Re.y-pe.y});var Mt=gt[Math.floor(gt.length/2)],At=gt.filter(function(pe){return pe.distanceTo(Mt)<=Ve})[0];if(At){var ht=new THREE__namespace.Vector4(Ie.x,Ie.y,Ie.z,At.y-Ie.y),_t=this.adjustPanoCircleMeshPositionFix.get(Oe);_t&&!ht.equals(_t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Oe,ht)}}this.accessibleObserverFloorCheckCount++}}var Ke=new Map;if(nt)for(var Ze=0,at=nt.accessibleNodes;Ze<at.length;Ze++){var Me=at[Ze],q=nt.work.observers[Me];if(q){var Oe=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});Ke.set(Oe,q)}}if(De)for(var Qe=0,ie=De.accessibleNodes;Qe<ie.length;Qe++){var Me=ie[Qe],q=De.work.observers[Me];if(q){var Oe=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});Ke.set(Oe,q)}}if(this.panoMeshes.forEach(function(pe,Re){var we=Ke.get(Re);if(we){pe.position.copy(we.standingPosition).applyMatrix4(we.work.transform);var Le=o.adjustPanoCircleMeshPositionFix.get(Re);Le&&(scratchVector3.set(Le.x,Le.y,Le.z),scratchVector3.equals(pe.position)&&(pe.position.y+=Le.w)),pe.scale.setScalar(1.2),Ke.delete(Re)}else o.helper.remove(pe),pe.dispose(),o.panoMeshes.delete(Re)}),Ke.forEach(function(pe,Re){var we=o.panoCircleMeshCreator(panoParse(Re));we.position.copy(pe.standingPosition).applyMatrix4(pe.work.transform);var Le=o.adjustPanoCircleMeshPositionFix.get(Re);Le&&(scratchVector3.set(Le.x,Le.y,Le.z),scratchVector3.equals(we.position)&&(we.position.y+=Le.w)),we.scale.setScalar(1.2),o.panoMeshes.set(Re,we),o.helper.add(we),Ke.delete(Re)}),this.camera.pose.distance>.1||C)this.panoMeshes.forEach(function(pe){pe.setOpacity(0),pe.setCurrent(!1),pe.updateTime&&pe.updateTime(e,r),pe.visible=!1});else if(Be){var _e=Be.work.observers,Pe=arrayMin(Be.accessibleNodes,function(pe){var Re=_e[pe];return Re?Be.standingPosition.distanceTo(Re.standingPosition):1/0},!0),Ce=Pe[1];Ce=clamp$1(Ce,2.5,1/0);var yt=Be.visibleNodes.concat(Be.panoIndex).map(function(pe){return panoStringify({panoIndex:pe,workCode:Be.work.workCode})}),ct=this.camera.getDirection(new THREE__namespace.Vector3);this.panoMeshes.forEach(function(pe,Re){var we=o.works.getObserver(Re);if(yt.indexOf(Re)===-1)pe.setCurrent(!1),pe.setOpacity(0);else if(!we)pe.setCurrent(!1),pe.setOpacity(0);else if(!we.loadable&&!we.active)pe.setCurrent(!1),pe.setOpacity(0);else{var Le=pe.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);pe.setCurrent(!pe.loading&&pe.progress===0&&Ye!==null&&panoStringify({panoIndex:Ye.panoIndex,workCode:Ye.work.workCode})===Re),pe.setOpacity(Le<.01?0:clamp$1(Ce/Le*1.2,.65,.98));var Bt=o.camera.position.clone().setY(pe.position.y),ut=new THREE__namespace.Vector3().copy(pe.position).sub(Bt).normalize();if(Re===panoStringify(o.currentPano)){var rt=clamp$1((.5-Bt.distanceTo(pe.position))/.5,0,1);ut.multiplyScalar(1-rt).add(ct.clone().multiplyScalar(rt))}ut.length()>0&&pe.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(ut.x,ut.z),0))}pe.updateTime&&pe.updateTime(e,r)})}{var N=(f=this.modelScene.parameter.progress)!==null&&f!==void 0?f:1,Et=Math.round(N),it=this.modelScene.parameter.pano0,pt=this.modelScene.parameter.pano1,bt=Et===0?it:pt,q=void 0;if(bt&&(q=this.works.getObserver(bt.panoId),q||(q=this.panoPictureObserverMap.get(bt))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=N<.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!q||!bt||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var It={renderer:this.renderer,resolution:se,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(It),this.modelScene.parameter.set("refinedScreen",null)}else{var ot=getImageSizeLevel(bt.mapSize),Pt=ot+1,Tt=4;this.tiling.setObserver(q);var It={renderer:this.renderer,resolution:se,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:bt.map,panoMatrix:bt.matrix,panoZoom:bt.zoom,minLevel:Pt,level:Tt},vt=this.tiling.update(It),xt={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Et,opacity:(it==null?void 0:it.panoId)===(pt==null?void 0:pt.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},We=this.modelScene.parameter.refinedScreen;(vt||xt.pano!==(We==null?void 0:We.pano)||xt.opacity!==(We==null?void 0:We.opacity))&&this.modelScene.parameter.set("refinedScreen",xt)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&Be&&Be.position.y-Be.standingPosition.y>10){var mt=this.camera.position.distanceTo(this.intersectMesh.position),Ot=2*Math.tan(.5*this.camera.fov/180*Math.PI),Lt=mt*Ot/5;this.intersectMesh.scale.setScalar(Lt)}else this.intersectMesh.scale.setScalar(1);{var Ht=w.effect,st=this.modelScene.parameter,it=st.pano0,pt=st.pano1;if(it&&pt&&it!==pt&&Ht==="fly"&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==it.panoId||((m=this.modelScene.parameter.pano1Depth)===null||m===void 0?void 0:m.panoId)!==pt.panoId){var St=500,ft=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==ft&&this.pano0DepthCubeRenderTarget.setSize(ft,ft):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ft,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==ft&&this.pano1DepthCubeRenderTarget.setSize(ft,ft):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ft,{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(it.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,St);var wt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);wt.matrix.copy(pt.matrix),wt.matrixWorld.copy(wt.matrix),wt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,wt,St),this.modelScene.parameter.set({pano0Depth:{panoId:it.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:St},pano1Depth:{panoId:pt.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:St}})}}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(){this.renderer.setScissorTest(!1);var e=this.xrManager.cameraVR;this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},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 p=e[c].handedness,f=e[c].gamepad;switch(p){case"left":f.axes&&(this.emitHandleEvent(f.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(f.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(f.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(f.axes[3]===1,"LeftAxesDown",r)),f!=null&&f.buttons&&(f.buttons[4]&&this.emitHandleEvent(f.buttons[4].pressed,"X",r),f.buttons[5]&&this.emitHandleEvent(f.buttons[5].pressed,"Y",r),f.buttons[0]&&this.emitHandleEvent(f.buttons[0].pressed,"LeftTrigger",r),f.buttons[1]&&this.emitHandleEvent(f.buttons[1].pressed,"LeftPinch",r));var d={raycaster:s,axes:{up:f.axes&&f.axes[3]<0?Math.abs(f.axes[3]):0,down:f.axes&&f.axes[3]<0?0:Math.abs(f.axes[3]),left:f.axes&&f.axes[2]<0?Math.abs(f.axes[2]):0,right:f.axes&&f.axes[2]<0?0:Math.abs(f.axes[2])},deltaTime:o};l.buttons.X=f.buttons&&f.buttons[4]?f.buttons[4].pressed:!1,l.buttons.Y=f.buttons&&f.buttons[5]?f==null?void 0:f.buttons[5].pressed:!1,l.buttons.LeftTrigger=f.buttons&&f.buttons[0]?f==null?void 0:f.buttons[0].pressed:!1,l.buttons.LeftPinch=f.buttons&&f.buttons[1]?f==null?void 0:f.buttons[1].pressed:!1,l.left=d;break;case"right":f.axes&&(this.emitHandleEvent(f.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(f.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(f.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(f.axes[3]===1,"RightAxesDown",r)),f.buttons&&(f.buttons[4]&&this.emitHandleEvent(f.buttons[4].pressed,"A",r),f.buttons[5]&&this.emitHandleEvent(f.buttons[5].pressed,"B",r),f.buttons[0]&&this.emitHandleEvent(f.buttons[0].pressed,"RightTrigger",r),f.buttons[1]&&this.emitHandleEvent(f.buttons[1].pressed,"RightPinch",r));var h={raycaster:u,axes:{up:f.axes&&f.axes[3]<0?Math.abs(f.axes[3]):0,down:f.axes&&f.axes[3]<0?0:Math.abs(f.axes[3]),left:f.axes&&f.axes[2]<0?Math.abs(f.axes[2]):0,right:f.axes&&f.axes[2]<0?0:Math.abs(f.axes[2])},deltaTime:o};l.right=h,l.buttons.A=f.buttons&&f.buttons[4]?f==null?void 0:f.buttons[4].pressed:!1,l.buttons.B=f.buttons&&f.buttons[5]?f==null?void 0:f.buttons[5].pressed:!1,l.buttons.RightTrigger=f.buttons&&f.buttons[0]?f==null?void 0:f.buttons[0].pressed:!1,l.buttons.RightPinch=f.buttons&&f.buttons[1]?f==null?void 0:f.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}}}),p=this.emit("xr.gesture.tap",c);!p&&!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],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),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("="),p=(t=c[0])===null||t===void 0?void 0:t.trim(),f=(e=c[1])===null||e===void 0?void 0:e.trim();p&&f&&(r[p]=f)}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,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";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$4=new THREE__namespace.BufferGeometry;geometry$4.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3));geometry$4.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2));geometry$4.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh$4=new THREE__namespace.Mesh(geometry$4,material);mesh$4.matrixAutoUpdate=!1;var scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4);scene$2.matrixAutoUpdate=!1;var camera$2=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera$2.position.set(0,0,.5);camera$2.lookAt(0,0,0);camera$2.updateMatrixWorld(!0);camera$2.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,p=imageSize[0]/3,f=imageSize[1]/3;n.setViewport(l,c,p,f),n.setScissor(l,c,p,f),n.setScissorTest(!0),n.autoClear=!1,n.render(scene$2,camera$2),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 FRAGMENT$2=`
2133
+ `},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,p=0,f=r.count;c<f;c++,p+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[p]=p===0?0:s[p-1],s[p+1]=s[p]+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,p=c.resolution,f=c.linewidth,d=l.attributes.instanceStart,h=l.attributes.instanceEnd,m=new THREE__namespace.Vector4,A=new THREE__namespace.Vector4,g=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,E=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,g),g.w=1,g.applyMatrix4(s.matrixWorldInverse),g.applyMatrix4(u),g.multiplyScalar(1/g.w),g.x*=p.x/2,g.y*=p.y/2,g.z=0,y.copy(g);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){m.fromBufferAttribute(d,_),A.fromBufferAttribute(h,_),m.w=1,A.w=1,m.applyMatrix4(v),A.applyMatrix4(v),m.applyMatrix4(u),A.applyMatrix4(u),m.multiplyScalar(1/m.w),A.multiplyScalar(1/A.w);var R=m.z<-1&&A.z<-1,w=m.z>1&&A.z>1;if(!(R||w)){m.x*=p.x/2,m.y*=p.y/2,A.x*=p.x/2,A.y*=p.y/2,E.start.copy(m),E.start.z=0,E.end.copy(A),E.end.z=0;var M=E.closestPointToPointParameter(y,!0);E.at(M,b);var B=THREE__namespace.MathUtils.lerp(m.z,A.z,M),C=B>=-1&&B<=1,I=y.distanceTo(b)<f*.5;if(C&&I){E.start.fromBufferAttribute(d,_),E.end.fromBufferAttribute(h,_),E.start.applyMatrix4(T),E.end.applyMatrix4(T);var L=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3;o.distanceSqToSegment(E.start,E.end,O,L),r.push({point:O,pointOnLine:L,distance:o.origin.distanceTo(O),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.8"},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,p,f,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(m){var A=u[m];return A&&(l={profileId:m,profilePath:"".concat(r,"/").concat(A.path),deprecated:!!A.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(p=h.sent(),s){if(d=void 0,d=p.layouts[e.handedness],!d)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));d.assetPath&&(f=l.profilePath.replace("profile.json",d.assetPath))}return[2,{profile:p,assetPath:f}]}})})}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,p=o.valueNodeProperty;s&&(p===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:p===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(p){var f=p.valueNodeName,d=p.minNodeName,h=p.maxNodeName,m=p.valueNodeProperty;if(m===Constants.VisualResponseProperty.TRANSFORM){if(p.minNode=t.getObjectByName(d),p.maxNode=t.getObjectByName(h),!p.minNode){console.warn("Could not find ".concat(d," in the model"));return}if(!p.maxNode){console.warn("Could not find ".concat(h," in the model"));return}}p.valueNode=t.getObjectByName(f),p.valueNode||console.warn("Could not find ".concat(f," 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,p=l.assetPath;r.motionController=new MotionController(u,c,p);var f=e._assetCache[r.motionController.assetUrl];if(f)o=f.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,p){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(f){var d;return parseGltf(f.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(d=c.split("?")[1])!==null&&d!==void 0?d:"",fetcher:internalFetcher})}).then(function(f){return p(f)})}},(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",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 p=r.xrManager.getControllerGrip(1);p.add(u.createControllerModel(p)),r.controllerWrappers[1].add(p)}),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=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),f=this.works.getObserver(e);if(!f)throw new Error("Invalid PanoIndex");getImageSizeFromURL(f.images.up),this.imageOptions.size;var d=this.imageOptions.transform,h=function(R,w){return mapPanoResource(applyImageURLOptions(R,d,w))},m=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality"])),A={right:f.images.work.getURL(f.images.right),left:f.images.work.getURL(f.images.left),up:f.images.work.getURL(f.images.up),down:f.images.work.getURL(f.images.down),front:f.images.work.getURL(f.images.front),back:f.images.work.getURL(f.images.back)},g="pano:"+jsonHash([A,m,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)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:e}))}var v=this.modelScene.parameter.resolveValue(),E=v.pano0,b=v.pano1,T;if((E==null?void 0:E.map.name)===g?T=E:(b==null?void 0:b.map.name)===g&&(T=b),T){var _={panoId:p,effect:c,leftPanoPicture:{panoId:T.panoId,map:T.map,mapSize:T.mapSize,matrix:f.matrix.clone().premultiply(f.work.transform),zoom:1},position:f.position.clone().applyMatrix4(f.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,_,r);return}var S="move-to-pano-"+p;this.pending.add(S),this.pendingTextureTask={panoId:p,hash:g,onLoad:function(R){var w,M=R.body;if(s.destroyed)M.dispose();else{M.name=g;var B=Array.isArray(M.image)?M.image[0]:M.image,C=(w=B==null?void 0:B.width)!==null&&w!==void 0?w:2048,I={panoId:p,effect:c,leftPanoPicture:{panoId:p,map:M,mapSize:C,matrix:f.matrix.clone(),zoom:1},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,I,r)}},onError:function(R){var w=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:R,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),r.moveCancelCallback&&r.moveCancelCallback()}},this.textureLoader.loadCubeTexture(A,{imageURL:{transform:h,options:m},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(f.work)},void 0,void 0,function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g&&((M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(R)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:R,meta:null,pano:e}))},this.renderer).then(function(R){var w,M;s.pending.delete(S),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g?(s.pendingTextureTask.onLoad(R),s.pendingTextureTask=void 0,(M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(0)):R.body.dispose(),s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:R.meta,pano:e}))}).catch(function(R){var w,M;s.pending.delete(S),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g&&(s.pendingTextureTask.onError(R),s.pendingTextureTask=void 0,(M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(0)),s.emit("pano.texture.error",createEvent("pano.texture.error",{error:R,progress:0,meta:null,pano:e})),s.emit("error",R)}),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,p,f,d,h,m,A,g;o===void 0&&(o={});var y=now(),v=createUuid();this.panoResources[v]=r;var E=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(y);S[0];var R=S[1],w=this.locationMotion.value,M=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position;b=Math.max(M.distanceTo(B),E),T=[{key:R.key,progress:0,value:__assign(__assign({},w),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(y),I=C[0],R=C[1],w=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(I).position,M=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position,O=R.value.count-w.count,F=Math.max(L.distanceTo(M),E)*O,N=Math.max(M.distanceTo(B),E);b=F+N,T=[{key:I.key,progress:0,value:__assign({},w)},{key:R.key,progress:F/b,value:R.value},{key:v,progress:1,value:{count:R.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"?b:0),j={longitude:o.longitude,latitude:o.latitude,fov:o.fov},J=__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}),V=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:V,progress:0,state:J,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(J),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")this.cameraMotion.set(j,z).catch(noop);else{var U=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),G=coordinatesToVector({longitude:(p=j.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(f=j.latitude)!==null&&f!==void 0?f:this.cameraMotion.value.latitude}),Z=new THREE__namespace.Object3D;Z.lookAt(U);var W=new THREE__namespace.Matrix4().makeRotationFromQuaternion(Z.quaternion);Z.lookAt(G);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(Z.quaternion),X=new THREE__namespace.Matrix4().getInverse(W).premultiply(ee),K=this.cameraMotion.value.fov,$=(d=j.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,re=1;r.effect==="zoomin"?re=1.5:r.effect==="zoomout"&&(re=.4);for(var ne=$*re,ae=0;ae<T.length-1;ae++){var le=T[ae].key;if(le){var se=this.panoResources[le];se&&(se.fixCameraTransform.copy(X),se.leftPanoPicture&&(se.leftPanoPicture.zoom=Math.tan(ne/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=j.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(m=j.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:ne}},{progress:1,value:{longitude:(A=j.longitude)!==null&&A!==void 0?A:this.cameraMotion.value.longitude,latitude:(g=j.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:$}}],z).catch(noop)}var ce=this.locationMotion.setKeyframes(T,z,_);ce.then(function(){for(var me=0,Ae=s.modelScene.children;me<Ae.length;me++){var be=Ae[me];be instanceof Model&&be.show()}var de=__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:V,progress:1,state:de,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(de);var he=s.works.getObserver(s.currentPano);if(he&&he.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var fe={map:s.videoTexture,size:he.video.size.clone(),matrix:he.video.matrix.clone(),panoMatrix:he.matrix.clone().premultiply(he.work.transform),alpha:1},te=createUuid(),ue=s.videoTexture.image;ue.setAttribute("uuid",te),canplayVideo().then(function(Te){Te&&he.video&&ue.getAttribute("uuid")===te&&(ue.oncanplay=function(){ue.oncanplay=noop,ue.play()},ue.ontimeupdate=function(){ue.currentTime>.5&&(ue.ontimeupdate=noop,s.panoVideo.setMaterial(fe))},ue.src=he.video.source)}).catch((function(){ue.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:V,progress:0,state:J,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 R=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return R.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),p=this.modelScene.intersectRaycaster(e)[0];if(p){var f=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var R=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return R.distanceTo(p.point)},!0),d=f[0],h=f[1];typeof d=="number"&&h<this.panoTapTriggerRadius&&(s=(o=l[d])!==null&&o!==void 0?o:null)}if(isNil(s)){var m=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);m&&(s=m)}for(var A=0,g=this.locationMotion.keyframes;A<g.length;A++){var y=g[A],v=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&s){var E=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===E){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var E=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(E);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,p,f,d,h,m,A=[],g=2;g<arguments.length;g++)A[g-2]=arguments[g];this.userAction=!0;var y={},v={},E=this.locationMotion.keyframes[0],b=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],T=this.locationMotion.getKeyFrameSegment(e),_=T[0],S=T[1],R=this.panoResourceFromLocationMotionKeyframe(_),w=this.panoResourceFromLocationMotionKeyframe(S),M=this.panoResourceFromLocationMotionKeyframe(E),B=this.panoResourceFromLocationMotionKeyframe(b),C=!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 I=this.locationMotion.getKeyFrameSegment(e);I[0];var L=I[1],O=new THREE__namespace.Vector3().copy(R.position),F=new THREE__namespace.Vector3().copy(w.position),N=this.locationMotion.value.count-L.value.count+1;if(y.progress=N,w.leftPanoPicture&&(N<1?R.leftPanoPicture&&(y.pano0=R.leftPanoPicture):y.pano0=w.leftPanoPicture,y.pano1=w.leftPanoPicture),w.effect==="montage"?y.transition="BLACK":w.effect==="spread"?y.transition="SPREAD":y.transition="FADE",(w.effect==="zoomin"||w.effect==="zoomout")&&(y.progress=Math.pow(N,3)),N<1&&w.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(w.position)},q=this.panoPictureObserverMap.get(y.pano0);q&&this.panoPictureObserverMap.set(D,q),y.pano0=D}O.copy(F),C=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(O.x+(F.x-O.x)*N,O.y+(F.y-O.y)*N,O.z+(F.z-O.z)*N);for(var z=[],j=[],J=0,V=this.locationMotion.keyframes;J<V.length;J++){var U=V[J],G=U.key,Z=U.progress;G!==void 0&&(z.push(G),Z>this.locationMotion.progress&&j.push(G))}for(var W=0,ee=Object.keys(this.panoResources);W<ee.length;W++){var X=ee[W];if(!(j.indexOf(X)>=0)){var K=this.panoResources[X];if(K.leftPanoPicture){var $=K.leftPanoPicture.map;if($){if($===((s=y.pano0)===null||s===void 0?void 0:s.map)||$===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;$.dispose(),K.leftPanoPicture=null}}z.indexOf(X)>=0||delete this.panoResources[X]}}var re=panoParse(w.panoId);re!==this.currentPano&&(this.currentPano=re,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(M.panoId),state:__assign(__assign(__assign(__assign({},panoParse(B.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 ne=A,ae=ne[1],le=new THREE__namespace.Vector3(0,0,0),se=new THREE__namespace.Vector2().copy(this.camera.resolution);if(ae&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){var ce=this.xrManager.cameraVR,me=this.xrManager.referenceSpace,Ae=this.xrManager.session.renderState.baseLayer,be=ae.getViewerPose(me),de=(l=be==null?void 0:be.views)!==null&&l!==void 0?l:[];this.renderer.setFramebuffer(Ae.framebuffer);for(var he=0;he<de.length;he++){var fe=de[he],te=ce.cameras[he],ue=Ae.getViewport(fe);ue&&(te.projectionMatrix.fromArray(fe.projectionMatrix),te.projectionMatrixInverse.getInverse(te.projectionMatrix),te.matrix.fromArray(fe.transform.matrix),te.matrix.setPosition(this.camera.position),te.matrix.decompose(te.position,te.quaternion,te.scale),te.matrixWorld.copy(te.matrix),te.matrixWorldInverse.getInverse(te.matrixWorld),te.matrixAutoUpdate=!1,le.copy(te.position),te.viewport.set(ue.x,ue.y,ue.width,ue.height),se.set(ue.width,ue.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&&this.xrManager.session.inputSources){for(var he=0;he<this.xrManager.session.inputSources.length;he++)if(this.xrManager.session.inputSources[he]&&this.xrManager.session.inputSources[he].targetRayMode==="transient-pointer"){var Te=ae.getPose(this.xrManager.session.inputSources[he].targetRaySpace,me);if(Te){var xe=Te.transform.orientation,Xe=new THREE__namespace.Quaternion(xe.x,xe.y,xe.z,xe.w),Je=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(Xe),ze=new THREE__namespace.Raycaster(this.camera.position,Je);this.gazeRay=ze}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var ve=this.xrManager.session.inputSources,Ge=function(pe){var Re=ye.xrManager.controllers[pe],we=ve[pe];if(!we)return"continue";Re&&Re.update(we,ae,me);var Le=ye.xrManager.getController(pe),Bt=new THREE__namespace.Vector3(0,1.2,0),ut=Le.position.clone().add(le).sub(Bt);we.handedness==="left"?ye.xrControllerRay.left.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(Le.rotation)):we.handedness==="right"&&ye.xrControllerRay.right.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(Le.rotation)),ye.controllerWrappers[pe].position.copy(new THREE__namespace.Vector3(0,0,0).add(le).sub(Bt));var rt=ye.modelScene.intersectRaycaster(ye.xrControllerRay.right);if(rt.length===0){var Ft=ye.works.getResolvedObserver(ye.currentPano);rt=ye.xrControllerRay.right.intersectObject(ye.boundingMesh,!0).map(function($e){var Fe,lt=(Fe=Ft==null?void 0:Ft.floorIndex)!==null&&Fe!==void 0?Fe:0;return __assign({floorIndex:lt,floor:lt},$e)})}if(rt.length>=1&&rt[0].face)if(we.handedness==="right"){var P=ye.xrControllerRay.right.intersectObject(ye.xrCustomObjectsScene,!0),H=rt[0].face.normal,k=H.clone(),Q=rt[0].point.clone();ye.intersectMesh.position.copy(Q);var Y=Q.clone().add(k);if(ye.intersectMesh.lookAt(Y),Math.abs(H.y)>.99){var oe=ye.camera.position.clone().sub(Q);ye.intersectMesh.rotation.z=-Math.atan2(oe.z,oe.x)}ye.intersectMesh.visible=!0,ye.needsRender=!0,P.length>0?(ye.pointerLines.right.setPoints(ut,P[0].point),ye.pointerLines.right.points.visible=!0,ye.intersectMesh.visible=!1):(ye.pointerLines.right.points.visible=!1,ye.pointerLines.right.setPoints(ut,rt[0].point));var Ee=rt[0],ke=createEvent("intersect.update",{raycaster:(p=ye.xrControllerRay.right)!==null&&p!==void 0?p:null,intersection:Ee!=null?Ee:null,object:ye.intersectMesh});if(ye.emit("intersect.update",ke),ke.defaultPrevented)return ye.hideIntersectMesh(),{value:void 0}}else ye.pointerLines.left.setPoints(ut,rt[0].point)},ye=this,he=0;he<ve.length;he++){var Ne=Ge(he);if(typeof Ne=="object")return Ne.value}this.updateControllerHelper(ve,e,r)}}else ae||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 Be=this.works.getResolvedObserver(this.currentPano),Ye=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,nt=this.works.getObserver(R.panoId),De=this.works.getObserver(w.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Be){for(var qe=[],He=Be.work.observers,ge=0,Se=Be.accessibleNodes;ge<Se.length;ge++){var Me=Se[ge],q=He[Me];q&&qe.push(q)}var je=new Map;if(qe.sort(function(pe,Re){var we=je.get(pe);typeof we=="undefined"&&(we=pe.standingPosition.distanceTo(Be.standingPosition),je.set(pe,we));var Le=je.get(pe);return typeof Le=="undefined"&&(Le=Re.standingPosition.distanceTo(Be.standingPosition),je.set(Re,Le)),we-Le}),qe.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%qe.length;var Ue=qe[this.accessibleObserverFloorCheckCount],tt=this.modelScene.models.find(function(pe){return pe.work===(Ue==null?void 0:Ue.work)});if(Ue&&tt&&tt.visible){var dt=.3,Ve=.05,Ct=.005,Ie=Ue.standingPosition.clone().applyMatrix4(Ue.work.transform),Oe=panoStringify({panoIndex:Ue.panoIndex,workCode:Ue.work.workCode}),gt=adjustPanoCircleMeshVectors.map(function(pe){scratchRaycaster.ray.origin.copy(Ie),scratchRaycaster.ray.origin.add(scratchVector3.copy(pe).setY(dt)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var Re=tt.intersectRaycaster(scratchRaycaster)[0];return Re&&Re.distance-Ct<=dt?new THREE__namespace.Vector3().copy(Ie).setY(Re.point.y+Ct):Ie});gt.sort(function(pe,Re){return Re.y-pe.y});var Mt=gt[Math.floor(gt.length/2)],At=gt.filter(function(pe){return pe.distanceTo(Mt)<=Ve})[0];if(At){var ht=new THREE__namespace.Vector4(Ie.x,Ie.y,Ie.z,At.y-Ie.y),_t=this.adjustPanoCircleMeshPositionFix.get(Oe);_t&&!ht.equals(_t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Oe,ht)}}this.accessibleObserverFloorCheckCount++}}var Ke=new Map;if(nt)for(var Ze=0,at=nt.accessibleNodes;Ze<at.length;Ze++){var Me=at[Ze],q=nt.work.observers[Me];if(q){var Oe=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});Ke.set(Oe,q)}}if(De)for(var Qe=0,ie=De.accessibleNodes;Qe<ie.length;Qe++){var Me=ie[Qe],q=De.work.observers[Me];if(q){var Oe=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});Ke.set(Oe,q)}}if(this.panoMeshes.forEach(function(pe,Re){var we=Ke.get(Re);if(we){pe.position.copy(we.standingPosition).applyMatrix4(we.work.transform);var Le=o.adjustPanoCircleMeshPositionFix.get(Re);Le&&(scratchVector3.set(Le.x,Le.y,Le.z),scratchVector3.equals(pe.position)&&(pe.position.y+=Le.w)),pe.scale.setScalar(1.2),Ke.delete(Re)}else o.helper.remove(pe),pe.dispose(),o.panoMeshes.delete(Re)}),Ke.forEach(function(pe,Re){var we=o.panoCircleMeshCreator(panoParse(Re));we.position.copy(pe.standingPosition).applyMatrix4(pe.work.transform);var Le=o.adjustPanoCircleMeshPositionFix.get(Re);Le&&(scratchVector3.set(Le.x,Le.y,Le.z),scratchVector3.equals(we.position)&&(we.position.y+=Le.w)),we.scale.setScalar(1.2),o.panoMeshes.set(Re,we),o.helper.add(we),Ke.delete(Re)}),this.camera.pose.distance>.1||C)this.panoMeshes.forEach(function(pe){pe.setOpacity(0),pe.setCurrent(!1),pe.updateTime&&pe.updateTime(e,r),pe.visible=!1});else if(Be){var _e=Be.work.observers,Pe=arrayMin(Be.accessibleNodes,function(pe){var Re=_e[pe];return Re?Be.standingPosition.distanceTo(Re.standingPosition):1/0},!0),Ce=Pe[1];Ce=clamp$1(Ce,2.5,1/0);var yt=Be.visibleNodes.concat(Be.panoIndex).map(function(pe){return panoStringify({panoIndex:pe,workCode:Be.work.workCode})}),ct=this.camera.getDirection(new THREE__namespace.Vector3);this.panoMeshes.forEach(function(pe,Re){var we=o.works.getObserver(Re);if(yt.indexOf(Re)===-1)pe.setCurrent(!1),pe.setOpacity(0);else if(!we)pe.setCurrent(!1),pe.setOpacity(0);else if(!we.loadable&&!we.active)pe.setCurrent(!1),pe.setOpacity(0);else{var Le=pe.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);pe.setCurrent(!pe.loading&&pe.progress===0&&Ye!==null&&panoStringify({panoIndex:Ye.panoIndex,workCode:Ye.work.workCode})===Re),pe.setOpacity(Le<.01?0:clamp$1(Ce/Le*1.2,.65,.98));var Bt=o.camera.position.clone().setY(pe.position.y),ut=new THREE__namespace.Vector3().copy(pe.position).sub(Bt).normalize();if(Re===panoStringify(o.currentPano)){var rt=clamp$1((.5-Bt.distanceTo(pe.position))/.5,0,1);ut.multiplyScalar(1-rt).add(ct.clone().multiplyScalar(rt))}ut.length()>0&&pe.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(ut.x,ut.z),0))}pe.updateTime&&pe.updateTime(e,r)})}{var N=(f=this.modelScene.parameter.progress)!==null&&f!==void 0?f:1,Et=Math.round(N),it=this.modelScene.parameter.pano0,pt=this.modelScene.parameter.pano1,bt=Et===0?it:pt,q=void 0;if(bt&&(q=this.works.getObserver(bt.panoId),q||(q=this.panoPictureObserverMap.get(bt))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=N<.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!q||!bt||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var It={renderer:this.renderer,resolution:se,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(It),this.modelScene.parameter.set("refinedScreen",null)}else{var ot=getImageSizeLevel(bt.mapSize),Pt=ot+1,Tt=4;this.tiling.setObserver(q);var It={renderer:this.renderer,resolution:se,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:bt.map,panoMatrix:bt.matrix,panoZoom:bt.zoom,minLevel:Pt,level:Tt},vt=this.tiling.update(It),xt={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Et,opacity:(it==null?void 0:it.panoId)===(pt==null?void 0:pt.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},We=this.modelScene.parameter.refinedScreen;(vt||xt.pano!==(We==null?void 0:We.pano)||xt.opacity!==(We==null?void 0:We.opacity))&&this.modelScene.parameter.set("refinedScreen",xt)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&Be&&Be.position.y-Be.standingPosition.y>10){var mt=this.camera.position.distanceTo(this.intersectMesh.position),Ot=2*Math.tan(.5*this.camera.fov/180*Math.PI),Lt=mt*Ot/5;this.intersectMesh.scale.setScalar(Lt)}else this.intersectMesh.scale.setScalar(1);{var Ht=w.effect,st=this.modelScene.parameter,it=st.pano0,pt=st.pano1;if(it&&pt&&it!==pt&&Ht==="fly"&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==it.panoId||((m=this.modelScene.parameter.pano1Depth)===null||m===void 0?void 0:m.panoId)!==pt.panoId){var St=500,ft=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==ft&&this.pano0DepthCubeRenderTarget.setSize(ft,ft):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ft,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==ft&&this.pano1DepthCubeRenderTarget.setSize(ft,ft):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ft,{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(it.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,St);var wt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);wt.matrix.copy(pt.matrix),wt.matrixWorld.copy(wt.matrix),wt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,wt,St),this.modelScene.parameter.set({pano0Depth:{panoId:it.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:St},pano1Depth:{panoId:pt.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:St}})}}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(){this.renderer.setScissorTest(!1);var e=this.xrManager.cameraVR;this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},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 p=e[c].handedness,f=e[c].gamepad;switch(p){case"left":f.axes&&(this.emitHandleEvent(f.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(f.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(f.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(f.axes[3]===1,"LeftAxesDown",r)),f!=null&&f.buttons&&(f.buttons[4]&&this.emitHandleEvent(f.buttons[4].pressed,"X",r),f.buttons[5]&&this.emitHandleEvent(f.buttons[5].pressed,"Y",r),f.buttons[0]&&this.emitHandleEvent(f.buttons[0].pressed,"LeftTrigger",r),f.buttons[1]&&this.emitHandleEvent(f.buttons[1].pressed,"LeftPinch",r));var d={raycaster:s,axes:{up:f.axes&&f.axes[3]<0?Math.abs(f.axes[3]):0,down:f.axes&&f.axes[3]<0?0:Math.abs(f.axes[3]),left:f.axes&&f.axes[2]<0?Math.abs(f.axes[2]):0,right:f.axes&&f.axes[2]<0?0:Math.abs(f.axes[2])},deltaTime:o};l.buttons.X=f.buttons&&f.buttons[4]?f.buttons[4].pressed:!1,l.buttons.Y=f.buttons&&f.buttons[5]?f==null?void 0:f.buttons[5].pressed:!1,l.buttons.LeftTrigger=f.buttons&&f.buttons[0]?f==null?void 0:f.buttons[0].pressed:!1,l.buttons.LeftPinch=f.buttons&&f.buttons[1]?f==null?void 0:f.buttons[1].pressed:!1,l.left=d;break;case"right":f.axes&&(this.emitHandleEvent(f.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(f.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(f.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(f.axes[3]===1,"RightAxesDown",r)),f.buttons&&(f.buttons[4]&&this.emitHandleEvent(f.buttons[4].pressed,"A",r),f.buttons[5]&&this.emitHandleEvent(f.buttons[5].pressed,"B",r),f.buttons[0]&&this.emitHandleEvent(f.buttons[0].pressed,"RightTrigger",r),f.buttons[1]&&this.emitHandleEvent(f.buttons[1].pressed,"RightPinch",r));var h={raycaster:u,axes:{up:f.axes&&f.axes[3]<0?Math.abs(f.axes[3]):0,down:f.axes&&f.axes[3]<0?0:Math.abs(f.axes[3]),left:f.axes&&f.axes[2]<0?Math.abs(f.axes[2]):0,right:f.axes&&f.axes[2]<0?0:Math.abs(f.axes[2])},deltaTime:o};l.right=h,l.buttons.A=f.buttons&&f.buttons[4]?f==null?void 0:f.buttons[4].pressed:!1,l.buttons.B=f.buttons&&f.buttons[5]?f==null?void 0:f.buttons[5].pressed:!1,l.buttons.RightTrigger=f.buttons&&f.buttons[0]?f==null?void 0:f.buttons[0].pressed:!1,l.buttons.RightPinch=f.buttons&&f.buttons[1]?f==null?void 0:f.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}}}),p=this.emit("xr.gesture.tap",c);!p&&!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],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),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("="),p=(t=c[0])===null||t===void 0?void 0:t.trim(),f=(e=c[1])===null||e===void 0?void 0:e.trim();p&&f&&(r[p]=f)}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,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";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$4=new THREE__namespace.BufferGeometry;geometry$4.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3));geometry$4.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2));geometry$4.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh$4=new THREE__namespace.Mesh(geometry$4,material);mesh$4.matrixAutoUpdate=!1;var scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4);scene$2.matrixAutoUpdate=!1;var camera$2=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera$2.position.set(0,0,.5);camera$2.lookAt(0,0,0);camera$2.updateMatrixWorld(!0);camera$2.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,p=imageSize[0]/3,f=imageSize[1]/3;n.setViewport(l,c,p,f),n.setScissor(l,c,p,f),n.setScissorTest(!0),n.autoClear=!1,n.render(scene$2,camera$2),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 FRAGMENT$2=`
2134
2134
  precision mediump float;
2135
2135
  precision mediump int;
2136
2136
  uniform sampler2D depthBuffer;
@@ -2246,4 +2246,4 @@ void main() {
2246
2246
  rgb = clamp(lumCompressed * rgb, 0.0, 1.0);
2247
2247
  gl_FragColor = mix(inputColor, vec4(rgb, alpha), progress * 0.9);
2248
2248
  }
2249
- `})||this;return r.material.transparent=!0,r}return Object.defineProperty(t.prototype,"luminanceAdaptiveBuffer",{get:function(){return this.material.uniforms.luminanceAdaptiveBuffer.value},set:function(e){this.material.uniforms.luminanceAdaptiveBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),t})(Pass),LuminanceAdaptiveEffect=(function(n){__extends(t,n);function t(e,r,o,s){var u=n.call(this,e,r,o,s)||this;return u.enableTime=now(),u.renderer=e,u.valuePass=new ValuePass(u.renderer),u.luminancePass=new LuminancePass(u.renderer,Math.sqrt(1/3)),u.nextStepPass=new NextStepPass(u.renderer,.01),u.luminanceAdaptivePass=new LuminanceAdaptivePass(u.renderer),u}return t.prototype.render=function(e){this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera),this.enableTime===null&&(this.enableTime=now()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new THREE__namespace.WebGLRenderTarget(128,128,{minFilter:THREE__namespace.LinearMipmapLinearFilter,magFilter:THREE__namespace.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:THREE__namespace.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(e[0],this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminanceNextBuffer),this.luminanceAdaptivePass.luminanceAdaptiveBuffer=this.luminanceNextBuffer.texture),this.copyPass.render(this.luminanceNextBuffer,this.luminancePrevBuffer),this.nextStepPass.render(this.luminancePrevBuffer,this.luminanceNextBuffer),this.luminanceAdaptivePass.progress=Math.min((now()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(e[0],e[1])},t.prototype.dispose=function(){var e,r,o;(e=this.luminanceTargetBuffer)===null||e===void 0||e.dispose(),(r=this.luminancePrevBuffer)===null||r===void 0||r.dispose(),(o=this.luminanceNextBuffer)===null||o===void 0||o.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},t})(Effect),sharedV2=new THREE__namespace.Vector2,LuminanceRenderer=(function(n){__extends(t,n);function t(e){var r,o,s=n.call(this,e)||this;s.type="default",s.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(s.renderer,s.modelScene,s.camera,s.modelScene);var u=s.renderer.getDrawingBufferSize(sharedV2);return s.screenBuffers=[new THREE__namespace.WebGLRenderTarget(u.x,u.y,{generateMipmaps:!1,encoding:(o=(r=s.renderer)===null||r===void 0?void 0:r.outputEncoding)!==null&&o!==void 0?o:THREE__namespace.sRGBEncoding}),s.enableFragDepth?s.modelRenderTarget:null],s}return t.prototype.render=function(e){var r=this.renderer.getRenderTarget();this.enableFragDepth?(e&&(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers)),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,r),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,r),this.renderer.setRenderTarget(r),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0):(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0),this.modelScene.needsRender=!0},t})(BaseRenderer),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=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,p,f,d,h,m,A,g=n.call(this)||this;if(g.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[g.ident]=g),g.renderSwitch01=0,g.currentUpdateArgs={time:now(),args:[]},g.currentMode="Panorama",g.pano={workCode:"",panoIndex:0},g.needsRender=!1,g.modelSceneNeedsRender=!1,g.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,g.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),g.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),g.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,g.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),g.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,g.extraElements=[],g.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)},g.fps={testCount:0,testTime:now()},g.modeChangeDuration=(p=e.modeChangeDuration)!==null&&p!==void 0?p:DEFAULT_MODE_CHANGE_DURATION,g.enableWheel=(f=e.enableWheel)!==null&&f!==void 0?f:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&g.throwError(new Error("cannot render a internal renderer")),g.renderer=e.renderer;else try{g.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var y=getViewportScale();g.renderer.setPixelRatio(y===1?window.devicePixelRatio:1),g.renderer.setSize(512,512),g.renderer.setClearColor(g.backgroundColor,g.backgroundAlpha)}catch(O){var v=O instanceof Error?O:new Error(String(O));g.throwError(v)}g.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=g.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),g.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),g.camera=new Camera(DEFAULT_CAMERA_FOV),g.scene=new Scene,g.xrCustomObjectsScene=new THREE__namespace.Scene,g.scene.add(g.xrCustomObjectsScene),g.scene.matrixAutoUpdate=!1,g.loadWorkTask=Promise.resolve(),g.requestProxy=(m=e.requestProxy)!==null&&m!==void 0?m:DEFAULT_REQUEST_PROXY,g.networkSubscribe=new NetworkSubscribe,g.networkSubscribe.on("network",function(O,F,N,D){var q;g.emit("network.resource",createEvent("network.resource",{source:O,requestType:F,requestState:N,detail:D})),(q=g.analysis)===null||q===void 0||q.network(g.works,O,F,N,D)}),g.boundingMesh=new BoundingMesh$1,g.boundingMesh.name="bounding",g.readyCallbacks=[],g.syncingState=!1,g.helperGroup=new THREE__namespace.Group,g.helperGroup.name="helper",g.helperGroup.matrixAutoUpdate=!1,g.scene.add(g.helperGroup);var E=new Model(emptyWorks[0]);worksMap.set(g,emptyWorks),g.modelScene=new ModelScene,g.modelScene.add(E),g.modelScene.add(g.boundingMesh),defineProperty(E,"loaded",{get:function(){return!1},set:function(O){}}),g.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var b=initLights();g.scene.add(b);var T=new THREE__namespace.Group;defineProperty(T,"children",{get:function(){return b.children},set:function(O){b.children=O}}),defineProperty(T,"visible",{get:function(){return b.visible},set:function(O){b.visible=O}}),defineProperty(T,"name",{get:function(){return b.name},set:function(O){b.name=O}}),g.modelScene.add(T),g.state={mode:g.currentMode,workCode:g.pano.workCode,panoIndex:g.pano.panoIndex,longitude:g.camera.pose.longitude,latitude:g.camera.pose.latitude,fov:g.camera.pose.fov,offset:g.camera.pose.offset.clone(),distance:g.camera.pose.distance},g.stateSynced=!1,g.destroyed=!1,g.paused=!0,typeof window!="undefined"&&(e.play!==!1&&g.play(),g.stopAnimationLoop=AnimationFrameLoop.shared.add(function(O,F){for(var N=[],D=2;D<arguments.length;D++)N[D-2]=arguments[D];g.updateTime.apply(g,__spreadArray([O,F],N,!1))},!1,0,10));var _=function(){typeof document!="undefined"&&document.fullscreenElement===null&&g.currentMode==="VRPanorama"&&g.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},S=function(){g.needsRender=!0,g.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",_,!1),g.renderer&&g.renderer.domElement.addEventListener("webglcontextrestored",S,!1),g.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",_,!1),g.renderer&&g.renderer.domElement.removeEventListener("webglcontextrestored",S,!1)},g.plugins={},e.plugins&&e.plugins.length)for(var R=0,w=e.plugins;R<w.length;R++){var M=w[R];if(typeof M=="function")M(g);else if(Array.isArray(M)){var B=M[0],C=M[1],I=M[2];if(typeof B=="function"){var L=B(g,I);typeof C=="string"&&(g.plugins[C]?g.throwError(new Error("plugin name ".concat(C," is exists."))):g.plugins[C]=L)}}}return initLegacyEvent(g),g.enableLayeringRendering=(A=e.enableLayeringRendering)!==null&&A!==void 0?A:!1,g._buildInRendererType="default",g._builtinRenderer=null,g}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.7"},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,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],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");for(var s=0,u=this.modelScene.children.slice();s<u.length;s++){var l=u[s];l.dispose&&l.dispose(),this.modelScene.remove(l)}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.renderer.setAnimationLoop(null)),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,this.modelSceneNeedsRender=!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.getBuiltinRenderer=function(e){var r=this._builtinRenderer;if((r==null?void 0:r.type)!==this._buildInRendererType)switch(r&&r.dispose(),this._buildInRendererType){case"default":this._builtinRenderer=new DefaultRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"edl":this._builtinRenderer=new EDLRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"hq":this._builtinRenderer=new HQRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"luminance":this._builtinRenderer=new LuminanceRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break}return this._builtinRenderer},Object.defineProperty(t.prototype,"renderEffect",{get:function(){return this._buildInRendererType},set:function(e){this._buildInRendererType=e,this.modelSceneNeedsRender=!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;if(e===void 0&&(e={}),!!this.renderer){var u=this.renderer.domElement,l=u.parentNode,c=e.width,p=c===void 0?(o=l==null?void 0:l.offsetWidth)!==null&&o!==void 0?o:512:c,f=e.height,d=f===void 0?(s=l==null?void 0:l.offsetHeight)!==null&&s!==void 0?s:512:f;r=r!=null?r:this.renderer.getPixelRatio();var h=this.renderer.capabilities.maxTextureSize,m=Math.max(p,d)*r;m>h&&(r=r/m*h,r=Math.floor(r*100)/100),this.renderer.setPixelRatio(r),this.renderer.setSize(p,d),this.needsRender=!0,this.modelSceneNeedsRender=!0;var A=now(),g=A-this.currentUpdateArgs.time,y=this.currentUpdateArgs.args;this.updateTime(A,g,y)}},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,p,f,d,h,m,A,g,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 E=[];if(Array.isArray(e))for(var b=0,T=e;b<T.length;b++){var _=T[b];_ instanceof Work?E.push(_):typeof _!="string"&&"work"in _?E.push(parseWork(_.work,_)):E.push(parseWork(_))}else e instanceof Work?E.push(e):E.push(parseWork(e));for(var S=createWorks(E),R=function(X){var K=w,$=new Fetcher({get networkSubscribe(){return K.networkSubscribe},requestProxy:function(re){return Promise.resolve(re).then(function(ne){return K.requestProxy(ne)}).then(function(ne){var ae=verifyURL(ne,X.allowHosts);if(ae instanceof Error)throw ae;return ae})}});registerFetcher(X,$)},w=this,M=0,B=S;M<B.length;M++){var C=B[M];R(C)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var I=S.initial,L=I.work.observers[0],O=L?{workCode:L.work.workCode,panoIndex:L.panoIndex}:{workCode:I.work.workCode,panoIndex:0},F=(l=I.mode)!==null&&l!==void 0?l:L?"Panorama":"Mapview",N={};if(r==="inherit"){F=this.currentMode;var D=(p=(c=S[0])===null||c===void 0?void 0:c.observers)===null||p===void 0?void 0:p[this.panoIndex];D?O={workCode:D.work.workCode,panoIndex:D.panoIndex}:typeof S.initial.panoIndex=="number"?O={workCode:S.initial.work.workCode,panoIndex:S.initial.panoIndex}:(F==="Panorama"||F==="VRPanorama"||F==="XRPanorama")&&(F="Mapview"),N={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:void 0,offset:void 0}}else if(r==="initial")typeof I.panoIndex=="number"&&(O={workCode:I.work.workCode,panoIndex:I.panoIndex}),I.mode&&(F=I.mode),N={longitude:I.longitude,latitude:I.latitude,fov:I.fov,distance:I.distance,offset:(f=I.offset)===null||f===void 0?void 0:f.clone()};else{if(F=(d=r.mode)!==null&&d!==void 0?d:this.currentMode,typeof r.panoIndex=="number"){var D=S.getObserver({workCode:(m=(h=r.workCode)!==null&&h!==void 0?h:I.work.workCode)!==null&&m!==void 0?m:"",panoIndex:r.panoIndex});D&&(O={workCode:D.work.workCode,panoIndex:D.panoIndex})}N={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var q=__assign(__assign(__assign({},O),{mode:F}),N),z=this.getCurrentState(),j=(A=v.duration)!==null&&A!==void 0?A:this.modeChangeDuration;(F==="Floorplan"||F==="Topview"||F==="Mapview")&&this.currentMode===F&&(j=0);var J="fly";(F==="Panorama"||F==="VRPanorama"||F==="XRPanorama")&&this.currentMode===F&&(J=(g=v.effect)!==null&&g!==void 0?g:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:S,state:q,userAction:s}));var V=function(){u.pano=O;var X=__assign(__assign({initial:{state:q,currentState:z,duration:j,effect:J,userAction:s}},u.commonParams()),u.controllerInits[F]),K=Controllers[F].initAnimationEndState(X);if(u.controller&&u.currentMode===F)u.controller.updateWork(S,K,{effect:J,duration:j},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(F,X));else{var $=u.currentMode;if(u.controller)u.controller.destroy();else{var re=Controllers[F].initAnimationEndState(X);u.camera.setFromPose(re),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(F,X);var ne=createEvent("mode.change",{prevMode:$,mode:F,state:K,userAction:s});try{u.emit("mode.change",ne)}catch(ae){console.error(ae)}}u.updateTime(u.currentUpdateArgs.time,0,u.currentUpdateArgs.args)};worksMap.set(this,S);var U=Promise.resolve();if(F===t.Mode.Floorplan||F===t.Mode.Topview||F===t.Mode.Mapview||F===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(q),assignPose(this.state,this.camera.pose)),this.controller||(this.currentMode=F);var G=this.loadModels(S,v);U=Promise.all(G.map(function(X){return X.loadedReady})).then(function(){u.needsRender=!0,u.modelSceneNeedsRender=!0,V(),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{V();var Z=this.controller,W=!1;this.modelScene.autoRefine=!1;var ee=function(){u.works===S&&W===!1&&(u.needsRender=!0,u.modelSceneNeedsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),W=!0,u.modelScene.autoRefine=!0),Z.off("pano.arrived",ee),Z.off("pano.cancel",ee)},G=this.loadModels(S,v);U=Promise.all(G.map(function(K){return K.initReady})).then(noop),Z.once("pano.arrived",ee),Z.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,state:this.getCurrentState(),userAction:s,works:S})),U.then(function(){return u.ready()}).then(function(){var X;u.emit("works.ready",createEvent("works.ready",{input:e,state:u.getCurrentState(),userAction:s,works:S})),(X=u.analysis)===null||X===void 0||X.work(S)})},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}),e.renderer&&e.modelScene.update(e.renderer,e.camera);for(var u=0,l=e.modelScene.children;u<l.length;u++){var c=l[u];c instanceof Model&&(c.dispose(),e.modelScene.remove(c))}e.needsRender=!0,e.modelSceneNeedsRender=!0,worksMap.delete(e);var p=parseWork(null),f=new Model(p);f.work=p,worksMap.set(e,createWorks([p])),e.currentMode="Mapview",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,e.modelSceneNeedsRender=!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,p){var f,d,h,m;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var A=0;l.controller&&(typeof o=="number"?A=o:A=(f=o==null?void 0:o.duration)!==null&&f!==void 0?f:l.modeChangeDuration);var g="fly";l.controller&&typeof o=="object"&&o.effect&&(g=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(m=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&m!==void 0?m:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));l.throwError(v),p(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),p(v);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&(l.modelScene.loaded||(A=0));var E=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:A},r),s):l.controller.updateCamera(r,A,s).catch(noop):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,A,s).catch(noop));else{var S=__assign(__assign({},r),y),R=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:A,effect:g,userAction:s}},l.commonParams()),l.controllerInits[e]),w=Controllers[e].initAnimationEndState(R),M=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:w,userAction:s});if(l.emit("mode.change.request",M),!M.defaultPrevented){E&&E.destroy(),l.controller=l.applyController(e,R);var B=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:w,userAction:s});l.emit("mode.change",B)}}c()};if(e===t.Mode.VRPanorama)l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){var R=S instanceof Error?S:new Error(String(S));l.exitFullscreen(),l.throwError(R),p(R)});else if(e===t.Mode.XRPanorama){var _=AnimationFrameLoop.shared.getContext();_?_.end():requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),T()}).catch(function(S){var R=S instanceof Error?S:new Error(String(S));l.throwError(R),p(R)})}else T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var p=this.renderer.getPixelRatio(),f=this.renderer.getRenderTarget(),d=this.renderer.getSize(new THREE__namespace.Vector2),h=0,m=0,A=1,g=1,y,v,E,b,T;typeof e=="number"?(h=e,typeof r=="number"&&(m=r),typeof o=="number"&&(A=o),typeof s=="number"&&(g=s),y=u,v=l,T=c):(h=e.x,m=e.y,A=e.width,g=e.height,y=e.pixelRatio,v=e.flipY,E=e.helperVisible,b=e.skipPanorama,T=e.buffer),h=Math.ceil(h),m=Math.ceil(m),A=Math.ceil(A),g=Math.ceil(g),y=Math.ceil(y!=null?y:p),v=v!=null?v:!1;var _=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=E!=null?E:this.helperVisible,b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&b===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(A*y,g*y),this.renderer.setRenderTarget(R),this.camera.pixelRatio=y,this.camera.resolution.set(A,g),this.camera.setViewOffset(d.width,d.height,h,d.height-m-g,A,g),this.scene.update(this.renderer,this.camera),this.render(),this.helperVisible=_,S===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",S),this.renderer.setRenderTarget(f),this.camera.clearViewOffset(),this.camera.pixelRatio=p,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var w=A*y,M=g*y,B=w*M,C=B*4;if(T){if(T.length!==C)throw new Error("buffer length is not equals pixels ".concat(C))}else T=new Uint8Array(C);if(this.renderer.readRenderTargetPixels(R,0,0,A*y,g*y,T),v)for(var I=B/2,L=0,O=0,F=0,N=0;O<I;O++)for(N=(M-Math.floor(O/w)-1)*w+O%w,F=0;F<4;F++)L=T[O*4+F],T[O*4+F]=T[N*4+F],T[N*4+F]=L;return T},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(),s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,p=scratchClearColor.copy(r.getClearColor()),f=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),m=r.getScissorTest(),A=r.getSize(scratchRenderSize),g=r.getPixelRatio(),y=Math.floor(A.x*this.viewport.left),v=Math.floor(A.y*this.viewport.bottom),E=Math.floor(A.x*this.viewport.width),b=Math.floor(A.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(y,v,E,b),r.setScissor(y,v,E,b);var T=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(T);var _=this.scene.background;this.modelScene.background=this.camera.isOrthographicCamera?null:_,this.modelScene.environment=this.scene.environment,this.scene.background=null;var S=this.getBuiltinRenderer(r);S.setSize(A.x,A.y,g),this.controller?this.controller.render(S,this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0):S.render(this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0),this.scene.background=_,this.modelScene.background=null,this.modelScene.environment=null,this.poweredByRealsee&&this.currentMode!=="VRPanorama"&&this.currentMode!=="XRPanorama"&&r.getRenderTarget()!==this.getPixelsRenderTarget&&renderPoweredByRealsee(r),r.setRenderTarget(o),r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(p,f),r.setViewport(d),r.setScissor(h),r.setScissorTest(m),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.autoNearFar){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.boundingMesh);var c=scratchBox3.getBoundingSphere(scratchSphere),p=c.radius*2;c.containsPoint(this.camera.position)||(p=this.camera.position.distanceTo(c.center)+c.radius),p=clamp$1(p,800);var f=p/1e4;f=clamp$1(f,.03,.1),this.camera.near!==f&&(this.camera.near=f),this.camera.far!==p&&(this.camera.far=p)}if(this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var d=this.modelScene.loaded,h=this.modelScene.refined;if(this.modelScene.loaded){for(var m=[],A=0,g=this.modelScene.children;A<g.length;A++){var y=g[A];y instanceof Model&&y.outdated&&m.push(y)}for(var v=0,E=m;v<E.length;v++){var b=E[v];this.modelScene.remove(b),b.dispose()}if(m.length>0)for(var T=0,_=this.modelScene.children;T<_.length;T++){var y=_[T];y instanceof Model&&(y.visible=!0,this.modelSceneNeedsRender=!0)}}this.modelScene.update(this.renderer,this.camera),d===!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)),h===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}this.renderer&&this.scene.update(this.renderer,this.camera),this.syncingState=!1,this.controller&&(this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.controller.modelSceneNeedsRender===!0&&(this.controller.modelSceneNeedsRender=!1,this.modelSceneNeedsRender=!0)),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0),this.modelSceneNeedsRender===!0&&(this.needsRender=!0);var S=this.camera.resolution.width*this.camera.pixelRatio*this.camera.resolution.height*this.camera.pixelRatio;S>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderSwitch01!==0&&(this.needsRender=!1),this.paused===!0&&(this.needsRender=!1);var R=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",R),R.defaultPrevented&&(this.needsRender=!1);var w=this.needsRender;this.renderer&&w&&this.render(),this.needsRender=!1,this.modelSceneNeedsRender=!1,this.emit("render",createEvent("render",{needsRender:w})),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.modelSceneNeedsRender=!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();var c=this.works.getObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var p={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(p,r,o):c&&(this.pano=p,this.once("initAnimation.start",function(f){r.moveStartCallback&&r.moveStartCallback(f.state)}),this.once("initAnimation.end",function(f){r.moveEndCallback&&r.moveEndCallback(f.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 p=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),f=__assign({key:"pano.".concat(p,".").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,f):imageURL(d,f);return getFetcher(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 p=this.renderer.getSize(new THREE__namespace.Vector2),f=p.x*this.viewport.width,d=p.y*this.viewport.height,h=p.x*this.viewport.left+(c.x+1)/2*f,m=p.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,m)},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,p,f,d,h,m,A;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 g;if(typeof e.panoIndex=="number")if(e.workCode)g={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(I){return I.workCode===v}).length>0&&(y=v),g={workCode:y,panoIndex:e.panoIndex}}var E=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,R;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==E){if(E==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var w={workCode:g==null?void 0:g.workCode,panoIndex:g==null?void 0:g.panoIndex};typeof e.longitude=="number"&&(w.longitude=e.longitude),typeof e.latitude=="number"&&(w.latitude=e.latitude),typeof e.fov=="number"&&(w.fov=e.fov),typeof e.distance=="number"&&(w.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(w.offset=e.offset);var M=__assign(__assign({initial:{state:w,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[E]),B=Controllers[E].initAnimationEndState(M);b=B.longitude,T=B.latitude,_=B.fov,S=B.offset,R=B.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(p=e.latitude)!==null&&p!==void 0?p:this.state.latitude,_=(f=e.fov)!==null&&f!==void 0?f:this.state.fov,S=(d=e.offset)!==null&&d!==void 0?d:this.state.offset,R=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(g!=null?g:this.pano).workCode,panoIndex:(g!=null?g:this.pano).panoIndex,mode:E,longitude:b,latitude:T,fov:_,offset:S,distance:R};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&&((m=this.controller)===null||m===void 0||m.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:o,state:this.state})),(A=this.analysis)===null||A===void 0||A.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 p=1,f=.2,d=.2,h=Math.PI/45,m=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,p),A=Math.abs(this.camera.pose.distance-this.state.distance),g=A>d*15?A/15:f,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,g),v=this.camera.pose.offset.distanceTo(this.state.offset),E=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,E),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(m,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 R={x:b.x,y:b.y,z:b.z},w={fov:m};return Object.assign(R,{distance:y}),Object.assign(w,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(w,0).catch(noop),this.controller.locationMotion.set(R,0).catch(noop),!0}}else{var M=1,B=Math.PI/45,m=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,M),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},B),_=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(m,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,fov:m},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 I=this.currentMode,L=I===t.Mode.Floorplan||I===t.Mode.Topview||I===t.Mode.Mapview||I===t.Mode.Model;if(!L||this.modelScene.loaded){var O=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var F=0,N=O;F<N.length;F++){var D=N[F];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})},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.loadModels=function(e,r){for(var o=this,s,u,l,c,p,f,d=new Map,h=!1,m=[],A=0,g=this.modelScene.children;A<g.length;A++){var y=g[A];y instanceof Model&&(y.outdated=!0,d.set(y.work.workCode,y),h=!0)}for(var v=function(T){var _=e[T],S=_.workCode&&d.get(_.workCode);if(S)S.work=_,S.outdated=!1,d.delete(_.workCode),m.push(S);else{var R=(l=(u=(s=r.model)===null||s===void 0?void 0:s.textureOptions)!==null&&u!==void 0?u:r.textureOptions)!==null&&l!==void 0?l:E.textureOptions,w=(p=(c=r.model)===null||c===void 0?void 0:c["3d-tiles"])!==null&&p!==void 0?p:r["3d-tiles"],M=new Model(_,{light:(f=r.model)===null||f===void 0?void 0:f.light,textureOptions:R});M.initReady.then(function(){if(w)if(typeof w=="function")for(var O=0,F=M.viewLayers;O<F.length;O++){var N=F[O],D=w(N,M,T);D&&(D.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(D.viewerRequestVolume)),N.parameter.set(omit(D,["showLayers"])),D.showLayers===!1?N.visible=!1:Array.isArray(D.showLayers)&&(N.visible=D.showLayers.includes(N.name)))}else for(var q=0,z=M.viewLayers;q<z.length;q++){var N=z[q];w.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(w.viewerRequestVolume)),N.parameter.set(omit(w,["showLayers"])),w.showLayers===!1?N.visible=!1:Array.isArray(w.showLayers)&&(N.visible=w.showLayers.includes(N.name))}}),m.push(M),h&&(M.visible=!1),E.modelScene.add(M);var B=function(){AnimationFrameLoop.shared.add(function(){o.emit("model.load",createEvent("model.load",{work:_,model:M,error:null}))},!0)},C=function(O){var F=O.error;o.emit("model.error",createEvent("model.error",{work:_,model:M,error:F})),o.throwError(F)},I=function(){o.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:_,model:M,error:null}))},L=function(){M.removeEventListener("load",B),M.removeEventListener("error",C),M.removeEventListener("changeShownFloor",I),M.removeEventListener("dispose",L)};M.addEventListener("load",B),M.addEventListener("error",C),M.addEventListener("changeShownFloor",I),M.addEventListener("dispose",L),E.emit("model.request",createEvent("model.request",{work:_,model:M,error:null}))}},E=this,b=0;b<e.length;b++)v(b);return this.modelScene.loaded=!1,this.modelScene.refined=!1,m},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,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(m){u.on(m,function(){for(var A=[],g=0;g<arguments.length;g++)A[g]=arguments[g];var y=o.emit.apply(o,__spreadArray([m],A,!1));if(y)return!1})},c=0,p=PROXY_CONTROLLER_EVENT_NAMES;c<p.length;c++){var f=p[c];l(f)}{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(m){var A;if(o.controller){var g=o.controller.getTargetState();m.userAction&&o.syncingState===!1&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:m.userAction,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:m.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(m){var A,g=m.state,y=m.userAction;y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("initAnimation.end",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.arrived",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.cancel",function(m){var A,g=m.state,y=m.userAction;y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(m){var A=m.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:A,state:o.getCurrentState()}))}),u.on("pano.request",function(m){o.emit("pano.request",m),m.defaultPrevented||o.moveToPano(m.state,m.options,m.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(m){return o.throwError(m)}),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},Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.renderEffect==="edl"},set:function(e){this.renderEffect=e?"edl":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.renderEffect==="hq"},set:function(e){this.renderEffect=e?"hq":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t})(Subscribe),__FIVE_DEBUG__={constructor:Five,THREE:THREE__namespace,instances:{}};typeof window!="undefined"&&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.AnimationFrameLoop=AnimationFrameLoop;exports.Camera=Camera;exports.CustomShader=PBMCustomShader;exports.Fetcher=Fetcher;exports.Five=Five;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;
2249
+ `})||this;return r.material.transparent=!0,r}return Object.defineProperty(t.prototype,"luminanceAdaptiveBuffer",{get:function(){return this.material.uniforms.luminanceAdaptiveBuffer.value},set:function(e){this.material.uniforms.luminanceAdaptiveBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),t})(Pass),LuminanceAdaptiveEffect=(function(n){__extends(t,n);function t(e,r,o,s){var u=n.call(this,e,r,o,s)||this;return u.enableTime=now(),u.renderer=e,u.valuePass=new ValuePass(u.renderer),u.luminancePass=new LuminancePass(u.renderer,Math.sqrt(1/3)),u.nextStepPass=new NextStepPass(u.renderer,.01),u.luminanceAdaptivePass=new LuminanceAdaptivePass(u.renderer),u}return t.prototype.render=function(e){this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera),this.enableTime===null&&(this.enableTime=now()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new THREE__namespace.WebGLRenderTarget(128,128,{minFilter:THREE__namespace.LinearMipmapLinearFilter,magFilter:THREE__namespace.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:THREE__namespace.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(e[0],this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminanceNextBuffer),this.luminanceAdaptivePass.luminanceAdaptiveBuffer=this.luminanceNextBuffer.texture),this.copyPass.render(this.luminanceNextBuffer,this.luminancePrevBuffer),this.nextStepPass.render(this.luminancePrevBuffer,this.luminanceNextBuffer),this.luminanceAdaptivePass.progress=Math.min((now()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(e[0],e[1])},t.prototype.dispose=function(){var e,r,o;(e=this.luminanceTargetBuffer)===null||e===void 0||e.dispose(),(r=this.luminancePrevBuffer)===null||r===void 0||r.dispose(),(o=this.luminanceNextBuffer)===null||o===void 0||o.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},t})(Effect),sharedV2=new THREE__namespace.Vector2,LuminanceRenderer=(function(n){__extends(t,n);function t(e){var r,o,s=n.call(this,e)||this;s.type="default",s.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(s.renderer,s.modelScene,s.camera,s.modelScene);var u=s.renderer.getDrawingBufferSize(sharedV2);return s.screenBuffers=[new THREE__namespace.WebGLRenderTarget(u.x,u.y,{generateMipmaps:!1,encoding:(o=(r=s.renderer)===null||r===void 0?void 0:r.outputEncoding)!==null&&o!==void 0?o:THREE__namespace.sRGBEncoding}),s.enableFragDepth?s.modelRenderTarget:null],s}return t.prototype.render=function(e){var r=this.renderer.getRenderTarget();this.enableFragDepth?(e&&(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers)),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,r),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,r),this.renderer.setRenderTarget(r),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0):(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0),this.modelScene.needsRender=!0},t})(BaseRenderer),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=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,p,f,d,h,m,A,g=n.call(this)||this;if(g.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[g.ident]=g),g.renderSwitch01=0,g.currentUpdateArgs={time:now(),args:[]},g.currentMode="Panorama",g.pano={workCode:"",panoIndex:0},g.needsRender=!1,g.modelSceneNeedsRender=!1,g.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,g.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),g.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),g.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,g.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),g.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,g.extraElements=[],g.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)},g.fps={testCount:0,testTime:now()},g.modeChangeDuration=(p=e.modeChangeDuration)!==null&&p!==void 0?p:DEFAULT_MODE_CHANGE_DURATION,g.enableWheel=(f=e.enableWheel)!==null&&f!==void 0?f:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&g.throwError(new Error("cannot render a internal renderer")),g.renderer=e.renderer;else try{g.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var y=getViewportScale();g.renderer.setPixelRatio(y===1?window.devicePixelRatio:1),g.renderer.setSize(512,512),g.renderer.setClearColor(g.backgroundColor,g.backgroundAlpha)}catch(O){var v=O instanceof Error?O:new Error(String(O));g.throwError(v)}g.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=g.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),g.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),g.camera=new Camera(DEFAULT_CAMERA_FOV),g.scene=new Scene,g.xrCustomObjectsScene=new THREE__namespace.Scene,g.scene.add(g.xrCustomObjectsScene),g.scene.matrixAutoUpdate=!1,g.loadWorkTask=Promise.resolve(),g.requestProxy=(m=e.requestProxy)!==null&&m!==void 0?m:DEFAULT_REQUEST_PROXY,g.networkSubscribe=new NetworkSubscribe,g.networkSubscribe.on("network",function(O,F,N,D){var q;g.emit("network.resource",createEvent("network.resource",{source:O,requestType:F,requestState:N,detail:D})),(q=g.analysis)===null||q===void 0||q.network(g.works,O,F,N,D)}),g.boundingMesh=new BoundingMesh$1,g.boundingMesh.name="bounding",g.readyCallbacks=[],g.syncingState=!1,g.helperGroup=new THREE__namespace.Group,g.helperGroup.name="helper",g.helperGroup.matrixAutoUpdate=!1,g.scene.add(g.helperGroup);var E=new Model(emptyWorks[0]);worksMap.set(g,emptyWorks),g.modelScene=new ModelScene,g.modelScene.add(E),g.modelScene.add(g.boundingMesh),defineProperty(E,"loaded",{get:function(){return!1},set:function(O){}}),g.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var b=initLights();g.scene.add(b);var T=new THREE__namespace.Group;defineProperty(T,"children",{get:function(){return b.children},set:function(O){b.children=O}}),defineProperty(T,"visible",{get:function(){return b.visible},set:function(O){b.visible=O}}),defineProperty(T,"name",{get:function(){return b.name},set:function(O){b.name=O}}),g.modelScene.add(T),g.state={mode:g.currentMode,workCode:g.pano.workCode,panoIndex:g.pano.panoIndex,longitude:g.camera.pose.longitude,latitude:g.camera.pose.latitude,fov:g.camera.pose.fov,offset:g.camera.pose.offset.clone(),distance:g.camera.pose.distance},g.stateSynced=!1,g.destroyed=!1,g.paused=!0,typeof window!="undefined"&&(e.play!==!1&&g.play(),g.stopAnimationLoop=AnimationFrameLoop.shared.add(function(O,F){for(var N=[],D=2;D<arguments.length;D++)N[D-2]=arguments[D];g.updateTime.apply(g,__spreadArray([O,F],N,!1))},!1,0,10));var _=function(){typeof document!="undefined"&&document.fullscreenElement===null&&g.currentMode==="VRPanorama"&&g.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},S=function(){g.needsRender=!0,g.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",_,!1),g.renderer&&g.renderer.domElement.addEventListener("webglcontextrestored",S,!1),g.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",_,!1),g.renderer&&g.renderer.domElement.removeEventListener("webglcontextrestored",S,!1)},g.plugins={},e.plugins&&e.plugins.length)for(var R=0,w=e.plugins;R<w.length;R++){var M=w[R];if(typeof M=="function")M(g);else if(Array.isArray(M)){var B=M[0],C=M[1],I=M[2];if(typeof B=="function"){var L=B(g,I);typeof C=="string"&&(g.plugins[C]?g.throwError(new Error("plugin name ".concat(C," is exists."))):g.plugins[C]=L)}}}return initLegacyEvent(g),g.enableLayeringRendering=(A=e.enableLayeringRendering)!==null&&A!==void 0?A:!1,g._buildInRendererType="default",g._builtinRenderer=null,g}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.8"},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,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],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");for(var s=0,u=this.modelScene.children.slice();s<u.length;s++){var l=u[s];l.dispose&&l.dispose(),this.modelScene.remove(l)}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.renderer.setAnimationLoop(null)),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,this.modelSceneNeedsRender=!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.getBuiltinRenderer=function(e){var r=this._builtinRenderer;if((r==null?void 0:r.type)!==this._buildInRendererType)switch(r&&r.dispose(),this._buildInRendererType){case"default":this._builtinRenderer=new DefaultRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"edl":this._builtinRenderer=new EDLRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"hq":this._builtinRenderer=new HQRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"luminance":this._builtinRenderer=new LuminanceRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break}return this._builtinRenderer},Object.defineProperty(t.prototype,"renderEffect",{get:function(){return this._buildInRendererType},set:function(e){this._buildInRendererType=e,this.modelSceneNeedsRender=!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;if(e===void 0&&(e={}),!!this.renderer){var u=this.renderer.domElement,l=u.parentNode,c=e.width,p=c===void 0?(o=l==null?void 0:l.offsetWidth)!==null&&o!==void 0?o:512:c,f=e.height,d=f===void 0?(s=l==null?void 0:l.offsetHeight)!==null&&s!==void 0?s:512:f;r=r!=null?r:this.renderer.getPixelRatio();var h=this.renderer.capabilities.maxTextureSize,m=Math.max(p,d)*r;m>h&&(r=r/m*h,r=Math.floor(r*100)/100),this.renderer.setPixelRatio(r),this.renderer.setSize(p,d),this.needsRender=!0,this.modelSceneNeedsRender=!0;var A=now(),g=A-this.currentUpdateArgs.time,y=this.currentUpdateArgs.args;this.updateTime(A,g,y)}},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,p,f,d,h,m,A,g,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 E=[];if(Array.isArray(e))for(var b=0,T=e;b<T.length;b++){var _=T[b];_ instanceof Work?E.push(_):typeof _!="string"&&"work"in _?E.push(parseWork(_.work,_)):E.push(parseWork(_))}else e instanceof Work?E.push(e):E.push(parseWork(e));for(var S=createWorks(E),R=function(X){var K=w,$=new Fetcher({get networkSubscribe(){return K.networkSubscribe},requestProxy:function(re){return Promise.resolve(re).then(function(ne){return K.requestProxy(ne)}).then(function(ne){var ae=verifyURL(ne,X.allowHosts);if(ae instanceof Error)throw ae;return ae})}});registerFetcher(X,$)},w=this,M=0,B=S;M<B.length;M++){var C=B[M];R(C)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var I=S.initial,L=I.work.observers[0],O=L?{workCode:L.work.workCode,panoIndex:L.panoIndex}:{workCode:I.work.workCode,panoIndex:0},F=(l=I.mode)!==null&&l!==void 0?l:L?"Panorama":"Mapview",N={};if(r==="inherit"){F=this.currentMode;var D=(p=(c=S[0])===null||c===void 0?void 0:c.observers)===null||p===void 0?void 0:p[this.panoIndex];D?O={workCode:D.work.workCode,panoIndex:D.panoIndex}:typeof S.initial.panoIndex=="number"?O={workCode:S.initial.work.workCode,panoIndex:S.initial.panoIndex}:(F==="Panorama"||F==="VRPanorama"||F==="XRPanorama")&&(F="Mapview"),N={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:void 0,offset:void 0}}else if(r==="initial")typeof I.panoIndex=="number"&&(O={workCode:I.work.workCode,panoIndex:I.panoIndex}),I.mode&&(F=I.mode),N={longitude:I.longitude,latitude:I.latitude,fov:I.fov,distance:I.distance,offset:(f=I.offset)===null||f===void 0?void 0:f.clone()};else{if(F=(d=r.mode)!==null&&d!==void 0?d:this.currentMode,typeof r.panoIndex=="number"){var D=S.getObserver({workCode:(m=(h=r.workCode)!==null&&h!==void 0?h:I.work.workCode)!==null&&m!==void 0?m:"",panoIndex:r.panoIndex});D&&(O={workCode:D.work.workCode,panoIndex:D.panoIndex})}N={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var q=__assign(__assign(__assign({},O),{mode:F}),N),z=this.getCurrentState(),j=(A=v.duration)!==null&&A!==void 0?A:this.modeChangeDuration;(F==="Floorplan"||F==="Topview"||F==="Mapview")&&this.currentMode===F&&(j=0);var J="fly";(F==="Panorama"||F==="VRPanorama"||F==="XRPanorama")&&this.currentMode===F&&(J=(g=v.effect)!==null&&g!==void 0?g:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:S,state:q,userAction:s}));var V=function(){u.pano=O;var X=__assign(__assign({initial:{state:q,currentState:z,duration:j,effect:J,userAction:s}},u.commonParams()),u.controllerInits[F]),K=Controllers[F].initAnimationEndState(X);if(u.controller&&u.currentMode===F)u.controller.updateWork(S,K,{effect:J,duration:j},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(F,X));else{var $=u.currentMode;if(u.controller)u.controller.destroy();else{var re=Controllers[F].initAnimationEndState(X);u.camera.setFromPose(re),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(F,X);var ne=createEvent("mode.change",{prevMode:$,mode:F,state:K,userAction:s});try{u.emit("mode.change",ne)}catch(ae){console.error(ae)}}u.updateTime(u.currentUpdateArgs.time,0,u.currentUpdateArgs.args)};worksMap.set(this,S);var U=Promise.resolve();if(F===t.Mode.Floorplan||F===t.Mode.Topview||F===t.Mode.Mapview||F===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(q),assignPose(this.state,this.camera.pose)),this.controller||(this.currentMode=F);var G=this.loadModels(S,v);U=Promise.all(G.map(function(X){return X.loadedReady})).then(function(){u.needsRender=!0,u.modelSceneNeedsRender=!0,V(),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{V();var Z=this.controller,W=!1;this.modelScene.autoRefine=!1;var ee=function(){u.works===S&&W===!1&&(u.needsRender=!0,u.modelSceneNeedsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),W=!0,u.modelScene.autoRefine=!0),Z.off("pano.arrived",ee),Z.off("pano.cancel",ee)},G=this.loadModels(S,v);U=Promise.all(G.map(function(K){return K.initReady})).then(noop),Z.once("pano.arrived",ee),Z.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,state:this.getCurrentState(),userAction:s,works:S})),U.then(function(){return u.ready()}).then(function(){var X;u.emit("works.ready",createEvent("works.ready",{input:e,state:u.getCurrentState(),userAction:s,works:S})),(X=u.analysis)===null||X===void 0||X.work(S)})},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}),e.renderer&&e.modelScene.update(e.renderer,e.camera);for(var u=0,l=e.modelScene.children;u<l.length;u++){var c=l[u];c instanceof Model&&(c.dispose(),e.modelScene.remove(c))}e.needsRender=!0,e.modelSceneNeedsRender=!0,worksMap.delete(e);var p=parseWork(null),f=new Model(p);f.work=p,worksMap.set(e,createWorks([p])),e.currentMode="Mapview",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,e.modelSceneNeedsRender=!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,p){var f,d,h,m;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var A=0;l.controller&&(typeof o=="number"?A=o:A=(f=o==null?void 0:o.duration)!==null&&f!==void 0?f:l.modeChangeDuration);var g="fly";l.controller&&typeof o=="object"&&o.effect&&(g=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(m=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&m!==void 0?m:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));l.throwError(v),p(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),p(v);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&(l.modelScene.loaded||(A=0));var E=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:A},r),s):l.controller.updateCamera(r,A,s).catch(noop):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,A,s).catch(noop));else{var S=__assign(__assign({},r),y),R=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:A,effect:g,userAction:s}},l.commonParams()),l.controllerInits[e]),w=Controllers[e].initAnimationEndState(R),M=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:w,userAction:s});if(l.emit("mode.change.request",M),!M.defaultPrevented){E&&E.destroy(),l.controller=l.applyController(e,R);var B=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:w,userAction:s});l.emit("mode.change",B)}}c()};if(e===t.Mode.VRPanorama)l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){var R=S instanceof Error?S:new Error(String(S));l.exitFullscreen(),l.throwError(R),p(R)});else if(e===t.Mode.XRPanorama){var _=AnimationFrameLoop.shared.getContext();_?_.end():requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),T()}).catch(function(S){var R=S instanceof Error?S:new Error(String(S));l.throwError(R),p(R)})}else T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var p=this.renderer.getPixelRatio(),f=this.renderer.getRenderTarget(),d=this.renderer.getSize(new THREE__namespace.Vector2),h=0,m=0,A=1,g=1,y,v,E,b,T;typeof e=="number"?(h=e,typeof r=="number"&&(m=r),typeof o=="number"&&(A=o),typeof s=="number"&&(g=s),y=u,v=l,T=c):(h=e.x,m=e.y,A=e.width,g=e.height,y=e.pixelRatio,v=e.flipY,E=e.helperVisible,b=e.skipPanorama,T=e.buffer),h=Math.ceil(h),m=Math.ceil(m),A=Math.ceil(A),g=Math.ceil(g),y=Math.ceil(y!=null?y:p),v=v!=null?v:!1;var _=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=E!=null?E:this.helperVisible,b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&b===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(A*y,g*y),this.renderer.setRenderTarget(R),this.camera.pixelRatio=y,this.camera.resolution.set(A,g),this.camera.setViewOffset(d.width,d.height,h,d.height-m-g,A,g),this.scene.update(this.renderer,this.camera),this.render(),this.helperVisible=_,S===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",S),this.renderer.setRenderTarget(f),this.camera.clearViewOffset(),this.camera.pixelRatio=p,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var w=A*y,M=g*y,B=w*M,C=B*4;if(T){if(T.length!==C)throw new Error("buffer length is not equals pixels ".concat(C))}else T=new Uint8Array(C);if(this.renderer.readRenderTargetPixels(R,0,0,A*y,g*y,T),v)for(var I=B/2,L=0,O=0,F=0,N=0;O<I;O++)for(N=(M-Math.floor(O/w)-1)*w+O%w,F=0;F<4;F++)L=T[O*4+F],T[O*4+F]=T[N*4+F],T[N*4+F]=L;return T},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(),s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,p=scratchClearColor.copy(r.getClearColor()),f=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),m=r.getScissorTest(),A=r.getSize(scratchRenderSize),g=r.getPixelRatio(),y=Math.floor(A.x*this.viewport.left),v=Math.floor(A.y*this.viewport.bottom),E=Math.floor(A.x*this.viewport.width),b=Math.floor(A.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(y,v,E,b),r.setScissor(y,v,E,b);var T=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(T);var _=this.scene.background;this.modelScene.background=this.camera.isOrthographicCamera?null:_,this.modelScene.environment=this.scene.environment,this.scene.background=null;var S=this.getBuiltinRenderer(r);S.setSize(A.x,A.y,g),this.controller?this.controller.render(S,this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0):S.render(this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0),this.scene.background=_,this.modelScene.background=null,this.modelScene.environment=null,this.poweredByRealsee&&this.currentMode!=="VRPanorama"&&this.currentMode!=="XRPanorama"&&r.getRenderTarget()!==this.getPixelsRenderTarget&&renderPoweredByRealsee(r),r.setRenderTarget(o),r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(p,f),r.setViewport(d),r.setScissor(h),r.setScissorTest(m),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.autoNearFar){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.boundingMesh);var c=scratchBox3.getBoundingSphere(scratchSphere),p=c.radius*2;c.containsPoint(this.camera.position)||(p=this.camera.position.distanceTo(c.center)+c.radius),p=clamp$1(p,800);var f=p/1e4;f=clamp$1(f,.03,.1),this.camera.near!==f&&(this.camera.near=f),this.camera.far!==p&&(this.camera.far=p)}if(this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var d=this.modelScene.loaded,h=this.modelScene.refined;if(this.modelScene.loaded){for(var m=[],A=0,g=this.modelScene.children;A<g.length;A++){var y=g[A];y instanceof Model&&y.outdated&&m.push(y)}for(var v=0,E=m;v<E.length;v++){var b=E[v];this.modelScene.remove(b),b.dispose()}if(m.length>0)for(var T=0,_=this.modelScene.children;T<_.length;T++){var y=_[T];y instanceof Model&&(y.visible=!0,this.modelSceneNeedsRender=!0)}}this.modelScene.update(this.renderer,this.camera),d===!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)),h===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}this.renderer&&this.scene.update(this.renderer,this.camera),this.syncingState=!1,this.controller&&(this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.controller.modelSceneNeedsRender===!0&&(this.controller.modelSceneNeedsRender=!1,this.modelSceneNeedsRender=!0)),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0),this.modelSceneNeedsRender===!0&&(this.needsRender=!0);var S=this.camera.resolution.width*this.camera.pixelRatio*this.camera.resolution.height*this.camera.pixelRatio;S>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderSwitch01!==0&&(this.needsRender=!1),this.paused===!0&&(this.needsRender=!1);var R=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",R),R.defaultPrevented&&(this.needsRender=!1);var w=this.needsRender;this.renderer&&w&&this.render(),this.needsRender=!1,this.modelSceneNeedsRender=!1,this.emit("render",createEvent("render",{needsRender:w})),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.modelSceneNeedsRender=!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();var c=this.works.getObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var p={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(p,r,o):c&&(this.pano=p,this.once("initAnimation.start",function(f){r.moveStartCallback&&r.moveStartCallback(f.state)}),this.once("initAnimation.end",function(f){r.moveEndCallback&&r.moveEndCallback(f.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 p=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),f=__assign({key:"pano.".concat(p,".").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,f):imageURL(d,f);return getFetcher(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 p=this.renderer.getSize(new THREE__namespace.Vector2),f=p.x*this.viewport.width,d=p.y*this.viewport.height,h=p.x*this.viewport.left+(c.x+1)/2*f,m=p.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,m)},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,p,f,d,h,m,A;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 g;if(typeof e.panoIndex=="number")if(e.workCode)g={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(I){return I.workCode===v}).length>0&&(y=v),g={workCode:y,panoIndex:e.panoIndex}}var E=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,R;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==E){if(E==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var w={workCode:g==null?void 0:g.workCode,panoIndex:g==null?void 0:g.panoIndex};typeof e.longitude=="number"&&(w.longitude=e.longitude),typeof e.latitude=="number"&&(w.latitude=e.latitude),typeof e.fov=="number"&&(w.fov=e.fov),typeof e.distance=="number"&&(w.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(w.offset=e.offset);var M=__assign(__assign({initial:{state:w,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[E]),B=Controllers[E].initAnimationEndState(M);b=B.longitude,T=B.latitude,_=B.fov,S=B.offset,R=B.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(p=e.latitude)!==null&&p!==void 0?p:this.state.latitude,_=(f=e.fov)!==null&&f!==void 0?f:this.state.fov,S=(d=e.offset)!==null&&d!==void 0?d:this.state.offset,R=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(g!=null?g:this.pano).workCode,panoIndex:(g!=null?g:this.pano).panoIndex,mode:E,longitude:b,latitude:T,fov:_,offset:S,distance:R};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&&((m=this.controller)===null||m===void 0||m.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:o,state:this.state})),(A=this.analysis)===null||A===void 0||A.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 p=1,f=.2,d=.2,h=Math.PI/45,m=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,p),A=Math.abs(this.camera.pose.distance-this.state.distance),g=A>d*15?A/15:f,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,g),v=this.camera.pose.offset.distanceTo(this.state.offset),E=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,E),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(m,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 R={x:b.x,y:b.y,z:b.z},w={fov:m};return Object.assign(R,{distance:y}),Object.assign(w,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(w,0).catch(noop),this.controller.locationMotion.set(R,0).catch(noop),!0}}else{var M=1,B=Math.PI/45,m=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,M),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},B),_=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(m,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,fov:m},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 I=this.currentMode,L=I===t.Mode.Floorplan||I===t.Mode.Topview||I===t.Mode.Mapview||I===t.Mode.Model;if(!L||this.modelScene.loaded){var O=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var F=0,N=O;F<N.length;F++){var D=N[F];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})},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.loadModels=function(e,r){for(var o=this,s,u,l,c,p,f,d=new Map,h=!1,m=[],A=0,g=this.modelScene.children;A<g.length;A++){var y=g[A];y instanceof Model&&(y.outdated=!0,d.set(y.work.workCode,y),h=!0)}for(var v=function(T){var _=e[T],S=_.workCode&&d.get(_.workCode);if(S)S.work=_,S.outdated=!1,d.delete(_.workCode),m.push(S);else{var R=(l=(u=(s=r.model)===null||s===void 0?void 0:s.textureOptions)!==null&&u!==void 0?u:r.textureOptions)!==null&&l!==void 0?l:E.textureOptions,w=(p=(c=r.model)===null||c===void 0?void 0:c["3d-tiles"])!==null&&p!==void 0?p:r["3d-tiles"],M=new Model(_,{light:(f=r.model)===null||f===void 0?void 0:f.light,textureOptions:R});M.initReady.then(function(){if(w)if(typeof w=="function")for(var O=0,F=M.viewLayers;O<F.length;O++){var N=F[O],D=w(N,M,T);D&&(D.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(D.viewerRequestVolume)),N.parameter.set(omit(D,["showLayers"])),D.showLayers===!1?N.visible=!1:Array.isArray(D.showLayers)&&(N.visible=D.showLayers.includes(N.name)))}else for(var q=0,z=M.viewLayers;q<z.length;q++){var N=z[q];w.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(w.viewerRequestVolume)),N.parameter.set(omit(w,["showLayers"])),w.showLayers===!1?N.visible=!1:Array.isArray(w.showLayers)&&(N.visible=w.showLayers.includes(N.name))}}),m.push(M),h&&(M.visible=!1),E.modelScene.add(M);var B=function(){AnimationFrameLoop.shared.add(function(){o.emit("model.load",createEvent("model.load",{work:_,model:M,error:null}))},!0)},C=function(O){var F=O.error;o.emit("model.error",createEvent("model.error",{work:_,model:M,error:F})),o.throwError(F)},I=function(){o.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:_,model:M,error:null}))},L=function(){M.removeEventListener("load",B),M.removeEventListener("error",C),M.removeEventListener("changeShownFloor",I),M.removeEventListener("dispose",L)};M.addEventListener("load",B),M.addEventListener("error",C),M.addEventListener("changeShownFloor",I),M.addEventListener("dispose",L),E.emit("model.request",createEvent("model.request",{work:_,model:M,error:null}))}},E=this,b=0;b<e.length;b++)v(b);return this.modelScene.loaded=!1,this.modelScene.refined=!1,m},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,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(m){u.on(m,function(){for(var A=[],g=0;g<arguments.length;g++)A[g]=arguments[g];var y=o.emit.apply(o,__spreadArray([m],A,!1));if(y)return!1})},c=0,p=PROXY_CONTROLLER_EVENT_NAMES;c<p.length;c++){var f=p[c];l(f)}{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(m){var A;if(o.controller){var g=o.controller.getTargetState();m.userAction&&o.syncingState===!1&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:m.userAction,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:m.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(m){var A,g=m.state,y=m.userAction;y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("initAnimation.end",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.arrived",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.cancel",function(m){var A,g=m.state,y=m.userAction;y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(m){var A=m.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:A,state:o.getCurrentState()}))}),u.on("pano.request",function(m){o.emit("pano.request",m),m.defaultPrevented||o.moveToPano(m.state,m.options,m.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(m){return o.throwError(m)}),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},Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.renderEffect==="edl"},set:function(e){this.renderEffect=e?"edl":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.renderEffect==="hq"},set:function(e){this.renderEffect=e?"hq":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t})(Subscribe),__FIVE_DEBUG__={constructor:Five,THREE:THREE__namespace,instances:{}};typeof window!="undefined"&&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.AnimationFrameLoop=AnimationFrameLoop;exports.Camera=Camera;exports.CustomShader=PBMCustomShader;exports.Fetcher=Fetcher;exports.Five=Five;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;