@realsee/five 6.7.0-alpha.32 → 6.7.0-alpha.33
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 +3 -3
- package/five/index.mjs +11 -5
- package/gltf-loader/index.js +2 -2
- package/gltf-loader/index.mjs +2 -2
- package/line/index.js +2 -2
- package/line/index.mjs +2 -2
- package/package.json +1 -1
- package/plugins/index.js +1 -1
- package/plugins/index.mjs +1 -1
- package/react/index.js +1 -1
- package/react/index.mjs +1 -1
- package/shader-lib/index.js +1 -1
- package/shader-lib/index.mjs +1 -1
- package/sticker/index.js +2 -2
- package/sticker/index.mjs +2 -2
- package/umd/five-gltf-loader.js +2 -2
- package/umd/five-line.js +2 -2
- package/umd/five-plugins.js +1 -1
- package/umd/five-react.js +1 -1
- package/umd/five-shader-lib.js +1 -1
- package/umd/five-sticker.js +2 -2
- package/umd/five-vfx.js +1 -1
- package/umd/five-vue.js +1 -1
- package/umd/five.js +3 -3
- package/vfx/index.js +1 -1
- package/vfx/index.mjs +1 -1
- package/vue/index.js +1 -1
- package/vue/index.mjs +1 -1
- package/work-downloader/index.js +1 -1
- package/work-downloader/index.mjs +1 -1
package/five/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
4
|
* Generated: 12/22/2025
|
|
5
|
-
* Version: 6.7.0-alpha.
|
|
5
|
+
* Version: 6.7.0-alpha.33
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -915,7 +915,7 @@ self.onmessage = function(event) {
|
|
|
915
915
|
}
|
|
916
916
|
`,EXTENSION_NAME$5="KHR_texture_basisu",KHR_texture_basisu=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.loadTexture=function(e,r){var o=r.json.textures[e];if(!o.extensions||!o.extensions[EXTENSION_NAME$5])return null;var s=o.extensions[EXTENSION_NAME$5],u=r.json.images[s.source],l=null;if(u.bufferView!==void 0)l=r.loadBufferView(u.bufferView).then(function(p){return ktx2.parse(p)});else if(u.uri)l=r.options.fetcher.ajax(r.resolveResouce(u.uri),{responseType:"arraybuffer"}).then(function(p){return ktx2.parse(p.body)});else throw new Error("glTF: Invalid image defs.");var c=r.json.samplers||{},f=c[o.sampler]||{};return l=l.then(function(p){return p.magFilter=THREE__namespace.LinearFilter,p.minFilter=THREE__namespace.LinearFilter,p.wrapS=WEBGL_WRAPPINGS[f.wrapS]||THREE__namespace.RepeatWrapping,p.wrapT=WEBGL_WRAPPINGS[f.wrapT]||THREE__namespace.RepeatWrapping,p}),l},t})(BaseExtension),EXTENSION_NAME$4="KHR_texture_transform",KHR_texture_transform=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.extendTexture=function(e,r,o){var s=r.extensions!==void 0?r.extensions[EXTENSION_NAME$4]:void 0;return s?(s.texCoord!==void 0&&console.warn('glTF: Custom UV sets in "'+EXTENSION_NAME$4+'" extension not yet supported.'),s.offset===void 0&&s.rotation===void 0&&s.scale===void 0||(e=e.clone(),e.needsUpdate=!0,s.offset!==void 0&&e.offset.fromArray(s.offset),s.rotation!==void 0&&(e.rotation=s.rotation),s.scale!==void 0&&e.repeat.fromArray(s.scale)),e):null},t})(BaseExtension),KHR_mesh_quantization=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t})(BaseExtension),KHR_materials_unlit=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t})(BaseExtension),meshoptDecoder=(function(){var n="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:78Yqdbk:qzezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlinalgic9Wfglawcj;cbffhOdndndndndnaHalco4fRbbalci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOaoRblaoRbbgAco4glalciSgCE86bbawcj;cbfaifglcGfaoclfaCfgORbbaAcl4ciGgCaCciSgCE86bbalcVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbalc7faOaCfgORbbaAciGgAaAciSgAE86bbalctfaOaAfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkaOaoRbwaoRbbgAcl4glalcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgORbbaAcsGgAaAcsSgAE86bbalcVfaOaAfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekaOao8Pbb83bbaOcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhPdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkaCcefhCamcefgmad6hsamad9hmbkaPhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaPhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj;8ifcjjj98G::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",t="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;a9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;d8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgAclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var o=WebAssembly.validate(e)?t:n,s,u=WebAssembly.instantiate(l(o),{}).then(function(v){s=v.instance,s.exports.__wasm_call_ctors()});function l(v){for(var A=new Uint8Array(v.length),b=0;b<v.length;++b){var T=v.charCodeAt(b);A[b]=T>96?T-97:T>64?T-39:T+4}for(var _=0,b=0;b<v.length;++b)A[_++]=A[b]<60?r[A[b]]:(A[b]-60)*64+A[++b];return A.buffer.slice(0,_)}function c(v,A,b,T,_,S){var w=s.exports.sbrk,R=b+3&-4,I=w(R*T),H=w(_.length),C=new Uint8Array(s.exports.memory.buffer);C.set(_,H);var M=v(I,b,T,H,_.length);if(M==0&&S&&S(I,R,T),A.set(C.subarray(I,I+b*T)),w(I-w(0)),M!=0)throw new Error("Malformed buffer data: "+M)}var f={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},p={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},d=[],h=0;function g(v){var A={object:new Worker(v),pending:0,requests:{}};return A.object.onmessage=function(b){var T=b.data;A.pending-=T.count,A.requests[T.id][T.action](T.value),delete A.requests[T.id]},A}function m(v){for(var A="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(l(o))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+c.toString()+y.toString(),b=new Blob([A],{type:"text/javascript"}),T=URL.createObjectURL(b),_=0;_<v;++_)d[_]=g(T);URL.revokeObjectURL(T)}function E(v,A,b,T,_){for(var S=d[0],w=1;w<d.length;++w)d[w].pending<S.pending&&(S=d[w]);return new Promise(function(R,I){var H=new Uint8Array(b),C=h++;S.pending+=v,S.requests[C]={resolve:R,reject:I},S.object.postMessage({id:C,count:v,size:A,source:H,mode:T,filter:_},[H.buffer])})}function y(v){u.then(function(){var A=v.data;try{var b=new Uint8Array(A.count*A.size);c(s.exports[A.mode],b,A.count,A.size,A.source,s.exports[A.filter]),self.postMessage({id:A.id,count:A.count,action:"resolve",value:b},[b.buffer])}catch(T){self.postMessage({id:A.id,count:A.count,action:"reject",value:T})}})}return{ready:u,supported:!0,useWorkers:function(v){m(v)},decodeVertexBuffer:function(v,A,b,T,_){c(s.exports.meshopt_decodeVertexBuffer,v,A,b,T,s.exports[f[_]])},decodeIndexBuffer:function(v,A,b,T){c(s.exports.meshopt_decodeIndexBuffer,v,A,b,T)},decodeIndexSequence:function(v,A,b,T){c(s.exports.meshopt_decodeIndexSequence,v,A,b,T)},decodeGltfBuffer:function(v,A,b,T,_,S){c(s.exports[p[_]],v,A,b,T,s.exports[f[S]])},decodeGltfBufferAsync:function(v,A,b,T,_){return d.length>0?E(v,A,b,p[T],f[_]):u.then(function(){var S=new Uint8Array(v*A);return c(s.exports[p[T]],S,v,A,b,s.exports[f[_]]),S})}}})(),EXTENSION_NAME$3="EXT_meshopt_compression",EXT_meshopt_compression=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.loadBufferView=function(e,r){var o=r.json,s=o.bufferViews[e];if(s.extensions&&s.extensions[EXTENSION_NAME$3]){var u=s.extensions[EXTENSION_NAME$3],l=r.loadBuffer(u.buffer);if(!meshoptDecoder.supported){if(o.extensionsRequired&&o.extensionsRequired.indexOf(EXTENSION_NAME$3)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([l,meshoptDecoder.ready]).then(function(c){var f=c[0],p=u.byteOffset||0,d=u.byteLength||0,h=u.count,g=u.byteStride,m=new ArrayBuffer(h*g),E=new Uint8Array(f,p,d);return meshoptDecoder.decodeGltfBuffer(new Uint8Array(m),h,g,E,u.mode,u.filter),m})}else return null},t})(BaseExtension),EXTENSION_NAME$2="EXT_texture_webp",EXT_texture_webp=(function(n){__extends(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.supportsWep=!1,e}return t.prototype.prepare=function(e){var r=this;return imageSupport().then(function(o){r.supportsWep=o.webp})},t.prototype.loadTexture=function(e,r){var o=r.json,s=o.textures[e];if(!s.extensions||!s.extensions[EXTENSION_NAME$2]||!this.supportsWep)return null;var u=s.extensions[EXTENSION_NAME$2];return r.loadImage(u.source).then(function(l){var c=new THREE__namespace.Texture(l);c.needsUpdate=!0,c.flipY=!1,s.name&&(c.name=s.name);var f=r.json.samplers||{},p=f[s.sampler]||{};return c.magFilter=WEBGL_FILTERS[p.magFilter]||THREE__namespace.LinearFilter,c.minFilter=WEBGL_FILTERS[p.minFilter]||THREE__namespace.LinearMipmapLinearFilter,c.wrapS=WEBGL_WRAPPINGS[p.wrapS]||THREE__namespace.RepeatWrapping,c.wrapT=WEBGL_WRAPPINGS[p.wrapT]||THREE__namespace.RepeatWrapping,c.onUpdate=function(){l.close()},c})},t})(BaseExtension),EXTENSION_NAME$1="CESIUM_RTC",CESIUM_RTC=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.emitResult=function(e,r){if(r.json.extensions[EXTENSION_NAME$1]&&r.json.extensions[EXTENSION_NAME$1].center){var o=r.json.extensions[EXTENSION_NAME$1].center;e.CESIUM_RTC={center:new THREE__namespace.Vector3().fromArray(o)}}},t})(BaseExtension),PBM_mesh=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.loadMesh=function(e,r){var o=this,s=r.json.meshes[e],u=s.primitives,l=Promise.all(u.map(function(p){return r.loadGeometry(p)})),c=Promise.all(u.map(function(p){return o.loadPBMMaterial(p,r)})),f=Promise.all([l,c]).then(function(p){for(var d,h=p[0],g=p[1],m=[],E=0;E<u.length;E++){var y=u[E],v=h[E],A=g[E],b=(d=y.mode)!==null&&d!==void 0?d:WEBGL_CONSTANTS.TRIANGLES,T=void 0;if(b===WEBGL_CONSTANTS.TRIANGLES||b===WEBGL_CONSTANTS.TRIANGLE_STRIP||b===WEBGL_CONSTANTS.TRIANGLE_FAN)if(b===WEBGL_CONSTANTS.TRIANGLE_STRIP?v=r.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleStripDrawMode):b===WEBGL_CONSTANTS.TRIANGLE_FAN&&(v=r.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleFanDrawMode)),v.clearGroups(),v.addGroup(0,v.index?v.index.count:v.attributes.position.count,0),r.disposeSet.add(v),s.isSkinnedMesh){var _=new PBMSkinnedMesh(v,[A]);r.normalizeSkinWeights(_),T=_}else T=new PBMMesh(v,[A]);else if(b===WEBGL_CONSTANTS.POINTS)T=new PBMPointCloud(v,A);else throw new Error("glTF: Primitive mode unsupported: "+b);if(Object.keys(v.morphAttributes).length>0){if(s.weights!==void 0)for(var S=0,w=s.weights.length;S<w;S++)T.morphTargetInfluences[S]=s.weights[S];if(s.extras&&Array.isArray(s.extras.targetNames)){var R=s.extras.targetNames;if(T.morphTargetInfluences.length===R.length){T.morphTargetDictionary={};for(var S=0,w=R.length;S<w;S++)T.morphTargetDictionary[R[S]]=S}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}T.name=s.name||"mesh_"+e,r.assignFinalMaterial(T),m.push(T)}if(m.length===1)return m[0];for(var I=new THREE__namespace.Group,H=0,C=m;H<C.length;H++){var T=C[H];I.add(T)}return I});return f},t.prototype.loadPBMMaterial=function(e,r){var o,s=(o=e.mode)!==null&&o!==void 0?o:WEBGL_CONSTANTS.TRIANGLES,u=null;if(s===WEBGL_CONSTANTS.TRIANGLES||s===WEBGL_CONSTANTS.TRIANGLE_STRIP||s===WEBGL_CONSTANTS.TRIANGLE_FAN)u=this.loadPBMMeshMaterial(e,r);else if(s===WEBGL_CONSTANTS.POINTS)u=this.loadPBMPointCloudMaterial(e,r);else throw new Error("glTF: Primitive mode unsupported: "+s);return u=u.then(function(l){return Promise.all(values(r.extensions).map(function(c){return c.extendMaterial(l,e,r)})).then(function(){return l})}),u},t.prototype.extendTexture=function(e,r,o){return e instanceof THREE__namespace.CompressedTexture||(e.minFilter=THREE__namespace.LinearFilter,e.magFilter=THREE__namespace.LinearFilter,e.generateMipmaps=!1),e},t.prototype.loadPBMPointCloudMaterial=function(e,r){var o=new PBMPointCloudMaterial;return r.disposeSet.add(o),Promise.resolve(o)},t.prototype.loadPBMMeshMaterial=function(e,r){var o=[],s=r.extensions.KHR_materials_unlit?"basic":"standard",u=new PBMMeshMaterial(s);if(u.color=new THREE__namespace.Color(1,1,1),u.opacity=1,u.colorAlpha=1,e.material!==void 0){var l=r.json.materials[e.material];l.name&&(u.name=l.name);var c=l.pbrMetallicRoughness||{};if(Array.isArray(c.baseColorFactor)){var f=c.baseColorFactor;u.color=new THREE__namespace.Color().fromArray(f),u.colorAlpha=f[3]}c.baseColorTexture!==void 0&&o.push(r.createMaterialTexture(c.baseColorTexture).then(function(h){h.encoding=THREE__namespace.sRGBEncoding,u.map=h,l.alphaMode===ALPHA_MODES.MASK&&!(h instanceof THREE__namespace.CompressedTexture)&&h.minFilter!==THREE__namespace.LinearMipmapLinearFilter&&(h.minFilter=THREE__namespace.LinearMipmapLinearFilter,h.generateMipmaps=!0),r.disposeSet.add(h)})),u.metalness=c.metallicFactor!==void 0?c.metallicFactor:1,u.roughness=c.roughnessFactor!==void 0?c.roughnessFactor:1,c.metallicRoughnessTexture!==void 0&&o.push(r.createMaterialTexture(c.metallicRoughnessTexture).then(function(h){h.format=THREE__namespace.RGBFormat,u.roughnessMap=h,u.metalnessMap=h,r.disposeSet.add(h)})),l.doubleSided===!0&&(u.side=THREE__namespace.DoubleSide);var p=l.alphaMode||ALPHA_MODES.OPAQUE;if(u.alphaMode="OPAQUE",p===ALPHA_MODES.BLEND?(u.alphaMode="BLEND",u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,p===ALPHA_MODES.MASK&&(u.alphaMode="MASK",u.alphaTest=l.alphaCutoff!==void 0?l.alphaCutoff:.5)),l.normalTexture!==void 0&&(o.push(r.createMaterialTexture(l.normalTexture).then(function(h){r.disposeSet.add(h),u.normalMap=h})),u.normalScale=new THREE__namespace.Vector2(1,1),l.normalTexture.scale!==void 0)){var d=l.normalTexture.scale;u.normalScale.set(d,d)}l.occlusionTexture!==void 0&&(o.push(r.createMaterialTexture(l.occlusionTexture).then(function(h){h.format=THREE__namespace.RGBFormat,u.aoMap=h,r.disposeSet.add(h)})),l.occlusionTexture.strength!==void 0&&(u.aoMapIntensity=l.occlusionTexture.strength)),l.emissiveFactor!==void 0&&(u.emissive=new THREE__namespace.Color().fromArray(l.emissiveFactor)),l.emissiveTexture!==void 0&&o.push(r.createMaterialTexture(l.emissiveTexture).then(function(h){h.format=THREE__namespace.RGBFormat,u.emissiveMap=h,r.disposeSet.add(h)}))}return r.disposeSet.add(u),Promise.all(o).then(function(){return u})},t})(BaseExtension),EXTENSION_NAME="REALSEE_materials_lightmap",REALSEE_materials_lightmap=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.extendMaterial=function(e,r,o){var s=[];if(o.json.materials&&r.material!==void 0){var u=o.json.materials[r.material],l=u.extensions[EXTENSION_NAME];l&&(l.lightMapTexture!==void 0&&s.push(o.createMaterialTexture(l.lightMapTexture).then(function(c){e.lightMap=c})),l.lightMapIntensity!==void 0&&(e.lightMapIntensity=l.lightMapIntensity))}return Promise.all(s).then(function(){})},t})(BaseExtension),EXTENSIONS={KHR_binary_glTF,KHR_draco_mesh_compression,KHR_texture_basisu,KHR_texture_transform,KHR_mesh_quantization,KHR_materials_unlit,EXT_meshopt_compression,EXT_texture_webp,CESIUM_RTC,REALSEE_materials_lightmap,PBM_mesh};function parseGltf(n,t){var e,r,o,s={},u,l;if(typeof n=="string")l=n;else{var c=EXTENSIONS.KHR_binary_glTF.getMagic(n);if(c===EXTENSIONS.KHR_binary_glTF.HEADER_MAGIC){u=new EXTENSIONS.KHR_binary_glTF;try{u.loadGlbBinary(n)}catch(m){return Promise.reject(m)}s.KHR_binary_glTF=u,l=u.content}else l=decodeText(new Uint8Array(n))}var f=JSON.parse(l);if(t.jsonModify&&(f=t.jsonModify(f)),f.asset===void 0||Number(f.asset.version[0])<2)return Promise.reject(new Error("glTF: Unsupported asset. glTF versions >=2.0 are supported."));if(f.extensionsUsed)for(var p=f.extensionsRequired||[],d=0;d<f.extensionsUsed.length;d++){var h=f.extensionsUsed[d];s[h]||(EXTENSIONS[h]?s[h]=new EXTENSIONS[h]:p.indexOf(h)>=0&&console.warn('glTF: Unknown extension "'+h+'".'))}var g=new Parser(f,s,{copyUV2:(e=t.copyUV2)!==null&&e!==void 0?e:!1,resourcePath:(r=t.resourcePath)!==null&&r!==void 0?r:"",search:(o=t.search)!==null&&o!==void 0?o:"",fetcher:t.fetcher});return g.parse().then(function(m){return u&&u.clear(),m})}function loadB3dm(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.modelUpAxis)!==null&&e!==void 0?e:"Y",u=(r=t.upAxis)!==null&&r!==void 0?r:"Z",l=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,c={uri:n};return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"}).then(function(f){return f.body})}).then(function(f){return Promise.resolve(0).then(function(p){return parseHeader$1(c,f,p)}).then(function(p){return parseTable(c,f,p)}).then(function(p){return parseGlTFArrayBuffer(c,f,p)})}).then(function(){var f;return parseGltf(c.gltfArrayBuffer,{copyUV2:!1,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(f=n.split("?")[1])!==null&&f!==void 0?f:"",jsonModify:function(p){var d;if(p.extensionsUsed=(d=p.extensionsUsed)!==null&&d!==void 0?d:[],typeof t.light=="boolean"){var h="KHR_materials_unlit";if(t.light){var g=p.extensionsUsed.indexOf(h);g>=0&&p.extensionsUsed.splice(g,1)}else{var g=p.extensionsUsed.indexOf(h);g===-1&&p.extensionsUsed.push(h)}}{var h="PBM_mesh",g=p.extensionsUsed.indexOf(h);g===-1&&p.extensionsUsed.push(h)}return p},fetcher:l}).then(function(p){var d=new THREE__namespace.Matrix4;s==="Y"&&d.premultiply(ROTATE_X_MATRIX);var h;if(c.rtcCenter?h=new THREE__namespace.Vector3().fromArray(c.rtcCenter):p.CESIUM_RTC&&(h=new THREE__namespace.Vector3().copy(p.CESIUM_RTC.center)),h){var g=new THREE__namespace.Matrix4().setPosition(h);d.premultiply(g)}return u==="Y"&&d.premultiply(ROTATE_X_MATRIX_INVERSE),p.scene.applyMatrix4(d),c.featureTableBinary=void 0,c.batchTableBinary=void 0,c.gltfArrayBuffer=void 0,{type:"b3dm",modelUpAxis:s,upAxis:"Z",uri:c.uri,byteLength:c.byteLength,memoryUsage:getMemoryUsage(p.scene),scene:p.scene,textures:p.textures,animations:[],rtcCenter:h,dispose:function(){return p.dispose()}}})})}const jsContent$1=`(function(){"use strict";function B(a){onmessage=function(r){Promise.resolve(r.data).then(function(n){return a(n)}).then(function(n){var e=n.output,t=n.transfer;return postMessage(e,t)}).catch(function(n){return postMessage({$$error:n})})}}var u,y;(function(a){a[a.BYTE=5120]="BYTE",a[a.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",a[a.SHORT=5122]="SHORT",a[a.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",a[a.INT=5124]="INT",a[a.UNSIGNED_INT=5125]="UNSIGNED_INT",a[a.FLOAT=5126]="FLOAT",a[a.DOUBLE=5130]="DOUBLE"})(y||(y={}));var c=(u={},u[y.DOUBLE]=Float64Array,u[y.FLOAT]=Float32Array,u[y.UNSIGNED_SHORT]=Uint16Array,u[y.UNSIGNED_INT]=Uint32Array,u[y.UNSIGNED_BYTE]=Uint8Array,u[y.BYTE]=Int8Array,u[y.SHORT]=Int16Array,u[y.INT]=Int32Array,u),F={DOUBLE:y.DOUBLE,FLOAT:y.FLOAT,UNSIGNED_SHORT:y.UNSIGNED_SHORT,UNSIGNED_INT:y.UNSIGNED_INT,UNSIGNED_BYTE:y.UNSIGNED_BYTE,BYTE:y.BYTE,SHORT:y.SHORT,INT:y.INT};function O(a){var r=c[a];if(!r)throw new Error("Failed to convert GL type");return r}function p(a){var r=O(a);return r.BYTES_PER_ELEMENT}function _(a,r,n,e){n===void 0&&(n=0);var t=O(a);if(n%p(a)!==0){var i=e?r.slice(n,n+e*p(a)):r.slice(n);return new t(i)}else return new t(r,n,e!=null?e:(r.byteLength-n)/p(a))}function l(a){var r=F[a];if(!r)throw new Error("Failed to convert GL type");return r}var R=(function(){function a(r,n){this.featuresLength=0,this.cachedTypedArrays={},this.json=r,this.buffer=n;var e=this.getGlobalProperty("POINTS_LENGTH",y.UNSIGNED_INT,1);e&&e.length&&(this.featuresLength=e[0])}return a.prototype.getExtension=function(r){return this.json.extensions&&this.json.extensions[r]},a.prototype.hasProperty=function(r){return!!this.json[r]},a.prototype.getGlobalProperty=function(r,n,e){var t=this.json[r];if(typeof t=="number"){var i=O(n);return new i([t])}else if(Array.isArray(t)){var i=O(n);return new i(t)}else if(t&&Number.isFinite(t.byteOffset))return this.getTypedArrayFromBinary(r,n,e,1,t.byteOffset);return null},a.prototype.getPropertyArray=function(r,n,e){var t=this.json[r];return t&&Number.isFinite(t.byteOffset)?("componentType"in t&&(n=l(t.componentType)),this.getTypedArrayFromBinary(r,n,e,this.featuresLength,t.byteOffset)):this.getTypedArrayFromArray(r,n,t)},a.prototype.getProperty=function(r,n,e,t,i){var o=this.json[r];if(!o)return null;var v=this.getPropertyArray(r,n,e);if(e===1)return i[0]=v[t],i;for(var A=0;A<e;++A)i[A]=v[e*t+A];return i},a.prototype.getTypedArrayFromBinary=function(r,n,e,t,i){var o=this.cachedTypedArrays,v=o[r];return v||(v=_(n,this.buffer.buffer,this.buffer.byteOffset+i,t*e),o[r]=v),v},a.prototype.getTypedArrayFromArray=function(r,n,e){var t=this.cachedTypedArrays,i=t[r];return i||(i=_(n,e),t[r]=i),i},a})();B(function(a){return Promise.resolve(a).then(function(r){var n=new R(r.featureTableJson,r.featureTableBinary),e=d(n),t=g(n),i=P(n),o=[];return e&&o.push(e.array.buffer),t&&o.push(t.array.buffer),i&&o.push(i.array.buffer),{output:{position:e,color:t,normal:i},transfer:o}})});var U=65535;function d(a){if(a.hasProperty("POSITION")){var r=a.getPropertyArray("POSITION",y.FLOAT,3);return{array:r,itemSize:3,normalized:!1}}else if(a.hasProperty("POSITION_QUANTIZED")){var n=a.getPropertyArray("POSITION_QUANTIZED",y.UNSIGNED_SHORT,3),e=a.getGlobalProperty("QUANTIZED_VOLUME_SCALE",y.FLOAT,3),t=a.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",y.FLOAT,3);if(!e||!t)throw new Error("QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.");for(var i=new Float32Array(n.length),o=n.length/3,v=e[0]/U,A=e[1]/U,N=e[2]/U,E=t[0],S=t[1],s=t[2],T=0,I=void 0;T<o;T++)I=T*3,i[I]=n[I]*v+E,i[++I]=n[I]*A+S,i[++I]=n[I]*N+s;return{array:i,itemSize:3,normalized:!1}}return null}function g(a){if(a.hasProperty("RGB")){for(var r=a.getPropertyArray("RGB",y.UNSIGNED_BYTE,3),n=r.length/3,e=new Uint8Array(n*4),t=0,i=void 0,o=void 0;t<n;t++)o=t*4,i=t*3,e[o]=r[i],e[++o]=r[++i],e[++o]=r[++i];return{array:e,itemSize:4,normalized:!0}}else if(a.hasProperty("RGBA")){var r=a.getPropertyArray("RGBA",y.UNSIGNED_BYTE,4);return{array:r,itemSize:4,normalized:!0}}else if(a.hasProperty("RGB565")){for(var r=a.getPropertyArray("RGB565",y.UNSIGNED_SHORT,1),n=r.length,e=new Uint8Array(n*4),t=0,v=void 0,A=void 0;t<n;t++)A=r[t],v=t*4,e[v]=(A>>11&31)<<3,e[++v]=(A>>5&63)<<2,e[++v]=(A&31)<<3;return{array:e,itemSize:4,normalized:!0}}return null}var G=255,h=127,D=2/G;function P(a){if(a.hasProperty("NORMAL")){for(var r=a.getPropertyArray("NORMAL",y.FLOAT,3),n=r.length/3,e=new Int8Array(n*4),t=0,i=void 0,o=void 0;t<n;t++)o=t*4,i=t*3,e[o]=r[i]*h,e[++o]=r[++i]*h,e[++o]=r[++i]*h;return{array:e,itemSize:4,normalized:!0}}else if(a.hasProperty("NORMAL_OCT16P")){for(var r=a.getPropertyArray("NORMAL_OCT16P",y.UNSIGNED_BYTE,2),n=r.length/2,e=new Int8Array(n*4),t=0,v=void 0,A=void 0,N=void 0,E=void 0,S=void 0,s=void 0,T=void 0;t<n;t++)v=t*2,A=r[v]*D-1,N=r[++v]*D-1,S=A<0?-A:A,s=N<0?-N:N,E=1-(S+s),E<0&&(A=(1-s)*(A<0?-1:1),N=(1-S)*(N<0?-1:1)),T=Math.sqrt(A*A+N*N+E*E),v=t*4,e[v]=A/T*h,e[++v]=N/T*h,e[++v]=E/T*h;return{array:e,itemSize:4,normalized:!0}}return null}})();
|
|
917
917
|
`,blob$1=typeof self!="undefined"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",jsContent$1],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(n){let t;try{if(t=blob$1&&(self.URL||self.webkitURL).createObjectURL(blob$1),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(jsContent$1),{name:n==null?void 0:n.name})}}var attributeWorkerPool=new WorkerPool(function(){return new WorkerWrapper$1},2);function parsePointCloud(n,t,e){var r=new FeatureTable(n.featureTableJson,n.featureTableBinary);return Promise.resolve().then(function(){var o=r.getExtension("3DTILES_draco_point_compression");return o?parseDraco(o,r):attributeWorkerPool.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(function(o){return n.attributes=o,e})}function parseDraco(n,t){return __awaiter(this,void 0,void 0,function(){var e,r,o,s,u,l;return __generator(this,function(c){if(e=n.properties||{},r=n.byteOffset,o=n.byteLength,!e||!Number.isFinite(r)||!o)throw new Error("Draco properties, byteOffset, and byteLength must be defined");return s=t.buffer.slice(r,r+o),u=n.properties,l={POSITION:"Float32Array",NORMAL:"Float32Array",RGB:"Uint8Array",RGBA:"Uint8Array"},[2,draco.decodeGeometry(s.buffer,{attributeIDs:u,attributeTypes:l,useUniqueIDs:!0}).then(function(f){var p=f.getAttribute("POSITION"),d=f.getAttribute("RGB"),h=f.getAttribute("RGBA"),g=f.getAttribute("NORMAL"),m;if(h)m=h;else if(d){for(var E=d.count,y=d.array,v=new Uint8Array(E*4),A=0,b=void 0,T=void 0;A<E;A++)T=A*4,b=A*3,v[T]=y[b],v[++T]=y[++b],v[++T]=y[++b];m=new THREE__namespace.BufferAttribute(v,4,d.normalized)}return{position:p?{array:p.array,itemSize:p.itemSize,normalized:p.normalized}:null,color:m?{array:m.array,itemSize:m.itemSize,normalized:m.normalized}:null,normal:g?{array:g.array,itemSize:g.itemSize,normalized:g.normalized}:null}})]})})}function loadPnts(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u={uri:n};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return l.body})}).then(function(l){return Promise.resolve(0).then(function(c){return parseHeader$1(u,l,c)}).then(function(c){return parseTable(u,l,c)}).then(function(c){return parsePointCloud(u,l,c)})}).then(function(){var l;return createPoints(u.attributes,{computeBoundingBox:(l=t.computeBoundingBox)!==null&&l!==void 0?l:!0})}).then(function(l){var c=new THREE__namespace.Matrix4,f;if(u.rtcCenter&&(f=new THREE__namespace.Vector3().fromArray(u.rtcCenter)),f){var p=new THREE__namespace.Matrix4().setPosition(f);c.premultiply(p)}return o==="Y"&&c.premultiply(ROTATE_X_MATRIX_INVERSE),l.object.applyMatrix4(c),u.gltfArrayBuffer=void 0,u.featureTableBinary=void 0,u.batchTableBinary=void 0,{type:"pnts",modelUpAxis:"Z",upAxis:o,uri:u.uri,byteLength:u.byteLength,memoryUsage:getMemoryUsage(l.object),scene:l.object,textures:[],animations:[],rtcCenter:f,dispose:function(){return l.dispose()}}})}function createPoints(n,t){var e=new Set,r=new THREE__namespace.BufferGeometry;e.add(r);var o=new PBMPointCloudMaterial;e.add(o),n.position&&r.setAttribute("position",new THREE__namespace.BufferAttribute(n.position.array,n.position.itemSize,n.position.normalized)),n.color&&r.setAttribute("color",new THREE__namespace.BufferAttribute(n.color.array,n.color.itemSize,n.color.normalized)),n.normal?r.setAttribute("normal",new THREE__namespace.BufferAttribute(n.normal.array,n.normal.itemSize,n.normal.normalized)):o.flatShading=!0,t.computeBoundingBox&&r.computeBoundingBox();var s=new PBMPointCloud(r,o);return s.matrix.compose(s.position,s.quaternion,s.scale),s.matrixAutoUpdate=!1,s.frustumCulled=!1,Promise.resolve({object:s,dispose:function(){e.forEach(function(u){u.dispose()}),e.clear()}})}function loadGltf(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.modelUpAxis)!==null&&e!==void 0?e:"Y",u=(r=t.upAxis)!==null&&r!==void 0?r:"Z",l=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,c=0;return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"}).then(function(f){return c=f.body.byteLength,f.body})}).then(function(f){var p;return parseGltf(f,{copyUV2:!1,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(p=n.split("?")[1])!==null&&p!==void 0?p:"",jsonModify:function(d){var h;if(d.extensionsUsed=(h=d.extensionsUsed)!==null&&h!==void 0?h:[],typeof t.light=="boolean"){var g="KHR_materials_unlit";if(t.light){var m=d.extensionsUsed.indexOf(g);m>=0&&d.extensionsUsed.splice(m,1)}else{var m=d.extensionsUsed.indexOf(g);m===-1&&d.extensionsUsed.push(g)}}{var g="PBM_mesh",m=d.extensionsUsed.indexOf(g);m===-1&&d.extensionsUsed.push(g)}return d},fetcher:l})}).then(function(f){var p,d=new THREE__namespace.Matrix4;if(s==="Y"&&d.premultiply(ROTATE_X_MATRIX),f.CESIUM_RTC){var h=new THREE__namespace.Matrix4().setPosition(f.CESIUM_RTC.center);d.premultiply(h)}return u==="Y"&&d.premultiply(ROTATE_X_MATRIX_INVERSE),f.scene.applyMatrix4(d),{type:"gltf",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(f.scene),scene:f.scene,textures:f.textures,animations:f.animations,rtcCenter:(p=f.CESIUM_RTC)===null||p===void 0?void 0:p.center,dispose:function(){return f.dispose()}}})}var scratchColor=new THREE__namespace.Color;function loadPly(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.modelUpAxis)!==null&&e!==void 0?e:"Z",u=(r=t.upAxis)!==null&&r!==void 0?r:"Z",l=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,c=0;return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"}).then(function(f){return c=f.body.byteLength,f.body})}).then(function(f){var p,d;return parsePly(f,{propertyNameMapping:(p=t.propertyNameMapping)!==null&&p!==void 0?p:{},customPropertyMapping:(d=t.customPropertyMapping)!==null&&d!==void 0?d:{}})}).then(function(f){var p=f.geometry;switch(t.type){case"geometry":{var d=p;return s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getGeometryMemoryUsed(d),scene:d,textures:[],animations:[],dispose:function(){p.dispose()}}}case"line":{var h="color"in p.attributes,g=new THREE__namespace.LineBasicMaterial({vertexColors:h}),d=new THREE__namespace.Line(p,g);return d.computeLineDistances(),s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(d),scene:d,textures:[],animations:[],dispose:function(){p.dispose(),g.dispose()}}}case"pbmMesh":{var m=new PBMMeshMaterial(t.light?"phong":"basic");m.vertexColors="color"in p.attributes;var d=new THREE__namespace.Mesh(p,m);return s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(d),scene:d,textures:[],animations:[],dispose:function(){p.dispose(),m.dispose()}}}case"pbmPointCloud":{var E=new PBMPointCloudMaterial,d=new PBMPointCloud(p,E);return s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(d),scene:d,textures:[],animations:[],dispose:function(){p.dispose(),E.dispose()}}}}throw new Error("Invalid Type: ".concat(t.type))})}function parsePly(n,t){var e=new Uint8Array(n),r=extractHeaderText(e),o=r.headerText,s=r.headerLength,u=parseHeader(o,s,t);if(u.format==="ascii"){var l=new TextDecoder().decode(e);return{header:u,geometry:parseASCII(l,u,t)}}else return{header:u,geometry:parseBinary(n,u,t)}}function makePlyElementProperty(n,t){var e={name:"",type:n[0]};return e.type==="list"?(e.name=n[3],e.countType=n[1],e.itemType=n[2]):e.name=n[1],e.name in t.propertyNameMapping&&(e.name=t.propertyNameMapping[e.name]),e}function parseHeader(n,t,e){t===void 0&&(t=0);var r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,o="",s=r.exec(n);s!==null&&(o=s[1]);for(var u={format:"",version:"",comments:[],elements:[],headerLength:t,objInfo:""},l=o.split(/\r\n|\r|\n/),c=null,f=0;f<l.length;f++){var p=l[f];if(p=p.trim(),p!==""){var d=p.split(/\s+/),h=d.shift();switch(p=d.join(" "),h){case"format":u.format=d[0],u.version=d[1];break;case"comment":u.comments.push(p);break;case"element":c&&u.elements.push(c),c={name:d[0],count:parseInt(d[1]),properties:[]};break;case"property":c&&c.properties.push(makePlyElementProperty(d,e));break;case"obj_info":u.objInfo=p;break;default:console.log("unhandled",h,d)}}}return c&&u.elements.push(c),u}function parseASCIINumber(n,t){switch(t){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(n);case"float":case"double":case"float32":case"float64":return parseFloat(n);default:throw new Error("unspport type: "+t)}}function parseASCIIElement(n,t){for(var e={},r=0;r<n.length;r++){if(t.empty())return null;if(n[r].type==="list"){for(var o=[],s=parseASCIINumber(t.next(),n[r].countType),u=0;u<s;u++){if(t.empty())return null;o.push(parseASCIINumber(t.next(),n[r].itemType))}e[n[r].name]=o}else e[n[r].name]=parseASCIINumber(t.next(),n[r].type)}return e}function createBuffer(n){for(var t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]},e=0,r=Object.keys(n.customPropertyMapping);e<r.length;e++){var o=r[e];t[o]=[]}return t}function mapElementAttributes(n){var t=n.map(function(r){return r.name});function e(r){for(var o=0,s=r.length;o<s;o++){var u=r[o];if(t.includes(u))return u}return null}return{attrX:e(["x","px","posx"])||"x",attrY:e(["y","py","posy"])||"y",attrZ:e(["z","pz","posz"])||"z",attrNX:e(["nx","normalx"]),attrNY:e(["ny","normaly"]),attrNZ:e(["nz","normalz"]),attrS:e(["s","u","texture_u","tx"]),attrT:e(["t","v","texture_v","ty"]),attrR:e(["red","diffuse_red","r","diffuse_r"]),attrG:e(["green","diffuse_green","g","diffuse_g"]),attrB:e(["blue","diffuse_blue","b","diffuse_b"])}}function parseASCII(n,t,e){var r=createBuffer(e),o=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,s,u=null;(u=o.exec(n))!==null?s=u[1].split(/\s+/):s=[];var l=new ArrayStream(s);e:for(var c=0;c<t.elements.length;c++)for(var f=t.elements[c],p=mapElementAttributes(f.properties),d=0;d<f.count;d++){var h=parseASCIIElement(f.properties,l);if(!h)break e;handleElement(r,f.name,h,p,e)}return postProcess(r,e)}function postProcess(n,t){var e=new THREE__namespace.BufferGeometry;n.indices.length>0&&e.setIndex(n.indices),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(n.vertices,3)),n.normals.length>0&&e.setAttribute("normal",new THREE__namespace.Float32BufferAttribute(n.normals,3)),n.uvs.length>0&&e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(n.uvs,2)),n.colors.length>0&&e.setAttribute("color",new THREE__namespace.Float32BufferAttribute(n.colors,3)),(n.faceVertexUvs.length>0||n.faceVertexColors.length>0)&&(e=e.toNonIndexed(),n.faceVertexUvs.length>0&&e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(n.faceVertexUvs,2)),n.faceVertexColors.length>0&&e.setAttribute("color",new THREE__namespace.Float32BufferAttribute(n.faceVertexColors,3)));for(var r=0,o=Object.keys(t.customPropertyMapping);r<o.length;r++){var s=o[r];if(n[s].length>0){var u=t.customPropertyMapping[s],l=u.itemType,c=u.itemNames,f=u.normalized,p=c.length,d=void 0;switch(l){case"float32":d=new THREE__namespace.Float32BufferAttribute(n[s],p,f);break;case"uint32":d=new THREE__namespace.Uint32BufferAttribute(n[s],p,f);break;case"int32":d=new THREE__namespace.Int32BufferAttribute(n[s],p,f);break;case"uint16":d=new THREE__namespace.Uint16BufferAttribute(n[s],p,f);break;case"int16":d=new THREE__namespace.Int16BufferAttribute(n[s],p,f);break;case"uint8":d=new THREE__namespace.Uint8BufferAttribute(n[s],p,f);break;case"int8":d=new THREE__namespace.Int8BufferAttribute(n[s],p,f);break;default:d=new THREE__namespace.Float32BufferAttribute(n[s],p,f);break}e.setAttribute(s,d)}}return e.computeBoundingSphere(),e}function handleElement(n,t,e,r,o){if(t==="vertex"){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&n.vertices.push(e[r.attrX],e[r.attrY],e[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&n.normals.push(e[r.attrNX],e[r.attrNY],e[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&n.uvs.push(e[r.attrS],e[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(scratchColor.setRGB(e[r.attrR]/255,e[r.attrG]/255,e[r.attrB]/255),n.colors.push(scratchColor.r,scratchColor.g,scratchColor.b));for(var s=0,u=Object.keys(o.customPropertyMapping);s<u.length;s++)for(var l=u[s],c=0,f=o.customPropertyMapping[l].itemNames;c<f.length;c++){var p=f[c];n[l].push(e[p])}}else if(t==="face"){var d=e.vertex_indices||e.vertex_index,h=e.texcoord;d.length===3?(n.indices.push(d[0],d[1],d[2]),h&&h.length===6&&(n.faceVertexUvs.push(h[0],h[1]),n.faceVertexUvs.push(h[2],h[3]),n.faceVertexUvs.push(h[4],h[5]))):d.length===4&&(n.indices.push(d[0],d[1],d[3]),n.indices.push(d[1],d[2],d[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(scratchColor.setRGB(e[r.attrR]/255,e[r.attrG]/255,e[r.attrB]/255),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b))}}function binaryReadElement(n,t){for(var e={},r=0,o=0;o<t.length;o++){var s=t[o],u=s.valueReader;if(s.type==="list"){var l=[],c=s.countReader.read(n+r);r+=s.countReader.size;for(var f=0;f<c;f++)l.push(u.read(n+r)),r+=u.size;e[s.name]=l}else e[s.name]=u.read(n+r),r+=u.size}return[e,r]}function setPropertyBinaryReaders(n,t,e){function r(l,c,f){switch(c){case"int8":case"char":return{read:function(p){return l.getInt8(p)},size:1};case"uint8":case"uchar":return{read:function(p){return l.getUint8(p)},size:1};case"int16":case"short":return{read:function(p){return l.getInt16(p,f)},size:2};case"uint16":case"ushort":return{read:function(p){return l.getUint16(p,f)},size:2};case"int32":case"int":return{read:function(p){return l.getInt32(p,f)},size:4};case"uint32":case"uint":return{read:function(p){return l.getUint32(p,f)},size:4};case"float32":case"float":return{read:function(p){return l.getFloat32(p,f)},size:4};case"float64":case"double":return{read:function(p){return l.getFloat64(p,f)},size:8};default:throw new Error("not support type: "+c)}}for(var o=0,s=n.length;o<s;o++){var u=n[o];u.type==="list"?(u.countReader=r(t,u.countType,e),u.valueReader=r(t,u.itemType,e)):u.valueReader=r(t,u.type,e)}}function parseBinary(n,t,e){for(var r=createBuffer(e),o=t.format==="binary_little_endian",s=new DataView(n,t.headerLength),u,l=0,c=0;c<t.elements.length;c++){var f=t.elements[c],p=f.properties,d=mapElementAttributes(p);setPropertyBinaryReaders(p,s,o);for(var h=0;h<f.count;h++){u=binaryReadElement(l,p),l+=u[1];var g=u[0];handleElement(r,f.name,g,d,e)}}return postProcess(r,e)}function extractHeaderText(n){var t=0,e=!0,r="",o=[],s=new TextDecoder().decode(n.subarray(0,5)),u=/^ply\r\n/.test(s);do{var l=String.fromCharCode(n[t++]);l!==`
|
|
918
|
-
`&&l!=="\r"?r+=l:(r==="end_header"&&(e=!1),r!==""&&(o.push(r),r=""))}while(e&&t<n.length);return u===!0&&t++,{headerText:o.join("\r")+"\r",headerLength:t}}var ArrayStream=(function(){function n(t){this.arr=t,this.i=0}return n.prototype.empty=function(){return this.i>=this.arr.length},n.prototype.next=function(){return this.arr[this.i++]},n})(),u8=Uint8Array,u16=Uint16Array,i32=Int32Array,fleb=new u8([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fdeb=new u8([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),clim=new u8([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(n,t){for(var e=new u16(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var o=new i32(e[30]),r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)o[s]=s-e[r]<<5|r;return{b:e,r:o}},_a$3=freb(fleb,2),fl=_a$3.b,revfl=_a$3.r;fl[28]=258,revfl[258]=28;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 f=o<<4|n[o],p=t-n[o],d=u[n[o]-1]++<<p,h=d|(1<<p)-1;d<=h;++d)l[rev[d]>>c]=f}else for(l=new u16(r),o=0;o<r;++o)n[o]&&(l[o]=rev[u[n[o]-1]++]>>15-n[o]);return l}),flt=new u8(288);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 f=function(G){var W=e.length;if(G>W){var $=new u8(Math.max(W*2,G));$.set(e),e=$}},p=t.f||0,d=t.p||0,h=t.b||0,g=t.l,m=t.d,E=t.m,y=t.n,v=o*8;do{if(!g){p=bits(n,d,1);var A=bits(n,d+1,3);if(d+=3,A)if(A==1)g=flrm,m=fdrm,E=9,y=5;else if(A==2){var S=bits(n,d,31)+257,w=bits(n,d+10,15)+4,R=S+bits(n,d+5,31)+1;d+=14;for(var I=new u8(R),H=new u8(19),C=0;C<w;++C)H[clim[C]]=bits(n,d+C*3,7);d+=w*3;for(var M=max(H),B=(1<<M)-1,L=hMap(H,M,1),C=0;C<R;){var O=L[bits(n,d,B)];d+=O&15;var b=O>>4;if(b<16)I[C++]=b;else{var k=0,D=0;for(b==16?(D=3+bits(n,d,3),d+=2,k=I[C-1]):b==17?(D=3+bits(n,d,7),d+=3):b==18&&(D=11+bits(n,d,127),d+=7);D--;)I[C++]=k}}var q=I.subarray(0,S),z=I.subarray(S);E=max(q),y=max(z),g=hMap(q,E,1),m=hMap(z,y,1)}else err(1);else{var b=shft(d)+4,T=n[b-4]|n[b-3]<<8,_=b+T;if(_>o){c&&err(0);break}l&&f(h+T),e.set(n.subarray(b,_),h),t.b=h+=T,t.p=d=_*8,t.f=p;continue}if(d>v){c&&err(0);break}}l&&f(h+131072);for(var J=(1<<E)-1,V=(1<<y)-1,U=d;;U=d){var k=g[bits16(n,d)&J],j=k>>4;if(d+=k&15,d>v){c&&err(0);break}if(k||err(2),j<256)e[h++]=j;else if(j==256){U=d,g=null;break}else{var K=j-254;if(j>264){var C=j-257,ae=fleb[C];K=bits(n,d,(1<<ae)-1)+fl[C],d+=ae}var re=m[bits16(n,d)&V],ee=re>>4;re||err(3),d+=re&15;var z=fd[ee];if(ee>3){var ae=fdeb[ee];z+=bits16(n,d)&(1<<ae)-1,d+=ae}if(d>v){c&&err(0);break}l&&f(h+131072);var Z=h+K;if(h<z){var X=s-z,se=Math.min(z,Z);for(X+h<0&&err(3);h<se;++h)e[h]=r[X+h]}for(;h<Z;++h)e[h]=e[h-z]}}t.l=g,t.p=U,t.b=h,t.f=p,g&&(p=1,t.m=E,t.d=m,t.n=y)}while(!p);return h!=e.length&&u?slc(e,0,h):e.subarray(0,h)},et=new u8(0),b2=function(n,t){return n[t]|n[t+1]<<8},b4=function(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0},b8=function(n,t){return b4(n,t)+b4(n,t+4)*4294967296},zls=function(n,t){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&err(6,"invalid zlib data"),(n[1]>>5&1)==1&&err(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function inflateSync(n,t){return inflt(n,{i:2},t&&t.out,t&&t.dictionary)}function unzlibSync(n,t){return inflt(n.subarray(zls(n),-4),{i:2},t,t)}var td=typeof TextDecoder!="undefined"&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0}),tds=1}catch(n){}var dutf8=function(n){for(var t="",e=0;;){var r=n[e++],o=(r>127)+(r>223)+(r>239);if(e+o>n.length)return{s:t,r:slc(n,e-1)};o?o==3?(r=((r&15)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):o&1?t+=String.fromCharCode((r&31)<<6|n[e++]&63):t+=String.fromCharCode((r&15)<<12|(n[e++]&63)<<6|n[e++]&63):t+=String.fromCharCode(r)}};function strFromU8(n,t){if(t){for(var e="",r=0;r<n.length;r+=16384)e+=String.fromCharCode.apply(null,n.subarray(r,r+16384));return e}else{if(td)return td.decode(n);var o=dutf8(n),s=o.s,e=o.r;return e.length&&err(8),s}}var slzh=function(n,t){return t+30+b2(n,t+26)+b2(n,t+28)},zh=function(n,t,e){var r=b2(n,t+28),o=strFromU8(n.subarray(t+46,t+46+r),!(b2(n,t+8)&2048)),s=t+46+r,u=b4(n,t+20),l=e&&u==4294967295?z64e(n,s):[u,b4(n,t+24),b4(n,t+42)],c=l[0],f=l[1],p=l[2];return[b2(n,t+10),c,f,o,s+b2(n,t+30)+b2(n,t+32),p]},z64e=function(n,t){for(;b2(n,t)!=1;t+=4+b2(n,t+2));return[b8(n,t+12),b8(n,t+4),b8(n,t+20)]};function unzipSync(n,t){for(var e={},r=n.length-22;b4(n,r)!=101010256;--r)(!r||n.length-r>65558)&&err(13);var o=b2(n,r+8);if(!o)return{};var s=b4(n,r+16),u=s==4294967295||o==65535;if(u){var l=b4(n,r-12);u=b4(n,l)==101075792,u&&(o=b4(n,l+32),s=b4(n,l+48))}for(var c=0;c<o;++c){var f=zh(n,s,u),p=f[0],d=f[1],h=f[2],g=f[3],m=f[4],E=f[5],y=slzh(n,E);s=m,p?p==8?e[g]=inflateSync(n.subarray(y,y+d),{out:new u8(h)}):err(14,"unknown compression type "+p):e[g]=slc(n,y,y+d)}return e}function loadFbx(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u=0;return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return u=l.body.byteLength,l.body})}).then(function(l){var c;return parse$2(l,{light:t.light,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(c=n.split("?")[1])!==null&&c!==void 0?c:"",fetcher:s})}).then(function(l){var c=l.scene,f=l.unitScale/100,p=new THREE__namespace.Matrix4;if(p.makeScale(f,f,f),l.upAxis==="X")throw new Error("Cannot load fbx x upAxis");return l.upAxis==="Y"&&p.premultiply(ROTATE_X_MATRIX),o==="Y"&&p.premultiply(ROTATE_X_MATRIX_INVERSE),c.applyMatrix4(p),{type:"fbx",modelUpAxis:l.upAxis,upAxis:o,uri:n,byteLength:u,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:l.animations,dispose:function(){return l.dispose()}}})}function parse$2(n,t){var e;if(isFbxFormatBinary(n))e=new BinaryParser().parse(n);else{var r=convertArrayBufferToString(n);if(!isFbxFormatASCII(r))throw new Error("THREE.FBXLoader: Unknown format.");if(getFbxVersion(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+getFbxVersion(r));e=new TextParser().parse(r)}return new FBXTreeParser(t).parse(e)}var FBXTreeParser=(function(){function n(t){var e,r,o;this.light=(e=t.light)!==null&&e!==void 0?e:!0,this.resourcePath=(r=t.resourcePath)!==null&&r!==void 0?r:"",this.search=(o=t.search)!==null&&o!==void 0?o:"",this.fetcher=t.fetcher}return n.prototype.parse=function(t){var e,r,o,s,u,l,c=this.parseConnections(t),f=Object.assign(new THREE__namespace.Group,{animations:[]}),p=[],d=this.parseImages(t),h=this.parseTextures(t,d,c,p),g=this.parseMaterials(t,h,c),m=this.parseDeformers(t,c),E=new GeometryParser().parse(t,m,c);this.parseScene(t,m,E,g,c,f);var y=(r=(e=t.GlobalSettings.UpAxis)===null||e===void 0?void 0:e.value)!==null&&r!==void 0?r:1,v=(s=(o=t.GlobalSettings.FrontAxis)===null||o===void 0?void 0:o.value)!==null&&s!==void 0?s:2,A=(l=(u=t.GlobalSettings.UnitScaleFactor)===null||u===void 0?void 0:u.value)!==null&&l!==void 0?l:1,b;if(t.GlobalSettings.AmbientColor){var T=t.GlobalSettings.AmbientColor.value,_=T[0],S=T[1],w=T[2];if(_!==0||S!==0||w!==0){var R=new THREE__namespace.Color().setRGB(_,S,w);b=new THREE__namespace.AmbientLight(R,1)}}return Promise.all(p).then(function(I){var H;return{scene:f,textures:I,ambientLight:b,upAxis:["X","Y","Z"][y],frontAxis:["X","Y","Z"][v],unitScale:A,animations:(H=f.animations)!==null&&H!==void 0?H:[],dispose:function(){I.forEach(function(C){return C.dispose()}),g.forEach(function(C){return C.dispose()}),E.forEach(function(C){return C.dispose()})}}})},n.prototype.parseConnections=function(t){var e=new Map;if("Connections"in t){var r=t.Connections.connections;r.forEach(function(o){var s=o[0],u=o[1],l=o[2];e.has(s)||e.set(s,{parents:[],children:[]});var c={ID:u,relationship:l};e.get(s).parents.push(c),e.has(u)||e.set(u,{parents:[],children:[]});var f={ID:s,relationship:l};e.get(u).children.push(f)})}return e},n.prototype.parseImages=function(t){var e={},r={};if("Video"in t.Objects){var o=t.Objects.Video;for(var s in o){var u=o[s],l=parseInt(s);if(e[l]=u.RelativeFilename||u.Filename,"Content"in u){var c=u.Content instanceof ArrayBuffer&&u.Content.byteLength>0,f=typeof u.Content=="string"&&u.Content!=="";if(c||f){var p=this.parseImage(o[s]);r[u.RelativeFilename||u.Filename]=p}}}}for(var l in e){var d=e[l];r[d]!==void 0?e[l]=r[d]:e[l]=e[l].split("\\").pop()}return e},n.prototype.parseImage=function(t){var e=t.Content,r=t.RelativeFilename||t.Filename,o=r.slice(r.lastIndexOf(".")+1).toLowerCase(),s;switch(o){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":s="image/tga";break;default:return}if(typeof e=="string")return"data:"+s+";base64,"+e;var u=new Uint8Array(e);return window.URL.createObjectURL(new Blob([u],{type:s}))},n.prototype.parseTextures=function(t,e,r,o){var s=new Map;if("Texture"in t.Objects){var u=t.Objects.Texture;for(var l in u){var c=this.parseTexture(u[l],e,r,o);s.set(parseInt(l),c)}}return s},n.prototype.parseTexture=function(t,e,r,o){var s=this.loadTexture(t,e,r,o);s.ID=t.id,s.name=t.attrName;var u=t.WrapModeU,l=t.WrapModeV,c=u!==void 0?u.value:0,f=l!==void 0?l.value:0;if(s.wrapS=c===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,s.wrapT=f===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,t.Scaling){var p=t.Scaling.value;s.repeat.x=p[0],s.repeat.y=p[1]}if(t.Translation){var p=t.Translation.value;s.offset.x=p[0],s.offset.y=p[1]}return s},n.prototype.loadTexture=function(t,e,r,o){var s=r.get(t.id).children,u="";s!==void 0&&s.length>0&&e[s[0].ID]!==void 0&&(u=e[s[0].ID]),u=pathJoin(this.resourcePath,appendSearch(u,this.search));var l=Object.assign(new THREE__namespace.Texture,{ID:0}),c;canUseNativeImageBitmap()?c=this.fetcher.ajax(u,{responseType:"blob"}).then(function(p){var d=p.body;return createImageBitmapLike(d)}):c=this.fetcher.loadImage(u,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(p){return p.body});var f=c.then(function(p){return l.image=p,l.needsUpdate=!0,l}).catch(function(p){return console.warn(p),l});return o.push(f),l},n.prototype.parseMaterials=function(t,e,r){var o=new Map;if("Material"in t.Objects){var s=t.Objects.Material;for(var u in s){var l=this.parseMaterial(t,s[u],e,r);l!==null&&o.set(parseInt(u),l)}}return o},n.prototype.parseMaterial=function(t,e,r,o){var s=e.id,u=e.attrName,l=e.ShadingModel;if(typeof l=="object"&&(l=l.value),l=l.toLowerCase(),!o.has(s))return null;var c=new PBMMeshMaterial(this.light?"phong":"basic");c.name=u,e.BumpFactor&&(c.bumpScale=e.BumpFactor.value),e.Diffuse?c.color=new THREE__namespace.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(c.color=new THREE__namespace.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(c.displacementScale=e.DisplacementFactor.value),e.Emissive?c.emissive=new THREE__namespace.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(c.emissive=new THREE__namespace.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(c.emissiveIntensity=parseFloat(e.EmissiveFactor.value));var f=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0);(f===1||f===0)&&(f=e.Opacity?parseFloat(e.Opacity.value):null,f===null&&(f=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),c.opacity=f,c.opacity<1&&(c.transparent=!0),e.ReflectionFactor&&(c.reflectivity=e.ReflectionFactor.value),e.Shininess&&(c.shininess=e.Shininess.value),e.Specular?c.specular=new THREE__namespace.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(c.specular=new THREE__namespace.Color().fromArray(e.SpecularColor.value));var p=this;return o.get(s).children.forEach(function(d){var h=d.relationship;switch(h){case"Bump":c.bumpMap=p.getTexture(t,r,d.ID,o);break;case"Maya|TEX_ao_map":c.aoMap=p.getTexture(t,r,d.ID,o);break;case"DiffuseColor":case"Maya|TEX_color_map":c.map=p.getTexture(t,r,d.ID,o),c.map!==void 0&&(c.map.encoding=THREE__namespace.sRGBEncoding);break;case"DisplacementColor":c.displacementMap=p.getTexture(t,r,d.ID,o);break;case"EmissiveColor":c.emissiveMap=p.getTexture(t,r,d.ID,o),c.emissiveMap!==void 0&&(c.emissiveMap.encoding=THREE__namespace.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":c.normalMap=p.getTexture(t,r,d.ID,o);break;case"ReflectionColor":c.envMap=p.getTexture(t,r,d.ID,o),c.envMap!==void 0&&(c.envMap.mapping=THREE__namespace.EquirectangularReflectionMapping,c.envMap.encoding=THREE__namespace.sRGBEncoding);break;case"SpecularColor":c.specularMap=p.getTexture(t,r,d.ID,o),c.specularMap!==void 0&&(c.specularMap.encoding=THREE__namespace.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":c.alphaMap=p.getTexture(t,r,d.ID,o),c.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",h);break}}),c},n.prototype.getTexture=function(t,e,r,o){return t.Objects.LayeredTexture&&r in t.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=o.get(r).children[0].ID),e.get(r)},n.prototype.parseDeformers=function(t,e){var r={},o={};if("Deformer"in t.Objects){var s=t.Objects.Deformer;for(var u in s){var l=s[u],c=e.get(parseInt(u));if(l.attrType==="Skin"){var f=this.parseSkeleton(c,s);f.ID=u,c.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),f.geometryID=c.parents[0].ID,r[u]=f}else if(l.attrType==="BlendShape"){var p={id:u};p.rawTargets=this.parseMorphTargets(c,s,e),p.id=u,c.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),o[u]=p}}}return{skeletons:r,morphTargets:o}},n.prototype.parseSkeleton=function(t,e){var r=[];return t.children.forEach(function(o){var s=e[o.ID];if(s.attrType==="Cluster"){var u={ID:o.ID,indices:[],weights:[],transformLink:new THREE__namespace.Matrix4().fromArray(s.TransformLink.a)};s.Indexes&&(u.indices=s.Indexes.a,u.weights=s.Weights.a),r.push(u)}}),{ID:"",geometryID:0,rawBones:r,bones:[]}},n.prototype.parseMorphTargets=function(t,e,r){for(var o=[],s=0;s<t.children.length;s++){var u=t.children[s],l=e[u.ID],c={name:l.attrName,initialWeight:l.DeformPercent,id:l.id,fullWeights:l.FullWeights.a,geoID:0};if(l.attrType!=="BlendShapeChannel")return;c.geoID=r.get(parseInt(u.ID)).children.filter(function(f){return f.relationship===void 0})[0].ID,o.push(c)}return o},n.prototype.parseScene=function(t,e,r,o,s,u){var l=this.parseModels(t,e.skeletons,r,o,s),c=t.Objects.Model,f=this;l.forEach(function(d){var h=c[d.ID];f.setLookAtProperties(t,d,h,s,u);var g=s.get(d.ID).parents;g.forEach(function(m){var E=l.get(m.ID);E!==void 0&&E.add(d)}),d.parent===null&&u.add(d)}),this.bindSkeleton(t,e.skeletons,r,l,s),u.traverse(function(d){if(d.userData.transformData){d.parent&&(d.userData.transformData.parentMatrix=d.parent.matrix,d.userData.transformData.parentMatrixWorld=d.parent.matrixWorld);var h=generateTransform(d.userData.transformData);d.applyMatrix4(h),d.updateWorldMatrix(!0,!0)}});var p=new AnimationParser().parse(t,s,u);u.children.length===1&&u.children[0]instanceof THREE__namespace.Group&&(u=u.children[0]),u.animations=p},n.prototype.parseModels=function(t,e,r,o,s){var u=new Map,l=t.Objects.Model;for(var c in l){var f=parseInt(c),p=l[c],d=s.get(f),h=this.buildSkeleton(d,e,f,p.attrName);if(!h){switch(p.attrType){case"Camera":h=this.createCamera(t,d);break;case"Light":h=this.createLight(t,d);break;case"Mesh":h=this.createMesh(d,r,o);break;case"NurbsCurve":case"LimbNode":case"Root":h=new THREE__namespace.Bone;break;case"Null":default:h=new THREE__namespace.Group;break}h.name=p.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(p.attrName):"",h.userData.originalName=p.attrName,h.ID=f}this.getTransformData(h,p),u.set(f,h)}return u},n.prototype.buildSkeleton=function(t,e,r,o){var s=null;return t.parents.forEach(function(u){var l=function(f){var p=e[f];p.rawBones.forEach(function(d,h){if(d.ID===u.ID){var g=s;s=new THREE__namespace.Bone,s.matrixWorld.copy(d.transformLink),s.name=o?THREE__namespace.PropertyBinding.sanitizeNodeName(o):"",s.userData.originalName=o,s.ID=r,p.bones[h]=s,g!==null&&s.add(g)}})};for(var c in e)l(c)}),s},n.prototype.createCamera=function(t,e){var r,o;if(e.children.forEach(function(g){var m=t.Objects.NodeAttribute[g.ID];m!==void 0&&(o=m)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=0;o.CameraProjectionType!==void 0&&o.CameraProjectionType.value===1&&(s=1);var u=1;o.NearPlane!==void 0&&(u=o.NearPlane.value/1e3);var l=1e3;o.FarPlane!==void 0&&(l=o.FarPlane.value/1e3);var c=window.innerWidth,f=window.innerHeight;o.AspectWidth!==void 0&&o.AspectHeight!==void 0&&(c=o.AspectWidth.value,f=o.AspectHeight.value);var p=c/f,d=45;o.FieldOfView!==void 0&&(d=o.FieldOfView.value);var h=o.FocalLength?o.FocalLength.value:null;switch(s){case 0:r=new THREE__namespace.PerspectiveCamera(d,p,u,l),h!==null&&r.setFocalLength(h);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),r=new THREE__namespace.Object3D;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),r=new THREE__namespace.Object3D;break}}return r},n.prototype.createLight=function(t,e){var r,o;if(e.children.forEach(function(h){var g=t.Objects.NodeAttribute[h.ID];g!==void 0&&(o=g)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=void 0;o.LightType===void 0?s=0:s=o.LightType.value;var u=new THREE__namespace.Color(16777215);o.Color!==void 0&&(u=new THREE__namespace.Color().fromArray(o.Color.value));var l=o.Intensity===void 0?1:o.Intensity.value/100;o.CastLightOnObject!==void 0&&o.CastLightOnObject.value===0&&(l=0);var c=0;o.FarAttenuationEnd!==void 0&&(o.EnableFarAttenuation!==void 0&&o.EnableFarAttenuation.value===0?c=0:c=o.FarAttenuationEnd.value);var f=1;switch(s){case 0:r=new THREE__namespace.PointLight(u,l,c,f);break;case 1:r=new THREE__namespace.DirectionalLight(u,l);break;case 2:var p=Math.PI/3;o.InnerAngle!==void 0&&(p=THREE__namespace.MathUtils.degToRad(o.InnerAngle.value));var d=0;o.OuterAngle!==void 0&&(d=THREE__namespace.MathUtils.degToRad(o.OuterAngle.value),d=Math.max(d,1)),r=new THREE__namespace.SpotLight(u,l,c,p,d,f);break;default:console.warn("THREE.FBXLoader: Unknown light type "+o.LightType.value+", defaulting to a PointLight."),r=new THREE__namespace.PointLight(u,l);break}o.CastShadows!==void 0&&o.CastShadows.value===1&&(r.castShadow=!0)}return r},n.prototype.createMesh=function(t,e,r){var o,s=null,u=[];if(t.children.forEach(function(c){e.has(c.ID)&&(s=e.get(c.ID)),r.has(c.ID)&&u.push(r.get(c.ID))}),u.length===0){var l=new PBMMeshMaterial(this.light?"phong":"basic");l.color=new THREE__namespace.Color(13421772),u.push(l)}return"color"in s.attributes&&u.forEach(function(c){c.vertexColors=!0}),(!s.groups||s.groups.length===0)&&s.addGroup(0,s.index?s.index.count:s.attributes.position.count,0),s.FBX_Deformer?(u.forEach(function(c){c.skinning=!0}),o=new PBMSkinnedMesh(s,u),o.normalizeSkinWeights()):o=new PBMMesh(s,u),o},n.prototype.createCurve=function(t,e){var r=t.children.reduce(function(s,u){return e.has(u.ID)&&(s=e.get(u.ID)),s},null),o=new THREE__namespace.LineBasicMaterial({name:"",color:3342591,linewidth:1});return new THREE__namespace.Line(r,o)},n.prototype.getTransformData=function(t,e){var r={};e.InheritType&&(r.inheritType=parseInt(e.InheritType.value)),e.RotationOrder?r.eulerOrder=getEulerOrder(e.RotationOrder.value):r.eulerOrder=getEulerOrder(0),e.Lcl_Translation&&(r.translation=e.Lcl_Translation.value),e.PreRotation&&(r.preRotation=e.PreRotation.value),e.Lcl_Rotation&&(r.rotation=e.Lcl_Rotation.value),e.PostRotation&&(r.postRotation=e.PostRotation.value),e.Lcl_Scaling&&(r.scale=e.Lcl_Scaling.value),e.ScalingOffset&&(r.scalingOffset=e.ScalingOffset.value),e.ScalingPivot&&(r.scalingPivot=e.ScalingPivot.value),e.RotationOffset&&(r.rotationOffset=e.RotationOffset.value),e.RotationPivot&&(r.rotationPivot=e.RotationPivot.value),t.userData.transformData=r},n.prototype.setLookAtProperties=function(t,e,r,o,s){if("LookAtProperty"in r){var u=o.get(e.ID).children;u.forEach(function(l){if(l.relationship==="LookAtProperty"){var c=t.Objects.Model[l.ID];if(c.Lcl_Translation){var f=c.Lcl_Translation.value;"target"in e&&e.target instanceof THREE__namespace.Object3D?(e.target.position.fromArray(f),s.add(e.target)):e.lookAt(new THREE__namespace.Vector3().fromArray(f))}}})}},n.prototype.bindSkeleton=function(t,e,r,o,s){var u=this.parsePoseNodes(t),l=function(f){var p=e[f],d=s.get(parseInt(p.ID)).parents;d.forEach(function(h){if(r.has(h.ID)){var g=h.ID,m=s.get(g);m.parents.forEach(function(E){if(o.has(E.ID)){var y=o.get(E.ID);y instanceof THREE__namespace.SkinnedMesh&&y.bind(new THREE__namespace.Skeleton(p.bones),u[E.ID])}})}})};for(var c in e)l(c)},n.prototype.parsePoseNodes=function(t){var e={};if(t.Objects.Pose){var r=t.Objects.Pose;for(var o in r)if(r[o].attrType==="BindPose"&&r[o].NbPoseNodes>0){var s=r[o].PoseNode;Array.isArray(s)?s.forEach(function(u){e[u.Node]=new THREE__namespace.Matrix4().fromArray(u.Matrix.a)}):e[s.Node]=new THREE__namespace.Matrix4().fromArray(s.Matrix.a)}}return e},n})(),GeometryParser=(function(){function n(){this.negativeMaterialIndices=!1}return n.prototype.parse=function(t,e,r){var o=new Map;if("Geometry"in t.Objects){var s=t.Objects.Geometry;for(var u in s){var l=r.get(parseInt(u)),c=this.parseGeometry(t,l,s[u],e);o.set(parseInt(u),c)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),o},n.prototype.parseGeometry=function(t,e,r,o){switch(r.attrType){case"Mesh":return this.parseMeshGeometry(t,e,r,o);case"NurbsCurve":return this.parseNurbsGeometry(r)}},n.prototype.parseMeshGeometry=function(t,e,r,o){var s=o.skeletons,u=[],l=e.parents.map(function(h){return t.Objects.Model[h.ID]});if(l.length!==0){var c=e.children.reduce(function(h,g){return s[g.ID]!==void 0&&(h=s[g.ID]),h},null);e.children.forEach(function(h){o.morphTargets[h.ID]!==void 0&&u.push(o.morphTargets[h.ID])});var f=l[0],p={};f.RotationOrder&&(p.eulerOrder=getEulerOrder(f.RotationOrder.value)),f.InheritType&&(p.inheritType=parseInt(f.InheritType.value)),f.GeometricTranslation&&(p.translation=f.GeometricTranslation.value),f.GeometricRotation&&(p.rotation=f.GeometricRotation.value),f.GeometricScaling&&(p.scale=f.GeometricScaling.value);var d=generateTransform(p);return this.genGeometry(t,r,c,u,d)}},n.prototype.genGeometry=function(t,e,r,o,s){var u=new THREE__namespace.BufferGeometry;e.attrName&&(u.name=e.attrName);var l=this.parseGeoNode(e,r),c=this.genBuffers(l),f=new THREE__namespace.Float32BufferAttribute(c.vertex,3);if(f.applyMatrix4(s),u.setAttribute("position",f),c.colors.length>0&&u.setAttribute("color",new THREE__namespace.Float32BufferAttribute(c.colors,3)),r&&(u.setAttribute("skinIndex",new THREE__namespace.Uint16BufferAttribute(c.weightsIndices,4)),u.setAttribute("skinWeight",new THREE__namespace.Float32BufferAttribute(c.vertexWeights,4)),u.FBX_Deformer=r),c.normal.length>0){var p=new THREE__namespace.Matrix3().getNormalMatrix(s),d=new THREE__namespace.Float32BufferAttribute(c.normal,3);d.applyNormalMatrix(p),u.setAttribute("normal",d)}if(c.uvs.forEach(function(y,v){var A=v===0?"uv":"uv".concat(v+1);u.setAttribute(A,new THREE__namespace.Float32BufferAttribute(c.uvs[v],2))}),l.material&&l.material.mappingType!=="AllSame"){var h=c.materialIndex[0],g=0;if(c.materialIndex.forEach(function(y,v){y!==h&&(u.addGroup(g,v-g,h),h=y,g=v)}),u.groups.length>0){var m=u.groups[u.groups.length-1],E=m.start+m.count;E!==c.materialIndex.length&&u.addGroup(E,c.materialIndex.length-E,h)}u.groups.length===0&&u.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(t,u,e,o,s),u},n.prototype.parseGeoNode=function(t,e){var r={};if(r.vertexPositions=t.Vertices!==void 0?t.Vertices.a:[],r.vertexIndices=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(r.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(r.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(r.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){r.uv=[];for(var o=0;t.LayerElementUV[o];)t.LayerElementUV[o].UV&&r.uv.push(this.parseUVs(t.LayerElementUV[o])),o++}return r.weightTable={},e!==null&&(r.skeleton=e,e.rawBones.forEach(function(s,u){s.indices.forEach(function(l,c){r.weightTable[l]===void 0&&(r.weightTable[l]=[]),r.weightTable[l].push({id:u,weight:s.weights[c]})})})),r},n.prototype.genBuffers=function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,o=0,s=!1,u=[],l=[],c=[],f=[],p=[],d=[],h=this;return t.vertexIndices.forEach(function(g,m){var E=0,y=!1;g<0&&(g=g^-1,y=!0);var v=[],A=[];if(u.push(g*3,g*3+1,g*3+2),t.color){var b=getData(m,r,g,t.color);c.push(b[0],b[1],b[2])}if(t.skeleton){if(t.weightTable[g]!==void 0&&t.weightTable[g].forEach(function(w){A.push(w.weight),v.push(w.id)}),A.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);var T=[0,0,0,0],_=[0,0,0,0];A.forEach(function(w,R){var I=w,H=v[R];_.forEach(function(C,M,B){if(I>C){B[M]=I,I=C;var L=T[M];T[M]=H,H=L}})}),v=T,A=_}for(;A.length<4;)A.push(0),v.push(0);for(var S=0;S<4;++S)p.push(A[S]),d.push(v[S])}if(t.normal){var b=getData(m,r,g,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(E=getData(m,r,g,t.material)[0],E<0&&(h.negativeMaterialIndices=!0,E=0)),t.uv&&t.uv.forEach(function(w,R){var I=getData(m,r,g,w);f[R]===void 0&&(f[R]=[]),f[R].push(I[0]),f[R].push(I[1])}),o++,y&&(h.genFace(e,t,u,E,l,c,f,p,d,o),r++,o=0,u=[],l=[],c=[],f=[],p=[],d=[])}),e},n.prototype.getNormalNewell=function(t){for(var e=new THREE__namespace.Vector3(0,0,0),r=0;r<t.length;r++){var o=t[r],s=t[(r+1)%t.length];e.x+=(o.y-s.y)*(o.z+s.z),e.y+=(o.z-s.z)*(o.x+s.x),e.z+=(o.x-s.x)*(o.y+s.y)}return e.normalize(),e},n.prototype.getNormalTangentAndBitangent=function(t){var e=this.getNormalNewell(t),r=Math.abs(e.z)>.5?new THREE__namespace.Vector3(0,1,0):new THREE__namespace.Vector3(0,0,1),o=r.cross(e).normalize(),s=e.clone().cross(o).normalize();return{normal:e,tangent:o,bitangent:s}},n.prototype.flattenVertex=function(t,e,r){return new THREE__namespace.Vector2(t.dot(e),t.dot(r))},n.prototype.genFace=function(t,e,r,o,s,u,l,c,f,p){var d;if(p>3){for(var h=[],g=e.baseVertexPositions||e.vertexPositions,m=0;m<r.length;m+=3)h.push(new THREE__namespace.Vector3(g[r[m]],g[r[m+1]],g[r[m+2]]));for(var E=this.getNormalTangentAndBitangent(h),y=E.tangent,v=E.bitangent,A=[],b=0,T=h;b<T.length;b++){var _=T[b];A.push(this.flattenVertex(_,y,v))}d=THREE__namespace.ShapeUtils.triangulateShape(A,[])}else d=[[0,1,2]];for(var S=function(B,L,O){t.vertex.push(e.vertexPositions[r[B*3]]),t.vertex.push(e.vertexPositions[r[B*3+1]]),t.vertex.push(e.vertexPositions[r[B*3+2]]),t.vertex.push(e.vertexPositions[r[L*3]]),t.vertex.push(e.vertexPositions[r[L*3+1]]),t.vertex.push(e.vertexPositions[r[L*3+2]]),t.vertex.push(e.vertexPositions[r[O*3]]),t.vertex.push(e.vertexPositions[r[O*3+1]]),t.vertex.push(e.vertexPositions[r[O*3+2]]),e.skeleton&&(t.vertexWeights.push(c[B*4]),t.vertexWeights.push(c[B*4+1]),t.vertexWeights.push(c[B*4+2]),t.vertexWeights.push(c[B*4+3]),t.vertexWeights.push(c[L*4]),t.vertexWeights.push(c[L*4+1]),t.vertexWeights.push(c[L*4+2]),t.vertexWeights.push(c[L*4+3]),t.vertexWeights.push(c[O*4]),t.vertexWeights.push(c[O*4+1]),t.vertexWeights.push(c[O*4+2]),t.vertexWeights.push(c[O*4+3]),t.weightsIndices.push(f[B*4]),t.weightsIndices.push(f[B*4+1]),t.weightsIndices.push(f[B*4+2]),t.weightsIndices.push(f[B*4+3]),t.weightsIndices.push(f[L*4]),t.weightsIndices.push(f[L*4+1]),t.weightsIndices.push(f[L*4+2]),t.weightsIndices.push(f[L*4+3]),t.weightsIndices.push(f[O*4]),t.weightsIndices.push(f[O*4+1]),t.weightsIndices.push(f[O*4+2]),t.weightsIndices.push(f[O*4+3])),e.color&&(t.colors.push(u[B*3]),t.colors.push(u[B*3+1]),t.colors.push(u[B*3+2]),t.colors.push(u[L*3]),t.colors.push(u[L*3+1]),t.colors.push(u[L*3+2]),t.colors.push(u[O*3]),t.colors.push(u[O*3+1]),t.colors.push(u[O*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(o),t.materialIndex.push(o),t.materialIndex.push(o)),e.normal&&(t.normal.push(s[B*3]),t.normal.push(s[B*3+1]),t.normal.push(s[B*3+2]),t.normal.push(s[L*3]),t.normal.push(s[L*3+1]),t.normal.push(s[L*3+2]),t.normal.push(s[O*3]),t.normal.push(s[O*3+1]),t.normal.push(s[O*3+2])),e.uv&&e.uv.forEach(function(k,D){t.uvs[D]===void 0&&(t.uvs[D]=[]),t.uvs[D].push(l[D][B*2]),t.uvs[D].push(l[D][B*2+1]),t.uvs[D].push(l[D][L*2]),t.uvs[D].push(l[D][L*2+1]),t.uvs[D].push(l[D][O*2]),t.uvs[D].push(l[D][O*2+1])})},w=0,R=d;w<R.length;w++){var I=R[w],H=I[0],C=I[1],M=I[2];S(H,C,M)}},n.prototype.addMorphTargets=function(t,e,r,o,s){if(o.length!==0){e.morphTargetsRelative=!0,e.morphAttributes.position=[];var u=this;o.forEach(function(l){l.rawTargets.forEach(function(c){var f=t.Objects.Geometry[c.geoID];f!==void 0&&u.genMorphGeometry(e,r,f,s,c.name)})})}},n.prototype.genMorphGeometry=function(t,e,r,o,s){for(var u=e.Vertices!==void 0?e.Vertices.a:[],l=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],c=r.Vertices!==void 0?r.Vertices.a:[],f=r.Indexes?r.Indexes.a:[],p=t.attributes.position.count*3,d=new Float32Array(p),h=0;h<f.length;h++){var g=f[h]*3;d[g]=c[h*3],d[g+1]=c[h*3+1],d[g+2]=c[h*3+2]}var m={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},E=this.genBuffers(m),y=new THREE__namespace.Float32BufferAttribute(E.vertex,3);y.name=s||r.attrName,y.applyMatrix4(o),t.morphAttributes.position.push(y)},n.prototype.parseNormals=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Normals.a,s=[];return r==="IndexToDirect"&&(t.NormalIndex?s=t.NormalIndex.a:t.NormalsIndex&&(s=t.NormalsIndex.a)),{dataSize:3,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseUVs=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.UV.a,s=[];return r==="IndexToDirect"&&(s=t.UVIndex.a),{dataSize:2,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseVertexColors=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Colors.a,s=[];r==="IndexToDirect"&&(s=t.ColorIndex.a);for(var u=0,l=new THREE__namespace.Color;u<o.length;u+=4)l.fromArray(o,u),l.toArray(o,u);return{dataSize:4,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseMaterialIndices=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var o=t.Materials.a,s=[],u=0;u<o.length;++u)s.push(u);return{dataSize:1,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseNurbsGeometry=function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new THREE__namespace.BufferGeometry;for(var r=e-1,o=t.KnotVector.a,s=[],u=t.Points.a,l=0,c=u.length;l<c;l+=4)s.push(new THREE__namespace.Vector4().fromArray(u,l));var f,p;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){f=r,p=o.length-1-f;for(var l=0;l<r;++l)s.push(s[l])}var d=new NURBSCurve(r,o,s,f,p),h=d.getPoints(s.length*12);return new THREE__namespace.BufferGeometry().setFromPoints(h)},n})(),AnimationParser=(function(){function n(){}return n.prototype.parse=function(t,e,r){var o=[],s=this.parseClips(t,e,r);if(s!==void 0)for(var u in s){var l=s[u],c=this.addClip(l,r);o.push(c)}return o},n.prototype.parseClips=function(t,e,r){if(t.Objects.AnimationCurve!==void 0){var o=this.parseAnimationCurveNodes(t);this.parseAnimationCurves(t,o,e);var s=this.parseAnimationLayers(t,o,e,r),u=this.parseAnimStacks(t,s,e);return u}},n.prototype.parseAnimationCurveNodes=function(t){var e=t.Objects.AnimationCurveNode,r=new Map;for(var o in e){var s=e[o];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){var u={id:s.id,attr:s.attrName,curves:{}};r.set(u.id,u)}}return r},n.prototype.parseAnimationCurves=function(t,e,r){var o=t.Objects.AnimationCurve;for(var s in o){var u={id:o[s].id,times:o[s].KeyTime.a.map(convertFBXTimeToSeconds),values:o[s].KeyValueFloat.a},l=r.get(u.id);if(l!==void 0){var c=l.parents[0].ID,f=l.parents[0].relationship,p=e.get(c);p&&(f.match(/X/)?p.curves.x=u:f.match(/Y/)?p.curves.y=u:f.match(/Z/)?p.curves.z=u:f.match(/DeformPercent/)&&e.has(c)&&(p.curves.morph=u))}}},n.prototype.parseAnimationLayers=function(t,e,r,o){var s=t.Objects.AnimationLayer,u=new Map,l=function(f){var p=[],d=r.get(parseInt(f));if(d!==void 0){var h=d.children;h.forEach(function(g,m){if(e.has(g.ID)){var E=e.get(g.ID);if(E.curves.x!==void 0||E.curves.y!==void 0||E.curves.z!==void 0){if(p[m]===void 0){var y=r.get(g.ID).parents.filter(function(R){return R.relationship!==void 0})[0].ID;if(y!==void 0){var v=t.Objects.Model[y.toString()];if(v===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",g);return}var A={modelName:v.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(v.attrName):"",ID:v.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new THREE__namespace.Matrix4,eulerOrder:"",preRotation:[0,0,0],postRotation:[0,0,0]};o.traverse(function(R){R.ID===v.id&&(A.transform=R.matrix,R.userData.transformData&&(A.eulerOrder=R.userData.transformData.eulerOrder))}),A.transform||(A.transform=new THREE__namespace.Matrix4),v.PreRotation&&(A.preRotation=v.PreRotation.value),v.PostRotation&&(A.postRotation=v.PostRotation.value),p[m]=A}}p[m]&&(p[m][E.attr]=E)}else if(E.curves.morph!==void 0){if(p[m]===void 0){var b=r.get(g.ID).parents.filter(function(I){return I.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,y=r.get(_).parents[0].ID,S=t.Objects.Model[y],w={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};p[m]=w}p[m][E.attr]=E}}}),u.set(parseInt(f),p)}};for(var c in s)l(c);return u},n.prototype.parseAnimStacks=function(t,e,r){var o=t.Objects.AnimationStack,s={};for(var u in o){var l=r.get(parseInt(u)).children;l.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var c=e.get(l[0].ID);s[u]={name:o[u].attrName,layer:c}}return s},n.prototype.addClip=function(t,e){var r=[],o=this;return t.layer.forEach(function(s){r=r.concat(o.generateTracks(s,e))}),new THREE__namespace.AnimationClip(t.name,-1,r)},n.prototype.generateTracks=function(t,e){var r=[],o=new THREE__namespace.Vector3,s=new THREE__namespace.Vector3;t.transform&&t.transform.decompose(o,new THREE__namespace.Quaternion,s);var u=o.toArray(),l=s.toArray();if(t.T!==void 0&&Object.keys(t.T.curves).length>0){var c=this.generateVectorTrack(t.modelName,t.T.curves,u,"position");c!==void 0&&r.push(c)}if(t.R!==void 0&&Object.keys(t.R.curves).length>0){var f=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);f!==void 0&&r.push(f)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){var p=this.generateVectorTrack(t.modelName,t.S.curves,l,"scale");p!==void 0&&r.push(p)}if(t.DeformPercent!==void 0){var d=this.generateMorphTrack(t,e);d!==void 0&&r.push(d)}return r},n.prototype.generateVectorTrack=function(t,e,r,o){var s=this.getTimesForAllAxes(e),u=this.getKeyframeTrackValues(s,e,r);return new THREE__namespace.VectorKeyframeTrack(t+"."+o,s,u)},n.prototype.generateRotationTrack=function(t,e,r,o,s){var u,l;if(e.x!==void 0&&e.y!==void 0&&e.z!==void 0){var c=this.interpolateRotations(e.x,e.y,e.z,s);u=c[0],l=c[1]}var f=getEulerOrder(0),p=new THREE__namespace.Quaternion,d=new THREE__namespace.Quaternion;r!==void 0&&(r=r.map(THREE__namespace.MathUtils.degToRad),r.push(f),p.setFromEuler(new THREE__namespace.Euler().fromArray(r))),o!==void 0&&(o=o.map(THREE__namespace.MathUtils.degToRad),o.push(f),d.setFromEuler(new THREE__namespace.Euler().fromArray(o)),d.inverse());var h=new THREE__namespace.Quaternion,g=new THREE__namespace.Euler,m=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var E=0;E<l.length;E+=3){if(g.set(l[E],l[E+1],l[E+2],s),h.setFromEuler(g),h.premultiply(p),h.multiply(d),E>2){var y=new THREE__namespace.Quaternion().fromArray(m,(E-3)/3*4);y.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(m,E/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,m)},n.prototype.generateMorphTrack=function(t,e){var r=t.DeformPercent.curves.morph,o=r.values.map(function(u){return u/100}),s=e.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new THREE__namespace.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+s+"]",r.times,o)},n.prototype.getTimesForAllAxes=function(t){var e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(l,c){return l-c}),e.length>1){for(var r=1,o=e[0],s=1;s<e.length;s++){var u=e[s];u!==o&&(e[r]=u,o=u,r++)}e=e.slice(0,r)}return e},n.prototype.getKeyframeTrackValues=function(t,e,r){var o=r,s=[],u=-1,l=-1,c=-1;return t.forEach(function(f){if(e.x&&(u=e.x.times.indexOf(f)),e.y&&(l=e.y.times.indexOf(f)),e.z&&(c=e.z.times.indexOf(f)),u!==-1){var p=e.x.values[u];s.push(p),o[0]=p}else s.push(o[0]);if(l!==-1){var d=e.y.values[l];s.push(d),o[1]=d}else s.push(o[1]);if(c!==-1){var h=e.z.values[c];s.push(h),o[2]=h}else s.push(o[2])}),s},n.prototype.interpolateRotations=function(t,e,r,o){var s=[],u=[];s.push(t.times[0]),u.push(THREE__namespace.MathUtils.degToRad(t.values[0])),u.push(THREE__namespace.MathUtils.degToRad(e.values[0])),u.push(THREE__namespace.MathUtils.degToRad(r.values[0]));for(var l=1;l<t.values.length;l++){var c=[t.values[l-1],e.values[l-1],r.values[l-1]];if(!(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))){var f=c.map(THREE__namespace.MathUtils.degToRad),p=[t.values[l],e.values[l],r.values[l]];if(!(isNaN(p[0])||isNaN(p[1])||isNaN(p[2]))){p.map(THREE__namespace.MathUtils.degToRad);var d=[p[0]-c[0],p[1]-c[1],p[2]-c[2]],h=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(h[0]>=180||h[1]>=180||h[2]>=180){var g=Math.max.apply(Math,h),m=g/180,E=new THREE__namespace.Euler(f[0],f[1],f[2],o),y=new THREE__namespace.Euler(f[0],f[1],f[2],o),v=new THREE__namespace.Quaternion().setFromEuler(E),A=new THREE__namespace.Quaternion().setFromEuler(y);v.dot(A)&&A.set(-A.x,-A.y,-A.z,-A.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,w=0;w<1;w+=1/m)_.copy(v.clone().slerp(A.clone(),w)),s.push(b+w*T),S.setFromQuaternion(_,o),u.push(S.x),u.push(S.y),u.push(S.z)}else s.push(t.times[l]),u.push(THREE__namespace.MathUtils.degToRad(t.values[l])),u.push(THREE__namespace.MathUtils.degToRad(e.values[l])),u.push(THREE__namespace.MathUtils.degToRad(r.values[l]))}}}return[s,u]},n})(),TextParser=(function(){function n(){this.allNodes=new FBXTree,this.nodeStack=[],this.currentIndent=0,this.currentPropName=""}return n.prototype.getPrevNode=function(){return this.nodeStack[this.currentIndent-2]},n.prototype.getCurrentNode=function(){return this.nodeStack[this.currentIndent-1]},n.prototype.getCurrentProp=function(){return this.currentProp},n.prototype.pushStack=function(t){this.nodeStack.push(t),this.currentIndent+=1},n.prototype.popStack=function(){this.nodeStack.pop(),this.currentIndent-=1},n.prototype.setCurrentProp=function(t,e){this.currentProp=t,this.currentPropName=e},n.prototype.parse=function(t){this.currentIndent=0,this.allNodes=new FBXTree,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach(function(o,s){var u=o.match(/^[\s\t]*;/),l=o.match(/^[\s\t]*$/);if(!(u||l)){var c=o.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){"),f=o.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),p=o.match("^\\t{"+(e.currentIndent-1)+"}}");c?e.parseNodeBegin(o,c):f?e.parseNodeProperty(o,f,r[++s]):p?e.popStack():o.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(o)}}),this.allNodes},n.prototype.parseNodeBegin=function(t,e){var r=e[1].trim().replace(/^"/,"").replace(/"$/,""),o=e[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},u=this.parseNodeAttr(o),l=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in l?(r==="PoseNode"?l.PoseNode.push(s):l[r].id!==void 0&&(l[r]={},l[r][l[r].id]=l[r]),u.id!==""&&(l[r][u.id]=s)):typeof u.id=="number"?(l[r]={},l[r][u.id]=s):r!=="Properties70"&&(r==="PoseNode"?l[r]=[s]:l[r]=s),typeof u.id=="number"&&(s.id=u.id),u.name!==""&&(s.attrName=u.name),u.type!==""&&(s.attrType=u.type),this.pushStack(s)},n.prototype.parseNodeAttr=function(t){var e=t[0];t[0]!==""&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",o="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),o=t[2]),{id:e,name:r,type:o}},n.prototype.parseNodeProperty=function(t,e,r){var o=e[1].replace(/^"/,"").replace(/"$/,"").trim(),s=e[2].replace(/^"/,"").replace(/"$/,"").trim();o==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());var u=this.getCurrentNode(),l=u.name;if(l==="Properties70"){this.parseNodeSpecialProperty(t,o,s);return}if(o==="C"){var c=s.split(",").slice(1),f=parseInt(c[0]),p=parseInt(c[1]),d=s.split(",").slice(3);d=d.map(function(h){return h.trim().replace(/^"/,"")}),o="connections",s=[f,p],append(s,d),u[o]===void 0&&(u[o]=[])}o==="Node"&&(u.id=s),o in u&&Array.isArray(u[o])?u[o].push(s):o!=="a"?u[o]=s:u.a=s,this.setCurrentProp(u,o),o==="a"&&s.slice(-1)!==","&&(u.a=parseNumberArray(s))},n.prototype.parseNodePropertyContinued=function(t){var e=this.getCurrentNode();e.a+=t,t.slice(-1)!==","&&(e.a=parseNumberArray(e.a))},n.prototype.parseNodeSpecialProperty=function(t,e,r){var o=r.split('",').map(function(p){return p.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=o[0],u=o[1],l=o[2],c=o[3],f=o[4];switch(u){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":f=parseFloat(f);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":f=parseNumberArray(f);break}this.getPrevNode()[s]={type:u,type2:l,flag:c,value:f},this.setCurrentProp(this.getPrevNode(),s)},n})(),BinaryParser=(function(){function n(){}return n.prototype.parse=function(t){var e=new BinaryReader(t);e.skip(23);var r=e.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var o=new FBXTree;!this.endOfContent(e);){var s=this.parseNode(e,r);s!==null&&o.add(s.name,s)}return o},n.prototype.endOfContent=function(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()},n.prototype.parseNode=function(t,e){var r={},o=e>=7500?t.getUint64():t.getUint32(),s=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();var u=t.getUint8(),l=t.getString(u);if(o===0)return null;for(var c=[],f=0;f<s;f++)c.push(this.parseProperty(t));var p=c.length>0?c[0]:"",d=c.length>1?c[1]:"",h=c.length>2?c[2]:"";for(r.singleProperty=s===1&&t.getOffset()===o;o>t.getOffset();){var g=this.parseNode(t,e);g!==null&&this.parseSubNode(l,r,g)}return r.propertyList=c,typeof p=="number"&&(r.id=p),d!==""&&(r.attrName=d),h!==""&&(r.attrType=h),l!==""&&(r.name=l),r},n.prototype.parseSubNode=function(t,e,r){if(r.singleProperty===!0){var o=r.propertyList[0];Array.isArray(o)?(e[r.name]=r,r.a=o):e[r.name]=o}else if(t==="Connections"&&r.name==="C"){var s=[];r.propertyList.forEach(function(h,g){g!==0&&s.push(h)}),e.connections===void 0&&(e.connections=[]),e.connections.push(s)}else if(r.name==="Properties70"){var u=Object.keys(r);u.forEach(function(h){e[h]=r[h]})}else if(t==="Properties70"&&r.name==="P"){var l=r.propertyList[0],c=r.propertyList[1],f=r.propertyList[2],p=r.propertyList[3],d=void 0;l.indexOf("Lcl ")===0&&(l=l.replace("Lcl ","Lcl_")),c.indexOf("Lcl ")===0&&(c=c.replace("Lcl ","Lcl_")),c==="Color"||c==="ColorRGB"||c==="Vector"||c==="Vector3D"||c.indexOf("Lcl_")===0?d=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:d=r.propertyList[4],e[l]={type:c,type2:f,flag:p,value:d}}else e[r.name]===void 0?typeof r.id=="number"?(e[r.name]={},e[r.name][r.id]=r):e[r.name]=r:r.name==="PoseNode"?(Array.isArray(e[r.name])||(e[r.name]=[e[r.name]]),e[r.name].push(r)):e[r.name][r.id]===void 0&&(e[r.name][r.id]=r)},n.prototype.parseProperty=function(t){var e=t.getString(1),r;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return r=t.getUint32(),t.getArrayBuffer(r);case"S":return r=t.getUint32(),t.getString(r);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var o=t.getUint32(),s=t.getUint32(),u=t.getUint32();if(s===0)switch(e){case"b":case"c":return t.getBooleanArray(o);case"d":return t.getFloat64Array(o);case"f":return t.getFloat32Array(o);case"i":return t.getInt32Array(o);case"l":return t.getInt64Array(o)}var l=unzlibSync(new Uint8Array(t.getArrayBuffer(u))),c=new BinaryReader(l.buffer);switch(e){case"b":case"c":return c.getBooleanArray(o);case"d":return c.getFloat64Array(o);case"f":return c.getFloat32Array(o);case"i":return c.getInt32Array(o);case"l":return c.getInt64Array(o)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}},n})(),BinaryReader=(function(){function n(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0,this._textDecoder=new TextDecoder}return n.prototype.getOffset=function(){return this.offset},n.prototype.size=function(){return this.dv.buffer.byteLength},n.prototype.skip=function(t){this.offset+=t},n.prototype.getBoolean=function(){return(this.getUint8()&1)===1},n.prototype.getBooleanArray=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e},n.prototype.getUint8=function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t},n.prototype.getInt16=function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},n.prototype.getInt32=function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e},n.prototype.getUint32=function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e&2147483648?(e=~e&4294967295,t=~t&4294967295,t===4294967295&&(e=e+1&4294967295),t=t+1&4294967295,-(e*4294967296+t)):e*4294967296+t},n.prototype.getInt64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e},n.prototype.getUint64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e*4294967296+t},n.prototype.getFloat32=function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getFloat32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e},n.prototype.getFloat64=function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},n.prototype.getFloat64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e},n.prototype.getArrayBuffer=function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},n.prototype.getString=function(t){var e=this.offset,r=new Uint8Array(this.dv.buffer,e,t);this.skip(t);var o=r.indexOf(0);return o>=0&&(r=new Uint8Array(this.dv.buffer,e,o)),this._textDecoder.decode(r)},n})(),FBXTree=(function(){function n(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}return n.prototype.add=function(t,e){this[t]=e},n})();function isFbxFormatBinary(n){var t="Kaydara FBX Binary \0";return n.byteLength>=t.length&&t===convertArrayBufferToString(n,0,t.length)}function isFbxFormatASCII(n){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],e=0;function r(u){var l=n[u-1];return n=n.slice(e+u),e++,l}for(var o=0;o<t.length;++o){var s=r(1);if(s===t[o])return!1}return!0}function getFbxVersion(n){var t=/FBXVersion: (\d+)/,e=n.match(t);if(e){var r=parseInt(e[1]);return r}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function convertFBXTimeToSeconds(n){return n/46186158e3}var dataArray=[];function getData(n,t,e,r){var o;switch(r.mappingType){case"ByPolygonVertex":o=n;break;case"ByPolygon":o=t;break;case"ByVertice":o=e;break;case"AllSame":o=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType),o=0}r.referenceType==="IndexToDirect"&&(o=r.indices[o]);var s=o*r.dataSize,u=s+r.dataSize;return slice(dataArray,r.buffer,s,u)}var tempEuler=new THREE__namespace.Euler,tempVec=new THREE__namespace.Vector3;function generateTransform(n){var t=new THREE__namespace.Matrix4,e=new THREE__namespace.Matrix4,r=new THREE__namespace.Matrix4,o=new THREE__namespace.Matrix4,s=new THREE__namespace.Matrix4,u=new THREE__namespace.Matrix4,l=new THREE__namespace.Matrix4,c=new THREE__namespace.Matrix4,f=new THREE__namespace.Matrix4,p=new THREE__namespace.Matrix4,d=new THREE__namespace.Matrix4,h=new THREE__namespace.Matrix4,g=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var m=getEulerOrder(0);if(n.preRotation){var E=n.preRotation.map(THREE__namespace.MathUtils.degToRad);E.push(m),e.makeRotationFromEuler(tempEuler.fromArray(E))}if(n.rotation){var E=n.rotation.map(THREE__namespace.MathUtils.degToRad);E.push(n.eulerOrder||m),r.makeRotationFromEuler(tempEuler.fromArray(E))}if(n.postRotation){var E=n.postRotation.map(THREE__namespace.MathUtils.degToRad);E.push(m),o.makeRotationFromEuler(tempEuler.fromArray(E)),o.copy(new THREE__namespace.Matrix4().getInverse(o))}n.scale&&s.scale(tempVec.fromArray(n.scale)),n.scalingOffset&&l.setPosition(tempVec.fromArray(n.scalingOffset)),n.scalingPivot&&u.setPosition(tempVec.fromArray(n.scalingPivot)),n.rotationOffset&&c.setPosition(tempVec.fromArray(n.rotationOffset)),n.rotationPivot&&f.setPosition(tempVec.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(d.copy(n.parentMatrix),p.copy(n.parentMatrixWorld));var y=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(p);var A=new THREE__namespace.Matrix4;A.copyPosition(p);var b=new THREE__namespace.Matrix4().getInverse(A).multiply(p),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(g===0)S.copy(v).multiply(y).multiply(T).multiply(_);else if(g===1)S.copy(v).multiply(T).multiply(y).multiply(_);else{var w=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),R=new THREE__namespace.Matrix4().getInverse(w),I=T.clone().multiply(R);S.copy(v).multiply(y).multiply(I).multiply(_)}var H=new THREE__namespace.Matrix4().getInverse(f),C=new THREE__namespace.Matrix4().getInverse(u),M=t.clone().multiply(c).multiply(f).multiply(e).multiply(r).multiply(o).multiply(H).multiply(l).multiply(u).multiply(s).multiply(C),B=new THREE__namespace.Matrix4().copyPosition(M),L=p.clone().multiply(B);return h.copyPosition(L),M=h.clone().multiply(S),M.premultiply(new THREE__namespace.Matrix4().getInverse(p)),M}function getEulerOrder(n){n=n||0;var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return n===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[n]}function parseNumberArray(n){var t=n.split(",").map(function(e){return parseFloat(e)});return t}function convertArrayBufferToString(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=n.byteLength),new TextDecoder().decode(new Uint8Array(n,t,e))}function append(n,t){for(var e=0,r=n.length,o=t.length;e<o;e++,r++)n[r]=t[e]}function slice(n,t,e,r){for(var o=e,s=0;o<r;o++,s++)n[s]=t[o];return n}var NURBSCurve=(function(n){__extends(t,n);function t(e,r,o,s,u){var l=n.call(this)||this,c=r?r.length-1:0,f=o?o.length:0;l.degree=e,l.knots=r,l.controlPoints=[],l.startKnot=s||0,l.endKnot=u||c;for(var p=0;p<f;++p){var d=o[p];l.controlPoints[p]=new THREE__namespace.Vector4(d.x,d.y,d.z,d.w)}return l}return t.prototype.getPoint=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),u=calcBSplinePoint(this.degree,this.knots,this.controlPoints,s);return u.w!==1&&u.divideScalar(u.w),o.set(u.x,u.y,u.z)},t.prototype.getTangent=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),u=calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,s,1);return o.copy(u[1]).normalize(),o},t.prototype.toJSON=function(){var e=n.prototype.toJSON.call(this);return e.degree=this.degree,e.knots=__spreadArray([],this.knots,!0),e.controlPoints=this.controlPoints.map(function(r){return r.toArray()}),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e},t.prototype.fromJSON=function(e){return n.prototype.fromJSON.call(this,e),this.degree=e.degree,this.knots=__spreadArray([],e.knots,!0),this.controlPoints=e.controlPoints.map(function(r){return new THREE__namespace.Vector4(r[0],r[1],r[2],r[3])}),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this},t})(THREE__namespace.Curve);function findSpan(n,t,e){var r=e.length-n-1;if(t>=e[r])return r-1;if(t<=e[n])return n;for(var o=n,s=r,u=Math.floor((o+s)/2);t<e[u]||t>=e[u+1];)t<e[u]?s=u:o=u,u=Math.floor((o+s)/2);return u}function calcBasisFunctions(n,t,e,r){var o=[],s=[],u=[];o[0]=1;for(var l=1;l<=e;++l){s[l]=t-r[n+1-l],u[l]=r[n+l]-t;for(var c=0,f=0;f<l;++f){var p=u[f+1],d=s[l-f],h=o[f]/(p+d);o[f]=c+p*h,c=d*h}o[l]=c}return o}function calcBSplinePoint(n,t,e,r){for(var o=findSpan(n,r,t),s=calcBasisFunctions(o,r,n,t),u=new THREE__namespace.Vector4(0,0,0,0),l=0;l<=n;++l){var c=e[o-n+l],f=s[l],p=c.w*f;u.x+=c.x*p,u.y+=c.y*p,u.z+=c.z*p,u.w+=c.w*f}return u}function calcBasisFunctionDerivatives(n,t,e,r,o){for(var s=[],u=0;u<=e;++u)s[u]=0;for(var l=[],u=0;u<=r;++u)l[u]=s.slice(0);for(var c=[],u=0;u<=e;++u)c[u]=s.slice(0);c[0][0]=1;for(var f=s.slice(0),p=s.slice(0),d=1;d<=e;++d){f[d]=t-o[n+1-d],p[d]=o[n+d]-t;for(var h=0,g=0;g<d;++g){var m=p[g+1],E=f[d-g];c[d][g]=m+E;var y=c[g][d-1]/c[d][g];c[g][d]=h+m*y,h=E*y}c[d][d]=h}for(var d=0;d<=e;++d)l[0][d]=c[d][e];for(var v=0;v<=e;++v){for(var A=0,b=1,T=[],u=0;u<=e;++u)T[u]=s.slice(0);T[0][0]=1;for(var _=1;_<=r;++_){var S=0,w=v-_,R=e-_;v>=_&&(T[b][0]=T[A][0]/c[R+1][w],S=T[b][0]*c[w][R]);for(var I=w>=-1?1:-w,H=v-1<=R?_-1:e-v,C=I;C<=H;++C)T[b][C]=(T[A][C]-T[A][C-1])/c[R+1][w+C],S+=T[b][C]*c[w+C][R];v<=R&&(T[b][_]=-T[A][_-1]/c[R+1][v],S+=T[b][_]*c[v][R]),l[_][v]=S;var d=A;A=b,b=d}}for(var M=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=M;M*=e-_}return l}function calcBSplineDerivatives(n,t,e,r,o){for(var s=o<n?o:n,u=[],l=findSpan(n,r,t),c=calcBasisFunctionDerivatives(l,r,n,s,t),f=[],p=0;p<e.length;++p){var d=e[p].clone(),h=d.w;d.x*=h,d.y*=h,d.z*=h,f[p]=d}for(var g=0;g<=s;++g){for(var d=f[l-n].clone().multiplyScalar(c[g][0]),m=1;m<=n;++m)d.add(f[l-n+m].clone().multiplyScalar(c[g][m]));u[g]=d}for(var g=s+1;g<=o+1;++g)u[g]=new THREE__namespace.Vector4(0,0,0);return u}function calcKoverI(n,t){for(var e=1,r=2;r<=n;++r)e*=r;for(var o=1,r=2;r<=t;++r)o*=r;for(var r=2;r<=n-t;++r)o*=r;return e/o}function calcRationalCurveDerivatives(n){for(var t=n.length,e=[],r=[],o=0;o<t;++o){var s=n[o];e[o]=new THREE__namespace.Vector3(s.x,s.y,s.z),r[o]=s.w}for(var u=[],l=0;l<t;++l){for(var c=e[l].clone(),o=1;o<=l;++o)c.sub(u[l-o].clone().multiplyScalar(calcKoverI(l,o)*r[o]));u[l]=c.divideScalar(r[0])}return u}function calcNURBSDerivatives(n,t,e,r,o){var s=calcBSplineDerivatives(n,t,e,r,o);return calcRationalCurveDerivatives(s)}var _vector=new THREE__namespace.Vector3;function getPointArray(n,t){switch(t){case"D":return new Float64Array(n);case"F":return new Float32Array(n);case"L":return new Int32Array(n);case"I":return new Int16Array(n);default:return new Uint8Array(n)}}function loadX3p(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){var c,f;return u.byteLength=l.body.byteLength,parse$1(new Uint8Array(l.body),{light:(c=t.light)!==null&&c!==void 0?c:!0,color:t.color,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(f=n.split("?")[1])!==null&&f!==void 0?f:""})}).then(function(l){var c=new THREE__namespace.Group;return c.name=n,c.add(l.object),o==="Y"&&c.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"x3p",modelUpAxis:"Z",upAxis:o,uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:[],animations:[],dispose:function(){return l.dispose()}}})}function parse$1(n,t){for(var e,r,o,s,u,l,c,f,p,d,h,g,m,E,y,v,A,b,T,_,S,w,R,I,H,C,M,B,L,O,k,D,q,z,J,V,U,j,K,ae,re,ee,Z,X,se,G,W,$,ne,te,ve,oe,fe,be,ie=unzipSync(n),ue="",me=null,ge=0,Ae=Object.keys(ie);ge<Ae.length;ge++){var xe=Ae[ge];/(^|\/)main\.xml$/i.test(xe)&&(me=ie[xe],ue=xe.slice(0,xe.lastIndexOf("/")+1))}if(!me)throw new Error("X3p: main.xml not found.");if(typeof DOMParser=="undefined")throw new Error("X3p: DOMParser not found.");var de=(e=t.color)!==null&&e!==void 0?e:new THREE__namespace.Color(10066329),_e=new DOMParser,He=decodeText(me),Ee=_e.parseFromString(He,"text/xml"),pe=Ee.querySelector("Record1 Axes"),Ve={x:{type:(s=(o=(r=pe==null?void 0:pe.querySelector("CX AxisType"))===null||r===void 0?void 0:r.textContent)===null||o===void 0?void 0:o.toUpperCase())!==null&&s!==void 0?s:"I",dataType:(c=(l=(u=pe==null?void 0:pe.querySelector("CX DataType"))===null||u===void 0?void 0:u.textContent)===null||l===void 0?void 0:l.toUpperCase())!==null&&c!==void 0?c:"D",increment:Number((p=(f=pe==null?void 0:pe.querySelector("CX Increment"))===null||f===void 0?void 0:f.textContent)!==null&&p!==void 0?p:"1"),offset:Number((h=(d=pe==null?void 0:pe.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(E=(m=(g=pe==null?void 0:pe.querySelector("CY AxisType"))===null||g===void 0?void 0:g.textContent)===null||m===void 0?void 0:m.toUpperCase())!==null&&E!==void 0?E:"I",dataType:(A=(v=(y=pe==null?void 0:pe.querySelector("CY DataType"))===null||y===void 0?void 0:y.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&A!==void 0?A:"D",increment:Number((T=(b=pe==null?void 0:pe.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=pe==null?void 0:pe.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(I=(R=(w=pe==null?void 0:pe.querySelector("CZ AxisType"))===null||w===void 0?void 0:w.textContent)===null||R===void 0?void 0:R.toUpperCase())!==null&&I!==void 0?I:"A",dataType:(M=(C=(H=pe==null?void 0:pe.querySelector("CZ DataType"))===null||H===void 0?void 0:H.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&M!==void 0?M:"D",increment:Number((L=(B=pe==null?void 0:pe.querySelector("CZ Increment"))===null||B===void 0?void 0:B.textContent)!==null&&L!==void 0?L:"1"),offset:Number((k=(O=pe==null?void 0:pe.querySelector("CZ Offset"))===null||O===void 0?void 0:O.textContent)!==null&&k!==void 0?k:"0")}},ye=null,Pe=Ee.querySelector("Record1 Axes Rotation");Pe&&(ye=new THREE__namespace.Matrix3,ye.set(Number((q=(D=Pe.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&q!==void 0?q:0),Number((J=(z=Pe.querySelector("r12"))===null||z===void 0?void 0:z.textContent)!==null&&J!==void 0?J:0),Number((U=(V=Pe.querySelector("r13"))===null||V===void 0?void 0:V.textContent)!==null&&U!==void 0?U:0),Number((K=(j=Pe.querySelector("r21"))===null||j===void 0?void 0:j.textContent)!==null&&K!==void 0?K:0),Number((re=(ae=Pe.querySelector("r22"))===null||ae===void 0?void 0:ae.textContent)!==null&&re!==void 0?re:0),Number((Z=(ee=Pe.querySelector("r23"))===null||ee===void 0?void 0:ee.textContent)!==null&&Z!==void 0?Z:0),Number((se=(X=Pe.querySelector("r31"))===null||X===void 0?void 0:X.textContent)!==null&&se!==void 0?se:0),Number((W=(G=Pe.querySelector("r32"))===null||G===void 0?void 0:G.textContent)!==null&&W!==void 0?W:0),Number((ne=($=Pe.querySelector("r33"))===null||$===void 0?void 0:$.textContent)!==null&&ne!==void 0?ne:0)));var Ce=(te=Ee.querySelector("Record3 DataLink PointDataLink"))===null||te===void 0?void 0:te.textContent;if(typeof Ce!="string")throw new Error("X3p: PointDataLink not found.");Ce=pathJoin(ue,Ce);var $e=ie[Ce];if(!$e)throw new Error("X3p: ".concat($e," not found."));for(var Se=getPointArray($e.buffer,Ve.z.dataType),ze=Number((oe=(ve=Ee.querySelector("Record3 MatrixDimension SizeX"))===null||ve===void 0?void 0:ve.textContent)!==null&&oe!==void 0?oe:"0"),Fe=Number((be=(fe=Ee.querySelector("Record3 MatrixDimension SizeY"))===null||fe===void 0?void 0:fe.textContent)!==null&&be!==void 0?be:"0"),Oe=Math.floor(ze-1),Le=Math.floor(Fe-1),Ue=Oe+1,tt=Le+1,lt=new Float32Array(Ue*tt*3),nt=new Float32Array(Ue*tt*2),ot=new Uint32Array(Oe*Le*6),At=new THREE__namespace.Box3,We=0;We<tt;We++)for(var Mt=We*Ve.y.increment+Ve.y.offset,Be=0;Be<Ue;Be++){var Ne=We*Ue+Be,bt=Be*Ve.x.increment+Ve.x.offset,Ct=Se[Ne],xt=!isNaN(Ct),yt=xt?Ct:NaN;_vector.set(bt,-Mt,yt),ye&&_vector.applyMatrix3(ye),xt&&At.expandByPoint(_vector),lt[Ne*3+0]=_vector.x,lt[Ne*3+1]=_vector.y,lt[Ne*3+2]=_vector.z,nt[Ne*2+0]=Be/Oe,nt[Ne*2+1]=1-We/Le}for(var We=0;We<Le;We++)for(var Be=0;Be<Oe;Be++){var St=Be+Ue*We,rt=Be+Ue*(We+1),at=Be+1+Ue*(We+1),ct=Be+1+Ue*We,Xe=(We*Oe+Be)*6;ot[Xe+0]=St,ot[Xe+1]=rt,ot[Xe+2]=ct,ot[Xe+3]=rt,ot[Xe+4]=at,ot[Xe+5]=ct}var ce=new THREE__namespace.BufferGeometry;ce.setAttribute("position",new THREE__namespace.BufferAttribute(lt,3)),ce.setAttribute("uv",new THREE__namespace.BufferAttribute(nt,2)),ce.setIndex(new THREE__namespace.BufferAttribute(ot,1)),(!ce.groups||ce.groups.length===0)&&ce.addGroup(0,ce.index?ce.index.count:ce.attributes.position.count,0),ce.boundingBox=At;var we=new PBMMeshMaterial(t.light?"phong":"basic");we.flatShading=!0,we.color.copy(de);var Me=new PBMMesh(ce,[we]);return{object:Me,dispose:function(){ce.dispose(),we.dispose()}}}var VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,identityMatrix4$1=new THREE__namespace.Matrix4().identity(),scratchVector=new THREE__namespace.Vector3,scratchMatrix4$5=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3$1=new THREE__namespace.Box3,scratchSphere$2=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$5.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=(function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$5.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$5),this.setFromFrustum(scratchFrustum),this},n.prototype.applyMatrix4=function(t){for(var e=0,r=this.planes;e<r.length;e++){var o=r[e];o.applyMatrix4(t)}},n.prototype.copy=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,o=this.planes;r<o.length;r++){var s=o[r],u=t.intersectPlane(s);switch(u){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,o=Math.min(32,this.planes.length),s=0;s<o;++s){var u=1<<s;if((e&u)!==0){var l=this.planes[s],c=t.intersectPlane(l);if(c===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=u)}}return r},n})(),BoxBoundingVolume=(function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],o=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],p=e[10],d=e[11],h=Math.max(Math.sqrt(r*r+o*o+s*s),.001),g=Math.max(Math.sqrt(u*u+l*l+c*c),.001),m=Math.max(Math.sqrt(f*f+p*p+d*d),.001);this.halfSize.set(h,g,m);var E=this.halfSize.toArray().reduce(function(y,v){return y+v},0);return(isNaN(E)||E<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/g,l/g,c/g,f/m,p/m,d/m]),isNaN(this.rotation.toArray().reduce(function(y,v){return y+v},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return t.equals(identityMatrix4$1)?this:(scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$5.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this)},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.rotation.elements,r=t.x-this.center.x,o=t.y-this.center.y,s=t.z-this.center.z,u=0,l;return l=r*e[0]+o*e[1]+s*e[2],l<0&&(l=-l),l-=this.halfSize.x,l>0&&(u+=l*l),l=r*e[3]+o*e[4]+s*e[5],l<0&&(l=-l),l-=this.halfSize.y,l>0&&(u+=l*l),l=r*e[6]+o*e[7]+s*e[8],l<0&&(l=-l),l-=this.halfSize.z,l>0&&(u+=l*l),u},n.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSquaredToPoint(t))},n.prototype.distanceToPlane=function(t){var e=t.projectPoint(this.center,new THREE__namespace.Vector3);return this.distanceToPoint(e)},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),e=new Float32Array(24);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,o=this.rotation.elements,s=this.halfSize,u=r.x,l=r.y,c=r.z,f=Math.abs(u*o[0]*s.x+l*o[1]*s.x+c*o[2]*s.x)+Math.abs(u*o[3]*s.y+l*o[4]*s.y+c*o[5]*s.y)+Math.abs(u*o[6]*s.z+l*o[7]*s.z+c*o[8]*s.z),p=r.dot(e)+t.constant;return p<=-f?VolumePlaneIntersect.Outside:p>=f?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e,r){if(e===void 0&&(e=0),scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3$1.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),scratchBox3$1.expandByScalar(e),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$5),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3$1.containsPoint(scratchRay$1.origin))return!0;var o=scratchRay$1.intersectBox(scratchBox3$1,scratchVector);return o?r!==void 0?(r+=e,o.distanceToSquared(scratchRay$1.origin)<=r*r):!0:!1},n})(),SphereBoundingVolume=(function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+Math.sin(o)*this.radius,e[r*6+2]=this.center.z+0,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+Math.sin(o)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(o)*this.radius,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(o)*this.radius}var s=new THREE__namespace.BufferGeometry;return s.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),s.computeBoundingBox(),s.computeBoundingSphere(),s},n.prototype.applyMatrix4=function(t){return t.equals(identityMatrix4$1)?this:(this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this)},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.distanceToPoint(t);return e*e},n.prototype.distanceToPoint=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.distanceToPlane=function(t){var e=Math.abs(t.distanceToPoint(this.center));return Math.max(0,e-this.radius)},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,o=t.normal,s=o.dot(e)+t.constant;return s<-r?VolumePlaneIntersect.Outside:s<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e,r){if(e===void 0&&(e=0),scratchSphere$2.set(this.center,this.radius+e),scratchSphere$2.containsPoint(t.origin))return!0;var o=t.intersectSphere(scratchSphere$2,scratchVector);return o?r!==void 0?(r+=e,t.origin.distanceToSquared(o)<=r*r):!0:!1},n})(),RegionBoundingVolume=(function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceToPlane=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r){throw new Error("not implemented")},n})();function isBoundingVolume(n){return n instanceof BoxBoundingVolume||n instanceof SphereBoundingVolume||n instanceof RegionBoundingVolume}function makeBoundingVolume(n){if(isBoundingVolume(n))return n;if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})}),debugBoxGeometry=(function(){var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e})(),debugSphereGeometry=(function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o})();function createDebugBoundingMesh(n,t){if(t===void 0&&(t=0),n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}return null}var scratchVector3$a=new THREE__namespace.Vector3,scratchPlane=new THREE__namespace.Plane,scratchSphereBoundingVolume$1=new SphereBoundingVolume,scratchBoxBoundingVolume$1=new BoxBoundingVolume,Tile=(function(){function n(t,e,r,o){var s=this,u,l,c,f;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,centerScreenY:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=o!=null?o:null,this.contentParent=o?o.hasRenderContent?o:o.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(u=e.refine)!==null&&u!==void 0?u:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(l=this.parent)===null||l===void 0?void 0:l.geometricError)!==null&&c!==void 0?c:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,byteLength:0,memoryUsage:0},e.content.group!==void 0&&(this.content.group=e.content.group),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type==="SCENEGRAPH"&&(this.levelOfContent=this.levelOfContent+1),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(f=e.extras)!==null&&f!==void 0?f:{},typeof this.extras.floor!="number"&&o&&typeof o.extras.floor=="number"&&(this.extras.floor=o.extras.floor),typeof this.extras.floor=="number"&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),e.children?this.children=e.children.map(function(p,d){return new n("".concat(s.id,".").concat(d),p,r,s)}):this.children=[]}return n.prototype.traverse=function(t){t(this);for(var e=0,r=this.children;e<r.length;e++){var o=r[e];o.traverse(t)}},n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transform;if(this.boundingVolume){var r=void 0;this.boundingVolume instanceof BoxBoundingVolume?r=scratchBoxBoundingVolume$1.copy(this.boundingVolume):this.boundingVolume instanceof SphereBoundingVolume?r=scratchSphereBoundingVolume$1.copy(this.boundingVolume):r=this.boundingVolume.clone(),r.applyMatrix4(e),t.camera.type==="OrthographicCamera"?(scratchPlane.setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position),this.state.distanceToCamera=r.distanceToPlane(scratchPlane)):this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var o=r.getCenter(scratchVector3$a).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(o),this.state.centerScreenY=t.camera.up.dot(o);var s=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,s),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,t.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if((this.levelOfContent<=t.minLevelOfDetail||this.geometricError>=t.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){var u=void 0;this.viewerRequestVolume instanceof BoxBoundingVolume?u=scratchBoxBoundingVolume$1.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof SphereBoundingVolume?u=scratchSphereBoundingVolume$1.copy(this.viewerRequestVolume):u=this.viewerRequestVolume.clone(),u.applyMatrix4(e),this.state.inRequestVolume=u.distanceSquaredToPoint(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentMemoryUsage",{get:function(){return this.content?this.content.memoryUsage:0},enumerable:!1,configurable:!0}),n.prototype.getScreenSpaceError=function(t,e,r){var o=this.tileset.transform.getMaxScaleOnAxis(),s=this.parent?this.parent.geometricError:this.tileset.geometricError,u=o*(r?s:this.geometricError);if(u===0)return 0;var l=t.height,c=t.sseDenominator;if(t.camera.type==="OrthographicCamera"){var f=t.camera.projectionMatrix.elements,p=1/(f[5]/2),d=.9,h=p/l*d,g=u/h;return g}else{var m=Math.max(e,.001),h=m*c/l,g=u/h;return g}},n.prototype.getPriority=function(t){var e=this.refine==="ADD"||t.skipLevelOfDetail;if(e&&!this.state.visible||t.frameNumber-this.state.touchedFrameNumber>=1)return-1;var r=this.parent,o=r&&(!e||this.state.screenSpaceError===0),s=o?r.state.screenSpaceError:this.state.screenSpaceError,u=this.tileset.root?this.tileset.root.state.screenSpaceError:0,l=Math.max(u-s,0);return l},n})(),defaultIterator=function(n){return Number(n)};function arrayMin(n,t,e){var r;t===void 0&&(t=defaultIterator),e===void 0&&(e=!1);for(var o,s=1/0,u=0,l=n;u<l.length;u++){var c=l[u],f=t(c);f<=s&&(r=[c,f],o=r[0],s=r[1])}return isFinite(s)||(s=0),e?[o,s]:o}function arrayEqual(n,t,e){e===void 0&&(e=function(s,u){return s===u});var r=n.length;if(r!==t.length)return!1;for(var o=0;o<r;o++)if(e(n[o],t[o])===!1)return!1;return!0}var arrayUniqueSet=new Set;function arrayUnique(n){arrayUniqueSet.clear();for(var t=[],e=n.length,r=0;r<e;r++){var o=n[r];arrayUniqueSet.has(o)||(t.push(o),arrayUniqueSet.add(o))}return arrayUniqueSet.clear(),t}var arrayMinCallback=function(n){return n.distance},intersectDistanceSortCallback=function(n,t){return n.distance-t.distance};function sortIntersects(n,t,e){if(t===void 0&&(t=!0),e===void 0&&(e=!1),e&&n.length>1){var r=arrayMin(n,arrayMinCallback);r?(n[0]=r,n.length=1):n.length=0}return t&&n.length>1&&n.sort(intersectDistanceSortCallback),n}var BVHObject=(function(){function n(t,e){this.position=t,this.indices=e}return n.prototype.getPositionCount=function(){var t,e,r=this.indices,o=this.position;return r?r.array.length/((t=r.stride)!==null&&t!==void 0?t:1):o.array.length/((e=o.stride)!==null&&e!==void 0?e:3)},n.prototype.getPositionByIndex=function(t,e){var r,o,s,u,l=this.indices,c=this.position,f=t;if(l){var p=l.array,d=(r=l.stride)!==null&&r!==void 0?r:1,h=(o=l.offset)!==null&&o!==void 0?o:0;f=p[t*d+h]}var g=c.array,m=(s=c.stride)!==null&&s!==void 0?s:3,E=(u=c.offset)!==null&&u!==void 0?u:0;return f=f*m+E,e.x=g[f],e.y=g[f+1],e.z=g[f+2],e},n.prototype.createTree=function(t,e,r){throw new Error("not implemented")},n.prototype.trianglesInSphere=function(t,e){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r,o,s){throw new Error("not implemented")},n})(),BVHNode=(function(){function n(t,e,r,o,s){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=o,this.deepth=s}return n})(),BYTES_PER_NODE=36;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),o=new Uint32Array(e),s=new Uint16Array(e),u=[n],l,c;l=u.pop();)c=l.id*BYTES_PER_NODE/4,r[c]=l.extents[0],r[c+1]=l.extents[1],r[c+2]=l.extents[2],r[c+3]=l.extents[3],r[c+4]=l.extents[4],r[c+5]=l.extents[5],o[c+6]=l.startIndex,o[c+7]=l.endIndex,c=l.id*BYTES_PER_NODE/2,l.node0&&(s[c+16]=l.node0.id,u.push(l.node0)),l.node1&&(s[c+17]=l.node1.id,u.push(l.node1));return e}function intersectNodeBox(n,t,e,r){r===void 0&&(r=0);var o=e.min.x-r,s=e.min.y-r,u=e.min.z-r,l=e.max.x+r,c=e.max.y+r,f=e.max.z+r,p=0,d=0,h=0,g=0,m=0,E=0;return t.x>=0?(p=(o-n.x)*t.x,d=(l-n.x)*t.x):(p=(l-n.x)*t.x,d=(o-n.x)*t.x),t.y>=0?(h=(s-n.y)*t.y,g=(c-n.y)*t.y):(h=(c-n.y)*t.y,g=(s-n.y)*t.y),p>g||h>d||((h>p||p!==p)&&(p=h),(g<d||d!==d)&&(d=g),t.z>=0?(m=(u-n.z)*t.z,E=(f-n.z)*t.z):(m=(f-n.z)*t.z,E=(u-n.z)*t.z),p>E||m>d)||((m>p||p!==p)&&(p=m),(E<d||d!==d)&&(d=E),d<0)?null:p>=0?p:d}var BVHVector3=(function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,o=this.z;return this.x=r*t.z-o*t.y,this.y=o*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,o=t.y,s=t.z,u=e.x,l=e.y,c=e.z;return this.x=o*c-s*l,this.y=s*u-r*c,this.z=r*l-o*u,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,o=this.z-t.z;return e*e+r*r+o*o},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n})(),BVHIntersect=(function(){function n(t,e,r,o,s){this.pointA=t,this.pointB=e,this.pointC=r,this.index=o,this.intersectionPoint=s}return n})(),BVHBox3=(function(){function n(t,e){this.min=t,this.max=e}return n})(),EPSILON$1=1e-6,scratchVector3$9=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionCount()/3,u=s>65535?new Uint32Array(s):new Uint16Array(s),l=new Float32Array(s*6),c=[],f=0,p=-1;if(o)for(var d=0;d<s;d+=1){var h=d*3,g=d*6,m=void 0,E=void 0,y=void 0,v=void 0,A=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),m=v=scratchVector3A.x,T=scratchVector3B.x,T<m&&(m=T),T>v&&(v=T),T=scratchVector3C.x,T<m&&(m=T),T>v&&(v=T),E=A=scratchVector3A.y,T=scratchVector3B.y,T<E&&(E=T),T>A&&(A=T),T=scratchVector3C.y,T<E&&(E=T),T>A&&(A=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=m,l[g+1]=E,l[g+2]=y,l[g+3]=v,l[g+4]=A,l[g+5]=b}else{for(var _=1/0,S=1/0,w=1/0,R=-1/0,I=-1/0,H=-1/0,d=0;d<s;d+=1){var h=d*3,g=d*6,m=void 0,E=void 0,y=void 0,v=void 0,A=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),m=v=scratchVector3A.x,T=scratchVector3B.x,T<m&&(m=T),T>v&&(v=T),T=scratchVector3C.x,T<m&&(m=T),T>v&&(v=T),E=A=scratchVector3A.y,T=scratchVector3B.y,T<E&&(E=T),T>A&&(A=T),T=scratchVector3C.y,T<E&&(E=T),T>A&&(A=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=m,l[g+1]=E,l[g+2]=y,l[g+3]=v,l[g+4]=A,l[g+5]=b,m<_&&(_=m),v>R&&(R=v),E<S&&(S=E),A>I&&(I=A),y<w&&(w=y),b>H&&(H=b)}o=[_,S,w,R,I,H]}var C=new BVHNode(++p,o,0,s,0);c[f++]=C;var M=[],B=[0,1,2],L=function(k,D){return M[D]-M[k]};function O(k){var D=k.startIndex,q=k.endIndex,z=k.extents;M[0]=z[3]-z[0],M[1]=z[4]-z[1],M[2]=z[5]-z[2],B.sort(L);for(var J=0;J<3;J++){for(var V=B[J],U=z[V]+z[V+3],j=D,K=q-1,ae=-1,re=void 0;j<=K;)ae===-1?(re=u[j],l[re*6+V]+l[re*6+V+3]<U?j++:ae=re):(re=u[K],l[re*6+V]+l[re*6+V+3]>=U||(u[j]=re,u[K]=ae,ae=-1,j++),K--);if(j>D&&j<q){var ee=new BVHNode(++p,calcExtents(u,l,D,j,EPSILON$1),D,j,k.deepth+1);ee.deepth<r&&ee.endIndex-ee.startIndex>e&&(c[f++]=ee);var Z=new BVHNode(++p,calcExtents(u,l,j,q,EPSILON$1),j,q,k.deepth+1);Z.deepth<r&&Z.endIndex-Z.startIndex>e&&(c[f++]=Z),k.node0=ee,k.node1=Z,k.startIndex=0,k.endIndex=0;break}}}for(;f;)O(c[--f]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(C,p+1),c.length=0,this},t.prototype.trianglesInSphere=function(e,r){for(var o=this.offsetArray,s=this.rootNodePacked,u=new Float32Array(s),l=new Uint32Array(s),c=new Uint16Array(s),f=[0],p=[],d;(d=f.pop())!==void 0;){var h=d*BYTES_PER_NODE/4,g=clamp(e.x,u[h],u[h+3])-e.x,m=clamp(e.y,u[h+1],u[h+4])-e.y,E=clamp(e.z,u[h+2],u[h+5])-e.z;if(g*g+m*m+E*E<=r*r){for(var y=l[h+6],v=l[h+7],A=y;A<v;A++){var b=o[A];p.push(b)}var T=d*BYTES_PER_NODE/2,_=c[T+16],S=c[T+17];_&&f.push(_),S&&f.push(S)}}for(var w=p.length,R=new Float32Array(w*9),A=0;A<w;A++){var b=p[A],I=b*3;this.getPositionByIndex(I,scratchVector3$9),R[A*9]=scratchVector3$9.x,R[A*9+1]=scratchVector3$9.y,R[A*9+2]=scratchVector3$9.z,this.getPositionByIndex(I+1,scratchVector3$9),R[A*9+3]=scratchVector3$9.x,R[A*9+4]=scratchVector3$9.y,R[A*9+5]=scratchVector3$9.z,this.getPositionByIndex(I+2,scratchVector3$9),R[A*9+6]=scratchVector3$9.x,R[A*9+7]=scratchVector3$9.y,R[A*9+8]=scratchVector3$9.z}return R},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,f=this.rootNodePacked,p=new Float32Array(f),d=new Uint32Array(f),h=new Uint16Array(f),g=new BVHVector3(1/r.x,1/r.y,1/r.z),m=[0],E,y=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),v=1/0;(E=m.pop())!==void 0;){var A=E*BYTES_PER_NODE/4;y.min.x=p[A],y.min.y=p[A+1],y.min.z=p[A+2],y.max.x=p[A+3],y.max.y=p[A+4],y.max.z=p[A+5];var b=intersectNodeBox(e,g,y,o);if(b!==null&&!(s&&b>v)){for(var T=e.x,_=e.y,S=e.z,w=r.x,R=r.y,I=r.z,H=d[A+6],C=d[A+7],M=H;M<C;M++){var B=c[M],L=B*3,O=new BVHVector3(0,0,0);this.getPositionByIndex(L,O);var k=O.x,D=O.y,q=O.z,z=new BVHVector3(0,0,0);this.getPositionByIndex(L+1,z);var J=z.x,V=z.y,U=z.z,j=new BVHVector3(0,0,0);this.getPositionByIndex(L+2,j);var K=j.x,ae=j.y,re=j.z,ee=J-k,Z=V-D,X=U-q,se=K-k,G=ae-D,W=re-q,$=Z*W-X*G,ne=X*se-ee*W,te=ee*G-Z*se,ve=w*$+R*ne+I*te,oe=void 0;if(ve>0)oe=1;else if(ve<0)oe=-1,ve=-ve;else continue;var fe=T-k,be=_-D,ie=S-q,ue=oe*(w*(be*W-ie*G)+R*(ie*se-fe*W)+I*(fe*G-be*se));if(!(ue<0)){var me=oe*(w*(Z*ie-X*be)+R*(X*fe-ee*ie)+I*(ee*be-Z*fe));if(!(me<0)&&!(ue+me>ve)){var ge=-oe*(fe*$+be*ne+ie*te);if(!(ge<0)){var Ae=ge/ve,xe=new BVHVector3(T+w*Ae,_+R*Ae,S+I*Ae),de=new BVHIntersect(O,z,j,B,xe);(!u||u(de))&&(s?Ae<v&&(v=Ae,l.length>0&&(l.length=0),l.push(de)):l.push(de))}}}}var _e=E*BYTES_PER_NODE/2,He=h[_e+16],Ee=h[_e+17];He&&m.push(He),Ee&&m.push(Ee)}}return l},t})(BVHObject);function clamp(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,o){if(e>=r)return[0,0,0,0,0,0];for(var s=1/0,u=1/0,l=1/0,c=-1/0,f=-1/0,p=-1/0,d=e;d<r;d++){var h=n[d]*6,g=t[h];g<s&&(s=g),g=t[h+1],g<u&&(u=g),g=t[h+2],g<l&&(l=g),g=t[h+3],g>c&&(c=g),g=t[h+4],g>f&&(f=g),g=t[h+5],g>p&&(p=g)}return[s-o,u-o,l-o,c+o,f+o,p+o]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$8=new BVHVector3(0,0,0),BVHPoints=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionByIndex.bind(this),u=this.getPositionCount(),l=u>65535?new Uint32Array(u):new Uint16Array(u),c=[],f=0,p=-1;if(o)for(var d=0;d<u;d+=1)l[d]=d;else{s(0,scratchVector3$8);for(var h=scratchVector3$8.x,g=scratchVector3$8.y,m=scratchVector3$8.z,E=h,y=g,v=m,d=0;d<u;d+=1){l[d]=d,s(d,scratchVector3$8);var A=scratchVector3$8.x,b=scratchVector3$8.y,T=scratchVector3$8.z;A<h?h=A:A>E&&(E=A),b<g?g=b:b>y&&(y=b),T<m?m=T:T>v&&(v=T)}o=[h,g,m,E,y,v]}var _=new BVHNode(++p,o,0,u,0);c[f++]=_;var S=[],w=[0,1,2],R=function(H,C){return S[C]-S[H]};function I(H){var C=H.startIndex,M=H.endIndex,B=H.extents;S[0]=B[3]-B[0],S[1]=B[4]-B[1],S[2]=B[5]-B[2];for(var L=w.sort(R)[0],O=ORDER_AXISES[L],k=(B[L]+B[L+3])/2,D=C,q=M-1,z=-1,J;D<=q;)z===-1?(J=l[D],s(J,scratchVector3$8),scratchVector3$8[O]<k?D++:z=J):(J=l[q],s(J,scratchVector3$8),scratchVector3$8[O]>=k||(l[D]=J,l[q]=z,z=-1,D++),q--);if(D>C){var V=B.slice();V[L+3]=k+EPSILON;var U=new BVHNode(++p,V,C,D,H.deepth+1);U.deepth<r&&U.endIndex-U.startIndex>e&&(c[f++]=U),H.node0=U}if(M>D){var j=B.slice();j[L]=k-EPSILON;var K=new BVHNode(++p,j,D,M,H.deepth+1);K.deepth<r&&K.endIndex-K.startIndex>e&&(c[f++]=K),H.node1=K}H.startIndex=0,H.endIndex=0}for(;f;)I(c[--f]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,p+1),c.length=0,this},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,f=this.rootNodePacked,p=new Float32Array(f),d=new Uint32Array(f),h=new Uint16Array(f),g=o*o,m=new BVHVector3(1/r.x,1/r.y,1/r.z),E=[0],y,v=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),A=1/0;(y=E.pop())!==void 0;){var b=y*BYTES_PER_NODE/4;v.min.x=p[b],v.min.y=p[b+1],v.min.z=p[b+2],v.max.x=p[b+3],v.max.y=p[b+4],v.max.z=p[b+5];var T=intersectNodeBox(e,m,v,o);if(T!==null&&!(s&&T>A)){for(var _=d[b+6],S=d[b+7],w=_;w<S;w++){var R=c[w],I=new BVHVector3(0,0,0);this.getPositionByIndex(R,I);var H=I.x,C=I.y,M=I.z,B=e.x,L=e.y,O=e.z,k=r.x,D=r.y,q=r.z,z=k*(H-B)+D*(C-L)+q*(M-O);if(z>0?(B+=k*z,L+=D*z,O+=q*z):z<0&&(z=0),k=H-B,D=C-L,q=M-O,k*k+D*D+q*q<=g){var J=new BVHVector3(B,L,O),V=new BVHIntersect(I,I,I,R,J);(!u||u(V))&&(s?z<A&&(A=z,l.length>0&&(l.length=0),l.push(V)):l.push(V))}}var U=y*BYTES_PER_NODE/2,j=h[U+16],K=h[U+17];j&&E.push(j),K&&E.push(K)}}return l},t})(BVHObject);const jsContent=`(function(){"use strict";var ur=function(o,r){return ur=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},ur(o,r)};function yr(o,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");ur(o,r);function t(){this.constructor=o}o.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}typeof SuppressedError=="function"&&SuppressedError;var cr=(function(){function o(r,t){this.position=r,this.indices=t}return o.prototype.getPositionCount=function(){var r,t,n=this.indices,e=this.position;return n?n.array.length/((r=n.stride)!==null&&r!==void 0?r:1):e.array.length/((t=e.stride)!==null&&t!==void 0?t:3)},o.prototype.getPositionByIndex=function(r,t){var n,e,h,v,i=this.indices,f=this.position,l=r;if(i){var y=i.array,s=(n=i.stride)!==null&&n!==void 0?n:1,d=(e=i.offset)!==null&&e!==void 0?e:0;l=y[r*s+d]}var u=f.array,x=(h=f.stride)!==null&&h!==void 0?h:3,w=(v=f.offset)!==null&&v!==void 0?v:0;return l=l*x+w,t.x=u[l],t.y=u[l+1],t.z=u[l+2],t},o.prototype.createTree=function(r,t,n){throw new Error("not implemented")},o.prototype.trianglesInSphere=function(r,t){throw new Error("not implemented")},o.prototype.intersectRay=function(r,t,n,e,h){throw new Error("not implemented")},o})(),D=(function(){function o(r,t,n,e,h){this.id=r,this.extents=t,this.startIndex=n,this.endIndex=e,this.deepth=h}return o})(),X=36;function lr(o,r){for(var t=new ArrayBuffer(r*X),n=new Float32Array(t),e=new Uint32Array(t),h=new Uint16Array(t),v=[o],i,f;i=v.pop();)f=i.id*X/4,n[f]=i.extents[0],n[f+1]=i.extents[1],n[f+2]=i.extents[2],n[f+3]=i.extents[3],n[f+4]=i.extents[4],n[f+5]=i.extents[5],e[f+6]=i.startIndex,e[f+7]=i.endIndex,f=i.id*X/2,i.node0&&(h[f+16]=i.node0.id,v.push(i.node0)),i.node1&&(h[f+17]=i.node1.id,v.push(i.node1));return t}function dr(o,r,t,n){n===void 0&&(n=0);var e=t.min.x-n,h=t.min.y-n,v=t.min.z-n,i=t.max.x+n,f=t.max.y+n,l=t.max.z+n,y=0,s=0,d=0,u=0,x=0,w=0;return r.x>=0?(y=(e-o.x)*r.x,s=(i-o.x)*r.x):(y=(i-o.x)*r.x,s=(e-o.x)*r.x),r.y>=0?(d=(h-o.y)*r.y,u=(f-o.y)*r.y):(d=(f-o.y)*r.y,u=(h-o.y)*r.y),y>u||d>s||((d>y||y!==y)&&(y=d),(u<s||s!==s)&&(s=u),r.z>=0?(x=(v-o.z)*r.z,w=(l-o.z)*r.z):(x=(l-o.z)*r.z,w=(v-o.z)*r.z),y>w||x>s)||((x>y||y!==y)&&(y=x),(w<s||s!==s)&&(s=w),s<0)?null:y>=0?y:s}var H=(function(){function o(r,t,n){this.x=r,this.y=t,this.z=n}return o.prototype.copy=function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this},o.prototype.set=function(r,t,n){return this.x=r,this.y=t,this.z=n,this},o.prototype.fromArray=function(r,t){return t===void 0&&(t=0),this.x=r[t],this.y=r[t+1],this.z=r[t+2],this},o.prototype.toArray=function(r,t){return r===void 0&&(r=[]),t===void 0&&(t=0),r[t]=this.x,r[t+1]=this.y,r[t+2]=this.z,r},o.prototype.add=function(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this},o.prototype.multiplyScalar=function(r){return this.x*=r,this.y*=r,this.z*=r,this},o.prototype.subVectors=function(r,t){return this.x=r.x-t.x,this.y=r.y-t.y,this.z=r.z-t.z,this},o.prototype.addScaledVector=function(r,t){return this.x+=r.x*t,this.y+=r.y*t,this.z+=r.z*t,this},o.prototype.dot=function(r){return this.x*r.x+this.y*r.y+this.z*r.z},o.prototype.cross=function(r){var t=this.x,n=this.y,e=this.z;return this.x=n*r.z-e*r.y,this.y=e*r.x-t*r.z,this.z=t*r.y-n*r.x,this},o.prototype.crossVectors=function(r,t){var n=r.x,e=r.y,h=r.z,v=t.x,i=t.y,f=t.z;return this.x=e*f-h*i,this.y=h*v-n*f,this.z=n*i-e*v,this},o.prototype.distanceTo=function(r){return Math.sqrt(this.distanceToSquared(r))},o.prototype.distanceToSquared=function(r){var t=this.x-r.x,n=this.y-r.y,e=this.z-r.z;return t*t+n*n+e*e},o.prototype.clone=function(){return new o(this.x,this.y,this.z)},o})(),wr=(function(){function o(r,t,n,e,h){this.pointA=r,this.pointB=t,this.pointC=n,this.index=e,this.intersectionPoint=h}return o})(),xr=(function(){function o(r,t){this.min=r,this.max=t}return o})(),pr=1e-6,J=new H(0,0,0),Y=new H(0,0,0),g=new H(0,0,0),Z=new H(0,0,0),Hr=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionCount()/3,v=h>65535?new Uint32Array(h):new Uint16Array(h),i=new Float32Array(h*6),f=[],l=0,y=-1;if(e)for(var s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p}else{for(var F=1/0,k=1/0,E=1/0,S=-1/0,V=-1/0,U=-1/0,s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p,x<F&&(F=x),I>S&&(S=I),w<k&&(k=w),c>V&&(V=c),z<E&&(E=z),p>U&&(U=p)}e=[F,k,E,S,V,U]}var W=new D(++y,e,0,h,0);f[l++]=W;var M=[],T=[0,1,2],j=function(P,B){return M[B]-M[P]};function q(P){var B=P.startIndex,_=P.endIndex,A=P.extents;M[0]=A[3]-A[0],M[1]=A[4]-A[1],M[2]=A[5]-A[2],T.sort(j);for(var $=0;$<3;$++){for(var C=T[$],G=A[C]+A[C+3],N=B,L=_-1,O=-1,Q=void 0;N<=L;)O===-1?(Q=v[N],i[Q*6+C]+i[Q*6+C+3]<G?N++:O=Q):(Q=v[L],i[Q*6+C]+i[Q*6+C+3]>=G||(v[N]=Q,v[L]=O,O=-1,N++),L--);if(N>B&&N<_){var R=new D(++y,zr(v,i,B,N,pr),B,N,P.deepth+1);R.deepth<n&&R.endIndex-R.startIndex>t&&(f[l++]=R);var b=new D(++y,zr(v,i,N,_,pr),N,_,P.deepth+1);b.deepth<n&&b.endIndex-b.startIndex>t&&(f[l++]=b),P.node0=R,P.node1=b,P.startIndex=0,P.endIndex=0;break}}}for(;l;)q(f[--l]);return this.offsetArray=v,this.rootNodePacked=lr(W,y+1),f.length=0,this},r.prototype.trianglesInSphere=function(t,n){for(var e=this.offsetArray,h=this.rootNodePacked,v=new Float32Array(h),i=new Uint32Array(h),f=new Uint16Array(h),l=[0],y=[],s;(s=l.pop())!==void 0;){var d=s*X/4,u=fr(t.x,v[d],v[d+3])-t.x,x=fr(t.y,v[d+1],v[d+4])-t.y,w=fr(t.z,v[d+2],v[d+5])-t.z;if(u*u+x*x+w*w<=n*n){for(var z=i[d+6],I=i[d+7],c=z;c<I;c++){var p=e[c];y.push(p)}var a=s*X/2,F=f[a+16],k=f[a+17];F&&l.push(F),k&&l.push(k)}}for(var E=y.length,S=new Float32Array(E*9),c=0;c<E;c++){var p=y[c],V=p*3;this.getPositionByIndex(V,J),S[c*9]=J.x,S[c*9+1]=J.y,S[c*9+2]=J.z,this.getPositionByIndex(V+1,J),S[c*9+3]=J.x,S[c*9+4]=J.y,S[c*9+5]=J.z,this.getPositionByIndex(V+2,J),S[c*9+6]=J.x,S[c*9+7]=J.y,S[c*9+8]=J.z}return S},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=new H(1/n.x,1/n.y,1/n.z),x=[0],w,z=new xr(new H(0,0,0),new H(0,0,0)),I=1/0;(w=x.pop())!==void 0;){var c=w*X/4;z.min.x=y[c],z.min.y=y[c+1],z.min.z=y[c+2],z.max.x=y[c+3],z.max.y=y[c+4],z.max.z=y[c+5];var p=dr(t,u,z,e);if(p!==null&&!(h&&p>I)){for(var a=t.x,F=t.y,k=t.z,E=n.x,S=n.y,V=n.z,U=s[c+6],W=s[c+7],M=U;M<W;M++){var T=f[M],j=T*3,q=new H(0,0,0);this.getPositionByIndex(j,q);var P=q.x,B=q.y,_=q.z,A=new H(0,0,0);this.getPositionByIndex(j+1,A);var $=A.x,C=A.y,G=A.z,N=new H(0,0,0);this.getPositionByIndex(j+2,N);var L=N.x,O=N.y,Q=N.z,R=$-P,b=C-B,or=G-_,er=L-P,vr=O-B,sr=Q-_,Ar=b*sr-or*vr,Pr=or*er-R*sr,Br=R*vr-b*er,m=E*Ar+S*Pr+V*Br,rr=void 0;if(m>0)rr=1;else if(m<0)rr=-1,m=-m;else continue;var tr=a-P,nr=F-B,ir=k-_,Sr=rr*(E*(nr*sr-ir*vr)+S*(ir*er-tr*sr)+V*(tr*vr-nr*er));if(!(Sr<0)){var Nr=rr*(E*(b*ir-or*nr)+S*(or*tr-R*ir)+V*(R*nr-b*tr));if(!(Nr<0)&&!(Sr+Nr>m)){var Vr=-rr*(tr*Ar+nr*Pr+ir*Br);if(!(Vr<0)){var ar=Vr/m,jr=new H(a+E*ar,F+S*ar,k+V*ar),hr=new wr(q,A,N,T,jr);(!v||v(hr))&&(h?ar<I&&(I=ar,i.length>0&&(i.length=0),i.push(hr)):i.push(hr))}}}}var Tr=w*X/2,Ur=d[Tr+16],_r=d[Tr+17];Ur&&x.push(Ur),_r&&x.push(_r)}}return i},r})(cr);function fr(o,r,t){return o<r?r:o>t?t:o}function zr(o,r,t,n,e){if(t>=n)return[0,0,0,0,0,0];for(var h=1/0,v=1/0,i=1/0,f=-1/0,l=-1/0,y=-1/0,s=t;s<n;s++){var d=o[s]*6,u=r[d];u<h&&(h=u),u=r[d+1],u<v&&(v=u),u=r[d+2],u<i&&(i=u),u=r[d+3],u>f&&(f=u),u=r[d+4],u>l&&(l=u),u=r[d+5],u>y&&(y=u)}return[h-e,v-e,i-e,f+e,l+e,y+e]}var Ir=1e-6,kr=["x","y","z"],K=new H(0,0,0),Er=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionByIndex.bind(this),v=this.getPositionCount(),i=v>65535?new Uint32Array(v):new Uint16Array(v),f=[],l=0,y=-1;if(e)for(var s=0;s<v;s+=1)i[s]=s;else{h(0,K);for(var d=K.x,u=K.y,x=K.z,w=d,z=u,I=x,s=0;s<v;s+=1){i[s]=s,h(s,K);var c=K.x,p=K.y,a=K.z;c<d?d=c:c>w&&(w=c),p<u?u=p:p>z&&(z=p),a<x?x=a:a>I&&(I=a)}e=[d,u,x,w,z,I]}var F=new D(++y,e,0,v,0);f[l++]=F;var k=[],E=[0,1,2],S=function(U,W){return k[W]-k[U]};function V(U){var W=U.startIndex,M=U.endIndex,T=U.extents;k[0]=T[3]-T[0],k[1]=T[4]-T[1],k[2]=T[5]-T[2];for(var j=E.sort(S)[0],q=kr[j],P=(T[j]+T[j+3])/2,B=W,_=M-1,A=-1,$;B<=_;)A===-1?($=i[B],h($,K),K[q]<P?B++:A=$):($=i[_],h($,K),K[q]>=P||(i[B]=$,i[_]=A,A=-1,B++),_--);if(B>W){var C=T.slice();C[j+3]=P+Ir;var G=new D(++y,C,W,B,U.deepth+1);G.deepth<n&&G.endIndex-G.startIndex>t&&(f[l++]=G),U.node0=G}if(M>B){var N=T.slice();N[j]=P-Ir;var L=new D(++y,N,B,M,U.deepth+1);L.deepth<n&&L.endIndex-L.startIndex>t&&(f[l++]=L),U.node1=L}U.startIndex=0,U.endIndex=0}for(;l;)V(f[--l]);return this.offsetArray=i,this.rootNodePacked=lr(F,y+1),f.length=0,this},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=e*e,x=new H(1/n.x,1/n.y,1/n.z),w=[0],z,I=new xr(new H(0,0,0),new H(0,0,0)),c=1/0;(z=w.pop())!==void 0;){var p=z*X/4;I.min.x=y[p],I.min.y=y[p+1],I.min.z=y[p+2],I.max.x=y[p+3],I.max.y=y[p+4],I.max.z=y[p+5];var a=dr(t,x,I,e);if(a!==null&&!(h&&a>c)){for(var F=s[p+6],k=s[p+7],E=F;E<k;E++){var S=f[E],V=new H(0,0,0);this.getPositionByIndex(S,V);var U=V.x,W=V.y,M=V.z,T=t.x,j=t.y,q=t.z,P=n.x,B=n.y,_=n.z,A=P*(U-T)+B*(W-j)+_*(M-q);if(A>0?(T+=P*A,j+=B*A,q+=_*A):A<0&&(A=0),P=U-T,B=W-j,_=M-q,P*P+B*B+_*_<=u){var $=new H(T,j,q),C=new wr(V,V,V,S,$);(!v||v(C))&&(h?A<c&&(c=A,i.length>0&&(i.length=0),i.push(C)):i.push(C))}}var G=z*X/2,N=d[G+16],L=d[G+17];N&&w.push(N),L&&w.push(L)}}return i},r})(cr);function Mr(o){onmessage=function(r){Promise.resolve(r.data).then(function(t){return o(t)}).then(function(t){var n=t.output,e=t.transfer;return postMessage(n,e)}).catch(function(t){return postMessage({$$error:t})})}}Mr(function(o){return Promise.resolve(o).then(function(r){for(var t=[],n=new Set,e=0,h=r;e<h.length;e++){var v=h[e],i=void 0;if(v.type==="mesh")i=new Hr(v.attributes.position,v.indices);else if(v.type==="points")i=new Er(v.attributes.position,v.indices);else throw new Error("Invalid Type");i.createTree(v.maxItemPerNode,v.maxTreeDepth,v.extents);var f={type:v.type,attributes:v.attributes,indices:v.indices,offsetArray:i.offsetArray,rootNodePacked:i.rootNodePacked};t.push(f);var l=void 0;for(var y in f.attributes){var s=f.attributes[y];s&&s.buffer instanceof ArrayBuffer&&n.add(s.buffer)}l=f.indices,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),l=f.offsetArray,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),n.add(f.rootNodePacked)}return{output:t,transfer:Array.from(n)}})})})();
|
|
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 f=o<<4|n[o],p=t-n[o],d=u[n[o]-1]++<<p,h=d|(1<<p)-1;d<=h;++d)l[rev[d]>>c]=f}else for(l=new u16(r),o=0;o<r;++o)n[o]&&(l[o]=rev[u[n[o]-1]++]>>15-n[o]);return l}),flt=new u8(288);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 f=function(G){var W=e.length;if(G>W){var $=new u8(Math.max(W*2,G));$.set(e),e=$}},p=t.f||0,d=t.p||0,h=t.b||0,g=t.l,m=t.d,E=t.m,y=t.n,v=o*8;do{if(!g){p=bits(n,d,1);var A=bits(n,d+1,3);if(d+=3,A)if(A==1)g=flrm,m=fdrm,E=9,y=5;else if(A==2){var S=bits(n,d,31)+257,w=bits(n,d+10,15)+4,R=S+bits(n,d+5,31)+1;d+=14;for(var I=new u8(R),H=new u8(19),C=0;C<w;++C)H[clim[C]]=bits(n,d+C*3,7);d+=w*3;for(var M=max(H),B=(1<<M)-1,L=hMap(H,M,1),C=0;C<R;){var O=L[bits(n,d,B)];d+=O&15;var b=O>>4;if(b<16)I[C++]=b;else{var k=0,D=0;for(b==16?(D=3+bits(n,d,3),d+=2,k=I[C-1]):b==17?(D=3+bits(n,d,7),d+=3):b==18&&(D=11+bits(n,d,127),d+=7);D--;)I[C++]=k}}var q=I.subarray(0,S),z=I.subarray(S);E=max(q),y=max(z),g=hMap(q,E,1),m=hMap(z,y,1)}else err(1);else{var b=shft(d)+4,T=n[b-4]|n[b-3]<<8,_=b+T;if(_>o){c&&err(0);break}l&&f(h+T),e.set(n.subarray(b,_),h),t.b=h+=T,t.p=d=_*8,t.f=p;continue}if(d>v){c&&err(0);break}}l&&f(h+131072);for(var J=(1<<E)-1,V=(1<<y)-1,U=d;;U=d){var k=g[bits16(n,d)&J],j=k>>4;if(d+=k&15,d>v){c&&err(0);break}if(k||err(2),j<256)e[h++]=j;else if(j==256){U=d,g=null;break}else{var K=j-254;if(j>264){var C=j-257,ae=fleb[C];K=bits(n,d,(1<<ae)-1)+fl[C],d+=ae}var re=m[bits16(n,d)&V],ee=re>>4;re||err(3),d+=re&15;var z=fd[ee];if(ee>3){var ae=fdeb[ee];z+=bits16(n,d)&(1<<ae)-1,d+=ae}if(d>v){c&&err(0);break}l&&f(h+131072);var Z=h+K;if(h<z){var X=s-z,se=Math.min(z,Z);for(X+h<0&&err(3);h<se;++h)e[h]=r[X+h]}for(;h<Z;++h)e[h]=e[h-z]}}t.l=g,t.p=U,t.b=h,t.f=p,g&&(p=1,t.m=E,t.d=m,t.n=y)}while(!p);return h!=e.length&&u?slc(e,0,h):e.subarray(0,h)},et=new u8(0),b2=function(n,t){return n[t]|n[t+1]<<8},b4=function(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0},b8=function(n,t){return b4(n,t)+b4(n,t+4)*4294967296},zls=function(n,t){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&err(6,"invalid zlib data"),(n[1]>>5&1)==1&&err(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function inflateSync(n,t){return inflt(n,{i:2},t&&t.out,t&&t.dictionary)}function unzlibSync(n,t){return inflt(n.subarray(zls(n),-4),{i:2},t,t)}var td=typeof TextDecoder!="undefined"&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0}),tds=1}catch(n){}var dutf8=function(n){for(var t="",e=0;;){var r=n[e++],o=(r>127)+(r>223)+(r>239);if(e+o>n.length)return{s:t,r:slc(n,e-1)};o?o==3?(r=((r&15)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):o&1?t+=String.fromCharCode((r&31)<<6|n[e++]&63):t+=String.fromCharCode((r&15)<<12|(n[e++]&63)<<6|n[e++]&63):t+=String.fromCharCode(r)}};function strFromU8(n,t){if(t){for(var e="",r=0;r<n.length;r+=16384)e+=String.fromCharCode.apply(null,n.subarray(r,r+16384));return e}else{if(td)return td.decode(n);var o=dutf8(n),s=o.s,e=o.r;return e.length&&err(8),s}}var slzh=function(n,t){return t+30+b2(n,t+26)+b2(n,t+28)},zh=function(n,t,e){var r=b2(n,t+28),o=strFromU8(n.subarray(t+46,t+46+r),!(b2(n,t+8)&2048)),s=t+46+r,u=b4(n,t+20),l=e&&u==4294967295?z64e(n,s):[u,b4(n,t+24),b4(n,t+42)],c=l[0],f=l[1],p=l[2];return[b2(n,t+10),c,f,o,s+b2(n,t+30)+b2(n,t+32),p]},z64e=function(n,t){for(;b2(n,t)!=1;t+=4+b2(n,t+2));return[b8(n,t+12),b8(n,t+4),b8(n,t+20)]};function unzipSync(n,t){for(var e={},r=n.length-22;b4(n,r)!=101010256;--r)(!r||n.length-r>65558)&&err(13);var o=b2(n,r+8);if(!o)return{};var s=b4(n,r+16),u=s==4294967295||o==65535;if(u){var l=b4(n,r-12);u=b4(n,l)==101075792,u&&(o=b4(n,l+32),s=b4(n,l+48))}for(var c=0;c<o;++c){var f=zh(n,s,u),p=f[0],d=f[1],h=f[2],g=f[3],m=f[4],E=f[5],y=slzh(n,E);s=m,p?p==8?e[g]=inflateSync(n.subarray(y,y+d),{out:new u8(h)}):err(14,"unknown compression type "+p):e[g]=slc(n,y,y+d)}return e}function loadFbx(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u=0;return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return u=l.body.byteLength,l.body})}).then(function(l){var c;return parse$2(l,{light:t.light,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(c=n.split("?")[1])!==null&&c!==void 0?c:"",fetcher:s})}).then(function(l){var c=l.scene,f=l.unitScale/100,p=new THREE__namespace.Matrix4;if(p.makeScale(f,f,f),l.upAxis==="X")throw new Error("Cannot load fbx x upAxis");return l.upAxis==="Y"&&p.premultiply(ROTATE_X_MATRIX),o==="Y"&&p.premultiply(ROTATE_X_MATRIX_INVERSE),c.applyMatrix4(p),{type:"fbx",modelUpAxis:l.upAxis,upAxis:o,uri:n,byteLength:u,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:l.animations,dispose:function(){return l.dispose()}}})}function parse$2(n,t){var e;if(isFbxFormatBinary(n))e=new BinaryParser().parse(n);else{var r=convertArrayBufferToString(n);if(!isFbxFormatASCII(r))throw new Error("THREE.FBXLoader: Unknown format.");if(getFbxVersion(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+getFbxVersion(r));e=new TextParser().parse(r)}return new FBXTreeParser(t).parse(e)}var FBXTreeParser=(function(){function n(t){var e,r,o;this.light=(e=t.light)!==null&&e!==void 0?e:!0,this.resourcePath=(r=t.resourcePath)!==null&&r!==void 0?r:"",this.search=(o=t.search)!==null&&o!==void 0?o:"",this.fetcher=t.fetcher}return n.prototype.parse=function(t){var e,r,o,s,u,l,c=this.parseConnections(t),f=Object.assign(new THREE__namespace.Group,{animations:[]}),p=[],d=this.parseImages(t),h=this.parseTextures(t,d,c,p),g=this.parseMaterials(t,h,c),m=this.parseDeformers(t,c),E=new GeometryParser().parse(t,m,c);this.parseScene(t,m,E,g,c,f);var y=(r=(e=t.GlobalSettings.UpAxis)===null||e===void 0?void 0:e.value)!==null&&r!==void 0?r:1,v=(s=(o=t.GlobalSettings.FrontAxis)===null||o===void 0?void 0:o.value)!==null&&s!==void 0?s:2,A=(l=(u=t.GlobalSettings.UnitScaleFactor)===null||u===void 0?void 0:u.value)!==null&&l!==void 0?l:1,b;if(t.GlobalSettings.AmbientColor){var T=t.GlobalSettings.AmbientColor.value,_=T[0],S=T[1],w=T[2];if(_!==0||S!==0||w!==0){var R=new THREE__namespace.Color().setRGB(_,S,w);b=new THREE__namespace.AmbientLight(R,1)}}return Promise.all(p).then(function(I){var H;return{scene:f,textures:I,ambientLight:b,upAxis:["X","Y","Z"][y],frontAxis:["X","Y","Z"][v],unitScale:A,animations:(H=f.animations)!==null&&H!==void 0?H:[],dispose:function(){I.forEach(function(C){return C.dispose()}),g.forEach(function(C){return C.dispose()}),E.forEach(function(C){return C.dispose()})}}})},n.prototype.parseConnections=function(t){var e=new Map;if("Connections"in t){var r=t.Connections.connections;r.forEach(function(o){var s=o[0],u=o[1],l=o[2];e.has(s)||e.set(s,{parents:[],children:[]});var c={ID:u,relationship:l};e.get(s).parents.push(c),e.has(u)||e.set(u,{parents:[],children:[]});var f={ID:s,relationship:l};e.get(u).children.push(f)})}return e},n.prototype.parseImages=function(t){var e={},r={};if("Video"in t.Objects){var o=t.Objects.Video;for(var s in o){var u=o[s],l=parseInt(s);if(e[l]=u.RelativeFilename||u.Filename,"Content"in u){var c=u.Content instanceof ArrayBuffer&&u.Content.byteLength>0,f=typeof u.Content=="string"&&u.Content!=="";if(c||f){var p=this.parseImage(o[s]);r[u.RelativeFilename||u.Filename]=p}}}}for(var l in e){var d=e[l];r[d]!==void 0?e[l]=r[d]:e[l]=e[l].split("\\").pop()}return e},n.prototype.parseImage=function(t){var e=t.Content,r=t.RelativeFilename||t.Filename,o=r.slice(r.lastIndexOf(".")+1).toLowerCase(),s;switch(o){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":s="image/tga";break;default:return}if(typeof e=="string")return"data:"+s+";base64,"+e;var u=new Uint8Array(e);return window.URL.createObjectURL(new Blob([u],{type:s}))},n.prototype.parseTextures=function(t,e,r,o){var s=new Map;if("Texture"in t.Objects){var u=t.Objects.Texture;for(var l in u){var c=this.parseTexture(u[l],e,r,o);s.set(parseInt(l),c)}}return s},n.prototype.parseTexture=function(t,e,r,o){var s=this.loadTexture(t,e,r,o);s.ID=t.id,s.name=t.attrName;var u=t.WrapModeU,l=t.WrapModeV,c=u!==void 0?u.value:0,f=l!==void 0?l.value:0;if(s.wrapS=c===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,s.wrapT=f===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,t.Scaling){var p=t.Scaling.value;s.repeat.x=p[0],s.repeat.y=p[1]}if(t.Translation){var p=t.Translation.value;s.offset.x=p[0],s.offset.y=p[1]}return s},n.prototype.loadTexture=function(t,e,r,o){var s=r.get(t.id).children,u="";s!==void 0&&s.length>0&&e[s[0].ID]!==void 0&&(u=e[s[0].ID]),u=pathJoin(this.resourcePath,appendSearch(u,this.search));var l=Object.assign(new THREE__namespace.Texture,{ID:0}),c;canUseNativeImageBitmap()?c=this.fetcher.ajax(u,{responseType:"blob"}).then(function(p){var d=p.body;return createImageBitmapLike(d)}):c=this.fetcher.loadImage(u,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(p){return p.body});var f=c.then(function(p){return l.image=p,l.needsUpdate=!0,l}).catch(function(p){return console.warn(p),l});return o.push(f),l},n.prototype.parseMaterials=function(t,e,r){var o=new Map;if("Material"in t.Objects){var s=t.Objects.Material;for(var u in s){var l=this.parseMaterial(t,s[u],e,r);l!==null&&o.set(parseInt(u),l)}}return o},n.prototype.parseMaterial=function(t,e,r,o){var s=e.id,u=e.attrName,l=e.ShadingModel;if(typeof l=="object"&&(l=l.value),l=l.toLowerCase(),!o.has(s))return null;var c=new PBMMeshMaterial(this.light?"phong":"basic");c.name=u,e.BumpFactor&&(c.bumpScale=e.BumpFactor.value),e.Diffuse?c.color=new THREE__namespace.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(c.color=new THREE__namespace.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(c.displacementScale=e.DisplacementFactor.value),e.Emissive?c.emissive=new THREE__namespace.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(c.emissive=new THREE__namespace.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(c.emissiveIntensity=parseFloat(e.EmissiveFactor.value));var f=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0);(f===1||f===0)&&(f=e.Opacity?parseFloat(e.Opacity.value):null,f===null&&(f=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),c.opacity=f,c.opacity<1&&(c.transparent=!0),e.ReflectionFactor&&(c.reflectivity=e.ReflectionFactor.value),e.Shininess&&(c.shininess=e.Shininess.value),e.Specular?c.specular=new THREE__namespace.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(c.specular=new THREE__namespace.Color().fromArray(e.SpecularColor.value));var p=this;return o.get(s).children.forEach(function(d){var h=d.relationship;switch(h){case"Bump":c.bumpMap=p.getTexture(t,r,d.ID,o);break;case"Maya|TEX_ao_map":c.aoMap=p.getTexture(t,r,d.ID,o);break;case"DiffuseColor":case"Maya|TEX_color_map":c.map=p.getTexture(t,r,d.ID,o),c.map!==void 0&&(c.map.encoding=THREE__namespace.sRGBEncoding);break;case"DisplacementColor":c.displacementMap=p.getTexture(t,r,d.ID,o);break;case"EmissiveColor":c.emissiveMap=p.getTexture(t,r,d.ID,o),c.emissiveMap!==void 0&&(c.emissiveMap.encoding=THREE__namespace.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":c.normalMap=p.getTexture(t,r,d.ID,o);break;case"ReflectionColor":c.envMap=p.getTexture(t,r,d.ID,o),c.envMap!==void 0&&(c.envMap.mapping=THREE__namespace.EquirectangularReflectionMapping,c.envMap.encoding=THREE__namespace.sRGBEncoding);break;case"SpecularColor":c.specularMap=p.getTexture(t,r,d.ID,o),c.specularMap!==void 0&&(c.specularMap.encoding=THREE__namespace.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":c.alphaMap=p.getTexture(t,r,d.ID,o),c.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",h);break}}),c},n.prototype.getTexture=function(t,e,r,o){return t.Objects.LayeredTexture&&r in t.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=o.get(r).children[0].ID),e.get(r)},n.prototype.parseDeformers=function(t,e){var r={},o={};if("Deformer"in t.Objects){var s=t.Objects.Deformer;for(var u in s){var l=s[u],c=e.get(parseInt(u));if(l.attrType==="Skin"){var f=this.parseSkeleton(c,s);f.ID=u,c.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),f.geometryID=c.parents[0].ID,r[u]=f}else if(l.attrType==="BlendShape"){var p={id:u};p.rawTargets=this.parseMorphTargets(c,s,e),p.id=u,c.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),o[u]=p}}}return{skeletons:r,morphTargets:o}},n.prototype.parseSkeleton=function(t,e){var r=[];return t.children.forEach(function(o){var s=e[o.ID];if(s.attrType==="Cluster"){var u={ID:o.ID,indices:[],weights:[],transformLink:new THREE__namespace.Matrix4().fromArray(s.TransformLink.a)};s.Indexes&&(u.indices=s.Indexes.a,u.weights=s.Weights.a),r.push(u)}}),{ID:"",geometryID:0,rawBones:r,bones:[]}},n.prototype.parseMorphTargets=function(t,e,r){for(var o=[],s=0;s<t.children.length;s++){var u=t.children[s],l=e[u.ID],c={name:l.attrName,initialWeight:l.DeformPercent,id:l.id,fullWeights:l.FullWeights.a,geoID:0};if(l.attrType!=="BlendShapeChannel")return;c.geoID=r.get(parseInt(u.ID)).children.filter(function(f){return f.relationship===void 0})[0].ID,o.push(c)}return o},n.prototype.parseScene=function(t,e,r,o,s,u){var l=this.parseModels(t,e.skeletons,r,o,s),c=t.Objects.Model,f=this;l.forEach(function(d){var h=c[d.ID];f.setLookAtProperties(t,d,h,s,u);var g=s.get(d.ID).parents;g.forEach(function(m){var E=l.get(m.ID);E!==void 0&&E.add(d)}),d.parent===null&&u.add(d)}),this.bindSkeleton(t,e.skeletons,r,l,s),u.traverse(function(d){if(d.userData.transformData){d.parent&&(d.userData.transformData.parentMatrix=d.parent.matrix,d.userData.transformData.parentMatrixWorld=d.parent.matrixWorld);var h=generateTransform(d.userData.transformData);d.applyMatrix4(h),d.updateWorldMatrix(!0,!0)}});var p=new AnimationParser().parse(t,s,u);u.children.length===1&&u.children[0]instanceof THREE__namespace.Group&&(u=u.children[0]),u.animations=p},n.prototype.parseModels=function(t,e,r,o,s){var u=new Map,l=t.Objects.Model;for(var c in l){var f=parseInt(c),p=l[c],d=s.get(f),h=this.buildSkeleton(d,e,f,p.attrName);if(!h){switch(p.attrType){case"Camera":h=this.createCamera(t,d);break;case"Light":h=this.createLight(t,d);break;case"Mesh":h=this.createMesh(d,r,o);break;case"NurbsCurve":case"LimbNode":case"Root":h=new THREE__namespace.Bone;break;case"Null":default:h=new THREE__namespace.Group;break}h.name=p.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(p.attrName):"",h.userData.originalName=p.attrName,h.ID=f}this.getTransformData(h,p),u.set(f,h)}return u},n.prototype.buildSkeleton=function(t,e,r,o){var s=null;return t.parents.forEach(function(u){var l=function(f){var p=e[f];p.rawBones.forEach(function(d,h){if(d.ID===u.ID){var g=s;s=new THREE__namespace.Bone,s.matrixWorld.copy(d.transformLink),s.name=o?THREE__namespace.PropertyBinding.sanitizeNodeName(o):"",s.userData.originalName=o,s.ID=r,p.bones[h]=s,g!==null&&s.add(g)}})};for(var c in e)l(c)}),s},n.prototype.createCamera=function(t,e){var r,o;if(e.children.forEach(function(g){var m=t.Objects.NodeAttribute[g.ID];m!==void 0&&(o=m)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=0;o.CameraProjectionType!==void 0&&o.CameraProjectionType.value===1&&(s=1);var u=1;o.NearPlane!==void 0&&(u=o.NearPlane.value/1e3);var l=1e3;o.FarPlane!==void 0&&(l=o.FarPlane.value/1e3);var c=window.innerWidth,f=window.innerHeight;o.AspectWidth!==void 0&&o.AspectHeight!==void 0&&(c=o.AspectWidth.value,f=o.AspectHeight.value);var p=c/f,d=45;o.FieldOfView!==void 0&&(d=o.FieldOfView.value);var h=o.FocalLength?o.FocalLength.value:null;switch(s){case 0:r=new THREE__namespace.PerspectiveCamera(d,p,u,l),h!==null&&r.setFocalLength(h);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),r=new THREE__namespace.Object3D;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),r=new THREE__namespace.Object3D;break}}return r},n.prototype.createLight=function(t,e){var r,o;if(e.children.forEach(function(h){var g=t.Objects.NodeAttribute[h.ID];g!==void 0&&(o=g)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=void 0;o.LightType===void 0?s=0:s=o.LightType.value;var u=new THREE__namespace.Color(16777215);o.Color!==void 0&&(u=new THREE__namespace.Color().fromArray(o.Color.value));var l=o.Intensity===void 0?1:o.Intensity.value/100;o.CastLightOnObject!==void 0&&o.CastLightOnObject.value===0&&(l=0);var c=0;o.FarAttenuationEnd!==void 0&&(o.EnableFarAttenuation!==void 0&&o.EnableFarAttenuation.value===0?c=0:c=o.FarAttenuationEnd.value);var f=1;switch(s){case 0:r=new THREE__namespace.PointLight(u,l,c,f);break;case 1:r=new THREE__namespace.DirectionalLight(u,l);break;case 2:var p=Math.PI/3;o.InnerAngle!==void 0&&(p=THREE__namespace.MathUtils.degToRad(o.InnerAngle.value));var d=0;o.OuterAngle!==void 0&&(d=THREE__namespace.MathUtils.degToRad(o.OuterAngle.value),d=Math.max(d,1)),r=new THREE__namespace.SpotLight(u,l,c,p,d,f);break;default:console.warn("THREE.FBXLoader: Unknown light type "+o.LightType.value+", defaulting to a PointLight."),r=new THREE__namespace.PointLight(u,l);break}o.CastShadows!==void 0&&o.CastShadows.value===1&&(r.castShadow=!0)}return r},n.prototype.createMesh=function(t,e,r){var o,s=null,u=[];if(t.children.forEach(function(c){e.has(c.ID)&&(s=e.get(c.ID)),r.has(c.ID)&&u.push(r.get(c.ID))}),u.length===0){var l=new PBMMeshMaterial(this.light?"phong":"basic");l.color=new THREE__namespace.Color(13421772),u.push(l)}return"color"in s.attributes&&u.forEach(function(c){c.vertexColors=!0}),(!s.groups||s.groups.length===0)&&s.addGroup(0,s.index?s.index.count:s.attributes.position.count,0),s.FBX_Deformer?(u.forEach(function(c){c.skinning=!0}),o=new PBMSkinnedMesh(s,u),o.normalizeSkinWeights()):o=new PBMMesh(s,u),o},n.prototype.createCurve=function(t,e){var r=t.children.reduce(function(s,u){return e.has(u.ID)&&(s=e.get(u.ID)),s},null),o=new THREE__namespace.LineBasicMaterial({name:"",color:3342591,linewidth:1});return new THREE__namespace.Line(r,o)},n.prototype.getTransformData=function(t,e){var r={};e.InheritType&&(r.inheritType=parseInt(e.InheritType.value)),e.RotationOrder?r.eulerOrder=getEulerOrder(e.RotationOrder.value):r.eulerOrder=getEulerOrder(0),e.Lcl_Translation&&(r.translation=e.Lcl_Translation.value),e.PreRotation&&(r.preRotation=e.PreRotation.value),e.Lcl_Rotation&&(r.rotation=e.Lcl_Rotation.value),e.PostRotation&&(r.postRotation=e.PostRotation.value),e.Lcl_Scaling&&(r.scale=e.Lcl_Scaling.value),e.ScalingOffset&&(r.scalingOffset=e.ScalingOffset.value),e.ScalingPivot&&(r.scalingPivot=e.ScalingPivot.value),e.RotationOffset&&(r.rotationOffset=e.RotationOffset.value),e.RotationPivot&&(r.rotationPivot=e.RotationPivot.value),t.userData.transformData=r},n.prototype.setLookAtProperties=function(t,e,r,o,s){if("LookAtProperty"in r){var u=o.get(e.ID).children;u.forEach(function(l){if(l.relationship==="LookAtProperty"){var c=t.Objects.Model[l.ID];if(c.Lcl_Translation){var f=c.Lcl_Translation.value;"target"in e&&e.target instanceof THREE__namespace.Object3D?(e.target.position.fromArray(f),s.add(e.target)):e.lookAt(new THREE__namespace.Vector3().fromArray(f))}}})}},n.prototype.bindSkeleton=function(t,e,r,o,s){var u=this.parsePoseNodes(t),l=function(f){var p=e[f],d=s.get(parseInt(p.ID)).parents;d.forEach(function(h){if(r.has(h.ID)){var g=h.ID,m=s.get(g);m.parents.forEach(function(E){if(o.has(E.ID)){var y=o.get(E.ID);y instanceof THREE__namespace.SkinnedMesh&&y.bind(new THREE__namespace.Skeleton(p.bones),u[E.ID])}})}})};for(var c in e)l(c)},n.prototype.parsePoseNodes=function(t){var e={};if(t.Objects.Pose){var r=t.Objects.Pose;for(var o in r)if(r[o].attrType==="BindPose"&&r[o].NbPoseNodes>0){var s=r[o].PoseNode;Array.isArray(s)?s.forEach(function(u){e[u.Node]=new THREE__namespace.Matrix4().fromArray(u.Matrix.a)}):e[s.Node]=new THREE__namespace.Matrix4().fromArray(s.Matrix.a)}}return e},n})(),GeometryParser=(function(){function n(){this.negativeMaterialIndices=!1}return n.prototype.parse=function(t,e,r){var o=new Map;if("Geometry"in t.Objects){var s=t.Objects.Geometry;for(var u in s){var l=r.get(parseInt(u)),c=this.parseGeometry(t,l,s[u],e);o.set(parseInt(u),c)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),o},n.prototype.parseGeometry=function(t,e,r,o){switch(r.attrType){case"Mesh":return this.parseMeshGeometry(t,e,r,o);case"NurbsCurve":return this.parseNurbsGeometry(r)}},n.prototype.parseMeshGeometry=function(t,e,r,o){var s=o.skeletons,u=[],l=e.parents.map(function(h){return t.Objects.Model[h.ID]});if(l.length!==0){var c=e.children.reduce(function(h,g){return s[g.ID]!==void 0&&(h=s[g.ID]),h},null);e.children.forEach(function(h){o.morphTargets[h.ID]!==void 0&&u.push(o.morphTargets[h.ID])});var f=l[0],p={};f.RotationOrder&&(p.eulerOrder=getEulerOrder(f.RotationOrder.value)),f.InheritType&&(p.inheritType=parseInt(f.InheritType.value)),f.GeometricTranslation&&(p.translation=f.GeometricTranslation.value),f.GeometricRotation&&(p.rotation=f.GeometricRotation.value),f.GeometricScaling&&(p.scale=f.GeometricScaling.value);var d=generateTransform(p);return this.genGeometry(t,r,c,u,d)}},n.prototype.genGeometry=function(t,e,r,o,s){var u=new THREE__namespace.BufferGeometry;e.attrName&&(u.name=e.attrName);var l=this.parseGeoNode(e,r),c=this.genBuffers(l),f=new THREE__namespace.Float32BufferAttribute(c.vertex,3);if(f.applyMatrix4(s),u.setAttribute("position",f),c.colors.length>0&&u.setAttribute("color",new THREE__namespace.Float32BufferAttribute(c.colors,3)),r&&(u.setAttribute("skinIndex",new THREE__namespace.Uint16BufferAttribute(c.weightsIndices,4)),u.setAttribute("skinWeight",new THREE__namespace.Float32BufferAttribute(c.vertexWeights,4)),u.FBX_Deformer=r),c.normal.length>0){var p=new THREE__namespace.Matrix3().getNormalMatrix(s),d=new THREE__namespace.Float32BufferAttribute(c.normal,3);d.applyNormalMatrix(p),u.setAttribute("normal",d)}if(c.uvs.forEach(function(y,v){var A=v===0?"uv":"uv".concat(v+1);u.setAttribute(A,new THREE__namespace.Float32BufferAttribute(c.uvs[v],2))}),l.material&&l.material.mappingType!=="AllSame"){var h=c.materialIndex[0],g=0;if(c.materialIndex.forEach(function(y,v){y!==h&&(u.addGroup(g,v-g,h),h=y,g=v)}),u.groups.length>0){var m=u.groups[u.groups.length-1],E=m.start+m.count;E!==c.materialIndex.length&&u.addGroup(E,c.materialIndex.length-E,h)}u.groups.length===0&&u.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(t,u,e,o,s),u},n.prototype.parseGeoNode=function(t,e){var r={};if(r.vertexPositions=t.Vertices!==void 0?t.Vertices.a:[],r.vertexIndices=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(r.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(r.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(r.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){r.uv=[];for(var o=0;t.LayerElementUV[o];)t.LayerElementUV[o].UV&&r.uv.push(this.parseUVs(t.LayerElementUV[o])),o++}return r.weightTable={},e!==null&&(r.skeleton=e,e.rawBones.forEach(function(s,u){s.indices.forEach(function(l,c){r.weightTable[l]===void 0&&(r.weightTable[l]=[]),r.weightTable[l].push({id:u,weight:s.weights[c]})})})),r},n.prototype.genBuffers=function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,o=0,s=!1,u=[],l=[],c=[],f=[],p=[],d=[],h=this;return t.vertexIndices.forEach(function(g,m){var E=0,y=!1;g<0&&(g=g^-1,y=!0);var v=[],A=[];if(u.push(g*3,g*3+1,g*3+2),t.color){var b=getData(m,r,g,t.color);c.push(b[0],b[1],b[2])}if(t.skeleton){if(t.weightTable[g]!==void 0&&t.weightTable[g].forEach(function(w){A.push(w.weight),v.push(w.id)}),A.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);var T=[0,0,0,0],_=[0,0,0,0];A.forEach(function(w,R){var I=w,H=v[R];_.forEach(function(C,M,B){if(I>C){B[M]=I,I=C;var L=T[M];T[M]=H,H=L}})}),v=T,A=_}for(;A.length<4;)A.push(0),v.push(0);for(var S=0;S<4;++S)p.push(A[S]),d.push(v[S])}if(t.normal){var b=getData(m,r,g,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(E=getData(m,r,g,t.material)[0],E<0&&(h.negativeMaterialIndices=!0,E=0)),t.uv&&t.uv.forEach(function(w,R){var I=getData(m,r,g,w);f[R]===void 0&&(f[R]=[]),f[R].push(I[0]),f[R].push(I[1])}),o++,y&&(h.genFace(e,t,u,E,l,c,f,p,d,o),r++,o=0,u=[],l=[],c=[],f=[],p=[],d=[])}),e},n.prototype.getNormalNewell=function(t){for(var e=new THREE__namespace.Vector3(0,0,0),r=0;r<t.length;r++){var o=t[r],s=t[(r+1)%t.length];e.x+=(o.y-s.y)*(o.z+s.z),e.y+=(o.z-s.z)*(o.x+s.x),e.z+=(o.x-s.x)*(o.y+s.y)}return e.normalize(),e},n.prototype.getNormalTangentAndBitangent=function(t){var e=this.getNormalNewell(t),r=Math.abs(e.z)>.5?new THREE__namespace.Vector3(0,1,0):new THREE__namespace.Vector3(0,0,1),o=r.cross(e).normalize(),s=e.clone().cross(o).normalize();return{normal:e,tangent:o,bitangent:s}},n.prototype.flattenVertex=function(t,e,r){return new THREE__namespace.Vector2(t.dot(e),t.dot(r))},n.prototype.genFace=function(t,e,r,o,s,u,l,c,f,p){var d;if(p>3){for(var h=[],g=e.baseVertexPositions||e.vertexPositions,m=0;m<r.length;m+=3)h.push(new THREE__namespace.Vector3(g[r[m]],g[r[m+1]],g[r[m+2]]));for(var E=this.getNormalTangentAndBitangent(h),y=E.tangent,v=E.bitangent,A=[],b=0,T=h;b<T.length;b++){var _=T[b];A.push(this.flattenVertex(_,y,v))}d=THREE__namespace.ShapeUtils.triangulateShape(A,[])}else d=[[0,1,2]];for(var S=function(B,L,O){t.vertex.push(e.vertexPositions[r[B*3]]),t.vertex.push(e.vertexPositions[r[B*3+1]]),t.vertex.push(e.vertexPositions[r[B*3+2]]),t.vertex.push(e.vertexPositions[r[L*3]]),t.vertex.push(e.vertexPositions[r[L*3+1]]),t.vertex.push(e.vertexPositions[r[L*3+2]]),t.vertex.push(e.vertexPositions[r[O*3]]),t.vertex.push(e.vertexPositions[r[O*3+1]]),t.vertex.push(e.vertexPositions[r[O*3+2]]),e.skeleton&&(t.vertexWeights.push(c[B*4]),t.vertexWeights.push(c[B*4+1]),t.vertexWeights.push(c[B*4+2]),t.vertexWeights.push(c[B*4+3]),t.vertexWeights.push(c[L*4]),t.vertexWeights.push(c[L*4+1]),t.vertexWeights.push(c[L*4+2]),t.vertexWeights.push(c[L*4+3]),t.vertexWeights.push(c[O*4]),t.vertexWeights.push(c[O*4+1]),t.vertexWeights.push(c[O*4+2]),t.vertexWeights.push(c[O*4+3]),t.weightsIndices.push(f[B*4]),t.weightsIndices.push(f[B*4+1]),t.weightsIndices.push(f[B*4+2]),t.weightsIndices.push(f[B*4+3]),t.weightsIndices.push(f[L*4]),t.weightsIndices.push(f[L*4+1]),t.weightsIndices.push(f[L*4+2]),t.weightsIndices.push(f[L*4+3]),t.weightsIndices.push(f[O*4]),t.weightsIndices.push(f[O*4+1]),t.weightsIndices.push(f[O*4+2]),t.weightsIndices.push(f[O*4+3])),e.color&&(t.colors.push(u[B*3]),t.colors.push(u[B*3+1]),t.colors.push(u[B*3+2]),t.colors.push(u[L*3]),t.colors.push(u[L*3+1]),t.colors.push(u[L*3+2]),t.colors.push(u[O*3]),t.colors.push(u[O*3+1]),t.colors.push(u[O*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(o),t.materialIndex.push(o),t.materialIndex.push(o)),e.normal&&(t.normal.push(s[B*3]),t.normal.push(s[B*3+1]),t.normal.push(s[B*3+2]),t.normal.push(s[L*3]),t.normal.push(s[L*3+1]),t.normal.push(s[L*3+2]),t.normal.push(s[O*3]),t.normal.push(s[O*3+1]),t.normal.push(s[O*3+2])),e.uv&&e.uv.forEach(function(k,D){t.uvs[D]===void 0&&(t.uvs[D]=[]),t.uvs[D].push(l[D][B*2]),t.uvs[D].push(l[D][B*2+1]),t.uvs[D].push(l[D][L*2]),t.uvs[D].push(l[D][L*2+1]),t.uvs[D].push(l[D][O*2]),t.uvs[D].push(l[D][O*2+1])})},w=0,R=d;w<R.length;w++){var I=R[w],H=I[0],C=I[1],M=I[2];S(H,C,M)}},n.prototype.addMorphTargets=function(t,e,r,o,s){if(o.length!==0){e.morphTargetsRelative=!0,e.morphAttributes.position=[];var u=this;o.forEach(function(l){l.rawTargets.forEach(function(c){var f=t.Objects.Geometry[c.geoID];f!==void 0&&u.genMorphGeometry(e,r,f,s,c.name)})})}},n.prototype.genMorphGeometry=function(t,e,r,o,s){for(var u=e.Vertices!==void 0?e.Vertices.a:[],l=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],c=r.Vertices!==void 0?r.Vertices.a:[],f=r.Indexes?r.Indexes.a:[],p=t.attributes.position.count*3,d=new Float32Array(p),h=0;h<f.length;h++){var g=f[h]*3;d[g]=c[h*3],d[g+1]=c[h*3+1],d[g+2]=c[h*3+2]}var m={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},E=this.genBuffers(m),y=new THREE__namespace.Float32BufferAttribute(E.vertex,3);y.name=s||r.attrName,y.applyMatrix4(o),t.morphAttributes.position.push(y)},n.prototype.parseNormals=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Normals.a,s=[];return r==="IndexToDirect"&&(t.NormalIndex?s=t.NormalIndex.a:t.NormalsIndex&&(s=t.NormalsIndex.a)),{dataSize:3,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseUVs=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.UV.a,s=[];return r==="IndexToDirect"&&(s=t.UVIndex.a),{dataSize:2,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseVertexColors=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Colors.a,s=[];r==="IndexToDirect"&&(s=t.ColorIndex.a);for(var u=0,l=new THREE__namespace.Color;u<o.length;u+=4)l.fromArray(o,u),l.toArray(o,u);return{dataSize:4,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseMaterialIndices=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var o=t.Materials.a,s=[],u=0;u<o.length;++u)s.push(u);return{dataSize:1,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseNurbsGeometry=function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new THREE__namespace.BufferGeometry;for(var r=e-1,o=t.KnotVector.a,s=[],u=t.Points.a,l=0,c=u.length;l<c;l+=4)s.push(new THREE__namespace.Vector4().fromArray(u,l));var f,p;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){f=r,p=o.length-1-f;for(var l=0;l<r;++l)s.push(s[l])}var d=new NURBSCurve(r,o,s,f,p),h=d.getPoints(s.length*12);return new THREE__namespace.BufferGeometry().setFromPoints(h)},n})(),AnimationParser=(function(){function n(){}return n.prototype.parse=function(t,e,r){var o=[],s=this.parseClips(t,e,r);if(s!==void 0)for(var u in s){var l=s[u],c=this.addClip(l,r);o.push(c)}return o},n.prototype.parseClips=function(t,e,r){if(t.Objects.AnimationCurve!==void 0){var o=this.parseAnimationCurveNodes(t);this.parseAnimationCurves(t,o,e);var s=this.parseAnimationLayers(t,o,e,r),u=this.parseAnimStacks(t,s,e);return u}},n.prototype.parseAnimationCurveNodes=function(t){var e=t.Objects.AnimationCurveNode,r=new Map;for(var o in e){var s=e[o];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){var u={id:s.id,attr:s.attrName,curves:{}};r.set(u.id,u)}}return r},n.prototype.parseAnimationCurves=function(t,e,r){var o=t.Objects.AnimationCurve;for(var s in o){var u={id:o[s].id,times:o[s].KeyTime.a.map(convertFBXTimeToSeconds),values:o[s].KeyValueFloat.a},l=r.get(u.id);if(l!==void 0){var c=l.parents[0].ID,f=l.parents[0].relationship,p=e.get(c);p&&(f.match(/X/)?p.curves.x=u:f.match(/Y/)?p.curves.y=u:f.match(/Z/)?p.curves.z=u:f.match(/DeformPercent/)&&e.has(c)&&(p.curves.morph=u))}}},n.prototype.parseAnimationLayers=function(t,e,r,o){var s=t.Objects.AnimationLayer,u=new Map,l=function(f){var p=[],d=r.get(parseInt(f));if(d!==void 0){var h=d.children;h.forEach(function(g,m){if(e.has(g.ID)){var E=e.get(g.ID);if(E.curves.x!==void 0||E.curves.y!==void 0||E.curves.z!==void 0){if(p[m]===void 0){var y=r.get(g.ID).parents.filter(function(R){return R.relationship!==void 0})[0].ID;if(y!==void 0){var v=t.Objects.Model[y.toString()];if(v===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",g);return}var A={modelName:v.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(v.attrName):"",ID:v.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new THREE__namespace.Matrix4,eulerOrder:"",preRotation:[0,0,0],postRotation:[0,0,0]};o.traverse(function(R){R.ID===v.id&&(A.transform=R.matrix,R.userData.transformData&&(A.eulerOrder=R.userData.transformData.eulerOrder))}),A.transform||(A.transform=new THREE__namespace.Matrix4),v.PreRotation&&(A.preRotation=v.PreRotation.value),v.PostRotation&&(A.postRotation=v.PostRotation.value),p[m]=A}}p[m]&&(p[m][E.attr]=E)}else if(E.curves.morph!==void 0){if(p[m]===void 0){var b=r.get(g.ID).parents.filter(function(I){return I.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,y=r.get(_).parents[0].ID,S=t.Objects.Model[y],w={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};p[m]=w}p[m][E.attr]=E}}}),u.set(parseInt(f),p)}};for(var c in s)l(c);return u},n.prototype.parseAnimStacks=function(t,e,r){var o=t.Objects.AnimationStack,s={};for(var u in o){var l=r.get(parseInt(u)).children;l.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var c=e.get(l[0].ID);s[u]={name:o[u].attrName,layer:c}}return s},n.prototype.addClip=function(t,e){var r=[],o=this;return t.layer.forEach(function(s){r=r.concat(o.generateTracks(s,e))}),new THREE__namespace.AnimationClip(t.name,-1,r)},n.prototype.generateTracks=function(t,e){var r=[],o=new THREE__namespace.Vector3,s=new THREE__namespace.Vector3;t.transform&&t.transform.decompose(o,new THREE__namespace.Quaternion,s);var u=o.toArray(),l=s.toArray();if(t.T!==void 0&&Object.keys(t.T.curves).length>0){var c=this.generateVectorTrack(t.modelName,t.T.curves,u,"position");c!==void 0&&r.push(c)}if(t.R!==void 0&&Object.keys(t.R.curves).length>0){var f=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);f!==void 0&&r.push(f)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){var p=this.generateVectorTrack(t.modelName,t.S.curves,l,"scale");p!==void 0&&r.push(p)}if(t.DeformPercent!==void 0){var d=this.generateMorphTrack(t,e);d!==void 0&&r.push(d)}return r},n.prototype.generateVectorTrack=function(t,e,r,o){var s=this.getTimesForAllAxes(e),u=this.getKeyframeTrackValues(s,e,r);return new THREE__namespace.VectorKeyframeTrack(t+"."+o,s,u)},n.prototype.generateRotationTrack=function(t,e,r,o,s){var u,l;if(e.x!==void 0&&e.y!==void 0&&e.z!==void 0){var c=this.interpolateRotations(e.x,e.y,e.z,s);u=c[0],l=c[1]}var f=getEulerOrder(0),p=new THREE__namespace.Quaternion,d=new THREE__namespace.Quaternion;r!==void 0&&(r=r.map(THREE__namespace.MathUtils.degToRad),r.push(f),p.setFromEuler(new THREE__namespace.Euler().fromArray(r))),o!==void 0&&(o=o.map(THREE__namespace.MathUtils.degToRad),o.push(f),d.setFromEuler(new THREE__namespace.Euler().fromArray(o)),d.inverse());var h=new THREE__namespace.Quaternion,g=new THREE__namespace.Euler,m=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var E=0;E<l.length;E+=3){if(g.set(l[E],l[E+1],l[E+2],s),h.setFromEuler(g),h.premultiply(p),h.multiply(d),E>2){var y=new THREE__namespace.Quaternion().fromArray(m,(E-3)/3*4);y.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(m,E/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,m)},n.prototype.generateMorphTrack=function(t,e){var r=t.DeformPercent.curves.morph,o=r.values.map(function(u){return u/100}),s=e.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new THREE__namespace.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+s+"]",r.times,o)},n.prototype.getTimesForAllAxes=function(t){var e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(l,c){return l-c}),e.length>1){for(var r=1,o=e[0],s=1;s<e.length;s++){var u=e[s];u!==o&&(e[r]=u,o=u,r++)}e=e.slice(0,r)}return e},n.prototype.getKeyframeTrackValues=function(t,e,r){var o=r,s=[],u=-1,l=-1,c=-1;return t.forEach(function(f){if(e.x&&(u=e.x.times.indexOf(f)),e.y&&(l=e.y.times.indexOf(f)),e.z&&(c=e.z.times.indexOf(f)),u!==-1){var p=e.x.values[u];s.push(p),o[0]=p}else s.push(o[0]);if(l!==-1){var d=e.y.values[l];s.push(d),o[1]=d}else s.push(o[1]);if(c!==-1){var h=e.z.values[c];s.push(h),o[2]=h}else s.push(o[2])}),s},n.prototype.interpolateRotations=function(t,e,r,o){var s=[],u=[];s.push(t.times[0]),u.push(THREE__namespace.MathUtils.degToRad(t.values[0])),u.push(THREE__namespace.MathUtils.degToRad(e.values[0])),u.push(THREE__namespace.MathUtils.degToRad(r.values[0]));for(var l=1;l<t.values.length;l++){var c=[t.values[l-1],e.values[l-1],r.values[l-1]];if(!(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))){var f=c.map(THREE__namespace.MathUtils.degToRad),p=[t.values[l],e.values[l],r.values[l]];if(!(isNaN(p[0])||isNaN(p[1])||isNaN(p[2]))){p.map(THREE__namespace.MathUtils.degToRad);var d=[p[0]-c[0],p[1]-c[1],p[2]-c[2]],h=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(h[0]>=180||h[1]>=180||h[2]>=180){var g=Math.max.apply(Math,h),m=g/180,E=new THREE__namespace.Euler(f[0],f[1],f[2],o),y=new THREE__namespace.Euler(f[0],f[1],f[2],o),v=new THREE__namespace.Quaternion().setFromEuler(E),A=new THREE__namespace.Quaternion().setFromEuler(y);v.dot(A)&&A.set(-A.x,-A.y,-A.z,-A.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,w=0;w<1;w+=1/m)_.copy(v.clone().slerp(A.clone(),w)),s.push(b+w*T),S.setFromQuaternion(_,o),u.push(S.x),u.push(S.y),u.push(S.z)}else s.push(t.times[l]),u.push(THREE__namespace.MathUtils.degToRad(t.values[l])),u.push(THREE__namespace.MathUtils.degToRad(e.values[l])),u.push(THREE__namespace.MathUtils.degToRad(r.values[l]))}}}return[s,u]},n})(),TextParser=(function(){function n(){this.allNodes=new FBXTree,this.nodeStack=[],this.currentIndent=0,this.currentPropName=""}return n.prototype.getPrevNode=function(){return this.nodeStack[this.currentIndent-2]},n.prototype.getCurrentNode=function(){return this.nodeStack[this.currentIndent-1]},n.prototype.getCurrentProp=function(){return this.currentProp},n.prototype.pushStack=function(t){this.nodeStack.push(t),this.currentIndent+=1},n.prototype.popStack=function(){this.nodeStack.pop(),this.currentIndent-=1},n.prototype.setCurrentProp=function(t,e){this.currentProp=t,this.currentPropName=e},n.prototype.parse=function(t){this.currentIndent=0,this.allNodes=new FBXTree,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach(function(o,s){var u=o.match(/^[\s\t]*;/),l=o.match(/^[\s\t]*$/);if(!(u||l)){var c=o.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){"),f=o.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),p=o.match("^\\t{"+(e.currentIndent-1)+"}}");c?e.parseNodeBegin(o,c):f?e.parseNodeProperty(o,f,r[++s]):p?e.popStack():o.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(o)}}),this.allNodes},n.prototype.parseNodeBegin=function(t,e){var r=e[1].trim().replace(/^"/,"").replace(/"$/,""),o=e[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},u=this.parseNodeAttr(o),l=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in l?(r==="PoseNode"?l.PoseNode.push(s):l[r].id!==void 0&&(l[r]={},l[r][l[r].id]=l[r]),u.id!==""&&(l[r][u.id]=s)):typeof u.id=="number"?(l[r]={},l[r][u.id]=s):r!=="Properties70"&&(r==="PoseNode"?l[r]=[s]:l[r]=s),typeof u.id=="number"&&(s.id=u.id),u.name!==""&&(s.attrName=u.name),u.type!==""&&(s.attrType=u.type),this.pushStack(s)},n.prototype.parseNodeAttr=function(t){var e=t[0];t[0]!==""&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",o="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),o=t[2]),{id:e,name:r,type:o}},n.prototype.parseNodeProperty=function(t,e,r){var o=e[1].replace(/^"/,"").replace(/"$/,"").trim(),s=e[2].replace(/^"/,"").replace(/"$/,"").trim();o==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());var u=this.getCurrentNode(),l=u.name;if(l==="Properties70"){this.parseNodeSpecialProperty(t,o,s);return}if(o==="C"){var c=s.split(",").slice(1),f=parseInt(c[0]),p=parseInt(c[1]),d=s.split(",").slice(3);d=d.map(function(h){return h.trim().replace(/^"/,"")}),o="connections",s=[f,p],append(s,d),u[o]===void 0&&(u[o]=[])}o==="Node"&&(u.id=s),o in u&&Array.isArray(u[o])?u[o].push(s):o!=="a"?u[o]=s:u.a=s,this.setCurrentProp(u,o),o==="a"&&s.slice(-1)!==","&&(u.a=parseNumberArray(s))},n.prototype.parseNodePropertyContinued=function(t){var e=this.getCurrentNode();e.a+=t,t.slice(-1)!==","&&(e.a=parseNumberArray(e.a))},n.prototype.parseNodeSpecialProperty=function(t,e,r){var o=r.split('",').map(function(p){return p.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=o[0],u=o[1],l=o[2],c=o[3],f=o[4];switch(u){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":f=parseFloat(f);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":f=parseNumberArray(f);break}this.getPrevNode()[s]={type:u,type2:l,flag:c,value:f},this.setCurrentProp(this.getPrevNode(),s)},n})(),BinaryParser=(function(){function n(){}return n.prototype.parse=function(t){var e=new BinaryReader(t);e.skip(23);var r=e.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var o=new FBXTree;!this.endOfContent(e);){var s=this.parseNode(e,r);s!==null&&o.add(s.name,s)}return o},n.prototype.endOfContent=function(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()},n.prototype.parseNode=function(t,e){var r={},o=e>=7500?t.getUint64():t.getUint32(),s=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();var u=t.getUint8(),l=t.getString(u);if(o===0)return null;for(var c=[],f=0;f<s;f++)c.push(this.parseProperty(t));var p=c.length>0?c[0]:"",d=c.length>1?c[1]:"",h=c.length>2?c[2]:"";for(r.singleProperty=s===1&&t.getOffset()===o;o>t.getOffset();){var g=this.parseNode(t,e);g!==null&&this.parseSubNode(l,r,g)}return r.propertyList=c,typeof p=="number"&&(r.id=p),d!==""&&(r.attrName=d),h!==""&&(r.attrType=h),l!==""&&(r.name=l),r},n.prototype.parseSubNode=function(t,e,r){if(r.singleProperty===!0){var o=r.propertyList[0];Array.isArray(o)?(e[r.name]=r,r.a=o):e[r.name]=o}else if(t==="Connections"&&r.name==="C"){var s=[];r.propertyList.forEach(function(h,g){g!==0&&s.push(h)}),e.connections===void 0&&(e.connections=[]),e.connections.push(s)}else if(r.name==="Properties70"){var u=Object.keys(r);u.forEach(function(h){e[h]=r[h]})}else if(t==="Properties70"&&r.name==="P"){var l=r.propertyList[0],c=r.propertyList[1],f=r.propertyList[2],p=r.propertyList[3],d=void 0;l.indexOf("Lcl ")===0&&(l=l.replace("Lcl ","Lcl_")),c.indexOf("Lcl ")===0&&(c=c.replace("Lcl ","Lcl_")),c==="Color"||c==="ColorRGB"||c==="Vector"||c==="Vector3D"||c.indexOf("Lcl_")===0?d=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:d=r.propertyList[4],e[l]={type:c,type2:f,flag:p,value:d}}else e[r.name]===void 0?typeof r.id=="number"?(e[r.name]={},e[r.name][r.id]=r):e[r.name]=r:r.name==="PoseNode"?(Array.isArray(e[r.name])||(e[r.name]=[e[r.name]]),e[r.name].push(r)):e[r.name][r.id]===void 0&&(e[r.name][r.id]=r)},n.prototype.parseProperty=function(t){var e=t.getString(1),r;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return r=t.getUint32(),t.getArrayBuffer(r);case"S":return r=t.getUint32(),t.getString(r);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var o=t.getUint32(),s=t.getUint32(),u=t.getUint32();if(s===0)switch(e){case"b":case"c":return t.getBooleanArray(o);case"d":return t.getFloat64Array(o);case"f":return t.getFloat32Array(o);case"i":return t.getInt32Array(o);case"l":return t.getInt64Array(o)}var l=unzlibSync(new Uint8Array(t.getArrayBuffer(u))),c=new BinaryReader(l.buffer);switch(e){case"b":case"c":return c.getBooleanArray(o);case"d":return c.getFloat64Array(o);case"f":return c.getFloat32Array(o);case"i":return c.getInt32Array(o);case"l":return c.getInt64Array(o)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}},n})(),BinaryReader=(function(){function n(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0,this._textDecoder=new TextDecoder}return n.prototype.getOffset=function(){return this.offset},n.prototype.size=function(){return this.dv.buffer.byteLength},n.prototype.skip=function(t){this.offset+=t},n.prototype.getBoolean=function(){return(this.getUint8()&1)===1},n.prototype.getBooleanArray=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e},n.prototype.getUint8=function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t},n.prototype.getInt16=function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},n.prototype.getInt32=function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e},n.prototype.getUint32=function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e&2147483648?(e=~e&4294967295,t=~t&4294967295,t===4294967295&&(e=e+1&4294967295),t=t+1&4294967295,-(e*4294967296+t)):e*4294967296+t},n.prototype.getInt64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e},n.prototype.getUint64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e*4294967296+t},n.prototype.getFloat32=function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getFloat32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e},n.prototype.getFloat64=function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},n.prototype.getFloat64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e},n.prototype.getArrayBuffer=function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},n.prototype.getString=function(t){var e=this.offset,r=new Uint8Array(this.dv.buffer,e,t);this.skip(t);var o=r.indexOf(0);return o>=0&&(r=new Uint8Array(this.dv.buffer,e,o)),this._textDecoder.decode(r)},n})(),FBXTree=(function(){function n(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}return n.prototype.add=function(t,e){this[t]=e},n})();function isFbxFormatBinary(n){var t="Kaydara FBX Binary \0";return n.byteLength>=t.length&&t===convertArrayBufferToString(n,0,t.length)}function isFbxFormatASCII(n){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],e=0;function r(u){var l=n[u-1];return n=n.slice(e+u),e++,l}for(var o=0;o<t.length;++o){var s=r(1);if(s===t[o])return!1}return!0}function getFbxVersion(n){var t=/FBXVersion: (\d+)/,e=n.match(t);if(e){var r=parseInt(e[1]);return r}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function convertFBXTimeToSeconds(n){return n/46186158e3}var dataArray=[];function getData(n,t,e,r){var o;switch(r.mappingType){case"ByPolygonVertex":o=n;break;case"ByPolygon":o=t;break;case"ByVertice":o=e;break;case"AllSame":o=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType),o=0}r.referenceType==="IndexToDirect"&&(o=r.indices[o]);var s=o*r.dataSize,u=s+r.dataSize;return slice(dataArray,r.buffer,s,u)}var tempEuler=new THREE__namespace.Euler,tempVec=new THREE__namespace.Vector3;function generateTransform(n){var t=new THREE__namespace.Matrix4,e=new THREE__namespace.Matrix4,r=new THREE__namespace.Matrix4,o=new THREE__namespace.Matrix4,s=new THREE__namespace.Matrix4,u=new THREE__namespace.Matrix4,l=new THREE__namespace.Matrix4,c=new THREE__namespace.Matrix4,f=new THREE__namespace.Matrix4,p=new THREE__namespace.Matrix4,d=new THREE__namespace.Matrix4,h=new THREE__namespace.Matrix4,g=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var m=getEulerOrder(0);if(n.preRotation){var E=n.preRotation.map(THREE__namespace.MathUtils.degToRad);E.push(m),e.makeRotationFromEuler(tempEuler.fromArray(E))}if(n.rotation){var E=n.rotation.map(THREE__namespace.MathUtils.degToRad);E.push(n.eulerOrder||m),r.makeRotationFromEuler(tempEuler.fromArray(E))}if(n.postRotation){var E=n.postRotation.map(THREE__namespace.MathUtils.degToRad);E.push(m),o.makeRotationFromEuler(tempEuler.fromArray(E)),o.copy(new THREE__namespace.Matrix4().getInverse(o))}n.scale&&s.scale(tempVec.fromArray(n.scale)),n.scalingOffset&&l.setPosition(tempVec.fromArray(n.scalingOffset)),n.scalingPivot&&u.setPosition(tempVec.fromArray(n.scalingPivot)),n.rotationOffset&&c.setPosition(tempVec.fromArray(n.rotationOffset)),n.rotationPivot&&f.setPosition(tempVec.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(d.copy(n.parentMatrix),p.copy(n.parentMatrixWorld));var y=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(p);var A=new THREE__namespace.Matrix4;A.copyPosition(p);var b=new THREE__namespace.Matrix4().getInverse(A).multiply(p),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(g===0)S.copy(v).multiply(y).multiply(T).multiply(_);else if(g===1)S.copy(v).multiply(T).multiply(y).multiply(_);else{var w=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),R=new THREE__namespace.Matrix4().getInverse(w),I=T.clone().multiply(R);S.copy(v).multiply(y).multiply(I).multiply(_)}var H=new THREE__namespace.Matrix4().getInverse(f),C=new THREE__namespace.Matrix4().getInverse(u),M=t.clone().multiply(c).multiply(f).multiply(e).multiply(r).multiply(o).multiply(H).multiply(l).multiply(u).multiply(s).multiply(C),B=new THREE__namespace.Matrix4().copyPosition(M),L=p.clone().multiply(B);return h.copyPosition(L),M=h.clone().multiply(S),M.premultiply(new THREE__namespace.Matrix4().getInverse(p)),M}function getEulerOrder(n){n=n||0;var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return n===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[n]}function parseNumberArray(n){var t=n.split(",").map(function(e){return parseFloat(e)});return t}function convertArrayBufferToString(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=n.byteLength),new TextDecoder().decode(new Uint8Array(n,t,e))}function append(n,t){for(var e=0,r=n.length,o=t.length;e<o;e++,r++)n[r]=t[e]}function slice(n,t,e,r){for(var o=e,s=0;o<r;o++,s++)n[s]=t[o];return n}var NURBSCurve=(function(n){__extends(t,n);function t(e,r,o,s,u){var l=n.call(this)||this,c=r?r.length-1:0,f=o?o.length:0;l.degree=e,l.knots=r,l.controlPoints=[],l.startKnot=s||0,l.endKnot=u||c;for(var p=0;p<f;++p){var d=o[p];l.controlPoints[p]=new THREE__namespace.Vector4(d.x,d.y,d.z,d.w)}return l}return t.prototype.getPoint=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),u=calcBSplinePoint(this.degree,this.knots,this.controlPoints,s);return u.w!==1&&u.divideScalar(u.w),o.set(u.x,u.y,u.z)},t.prototype.getTangent=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),u=calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,s,1);return o.copy(u[1]).normalize(),o},t.prototype.toJSON=function(){var e=n.prototype.toJSON.call(this);return e.degree=this.degree,e.knots=__spreadArray([],this.knots,!0),e.controlPoints=this.controlPoints.map(function(r){return r.toArray()}),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e},t.prototype.fromJSON=function(e){return n.prototype.fromJSON.call(this,e),this.degree=e.degree,this.knots=__spreadArray([],e.knots,!0),this.controlPoints=e.controlPoints.map(function(r){return new THREE__namespace.Vector4(r[0],r[1],r[2],r[3])}),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this},t})(THREE__namespace.Curve);function findSpan(n,t,e){var r=e.length-n-1;if(t>=e[r])return r-1;if(t<=e[n])return n;for(var o=n,s=r,u=Math.floor((o+s)/2);t<e[u]||t>=e[u+1];)t<e[u]?s=u:o=u,u=Math.floor((o+s)/2);return u}function calcBasisFunctions(n,t,e,r){var o=[],s=[],u=[];o[0]=1;for(var l=1;l<=e;++l){s[l]=t-r[n+1-l],u[l]=r[n+l]-t;for(var c=0,f=0;f<l;++f){var p=u[f+1],d=s[l-f],h=o[f]/(p+d);o[f]=c+p*h,c=d*h}o[l]=c}return o}function calcBSplinePoint(n,t,e,r){for(var o=findSpan(n,r,t),s=calcBasisFunctions(o,r,n,t),u=new THREE__namespace.Vector4(0,0,0,0),l=0;l<=n;++l){var c=e[o-n+l],f=s[l],p=c.w*f;u.x+=c.x*p,u.y+=c.y*p,u.z+=c.z*p,u.w+=c.w*f}return u}function calcBasisFunctionDerivatives(n,t,e,r,o){for(var s=[],u=0;u<=e;++u)s[u]=0;for(var l=[],u=0;u<=r;++u)l[u]=s.slice(0);for(var c=[],u=0;u<=e;++u)c[u]=s.slice(0);c[0][0]=1;for(var f=s.slice(0),p=s.slice(0),d=1;d<=e;++d){f[d]=t-o[n+1-d],p[d]=o[n+d]-t;for(var h=0,g=0;g<d;++g){var m=p[g+1],E=f[d-g];c[d][g]=m+E;var y=c[g][d-1]/c[d][g];c[g][d]=h+m*y,h=E*y}c[d][d]=h}for(var d=0;d<=e;++d)l[0][d]=c[d][e];for(var v=0;v<=e;++v){for(var A=0,b=1,T=[],u=0;u<=e;++u)T[u]=s.slice(0);T[0][0]=1;for(var _=1;_<=r;++_){var S=0,w=v-_,R=e-_;v>=_&&(T[b][0]=T[A][0]/c[R+1][w],S=T[b][0]*c[w][R]);for(var I=w>=-1?1:-w,H=v-1<=R?_-1:e-v,C=I;C<=H;++C)T[b][C]=(T[A][C]-T[A][C-1])/c[R+1][w+C],S+=T[b][C]*c[w+C][R];v<=R&&(T[b][_]=-T[A][_-1]/c[R+1][v],S+=T[b][_]*c[v][R]),l[_][v]=S;var d=A;A=b,b=d}}for(var M=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=M;M*=e-_}return l}function calcBSplineDerivatives(n,t,e,r,o){for(var s=o<n?o:n,u=[],l=findSpan(n,r,t),c=calcBasisFunctionDerivatives(l,r,n,s,t),f=[],p=0;p<e.length;++p){var d=e[p].clone(),h=d.w;d.x*=h,d.y*=h,d.z*=h,f[p]=d}for(var g=0;g<=s;++g){for(var d=f[l-n].clone().multiplyScalar(c[g][0]),m=1;m<=n;++m)d.add(f[l-n+m].clone().multiplyScalar(c[g][m]));u[g]=d}for(var g=s+1;g<=o+1;++g)u[g]=new THREE__namespace.Vector4(0,0,0);return u}function calcKoverI(n,t){for(var e=1,r=2;r<=n;++r)e*=r;for(var o=1,r=2;r<=t;++r)o*=r;for(var r=2;r<=n-t;++r)o*=r;return e/o}function calcRationalCurveDerivatives(n){for(var t=n.length,e=[],r=[],o=0;o<t;++o){var s=n[o];e[o]=new THREE__namespace.Vector3(s.x,s.y,s.z),r[o]=s.w}for(var u=[],l=0;l<t;++l){for(var c=e[l].clone(),o=1;o<=l;++o)c.sub(u[l-o].clone().multiplyScalar(calcKoverI(l,o)*r[o]));u[l]=c.divideScalar(r[0])}return u}function calcNURBSDerivatives(n,t,e,r,o){var s=calcBSplineDerivatives(n,t,e,r,o);return calcRationalCurveDerivatives(s)}var _vector=new THREE__namespace.Vector3;function getPointArray(n,t){switch(t){case"D":return new Float64Array(n);case"F":return new Float32Array(n);case"L":return new Int32Array(n);case"I":return new Int16Array(n);default:return new Uint8Array(n)}}function loadX3p(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:internalFetcher,u={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){var c,f;return u.byteLength=l.body.byteLength,parse$1(new Uint8Array(l.body),{light:(c=t.light)!==null&&c!==void 0?c:!0,color:t.color,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(f=n.split("?")[1])!==null&&f!==void 0?f:""})}).then(function(l){var c=new THREE__namespace.Group;return c.name=n,c.add(l.object),o==="Y"&&c.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"x3p",modelUpAxis:"Z",upAxis:o,uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:[],animations:[],dispose:function(){return l.dispose()}}})}function parse$1(n,t){for(var e,r,o,s,u,l,c,f,p,d,h,g,m,E,y,v,A,b,T,_,S,w,R,I,H,C,M,B,L,O,k,D,q,z,J,V,U,j,K,ae,re,ee,Z,X,se,G,W,$,ne,te,ve,oe,fe,be,ie=unzipSync(n),ue="",me=null,ge=0,Ae=Object.keys(ie);ge<Ae.length;ge++){var xe=Ae[ge];/(^|\/)main\.xml$/i.test(xe)&&(me=ie[xe],ue=xe.slice(0,xe.lastIndexOf("/")+1))}if(!me)throw new Error("X3p: main.xml not found.");if(typeof DOMParser=="undefined")throw new Error("X3p: DOMParser not found.");var de=(e=t.color)!==null&&e!==void 0?e:new THREE__namespace.Color(10066329),_e=new DOMParser,He=decodeText(me),Ee=_e.parseFromString(He,"text/xml"),pe=Ee.querySelector("Record1 Axes"),Ve={x:{type:(s=(o=(r=pe==null?void 0:pe.querySelector("CX AxisType"))===null||r===void 0?void 0:r.textContent)===null||o===void 0?void 0:o.toUpperCase())!==null&&s!==void 0?s:"I",dataType:(c=(l=(u=pe==null?void 0:pe.querySelector("CX DataType"))===null||u===void 0?void 0:u.textContent)===null||l===void 0?void 0:l.toUpperCase())!==null&&c!==void 0?c:"D",increment:Number((p=(f=pe==null?void 0:pe.querySelector("CX Increment"))===null||f===void 0?void 0:f.textContent)!==null&&p!==void 0?p:"1"),offset:Number((h=(d=pe==null?void 0:pe.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(E=(m=(g=pe==null?void 0:pe.querySelector("CY AxisType"))===null||g===void 0?void 0:g.textContent)===null||m===void 0?void 0:m.toUpperCase())!==null&&E!==void 0?E:"I",dataType:(A=(v=(y=pe==null?void 0:pe.querySelector("CY DataType"))===null||y===void 0?void 0:y.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&A!==void 0?A:"D",increment:Number((T=(b=pe==null?void 0:pe.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=pe==null?void 0:pe.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(I=(R=(w=pe==null?void 0:pe.querySelector("CZ AxisType"))===null||w===void 0?void 0:w.textContent)===null||R===void 0?void 0:R.toUpperCase())!==null&&I!==void 0?I:"A",dataType:(M=(C=(H=pe==null?void 0:pe.querySelector("CZ DataType"))===null||H===void 0?void 0:H.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&M!==void 0?M:"D",increment:Number((L=(B=pe==null?void 0:pe.querySelector("CZ Increment"))===null||B===void 0?void 0:B.textContent)!==null&&L!==void 0?L:"1"),offset:Number((k=(O=pe==null?void 0:pe.querySelector("CZ Offset"))===null||O===void 0?void 0:O.textContent)!==null&&k!==void 0?k:"0")}},ye=null,Pe=Ee.querySelector("Record1 Axes Rotation");Pe&&(ye=new THREE__namespace.Matrix3,ye.set(Number((q=(D=Pe.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&q!==void 0?q:0),Number((J=(z=Pe.querySelector("r12"))===null||z===void 0?void 0:z.textContent)!==null&&J!==void 0?J:0),Number((U=(V=Pe.querySelector("r13"))===null||V===void 0?void 0:V.textContent)!==null&&U!==void 0?U:0),Number((K=(j=Pe.querySelector("r21"))===null||j===void 0?void 0:j.textContent)!==null&&K!==void 0?K:0),Number((re=(ae=Pe.querySelector("r22"))===null||ae===void 0?void 0:ae.textContent)!==null&&re!==void 0?re:0),Number((Z=(ee=Pe.querySelector("r23"))===null||ee===void 0?void 0:ee.textContent)!==null&&Z!==void 0?Z:0),Number((se=(X=Pe.querySelector("r31"))===null||X===void 0?void 0:X.textContent)!==null&&se!==void 0?se:0),Number((W=(G=Pe.querySelector("r32"))===null||G===void 0?void 0:G.textContent)!==null&&W!==void 0?W:0),Number((ne=($=Pe.querySelector("r33"))===null||$===void 0?void 0:$.textContent)!==null&&ne!==void 0?ne:0)));var Ce=(te=Ee.querySelector("Record3 DataLink PointDataLink"))===null||te===void 0?void 0:te.textContent;if(typeof Ce!="string")throw new Error("X3p: PointDataLink not found.");Ce=pathJoin(ue,Ce);var $e=ie[Ce];if(!$e)throw new Error("X3p: ".concat($e," not found."));for(var Se=getPointArray($e.buffer,Ve.z.dataType),ze=Number((oe=(ve=Ee.querySelector("Record3 MatrixDimension SizeX"))===null||ve===void 0?void 0:ve.textContent)!==null&&oe!==void 0?oe:"0"),Fe=Number((be=(fe=Ee.querySelector("Record3 MatrixDimension SizeY"))===null||fe===void 0?void 0:fe.textContent)!==null&&be!==void 0?be:"0"),Oe=Math.floor(ze-1),Le=Math.floor(Fe-1),Ue=Oe+1,tt=Le+1,lt=new Float32Array(Ue*tt*3),nt=new Float32Array(Ue*tt*2),ot=new Uint32Array(Oe*Le*6),At=new THREE__namespace.Box3,We=0;We<tt;We++)for(var Mt=We*Ve.y.increment+Ve.y.offset,Be=0;Be<Ue;Be++){var Ne=We*Ue+Be,bt=Be*Ve.x.increment+Ve.x.offset,Ct=Se[Ne],xt=!isNaN(Ct),yt=xt?Ct:NaN;_vector.set(bt,-Mt,yt),ye&&_vector.applyMatrix3(ye),xt&&At.expandByPoint(_vector),lt[Ne*3+0]=_vector.x,lt[Ne*3+1]=_vector.y,lt[Ne*3+2]=_vector.z,nt[Ne*2+0]=Be/Oe,nt[Ne*2+1]=1-We/Le}for(var We=0;We<Le;We++)for(var Be=0;Be<Oe;Be++){var St=Be+Ue*We,rt=Be+Ue*(We+1),at=Be+1+Ue*(We+1),ct=Be+1+Ue*We,Xe=(We*Oe+Be)*6;ot[Xe+0]=St,ot[Xe+1]=rt,ot[Xe+2]=ct,ot[Xe+3]=rt,ot[Xe+4]=at,ot[Xe+5]=ct}var ce=new THREE__namespace.BufferGeometry;ce.setAttribute("position",new THREE__namespace.BufferAttribute(lt,3)),ce.setAttribute("uv",new THREE__namespace.BufferAttribute(nt,2)),ce.setIndex(new THREE__namespace.BufferAttribute(ot,1)),(!ce.groups||ce.groups.length===0)&&ce.addGroup(0,ce.index?ce.index.count:ce.attributes.position.count,0),ce.boundingBox=At;var we=new PBMMeshMaterial(t.light?"phong":"basic");we.flatShading=!0,we.color.copy(de);var Me=new PBMMesh(ce,[we]);return{object:Me,dispose:function(){ce.dispose(),we.dispose()}}}var VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,identityMatrix4$1=new THREE__namespace.Matrix4().identity(),scratchVector=new THREE__namespace.Vector3,scratchMatrix4$5=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3$1=new THREE__namespace.Box3,scratchSphere$2=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$5.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=(function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$5.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$5),this.setFromFrustum(scratchFrustum),this},n.prototype.applyMatrix4=function(t){for(var e=0,r=this.planes;e<r.length;e++){var o=r[e];o.applyMatrix4(t)}},n.prototype.copy=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,o=this.planes;r<o.length;r++){var s=o[r],u=t.intersectPlane(s);switch(u){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,o=Math.min(32,this.planes.length),s=0;s<o;++s){var u=1<<s;if((e&u)!==0){var l=this.planes[s],c=t.intersectPlane(l);if(c===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=u)}}return r},n})(),BoxBoundingVolume=(function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],o=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],p=e[10],d=e[11],h=Math.max(Math.sqrt(r*r+o*o+s*s),.001),g=Math.max(Math.sqrt(u*u+l*l+c*c),.001),m=Math.max(Math.sqrt(f*f+p*p+d*d),.001);this.halfSize.set(h,g,m);var E=this.halfSize.toArray().reduce(function(y,v){return y+v},0);return(isNaN(E)||E<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/g,l/g,c/g,f/m,p/m,d/m]),isNaN(this.rotation.toArray().reduce(function(y,v){return y+v},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return t.equals(identityMatrix4$1)?this:(scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$5.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this)},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.rotation.elements,r=t.x-this.center.x,o=t.y-this.center.y,s=t.z-this.center.z,u=0,l;return l=r*e[0]+o*e[1]+s*e[2],l<0&&(l=-l),l-=this.halfSize.x,l>0&&(u+=l*l),l=r*e[3]+o*e[4]+s*e[5],l<0&&(l=-l),l-=this.halfSize.y,l>0&&(u+=l*l),l=r*e[6]+o*e[7]+s*e[8],l<0&&(l=-l),l-=this.halfSize.z,l>0&&(u+=l*l),u},n.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSquaredToPoint(t))},n.prototype.distanceToPlane=function(t){var e=t.projectPoint(this.center,new THREE__namespace.Vector3);return this.distanceToPoint(e)},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),e=new Float32Array(24);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,o=this.rotation.elements,s=this.halfSize,u=r.x,l=r.y,c=r.z,f=Math.abs(u*o[0]*s.x+l*o[1]*s.x+c*o[2]*s.x)+Math.abs(u*o[3]*s.y+l*o[4]*s.y+c*o[5]*s.y)+Math.abs(u*o[6]*s.z+l*o[7]*s.z+c*o[8]*s.z),p=r.dot(e)+t.constant;return p<=-f?VolumePlaneIntersect.Outside:p>=f?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e,r){if(e===void 0&&(e=0),scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3$1.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),scratchBox3$1.expandByScalar(e),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$5),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3$1.containsPoint(scratchRay$1.origin))return!0;var o=scratchRay$1.intersectBox(scratchBox3$1,scratchVector);return o?r!==void 0?(r+=e,o.distanceToSquared(scratchRay$1.origin)<=r*r):!0:!1},n})(),SphereBoundingVolume=(function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+Math.sin(o)*this.radius,e[r*6+2]=this.center.z+0,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+Math.sin(o)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(o)*this.radius,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(o)*this.radius}var s=new THREE__namespace.BufferGeometry;return s.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),s.computeBoundingBox(),s.computeBoundingSphere(),s},n.prototype.applyMatrix4=function(t){return t.equals(identityMatrix4$1)?this:(this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this)},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.distanceToPoint(t);return e*e},n.prototype.distanceToPoint=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.distanceToPlane=function(t){var e=Math.abs(t.distanceToPoint(this.center));return Math.max(0,e-this.radius)},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,o=t.normal,s=o.dot(e)+t.constant;return s<-r?VolumePlaneIntersect.Outside:s<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e,r){if(e===void 0&&(e=0),scratchSphere$2.set(this.center,this.radius+e),scratchSphere$2.containsPoint(t.origin))return!0;var o=t.intersectSphere(scratchSphere$2,scratchVector);return o?r!==void 0?(r+=e,t.origin.distanceToSquared(o)<=r*r):!0:!1},n})(),RegionBoundingVolume=(function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceToPlane=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r){throw new Error("not implemented")},n})();function isBoundingVolume(n){return n instanceof BoxBoundingVolume||n instanceof SphereBoundingVolume||n instanceof RegionBoundingVolume}function makeBoundingVolume(n){if(isBoundingVolume(n))return n;if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})}),debugBoxGeometry=(function(){var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e})(),debugSphereGeometry=(function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o})();function createDebugBoundingMesh(n,t){if(t===void 0&&(t=0),n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}return null}var scratchVector3$a=new THREE__namespace.Vector3,scratchPlane=new THREE__namespace.Plane,scratchSphereBoundingVolume$1=new SphereBoundingVolume,scratchBoxBoundingVolume$1=new BoxBoundingVolume,Tile=(function(){function n(t,e,r,o){var s=this,u,l,c,f;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,centerScreenY:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=o!=null?o:null,this.contentParent=o?o.hasRenderContent?o:o.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(u=e.refine)!==null&&u!==void 0?u:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(l=this.parent)===null||l===void 0?void 0:l.geometricError)!==null&&c!==void 0?c:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,byteLength:0,memoryUsage:0},e.content.group!==void 0&&(this.content.group=e.content.group),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type==="SCENEGRAPH"&&(this.levelOfContent=this.levelOfContent+1),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(f=e.extras)!==null&&f!==void 0?f:{},typeof this.extras.floor!="number"&&o&&typeof o.extras.floor=="number"&&(this.extras.floor=o.extras.floor),typeof this.extras.floor=="number"&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),e.children?this.children=e.children.map(function(p,d){return new n("".concat(s.id,".").concat(d),p,r,s)}):this.children=[]}return n.prototype.traverse=function(t){t(this);for(var e=0,r=this.children;e<r.length;e++){var o=r[e];o.traverse(t)}},n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transform;if(this.boundingVolume){var r=void 0;this.boundingVolume instanceof BoxBoundingVolume?r=scratchBoxBoundingVolume$1.copy(this.boundingVolume):this.boundingVolume instanceof SphereBoundingVolume?r=scratchSphereBoundingVolume$1.copy(this.boundingVolume):r=this.boundingVolume.clone(),r.applyMatrix4(e),t.camera.type==="OrthographicCamera"?(scratchPlane.setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position),this.state.distanceToCamera=r.distanceToPlane(scratchPlane)):this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var o=r.getCenter(scratchVector3$a).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(o),this.state.centerScreenY=t.camera.up.dot(o);var s=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,s),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,t.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if((this.levelOfContent<=t.minLevelOfDetail||this.geometricError>=t.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){var u=void 0;this.viewerRequestVolume instanceof BoxBoundingVolume?u=scratchBoxBoundingVolume$1.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof SphereBoundingVolume?u=scratchSphereBoundingVolume$1.copy(this.viewerRequestVolume):u=this.viewerRequestVolume.clone(),u.applyMatrix4(e),this.state.inRequestVolume=u.distanceSquaredToPoint(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentMemoryUsage",{get:function(){return this.content?this.content.memoryUsage:0},enumerable:!1,configurable:!0}),n.prototype.getScreenSpaceError=function(t,e,r){var o=this.tileset.transform.getMaxScaleOnAxis(),s=this.parent?this.parent.geometricError:this.tileset.geometricError,u=o*(r?s:this.geometricError);if(u===0)return 0;var l=t.height,c=t.sseDenominator;if(t.camera.type==="OrthographicCamera"){var f=t.camera.projectionMatrix.elements,p=1/(f[5]/2),d=.9,h=p/l*d,g=u/h;return g}else{var m=Math.max(e,.001),h=m*c/l,g=u/h;return g}},n.prototype.getPriority=function(t){var e=this.refine==="ADD"||t.skipLevelOfDetail;if(e&&!this.state.visible||t.frameNumber-this.state.touchedFrameNumber>=1)return-1;var r=this.parent,o=r&&(!e||this.state.screenSpaceError===0),s=o?r.state.screenSpaceError:this.state.screenSpaceError,u=this.tileset.root?this.tileset.root.state.screenSpaceError:0,l=Math.max(u-s,0);return l},n})(),defaultIterator=function(n){return Number(n)};function arrayMin(n,t,e){var r;t===void 0&&(t=defaultIterator),e===void 0&&(e=!1);for(var o,s=1/0,u=0,l=n;u<l.length;u++){var c=l[u],f=t(c);f<=s&&(r=[c,f],o=r[0],s=r[1])}return isFinite(s)||(s=0),e?[o,s]:o}function arrayEqual(n,t,e){e===void 0&&(e=function(s,u){return s===u});var r=n.length;if(r!==t.length)return!1;for(var o=0;o<r;o++)if(e(n[o],t[o])===!1)return!1;return!0}var arrayUniqueSet=new Set;function arrayUnique(n){arrayUniqueSet.clear();for(var t=[],e=n.length,r=0;r<e;r++){var o=n[r];arrayUniqueSet.has(o)||(t.push(o),arrayUniqueSet.add(o))}return arrayUniqueSet.clear(),t}var arrayMinCallback=function(n){return n.distance},intersectDistanceSortCallback=function(n,t){return n.distance-t.distance};function sortIntersects(n,t,e){if(t===void 0&&(t=!0),e===void 0&&(e=!1),e&&n.length>1){var r=arrayMin(n,arrayMinCallback);r?(n[0]=r,n.length=1):n.length=0}return t&&n.length>1&&n.sort(intersectDistanceSortCallback),n}var BVHObject=(function(){function n(t,e){this.position=t,this.indices=e}return n.prototype.getPositionCount=function(){var t,e,r=this.indices,o=this.position;return r?r.array.length/((t=r.stride)!==null&&t!==void 0?t:1):o.array.length/((e=o.stride)!==null&&e!==void 0?e:3)},n.prototype.getPositionByIndex=function(t,e){var r,o,s,u,l=this.indices,c=this.position,f=t;if(l){var p=l.array,d=(r=l.stride)!==null&&r!==void 0?r:1,h=(o=l.offset)!==null&&o!==void 0?o:0;f=p[t*d+h]}var g=c.array,m=(s=c.stride)!==null&&s!==void 0?s:3,E=(u=c.offset)!==null&&u!==void 0?u:0;return f=f*m+E,e.x=g[f],e.y=g[f+1],e.z=g[f+2],e},n.prototype.createTree=function(t,e,r){throw new Error("not implemented")},n.prototype.trianglesInSphere=function(t,e){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r,o,s){throw new Error("not implemented")},n})(),BVHNode=(function(){function n(t,e,r,o,s){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=o,this.deepth=s}return n})(),BYTES_PER_NODE=36;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),o=new Uint32Array(e),s=new Uint16Array(e),u=[n],l,c;l=u.pop();)c=l.id*BYTES_PER_NODE/4,r[c]=l.extents[0],r[c+1]=l.extents[1],r[c+2]=l.extents[2],r[c+3]=l.extents[3],r[c+4]=l.extents[4],r[c+5]=l.extents[5],o[c+6]=l.startIndex,o[c+7]=l.endIndex,c=l.id*BYTES_PER_NODE/2,l.node0&&(s[c+16]=l.node0.id,u.push(l.node0)),l.node1&&(s[c+17]=l.node1.id,u.push(l.node1));return e}function containsNodeBox(n,t,e){e===void 0&&(e=0);var r=t.min.x-e,o=t.min.y-e,s=t.min.z-e,u=t.max.x+e,l=t.max.y+e,c=t.max.z+e;return n.x>=r&&n.x<=u&&n.y>=o&&n.y<=l&&n.z>=s&&n.z<=c}function intersectNodeBox(n,t,e,r){if(r===void 0&&(r=0),containsNodeBox(n,e,r))return 0;var o=e.min.x-r,s=e.min.y-r,u=e.min.z-r,l=e.max.x+r,c=e.max.y+r,f=e.max.z+r,p=0,d=0,h=0,g=0,m=0,E=0;return t.x>=0?(p=(o-n.x)*t.x,d=(l-n.x)*t.x):(p=(l-n.x)*t.x,d=(o-n.x)*t.x),t.y>=0?(h=(s-n.y)*t.y,g=(c-n.y)*t.y):(h=(c-n.y)*t.y,g=(s-n.y)*t.y),p>g||h>d||((h>p||p!==p)&&(p=h),(g<d||d!==d)&&(d=g),t.z>=0?(m=(u-n.z)*t.z,E=(f-n.z)*t.z):(m=(f-n.z)*t.z,E=(u-n.z)*t.z),p>E||m>d)||((m>p||p!==p)&&(p=m),(E<d||d!==d)&&(d=E),d<0)?null:p>=0?p:d}var BVHVector3=(function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,o=this.z;return this.x=r*t.z-o*t.y,this.y=o*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,o=t.y,s=t.z,u=e.x,l=e.y,c=e.z;return this.x=o*c-s*l,this.y=s*u-r*c,this.z=r*l-o*u,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,o=this.z-t.z;return e*e+r*r+o*o},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n})(),BVHIntersect=(function(){function n(t,e,r,o,s){this.pointA=t,this.pointB=e,this.pointC=r,this.index=o,this.intersectionPoint=s}return n})(),BVHBox3=(function(){function n(t,e){this.min=t,this.max=e}return n})(),EPSILON$1=1e-6,scratchVector3$9=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionCount()/3,u=s>65535?new Uint32Array(s):new Uint16Array(s),l=new Float32Array(s*6),c=[],f=0,p=-1;if(o)for(var d=0;d<s;d+=1){var h=d*3,g=d*6,m=void 0,E=void 0,y=void 0,v=void 0,A=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),m=v=scratchVector3A.x,T=scratchVector3B.x,T<m&&(m=T),T>v&&(v=T),T=scratchVector3C.x,T<m&&(m=T),T>v&&(v=T),E=A=scratchVector3A.y,T=scratchVector3B.y,T<E&&(E=T),T>A&&(A=T),T=scratchVector3C.y,T<E&&(E=T),T>A&&(A=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=m,l[g+1]=E,l[g+2]=y,l[g+3]=v,l[g+4]=A,l[g+5]=b}else{for(var _=1/0,S=1/0,w=1/0,R=-1/0,I=-1/0,H=-1/0,d=0;d<s;d+=1){var h=d*3,g=d*6,m=void 0,E=void 0,y=void 0,v=void 0,A=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),m=v=scratchVector3A.x,T=scratchVector3B.x,T<m&&(m=T),T>v&&(v=T),T=scratchVector3C.x,T<m&&(m=T),T>v&&(v=T),E=A=scratchVector3A.y,T=scratchVector3B.y,T<E&&(E=T),T>A&&(A=T),T=scratchVector3C.y,T<E&&(E=T),T>A&&(A=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=m,l[g+1]=E,l[g+2]=y,l[g+3]=v,l[g+4]=A,l[g+5]=b,m<_&&(_=m),v>R&&(R=v),E<S&&(S=E),A>I&&(I=A),y<w&&(w=y),b>H&&(H=b)}o=[_,S,w,R,I,H]}var C=new BVHNode(++p,o,0,s,0);c[f++]=C;var M=[],B=[0,1,2],L=function(k,D){return M[D]-M[k]};function O(k){var D=k.startIndex,q=k.endIndex,z=k.extents;M[0]=z[3]-z[0],M[1]=z[4]-z[1],M[2]=z[5]-z[2],B.sort(L);for(var J=0;J<3;J++){for(var V=B[J],U=z[V]+z[V+3],j=D,K=q-1,ae=-1,re=void 0;j<=K;)ae===-1?(re=u[j],l[re*6+V]+l[re*6+V+3]<U?j++:ae=re):(re=u[K],l[re*6+V]+l[re*6+V+3]>=U||(u[j]=re,u[K]=ae,ae=-1,j++),K--);if(j>D&&j<q){var ee=new BVHNode(++p,calcExtents(u,l,D,j,EPSILON$1),D,j,k.deepth+1);ee.deepth<r&&ee.endIndex-ee.startIndex>e&&(c[f++]=ee);var Z=new BVHNode(++p,calcExtents(u,l,j,q,EPSILON$1),j,q,k.deepth+1);Z.deepth<r&&Z.endIndex-Z.startIndex>e&&(c[f++]=Z),k.node0=ee,k.node1=Z,k.startIndex=0,k.endIndex=0;break}}}for(;f;)O(c[--f]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(C,p+1),c.length=0,this},t.prototype.trianglesInSphere=function(e,r){for(var o=this.offsetArray,s=this.rootNodePacked,u=new Float32Array(s),l=new Uint32Array(s),c=new Uint16Array(s),f=[0],p=[],d;(d=f.pop())!==void 0;){var h=d*BYTES_PER_NODE/4,g=clamp(e.x,u[h],u[h+3])-e.x,m=clamp(e.y,u[h+1],u[h+4])-e.y,E=clamp(e.z,u[h+2],u[h+5])-e.z;if(g*g+m*m+E*E<=r*r){for(var y=l[h+6],v=l[h+7],A=y;A<v;A++){var b=o[A];p.push(b)}var T=d*BYTES_PER_NODE/2,_=c[T+16],S=c[T+17];_&&f.push(_),S&&f.push(S)}}for(var w=p.length,R=new Float32Array(w*9),A=0;A<w;A++){var b=p[A],I=b*3;this.getPositionByIndex(I,scratchVector3$9),R[A*9]=scratchVector3$9.x,R[A*9+1]=scratchVector3$9.y,R[A*9+2]=scratchVector3$9.z,this.getPositionByIndex(I+1,scratchVector3$9),R[A*9+3]=scratchVector3$9.x,R[A*9+4]=scratchVector3$9.y,R[A*9+5]=scratchVector3$9.z,this.getPositionByIndex(I+2,scratchVector3$9),R[A*9+6]=scratchVector3$9.x,R[A*9+7]=scratchVector3$9.y,R[A*9+8]=scratchVector3$9.z}return R},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,f=this.rootNodePacked,p=new Float32Array(f),d=new Uint32Array(f),h=new Uint16Array(f),g=new BVHVector3(1/r.x,1/r.y,1/r.z),m=[0],E,y=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),v=1/0;(E=m.pop())!==void 0;){var A=E*BYTES_PER_NODE/4;y.min.x=p[A],y.min.y=p[A+1],y.min.z=p[A+2],y.max.x=p[A+3],y.max.y=p[A+4],y.max.z=p[A+5];var b=intersectNodeBox(e,g,y,o);if(b!==null&&!(s&&b>v)){for(var T=e.x,_=e.y,S=e.z,w=r.x,R=r.y,I=r.z,H=d[A+6],C=d[A+7],M=H;M<C;M++){var B=c[M],L=B*3,O=new BVHVector3(0,0,0);this.getPositionByIndex(L,O);var k=O.x,D=O.y,q=O.z,z=new BVHVector3(0,0,0);this.getPositionByIndex(L+1,z);var J=z.x,V=z.y,U=z.z,j=new BVHVector3(0,0,0);this.getPositionByIndex(L+2,j);var K=j.x,ae=j.y,re=j.z,ee=J-k,Z=V-D,X=U-q,se=K-k,G=ae-D,W=re-q,$=Z*W-X*G,ne=X*se-ee*W,te=ee*G-Z*se,ve=w*$+R*ne+I*te,oe=void 0;if(ve>0)oe=1;else if(ve<0)oe=-1,ve=-ve;else continue;var fe=T-k,be=_-D,ie=S-q,ue=oe*(w*(be*W-ie*G)+R*(ie*se-fe*W)+I*(fe*G-be*se));if(!(ue<0)){var me=oe*(w*(Z*ie-X*be)+R*(X*fe-ee*ie)+I*(ee*be-Z*fe));if(!(me<0)&&!(ue+me>ve)){var ge=-oe*(fe*$+be*ne+ie*te);if(!(ge<0)){var Ae=ge/ve,xe=new BVHVector3(T+w*Ae,_+R*Ae,S+I*Ae),de=new BVHIntersect(O,z,j,B,xe);(!u||u(de))&&(s?Ae<v&&(v=Ae,l.length>0&&(l.length=0),l.push(de)):l.push(de))}}}}var _e=E*BYTES_PER_NODE/2,He=h[_e+16],Ee=h[_e+17];He&&m.push(He),Ee&&m.push(Ee)}}return l},t})(BVHObject);function clamp(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,o){if(e>=r)return[0,0,0,0,0,0];for(var s=1/0,u=1/0,l=1/0,c=-1/0,f=-1/0,p=-1/0,d=e;d<r;d++){var h=n[d]*6,g=t[h];g<s&&(s=g),g=t[h+1],g<u&&(u=g),g=t[h+2],g<l&&(l=g),g=t[h+3],g>c&&(c=g),g=t[h+4],g>f&&(f=g),g=t[h+5],g>p&&(p=g)}return[s-o,u-o,l-o,c+o,f+o,p+o]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$8=new BVHVector3(0,0,0),BVHPoints=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionByIndex.bind(this),u=this.getPositionCount(),l=u>65535?new Uint32Array(u):new Uint16Array(u),c=[],f=0,p=-1;if(o)for(var d=0;d<u;d+=1)l[d]=d;else{s(0,scratchVector3$8);for(var h=scratchVector3$8.x,g=scratchVector3$8.y,m=scratchVector3$8.z,E=h,y=g,v=m,d=0;d<u;d+=1){l[d]=d,s(d,scratchVector3$8);var A=scratchVector3$8.x,b=scratchVector3$8.y,T=scratchVector3$8.z;A<h?h=A:A>E&&(E=A),b<g?g=b:b>y&&(y=b),T<m?m=T:T>v&&(v=T)}o=[h,g,m,E,y,v]}var _=new BVHNode(++p,o,0,u,0);c[f++]=_;var S=[],w=[0,1,2],R=function(H,C){return S[C]-S[H]};function I(H){var C=H.startIndex,M=H.endIndex,B=H.extents;S[0]=B[3]-B[0],S[1]=B[4]-B[1],S[2]=B[5]-B[2];for(var L=w.sort(R)[0],O=ORDER_AXISES[L],k=(B[L]+B[L+3])/2,D=C,q=M-1,z=-1,J;D<=q;)z===-1?(J=l[D],s(J,scratchVector3$8),scratchVector3$8[O]<k?D++:z=J):(J=l[q],s(J,scratchVector3$8),scratchVector3$8[O]>=k||(l[D]=J,l[q]=z,z=-1,D++),q--);if(D>C){var V=B.slice();V[L+3]=k+EPSILON;var U=new BVHNode(++p,V,C,D,H.deepth+1);U.deepth<r&&U.endIndex-U.startIndex>e&&(c[f++]=U),H.node0=U}if(M>D){var j=B.slice();j[L]=k-EPSILON;var K=new BVHNode(++p,j,D,M,H.deepth+1);K.deepth<r&&K.endIndex-K.startIndex>e&&(c[f++]=K),H.node1=K}H.startIndex=0,H.endIndex=0}for(;f;)I(c[--f]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,p+1),c.length=0,this},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,f=this.rootNodePacked,p=new Float32Array(f),d=new Uint32Array(f),h=new Uint16Array(f),g=o*o,m=new BVHVector3(1/r.x,1/r.y,1/r.z),E=[0],y,v=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),A=1/0;(y=E.pop())!==void 0;){var b=y*BYTES_PER_NODE/4;v.min.x=p[b],v.min.y=p[b+1],v.min.z=p[b+2],v.max.x=p[b+3],v.max.y=p[b+4],v.max.z=p[b+5];var T=intersectNodeBox(e,m,v,o);if(T!==null&&!(s&&T>A)){for(var _=d[b+6],S=d[b+7],w=_;w<S;w++){var R=c[w],I=new BVHVector3(0,0,0);this.getPositionByIndex(R,I);var H=I.x,C=I.y,M=I.z,B=e.x,L=e.y,O=e.z,k=r.x,D=r.y,q=r.z,z=k*(H-B)+D*(C-L)+q*(M-O);if(z>0?(B+=k*z,L+=D*z,O+=q*z):z<0&&(z=0),k=H-B,D=C-L,q=M-O,k*k+D*D+q*q<=g){var J=new BVHVector3(B,L,O),V=new BVHIntersect(I,I,I,R,J);(!u||u(V))&&(s?z<A&&(A=z,l.length>0&&(l.length=0),l.push(V)):l.push(V))}}var U=y*BYTES_PER_NODE/2,j=h[U+16],K=h[U+17];j&&E.push(j),K&&E.push(K)}}return l},t})(BVHObject);const jsContent=`(function(){"use strict";var ur=function(a,r){return ur=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},ur(a,r)};function cr(a,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");ur(a,r);function t(){this.constructor=a}a.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}typeof SuppressedError=="function"&&SuppressedError;var hr=(function(){function a(r,t){this.position=r,this.indices=t}return a.prototype.getPositionCount=function(){var r,t,n=this.indices,o=this.position;return n?n.array.length/((r=n.stride)!==null&&r!==void 0?r:1):o.array.length/((t=o.stride)!==null&&t!==void 0?t:3)},a.prototype.getPositionByIndex=function(r,t){var n,o,f,v,i=this.indices,u=this.position,w=r;if(i){var c=i.array,s=(n=i.stride)!==null&&n!==void 0?n:1,d=(o=i.offset)!==null&&o!==void 0?o:0;w=c[r*s+d]}var y=u.array,x=(f=u.stride)!==null&&f!==void 0?f:3,l=(v=u.offset)!==null&&v!==void 0?v:0;return w=w*x+l,t.x=y[w],t.y=y[w+1],t.z=y[w+2],t},a.prototype.createTree=function(r,t,n){throw new Error("not implemented")},a.prototype.trianglesInSphere=function(r,t){throw new Error("not implemented")},a.prototype.intersectRay=function(r,t,n,o,f){throw new Error("not implemented")},a})(),D=(function(){function a(r,t,n,o,f){this.id=r,this.extents=t,this.startIndex=n,this.endIndex=o,this.deepth=f}return a})(),Y=36;function wr(a,r){for(var t=new ArrayBuffer(r*Y),n=new Float32Array(t),o=new Uint32Array(t),f=new Uint16Array(t),v=[a],i,u;i=v.pop();)u=i.id*Y/4,n[u]=i.extents[0],n[u+1]=i.extents[1],n[u+2]=i.extents[2],n[u+3]=i.extents[3],n[u+4]=i.extents[4],n[u+5]=i.extents[5],o[u+6]=i.startIndex,o[u+7]=i.endIndex,u=i.id*Y/2,i.node0&&(f[u+16]=i.node0.id,v.push(i.node0)),i.node1&&(f[u+17]=i.node1.id,v.push(i.node1));return t}function Hr(a,r,t){t===void 0&&(t=0);var n=r.min.x-t,o=r.min.y-t,f=r.min.z-t,v=r.max.x+t,i=r.max.y+t,u=r.max.z+t;return a.x>=n&&a.x<=v&&a.y>=o&&a.y<=i&&a.z>=f&&a.z<=u}function dr(a,r,t,n){if(n===void 0&&(n=0),Hr(a,t,n))return 0;var o=t.min.x-n,f=t.min.y-n,v=t.min.z-n,i=t.max.x+n,u=t.max.y+n,w=t.max.z+n,c=0,s=0,d=0,y=0,x=0,l=0;return r.x>=0?(c=(o-a.x)*r.x,s=(i-a.x)*r.x):(c=(i-a.x)*r.x,s=(o-a.x)*r.x),r.y>=0?(d=(f-a.y)*r.y,y=(u-a.y)*r.y):(d=(u-a.y)*r.y,y=(f-a.y)*r.y),c>y||d>s||((d>c||c!==c)&&(c=d),(y<s||s!==s)&&(s=y),r.z>=0?(x=(v-a.z)*r.z,l=(w-a.z)*r.z):(x=(w-a.z)*r.z,l=(v-a.z)*r.z),c>l||x>s)||((x>c||c!==c)&&(c=x),(l<s||s!==s)&&(s=l),s<0)?null:c>=0?c:s}var H=(function(){function a(r,t,n){this.x=r,this.y=t,this.z=n}return a.prototype.copy=function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this},a.prototype.set=function(r,t,n){return this.x=r,this.y=t,this.z=n,this},a.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},a.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},a.prototype.add=function(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this},a.prototype.multiplyScalar=function(r){return this.x*=r,this.y*=r,this.z*=r,this},a.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},a.prototype.addScaledVector=function(r,t){return this.x+=r.x*t,this.y+=r.y*t,this.z+=r.z*t,this},a.prototype.dot=function(r){return this.x*r.x+this.y*r.y+this.z*r.z},a.prototype.cross=function(r){var t=this.x,n=this.y,o=this.z;return this.x=n*r.z-o*r.y,this.y=o*r.x-t*r.z,this.z=t*r.y-n*r.x,this},a.prototype.crossVectors=function(r,t){var n=r.x,o=r.y,f=r.z,v=t.x,i=t.y,u=t.z;return this.x=o*u-f*i,this.y=f*v-n*u,this.z=n*i-o*v,this},a.prototype.distanceTo=function(r){return Math.sqrt(this.distanceToSquared(r))},a.prototype.distanceToSquared=function(r){var t=this.x-r.x,n=this.y-r.y,o=this.z-r.z;return t*t+n*n+o*o},a.prototype.clone=function(){return new a(this.x,this.y,this.z)},a})(),lr=(function(){function a(r,t,n,o,f){this.pointA=r,this.pointB=t,this.pointC=n,this.index=o,this.intersectionPoint=f}return a})(),xr=(function(){function a(r,t){this.min=r,this.max=t}return a})(),zr=1e-6,J=new H(0,0,0),Z=new H(0,0,0),g=new H(0,0,0),b=new H(0,0,0),kr=(function(a){cr(r,a);function r(){return a!==null&&a.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,o){n=Math.min(n,16);var f=this.getPositionCount()/3,v=f>65535?new Uint32Array(f):new Uint16Array(f),i=new Float32Array(f*6),u=[],w=0,c=-1;if(o)for(var s=0;s<f;s+=1){var d=s*3,y=s*6,x=void 0,l=void 0,I=void 0,p=void 0,h=void 0,z=void 0,e=void 0;v[s]=s,this.getPositionByIndex(d,Z),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,b),x=p=Z.x,e=g.x,e<x&&(x=e),e>p&&(p=e),e=b.x,e<x&&(x=e),e>p&&(p=e),l=h=Z.y,e=g.y,e<l&&(l=e),e>h&&(h=e),e=b.y,e<l&&(l=e),e>h&&(h=e),I=z=Z.z,e=g.z,e<I&&(I=e),e>z&&(z=e),e=b.z,e<I&&(I=e),e>z&&(z=e),i[y]=x,i[y+1]=l,i[y+2]=I,i[y+3]=p,i[y+4]=h,i[y+5]=z}else{for(var F=1/0,k=1/0,E=1/0,N=-1/0,V=-1/0,U=-1/0,s=0;s<f;s+=1){var d=s*3,y=s*6,x=void 0,l=void 0,I=void 0,p=void 0,h=void 0,z=void 0,e=void 0;v[s]=s,this.getPositionByIndex(d,Z),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,b),x=p=Z.x,e=g.x,e<x&&(x=e),e>p&&(p=e),e=b.x,e<x&&(x=e),e>p&&(p=e),l=h=Z.y,e=g.y,e<l&&(l=e),e>h&&(h=e),e=b.y,e<l&&(l=e),e>h&&(h=e),I=z=Z.z,e=g.z,e<I&&(I=e),e>z&&(z=e),e=b.z,e<I&&(I=e),e>z&&(z=e),i[y]=x,i[y+1]=l,i[y+2]=I,i[y+3]=p,i[y+4]=h,i[y+5]=z,x<F&&(F=x),p>N&&(N=p),l<k&&(k=l),h>V&&(V=h),I<E&&(E=I),z>U&&(U=z)}o=[F,k,E,N,V,U]}var W=new D(++c,o,0,f,0);u[w++]=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],S=B,L=_-1,O=-1,Q=void 0;S<=L;)O===-1?(Q=v[S],i[Q*6+C]+i[Q*6+C+3]<G?S++:O=Q):(Q=v[L],i[Q*6+C]+i[Q*6+C+3]>=G||(v[S]=Q,v[L]=O,O=-1,S++),L--);if(S>B&&S<_){var R=new D(++c,Ir(v,i,B,S,zr),B,S,P.deepth+1);R.deepth<n&&R.endIndex-R.startIndex>t&&(u[w++]=R);var X=new D(++c,Ir(v,i,S,_,zr),S,_,P.deepth+1);X.deepth<n&&X.endIndex-X.startIndex>t&&(u[w++]=X),P.node0=R,P.node1=X,P.startIndex=0,P.endIndex=0;break}}}for(;w;)q(u[--w]);return this.offsetArray=v,this.rootNodePacked=wr(W,c+1),u.length=0,this},r.prototype.trianglesInSphere=function(t,n){for(var o=this.offsetArray,f=this.rootNodePacked,v=new Float32Array(f),i=new Uint32Array(f),u=new Uint16Array(f),w=[0],c=[],s;(s=w.pop())!==void 0;){var d=s*Y/4,y=fr(t.x,v[d],v[d+3])-t.x,x=fr(t.y,v[d+1],v[d+4])-t.y,l=fr(t.z,v[d+2],v[d+5])-t.z;if(y*y+x*x+l*l<=n*n){for(var I=i[d+6],p=i[d+7],h=I;h<p;h++){var z=o[h];c.push(z)}var e=s*Y/2,F=u[e+16],k=u[e+17];F&&w.push(F),k&&w.push(k)}}for(var E=c.length,N=new Float32Array(E*9),h=0;h<E;h++){var z=c[h],V=z*3;this.getPositionByIndex(V,J),N[h*9]=J.x,N[h*9+1]=J.y,N[h*9+2]=J.z,this.getPositionByIndex(V+1,J),N[h*9+3]=J.x,N[h*9+4]=J.y,N[h*9+5]=J.z,this.getPositionByIndex(V+2,J),N[h*9+6]=J.x,N[h*9+7]=J.y,N[h*9+8]=J.z}return N},r.prototype.intersectRay=function(t,n,o,f,v){o===void 0&&(o=0),f===void 0&&(f=!1);for(var i=[],u=this.offsetArray,w=this.rootNodePacked,c=new Float32Array(w),s=new Uint32Array(w),d=new Uint16Array(w),y=new H(1/n.x,1/n.y,1/n.z),x=[0],l,I=new xr(new H(0,0,0),new H(0,0,0)),p=1/0;(l=x.pop())!==void 0;){var h=l*Y/4;I.min.x=c[h],I.min.y=c[h+1],I.min.z=c[h+2],I.max.x=c[h+3],I.max.y=c[h+4],I.max.z=c[h+5];var z=dr(t,y,I,o);if(z!==null&&!(f&&z>p)){for(var e=t.x,F=t.y,k=t.z,E=n.x,N=n.y,V=n.z,U=s[h+6],W=s[h+7],M=U;M<W;M++){var T=u[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,S=new H(0,0,0);this.getPositionByIndex(j+2,S);var L=S.x,O=S.y,Q=S.z,R=$-P,X=C-B,er=G-_,or=L-P,vr=O-B,sr=Q-_,Ar=X*sr-er*vr,Pr=er*or-R*sr,Br=R*vr-X*or,m=E*Ar+N*Pr+V*Br,rr=void 0;if(m>0)rr=1;else if(m<0)rr=-1,m=-m;else continue;var tr=e-P,nr=F-B,ir=k-_,Nr=rr*(E*(nr*sr-ir*vr)+N*(ir*or-tr*sr)+V*(tr*vr-nr*or));if(!(Nr<0)){var Sr=rr*(E*(X*ir-er*nr)+N*(er*tr-R*ir)+V*(R*nr-X*tr));if(!(Sr<0)&&!(Nr+Sr>m)){var Vr=-rr*(tr*Ar+nr*Pr+ir*Br);if(!(Vr<0)){var ar=Vr/m,Lr=new H(e+E*ar,F+N*ar,k+V*ar),yr=new lr(q,A,S,T,Lr);(!v||v(yr))&&(f?ar<p&&(p=ar,i.length>0&&(i.length=0),i.push(yr)):i.push(yr))}}}}var Tr=l*Y/2,Ur=d[Tr+16],_r=d[Tr+17];Ur&&x.push(Ur),_r&&x.push(_r)}}return i},r})(hr);function fr(a,r,t){return a<r?r:a>t?t:a}function Ir(a,r,t,n,o){if(t>=n)return[0,0,0,0,0,0];for(var f=1/0,v=1/0,i=1/0,u=-1/0,w=-1/0,c=-1/0,s=t;s<n;s++){var d=a[s]*6,y=r[d];y<f&&(f=y),y=r[d+1],y<v&&(v=y),y=r[d+2],y<i&&(i=y),y=r[d+3],y>u&&(u=y),y=r[d+4],y>w&&(w=y),y=r[d+5],y>c&&(c=y)}return[f-o,v-o,i-o,u+o,w+o,c+o]}var pr=1e-6,Er=["x","y","z"],K=new H(0,0,0),Mr=(function(a){cr(r,a);function r(){return a!==null&&a.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,o){n=Math.min(n,16);var f=this.getPositionByIndex.bind(this),v=this.getPositionCount(),i=v>65535?new Uint32Array(v):new Uint16Array(v),u=[],w=0,c=-1;if(o)for(var s=0;s<v;s+=1)i[s]=s;else{f(0,K);for(var d=K.x,y=K.y,x=K.z,l=d,I=y,p=x,s=0;s<v;s+=1){i[s]=s,f(s,K);var h=K.x,z=K.y,e=K.z;h<d?d=h:h>l&&(l=h),z<y?y=z:z>I&&(I=z),e<x?x=e:e>p&&(p=e)}o=[d,y,x,l,I,p]}var F=new D(++c,o,0,v,0);u[w++]=F;var k=[],E=[0,1,2],N=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(N)[0],q=Er[j],P=(T[j]+T[j+3])/2,B=W,_=M-1,A=-1,$;B<=_;)A===-1?($=i[B],f($,K),K[q]<P?B++:A=$):($=i[_],f($,K),K[q]>=P||(i[B]=$,i[_]=A,A=-1,B++),_--);if(B>W){var C=T.slice();C[j+3]=P+pr;var G=new D(++c,C,W,B,U.deepth+1);G.deepth<n&&G.endIndex-G.startIndex>t&&(u[w++]=G),U.node0=G}if(M>B){var S=T.slice();S[j]=P-pr;var L=new D(++c,S,B,M,U.deepth+1);L.deepth<n&&L.endIndex-L.startIndex>t&&(u[w++]=L),U.node1=L}U.startIndex=0,U.endIndex=0}for(;w;)V(u[--w]);return this.offsetArray=i,this.rootNodePacked=wr(F,c+1),u.length=0,this},r.prototype.intersectRay=function(t,n,o,f,v){o===void 0&&(o=0),f===void 0&&(f=!1);for(var i=[],u=this.offsetArray,w=this.rootNodePacked,c=new Float32Array(w),s=new Uint32Array(w),d=new Uint16Array(w),y=o*o,x=new H(1/n.x,1/n.y,1/n.z),l=[0],I,p=new xr(new H(0,0,0),new H(0,0,0)),h=1/0;(I=l.pop())!==void 0;){var z=I*Y/4;p.min.x=c[z],p.min.y=c[z+1],p.min.z=c[z+2],p.max.x=c[z+3],p.max.y=c[z+4],p.max.z=c[z+5];var e=dr(t,x,p,o);if(e!==null&&!(f&&e>h)){for(var F=s[z+6],k=s[z+7],E=F;E<k;E++){var N=u[E],V=new H(0,0,0);this.getPositionByIndex(N,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+_*_<=y){var $=new H(T,j,q),C=new lr(V,V,V,N,$);(!v||v(C))&&(f?A<h&&(h=A,i.length>0&&(i.length=0),i.push(C)):i.push(C))}}var G=I*Y/2,S=d[G+16],L=d[G+17];S&&l.push(S),L&&l.push(L)}}return i},r})(hr);function jr(a){onmessage=function(r){Promise.resolve(r.data).then(function(t){return a(t)}).then(function(t){var n=t.output,o=t.transfer;return postMessage(n,o)}).catch(function(t){return postMessage({$$error:t})})}}jr(function(a){return Promise.resolve(a).then(function(r){for(var t=[],n=new Set,o=0,f=r;o<f.length;o++){var v=f[o],i=void 0;if(v.type==="mesh")i=new kr(v.attributes.position,v.indices);else if(v.type==="points")i=new Mr(v.attributes.position,v.indices);else throw new Error("Invalid Type");i.createTree(v.maxItemPerNode,v.maxTreeDepth,v.extents);var u={type:v.type,attributes:v.attributes,indices:v.indices,offsetArray:i.offsetArray,rootNodePacked:i.rootNodePacked};t.push(u);var w=void 0;for(var c in u.attributes){var s=u.attributes[c];s&&s.buffer instanceof ArrayBuffer&&n.add(s.buffer)}w=u.indices,w&&w.buffer instanceof ArrayBuffer&&n.add(w.buffer),w=u.offsetArray,w&&w.buffer instanceof ArrayBuffer&&n.add(w.buffer),n.add(u.rootNodePacked)}return{output:t,transfer:Array.from(n)}})})})();
|
|
919
919
|
`,blob=typeof self!="undefined"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",jsContent],{type:"text/javascript;charset=utf-8"});function WorkerWrapper(n){let t;try{if(t=blob&&(self.URL||self.webkitURL).createObjectURL(blob),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(jsContent),{name:n==null?void 0:n.name})}}var bvhWorkerPool=new WorkerPool(function(){return new WorkerWrapper},4),defaultHitFilter=function(){return!0},scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,intersectsMap=new Map;function raycastMesh(n,t,e,r){var o,s,u=n.matrixWorld;scratchInverseMatrix.getInverse(u),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);var l=(o=e.hitFilter)!==null&&o!==void 0?o:defaultHitFilter,c=(s=e.firstHitOnly)!==null&&s!==void 0?s:!1,f=n.geometry,p=n.material,d=f.groups,h=f.index;intersectsMap.clear();for(var g=t.intersectRay(scratchRay.origin,scratchRay.direction,0,c,function(v){var A,b=v.index,T=b*3,_;if(Array.isArray(p)){if(d)for(var S=0,w=d;S<w.length;S++){var R=w[S];if(T>=R.start&&T-R.start<R.count){_=p[(A=R.materialIndex)!==null&&A!==void 0?A:0];break}}}else _=p;if(!_)return!1;var I=v.intersectionPoint,H=new THREE__namespace.Vector3(I.x,I.y,I.z).applyMatrix4(u),C=e.ray.origin.distanceTo(H);if(C<e.near||C>e.far)return!1;var M=v.pointA,B=v.pointB,L=v.pointC,O=THREE__namespace.Triangle.getNormal(scratchIntersectionFaceA.set(M.x,M.y,M.z).applyMatrix4(u),scratchIntersectionFaceB.set(B.x,B.y,B.z).applyMatrix4(u),scratchIntersectionFaceC.set(L.x,L.y,L.z).applyMatrix4(u),new THREE__namespace.Vector3),k=e.ray.direction.dot(O);if(_.side===THREE__namespace.FrontSide&&k>=0||_.side===THREE__namespace.BackSide&&k<=0)return!1;var D=new THREE__namespace.Face3(h?h.array[T]:T,h?h.array[T+1]:T+1,h?h.array[T+2]:T+2,O),q={distance:C,object:n,face:D,point:H,distanceToRay:0,faceIndex:b};return intersectsMap.set(v,q),l(q)}),m=g.length,E=0;E<m;E++){var y=intersectsMap.get(g[E]);y&&r.push(y)}intersectsMap.clear()}function raycastPoints(n,t,e,r){var o,s,u,l,c=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(c),scratchInverseMatrix.getInverse(c),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);var f=((s=(o=e.params.Points)===null||o===void 0?void 0:o.threshold)!==null&&s!==void 0?s:1)*scratchInverseMatrix.getMaxScaleOnAxis(),p=(u=e.hitFilter)!==null&&u!==void 0?u:defaultHitFilter,d=(l=e.firstHitOnly)!==null&&l!==void 0?l:!1,h=n.geometry,g=h.index,m=h.getAttribute("normal"),E=m instanceof THREE__namespace.BufferAttribute;intersectsMap.clear();for(var y=t.intersectRay(scratchRay.origin,scratchRay.direction,f,d,function(T){var _=T.intersectionPoint,S=new THREE__namespace.Vector3(_.x,_.y,_.z).applyMatrix4(c),w=e.ray.origin.distanceTo(S);if(w<e.near||w>e.far)return!1;var R=T.pointA,I=scratchIntersectionFaceA.set(R.x,R.y,R.z).applyMatrix4(c),H=T.index,C=g?g.array[H]:H,M;if(E){var B=new THREE__namespace.Vector3().fromBufferAttribute(m,C).applyNormalMatrix(scratchNormalMatrix);M=new THREE__namespace.Face3(C,C,C,B)}var L={distance:w,object:n,face:M,point:S,distanceToRay:S.distanceTo(I),index:H};return intersectsMap.set(T,L),p(L)}),v=y.length,A=0;A<v;A++){var b=intersectsMap.get(y[A]);b&&r.push(b)}intersectsMap.clear()}var BVH_MESH_PROP="__bvh_mesh__",originMeshRaycast=THREE__namespace.Mesh.prototype.raycast;function overrideMeshRaycast(n,t){var e=getBvhTreeForMesh(this);e?raycastMesh(this,e,n,t):originMeshRaycast.call(this,n,t)}function getBvhTreeForMesh(n){var t=n[BVH_MESH_PROP];return t instanceof BVHMesh,t}function bindBvhTreeForMesh(n,t){var e;Object.assign(n,(e={},e[BVH_MESH_PROP]=t,e.raycast=overrideMeshRaycast,e))}var BVH_POINTS_PROP="__bvh_points__",originPointsRaycast=THREE__namespace.Points.prototype.raycast;function overridePointsRaycast(n,t){var e=getBvhTreeForPoints(this);e?raycastPoints(this,e,n,t):originPointsRaycast.call(this,n,t)}function getBvhTreeForPoints(n){var t=n[BVH_POINTS_PROP];return t instanceof BVHPoints,t}function bindBvhTreeForPoints(n,t){var e;Object.assign(n,(e={},e[BVH_POINTS_PROP]=t,e.raycast=overridePointsRaycast,e))}function generateBvhTree(n,t,e,r){var o=[];return n.traverse(function(s){(s instanceof THREE__namespace.Mesh||s instanceof THREE__namespace.Points)&&s.geometry instanceof THREE__namespace.BufferGeometry&&o.push(s)}),Promise.resolve().then(function(){for(var s=[],u=new Set,l=null,c=0;c<o.length;c++){var f=o[c],p=f.geometry;if(p instanceof THREE__namespace.BufferGeometry){var d=void 0;if(f instanceof THREE__namespace.Mesh?d="mesh":f instanceof THREE__namespace.Points&&(d="points"),!!d){var h=p.boundingBox,g=h?[h.min.x,h.min.y,h.min.z,h.max.x,h.max.y,h.max.z]:void 0,m={};for(var E in p.attributes){var y=p.attributes[E];y instanceof THREE__namespace.InterleavedBufferAttribute?(m[E]={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(m[E]={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var v=void 0,A=p.getIndex();A&&(A instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:A.data.array,stride:A.data.stride,offset:A.offset},l=A.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(v={array:A.array},l=A.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:d,attributes:m,indices:v,maxItemPerNode:e,maxTreeDepth:r,extents:g};s.push(b)}}}return bvhWorkerPool.postMessage(s,Array.from(u))}).then(function(s){for(var u=0;u<o.length;u++){var l=o[u],c=l.geometry,f=s[u];if(c instanceof THREE__namespace.BufferGeometry){for(var p in f.attributes){var d=f.attributes[p].array,h=c.attributes[p];h instanceof THREE__namespace.InterleavedBufferAttribute?h.data.array=d:h.array=d}var g=c.getIndex();if(g&&f.indices){var d=f.indices.array;g instanceof THREE__namespace.InterleavedBufferAttribute?g.data.array=d:g.array=d}if(l instanceof THREE__namespace.Mesh){var m=new BVHMesh(f.attributes.position,f.indices);m.offsetArray=f.offsetArray,m.rootNodePacked=f.rootNodePacked,bindBvhTreeForMesh(l,m)}else if(l instanceof THREE__namespace.Points){var m=new BVHPoints(f.attributes.position,f.indices);m.offsetArray=f.offsetArray,m.rootNodePacked=f.rootNodePacked,bindBvhTreeForPoints(l,m)}}}return n})}function mixNumber(n,t,e){return n+(t-n)*e}function value(n,t,e,r){var o=(t*e+2*n)/Math.pow(e,3),s=-(2*t*e+3*n)/Math.pow(e,2),u=t,l=n;return o*Math.pow(r,3)+s*Math.pow(r,2)+u*r+l}function velocity(n,t,e,r){var o=(t*e+2*n)/Math.pow(e,3),s=-(2*t*e+3*n)/Math.pow(e,2),u=t;return 3*o*Math.pow(r,2)+2*s*r+u}function mixCircle(n,t,e,r){var o=r[1]-r[0];return n=circleValue(n,r),t=circleValue(t,r),t-n>o/2?mixNumber(n+o,t,e):n-t>o/2?mixNumber(n-o,t,e):mixNumber(n,t,e)}function circleValue(n,t){var e=t[1]-t[0];return n<t[0]?circleValue(n+e,t):n>=t[1]?circleValue(n-e,t):n}function mixValue(n,t,e,r){return r?mixCircle(n,t,e,r):mixNumber(n,t,e)}function toNumber(n){var t=Number(n);return isNaN(t)||!isFinite(t)?0:t}var Motion=(function(){function n(t){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=now(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var e in t){var r=t[e];typeof r=="object"?(this.value[e]=toNumber(r.value),this.config[e]={circle:r.circle}):(this.value[e]=toNumber(r),this.config[e]={circle:!1})}this.keyframes=[{progress:0,value:__assign({},this.value)},{progress:1,value:__assign({},this.value)}]}return n.prototype.getProgress=function(t){var e=t-this.startTime;return e<0?0:e>=this.duration?1:1-value(1,this.startVelocity,this.duration,e)},n.prototype.getValue=function(t){for(var e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t){var r=this.keyframes[e-1],o=this.keyframes[e],s={};for(var u in this.config){var l=(t-r.progress)/(o.progress-r.progress);s[u]=mixValue(r.value[u],o.value[u],l,this.config[u].circle)}return s}return __assign({},this.keyframes[this.keyframes.length-1].value)},n.prototype.getProgressVelocity=function(t){var e=t-this.startTime;return e>=this.duration?0:velocity(1,this.startVelocity,this.duration,e)},n.prototype.update=function(t){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(t))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},n.prototype.getKeyFrameSegment=function(t){for(var e=this.getProgress(t),r=1;r<this.keyframes.length;r++)if(this.keyframes[r].progress>e)return[this.keyframes[r-1],this.keyframes[r]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},n.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},n.prototype.set=function(t,e,r,o){var s;r===void 0&&(r=0),isNaN(e)&&(e=0),isNaN(r)&&(r=0),o=o!=null?o:now();var u=this.getProgress(o),l=this.getValue(u),c={};for(var f in this.config)c[f]=(s=t[f])!==null&&s!==void 0?s:l[f];var p=[{progress:0,value:l},{progress:1,value:c}];return this.setKeyframes(p,e,r,o)},n.prototype.setKeyframes=function(t,e,r,o){var s=this;if(r===void 0&&(r=0),t.length<2)throw new Error("keyframes invalid.");return isNaN(e)&&(e=0),isNaN(r)&&(r=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(u,l){o=o!=null?o:now(),s.progress=0,s.ended=!1,s.startTime=o,s.startVelocity=r,s.keyframes=t,s.duration=e,e===0?(s.progress=1,s.value=__assign({},t[t.length-1].value)):s.value=__assign({},t[0].value),s.callbacks=[u,l]})},n.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},n})(),easeInCubic=function(n){return n*n*n},easeInQuart=function(n){return n*n*n*n},APPEAR_ANIMATION_DURATION=500,versionMap$1=new WeakMap,scratchIntersectPoint=new THREE__namespace.Vector3,scratchClippingBoxMatrixInverse=new THREE__namespace.Matrix4,TileNode=(function(n){__extends(t,n);function t(e,r,o,s){s===void 0&&(s=noop);var u=n.call(this)||this;return u.name=e,u.materials=[],u.pbmObjects=[],u.contentObject=r,u.animations=o,u.appearMotion=new Motion({appear:0}),u.disposers=[s],u.add(r),r.traverse(function(l){if(l instanceof THREE__namespace.Mesh||l instanceof THREE__namespace.Points){var c=l.material;if(Array.isArray(c))for(var f=0;f<c.length;f++)u.materials.push(c[f]);else u.materials.push(c)}(l instanceof PBMMesh||l instanceof PBMSkinnedMesh||l instanceof PBMPointCloud)&&u.pbmObjects.push(l)}),u}return t.prototype.generateBvhTree=function(){return generateBvhTree(this,!0,200,20)},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=e.hitFilter;e.hitFilter=function(p){if(p.object instanceof PBMPointCloud&&p.object.material.pointBack==="HIDDEN"&&p.face&&p.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;var d=0,h=-1;if((p.object instanceof PBMMesh||p.object instanceof PBMSkinnedMesh||p.object instanceof PBMPointCloud)&&p.face){var g=Array.isArray(p.object.material)?p.object.material[p.face.materialIndex]:p.object.material;if(g){d=g.floorIndex,h=g.shownFloorIndex;for(var m=0,E=g.clippers;m<E.length;m++){var y=E[m];if(!(typeof y.floorIndex=="number"&&y.floorIndex!==d)&&(scratchClippingBoxMatrixInverse.getInverse(y.clippingBoxMatrix),scratchIntersectPoint.copy(p.point).applyMatrix4(scratchClippingBoxMatrixInverse),Math.abs(scratchIntersectPoint.x)<.5&&Math.abs(scratchIntersectPoint.y)<.5&&Math.abs(scratchIntersectPoint.z)<.5))return!1}}}var v=h;return e.floorIndex!==void 0?v=e.floorIndex:e.floor!==void 0&&(v=e.floor===null?-1:e.floor),v>=0&&d!==v?!1:(Object.assign(p,{floorIndex:d,floor:d}),s?s.call(e,p):!0)};for(var u=this.children.slice(),l;l=u.pop();)if(l.visible){l.raycast(e,o);for(var c=0,f=l.children.length;c<f;c++)u.push(l.children[c])}return e.hitFilter=s,sortIntersects(o,e.sortByDistance,e.firstHitOnly),o},t.prototype.update=function(e,r,o,s,u,l){var c=!1,f=s.visible&&u.state.selectedFrameNumber===u.tileset.frameNumber;if(f){var p=1;this.appearMotion.getTargetKeyframe().value.appear!==p&&this.appearMotion.set({appear:p},APPEAR_ANIMATION_DURATION).catch(noop)}else{var p=0;this.appearMotion.getTargetKeyframe().value.appear!==p&&this.appearMotion.set({appear:p},0).catch(noop)}this.appearMotion.ended!==!0&&this.appearMotion.update(r.time);for(var d=0,h=this.pbmObjects;d<h.length;d++){var g=h[d];if(g instanceof PBMMesh||g instanceof PBMSkinnedMesh){var m=updatePBMMesh(g,this.appearMotion,e,r,o,u,l);m===!0&&(c=!0)}else if(g instanceof PBMPointCloud){var m=updatePBMPointCloud(g,this.appearMotion,e,r,o,u,l);m===!0&&(c=!0)}}return c},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var o=r[e];o()}this.disposers.length=0,this.pbmObjects.length=0},t.prototype.clone=function(){return new t(this.name,this.contentObject.clone(),this.animations)},t})(THREE__namespace.Object3D);function updatePBMMesh(n,t,e,r,o,s,u){var l=!1;if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),l=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var c=n.material,f=0,p=c;f<p.length;f++){var d=p[f];d.customShaders=u.customShaders,d.pano0=u.pano0,d.pano1=u.pano1,d.pano0Depth=u.pano0Depth,d.pano1Depth=u.pano1Depth,d.refinedScreen=u.refinedScreen,d.modelAlpha=u.modelAlpha,d.progress=u.progress,d.transition=u.transition,d.opacity=u.opacity,d.floorStyle=u.floorStyle,d.constantColor=u.constantColor,d.shownFloorIndex=u.shownFloorIndex,d.clippers=u.clippers,d.brightness=u.brightness,d.useHQWeight=u.useHQWeight,d.useHQDepth=u.useHQDepth,d.colorSaturation=u.colorSaturation,d.colorBrightness=u.colorBrightness,d.gradientTexture=u.gradientTexture,d.vertexMarks=u.vertexMarks,d.modelBoundingMax.copy(u.boundingBox.max),d.modelBoundingMin.copy(u.boundingBox.min),d.shaderType==="none"?(d.transparent=!0,d.blending=THREE__namespace.NormalBlending,d.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,d.blendEquation=THREE__namespace.AddEquation,d.blendSrcAlpha=null,d.blendDstAlpha=null,d.blendEquationAlpha=null,d.depthWrite=!1,d.depthTest=!0):(d.transparent=d.alphaMode==="BLEND",d.blending=THREE__namespace.NormalBlending,d.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,d.blendEquation=THREE__namespace.AddEquation,d.blendSrcAlpha=null,d.blendDstAlpha=null,d.blendEquationAlpha=null,d.depthWrite=!0,d.depthTest=!0,u.useAddBlend&&(d.depthWrite=!1,d.depthTest=!1,d.blending=THREE__namespace.AdditiveBlending),d.shownFloorIndex>-1&&d.shownFloorIndex!==d.floorIndex&&(d.transparent=!0),d.opacity<1&&(d.transparent=!0),d.alphaMap&&(d.transparent=!0),d.brightness<1&&(d.transparent=!0),d.modelAlpha<=0&&(d.transparent=!1),d.depthWrite=!d.transparent,u.useAddBlend&&(d.depthWrite=!1,d.depthTest=!1,d.blending=THREE__namespace.AdditiveBlending))}}return l}function updatePBMPointCloud(n,t,e,r,o,s,u){var l,c,f=!1;if(u.pointAppearAnimation===!0&&s.refine==="ADD"&&s.tileset.rootMeta.pntsOrder==="RANDOM"){var p=n.geometry,d=s.tileset.currentMaxScreenSpaceError,h=s.state.screenSpaceError,g=(c=(l=s.parent)===null||l===void 0?void 0:l.state.screenSpaceError)!==null&&c!==void 0?c:h,m=1;g!==h&&(m=(g-d)/(g-h)),m=clamp$1(m,0,1),m=easeInCubic(m);var E=p.index?p.index.count:p.attributes.position?p.attributes.position.count:1/0,y=Math.floor(E*m*t.value.appear);p.drawRange.count!==y&&(p.setDrawRange(0,y),f=!0)}if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),f=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var v=[n.material],A=0,b=v;A<b.length;A++){var T=b[A];T.customShaders=u.customShaders,T.pointScale=u.pointScale,T.pointMinPixel=u.pointMinPixel,T.pointMaxPixel=u.pointMaxPixel,T.pointSize=u.pointSize,T.pointShape=u.pointShape,T.pointBack=u.pointBack,T.modelAlpha=u.modelAlpha,T.opacity=u.opacity,T.floorStyle=u.floorStyle,T.constantColor=u.constantColor,T.shownFloorIndex=u.shownFloorIndex,T.clippers=u.clippers,T.brightness=u.brightness,T.useHQWeight=u.useHQWeight,T.useHQDepth=u.useHQDepth,T.colorSaturation=u.colorSaturation,T.colorBrightness=u.colorBrightness,T.outlineGain=u.outlineGain,T.distanceGain=u.distanceGain,T.gradientTexture=u.gradientTexture,T.transparent=!1,T.blending=THREE__namespace.NormalBlending,T.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,T.blendEquation=THREE__namespace.AddEquation,T.blendSrcAlpha=null,T.blendDstAlpha=null,T.blendEquationAlpha=null,T.colorWrite=!0,T.depthWrite=!0,T.depthTest=!0,T.modelBoundingMax.copy(u.boundingBox.max),T.modelBoundingMin.copy(u.boundingBox.min),T.shownFloorIndex>-1&&(T.transparent=T.shownFloorIndex!==T.floorIndex),T.modelAlpha<1&&(T.transparent=!0),T.opacity<1&&(T.transparent=!0),T.brightness<1&&(T.transparent=!0),u.useAddBlend&&(T.depthWrite=!1,T.depthTest=!1,T.blending=THREE__namespace.AdditiveBlending),T.useHQWeight&&(T.depthWrite=!1,T.blending=THREE__namespace.CustomBlending,T.blendSrc=THREE__namespace.SrcAlphaFactor,T.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,T.blendDst=THREE__namespace.OneFactor,T.blendDstAlpha=THREE__namespace.OneFactor),T.useHQDepth&&(T.colorWrite=!1)}}return f}var Trajectory=(function(){function n(t,e,r){this.id=t,this.name=e.name,this.visible=!1,this.tileset=r,this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.transform.premultiply(this.tileset.root.transform),this.content={uri:e.file,byteLength:0,memoryUsage:0,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,data:void 0}}return n})(),TrajectoryNode=(function(n){__extends(t,n);function t(e,r,o){o===void 0&&(o=noop);var s=n.call(this)||this;return s.name=e,s.contentObject=r,s.name=e,s.add(r),s.disposers=[o],s}return t.prototype.update=function(e,r,o,s,u,l){var c=this.contentObject.material[2];return c.uniforms.dashOffset.value=(c.uniforms.dashOffset.value-.003)%(c.uniforms.dashSize.value.x+c.uniforms.dashSize.value.y),!0},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var o=r[e];o()}this.disposers.length=0},t.prototype.clone=function(){return new t(this.name,this.contentObject.clone())},t})(THREE__namespace.Object3D),priorityCache=new Map;function getPriority(n,t,e){if(e&&e.has(t))return e.get(t);var r=t.refine==="ADD"||n.skipLevelOfDetail,o=t.parent,s=o&&(!r||t.state.screenSpaceError===0),u=s?o.state.screenSpaceError:t.state.screenSpaceError,l=t.tileset.root?t.tileset.root.state.screenSpaceError:0,c=Math.max(l-u,0);return e&&e.set(t,c),c}var TileRequestScheduler=(function(){function n(t,e){this.tileset=t,this.options=e,this.activeRequests=0,this.requestQueue=[]}return n.prototype.reset=function(){for(var t=0,e=this.requestQueue;t<e.length;t++){var r=e[t];this.options.onTileSkip&&(r.tile.content&&this.tileset.options.tileUnloader(r.tile),this.options.onTileSkip(r.tile))}this.requestQueue.length=0},n.prototype.update=function(t,e,r){for(var o=this,s=r.time,u=this.requestQueue,l=new Set(t),c=0;c<u.length;c++){var f=u[c];if(l.has(f.tile)){l.delete(f.tile);continue}f.status==="WAITING"&&(u.splice(c,1),c--,this.options.onTileSkip&&this.options.onTileSkip(f.tile))}l.size>0&&(l.forEach(function(v){u.push({tile:v,status:"WAITING",time:s,error:null})}),l.clear());for(var p=r.maxRequests,c=0;c<u.length&&p>0;c++){var f=u[c];if(f.status==="DONE")f.error!==null?this.options.onTileError&&this.options.onTileError(f.tile,f.error):(p--,f.tile.content&&(f.tile.content.loadState="READY"),this.options.onTileLoad&&this.options.onTileLoad(f.tile)),u.splice(c,1),c--;else if(f.status==="PENDING"&&s-f.time<1e3)break}switch(priorityCache.clear(),e){case"SCREEN_SPACE_ERROR":{u.sort(function(v,A){if(v.tile.state.requestedFrameNumber!==A.tile.state.requestedFrameNumber)return A.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber;if(v.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(r,v.tile,priorityCache),T=getPriority(r,A.tile,priorityCache);return b-T}else return v.tile.level!==A.tile.level?v.tile.level-A.tile.level:v.tile.state.distanceToCamera-A.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(v,A){return v.tile.state.requestedFrameNumber!==A.tile.state.requestedFrameNumber?A.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.state.centerScreenY!==A.tile.state.centerScreenY?v.tile.state.centerScreenY-A.tile.state.centerScreenY:v.tile.state.centerZDepth!==A.tile.state.centerZDepth?v.tile.state.centerZDepth-A.tile.state.centerZDepth:v.tile.level!==A.tile.level?v.tile.level-A.tile.level:v.tile.state.distanceToCamera-A.tile.state.distanceToCamera:v.tile.level!==A.tile.level?v.tile.level-A.tile.level:v.tile.state.distanceToCamera-A.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(v,A){return v.tile.state.requestedFrameNumber!==A.tile.state.requestedFrameNumber?A.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.level!==A.tile.level?v.tile.level-A.tile.level:v.tile.state.centerScreenY!==A.tile.state.centerScreenY?v.tile.state.centerScreenY-A.tile.state.centerScreenY:v.tile.state.centerZDepth!==A.tile.state.centerZDepth?v.tile.state.centerZDepth-A.tile.state.centerZDepth:v.tile.state.distanceToCamera-A.tile.state.distanceToCamera:v.tile.level!==A.tile.level?v.tile.level-A.tile.level:v.tile.state.distanceToCamera-A.tile.state.distanceToCamera});break}}if(p=Math.max(r.maxRequests-this.activeRequests,0),!r.skipLevelOfDetail)for(var d=0,h=u.length,c=0;c<h;c++){var g=u[c].tile;if(g.hasTilesetContent||g.contentParent===null||g.contentParent.state.selectedFrameNumber===r.frameNumber){var m=u.splice(c,1);u.splice.apply(u,__spreadArray([d++,0],m,!1))}}for(var E=function(v){var A=u[v];A.status==="WAITING"&&(p--,A.status="PENDING",A.time=s,y.activeRequests++,y.tileset.options.tileLoader(A.tile).catch(function(b){A.error=b}).then(function(){A.status="DONE",A.tile.content&&A.tile.content.loadState==="READY"&&(A.tile.content.loadState="LOADING"),o.activeRequests--}))},y=this,c=0;c<u.length&&p>0;c++)E(c)},n})(),CacheNode=(function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n})(),CacheNodeList=(function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n})(),TileCache=(function(){function n(t){t===void 0&&(t={}),this.options=t,this.cacheNodeMap=new WeakMap,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touchTile=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.loadTile=function(t){if(!this.cacheNodeMap.has(t)){var e=this.list.add(t);this.cacheNodeMap.set(t,e),this.options.onTileLoad&&this.options.onTileLoad(t)}},n.prototype.unloadTile=function(t){var e=this.cacheNodeMap.get(t);e&&(this.list.remove(e),this.cacheNodeMap.delete(t),this.options.onTileUnload&&this.options.onTileUnload(t))},n.prototype.unloadTiles=function(t){for(var e=this.list.head;e!==this.sentinel&&t();){var r=e.item;e=e.next,this.unloadTile(r)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var o=r[e];o.item!=="sentinel"&&t.push(o.item)}return t},n})(),ManagedArray=(function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),this.array[this._length]=void 0,t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n.prototype.peek=function(){return this.array[this._length-1]},n})(),TilesetBaseTraverser=(function(){function n(t){this.tileset=t,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new ManagedArray}return n.prototype.traverse=function(t,e,r){this.reset()},n.prototype.reset=function(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e),t.state.shouldSelect=!1,t.state.finalResolution=!0},n.prototype.selectTile=function(t,e){var r=t.contentAvailable&&this._canSelectTile;r&&t.state.selectedFrameNumber<e.frameNumber&&(t.state.selectedFrameNumber=e.frameNumber,this.tileset.selectedTiles.push(t),this.tileset.needsRefinedTiles.add(t))},n.prototype.loadTile=function(t,e){t.state.requestedFrameNumber<e.frameNumber&&(t.state.requestedFrameNumber=e.frameNumber,t.content&&(t.content.loadState==="FAILED"&&e.time-t.content.loadStateUpdateTime>t.content.loadfailRetryDelay&&(t.content.loadState="UNLOADED",t.content.loadStateUpdateTime=e.time),t.content.loadState==="UNLOADED"&&this.tileset.requestedTiles.push(t))),this.tileset.needsRefinedTiles.add(t)},n.prototype.touchTile=function(t,e){this.tileset.cache.touchTile(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e){return!t.state.inRequestVolume||t.hasRenderContent&&(t.levelOfContent>=e.maxLevelOfDetail||t.levelOfContent>=0&&t.geometricError<=e.minGeometricError)||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.geometricError>=e.maxGeometricError||t.hasTilesetContent?!0:t.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var o=t.children[0];this.updateTileVisibility(o,e),t.state.visible=o.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}var s=t.refine==="REPLACE";if(s&&r&&!this.anyChildrenVisible(t,e)){t.state.visible=!1;return}}},n.prototype.anyChildrenVisible=function(t,e){for(var r=!1,o=t.children,s=0,u=o;s<u.length;s++){var l=u[s];l.updateState(e),r=r||l.state.visible}return r},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"||r.levelOfContent<e.minLevelOfDetail||r.geometricError>e.maxGeometricError?!1:r.levelOfContent>e.maxLevelOfDetail||r.levelOfContent>=0&&r.geometricError<e.minGeometricError?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError},n.prototype.sortTilesByDistanceToCamera=function(t){t.sort(function(e,r){return r.state.distanceToCamera===0&&e.state.distanceToCamera===0?r.state.centerZDepth-e.state.centerZDepth:r.state.distanceToCamera-e.state.distanceToCamera})},n})(),TilesetNormalTraverser=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r._traversalStack=new ManagedArray,r._emptyTraversalStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,o){o===void 0&&(o=[]),n.prototype.traverse.call(this,e,r,o);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),this._emptyTraversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,this.updateTile(e,l),this.executeTraversal(e,l))}this._traversalStack.reset(),this._emptyTraversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._emptyTraversalStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&o.push(e);o.length>0;){var s=o.pop(),u=s.parent,l=!u||u.state.shouldRefine,c=!1;this.canTraverse(s,r)&&(c=this.updateAndPushChildren(s,r,o)&&l);var f=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)):(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)),this.touchTile(s,r),s.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0,l=s;u<l.length;u++){var c=l[u];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(s);for(var f=e.refine==="REPLACE"&&e.hasRenderContent,p=!1,d=!0,h=0,g=s;h<g.length;h++){var c=g[h];if(c.levelOfContent<=r.minLevelOfDetail||c.geometricError>=r.maxGeometricError||c.state.visible&&c.state.inRequestVolume?(o.find(c)&&o.delete(c),o.push(c),p===!1&&(p=!0)):(f||r.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),f){var m=void 0;c.state.inRequestVolume?c.hasRenderContent?m=c.contentAvailable:m=this.executeEmptyTraversal(c,r):m=!1,d=d&&m}}return p||(d=!1),d},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t.prototype.executeEmptyTraversal=function(e,r){var o=!0,s=this._emptyTraversalStack;for(s.push(e);s.length>0&&o;){var u=s.pop(),l=!u.hasRenderContent&&this.canTraverse(u,r);if(!l&&!u.contentAvailable&&(o=!1),this.updateTile(u,r),u.state.visible||(this.loadTile(u,r),this.touchTile(u,r)),l)for(var c=u.children,f=0,p=c;f<p.length;f++){var d=p[f];s.find(d)&&s.delete(d),s.push(d)}}return o},t})(TilesetBaseTraverser),TilesetSkipTraverser=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.baseScreenSpaceError=1024,r.skipScreenSpaceErrorFactor=16,r.skipLevels=1,r._traversalStack=new ManagedArray,r._descendantTraversalStack=new ManagedArray,r._selectionTraversalStack=new ManagedArray,r._selectionTraversalancestorStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,o){o===void 0&&(o=[]),n.prototype.traverse.call(this,e,r,o);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,this.updateTile(e,l),this.executeTraversal(e,l),this.traverseAndSelect(e,l))}this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r),this.traverseAndSelect(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&o.push(e);o.length>0;){var s=o.pop();this.updateTileAncestorContentLinks(s,r);var u=s.parent,l=!u||u.state.shouldRefine,c=!1;this.canTraverse(s,r)&&(c=this.updateAndPushChildren(s,r,o)&&l);var f=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.inBaseTraversal(s,this.baseScreenSpaceError)?(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)):f?(this.loadTile(s,r),this.selectDesiredTile(s,r)):this.reachedSkippingThreshold(s)&&this.loadTile(s,r)):(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)),this.touchTile(s,r),s.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0,l=s;u<l.length;u++){var c=l[u];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(s);for(var f=!1,p=0,d=s;p<d.length;p++){var c=d[p];c.levelOfContent<=r.minLevelOfDetail||c.geometricError>=r.maxGeometricError||c.state.visible&&c.state.inRequestVolume?(o.push(c),f===!1&&(f=!0)):r.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return f},t.prototype.selectDesiredTile=function(e,r){var o=e.contentAvailable?e:e.state.ancestorWithContentAvailable;o&&(o.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,r)},t.prototype.selectDescendants=function(e,r){var o=this._descendantTraversalStack;for(o.push(e);o.length>0;)for(var s=o.pop(),u=s.children,l=0,c=u;l<c.length;l++){var f=c[l];f.state.visible&&(f.contentAvailable?(this.updateTile(f,r),this.touchTile(f,r),this.selectTile(f,r)):o.push(f))}},t.prototype.reachedSkippingThreshold=function(e){var r=e.state.ancestorWithContent,o=r!==null&&e.state.screenSpaceError<r.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>r.levelOfContent+this.skipLevels;return o},t.prototype.updateTileAncestorContentLinks=function(e,r){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;var o=e.parent;if(o){var s=!(o.hasRenderContent&&o.hasUnloadedContent)||o.state.requestedFrameNumber===r.frameNumber;e.state.ancestorWithContent=s?o:o.state.ancestorWithContent,e.state.ancestorWithContentAvailable=o.contentAvailable?o:o.state.ancestorWithContentAvailable}},t.prototype.inBaseTraversal=function(e,r){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>r:e.state.screenSpaceError>r:!0},t.prototype.traverseAndSelect=function(e,r){var o=this._selectionTraversalStack,s=this._selectionTraversalancestorStack,u;for(o.push(e);o.length>0||s.length>0;){if(s.length>0){var l=s.peek();if(l.state.stackLength===o.length){s.pop(),l!==u&&(l.state.finalResolution=!1),this.selectTile(l,r);continue}}var c=o.pop();if(c){var f=this.canTraverse(c,r);if(c.state.shouldSelect)if(c.refine==="ADD")this.selectTile(c,r);else{if(c.state.selectionDepth=s.length,c.state.selectionDepth>0&&(c.tileset.hasMixedContent=!0),u=c,!f){this.selectTile(c,r);continue}s.push(c),c.state.stackLength=o.length}if(f)for(var p=0,d=c.children;p<d.length;p++){var h=d[p];h.state.visible&&o.push(h)}}}},t})(TilesetBaseTraverser),TilesetMostDetailTraverser=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r._traversalStack=new ManagedArray,r}return t.prototype.canTraverse=function(e,r){return!(!e.state.inRequestVolume||e.levelOfContent>=r.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=r.minGeometricError||e.children.length===0)},t.prototype.traverse=function(e,r,o){n.prototype.traverse.call(this,e,r,[]),this._traversalStack.reset(),e.updateState(r);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,e.updateState(l),this.executeTraversal(e,l))}this._traversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,e.updateState(r),this.executeTraversal(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(o.push(e);o.length>0;){var s=o.pop(),u=s.refine==="ADD",l=s.refine==="REPLACE",c=this.canTraverse(s,r);c&&this.updateAndPushChildren(s,r,o),(u||l&&!c)&&(this.loadTile(s,r),this.touchTile(s,r),this.selectDesiredTile(s,r))}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0;u<s.length;++u){var l=s[u];l.updateState(r),l.state.visible&&o.push(l)}},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t})(TilesetBaseTraverser),Tileset=(function(){function n(t,e){var r=this,o,s,u,l,c,f,p;if(this.id=t.tilesetUrl,this.transform=new THREE__namespace.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.asset={version:t.asset.version,tilesetVersion:t.asset.tilesetVersion||"",gltfUpAxis:(o=t.asset.gltfUpAxis)!==null&&o!==void 0?o:"Y",overview:t.asset.overview,trajectories:(u=(s=t.asset.trajectories)===null||s===void 0?void 0:s.list)!==null&&u!==void 0?u:[],extras:t.asset.extras},this.rootMeta=(l=t.rootMeta)!==null&&l!==void 0?l:{},this.pointLength=(c=this.rootMeta.numTotalPoints)!==null&&c!==void 0?c:1/0,this.floorLength=(f=this.rootMeta.numFloors)!==null&&f!==void 0?f:1,this.properties=(p=t.properties)!==null&&p!==void 0?p:{},this.options=e,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new TilesetNormalTraverser(this),this.skipTraverser=new TilesetSkipTraverser(this),this.mostDetailTraverser=new TilesetMostDetailTraverser(this),this.cache=new TileCache({onTileLoad:function(g){r.cacheMemoryUsageInBytes+=g.contentMemoryUsage},onTileUnload:function(g){r.cacheMemoryUsageInBytes-=g.contentMemoryUsage,r.unloadTiles.push(g)}}),this.requestScheduler=new TileRequestScheduler(this,{onTileSkip:function(g){},onTileLoad:function(g){var m;!((m=g.content)===null||m===void 0)&&m.data&&(r.loadedTiles.add(g),r.cache.loadTile(g)),r.options.onTileLoad(g)},onTileError:function(g,m){r.options.onTileError(g,m)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new Tile("".concat(this.id,"#tile:0"),t.root,this),this.geometricError=t.geometricError,this.trajectories=[],this.asset.trajectories)for(var d=0;d<this.asset.trajectories.length;d++){var h=new Trajectory("".concat(this.id,"#trajectory:").concat(d),this.asset.trajectories[d],this);this.trajectories.push(h)}}return n.prototype.adjustScreenSpaceError=function(t){if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=t.maxScreenSpaceError),t.memoryAdjustedScreenSpaceError){var e=0,r=0,o=0;if(this.needsRefinedTiles.forEach(function(h){h.content&&(r++,e+=h.content.memoryUsage,h.content.loadState==="READY"&&o++)}),o<2||r<2)this.currentMaxScreenSpaceError=t.maxScreenSpaceError;else{var s=1048576,u=e/o*r,l=t.maxMemoryUsage*s,c=l-clamp$1(l*.1,8*s,64*s),f=this.currentMaxScreenSpaceError;if(u<c){var p=1-u/c,d=.5*p;f-=d}else if(u>l){var d=.3;f+=d}f=clamp$1(f,1,t.maxScreenSpaceError),Math.abs(f-this.currentMaxScreenSpaceError)>=.1&&(this.currentMaxScreenSpaceError=f)}}else this.currentMaxScreenSpaceError=t.maxScreenSpaceError},n.prototype.getTraverser=function(t){return t.mostDetail?this.mostDetailTraverser:t.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},n.prototype.reset=function(){var t=this;this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();for(var e=[this.root],r;r=e.pop();){for(var o=0,s=r.children.length;o<s;o++)e.push(r.children[o]);this.cache.unloadTile(r)}for(var u=function(){var p=l.unloadTiles.pop();p&&(l.loadedTiles.delete(p),l.cacheMemoryUsageInBytes-=p.contentMemoryUsage,l.options.tileUnloader(p).catch(function(){}).then(function(){t.options.onTileUnload&&t.options.onTileUnload(p)}))},l=this;this.unloadTiles.length;)u();this.loadedTiles.clear();for(var c=function(){var p=f.trajectories.pop();p&&f.options.trajectoryUnloader(p).catch(function(){}).then(function(){t.options.onTrajectoryUnload&&t.options.onTrajectoryUnload(p)})},f=this;this.trajectories.length;)c()},n.prototype.update=function(t,e){var r=this,o;e===void 0&&(e=[]),this.frameNumber=t.frameNumber,this.adjustScreenSpaceError(t),this.cache.reset(),this.getTraverser(t).traverse(this.root,t,e),this.cache.unloadTiles(function(){var h=r.cacheMemoryUsageInBytes>t.maxMemoryUsage*1024*1024;return h}),this.requestScheduler.update(this.requestedTiles,t.requestOrder,t);for(var s=function(){var h=u.unloadTiles.pop();h&&(u.loadedTiles.delete(h),u.options.tileUnloader(h).catch(function(){}).then(function(){r.options.onTileUnload&&r.options.onTileUnload(h)}))},u=this;this.unloadTiles.length;)s();this.selectedTrajectories.length=0;for(var l=function(h){h.visible===!0&&h.content.loadState==="READY"&&(!((o=h.content.data)===null||o===void 0)&&o.object)?c.selectedTrajectories.push(h):h.visible===!0&&(h.content.loadState==="FAILED"&&t.time-h.content.loadStateUpdateTime>h.content.loadfailRetryDelay&&(h.content.loadState="UNLOADED",h.content.loadStateUpdateTime=t.time),h.content.loadState==="UNLOADED"&&c.options.trajectoryLoader(h).then(function(){r.options.onTrajectoryLoad(h)}).catch(function(g){r.options.onTrajectoryError(h,g)}))},c=this,f=0,p=this.trajectories;f<p.length;f++){var d=p[f];l(d)}},n})();function normalizeTileHeader(n,t){var e;if(n.content){var r=(e=n.content.uri)!==null&&e!==void 0?e:n.content.url;typeof r=="string"&&!isAbsoluteURL(r)&&(n.content.uri=normalizeURL(pathJoin(t,r)))}if(n.transform){for(var o=!1,s=0;s<16;s++){var u=n.transform[s];if(typeof u!="number"||isNaN(u)||!isFinite(u)){o=!0;break}}if(n.transform[15]===0&&(o=!0),o)throw new Error("Invalid Tile Transform: "+JSON.stringify(n.transform))}if(n.children)for(var l=0,c=n.children;l<c.length;l++){var f=c[l];normalizeTileHeader(f,t)}return n}function normalizeTilesetHeader(n,t){n.tilesetUrl=t;var e=/^blob\:/.test(t)?"":t.slice(0,t.lastIndexOf("/")+1);if(n.asset||(n.asset={}),n.rootMeta||(n.rootMeta={}),n.rootMeta.taskParameters||(n.rootMeta.taskParameters={}),n.asset.overview){var r=n.asset.overview;isAbsoluteURL(r.imageFile)||(r.imageFile=normalizeURL(pathJoin(e,r.imageFile))),isAbsoluteURL(r.worldFile)||(r.worldFile=normalizeURL(pathJoin(e,r.worldFile)))}if(n.asset.trajectories)for(var o=0;o<n.asset.trajectories.list.length;o++){var s=n.asset.trajectories.list[o];s.file=normalizeURL(pathJoin(e,s.file))}return normalizeTileHeader(n.root,e),n}function delay(n){return new Promise(function(t){return setTimeout(t,n)})}var AsyncTaskQueue=(function(){function n(t){this.queue=[],this.concurrency=t,this.dequeuing=0}return n.prototype.add=function(t,e){e===void 0&&(e=1e3);var r,o,s=new Promise(function(l,c){r=l,o=c}),u=function(){var l=Promise.resolve().then(t);l.then(r,o);var c=delay(e);return Promise.race([l,c]).then(noop,noop)};return this.queue.unshift(u),this.dequeue(),s},n.prototype.dequeue=function(){for(var t=this;this.dequeuing<this.concurrency&&this.queue.length>0;){var e=this.queue.pop();this.dequeuing++,e().catch(noop).then(function(){t.dequeuing--,t.dequeue()})}},n})(),initTextureQueue=new AsyncTaskQueue(1),skipImageSize=256;function canInit(n){return typeof n.image=="object"&&n.image.width>0&&n.image.height>0}function initTexture(n,t){if(!canInit(n))return Promise.resolve(n);if(n.image.width<skipImageSize&&n.image.width<skipImageSize)return t.initTexture(n),Promise.resolve(n);var e=!1,r=function(){e=!0,n.removeEventListener("dispose",r)};return n.addEventListener("dispose",r),initTextureQueue.add(function(){return new Promise(function(o){AnimationFrameLoop.shared.add(function(){canInit(n)&&e===!1&&t.initTexture(n),n.removeEventListener("dispose",r),o(n)},!0)})})}function initTextures(n,t){return Promise.all(n.map(function(e){return initTexture(e,t)}))}var _object_pattern=/^[og]\s*(.+)?/,_material_library_pattern=/^mtllib /,_material_use_pattern=/^usemtl /,_map_use_pattern=/^usemap /,_face_vertex_data_separator_pattern=/\s+/,_color=new THREE__namespace.Color,ObjState=(function(){function n(){this.objects=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materials={},this.materialLibraries=[],this.startObject("",!1)}return n.prototype.startObject=function(t,e){if(this.object&&this.object.fromDeclaration===!1){this.object.name=t,this.object.fromDeclaration=e!==!1;return}var r=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:e!==!1,geometry:{vertices:[],hasNormal:!0,normals:[],hasColor:!0,colors:[],hasUV:!0,uvs:[],index:[],indexMap:{}},materials:[],smooth:!0,startMaterial:function(s,u){var l,c,f=this._finalize(!1);f&&(f.inherited||((l=f.groupCount)!==null&&l!==void 0?l:0)<=0)&&this.materials.splice((c=f.index)!==null&&c!==void 0?c:0,1);var p={index:this.materials.length,name:s||"",mtllib:Array.isArray(u)&&u.length>0?u[u.length-1]:"",smooth:f!==void 0?f.smooth:this.smooth,groupStart:f!==void 0?f.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(d){var h={index:typeof d=="number"?d:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(){return this}};return h.clone=this.clone.bind(h),h}};return this.materials.push(p),p},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(s){var u,l,c=this.currentMaterial();if(c&&c.groupEnd===-1&&(c.groupEnd=this.geometry.index.length,c.groupCount=c.groupEnd-((u=c.groupStart)!==null&&u!==void 0?u:0),c.inherited=!1),s&&this.materials.length>1)for(var f=this.materials.length-1;f>=0;f--)((l=this.materials[f].groupCount)!==null&&l!==void 0?l:0)<=0&&this.materials.splice(f,1);return s&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),c}},r&&r.name&&typeof r.clone=="function"){var o=r.clone(0);o.inherited=!0,this.object.materials.push(o)}this.objects.push(this.object)},n.prototype.finalize=function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},n.prototype.parseVertexIndex=function(t,e){var r=parseInt(t,10);return(r>=0?r-1:r+e/3)*3},n.prototype.parseNormalIndex=function(t,e){var r=parseInt(t,10);return(r>=0?r-1:r+e/3)*3},n.prototype.parseUVIndex=function(t,e){var r=parseInt(t,10);return(r>=0?r-1:r+e/2)*2},n.prototype.addFace=function(t,e,r,o,s,u,l,c,f){var p=this.object.geometry,d=this.vertices.length,h=this.normals.length,g=this.uvs.length,m=this.parseVertexIndex(t,d),E=this.parseVertexIndex(e,d),y=this.parseVertexIndex(r,d),v=l!==void 0?this.parseNormalIndex(l,h):void 0,A=c!==void 0?this.parseNormalIndex(c,h):void 0,b=f!==void 0?this.parseNormalIndex(f,h):void 0,T=o!==void 0?this.parseUVIndex(o,g):void 0,_=s!==void 0?this.parseUVIndex(s,g):void 0,S=u!==void 0?this.parseUVIndex(u,g):void 0;(p.hasNormal===!0&&v===void 0||A===void 0||b===void 0)&&(p.hasNormal=!1),(p.hasUV===!0&&T===void 0||_===void 0||S===void 0)&&(p.hasUV=!1);var w=[m,T,v].join(":"),R=p.indexMap[w];R===void 0&&(R=p.vertices.length/3,p.indexMap[w]=R,p.vertices.push(this.vertices[m+0],this.vertices[m+1],this.vertices[m+2]),p.hasColor&&(this.colors[m]===void 0?p.hasColor=!1:p.colors.push(this.colors[m+0],this.colors[m+1],this.colors[m+2])),p.hasNormal&&p.normals.push(this.normals[m+0],this.normals[m+1],this.normals[m+2]),p.hasUV&&p.uvs.push(this.uvs[T+0],this.uvs[T+1])),p.index.push(R);var I=[E,_,A].join(":"),H=p.indexMap[I];H===void 0&&(H=p.vertices.length/3,p.indexMap[I]=H,p.vertices.push(this.vertices[E+0],this.vertices[E+1],this.vertices[E+2]),p.hasColor&&(this.colors[E]===void 0?p.hasColor=!1:p.colors.push(this.colors[E+0],this.colors[E+1],this.colors[E+2])),p.hasNormal&&p.normals.push(this.normals[E+0],this.normals[E+1],this.normals[E+2]),p.hasUV&&p.uvs.push(this.uvs[_+0],this.uvs[_+1])),p.index.push(H);var C=[y,S,b].join(":"),M=p.indexMap[C];M===void 0&&(M=p.vertices.length/3,p.indexMap[C]=M,p.vertices.push(this.vertices[y+0],this.vertices[y+1],this.vertices[y+2]),p.hasColor&&(this.colors[y]===void 0?p.hasColor=!1:p.colors.push(this.colors[y+0],this.colors[y+1],this.colors[y+2])),p.hasNormal&&p.normals.push(this.normals[y+0],this.normals[y+1],this.normals[y+2]),p.hasUV&&p.uvs.push(this.uvs[S+0],this.uvs[S+1])),p.index.push(M)},n})();function parseObj(n){var t=new ObjState;n.indexOf(`\r
|
|
920
920
|
`)!==-1&&(n=n.replace(/\r\n/g,`
|
|
921
921
|
`)),n.indexOf(`\\
|
|
@@ -2347,4 +2347,4 @@ void main() {
|
|
|
2347
2347
|
#include <premultiplied_alpha_fragment>
|
|
2348
2348
|
|
|
2349
2349
|
}
|
|
2350
|
-
`},LineMaterial=(function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(o){this.uniforms.diffuse.value=o}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(o){this.uniforms.linewidth.value=o}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(o){this.uniforms.dashScale.value=o}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(o){this.uniforms.dashSize.value=o}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(o){this.uniforms.gapSize.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}}}),r.setValues(e),r}return t})(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this)||this;return o.type="LineSegments2",o.geometry=e!==void 0?e:new LineSegmentsGeometry,o.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),o}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,o=e.attributes.instanceEnd,s=new Float32Array(2*r.count),u=new THREE__namespace.Vector3,l=new THREE__namespace.Vector3,c=0,f=0,p=r.count;c<p;c++,f+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[f]=f===0?0:s[f-1],s[f+1]=s[f]+u.distanceTo(l);var d=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(d,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(d,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var o=e.ray,s=e.camera,u=s.projectionMatrix,l=this.geometry,c=this.material,f=c.resolution,p=c.linewidth,d=l.attributes.instanceStart,h=l.attributes.instanceEnd,g=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,E=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,A=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,E),E.w=1,E.applyMatrix4(s.matrixWorldInverse),E.applyMatrix4(u),E.multiplyScalar(1/E.w),E.x*=f.x/2,E.y*=f.y/2,E.z=0,y.copy(E);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){g.fromBufferAttribute(d,_),m.fromBufferAttribute(h,_),g.w=1,m.w=1,g.applyMatrix4(v),m.applyMatrix4(v),g.applyMatrix4(u),m.applyMatrix4(u),g.multiplyScalar(1/g.w),m.multiplyScalar(1/m.w);var w=g.z<-1&&m.z<-1,R=g.z>1&&m.z>1;if(!(w||R)){g.x*=f.x/2,g.y*=f.y/2,m.x*=f.x/2,m.y*=f.y/2,A.start.copy(g),A.start.z=0,A.end.copy(m),A.end.z=0;var I=A.closestPointToPointParameter(y,!0);A.at(I,b);var H=THREE__namespace.MathUtils.lerp(g.z,m.z,I),C=H>=-1&&H<=1,M=y.distanceTo(b)<p*.5;if(C&&M){A.start.fromBufferAttribute(d,_),A.end.fromBufferAttribute(h,_),A.start.applyMatrix4(T),A.end.applyMatrix4(T);var B=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;o.distanceSqToSegment(A.start,A.end,L,B),r.push({point:L,pointOnLine:B,distance:o.origin.distanceTo(L),object:this,faceIndex:_})}}}},t})(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.type="Line2",o}return t})(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setPositions.call(this,o),this},t.prototype.setColors=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setColors.call(this,o),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t})(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=(function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var o=n.call(this)||this;o.type="FiveLine",o.needsRender=!0;var s=new LineGeometry,u=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});o.line=new Line2(s,u);var l=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return o.points=new THREE__namespace.Points(l,c),o.points.renderOrder=11,o.points.frustumCulled=!1,o.setPoints(e,r),o.add(o.line,o.points),o}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.32"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var o=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(o),3)),this.line.geometry.setPositions(o),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o];o==="dashed"?(r.dashed=s,s?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[o]=e[o]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var o=this.line.material.resolution;(o.x!==e||o.y!==r)&&(o.set(e,r),this.needsRender=!0)},t})(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,f,p,d;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(h){switch(h.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(u=h.sent(),e.profiles.some(function(g){var m=u[g];return m&&(l={profileId:g,profilePath:"".concat(r,"/").concat(m.path),deprecated:!!m.deprecated}),!!l}),!l){if(!o)throw new Error("No matching profile name found");if(c=u[o],!c)throw new Error('No matching profile name found and default profile "'.concat(o,'" missing.'));l={profileId:o,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(l.profilePath)];case 2:if(f=h.sent(),s){if(d=void 0,d=f.layouts[e.handedness],!d)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));d.assetPath&&(p=l.profilePath.replace("profile.json",d.assetPath))}return[2,{profile:f,assetPath:p}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,o=Math.sqrt(n*n+t*t);if(o>1){var s=Math.atan2(t,n);e=Math.cos(s),r=Math.sin(s)}var u={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return u}var VisualResponse=(function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,o=t.button,s=t.state,u=normalizeAxes(e,r),l=u.normalizedXAxis,c=u.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?l:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(s)?o:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n})(),Component=(function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(o){var s=new VisualResponse(e.visualResponses[o]);r.visualResponses[o]=s}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(o){o.updateFromComponent(e.values)})},n})(),MotionController=(function(){function n(t,e,r){var o=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(s){var u=o.layoutDescription.components[s];o.components[s]=new Component(s,u)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n})(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(o){o instanceof THREE__namespace.Mesh&&o.isMesh&&(o.material.envMap=r.envMap,o.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(o){var s=o.valueNode,u=o.minNode,l=o.maxNode,c=o.value,f=o.valueNodeProperty;s&&(f===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:f===Constants.VisualResponseProperty.TRANSFORM&&(s.quaternion.copy(u.quaternion).slerp(l.quaternion,c),s.position.lerpVectors(u.position,l.position,c)))})}))},t})(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,o=e.touchPointNodeName,s=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(o),e.touchPointNode){var u=new THREE.SphereGeometry(.001),l=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(u,l);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(s).forEach(function(f){var p=f.valueNodeName,d=f.minNodeName,h=f.maxNodeName,g=f.valueNodeProperty;if(g===Constants.VisualResponseProperty.TRANSFORM){if(f.minNode=t.getObjectByName(d),f.maxNode=t.getObjectByName(h),!f.minNode){console.warn("Could not find ".concat(d," in the model"));return}if(!f.maxNode){console.warn("Could not find ".concat(h," in the model"));return}}f.valueNode=t.getObjectByName(p),f.valueNode||console.warn("Could not find ".concat(p," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=(function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,o=null;return t.addEventListener("connected",function(s){var u=s.data;u.targetRayMode!=="tracked-pointer"||!u.gamepad||fetchProfile(u,e.path,DEFAULT_PROFILE).then(function(l){var c=l.profile,f=l.assetPath;r.motionController=new MotionController(u,c,f);var p=e._assetCache[r.motionController.assetUrl];if(p)o=p.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(d){e._assetCache[r.motionController.assetUrl]=d,o=d.scene.clone(),addAssetSceneToControllerModel(r,o)})}}).catch(function(l){console.warn(l)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(o),o=null}),r},n})(),defaultXRPanoramaControllerInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"]));function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,scratchRaycaster=new THREE__namespace.Raycaster,scratchVector3=new THREE__namespace.Vector3,XRPanoramaController=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.left.firstHitOnly=!0,r.xrControllerRay.left.floorIndex=-1,r.xrControllerRay.right.params.Points={threshold:.1},r.xrControllerRay.right.firstHitOnly=!0,r.xrControllerRay.right.floorIndex=-1,r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var s=r.xrManager.getController(1);r.controllerWrappers[1].add(s);var u=new XRControllerModelFactory;u.gltfLoader={load:function(c,f){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(p){var d;return parseGltf(p.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(d=c.split("?")[1])!==null&&d!==void 0?d:"",fetcher:internalFetcher})}).then(function(p){return f(p)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",effectEasing:defaultEffectEase,fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var l=AnimationFrameLoop.shared.getContext();return l?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(l),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(u.createControllerModel(c)),r.controllerWrappers[0].add(c);var f=r.xrManager.getControllerGrip(1);f.add(u.createControllerModel(f)),r.controllerWrappers[1].add(f)}),r.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"XRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),d=this.works.getObserver(e);if(!d)throw new Error("Invalid PanoIndex");getImageSizeFromURL(d.images.up),this.imageOptions.size;var h=this.imageOptions.transform,g=function(I,H){return mapPanoResource(applyImageURLOptions(I,h,H))},m=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality"])),E={right:d.images.work.getURL(d.images.right),left:d.images.work.getURL(d.images.left),up:d.images.work.getURL(d.images.up),down:d.images.work.getURL(d.images.down),front:d.images.work.getURL(d.images.front),back:d.images.work.getURL(d.images.back)},y="pano:"+jsonHash([E,m,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===y)return;var v=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(v))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:e}))}var A=this.modelScene.parameter.resolveValue(),b=A.pano0,T=A.pano1,_;if((b==null?void 0:b.map.name)===y?_=b:(T==null?void 0:T.map.name)===y&&(_=T),_){var S={panoId:p,effect:f,effectEasing:(c=r.effectEasing)!==null&&c!==void 0?c:defaultEffectEase,leftPanoPicture:{panoId:_.panoId,map:_.map,mapSize:_.mapSize,matrix:d.matrix.clone().premultiply(d.work.transform),zoom:1},position:d.position.clone().applyMatrix4(d.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,S,r);return}var w="move-to-pano-"+p;this.pending.add(w),this.pendingTextureTask={panoId:p,hash:y,onLoad:function(I){var H,C,M=I.body;if(s.destroyed)M.dispose();else{M.name=y;var B=Array.isArray(M.image)?M.image[0]:M.image,L=(H=B==null?void 0:B.width)!==null&&H!==void 0?H:2048,O={panoId:p,effect:f,effectEasing:(C=r.effectEasing)!==null&&C!==void 0?C:defaultEffectEase,leftPanoPicture:{panoId:p,map:M,mapSize:L,matrix:d.matrix.clone(),zoom:1},position:d.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,O,r)}},onError:function(I){var H=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:I,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),r.moveCancelCallback&&r.moveCancelCallback()}};var R=this.panoMeshes.get(p);R&&R.tap&&R.tap(),this.textureLoader.loadCubeTexture(E,{imageURL:{transform:g,options:m},format:THREE__namespace.RGBFormat,fetcher:getFetcher(this.fiveId,d.work)},void 0,void 0,function(I){var H,C;((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&((C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(I)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:I,meta:null,pano:e}))},this.renderer).then(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y?(s.pendingTextureTask.onLoad(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)):I.body.dispose(),s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:I.meta,pano:e}))}).catch(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&(s.pendingTextureTask.onError(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)),s.emit("pano.texture.error",createEvent("pano.texture.error",{error:I,progress:0,meta:null,pano:e})),s.emit("error",I)}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,m,E;o===void 0&&(o={});var y=now(),v=createUuid();this.panoResources[v]=r;var A=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(y);S[0];var w=S[1],R=this.locationMotion.value,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position;b=Math.max(I.distanceTo(H),A),T=[{key:w.key,progress:0,value:__assign(__assign({},R),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(y),M=C[0],w=C[1],R=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(M).position,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position,L=w.value.count-R.count,O=Math.max(B.distanceTo(I),A)*L,k=Math.max(I.distanceTo(H),A);b=O+k,T=[{key:M.key,progress:0,value:__assign({},R)},{key:w.key,progress:O/b,value:w.value},{key:v,progress:1,value:{count:w.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),q=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*D/q}var z=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"||r.effect==="model"?b:0),J={longitude:o.longitude,latitude:o.latitude,fov:o.fov},V=__assign(__assign({},e),{mode:this.mode,longitude:(u=J.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=J.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=J.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),U=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:U,progress:0,state:V,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(V),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly"||r.effect==="model")this.cameraMotion.set(J,z).catch(noop);else{var j=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),K=coordinatesToVector({longitude:(f=J.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(p=J.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude}),ae=new THREE__namespace.Object3D;ae.lookAt(j);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion);ae.lookAt(K);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion),Z=new THREE__namespace.Matrix4().getInverse(re).premultiply(ee),X=this.cameraMotion.value.fov,se=(d=J.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,G=1;r.effect==="zoomin"?G=1.5:r.effect==="zoomout"&&(G=.4);for(var W=se*G,$=0;$<T.length-1;$++){var ne=T[$].key;if(ne){var te=this.panoResources[ne];te&&(te.fixCameraTransform.copy(Z),te.leftPanoPicture&&(te.leftPanoPicture.zoom=Math.tan(W/2/180*Math.PI)/Math.tan(X/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(h=J.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(g=J.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:W}},{progress:1,value:{longitude:(m=J.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(E=J.latitude)!==null&&E!==void 0?E:this.cameraMotion.value.latitude,fov:se}}],z).catch(noop)}var ve=this.locationMotion.setKeyframes(T,z,_);ve.then(function(){for(var oe=0,fe=s.modelScene.children;oe<fe.length;oe++){var be=fe[oe];be instanceof Model&&be.show()}var ie=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:U,progress:1,state:ie,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ie);var ue=s.works.getObserver(s.currentPano);if(ue&&ue.images.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var me={map:s.videoTexture,size:ue.images.video.size.clone(),matrix:ue.images.video.matrix.clone(),panoMatrix:ue.matrix.clone().premultiply(ue.work.transform),alpha:1},ge=createUuid(),Ae=s.videoTexture.image;Ae.setAttribute("uuid",ge),canplayVideo().then(function(xe){xe&&ue.images.video&&Ae.getAttribute("uuid")===ge&&(Ae.oncanplay=function(){Ae.oncanplay=noop,Ae.play()},Ae.ontimeupdate=function(){Ae.currentTime>.5&&(Ae.ontimeupdate=noop,s.panoVideo.setMaterial(me))},Ae.src=ue.images.video.source)}).catch((function(){Ae.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:U,progress:0,state:V,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o;this.stopMomentumMovement(),this.camera.getDirection(new THREE__namespace.Vector3).setY(0);var s=null,u=this.works.getObserver(this.currentPano);if(!u)return null;var l=u.work.observers,c=u.accessibleNodes.filter(function(_){if(_===r.currentPano.panoIndex&&u.work.workCode===r.currentPano.workCode)return!1;var S=l[_];if(!S)return!1;var w=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return w.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),f=this.modelScene.intersectRaycaster(e)[0];if(f){var p=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var w=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return w.distanceTo(f.point)},!0),d=p[0],h=p[1];typeof d=="number"&&h<this.panoTapTriggerRadius&&(s=(o=l[d])!==null&&o!==void 0?o:null)}if(isNil(s)){var g=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);g&&(s=g)}for(var m=0,E=this.locationMotion.keyframes;m<E.length;m++){var y=E[m],v=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&s){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===A){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(A);b&&(b.setDisabled(!1),b.setLoading(!0))}var T={workCode:s.work.workCode,panoIndex:s.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:s?s.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:T,userAction:!0,options:{},progress:0,error:null})),s&&s.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:T,options:{},error:null})),{workCode:s.work.workCode,panoIndex:s.panoIndex}):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var o=this,s,u,l,c,f,p,d,h,g,m=[],E=2;E<arguments.length;E++)m[E-2]=arguments[E];this.userAction=!0;var y={},v={},A=this.camera.getDirection(new THREE__namespace.Vector3),b=this.locationMotion.keyframes[0],T=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],_=this.locationMotion.getKeyFrameSegment(e),S=_[0],w=_[1],R=this.panoResourceFromLocationMotionKeyframe(S),I=this.panoResourceFromLocationMotionKeyframe(w),H=this.panoResourceFromLocationMotionKeyframe(b),C=this.panoResourceFromLocationMotionKeyframe(T),M=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),v.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var B=this.locationMotion.value.count-w.value.count+1,L=new THREE__namespace.Vector3().copy(R.position),O=new THREE__namespace.Vector3().copy(I.position);if(y.progress=B,B>=.01&&B<=.99&&(y.progress=clamp$1(I.effectEasing(B),.01,.99)),I.leftPanoPicture&&(B<1?R.leftPanoPicture&&(y.pano0=R.leftPanoPicture):y.pano0=I.leftPanoPicture,y.pano1=I.leftPanoPicture),I.effect==="montage"?y.transition="BLACK":I.effect==="spread"?y.transition="SPREAD":y.transition="FADE",I.effect==="zoomin"||I.effect==="zoomout")y.progress=Math.pow(B,3);else if(I.effect==="model"&&this.camera.pose.distance<.01){var k=1-Math.pow(clamp$1(Math.abs(B-.5)*2,0,1),4);y.modelAlpha=k}if(B<1&&I.effect!=="fly"){if(y.pano0&&R.leftPanoPicture){var D={panoId:y.pano0.panoId,map:y.pano0.map,mapSize:y.pano0.mapSize,zoom:y.pano0.zoom,matrix:R.leftPanoPicture.matrix.clone().setPosition(I.position)},q=this.panoPictureObserverMap.get(y.pano0);q&&this.panoPictureObserverMap.set(D,q),y.pano0=D}L.copy(O),M=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(L.x+(O.x-L.x)*B,L.y+(O.y-L.y)*B,L.z+(O.z-L.z)*B);for(var z=[],J=[],V=0,U=this.locationMotion.keyframes;V<U.length;V++){var j=U[V],K=j.key,ae=j.progress;K!==void 0&&(z.push(K),ae>this.locationMotion.progress&&J.push(K))}for(var re=0,ee=Object.keys(this.panoResources);re<ee.length;re++){var Z=ee[re];if(!(J.indexOf(Z)>=0)){var X=this.panoResources[Z];if(X.leftPanoPicture){var se=X.leftPanoPicture.map;if(se){if(se===((s=y.pano0)===null||s===void 0?void 0:s.map)||se===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;se.dispose(),X.leftPanoPicture=null}}z.indexOf(Z)>=0||delete this.panoResources[Z]}}var G=panoParse(I.panoId);G!==this.currentPano&&(this.currentPano=G,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(H.panoId),state:__assign(__assign(__assign(__assign({},panoParse(C.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(v),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);var W=m,$=W[1],ne=new THREE__namespace.Vector3(0,0,0),te=new THREE__namespace.Vector2().copy(this.camera.resolution);if($&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){for(var ve=this.xrManager.cameraVR,oe=this.xrManager.referenceSpace,fe=this.xrManager.session.renderState.baseLayer,be=$.getViewerPose(oe),ie=(l=be==null?void 0:be.views)!==null&&l!==void 0?l:[],ue=0;ue<ie.length;ue++){var me=ie[ue],ge=ve.cameras[ue],Ae=fe.getViewport(me);Ae&&(ge.projectionMatrix.fromArray(me.projectionMatrix),ge.projectionMatrixInverse.getInverse(ge.projectionMatrix),ge.matrix.fromArray(me.transform.matrix),ge.matrix.setPosition(this.camera.position),ge.matrix.decompose(ge.position,ge.quaternion,ge.scale),ge.matrixWorld.copy(ge.matrix),ge.matrixWorldInverse.getInverse(ge.matrixWorld),ge.matrixAutoUpdate=!1,ne.copy(ge.position),ge.viewport.set(Ae.x,Ae.y,Ae.width,Ae.height),te.set(Ae.width,Ae.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((c=v.distance)!==null&&c!==void 0?c:this.camera.pose.distance),this.xrManager.session.inputSources){for(var ue=0;ue<this.xrManager.session.inputSources.length;ue++)if(this.xrManager.session.inputSources[ue]&&this.xrManager.session.inputSources[ue].targetRayMode==="transient-pointer"){var xe=$.getPose(this.xrManager.session.inputSources[ue].targetRaySpace,oe);if(xe){var de=xe.transform.orientation,_e=new THREE__namespace.Quaternion(de.x,de.y,de.z,de.w),He=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(_e),Ee=new THREE__namespace.Raycaster(this.camera.position,He);this.gazeRay=Ee}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var pe=this.xrManager.session.inputSources,Ve=function(he){var Ie=ye.xrManager.controllers[he],Re=pe[he];if(!Re)return"continue";Ie&&Ie.update(Re,$,oe);var qe=ye.xrManager.getController(he),Ye=new THREE__namespace.Vector3(0,1.2,0),ut=qe.position.clone().add(ne).sub(Ye);Re.handedness==="left"?ye.xrControllerRay.left.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)):Re.handedness==="right"&&ye.xrControllerRay.right.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)),ye.controllerWrappers[he].position.copy(new THREE__namespace.Vector3(0,0,0).add(ne).sub(Ye));var Ke=ye.modelScene.intersectRaycaster(ye.xrControllerRay.right);if(Ke.length===0){var dt=ye.works.getResolvedObserver(ye.currentPano);Ke=ye.xrControllerRay.right.intersectObject(ye.modelScene.boundingMesh,!0).map(function(Ge){var Ze,De=(Ze=dt==null?void 0:dt.floorIndex)!==null&&Ze!==void 0?Ze:0;return __assign({floorIndex:De,floor:De},Ge)})}if(Ke.length>=1&&Ke[0].face)if(Re.handedness==="right"){var Pt=ye.xrControllerRay.right.intersectObject(ye.xrCustomObjectsScene,!0),P=Ke[0].face.normal,F=P.clone(),N=Ke[0].point.clone();ye.intersectMesh.position.copy(N);var Q=N.clone().add(F);if(ye.intersectMesh.lookAt(Q),Math.abs(P.y)>.99){var Y=ye.camera.position.clone().sub(N);ye.intersectMesh.rotation.z=-Math.atan2(Y.z,Y.x)}ye.intersectMesh.visible=!0,ye.needsRender=!0,Pt.length>0?(ye.pointerLines.right.setPoints(ut,Pt[0].point),ye.pointerLines.right.points.visible=!0,ye.intersectMesh.visible=!1):(ye.pointerLines.right.points.visible=!1,ye.pointerLines.right.setPoints(ut,Ke[0].point));var le=Ke[0],Te=createEvent("intersect.update",{raycaster:(f=ye.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:le!=null?le:null,object:ye.intersectMesh});if(ye.emit("intersect.update",Te),Te.defaultPrevented)return ye.hideIntersectMesh(),{value:void 0}}else ye.pointerLines.left.setPoints(ut,Ke[0].point)},ye=this,ue=0;ue<pe.length;ue++){var Pe=Ve(ue);if(typeof Pe=="object")return Pe.value}this.updateControllerHelper(pe,e,r)}}else $||console.error("xrFrame丢失,请重试"),this.xrManager.session||console.error("session丢失,请重试"),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error("no layer found");isEmptyObject(y)===!1&&this.modelScene.parameter.set(y),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));var Ce=this.works.getResolvedObserver(this.currentPano),$e=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,Se=this.works.getObserver(R.panoId),ze=this.works.getObserver(I.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Ce){for(var Fe=[],Oe=Ce.work.observers,Le=0,Ue=Ce.accessibleNodes;Le<Ue.length;Le++){var tt=Ue[Le],q=Oe[tt];q&&Fe.push(q)}var lt=new Map;if(Fe.sort(function(he,Ie){var Re=lt.get(he);typeof Re=="undefined"&&(Re=he.standingPosition.distanceTo(Ce.standingPosition),lt.set(he,Re));var qe=lt.get(he);return typeof qe=="undefined"&&(qe=Ie.standingPosition.distanceTo(Ce.standingPosition),lt.set(Ie,qe)),Re-qe}),Fe.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Fe.length;var nt=Fe[this.accessibleObserverFloorCheckCount],ot=this.modelScene.models.find(function(he){return he.work===(nt==null?void 0:nt.work)});if(nt&&ot&&ot.visible){var At=.3,We=.05,Mt=.005,Be=nt.standingPosition.clone().applyMatrix4(nt.work.transform),Ne=panoStringify({panoIndex:nt.panoIndex,workCode:nt.work.workCode}),bt=adjustPanoCircleMeshVectors.map(function(he){scratchRaycaster.ray.origin.copy(Be),scratchRaycaster.ray.origin.add(scratchVector3.copy(he).setY(At)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var Ie=ot.intersectRaycaster(scratchRaycaster)[0];return Ie&&Ie.distance-Mt<=At?new THREE__namespace.Vector3().copy(Be).setY(Ie.point.y+Mt):Be});bt.sort(function(he,Ie){return Ie.y-he.y});var Ct=bt[Math.floor(bt.length/2)],xt=bt.filter(function(he){return he.distanceTo(Ct)<=We})[0];if(xt){var yt=new THREE__namespace.Vector4(Be.x,Be.y,Be.z,xt.y-Be.y),St=this.adjustPanoCircleMeshPositionFix.get(Ne);St&&!yt.equals(St)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Ne,yt)}}this.accessibleObserverFloorCheckCount++}}var rt=new Map;if(Se)for(var at=0,ct=Se.accessibleNodes;at<ct.length;at++){var tt=ct[at],q=Se.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(ze)for(var Xe=0,ce=ze.accessibleNodes;Xe<ce.length;Xe++){var tt=ce[Xe],q=ze.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(this.panoMeshes.forEach(function(he,Ie){var Re=rt.get(Ie);Re?rt.delete(Ie):(o.helper.remove(he),he.dispose(),o.panoMeshes.delete(Ie))}),rt.forEach(function(he,Ie){var Re=o.panoCircleMeshCreator(he,{aerialObserverMinHeight:o.aerialObserverMinHeight});o.panoMeshes.set(Ie,Re),o.helper.add(Re),rt.delete(Ie)}),this.panoMeshes.forEach(function(he,Ie){var Re=o.works.getObserver(Ie);if(Re){var qe=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(qe)he.position.copy(Re.position).applyMatrix4(Re.work.transform),he.scale.setScalar(18);else{he.position.copy(Re.standingPosition).applyMatrix4(Re.work.transform);var Ye=o.adjustPanoCircleMeshPositionFix.get(Re.panoId);Ye&&(scratchVector3.set(Ye.x,Ye.y,Ye.z),scratchVector3.equals(he.position)&&(he.position.y+=Ye.w)),he.scale.setScalar(1.2)}var ut=o.camera.position.clone().setY(he.position.y),Ke=new THREE__namespace.Vector3().copy(he.position).sub(ut).normalize();if(Ie===panoStringify(o.currentPano)){var dt=clamp$1((.5-ut.distanceTo(he.position))/.5,0,1);Ke.multiplyScalar(1-dt).add(A.clone().multiplyScalar(dt))}if(Ke.length()>0){var Pt=qe?-Math.PI/2:0,P=Math.atan2(Ke.x,Ke.z);he.quaternion.setFromEuler(new THREE__namespace.Euler(Pt,P,0,"YXZ"))}}else he.visible=!1}),this.camera.pose.distance>.1||M)this.panoMeshes.forEach(function(he){he.setOpacity(0),he.setCurrent(!1),he.updateTime&&he.updateTime(e,r),he.visible=!1});else if(Ce){var we=Ce.work.observers,Me=arrayMin(Ce.accessibleNodes,function(he){var Ie=we[he];return Ie?Ce.standingPosition.distanceTo(Ie.standingPosition):1/0},!0),ke=Me[1];ke=clamp$1(ke,2.5,1/0);var je=Ce.accessibleNodes.concat(Ce.panoIndex).map(function(he){return panoStringify({panoIndex:he,workCode:Ce.work.workCode})});this.panoMeshes.forEach(function(he,Ie){var Re=o.works.getObserver(Ie),qe=!1,Ye=1;if(je.indexOf(Ie)===-1)qe=!1,Ye=0;else if(!Re)qe=!1,Ye=0;else if(!Re.loadable&&!Re.active)qe=!1,Ye=0;else{var ut=he.position.clone().project(o.camera),Ke=Math.abs(ut.x)<1&&Math.abs(ut.y)<1&&Math.abs(ut.z)<1;qe=Ke&&!he.loading&&he.progress===0&&$e!==null&&panoStringify({panoIndex:$e.panoIndex,workCode:$e.work.workCode})===Ie;var dt=he.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Ye=dt<.01?0:clamp$1(ke/dt,.1,.85)}if(Re&&Re===ze){var Pt=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(Pt){var dt=he.position.distanceTo(o.camera.position);dt<35&&(Ye=0)}}o.modelScene.parameter.resolveValue().modelAlpha>0&&(Ye=0),he.setCurrent(qe),he.setOpacity(Ye),he.updateTime&&he.updateTime(e,r)})}{var B=(p=this.modelScene.parameter.progress)!==null&&p!==void 0?p:1,st=Math.round(B),Qe=this.modelScene.parameter.pano0,Je=this.modelScene.parameter.pano1,ft=st===0?Qe:Je,q=void 0;if(ft&&(q=this.works.getObserver(ft.panoId),q||(q=this.panoPictureObserverMap.get(ft))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=B<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!q||!ft||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var Bt={renderer:this.renderer,resolution:te,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(Bt),this.modelScene.parameter.set("refinedScreen",null)}else{var Ft=getImageSizeLevel(ft.mapSize),pt=Ft+1,It=4;this.tiling.setObserver(q);var Bt={renderer:this.renderer,resolution:te,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:ft.map,panoMatrix:ft.matrix,panoZoom:ft.zoom,minLevel:pt,level:It},Tt=this.tiling.update(Bt),ht={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:st,opacity:(Qe==null?void 0:Qe.panoId)===(Je==null?void 0:Je.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},mt=this.modelScene.parameter.refinedScreen;(Tt||ht.pano!==(mt==null?void 0:mt.pano)||ht.opacity!==(mt==null?void 0:mt.opacity))&&this.modelScene.parameter.set("refinedScreen",ht)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&Ce&&Ce.position.y-Ce.standingPosition.y>10){var gt=this.camera.position.distanceTo(this.intersectMesh.position),Et=2*Math.tan(.5*this.camera.fov/180*Math.PI),Lt=gt*Et/5;this.intersectMesh.scale.setScalar(Lt)}else this.intersectMesh.scale.setScalar(1);{var Ot=I.effect,Ht=this.modelScene.parameter,Qe=Ht.pano0,Je=Ht.pano1;if(Qe&&Je&&Qe!==Je&&(Ot==="fly"||Ot==="model")&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==Qe.panoId||((g=this.modelScene.parameter.pano1Depth)===null||g===void 0?void 0:g.panoId)!==Je.panoId){var it=500,vt=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==vt&&this.pano0DepthCubeRenderTarget.setSize(vt,vt):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==vt&&this.pano1DepthCubeRenderTarget.setSize(vt,vt):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Rt.matrix.copy(Qe.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,it);var wt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);wt.matrix.copy(Je.matrix),wt.matrixWorld.copy(wt.matrix),wt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,wt,it),this.modelScene.parameter.set({pano0Depth:{panoId:Qe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:it},pano1Depth:{panoId:Je.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:it}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}},t.prototype.render=function(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){var e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var l={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var f=e[c].handedness,p=e[c].gamepad;switch(f){case"left":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"LeftAxesDown",r)),p!=null&&p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"X",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"Y",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"LeftTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"LeftPinch",r));var d={raycaster:s,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.buttons.X=p.buttons&&p.buttons[4]?p.buttons[4].pressed:!1,l.buttons.Y=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.LeftTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.LeftPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1,l.left=d;break;case"right":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"RightAxesDown",r)),p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"A",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"B",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"RightTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"RightPinch",r));var h={raycaster:u,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.right=h,l.buttons.A=p.buttons&&p.buttons[4]?p==null?void 0:p.buttons[4].pressed:!1,l.buttons.B=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.RightTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.RightPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",l))}},t.prototype.emitHandleEvent=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=o,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}));else{var l=o-this.xrHandleState[r].touchStartTime;l>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}));var l=o-this.xrHandleState[r].touchStartTime;if(l<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}),f=this.emit("xr.gesture.tap",c);!f&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t})(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},controllersDefaultInitArgs={Floorplan:defaultFloorplanControllerCustomInitArgs,Topview:defaultTopviewControllerCustomInitArgs,Panorama:defaultPanoramaControllerCustomInitArgs,VRPanorama:defaultVRPanoramaControllerCustomInitArgs,Model:defaultModelControllerCustomInitArgs,Mapview:defaultMapviewControllerCustomInitArgs,XRPanorama:defaultXRPanoramaControllerInitArgs},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.dbltap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.dbltap",function(t){var e=!1;e=n.emit("wantsGesture","dbltap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsDblTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","dbltap",t.pointers,t.isFinal),n.emit("dblTapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],n.getCurrentState())}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],n.getCurrentState())}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(){var n=new THREE__namespace.Group;n.name="internalLights";{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction0",t.position.copy(new THREE__namespace.Vector3(0,1,0)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction1",t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.name="direction2",t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);t.name="ambient0",n.add(t)}return n}function parseKeyValue(n){for(var t,e,r={},o=n.split(/(\;|\,)/),s=0,u=o;s<u.length;s++){var l=u[s],c=l.split("="),f=(t=c[0])===null||t===void 0?void 0:t.trim(),p=(e=c[1])===null||e===void 0?void 0:e.trim();f&&p&&(r[f]=p)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1}const textureURL="data:image/png;base64,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=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3));geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2));geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh);scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5);camera.lookAt(0,0,0);camera.updateMatrixWorld(!0);camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),o=n.getScissor(prevScissor),s=n.getScissorTest(),u=n.autoClear,l=o.x+imageOffset[0]/3,c=o.y+imageOffset[1]/3,f=imageSize[0]/3,p=imageSize[1]/3;n.setViewport(l,c,f,p),n.setScissor(l,c,f,p),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(o),n.setScissorTest(s),n.autoClear=u}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=1e3,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},scratchSphere=new THREE__namespace.Sphere,scratchBox3=new THREE__namespace.Box3,scratchViewport=new THREE__namespace.Vector4,scratchScissor=new THREE__namespace.Vector4,scratchClearColor=new THREE__namespace.Color,scratchRenderSize=new THREE__namespace.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five_Instances={},Five=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,p,d,h,g,m=n.call(this)||this;if(m.fiveId=createUuid(),Five_Instances[m.fiveId]=m,m.currentUpdateArgs={time:now(),args:[]},m.currentMode="Panorama",m.pano={workCode:"",panoIndex:0},m.needsRender=!1,m.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,m.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),m.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),m.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,m.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),m.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,m.extraElements=[],m.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},m.fps={testCount:0,testTime:now()},m.modeChangeDuration=(f=e.modeChangeDuration)!==null&&f!==void 0?f:DEFAULT_MODE_CHANGE_DURATION,m.enableWheel=(p=e.enableWheel)!==null&&p!==void 0?p:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&m.throwError(new Error("cannot render a internal renderer")),m.renderer=e.renderer;else try{m.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var E=getViewportScale();m.renderer.setPixelRatio(E===1?window.devicePixelRatio:1),m.renderer.setSize(512,512),m.renderer.setClearColor(m.backgroundColor,m.backgroundAlpha)}catch(M){var y=M instanceof Error?M:new Error(String(M));m.throwError(y)}m.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=m.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),m.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),m.camera=new Camera(DEFAULT_CAMERA_FOV),m.scene=new Scene,m.xrCustomObjectsScene=new THREE__namespace.Scene,m.scene.add(m.xrCustomObjectsScene),m.scene.matrixAutoUpdate=!1,m.loadWorkTask=Promise.resolve(),m.requestProxy=(g=e.requestProxy)!==null&&g!==void 0?g:DEFAULT_REQUEST_PROXY,m.networkSubscribe=new NetworkSubscribe,m.networkSubscribe.on("network",function(M,B,L,O){var k;m.emit("network.resource",createEvent("network.resource",{source:M,requestType:B,requestState:L,detail:O})),(k=m.analysis)===null||k===void 0||k.network(m.works,M,B,L,O)}),m.readyCallbacks=[],m.syncingState=!1,m.helperGroup=new THREE__namespace.Group,m.helperGroup.name="helper",m.helperGroup.matrixAutoUpdate=!1,m.scene.add(m.helperGroup),worksMap.set(m,emptyWorks),m.modelScene=new ModelScene({fiveId:m.fiveId}),m.modelScene.addEventListener("model.create",function(M){m.bindModel(M.model)}),m.scene.add(m.modelScene);var v=m.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0})[0];defineProperty(v,"loaded",{get:function(){return!1},set:function(M){}}),m.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var A=initLights();m.scene.add(A),m.state={mode:m.currentMode,workCode:m.pano.workCode,panoIndex:m.pano.panoIndex,longitude:m.camera.pose.longitude,latitude:m.camera.pose.latitude,fov:m.camera.pose.fov,offset:m.camera.pose.offset.clone(),distance:m.camera.pose.distance},m.stateSynced=!1,m.destroyed=!1,m.paused=!0,typeof window!="undefined"&&(e.play!==!1&&m.play(),m.stopAnimationLoop=AnimationFrameLoop.shared.add(function(M,B){for(var L=[],O=2;O<arguments.length;O++)L[O-2]=arguments[O];m.updateTime.apply(m,__spreadArray([M,B],L,!1))},!1,0,10));var b=function(){typeof document!="undefined"&&document.fullscreenElement===null&&m.currentMode==="VRPanorama"&&m.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},T=function(){m.needsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.addEventListener("webglcontextrestored",T,!1),m.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.removeEventListener("webglcontextrestored",T,!1)},m.plugins={},e.plugins&&e.plugins.length)for(var _=0,S=e.plugins;_<S.length;_++){var w=S[_];if(typeof w=="function")w(m);else if(Array.isArray(w)){var R=w[0],I=w[1],H=w[2];if(typeof R=="function"){var C=R(m,H);typeof I=="string"&&(m.plugins[I]?m.throwError(new Error("plugin name ".concat(I," is exists."))):m.plugins[I]=C)}}}return initLegacyEvent(m),m.fiveRenderer=new FiveRenderer,m.adaptiveLuminancePass=new AdaptiveLuminancePass,m.adaptiveLuminancePass.enabled=!1,m.fiveRenderer.composer.addPass(m.adaptiveLuminancePass),m.eyeDomeLightingPass=new EyeDomeLightingPass(m.camera),m.eyeDomeLightingPass.enabled=!1,m.fiveRenderer.composer.addPass(m.eyeDomeLightingPass),m}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.32"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"useNativeImageBitmap",{get:function(){return canUseNativeImageBitmap()},set:function(e){useNativeImageBitmap(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ident",{get:function(){return this.fiveId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e;if(this.destroyed!==!0){delete Five_Instances[this.fiveId],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var r=this.getElement();r&&r.parentNode&&r.parentNode.removeChild(r);var o=this.modelScene.parameter;o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((e=o.pano0)===null||e===void 0?void 0:e.map)&&o.pano1.map.dispose(),o.reset("pano0","pano1"),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),worksMap.set(this,emptyWorks),this.renderer&&this.renderer.render(new THREE__namespace.Scene,new THREE__namespace.Camera),this.fiveRenderer.dispose(),this.renderer instanceof InternalWebGLRenderer&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}},t.prototype.setViewport=function(e){Object.assign(this.viewport,e),this.needsRender=!0},Object.defineProperty(t.prototype,"boundingMesh",{get:function(){return this.modelScene.boundingMesh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1,s=!1;if(e.panorama&&(Object.assign(this.controllerInits.Panorama,omitUndefinedFields(e.panorama)),this.currentMode==="Panorama"&&(o=!0)),e.model&&(Object.assign(this.controllerInits.Model,omitUndefinedFields(e.model)),this.currentMode==="Model"&&(o=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,omitUndefinedFields(e.floorplan)),this.currentMode==="Floorplan"&&(o=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,omitUndefinedFields(e.topview)),this.currentMode==="Topview"&&(o=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,omitUndefinedFields(e.mapview)),this.currentMode==="Mapview"&&(o=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,omitUndefinedFields(e.vrPanorama)),this.currentMode==="VRPanorama"&&(o=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(s=!0,o=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&o&&this.controller&&this.currentMode){var u=this.controller.updateConfiguration(this.controllerInits[this.currentMode]);(!u||s)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var o=this.getElement();if(o){e.appendChild(o),this.refresh(r);var s=window.getComputedStyle(e).position;s!=="relative"&&s!=="absolute"&&s!=="fixed"&&s!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){var o,s,u;if(e===void 0&&(e={}),!!this.renderer){var l=this.renderer.domElement,c=l.parentNode,f=e.width,p=f===void 0?(o=c==null?void 0:c.offsetWidth)!==null&&o!==void 0?o:512:f,d=e.height,h=d===void 0?(s=c==null?void 0:c.offsetHeight)!==null&&s!==void 0?s:512:d;if(p=Math.max(1,p),h=Math.max(1,h),!r){var g=getViewportScale(),m=typeof window!="undefined"?window.devicePixelRatio:1;if(r=(u=g===1?m:1)!==null&&u!==void 0?u:1,r>1){var E=Math.max(p,h)*r,y=Math.min(this.renderer.capabilities.maxTextureSize,4096);E>y&&(r=Math.max(r/E*y,1),r=Math.floor(r*100)/100)}}this.renderer.setPixelRatio(r),this.renderer.setSize(p,h),this.needsRender=!0;var v=now(),A=v-this.currentUpdateArgs.time,b=this.currentUpdateArgs.args;this.updateTime.apply(this,__spreadArray([v,A],b,!1))}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.updateCamera=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCamera(e,r,o)},t.prototype.updateCameraWithKeyframes=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCameraWithKeyframes(e,r,o)},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);return e||emptyWorks},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"observers",{get:function(){return this.work.observers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"models",{get:function(){return this.modelScene.models},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.modelScene.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,o,s){var u=this;if(s===void 0&&(s=!0),!this.renderer)throw new Error("renderer is not initialized");var l=this.loadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return u.load_(c,r,o,s)}):u.load_(e,r,o,s)});return this.loadWorkTask=l.catch(function(c){u.throwError(c)}),l},t.prototype.load_=function(e,r,o,s){var u=this,l,c,f,p,d,h,g,m,E,y;s===void 0&&(s=!0);var v={};typeof o=="number"?v.duration=o:typeof o=="object"&&Object.assign(v,o),this.works===emptyWorks&&(v.duration===void 0&&(v.duration=0),v.effect===void 0&&(v.effect="instant"));var A={};Object.assign(A,v.model),!A["3d-tiles"]&&v["3d-tiles"]&&(A["3d-tiles"]=v["3d-tiles"]),!A.textureOptions&&v.textureOptions&&(A.textureOptions=v.textureOptions),!A.textureOptions&&this.textureOptions&&(A.textureOptions=this.textureOptions);var b=[];if(Array.isArray(e))for(var T=0,_=e;T<_.length;T++){var S=_[T];S instanceof Work?b.push(S):typeof S!="string"&&"work"in S?b.push(parseWork(S.work,S)):b.push(parseWork(S))}else e instanceof Work?b.push(e):b.push(parseWork(e));v.mode==="add"&&(b=[].concat(this.works,b));var w;try{w=createWorks(b)}catch(Z){return this.throwError(Z),Promise.reject(Z)}for(var R=0,I=w;R<I.length;R++){var H=I[R];this.bindWorkFetcher(H)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var C=this.currentMode,M=w.initial,B=M.work.observers[0],L=B?{workCode:B.work.workCode,panoIndex:B.panoIndex}:{workCode:M.work.workCode,panoIndex:0},O=(l=M.mode)!==null&&l!==void 0?l:B?"Panorama":"Mapview",k={};if(r==="inherit"){var D=this.getCurrentState(),q=w.filter(function(Z){return Z.workCode===D.workCode})[0];if(q)L={workCode:D.workCode,panoIndex:D.panoIndex},O=D.mode,k={longitude:D.latitude,latitude:D.latitude,fov:D.fov,distance:D.distance,offset:D.offset.clone()};else{r={mode:C};var z=(f=(c=w[0])===null||c===void 0?void 0:c.observers)===null||f===void 0?void 0:f[this.panoIndex];z?(r.workCode=z.work.workCode,r.panoIndex=z.panoIndex):typeof w.initial.panoIndex=="number"?(r.workCode=w.initial.work.workCode,r.panoIndex=w.initial.panoIndex):(r.mode==="Panorama"||r.mode==="VRPanorama"||r.mode==="XRPanorama")&&(r.mode="Mapview"),r.mode===C&&(r.longitude=this.camera.pose.longitude,r.latitude=this.camera.pose.latitude,r.fov=this.camera.pose.fov)}}if(r==="initial"&&(typeof M.panoIndex=="number"&&(L={workCode:M.work.workCode,panoIndex:M.panoIndex}),M.mode&&(O=M.mode),k={longitude:M.longitude,latitude:M.latitude,fov:M.fov,distance:M.distance,offset:(p=M.offset)===null||p===void 0?void 0:p.clone()}),typeof r=="object"){if(O=(d=r.mode)!==null&&d!==void 0?d:C,typeof r.panoIndex=="number"){var z=w.getObserver({workCode:(g=(h=r.workCode)!==null&&h!==void 0?h:M.work.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex});z&&(L={workCode:z.work.workCode,panoIndex:z.panoIndex})}k={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset?new THREE__namespace.Vector3().copy(r.offset):void 0}}var J=(m=v.duration)!==null&&m!==void 0?m:this.modeChangeDuration;(O==="Floorplan"||O==="Topview"||O==="Mapview")&&C===O&&(J=0);var V="fly";(O==="Panorama"||O==="VRPanorama"||O==="XRPanorama")&&C===O&&(V=(E=v.effect)!==null&&E!==void 0?E:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:w,userAction:s}));var U=function(Z,X,se){var G=u.getCurrentState(),W=__assign(__assign({mode:Z},X),se);r==="inherit"&&(W=u.getCurrentState()),u.pano=X;var $=__assign(__assign({initial:{state:W,currentState:G,duration:J,effect:V,userAction:s}},u.commonParams()),u.controllerInits[Z]),ne=Controllers[W.mode].initAnimationEndState($);if(u.controller&&C===Z)u.controller.updateWork(w,ne,{effect:V,duration:J},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(Z,$));else{if(u.controller)u.controller.destroy();else{var te=Controllers[Z].initAnimationEndState($);u.camera.setFromPose(te),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(Z,$);var ve=createEvent("mode.change",{prevMode:C,mode:Z,state:ne,userAction:s});try{u.emit("mode.change",ve)}catch(oe){console.error(oe)}}u.updateTime.apply(u,__spreadArray([u.currentUpdateArgs.time,0],u.currentUpdateArgs.args,!1))};worksMap.set(this,w);var j=Promise.resolve();if(O===t.Mode.Floorplan||O===t.Mode.Topview||O===t.Mode.Mapview||O===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(k),assignPose(this.state,this.camera.pose));var K=this.modelScene.setModels(w,A);j=Promise.all(K.map(function(Z){return Z.loadedReady})).then(function(){u.needsRender=!0,U(O,L,k),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{U(O,L,k);var ae=this.controller,re=!1;this.modelScene.autoRefine=!1;var ee=function(){u.works===w&&re===!1&&(u.needsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),re=!0,u.modelScene.autoRefine=!0),ae.off("pano.arrived",ee),ae.off("pano.cancel",ee)},K=this.modelScene.setModels(w,A);j=Promise.all(K.map(function(X){return X.initReady})).then(noop),ae.once("pano.arrived",ee),ae.once("pano.cancel",ee),setTimeout(ee,((y=v.duration)!==null&&y!==void 0?y:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,userAction:s,works:w})),j.then(function(){return u.ready()}).then(function(){var Z;u.emit("works.ready",createEvent("works.ready",{input:e,userAction:s,works:w})),(Z=u.analysis)===null||Z===void 0||Z.work(w)})},t.prototype.reset=function(){var e=this,r=this.loadWorkTask.then(function(){return e.reset_()});return this.loadWorkTask=r.catch(function(o){e.throwError(o)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var o;e.controller&&(e.controller.destroy(),e.controller=void 0);var s=e.modelScene.parameter;s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((o=s.pano0)===null||o===void 0?void 0:o.map)&&s.pano1.map.dispose(),s.set({pano0:null,pano1:null,modelAlpha:1}),worksMap.set(e,emptyWorks),e.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0}),e.renderer&&e.modelScene.update(e.renderer,e.camera),e.needsRender=!0,e.currentMode="Panorama",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.camera.needsRender=!1,e.needsRender=!1,r()})},t.prototype.changeMode=function(e,r,o,s,u){var l=this;return r===void 0&&(r={}),s===void 0&&(s=!0),u===void 0&&(u=!1),new Promise(function(c,f){var p,d,h,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var m=0;l.controller&&(typeof o=="number"?m=o:m=(p=o==null?void 0:o.duration)!==null&&p!==void 0?p:l.modeChangeDuration);var E="fly";l.controller&&typeof o=="object"&&o.effect&&(E=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(g=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));l.throwError(v),f(v);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!l.works.getObserver(y)){var v=new Error("PanoId ".concat(panoStringify(y)," not existed."));l.throwError(v),f(v);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&l.modelScene.empty&&(m=0);var A=l.controller,b=l.currentMode,T=function(){if(l.controller&&l.controller.stopMomentumMovement(),l.controller&&u===!1&&b===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?!panoEqual(l.pano,y)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(y,__assign({duration:m},r),s):l.controller.updateCamera(r,m,s).catch(noop):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,m,s).catch(noop));else{var S=__assign(__assign({},r),y),w=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:m,effect:E,userAction:s}},l.commonParams()),l.controllerInits[e]),R=Controllers[e].initAnimationEndState(w),I=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:R,userAction:s});if(l.emit("mode.change.request",I),!I.defaultPrevented){A&&A.destroy(),l.controller=l.applyController(e,w);var H=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:R,userAction:s});l.emit("mode.change",H)}}c()},_=AnimationFrameLoop.shared.getContext();_&&(typeof XRSession!="undefined"&&_ instanceof XRSession&&_.end(),AnimationFrameLoop.shared.setContext(null)),e===t.Mode.VRPanorama?(l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.exitFullscreen(),l.throwError(w),f(w)})):e===t.Mode.XRPanorama?requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),u=!0,T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.throwError(w),f(w)}):T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var f=now(),p=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),h=this.getSize(new THREE__namespace.Vector2),g=0,m=0,E=1,y=1,v,A,b,T,_;typeof e=="number"?(g=e,typeof r=="number"&&(m=r),typeof o=="number"&&(E=o),typeof s=="number"&&(y=s),v=u,A=l,_=c):(g=e.x,m=e.y,E=e.width,y=e.height,v=e.pixelRatio,A=e.flipY,b=e.helperVisible,T=e.skipPanorama,_=e.buffer),g=Math.floor(g),m=Math.floor(m),E=Math.floor(E),y=Math.floor(y),v=Math.floor(v!=null?v:p),A=A!=null?A:!1;var S=this.helperVisible,w=this.modelScene.parameter.modelAlpha;this.helperVisible=b!=null?b:this.helperVisible,T&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&T===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(E*v,y*v),this.renderer.setRenderTarget(R),this.camera.pixelRatio=v,this.camera.resolution.set(E,y),this.camera.setViewOffset(h.width,h.height,g,h.height-m-y,E,y),this.camera.aspect=h.width/h.height,this.camera.updateTime(f),this.scene.update(this.renderer,this.camera);var I=this.renderer.autoClear,H=this.renderer.autoClearColor,C=this.renderer.autoClearDepth,M=this.renderer.autoClearStencil,B=scratchClearColor.copy(this.renderer.getClearColor()),L=this.renderer.getClearAlpha(),O=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);var k=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:k,this.renderer.render(this.scene,this.camera),this.scene.background=k,this.renderer.autoClear=I,this.renderer.autoClearColor=H,this.renderer.autoClearDepth=C,this.renderer.autoClearStencil=M,this.renderer.setClearColor(B,L),this.renderer.setScissorTest(O),this.helperVisible=S,w===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",w),this.renderer.setRenderTarget(d),this.camera.clearViewOffset(),this.camera.pixelRatio=p,this.camera.resolution.copy(h),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(f),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var D=E*v,q=y*v,z=D*q,J=z*4;if(_){if(_.length!==J)throw new Error("buffer length is not equals pixels ".concat(J))}else _=new Uint8Array(J);if(this.renderer.readRenderTargetPixels(R,0,0,E*v,y*v,_),A)for(var V=z/2,U=0,j=0,K=0,ae=0;j<V;j++)for(ae=(q-Math.floor(j/D)-1)*D+j%D,K=0;K<4;K++)U=_[j*4+K],_[j*4+K]=_[ae*4+K],_[ae*4+K]=U;return _},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},t.prototype.render=function(e){var r=this.renderer;if(r){var o=r.getRenderTarget();r.setRenderTarget(null);var s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,f=scratchClearColor.copy(r.getClearColor()),p=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),g=r.getScissorTest();r.autoClear=!0,r.autoClearColor=!0,r.autoClearDepth=!0,r.autoClearStencil=!0;var m=r.getSize(scratchRenderSize),E=Math.floor(m.x*this.viewport.left),y=Math.floor(m.y*this.viewport.bottom),v=Math.floor(m.x*this.viewport.width),A=Math.floor(m.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(E,y,v,A),r.setScissor(E,y,v,A);var b=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(b);var T=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:T;var _=!0;if(this.controller){var S=this.controller.render();S&&(_=!1)}if(_){var w=this.fiveRenderer.render(r,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&w&&renderPoweredByRealsee(r)}this.scene.background=T,r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(f,p),r.setViewport(d),r.setScissor(h),r.setScissorTest(g),r.setRenderTarget(o),e&&AnimationFrameLoop.shared.add(e,!0)}},t.prototype.updateTime=function(e,r){for(var o,s=this,u=[],l=2;l<arguments.length;l++)u[l-2]=arguments[l];if(this.currentUpdateArgs={time:e,args:u},!this.destroyed){if(this.renderer&&ktx2.detectSupport(this.renderer),this.syncingState=this.syncState(e,r),this.controller&&(o=this.controller).updateTime.apply(o,__spreadArray([e,r],u,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var c=this.modelScene.loaded,f=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),c===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),AnimationFrameLoop.shared.add(function(){s.emit("models.load",createEvent("models.load",{modelScene:s.modelScene}))},!0,0,10)),f===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.modelScene.boundingMesh);var p=scratchBox3.getBoundingSphere(scratchSphere),d=p.radius*2;p.containsPoint(this.camera.position)||(d=this.camera.position.distanceTo(p.center)+p.radius),d=clamp$1(d,800);var h=d/1e4;h=clamp$1(h,.03,.1),this.camera.near!==h&&(this.camera.near=h),this.camera.far!==d&&(this.camera.far=d),this.camera.updateTime(e)}if(this.renderer){var g=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=g}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused!==!0){var m=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",m),m.defaultPrevented&&(this.needsRender=!1);var E=this.needsRender;this.render(),this.needsRender=!1,this.emit("render",createEvent("render",{needsRender:E})),this.hasListener("fps")&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={}),o===void 0&&(o=!0);var s=this,u=s.controller,l=s.renderer;if(!u)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!l)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();typeof e=="number"&&this.pano.workCode&&(e={workCode:this.pano.workCode,panoIndex:e});var c=this.works.getObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var f={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(f,r,o):c&&(this.pano=f,this.once("initAnimation.start",function(p){r.moveStartCallback&&r.moveStartCallback(p.state)}),this.once("initAnimation.end",function(p){r.moveEndCallback&&r.moveEndCallback(p.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},o)),this.ready()},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop);var s=this.works.getObserver(e);if(!s)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var u=["right","left","up","down","front","back"],l=now();return Promise.all(u.map(function(c){var f=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),p=__assign({key:"pano.".concat(f,".").concat(c)},pick(o.imageOptions,["size","format","quality","forceUseExifOrientation","mappings"])),d=s.work.getURL(s.images[c]),h=o.imageOptions.transform?o.imageOptions.transform(d,p):imageURL(d,p);return getFetcher(o.fiveId,s.work).preload(h)})).then(function(){var c=now()-l;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.camera.position,s=e.clone().sub(o),u=new THREE__namespace.Raycaster(o,s.clone().normalize());u.params.Points={threshold:.1};var l=this.modelScene.intersectRaycaster(u)[0];if(l&&l.distance+.01<s.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var f=this.renderer.getSize(new THREE__namespace.Vector2),p=f.x*this.viewport.width,d=f.y*this.viewport.height,h=f.x*this.viewport.left+(c.x+1)/2*p,g=f.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,g)},t.prototype.getCurrentState=function(){return __assign(__assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,o){var s,u,l,c,f,p,d,h,g,m;r===void 0&&(r=!1),o===void 0&&(o=!0),e=pick(e,["mode","workCode","panoIndex","longitude","latitude","fov","offset","distance"]),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var E;if(typeof e.panoIndex=="number")if(e.workCode)E={workCode:e.workCode,panoIndex:e.panoIndex};else{var y=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",v=this.state.workCode;this.works.filter(function(M){return M.workCode===v}).length>0&&(y=v),E={workCode:y,panoIndex:e.panoIndex}}var A=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,w;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==A){if(A==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var R={workCode:E==null?void 0:E.workCode,panoIndex:E==null?void 0:E.panoIndex};typeof e.longitude=="number"&&(R.longitude=e.longitude),typeof e.latitude=="number"&&(R.latitude=e.latitude),typeof e.fov=="number"&&(R.fov=e.fov),typeof e.distance=="number"&&(R.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(R.offset=e.offset);var I=__assign(__assign({initial:{state:R,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[A]),H=Controllers[A].initAnimationEndState(I);b=H.longitude,T=H.latitude,_=H.fov,S=H.offset,w=H.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(f=e.latitude)!==null&&f!==void 0?f:this.state.latitude,_=(p=e.fov)!==null&&p!==void 0?p:this.state.fov,S=(d=e.offset)!==null&&d!==void 0?d:this.state.offset,w=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(E!=null?E:this.pano).workCode,panoIndex:(E!=null?E:this.pano).panoIndex,mode:A,longitude:b,latitude:T,fov:_,offset:S,distance:w};this.emit("state.set",createEvent("state.set",{userAction:o,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode==="VRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("VRPanorama")):this.controller&&C.mode==="XRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("XRPanorama")):(assignState(this.state,C),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===C.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((g=this.controller)===null||g===void 0||g.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:o,state:this.state})),(m=this.analysis)===null||m===void 0||m.state(this.works,this.state)))},t.prototype.syncState=function(e,r,o){o===void 0&&(o=!1);var s=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){var u={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,u,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},l),{duration:o?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,l,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var f=1,p=.2,d=.2,h=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,f),m=Math.abs(this.camera.pose.distance-this.state.distance),E=m>d*15?m/15:p,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,E),v=this.camera.pose.offset.distanceTo(this.state.offset),A=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,A),T=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},h),_=T.longitude,S=T.latitude;if(notSimilarValue(g,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var w={x:b.x,y:b.y,z:b.z},R={fov:g};return Object.assign(w,{distance:y}),Object.assign(R,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(R,0).catch(noop),this.controller.locationMotion.set(w,0).catch(noop),!0}}else{var I=1,H=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,I),C=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},H),_=C.longitude,S=C.latitude,y=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(b,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)||notSimilarValue(g,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,fov:g},0).catch(noop),!0}if(this.stateSynced=!0,s===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var M=this.currentMode,B=M===t.Mode.Floorplan||M===t.Mode.Topview||M===t.Mode.Mapview||M===t.Mode.Model;if(!B||this.modelScene.loaded){var L=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var O=0,k=L;O<k.length;O++){var D=k[O];this.controller instanceof Controllers.Panorama&&D.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(D):D()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(o){var s;r.readyCallbacks.push(Object.assign(o,{tile:(s=e.tile)!==null&&s!==void 0?s:!1}))}).then(function(){return r.model.initReady}).then(noop)},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.bindModel=function(e){var r=this,o=function(){AnimationFrameLoop.shared.add(function(){r.emit("model.load",createEvent("model.load",{work:e.work,model:e,error:null}))},!0)},s=function(c){var f=c.error;r.emit("model.error",createEvent("model.error",{work:e.work,model:e,error:f})),r.throwError(f)},u=function(){r.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:e.work,model:e,error:null}))},l=function(){e.removeEventListener("load",o),e.removeEventListener("error",s),e.removeEventListener("changeShownFloor",u),e.removeEventListener("dispose",l)};e.addEventListener("load",o),e.addEventListener("error",s),e.addEventListener("changeShownFloor",u),e.addEventListener("dispose",l),this.emit("model.request",createEvent("model.request",{work:e.work,model:e,error:null}))},t.prototype.bindWorkFetcher=function(e){var r=this,o=e.workCode,s=e.allowHosts,u=new Fetcher({get networkSubscribe(){return r.networkSubscribe},requestProxy:function(l){return Promise.resolve(l).then(function(c){return r.requestProxy(c,o)}).then(function(c){var f=verifyURL(c,s);return f instanceof Error?Promise.reject(f):f})}});registerFetcher(this.fiveId,e,u)},t.prototype.commonParams=function(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var m=[],E=0;E<arguments.length;E++)m[E]=arguments[E];var y=o.emit.apply(o,__spreadArray([g],m,!1));if(y)return!1})},c=0,f=PROXY_CONTROLLER_EVENT_NAMES;c<f.length;c++){var p=f[c];l(p)}{var d=Controllers[e].initAnimationEndState(r),h=r.initial.userAction;stateEqual(this.state,d)||(assignState(this.state,d),this.emit("state.change",createEvent("state.change",{userAction:h,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:this.getCurrentState()}))}return u.on("camera.update",function(g){var m;if(o.controller){var E=o.controller.getTargetState();g.userAction&&o.syncingState===!1&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:g.userAction,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:g.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.arrived",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.cancel",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:m,state:o.getCurrentState()}))}),u.on("pano.request",function(g){o.emit("pano.request",g),g.defaultPrevented||o.moveToPano(g.state,g.options,g.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(g){return o.throwError(g)}),u},t.prototype.removeEventListeners=function(){},Object.defineProperty(t.prototype,"internalLightsEnabled",{get:function(){var e=this.scene.children.find(function(r){return r.name==="internalLights"});return e?e.visible:!1},set:function(e){var r=this.scene.children.find(function(o){return o.name==="internalLights"});r&&(r.visible=e),r=this.modelScene.children.find(function(o){return o.name==="internalLights"}),r&&(r.visible=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scissor",{get:function(){return this.viewport},enumerable:!1,configurable:!0}),t.prototype.setScissor=function(e){return this.setViewport(e)},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,o=e.latitude,s=e.fov,u=e.offset,l=e.distance;return{longitude:r,latitude:o,fov:s,offset:u.clone(),distance:l}},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,o=e.latitude;return{longitude:r,latitude:o}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;r.matrix.copy(e.matrix).premultiply(e.work.transform),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1;var o=new THREE__namespace.Vector3(0,0,-1);o.applyQuaternion(this.camera.quaternion);var s=r.quaternion.clone().inverse();o.applyQuaternion(s);var u=Math.atan2(o.x,-o.z),l=-Math.asin(o.y);return{theta:u,phi:l,lookAtVector:o}}}return null},t.prototype.addPass=function(e){this.fiveRenderer.composer.addPass(e)},t.prototype.removePass=function(e){var r=this.fiveRenderer.composer.passes.indexOf(e);r!==-1&&this.fiveRenderer.composer.passes.splice(r,1)},t.prototype.insertPass=function(e,r){this.fiveRenderer.composer.insertPass(e,r)},Object.defineProperty(t.prototype,"renderMode",{get:function(){return this.fiveRenderer.renderMode},set:function(e){this.fiveRenderer.renderMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.fiveRenderer.renderMode==="point-cloud-high-quality"},set:function(e){this.fiveRenderer.renderMode=e?"point-cloud-high-quality":"default",this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.eyeDomeLightingPass.enabled},set:function(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableAdaptiveLuminance",{get:function(){return this.adaptiveLuminancePass.enabled},set:function(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelSceneNeedsRender",{get:function(){return this.modelScene.needsRender},set:function(e){this.modelScene.needsRender=e},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t})(Subscribe);if(typeof window!="undefined"){var __FIVE_DEBUG__={THREE:THREE__namespace,constructor:Five,instances:Five_Instances};Object.assign(window,{__FIVE_DEBUG__})}var XRButton=(function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function o(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function s(){o(),e.textContent="VR NOT SUPPORTED"}function u(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",u(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():s()}),e;var l=document.createElement("a");return window.isSecureContext===!1?(l.href=document.location.href.replace(/^http:/,"https:"),l.innerHTML="WEBXR NEEDS HTTPS"):(l.href="https://immersiveweb.dev/",l.innerHTML="WEBXR NOT AVAILABLE"),l.style.left="calc(50% - 90px)",l.style.width="180px",l.style.textDecoration="none",u(l),l},n})();exports.AdaptiveLuminancePass=AdaptiveLuminancePass;exports.AnimationFrameLoop=AnimationFrameLoop;exports.BoundingMesh=BoundingMesh$1;exports.Camera=Camera;exports.CustomShader=PBMCustomShader;exports.EffectComposer=EffectComposer;exports.EyeDomeLightingPass=EyeDomeLightingPass;exports.Fetcher=Fetcher;exports.Five=Five;exports.FivePass=FivePass;exports.FiveRenderer=FiveRenderer;exports.FullScreenQuad=FullScreenQuad;exports.InternalWebGLRenderer=InternalWebGLRenderer;exports.Model=Model;exports.ModelScene=ModelScene;exports.Motion=Motion;exports.NetworkSubscribe=NetworkSubscribe;exports.PBMContainer=PBMContainer;exports.PBMCustomShader=PBMCustomShader;exports.PBMGroup=PBMGroup;exports.PBMMesh=PBMMesh;exports.PBMMeshMaterial=PBMMeshMaterial;exports.PBMPointCloud=PBMPointCloud;exports.PBMPointCloudMaterial=PBMPointCloudMaterial;exports.PBMSkinnedMesh=PBMSkinnedMesh;exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES;exports.PanoCircleMesh=PanoCircleMesh;exports.PanoCircleMeshCustom=PanoCircleMeshCustom;exports.PanoCircleMeshSolid=PanoCircleMeshSolid;exports.Parameter=Parameter;exports.Scene=Scene;exports.Subscribe=Subscribe;exports.TextureLoader=TextureLoader;exports.Tile=Tile;exports.Tile3D=Tile3D;exports.Tile3DModel=Tile3D;exports.TileCache=TileCache;exports.TileNode=TileNode;exports.TileRequestScheduler=TileRequestScheduler;exports.Tileset=Tileset;exports.Trajectory=Trajectory;exports.TrajectoryNode=TrajectoryNode;exports.Work=Work;exports.WorkResolvedObserver=WorkResolvedObserver;exports.XRButton=XRButton;exports.controllersDefaultInitArgs=controllersDefaultInitArgs;exports.coordinatesToVector=coordinatesToVector;exports.createDebugBoundingMesh=createDebugBoundingMesh;exports.createWorks=createWorks;exports.defaultImageURLTransform=imageURL;exports.draco=draco;exports.getViewportScale=getViewportScale;exports.headingToLongitude=headingToLongitude;exports.imageSupport=imageSupport;exports.isBoundingVolume=isBoundingVolume;exports.isPanoId=isPanoId;exports.ktx2=ktx2;exports.loadAt3d=loadAt3d;exports.loadB3dm=loadB3dm;exports.loadDome=loadDome;exports.loadDomez=loadDomez;exports.loadFbx=loadFbx;exports.loadGltf=loadGltf;exports.loadPbm=loadPbm;exports.loadPly=loadPly;exports.loadPnts=loadPnts;exports.loadX3p=loadX3p;exports.longitudeToHeading=longitudeToHeading;exports.makeBoundingVolume=makeBoundingVolume;exports.panoEqual=panoEqual;exports.panoParse=panoParse;exports.panoStringify=panoStringify;exports.parseWork=parseWork;exports.vectorToCoordinates=vectorToCoordinates;exports.workToJson=workToJson;
|
|
2350
|
+
`},LineMaterial=(function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(o){this.uniforms.diffuse.value=o}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(o){this.uniforms.linewidth.value=o}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(o){this.uniforms.dashScale.value=o}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(o){this.uniforms.dashSize.value=o}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(o){this.uniforms.gapSize.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}}}),r.setValues(e),r}return t})(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this)||this;return o.type="LineSegments2",o.geometry=e!==void 0?e:new LineSegmentsGeometry,o.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),o}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,o=e.attributes.instanceEnd,s=new Float32Array(2*r.count),u=new THREE__namespace.Vector3,l=new THREE__namespace.Vector3,c=0,f=0,p=r.count;c<p;c++,f+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[f]=f===0?0:s[f-1],s[f+1]=s[f]+u.distanceTo(l);var d=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(d,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(d,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var o=e.ray,s=e.camera,u=s.projectionMatrix,l=this.geometry,c=this.material,f=c.resolution,p=c.linewidth,d=l.attributes.instanceStart,h=l.attributes.instanceEnd,g=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,E=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,A=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,E),E.w=1,E.applyMatrix4(s.matrixWorldInverse),E.applyMatrix4(u),E.multiplyScalar(1/E.w),E.x*=f.x/2,E.y*=f.y/2,E.z=0,y.copy(E);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){g.fromBufferAttribute(d,_),m.fromBufferAttribute(h,_),g.w=1,m.w=1,g.applyMatrix4(v),m.applyMatrix4(v),g.applyMatrix4(u),m.applyMatrix4(u),g.multiplyScalar(1/g.w),m.multiplyScalar(1/m.w);var w=g.z<-1&&m.z<-1,R=g.z>1&&m.z>1;if(!(w||R)){g.x*=f.x/2,g.y*=f.y/2,m.x*=f.x/2,m.y*=f.y/2,A.start.copy(g),A.start.z=0,A.end.copy(m),A.end.z=0;var I=A.closestPointToPointParameter(y,!0);A.at(I,b);var H=THREE__namespace.MathUtils.lerp(g.z,m.z,I),C=H>=-1&&H<=1,M=y.distanceTo(b)<p*.5;if(C&&M){A.start.fromBufferAttribute(d,_),A.end.fromBufferAttribute(h,_),A.start.applyMatrix4(T),A.end.applyMatrix4(T);var B=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;o.distanceSqToSegment(A.start,A.end,L,B),r.push({point:L,pointOnLine:B,distance:o.origin.distanceTo(L),object:this,faceIndex:_})}}}},t})(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.type="Line2",o}return t})(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setPositions.call(this,o),this},t.prototype.setColors=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setColors.call(this,o),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t})(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=(function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var o=n.call(this)||this;o.type="FiveLine",o.needsRender=!0;var s=new LineGeometry,u=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});o.line=new Line2(s,u);var l=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return o.points=new THREE__namespace.Points(l,c),o.points.renderOrder=11,o.points.frustumCulled=!1,o.setPoints(e,r),o.add(o.line,o.points),o}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.33"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var o=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(o),3)),this.line.geometry.setPositions(o),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o];o==="dashed"?(r.dashed=s,s?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[o]=e[o]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var o=this.line.material.resolution;(o.x!==e||o.y!==r)&&(o.set(e,r),this.needsRender=!0)},t})(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,f,p,d;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(h){switch(h.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(u=h.sent(),e.profiles.some(function(g){var m=u[g];return m&&(l={profileId:g,profilePath:"".concat(r,"/").concat(m.path),deprecated:!!m.deprecated}),!!l}),!l){if(!o)throw new Error("No matching profile name found");if(c=u[o],!c)throw new Error('No matching profile name found and default profile "'.concat(o,'" missing.'));l={profileId:o,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(l.profilePath)];case 2:if(f=h.sent(),s){if(d=void 0,d=f.layouts[e.handedness],!d)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));d.assetPath&&(p=l.profilePath.replace("profile.json",d.assetPath))}return[2,{profile:f,assetPath:p}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,o=Math.sqrt(n*n+t*t);if(o>1){var s=Math.atan2(t,n);e=Math.cos(s),r=Math.sin(s)}var u={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return u}var VisualResponse=(function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,o=t.button,s=t.state,u=normalizeAxes(e,r),l=u.normalizedXAxis,c=u.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?l:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(s)?o:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n})(),Component=(function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(o){var s=new VisualResponse(e.visualResponses[o]);r.visualResponses[o]=s}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(o){o.updateFromComponent(e.values)})},n})(),MotionController=(function(){function n(t,e,r){var o=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(s){var u=o.layoutDescription.components[s];o.components[s]=new Component(s,u)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n})(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(o){o instanceof THREE__namespace.Mesh&&o.isMesh&&(o.material.envMap=r.envMap,o.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(o){var s=o.valueNode,u=o.minNode,l=o.maxNode,c=o.value,f=o.valueNodeProperty;s&&(f===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:f===Constants.VisualResponseProperty.TRANSFORM&&(s.quaternion.copy(u.quaternion).slerp(l.quaternion,c),s.position.lerpVectors(u.position,l.position,c)))})}))},t})(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,o=e.touchPointNodeName,s=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(o),e.touchPointNode){var u=new THREE.SphereGeometry(.001),l=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(u,l);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(s).forEach(function(f){var p=f.valueNodeName,d=f.minNodeName,h=f.maxNodeName,g=f.valueNodeProperty;if(g===Constants.VisualResponseProperty.TRANSFORM){if(f.minNode=t.getObjectByName(d),f.maxNode=t.getObjectByName(h),!f.minNode){console.warn("Could not find ".concat(d," in the model"));return}if(!f.maxNode){console.warn("Could not find ".concat(h," in the model"));return}}f.valueNode=t.getObjectByName(p),f.valueNode||console.warn("Could not find ".concat(p," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=(function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,o=null;return t.addEventListener("connected",function(s){var u=s.data;u.targetRayMode!=="tracked-pointer"||!u.gamepad||fetchProfile(u,e.path,DEFAULT_PROFILE).then(function(l){var c=l.profile,f=l.assetPath;r.motionController=new MotionController(u,c,f);var p=e._assetCache[r.motionController.assetUrl];if(p)o=p.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(d){e._assetCache[r.motionController.assetUrl]=d,o=d.scene.clone(),addAssetSceneToControllerModel(r,o)})}}).catch(function(l){console.warn(l)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(o),o=null}),r},n})(),defaultXRPanoramaControllerInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"]));function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,scratchRaycaster=new THREE__namespace.Raycaster,scratchVector3=new THREE__namespace.Vector3,XRPanoramaController=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.left.firstHitOnly=!0,r.xrControllerRay.left.floorIndex=-1,r.xrControllerRay.right.params.Points={threshold:.1},r.xrControllerRay.right.firstHitOnly=!0,r.xrControllerRay.right.floorIndex=-1,r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var s=r.xrManager.getController(1);r.controllerWrappers[1].add(s);var u=new XRControllerModelFactory;u.gltfLoader={load:function(c,f){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(p){var d;return parseGltf(p.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(d=c.split("?")[1])!==null&&d!==void 0?d:"",fetcher:internalFetcher})}).then(function(p){return f(p)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",effectEasing:defaultEffectEase,fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var l=AnimationFrameLoop.shared.getContext();return l?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(l),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(u.createControllerModel(c)),r.controllerWrappers[0].add(c);var f=r.xrManager.getControllerGrip(1);f.add(u.createControllerModel(f)),r.controllerWrappers[1].add(f)}),r.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"XRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),d=this.works.getObserver(e);if(!d)throw new Error("Invalid PanoIndex");getImageSizeFromURL(d.images.up),this.imageOptions.size;var h=this.imageOptions.transform,g=function(I,H){return mapPanoResource(applyImageURLOptions(I,h,H))},m=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality"])),E={right:d.images.work.getURL(d.images.right),left:d.images.work.getURL(d.images.left),up:d.images.work.getURL(d.images.up),down:d.images.work.getURL(d.images.down),front:d.images.work.getURL(d.images.front),back:d.images.work.getURL(d.images.back)},y="pano:"+jsonHash([E,m,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===y)return;var v=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(v))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:e}))}var A=this.modelScene.parameter.resolveValue(),b=A.pano0,T=A.pano1,_;if((b==null?void 0:b.map.name)===y?_=b:(T==null?void 0:T.map.name)===y&&(_=T),_){var S={panoId:p,effect:f,effectEasing:(c=r.effectEasing)!==null&&c!==void 0?c:defaultEffectEase,leftPanoPicture:{panoId:_.panoId,map:_.map,mapSize:_.mapSize,matrix:d.matrix.clone().premultiply(d.work.transform),zoom:1},position:d.position.clone().applyMatrix4(d.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,S,r);return}var w="move-to-pano-"+p;this.pending.add(w),this.pendingTextureTask={panoId:p,hash:y,onLoad:function(I){var H,C,M=I.body;if(s.destroyed)M.dispose();else{M.name=y;var B=Array.isArray(M.image)?M.image[0]:M.image,L=(H=B==null?void 0:B.width)!==null&&H!==void 0?H:2048,O={panoId:p,effect:f,effectEasing:(C=r.effectEasing)!==null&&C!==void 0?C:defaultEffectEase,leftPanoPicture:{panoId:p,map:M,mapSize:L,matrix:d.matrix.clone(),zoom:1},position:d.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,O,r)}},onError:function(I){var H=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:I,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),r.moveCancelCallback&&r.moveCancelCallback()}};var R=this.panoMeshes.get(p);R&&R.tap&&R.tap(),this.textureLoader.loadCubeTexture(E,{imageURL:{transform:g,options:m},format:THREE__namespace.RGBFormat,fetcher:getFetcher(this.fiveId,d.work)},void 0,void 0,function(I){var H,C;((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&((C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(I)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:I,meta:null,pano:e}))},this.renderer).then(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y?(s.pendingTextureTask.onLoad(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)):I.body.dispose(),s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:I.meta,pano:e}))}).catch(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&(s.pendingTextureTask.onError(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)),s.emit("pano.texture.error",createEvent("pano.texture.error",{error:I,progress:0,meta:null,pano:e})),s.emit("error",I)}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,m,E;o===void 0&&(o={});var y=now(),v=createUuid();this.panoResources[v]=r;var A=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(y);S[0];var w=S[1],R=this.locationMotion.value,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position;b=Math.max(I.distanceTo(H),A),T=[{key:w.key,progress:0,value:__assign(__assign({},R),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(y),M=C[0],w=C[1],R=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(M).position,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position,L=w.value.count-R.count,O=Math.max(B.distanceTo(I),A)*L,k=Math.max(I.distanceTo(H),A);b=O+k,T=[{key:M.key,progress:0,value:__assign({},R)},{key:w.key,progress:O/b,value:w.value},{key:v,progress:1,value:{count:w.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),q=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*D/q}var z=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"||r.effect==="model"?b:0),J={longitude:o.longitude,latitude:o.latitude,fov:o.fov},V=__assign(__assign({},e),{mode:this.mode,longitude:(u=J.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=J.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=J.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),U=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:U,progress:0,state:V,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(V),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly"||r.effect==="model")this.cameraMotion.set(J,z).catch(noop);else{var j=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),K=coordinatesToVector({longitude:(f=J.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(p=J.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude}),ae=new THREE__namespace.Object3D;ae.lookAt(j);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion);ae.lookAt(K);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion),Z=new THREE__namespace.Matrix4().getInverse(re).premultiply(ee),X=this.cameraMotion.value.fov,se=(d=J.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,G=1;r.effect==="zoomin"?G=1.5:r.effect==="zoomout"&&(G=.4);for(var W=se*G,$=0;$<T.length-1;$++){var ne=T[$].key;if(ne){var te=this.panoResources[ne];te&&(te.fixCameraTransform.copy(Z),te.leftPanoPicture&&(te.leftPanoPicture.zoom=Math.tan(W/2/180*Math.PI)/Math.tan(X/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(h=J.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(g=J.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:W}},{progress:1,value:{longitude:(m=J.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(E=J.latitude)!==null&&E!==void 0?E:this.cameraMotion.value.latitude,fov:se}}],z).catch(noop)}var ve=this.locationMotion.setKeyframes(T,z,_);ve.then(function(){for(var oe=0,fe=s.modelScene.children;oe<fe.length;oe++){var be=fe[oe];be instanceof Model&&be.show()}var ie=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:U,progress:1,state:ie,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ie);var ue=s.works.getObserver(s.currentPano);if(ue&&ue.images.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var me={map:s.videoTexture,size:ue.images.video.size.clone(),matrix:ue.images.video.matrix.clone(),panoMatrix:ue.matrix.clone().premultiply(ue.work.transform),alpha:1},ge=createUuid(),Ae=s.videoTexture.image;Ae.setAttribute("uuid",ge),canplayVideo().then(function(xe){xe&&ue.images.video&&Ae.getAttribute("uuid")===ge&&(Ae.oncanplay=function(){Ae.oncanplay=noop,Ae.play()},Ae.ontimeupdate=function(){Ae.currentTime>.5&&(Ae.ontimeupdate=noop,s.panoVideo.setMaterial(me))},Ae.src=ue.images.video.source)}).catch((function(){Ae.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:U,progress:0,state:V,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o;this.stopMomentumMovement(),this.camera.getDirection(new THREE__namespace.Vector3).setY(0);var s=null,u=this.works.getObserver(this.currentPano);if(!u)return null;var l=u.work.observers,c=u.accessibleNodes.filter(function(_){if(_===r.currentPano.panoIndex&&u.work.workCode===r.currentPano.workCode)return!1;var S=l[_];if(!S)return!1;var w=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return w.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),f=this.modelScene.intersectRaycaster(e)[0];if(f){var p=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var w=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return w.distanceTo(f.point)},!0),d=p[0],h=p[1];typeof d=="number"&&h<this.panoTapTriggerRadius&&(s=(o=l[d])!==null&&o!==void 0?o:null)}if(isNil(s)){var g=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);g&&(s=g)}for(var m=0,E=this.locationMotion.keyframes;m<E.length;m++){var y=E[m],v=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&s){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===A){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(A);b&&(b.setDisabled(!1),b.setLoading(!0))}var T={workCode:s.work.workCode,panoIndex:s.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:s?s.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:T,userAction:!0,options:{},progress:0,error:null})),s&&s.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:T,options:{},error:null})),{workCode:s.work.workCode,panoIndex:s.panoIndex}):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var o=this,s,u,l,c,f,p,d,h,g,m=[],E=2;E<arguments.length;E++)m[E-2]=arguments[E];this.userAction=!0;var y={},v={},A=this.camera.getDirection(new THREE__namespace.Vector3),b=this.locationMotion.keyframes[0],T=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],_=this.locationMotion.getKeyFrameSegment(e),S=_[0],w=_[1],R=this.panoResourceFromLocationMotionKeyframe(S),I=this.panoResourceFromLocationMotionKeyframe(w),H=this.panoResourceFromLocationMotionKeyframe(b),C=this.panoResourceFromLocationMotionKeyframe(T),M=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),v.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var B=this.locationMotion.value.count-w.value.count+1,L=new THREE__namespace.Vector3().copy(R.position),O=new THREE__namespace.Vector3().copy(I.position);if(y.progress=B,B>=.01&&B<=.99&&(y.progress=clamp$1(I.effectEasing(B),.01,.99)),I.leftPanoPicture&&(B<1?R.leftPanoPicture&&(y.pano0=R.leftPanoPicture):y.pano0=I.leftPanoPicture,y.pano1=I.leftPanoPicture),I.effect==="montage"?y.transition="BLACK":I.effect==="spread"?y.transition="SPREAD":y.transition="FADE",I.effect==="zoomin"||I.effect==="zoomout")y.progress=Math.pow(B,3);else if(I.effect==="model"&&this.camera.pose.distance<.01){var k=1-Math.pow(clamp$1(Math.abs(B-.5)*2,0,1),4);y.modelAlpha=k}if(B<1&&I.effect!=="fly"){if(y.pano0&&R.leftPanoPicture){var D={panoId:y.pano0.panoId,map:y.pano0.map,mapSize:y.pano0.mapSize,zoom:y.pano0.zoom,matrix:R.leftPanoPicture.matrix.clone().setPosition(I.position)},q=this.panoPictureObserverMap.get(y.pano0);q&&this.panoPictureObserverMap.set(D,q),y.pano0=D}L.copy(O),M=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(L.x+(O.x-L.x)*B,L.y+(O.y-L.y)*B,L.z+(O.z-L.z)*B);for(var z=[],J=[],V=0,U=this.locationMotion.keyframes;V<U.length;V++){var j=U[V],K=j.key,ae=j.progress;K!==void 0&&(z.push(K),ae>this.locationMotion.progress&&J.push(K))}for(var re=0,ee=Object.keys(this.panoResources);re<ee.length;re++){var Z=ee[re];if(!(J.indexOf(Z)>=0)){var X=this.panoResources[Z];if(X.leftPanoPicture){var se=X.leftPanoPicture.map;if(se){if(se===((s=y.pano0)===null||s===void 0?void 0:s.map)||se===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;se.dispose(),X.leftPanoPicture=null}}z.indexOf(Z)>=0||delete this.panoResources[Z]}}var G=panoParse(I.panoId);G!==this.currentPano&&(this.currentPano=G,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(H.panoId),state:__assign(__assign(__assign(__assign({},panoParse(C.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(v),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);var W=m,$=W[1],ne=new THREE__namespace.Vector3(0,0,0),te=new THREE__namespace.Vector2().copy(this.camera.resolution);if($&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){for(var ve=this.xrManager.cameraVR,oe=this.xrManager.referenceSpace,fe=this.xrManager.session.renderState.baseLayer,be=$.getViewerPose(oe),ie=(l=be==null?void 0:be.views)!==null&&l!==void 0?l:[],ue=0;ue<ie.length;ue++){var me=ie[ue],ge=ve.cameras[ue],Ae=fe.getViewport(me);Ae&&(ge.projectionMatrix.fromArray(me.projectionMatrix),ge.projectionMatrixInverse.getInverse(ge.projectionMatrix),ge.matrix.fromArray(me.transform.matrix),ge.matrix.setPosition(this.camera.position),ge.matrix.decompose(ge.position,ge.quaternion,ge.scale),ge.matrixWorld.copy(ge.matrix),ge.matrixWorldInverse.getInverse(ge.matrixWorld),ge.matrixAutoUpdate=!1,ne.copy(ge.position),ge.viewport.set(Ae.x,Ae.y,Ae.width,Ae.height),te.set(Ae.width,Ae.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((c=v.distance)!==null&&c!==void 0?c:this.camera.pose.distance),this.xrManager.session.inputSources){for(var ue=0;ue<this.xrManager.session.inputSources.length;ue++)if(this.xrManager.session.inputSources[ue]&&this.xrManager.session.inputSources[ue].targetRayMode==="transient-pointer"){var xe=$.getPose(this.xrManager.session.inputSources[ue].targetRaySpace,oe);if(xe){var de=xe.transform.orientation,_e=new THREE__namespace.Quaternion(de.x,de.y,de.z,de.w),He=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(_e),Ee=new THREE__namespace.Raycaster(this.camera.position,He);this.gazeRay=Ee}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var pe=this.xrManager.session.inputSources,Ve=function(he){var Ie=ye.xrManager.controllers[he],Re=pe[he];if(!Re)return"continue";Ie&&Ie.update(Re,$,oe);var qe=ye.xrManager.getController(he),Ye=new THREE__namespace.Vector3(0,1.2,0),ut=qe.position.clone().add(ne).sub(Ye);Re.handedness==="left"?ye.xrControllerRay.left.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)):Re.handedness==="right"&&ye.xrControllerRay.right.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)),ye.controllerWrappers[he].position.copy(new THREE__namespace.Vector3(0,0,0).add(ne).sub(Ye));var Ke=ye.modelScene.intersectRaycaster(ye.xrControllerRay.right);if(Ke.length===0){var dt=ye.works.getResolvedObserver(ye.currentPano);Ke=ye.xrControllerRay.right.intersectObject(ye.modelScene.boundingMesh,!0).map(function(Ge){var Ze,De=(Ze=dt==null?void 0:dt.floorIndex)!==null&&Ze!==void 0?Ze:0;return __assign({floorIndex:De,floor:De},Ge)})}if(Ke.length>=1&&Ke[0].face)if(Re.handedness==="right"){var Pt=ye.xrControllerRay.right.intersectObject(ye.xrCustomObjectsScene,!0),P=Ke[0].face.normal,F=P.clone(),N=Ke[0].point.clone();ye.intersectMesh.position.copy(N);var Q=N.clone().add(F);if(ye.intersectMesh.lookAt(Q),Math.abs(P.y)>.99){var Y=ye.camera.position.clone().sub(N);ye.intersectMesh.rotation.z=-Math.atan2(Y.z,Y.x)}ye.intersectMesh.visible=!0,ye.needsRender=!0,Pt.length>0?(ye.pointerLines.right.setPoints(ut,Pt[0].point),ye.pointerLines.right.points.visible=!0,ye.intersectMesh.visible=!1):(ye.pointerLines.right.points.visible=!1,ye.pointerLines.right.setPoints(ut,Ke[0].point));var le=Ke[0],Te=createEvent("intersect.update",{raycaster:(f=ye.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:le!=null?le:null,object:ye.intersectMesh});if(ye.emit("intersect.update",Te),Te.defaultPrevented)return ye.hideIntersectMesh(),{value:void 0}}else ye.pointerLines.left.setPoints(ut,Ke[0].point)},ye=this,ue=0;ue<pe.length;ue++){var Pe=Ve(ue);if(typeof Pe=="object")return Pe.value}this.updateControllerHelper(pe,e,r)}}else $||console.error("xrFrame丢失,请重试"),this.xrManager.session||console.error("session丢失,请重试"),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error("no layer found");isEmptyObject(y)===!1&&this.modelScene.parameter.set(y),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));var Ce=this.works.getResolvedObserver(this.currentPano),$e=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,Se=this.works.getObserver(R.panoId),ze=this.works.getObserver(I.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Ce){for(var Fe=[],Oe=Ce.work.observers,Le=0,Ue=Ce.accessibleNodes;Le<Ue.length;Le++){var tt=Ue[Le],q=Oe[tt];q&&Fe.push(q)}var lt=new Map;if(Fe.sort(function(he,Ie){var Re=lt.get(he);typeof Re=="undefined"&&(Re=he.standingPosition.distanceTo(Ce.standingPosition),lt.set(he,Re));var qe=lt.get(he);return typeof qe=="undefined"&&(qe=Ie.standingPosition.distanceTo(Ce.standingPosition),lt.set(Ie,qe)),Re-qe}),Fe.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Fe.length;var nt=Fe[this.accessibleObserverFloorCheckCount],ot=this.modelScene.models.find(function(he){return he.work===(nt==null?void 0:nt.work)});if(nt&&ot&&ot.visible){var At=.3,We=.05,Mt=.005,Be=nt.standingPosition.clone().applyMatrix4(nt.work.transform),Ne=panoStringify({panoIndex:nt.panoIndex,workCode:nt.work.workCode}),bt=adjustPanoCircleMeshVectors.map(function(he){scratchRaycaster.ray.origin.copy(Be),scratchRaycaster.ray.origin.add(scratchVector3.copy(he).setY(At)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var Ie=ot.intersectRaycaster(scratchRaycaster)[0];return Ie&&Ie.distance-Mt<=At?new THREE__namespace.Vector3().copy(Be).setY(Ie.point.y+Mt):Be});bt.sort(function(he,Ie){return Ie.y-he.y});var Ct=bt[Math.floor(bt.length/2)],xt=bt.filter(function(he){return he.distanceTo(Ct)<=We})[0];if(xt){var yt=new THREE__namespace.Vector4(Be.x,Be.y,Be.z,xt.y-Be.y),St=this.adjustPanoCircleMeshPositionFix.get(Ne);St&&!yt.equals(St)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Ne,yt)}}this.accessibleObserverFloorCheckCount++}}var rt=new Map;if(Se)for(var at=0,ct=Se.accessibleNodes;at<ct.length;at++){var tt=ct[at],q=Se.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(ze)for(var Xe=0,ce=ze.accessibleNodes;Xe<ce.length;Xe++){var tt=ce[Xe],q=ze.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(this.panoMeshes.forEach(function(he,Ie){var Re=rt.get(Ie);Re?rt.delete(Ie):(o.helper.remove(he),he.dispose(),o.panoMeshes.delete(Ie))}),rt.forEach(function(he,Ie){var Re=o.panoCircleMeshCreator(he,{aerialObserverMinHeight:o.aerialObserverMinHeight});o.panoMeshes.set(Ie,Re),o.helper.add(Re),rt.delete(Ie)}),this.panoMeshes.forEach(function(he,Ie){var Re=o.works.getObserver(Ie);if(Re){var qe=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(qe)he.position.copy(Re.position).applyMatrix4(Re.work.transform),he.scale.setScalar(18);else{he.position.copy(Re.standingPosition).applyMatrix4(Re.work.transform);var Ye=o.adjustPanoCircleMeshPositionFix.get(Re.panoId);Ye&&(scratchVector3.set(Ye.x,Ye.y,Ye.z),scratchVector3.equals(he.position)&&(he.position.y+=Ye.w)),he.scale.setScalar(1.2)}var ut=o.camera.position.clone().setY(he.position.y),Ke=new THREE__namespace.Vector3().copy(he.position).sub(ut).normalize();if(Ie===panoStringify(o.currentPano)){var dt=clamp$1((.5-ut.distanceTo(he.position))/.5,0,1);Ke.multiplyScalar(1-dt).add(A.clone().multiplyScalar(dt))}if(Ke.length()>0){var Pt=qe?-Math.PI/2:0,P=Math.atan2(Ke.x,Ke.z);he.quaternion.setFromEuler(new THREE__namespace.Euler(Pt,P,0,"YXZ"))}}else he.visible=!1}),this.camera.pose.distance>.1||M)this.panoMeshes.forEach(function(he){he.setOpacity(0),he.setCurrent(!1),he.updateTime&&he.updateTime(e,r),he.visible=!1});else if(Ce){var we=Ce.work.observers,Me=arrayMin(Ce.accessibleNodes,function(he){var Ie=we[he];return Ie?Ce.standingPosition.distanceTo(Ie.standingPosition):1/0},!0),ke=Me[1];ke=clamp$1(ke,2.5,1/0);var je=Ce.accessibleNodes.concat(Ce.panoIndex).map(function(he){return panoStringify({panoIndex:he,workCode:Ce.work.workCode})});this.panoMeshes.forEach(function(he,Ie){var Re=o.works.getObserver(Ie),qe=!1,Ye=1;if(je.indexOf(Ie)===-1)qe=!1,Ye=0;else if(!Re)qe=!1,Ye=0;else if(!Re.loadable&&!Re.active)qe=!1,Ye=0;else{var ut=he.position.clone().project(o.camera),Ke=Math.abs(ut.x)<1&&Math.abs(ut.y)<1&&Math.abs(ut.z)<1;qe=Ke&&!he.loading&&he.progress===0&&$e!==null&&panoStringify({panoIndex:$e.panoIndex,workCode:$e.work.workCode})===Ie;var dt=he.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Ye=dt<.01?0:clamp$1(ke/dt,.1,.85)}if(Re&&Re===ze){var Pt=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(Pt){var dt=he.position.distanceTo(o.camera.position);dt<35&&(Ye=0)}}o.modelScene.parameter.resolveValue().modelAlpha>0&&(Ye=0),he.setCurrent(qe),he.setOpacity(Ye),he.updateTime&&he.updateTime(e,r)})}{var B=(p=this.modelScene.parameter.progress)!==null&&p!==void 0?p:1,st=Math.round(B),Qe=this.modelScene.parameter.pano0,Je=this.modelScene.parameter.pano1,ft=st===0?Qe:Je,q=void 0;if(ft&&(q=this.works.getObserver(ft.panoId),q||(q=this.panoPictureObserverMap.get(ft))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=B<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!q||!ft||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var Bt={renderer:this.renderer,resolution:te,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(Bt),this.modelScene.parameter.set("refinedScreen",null)}else{var Ft=getImageSizeLevel(ft.mapSize),pt=Ft+1,It=4;this.tiling.setObserver(q);var Bt={renderer:this.renderer,resolution:te,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:ft.map,panoMatrix:ft.matrix,panoZoom:ft.zoom,minLevel:pt,level:It},Tt=this.tiling.update(Bt),ht={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:st,opacity:(Qe==null?void 0:Qe.panoId)===(Je==null?void 0:Je.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},mt=this.modelScene.parameter.refinedScreen;(Tt||ht.pano!==(mt==null?void 0:mt.pano)||ht.opacity!==(mt==null?void 0:mt.opacity))&&this.modelScene.parameter.set("refinedScreen",ht)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&Ce&&Ce.position.y-Ce.standingPosition.y>10){var gt=this.camera.position.distanceTo(this.intersectMesh.position),Et=2*Math.tan(.5*this.camera.fov/180*Math.PI),Lt=gt*Et/5;this.intersectMesh.scale.setScalar(Lt)}else this.intersectMesh.scale.setScalar(1);{var Ot=I.effect,Ht=this.modelScene.parameter,Qe=Ht.pano0,Je=Ht.pano1;if(Qe&&Je&&Qe!==Je&&(Ot==="fly"||Ot==="model")&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==Qe.panoId||((g=this.modelScene.parameter.pano1Depth)===null||g===void 0?void 0:g.panoId)!==Je.panoId){var it=500,vt=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==vt&&this.pano0DepthCubeRenderTarget.setSize(vt,vt):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==vt&&this.pano1DepthCubeRenderTarget.setSize(vt,vt):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Rt.matrix.copy(Qe.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,it);var wt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);wt.matrix.copy(Je.matrix),wt.matrixWorld.copy(wt.matrix),wt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,wt,it),this.modelScene.parameter.set({pano0Depth:{panoId:Qe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:it},pano1Depth:{panoId:Je.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:it}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}},t.prototype.render=function(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){var e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var l={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var f=e[c].handedness,p=e[c].gamepad;switch(f){case"left":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"LeftAxesDown",r)),p!=null&&p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"X",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"Y",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"LeftTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"LeftPinch",r));var d={raycaster:s,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.buttons.X=p.buttons&&p.buttons[4]?p.buttons[4].pressed:!1,l.buttons.Y=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.LeftTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.LeftPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1,l.left=d;break;case"right":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"RightAxesDown",r)),p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"A",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"B",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"RightTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"RightPinch",r));var h={raycaster:u,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.right=h,l.buttons.A=p.buttons&&p.buttons[4]?p==null?void 0:p.buttons[4].pressed:!1,l.buttons.B=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.RightTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.RightPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",l))}},t.prototype.emitHandleEvent=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=o,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}));else{var l=o-this.xrHandleState[r].touchStartTime;l>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}));var l=o-this.xrHandleState[r].touchStartTime;if(l<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}),f=this.emit("xr.gesture.tap",c);!f&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t})(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},controllersDefaultInitArgs={Floorplan:defaultFloorplanControllerCustomInitArgs,Topview:defaultTopviewControllerCustomInitArgs,Panorama:defaultPanoramaControllerCustomInitArgs,VRPanorama:defaultVRPanoramaControllerCustomInitArgs,Model:defaultModelControllerCustomInitArgs,Mapview:defaultMapviewControllerCustomInitArgs,XRPanorama:defaultXRPanoramaControllerInitArgs},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.dbltap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.dbltap",function(t){var e=!1;e=n.emit("wantsGesture","dbltap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsDblTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","dbltap",t.pointers,t.isFinal),n.emit("dblTapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],n.getCurrentState())}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],n.getCurrentState())}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(){var n=new THREE__namespace.Group;n.name="internalLights";{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction0",t.position.copy(new THREE__namespace.Vector3(0,1,0)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction1",t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.name="direction2",t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);t.name="ambient0",n.add(t)}return n}function parseKeyValue(n){for(var t,e,r={},o=n.split(/(\;|\,)/),s=0,u=o;s<u.length;s++){var l=u[s],c=l.split("="),f=(t=c[0])===null||t===void 0?void 0:t.trim(),p=(e=c[1])===null||e===void 0?void 0:e.trim();f&&p&&(r[f]=p)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1}const textureURL="data:image/png;base64,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=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3));geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2));geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh);scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5);camera.lookAt(0,0,0);camera.updateMatrixWorld(!0);camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),o=n.getScissor(prevScissor),s=n.getScissorTest(),u=n.autoClear,l=o.x+imageOffset[0]/3,c=o.y+imageOffset[1]/3,f=imageSize[0]/3,p=imageSize[1]/3;n.setViewport(l,c,f,p),n.setScissor(l,c,f,p),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(o),n.setScissorTest(s),n.autoClear=u}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=1e3,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},scratchSphere=new THREE__namespace.Sphere,scratchBox3=new THREE__namespace.Box3,scratchViewport=new THREE__namespace.Vector4,scratchScissor=new THREE__namespace.Vector4,scratchClearColor=new THREE__namespace.Color,scratchRenderSize=new THREE__namespace.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five_Instances={},Five=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,p,d,h,g,m=n.call(this)||this;if(m.fiveId=createUuid(),Five_Instances[m.fiveId]=m,m.currentUpdateArgs={time:now(),args:[]},m.currentMode="Panorama",m.pano={workCode:"",panoIndex:0},m.needsRender=!1,m.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,m.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),m.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),m.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,m.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),m.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,m.extraElements=[],m.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},m.fps={testCount:0,testTime:now()},m.modeChangeDuration=(f=e.modeChangeDuration)!==null&&f!==void 0?f:DEFAULT_MODE_CHANGE_DURATION,m.enableWheel=(p=e.enableWheel)!==null&&p!==void 0?p:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&m.throwError(new Error("cannot render a internal renderer")),m.renderer=e.renderer;else try{m.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var E=getViewportScale();m.renderer.setPixelRatio(E===1?window.devicePixelRatio:1),m.renderer.setSize(512,512),m.renderer.setClearColor(m.backgroundColor,m.backgroundAlpha)}catch(M){var y=M instanceof Error?M:new Error(String(M));m.throwError(y)}m.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=m.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),m.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),m.camera=new Camera(DEFAULT_CAMERA_FOV),m.scene=new Scene,m.xrCustomObjectsScene=new THREE__namespace.Scene,m.scene.add(m.xrCustomObjectsScene),m.scene.matrixAutoUpdate=!1,m.loadWorkTask=Promise.resolve(),m.requestProxy=(g=e.requestProxy)!==null&&g!==void 0?g:DEFAULT_REQUEST_PROXY,m.networkSubscribe=new NetworkSubscribe,m.networkSubscribe.on("network",function(M,B,L,O){var k;m.emit("network.resource",createEvent("network.resource",{source:M,requestType:B,requestState:L,detail:O})),(k=m.analysis)===null||k===void 0||k.network(m.works,M,B,L,O)}),m.readyCallbacks=[],m.syncingState=!1,m.helperGroup=new THREE__namespace.Group,m.helperGroup.name="helper",m.helperGroup.matrixAutoUpdate=!1,m.scene.add(m.helperGroup),worksMap.set(m,emptyWorks),m.modelScene=new ModelScene({fiveId:m.fiveId}),m.modelScene.addEventListener("model.create",function(M){m.bindModel(M.model)}),m.scene.add(m.modelScene);var v=m.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0})[0];defineProperty(v,"loaded",{get:function(){return!1},set:function(M){}}),m.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var A=initLights();m.scene.add(A),m.state={mode:m.currentMode,workCode:m.pano.workCode,panoIndex:m.pano.panoIndex,longitude:m.camera.pose.longitude,latitude:m.camera.pose.latitude,fov:m.camera.pose.fov,offset:m.camera.pose.offset.clone(),distance:m.camera.pose.distance},m.stateSynced=!1,m.destroyed=!1,m.paused=!0,typeof window!="undefined"&&(e.play!==!1&&m.play(),m.stopAnimationLoop=AnimationFrameLoop.shared.add(function(M,B){for(var L=[],O=2;O<arguments.length;O++)L[O-2]=arguments[O];m.updateTime.apply(m,__spreadArray([M,B],L,!1))},!1,0,10));var b=function(){typeof document!="undefined"&&document.fullscreenElement===null&&m.currentMode==="VRPanorama"&&m.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},T=function(){m.needsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.addEventListener("webglcontextrestored",T,!1),m.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.removeEventListener("webglcontextrestored",T,!1)},m.plugins={},e.plugins&&e.plugins.length)for(var _=0,S=e.plugins;_<S.length;_++){var w=S[_];if(typeof w=="function")w(m);else if(Array.isArray(w)){var R=w[0],I=w[1],H=w[2];if(typeof R=="function"){var C=R(m,H);typeof I=="string"&&(m.plugins[I]?m.throwError(new Error("plugin name ".concat(I," is exists."))):m.plugins[I]=C)}}}return initLegacyEvent(m),m.fiveRenderer=new FiveRenderer,m.adaptiveLuminancePass=new AdaptiveLuminancePass,m.adaptiveLuminancePass.enabled=!1,m.fiveRenderer.composer.addPass(m.adaptiveLuminancePass),m.eyeDomeLightingPass=new EyeDomeLightingPass(m.camera),m.eyeDomeLightingPass.enabled=!1,m.fiveRenderer.composer.addPass(m.eyeDomeLightingPass),m}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.33"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"useNativeImageBitmap",{get:function(){return canUseNativeImageBitmap()},set:function(e){useNativeImageBitmap(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ident",{get:function(){return this.fiveId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e;if(this.destroyed!==!0){delete Five_Instances[this.fiveId],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var r=this.getElement();r&&r.parentNode&&r.parentNode.removeChild(r);var o=this.modelScene.parameter;o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((e=o.pano0)===null||e===void 0?void 0:e.map)&&o.pano1.map.dispose(),o.reset("pano0","pano1"),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),worksMap.set(this,emptyWorks),this.renderer&&this.renderer.render(new THREE__namespace.Scene,new THREE__namespace.Camera),this.fiveRenderer.dispose(),this.renderer instanceof InternalWebGLRenderer&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}},t.prototype.setViewport=function(e){Object.assign(this.viewport,e),this.needsRender=!0},Object.defineProperty(t.prototype,"boundingMesh",{get:function(){return this.modelScene.boundingMesh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1,s=!1;if(e.panorama&&(Object.assign(this.controllerInits.Panorama,omitUndefinedFields(e.panorama)),this.currentMode==="Panorama"&&(o=!0)),e.model&&(Object.assign(this.controllerInits.Model,omitUndefinedFields(e.model)),this.currentMode==="Model"&&(o=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,omitUndefinedFields(e.floorplan)),this.currentMode==="Floorplan"&&(o=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,omitUndefinedFields(e.topview)),this.currentMode==="Topview"&&(o=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,omitUndefinedFields(e.mapview)),this.currentMode==="Mapview"&&(o=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,omitUndefinedFields(e.vrPanorama)),this.currentMode==="VRPanorama"&&(o=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(s=!0,o=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&o&&this.controller&&this.currentMode){var u=this.controller.updateConfiguration(this.controllerInits[this.currentMode]);(!u||s)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var o=this.getElement();if(o){e.appendChild(o),this.refresh(r);var s=window.getComputedStyle(e).position;s!=="relative"&&s!=="absolute"&&s!=="fixed"&&s!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){var o,s,u;if(e===void 0&&(e={}),!!this.renderer){var l=this.renderer.domElement,c=l.parentNode,f=e.width,p=f===void 0?(o=c==null?void 0:c.offsetWidth)!==null&&o!==void 0?o:512:f,d=e.height,h=d===void 0?(s=c==null?void 0:c.offsetHeight)!==null&&s!==void 0?s:512:d;if(p=Math.max(1,p),h=Math.max(1,h),!r){var g=getViewportScale(),m=typeof window!="undefined"?window.devicePixelRatio:1;if(r=(u=g===1?m:1)!==null&&u!==void 0?u:1,r>1){var E=Math.max(p,h)*r,y=Math.min(this.renderer.capabilities.maxTextureSize,4096);E>y&&(r=Math.max(r/E*y,1),r=Math.floor(r*100)/100)}}this.renderer.setPixelRatio(r),this.renderer.setSize(p,h),this.needsRender=!0;var v=now(),A=v-this.currentUpdateArgs.time,b=this.currentUpdateArgs.args;this.updateTime.apply(this,__spreadArray([v,A],b,!1))}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.updateCamera=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCamera(e,r,o)},t.prototype.updateCameraWithKeyframes=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCameraWithKeyframes(e,r,o)},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);return e||emptyWorks},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"observers",{get:function(){return this.work.observers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"models",{get:function(){return this.modelScene.models},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.modelScene.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,o,s){var u=this;if(s===void 0&&(s=!0),!this.renderer)throw new Error("renderer is not initialized");var l=this.loadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return u.load_(c,r,o,s)}):u.load_(e,r,o,s)});return this.loadWorkTask=l.catch(function(c){u.throwError(c)}),l},t.prototype.load_=function(e,r,o,s){var u=this,l,c,f,p,d,h,g,m,E,y;s===void 0&&(s=!0);var v={};typeof o=="number"?v.duration=o:typeof o=="object"&&Object.assign(v,o),this.works===emptyWorks&&(v.duration===void 0&&(v.duration=0),v.effect===void 0&&(v.effect="instant"));var A={};Object.assign(A,v.model),!A["3d-tiles"]&&v["3d-tiles"]&&(A["3d-tiles"]=v["3d-tiles"]),!A.textureOptions&&v.textureOptions&&(A.textureOptions=v.textureOptions),!A.textureOptions&&this.textureOptions&&(A.textureOptions=this.textureOptions);var b=[];if(Array.isArray(e))for(var T=0,_=e;T<_.length;T++){var S=_[T];S instanceof Work?b.push(S):typeof S!="string"&&"work"in S?b.push(parseWork(S.work,S)):b.push(parseWork(S))}else e instanceof Work?b.push(e):b.push(parseWork(e));v.mode==="add"&&(b=[].concat(this.works,b));var w;try{w=createWorks(b)}catch(Z){return this.throwError(Z),Promise.reject(Z)}for(var R=0,I=w;R<I.length;R++){var H=I[R];this.bindWorkFetcher(H)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var C=this.currentMode,M=w.initial,B=M.work.observers[0],L=B?{workCode:B.work.workCode,panoIndex:B.panoIndex}:{workCode:M.work.workCode,panoIndex:0},O=(l=M.mode)!==null&&l!==void 0?l:B?"Panorama":"Mapview",k={};if(r==="inherit"){var D=this.getCurrentState(),q=w.filter(function(Z){return Z.workCode===D.workCode})[0];if(q)L={workCode:D.workCode,panoIndex:D.panoIndex},O=D.mode,k={longitude:D.latitude,latitude:D.latitude,fov:D.fov,distance:D.distance,offset:D.offset.clone()};else{r={mode:C};var z=(f=(c=w[0])===null||c===void 0?void 0:c.observers)===null||f===void 0?void 0:f[this.panoIndex];z?(r.workCode=z.work.workCode,r.panoIndex=z.panoIndex):typeof w.initial.panoIndex=="number"?(r.workCode=w.initial.work.workCode,r.panoIndex=w.initial.panoIndex):(r.mode==="Panorama"||r.mode==="VRPanorama"||r.mode==="XRPanorama")&&(r.mode="Mapview"),r.mode===C&&(r.longitude=this.camera.pose.longitude,r.latitude=this.camera.pose.latitude,r.fov=this.camera.pose.fov)}}if(r==="initial"&&(typeof M.panoIndex=="number"&&(L={workCode:M.work.workCode,panoIndex:M.panoIndex}),M.mode&&(O=M.mode),k={longitude:M.longitude,latitude:M.latitude,fov:M.fov,distance:M.distance,offset:(p=M.offset)===null||p===void 0?void 0:p.clone()}),typeof r=="object"){if(O=(d=r.mode)!==null&&d!==void 0?d:C,typeof r.panoIndex=="number"){var z=w.getObserver({workCode:(g=(h=r.workCode)!==null&&h!==void 0?h:M.work.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex});z&&(L={workCode:z.work.workCode,panoIndex:z.panoIndex})}k={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset?new THREE__namespace.Vector3().copy(r.offset):void 0}}var J=(m=v.duration)!==null&&m!==void 0?m:this.modeChangeDuration;(O==="Floorplan"||O==="Topview"||O==="Mapview")&&C===O&&(J=0);var V="fly";(O==="Panorama"||O==="VRPanorama"||O==="XRPanorama")&&C===O&&(V=(E=v.effect)!==null&&E!==void 0?E:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:w,userAction:s}));var U=function(Z,X,se){var G=u.getCurrentState(),W=__assign(__assign({mode:Z},X),se);r==="inherit"&&(W=u.getCurrentState()),u.pano=X;var $=__assign(__assign({initial:{state:W,currentState:G,duration:J,effect:V,userAction:s}},u.commonParams()),u.controllerInits[Z]),ne=Controllers[W.mode].initAnimationEndState($);if(u.controller&&C===Z)u.controller.updateWork(w,ne,{effect:V,duration:J},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(Z,$));else{if(u.controller)u.controller.destroy();else{var te=Controllers[Z].initAnimationEndState($);u.camera.setFromPose(te),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(Z,$);var ve=createEvent("mode.change",{prevMode:C,mode:Z,state:ne,userAction:s});try{u.emit("mode.change",ve)}catch(oe){console.error(oe)}}u.updateTime.apply(u,__spreadArray([u.currentUpdateArgs.time,0],u.currentUpdateArgs.args,!1))};worksMap.set(this,w);var j=Promise.resolve();if(O===t.Mode.Floorplan||O===t.Mode.Topview||O===t.Mode.Mapview||O===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(k),assignPose(this.state,this.camera.pose));var K=this.modelScene.setModels(w,A);j=Promise.all(K.map(function(Z){return Z.loadedReady})).then(function(){u.needsRender=!0,U(O,L,k),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{U(O,L,k);var ae=this.controller,re=!1;this.modelScene.autoRefine=!1;var ee=function(){u.works===w&&re===!1&&(u.needsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),re=!0,u.modelScene.autoRefine=!0),ae.off("pano.arrived",ee),ae.off("pano.cancel",ee)},K=this.modelScene.setModels(w,A);j=Promise.all(K.map(function(X){return X.initReady})).then(noop),ae.once("pano.arrived",ee),ae.once("pano.cancel",ee),setTimeout(ee,((y=v.duration)!==null&&y!==void 0?y:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,userAction:s,works:w})),j.then(function(){return u.ready()}).then(function(){var Z;u.emit("works.ready",createEvent("works.ready",{input:e,userAction:s,works:w})),(Z=u.analysis)===null||Z===void 0||Z.work(w)})},t.prototype.reset=function(){var e=this,r=this.loadWorkTask.then(function(){return e.reset_()});return this.loadWorkTask=r.catch(function(o){e.throwError(o)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var o;e.controller&&(e.controller.destroy(),e.controller=void 0);var s=e.modelScene.parameter;s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((o=s.pano0)===null||o===void 0?void 0:o.map)&&s.pano1.map.dispose(),s.set({pano0:null,pano1:null,modelAlpha:1}),worksMap.set(e,emptyWorks),e.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0}),e.renderer&&e.modelScene.update(e.renderer,e.camera),e.needsRender=!0,e.currentMode="Panorama",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.camera.needsRender=!1,e.needsRender=!1,r()})},t.prototype.changeMode=function(e,r,o,s,u){var l=this;return r===void 0&&(r={}),s===void 0&&(s=!0),u===void 0&&(u=!1),new Promise(function(c,f){var p,d,h,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var m=0;l.controller&&(typeof o=="number"?m=o:m=(p=o==null?void 0:o.duration)!==null&&p!==void 0?p:l.modeChangeDuration);var E="fly";l.controller&&typeof o=="object"&&o.effect&&(E=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(g=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));l.throwError(v),f(v);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!l.works.getObserver(y)){var v=new Error("PanoId ".concat(panoStringify(y)," not existed."));l.throwError(v),f(v);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&l.modelScene.empty&&(m=0);var A=l.controller,b=l.currentMode,T=function(){if(l.controller&&l.controller.stopMomentumMovement(),l.controller&&u===!1&&b===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?!panoEqual(l.pano,y)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(y,__assign({duration:m},r),s):l.controller.updateCamera(r,m,s).catch(noop):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,m,s).catch(noop));else{var S=__assign(__assign({},r),y),w=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:m,effect:E,userAction:s}},l.commonParams()),l.controllerInits[e]),R=Controllers[e].initAnimationEndState(w),I=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:R,userAction:s});if(l.emit("mode.change.request",I),!I.defaultPrevented){A&&A.destroy(),l.controller=l.applyController(e,w);var H=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:R,userAction:s});l.emit("mode.change",H)}}c()},_=AnimationFrameLoop.shared.getContext();_&&(typeof XRSession!="undefined"&&_ instanceof XRSession&&_.end(),AnimationFrameLoop.shared.setContext(null)),e===t.Mode.VRPanorama?(l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.exitFullscreen(),l.throwError(w),f(w)})):e===t.Mode.XRPanorama?requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),u=!0,T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.throwError(w),f(w)}):T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var f=now(),p=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),h=this.getSize(new THREE__namespace.Vector2),g=0,m=0,E=1,y=1,v,A,b,T,_;typeof e=="number"?(g=e,typeof r=="number"&&(m=r),typeof o=="number"&&(E=o),typeof s=="number"&&(y=s),v=u,A=l,_=c):(g=e.x,m=e.y,E=e.width,y=e.height,v=e.pixelRatio,A=e.flipY,b=e.helperVisible,T=e.skipPanorama,_=e.buffer),g=Math.floor(g),m=Math.floor(m),E=Math.floor(E),y=Math.floor(y),v=Math.floor(v!=null?v:p),A=A!=null?A:!1;var S=this.helperVisible,w=this.modelScene.parameter.modelAlpha;this.helperVisible=b!=null?b:this.helperVisible,T&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&T===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(E*v,y*v),this.renderer.setRenderTarget(R),this.camera.pixelRatio=v,this.camera.resolution.set(E,y),this.camera.setViewOffset(h.width,h.height,g,h.height-m-y,E,y),this.camera.aspect=h.width/h.height,this.camera.updateTime(f),this.scene.update(this.renderer,this.camera);var I=this.renderer.autoClear,H=this.renderer.autoClearColor,C=this.renderer.autoClearDepth,M=this.renderer.autoClearStencil,B=scratchClearColor.copy(this.renderer.getClearColor()),L=this.renderer.getClearAlpha(),O=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);var k=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:k,this.renderer.render(this.scene,this.camera),this.scene.background=k,this.renderer.autoClear=I,this.renderer.autoClearColor=H,this.renderer.autoClearDepth=C,this.renderer.autoClearStencil=M,this.renderer.setClearColor(B,L),this.renderer.setScissorTest(O),this.helperVisible=S,w===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",w),this.renderer.setRenderTarget(d),this.camera.clearViewOffset(),this.camera.pixelRatio=p,this.camera.resolution.copy(h),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(f),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var D=E*v,q=y*v,z=D*q,J=z*4;if(_){if(_.length!==J)throw new Error("buffer length is not equals pixels ".concat(J))}else _=new Uint8Array(J);if(this.renderer.readRenderTargetPixels(R,0,0,E*v,y*v,_),A)for(var V=z/2,U=0,j=0,K=0,ae=0;j<V;j++)for(ae=(q-Math.floor(j/D)-1)*D+j%D,K=0;K<4;K++)U=_[j*4+K],_[j*4+K]=_[ae*4+K],_[ae*4+K]=U;return _},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},t.prototype.render=function(e){var r=this.renderer;if(r){var o=r.getRenderTarget();r.setRenderTarget(null);var s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,f=scratchClearColor.copy(r.getClearColor()),p=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),g=r.getScissorTest();r.autoClear=!0,r.autoClearColor=!0,r.autoClearDepth=!0,r.autoClearStencil=!0;var m=r.getSize(scratchRenderSize),E=Math.floor(m.x*this.viewport.left),y=Math.floor(m.y*this.viewport.bottom),v=Math.floor(m.x*this.viewport.width),A=Math.floor(m.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(E,y,v,A),r.setScissor(E,y,v,A);var b=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(b);var T=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:T;var _=!0;if(this.controller){var S=this.controller.render();S&&(_=!1)}if(_){var w=this.fiveRenderer.render(r,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&w&&renderPoweredByRealsee(r)}this.scene.background=T,r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(f,p),r.setViewport(d),r.setScissor(h),r.setScissorTest(g),r.setRenderTarget(o),e&&AnimationFrameLoop.shared.add(e,!0)}},t.prototype.updateTime=function(e,r){for(var o,s=this,u=[],l=2;l<arguments.length;l++)u[l-2]=arguments[l];if(this.currentUpdateArgs={time:e,args:u},!this.destroyed){if(this.renderer&&ktx2.detectSupport(this.renderer),this.syncingState=this.syncState(e,r),this.controller&&(o=this.controller).updateTime.apply(o,__spreadArray([e,r],u,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var c=this.modelScene.loaded,f=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),c===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),AnimationFrameLoop.shared.add(function(){s.emit("models.load",createEvent("models.load",{modelScene:s.modelScene}))},!0,0,10)),f===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.modelScene.boundingMesh);var p=scratchBox3.getBoundingSphere(scratchSphere),d=p.radius*2;p.containsPoint(this.camera.position)||(d=this.camera.position.distanceTo(p.center)+p.radius),d=clamp$1(d,800);var h=d/1e4;h=clamp$1(h,.03,.1),this.camera.near!==h&&(this.camera.near=h),this.camera.far!==d&&(this.camera.far=d),this.camera.updateTime(e)}if(this.renderer){var g=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=g}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused!==!0){var m=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",m),m.defaultPrevented&&(this.needsRender=!1);var E=this.needsRender;this.render(),this.needsRender=!1,this.emit("render",createEvent("render",{needsRender:E})),this.hasListener("fps")&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={}),o===void 0&&(o=!0);var s=this,u=s.controller,l=s.renderer;if(!u)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!l)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();typeof e=="number"&&this.pano.workCode&&(e={workCode:this.pano.workCode,panoIndex:e});var c=this.works.getObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var f={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(f,r,o):c&&(this.pano=f,this.once("initAnimation.start",function(p){r.moveStartCallback&&r.moveStartCallback(p.state)}),this.once("initAnimation.end",function(p){r.moveEndCallback&&r.moveEndCallback(p.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},o)),this.ready()},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop);var s=this.works.getObserver(e);if(!s)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var u=["right","left","up","down","front","back"],l=now();return Promise.all(u.map(function(c){var f=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),p=__assign({key:"pano.".concat(f,".").concat(c)},pick(o.imageOptions,["size","format","quality","forceUseExifOrientation","mappings"])),d=s.work.getURL(s.images[c]),h=o.imageOptions.transform?o.imageOptions.transform(d,p):imageURL(d,p);return getFetcher(o.fiveId,s.work).preload(h)})).then(function(){var c=now()-l;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.camera.position,s=e.clone().sub(o),u=new THREE__namespace.Raycaster(o,s.clone().normalize());u.params.Points={threshold:.1};var l=this.modelScene.intersectRaycaster(u)[0];if(l&&l.distance+.01<s.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var f=this.renderer.getSize(new THREE__namespace.Vector2),p=f.x*this.viewport.width,d=f.y*this.viewport.height,h=f.x*this.viewport.left+(c.x+1)/2*p,g=f.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,g)},t.prototype.getCurrentState=function(){return __assign(__assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,o){var s,u,l,c,f,p,d,h,g,m;r===void 0&&(r=!1),o===void 0&&(o=!0),e=pick(e,["mode","workCode","panoIndex","longitude","latitude","fov","offset","distance"]),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var E;if(typeof e.panoIndex=="number")if(e.workCode)E={workCode:e.workCode,panoIndex:e.panoIndex};else{var y=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",v=this.state.workCode;this.works.filter(function(M){return M.workCode===v}).length>0&&(y=v),E={workCode:y,panoIndex:e.panoIndex}}var A=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,w;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==A){if(A==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var R={workCode:E==null?void 0:E.workCode,panoIndex:E==null?void 0:E.panoIndex};typeof e.longitude=="number"&&(R.longitude=e.longitude),typeof e.latitude=="number"&&(R.latitude=e.latitude),typeof e.fov=="number"&&(R.fov=e.fov),typeof e.distance=="number"&&(R.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(R.offset=e.offset);var I=__assign(__assign({initial:{state:R,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[A]),H=Controllers[A].initAnimationEndState(I);b=H.longitude,T=H.latitude,_=H.fov,S=H.offset,w=H.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(f=e.latitude)!==null&&f!==void 0?f:this.state.latitude,_=(p=e.fov)!==null&&p!==void 0?p:this.state.fov,S=(d=e.offset)!==null&&d!==void 0?d:this.state.offset,w=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(E!=null?E:this.pano).workCode,panoIndex:(E!=null?E:this.pano).panoIndex,mode:A,longitude:b,latitude:T,fov:_,offset:S,distance:w};this.emit("state.set",createEvent("state.set",{userAction:o,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode==="VRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("VRPanorama")):this.controller&&C.mode==="XRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("XRPanorama")):(assignState(this.state,C),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===C.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((g=this.controller)===null||g===void 0||g.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:o,state:this.state})),(m=this.analysis)===null||m===void 0||m.state(this.works,this.state)))},t.prototype.syncState=function(e,r,o){o===void 0&&(o=!1);var s=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){var u={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,u,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},l),{duration:o?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,l,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var f=1,p=.2,d=.2,h=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,f),m=Math.abs(this.camera.pose.distance-this.state.distance),E=m>d*15?m/15:p,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,E),v=this.camera.pose.offset.distanceTo(this.state.offset),A=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,A),T=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},h),_=T.longitude,S=T.latitude;if(notSimilarValue(g,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var w={x:b.x,y:b.y,z:b.z},R={fov:g};return Object.assign(w,{distance:y}),Object.assign(R,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(R,0).catch(noop),this.controller.locationMotion.set(w,0).catch(noop),!0}}else{var I=1,H=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,I),C=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},H),_=C.longitude,S=C.latitude,y=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(b,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)||notSimilarValue(g,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,fov:g},0).catch(noop),!0}if(this.stateSynced=!0,s===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var M=this.currentMode,B=M===t.Mode.Floorplan||M===t.Mode.Topview||M===t.Mode.Mapview||M===t.Mode.Model;if(!B||this.modelScene.loaded){var L=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var O=0,k=L;O<k.length;O++){var D=k[O];this.controller instanceof Controllers.Panorama&&D.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(D):D()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(o){var s;r.readyCallbacks.push(Object.assign(o,{tile:(s=e.tile)!==null&&s!==void 0?s:!1}))}).then(function(){return r.model.initReady}).then(noop)},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.bindModel=function(e){var r=this,o=function(){AnimationFrameLoop.shared.add(function(){r.emit("model.load",createEvent("model.load",{work:e.work,model:e,error:null}))},!0)},s=function(c){var f=c.error;r.emit("model.error",createEvent("model.error",{work:e.work,model:e,error:f})),r.throwError(f)},u=function(){r.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:e.work,model:e,error:null}))},l=function(){e.removeEventListener("load",o),e.removeEventListener("error",s),e.removeEventListener("changeShownFloor",u),e.removeEventListener("dispose",l)};e.addEventListener("load",o),e.addEventListener("error",s),e.addEventListener("changeShownFloor",u),e.addEventListener("dispose",l),this.emit("model.request",createEvent("model.request",{work:e.work,model:e,error:null}))},t.prototype.bindWorkFetcher=function(e){var r=this,o=e.workCode,s=e.allowHosts,u=new Fetcher({get networkSubscribe(){return r.networkSubscribe},requestProxy:function(l){return Promise.resolve(l).then(function(c){return r.requestProxy(c,o)}).then(function(c){var f=verifyURL(c,s);return f instanceof Error?Promise.reject(f):f})}});registerFetcher(this.fiveId,e,u)},t.prototype.commonParams=function(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var m=[],E=0;E<arguments.length;E++)m[E]=arguments[E];var y=o.emit.apply(o,__spreadArray([g],m,!1));if(y)return!1})},c=0,f=PROXY_CONTROLLER_EVENT_NAMES;c<f.length;c++){var p=f[c];l(p)}{var d=Controllers[e].initAnimationEndState(r),h=r.initial.userAction;stateEqual(this.state,d)||(assignState(this.state,d),this.emit("state.change",createEvent("state.change",{userAction:h,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:this.getCurrentState()}))}return u.on("camera.update",function(g){var m;if(o.controller){var E=o.controller.getTargetState();g.userAction&&o.syncingState===!1&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:g.userAction,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:g.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.arrived",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.cancel",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:m,state:o.getCurrentState()}))}),u.on("pano.request",function(g){o.emit("pano.request",g),g.defaultPrevented||o.moveToPano(g.state,g.options,g.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(g){return o.throwError(g)}),u},t.prototype.removeEventListeners=function(){},Object.defineProperty(t.prototype,"internalLightsEnabled",{get:function(){var e=this.scene.children.find(function(r){return r.name==="internalLights"});return e?e.visible:!1},set:function(e){var r=this.scene.children.find(function(o){return o.name==="internalLights"});r&&(r.visible=e),r=this.modelScene.children.find(function(o){return o.name==="internalLights"}),r&&(r.visible=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scissor",{get:function(){return this.viewport},enumerable:!1,configurable:!0}),t.prototype.setScissor=function(e){return this.setViewport(e)},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,o=e.latitude,s=e.fov,u=e.offset,l=e.distance;return{longitude:r,latitude:o,fov:s,offset:u.clone(),distance:l}},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,o=e.latitude;return{longitude:r,latitude:o}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;r.matrix.copy(e.matrix).premultiply(e.work.transform),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1;var o=new THREE__namespace.Vector3(0,0,-1);o.applyQuaternion(this.camera.quaternion);var s=r.quaternion.clone().inverse();o.applyQuaternion(s);var u=Math.atan2(o.x,-o.z),l=-Math.asin(o.y);return{theta:u,phi:l,lookAtVector:o}}}return null},t.prototype.addPass=function(e){this.fiveRenderer.composer.addPass(e)},t.prototype.removePass=function(e){var r=this.fiveRenderer.composer.passes.indexOf(e);r!==-1&&this.fiveRenderer.composer.passes.splice(r,1)},t.prototype.insertPass=function(e,r){this.fiveRenderer.composer.insertPass(e,r)},Object.defineProperty(t.prototype,"renderMode",{get:function(){return this.fiveRenderer.renderMode},set:function(e){this.fiveRenderer.renderMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.fiveRenderer.renderMode==="point-cloud-high-quality"},set:function(e){this.fiveRenderer.renderMode=e?"point-cloud-high-quality":"default",this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.eyeDomeLightingPass.enabled},set:function(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableAdaptiveLuminance",{get:function(){return this.adaptiveLuminancePass.enabled},set:function(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelSceneNeedsRender",{get:function(){return this.modelScene.needsRender},set:function(e){this.modelScene.needsRender=e},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t})(Subscribe);if(typeof window!="undefined"){var __FIVE_DEBUG__={THREE:THREE__namespace,constructor:Five,instances:Five_Instances};Object.assign(window,{__FIVE_DEBUG__})}var XRButton=(function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function o(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function s(){o(),e.textContent="VR NOT SUPPORTED"}function u(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",u(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():s()}),e;var l=document.createElement("a");return window.isSecureContext===!1?(l.href=document.location.href.replace(/^http:/,"https:"),l.innerHTML="WEBXR NEEDS HTTPS"):(l.href="https://immersiveweb.dev/",l.innerHTML="WEBXR NOT AVAILABLE"),l.style.left="calc(50% - 90px)",l.style.width="180px",l.style.textDecoration="none",u(l),l},n})();exports.AdaptiveLuminancePass=AdaptiveLuminancePass;exports.AnimationFrameLoop=AnimationFrameLoop;exports.BoundingMesh=BoundingMesh$1;exports.Camera=Camera;exports.CustomShader=PBMCustomShader;exports.EffectComposer=EffectComposer;exports.EyeDomeLightingPass=EyeDomeLightingPass;exports.Fetcher=Fetcher;exports.Five=Five;exports.FivePass=FivePass;exports.FiveRenderer=FiveRenderer;exports.FullScreenQuad=FullScreenQuad;exports.InternalWebGLRenderer=InternalWebGLRenderer;exports.Model=Model;exports.ModelScene=ModelScene;exports.Motion=Motion;exports.NetworkSubscribe=NetworkSubscribe;exports.PBMContainer=PBMContainer;exports.PBMCustomShader=PBMCustomShader;exports.PBMGroup=PBMGroup;exports.PBMMesh=PBMMesh;exports.PBMMeshMaterial=PBMMeshMaterial;exports.PBMPointCloud=PBMPointCloud;exports.PBMPointCloudMaterial=PBMPointCloudMaterial;exports.PBMSkinnedMesh=PBMSkinnedMesh;exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES;exports.PanoCircleMesh=PanoCircleMesh;exports.PanoCircleMeshCustom=PanoCircleMeshCustom;exports.PanoCircleMeshSolid=PanoCircleMeshSolid;exports.Parameter=Parameter;exports.Scene=Scene;exports.Subscribe=Subscribe;exports.TextureLoader=TextureLoader;exports.Tile=Tile;exports.Tile3D=Tile3D;exports.Tile3DModel=Tile3D;exports.TileCache=TileCache;exports.TileNode=TileNode;exports.TileRequestScheduler=TileRequestScheduler;exports.Tileset=Tileset;exports.Trajectory=Trajectory;exports.TrajectoryNode=TrajectoryNode;exports.Work=Work;exports.WorkResolvedObserver=WorkResolvedObserver;exports.XRButton=XRButton;exports.controllersDefaultInitArgs=controllersDefaultInitArgs;exports.coordinatesToVector=coordinatesToVector;exports.createDebugBoundingMesh=createDebugBoundingMesh;exports.createWorks=createWorks;exports.defaultImageURLTransform=imageURL;exports.draco=draco;exports.getViewportScale=getViewportScale;exports.headingToLongitude=headingToLongitude;exports.imageSupport=imageSupport;exports.isBoundingVolume=isBoundingVolume;exports.isPanoId=isPanoId;exports.ktx2=ktx2;exports.loadAt3d=loadAt3d;exports.loadB3dm=loadB3dm;exports.loadDome=loadDome;exports.loadDomez=loadDomez;exports.loadFbx=loadFbx;exports.loadGltf=loadGltf;exports.loadPbm=loadPbm;exports.loadPly=loadPly;exports.loadPnts=loadPnts;exports.loadX3p=loadX3p;exports.longitudeToHeading=longitudeToHeading;exports.makeBoundingVolume=makeBoundingVolume;exports.panoEqual=panoEqual;exports.panoParse=panoParse;exports.panoStringify=panoStringify;exports.parseWork=parseWork;exports.vectorToCoordinates=vectorToCoordinates;exports.workToJson=workToJson;
|