@realsee/five 6.6.0-alpha.8 → 6.6.0-alpha.9
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/docs/assets/hierarchy.js +1 -1
- package/docs/classes/five.Five.html +36 -36
- package/docs/classes/five.Model.html +1 -1
- package/docs/classes/five.ModelScene.html +1 -1
- package/docs/classes/five.PBMContainer.html +1 -1
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PBMMeshMaterial.html +1 -1
- package/docs/classes/five.PBMPointCloud.html +1 -1
- package/docs/classes/five.PBMPointCloudMaterial.html +1 -1
- package/docs/classes/five.PBMSkinnedMesh.html +1 -1
- package/docs/classes/five.Parameter.html +1 -1
- package/docs/classes/five.Tile3DModel.html +1 -1
- package/docs/classes/five.TileNode.html +1 -1
- package/docs/classes/five.TrajectoryNode.html +1 -1
- package/docs/classes/five.WorkResolvedObserver.html +1 -1
- package/docs/classes/gltf-loader.DDSLoader.html +1 -1
- package/docs/classes/gltf-loader.DRACOLoader.html +1 -1
- package/docs/classes/gltf-loader.GLTFObject.html +1 -1
- package/docs/classes/gltf-loader.THREEGLTFLoader.html +1 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/plugins.RoundedBoxGeometry.html +1 -1
- package/docs/classes/vfx.Airflow.html +1 -1
- package/docs/classes/vfx.Flame.html +1 -1
- package/docs/classes/vfx.Particle.html +1 -1
- package/docs/classes/vfx.ParticleGPU.html +1 -1
- package/docs/classes/vfx.SpotLight.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/five.EventCallback.html +1 -1
- package/docs/interfaces/five.LooseWorkPanorama.html +1 -1
- package/docs/interfaces/five.LooseWorkWithExtrinsics.html +1 -1
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelLike.html +1 -1
- package/docs/interfaces/five.PBMMaterial.html +1 -1
- package/docs/interfaces/five.PBMMeshMaterialParameters.html +1 -1
- package/docs/interfaces/five.PBMPointCloudMaterialParameters.html +1 -1
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ParameterMaterialValue.html +1 -1
- package/docs/interfaces/five.ParameterTilesetValue.html +1 -1
- package/docs/interfaces/five.ParameterValue.html +1 -1
- package/docs/interfaces/five.ResolvedParameterValue.html +1 -1
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ViewLayer.html +1 -1
- package/docs/interfaces/five.WorkCubeImage.html +1 -1
- package/docs/interfaces/five.WorkImage.html +1 -1
- package/docs/interfaces/five.WorkObserver.html +1 -1
- package/docs/interfaces/five.WorkTile.html +1 -1
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/plugins.BackgroundPluginController.html +1 -1
- package/docs/interfaces/plugins.BackgroundPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.ItemMaskController.html +1 -1
- package/docs/interfaces/plugins.ItemMaskPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.ItemMaskPluginType.State.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginController.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginType.State.html +1 -1
- package/docs/interfaces/plugins.PanoAnimeController.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.State.html +1 -1
- package/docs/interfaces/plugins.PluginTemplateType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PluginTemplateType.State.html +1 -1
- package/docs/interfaces/plugins.TrajectoryController.html +1 -1
- package/docs/interfaces/react.FiveInjectionTypes.html +1 -1
- package/docs/types/five.ParseOptions.html +1 -1
- package/five/index.d.ts +0 -2
- package/five/index.js +11 -11
- package/five/index.mjs +189 -187
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/plugins/index.js +2 -2
- package/plugins/index.mjs +2 -2
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/shader-lib/index.js +2 -2
- package/shader-lib/index.mjs +2 -2
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +3 -3
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +2 -2
- package/umd/five-react.js +2 -2
- package/umd/five-shader-lib.js +2 -2
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five-vue.js +2 -2
- package/umd/five.js +11 -11
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
- package/work-downloader/index.js +2 -2
- package/work-downloader/index.mjs +2 -2
package/five/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 9/
|
|
5
|
-
* Version: 6.6.0-alpha.
|
|
4
|
+
* Generated: 9/3/2025
|
|
5
|
+
* Version: 6.6.0-alpha.9
|
|
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 y=new Uint8Array(v.length),b=0;b<v.length;++b){var T=v.charCodeAt(b);y[b]=T>96?T-97:T>64?T-39:T+4}for(var _=0,b=0;b<v.length;++b)y[_++]=y[b]<60?r[y[b]]:(y[b]-60)*64+y[++b];return y.buffer.slice(0,_)}function c(v,y,b,T,_,S){var R=s.exports.sbrk,w=b+3&-4,M=R(w*T),O=R(_.length),C=new Uint8Array(s.exports.memory.buffer);C.set(_,O);var P=v(M,b,T,O,_.length);if(P==0&&S&&S(M,w,T),y.set(C.subarray(M,M+b*T)),R(M-R(0)),P!=0)throw new Error("Malformed buffer data: "+P)}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 y={object:new Worker(v),pending:0,requests:{}};return y.object.onmessage=function(b){var T=b.data;y.pending-=T.count,y.requests[T.id][T.action](T.value),delete y.requests[T.id]},y}function A(v){for(var y="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()+E.toString(),b=new Blob([y],{type:"text/javascript"}),T=URL.createObjectURL(b),_=0;_<v;++_)d[_]=g(T);URL.revokeObjectURL(T)}function m(v,y,b,T,_){for(var S=d[0],R=1;R<d.length;++R)d[R].pending<S.pending&&(S=d[R]);return new Promise(function(w,M){var O=new Uint8Array(b),C=h++;S.pending+=v,S.requests[C]={resolve:w,reject:M},S.object.postMessage({id:C,count:v,size:y,source:O,mode:T,filter:_},[O.buffer])})}function E(v){u.then(function(){var y=v.data;try{var b=new Uint8Array(y.count*y.size);c(s.exports[y.mode],b,y.count,y.size,y.source,s.exports[y.filter]),self.postMessage({id:y.id,count:y.count,action:"resolve",value:b},[b.buffer])}catch(T){self.postMessage({id:y.id,count:y.count,action:"reject",value:T})}})}return{ready:u,supported:!0,useWorkers:function(v){A(v)},decodeVertexBuffer:function(v,y,b,T,_){c(s.exports.meshopt_decodeVertexBuffer,v,y,b,T,s.exports[f[_]])},decodeIndexBuffer:function(v,y,b,T){c(s.exports.meshopt_decodeIndexBuffer,v,y,b,T)},decodeIndexSequence:function(v,y,b,T){c(s.exports.meshopt_decodeIndexSequence,v,y,b,T)},decodeGltfBuffer:function(v,y,b,T,_,S){c(s.exports[p[_]],v,y,b,T,s.exports[f[S]])},decodeGltfBufferAsync:function(v,y,b,T,_){return d.length>0?m(v,y,b,p[T],f[_]):u.then(function(){var S=new Uint8Array(v*y);return c(s.exports[p[T]],S,v,y,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,A=new ArrayBuffer(h*g),m=new Uint8Array(f,p,d);return meshoptDecoder.decodeGltfBuffer(new Uint8Array(A),h,g,m,u.mode,u.filter),A})}else return null},t})(BaseExtension),EXTENSION_NAME$2="EXT_texture_webp",EXT_texture_webp=(function(n){__extends(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.supportsWep=!1,e}return t.prototype.prepare=function(e){var r=this;return imageSupport().then(function(o){r.supportsWep=o.webp})},t.prototype.loadTexture=function(e,r){var o=r.json,s=o.textures[e];if(!s.extensions||!s.extensions[EXTENSION_NAME$2]||!this.supportsWep)return null;var u=s.extensions[EXTENSION_NAME$2];return r.loadImage(u.source).then(function(l){var c=new THREE__namespace.Texture(l);c.needsUpdate=!0,c.flipY=!1,s.name&&(c.name=s.name);var 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=p[0],h=p[1],g=[],A=0;A<u.length;A++){var m=u[A],E=d[A],v=h[A],y=m.mode||WEBGL_CONSTANTS.TRIANGLES,b=void 0;if(y===WEBGL_CONSTANTS.TRIANGLES||y===WEBGL_CONSTANTS.TRIANGLE_STRIP||y===WEBGL_CONSTANTS.TRIANGLE_FAN)if(y===WEBGL_CONSTANTS.TRIANGLE_STRIP?E=r.toGeometryTrianglesDrawMode(E,THREE__namespace.TriangleStripDrawMode):y===WEBGL_CONSTANTS.TRIANGLE_FAN&&(E=r.toGeometryTrianglesDrawMode(E,THREE__namespace.TriangleFanDrawMode)),E.clearGroups(),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,0),r.disposeSet.add(E),s.isSkinnedMesh){var T=new PBMSkinnedMesh(E,[v]);E.attributes.skinWeight.normalized||T.normalizeSkinWeights(),b=T}else b=new PBMMesh(E,[v]);else if(y===WEBGL_CONSTANTS.POINTS)b=new PBMPointCloud(E,v);else throw new Error("glTF: Primitive mode unsupported: "+y);if(Object.keys(E.morphAttributes).length>0){if(s.weights!==void 0)for(var _=0,S=s.weights.length;_<S;_++)b.morphTargetInfluences[_]=s.weights[_];if(s.extras&&Array.isArray(s.extras.targetNames)){var R=s.extras.targetNames;if(b.morphTargetInfluences.length===R.length){b.morphTargetDictionary={};for(var _=0,S=R.length;_<S;_++)b.morphTargetDictionary[R[_]]=_}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}b.name=s.name||"mesh_"+e,r.assignFinalMaterial(b),g.push(b)}if(g.length===1)return g[0];for(var w=new THREE__namespace.Group,M=0,O=g;M<O.length;M++){var b=O[M];w.add(b)}return w});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.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){r.disposeSet.add(h),h.encoding=THREE__namespace.sRGBEncoding,u.map=h})),u.metalness=c.metallicFactor!==void 0?c.metallicFactor:1,u.roughness=c.roughnessFactor!==void 0?c.roughnessFactor:1,c.metallicRoughnessTexture!==void 0&&o.push(r.createMaterialTexture(c.metallicRoughnessTexture).then(function(h){r.disposeSet.add(h),h.encoding=THREE__namespace.sRGBEncoding,u.roughnessMap=h,u.metalnessMap=h})),l.doubleSided===!0&&(u.side=THREE__namespace.DoubleSide);var 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){u.aoMap=h,r.disposeSet.add(h)})),l.occlusionTexture.strength!==void 0&&(u.aoMapIntensity=l.occlusionTexture.strength)),l.emissiveFactor!==void 0&&(u.emissive=new THREE__namespace.Color().fromArray(l.emissiveFactor)),l.emissiveTexture!==void 0&&o.push(r.createMaterialTexture(l.emissiveTexture).then(function(h){u.emissiveMap=h,r.disposeSet.add(h)}))}return r.disposeSet.add(u),Promise.all(o).then(function(){return u})},t})(BaseExtension),EXTENSION_NAME="REALSEE_materials_lightmap",REALSEE_materials_lightmap=(function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.extendMaterial=function(e,r,o){var s=[];if(o.json.materials&&r.material!==void 0){var u=o.json.materials[r.material],l=u.extensions[EXTENSION_NAME];l&&(l.lightMapTexture!==void 0&&s.push(o.createMaterialTexture(l.lightMapTexture).then(function(c){e.lightMap=c})),l.lightMapIntensity!==void 0&&(e.lightMapIntensity=l.lightMapIntensity))}return Promise.all(s).then(function(){})},t})(BaseExtension),EXTENSIONS={KHR_binary_glTF,KHR_draco_mesh_compression,KHR_texture_basisu,KHR_texture_transform,KHR_mesh_quantization,KHR_materials_unlit,EXT_meshopt_compression,EXT_texture_webp,CESIUM_RTC,REALSEE_materials_lightmap,PBM_mesh};function parseGltf(n,t){var e,r,o,s={},u,l;if(typeof n=="string")l=n;else{var c=EXTENSIONS.KHR_binary_glTF.getMagic(n);if(c===EXTENSIONS.KHR_binary_glTF.HEADER_MAGIC){u=new EXTENSIONS.KHR_binary_glTF;try{u.loadGlbBinary(n)}catch(A){return Promise.reject(A)}s.KHR_binary_glTF=u,l=u.content}else l=decodeText(new Uint8Array(n))}var 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:!0,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(A){return u&&u.clear(),A})}function loadB3dm(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.modelUpAxis)!==null&&e!==void 0?e:"Y",u=(r=t.upAxis)!==null&&r!==void 0?r:"Z",l=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,c={uri:n};return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"}).then(function(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),delete c.featureTableBinary,delete c.batchTableBinary,delete c.gltfArrayBuffer,{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()}}})})}var WorkerPool=(function(){function n(t,e){this.disposed=!1,this.pool=e,this.workerCreator=t,this.queue=[],this.workers=[],this.workerResolvers=[],this.workerStatus=0}return n.prototype.initWorker=function(t){if(this.workerCreator&&!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this.onMessage.bind(this,t)),this.workers[t]=e}},n.prototype.getIdleWorker=function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1},n.prototype.onMessage=function(t,e){var r=this.workerResolvers[t];if(e.data&&"$$error"in e.data?r==null||r.reject(e.data.$$error):r==null||r.resolve(e.data),this.workerResolvers[t]=void 0,this.queue.length){var o=this.queue.shift(),s=o.resolve,u=o.reject,l=o.input,c=o.transfer;this.workerResolvers[t]={resolve:s,reject:u},this.workers[t].postMessage(l,c)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(o,s){if(r.disposed){s(new Error("disposed"));return}var u=r.getIdleWorker();u!==-1?(r.initWorker(u),r.workerStatus|=1<<u,r.workerResolvers[u]={resolve:o,reject:s},r.workers[u].postMessage(t,e)):r.queue.push({resolve:o,reject:s,input:t,transfer:e})})},n.prototype.dispose=function(){this.disposed=!0,this.workers.forEach(function(t){t.terminate()}),this.workers.length=0,this.workerResolvers.forEach(function(t){t==null||t.reject(new Error("disposed"))}),this.workerResolvers.length=0,this.queue.forEach(function(t){t.reject(new Error("disposed"))}),this.queue.length=0,this.workerStatus=0},n})();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"),A;if(h)A=h;else if(d){for(var m=d.count,E=d.array,v=new Uint8Array(m*4),y=0,b=void 0,T=void 0;y<m;y++)T=y*4,b=y*3,v[T]=E[b],v[++T]=E[++b],v[++T]=E[++b];A=new THREE__namespace.BufferAttribute(v,4,d.normalized)}return{position:p?{array:p.array,itemSize:p.itemSize,normalized:p.normalized}:null,color:A?{array:A.array,itemSize:A.itemSize,normalized:A.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),delete u.gltfArrayBuffer,delete u.featureTableBinary,delete u.batchTableBinary,{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 A=d.extensionsUsed.indexOf(g);A>=0&&d.extensionsUsed.splice(A,1)}else{var A=d.extensionsUsed.indexOf(g);A===-1&&d.extensionsUsed.push(g)}}{var g="PBM_mesh",A=d.extensionsUsed.indexOf(g);A===-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 A=new PBMMeshMaterial(t.light?"phong":"basic");A.vertexColors="color"in p.attributes;var d=new THREE__namespace.Mesh(p,A);return s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(d),scene:d,textures:[],animations:[],dispose:function(){p.dispose(),A.dispose()}}}case"pbmPointCloud":{var m=new PBMPointCloudMaterial,d=new PBMPointCloud(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()}}}}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(ee){var te=e.length;if(ee>te){var ae=new u8(Math.max(te*2,ee));ae.set(e),e=ae}},p=t.f||0,d=t.p||0,h=t.b||0,g=t.l,A=t.d,m=t.m,E=t.n,v=o*8;do{if(!g){p=bits(n,d,1);var y=bits(n,d+1,3);if(d+=3,y)if(y==1)g=flrm,A=fdrm,m=9,E=5;else if(y==2){var S=bits(n,d,31)+257,R=bits(n,d+10,15)+4,w=S+bits(n,d+5,31)+1;d+=14;for(var M=new u8(w),O=new u8(19),C=0;C<R;++C)O[clim[C]]=bits(n,d+C*3,7);d+=R*3;for(var P=max(O),F=(1<<P)-1,L=hMap(O,P,1),C=0;C<w;){var H=L[bits(n,d,F)];d+=H&15;var b=H>>4;if(b<16)M[C++]=b;else{var N=0,D=0;for(b==16?(D=3+bits(n,d,3),d+=2,N=M[C-1]):b==17?(D=3+bits(n,d,7),d+=3):b==18&&(D=11+bits(n,d,127),d+=7);D--;)M[C++]=N}}var Q=M.subarray(0,S),J=M.subarray(S);m=max(Q),E=max(J),g=hMap(Q,m,1),A=hMap(J,E,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 U=(1<<m)-1,z=(1<<E)-1,q=d;;q=d){var N=g[bits16(n,d)&U],j=N>>4;if(d+=N&15,d>v){c&&err(0);break}if(N||err(2),j<256)e[h++]=j;else if(j==256){q=d,g=null;break}else{var G=j-254;if(j>264){var C=j-257,X=fleb[C];G=bits(n,d,(1<<X)-1)+fl[C],d+=X}var Y=A[bits16(n,d)&z],Z=Y>>4;Y||err(3),d+=Y&15;var J=fd[Z];if(Z>3){var X=fdeb[Z];J+=bits16(n,d)&(1<<X)-1,d+=X}if(d>v){c&&err(0);break}l&&f(h+131072);var W=h+G;if(h<J){var K=s-J,ne=Math.min(J,W);for(K+h<0&&err(3);h<ne;++h)e[h]=r[K+h]}for(;h<W;++h)e[h]=e[h-J]}}t.l=g,t.p=q,t.b=h,t.f=p,g&&(p=1,t.m=m,t.d=A,t.n=E)}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],A=f[4],m=f[5],E=slzh(n,m);s=A,p?p==8?e[g]=inflateSync(n.subarray(E,E+d),{out:new u8(h)}):err(14,"unknown compression type "+p):e[g]=slc(n,E,E+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),A=this.parseDeformers(t,c),m=new GeometryParser().parse(t,A,c);this.parseScene(t,A,m,g,c,f);var E=(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,y=(l=(u=t.GlobalSettings.UnitScaleFactor)===null||u===void 0?void 0:u.value)!==null&&l!==void 0?l:1,b;if(t.GlobalSettings.AmbientColor){var T=t.GlobalSettings.AmbientColor.value,_=T[0],S=T[1],R=T[2];if(_!==0||S!==0||R!==0){var w=new THREE__namespace.Color().setRGB(_,S,R);b=new THREE__namespace.AmbientLight(w,1)}}return Promise.all(p).then(function(M){var O;return{scene:f,textures:M,ambientLight:b,upAxis:["X","Y","Z"][E],frontAxis:["X","Y","Z"][v],unitScale:y,animations:(O=f.animations)!==null&&O!==void 0?O:[],dispose:function(){M.forEach(function(C){return C.dispose()}),g.forEach(function(C){return C.dispose()}),m.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;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(A){var m=l.get(A.ID);m!==void 0&&m.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 A=t.Objects.NodeAttribute[g.ID];A!==void 0&&(o=A)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=0;o.CameraProjectionType!==void 0&&o.CameraProjectionType.value===1&&(s=1);var u=1;o.NearPlane!==void 0&&(u=o.NearPlane.value/1e3);var l=1e3;o.FarPlane!==void 0&&(l=o.FarPlane.value/1e3);var c=window.innerWidth,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,A=s.get(g);A.parents.forEach(function(m){if(o.has(m.ID)){var E=o.get(m.ID);E instanceof THREE__namespace.SkinnedMesh&&E.bind(new THREE__namespace.Skeleton(p.bones),u[m.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(E,v){var y=v===0?"uv":"uv".concat(v+1);u.setAttribute(y,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(E,v){E!==h&&(u.addGroup(g,v-g,h),h=E,g=v)}),u.groups.length>0){var A=u.groups[u.groups.length-1],m=A.start+A.count;m!==c.materialIndex.length&&u.addGroup(m,c.materialIndex.length-m,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,A){var m=0,E=!1;g<0&&(g=g^-1,E=!0);var v=[],y=[];if(u.push(g*3,g*3+1,g*3+2),t.color){var b=getData(A,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(R){y.push(R.weight),v.push(R.id)}),y.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];y.forEach(function(R,w){var M=R,O=v[w];_.forEach(function(C,P,F){if(M>C){F[P]=M,M=C;var L=T[P];T[P]=O,O=L}})}),v=T,y=_}for(;y.length<4;)y.push(0),v.push(0);for(var S=0;S<4;++S)p.push(y[S]),d.push(v[S])}if(t.normal){var b=getData(A,r,g,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(m=getData(A,r,g,t.material)[0],m<0&&(h.negativeMaterialIndices=!0,m=0)),t.uv&&t.uv.forEach(function(R,w){var M=getData(A,r,g,R);f[w]===void 0&&(f[w]=[]),f[w].push(M[0]),f[w].push(M[1])}),o++,E&&(h.genFace(e,t,u,m,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,A=0;A<r.length;A+=3)h.push(new THREE__namespace.Vector3(g[r[A]],g[r[A+1]],g[r[A+2]]));for(var m=this.getNormalTangentAndBitangent(h),E=m.tangent,v=m.bitangent,y=[],b=0,T=h;b<T.length;b++){var _=T[b];y.push(this.flattenVertex(_,E,v))}d=THREE__namespace.ShapeUtils.triangulateShape(y,[])}else d=[[0,1,2]];for(var S=function(F,L,H){t.vertex.push(e.vertexPositions[r[F*3]]),t.vertex.push(e.vertexPositions[r[F*3+1]]),t.vertex.push(e.vertexPositions[r[F*3+2]]),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[H*3]]),t.vertex.push(e.vertexPositions[r[H*3+1]]),t.vertex.push(e.vertexPositions[r[H*3+2]]),e.skeleton&&(t.vertexWeights.push(c[F*4]),t.vertexWeights.push(c[F*4+1]),t.vertexWeights.push(c[F*4+2]),t.vertexWeights.push(c[F*4+3]),t.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[H*4]),t.vertexWeights.push(c[H*4+1]),t.vertexWeights.push(c[H*4+2]),t.vertexWeights.push(c[H*4+3]),t.weightsIndices.push(f[F*4]),t.weightsIndices.push(f[F*4+1]),t.weightsIndices.push(f[F*4+2]),t.weightsIndices.push(f[F*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[H*4]),t.weightsIndices.push(f[H*4+1]),t.weightsIndices.push(f[H*4+2]),t.weightsIndices.push(f[H*4+3])),e.color&&(t.colors.push(u[F*3]),t.colors.push(u[F*3+1]),t.colors.push(u[F*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[H*3]),t.colors.push(u[H*3+1]),t.colors.push(u[H*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[F*3]),t.normal.push(s[F*3+1]),t.normal.push(s[F*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[H*3]),t.normal.push(s[H*3+1]),t.normal.push(s[H*3+2])),e.uv&&e.uv.forEach(function(N,D){t.uvs[D]===void 0&&(t.uvs[D]=[]),t.uvs[D].push(l[D][F*2]),t.uvs[D].push(l[D][F*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][H*2]),t.uvs[D].push(l[D][H*2+1])})},R=0,w=d;R<w.length;R++){var M=w[R],O=M[0],C=M[1],P=M[2];S(O,C,P)}},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 A={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},m=this.genBuffers(A),E=new THREE__namespace.Float32BufferAttribute(m.vertex,3);E.name=s||r.attrName,E.applyMatrix4(o),t.morphAttributes.position.push(E)},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,A){if(e.has(g.ID)){var m=e.get(g.ID);if(m.curves.x!==void 0||m.curves.y!==void 0||m.curves.z!==void 0){if(p[A]===void 0){var E=r.get(g.ID).parents.filter(function(w){return w.relationship!==void 0})[0].ID;if(E!==void 0){var v=t.Objects.Model[E.toString()];if(v===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",g);return}var y={modelName:v.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(v.attrName):"",ID:v.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new THREE__namespace.Matrix4,eulerOrder:"",preRotation:[0,0,0],postRotation:[0,0,0]};o.traverse(function(w){w.ID===v.id&&(y.transform=w.matrix,w.userData.transformData&&(y.eulerOrder=w.userData.transformData.eulerOrder))}),y.transform||(y.transform=new THREE__namespace.Matrix4),v.PreRotation&&(y.preRotation=v.PreRotation.value),v.PostRotation&&(y.postRotation=v.PostRotation.value),p[A]=y}}p[A]&&(p[A][m.attr]=m)}else if(m.curves.morph!==void 0){if(p[A]===void 0){var b=r.get(g.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,E=r.get(_).parents[0].ID,S=t.Objects.Model[E],R={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};p[A]=R}p[A][m.attr]=m}}}),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,A=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var m=0;m<l.length;m+=3){if(g.set(l[m],l[m+1],l[m+2],s),h.setFromEuler(g),h.premultiply(p),h.multiply(d),m>2){var E=new THREE__namespace.Quaternion().fromArray(A,(m-3)/3*4);E.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(A,m/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,A)},n.prototype.generateMorphTrack=function(t,e){var r=t.DeformPercent.curves.morph,o=r.values.map(function(u){return u/100}),s=e.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new THREE__namespace.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+s+"]",r.times,o)},n.prototype.getTimesForAllAxes=function(t){var e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(l,c){return l-c}),e.length>1){for(var r=1,o=e[0],s=1;s<e.length;s++){var u=e[s];u!==o&&(e[r]=u,o=u,r++)}e=e.slice(0,r)}return e},n.prototype.getKeyframeTrackValues=function(t,e,r){var o=r,s=[],u=-1,l=-1,c=-1;return t.forEach(function(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),A=g/180,m=new THREE__namespace.Euler(f[0],f[1],f[2],o),E=new THREE__namespace.Euler(f[0],f[1],f[2],o),v=new THREE__namespace.Quaternion().setFromEuler(m),y=new THREE__namespace.Quaternion().setFromEuler(E);v.dot(y)&&y.set(-y.x,-y.y,-y.z,-y.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,R=0;R<1;R+=1/A)_.copy(v.clone().slerp(y.clone(),R)),s.push(b+R*T),S.setFromQuaternion(_,o),u.push(S.x),u.push(S.y),u.push(S.z)}else s.push(t.times[l]),u.push(THREE__namespace.MathUtils.degToRad(t.values[l])),u.push(THREE__namespace.MathUtils.degToRad(e.values[l])),u.push(THREE__namespace.MathUtils.degToRad(r.values[l]))}}}return[s,u]},n})(),TextParser=(function(){function n(){this.allNodes=new FBXTree,this.nodeStack=[],this.currentIndent=0,this.currentPropName=""}return n.prototype.getPrevNode=function(){return this.nodeStack[this.currentIndent-2]},n.prototype.getCurrentNode=function(){return this.nodeStack[this.currentIndent-1]},n.prototype.getCurrentProp=function(){return this.currentProp},n.prototype.pushStack=function(t){this.nodeStack.push(t),this.currentIndent+=1},n.prototype.popStack=function(){this.nodeStack.pop(),this.currentIndent-=1},n.prototype.setCurrentProp=function(t,e){this.currentProp=t,this.currentPropName=e},n.prototype.parse=function(t){this.currentIndent=0,this.allNodes=new FBXTree,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach(function(o,s){var u=o.match(/^[\s\t]*;/),l=o.match(/^[\s\t]*$/);if(!(u||l)){var c=o.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){"),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 A=getEulerOrder(0);if(n.preRotation){var m=n.preRotation.map(THREE__namespace.MathUtils.degToRad);m.push(A),e.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.rotation){var m=n.rotation.map(THREE__namespace.MathUtils.degToRad);m.push(n.eulerOrder||A),r.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.postRotation){var m=n.postRotation.map(THREE__namespace.MathUtils.degToRad);m.push(A),o.makeRotationFromEuler(tempEuler.fromArray(m)),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 E=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(p);var y=new THREE__namespace.Matrix4;y.copyPosition(p);var b=new THREE__namespace.Matrix4().getInverse(y).multiply(p),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(g===0)S.copy(v).multiply(E).multiply(T).multiply(_);else if(g===1)S.copy(v).multiply(T).multiply(E).multiply(_);else{var R=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),w=new THREE__namespace.Matrix4().getInverse(R),M=T.clone().multiply(w);S.copy(v).multiply(E).multiply(M).multiply(_)}var O=new THREE__namespace.Matrix4().getInverse(f),C=new THREE__namespace.Matrix4().getInverse(u),P=t.clone().multiply(c).multiply(f).multiply(e).multiply(r).multiply(o).multiply(O).multiply(l).multiply(u).multiply(s).multiply(C),F=new THREE__namespace.Matrix4().copyPosition(P),L=p.clone().multiply(F);return h.copyPosition(L),P=h.clone().multiply(S),P.premultiply(new THREE__namespace.Matrix4().getInverse(p)),P}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 A=p[g+1],m=f[d-g];c[d][g]=A+m;var E=c[g][d-1]/c[d][g];c[g][d]=h+A*E,h=m*E}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 y=0,b=1,T=[],u=0;u<=e;++u)T[u]=s.slice(0);T[0][0]=1;for(var _=1;_<=r;++_){var S=0,R=v-_,w=e-_;v>=_&&(T[b][0]=T[y][0]/c[w+1][R],S=T[b][0]*c[R][w]);for(var M=R>=-1?1:-R,O=v-1<=w?_-1:e-v,C=M;C<=O;++C)T[b][C]=(T[y][C]-T[y][C-1])/c[w+1][R+C],S+=T[b][C]*c[R+C][w];v<=w&&(T[b][_]=-T[y][_-1]/c[w+1][v],S+=T[b][_]*c[v][w]),l[_][v]=S;var d=y;y=b,b=d}}for(var P=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=P;P*=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]),A=1;A<=n;++A)d.add(f[l-n+A].clone().multiplyScalar(c[g][A]));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,A,m,E,v,y,b,T,_,S,R,w,M,O,C,P,F,L,H,N,D,Q,J,U,z,q,j,G,X,Y,Z,W,K,ne,ee,te,ae,fe,se,he,me,be,Te,ce=unzipSync(n),pe="",re=null,ue=0,ve=Object.keys(ce);ue<ve.length;ue++){var ye=ve[ue];/(^|\/)main\.xml$/i.test(ye)&&(re=ce[ye],pe=ye.slice(0,ye.lastIndexOf("/")+1))}if(!re)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),Je=new DOMParser,$e=decodeText(re),Ue=Je.parseFromString($e,"text/xml"),de=Ue.querySelector("Record1 Axes"),Ye={x:{type:(s=(o=(r=de==null?void 0:de.querySelector("CX AxisType"))===null||r===void 0?void 0:r.textContent)===null||o===void 0?void 0:o.toUpperCase())!==null&&s!==void 0?s:"I",dataType:(c=(l=(u=de==null?void 0:de.querySelector("CX DataType"))===null||u===void 0?void 0:u.textContent)===null||l===void 0?void 0:l.toUpperCase())!==null&&c!==void 0?c:"D",increment:Number((p=(f=de==null?void 0:de.querySelector("CX Increment"))===null||f===void 0?void 0:f.textContent)!==null&&p!==void 0?p:"1"),offset:Number((h=(d=de==null?void 0:de.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(m=(A=(g=de==null?void 0:de.querySelector("CY AxisType"))===null||g===void 0?void 0:g.textContent)===null||A===void 0?void 0:A.toUpperCase())!==null&&m!==void 0?m:"I",dataType:(y=(v=(E=de==null?void 0:de.querySelector("CY DataType"))===null||E===void 0?void 0:E.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&y!==void 0?y:"D",increment:Number((T=(b=de==null?void 0:de.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=de==null?void 0:de.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(M=(w=(R=de==null?void 0:de.querySelector("CZ AxisType"))===null||R===void 0?void 0:R.textContent)===null||w===void 0?void 0:w.toUpperCase())!==null&&M!==void 0?M:"A",dataType:(P=(C=(O=de==null?void 0:de.querySelector("CZ DataType"))===null||O===void 0?void 0:O.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&P!==void 0?P:"D",increment:Number((L=(F=de==null?void 0:de.querySelector("CZ Increment"))===null||F===void 0?void 0:F.textContent)!==null&&L!==void 0?L:"1"),offset:Number((N=(H=de==null?void 0:de.querySelector("CZ Offset"))===null||H===void 0?void 0:H.textContent)!==null&&N!==void 0?N:"0")}},Ee=null,Oe=Ue.querySelector("Record1 Axes Rotation");Oe&&(Ee=new THREE__namespace.Matrix3,Ee.set(Number((Q=(D=Oe.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&Q!==void 0?Q:0),Number((U=(J=Oe.querySelector("r12"))===null||J===void 0?void 0:J.textContent)!==null&&U!==void 0?U:0),Number((q=(z=Oe.querySelector("r13"))===null||z===void 0?void 0:z.textContent)!==null&&q!==void 0?q:0),Number((G=(j=Oe.querySelector("r21"))===null||j===void 0?void 0:j.textContent)!==null&&G!==void 0?G:0),Number((Y=(X=Oe.querySelector("r22"))===null||X===void 0?void 0:X.textContent)!==null&&Y!==void 0?Y:0),Number((W=(Z=Oe.querySelector("r23"))===null||Z===void 0?void 0:Z.textContent)!==null&&W!==void 0?W:0),Number((ne=(K=Oe.querySelector("r31"))===null||K===void 0?void 0:K.textContent)!==null&&ne!==void 0?ne:0),Number((te=(ee=Oe.querySelector("r32"))===null||ee===void 0?void 0:ee.textContent)!==null&&te!==void 0?te:0),Number((fe=(ae=Oe.querySelector("r33"))===null||ae===void 0?void 0:ae.textContent)!==null&&fe!==void 0?fe:0)));var Fe=(se=Ue.querySelector("Record3 DataLink PointDataLink"))===null||se===void 0?void 0:se.textContent;if(typeof Fe!="string")throw new Error("X3p: PointDataLink not found.");Fe=pathJoin(pe,Fe);var tt=ce[Fe];if(!tt)throw new Error("X3p: ".concat(tt," not found."));for(var rt=getPointArray(tt.buffer,Ye.z.dataType),Le=Number((me=(he=Ue.querySelector("Record3 MatrixDimension SizeX"))===null||he===void 0?void 0:he.textContent)!==null&&me!==void 0?me:"0"),Ie=Number((Te=(be=Ue.querySelector("Record3 MatrixDimension SizeY"))===null||be===void 0?void 0:be.textContent)!==null&&Te!==void 0?Te:"0"),He=Math.floor(Le-1),ge=Math.floor(Ie-1),we=He+1,Pe=ge+1,je=new Float32Array(we*Pe*3),Ve=new Float32Array(we*Pe*2),Ze=new Uint32Array(He*ge*6),gt=new THREE__namespace.Box3,Qe=0;Qe<Pe;Qe++)for(var At=Qe*Ye.y.increment+Ye.y.offset,Re=0;Re<we;Re++){var qe=Qe*we+Re,ft=Re*Ye.x.increment+Ye.x.offset,dt=rt[qe],Ge=!isNaN(dt),nt=Ge?dt:NaN;_vector.set(ft,-At,nt),Ee&&_vector.applyMatrix3(Ee),Ge&>.expandByPoint(_vector),je[qe*3+0]=_vector.x,je[qe*3+1]=_vector.y,je[qe*3+2]=_vector.z,Ve[qe*2+0]=Re/He,Ve[qe*2+1]=1-Qe/ge}for(var Qe=0;Qe<ge;Qe++)for(var Re=0;Re<He;Re++){var ct=Re+we*Qe,oe=Re+we*(Qe+1),_e=Re+1+we*(Qe+1),Me=Re+1+we*Qe,xe=(Qe*He+Re)*6;Ze[xe+0]=ct,Ze[xe+1]=oe,Ze[xe+2]=Me,Ze[xe+3]=oe,Ze[xe+4]=_e,Ze[xe+5]=Me}var ze=new THREE__namespace.BufferGeometry;ze.setAttribute("position",new THREE__namespace.BufferAttribute(je,3)),ze.setAttribute("uv",new THREE__namespace.BufferAttribute(Ve,2)),ze.setIndex(new THREE__namespace.BufferAttribute(Ze,1)),(!ze.groups||ze.groups.length===0)&&ze.addGroup(0,ze.index?ze.index.count:ze.attributes.position.count,0),ze.boundingBox=gt;var at=new PBMMeshMaterial(t.light?"phong":"basic");at.flatShading=!0,at.color.copy(De);var yt=new PBMMesh(ze,[at]);return{object:yt,dispose:function(){ze.dispose(),at.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=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=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),A=Math.max(Math.sqrt(f*f+p*p+d*d),.001);this.halfSize.set(h,g,A);var m=this.halfSize.toArray().reduce(function(E,v){return E+v},0);return(isNaN(m)||m<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/g,l/g,c/g,f/A,p/A,d/A]),isNaN(this.rotation.toArray().reduce(function(E,v){return E+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)?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.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),scratchBox3.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.containsPoint(scratchRay$1.origin))return!0;var o=scratchRay$1.intersectBox(scratchBox3,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)?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 A=Math.max(e,.001),h=A*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}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,A=(s=c.stride)!==null&&s!==void 0?s:3,m=(u=c.offset)!==null&&u!==void 0?u:0;return f=f*A+m,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,A=0,m=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?(A=(u-n.z)*t.z,m=(f-n.z)*t.z):(A=(f-n.z)*t.z,m=(u-n.z)*t.z),p>m||A>d)||((A>p||p!==p)&&(p=A),(m<d||d!==d)&&(d=m),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,A=void 0,m=void 0,E=void 0,v=void 0,y=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),A=v=scratchVector3A.x,T=scratchVector3B.x,T<A&&(A=T),T>v&&(v=T),T=scratchVector3C.x,T<A&&(A=T),T>v&&(v=T),m=y=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>y&&(y=T),T=scratchVector3C.y,T<m&&(m=T),T>y&&(y=T),E=b=scratchVector3A.z,T=scratchVector3B.z,T<E&&(E=T),T>b&&(b=T),T=scratchVector3C.z,T<E&&(E=T),T>b&&(b=T),l[g]=A,l[g+1]=m,l[g+2]=E,l[g+3]=v,l[g+4]=y,l[g+5]=b}else{for(var _=1/0,S=1/0,R=1/0,w=-1/0,M=-1/0,O=-1/0,d=0;d<s;d+=1){var h=d*3,g=d*6,A=void 0,m=void 0,E=void 0,v=void 0,y=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),A=v=scratchVector3A.x,T=scratchVector3B.x,T<A&&(A=T),T>v&&(v=T),T=scratchVector3C.x,T<A&&(A=T),T>v&&(v=T),m=y=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>y&&(y=T),T=scratchVector3C.y,T<m&&(m=T),T>y&&(y=T),E=b=scratchVector3A.z,T=scratchVector3B.z,T<E&&(E=T),T>b&&(b=T),T=scratchVector3C.z,T<E&&(E=T),T>b&&(b=T),l[g]=A,l[g+1]=m,l[g+2]=E,l[g+3]=v,l[g+4]=y,l[g+5]=b,A<_&&(_=A),v>w&&(w=v),m<S&&(S=m),y>M&&(M=y),E<R&&(R=E),b>O&&(O=b)}o=[_,S,R,w,M,O]}var C=new BVHNode(++p,o,0,s,0);c[f++]=C;var P=[],F=[0,1,2],L=function(N,D){return P[D]-P[N]};function H(N){var D=N.startIndex,Q=N.endIndex,J=N.extents;P[0]=J[3]-J[0],P[1]=J[4]-J[1],P[2]=J[5]-J[2],F.sort(L);for(var U=0;U<3;U++){for(var z=F[U],q=J[z]+J[z+3],j=D,G=Q-1,X=-1,Y=void 0;j<=G;)X===-1?(Y=u[j],l[Y*6+z]+l[Y*6+z+3]<q?j++:X=Y):(Y=u[G],l[Y*6+z]+l[Y*6+z+3]>=q||(u[j]=Y,u[G]=X,X=-1,j++),G--);if(j>D&&j<Q){var Z=new BVHNode(++p,calcExtents(u,l,D,j,EPSILON$1),D,j,N.deepth+1);Z.deepth<r&&Z.endIndex-Z.startIndex>e&&(c[f++]=Z);var W=new BVHNode(++p,calcExtents(u,l,j,Q,EPSILON$1),j,Q,N.deepth+1);W.deepth<r&&W.endIndex-W.startIndex>e&&(c[f++]=W),N.node0=Z,N.node1=W,N.startIndex=0,N.endIndex=0;break}}}for(;f;)H(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,A=clamp(e.y,u[h+1],u[h+4])-e.y,m=clamp(e.z,u[h+2],u[h+5])-e.z;if(g*g+A*A+m*m<=r*r){for(var E=l[h+6],v=l[h+7],y=E;y<v;y++){var b=o[y];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 R=p.length,w=new Float32Array(R*9),y=0;y<R;y++){var b=p[y],M=b*3;this.getPositionByIndex(M,scratchVector3$9),w[y*9]=scratchVector3$9.x,w[y*9+1]=scratchVector3$9.y,w[y*9+2]=scratchVector3$9.z,this.getPositionByIndex(M+1,scratchVector3$9),w[y*9+3]=scratchVector3$9.x,w[y*9+4]=scratchVector3$9.y,w[y*9+5]=scratchVector3$9.z,this.getPositionByIndex(M+2,scratchVector3$9),w[y*9+6]=scratchVector3$9.x,w[y*9+7]=scratchVector3$9.y,w[y*9+8]=scratchVector3$9.z}return w},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,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),A=[0],m,E=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),v=1/0;(m=A.pop())!==void 0;){var y=m*BYTES_PER_NODE/4;E.min.x=p[y],E.min.y=p[y+1],E.min.z=p[y+2],E.max.x=p[y+3],E.max.y=p[y+4],E.max.z=p[y+5];var b=intersectNodeBox(e,g,E,o);if(b!==null&&!(s&&b>v)){for(var T=e.x,_=e.y,S=e.z,R=r.x,w=r.y,M=r.z,O=d[y+6],C=d[y+7],P=O;P<C;P++){var F=c[P],L=F*3,H=new BVHVector3(0,0,0);this.getPositionByIndex(L,H);var N=H.x,D=H.y,Q=H.z,J=new BVHVector3(0,0,0);this.getPositionByIndex(L+1,J);var U=J.x,z=J.y,q=J.z,j=new BVHVector3(0,0,0);this.getPositionByIndex(L+2,j);var G=j.x,X=j.y,Y=j.z,Z=U-N,W=z-D,K=q-Q,ne=G-N,ee=X-D,te=Y-Q,ae=W*te-K*ee,fe=K*ne-Z*te,se=Z*ee-W*ne,he=R*ae+w*fe+M*se,me=void 0;if(he>0)me=1;else if(he<0)me=-1,he=-he;else continue;var be=T-N,Te=_-D,ce=S-Q,pe=me*(R*(Te*te-ce*ee)+w*(ce*ne-be*te)+M*(be*ee-Te*ne));if(!(pe<0)){var re=me*(R*(W*ce-K*Te)+w*(K*be-Z*ce)+M*(Z*Te-W*be));if(!(re<0)&&!(pe+re>he)){var ue=-me*(be*ae+Te*fe+ce*se);if(!(ue<0)){var ve=ue/he,ye=new BVHVector3(T+R*ve,_+w*ve,S+M*ve),De=new BVHIntersect(H,J,j,F,ye);(!u||u(De))&&(s?ve<v&&(v=ve,l.length>0&&(l.length=0),l.push(De)):l.push(De))}}}}var Je=m*BYTES_PER_NODE/2,$e=h[Je+16],Ue=h[Je+17];$e&&A.push($e),Ue&&A.push(Ue)}}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,A=scratchVector3$8.z,m=h,E=g,v=A,d=0;d<u;d+=1){l[d]=d,s(d,scratchVector3$8);var y=scratchVector3$8.x,b=scratchVector3$8.y,T=scratchVector3$8.z;y<h?h=y:y>m&&(m=y),b<g?g=b:b>E&&(E=b),T<A?A=T:T>v&&(v=T)}o=[h,g,A,m,E,v]}var _=new BVHNode(++p,o,0,u,0);c[f++]=_;var S=[],R=[0,1,2],w=function(O,C){return S[C]-S[O]};function M(O){var C=O.startIndex,P=O.endIndex,F=O.extents;S[0]=F[3]-F[0],S[1]=F[4]-F[1],S[2]=F[5]-F[2];for(var L=R.sort(w)[0],H=ORDER_AXISES[L],N=(F[L]+F[L+3])/2,D=C,Q=P-1,J=-1,U;D<=Q;)J===-1?(U=l[D],s(U,scratchVector3$8),scratchVector3$8[H]<N?D++:J=U):(U=l[Q],s(U,scratchVector3$8),scratchVector3$8[H]>=N||(l[D]=U,l[Q]=J,J=-1,D++),Q--);if(D>C){var z=F.slice();z[L+3]=N+EPSILON;var q=new BVHNode(++p,z,C,D,O.deepth+1);q.deepth<r&&q.endIndex-q.startIndex>e&&(c[f++]=q),O.node0=q}if(P>D){var j=F.slice();j[L]=N-EPSILON;var G=new BVHNode(++p,j,D,P,O.deepth+1);G.deepth<r&&G.endIndex-G.startIndex>e&&(c[f++]=G),O.node1=G}O.startIndex=0,O.endIndex=0}for(;f;)M(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,A=new BVHVector3(1/r.x,1/r.y,1/r.z),m=[0],E,v=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),y=1/0;(E=m.pop())!==void 0;){var b=E*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,A,v,o);if(T!==null&&!(s&&T>y)){for(var _=d[b+6],S=d[b+7],R=_;R<S;R++){var w=c[R],M=new BVHVector3(0,0,0);this.getPositionByIndex(w,M);var O=M.x,C=M.y,P=M.z,F=e.x,L=e.y,H=e.z,N=r.x,D=r.y,Q=r.z,J=N*(O-F)+D*(C-L)+Q*(P-H);if(J>0?(F+=N*J,L+=D*J,H+=Q*J):J<0&&(J=0),N=O-F,D=C-L,Q=P-H,N*N+D*D+Q*Q<=g){var U=new BVHVector3(F,L,H),z=new BVHIntersect(M,M,M,w,U);(!u||u(z))&&(s?J<y&&(y=J,l.length>0&&(l.length=0),l.push(z)):l.push(z))}}var q=E*BYTES_PER_NODE/2,j=h[q+16],G=h[q+17];j&&m.push(j),G&&m.push(G)}}return l},t})(BVHObject);const jsContent=`(function(){"use strict";var ur=function(o,r){return ur=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},ur(o,r)};function yr(o,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");ur(o,r);function t(){this.constructor=o}o.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}typeof SuppressedError=="function"&&SuppressedError;var cr=(function(){function o(r,t){this.position=r,this.indices=t}return o.prototype.getPositionCount=function(){var r,t,n=this.indices,e=this.position;return n?n.array.length/((r=n.stride)!==null&&r!==void 0?r:1):e.array.length/((t=e.stride)!==null&&t!==void 0?t:3)},o.prototype.getPositionByIndex=function(r,t){var n,e,h,v,i=this.indices,f=this.position,l=r;if(i){var y=i.array,s=(n=i.stride)!==null&&n!==void 0?n:1,d=(e=i.offset)!==null&&e!==void 0?e:0;l=y[r*s+d]}var u=f.array,x=(h=f.stride)!==null&&h!==void 0?h:3,w=(v=f.offset)!==null&&v!==void 0?v:0;return l=l*x+w,t.x=u[l],t.y=u[l+1],t.z=u[l+2],t},o.prototype.createTree=function(r,t,n){throw new Error("not implemented")},o.prototype.trianglesInSphere=function(r,t){throw new Error("not implemented")},o.prototype.intersectRay=function(r,t,n,e,h){throw new Error("not implemented")},o})(),D=(function(){function o(r,t,n,e,h){this.id=r,this.extents=t,this.startIndex=n,this.endIndex=e,this.deepth=h}return o})(),X=36;function lr(o,r){for(var t=new ArrayBuffer(r*X),n=new Float32Array(t),e=new Uint32Array(t),h=new Uint16Array(t),v=[o],i,f;i=v.pop();)f=i.id*X/4,n[f]=i.extents[0],n[f+1]=i.extents[1],n[f+2]=i.extents[2],n[f+3]=i.extents[3],n[f+4]=i.extents[4],n[f+5]=i.extents[5],e[f+6]=i.startIndex,e[f+7]=i.endIndex,f=i.id*X/2,i.node0&&(h[f+16]=i.node0.id,v.push(i.node0)),i.node1&&(h[f+17]=i.node1.id,v.push(i.node1));return t}function dr(o,r,t,n){n===void 0&&(n=0);var e=t.min.x-n,h=t.min.y-n,v=t.min.z-n,i=t.max.x+n,f=t.max.y+n,l=t.max.z+n,y=0,s=0,d=0,u=0,x=0,w=0;return r.x>=0?(y=(e-o.x)*r.x,s=(i-o.x)*r.x):(y=(i-o.x)*r.x,s=(e-o.x)*r.x),r.y>=0?(d=(h-o.y)*r.y,u=(f-o.y)*r.y):(d=(f-o.y)*r.y,u=(h-o.y)*r.y),y>u||d>s||((d>y||y!==y)&&(y=d),(u<s||s!==s)&&(s=u),r.z>=0?(x=(v-o.z)*r.z,w=(l-o.z)*r.z):(x=(l-o.z)*r.z,w=(v-o.z)*r.z),y>w||x>s)||((x>y||y!==y)&&(y=x),(w<s||s!==s)&&(s=w),s<0)?null:y>=0?y:s}var H=(function(){function o(r,t,n){this.x=r,this.y=t,this.z=n}return o.prototype.copy=function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this},o.prototype.set=function(r,t,n){return this.x=r,this.y=t,this.z=n,this},o.prototype.fromArray=function(r,t){return t===void 0&&(t=0),this.x=r[t],this.y=r[t+1],this.z=r[t+2],this},o.prototype.toArray=function(r,t){return r===void 0&&(r=[]),t===void 0&&(t=0),r[t]=this.x,r[t+1]=this.y,r[t+2]=this.z,r},o.prototype.add=function(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this},o.prototype.multiplyScalar=function(r){return this.x*=r,this.y*=r,this.z*=r,this},o.prototype.subVectors=function(r,t){return this.x=r.x-t.x,this.y=r.y-t.y,this.z=r.z-t.z,this},o.prototype.addScaledVector=function(r,t){return this.x+=r.x*t,this.y+=r.y*t,this.z+=r.z*t,this},o.prototype.dot=function(r){return this.x*r.x+this.y*r.y+this.z*r.z},o.prototype.cross=function(r){var t=this.x,n=this.y,e=this.z;return this.x=n*r.z-e*r.y,this.y=e*r.x-t*r.z,this.z=t*r.y-n*r.x,this},o.prototype.crossVectors=function(r,t){var n=r.x,e=r.y,h=r.z,v=t.x,i=t.y,f=t.z;return this.x=e*f-h*i,this.y=h*v-n*f,this.z=n*i-e*v,this},o.prototype.distanceTo=function(r){return Math.sqrt(this.distanceToSquared(r))},o.prototype.distanceToSquared=function(r){var t=this.x-r.x,n=this.y-r.y,e=this.z-r.z;return t*t+n*n+e*e},o.prototype.clone=function(){return new o(this.x,this.y,this.z)},o})(),wr=(function(){function o(r,t,n,e,h){this.pointA=r,this.pointB=t,this.pointC=n,this.index=e,this.intersectionPoint=h}return o})(),xr=(function(){function o(r,t){this.min=r,this.max=t}return o})(),pr=1e-6,J=new H(0,0,0),Y=new H(0,0,0),g=new H(0,0,0),Z=new H(0,0,0),Hr=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionCount()/3,v=h>65535?new Uint32Array(h):new Uint16Array(h),i=new Float32Array(h*6),f=[],l=0,y=-1;if(e)for(var s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p}else{for(var F=1/0,k=1/0,E=1/0,S=-1/0,V=-1/0,U=-1/0,s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p,x<F&&(F=x),I>S&&(S=I),w<k&&(k=w),c>V&&(V=c),z<E&&(E=z),p>U&&(U=p)}e=[F,k,E,S,V,U]}var W=new D(++y,e,0,h,0);f[l++]=W;var M=[],T=[0,1,2],j=function(P,B){return M[B]-M[P]};function q(P){var B=P.startIndex,_=P.endIndex,A=P.extents;M[0]=A[3]-A[0],M[1]=A[4]-A[1],M[2]=A[5]-A[2],T.sort(j);for(var $=0;$<3;$++){for(var C=T[$],G=A[C]+A[C+3],N=B,L=_-1,O=-1,Q=void 0;N<=L;)O===-1?(Q=v[N],i[Q*6+C]+i[Q*6+C+3]<G?N++:O=Q):(Q=v[L],i[Q*6+C]+i[Q*6+C+3]>=G||(v[N]=Q,v[L]=O,O=-1,N++),L--);if(N>B&&N<_){var R=new D(++y,zr(v,i,B,N,pr),B,N,P.deepth+1);R.deepth<n&&R.endIndex-R.startIndex>t&&(f[l++]=R);var b=new D(++y,zr(v,i,N,_,pr),N,_,P.deepth+1);b.deepth<n&&b.endIndex-b.startIndex>t&&(f[l++]=b),P.node0=R,P.node1=b,P.startIndex=0,P.endIndex=0;break}}}for(;l;)q(f[--l]);return this.offsetArray=v,this.rootNodePacked=lr(W,y+1),f.length=0,this},r.prototype.trianglesInSphere=function(t,n){for(var e=this.offsetArray,h=this.rootNodePacked,v=new Float32Array(h),i=new Uint32Array(h),f=new Uint16Array(h),l=[0],y=[],s;(s=l.pop())!==void 0;){var d=s*X/4,u=fr(t.x,v[d],v[d+3])-t.x,x=fr(t.y,v[d+1],v[d+4])-t.y,w=fr(t.z,v[d+2],v[d+5])-t.z;if(u*u+x*x+w*w<=n*n){for(var z=i[d+6],I=i[d+7],c=z;c<I;c++){var p=e[c];y.push(p)}var a=s*X/2,F=f[a+16],k=f[a+17];F&&l.push(F),k&&l.push(k)}}for(var E=y.length,S=new Float32Array(E*9),c=0;c<E;c++){var p=y[c],V=p*3;this.getPositionByIndex(V,J),S[c*9]=J.x,S[c*9+1]=J.y,S[c*9+2]=J.z,this.getPositionByIndex(V+1,J),S[c*9+3]=J.x,S[c*9+4]=J.y,S[c*9+5]=J.z,this.getPositionByIndex(V+2,J),S[c*9+6]=J.x,S[c*9+7]=J.y,S[c*9+8]=J.z}return S},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=new H(1/n.x,1/n.y,1/n.z),x=[0],w,z=new xr(new H(0,0,0),new H(0,0,0)),I=1/0;(w=x.pop())!==void 0;){var c=w*X/4;z.min.x=y[c],z.min.y=y[c+1],z.min.z=y[c+2],z.max.x=y[c+3],z.max.y=y[c+4],z.max.z=y[c+5];var p=dr(t,u,z,e);if(p!==null&&!(h&&p>I)){for(var a=t.x,F=t.y,k=t.z,E=n.x,S=n.y,V=n.z,U=s[c+6],W=s[c+7],M=U;M<W;M++){var T=f[M],j=T*3,q=new H(0,0,0);this.getPositionByIndex(j,q);var P=q.x,B=q.y,_=q.z,A=new H(0,0,0);this.getPositionByIndex(j+1,A);var $=A.x,C=A.y,G=A.z,N=new H(0,0,0);this.getPositionByIndex(j+2,N);var L=N.x,O=N.y,Q=N.z,R=$-P,b=C-B,or=G-_,er=L-P,vr=O-B,sr=Q-_,Ar=b*sr-or*vr,Pr=or*er-R*sr,Br=R*vr-b*er,m=E*Ar+S*Pr+V*Br,rr=void 0;if(m>0)rr=1;else if(m<0)rr=-1,m=-m;else continue;var tr=a-P,nr=F-B,ir=k-_,Sr=rr*(E*(nr*sr-ir*vr)+S*(ir*er-tr*sr)+V*(tr*vr-nr*er));if(!(Sr<0)){var Nr=rr*(E*(b*ir-or*nr)+S*(or*tr-R*ir)+V*(R*nr-b*tr));if(!(Nr<0)&&!(Sr+Nr>m)){var Vr=-rr*(tr*Ar+nr*Pr+ir*Br);if(!(Vr<0)){var ar=Vr/m,jr=new H(a+E*ar,F+S*ar,k+V*ar),hr=new wr(q,A,N,T,jr);(!v||v(hr))&&(h?ar<I&&(I=ar,i.length>0&&(i.length=0),i.push(hr)):i.push(hr))}}}}var Tr=w*X/2,Ur=d[Tr+16],_r=d[Tr+17];Ur&&x.push(Ur),_r&&x.push(_r)}}return i},r})(cr);function fr(o,r,t){return o<r?r:o>t?t:o}function zr(o,r,t,n,e){if(t>=n)return[0,0,0,0,0,0];for(var h=1/0,v=1/0,i=1/0,f=-1/0,l=-1/0,y=-1/0,s=t;s<n;s++){var d=o[s]*6,u=r[d];u<h&&(h=u),u=r[d+1],u<v&&(v=u),u=r[d+2],u<i&&(i=u),u=r[d+3],u>f&&(f=u),u=r[d+4],u>l&&(l=u),u=r[d+5],u>y&&(y=u)}return[h-e,v-e,i-e,f+e,l+e,y+e]}var Ir=1e-6,kr=["x","y","z"],K=new H(0,0,0),Er=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionByIndex.bind(this),v=this.getPositionCount(),i=v>65535?new Uint32Array(v):new Uint16Array(v),f=[],l=0,y=-1;if(e)for(var s=0;s<v;s+=1)i[s]=s;else{h(0,K);for(var d=K.x,u=K.y,x=K.z,w=d,z=u,I=x,s=0;s<v;s+=1){i[s]=s,h(s,K);var c=K.x,p=K.y,a=K.z;c<d?d=c:c>w&&(w=c),p<u?u=p:p>z&&(z=p),a<x?x=a:a>I&&(I=a)}e=[d,u,x,w,z,I]}var F=new D(++y,e,0,v,0);f[l++]=F;var k=[],E=[0,1,2],S=function(U,W){return k[W]-k[U]};function V(U){var W=U.startIndex,M=U.endIndex,T=U.extents;k[0]=T[3]-T[0],k[1]=T[4]-T[1],k[2]=T[5]-T[2];for(var j=E.sort(S)[0],q=kr[j],P=(T[j]+T[j+3])/2,B=W,_=M-1,A=-1,$;B<=_;)A===-1?($=i[B],h($,K),K[q]<P?B++:A=$):($=i[_],h($,K),K[q]>=P||(i[B]=$,i[_]=A,A=-1,B++),_--);if(B>W){var C=T.slice();C[j+3]=P+Ir;var G=new D(++y,C,W,B,U.deepth+1);G.deepth<n&&G.endIndex-G.startIndex>t&&(f[l++]=G),U.node0=G}if(M>B){var N=T.slice();N[j]=P-Ir;var L=new D(++y,N,B,M,U.deepth+1);L.deepth<n&&L.endIndex-L.startIndex>t&&(f[l++]=L),U.node1=L}U.startIndex=0,U.endIndex=0}for(;l;)V(f[--l]);return this.offsetArray=i,this.rootNodePacked=lr(F,y+1),f.length=0,this},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=e*e,x=new H(1/n.x,1/n.y,1/n.z),w=[0],z,I=new xr(new H(0,0,0),new H(0,0,0)),c=1/0;(z=w.pop())!==void 0;){var p=z*X/4;I.min.x=y[p],I.min.y=y[p+1],I.min.z=y[p+2],I.max.x=y[p+3],I.max.y=y[p+4],I.max.z=y[p+5];var a=dr(t,x,I,e);if(a!==null&&!(h&&a>c)){for(var F=s[p+6],k=s[p+7],E=F;E<k;E++){var S=f[E],V=new H(0,0,0);this.getPositionByIndex(S,V);var U=V.x,W=V.y,M=V.z,T=t.x,j=t.y,q=t.z,P=n.x,B=n.y,_=n.z,A=P*(U-T)+B*(W-j)+_*(M-q);if(A>0?(T+=P*A,j+=B*A,q+=_*A):A<0&&(A=0),P=U-T,B=W-j,_=M-q,P*P+B*B+_*_<=u){var $=new H(T,j,q),C=new wr(V,V,V,S,$);(!v||v(C))&&(h?A<c&&(c=A,i.length>0&&(i.length=0),i.push(C)):i.push(C))}}var G=z*X/2,N=d[G+16],L=d[G+17];N&&w.push(N),L&&w.push(L)}}return i},r})(cr);function Mr(o){onmessage=function(r){Promise.resolve(r.data).then(function(t){return o(t)}).then(function(t){var n=t.output,e=t.transfer;return postMessage(n,e)}).catch(function(t){return postMessage({$$error:t})})}}Mr(function(o){return Promise.resolve(o).then(function(r){for(var t=[],n=new Set,e=0,h=r;e<h.length;e++){var v=h[e],i=void 0;if(v.type==="mesh")i=new Hr(v.attributes.position,v.indices);else if(v.type==="points")i=new Er(v.attributes.position,v.indices);else throw new Error("Invalid Type");i.createTree(v.maxItemPerNode,v.maxTreeDepth,v.extents);var f={type:v.type,attributes:v.attributes,indices:v.indices,offsetArray:i.offsetArray,rootNodePacked:i.rootNodePacked};t.push(f);var l=void 0;for(var y in f.attributes){var s=f.attributes[y];s&&s.buffer instanceof ArrayBuffer&&n.add(s.buffer)}l=f.indices,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),l=f.offsetArray,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),n.add(f.rootNodePacked)}return{output:t,transfer:Array.from(n)}})})})();
|
|
918
|
+
`&&l!=="\r"?r+=l:(r==="end_header"&&(e=!1),r!==""&&(o.push(r),r=""))}while(e&&t<n.length);return u===!0&&t++,{headerText:o.join("\r")+"\r",headerLength:t}}var ArrayStream=(function(){function n(t){this.arr=t,this.i=0}return n.prototype.empty=function(){return this.i>=this.arr.length},n.prototype.next=function(){return this.arr[this.i++]},n})(),u8=Uint8Array,u16=Uint16Array,i32=Int32Array,fleb=new u8([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fdeb=new u8([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),clim=new u8([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(n,t){for(var e=new u16(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var o=new i32(e[30]),r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)o[s]=s-e[r]<<5|r;return{b:e,r:o}},_a$3=freb(fleb,2),fl=_a$3.b,revfl=_a$3.r;fl[28]=258,revfl[258]=28;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(ee){var te=e.length;if(ee>te){var ae=new u8(Math.max(te*2,ee));ae.set(e),e=ae}},p=t.f||0,d=t.p||0,h=t.b||0,g=t.l,A=t.d,m=t.m,E=t.n,v=o*8;do{if(!g){p=bits(n,d,1);var y=bits(n,d+1,3);if(d+=3,y)if(y==1)g=flrm,A=fdrm,m=9,E=5;else if(y==2){var S=bits(n,d,31)+257,R=bits(n,d+10,15)+4,w=S+bits(n,d+5,31)+1;d+=14;for(var M=new u8(w),O=new u8(19),C=0;C<R;++C)O[clim[C]]=bits(n,d+C*3,7);d+=R*3;for(var P=max(O),F=(1<<P)-1,L=hMap(O,P,1),C=0;C<w;){var H=L[bits(n,d,F)];d+=H&15;var b=H>>4;if(b<16)M[C++]=b;else{var N=0,D=0;for(b==16?(D=3+bits(n,d,3),d+=2,N=M[C-1]):b==17?(D=3+bits(n,d,7),d+=3):b==18&&(D=11+bits(n,d,127),d+=7);D--;)M[C++]=N}}var Q=M.subarray(0,S),J=M.subarray(S);m=max(Q),E=max(J),g=hMap(Q,m,1),A=hMap(J,E,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 U=(1<<m)-1,z=(1<<E)-1,q=d;;q=d){var N=g[bits16(n,d)&U],j=N>>4;if(d+=N&15,d>v){c&&err(0);break}if(N||err(2),j<256)e[h++]=j;else if(j==256){q=d,g=null;break}else{var G=j-254;if(j>264){var C=j-257,X=fleb[C];G=bits(n,d,(1<<X)-1)+fl[C],d+=X}var Y=A[bits16(n,d)&z],Z=Y>>4;Y||err(3),d+=Y&15;var J=fd[Z];if(Z>3){var X=fdeb[Z];J+=bits16(n,d)&(1<<X)-1,d+=X}if(d>v){c&&err(0);break}l&&f(h+131072);var W=h+G;if(h<J){var K=s-J,ne=Math.min(J,W);for(K+h<0&&err(3);h<ne;++h)e[h]=r[K+h]}for(;h<W;++h)e[h]=e[h-J]}}t.l=g,t.p=q,t.b=h,t.f=p,g&&(p=1,t.m=m,t.d=A,t.n=E)}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],A=f[4],m=f[5],E=slzh(n,m);s=A,p?p==8?e[g]=inflateSync(n.subarray(E,E+d),{out:new u8(h)}):err(14,"unknown compression type "+p):e[g]=slc(n,E,E+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),A=this.parseDeformers(t,c),m=new GeometryParser().parse(t,A,c);this.parseScene(t,A,m,g,c,f);var E=(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,y=(l=(u=t.GlobalSettings.UnitScaleFactor)===null||u===void 0?void 0:u.value)!==null&&l!==void 0?l:1,b;if(t.GlobalSettings.AmbientColor){var T=t.GlobalSettings.AmbientColor.value,_=T[0],S=T[1],R=T[2];if(_!==0||S!==0||R!==0){var w=new THREE__namespace.Color().setRGB(_,S,R);b=new THREE__namespace.AmbientLight(w,1)}}return Promise.all(p).then(function(M){var O;return{scene:f,textures:M,ambientLight:b,upAxis:["X","Y","Z"][E],frontAxis:["X","Y","Z"][v],unitScale:y,animations:(O=f.animations)!==null&&O!==void 0?O:[],dispose:function(){M.forEach(function(C){return C.dispose()}),g.forEach(function(C){return C.dispose()}),m.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;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(A){var m=l.get(A.ID);m!==void 0&&m.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 A=t.Objects.NodeAttribute[g.ID];A!==void 0&&(o=A)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=0;o.CameraProjectionType!==void 0&&o.CameraProjectionType.value===1&&(s=1);var u=1;o.NearPlane!==void 0&&(u=o.NearPlane.value/1e3);var l=1e3;o.FarPlane!==void 0&&(l=o.FarPlane.value/1e3);var c=window.innerWidth,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,A=s.get(g);A.parents.forEach(function(m){if(o.has(m.ID)){var E=o.get(m.ID);E instanceof THREE__namespace.SkinnedMesh&&E.bind(new THREE__namespace.Skeleton(p.bones),u[m.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(E,v){var y=v===0?"uv":"uv".concat(v+1);u.setAttribute(y,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(E,v){E!==h&&(u.addGroup(g,v-g,h),h=E,g=v)}),u.groups.length>0){var A=u.groups[u.groups.length-1],m=A.start+A.count;m!==c.materialIndex.length&&u.addGroup(m,c.materialIndex.length-m,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,A){var m=0,E=!1;g<0&&(g=g^-1,E=!0);var v=[],y=[];if(u.push(g*3,g*3+1,g*3+2),t.color){var b=getData(A,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(R){y.push(R.weight),v.push(R.id)}),y.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];y.forEach(function(R,w){var M=R,O=v[w];_.forEach(function(C,P,F){if(M>C){F[P]=M,M=C;var L=T[P];T[P]=O,O=L}})}),v=T,y=_}for(;y.length<4;)y.push(0),v.push(0);for(var S=0;S<4;++S)p.push(y[S]),d.push(v[S])}if(t.normal){var b=getData(A,r,g,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(m=getData(A,r,g,t.material)[0],m<0&&(h.negativeMaterialIndices=!0,m=0)),t.uv&&t.uv.forEach(function(R,w){var M=getData(A,r,g,R);f[w]===void 0&&(f[w]=[]),f[w].push(M[0]),f[w].push(M[1])}),o++,E&&(h.genFace(e,t,u,m,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,A=0;A<r.length;A+=3)h.push(new THREE__namespace.Vector3(g[r[A]],g[r[A+1]],g[r[A+2]]));for(var m=this.getNormalTangentAndBitangent(h),E=m.tangent,v=m.bitangent,y=[],b=0,T=h;b<T.length;b++){var _=T[b];y.push(this.flattenVertex(_,E,v))}d=THREE__namespace.ShapeUtils.triangulateShape(y,[])}else d=[[0,1,2]];for(var S=function(F,L,H){t.vertex.push(e.vertexPositions[r[F*3]]),t.vertex.push(e.vertexPositions[r[F*3+1]]),t.vertex.push(e.vertexPositions[r[F*3+2]]),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[H*3]]),t.vertex.push(e.vertexPositions[r[H*3+1]]),t.vertex.push(e.vertexPositions[r[H*3+2]]),e.skeleton&&(t.vertexWeights.push(c[F*4]),t.vertexWeights.push(c[F*4+1]),t.vertexWeights.push(c[F*4+2]),t.vertexWeights.push(c[F*4+3]),t.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[H*4]),t.vertexWeights.push(c[H*4+1]),t.vertexWeights.push(c[H*4+2]),t.vertexWeights.push(c[H*4+3]),t.weightsIndices.push(f[F*4]),t.weightsIndices.push(f[F*4+1]),t.weightsIndices.push(f[F*4+2]),t.weightsIndices.push(f[F*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[H*4]),t.weightsIndices.push(f[H*4+1]),t.weightsIndices.push(f[H*4+2]),t.weightsIndices.push(f[H*4+3])),e.color&&(t.colors.push(u[F*3]),t.colors.push(u[F*3+1]),t.colors.push(u[F*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[H*3]),t.colors.push(u[H*3+1]),t.colors.push(u[H*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[F*3]),t.normal.push(s[F*3+1]),t.normal.push(s[F*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[H*3]),t.normal.push(s[H*3+1]),t.normal.push(s[H*3+2])),e.uv&&e.uv.forEach(function(N,D){t.uvs[D]===void 0&&(t.uvs[D]=[]),t.uvs[D].push(l[D][F*2]),t.uvs[D].push(l[D][F*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][H*2]),t.uvs[D].push(l[D][H*2+1])})},R=0,w=d;R<w.length;R++){var M=w[R],O=M[0],C=M[1],P=M[2];S(O,C,P)}},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 A={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},m=this.genBuffers(A),E=new THREE__namespace.Float32BufferAttribute(m.vertex,3);E.name=s||r.attrName,E.applyMatrix4(o),t.morphAttributes.position.push(E)},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,A){if(e.has(g.ID)){var m=e.get(g.ID);if(m.curves.x!==void 0||m.curves.y!==void 0||m.curves.z!==void 0){if(p[A]===void 0){var E=r.get(g.ID).parents.filter(function(w){return w.relationship!==void 0})[0].ID;if(E!==void 0){var v=t.Objects.Model[E.toString()];if(v===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",g);return}var y={modelName:v.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(v.attrName):"",ID:v.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new THREE__namespace.Matrix4,eulerOrder:"",preRotation:[0,0,0],postRotation:[0,0,0]};o.traverse(function(w){w.ID===v.id&&(y.transform=w.matrix,w.userData.transformData&&(y.eulerOrder=w.userData.transformData.eulerOrder))}),y.transform||(y.transform=new THREE__namespace.Matrix4),v.PreRotation&&(y.preRotation=v.PreRotation.value),v.PostRotation&&(y.postRotation=v.PostRotation.value),p[A]=y}}p[A]&&(p[A][m.attr]=m)}else if(m.curves.morph!==void 0){if(p[A]===void 0){var b=r.get(g.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,E=r.get(_).parents[0].ID,S=t.Objects.Model[E],R={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};p[A]=R}p[A][m.attr]=m}}}),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,A=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var m=0;m<l.length;m+=3){if(g.set(l[m],l[m+1],l[m+2],s),h.setFromEuler(g),h.premultiply(p),h.multiply(d),m>2){var E=new THREE__namespace.Quaternion().fromArray(A,(m-3)/3*4);E.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(A,m/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,A)},n.prototype.generateMorphTrack=function(t,e){var r=t.DeformPercent.curves.morph,o=r.values.map(function(u){return u/100}),s=e.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new THREE__namespace.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+s+"]",r.times,o)},n.prototype.getTimesForAllAxes=function(t){var e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(l,c){return l-c}),e.length>1){for(var r=1,o=e[0],s=1;s<e.length;s++){var u=e[s];u!==o&&(e[r]=u,o=u,r++)}e=e.slice(0,r)}return e},n.prototype.getKeyframeTrackValues=function(t,e,r){var o=r,s=[],u=-1,l=-1,c=-1;return t.forEach(function(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),A=g/180,m=new THREE__namespace.Euler(f[0],f[1],f[2],o),E=new THREE__namespace.Euler(f[0],f[1],f[2],o),v=new THREE__namespace.Quaternion().setFromEuler(m),y=new THREE__namespace.Quaternion().setFromEuler(E);v.dot(y)&&y.set(-y.x,-y.y,-y.z,-y.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,R=0;R<1;R+=1/A)_.copy(v.clone().slerp(y.clone(),R)),s.push(b+R*T),S.setFromQuaternion(_,o),u.push(S.x),u.push(S.y),u.push(S.z)}else s.push(t.times[l]),u.push(THREE__namespace.MathUtils.degToRad(t.values[l])),u.push(THREE__namespace.MathUtils.degToRad(e.values[l])),u.push(THREE__namespace.MathUtils.degToRad(r.values[l]))}}}return[s,u]},n})(),TextParser=(function(){function n(){this.allNodes=new FBXTree,this.nodeStack=[],this.currentIndent=0,this.currentPropName=""}return n.prototype.getPrevNode=function(){return this.nodeStack[this.currentIndent-2]},n.prototype.getCurrentNode=function(){return this.nodeStack[this.currentIndent-1]},n.prototype.getCurrentProp=function(){return this.currentProp},n.prototype.pushStack=function(t){this.nodeStack.push(t),this.currentIndent+=1},n.prototype.popStack=function(){this.nodeStack.pop(),this.currentIndent-=1},n.prototype.setCurrentProp=function(t,e){this.currentProp=t,this.currentPropName=e},n.prototype.parse=function(t){this.currentIndent=0,this.allNodes=new FBXTree,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach(function(o,s){var u=o.match(/^[\s\t]*;/),l=o.match(/^[\s\t]*$/);if(!(u||l)){var c=o.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){"),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 A=getEulerOrder(0);if(n.preRotation){var m=n.preRotation.map(THREE__namespace.MathUtils.degToRad);m.push(A),e.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.rotation){var m=n.rotation.map(THREE__namespace.MathUtils.degToRad);m.push(n.eulerOrder||A),r.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.postRotation){var m=n.postRotation.map(THREE__namespace.MathUtils.degToRad);m.push(A),o.makeRotationFromEuler(tempEuler.fromArray(m)),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 E=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(p);var y=new THREE__namespace.Matrix4;y.copyPosition(p);var b=new THREE__namespace.Matrix4().getInverse(y).multiply(p),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(g===0)S.copy(v).multiply(E).multiply(T).multiply(_);else if(g===1)S.copy(v).multiply(T).multiply(E).multiply(_);else{var R=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),w=new THREE__namespace.Matrix4().getInverse(R),M=T.clone().multiply(w);S.copy(v).multiply(E).multiply(M).multiply(_)}var O=new THREE__namespace.Matrix4().getInverse(f),C=new THREE__namespace.Matrix4().getInverse(u),P=t.clone().multiply(c).multiply(f).multiply(e).multiply(r).multiply(o).multiply(O).multiply(l).multiply(u).multiply(s).multiply(C),F=new THREE__namespace.Matrix4().copyPosition(P),L=p.clone().multiply(F);return h.copyPosition(L),P=h.clone().multiply(S),P.premultiply(new THREE__namespace.Matrix4().getInverse(p)),P}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 A=p[g+1],m=f[d-g];c[d][g]=A+m;var E=c[g][d-1]/c[d][g];c[g][d]=h+A*E,h=m*E}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 y=0,b=1,T=[],u=0;u<=e;++u)T[u]=s.slice(0);T[0][0]=1;for(var _=1;_<=r;++_){var S=0,R=v-_,w=e-_;v>=_&&(T[b][0]=T[y][0]/c[w+1][R],S=T[b][0]*c[R][w]);for(var M=R>=-1?1:-R,O=v-1<=w?_-1:e-v,C=M;C<=O;++C)T[b][C]=(T[y][C]-T[y][C-1])/c[w+1][R+C],S+=T[b][C]*c[R+C][w];v<=w&&(T[b][_]=-T[y][_-1]/c[w+1][v],S+=T[b][_]*c[v][w]),l[_][v]=S;var d=y;y=b,b=d}}for(var P=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=P;P*=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]),A=1;A<=n;++A)d.add(f[l-n+A].clone().multiplyScalar(c[g][A]));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,A,m,E,v,y,b,T,_,S,R,w,M,O,C,P,F,L,H,N,D,Q,J,U,z,q,j,G,X,Y,Z,W,K,ne,ee,te,ae,fe,se,he,me,be,Te,ce=unzipSync(n),pe="",re=null,ue=0,ve=Object.keys(ce);ue<ve.length;ue++){var ge=ve[ue];/(^|\/)main\.xml$/i.test(ge)&&(re=ce[ge],pe=ge.slice(0,ge.lastIndexOf("/")+1))}if(!re)throw new Error("X3p: main.xml not found.");if(typeof DOMParser=="undefined")throw new Error("X3p: DOMParser not found.");var Le=(e=t.color)!==null&&e!==void 0?e:new THREE__namespace.Color(10066329),qe=new DOMParser,$e=decodeText(re),Ve=qe.parseFromString($e,"text/xml"),de=Ve.querySelector("Record1 Axes"),Ye={x:{type:(s=(o=(r=de==null?void 0:de.querySelector("CX AxisType"))===null||r===void 0?void 0:r.textContent)===null||o===void 0?void 0:o.toUpperCase())!==null&&s!==void 0?s:"I",dataType:(c=(l=(u=de==null?void 0:de.querySelector("CX DataType"))===null||u===void 0?void 0:u.textContent)===null||l===void 0?void 0:l.toUpperCase())!==null&&c!==void 0?c:"D",increment:Number((p=(f=de==null?void 0:de.querySelector("CX Increment"))===null||f===void 0?void 0:f.textContent)!==null&&p!==void 0?p:"1"),offset:Number((h=(d=de==null?void 0:de.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(m=(A=(g=de==null?void 0:de.querySelector("CY AxisType"))===null||g===void 0?void 0:g.textContent)===null||A===void 0?void 0:A.toUpperCase())!==null&&m!==void 0?m:"I",dataType:(y=(v=(E=de==null?void 0:de.querySelector("CY DataType"))===null||E===void 0?void 0:E.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&y!==void 0?y:"D",increment:Number((T=(b=de==null?void 0:de.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=de==null?void 0:de.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(M=(w=(R=de==null?void 0:de.querySelector("CZ AxisType"))===null||R===void 0?void 0:R.textContent)===null||w===void 0?void 0:w.toUpperCase())!==null&&M!==void 0?M:"A",dataType:(P=(C=(O=de==null?void 0:de.querySelector("CZ DataType"))===null||O===void 0?void 0:O.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&P!==void 0?P:"D",increment:Number((L=(F=de==null?void 0:de.querySelector("CZ Increment"))===null||F===void 0?void 0:F.textContent)!==null&&L!==void 0?L:"1"),offset:Number((N=(H=de==null?void 0:de.querySelector("CZ Offset"))===null||H===void 0?void 0:H.textContent)!==null&&N!==void 0?N:"0")}},Ee=null,Oe=Ve.querySelector("Record1 Axes Rotation");Oe&&(Ee=new THREE__namespace.Matrix3,Ee.set(Number((Q=(D=Oe.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&Q!==void 0?Q:0),Number((U=(J=Oe.querySelector("r12"))===null||J===void 0?void 0:J.textContent)!==null&&U!==void 0?U:0),Number((q=(z=Oe.querySelector("r13"))===null||z===void 0?void 0:z.textContent)!==null&&q!==void 0?q:0),Number((G=(j=Oe.querySelector("r21"))===null||j===void 0?void 0:j.textContent)!==null&&G!==void 0?G:0),Number((Y=(X=Oe.querySelector("r22"))===null||X===void 0?void 0:X.textContent)!==null&&Y!==void 0?Y:0),Number((W=(Z=Oe.querySelector("r23"))===null||Z===void 0?void 0:Z.textContent)!==null&&W!==void 0?W:0),Number((ne=(K=Oe.querySelector("r31"))===null||K===void 0?void 0:K.textContent)!==null&&ne!==void 0?ne:0),Number((te=(ee=Oe.querySelector("r32"))===null||ee===void 0?void 0:ee.textContent)!==null&&te!==void 0?te:0),Number((fe=(ae=Oe.querySelector("r33"))===null||ae===void 0?void 0:ae.textContent)!==null&&fe!==void 0?fe:0)));var Fe=(se=Ve.querySelector("Record3 DataLink PointDataLink"))===null||se===void 0?void 0:se.textContent;if(typeof Fe!="string")throw new Error("X3p: PointDataLink not found.");Fe=pathJoin(pe,Fe);var tt=ce[Fe];if(!tt)throw new Error("X3p: ".concat(tt," not found."));for(var rt=getPointArray(tt.buffer,Ye.z.dataType),Ne=Number((me=(he=Ve.querySelector("Record3 MatrixDimension SizeX"))===null||he===void 0?void 0:he.textContent)!==null&&me!==void 0?me:"0"),Ie=Number((Te=(be=Ve.querySelector("Record3 MatrixDimension SizeY"))===null||be===void 0?void 0:be.textContent)!==null&&Te!==void 0?Te:"0"),He=Math.floor(Ne-1),Ae=Math.floor(Ie-1),we=He+1,Pe=Ae+1,je=new Float32Array(we*Pe*3),Qe=new Float32Array(we*Pe*2),Ze=new Uint32Array(He*Ae*6),gt=new THREE__namespace.Box3,Je=0;Je<Pe;Je++)for(var At=Je*Ye.y.increment+Ye.y.offset,Re=0;Re<we;Re++){var Ue=Je*we+Re,ft=Re*Ye.x.increment+Ye.x.offset,dt=rt[Ue],Ge=!isNaN(dt),nt=Ge?dt:NaN;_vector.set(ft,-At,nt),Ee&&_vector.applyMatrix3(Ee),Ge&>.expandByPoint(_vector),je[Ue*3+0]=_vector.x,je[Ue*3+1]=_vector.y,je[Ue*3+2]=_vector.z,Qe[Ue*2+0]=Re/He,Qe[Ue*2+1]=1-Je/Ae}for(var Je=0;Je<Ae;Je++)for(var Re=0;Re<He;Re++){var ct=Re+we*Je,oe=Re+we*(Je+1),_e=Re+1+we*(Je+1),Me=Re+1+we*Je,xe=(Je*He+Re)*6;Ze[xe+0]=ct,Ze[xe+1]=oe,Ze[xe+2]=Me,Ze[xe+3]=oe,Ze[xe+4]=_e,Ze[xe+5]=Me}var ze=new THREE__namespace.BufferGeometry;ze.setAttribute("position",new THREE__namespace.BufferAttribute(je,3)),ze.setAttribute("uv",new THREE__namespace.BufferAttribute(Qe,2)),ze.setIndex(new THREE__namespace.BufferAttribute(Ze,1)),(!ze.groups||ze.groups.length===0)&&ze.addGroup(0,ze.index?ze.index.count:ze.attributes.position.count,0),ze.boundingBox=gt;var at=new PBMMeshMaterial(t.light?"phong":"basic");at.flatShading=!0,at.color.copy(Le);var yt=new PBMMesh(ze,[at]);return{object:yt,dispose:function(){ze.dispose(),at.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=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=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),A=Math.max(Math.sqrt(f*f+p*p+d*d),.001);this.halfSize.set(h,g,A);var m=this.halfSize.toArray().reduce(function(E,v){return E+v},0);return(isNaN(m)||m<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/g,l/g,c/g,f/A,p/A,d/A]),isNaN(this.rotation.toArray().reduce(function(E,v){return E+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)?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.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),scratchBox3.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.containsPoint(scratchRay$1.origin))return!0;var o=scratchRay$1.intersectBox(scratchBox3,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)?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 A=Math.max(e,.001),h=A*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}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,A=(s=c.stride)!==null&&s!==void 0?s:3,m=(u=c.offset)!==null&&u!==void 0?u:0;return f=f*A+m,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,A=0,m=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?(A=(u-n.z)*t.z,m=(f-n.z)*t.z):(A=(f-n.z)*t.z,m=(u-n.z)*t.z),p>m||A>d)||((A>p||p!==p)&&(p=A),(m<d||d!==d)&&(d=m),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,A=void 0,m=void 0,E=void 0,v=void 0,y=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),A=v=scratchVector3A.x,T=scratchVector3B.x,T<A&&(A=T),T>v&&(v=T),T=scratchVector3C.x,T<A&&(A=T),T>v&&(v=T),m=y=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>y&&(y=T),T=scratchVector3C.y,T<m&&(m=T),T>y&&(y=T),E=b=scratchVector3A.z,T=scratchVector3B.z,T<E&&(E=T),T>b&&(b=T),T=scratchVector3C.z,T<E&&(E=T),T>b&&(b=T),l[g]=A,l[g+1]=m,l[g+2]=E,l[g+3]=v,l[g+4]=y,l[g+5]=b}else{for(var _=1/0,S=1/0,R=1/0,w=-1/0,M=-1/0,O=-1/0,d=0;d<s;d+=1){var h=d*3,g=d*6,A=void 0,m=void 0,E=void 0,v=void 0,y=void 0,b=void 0,T=void 0;u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),A=v=scratchVector3A.x,T=scratchVector3B.x,T<A&&(A=T),T>v&&(v=T),T=scratchVector3C.x,T<A&&(A=T),T>v&&(v=T),m=y=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>y&&(y=T),T=scratchVector3C.y,T<m&&(m=T),T>y&&(y=T),E=b=scratchVector3A.z,T=scratchVector3B.z,T<E&&(E=T),T>b&&(b=T),T=scratchVector3C.z,T<E&&(E=T),T>b&&(b=T),l[g]=A,l[g+1]=m,l[g+2]=E,l[g+3]=v,l[g+4]=y,l[g+5]=b,A<_&&(_=A),v>w&&(w=v),m<S&&(S=m),y>M&&(M=y),E<R&&(R=E),b>O&&(O=b)}o=[_,S,R,w,M,O]}var C=new BVHNode(++p,o,0,s,0);c[f++]=C;var P=[],F=[0,1,2],L=function(N,D){return P[D]-P[N]};function H(N){var D=N.startIndex,Q=N.endIndex,J=N.extents;P[0]=J[3]-J[0],P[1]=J[4]-J[1],P[2]=J[5]-J[2],F.sort(L);for(var U=0;U<3;U++){for(var z=F[U],q=J[z]+J[z+3],j=D,G=Q-1,X=-1,Y=void 0;j<=G;)X===-1?(Y=u[j],l[Y*6+z]+l[Y*6+z+3]<q?j++:X=Y):(Y=u[G],l[Y*6+z]+l[Y*6+z+3]>=q||(u[j]=Y,u[G]=X,X=-1,j++),G--);if(j>D&&j<Q){var Z=new BVHNode(++p,calcExtents(u,l,D,j,EPSILON$1),D,j,N.deepth+1);Z.deepth<r&&Z.endIndex-Z.startIndex>e&&(c[f++]=Z);var W=new BVHNode(++p,calcExtents(u,l,j,Q,EPSILON$1),j,Q,N.deepth+1);W.deepth<r&&W.endIndex-W.startIndex>e&&(c[f++]=W),N.node0=Z,N.node1=W,N.startIndex=0,N.endIndex=0;break}}}for(;f;)H(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,A=clamp(e.y,u[h+1],u[h+4])-e.y,m=clamp(e.z,u[h+2],u[h+5])-e.z;if(g*g+A*A+m*m<=r*r){for(var E=l[h+6],v=l[h+7],y=E;y<v;y++){var b=o[y];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 R=p.length,w=new Float32Array(R*9),y=0;y<R;y++){var b=p[y],M=b*3;this.getPositionByIndex(M,scratchVector3$9),w[y*9]=scratchVector3$9.x,w[y*9+1]=scratchVector3$9.y,w[y*9+2]=scratchVector3$9.z,this.getPositionByIndex(M+1,scratchVector3$9),w[y*9+3]=scratchVector3$9.x,w[y*9+4]=scratchVector3$9.y,w[y*9+5]=scratchVector3$9.z,this.getPositionByIndex(M+2,scratchVector3$9),w[y*9+6]=scratchVector3$9.x,w[y*9+7]=scratchVector3$9.y,w[y*9+8]=scratchVector3$9.z}return w},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,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),A=[0],m,E=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),v=1/0;(m=A.pop())!==void 0;){var y=m*BYTES_PER_NODE/4;E.min.x=p[y],E.min.y=p[y+1],E.min.z=p[y+2],E.max.x=p[y+3],E.max.y=p[y+4],E.max.z=p[y+5];var b=intersectNodeBox(e,g,E,o);if(b!==null&&!(s&&b>v)){for(var T=e.x,_=e.y,S=e.z,R=r.x,w=r.y,M=r.z,O=d[y+6],C=d[y+7],P=O;P<C;P++){var F=c[P],L=F*3,H=new BVHVector3(0,0,0);this.getPositionByIndex(L,H);var N=H.x,D=H.y,Q=H.z,J=new BVHVector3(0,0,0);this.getPositionByIndex(L+1,J);var U=J.x,z=J.y,q=J.z,j=new BVHVector3(0,0,0);this.getPositionByIndex(L+2,j);var G=j.x,X=j.y,Y=j.z,Z=U-N,W=z-D,K=q-Q,ne=G-N,ee=X-D,te=Y-Q,ae=W*te-K*ee,fe=K*ne-Z*te,se=Z*ee-W*ne,he=R*ae+w*fe+M*se,me=void 0;if(he>0)me=1;else if(he<0)me=-1,he=-he;else continue;var be=T-N,Te=_-D,ce=S-Q,pe=me*(R*(Te*te-ce*ee)+w*(ce*ne-be*te)+M*(be*ee-Te*ne));if(!(pe<0)){var re=me*(R*(W*ce-K*Te)+w*(K*be-Z*ce)+M*(Z*Te-W*be));if(!(re<0)&&!(pe+re>he)){var ue=-me*(be*ae+Te*fe+ce*se);if(!(ue<0)){var ve=ue/he,ge=new BVHVector3(T+R*ve,_+w*ve,S+M*ve),Le=new BVHIntersect(H,J,j,F,ge);(!u||u(Le))&&(s?ve<v&&(v=ve,l.length>0&&(l.length=0),l.push(Le)):l.push(Le))}}}}var qe=m*BYTES_PER_NODE/2,$e=h[qe+16],Ve=h[qe+17];$e&&A.push($e),Ve&&A.push(Ve)}}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,A=scratchVector3$8.z,m=h,E=g,v=A,d=0;d<u;d+=1){l[d]=d,s(d,scratchVector3$8);var y=scratchVector3$8.x,b=scratchVector3$8.y,T=scratchVector3$8.z;y<h?h=y:y>m&&(m=y),b<g?g=b:b>E&&(E=b),T<A?A=T:T>v&&(v=T)}o=[h,g,A,m,E,v]}var _=new BVHNode(++p,o,0,u,0);c[f++]=_;var S=[],R=[0,1,2],w=function(O,C){return S[C]-S[O]};function M(O){var C=O.startIndex,P=O.endIndex,F=O.extents;S[0]=F[3]-F[0],S[1]=F[4]-F[1],S[2]=F[5]-F[2];for(var L=R.sort(w)[0],H=ORDER_AXISES[L],N=(F[L]+F[L+3])/2,D=C,Q=P-1,J=-1,U;D<=Q;)J===-1?(U=l[D],s(U,scratchVector3$8),scratchVector3$8[H]<N?D++:J=U):(U=l[Q],s(U,scratchVector3$8),scratchVector3$8[H]>=N||(l[D]=U,l[Q]=J,J=-1,D++),Q--);if(D>C){var z=F.slice();z[L+3]=N+EPSILON;var q=new BVHNode(++p,z,C,D,O.deepth+1);q.deepth<r&&q.endIndex-q.startIndex>e&&(c[f++]=q),O.node0=q}if(P>D){var j=F.slice();j[L]=N-EPSILON;var G=new BVHNode(++p,j,D,P,O.deepth+1);G.deepth<r&&G.endIndex-G.startIndex>e&&(c[f++]=G),O.node1=G}O.startIndex=0,O.endIndex=0}for(;f;)M(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,A=new BVHVector3(1/r.x,1/r.y,1/r.z),m=[0],E,v=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),y=1/0;(E=m.pop())!==void 0;){var b=E*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,A,v,o);if(T!==null&&!(s&&T>y)){for(var _=d[b+6],S=d[b+7],R=_;R<S;R++){var w=c[R],M=new BVHVector3(0,0,0);this.getPositionByIndex(w,M);var O=M.x,C=M.y,P=M.z,F=e.x,L=e.y,H=e.z,N=r.x,D=r.y,Q=r.z,J=N*(O-F)+D*(C-L)+Q*(P-H);if(J>0?(F+=N*J,L+=D*J,H+=Q*J):J<0&&(J=0),N=O-F,D=C-L,Q=P-H,N*N+D*D+Q*Q<=g){var U=new BVHVector3(F,L,H),z=new BVHIntersect(M,M,M,w,U);(!u||u(z))&&(s?J<y&&(y=J,l.length>0&&(l.length=0),l.push(z)):l.push(z))}}var q=E*BYTES_PER_NODE/2,j=h[q+16],G=h[q+17];j&&m.push(j),G&&m.push(G)}}return l},t})(BVHObject);const jsContent=`(function(){"use strict";var ur=function(o,r){return ur=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},ur(o,r)};function yr(o,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");ur(o,r);function t(){this.constructor=o}o.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}typeof SuppressedError=="function"&&SuppressedError;var cr=(function(){function o(r,t){this.position=r,this.indices=t}return o.prototype.getPositionCount=function(){var r,t,n=this.indices,e=this.position;return n?n.array.length/((r=n.stride)!==null&&r!==void 0?r:1):e.array.length/((t=e.stride)!==null&&t!==void 0?t:3)},o.prototype.getPositionByIndex=function(r,t){var n,e,h,v,i=this.indices,f=this.position,l=r;if(i){var y=i.array,s=(n=i.stride)!==null&&n!==void 0?n:1,d=(e=i.offset)!==null&&e!==void 0?e:0;l=y[r*s+d]}var u=f.array,x=(h=f.stride)!==null&&h!==void 0?h:3,w=(v=f.offset)!==null&&v!==void 0?v:0;return l=l*x+w,t.x=u[l],t.y=u[l+1],t.z=u[l+2],t},o.prototype.createTree=function(r,t,n){throw new Error("not implemented")},o.prototype.trianglesInSphere=function(r,t){throw new Error("not implemented")},o.prototype.intersectRay=function(r,t,n,e,h){throw new Error("not implemented")},o})(),D=(function(){function o(r,t,n,e,h){this.id=r,this.extents=t,this.startIndex=n,this.endIndex=e,this.deepth=h}return o})(),X=36;function lr(o,r){for(var t=new ArrayBuffer(r*X),n=new Float32Array(t),e=new Uint32Array(t),h=new Uint16Array(t),v=[o],i,f;i=v.pop();)f=i.id*X/4,n[f]=i.extents[0],n[f+1]=i.extents[1],n[f+2]=i.extents[2],n[f+3]=i.extents[3],n[f+4]=i.extents[4],n[f+5]=i.extents[5],e[f+6]=i.startIndex,e[f+7]=i.endIndex,f=i.id*X/2,i.node0&&(h[f+16]=i.node0.id,v.push(i.node0)),i.node1&&(h[f+17]=i.node1.id,v.push(i.node1));return t}function dr(o,r,t,n){n===void 0&&(n=0);var e=t.min.x-n,h=t.min.y-n,v=t.min.z-n,i=t.max.x+n,f=t.max.y+n,l=t.max.z+n,y=0,s=0,d=0,u=0,x=0,w=0;return r.x>=0?(y=(e-o.x)*r.x,s=(i-o.x)*r.x):(y=(i-o.x)*r.x,s=(e-o.x)*r.x),r.y>=0?(d=(h-o.y)*r.y,u=(f-o.y)*r.y):(d=(f-o.y)*r.y,u=(h-o.y)*r.y),y>u||d>s||((d>y||y!==y)&&(y=d),(u<s||s!==s)&&(s=u),r.z>=0?(x=(v-o.z)*r.z,w=(l-o.z)*r.z):(x=(l-o.z)*r.z,w=(v-o.z)*r.z),y>w||x>s)||((x>y||y!==y)&&(y=x),(w<s||s!==s)&&(s=w),s<0)?null:y>=0?y:s}var H=(function(){function o(r,t,n){this.x=r,this.y=t,this.z=n}return o.prototype.copy=function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this},o.prototype.set=function(r,t,n){return this.x=r,this.y=t,this.z=n,this},o.prototype.fromArray=function(r,t){return t===void 0&&(t=0),this.x=r[t],this.y=r[t+1],this.z=r[t+2],this},o.prototype.toArray=function(r,t){return r===void 0&&(r=[]),t===void 0&&(t=0),r[t]=this.x,r[t+1]=this.y,r[t+2]=this.z,r},o.prototype.add=function(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this},o.prototype.multiplyScalar=function(r){return this.x*=r,this.y*=r,this.z*=r,this},o.prototype.subVectors=function(r,t){return this.x=r.x-t.x,this.y=r.y-t.y,this.z=r.z-t.z,this},o.prototype.addScaledVector=function(r,t){return this.x+=r.x*t,this.y+=r.y*t,this.z+=r.z*t,this},o.prototype.dot=function(r){return this.x*r.x+this.y*r.y+this.z*r.z},o.prototype.cross=function(r){var t=this.x,n=this.y,e=this.z;return this.x=n*r.z-e*r.y,this.y=e*r.x-t*r.z,this.z=t*r.y-n*r.x,this},o.prototype.crossVectors=function(r,t){var n=r.x,e=r.y,h=r.z,v=t.x,i=t.y,f=t.z;return this.x=e*f-h*i,this.y=h*v-n*f,this.z=n*i-e*v,this},o.prototype.distanceTo=function(r){return Math.sqrt(this.distanceToSquared(r))},o.prototype.distanceToSquared=function(r){var t=this.x-r.x,n=this.y-r.y,e=this.z-r.z;return t*t+n*n+e*e},o.prototype.clone=function(){return new o(this.x,this.y,this.z)},o})(),wr=(function(){function o(r,t,n,e,h){this.pointA=r,this.pointB=t,this.pointC=n,this.index=e,this.intersectionPoint=h}return o})(),xr=(function(){function o(r,t){this.min=r,this.max=t}return o})(),pr=1e-6,J=new H(0,0,0),Y=new H(0,0,0),g=new H(0,0,0),Z=new H(0,0,0),Hr=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionCount()/3,v=h>65535?new Uint32Array(h):new Uint16Array(h),i=new Float32Array(h*6),f=[],l=0,y=-1;if(e)for(var s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p}else{for(var F=1/0,k=1/0,E=1/0,S=-1/0,V=-1/0,U=-1/0,s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p,x<F&&(F=x),I>S&&(S=I),w<k&&(k=w),c>V&&(V=c),z<E&&(E=z),p>U&&(U=p)}e=[F,k,E,S,V,U]}var W=new D(++y,e,0,h,0);f[l++]=W;var M=[],T=[0,1,2],j=function(P,B){return M[B]-M[P]};function q(P){var B=P.startIndex,_=P.endIndex,A=P.extents;M[0]=A[3]-A[0],M[1]=A[4]-A[1],M[2]=A[5]-A[2],T.sort(j);for(var $=0;$<3;$++){for(var C=T[$],G=A[C]+A[C+3],N=B,L=_-1,O=-1,Q=void 0;N<=L;)O===-1?(Q=v[N],i[Q*6+C]+i[Q*6+C+3]<G?N++:O=Q):(Q=v[L],i[Q*6+C]+i[Q*6+C+3]>=G||(v[N]=Q,v[L]=O,O=-1,N++),L--);if(N>B&&N<_){var R=new D(++y,zr(v,i,B,N,pr),B,N,P.deepth+1);R.deepth<n&&R.endIndex-R.startIndex>t&&(f[l++]=R);var b=new D(++y,zr(v,i,N,_,pr),N,_,P.deepth+1);b.deepth<n&&b.endIndex-b.startIndex>t&&(f[l++]=b),P.node0=R,P.node1=b,P.startIndex=0,P.endIndex=0;break}}}for(;l;)q(f[--l]);return this.offsetArray=v,this.rootNodePacked=lr(W,y+1),f.length=0,this},r.prototype.trianglesInSphere=function(t,n){for(var e=this.offsetArray,h=this.rootNodePacked,v=new Float32Array(h),i=new Uint32Array(h),f=new Uint16Array(h),l=[0],y=[],s;(s=l.pop())!==void 0;){var d=s*X/4,u=fr(t.x,v[d],v[d+3])-t.x,x=fr(t.y,v[d+1],v[d+4])-t.y,w=fr(t.z,v[d+2],v[d+5])-t.z;if(u*u+x*x+w*w<=n*n){for(var z=i[d+6],I=i[d+7],c=z;c<I;c++){var p=e[c];y.push(p)}var a=s*X/2,F=f[a+16],k=f[a+17];F&&l.push(F),k&&l.push(k)}}for(var E=y.length,S=new Float32Array(E*9),c=0;c<E;c++){var p=y[c],V=p*3;this.getPositionByIndex(V,J),S[c*9]=J.x,S[c*9+1]=J.y,S[c*9+2]=J.z,this.getPositionByIndex(V+1,J),S[c*9+3]=J.x,S[c*9+4]=J.y,S[c*9+5]=J.z,this.getPositionByIndex(V+2,J),S[c*9+6]=J.x,S[c*9+7]=J.y,S[c*9+8]=J.z}return S},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=new H(1/n.x,1/n.y,1/n.z),x=[0],w,z=new xr(new H(0,0,0),new H(0,0,0)),I=1/0;(w=x.pop())!==void 0;){var c=w*X/4;z.min.x=y[c],z.min.y=y[c+1],z.min.z=y[c+2],z.max.x=y[c+3],z.max.y=y[c+4],z.max.z=y[c+5];var p=dr(t,u,z,e);if(p!==null&&!(h&&p>I)){for(var a=t.x,F=t.y,k=t.z,E=n.x,S=n.y,V=n.z,U=s[c+6],W=s[c+7],M=U;M<W;M++){var T=f[M],j=T*3,q=new H(0,0,0);this.getPositionByIndex(j,q);var P=q.x,B=q.y,_=q.z,A=new H(0,0,0);this.getPositionByIndex(j+1,A);var $=A.x,C=A.y,G=A.z,N=new H(0,0,0);this.getPositionByIndex(j+2,N);var L=N.x,O=N.y,Q=N.z,R=$-P,b=C-B,or=G-_,er=L-P,vr=O-B,sr=Q-_,Ar=b*sr-or*vr,Pr=or*er-R*sr,Br=R*vr-b*er,m=E*Ar+S*Pr+V*Br,rr=void 0;if(m>0)rr=1;else if(m<0)rr=-1,m=-m;else continue;var tr=a-P,nr=F-B,ir=k-_,Sr=rr*(E*(nr*sr-ir*vr)+S*(ir*er-tr*sr)+V*(tr*vr-nr*er));if(!(Sr<0)){var Nr=rr*(E*(b*ir-or*nr)+S*(or*tr-R*ir)+V*(R*nr-b*tr));if(!(Nr<0)&&!(Sr+Nr>m)){var Vr=-rr*(tr*Ar+nr*Pr+ir*Br);if(!(Vr<0)){var ar=Vr/m,jr=new H(a+E*ar,F+S*ar,k+V*ar),hr=new wr(q,A,N,T,jr);(!v||v(hr))&&(h?ar<I&&(I=ar,i.length>0&&(i.length=0),i.push(hr)):i.push(hr))}}}}var Tr=w*X/2,Ur=d[Tr+16],_r=d[Tr+17];Ur&&x.push(Ur),_r&&x.push(_r)}}return i},r})(cr);function fr(o,r,t){return o<r?r:o>t?t:o}function zr(o,r,t,n,e){if(t>=n)return[0,0,0,0,0,0];for(var h=1/0,v=1/0,i=1/0,f=-1/0,l=-1/0,y=-1/0,s=t;s<n;s++){var d=o[s]*6,u=r[d];u<h&&(h=u),u=r[d+1],u<v&&(v=u),u=r[d+2],u<i&&(i=u),u=r[d+3],u>f&&(f=u),u=r[d+4],u>l&&(l=u),u=r[d+5],u>y&&(y=u)}return[h-e,v-e,i-e,f+e,l+e,y+e]}var Ir=1e-6,kr=["x","y","z"],K=new H(0,0,0),Er=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionByIndex.bind(this),v=this.getPositionCount(),i=v>65535?new Uint32Array(v):new Uint16Array(v),f=[],l=0,y=-1;if(e)for(var s=0;s<v;s+=1)i[s]=s;else{h(0,K);for(var d=K.x,u=K.y,x=K.z,w=d,z=u,I=x,s=0;s<v;s+=1){i[s]=s,h(s,K);var c=K.x,p=K.y,a=K.z;c<d?d=c:c>w&&(w=c),p<u?u=p:p>z&&(z=p),a<x?x=a:a>I&&(I=a)}e=[d,u,x,w,z,I]}var F=new D(++y,e,0,v,0);f[l++]=F;var k=[],E=[0,1,2],S=function(U,W){return k[W]-k[U]};function V(U){var W=U.startIndex,M=U.endIndex,T=U.extents;k[0]=T[3]-T[0],k[1]=T[4]-T[1],k[2]=T[5]-T[2];for(var j=E.sort(S)[0],q=kr[j],P=(T[j]+T[j+3])/2,B=W,_=M-1,A=-1,$;B<=_;)A===-1?($=i[B],h($,K),K[q]<P?B++:A=$):($=i[_],h($,K),K[q]>=P||(i[B]=$,i[_]=A,A=-1,B++),_--);if(B>W){var C=T.slice();C[j+3]=P+Ir;var G=new D(++y,C,W,B,U.deepth+1);G.deepth<n&&G.endIndex-G.startIndex>t&&(f[l++]=G),U.node0=G}if(M>B){var N=T.slice();N[j]=P-Ir;var L=new D(++y,N,B,M,U.deepth+1);L.deepth<n&&L.endIndex-L.startIndex>t&&(f[l++]=L),U.node1=L}U.startIndex=0,U.endIndex=0}for(;l;)V(f[--l]);return this.offsetArray=i,this.rootNodePacked=lr(F,y+1),f.length=0,this},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=e*e,x=new H(1/n.x,1/n.y,1/n.z),w=[0],z,I=new xr(new H(0,0,0),new H(0,0,0)),c=1/0;(z=w.pop())!==void 0;){var p=z*X/4;I.min.x=y[p],I.min.y=y[p+1],I.min.z=y[p+2],I.max.x=y[p+3],I.max.y=y[p+4],I.max.z=y[p+5];var a=dr(t,x,I,e);if(a!==null&&!(h&&a>c)){for(var F=s[p+6],k=s[p+7],E=F;E<k;E++){var S=f[E],V=new H(0,0,0);this.getPositionByIndex(S,V);var U=V.x,W=V.y,M=V.z,T=t.x,j=t.y,q=t.z,P=n.x,B=n.y,_=n.z,A=P*(U-T)+B*(W-j)+_*(M-q);if(A>0?(T+=P*A,j+=B*A,q+=_*A):A<0&&(A=0),P=U-T,B=W-j,_=M-q,P*P+B*B+_*_<=u){var $=new H(T,j,q),C=new wr(V,V,V,S,$);(!v||v(C))&&(h?A<c&&(c=A,i.length>0&&(i.length=0),i.push(C)):i.push(C))}}var G=z*X/2,N=d[G+16],L=d[G+17];N&&w.push(N),L&&w.push(L)}}return i},r})(cr);function Mr(o){onmessage=function(r){Promise.resolve(r.data).then(function(t){return o(t)}).then(function(t){var n=t.output,e=t.transfer;return postMessage(n,e)}).catch(function(t){return postMessage({$$error:t})})}}Mr(function(o){return Promise.resolve(o).then(function(r){for(var t=[],n=new Set,e=0,h=r;e<h.length;e++){var v=h[e],i=void 0;if(v.type==="mesh")i=new Hr(v.attributes.position,v.indices);else if(v.type==="points")i=new Er(v.attributes.position,v.indices);else throw new Error("Invalid Type");i.createTree(v.maxItemPerNode,v.maxTreeDepth,v.extents);var f={type:v.type,attributes:v.attributes,indices:v.indices,offsetArray:i.offsetArray,rootNodePacked:i.rootNodePacked};t.push(f);var l=void 0;for(var y in f.attributes){var s=f.attributes[y];s&&s.buffer instanceof ArrayBuffer&&n.add(s.buffer)}l=f.indices,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),l=f.offsetArray,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),n.add(f.rootNodePacked)}return{output:t,transfer:Array.from(n)}})})})();
|
|
919
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 y,b=v.index,T=b*3,_;if(Array.isArray(p)){if(d)for(var S=0,R=d;S<R.length;S++){var w=R[S];if(T>=w.start&&T-w.start<w.count){_=p[(y=w.materialIndex)!==null&&y!==void 0?y:0];break}}}else _=p;if(!_)return!1;var M=v.intersectionPoint,O=new THREE__namespace.Vector3(M.x,M.y,M.z).applyMatrix4(u),C=e.ray.origin.distanceTo(O);if(C<e.near||C>e.far)return!1;var P=v.pointA,F=v.pointB,L=v.pointC,H=THREE__namespace.Triangle.getNormal(scratchIntersectionFaceA.set(P.x,P.y,P.z).applyMatrix4(u),scratchIntersectionFaceB.set(F.x,F.y,F.z).applyMatrix4(u),scratchIntersectionFaceC.set(L.x,L.y,L.z).applyMatrix4(u),new THREE__namespace.Vector3),N=e.ray.direction.dot(H);if(_.side===THREE__namespace.FrontSide&&N>=0||_.side===THREE__namespace.BackSide&&N<=0)return!1;var D=new THREE__namespace.Face3(h?h.array[T]:T,h?h.array[T+1]:T+1,h?h.array[T+2]:T+2,H),Q={distance:C,object:n,face:D,point:O,distanceToRay:0,faceIndex:b};return intersectsMap.set(v,Q),l(Q)}),A=g.length,m=0;m<A;m++){var E=intersectsMap.get(g[m]);E&&r.push(E)}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,A=h.getAttribute("normal"),m=A instanceof THREE__namespace.BufferAttribute;intersectsMap.clear();for(var E=t.intersectRay(scratchRay.origin,scratchRay.direction,f,d,function(T){var _=T.intersectionPoint,S=new THREE__namespace.Vector3(_.x,_.y,_.z).applyMatrix4(c),R=e.ray.origin.distanceTo(S);if(R<e.near||R>e.far)return!1;var w=T.pointA,M=scratchIntersectionFaceA.set(w.x,w.y,w.z).applyMatrix4(c),O=T.index,C=g?g.array[O]:O,P;if(m){var F=new THREE__namespace.Vector3().fromBufferAttribute(A,C).applyNormalMatrix(scratchNormalMatrix);P=new THREE__namespace.Face3(C,C,C,F)}var L={distance:R,object:n,face:P,point:S,distanceToRay:S.distanceTo(M),index:O};return intersectsMap.set(T,L),p(L)}),v=E.length,y=0;y<v;y++){var b=intersectsMap.get(E[y]);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,A={};for(var m in p.attributes){var E=p.attributes[m];E instanceof THREE__namespace.InterleavedBufferAttribute?(A[m]={array:E.data.array,stride:E.data.stride,offset:E.offset},l=E.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(A[m]={array:E.array},l=E.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var v=void 0,y=p.getIndex();y&&(y instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(v={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:d,attributes:A,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 A=new BVHMesh(f.attributes.position,f.indices);A.offsetArray=f.offsetArray,A.rootNodePacked=f.rootNodePacked,bindBvhTreeForMesh(l,A)}else if(l instanceof THREE__namespace.Points){var A=new BVHPoints(f.attributes.position,f.indices);A.offsetArray=f.offsetArray,A.rootNodePacked=f.rootNodePacked,bindBvhTreeForPoints(l,A)}}}return n})}function mixNumber(n,t,e){return n+(t-n)*e}function value(n,t,e,r){var o=(t*e+2*n)/Math.pow(e,3),s=-(2*t*e+3*n)/Math.pow(e,2),u=t,l=n;return o*Math.pow(r,3)+s*Math.pow(r,2)+u*r+l}function velocity(n,t,e,r){var o=(t*e+2*n)/Math.pow(e,3),s=-(2*t*e+3*n)/Math.pow(e,2),u=t;return 3*o*Math.pow(r,2)+2*s*r+u}function mixCircle(n,t,e,r){var o=r[1]-r[0];return n=circleValue(n,r),t=circleValue(t,r),t-n>o/2?mixNumber(n+o,t,e):n-t>o/2?mixNumber(n-o,t,e):mixNumber(n,t,e)}function circleValue(n,t){var e=t[1]-t[0];return n<t[0]?circleValue(n+e,t):n>=t[1]?circleValue(n-e,t):n}function mixValue(n,t,e,r){return r?mixCircle(n,t,e,r):mixNumber(n,t,e)}function toNumber(n){var t=Number(n);return isNaN(t)||!isFinite(t)?0:t}var Motion=(function(){function n(t){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=now(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var e in t){var r=t[e];typeof r=="object"?(this.value[e]=toNumber(r.value),this.config[e]={circle:r.circle}):(this.value[e]=toNumber(r),this.config[e]={circle:!1})}this.keyframes=[{progress:0,value:__assign({},this.value)},{progress:1,value:__assign({},this.value)}]}return n.prototype.getProgress=function(t){var e=t-this.startTime;return e<0?0:e>=this.duration?1:1-value(1,this.startVelocity,this.duration,e)},n.prototype.getValue=function(t){for(var e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t){var r=this.keyframes[e-1],o=this.keyframes[e],s={};for(var u in this.config){var l=(t-r.progress)/(o.progress-r.progress);s[u]=mixValue(r.value[u],o.value[u],l,this.config[u].circle)}return s}return __assign({},this.keyframes[this.keyframes.length-1].value)},n.prototype.getProgressVelocity=function(t){var e=t-this.startTime;return e>=this.duration?0:velocity(1,this.startVelocity,this.duration,e)},n.prototype.update=function(t){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(t))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},n.prototype.getKeyFrameSegment=function(t){for(var e=this.getProgress(t),r=1;r<this.keyframes.length;r++)if(this.keyframes[r].progress>e)return[this.keyframes[r-1],this.keyframes[r]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},n.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},n.prototype.set=function(t,e,r,o){var s;r===void 0&&(r=0),isNaN(e)&&(e=0),isNaN(r)&&(r=0),o=o!=null?o:now();var u=this.getProgress(o),l=this.getValue(u),c={};for(var 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,TileNode=(function(n){__extends(t,n);function t(e,r,o){o===void 0&&(o=noop);var s=n.call(this)||this;return s.name=e,s.materials=[],s.pbmObjects=[],s.contentObject=r,s.appearMotion=new Motion({appear:0}),s.disposers=[o],s.add(r),r.traverse(function(u){var l;if(u instanceof THREE__namespace.Mesh||u instanceof THREE__namespace.Points){var c=u.material;Array.isArray(c)?(l=s.materials).push.apply(l,c):s.materials.push(c)}(u instanceof PBMMesh||u instanceof PBMSkinnedMesh||u instanceof PBMPointCloud)&&s.pbmObjects.push(u)}),s}return t.prototype.generateBvhTree=function(){return generateBvhTree(this,!0,200,20)},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=e.hitFilter;e.hitFilter=function(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;g&&(d=g.floorIndex,h=g.shownFloorIndex)}var A=h;return e.floorIndex!==void 0?A=e.floorIndex:e.floor!==void 0&&(A=e.floor===null?-1:e.floor),A>=0&&d!==A?!1:(Object.assign(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 A=updatePBMMesh(g,this.appearMotion,e,r,o,u,l);A===!0&&(c=!0)}else if(g instanceof PBMPointCloud){var A=updatePBMPointCloud(g,this.appearMotion,e,r,o,u,l);A===!0&&(c=!0)}}return c},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var o=r[e];o()}this.disposers.length=0,this.pbmObjects.length=0},t.prototype.clone=function(){return new t(this.name,this.contentObject.clone())},t})(THREE__namespace.Object3D);function updatePBMMesh(n,t,e,r,o,s,u){var l=!1;if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),l=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var c=n.material,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.logDepthAlpha=u.logDepthAlpha,d.progress=u.progress,d.transition=u.transition,d.opacity=u.opacity,d.floorStyle=u.floorStyle,d.constantColor=u.constantColor,d.shownFloorIndex=u.shownFloorIndex,d.clippers=u.clippers,d.brightness=u.brightness,d.useHQWeight=u.useHQWeight,d.useHQDepth=u.useHQDepth,d.colorSaturation=u.colorSaturation,d.colorBrightness=u.colorBrightness,d.gradientTexture=u.gradientTexture,d.modelBoundingMax.copy(u.boundingBox.max),d.modelBoundingMin.copy(u.boundingBox.min),d.shaderType==="none"?(d.transparent=!0,d.blending=THREE__namespace.NormalBlending,d.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,d.blendEquation=THREE__namespace.AddEquation,d.blendSrcAlpha=null,d.blendDstAlpha=null,d.blendEquationAlpha=null,d.depthWrite=!1,d.depthTest=!0):(d.transparent=d.alphaMode==="BLEND",d.blending=THREE__namespace.NormalBlending,d.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,d.blendEquation=THREE__namespace.AddEquation,d.blendSrcAlpha=null,d.blendDstAlpha=null,d.blendEquationAlpha=null,d.depthWrite=!0,d.depthTest=!0,u.useAddBlend&&(d.depthWrite=!1,d.depthTest=!1,d.blending=THREE__namespace.AdditiveBlending),d.shownFloorIndex>-1&&d.shownFloorIndex!==d.floorIndex&&(d.transparent=!0),d.opacity<1&&(d.transparent=!0),d.alphaMap&&(d.transparent=!0),d.brightness<1&&(d.transparent=!0),d.depthWrite=!d.transparent,d.logDepthAlpha>0?d.transparent=!1:u.useAddBlend&&(d.depthWrite=!1,d.depthTest=!1,d.blending=THREE__namespace.AdditiveBlending))}}return l}function updatePBMPointCloud(n,t,e,r,o,s,u){var l,c,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,A=1;g!==h&&(A=(g-d)/(g-h)),A=clamp$1(A,0,1),A=easeInCubic(A);var m=p.index?p.index.count:p.attributes.position?p.attributes.position.count:1/0,E=Math.floor(m*A*t.value.appear);p.drawRange.count!==E&&(p.setDrawRange(0,E),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],y=0,b=v;y<b.length;y++){var T=b[y];T.customShaders=u.customShaders,T.pointScale=u.pointScale,T.pointMinPixel=u.pointMinPixel,T.pointMaxPixel=u.pointMaxPixel,T.pointSize=u.pointSize,T.pointShape=u.pointShape,T.pointBack=u.pointBack,T.modelAlpha=u.modelAlpha,T.logDepthAlpha=u.logDepthAlpha,T.opacity=u.opacity,T.floorStyle=u.floorStyle,T.constantColor=u.constantColor,T.shownFloorIndex=u.shownFloorIndex,T.clippers=u.clippers,T.brightness=u.brightness,T.useHQWeight=u.useHQWeight,T.useHQDepth=u.useHQDepth,T.colorSaturation=u.colorSaturation,T.colorBrightness=u.colorBrightness,T.outlineGain=u.outlineGain,T.distanceGain=u.distanceGain,T.gradientTexture=u.gradientTexture,T.transparent=!1,T.blending=THREE__namespace.NormalBlending,T.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,T.blendEquation=THREE__namespace.AddEquation,T.blendSrcAlpha=null,T.blendDstAlpha=null,T.blendEquationAlpha=null,T.depthWrite=!0,T.depthTest=!0,T.modelBoundingMax.copy(u.boundingBox.max),T.modelBoundingMin.copy(u.boundingBox.min),T.shownFloorIndex>-1&&(T.transparent=T.shownFloorIndex!==T.floorIndex),T.modelAlpha<1&&(T.transparent=!0),T.opacity<1&&(T.transparent=!0),T.brightness<1&&(T.transparent=!0),T.logDepthAlpha>0?T.transparent=!1:u.useAddBlend&&(T.depthWrite=!1,T.depthTest=!1,T.blending=THREE__namespace.AdditiveBlending),T.useHQWeight&&(T.depthWrite=!1,T.blending=THREE__namespace.CustomBlending,T.blendSrc=THREE__namespace.SrcAlphaFactor,T.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,T.blendDst=THREE__namespace.OneFactor,T.blendDstAlpha=THREE__namespace.OneFactor)}}return 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&&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,y){if(v.tile.state.requestedFrameNumber!==y.tile.state.requestedFrameNumber)return y.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber;if(v.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(r,v.tile,priorityCache),T=getPriority(r,y.tile,priorityCache);return b-T}else return v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(v,y){return v.tile.state.requestedFrameNumber!==y.tile.state.requestedFrameNumber?y.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.state.centerScreenY!==y.tile.state.centerScreenY?v.tile.state.centerScreenY-y.tile.state.centerScreenY:v.tile.state.centerZDepth!==y.tile.state.centerZDepth?v.tile.state.centerZDepth-y.tile.state.centerZDepth:v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera:v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(v,y){return v.tile.state.requestedFrameNumber!==y.tile.state.requestedFrameNumber?y.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.centerScreenY!==y.tile.state.centerScreenY?v.tile.state.centerScreenY-y.tile.state.centerScreenY:v.tile.state.centerZDepth!==y.tile.state.centerZDepth?v.tile.state.centerZDepth-y.tile.state.centerZDepth:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera:v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.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 A=u.splice(c,1);u.splice.apply(u,__spreadArray([d++,0],A,!1))}}for(var m=function(v){var y=u[v];y.status==="WAITING"&&(p--,y.status="PENDING",y.time=s,E.activeRequests++,E.tileset.options.tileLoader(y.tile).catch(function(b){y.error=b}).then(function(){y.status="DONE",y.tile.content&&y.tile.content.loadState==="READY"&&(y.tile.content.loadState="LOADING"),o.activeRequests--}))},E=this,c=0;c<u.length&&p>0;c++)m(c)},n})(),CacheNode=(function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n})(),CacheNodeList=(function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n})(),TileCache=(function(){function n(t){t===void 0&&(t={}),this.options=t,this.cacheNodeMap=new Map,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touchTile=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.loadTile=function(t){if(!this.cacheNodeMap.has(t)){var e=this.list.add(t);this.cacheNodeMap.set(t,e),this.options.onTileLoad&&this.options.onTileLoad(t)}},n.prototype.unloadTile=function(t){var e=this.cacheNodeMap.get(t);e&&(this.list.remove(e),this.cacheNodeMap.delete(t),this.options.onTileUnload&&this.options.onTileUnload(t))},n.prototype.unloadTiles=function(t){for(var e=this.list.head;e!==this.sentinel&&t();){var r=e.item;e=e.next,this.unloadTile(r)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var o=r[e];o.item!=="sentinel"&&t.push(o.item)}return t},n})(),ManagedArray=(function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),this.array[this._length]=void 0,t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n.prototype.peek=function(){return this.array[this._length-1]},n})(),TilesetBaseTraverser=(function(){function n(t){this.tileset=t,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new ManagedArray}return n.prototype.traverse=function(t,e,r){this.reset()},n.prototype.reset=function(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e),t.state.shouldSelect=!1,t.state.finalResolution=!0},n.prototype.selectTile=function(t,e){var r=t.contentAvailable&&this._canSelectTile;r&&t.state.selectedFrameNumber<e.frameNumber&&(t.state.selectedFrameNumber=e.frameNumber,this.tileset.selectedTiles.push(t),this.tileset.needsRefinedTiles.add(t))},n.prototype.loadTile=function(t,e){t.state.requestedFrameNumber<e.frameNumber&&(t.state.requestedFrameNumber=e.frameNumber,t.content&&(t.content.loadState==="FAILED"&&e.time-t.content.loadStateUpdateTime>t.content.loadfailRetryDelay&&(t.content.loadState="UNLOADED",t.content.loadStateUpdateTime=e.time),t.content.loadState==="UNLOADED"&&this.tileset.requestedTiles.push(t))),this.tileset.needsRefinedTiles.add(t)},n.prototype.touchTile=function(t,e){this.tileset.cache.touchTile(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e){return!t.state.inRequestVolume||t.levelOfContent>=e.maxLevelOfDetail||t.levelOfContent>=0&&t.geometricError<=e.minGeometricError||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.geometricError>=e.maxGeometricError||t.hasTilesetContent?!0:t.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var o=t.children[0];this.updateTileVisibility(o,e),t.state.visible=o.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}var s=t.refine==="REPLACE";if(s&&r&&!this.anyChildrenVisible(t,e)){t.state.visible=!1;return}}},n.prototype.anyChildrenVisible=function(t,e){for(var r=!1,o=t.children,s=0,u=o;s<u.length;s++){var l=u[s];l.updateState(e),r=r||l.state.visible}return r},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"||r.levelOfContent<e.minLevelOfDetail||r.geometricError>e.maxGeometricError?!1:r.levelOfContent>e.maxLevelOfDetail||r.levelOfContent>=0&&r.geometricError<e.minGeometricError?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError},n.prototype.sortTilesByDistanceToCamera=function(t){t.sort(function(e,r){return r.state.distanceToCamera===0&&e.state.distanceToCamera===0?r.state.centerZDepth-e.state.centerZDepth:r.state.distanceToCamera-e.state.distanceToCamera})},n})(),TilesetNormalTraverser=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r._traversalStack=new ManagedArray,r._emptyTraversalStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,o){o===void 0&&(o=[]),n.prototype.traverse.call(this,e,r,o);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),this._emptyTraversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,this.updateTile(e,l),this.executeTraversal(e,l))}this._traversalStack.reset(),this._emptyTraversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._emptyTraversalStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&o.push(e);o.length>0;){var s=o.pop(),u=s.parent,l=!u||u.state.shouldRefine,c=!1;this.canTraverse(s,r)&&(c=this.updateAndPushChildren(s,r,o)&&l);var 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 A=void 0;c.state.inRequestVolume?c.hasRenderContent?A=c.contentAvailable:A=this.executeEmptyTraversal(c,r):A=!1,d=d&&A}}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 A;!((A=g.content)===null||A===void 0)&&A.data&&(r.loadedTiles.add(g),r.cache.loadTile(g)),r.options.onTileLoad(g)},onTileError:function(g,A){r.options.onTileError(g,A)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new Tile("".concat(this.id,"#tile:0"),t.root,this),this.geometricError=t.geometricError,this.trajectories=[],this.asset.trajectories)for(var d=0;d<this.asset.trajectories.length;d++){var h=new Trajectory("".concat(this.id,"#trajectory:").concat(d),this.asset.trajectories[d],this);this.trajectories.push(h)}}return n.prototype.adjustScreenSpaceError=function(t){if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=t.maxScreenSpaceError),t.memoryAdjustedScreenSpaceError){var e=0;this.needsRefinedTiles.forEach(function(s){s.content&&(e+=s.content.memoryUsage)});var r=(t.maxMemoryUsage-t.memoryAdjustedOverflow)*1024*1024,o=t.maxMemoryUsage*1024*1024;e<r?this.currentMaxScreenSpaceError=Math.max(this.currentMaxScreenSpaceError/1.02,t.maxScreenSpaceError):e>o&&this.selectedTiles.length>0&&(this.currentMaxScreenSpaceError*=1.02)}else this.currentMaxScreenSpaceError=t.maxScreenSpaceError},n.prototype.getTraverser=function(t){return t.mostDetail?this.mostDetailTraverser:t.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},n.prototype.reset=function(){var t=this;this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();for(var e=[this.root],r;r=e.pop();){for(var o=0,s=r.children.length;o<s;o++)e.push(r.children[o]);this.cache.unloadTile(r)}for(var u=function(){var 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 normalizeURL(n){var t,e=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(n);if(!e)return n;var r=e[1]||"",o=n.slice(r.length+2),s=o.indexOf("#");s>=0&&(n.slice(s),o=n.slice(0,s));var u=o.indexOf("?");u>=0&&(n.slice(u),o=n.slice(0,u));for(var l=o.split("/"),c=l.shift(),f=(t=l.pop())!==null&&t!==void 0?t:"",p=[],d=0,h=l;d<h.length;d++){var g=h[d];if(!(g===""||g===".")){if(g===".."){p.pop();continue}p.push(g)}}return r+"//"+c+"/"+p.join("/")+"/"+f}function 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!!n.image&&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,A=this.parseVertexIndex(t,d),m=this.parseVertexIndex(e,d),E=this.parseVertexIndex(r,d),v=l!==void 0?this.parseNormalIndex(l,h):void 0,y=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||y===void 0||b===void 0)&&(p.hasNormal=!1),(p.hasUV===!0&&T===void 0||_===void 0||S===void 0)&&(p.hasUV=!1);var R=[A,T,v].join(":"),w=p.indexMap[R];w===void 0&&(w=p.vertices.length/3,p.indexMap[R]=w,p.vertices.push(this.vertices[A+0],this.vertices[A+1],this.vertices[A+2]),p.hasColor&&(this.colors[A]===void 0?p.hasColor=!1:p.colors.push(this.colors[A+0],this.colors[A+1],this.colors[A+2])),p.hasNormal&&p.normals.push(this.normals[A+0],this.normals[A+1],this.normals[A+2]),p.hasUV&&p.uvs.push(this.uvs[T+0],this.uvs[T+1])),p.index.push(w);var M=[m,_,y].join(":"),O=p.indexMap[M];O===void 0&&(O=p.vertices.length/3,p.indexMap[M]=O,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[_+0],this.uvs[_+1])),p.index.push(O);var C=[E,S,b].join(":"),P=p.indexMap[C];P===void 0&&(P=p.vertices.length/3,p.indexMap[C]=P,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[S+0],this.uvs[S+1])),p.index.push(P)},n})();function parseObj(n){var t=new ObjState;n.indexOf(`\r
|
|
920
920
|
`)!==-1&&(n=n.replace(/\r\n/g,`
|
|
921
921
|
`)),n.indexOf(`\\
|
|
@@ -1023,7 +1023,7 @@ void main() {
|
|
|
1023
1023
|
#include <fog_fragment>
|
|
1024
1024
|
#include <premultiplied_alpha_fragment>
|
|
1025
1025
|
}
|
|
1026
|
-
`,uniforms:{diffuse:{value:new THREE__namespace.Color},opacity:{value:1},displacementScalar:{value:0}}};function createPipeBufferGeometry(n,t,e,r){for(var o=new Float32Array((e+1)*(r+1)*3),s=new Float32Array((e+1)*(r+1)*3),u=new Float32Array((e+1)*(r+1)*2),l=new Uint32Array(e*r*6),c=n.computeFrenetFrames(e),f=new THREE__namespace.Vector3,p=new THREE__namespace.Vector3,d=new THREE__namespace.Vector2,h=new THREE__namespace.Vector3,g=0;g<=e;g++){h=n.getPointAt(g/e,h);for(var A=c.normals[g],m=c.binormals[g],E=0;E<=r;E++){var v=g*(r+1)+E,y=E/r*Math.PI*2,b=Math.sin(y),T=-Math.cos(y);p.x=T*A.x+b*m.x,p.y=T*A.y+b*m.y,p.z=T*A.z+b*m.z,p.normalize(),p.toArray(s,v*3),f.x=h.x+t*p.x,f.y=h.y+t*p.y,f.z=h.z+t*p.z,f.toArray(o,v*3),d.x=g/e,d.y=E/r,d.toArray(u,v*2)}}for(var g=0;g<e;g++)for(var E=0;E<r;E++){var _=(g*r+E)*6,S=(r+1)*g+E,R=(r+1)*(g+1)+E,w=(r+1)*(g+1)+(E+1),M=(r+1)*g+(E+1);l[_]=S,l[_+1]=R,l[_+2]=M,l[_+3]=R,l[_+4]=w,l[_+5]=M}var O=new THREE__namespace.BufferGeometry;return O.setIndex(new THREE__namespace.BufferAttribute(l,1)),O.setAttribute("position",new THREE__namespace.BufferAttribute(o,3)),O.setAttribute("normal",new THREE__namespace.BufferAttribute(s,3)),O.setAttribute("uv",new THREE__namespace.BufferAttribute(u,2)),O}function parseTrajectoryObject(n,t){for(var e=new THREE__namespace.Color(0).convertSRGBToLinear(),r=new THREE__namespace.Color(52949).convertSRGBToLinear(),o=new THREE__namespace.Color(3370495).convertSRGBToLinear(),s=new THREE__namespace.Color(16777215).convertSRGBToLinear(),u=0,l=new THREE__namespace.CurvePath,c=n.length,f=3;f<c;f+=3){var p=new THREE__namespace.Vector3().fromArray(n,f-3),d=new THREE__namespace.Vector3().fromArray(n,f);u+=p.distanceTo(d);var h=new THREE__namespace.LineCurve3(p,d);l.add(h)}var g=.03,A=Math.ceil(u*100),m=6,E=createPipeBufferGeometry(l,g,A,m);E.clearGroups(),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,0),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,1),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,2);var v=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});v.uniforms.totalLength.value=u,v.uniforms.diffuse.value=e,v.uniforms.diffuse2.value=e,v.uniforms.opacity.value=.5,v.transparent=!0;var y=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});y.uniforms.totalLength.value=u,y.uniforms.displacementScalar.value=-.01,y.uniforms.diffuse.value=r,y.uniforms.diffuse2.value=o;var b=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.DoubleSide});b.uniforms.totalLength.value=u,b.uniforms.displacementScalar.value=-.026,b.uniforms.dashSize.value=new THREE__namespace.Vector2(.06,.09),b.uniforms.diffuse.value=s,b.uniforms.diffuse2.value=s;var T=new THREE__namespace.Mesh(E,[v,y,b]),_=.08,S=24,R=new THREE__namespace.SphereBufferGeometry(_,S,S);R.clearGroups(),R.addGroup(0,E.index?E.index.count:E.attributes.position.count,0),R.addGroup(0,E.index?E.index.count:E.attributes.position.count,1);var w=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.BackSide});w.uniforms.diffuse.value=e,w.uniforms.opacity.value=.5,w.transparent=!0;var M=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});M.uniforms.displacementScalar.value=-.01,M.uniforms.diffuse.value=r;var O=new THREE__namespace.Mesh(R,[w,M]);O.position.fromArray(n,0),T.add(O);var C=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});C.uniforms.displacementScalar.value=-.01,C.uniforms.diffuse.value=o;var P=new THREE__namespace.Mesh(R,[w,C]);return P.position.fromArray(n,n.length-3),T.add(P),{scene:T,dispose:function(){E.dispose(),v.dispose(),y.dispose(),b.dispose(),R.dispose(),w.dispose(),M.dispose(),C.dispose()}}}function loadTrajectory(n,t){var e=n.name,r=appendSearch(n.content.uri,t.search),o=imageURL(r,{key:"model.0"});return n.content.loadState="LOADING",n.content.loadStateUpdateTime=now(),loadPly(o,{type:"geometry",customPropertyMapping:{time:{itemType:"uint32",itemNames:["time_milisec"]}},fetcher:t.fetcher}).then(function(s){var u,l,c,f,p=(l=(u=s.scene.attributes)===null||u===void 0?void 0:u.time.array)!==null&&l!==void 0?l:[],d=(f=(c=s.scene.attributes)===null||c===void 0?void 0:c.position.array)!==null&&f!==void 0?f:[],h=s.byteLength,g=s.memoryUsage,A=parseTrajectoryObject(d);A.scene.applyMatrix4(n.transform),A.scene.updateWorldMatrix(!1,!0),A.scene.matrixAutoUpdate=!1;var m=new TrajectoryNode(e,A.scene);return n.content.data={uri:o,byteLength:h,memoryUsage:g,positionArray:d,timeArray:p,object:m},n.content.byteLength=h,n.content.memoryUsage=g,n.content.loadState="READY",n.content.loadStateUpdateTime=now(),n}).catch(function(s){return n.content.data=void 0,n.content.loadState="FAILED",n.content.loadStateUpdateTime=now(),s instanceof NetworkResponseError&&s.httpStatus===0||s instanceof NetworkTimeoutError||s instanceof NetworkProxyError?n.content.loadfailRetryDelay=clamp$1(n.content.loadfailRetryDelay+RETRY_DELAY_STEP,RETRY_DELAY_STEP,MAX_RETRY_DELAY):n.content.loadfailRetryDelay=1/0,Promise.reject(s)})}function unloadTrajectory(n){n.content&&(n.content.data&&n.content.data.object.dispose(),n.content.data=void 0,n.content.loadState="UNLOADED",n.content.loadStateUpdateTime=now(),n.content.byteLength=0,n.content.memoryUsage=0)}var scratchVector3$7=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$3=new THREE__namespace.Matrix4,a=6378137,invF=298.257223563;function ecefToLla(n){for(var t=a-a/invF,e=(a*a-t*t)/(a*a),r=Math.sqrt(n.x*n.x+n.y*n.y),o=1e-12,s=1e3,u=0,l=Math.atan2(n.z,r),c=0;u++<s;){var f=Math.sin(l),p=a/Math.sqrt(1-e*f*f);c=r/Math.cos(l)-p;var d=Math.atan2(n.z/(p*(1-e)+c),r/(p+c));if(isNaN(d))break;var h=Math.abs(d-l);if(h<o)break;l=d}return n.set(l,Math.atan2(n.y,n.x),c)}function llaToEcef(n){var t=n.x,e=n.y,r=n.z,o=a-a/invF,s=(a*a-o*o)/(a*a),u=Math.sin(t),l=Math.cos(t),c=Math.sin(e),f=Math.cos(e),p=a/Math.sqrt(1-s*u*u),d=(p+r)*l*f,h=(p+r)*l*c,g=(o*o/(a*a)*p+r)*u;return n.set(d,h,g)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$7.copy(n)),r=e.x,o=e.y,s=e.z,u=Math.sin(r),l=Math.sin(o),c=Math.cos(r),f=Math.cos(o);t.fromArray([-l,-u*f,c*f,0,+f,-u*l,c*l,0,0,c,u,0,0,0,0,1]);var p=scratchMatrix3.setFromMatrix4(t),d=scratchVector3$7.copy(n).applyMatrix3(p).multiplyScalar(-1);t.setPosition(d);var h=scratchMatrix4$3.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,s,1]);return t.premultiply(h),t}var ROTATE_X_90_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),ROTATE_X_90_MATRIX_INVERSE=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),enuToLocalMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),localToEnuMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE);function getRecommendTile3dProps(n,t){var e,r,o;t===void 0&&(t={});var s,u,l,c=typeof n.tileset.rootMeta.creationTime=="string";if(c){var f=typeof n.tileset.rootMeta.numTotalPoints=="number"&&n.tileset.rootMeta.numTotalPoints>0;if(f){l=4,t.powerPreference==="high"&&(l=2),s=l/1.6;var p=0;if(((e=n.tileset.rootMeta.taskParameters)===null||e===void 0?void 0:e.point_homogenization)==="1"&&(!((r=n.tileset.rootMeta.taskParameters)===null||r===void 0)&&r.homo_point_density)){var d=Number((o=n.tileset.rootMeta.taskParameters)===null||o===void 0?void 0:o.homo_point_density);isFinite(d)&&!isNaN(d)&&(p=d)}p<=0&&(p=.02),u=p*1.4}else l=5,t.powerPreference==="high"&&(l=4),s=0,u=.03}else l=6,s=0,u=.03,n.name==="aerophoto"?(l=12,t.powerPreference==="high"&&(l=10)):n.tileset.asset.extras&&typeof n.tileset.asset.extras.name=="string"&&/^matterport\b/i.test(n.tileset.asset.extras.name)&&(l=5,t.powerPreference==="high"&&(l=4));return{pointScale:u,pointMinPixel:s,maxScreenSpaceError:l}}var scratchVector3$6=new THREE__namespace.Vector3,scratchSphereBoundingVolume=new SphereBoundingVolume,scratchBoxBoundingVolume=new BoxBoundingVolume,parameterVersionMap=new WeakMap,tileVersionMap=new WeakMap,trajectoryVersionMap=new WeakMap,STENCIL_CONSTANT={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4},SKIP_BACKFACE_MATERIAL=(function(){var n=new THREE__namespace.MeshBasicMaterial;return n.side=THREE__namespace.BackSide,n.color.setHex(16711935),n.colorWrite=!1,n.stencilWrite=!0,n.polygonOffset=!0,n.polygonOffsetFactor=2,n.polygonOffsetUnits=2,n.stencilRef=STENCIL_CONSTANT.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=STENCIL_CONSTANT.TILE_MASK,n})(),SKIP_BACKFACE_TRANSPARENT_MATERIAL=(function(){var n=new THREE__namespace.MeshBasicMaterial;return n.visible=!1,n})(),CLEAR_STENCIL_GEOMETRY=new THREE__namespace.BufferGeometry,CLEAR_STENCIL_MATERIAL=new THREE__namespace.MeshBasicMaterial;function cloneSkipBackfaceObject(n){var t;n instanceof THREE__namespace.Mesh?t=new THREE__namespace.Mesh(n.geometry,Array.isArray(n.material)?n.material.map(function(s){return s.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):n.material&&n.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):n instanceof THREE__namespace.Group?t=new THREE__namespace.Group:t=new THREE__namespace.Object3D,t.position.copy(n.position),t.quaternion.copy(n.quaternion),t.scale.copy(n.scale),t.matrix.compose(n.position,n.quaternion,n.scale),t.matrixAutoUpdate=!1,t.frustumCulled=n.frustumCulled,t.visible=n.visible;for(var e=0,r=n.children;e<r.length;e++){var o=r[e];t.add(cloneSkipBackfaceObject(o))}return t}var Tile3D=(function(n){__extends(t,n);function t(e,r){var o,s,u=n.call(this)||this;return u.parameter=new Parameter,u.renderObjects=[],u.backfaceObjects=[],u.tileObjects=[],u.frameNumber=0,u.error=(o=r.error)!==null&&o!==void 0?o:null,u.name=r.name,u.type=r.type,u.upAxis=r.upAxis,u.light=r.light,u.fetcher=r.fetcher,u.search=(s=r.search)!==null&&s!==void 0?s:"",u.groundHeight=r.groundHeight,u.enuToEcefMatrix=new THREE__namespace.Matrix4().copy(r.enuToEcefMatrix),u.ecefToEnuMatrix=new THREE__namespace.Matrix4().copy(r.ecefToEnuMatrix),u.boundingBox=new THREE__namespace.Box3,u.autoRefine=!0,u.refined=!1,u.refineProgress=[0,0],u.loaded=!1,u.disposed=!1,u.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),u.clearStencilObject.frustumCulled=!1,u.clearStencilObject.onAfterRender=function(l){return l.clearStencil()},u.tileset=new Tileset(e,{tileLoader:function(l){return u.loadContent(l)},tileUnloader:function(l){return u.unloadContent(l)},onTileLoad:function(){},onTileUnload:function(l){},onTileError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Tile error",l.id,c)},trajectoryLoader:function(l){return u.loadTrajectory(l)},trajectoryUnloader:function(l){return u.unloadTrajectory(l)},onTrajectoryLoad:function(){},onTrajectoryUnload:function(l){},onTrajectoryError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Trajectory error",l,c)}}),u.tileset.root.boundingVolume&&u.tileset.root.boundingVolume.getBoundingBox(u.boundingBox),u}return Object.defineProperty(t.prototype,"viewerRequestVolume",{get:function(){return this.tileset.root.viewerRequestVolume},set:function(e){this.tileset.root.viewerRequestVolume=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tiles",{get:function(){return this.tileset.selectedTiles},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trajectories",{get:function(){return this.tileset.trajectories},enumerable:!1,configurable:!0}),t.prototype.getRecommendProps=function(e){return e===void 0&&(e={}),getRecommendTile3dProps(this,e)},t.prototype.loadContent=function(e){var r=this;return loadTileContent(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){e.type==="SCENEGRAPH"&&(r.disposed||!e.content?unloadTileContent(e):e.content.data&&r.boundingBox.expandByObject(e.content.data.object))})},t.prototype.unloadContent=function(e){return unloadTileContent(e),Promise.resolve()},t.prototype.loadAllTilesets=function(){var e=this,r=function(o){var s=[];return e.tileset.root.traverse(function(u){var l;u.type==="TILESET"&&((l=u.content)===null||l===void 0?void 0:l.loadState)!=="READY"&&s.push(u)}),Promise.all(s.map(function(u){return e.loadContent(u).then(function(){return r()})})).then(function(){})};return r(this.tileset.root)},t.prototype.loadTrajectory=function(e){var r=this;return loadTrajectory(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){r.disposed&&unloadTrajectory(o)})},t.prototype.unloadTrajectory=function(e){return unloadTrajectory(e),Promise.resolve()},t.prototype.intersectRaycaster=function(e,r){for(var o,s,u,l=r!=null?r:[],c=[this.tileset.root],f=this.tileset.transform,p,d=e.sortByDistance,h=(s=(o=e.params.Points)===null||o===void 0?void 0:o.threshold)!==null&&s!==void 0?s:0,g=1/0;p=c.pop();){var A=void 0;if(p.boundingVolume){var m=void 0;p.boundingVolume instanceof BoxBoundingVolume?m=scratchBoxBoundingVolume.copy(p.boundingVolume):p.boundingVolume instanceof SphereBoundingVolume?m=scratchSphereBoundingVolume.copy(p.boundingVolume):m=p.boundingVolume.clone(),m.applyMatrix4(f),A=m.intersectRay(e.ray,h,g)}else A=!0;if(A){for(var E=0,v=p.children.length;E<v;E++)c.push(p.children[E]);if(p.selected&&p.content&&p.content.data&&p.content.data.object.visible&&(p.content.data.object.intersectRaycaster(e,l),e.firstHitOnly)){var y=l[0];y&&g>y.distance&&(g=y.distance)}}}e.sortByDistance=d,sortIntersects(l,e.sortByDistance,e.firstHitOnly);for(var b=0,T=l;b<T.length;b++){var y=T[b];y.model=(u=this.parent)!==null&&u!==void 0?u:void 0,y.viewLayer=this}return l},t.prototype.update=function(e,r,o,s){var u,l,c=this,f,p,d,h,g;this.renderer=e,this.frameNumber++;var A=!1,m=this.parameter.resolveValue(o.parameter,s.parameter);parameterVersionMap.get(this)!==m.version&&(parameterVersionMap.set(this,m.version),A=!0);var E=m.maxLevelOfDetail;E=Math.max(E,0);var v=Math.min(m.minLevelOfDetail,E);(!this.visible||!this.loaded||!o.loaded)&&(E=Math.max(v,0));var y=m.minGeometricError,b=r.controllerMode;(b==="Panorama"||b==="VRPanorama"||b==="XRPanorama")&&m.modelAlpha<.1&&(y=m.panoramaMinGeometricError);var T=m.maxGeometricError;T=Math.max(y,T);var _={time:r.time,camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(r.up).applyQuaternion(r.quaternion),projectionMatrix:r.projectionMatrix.clone(),visible:r.visible,refine:r.refineModel},height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r),minLevelOfDetail:v,maxLevelOfDetail:E,minGeometricError:y,maxGeometricError:T,skipLevelOfDetail:m.skipLevelOfDetail,mostDetail:m.mostDetail,loadSiblings:m.loadSiblings,cameraCulling:m.cameraCulling,maxMemoryUsage:m.maxMemoryUsage,maxRequests:m.maxRequests,requestOrder:m.requestOrder,maxScreenSpaceError:m.maxScreenSpaceError,memoryAdjustedOverflow:m.memoryAdjustedOverflow,memoryAdjustedScreenSpaceError:m.memoryAdjustedScreenSpaceError},S=m.cacheCameras.map(function(re){return re.updateProjectionMatrix(),__assign(__assign({},_),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(re.position),direction:re.getWorldDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(re.up),projectionMatrix:re.projectionMatrix.clone(),visible:re.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(re)})});this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),A=!0);var R=!this.autoRefine;if(R===!1){var w=m.progress>.01&&m.progress<.99;if(w){var M=new THREE__namespace.Vector3;m.pano0&&M.setFromMatrixPosition(m.pano0.matrix);var O=M.clone();m.pano1&&O.setFromMatrixPosition(m.pano1.matrix),M.distanceTo(O)<10&&(R=!0)}}if(R||this.tileset.update(_,S),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(re){if(c.refineProgress[1]++,re.content){var ue=re.content.loadState;if(ue==="UNLOADED"||ue==="LOADING"){c.refined=!1;return}}c.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;var C=!1;this.tileset.needsRefinedTiles.forEach(function(re){if(c.loaded!==!1&&re.content){if(re.state.visible&&(C=!0),_.skipLevelOfDetail){if(re.state.finalResolution){var ue=re.state.ancestorWithContentAvailable,ve=ue&&ue.content?ue.content:re.content,ye=ve.loadState;(ye==="UNLOADED"||ye==="LOADING")&&(c.loaded=!1)}}else if(re.state.visible&&re.levelOfContent<=0){var ye=re.content.loadState;(ye==="UNLOADED"||ye==="LOADING")&&(c.loaded=!1)}}}),C&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0,this.remove.apply(this,this.children),_.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(re,ue){return re.floor!==ue.floor?re.floor-ue.floor:re.levelOfContent!==ue.levelOfContent?ue.levelOfContent-re.levelOfContent:re.state.distanceToCamera!==ue.state.distanceToCamera?re.state.distanceToCamera-ue.state.distanceToCamera:re.state.centerZDepth-ue.state.centerZDepth});for(var P=[],F=0,L=this.tileset.selectedTiles;F<L.length;F++){var H=L[F],N=(p=(f=H.content)===null||f===void 0?void 0:f.data)===null||p===void 0?void 0:p.object;if(N){var D=N.update(e,r,o,this,H,m);if(P.push(H.id),D&&(A=!0),this.tileset.hasMixedContent&&_.skipLevelOfDetail){if(!H.state.finalResolution){var Q=cloneSkipBackfaceObject(N);Q.name="skipBackface:"+N.name,this.backfaceObjects.push(Q)}for(var J=H.state.selectionDepth,U=STENCIL_CONSTANT.TILE_MASK|J<<STENCIL_CONSTANT.SKIP_LOD_BIT_SHIFT,z=THREE__namespace.GreaterEqualStencilFunc,q=STENCIL_CONSTANT.SKIP_LOD_MASK,j=THREE__namespace.ReplaceStencilOp,G=STENCIL_CONSTANT.TILE_MASK|STENCIL_CONSTANT.SKIP_LOD_MASK,X=0,Y=N.materials;X<Y.length;X++){var Z=Y[X];Z.stencilWrite=!0,Z.stencilRef=U,Z.stencilFunc=z,Z.stencilFuncMask=q,Z.stencilZPass=j,Z.stencilWriteMask=G}}else for(var W=0,K=N.materials;W<K.length;W++){var Z=K[W];Z.stencilWrite=!1,Z.stencilRef=STENCIL_CONSTANT.TILE_MASK,Z.stencilFunc=THREE__namespace.AlwaysStencilFunc,Z.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,Z.stencilZPass=THREE__namespace.ReplaceStencilOp,Z.stencilWriteMask=STENCIL_CONSTANT.TILE_MASK}this.tileObjects.push(N)}}var ne=P.toString();tileVersionMap.get(this)!==ne&&(tileVersionMap.set(this,ne),A=!0),_.skipLevelOfDetail&&this.backfaceObjects.length&&(u=this.renderObjects).push.apply(u,this.backfaceObjects),this.tileObjects.length&&(l=this.renderObjects).push.apply(l,this.tileObjects),_.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var ee=[],te=0,ae=this.tileset.selectedTrajectories;te<ae.length;te++){var fe=ae[te],se=(d=fe.content.data)===null||d===void 0?void 0:d.object;if(se){var D=se.update(e,r,o,this,fe,m);ee.push(fe.id),D&&(A=!0),this.renderObjects.push(se)}}var he=ee.toString();trajectoryVersionMap.get(this)!==he&&(trajectoryVersionMap.set(this,he),A=!0);for(var me=Math.min(0,((g=(h=this.parent)===null||h===void 0?void 0:h.children)!==null&&g!==void 0?g:[]).indexOf(this)),be=me*1e4,Te=function(re){var ue=ce.renderObjects[re],ve=re+be;ue.traverse(function(ye){(ye instanceof THREE__namespace.Mesh||ye instanceof THREE__namespace.Line||ye instanceof THREE__namespace.Points)&&(ye.renderOrder=ve)}),ce.add(ue)},ce=this,pe=0;pe<this.renderObjects.length;pe++)Te(pe);return A},t.prototype.dispose=function(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id),this.remove.apply(this,this.children),this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0,this.error=null,this.onError=void 0,this.renderer=void 0},Object.defineProperty(t.prototype,"model",{get:function(){return this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scene",{get:function(){return this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayer",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.enuToEcef=function(e){return e.applyMatrix4(this.enuToEcefMatrix)},t.prototype.ecefToEnu=function(e){return e.applyMatrix4(this.ecefToEnuMatrix)},t.prototype.localToEcef=function(e){return this.enuToEcef(this.localToEnu(e))},t.prototype.ecefToLocal=function(e){return this.enuToLocal(this.ecefToEnu(e))},t.prototype.localToLla=function(e){return ecefToLla(this.enuToEcef(this.localToEnu(e)))},t.prototype.llaToLocal=function(e){return this.enuToLocal(this.ecefToEnu(llaToEcef(e)))},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},t.prototype.worldToEcef=function(e){return this.localToEcef(this.worldToLocal(e))},t.prototype.ecefToWorld=function(e){return this.localToWorld(this.ecefToLocal(e))},t.prototype.worldToLla=function(e){return this.localToLla(this.worldToLocal(e))},t.prototype.llaToWorld=function(e){return this.localToWorld(this.llaToLocal(e))},Object.defineProperty(t.prototype,"coordinates",{get:function(){scratchVector3$6.setScalar(0);var e=this.localToLla(scratchVector3$6),r=e.x,o=e.y;return[r,o].map(function(s){return(s/Math.PI*180).toFixed(6)}).join(",")},enumerable:!1,configurable:!0}),t.prototype.getTransformMatrix4=function(e){return e===void 0&&(e=new THREE__namespace.Matrix4),e.copy(this.ecefToEnuMatrix),e.premultiply(enuToLocalMatrix),e.premultiply(this.matrixWorld),e},t.prototype.coordinatesToWorldPoint=function(e){var r=new THREE__namespace.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(r)},t.prototype.worldPointToCoordinates=function(e){return scratchVector3$6.copy(e),this.worldToLla(scratchVector3$6),{latitude:scratchVector3$6.x,longitude:scratchVector3$6.y,altitude:scratchVector3$6.z}},t.prototype.resetBrightness=function(){this.parameter.reset("brightness")},Object.defineProperty(t.prototype,"minLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minLevelOfDetail},set:function(e){this.parameter.set("minLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxLevelOfDetail},set:function(e){this.parameter.set("maxLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minGeometricError},set:function(e){this.parameter.set("minGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxGeometricError},set:function(e){this.parameter.set("maxGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoramaMinGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).panoramaMinGeometricError},set:function(e){this.parameter.set("panoramaMinGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).skipLevelOfDetail},set:function(e){this.parameter.set("skipLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mostDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).mostDetail},set:function(e){this.parameter.set("mostDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).loadSiblings},set:function(e){this.parameter.set("loadSiblings",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxMemoryUsage},set:function(e){this.parameter.set("maxMemoryUsage",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxRequests},set:function(e){this.parameter.set("maxRequests",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestOrder",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).requestOrder},set:function(e){this.parameter.set("requestOrder",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxScreenSpaceError},set:function(e){this.parameter.set("maxScreenSpaceError",e)},enumerable:!1,configurable:!0}),t})(THREE__namespace.Object3D),fetcherMap=new WeakMap;function getFetcher(n){var t=fetcherMap.get(n);if(t)return t;throw new Error("fetcher never registered.")}function registerFetcher(n,t){return fetcherMap.set(n,t)}var scratchVector3$5=new THREE__namespace.Vector3,scratchMatrix4$2=new THREE__namespace.Matrix4;function getEcefToEnuMatrixFromUpAxis(n,t,e){switch(n){case"Z":e.identity();break;case"Y":e.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);break;case"-Y":e.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]);break;case"WGS84":case"GCJ02":case"BD09":getEcefToEnuMatrix(t,e);break;default:e.identity();break}return e}function getExt(n){var t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(n);if(t){var e=String(t[1]).trim().split(".").slice(1).reverse()[0];if(e)return e}return""}function loadViewLayer(n,t){var e,r=n.tileset,o=n.name,s=n.type,u=n.work.getURL(r),l=u.split("#"),c=l[0],f=l[1],p=(e=(f||c).split("?")[1])!==null&&e!==void 0?e:"";return t.fetcher.ajax(u,{responseType:"text"}).catch(function(d){return{error:d,body:JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{geometricError:0}})}}).then(function(d){var h,g="error"in d?d.error:null,A=normalizeTilesetHeader(JSON.parse(d.body),u),m=A.root,E=A.rootMeta,v=E===void 0?{}:E,y=n.upAxis;v.upAxis&&v.upAxis!==y&&(y=v.upAxis),"lodVersion"in A&&(y="-Y","floorInfo"in A&&(A.properties=A.properties||{},A.properties.floorInfo=A.floorInfo.map(function(w){return{ground:-w.ground,height:w.height}}),delete A.floorInfo),A.asset.tilesetVersion=String(A.lodVersion),delete A.lodVersion);var b=m.boundingVolume?makeBoundingVolume(m.boundingVolume):void 0;b&&m.transform&&b.applyMatrix4(scratchMatrix4$2.fromArray(m.transform));var T=null,_=new THREE__namespace.Matrix4,S=new THREE__namespace.Matrix4;v.coordinate?(T=v.coordinate.ground_height,_.fromArray(v.coordinate.pose_ecef_to_enu),S.fromArray(v.coordinate.pose_enu_to_ecef)):(b?b.getCenter(scratchVector3$5):scratchVector3$5.setScalar(0),getEcefToEnuMatrixFromUpAxis(y,scratchVector3$5,_),S.getInverse(_)),A.root={refine:(h=m.refine)!==null&&h!==void 0?h:"REPLACE",geometricError:m.geometricError,transform:scratchMatrix4$2.copy(_).premultiply(enuToLocalMatrix).toArray(),boundingVolume:b?b.toJson():void 0,children:[m]};var R=new Tile3D(A,{name:o,type:s,upAxis:y,light:t.light,fetcher:t.fetcher,search:p,groundHeight:T,enuToEcefMatrix:S,ecefToEnuMatrix:_,error:g});return R})}function loadViewLayers(n,t){var e,r,o=n.layers.slice();if(n.file){for(var s=!1,u=0,l=o;u<l.length;u++){var c=l[u];if(c.type==="mesh"){s=!0;break}}if(s===!1){var f=getExt(n.file)||"at3d",p=JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{refine:"REPLACE",geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:n.work.getURL(n.file)},extras:(e={},e[f]={textureBaseUri:typeof n.textureBase=="string"?n.work.getURL(n.textureBase):void 0,textureArray:n.textures,textureOptions:(r=t.textureOptions)!==null&&r!==void 0?r:{}},e)}});o.push({work:n.work,name:"fallback",type:"mesh",upAxis:"Z",tileset:URL.createObjectURL(new Blob([p],{type:"application/json"}))})}}return o.map(function(d){return loadViewLayer(d,{fetcher:t.fetcher,light:t.light}).then(function(h){return t.onError&&(h.error&&t.onError(h.error),h.onError=t.onError),h})})}var BufferGeometryUtils={computeTangents:function(n){var t=n.index,e=n.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");return}var r=t.array,o=e.position.array,s=e.normal.array,u=e.uv.array,l=o.length/3;e.tangent===void 0&&n.setAttribute("tangent",new THREE__namespace.BufferAttribute(new Float32Array(4*l),4));for(var c=e.tangent.array,f=[],p=[],d=0;d<l;d++)f[d]=new THREE__namespace.Vector3,p[d]=new THREE__namespace.Vector3;var h=new THREE__namespace.Vector3,g=new THREE__namespace.Vector3,A=new THREE__namespace.Vector3,m=new THREE__namespace.Vector2,E=new THREE__namespace.Vector2,v=new THREE__namespace.Vector2,y=new THREE__namespace.Vector3,b=new THREE__namespace.Vector3;function T(U,z,q){h.fromArray(o,U*3),g.fromArray(o,z*3),A.fromArray(o,q*3),m.fromArray(u,U*2),E.fromArray(u,z*2),v.fromArray(u,q*2);var j=g.x-h.x,G=A.x-h.x,X=g.y-h.y,Y=A.y-h.y,Z=g.z-h.z,W=A.z-h.z,K=E.x-m.x,ne=v.x-m.x,ee=E.y-m.y,te=v.y-m.y,ae=1/(K*te-ne*ee);y.set((te*j-ee*G)*ae,(te*X-ee*Y)*ae,(te*Z-ee*W)*ae),b.set((K*G-ne*j)*ae,(K*Y-ne*X)*ae,(K*W-ne*Z)*ae),f[U].add(y),f[z].add(y),f[q].add(y),p[U].add(b),p[z].add(b),p[q].add(b)}var _=n.groups;_.length===0&&(_=[{start:0,count:r.length}]);for(var d=0,S=_.length;d<S;++d)for(var R=_[d],w=R.start,M=R.count,O=w,C=w+M;O<C;O+=3)T(r[O+0],r[O+1],r[O+2]);var P=new THREE__namespace.Vector3,F=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3,H=new THREE__namespace.Vector3,N,D,Q;function J(U){L.fromArray(s,U*3),H.copy(L),D=f[U],P.copy(D),P.sub(L.multiplyScalar(L.dot(D))).normalize(),F.crossVectors(H,D),Q=F.dot(p[U]),N=Q<0?-1:1,c[U*4]=P.x,c[U*4+1]=P.y,c[U*4+2]=P.z,c[U*4+3]=N}for(var d=0,S=_.length;d<S;++d)for(var R=_[d],w=R.start,M=R.count,O=w,C=w+M;O<C;O+=3)J(r[O+0]),J(r[O+1]),J(r[O+2])},mergeBufferGeometries:function(n,t){for(var e=n[0].index!==null,r=new Set(Object.keys(n[0].attributes)),o=new Set(Object.keys(n[0].morphAttributes)),s={},u={},l=new THREE__namespace.BufferGeometry,c=0,f=0;f<n.length;++f){var p=n[f];if(e!==(p.index!==null))return null;for(var d in p.attributes){if(!r.has(d))return null;s[d]===void 0&&(s[d]=[]),s[d].push(p.attributes[d])}for(var d in p.morphAttributes){if(!o.has(d))return null;u[d]===void 0&&(u[d]=[]),u[d].push(p.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(p.userData),t){var h;if(e)h=p.index.count;else if(p.attributes.position!==void 0)h=p.attributes.position.count;else return null;l.addGroup(c,h,f),c+=h}}if(e){for(var g=0,A=[],f=0;f<n.length;++f){for(var m=n[f].index,E=0;E<m.count;++E)A.push(m.getX(E)+g);g+=n[f].attributes.position.count}l.setIndex(A)}for(var d in s){var v=this.mergeBufferAttributes(s[d]);if(!v)return null;l.setAttribute(d,v)}for(var d in u){var y=u[d][0].length;if(y===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[d]=[];for(var f=0;f<y;++f){for(var b=[],E=0;E<u[d].length;++E)b.push(u[d][E][f]);var T=this.mergeBufferAttributes(b);if(!T)return null;l.morphAttributes[d].push(T)}}return l},mergeBufferAttributes:function(n){for(var t,e,r,o=0,s=0;s<n.length;++s){var u=n[s];if(u.isInterleavedBufferAttribute||(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)||(e===void 0&&(e=u.itemSize),e!==u.itemSize)||(r===void 0&&(r=u.normalized),r!==u.normalized))return null;o+=u.array.length}for(var l=new t(o),c=0,s=0;s<n.length;++s)l.set(n[s].array,c),c+=n[s].array.length;return new THREE__namespace.BufferAttribute(l,e,r)},interleaveAttributes:function(n){for(var t,e=0,r=0,o=0,s=n.length;o<s;++o){var u=n[o];if(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)return console.warn("AttributeBuffers of different types cannot be interleaved"),null;e+=u.array.length,r+=u.itemSize}for(var l=new THREE__namespace.InterleavedBuffer(new t(e),r),c=0,f=[],p=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"],h=0,s=n.length;h<s;h++){var u=n[h],g=u.itemSize,A=u.count,m=new THREE__namespace.InterleavedBufferAttribute(l,g,c,u.normalized);f.push(m),c+=g;for(var E=0;E<A;E++)for(var v=0;v<g;v++)m[d[v]](E,u[p[v]](E))}return f},estimateBytesUsed:function(n){var t=0;for(var e in n.attributes){var r=n.getAttribute(e);t+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}var o=n.getIndex();return t+=o?o.count*o.itemSize*o.array.BYTES_PER_ELEMENT:0,t},mergeVertices:function(n,t){t===void 0&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var e={},r=n.getIndex(),o=n.getAttribute("position"),s=r?r.count:o.count,u=0,l=Object.keys(n.attributes),c={},f={},p=[],d=["getX","getY","getZ","getW"],h=0,g=l.length;h<g;h++){var A=l[h];c[A]=[];var m=n.morphAttributes[A];m&&(f[A]=new Array(m.length).fill().map(function(){return[]}))}for(var E=Math.log10(1/t),v=Math.pow(10,E),h=0;h<s;h++){for(var y=r?r.getX(h):h,b="",T=0,g=l.length;T<g;T++)for(var A=l[T],_=n.getAttribute(A),S=_.itemSize,R=0;R<S;R++)b+="".concat(~~(_[d[R]](y)*v),",");if(b in e)p.push(e[b]);else{for(var T=0,g=l.length;T<g;T++)for(var A=l[T],_=n.getAttribute(A),m=n.morphAttributes[A],S=_.itemSize,w=c[A],M=f[A],R=0;R<S;R++){var O=d[R];if(w.push(_[O](y)),m)for(var C=0,P=m.length;C<P;C++)M[C].push(m[C][O](y))}e[b]=u,p.push(u),u++}}for(var F=n.clone(),h=0,g=l.length;h<g;h++){var A=l[h],L=n.getAttribute(A),H=new L.array.constructor(c[A]),_=new THREE__namespace.BufferAttribute(H,L.itemSize,L.normalized);if(F.setAttribute(A,_),A in f)for(var T=0;T<f[A].length;T++){var N=n.morphAttributes[A][T],H=new N.array.constructor(f[A][T]),D=new THREE__namespace.BufferAttribute(H,N.itemSize,N.normalized);F.morphAttributes[A][T]=D}}return F.setIndex(p),F}},scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4$1=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4;function getEdgesBySphere(n,t,e){e===void 0&&(e=30/180*Math.PI);for(var r=Math.cos(e),o=[],s=0,u=n.children;s<u.length;s++){var l=u[s];l instanceof Tile3D&&l.tileset.selectedTiles.forEach(function(c){var f,p,d,h=(p=(f=c.content)===null||f===void 0?void 0:f.data)===null||p===void 0?void 0:p.object;if(h&&h.visible){var g=[];if(h.traverseVisible(function(z){if(z instanceof THREE__namespace.Mesh){var q=getBvhTreeForMesh(z);if(q){scratchMatrix4$1.copy(z.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4$1),scratchSphere$1.copy(t).applyMatrix4(scratchMatrix4Inverse);var j=q.trianglesInSphere(scratchSphere$1.center,scratchSphere$1.radius),G=new THREE__namespace.BufferGeometry;G.setAttribute("position",new THREE__namespace.BufferAttribute(j,3)),G.applyMatrix4(z.matrixWorld),G=BufferGeometryUtils.mergeVertices(G,.01),g.push(G)}}}),g.length===0)return;for(var A=["a","b","c"],m=BufferGeometryUtils.mergeBufferGeometries(g,!1),E=m.getAttribute("position").array,v=((d=m.getIndex())===null||d===void 0?void 0:d.array)||[],y=[],b=[],T=0,_=E.length;T<_;T+=3){var S=new THREE__namespace.Vector3(E[T],E[T+1],E[T+2]);y.push(S)}for(var T=0,_=v.length;T<_;T+=3){var R=v[T],w=v[T+1],M=v[T+2],O=new THREE__namespace.Vector3().crossVectors(y[w].clone().sub(y[R]),y[M].clone().sub(y[R])).normalize();b.push({a:R,b:w,c:M,normal:O})}for(var C={},T=0,_=b.length;T<_;T++)for(var P=b[T],F=0;F<3;F++){var L=P[A[F]],H=P[A[(F+1)%3]],N=[Math.min(L,H),Math.max(L,H)],D=N[0]+"-"+N[1];C[D]===void 0?C[D]={index1:N[0],index2:N[1],face1:T}:C[D].face2=T}for(var D in C){var Q=C[D];if(Q.face2===void 0||b[Q.face1].normal.dot(b[Q.face2].normal)<=r){var J=y[Q.index1],U=y[Q.index2];o.push(new THREE__namespace.Line3(J,U))}}y.length=0,b.length=0}})}return o}var scratchBoundingBox$1=new THREE__namespace.Box3,scratchViewLayerBox=new THREE__namespace.Box3,scratchObserverBox$3=new THREE__namespace.Box3,Model=(function(n){__extends(t,n);function t(e,r){r===void 0&&(r={});var o,s=n.call(this)||this;s.disposed=!1,s.parameter=new Parameter,s.outdated=!1,s.autoRefine=!0,s.metaPending=!1,s.loaded=!1,s.refined=!1,s.refineProgress=[0,0],s.boundingBox=new THREE__namespace.Box3,s.needsRender=!1,s.work=e,s.name=s.work.workCode;for(var u=0,l=0,c=e.observers;l<c.length;l++){var f=c[l];u=Math.max(u,f.floorIndex)}if(s.floorLength=u+1,e.model){s.metaPending=!0;var p=loadViewLayers(e.model,{fetcher:getFetcher(e),light:(o=r.light)!==null&&o!==void 0?o:!1,textureOptions:r.textureOptions,onError:function(d){return s.dispatchEvent({type:"error",error:d})}});s.initReady=Promise.all(p).then(function(d){if(s.metaPending=!1,d.length)if(s.disposed)for(var h=0,g=d;h<g.length;h++){var A=g[h];A.dispose()}else s.add.apply(s,d)}),s.loadedReady=new Promise(function(d){var h=function(){d(),s.removeEventListener("load",h),s.removeEventListener("dispose",h)};s.addEventListener("load",h),s.addEventListener("dispose",h)})}else s.refined=!0,s.loaded=!0,s.initReady=Promise.resolve(),s.loadedReady=Promise.resolve();return s.parameter.set("boundingBox",s.boundingBox.clone()),s}return t.prototype.dispose=function(){this.disposed=!0;for(var e;e=this.children[0];)typeof e.dispose=="function"&&e.dispose(),this.remove(e);this.dispatchEvent({type:"dispose"})},Object.defineProperty(t.prototype,"empty",{get:function(){return this.children.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayers",{get:function(){return this.children},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,r){return r===void 0&&(r=30/180*Math.PI),getEdgesBySphere(this,e,r)},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=e.sortByDistance;e.sortByDistance=!1;for(var u=0,l=this.children.length;u<l;u++){var c=this.children[u];c.visible&&typeof c.intersectRaycaster=="function"&&c.intersectRaycaster(e,o)}return e.sortByDistance=s,sortIntersects(o,e.sortByDistance,e.firstHitOnly),o},t.prototype.update=function(e,r,o){var s=!1;this.needsRender===!0&&(this.needsRender=!1,s=!0);var u=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,s=!0);for(var l=0,c=this.children;l<c.length;l++){var f=c[l];f.autoRefine=this.autoRefine;var p=f.update(e,r,o,this);p&&(s=!0),f.refined===!1&&(this.refined=!1),f.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=f.refineProgress[0],this.refineProgress[1]+=f.refineProgress[1]}scratchBoundingBox$1.makeEmpty(),scratchObserverBox$3.copy(this.work.observerBox),scratchObserverBox$3.isEmpty()||(scratchObserverBox$3.max.x+=1,scratchObserverBox$3.max.z+=1,scratchObserverBox$3.max.y+=1,scratchObserverBox$3.min.x-=1,scratchObserverBox$3.min.z-=1,scratchBoundingBox$1.union(scratchObserverBox$3));for(var d=0,h=this.viewLayers;d<h.length;d++){var f=h[d];f.boundingBox.isEmpty()||(scratchViewLayerBox.copy(f.boundingBox),scratchBoundingBox$1.union(scratchViewLayerBox))}return scratchBoundingBox$1.applyMatrix4(this.matrix),scratchBoundingBox$1.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox$1),this.parameter.set("boundingBox",scratchBoundingBox$1.clone())),u===!1&&this.loaded===!0&&this.dispatchEvent({type:"load"}),s},t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},Object.defineProperty(t.prototype,"shownFloor",{get:function(){return this.shownFloorIndex===-1?null:this.shownFloorIndex},set:function(e){this.shownFloorIndex=e===null?-1:e},enumerable:!1,configurable:!0}),t.prototype.show=function(e){this.shownFloor=e!=null?e:null,this.dispatchEvent({type:"changeShownFloor",shownFloor:e})},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r)},Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).shownFloorIndex},set:function(e){this.parameter.set("shownFloorIndex",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"brightness",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).brightness},set:function(e){this.parameter.set("brightness",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clippers",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).clippers},set:function(e){this.parameter.set("clippers",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customShaders",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).customShaders},set:function(e){this.parameter.set("customShaders",e)},enumerable:!1,configurable:!0}),t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.viewLayers;e<r.length;e++){var o=r[e];o.resetBrightness()}},t})(THREE__namespace.Object3D),scratchBoundingBox3=new THREE__namespace.Box3,scratchModelBoundingBox3=new THREE__namespace.Box3,ModelScene=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.needsRender=!0,e.autoRefine=!0,e.boundingBox=new THREE__namespace.Box3,e.loaded=!1,e.refined=!1,e.refineProgress=[0,0],e.parameter=new Parameter;var r=e.models=[];e.parameter.set("boundingBox",e.boundingBox.clone());var o=e;return defineProperty(r,"autoUpdate",{get:function(){return o.autoRefine},set:function(s){o.autoRefine=s}}),defineProperty(r,"bounding",{get:function(){return o.boundingBox}}),defineProperty(r,"loaded",{get:function(){return o.loaded}}),defineProperty(r,"refined",{get:function(){return o.refined}}),defineProperty(r,"refineProgress",{get:function(){return o.refineProgress}}),defineProperty(r,"cacheCameras",{get:function(){return o.parameter.resolveValue().cacheCameras},set:function(s){o.parameter.set("cacheCameras",s)}}),defineProperty(r,"intersectRaycaster",{value:function(s){return o.intersectRaycaster(s)}}),defineProperty(r,"setMaterial",{value:function(s){return o.setMaterial(s)}}),defineProperty(r,"getMaterial",{value:function(){return o.getMaterial()}}),defineProperty(r,"resetBrightness",{value:function(){return o.resetBrightness()}}),e}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.prototype.add.apply(this,e),this.models.length=0;for(var o=0,s=this.children;o<s.length;o++){var u=s[o];u instanceof Model&&u.outdated!==!0&&this.models.push(u)}return this.needsRender=!0,this},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.prototype.remove.apply(this,e),this.models.length=0;for(var o=0,s=this.children;o<s.length;o++){var u=s[o];u instanceof Model&&u.outdated!==!0&&this.models.push(u)}scratchBoundingBox3.makeEmpty();for(var l=0,c=this.children;l<c.length;l++){var u=c[l];u instanceof Model&&(scratchModelBoundingBox3.copy(u.boundingBox).applyMatrix4(u.matrix),scratchBoundingBox3.union(scratchModelBoundingBox3))}return this.boundingBox.copy(scratchBoundingBox3),this.needsRender=!0,this},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=this.children.filter(function(p){return p instanceof Model});if(s.length===1)s[0].intersectRaycaster(e,o);else{var u=e.sortByDistance;e.sortByDistance=!1;for(var l=0,c=s;l<c.length;l++){var f=c[l];f.visible&&f.intersectRaycaster(e,o)}e.sortByDistance=u,sortIntersects(o,e.sortByDistance,e.firstHitOnly)}return o},t.prototype.update=function(e,r){var o=!1;scratchBoundingBox3.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.models.length=0;for(var s=0,u=this.children;s<u.length;s++){var l=u[s];if(l instanceof Model)if(l.outdated){l.autoRefine=!1;var c=l.update(e,r,this);c&&(o=!0)}else{this.models.push(l),l.autoRefine=this.autoRefine;var c=l.update(e,r,this);c&&(o=!0),l.loaded===!1&&(this.loaded=!1),l.refined===!1&&(this.refined=!1),this.refineProgress[0]+=l.refineProgress[0],this.refineProgress[1]+=l.refineProgress[1],scratchModelBoundingBox3.copy(l.boundingBox),scratchBoundingBox3.union(scratchModelBoundingBox3)}else if(l.update){var c=l.update(e,r,this);c&&(o=!0)}}return scratchBoundingBox3.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox3),this.parameter.set("boundingBox",scratchBoundingBox3.clone())),this.needsRender=o,o},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){return this.parameter.resolveValue()},t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.models;e<r.length;e++){var o=r[e];o.resetBrightness()}},t})(THREE__namespace.Scene);function workInitialToJson(n){var t,e={};return e.mode=n.mode,e.pano_index=n.panoIndex,e.longitude=n.longitude,e.latitude=n.latitude,e.fov=n.fov,e.distance=n.distance,e.offset=(t=n.offset)===null||t===void 0?void 0:t.toArray(),e}function workModelToJson(n){var t;if(n)return{file_url:n.file,material_base_url:n.textureBase,material_textures:(t=n.textures)===null||t===void 0?void 0:t.slice(),layers:n.layers.map(function(e){return{tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}})}}function workObserverToObserverJson(n){return{index:n.index,floor_index:n.floorIndex,position:n.position.toArray(),standing_position:n.standingPosition.toArray(),quaternion:{x:n.quaternion.x,y:n.quaternion.y,z:n.quaternion.z,w:n.quaternion.w},visible_nodes:n.visibleNodes.slice(),accessible_nodes:n.accessibleNodes.slice()}}function workObserverToPanoramaJson(n){return{index:n.index,active:n.active,loadable:n.loadable,derived_id:n.derivedId,derived_id_str:n.derivedIdStr,size_list:n.images.sizeList.slice(),up:n.images.up,down:n.images.down,right:n.images.right,left:n.images.left,front:n.images.front,back:n.images.back,video:n.video?{matrix:n.video.matrix.toArray(),size:n.video.size.toArray(),source:n.video.source}:void 0}}function workToJson(n){return{_signature:"",allow_hosts:n.allowHosts.slice(),expire_at:n.expire.getTime().toString(),code:n.workCode,name:n.name,base_url:n.baseURL,initial:workInitialToJson(n.initial),model:workModelToJson(n.model),observers:n.observers.map(function(t){return workObserverToObserverJson(t)}),panorama:{count:n.observers.length,list:n.observers.map(function(t){return workObserverToPanoramaJson(t)})}}}function isNumber(n){return typeof n=="number"}function jsonClone(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return n.map(function(o){return typeof o!="object"||o===null?o:jsonClone(o)});var t={};for(var e in n){var r=n[e];t[e]=typeof r!="object"||r===null?r:jsonClone(r)}return t}function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function jsonMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return jsonClone(t);if(r==="array")for(var o=0;o<t.length;o++)n[o]=jsonMerge(n[o],t[o]);else if(r==="dict")for(var s in t)n[s]=jsonMerge(n[s],t[s]);return n}function jsonStableStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":return JSON.stringify(n.toString());case"undefined":return t?void 0:null;case"number":return n;default:return isFinite(n)?n:null}}function jsonStableStrinfiy(n){return jsonStableStrinfiy_(n,!1)}function jsonHash(n){return"hash::".concat(sha256(jsonStableStrinfiy(n)))}function deepFreeze(n){Object.freeze(n);var t=typeof n=="function",e=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(n).forEach(function(r){e.call(n,r)&&(!t||r!=="caller"&&r!=="callee"&&r!=="arguments")&&n[r]!==null&&(typeof n[r]=="object"||typeof n[r]=="function")&&!Object.isFrozen(n[r])&&deepFreeze(n[r])}),n}var URL_REGEXP=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,BUILDIN_ALLOW_HOST=deepFreeze(JSON.parse((function n(){var t=113,e=126,r=0,o="";return arguments[r].split(o).map(function(s){return s.charCodeAt(r)>e?s:String.fromCharCode((s.charCodeAt(r)+t)%e)}).join(o)})("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j"))),domainRegex=/^([^.]+)(\.([^.]+))*$/,currentHostname=typeof location!="undefined"?location.hostname:"localhost";function isIPDomain(n){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(n)}function matchDomain(n,t){if(!domainRegex.test(n)||!domainRegex.test(t))return!1;if(n==="*")return!0;var e=n.split(".").reverse(),r=t.split(".").reverse();if(e.length<=1)return n===t;for(var o=0;o<e.length;o++)if(e[o]!==r[o])return!1;return!0}function hostnameFromURL(n){if(/^blob\:/i.test(n)||/^data\:/i.test(n))return currentHostname;var t=n.match(URL_REGEXP);return t?t[2]:currentHostname}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(n){return new Error("Date(".concat(n.toString(),") expired."))},error_host_not_allowed=function(n){return new Error("Host(".concat(JSON.stringify(n),") is not allowed."))};function ObjectOmit(n,t){for(var e={},r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];t.indexOf(s)===-1&&(e[s]=n[s])}return e}function jsonStableNoneNumberStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableNoneNumberStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableNoneNumberStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableNoneNumberStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableNoneNumberStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(n)?n:null}}function jsonStableNoneNumberStrinfiy(n){return String(jsonStableNoneNumberStrinfiy_(n,!1))}function verify(n){var t,e,r,o={};try{o=typeof n=="string"?JSON.parse(n):n}catch(m){return error_invalid_input()}if(typeof o!="object")return error_invalid_input();var s=currentHostname,u=Date.now(),l=new Date(typeof o.expire_at=="string"&&/^\d+$/.test(o.expire_at)?Number(o.expire_at):o.expire_at),c=Array.isArray(o.allow_hosts)?o.allow_hosts:[];if(s.length===0||isIPDomain(s)||BUILDIN_ALLOW_HOST.filter(function(m){return matchDomain(m,s)}).length>0){var f=String((t=o.certificate)!==null&&t!==void 0?t:"");if(f){var p=new X509;return p.readCertPEM(f),deepFreeze({issuer:p.getSubjectString(),expire:l,allowHosts:c})}return deepFreeze({issuer:"none",expire:l,allowHosts:c})}var d=String((e=o.certificate)!==null&&e!==void 0?e:"");if(!d)return error_invalid_certificate();var h=new X509;h.readCertPEM(d);var g=String((r=o._signature)!==null&&r!==void 0?r:"");if(!g)return error_invalid_signature();var A=jsonStableNoneNumberStrinfiy(ObjectOmit(o,["_signature"]));return verifyMessage(A,g,h)===!1?error_invalid_signature():u<l.getTime()?BUILDIN_ALLOW_HOST.concat(c).filter(function(m){return matchDomain(m,s)}).length===0?error_host_not_allowed(s):deepFreeze({issuer:h.getSubjectString(),expire:l,allowHosts:c}):error_date_expired(l)}function verifyURL(n,t){var e=hostnameFromURL(n);return currentHostname.length!==0&&!isIPDomain(currentHostname)&&BUILDIN_ALLOW_HOST.filter(function(r){return matchDomain(r,currentHostname)}).length===0&&!isIPDomain(e)&&BUILDIN_ALLOW_HOST.concat(t).filter(function(r){return matchDomain(r,e)}).length===0?error_host_not_allowed(e):n}var PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(1,1,1),FACE_ORDER$1=["right","left","up","down","front","back"];function relativeURL(n,t){if(!isAbsoluteURL(n))return n;if(n.indexOf(t)===0)return n.slice(t.length);var e=t.replace(/^https\:/,"http:");if(n.indexOf(e)===0)return n.slice(e.length);var r=t.replace(/^http\:/,"https:");return n.indexOf(r)===0?n.slice(r.length):(console.warn("".concat(n," is not start with base_url(").concat(t,").")),n)}function panoURL(n,t,e){return!isAbsoluteURL(n)&&typeof t=="string"&&t.length>0&&(n=pathJoin(t,String(e),n)),n}function getTileLevel(n){for(var t=10;t>=0;t--){var e=512*Math.pow(2,t);if(e<=n)return t}return null}function sortTile(n){n=n.slice().sort(function(u,l){return u.level-l.level});for(var t=[],e=0,r=n;e<r.length;e++){var o=r[e];if(t.length===0){t.push(o);continue}var s=t[t.length-1];if(o.level>s.level){t.push(o);continue}if(o.size>s.size){t[t.length-1]=o;continue}}return t}function parse(n,t){for(var e,r,o,s,u,l,c,f,p,d,h,g,A,m,E=[],v=null,y=0,b=[].concat(n);y<b.length;y++){var T=b[y];if("getURL"in T)v={allowHosts:T.allowHosts,expire:T.expire,issuer:T.issuer},E.push(workToJson(T));else{var _=typeof T=="string"?JSON.parse(T):jsonClone(T),S=verify(_);if(S instanceof Error)return S;v===null&&(v=S),E.push(_)}}if(v===null)return new Error("Empty");defineProperty(t,"issuer",{configurable:!1,writable:!1,value:v.issuer}),defineProperty(t,"expire",{configurable:!1,writable:!1,value:Object.freeze(v.expire)}),defineProperty(t,"allowHosts",{configurable:!1,writable:!1,value:Object.freeze(v.allowHosts)});var R=E.reduce(function(U,z){return jsonMerge(U,z)});defineProperty(t,"name",{configurable:!1,writable:!1,value:String((e=R.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{writable:!0,value:String(R.resource_code||R.basic_code||R.vr_code||R.code||R.project_id||R.work_code||R.workCode||createUuid())}),defineProperty(t,"baseURL",{writable:!0,value:(function(){var U,z=(U=R.base_url)!==null&&U!==void 0?U:"";return z&&z[z.length-1]!=="/"&&(z+="/"),z})()});var w=void 0;R.model&&(w={},defineProperty(w,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),typeof R.model=="object"&&(defineProperty(w,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(w,"file",{configurable:!1,writable:!1,value:(function(){var U=R.model.file_url;if(U)return relativeURL(U,t.baseURL)})()}),defineProperty(w,"textureBase",{configurable:!1,writable:!1,value:(function(){var U=R.model.material_base_url;return U&&(U=relativeURL(U,t.baseURL)),U})()}),defineProperty(w,"textures",{configurable:!1,writable:!1,value:(function(){var U=void 0;return Array.isArray(R.model.material_textures)&&(U=R.model.material_textures.slice(),Object.freeze(U)),U})()}),defineProperty(w,"layers",{configurable:!1,writable:!1,value:(function(){var U,z,q,j=[];if(Array.isArray(R.model.layers))for(var G=0,X=R.model.layers;G<X.length;G++){var Y=X[G];if(Y&&Y.tileset_url){var Z={};defineProperty(Z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(Z,"name",{configurable:!1,writable:!1,value:(U=Y.name)!==null&&U!==void 0?U:""}),defineProperty(Z,"type",{configurable:!1,writable:!1,value:(z=Y.type)!==null&&z!==void 0?z:"mesh"}),defineProperty(Z,"upAxis",{configurable:!1,writable:!1,value:(q=Y.up_axis)!==null&&q!==void 0?q:"Z"}),defineProperty(Z,"tileset",{configurable:!1,writable:!1,value:relativeURL(Y.tileset_url,t.baseURL)}),j.push(Z)}}if(typeof R.model.tiles=="object"){var Y=R.model.tiles;if(Y&&Y.tileset_url){var Z={};defineProperty(Z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(Z,"name",{configurable:!1,writable:!1,value:"lod"}),defineProperty(Z,"type",{configurable:!1,writable:!1,value:"mesh"}),defineProperty(Z,"upAxis",{configurable:!1,writable:!1,value:"-Y"}),defineProperty(Z,"tileset",{configurable:!1,writable:!1,value:relativeURL(Y.tileset_url,t.baseURL)}),j.push(Z)}}return Object.freeze(j)})()}))),defineProperty(t,"model",{configurable:!1,writable:!1,value:w});var M=[];if(Array.isArray(R.observers)&&R.panorama&&Array.isArray(R.panorama.list||R.panorama.info))for(var O=R.observers,C=(r=R.panorama.list||R.panorama.info)!==null&&r!==void 0?r:[],P=(f=(l=(s=(o=R.panorama)===null||o===void 0?void 0:o.pano_high_cube_base_url)!==null&&s!==void 0?s:(u=R.panorama)===null||u===void 0?void 0:u.pano_cube_base_url)!==null&&l!==void 0?l:(c=R.panorama)===null||c===void 0?void 0:c.base_url)!==null&&f!==void 0?f:"",F=Math.min(O.length,C.length),L=function(U){var z=O[U],q=C[U],j={};defineProperty(j,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(j,"index",{configurable:!1,writable:!1,value:U}),defineProperty(j,"panoIndex",{configurable:!1,writable:!1,value:U}),defineProperty(j,"floorIndex",{configurable:!1,writable:!1,value:(p=z.floor_index)!==null&&p!==void 0?p:z.floor}),defineProperty(j,"derivedId",{configurable:!1,writable:!1,value:z.derived_id}),defineProperty(j,"derivedIdStr",{configurable:!1,writable:!1,value:z.derived_id_str}),defineProperty(j,"active",{configurable:!1,writable:!1,value:z.active!==!1&&q.active!==!1}),defineProperty(j,"loadable",{configurable:!1,writable:!1,value:(h=(d=z.active)!==null&&d!==void 0?d:q.active)!==null&&h!==void 0?h:!1}),defineProperty(j,"position",{configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((g=z.position)!==null&&g!==void 0?g:[0,0,0]))}),defineProperty(j,"standingPosition",{configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((m=(A=z.standing_position)!==null&&A!==void 0?A:z.standingPosition)!==null&&m!==void 0?m:[0,0,0]))}),defineProperty(j,"quaternion",{configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Quaternion().fromArray(z.quaternion?[z.quaternion.x,z.quaternion.y,z.quaternion.z,z.quaternion.w]:[0,0,0,1]))}),defineProperty(j,"matrix",{configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Matrix4().compose(j.position,j.quaternion,PANO_TEXTURE_SCALE))}),defineProperty(j,"accessibleNodes",{configurable:!1,writable:!1,value:(function(){var G,X,Y=((X=(G=z.accessible_nodes)!==null&&G!==void 0?G:z.accessibleNodes)!==null&&X!==void 0?X:[]).filter(function(W){return W<F});if(Y.length===0)for(var Z=0;Z<F;Z++)Z!==U&&Y.push(Z);return Object.freeze(Y)})()}),defineProperty(j,"visibleNodes",{configurable:!1,writable:!1,value:(function(){var G,X,Y=((X=(G=z.visible_nodes)!==null&&G!==void 0?G:z.visibleNodes)!==null&&X!==void 0?X:[]).filter(function(W){return W<F});if(Y.length===0)for(var Z=0;Z<F;Z++)Z!==U&&Y.push(Z);return Object.freeze(Y)})()}),defineProperty(j,"images",{configurable:!1,writable:!1,value:(function(){var G={};defineProperty(G,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var X=0,Y=FACE_ORDER$1;X<Y.length;X++){var Z=Y[X];defineProperty(G,Z,{configurable:!1,writable:!1,value:relativeURL(panoURL(q[Z],P,U),t.baseURL)})}return defineProperty(G,"sizeList",{configurable:!1,writable:!1,value:(function(){var W=getImageSizeFromURL(G[FACE_ORDER$1[0]]);if(W){if(q.size_list){var K=q.size_list.slice().sort(function(se,he){return se-he});return Object.freeze(K)}else if(q.tiles){for(var K=[W],ne=q.tiles.slice().sort(function(he,me){return he-me}),ee=0,te=ne;ee<te.length;ee++){var ae=te[ee],fe=512*Math.pow(2,ae);fe>W&&K.push(fe)}return Object.freeze(K)}}return Object.freeze([])})()}),defineProperty(G,"tiles",{configurable:!1,writable:!1,value:(function(){var W=getImageSizeFromURL(G.front);if(W){var K=G.sizeList.slice();if(K[0]){var ne=getTileLevel(K[0]);if(ne)for(var ee=ne-1;ee>=0;ee--)K.unshift(512*Math.pow(2,ee))}if(!(K.length<=0)){for(var te=[],ae=0,fe=K;ae<fe.length;ae++){var se=fe[ae],he=getTileLevel(se);if(typeof he=="number"){var me={};if(defineProperty(me,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(me,"level",{configurable:!1,writable:!1,value:he}),se>W){defineProperty(me,"size",{configurable:!1,writable:!1,value:se}),defineProperty(me,"scale",{configurable:!1,writable:!1,value:1});for(var be=0,Te=FACE_ORDER$1;be<Te.length;be++){var ce=Te[be];defineProperty(me,ce,{configurable:!1,writable:!1,value:replaceImageSize(G[ce],se)})}}else{defineProperty(me,"size",{configurable:!1,writable:!1,value:W}),defineProperty(me,"scale",{configurable:!1,writable:!1,value:se/W});for(var pe=0,re=FACE_ORDER$1;pe<re.length;pe++){var ce=re[pe];defineProperty(me,ce,{configurable:!1,writable:!1,value:G[ce]})}}te.push(me)}}return te=sortTile(te),Object.freeze(te)}}})()}),G})()}),defineProperty(j,"video",{configurable:!1,writable:!1,value:(function(){var G=void 0;return q.video&&(G={},defineProperty(G,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(G,"source",{configurable:!1,writable:!1,value:q.video.source}),defineProperty(G,"matrix",{configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().fromArray(q.video.matrix)}),defineProperty(G,"size",{configurable:!1,writable:!1,value:new THREE__namespace.Vector2().fromArray(q.video.size)})),G})()}),M.push(j)},H=0;H<F;H++)L(H);defineProperty(t,"observers",{configurable:!1,writable:!1,value:Object.freeze(M)});var N={};if(defineProperty(N,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),R.initial){if(t.observers.length>0){var D=void 0;isNumber(R.initial.panoIndex)?D=R.initial.panoIndex:isNumber(R.initial.pano_index)?D=R.initial.pano_index:isNumber(R.initial.pano)&&(D=R.initial.pano),typeof D=="number"&&(D=clamp$1(D,0,t.observers.length-1),defineProperty(N,"panoIndex",{writable:!0,value:D}))}if(R.initial.mode==="Panorama"&&t.observers.length===0||R.initial.mode==="Floorplan"||R.initial.mode==="Topview"||R.initial.mode==="Model"||R.initial.mode==="Mapview"?defineProperty(N,"mode",{writable:!0,value:R.initial.mode}):typeof N.panoIndex=="number"?defineProperty(N,"mode",{writable:!0,value:"Panorama"}):defineProperty(N,"mode",{writable:!0,value:"Mapview"}),isNumber(R.initial.latitude)&&defineProperty(N,"latitude",{writable:!0,value:R.initial.latitude}),isNumber(R.initial.longitude)?defineProperty(N,"longitude",{writable:!0,value:R.initial.longitude}):isNumber(R.initial.heading)&&defineProperty(N,"longitude",{writable:!0,value:headingToLongitude(R.initial.heading)}),isNumber(R.initial.fov)&&defineProperty(N,"fov",{writable:!0,value:R.initial.fov}),isNumber(R.initial.distance)&&defineProperty(N,"distance",{writable:!0,value:R.initial.distance}),Array.isArray(R.initial.offset)){var Q=R.initial.offset,J=[0,0,0].map(function(U,z){var q=Number(Q[z]);return isNaN(q)||!isFinite(q)?0:q});defineProperty(N,"offset",{writable:!0,value:new THREE__namespace.Vector3().fromArray(J)})}else typeof R.initial.offset=="object"&&typeof R.initial.offset.x=="number"&&typeof R.initial.offset.y=="number"&&typeof R.initial.offset.z=="number"&&defineProperty(N,"offset",{writable:!0,value:new THREE__namespace.Vector3().fromArray([R.initial.offset.x,R.initial.offset.y,R.initial.offset.z])})}return defineProperty(t,"initial",{configurable:!1,writable:!1,value:N}),t}function parseNull(n,t){return defineProperty(t,"issuer",{configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{configurable:!1,writable:!1,value:"Null"}),defineProperty(t,"workCode",{value:createUuid()}),defineProperty(t,"baseURL",{value:"/"}),defineProperty(t,"model",{configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(t,"initial",{configurable:!1,writable:!1,value:(function(){var e={};return defineProperty(e,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(e,"mode",{writable:!0,value:"Mapview"}),e})()}),t}function parsePano(n,t){var e,r;return defineProperty(t,"issuer",{configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{configurable:!1,writable:!1,value:String((e=n.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{writable:!0,value:(r=n.code)!==null&&r!==void 0?r:createUuid()}),defineProperty(t,"baseURL",{writable:!0,value:"/"}),defineProperty(t,"model",{configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"index",{configurable:!1,writable:!1,value:0}),defineProperty(o,"panoIndex",{configurable:!1,writable:!1,value:0}),defineProperty(o,"floorIndex",{configurable:!1,writable:!1,value:0}),defineProperty(o,"derivedId",{configurable:!1,writable:!1,value:void 0}),defineProperty(o,"derivedIdStr",{configurable:!1,writable:!1,value:void 0}),defineProperty(o,"active",{configurable:!1,writable:!1,value:!0}),defineProperty(o,"loadable",{configurable:!1,writable:!1,value:!1}),defineProperty(o,"position",{configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,1.5,0)}),defineProperty(o,"standingPosition",{configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,0,0)}),defineProperty(o,"quaternion",{configurable:!1,writable:!1,value:new THREE__namespace.Quaternion(0,1,0,0)}),defineProperty(o,"matrix",{configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().compose(o.position,o.quaternion,PANO_TEXTURE_SCALE)}),defineProperty(o,"accessibleNodes",{configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(o,"visibleNodes",{configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(o,"images",{configurable:!1,writable:!1,value:(function(){var s={};defineProperty(s,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var u=0,l=FACE_ORDER$1;u<l.length;u++){var c=l[u];defineProperty(s,c,{configurable:!1,writable:!1,value:n[c]})}return defineProperty(s,"sizeList",{configurable:!1,writable:!1,value:Object.freeze([n.size])}),defineProperty(s,"tiles",{configurable:!1,writable:!1,value:(function(){var f=getImageSizeFromURL(s.front);if(f){var p=s.sizeList.slice();if(p[0]){var d=getTileLevel(p[0]);if(d)for(var h=d-1;h>=0;h--)p.unshift(512*Math.pow(2,h))}if(!(p.length<=0)){for(var g=[],A=0,m=p;A<m.length;A++){var E=m[A],v=getTileLevel(E);if(typeof v=="number"){var y={};if(defineProperty(y,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(y,"level",{configurable:!1,writable:!1,value:v}),E>f){defineProperty(y,"size",{configurable:!1,writable:!1,value:E}),defineProperty(y,"scale",{configurable:!1,writable:!1,value:1});for(var b=0,T=FACE_ORDER$1;b<T.length;b++){var _=T[b];defineProperty(y,_,{configurable:!1,writable:!1,value:replaceImageSize(s[_],E)})}}else{defineProperty(y,"size",{configurable:!1,writable:!1,value:f}),defineProperty(y,"scale",{configurable:!1,writable:!1,value:E/f});for(var S=0,R=FACE_ORDER$1;S<R.length;S++){var _=R[S];defineProperty(y,_,{configurable:!1,writable:!1,value:s[_]})}}g.push(y)}}return g=sortTile(g),Object.freeze(g)}}})()}),s})()}),defineProperty(o,"video",{configurable:!1,writable:!1,value:void 0}),Object.freeze([o])})()}),defineProperty(t,"initial",{configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"mode",{writable:!0,value:"Panorama"}),defineProperty(o,"panoIndex",{writable:!0,value:0}),o})()}),t}var workVerifySet=new WeakSet,hrefAElement=typeof document!="undefined"?document.createElement("a"):{href:""},Work=(function(){function n(t,e){this.observerBox=new THREE__namespace.Box3,this.observerBox=new THREE__namespace.Box3,this.transform=new THREE__namespace.Matrix4,this.shortPath=!1,this.jsonp=!1;var r;if(t!==null?typeof t=="object"&&typeof t.size=="number"&&typeof t.up=="string"&&typeof t.down=="string"&&typeof t.right=="string"&&typeof t.left=="string"&&typeof t.front=="string"&&typeof t.back=="string"?r=parsePano(t,this):r=parse(t,this):r=parseNull(t,this),r instanceof Error)throw new Error("[PARSE FAILED]: "+r.message+`
|
|
1026
|
+
`,uniforms:{diffuse:{value:new THREE__namespace.Color},opacity:{value:1},displacementScalar:{value:0}}};function createPipeBufferGeometry(n,t,e,r){for(var o=new Float32Array((e+1)*(r+1)*3),s=new Float32Array((e+1)*(r+1)*3),u=new Float32Array((e+1)*(r+1)*2),l=new Uint32Array(e*r*6),c=n.computeFrenetFrames(e),f=new THREE__namespace.Vector3,p=new THREE__namespace.Vector3,d=new THREE__namespace.Vector2,h=new THREE__namespace.Vector3,g=0;g<=e;g++){h=n.getPointAt(g/e,h);for(var A=c.normals[g],m=c.binormals[g],E=0;E<=r;E++){var v=g*(r+1)+E,y=E/r*Math.PI*2,b=Math.sin(y),T=-Math.cos(y);p.x=T*A.x+b*m.x,p.y=T*A.y+b*m.y,p.z=T*A.z+b*m.z,p.normalize(),p.toArray(s,v*3),f.x=h.x+t*p.x,f.y=h.y+t*p.y,f.z=h.z+t*p.z,f.toArray(o,v*3),d.x=g/e,d.y=E/r,d.toArray(u,v*2)}}for(var g=0;g<e;g++)for(var E=0;E<r;E++){var _=(g*r+E)*6,S=(r+1)*g+E,R=(r+1)*(g+1)+E,w=(r+1)*(g+1)+(E+1),M=(r+1)*g+(E+1);l[_]=S,l[_+1]=R,l[_+2]=M,l[_+3]=R,l[_+4]=w,l[_+5]=M}var O=new THREE__namespace.BufferGeometry;return O.setIndex(new THREE__namespace.BufferAttribute(l,1)),O.setAttribute("position",new THREE__namespace.BufferAttribute(o,3)),O.setAttribute("normal",new THREE__namespace.BufferAttribute(s,3)),O.setAttribute("uv",new THREE__namespace.BufferAttribute(u,2)),O}function parseTrajectoryObject(n,t){for(var e=new THREE__namespace.Color(0).convertSRGBToLinear(),r=new THREE__namespace.Color(52949).convertSRGBToLinear(),o=new THREE__namespace.Color(3370495).convertSRGBToLinear(),s=new THREE__namespace.Color(16777215).convertSRGBToLinear(),u=0,l=new THREE__namespace.CurvePath,c=n.length,f=3;f<c;f+=3){var p=new THREE__namespace.Vector3().fromArray(n,f-3),d=new THREE__namespace.Vector3().fromArray(n,f);u+=p.distanceTo(d);var h=new THREE__namespace.LineCurve3(p,d);l.add(h)}var g=.03,A=Math.ceil(u*100),m=6,E=createPipeBufferGeometry(l,g,A,m);E.clearGroups(),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,0),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,1),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,2);var v=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});v.uniforms.totalLength.value=u,v.uniforms.diffuse.value=e,v.uniforms.diffuse2.value=e,v.uniforms.opacity.value=.5,v.transparent=!0;var y=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});y.uniforms.totalLength.value=u,y.uniforms.displacementScalar.value=-.01,y.uniforms.diffuse.value=r,y.uniforms.diffuse2.value=o;var b=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.DoubleSide});b.uniforms.totalLength.value=u,b.uniforms.displacementScalar.value=-.026,b.uniforms.dashSize.value=new THREE__namespace.Vector2(.06,.09),b.uniforms.diffuse.value=s,b.uniforms.diffuse2.value=s;var T=new THREE__namespace.Mesh(E,[v,y,b]),_=.08,S=24,R=new THREE__namespace.SphereBufferGeometry(_,S,S);R.clearGroups(),R.addGroup(0,E.index?E.index.count:E.attributes.position.count,0),R.addGroup(0,E.index?E.index.count:E.attributes.position.count,1);var w=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.BackSide});w.uniforms.diffuse.value=e,w.uniforms.opacity.value=.5,w.transparent=!0;var M=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});M.uniforms.displacementScalar.value=-.01,M.uniforms.diffuse.value=r;var O=new THREE__namespace.Mesh(R,[w,M]);O.position.fromArray(n,0),T.add(O);var C=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});C.uniforms.displacementScalar.value=-.01,C.uniforms.diffuse.value=o;var P=new THREE__namespace.Mesh(R,[w,C]);return P.position.fromArray(n,n.length-3),T.add(P),{scene:T,dispose:function(){E.dispose(),v.dispose(),y.dispose(),b.dispose(),R.dispose(),w.dispose(),M.dispose(),C.dispose()}}}function loadTrajectory(n,t){var e=n.name,r=appendSearch(n.content.uri,t.search),o=imageURL(r,{key:"model.0"});return n.content.loadState="LOADING",n.content.loadStateUpdateTime=now(),loadPly(o,{type:"geometry",customPropertyMapping:{time:{itemType:"uint32",itemNames:["time_milisec"]}},fetcher:t.fetcher}).then(function(s){var u,l,c,f,p=(l=(u=s.scene.attributes)===null||u===void 0?void 0:u.time.array)!==null&&l!==void 0?l:[],d=(f=(c=s.scene.attributes)===null||c===void 0?void 0:c.position.array)!==null&&f!==void 0?f:[],h=s.byteLength,g=s.memoryUsage,A=parseTrajectoryObject(d);A.scene.applyMatrix4(n.transform),A.scene.updateWorldMatrix(!1,!0),A.scene.matrixAutoUpdate=!1;var m=new TrajectoryNode(e,A.scene);return n.content.data={uri:o,byteLength:h,memoryUsage:g,positionArray:d,timeArray:p,object:m},n.content.byteLength=h,n.content.memoryUsage=g,n.content.loadState="READY",n.content.loadStateUpdateTime=now(),n}).catch(function(s){return n.content.data=void 0,n.content.loadState="FAILED",n.content.loadStateUpdateTime=now(),s instanceof NetworkResponseError&&s.httpStatus===0||s instanceof NetworkTimeoutError||s instanceof NetworkProxyError?n.content.loadfailRetryDelay=clamp$1(n.content.loadfailRetryDelay+RETRY_DELAY_STEP,RETRY_DELAY_STEP,MAX_RETRY_DELAY):n.content.loadfailRetryDelay=1/0,Promise.reject(s)})}function unloadTrajectory(n){n.content&&(n.content.data&&n.content.data.object.dispose(),n.content.data=void 0,n.content.loadState="UNLOADED",n.content.loadStateUpdateTime=now(),n.content.byteLength=0,n.content.memoryUsage=0)}var scratchVector3$7=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$3=new THREE__namespace.Matrix4,a=6378137,invF=298.257223563;function ecefToLla(n){for(var t=a-a/invF,e=(a*a-t*t)/(a*a),r=Math.sqrt(n.x*n.x+n.y*n.y),o=1e-12,s=1e3,u=0,l=Math.atan2(n.z,r),c=0;u++<s;){var f=Math.sin(l),p=a/Math.sqrt(1-e*f*f);c=r/Math.cos(l)-p;var d=Math.atan2(n.z/(p*(1-e)+c),r/(p+c));if(isNaN(d))break;var h=Math.abs(d-l);if(h<o)break;l=d}return n.set(l,Math.atan2(n.y,n.x),c)}function llaToEcef(n){var t=n.x,e=n.y,r=n.z,o=a-a/invF,s=(a*a-o*o)/(a*a),u=Math.sin(t),l=Math.cos(t),c=Math.sin(e),f=Math.cos(e),p=a/Math.sqrt(1-s*u*u),d=(p+r)*l*f,h=(p+r)*l*c,g=(o*o/(a*a)*p+r)*u;return n.set(d,h,g)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$7.copy(n)),r=e.x,o=e.y,s=e.z,u=Math.sin(r),l=Math.sin(o),c=Math.cos(r),f=Math.cos(o);t.fromArray([-l,-u*f,c*f,0,+f,-u*l,c*l,0,0,c,u,0,0,0,0,1]);var p=scratchMatrix3.setFromMatrix4(t),d=scratchVector3$7.copy(n).applyMatrix3(p).multiplyScalar(-1);t.setPosition(d);var h=scratchMatrix4$3.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,s,1]);return t.premultiply(h),t}var ROTATE_X_90_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),ROTATE_X_90_MATRIX_INVERSE=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),enuToLocalMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),localToEnuMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE);function getRecommendTile3dProps(n,t){var e,r,o;t===void 0&&(t={});var s,u,l,c=typeof n.tileset.rootMeta.creationTime=="string";if(c){var f=typeof n.tileset.rootMeta.numTotalPoints=="number"&&n.tileset.rootMeta.numTotalPoints>0;if(f){l=4,t.powerPreference==="high"&&(l=2),s=l/1.6;var p=0;if(((e=n.tileset.rootMeta.taskParameters)===null||e===void 0?void 0:e.point_homogenization)==="1"&&(!((r=n.tileset.rootMeta.taskParameters)===null||r===void 0)&&r.homo_point_density)){var d=Number((o=n.tileset.rootMeta.taskParameters)===null||o===void 0?void 0:o.homo_point_density);isFinite(d)&&!isNaN(d)&&(p=d)}p<=0&&(p=.02),u=p*1.4}else l=5,t.powerPreference==="high"&&(l=4),s=0,u=.03}else l=6,s=0,u=.03,n.name==="aerophoto"?(l=12,t.powerPreference==="high"&&(l=10)):n.tileset.asset.extras&&typeof n.tileset.asset.extras.name=="string"&&/^matterport\b/i.test(n.tileset.asset.extras.name)&&(l=5,t.powerPreference==="high"&&(l=4));return{pointScale:u,pointMinPixel:s,maxScreenSpaceError:l}}var scratchVector3$6=new THREE__namespace.Vector3,scratchSphereBoundingVolume=new SphereBoundingVolume,scratchBoxBoundingVolume=new BoxBoundingVolume,parameterVersionMap=new WeakMap,tileVersionMap=new WeakMap,trajectoryVersionMap=new WeakMap,STENCIL_CONSTANT={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4},SKIP_BACKFACE_MATERIAL=(function(){var n=new THREE__namespace.MeshBasicMaterial;return n.side=THREE__namespace.BackSide,n.color.setHex(16711935),n.colorWrite=!1,n.stencilWrite=!0,n.polygonOffset=!0,n.polygonOffsetFactor=2,n.polygonOffsetUnits=2,n.stencilRef=STENCIL_CONSTANT.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=STENCIL_CONSTANT.TILE_MASK,n})(),SKIP_BACKFACE_TRANSPARENT_MATERIAL=(function(){var n=new THREE__namespace.MeshBasicMaterial;return n.visible=!1,n})(),CLEAR_STENCIL_GEOMETRY=new THREE__namespace.BufferGeometry,CLEAR_STENCIL_MATERIAL=new THREE__namespace.MeshBasicMaterial;function cloneSkipBackfaceObject(n){var t;n instanceof THREE__namespace.Mesh?t=new THREE__namespace.Mesh(n.geometry,Array.isArray(n.material)?n.material.map(function(s){return s.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):n.material&&n.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):n instanceof THREE__namespace.Group?t=new THREE__namespace.Group:t=new THREE__namespace.Object3D,t.position.copy(n.position),t.quaternion.copy(n.quaternion),t.scale.copy(n.scale),t.matrix.compose(n.position,n.quaternion,n.scale),t.matrixAutoUpdate=!1,t.frustumCulled=n.frustumCulled,t.visible=n.visible;for(var e=0,r=n.children;e<r.length;e++){var o=r[e];t.add(cloneSkipBackfaceObject(o))}return t}var Tile3D=(function(n){__extends(t,n);function t(e,r){var o,s,u=n.call(this)||this;return u.parameter=new Parameter,u.renderObjects=[],u.backfaceObjects=[],u.tileObjects=[],u.frameNumber=0,u.error=(o=r.error)!==null&&o!==void 0?o:null,u.name=r.name,u.type=r.type,u.upAxis=r.upAxis,u.light=r.light,u.fetcher=r.fetcher,u.search=(s=r.search)!==null&&s!==void 0?s:"",u.groundHeight=r.groundHeight,u.enuToEcefMatrix=new THREE__namespace.Matrix4().copy(r.enuToEcefMatrix),u.ecefToEnuMatrix=new THREE__namespace.Matrix4().copy(r.ecefToEnuMatrix),u.boundingBox=new THREE__namespace.Box3,u.autoRefine=!0,u.refined=!1,u.refineProgress=[0,0],u.loaded=!1,u.disposed=!1,u.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),u.clearStencilObject.frustumCulled=!1,u.clearStencilObject.onAfterRender=function(l){return l.clearStencil()},u.tileset=new Tileset(e,{tileLoader:function(l){return u.loadContent(l)},tileUnloader:function(l){return u.unloadContent(l)},onTileLoad:function(){},onTileUnload:function(l){},onTileError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Tile error",l.id,c)},trajectoryLoader:function(l){return u.loadTrajectory(l)},trajectoryUnloader:function(l){return u.unloadTrajectory(l)},onTrajectoryLoad:function(){},onTrajectoryUnload:function(l){},onTrajectoryError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Trajectory error",l,c)}}),u.tileset.root.boundingVolume&&u.tileset.root.boundingVolume.getBoundingBox(u.boundingBox),u}return Object.defineProperty(t.prototype,"viewerRequestVolume",{get:function(){return this.tileset.root.viewerRequestVolume},set:function(e){this.tileset.root.viewerRequestVolume=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tiles",{get:function(){return this.tileset.selectedTiles},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trajectories",{get:function(){return this.tileset.trajectories},enumerable:!1,configurable:!0}),t.prototype.getRecommendProps=function(e){return e===void 0&&(e={}),getRecommendTile3dProps(this,e)},t.prototype.loadContent=function(e){var r=this;return loadTileContent(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){e.type==="SCENEGRAPH"&&(r.disposed||!e.content?unloadTileContent(e):e.content.data&&r.boundingBox.expandByObject(e.content.data.object))})},t.prototype.unloadContent=function(e){return unloadTileContent(e),Promise.resolve()},t.prototype.loadAllTilesets=function(){var e=this,r=function(o){var s=[];return e.tileset.root.traverse(function(u){var l;u.type==="TILESET"&&((l=u.content)===null||l===void 0?void 0:l.loadState)!=="READY"&&s.push(u)}),Promise.all(s.map(function(u){return e.loadContent(u).then(function(){return r()})})).then(function(){})};return r(this.tileset.root)},t.prototype.loadTrajectory=function(e){var r=this;return loadTrajectory(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){r.disposed&&unloadTrajectory(o)})},t.prototype.unloadTrajectory=function(e){return unloadTrajectory(e),Promise.resolve()},t.prototype.intersectRaycaster=function(e,r){for(var o,s,u,l=r!=null?r:[],c=[this.tileset.root],f=this.tileset.transform,p,d=e.sortByDistance,h=(s=(o=e.params.Points)===null||o===void 0?void 0:o.threshold)!==null&&s!==void 0?s:0,g=1/0;p=c.pop();){var A=void 0;if(p.boundingVolume){var m=void 0;p.boundingVolume instanceof BoxBoundingVolume?m=scratchBoxBoundingVolume.copy(p.boundingVolume):p.boundingVolume instanceof SphereBoundingVolume?m=scratchSphereBoundingVolume.copy(p.boundingVolume):m=p.boundingVolume.clone(),m.applyMatrix4(f),A=m.intersectRay(e.ray,h,g)}else A=!0;if(A){for(var E=0,v=p.children.length;E<v;E++)c.push(p.children[E]);if(p.selected&&p.content&&p.content.data&&p.content.data.object.visible&&(p.content.data.object.intersectRaycaster(e,l),e.firstHitOnly)){var y=l[0];y&&g>y.distance&&(g=y.distance)}}}e.sortByDistance=d,sortIntersects(l,e.sortByDistance,e.firstHitOnly);for(var b=0,T=l;b<T.length;b++){var y=T[b];y.model=(u=this.parent)!==null&&u!==void 0?u:void 0,y.viewLayer=this}return l},t.prototype.update=function(e,r,o,s){var u,l,c=this,f,p,d,h,g;this.renderer=e,this.frameNumber++;var A=!1,m=this.parameter.resolveValue(o.parameter,s.parameter);parameterVersionMap.get(this)!==m.version&&(parameterVersionMap.set(this,m.version),A=!0);var E=m.maxLevelOfDetail;E=Math.max(E,0);var v=Math.min(m.minLevelOfDetail,E);(!this.visible||!this.loaded||!o.loaded)&&(E=Math.max(v,0));var y=m.minGeometricError,b=r.controllerMode;(b==="Panorama"||b==="VRPanorama"||b==="XRPanorama")&&m.modelAlpha<.1&&(y=m.panoramaMinGeometricError);var T=m.maxGeometricError;T=Math.max(y,T);var _={time:r.time,camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(r.up).applyQuaternion(r.quaternion),projectionMatrix:r.projectionMatrix.clone(),visible:r.visible,refine:r.refineModel},height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r),minLevelOfDetail:v,maxLevelOfDetail:E,minGeometricError:y,maxGeometricError:T,skipLevelOfDetail:m.skipLevelOfDetail,mostDetail:m.mostDetail,loadSiblings:m.loadSiblings,cameraCulling:m.cameraCulling,maxMemoryUsage:m.maxMemoryUsage,maxRequests:m.maxRequests,requestOrder:m.requestOrder,maxScreenSpaceError:m.maxScreenSpaceError,memoryAdjustedOverflow:m.memoryAdjustedOverflow,memoryAdjustedScreenSpaceError:m.memoryAdjustedScreenSpaceError},S=m.cacheCameras.map(function(re){return re.updateProjectionMatrix(),__assign(__assign({},_),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(re.position),direction:re.getWorldDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(re.up),projectionMatrix:re.projectionMatrix.clone(),visible:re.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(re)})});this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),A=!0);var R=!this.autoRefine;if(R===!1){var w=m.progress>.01&&m.progress<.99;if(w){var M=new THREE__namespace.Vector3;m.pano0&&M.setFromMatrixPosition(m.pano0.matrix);var O=M.clone();m.pano1&&O.setFromMatrixPosition(m.pano1.matrix),M.distanceTo(O)<10&&(R=!0)}}if(R||this.tileset.update(_,S),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(re){if(c.refineProgress[1]++,re.content){var ue=re.content.loadState;if(ue==="UNLOADED"||ue==="LOADING"){c.refined=!1;return}}c.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;var C=!1;this.tileset.needsRefinedTiles.forEach(function(re){if(c.loaded!==!1&&re.content){if(re.state.visible&&(C=!0),_.skipLevelOfDetail){if(re.state.finalResolution){var ue=re.state.ancestorWithContentAvailable,ve=ue&&ue.content?ue.content:re.content,ge=ve.loadState;(ge==="UNLOADED"||ge==="LOADING")&&(c.loaded=!1)}}else if(re.state.visible&&re.levelOfContent<=0){var ge=re.content.loadState;(ge==="UNLOADED"||ge==="LOADING")&&(c.loaded=!1)}}}),C&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0,this.remove.apply(this,this.children),_.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(re,ue){return re.floor!==ue.floor?re.floor-ue.floor:re.levelOfContent!==ue.levelOfContent?ue.levelOfContent-re.levelOfContent:re.state.distanceToCamera!==ue.state.distanceToCamera?re.state.distanceToCamera-ue.state.distanceToCamera:re.state.centerZDepth-ue.state.centerZDepth});for(var P=[],F=0,L=this.tileset.selectedTiles;F<L.length;F++){var H=L[F],N=(p=(f=H.content)===null||f===void 0?void 0:f.data)===null||p===void 0?void 0:p.object;if(N){var D=N.update(e,r,o,this,H,m);if(P.push(H.id),D&&(A=!0),this.tileset.hasMixedContent&&_.skipLevelOfDetail){if(!H.state.finalResolution){var Q=cloneSkipBackfaceObject(N);Q.name="skipBackface:"+N.name,this.backfaceObjects.push(Q)}for(var J=H.state.selectionDepth,U=STENCIL_CONSTANT.TILE_MASK|J<<STENCIL_CONSTANT.SKIP_LOD_BIT_SHIFT,z=THREE__namespace.GreaterEqualStencilFunc,q=STENCIL_CONSTANT.SKIP_LOD_MASK,j=THREE__namespace.ReplaceStencilOp,G=STENCIL_CONSTANT.TILE_MASK|STENCIL_CONSTANT.SKIP_LOD_MASK,X=0,Y=N.materials;X<Y.length;X++){var Z=Y[X];Z.stencilWrite=!0,Z.stencilRef=U,Z.stencilFunc=z,Z.stencilFuncMask=q,Z.stencilZPass=j,Z.stencilWriteMask=G}}else for(var W=0,K=N.materials;W<K.length;W++){var Z=K[W];Z.stencilWrite=!1,Z.stencilRef=STENCIL_CONSTANT.TILE_MASK,Z.stencilFunc=THREE__namespace.AlwaysStencilFunc,Z.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,Z.stencilZPass=THREE__namespace.ReplaceStencilOp,Z.stencilWriteMask=STENCIL_CONSTANT.TILE_MASK}this.tileObjects.push(N)}}var ne=P.toString();tileVersionMap.get(this)!==ne&&(tileVersionMap.set(this,ne),A=!0),_.skipLevelOfDetail&&this.backfaceObjects.length&&(u=this.renderObjects).push.apply(u,this.backfaceObjects),this.tileObjects.length&&(l=this.renderObjects).push.apply(l,this.tileObjects),_.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var ee=[],te=0,ae=this.tileset.selectedTrajectories;te<ae.length;te++){var fe=ae[te],se=(d=fe.content.data)===null||d===void 0?void 0:d.object;if(se){var D=se.update(e,r,o,this,fe,m);ee.push(fe.id),D&&(A=!0),this.renderObjects.push(se)}}var he=ee.toString();trajectoryVersionMap.get(this)!==he&&(trajectoryVersionMap.set(this,he),A=!0);for(var me=Math.min(0,((g=(h=this.parent)===null||h===void 0?void 0:h.children)!==null&&g!==void 0?g:[]).indexOf(this)),be=me*1e4,Te=function(re){var ue=ce.renderObjects[re],ve=re+be;ue.traverse(function(ge){(ge instanceof THREE__namespace.Mesh||ge instanceof THREE__namespace.Line||ge instanceof THREE__namespace.Points)&&(ge.renderOrder=ve)}),ce.add(ue)},ce=this,pe=0;pe<this.renderObjects.length;pe++)Te(pe);return A},t.prototype.dispose=function(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id),this.remove.apply(this,this.children),this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0,this.error=null,this.onError=void 0,this.renderer=void 0},Object.defineProperty(t.prototype,"model",{get:function(){return this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scene",{get:function(){return this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayer",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.enuToEcef=function(e){return e.applyMatrix4(this.enuToEcefMatrix)},t.prototype.ecefToEnu=function(e){return e.applyMatrix4(this.ecefToEnuMatrix)},t.prototype.localToEcef=function(e){return this.enuToEcef(this.localToEnu(e))},t.prototype.ecefToLocal=function(e){return this.enuToLocal(this.ecefToEnu(e))},t.prototype.localToLla=function(e){return ecefToLla(this.enuToEcef(this.localToEnu(e)))},t.prototype.llaToLocal=function(e){return this.enuToLocal(this.ecefToEnu(llaToEcef(e)))},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},t.prototype.worldToEcef=function(e){return this.localToEcef(this.worldToLocal(e))},t.prototype.ecefToWorld=function(e){return this.localToWorld(this.ecefToLocal(e))},t.prototype.worldToLla=function(e){return this.localToLla(this.worldToLocal(e))},t.prototype.llaToWorld=function(e){return this.localToWorld(this.llaToLocal(e))},Object.defineProperty(t.prototype,"coordinates",{get:function(){scratchVector3$6.setScalar(0);var e=this.localToLla(scratchVector3$6),r=e.x,o=e.y;return[r,o].map(function(s){return(s/Math.PI*180).toFixed(6)}).join(",")},enumerable:!1,configurable:!0}),t.prototype.getTransformMatrix4=function(e){return e===void 0&&(e=new THREE__namespace.Matrix4),e.copy(this.ecefToEnuMatrix),e.premultiply(enuToLocalMatrix),e.premultiply(this.matrixWorld),e},t.prototype.coordinatesToWorldPoint=function(e){var r=new THREE__namespace.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(r)},t.prototype.worldPointToCoordinates=function(e){return scratchVector3$6.copy(e),this.worldToLla(scratchVector3$6),{latitude:scratchVector3$6.x,longitude:scratchVector3$6.y,altitude:scratchVector3$6.z}},t.prototype.resetBrightness=function(){this.parameter.reset("brightness")},Object.defineProperty(t.prototype,"minLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minLevelOfDetail},set:function(e){this.parameter.set("minLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxLevelOfDetail},set:function(e){this.parameter.set("maxLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minGeometricError},set:function(e){this.parameter.set("minGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxGeometricError},set:function(e){this.parameter.set("maxGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoramaMinGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).panoramaMinGeometricError},set:function(e){this.parameter.set("panoramaMinGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).skipLevelOfDetail},set:function(e){this.parameter.set("skipLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mostDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).mostDetail},set:function(e){this.parameter.set("mostDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).loadSiblings},set:function(e){this.parameter.set("loadSiblings",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxMemoryUsage},set:function(e){this.parameter.set("maxMemoryUsage",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxRequests},set:function(e){this.parameter.set("maxRequests",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestOrder",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).requestOrder},set:function(e){this.parameter.set("requestOrder",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxScreenSpaceError},set:function(e){this.parameter.set("maxScreenSpaceError",e)},enumerable:!1,configurable:!0}),t})(THREE__namespace.Object3D),fetcherMap=new WeakMap;function getFetcher(n){var t=fetcherMap.get(n);if(t)return t;throw new Error("fetcher never registered.")}function registerFetcher(n,t){return fetcherMap.set(n,t)}var scratchVector3$5=new THREE__namespace.Vector3,scratchMatrix4$2=new THREE__namespace.Matrix4;function getEcefToEnuMatrixFromUpAxis(n,t,e){switch(n){case"Z":e.identity();break;case"Y":e.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);break;case"-Y":e.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]);break;case"WGS84":case"GCJ02":case"BD09":getEcefToEnuMatrix(t,e);break;default:e.identity();break}return e}function getExt(n){var t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(n);if(t){var e=String(t[1]).trim().split(".").slice(1).reverse()[0];if(e)return e}return""}function loadViewLayer(n,t){var e,r=n.tileset,o=n.name,s=n.type,u=n.work.getURL(r),l=u.split("#"),c=l[0],f=l[1],p=(e=(f||c).split("?")[1])!==null&&e!==void 0?e:"";return t.fetcher.ajax(u,{responseType:"text"}).catch(function(d){return{error:d,body:JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{geometricError:0}})}}).then(function(d){var h,g="error"in d?d.error:null,A=normalizeTilesetHeader(JSON.parse(d.body),u),m=A.root,E=A.rootMeta,v=E===void 0?{}:E,y=n.upAxis;v.upAxis&&v.upAxis!==y&&(y=v.upAxis),"lodVersion"in A&&(y="-Y","floorInfo"in A&&(A.properties=A.properties||{},A.properties.floorInfo=A.floorInfo.map(function(w){return{ground:-w.ground,height:w.height}}),delete A.floorInfo),A.asset.tilesetVersion=String(A.lodVersion),delete A.lodVersion);var b=m.boundingVolume?makeBoundingVolume(m.boundingVolume):void 0;b&&m.transform&&b.applyMatrix4(scratchMatrix4$2.fromArray(m.transform));var T=null,_=new THREE__namespace.Matrix4,S=new THREE__namespace.Matrix4;v.coordinate?(T=v.coordinate.ground_height,_.fromArray(v.coordinate.pose_ecef_to_enu),S.fromArray(v.coordinate.pose_enu_to_ecef)):(b?b.getCenter(scratchVector3$5):scratchVector3$5.setScalar(0),getEcefToEnuMatrixFromUpAxis(y,scratchVector3$5,_),S.getInverse(_)),A.root={refine:(h=m.refine)!==null&&h!==void 0?h:"REPLACE",geometricError:m.geometricError,transform:scratchMatrix4$2.copy(_).premultiply(enuToLocalMatrix).toArray(),boundingVolume:b?b.toJson():void 0,children:[m]};var R=new Tile3D(A,{name:o,type:s,upAxis:y,light:t.light,fetcher:t.fetcher,search:p,groundHeight:T,enuToEcefMatrix:S,ecefToEnuMatrix:_,error:g});return R})}function loadViewLayers(n,t){var e,r,o=n.layers.slice();if(n.file){for(var s=!1,u=0,l=o;u<l.length;u++){var c=l[u];if(c.type==="mesh"){s=!0;break}}if(s===!1){var f=getExt(n.file)||"at3d",p=JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{refine:"REPLACE",geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:n.work.getURL(n.file)},extras:(e={},e[f]={textureBaseUri:typeof n.textureBase=="string"?n.work.getURL(n.textureBase):void 0,textureArray:n.textures,textureOptions:(r=t.textureOptions)!==null&&r!==void 0?r:{}},e)}});o.push({work:n.work,name:"fallback",type:"mesh",upAxis:"Z",tileset:URL.createObjectURL(new Blob([p],{type:"application/json"}))})}}return o.map(function(d){return loadViewLayer(d,{fetcher:t.fetcher,light:t.light}).then(function(h){return t.onError&&(h.error&&t.onError(h.error),h.onError=t.onError),h})})}var BufferGeometryUtils={computeTangents:function(n){var t=n.index,e=n.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");return}var r=t.array,o=e.position.array,s=e.normal.array,u=e.uv.array,l=o.length/3;e.tangent===void 0&&n.setAttribute("tangent",new THREE__namespace.BufferAttribute(new Float32Array(4*l),4));for(var c=e.tangent.array,f=[],p=[],d=0;d<l;d++)f[d]=new THREE__namespace.Vector3,p[d]=new THREE__namespace.Vector3;var h=new THREE__namespace.Vector3,g=new THREE__namespace.Vector3,A=new THREE__namespace.Vector3,m=new THREE__namespace.Vector2,E=new THREE__namespace.Vector2,v=new THREE__namespace.Vector2,y=new THREE__namespace.Vector3,b=new THREE__namespace.Vector3;function T(U,z,q){h.fromArray(o,U*3),g.fromArray(o,z*3),A.fromArray(o,q*3),m.fromArray(u,U*2),E.fromArray(u,z*2),v.fromArray(u,q*2);var j=g.x-h.x,G=A.x-h.x,X=g.y-h.y,Y=A.y-h.y,Z=g.z-h.z,W=A.z-h.z,K=E.x-m.x,ne=v.x-m.x,ee=E.y-m.y,te=v.y-m.y,ae=1/(K*te-ne*ee);y.set((te*j-ee*G)*ae,(te*X-ee*Y)*ae,(te*Z-ee*W)*ae),b.set((K*G-ne*j)*ae,(K*Y-ne*X)*ae,(K*W-ne*Z)*ae),f[U].add(y),f[z].add(y),f[q].add(y),p[U].add(b),p[z].add(b),p[q].add(b)}var _=n.groups;_.length===0&&(_=[{start:0,count:r.length}]);for(var d=0,S=_.length;d<S;++d)for(var R=_[d],w=R.start,M=R.count,O=w,C=w+M;O<C;O+=3)T(r[O+0],r[O+1],r[O+2]);var P=new THREE__namespace.Vector3,F=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3,H=new THREE__namespace.Vector3,N,D,Q;function J(U){L.fromArray(s,U*3),H.copy(L),D=f[U],P.copy(D),P.sub(L.multiplyScalar(L.dot(D))).normalize(),F.crossVectors(H,D),Q=F.dot(p[U]),N=Q<0?-1:1,c[U*4]=P.x,c[U*4+1]=P.y,c[U*4+2]=P.z,c[U*4+3]=N}for(var d=0,S=_.length;d<S;++d)for(var R=_[d],w=R.start,M=R.count,O=w,C=w+M;O<C;O+=3)J(r[O+0]),J(r[O+1]),J(r[O+2])},mergeBufferGeometries:function(n,t){for(var e=n[0].index!==null,r=new Set(Object.keys(n[0].attributes)),o=new Set(Object.keys(n[0].morphAttributes)),s={},u={},l=new THREE__namespace.BufferGeometry,c=0,f=0;f<n.length;++f){var p=n[f];if(e!==(p.index!==null))return null;for(var d in p.attributes){if(!r.has(d))return null;s[d]===void 0&&(s[d]=[]),s[d].push(p.attributes[d])}for(var d in p.morphAttributes){if(!o.has(d))return null;u[d]===void 0&&(u[d]=[]),u[d].push(p.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(p.userData),t){var h;if(e)h=p.index.count;else if(p.attributes.position!==void 0)h=p.attributes.position.count;else return null;l.addGroup(c,h,f),c+=h}}if(e){for(var g=0,A=[],f=0;f<n.length;++f){for(var m=n[f].index,E=0;E<m.count;++E)A.push(m.getX(E)+g);g+=n[f].attributes.position.count}l.setIndex(A)}for(var d in s){var v=this.mergeBufferAttributes(s[d]);if(!v)return null;l.setAttribute(d,v)}for(var d in u){var y=u[d][0].length;if(y===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[d]=[];for(var f=0;f<y;++f){for(var b=[],E=0;E<u[d].length;++E)b.push(u[d][E][f]);var T=this.mergeBufferAttributes(b);if(!T)return null;l.morphAttributes[d].push(T)}}return l},mergeBufferAttributes:function(n){for(var t,e,r,o=0,s=0;s<n.length;++s){var u=n[s];if(u.isInterleavedBufferAttribute||(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)||(e===void 0&&(e=u.itemSize),e!==u.itemSize)||(r===void 0&&(r=u.normalized),r!==u.normalized))return null;o+=u.array.length}for(var l=new t(o),c=0,s=0;s<n.length;++s)l.set(n[s].array,c),c+=n[s].array.length;return new THREE__namespace.BufferAttribute(l,e,r)},interleaveAttributes:function(n){for(var t,e=0,r=0,o=0,s=n.length;o<s;++o){var u=n[o];if(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)return console.warn("AttributeBuffers of different types cannot be interleaved"),null;e+=u.array.length,r+=u.itemSize}for(var l=new THREE__namespace.InterleavedBuffer(new t(e),r),c=0,f=[],p=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"],h=0,s=n.length;h<s;h++){var u=n[h],g=u.itemSize,A=u.count,m=new THREE__namespace.InterleavedBufferAttribute(l,g,c,u.normalized);f.push(m),c+=g;for(var E=0;E<A;E++)for(var v=0;v<g;v++)m[d[v]](E,u[p[v]](E))}return f},estimateBytesUsed:function(n){var t=0;for(var e in n.attributes){var r=n.getAttribute(e);t+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}var o=n.getIndex();return t+=o?o.count*o.itemSize*o.array.BYTES_PER_ELEMENT:0,t},mergeVertices:function(n,t){t===void 0&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var e={},r=n.getIndex(),o=n.getAttribute("position"),s=r?r.count:o.count,u=0,l=Object.keys(n.attributes),c={},f={},p=[],d=["getX","getY","getZ","getW"],h=0,g=l.length;h<g;h++){var A=l[h];c[A]=[];var m=n.morphAttributes[A];m&&(f[A]=new Array(m.length).fill().map(function(){return[]}))}for(var E=Math.log10(1/t),v=Math.pow(10,E),h=0;h<s;h++){for(var y=r?r.getX(h):h,b="",T=0,g=l.length;T<g;T++)for(var A=l[T],_=n.getAttribute(A),S=_.itemSize,R=0;R<S;R++)b+="".concat(~~(_[d[R]](y)*v),",");if(b in e)p.push(e[b]);else{for(var T=0,g=l.length;T<g;T++)for(var A=l[T],_=n.getAttribute(A),m=n.morphAttributes[A],S=_.itemSize,w=c[A],M=f[A],R=0;R<S;R++){var O=d[R];if(w.push(_[O](y)),m)for(var C=0,P=m.length;C<P;C++)M[C].push(m[C][O](y))}e[b]=u,p.push(u),u++}}for(var F=n.clone(),h=0,g=l.length;h<g;h++){var A=l[h],L=n.getAttribute(A),H=new L.array.constructor(c[A]),_=new THREE__namespace.BufferAttribute(H,L.itemSize,L.normalized);if(F.setAttribute(A,_),A in f)for(var T=0;T<f[A].length;T++){var N=n.morphAttributes[A][T],H=new N.array.constructor(f[A][T]),D=new THREE__namespace.BufferAttribute(H,N.itemSize,N.normalized);F.morphAttributes[A][T]=D}}return F.setIndex(p),F}},scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4$1=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4;function getEdgesBySphere(n,t,e){e===void 0&&(e=30/180*Math.PI);for(var r=Math.cos(e),o=[],s=0,u=n.children;s<u.length;s++){var l=u[s];l instanceof Tile3D&&l.tileset.selectedTiles.forEach(function(c){var f,p,d,h=(p=(f=c.content)===null||f===void 0?void 0:f.data)===null||p===void 0?void 0:p.object;if(h&&h.visible){var g=[];if(h.traverseVisible(function(z){if(z instanceof THREE__namespace.Mesh){var q=getBvhTreeForMesh(z);if(q){scratchMatrix4$1.copy(z.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4$1),scratchSphere$1.copy(t).applyMatrix4(scratchMatrix4Inverse);var j=q.trianglesInSphere(scratchSphere$1.center,scratchSphere$1.radius),G=new THREE__namespace.BufferGeometry;G.setAttribute("position",new THREE__namespace.BufferAttribute(j,3)),G.applyMatrix4(z.matrixWorld),G=BufferGeometryUtils.mergeVertices(G,.01),g.push(G)}}}),g.length===0)return;for(var A=["a","b","c"],m=BufferGeometryUtils.mergeBufferGeometries(g,!1),E=m.getAttribute("position").array,v=((d=m.getIndex())===null||d===void 0?void 0:d.array)||[],y=[],b=[],T=0,_=E.length;T<_;T+=3){var S=new THREE__namespace.Vector3(E[T],E[T+1],E[T+2]);y.push(S)}for(var T=0,_=v.length;T<_;T+=3){var R=v[T],w=v[T+1],M=v[T+2],O=new THREE__namespace.Vector3().crossVectors(y[w].clone().sub(y[R]),y[M].clone().sub(y[R])).normalize();b.push({a:R,b:w,c:M,normal:O})}for(var C={},T=0,_=b.length;T<_;T++)for(var P=b[T],F=0;F<3;F++){var L=P[A[F]],H=P[A[(F+1)%3]],N=[Math.min(L,H),Math.max(L,H)],D=N[0]+"-"+N[1];C[D]===void 0?C[D]={index1:N[0],index2:N[1],face1:T}:C[D].face2=T}for(var D in C){var Q=C[D];if(Q.face2===void 0||b[Q.face1].normal.dot(b[Q.face2].normal)<=r){var J=y[Q.index1],U=y[Q.index2];o.push(new THREE__namespace.Line3(J,U))}}y.length=0,b.length=0}})}return o}var scratchBoundingBox$1=new THREE__namespace.Box3,scratchViewLayerBox=new THREE__namespace.Box3,scratchObserverBox$3=new THREE__namespace.Box3,Model=(function(n){__extends(t,n);function t(e,r){r===void 0&&(r={});var o,s=n.call(this)||this;s.disposed=!1,s.parameter=new Parameter,s.outdated=!1,s.autoRefine=!0,s.metaPending=!1,s.loaded=!1,s.refined=!1,s.refineProgress=[0,0],s.boundingBox=new THREE__namespace.Box3,s.needsRender=!1,s.work=e,s.name=s.work.workCode;for(var u=0,l=0,c=e.observers;l<c.length;l++){var f=c[l];u=Math.max(u,f.floorIndex)}if(s.floorLength=u+1,e.model){s.metaPending=!0;var p=loadViewLayers(e.model,{fetcher:getFetcher(e),light:(o=r.light)!==null&&o!==void 0?o:!1,textureOptions:r.textureOptions,onError:function(d){return s.dispatchEvent({type:"error",error:d})}});s.initReady=Promise.all(p).then(function(d){if(s.metaPending=!1,d.length)if(s.disposed)for(var h=0,g=d;h<g.length;h++){var A=g[h];A.dispose()}else s.add.apply(s,d)}),s.loadedReady=new Promise(function(d){var h=function(){d(),s.removeEventListener("load",h),s.removeEventListener("dispose",h)};s.addEventListener("load",h),s.addEventListener("dispose",h)})}else s.refined=!0,s.loaded=!0,s.initReady=Promise.resolve(),s.loadedReady=Promise.resolve();return s.parameter.set("boundingBox",s.boundingBox.clone()),s}return t.prototype.dispose=function(){this.disposed=!0;for(var e;e=this.children[0];)typeof e.dispose=="function"&&e.dispose(),this.remove(e);this.dispatchEvent({type:"dispose"})},Object.defineProperty(t.prototype,"empty",{get:function(){return this.children.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayers",{get:function(){return this.children},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,r){return r===void 0&&(r=30/180*Math.PI),getEdgesBySphere(this,e,r)},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=e.sortByDistance;e.sortByDistance=!1;for(var u=0,l=this.children.length;u<l;u++){var c=this.children[u];c.visible&&typeof c.intersectRaycaster=="function"&&c.intersectRaycaster(e,o)}return e.sortByDistance=s,sortIntersects(o,e.sortByDistance,e.firstHitOnly),o},t.prototype.update=function(e,r,o){var s=!1;this.needsRender===!0&&(this.needsRender=!1,s=!0);var u=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,s=!0);for(var l=0,c=this.children;l<c.length;l++){var f=c[l];f.autoRefine=this.autoRefine;var p=f.update(e,r,o,this);p&&(s=!0),f.refined===!1&&(this.refined=!1),f.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=f.refineProgress[0],this.refineProgress[1]+=f.refineProgress[1]}scratchBoundingBox$1.makeEmpty(),scratchObserverBox$3.copy(this.work.observerBox),scratchObserverBox$3.isEmpty()||(scratchObserverBox$3.max.x+=1,scratchObserverBox$3.max.z+=1,scratchObserverBox$3.max.y+=1,scratchObserverBox$3.min.x-=1,scratchObserverBox$3.min.z-=1,scratchBoundingBox$1.union(scratchObserverBox$3));for(var d=0,h=this.viewLayers;d<h.length;d++){var f=h[d];f.boundingBox.isEmpty()||(scratchViewLayerBox.copy(f.boundingBox),scratchBoundingBox$1.union(scratchViewLayerBox))}return scratchBoundingBox$1.applyMatrix4(this.matrix),scratchBoundingBox$1.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox$1),this.parameter.set("boundingBox",scratchBoundingBox$1.clone())),u===!1&&this.loaded===!0&&this.dispatchEvent({type:"load"}),s},t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},Object.defineProperty(t.prototype,"shownFloor",{get:function(){return this.shownFloorIndex===-1?null:this.shownFloorIndex},set:function(e){this.shownFloorIndex=e===null?-1:e},enumerable:!1,configurable:!0}),t.prototype.show=function(e){this.shownFloor=e!=null?e:null,this.dispatchEvent({type:"changeShownFloor",shownFloor:e})},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r)},Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).shownFloorIndex},set:function(e){this.parameter.set("shownFloorIndex",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"brightness",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).brightness},set:function(e){this.parameter.set("brightness",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clippers",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).clippers},set:function(e){this.parameter.set("clippers",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customShaders",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).customShaders},set:function(e){this.parameter.set("customShaders",e)},enumerable:!1,configurable:!0}),t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.viewLayers;e<r.length;e++){var o=r[e];o.resetBrightness()}},t})(THREE__namespace.Object3D),scratchBoundingBox3=new THREE__namespace.Box3,scratchModelBoundingBox3=new THREE__namespace.Box3,ModelScene=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.needsRender=!0,e.autoRefine=!0,e.boundingBox=new THREE__namespace.Box3,e.loaded=!1,e.refined=!1,e.refineProgress=[0,0],e.parameter=new Parameter;var r=e.models=[];e.parameter.set("boundingBox",e.boundingBox.clone());var o=e;return defineProperty(r,"autoUpdate",{get:function(){return o.autoRefine},set:function(s){o.autoRefine=s}}),defineProperty(r,"bounding",{get:function(){return o.boundingBox}}),defineProperty(r,"loaded",{get:function(){return o.loaded}}),defineProperty(r,"refined",{get:function(){return o.refined}}),defineProperty(r,"refineProgress",{get:function(){return o.refineProgress}}),defineProperty(r,"cacheCameras",{get:function(){return o.parameter.resolveValue().cacheCameras},set:function(s){o.parameter.set("cacheCameras",s)}}),defineProperty(r,"intersectRaycaster",{value:function(s){return o.intersectRaycaster(s)}}),defineProperty(r,"setMaterial",{value:function(s){return o.setMaterial(s)}}),defineProperty(r,"getMaterial",{value:function(){return o.getMaterial()}}),defineProperty(r,"resetBrightness",{value:function(){return o.resetBrightness()}}),e}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.prototype.add.apply(this,e),this.models.length=0;for(var o=0,s=this.children;o<s.length;o++){var u=s[o];u instanceof Model&&u.outdated!==!0&&this.models.push(u)}return this.needsRender=!0,this},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.prototype.remove.apply(this,e),this.models.length=0;for(var o=0,s=this.children;o<s.length;o++){var u=s[o];u instanceof Model&&u.outdated!==!0&&this.models.push(u)}scratchBoundingBox3.makeEmpty();for(var l=0,c=this.children;l<c.length;l++){var u=c[l];u instanceof Model&&(scratchModelBoundingBox3.copy(u.boundingBox).applyMatrix4(u.matrix),scratchBoundingBox3.union(scratchModelBoundingBox3))}return this.boundingBox.copy(scratchBoundingBox3),this.needsRender=!0,this},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=this.children.filter(function(p){return p instanceof Model});if(s.length===1)s[0].intersectRaycaster(e,o);else{var u=e.sortByDistance;e.sortByDistance=!1;for(var l=0,c=s;l<c.length;l++){var f=c[l];f.visible&&f.intersectRaycaster(e,o)}e.sortByDistance=u,sortIntersects(o,e.sortByDistance,e.firstHitOnly)}return o},t.prototype.update=function(e,r){var o=!1;scratchBoundingBox3.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.models.length=0;for(var s=0,u=this.children;s<u.length;s++){var l=u[s];if(l instanceof Model)if(l.outdated){l.autoRefine=!1;var c=l.update(e,r,this);c&&(o=!0)}else{this.models.push(l),l.autoRefine=this.autoRefine;var c=l.update(e,r,this);c&&(o=!0),l.loaded===!1&&(this.loaded=!1),l.refined===!1&&(this.refined=!1),this.refineProgress[0]+=l.refineProgress[0],this.refineProgress[1]+=l.refineProgress[1],scratchModelBoundingBox3.copy(l.boundingBox),scratchBoundingBox3.union(scratchModelBoundingBox3)}else if(l.update){var c=l.update(e,r,this);c&&(o=!0)}}return scratchBoundingBox3.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox3),this.parameter.set("boundingBox",scratchBoundingBox3.clone())),this.needsRender=o,o},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){return this.parameter.resolveValue()},t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.models;e<r.length;e++){var o=r[e];o.resetBrightness()}},t})(THREE__namespace.Scene);function workInitialToJson(n){var t,e={};return e.mode=n.mode,e.pano_index=n.panoIndex,e.longitude=n.longitude,e.latitude=n.latitude,e.fov=n.fov,e.distance=n.distance,e.offset=(t=n.offset)===null||t===void 0?void 0:t.toArray(),e}function workModelToJson(n){var t;if(n)return{file_url:n.file,material_base_url:n.textureBase,material_textures:(t=n.textures)===null||t===void 0?void 0:t.slice(),layers:n.layers.map(function(e){return{tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}})}}function workObserverToObserverJson(n){return{index:n.index,floor_index:n.floorIndex,position:n.position.toArray(),standing_position:n.standingPosition.toArray(),quaternion:{x:n.quaternion.x,y:n.quaternion.y,z:n.quaternion.z,w:n.quaternion.w},visible_nodes:n.visibleNodes.slice(),accessible_nodes:n.accessibleNodes.slice()}}function workObserverToPanoramaJson(n){return{index:n.index,active:n.active,loadable:n.loadable,derived_id:n.derivedId,derived_id_str:n.derivedIdStr,size_list:n.images.sizeList.slice(),up:n.images.up,down:n.images.down,right:n.images.right,left:n.images.left,front:n.images.front,back:n.images.back,video:n.video?{matrix:n.video.matrix.toArray(),size:n.video.size.toArray(),source:n.video.source}:void 0}}function workToJson(n){return{_signature:"",allow_hosts:n.allowHosts.slice(),expire_at:n.expire.getTime().toString(),code:n.workCode,name:n.name,base_url:n.baseURL,initial:workInitialToJson(n.initial),model:workModelToJson(n.model),observers:n.observers.map(function(t){return workObserverToObserverJson(t)}),panorama:{count:n.observers.length,list:n.observers.map(function(t){return workObserverToPanoramaJson(t)})}}}function isNumber(n){return typeof n=="number"}function jsonClone(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return n.map(function(o){return typeof o!="object"||o===null?o:jsonClone(o)});var t={};for(var e in n){var r=n[e];t[e]=typeof r!="object"||r===null?r:jsonClone(r)}return t}function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function jsonMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return jsonClone(t);if(r==="array")for(var o=0;o<t.length;o++)n[o]=jsonMerge(n[o],t[o]);else if(r==="dict")for(var s in t)n[s]=jsonMerge(n[s],t[s]);return n}function jsonStableStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":return JSON.stringify(n.toString());case"undefined":return t?void 0:null;case"number":return n;default:return isFinite(n)?n:null}}function jsonStableStrinfiy(n){return jsonStableStrinfiy_(n,!1)}function jsonHash(n){return"hash::".concat(sha256(jsonStableStrinfiy(n)))}function deepFreeze(n){Object.freeze(n);var t=typeof n=="function",e=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(n).forEach(function(r){e.call(n,r)&&(!t||r!=="caller"&&r!=="callee"&&r!=="arguments")&&n[r]!==null&&(typeof n[r]=="object"||typeof n[r]=="function")&&!Object.isFrozen(n[r])&&deepFreeze(n[r])}),n}var URL_REGEXP=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,BUILDIN_ALLOW_HOST=deepFreeze(JSON.parse((function n(){var t=113,e=126,r=0,o="";return arguments[r].split(o).map(function(s){return s.charCodeAt(r)>e?s:String.fromCharCode((s.charCodeAt(r)+t)%e)}).join(o)})("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j"))),domainRegex=/^([^.]+)(\.([^.]+))*$/,currentHostname=typeof location!="undefined"?location.hostname:"localhost";function isIPDomain(n){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(n)}function matchDomain(n,t){if(!domainRegex.test(n)||!domainRegex.test(t))return!1;if(n==="*")return!0;var e=n.split(".").reverse(),r=t.split(".").reverse();if(e.length<=1)return n===t;for(var o=0;o<e.length;o++)if(e[o]!==r[o])return!1;return!0}function hostnameFromURL(n){if(/^blob\:/i.test(n)||/^data\:/i.test(n))return currentHostname;var t=n.match(URL_REGEXP);return t?t[2]:currentHostname}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(n){return new Error("Date(".concat(n.toString(),") expired."))},error_host_not_allowed=function(n){return new Error("Host(".concat(JSON.stringify(n),") is not allowed."))};function ObjectOmit(n,t){for(var e={},r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];t.indexOf(s)===-1&&(e[s]=n[s])}return e}function jsonStableNoneNumberStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableNoneNumberStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableNoneNumberStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableNoneNumberStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableNoneNumberStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(n)?n:null}}function jsonStableNoneNumberStrinfiy(n){return String(jsonStableNoneNumberStrinfiy_(n,!1))}function verify(n){var t,e,r,o={};try{o=typeof n=="string"?JSON.parse(n):n}catch(m){return error_invalid_input()}if(typeof o!="object")return error_invalid_input();var s=currentHostname,u=Date.now(),l=new Date(typeof o.expire_at=="string"&&/^\d+$/.test(o.expire_at)?Number(o.expire_at):o.expire_at),c=Array.isArray(o.allow_hosts)?o.allow_hosts:[];if(s.length===0||isIPDomain(s)||BUILDIN_ALLOW_HOST.filter(function(m){return matchDomain(m,s)}).length>0){var f=String((t=o.certificate)!==null&&t!==void 0?t:"");if(f){var p=new X509;return p.readCertPEM(f),deepFreeze({issuer:p.getSubjectString(),expire:l,allowHosts:c})}return deepFreeze({issuer:"none",expire:l,allowHosts:c})}var d=String((e=o.certificate)!==null&&e!==void 0?e:"");if(!d)return error_invalid_certificate();var h=new X509;h.readCertPEM(d);var g=String((r=o._signature)!==null&&r!==void 0?r:"");if(!g)return error_invalid_signature();var A=jsonStableNoneNumberStrinfiy(ObjectOmit(o,["_signature"]));return verifyMessage(A,g,h)===!1?error_invalid_signature():u<l.getTime()?BUILDIN_ALLOW_HOST.concat(c).filter(function(m){return matchDomain(m,s)}).length===0?error_host_not_allowed(s):deepFreeze({issuer:h.getSubjectString(),expire:l,allowHosts:c}):error_date_expired(l)}function verifyURL(n,t){var e=hostnameFromURL(n);return currentHostname.length!==0&&!isIPDomain(currentHostname)&&BUILDIN_ALLOW_HOST.filter(function(r){return matchDomain(r,currentHostname)}).length===0&&!isIPDomain(e)&&BUILDIN_ALLOW_HOST.concat(t).filter(function(r){return matchDomain(r,e)}).length===0?error_host_not_allowed(e):n}var PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(1,1,1),FACE_ORDER$1=["right","left","up","down","front","back"];function relativeURL(n,t){if(!isAbsoluteURL(n))return n;if(n.indexOf(t)===0)return n.slice(t.length);var e=t.replace(/^https\:/,"http:");if(n.indexOf(e)===0)return n.slice(e.length);var r=t.replace(/^http\:/,"https:");return n.indexOf(r)===0?n.slice(r.length):(console.warn("".concat(n," is not start with base_url(").concat(t,").")),n)}function panoURL(n,t,e){return!isAbsoluteURL(n)&&typeof t=="string"&&t.length>0&&(n=pathJoin(t,String(e),n)),n}function getTileLevel(n){for(var t=10;t>=0;t--){var e=512*Math.pow(2,t);if(e<=n)return t}return null}function sortTile(n){n=n.slice().sort(function(u,l){return u.level-l.level});for(var t=[],e=0,r=n;e<r.length;e++){var o=r[e];if(t.length===0){t.push(o);continue}var s=t[t.length-1];if(o.level>s.level){t.push(o);continue}if(o.size>s.size){t[t.length-1]=o;continue}}return t}function parse(n,t){for(var e,r,o,s,u,l,c,f,p,d,h,g,A,m,E=[],v=null,y=0,b=[].concat(n);y<b.length;y++){var T=b[y];if("getURL"in T)v={allowHosts:T.allowHosts,expire:T.expire,issuer:T.issuer},E.push(workToJson(T));else{var _=typeof T=="string"?JSON.parse(T):jsonClone(T),S=verify(_);if(S instanceof Error)return S;v===null&&(v=S),E.push(_)}}if(v===null)return new Error("Empty");defineProperty(t,"issuer",{configurable:!1,writable:!1,value:v.issuer}),defineProperty(t,"expire",{configurable:!1,writable:!1,value:Object.freeze(v.expire)}),defineProperty(t,"allowHosts",{configurable:!1,writable:!1,value:Object.freeze(v.allowHosts)});var R=E.reduce(function(U,z){return jsonMerge(U,z)});defineProperty(t,"name",{configurable:!1,writable:!1,value:String((e=R.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{writable:!0,value:String(R.resource_code||R.basic_code||R.vr_code||R.code||R.project_id||R.work_code||R.workCode||createUuid())}),defineProperty(t,"baseURL",{writable:!0,value:(function(){var U,z=(U=R.base_url)!==null&&U!==void 0?U:"";return z&&z[z.length-1]!=="/"&&(z+="/"),z})()});var w=void 0;R.model&&(w={},defineProperty(w,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),typeof R.model=="object"&&(defineProperty(w,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(w,"file",{configurable:!1,writable:!1,value:(function(){var U=R.model.file_url;if(U)return relativeURL(U,t.baseURL)})()}),defineProperty(w,"textureBase",{configurable:!1,writable:!1,value:(function(){var U=R.model.material_base_url;return U&&(U=relativeURL(U,t.baseURL)),U})()}),defineProperty(w,"textures",{configurable:!1,writable:!1,value:(function(){var U=void 0;return Array.isArray(R.model.material_textures)&&(U=R.model.material_textures.slice(),Object.freeze(U)),U})()}),defineProperty(w,"layers",{configurable:!1,writable:!1,value:(function(){var U,z,q,j=[];if(Array.isArray(R.model.layers))for(var G=0,X=R.model.layers;G<X.length;G++){var Y=X[G];if(Y&&Y.tileset_url){var Z={};defineProperty(Z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(Z,"name",{configurable:!1,writable:!1,value:(U=Y.name)!==null&&U!==void 0?U:""}),defineProperty(Z,"type",{configurable:!1,writable:!1,value:(z=Y.type)!==null&&z!==void 0?z:"mesh"}),defineProperty(Z,"upAxis",{configurable:!1,writable:!1,value:(q=Y.up_axis)!==null&&q!==void 0?q:"Z"}),defineProperty(Z,"tileset",{configurable:!1,writable:!1,value:relativeURL(Y.tileset_url,t.baseURL)}),j.push(Z)}}if(typeof R.model.tiles=="object"){var Y=R.model.tiles;if(Y&&Y.tileset_url){var Z={};defineProperty(Z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(Z,"name",{configurable:!1,writable:!1,value:"lod"}),defineProperty(Z,"type",{configurable:!1,writable:!1,value:"mesh"}),defineProperty(Z,"upAxis",{configurable:!1,writable:!1,value:"-Y"}),defineProperty(Z,"tileset",{configurable:!1,writable:!1,value:relativeURL(Y.tileset_url,t.baseURL)}),j.push(Z)}}return Object.freeze(j)})()}))),defineProperty(t,"model",{configurable:!1,writable:!1,value:w});var M=[];if(Array.isArray(R.observers)&&R.panorama&&Array.isArray(R.panorama.list||R.panorama.info))for(var O=R.observers,C=(r=R.panorama.list||R.panorama.info)!==null&&r!==void 0?r:[],P=(f=(l=(s=(o=R.panorama)===null||o===void 0?void 0:o.pano_high_cube_base_url)!==null&&s!==void 0?s:(u=R.panorama)===null||u===void 0?void 0:u.pano_cube_base_url)!==null&&l!==void 0?l:(c=R.panorama)===null||c===void 0?void 0:c.base_url)!==null&&f!==void 0?f:"",F=Math.min(O.length,C.length),L=function(U){var z=O[U],q=C[U],j={};defineProperty(j,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(j,"index",{configurable:!1,writable:!1,value:U}),defineProperty(j,"panoIndex",{configurable:!1,writable:!1,value:U}),defineProperty(j,"floorIndex",{configurable:!1,writable:!1,value:(p=z.floor_index)!==null&&p!==void 0?p:z.floor}),defineProperty(j,"derivedId",{configurable:!1,writable:!1,value:z.derived_id}),defineProperty(j,"derivedIdStr",{configurable:!1,writable:!1,value:z.derived_id_str}),defineProperty(j,"active",{configurable:!1,writable:!1,value:z.active!==!1&&q.active!==!1}),defineProperty(j,"loadable",{configurable:!1,writable:!1,value:(h=(d=z.active)!==null&&d!==void 0?d:q.active)!==null&&h!==void 0?h:!1}),defineProperty(j,"position",{configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((g=z.position)!==null&&g!==void 0?g:[0,0,0]))}),defineProperty(j,"standingPosition",{configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((m=(A=z.standing_position)!==null&&A!==void 0?A:z.standingPosition)!==null&&m!==void 0?m:[0,0,0]))}),defineProperty(j,"quaternion",{configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Quaternion().fromArray(z.quaternion?[z.quaternion.x,z.quaternion.y,z.quaternion.z,z.quaternion.w]:[0,0,0,1]))}),defineProperty(j,"matrix",{configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Matrix4().compose(j.position,j.quaternion,PANO_TEXTURE_SCALE))}),defineProperty(j,"accessibleNodes",{configurable:!1,writable:!1,value:(function(){var G,X,Y=((X=(G=z.accessible_nodes)!==null&&G!==void 0?G:z.accessibleNodes)!==null&&X!==void 0?X:[]).filter(function(W){return W<F});if(Y.length===0)for(var Z=0;Z<F;Z++)Z!==U&&Y.push(Z);return Object.freeze(Y)})()}),defineProperty(j,"visibleNodes",{configurable:!1,writable:!1,value:(function(){var G,X,Y=((X=(G=z.visible_nodes)!==null&&G!==void 0?G:z.visibleNodes)!==null&&X!==void 0?X:[]).filter(function(W){return W<F});if(Y.length===0)for(var Z=0;Z<F;Z++)Z!==U&&Y.push(Z);return Object.freeze(Y)})()}),defineProperty(j,"images",{configurable:!1,writable:!1,value:(function(){var G={};defineProperty(G,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var X=0,Y=FACE_ORDER$1;X<Y.length;X++){var Z=Y[X];defineProperty(G,Z,{configurable:!1,writable:!1,value:relativeURL(panoURL(q[Z],P,U),t.baseURL)})}return defineProperty(G,"sizeList",{configurable:!1,writable:!1,value:(function(){var W=getImageSizeFromURL(G[FACE_ORDER$1[0]]);if(W){if(q.size_list){var K=q.size_list.slice().sort(function(se,he){return se-he});return Object.freeze(K)}else if(q.tiles){for(var K=[W],ne=q.tiles.slice().sort(function(he,me){return he-me}),ee=0,te=ne;ee<te.length;ee++){var ae=te[ee],fe=512*Math.pow(2,ae);fe>W&&K.push(fe)}return Object.freeze(K)}}return Object.freeze([])})()}),defineProperty(G,"tiles",{configurable:!1,writable:!1,value:(function(){var W=getImageSizeFromURL(G.front);if(W){var K=G.sizeList.slice();if(K[0]){var ne=getTileLevel(K[0]);if(ne)for(var ee=ne-1;ee>=0;ee--)K.unshift(512*Math.pow(2,ee))}if(!(K.length<=0)){for(var te=[],ae=0,fe=K;ae<fe.length;ae++){var se=fe[ae],he=getTileLevel(se);if(typeof he=="number"){var me={};if(defineProperty(me,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(me,"level",{configurable:!1,writable:!1,value:he}),se>W){defineProperty(me,"size",{configurable:!1,writable:!1,value:se}),defineProperty(me,"scale",{configurable:!1,writable:!1,value:1});for(var be=0,Te=FACE_ORDER$1;be<Te.length;be++){var ce=Te[be];defineProperty(me,ce,{configurable:!1,writable:!1,value:replaceImageSize(G[ce],se)})}}else{defineProperty(me,"size",{configurable:!1,writable:!1,value:W}),defineProperty(me,"scale",{configurable:!1,writable:!1,value:se/W});for(var pe=0,re=FACE_ORDER$1;pe<re.length;pe++){var ce=re[pe];defineProperty(me,ce,{configurable:!1,writable:!1,value:G[ce]})}}te.push(me)}}return te=sortTile(te),Object.freeze(te)}}})()}),G})()}),defineProperty(j,"video",{configurable:!1,writable:!1,value:(function(){var G=void 0;return q.video&&(G={},defineProperty(G,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(G,"source",{configurable:!1,writable:!1,value:q.video.source}),defineProperty(G,"matrix",{configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().fromArray(q.video.matrix)}),defineProperty(G,"size",{configurable:!1,writable:!1,value:new THREE__namespace.Vector2().fromArray(q.video.size)})),G})()}),M.push(j)},H=0;H<F;H++)L(H);defineProperty(t,"observers",{configurable:!1,writable:!1,value:Object.freeze(M)});var N={};if(defineProperty(N,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),R.initial){if(t.observers.length>0){var D=void 0;isNumber(R.initial.panoIndex)?D=R.initial.panoIndex:isNumber(R.initial.pano_index)?D=R.initial.pano_index:isNumber(R.initial.pano)&&(D=R.initial.pano),typeof D=="number"&&(D=clamp$1(D,0,t.observers.length-1),defineProperty(N,"panoIndex",{writable:!0,value:D}))}if(R.initial.mode==="Panorama"&&t.observers.length===0||R.initial.mode==="Floorplan"||R.initial.mode==="Topview"||R.initial.mode==="Model"||R.initial.mode==="Mapview"?defineProperty(N,"mode",{writable:!0,value:R.initial.mode}):typeof N.panoIndex=="number"?defineProperty(N,"mode",{writable:!0,value:"Panorama"}):defineProperty(N,"mode",{writable:!0,value:"Mapview"}),isNumber(R.initial.latitude)&&defineProperty(N,"latitude",{writable:!0,value:R.initial.latitude}),isNumber(R.initial.longitude)?defineProperty(N,"longitude",{writable:!0,value:R.initial.longitude}):isNumber(R.initial.heading)&&defineProperty(N,"longitude",{writable:!0,value:headingToLongitude(R.initial.heading)}),isNumber(R.initial.fov)&&defineProperty(N,"fov",{writable:!0,value:R.initial.fov}),isNumber(R.initial.distance)&&defineProperty(N,"distance",{writable:!0,value:R.initial.distance}),Array.isArray(R.initial.offset)){var Q=R.initial.offset,J=[0,0,0].map(function(U,z){var q=Number(Q[z]);return isNaN(q)||!isFinite(q)?0:q});defineProperty(N,"offset",{writable:!0,value:new THREE__namespace.Vector3().fromArray(J)})}else typeof R.initial.offset=="object"&&typeof R.initial.offset.x=="number"&&typeof R.initial.offset.y=="number"&&typeof R.initial.offset.z=="number"&&defineProperty(N,"offset",{writable:!0,value:new THREE__namespace.Vector3().fromArray([R.initial.offset.x,R.initial.offset.y,R.initial.offset.z])})}return defineProperty(t,"initial",{configurable:!1,writable:!1,value:N}),t}function parseNull(n,t){return defineProperty(t,"issuer",{configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{configurable:!1,writable:!1,value:"Null"}),defineProperty(t,"workCode",{value:createUuid()}),defineProperty(t,"baseURL",{value:"/"}),defineProperty(t,"model",{configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(t,"initial",{configurable:!1,writable:!1,value:(function(){var e={};return defineProperty(e,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(e,"mode",{writable:!0,value:"Mapview"}),e})()}),t}function parsePano(n,t){var e,r;return defineProperty(t,"issuer",{configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{configurable:!1,writable:!1,value:String((e=n.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{writable:!0,value:(r=n.code)!==null&&r!==void 0?r:createUuid()}),defineProperty(t,"baseURL",{writable:!0,value:"/"}),defineProperty(t,"model",{configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"index",{configurable:!1,writable:!1,value:0}),defineProperty(o,"panoIndex",{configurable:!1,writable:!1,value:0}),defineProperty(o,"floorIndex",{configurable:!1,writable:!1,value:0}),defineProperty(o,"derivedId",{configurable:!1,writable:!1,value:void 0}),defineProperty(o,"derivedIdStr",{configurable:!1,writable:!1,value:void 0}),defineProperty(o,"active",{configurable:!1,writable:!1,value:!0}),defineProperty(o,"loadable",{configurable:!1,writable:!1,value:!1}),defineProperty(o,"position",{configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,1.5,0)}),defineProperty(o,"standingPosition",{configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,0,0)}),defineProperty(o,"quaternion",{configurable:!1,writable:!1,value:new THREE__namespace.Quaternion(0,1,0,0)}),defineProperty(o,"matrix",{configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().compose(o.position,o.quaternion,PANO_TEXTURE_SCALE)}),defineProperty(o,"accessibleNodes",{configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(o,"visibleNodes",{configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(o,"images",{configurable:!1,writable:!1,value:(function(){var s={};defineProperty(s,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var u=0,l=FACE_ORDER$1;u<l.length;u++){var c=l[u];defineProperty(s,c,{configurable:!1,writable:!1,value:n[c]})}return defineProperty(s,"sizeList",{configurable:!1,writable:!1,value:Object.freeze([n.size])}),defineProperty(s,"tiles",{configurable:!1,writable:!1,value:(function(){var f=getImageSizeFromURL(s.front);if(f){var p=s.sizeList.slice();if(p[0]){var d=getTileLevel(p[0]);if(d)for(var h=d-1;h>=0;h--)p.unshift(512*Math.pow(2,h))}if(!(p.length<=0)){for(var g=[],A=0,m=p;A<m.length;A++){var E=m[A],v=getTileLevel(E);if(typeof v=="number"){var y={};if(defineProperty(y,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(y,"level",{configurable:!1,writable:!1,value:v}),E>f){defineProperty(y,"size",{configurable:!1,writable:!1,value:E}),defineProperty(y,"scale",{configurable:!1,writable:!1,value:1});for(var b=0,T=FACE_ORDER$1;b<T.length;b++){var _=T[b];defineProperty(y,_,{configurable:!1,writable:!1,value:replaceImageSize(s[_],E)})}}else{defineProperty(y,"size",{configurable:!1,writable:!1,value:f}),defineProperty(y,"scale",{configurable:!1,writable:!1,value:E/f});for(var S=0,R=FACE_ORDER$1;S<R.length;S++){var _=R[S];defineProperty(y,_,{configurable:!1,writable:!1,value:s[_]})}}g.push(y)}}return g=sortTile(g),Object.freeze(g)}}})()}),s})()}),defineProperty(o,"video",{configurable:!1,writable:!1,value:void 0}),Object.freeze([o])})()}),defineProperty(t,"initial",{configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"mode",{writable:!0,value:"Panorama"}),defineProperty(o,"panoIndex",{writable:!0,value:0}),o})()}),t}var workVerifySet=new WeakSet,hrefAElement=typeof document!="undefined"?document.createElement("a"):{href:""},Work=(function(){function n(t,e){this.observerBox=new THREE__namespace.Box3,this.observerBox=new THREE__namespace.Box3,this.transform=new THREE__namespace.Matrix4,this.shortPath=!1,this.jsonp=!1;var r;if(t!==null?typeof t=="object"&&typeof t.size=="number"&&typeof t.up=="string"&&typeof t.down=="string"&&typeof t.right=="string"&&typeof t.left=="string"&&typeof t.front=="string"&&typeof t.back=="string"?r=parsePano(t,this):r=parse(t,this):r=parseNull(t,this),r instanceof Error)throw new Error("[PARSE FAILED]: "+r.message+`
|
|
1027
1027
|
Error work input:
|
|
1028
1028
|
`+JSON.stringify(t));workVerifySet.add(this);for(var o=0,s=this.observers;o<s.length;o++){var u=s[o];this.observerBox.expandByPoint(u.position),this.observerBox.expandByPoint(u.standingPosition)}e.transform&&(Array.isArray(e.transform)?this.transform.fromArray(e.transform):this.transform.copy(e.transform)),typeof e.jsonp=="boolean"&&(this.jsonp=e.jsonp),typeof e.shortPath=="boolean"&&(this.shortPath=e.shortPath),e.workCode&&(typeof e.workCode=="string"?this.workCode=e.workCode:typeof e.workCode=="function"&&(this.workCode=e.workCode(t)));{var l=this;this.options={get transform(){return l.transform}},this.raw={get works(){return[JSON.stringify(workToJson(l))]}}}}return n.prototype.getURL=function(t){var e;if(!isAbsoluteURL(t)){if(this.jsonp===!0){t=t.replace(/([\?\#].*)?$/i,"");var r=sha256("".concat(t)).slice(0,7);t="".concat(t,".").concat(r,".jsonp")}if(this.shortPath===!0){var o=t.replace(t,"").split("."),s=(e=o.shift())!==null&&e!==void 0?e:"",u=o.join(".");t=sha256(s)+(u?"."+u:"")}t=pathJoin(this.baseURL,t)}return hrefAElement.href=t,t=hrefAElement.href,t},n.prototype.verifyURL=function(t){return typeof verifyURL(this.getURL(t),this.allowHosts)=="string"},n.prototype.toJSON=function(){return workToJson(this)},n.parse=parseWork,n})();function parseWork(n,t){typeof n=="string"&&n.trim()[0]==="{"&&(n=JSON.parse(n));try{return new Work(n,t!=null?t:{})}catch(e){throw console.log(e),new Error("[PARSE FAILED]: "+e.message+`
|
|
1029
1029
|
Error work input:
|
|
@@ -1384,13 +1384,13 @@ void main() {
|
|
|
1384
1384
|
|
|
1385
1385
|
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);
|
|
1386
1386
|
}
|
|
1387
|
-
`,PanoCircleMeshCustom=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,p=n.call(this)||this,d=(r=e.color)!==null&&r!==void 0?r:16777215,h=(o=e.scale)!==null&&o!==void 0?o:1,g=e.map,A=(s=e.mapAlpha)!==null&&s!==void 0?s:1,m=(u=e.mapUseColor)!==null&&u!==void 0?u:!1,E=(l=e.mapUseReverse)!==null&&l!==void 0?l:!1,v=(c=e.borderWidth)!==null&&c!==void 0?c:.1,y=(f=e.borderColor)!==null&&f!==void 0?f:16777215;return p.progress=0,p.opacity=0,p.loading=!1,p.current=!1,p.disabled=!1,p.currentMotion=new Motion({progress:0}),p.tapMotion=new Motion({scale:1,opacity:1}),p.loadingOpacityMotion=new Motion({opacity:0}),p.progressMotion=new Motion({progress:0}),p.progressOpacityMotion=new Motion({opacity:0}),p.opacityMotion=new Motion({opacity:0}),p.disableMotion=new Motion({progress:0}),p.panoMesh=new THREE__namespace.Mesh(sharedGeometry2,new THREE__namespace.ShaderMaterial({blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,vertexShader:vertexShader$4,fragmentShader:fragmentShader$4,defines:{USE_COLOR:m,USE_MAP:g!==void 0,USE_BORDER:v>0,USE_REVERSE:E},uniforms:{baseColor:{value:new THREE__namespace.Color(d)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0},map:{value:g},mapAlpha:{value:A},borderWidth:{value:v},borderColor:{value:new THREE__namespace.Color(y)}}})),p.renderOrder=-2,p.panoMesh.renderOrder=-2,p.panoMesh.position.y=.004,p.panoMesh.scale.set(h,1,h),p.add(p.panoMesh),p.currentStartTime=now(),p.needsRender=!0,p}return t.prototype.setProgress=function(e){var r=this;this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=clamp$1(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(noop),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(noop).then(function(){r.progressMotion.set({progress:0},0).catch(noop)}):this.progressMotion.set({progress:clamp$1(e*1.2,0,1)},100).catch(noop)),this.progress=e)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},200).catch(noop))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(noop),this.current=e,this.current===!0&&(this.currentStartTime=now()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(noop))},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(noop))},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();var r=[{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}];return this.progressOpacityMotion.set({opacity:0},0).catch(noop),this.progressMotion.set({progress:0},0).catch(noop),this.tapMotion.setKeyframes(r,600).then(function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(noop),e.progressMotion.set({progress:e.progress},120).catch(noop)}).catch(noop)},t.prototype.updateTime=function(e,r){if(!this.progressMotion.ended){this.progressMotion.update(e);var o=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=o,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var s=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=s,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);var s=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=s,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{var u=(e-this.currentStartTime-1500)/2e3;if(u%5<2){var l=u%1;this.panoMesh.material.uniforms.expand0.value=easeOut(l)*this.currentMotion.value.progress,this.needsRender=!0}}{var c=(e-this.currentStartTime-1e3)/2e3;if(c%5<2){var l=c%1;this.panoMesh.material.uniforms.expand1.value=easeOut(l)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){var o=this.disableMotion.value.progress;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=o,this.needsRender=!0}},t.prototype.dispose=function(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()},t})(THREE__namespace.Object3D);function isSimilarValue(n,t,e){var r=Math.abs(n-t);return r<.001||typeof e!="undefined"&&Math.abs(e-r)<.001}function notSimilarValue(n,t,e){return!isSimilarValue(n,t,e)}function isSimilarVector3(n,t){return n.distanceTo(t)<.001}function notSimilarVector3(n,t){return!isSimilarVector3(n,t)}var scratchGeometry=(function(){var n=new Float32Array([-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1]),t=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),e=new THREE__namespace.BufferGeometry;return e.setAttribute("position",new THREE__namespace.BufferAttribute(n,3)),e.setIndex(new THREE__namespace.BufferAttribute(t,1)),e.addGroup(0,e.index.count,0),e.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-.5,.5,.5)),e.computeBoundingBox(),e})(),versionMap=new WeakMap,cameraBoxSize=new THREE__namespace.Vector3(1,1,1),scratchBoundingBox=new THREE__namespace.Box3,scratchCameraBox=new THREE__namespace.Box3,scratchPosition=new THREE__namespace.Vector3,scratchScale=new THREE__namespace.Vector3,BoundingMesh$1=(function(n){__extends(t,n);function t(){var e=this,r=new PBMMeshMaterial("none");return r.flatShading=!0,r.depthWrite=!1,r.transparent=!1,r.blending=THREE__namespace.CustomBlending,r.blendSrc=THREE__namespace.SrcAlphaFactor,r.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,r.blendSrcAlpha=THREE__namespace.OneFactor,r.blendDstAlpha=THREE__namespace.OneMinusSrcAlphaFactor,e=n.call(this,scratchGeometry,[r])||this,e.frustumCulled=!1,e.renderOrder=-1001,e}return t.prototype.update=function(e,r,o){var s=!1,u=Parameter.resolveValue(o.parameter);if(scratchBoundingBox.copy(u.boundingBox),scratchBoundingBox.expandByScalar(.1),scratchBoundingBox.union(scratchCameraBox.setFromCenterAndSize(r.position,cameraBoxSize)),scratchBoundingBox.getCenter(scratchPosition),scratchBoundingBox.getSize(scratchScale),scratchPosition.equals(this.position)||(this.position.copy(scratchPosition),s=!0),scratchScale.equals(this.scale)||(this.scale.copy(scratchScale),s=!0),versionMap.get(this)!==u.version){versionMap.set(this,u.version),s=!0;for(var l=this.material,c=0,f=l;c<f.length;c++){var p=f[c];p.customShaders=u.customShaders,p.pano0=u.pano0,p.pano1=u.pano1,p.refinedScreen=u.refinedScreen,p.modelAlpha=u.modelAlpha,p.progress=u.progress,p.transition=u.transition,p.opacity=u.opacity,p.floorStyle=u.floorStyle,p.constantColor=u.constantColor,p.shownFloorIndex=u.shownFloorIndex,p.clippers=u.clippers,p.brightness=u.brightness,p.logDepthAlpha=u.logDepthAlpha,p.useHQWeight=u.useHQWeight,p.useHQDepth=u.useHQDepth,p.colorSaturation=u.colorSaturation,p.colorBrightness=u.colorBrightness,p.gradientTexture=u.gradientTexture,p.transparent=!1,p.modelBoundingMax.copy(u.boundingBox.max),p.modelBoundingMin.copy(u.boundingBox.min),u.useAddBlend&&(p.opacity=0),p.opacity===0&&(p.visible=!1)}}return s},t})(PBMMesh);function cameraWorldToLocal(n,t){var e=new THREE__namespace.Vector3(0,0,-1);e.applyQuaternion(n.quaternion);var r=t.quaternion.clone().inverse();e.applyQuaternion(r);var o=Math.atan2(e.x,-e.z),s=-Math.asin(e.y);return{theta:o,phi:s,lookAtVector:e}}var PI=Math.PI,TAU=PI*2;function stepNumber(n,t,e){if(n===t)return t;var r=t-n,o=Math.abs(r);if(o<=e)return t;var s=r>0?1:-1;return n+s*e}function stepVector(n,t,e){if(n.equals(t))return new THREE__namespace.Vector3().copy(t);var r=new THREE__namespace.Vector3().subVectors(t,n);return r.lengthSq()<e*e?r.copy(t):r.setLength(e).add(n)}function stepCoordinates(n,t,e){if(n.longitude===t.longitude&&n.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};var r=formatRad$1(n.longitude),o=n.latitude,s=formatRad$1(t.longitude),u=t.latitude;s-r>PI?r+=TAU:r-s>PI&&(r-=TAU);var l=Math.sqrt(Math.pow(s-r,2)+Math.pow(u-o,2)),c=e/l;return c>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(s-r)*c,latitude:o+(u-o)*c}}function isPromise(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}var _a$2,userAgent=typeof navigator!="undefined"?((_a$2=navigator==null?void 0:navigator.userAgent)!==null&&_a$2!==void 0?_a$2:"").toLowerCase():"node";(function(){try{var n=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(n.getContext("webgl")||n.getContext("experimental-webgl")))}catch(t){return!1}})();var isMobile=/android/i.test(userAgent)||/webos/i.test(userAgent)||/ipad|iphone|ipod/i.test(userAgent)||/iemobile/i.test(userAgent)||/opera mini/i.test(userAgent)||/blackberry/i.test(userAgent)||/windows phone/i.test(userAgent);function createEvent(n,t){for(var e=!1,r={type:n,timeStamp:now(),get defaultPrevented(){return e},preventDefault:function(){e=!0}},o=0,s=Object.keys(t);o<s.length;o++){var u=s[o];u in r||(r[u]=t[u])}return r}function requestDeviceOrientationPermission(){return typeof location=="undefined"||location.protocol!=="https:"?Promise.reject(new Error("Request DeviceOrientation Permission denied.")):typeof DeviceOrientationEvent!="undefined"&&typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(function(n){if(n=="granted")return Promise.resolve();var t=new Error("Request DeviceOrientation Permission denied.");return Promise.reject(t)}):Promise.resolve()}function requestXRSessionPermission(){if("xr"in navigator)return navigator.xr.isSessionSupported("immersive-vr").then(function(t){return t?Promise.resolve():Promise.reject()}).then(function(){var t={optionalFeatures:["local-floor"]};return navigator.xr.requestSession("immersive-vr",t).then(function(e){return Promise.resolve(e)})});var n=new Error("Request XR Permission denied.");return Promise.reject(n)}function assignState(n,t){n.mode=t.mode,n.workCode=t.workCode,n.panoIndex=t.panoIndex,n.longitude=t.longitude,n.latitude=t.latitude,n.fov=t.fov,n.offset.copy(t.offset),n.distance=t.distance}function stateEqual(n,t){return n.workCode===t.workCode&&n.mode===t.mode&&n.panoIndex===t.panoIndex&&isSimilarValue(n.longitude,t.longitude,Math.PI*2)&&isSimilarValue(n.latitude,t.latitude)&&isSimilarValue(n.fov,t.fov)&&isSimilarVector3(n.offset,t.offset)&&isSimilarValue(n.distance,t.distance)}function assignPose(n,t){n.longitude=t.longitude,n.latitude=t.latitude,n.fov=t.fov,n.distance=t.distance,n.offset.copy(t.offset)}function clonePose(n){return{longitude:n.longitude,latitude:n.latitude,fov:n.fov,offset:n.offset.clone(),distance:n.distance}}function isThirdPersonMode(n){switch(n){case"Floorplan":return!0;case"Mapview":return!0;default:return!1}}function isFristPersonMode(n){switch(n){case"Panorama":return!0;case"VRPanorama":return!0;case"XRPanorama":return!0;case"Model":return!0;default:return!1}}function isEmptyObject(n){for(var t in n)return!1;return!0}/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
1387
|
+
`,PanoCircleMeshCustom=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,p=n.call(this)||this,d=(r=e.color)!==null&&r!==void 0?r:16777215,h=(o=e.scale)!==null&&o!==void 0?o:1,g=e.map,A=(s=e.mapAlpha)!==null&&s!==void 0?s:1,m=(u=e.mapUseColor)!==null&&u!==void 0?u:!1,E=(l=e.mapUseReverse)!==null&&l!==void 0?l:!1,v=(c=e.borderWidth)!==null&&c!==void 0?c:.1,y=(f=e.borderColor)!==null&&f!==void 0?f:16777215;return p.progress=0,p.opacity=0,p.loading=!1,p.current=!1,p.disabled=!1,p.currentMotion=new Motion({progress:0}),p.tapMotion=new Motion({scale:1,opacity:1}),p.loadingOpacityMotion=new Motion({opacity:0}),p.progressMotion=new Motion({progress:0}),p.progressOpacityMotion=new Motion({opacity:0}),p.opacityMotion=new Motion({opacity:0}),p.disableMotion=new Motion({progress:0}),p.panoMesh=new THREE__namespace.Mesh(sharedGeometry2,new THREE__namespace.ShaderMaterial({blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,vertexShader:vertexShader$4,fragmentShader:fragmentShader$4,defines:{USE_COLOR:m,USE_MAP:g!==void 0,USE_BORDER:v>0,USE_REVERSE:E},uniforms:{baseColor:{value:new THREE__namespace.Color(d)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0},map:{value:g},mapAlpha:{value:A},borderWidth:{value:v},borderColor:{value:new THREE__namespace.Color(y)}}})),p.renderOrder=-2,p.panoMesh.renderOrder=-2,p.panoMesh.position.y=.004,p.panoMesh.scale.set(h,1,h),p.add(p.panoMesh),p.currentStartTime=now(),p.needsRender=!0,p}return t.prototype.setProgress=function(e){var r=this;this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=clamp$1(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(noop),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(noop).then(function(){r.progressMotion.set({progress:0},0).catch(noop)}):this.progressMotion.set({progress:clamp$1(e*1.2,0,1)},100).catch(noop)),this.progress=e)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},200).catch(noop))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(noop),this.current=e,this.current===!0&&(this.currentStartTime=now()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(noop))},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(noop))},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();var r=[{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}];return this.progressOpacityMotion.set({opacity:0},0).catch(noop),this.progressMotion.set({progress:0},0).catch(noop),this.tapMotion.setKeyframes(r,600).then(function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(noop),e.progressMotion.set({progress:e.progress},120).catch(noop)}).catch(noop)},t.prototype.updateTime=function(e,r){if(!this.progressMotion.ended){this.progressMotion.update(e);var o=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=o,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var s=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=s,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);var s=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=s,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{var u=(e-this.currentStartTime-1500)/2e3;if(u%5<2){var l=u%1;this.panoMesh.material.uniforms.expand0.value=easeOut(l)*this.currentMotion.value.progress,this.needsRender=!0}}{var c=(e-this.currentStartTime-1e3)/2e3;if(c%5<2){var l=c%1;this.panoMesh.material.uniforms.expand1.value=easeOut(l)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){var o=this.disableMotion.value.progress;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=o,this.needsRender=!0}},t.prototype.dispose=function(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()},t})(THREE__namespace.Object3D);function isSimilarValue(n,t,e){var r=Math.abs(n-t);return r<.001||typeof e!="undefined"&&Math.abs(e-r)<.001}function notSimilarValue(n,t,e){return!isSimilarValue(n,t,e)}function isSimilarVector3(n,t){return n.distanceTo(t)<.001}function notSimilarVector3(n,t){return!isSimilarVector3(n,t)}var scratchGeometry=(function(){var n=new Float32Array([-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1]),t=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),e=new THREE__namespace.BufferGeometry;return e.setAttribute("position",new THREE__namespace.BufferAttribute(n,3)),e.setIndex(new THREE__namespace.BufferAttribute(t,1)),e.addGroup(0,e.index.count,0),e.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-.5,.5,.5)),e.computeBoundingBox(),e})(),versionMap=new WeakMap,cameraBoxSize=new THREE__namespace.Vector3(1,1,1),scratchBoundingBox=new THREE__namespace.Box3,scratchCameraBox=new THREE__namespace.Box3,scratchPosition=new THREE__namespace.Vector3,scratchScale=new THREE__namespace.Vector3,BoundingMesh$1=(function(n){__extends(t,n);function t(){var e=this,r=new PBMMeshMaterial("none");return r.flatShading=!0,r.depthWrite=!1,r.transparent=!1,r.blending=THREE__namespace.CustomBlending,r.blendSrc=THREE__namespace.SrcAlphaFactor,r.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,r.blendSrcAlpha=THREE__namespace.OneFactor,r.blendDstAlpha=THREE__namespace.OneMinusSrcAlphaFactor,e=n.call(this,scratchGeometry,[r])||this,e.frustumCulled=!1,e.renderOrder=-1001,e}return t.prototype.update=function(e,r,o){var s=!1,u=Parameter.resolveValue(o.parameter);if(scratchBoundingBox.copy(u.boundingBox),scratchBoundingBox.expandByScalar(.1),scratchBoundingBox.union(scratchCameraBox.setFromCenterAndSize(r.position,cameraBoxSize)),scratchBoundingBox.getCenter(scratchPosition),scratchBoundingBox.getSize(scratchScale),scratchPosition.equals(this.position)||(this.position.copy(scratchPosition),s=!0),scratchScale.equals(this.scale)||(this.scale.copy(scratchScale),s=!0),versionMap.get(this)!==u.version){versionMap.set(this,u.version),s=!0;for(var l=this.material,c=0,f=l;c<f.length;c++){var p=f[c];p.customShaders=u.customShaders,p.pano0=u.pano0,p.pano1=u.pano1,p.refinedScreen=u.refinedScreen,p.modelAlpha=u.modelAlpha,p.progress=u.progress,p.transition=u.transition,p.opacity=u.opacity,p.floorStyle=u.floorStyle,p.constantColor=u.constantColor,p.shownFloorIndex=u.shownFloorIndex,p.clippers=u.clippers,p.brightness=u.brightness,p.logDepthAlpha=u.logDepthAlpha,p.useHQWeight=u.useHQWeight,p.useHQDepth=u.useHQDepth,p.colorSaturation=u.colorSaturation,p.colorBrightness=u.colorBrightness,p.gradientTexture=u.gradientTexture,p.transparent=!1,p.modelBoundingMax.copy(u.boundingBox.max),p.modelBoundingMin.copy(u.boundingBox.min),u.useAddBlend&&(p.opacity=0),p.opacity===0&&(p.visible=!1)}}return s},t.prototype.dispose=function(){for(var e=0,r=this.material;e<r.length;e++){var o=r[e];o.dispose(),o.pano0=null,o.pano1=null}},t})(PBMMesh);function cameraWorldToLocal(n,t){var e=new THREE__namespace.Vector3(0,0,-1);e.applyQuaternion(n.quaternion);var r=t.quaternion.clone().inverse();e.applyQuaternion(r);var o=Math.atan2(e.x,-e.z),s=-Math.asin(e.y);return{theta:o,phi:s,lookAtVector:e}}var PI=Math.PI,TAU=PI*2;function stepNumber(n,t,e){if(n===t)return t;var r=t-n,o=Math.abs(r);if(o<=e)return t;var s=r>0?1:-1;return n+s*e}function stepVector(n,t,e){if(n.equals(t))return new THREE__namespace.Vector3().copy(t);var r=new THREE__namespace.Vector3().subVectors(t,n);return r.lengthSq()<e*e?r.copy(t):r.setLength(e).add(n)}function stepCoordinates(n,t,e){if(n.longitude===t.longitude&&n.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};var r=formatRad$1(n.longitude),o=n.latitude,s=formatRad$1(t.longitude),u=t.latitude;s-r>PI?r+=TAU:r-s>PI&&(r-=TAU);var l=Math.sqrt(Math.pow(s-r,2)+Math.pow(u-o,2)),c=e/l;return c>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(s-r)*c,latitude:o+(u-o)*c}}function isPromise(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}var _a$2,userAgent=typeof navigator!="undefined"?((_a$2=navigator==null?void 0:navigator.userAgent)!==null&&_a$2!==void 0?_a$2:"").toLowerCase():"node";(function(){try{var n=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(n.getContext("webgl")||n.getContext("experimental-webgl")))}catch(t){return!1}})();var isMobile=/android/i.test(userAgent)||/webos/i.test(userAgent)||/ipad|iphone|ipod/i.test(userAgent)||/iemobile/i.test(userAgent)||/opera mini/i.test(userAgent)||/blackberry/i.test(userAgent)||/windows phone/i.test(userAgent);function createEvent(n,t){for(var e=!1,r={type:n,timeStamp:now(),get defaultPrevented(){return e},preventDefault:function(){e=!0}},o=0,s=Object.keys(t);o<s.length;o++){var u=s[o];u in r||(r[u]=t[u])}return r}function requestDeviceOrientationPermission(){return typeof location=="undefined"||location.protocol!=="https:"?Promise.reject(new Error("Request DeviceOrientation Permission denied.")):typeof DeviceOrientationEvent!="undefined"&&typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(function(n){if(n=="granted")return Promise.resolve();var t=new Error("Request DeviceOrientation Permission denied.");return Promise.reject(t)}):Promise.resolve()}function requestXRSessionPermission(){if("xr"in navigator)return navigator.xr.isSessionSupported("immersive-vr").then(function(t){return t?Promise.resolve():Promise.reject()}).then(function(){var t={optionalFeatures:["local-floor"]};return navigator.xr.requestSession("immersive-vr",t).then(function(e){return Promise.resolve(e)})});var n=new Error("Request XR Permission denied.");return Promise.reject(n)}function assignState(n,t){n.mode=t.mode,n.workCode=t.workCode,n.panoIndex=t.panoIndex,n.longitude=t.longitude,n.latitude=t.latitude,n.fov=t.fov,n.offset.copy(t.offset),n.distance=t.distance}function stateEqual(n,t){return n.workCode===t.workCode&&n.mode===t.mode&&n.panoIndex===t.panoIndex&&isSimilarValue(n.longitude,t.longitude,Math.PI*2)&&isSimilarValue(n.latitude,t.latitude)&&isSimilarValue(n.fov,t.fov)&&isSimilarVector3(n.offset,t.offset)&&isSimilarValue(n.distance,t.distance)}function assignPose(n,t){n.longitude=t.longitude,n.latitude=t.latitude,n.fov=t.fov,n.distance=t.distance,n.offset.copy(t.offset)}function clonePose(n){return{longitude:n.longitude,latitude:n.latitude,fov:n.fov,offset:n.offset.clone(),distance:n.distance}}function isThirdPersonMode(n){switch(n){case"Floorplan":return!0;case"Mapview":return!0;default:return!1}}function isFristPersonMode(n){switch(n){case"Panorama":return!0;case"VRPanorama":return!0;case"XRPanorama":return!0;case"Model":return!0;default:return!1}}function isEmptyObject(n){for(var t in n)return!1;return!0}/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
1388
1388
|
* http://hammerjs.github.io/
|
|
1389
1389
|
*
|
|
1390
1390
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
1391
1391
|
* Licensed under the MIT license */var Hammer=(function(n,t,e,r){var o=["","webkit","Moz","MS","ms","o"],s=t.createElement?t.createElement("div"):r,u="function",l=Math.round,c=Math.abs,f=Date.now;function p(I,B,k){return setTimeout(y(I,k),B)}function d(I,B,k){return Array.isArray(I)?(h(I,k[B],k),!0):!1}function h(I,B,k){var V;if(I)if(I.forEach)I.forEach(B,k);else if(I.length!==r)for(V=0;V<I.length;)B.call(k,I[V],V,I),V++;else for(V in I)I.hasOwnProperty(V)&&B.call(k,I[V],V,I)}function g(I,B,k){var V="DEPRECATED METHOD: "+B+`
|
|
1392
1392
|
`+k+` AT
|
|
1393
|
-
`;return function(){var $=new Error("get-stack-trace"),ie=$&&$.stack?$.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Ae=n.console&&(n.console.warn||n.console.log);return Ae&&Ae.call(n.console,V,ie),I.apply(this,arguments)}}var A;typeof Object.assign!="function"?A=function(B){if(B===r||B===null)throw new TypeError("Cannot convert undefined or null to object");for(var k=Object(B),V=1;V<arguments.length;V++){var $=arguments[V];if($!==r&&$!==null)for(var ie in $)$.hasOwnProperty(ie)&&(k[ie]=$[ie])}return k}:A=Object.assign;var m=g(function(B,k,V){for(var $=Object.keys(k),ie=0;ie<$.length;)(!V||V&&B[$[ie]]===r)&&(B[$[ie]]=k[$[ie]]),ie++;return B},"extend","Use `assign`."),E=g(function(B,k){return m(B,k,!0)},"merge","Use `assign`.");function v(I,B,k){var V=B.prototype,$;$=I.prototype=Object.create(V),$.constructor=I,$._super=V,k&&A($,k)}function y(I,B){return function(){return I.apply(B,arguments)}}function b(I,B){return typeof I==u?I.apply(B&&B[0]||r,B):I}function T(I,B){return I===r?B:I}function _(I,B,k){h(M(B),function(V){I.addEventListener(V,k,!1)})}function S(I,B,k){h(M(B),function(V){I.removeEventListener(V,k,!1)})}function R(I,B){for(;I;){if(I==B)return!0;I=I.parentNode}return!1}function w(I,B){return I.indexOf(B)>-1}function M(I){return I.trim().split(/\s+/g)}function O(I,B,k){if(I.indexOf&&!k)return I.indexOf(B);for(var V=0;V<I.length;){if(k&&I[V][k]==B||!k&&I[V]===B)return V;V++}return-1}function C(I){return Array.prototype.slice.call(I,0)}function P(I,B,k){for(var V=[],$=[],ie=0;ie<I.length;){var Ae=I[ie][B];O($,Ae)<0&&V.push(I[ie]),$[ie]=Ae,ie++}return V=V.sort(function(ut,ke){return ut[B]>ke[B]}),V}function F(I,B){for(var k,V,$=B[0].toUpperCase()+B.slice(1),ie=0;ie<o.length;){if(k=o[ie],V=k?k+$:B,V in I)return V;ie++}return r}var L=1;function H(){return L++}function N(I){var B=I.ownerDocument||I;return B.defaultView||B.parentWindow||n}var D=/mobile|tablet|ip(ad|hone|od)|android/i,Q="ontouchstart"in n,J=F(n,"PointerEvent")!==r,U=Q&&D.test(navigator.userAgent),z="touch",q="pen",j="mouse",G="kinect",X=25,Y=1,Z=2,W=4,K=8,ne=1,ee=2,te=4,ae=8,fe=16,se=ee|te,he=ae|fe,me=se|he,be=["x","y"],Te=["clientX","clientY"];function ce(I,B){var k=this;this.manager=I,this.callback=B,this.element=I.element,this.target=I.options.inputTarget,this.domHandler=function(V){b(I.options.enable,[I])&&k.handler(V)},this.init()}ce.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(N(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(N(this.element),this.evWin,this.domHandler)}};function pe(I){var B,k=I.options.inputClass;return k?B=k:J?B=Pe:U?B=qe:Q?B=nt:B=Le,new B(I,re)}function re(I,B,k){var V=k.pointers.length,$=k.changedPointers.length,ie=B&Y&&V-$===0,Ae=B&(W|K)&&V-$===0;k.isFirst=!!ie,k.isFinal=!!Ae,ie&&(I.session={}),k.eventType=B,ue(I,k),I.emit("hammer.input",k),I.recognize(k),I.session.prevInput=k}function ue(I,B){var k=I.session,V=B.pointers,$=V.length;k.firstInput||(k.firstInput=De(B)),$>1&&!k.firstMultiple?k.firstMultiple=De(B):$===1&&(k.firstMultiple=!1);var ie=k.firstInput,Ae=k.firstMultiple,Ne=Ae?Ae.center:ie.center,ut=B.center=Je(V);B.timeStamp=f(),B.deltaTime=B.timeStamp-ie.timeStamp,B.angle=Ye(Ne,ut),B.distance=de(Ne,ut),ve(k,B),B.offsetDirection=Ue(B.deltaX,B.deltaY);var ke=$e(B.deltaTime,B.deltaX,B.deltaY);B.overallVelocityX=ke.x,B.overallVelocityY=ke.y,B.overallVelocity=c(ke.x)>c(ke.y)?ke.x:ke.y,B.scale=Ae?Oe(Ae.pointers,V):1,B.rotation=Ae?Ee(Ae.pointers,V):0,B.maxPointers=k.prevInput?B.pointers.length>k.prevInput.maxPointers?B.pointers.length:k.prevInput.maxPointers:B.pointers.length,ye(k,B);var xt=I.element;R(B.srcEvent.target,xt)&&(xt=B.srcEvent.target),B.target=xt}function ve(I,B){var k=B.center,V=I.offsetDelta||{},$=I.prevDelta||{},ie=I.prevInput||{};(B.eventType===Y||ie.eventType===W)&&($=I.prevDelta={x:ie.deltaX||0,y:ie.deltaY||0},V=I.offsetDelta={x:k.x,y:k.y}),B.deltaX=$.x+(k.x-V.x),B.deltaY=$.y+(k.y-V.y)}function ye(I,B){var k=I.lastInterval||B,V=B.timeStamp-k.timeStamp,$,ie,Ae,Ne;if(B.eventType!=K&&(V>X||k.velocity===r)){var ut=B.deltaX-k.deltaX,ke=B.deltaY-k.deltaY,xt=$e(V,ut,ke);ie=xt.x,Ae=xt.y,$=c(xt.x)>c(xt.y)?xt.x:xt.y,Ne=Ue(ut,ke),I.lastInterval=B}else $=k.velocity,ie=k.velocityX,Ae=k.velocityY,Ne=k.direction;B.velocity=$,B.velocityX=ie,B.velocityY=Ae,B.direction=Ne}function De(I){for(var B=[],k=0;k<I.pointers.length;)B[k]={clientX:l(I.pointers[k].clientX),clientY:l(I.pointers[k].clientY)},k++;return{timeStamp:f(),pointers:B,center:Je(B),deltaX:I.deltaX,deltaY:I.deltaY}}function Je(I){var B=I.length;if(B===1)return{x:l(I[0].clientX),y:l(I[0].clientY)};for(var k=0,V=0,$=0;$<B;)k+=I[$].clientX,V+=I[$].clientY,$++;return{x:l(k/B),y:l(V/B)}}function $e(I,B,k){return{x:B/I||0,y:k/I||0}}function Ue(I,B){return I===B?ne:c(I)>=c(B)?I<0?ee:te:B<0?ae:fe}function de(I,B,k){k||(k=be);var V=B[k[0]]-I[k[0]],$=B[k[1]]-I[k[1]];return Math.sqrt(V*V+$*$)}function Ye(I,B,k){k||(k=be);var V=B[k[0]]-I[k[0]],$=B[k[1]]-I[k[1]];return Math.atan2($,V)*180/Math.PI}function Ee(I,B){return Ye(B[1],B[0],Te)+Ye(I[1],I[0],Te)}function Oe(I,B){return de(B[0],B[1],Te)/de(I[0],I[1],Te)}var Fe={mousedown:Y,mousemove:Z,mouseup:W},tt="mousedown",rt="mousemove mouseup";function Le(){this.evEl=tt,this.evWin=rt,this.pressed=!1,ce.apply(this,arguments)}v(Le,ce,{handler:function(B){var k=Fe[B.type];k&Y&&(B.button===0||B.button===2)&&(this.pressed=!0),k&Z&&B.which!==1&&(k=W),this.pressed&&(k&W&&(this.pressed=!1),this.callback(this.manager,k,{pointers:[B],changedPointers:[B],pointerType:j,srcEvent:B}))}});var Ie={pointerdown:Y,pointermove:Z,pointerup:W,pointercancel:K,pointerout:K},He={2:z,3:q,4:j,5:G},ge="pointerdown",we="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(ge="MSPointerDown",we="MSPointerMove MSPointerUp MSPointerCancel");function Pe(){this.evEl=ge,this.evWin=we,ce.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}v(Pe,ce,{handler:function(B){var k=this.store,V=!1,$=!1,ie=B.type.toLowerCase().replace("ms",""),Ae=Ie[ie],Ne=He[B.pointerType]||B.pointerType,ut=Ne==z,ke=O(k,B.pointerId,"pointerId");Ae&Y&&(B.button===0||B.button===2||ut)?ke<0&&(k.push(B),ke=k.length-1):Ae&(W|K)?V=!0:!ut&&B.buttons===0&&(V=!0,$=!0,Ae=Ie.pointerup),!(ke<0)&&($||(k[ke]=B),this.callback(this.manager,Ae,{pointers:k,changedPointers:[B],pointerType:Ne,srcEvent:k[ke]}),V&&k.splice(ke,1))}});var je={touchstart:Y,touchmove:Z,touchend:W,touchcancel:K},Ve="touchstart",Ze="touchstart touchmove touchend touchcancel";function gt(){this.evTarget=Ve,this.evWin=Ze,this.started=!1,ce.apply(this,arguments)}v(gt,ce,{handler:function(B){var k=je[B.type];if(k===Y&&(this.started=!0),!!this.started){var V=Qe.call(this,B,k);k&(W|K)&&V[0].length-V[1].length===0&&(this.started=!1),this.callback(this.manager,k,{pointers:V[0],changedPointers:V[1],pointerType:z,srcEvent:B})}}});function Qe(I,B){var k=C(I.touches),V=C(I.changedTouches);return B&(W|K)&&(k=P(k.concat(V),"identifier")),[k,V]}var At={touchstart:Y,touchmove:Z,touchend:W,touchcancel:K},Re="touchstart touchmove touchend touchcancel";function qe(){this.evTarget=Re,this.targetIds={},ce.apply(this,arguments)}v(qe,ce,{handler:function(B){var k=At[B.type],V=ft.call(this,B,k);V&&this.callback(this.manager,k,{pointers:V[0],changedPointers:V[1],pointerType:z,srcEvent:B})}});function ft(I,B){var k=C(I.touches),V=this.targetIds;if(B&(Y|Z)&&k.length===1)return V[k[0].identifier]=!0,[k,k];var $,ie,Ae=C(I.changedTouches),Ne=[],ut=this.target;if(ie=k.filter(function(ke){return R(ke.target,ut)}),B===Y)for($=0;$<ie.length;)V[ie[$].identifier]=!0,$++;for($=0;$<Ae.length;)V[Ae[$].identifier]&&Ne.push(Ae[$]),B&(W|K)&&delete V[Ae[$].identifier],$++;if(Ne.length)return[P(ie.concat(Ne),"identifier"),Ne]}var dt=2500,Ge=25;function nt(){ce.apply(this,arguments);var I=y(this.handler,this);this.touch=new qe(this.manager,I),this.mouse=new Le(this.manager,I),this.primaryTouch=null,this.lastTouches=[]}v(nt,ce,{handler:function(B,k,V){var $=V.pointerType==z,ie=V.pointerType==j;if(!(ie&&V.sourceCapabilities&&V.sourceCapabilities.firesTouchEvents)){if($)ct.call(this,k,V);else if(ie&&_e.call(this,V))return;this.callback(B,k,V)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function ct(I,B){I&Y?(this.primaryTouch=B.changedPointers[0].identifier,oe.call(this,B)):I&(W|K)&&oe.call(this,B)}function oe(I){var B=I.changedPointers[0];if(B.identifier===this.primaryTouch){var k={x:B.clientX,y:B.clientY};this.lastTouches.push(k);var V=this.lastTouches,$=function(){var ie=V.indexOf(k);ie>-1&&V.splice(ie,1)};setTimeout($,dt)}}function _e(I){for(var B=I.srcEvent.clientX,k=I.srcEvent.clientY,V=0;V<this.lastTouches.length;V++){var $=this.lastTouches[V],ie=Math.abs(B-$.x),Ae=Math.abs(k-$.y);if(ie<=Ge&&Ae<=Ge)return!0}return!1}var Me=s?F(s.style,"touchAction"):r,xe=Me!==r,ze="compute",at="auto",yt="manipulation",ht="none",Ct="pan-x",Mt="pan-y",It=Et();function it(I,B){this.manager=I,this.set(B)}it.prototype={set:function(I){I==ze&&(I=this.compute()),xe&&this.manager.element.style&&It[I]&&(this.manager.element.style[Me]=I),this.actions=I.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var I=[];return h(this.manager.recognizers,function(B){b(B.options.enable,[B])&&(I=I.concat(B.getTouchAction()))}),pt(I.join(" "))},preventDefaults:function(I){var B=I.srcEvent,k=I.offsetDirection;if(this.manager.session.prevented){B.preventDefault();return}var V=this.actions,$=w(V,ht)&&!It[ht],ie=w(V,Mt)&&!It[Mt],Ae=w(V,Ct)&&!It[Ct];if($){var Ne=I.pointers.length===1,ut=I.distance<2,ke=I.deltaTime<250;if(Ne&&ut&&ke)return}if(!(Ae&&ie)&&($||ie&&k&se||Ae&&k&he))return this.preventSrc(B)},preventSrc:function(I){this.manager.session.prevented=!0,I.preventDefault()}};function pt(I){if(w(I,ht))return ht;var B=w(I,Ct),k=w(I,Mt);return B&&k?ht:B||k?B?Ct:Mt:w(I,yt)?yt:at}function Et(){if(!xe)return!1;var I={},B=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(k){I[k]=B?n.CSS.supports("touch-action",k):!0}),I}var Rt=1,ot=2,wt=4,bt=8,vt=bt,St=16,Ke=32;function mt(I){this.options=A({},this.defaults,I||{}),this.id=H(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=Rt,this.simultaneous={},this.requireFail=[]}mt.prototype={defaults:{},set:function(I){return A(this.options,I),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(I){if(d(I,"recognizeWith",this))return this;var B=this.simultaneous;return I=lt(I,this),B[I.id]||(B[I.id]=I,I.recognizeWith(this)),this},dropRecognizeWith:function(I){return d(I,"dropRecognizeWith",this)?this:(I=lt(I,this),delete this.simultaneous[I.id],this)},requireFailure:function(I){if(d(I,"requireFailure",this))return this;var B=this.requireFail;return I=lt(I,this),O(B,I)===-1&&(B.push(I),I.requireFailure(this)),this},dropRequireFailure:function(I){if(d(I,"dropRequireFailure",this))return this;I=lt(I,this);var B=O(this.requireFail,I);return B>-1&&this.requireFail.splice(B,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(I){return!!this.simultaneous[I.id]},emit:function(I){var B=this,k=this.state;function V($){B.manager.emit($,I)}k<bt&&V(B.options.event+Ft(k)),V(B.options.event),I.additionalEvent&&V(I.additionalEvent),k>=bt&&V(B.options.event+Ft(k))},tryEmit:function(I){if(this.canEmit())return this.emit(I);this.state=Ke},canEmit:function(){for(var I=0;I<this.requireFail.length;){if(!(this.requireFail[I].state&(Ke|Rt)))return!1;I++}return!0},recognize:function(I){var B=A({},I);if(!b(this.options.enable,[this,B])){this.reset(),this.state=Ke;return}this.state&(vt|St|Ke)&&(this.state=Rt),this.state=this.process(B),this.state&(ot|wt|bt|St)&&this.tryEmit(B)},process:function(I){},getTouchAction:function(){},reset:function(){}};function Ft(I){return I&St?"cancel":I&bt?"end":I&wt?"move":I&ot?"start":""}function Pt(I){return I==fe?"down":I==ae?"up":I==ee?"left":I==te?"right":""}function lt(I,B){var k=B.manager;return k?k.get(I):I}function We(){mt.apply(this,arguments)}v(We,mt,{defaults:{pointers:1},attrTest:function(I){var B=this.options.pointers;return B===0||I.pointers.length===B},process:function(I){var B=this.state,k=I.eventType,V=B&(ot|wt),$=this.attrTest(I);return V&&(k&K||!$)?B|St:V||$?k&W?B|bt:B&ot?B|wt:ot:Ke}});function Tt(){We.apply(this,arguments),this.pX=null,this.pY=null}v(Tt,We,{defaults:{event:"pan",threshold:10,pointers:1,direction:me},getTouchAction:function(){var I=this.options.direction,B=[];return I&se&&B.push(Mt),I&he&&B.push(Ct),B},directionTest:function(I){var B=this.options,k=!0,V=I.distance,$=I.direction,ie=I.deltaX,Ae=I.deltaY;return $&B.direction||(B.direction&se?($=ie===0?ne:ie<0?ee:te,k=ie!=this.pX,V=Math.abs(I.deltaX)):($=Ae===0?ne:Ae<0?ae:fe,k=Ae!=this.pY,V=Math.abs(I.deltaY))),I.direction=$,k&&V>B.threshold&&$&B.direction},attrTest:function(I){return We.prototype.attrTest.call(this,I)&&(this.state&ot||!(this.state&ot)&&this.directionTest(I))},emit:function(I){this.pX=I.deltaX,this.pY=I.deltaY;var B=Pt(I.direction);B&&(I.additionalEvent=this.options.event+B),this._super.emit.call(this,I)}});function le(){We.apply(this,arguments)}v(le,We,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ht]},attrTest:function(I){return this._super.attrTest.call(this,I)&&(Math.abs(I.scale-1)>this.options.threshold||this.state&ot)},emit:function(I){if(I.scale!==1){var B=I.scale<1?"in":"out";I.additionalEvent=this.options.event+B}this._super.emit.call(this,I)}});function Se(){mt.apply(this,arguments),this._timer=null,this._input=null}v(Se,mt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[at]},process:function(I){var B=this.options,k=I.pointers.length===B.pointers,V=I.distance<B.threshold,$=I.deltaTime>B.time;if(this._input=I,!V||!k||I.eventType&(W|K)&&!$)this.reset();else if(I.eventType&Y)this.reset(),this._timer=p(function(){this.state=vt,this.tryEmit()},B.time,this);else if(I.eventType&W)return vt;return Ke},reset:function(){clearTimeout(this._timer)},emit:function(I){this.state===vt&&(I&&I.eventType&W?this.manager.emit(this.options.event+"up",I):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}});function Ce(){We.apply(this,arguments)}v(Ce,We,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ht]},attrTest:function(I){return this._super.attrTest.call(this,I)&&(Math.abs(I.rotation)>this.options.threshold||this.state&ot)}});function Be(){We.apply(this,arguments)}v(Be,We,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:se|he,pointers:1},getTouchAction:function(){return Tt.prototype.getTouchAction.call(this)},attrTest:function(I){var B=this.options.direction,k;return B&(se|he)?k=I.overallVelocity:B&se?k=I.overallVelocityX:B&he&&(k=I.overallVelocityY),this._super.attrTest.call(this,I)&&B&I.offsetDirection&&I.distance>this.options.threshold&&I.maxPointers==this.options.pointers&&c(k)>this.options.velocity&&I.eventType&W},emit:function(I){var B=Pt(I.offsetDirection);B&&this.manager.emit(this.options.event+B,I),this.manager.emit(this.options.event,I)}});function _t(){mt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}v(_t,mt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[yt]},process:function(I){var B=this.options,k=I.pointers.length===B.pointers,V=I.distance<B.threshold,$=I.deltaTime<B.time;if(this.reset(),I.eventType&Y&&this.count===0)return this.failTimeout();if(V&&$&&k){if(I.eventType!=W)return this.failTimeout();var ie=this.pTime?I.timeStamp-this.pTime<B.interval:!0,Ae=!this.pCenter||de(this.pCenter,I.center)<B.posThreshold;this.pTime=I.timeStamp,this.pCenter=I.center,!Ae||!ie?this.count=1:this.count+=1,this._input=I;var Ne=this.count%B.taps;if(Ne===0)return this.hasRequireFailures()?(this._timer=p(function(){this.state=vt,this.tryEmit()},B.interval,this),ot):vt}return Ke},failTimeout:function(){return this._timer=p(function(){this.state=Ke},this.options.interval,this),Ke},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==vt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Xe(I,B){return B=B||{},B.recognizers=T(B.recognizers,Xe.defaults.preset),new Ht(I,B)}Xe.VERSION="2.0.7",Xe.defaults={domEvents:!1,touchAction:ze,enable:!0,inputTarget:null,inputClass:null,preset:[[Ce,{enable:!1}],[le,{enable:!1},["rotate"]],[Be,{direction:se}],[Tt,{direction:se},["swipe"]],[_t],[_t,{event:"doubletap",taps:2},["tap"]],[Se]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var st=1,Bt=2;function Ht(I,B){this.options=A({},Xe.defaults,B||{}),this.options.inputTarget=this.options.inputTarget||I,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=I,this.input=pe(this),this.touchAction=new it(this,this.options.touchAction),Ot(this,!0),h(this.options.recognizers,function(k){var V=this.add(new k[0](k[1]));k[2]&&V.recognizeWith(k[2]),k[3]&&V.requireFailure(k[3])},this)}Ht.prototype={set:function(I){return A(this.options,I),I.touchAction&&this.touchAction.update(),I.inputTarget&&(this.input.destroy(),this.input.target=I.inputTarget,this.input.init()),this},stop:function(I){this.session.stopped=I?Bt:st},recognize:function(I){var B=this.session;if(!B.stopped){this.touchAction.preventDefaults(I);var k,V=this.recognizers,$=B.curRecognizer;(!$||$&&$.state&vt)&&($=B.curRecognizer=null);for(var ie=0;ie<V.length;)k=V[ie],B.stopped!==Bt&&(!$||k==$||k.canRecognizeWith($))?k.recognize(I):k.reset(),!$&&k.state&(ot|wt|bt)&&($=B.curRecognizer=k),ie++}},get:function(I){if(I instanceof mt)return I;for(var B=this.recognizers,k=0;k<B.length;k++)if(B[k].options.event==I)return B[k];return null},add:function(I){if(d(I,"add",this))return this;var B=this.get(I.options.event);return B&&this.remove(B),this.recognizers.push(I),I.manager=this,this.touchAction.update(),I},remove:function(I){if(d(I,"remove",this))return this;if(I=this.get(I),I){var B=this.recognizers,k=O(B,I);k!==-1&&(B.splice(k,1),this.touchAction.update())}return this},on:function(I,B){if(I!==r&&B!==r){var k=this.handlers;return h(M(I),function(V){k[V]=k[V]||[],k[V].push(B)}),this}},off:function(I,B){if(I!==r){var k=this.handlers;return h(M(I),function(V){B?k[V]&&k[V].splice(O(k[V],B),1):delete k[V]}),this}},emit:function(I,B){this.options.domEvents&&Lt(I,B);var k=this.handlers[I]&&this.handlers[I].slice();if(!(!k||!k.length)){B.type=I,B.preventDefault=function(){B.srcEvent.preventDefault()};for(var V=0;V<k.length;)k[V](B),V++}},destroy:function(){this.element&&Ot(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ot(I,B){var k=I.element;if(k.style){var V;h(I.options.cssProps,function($,ie){V=F(k.style,ie),B?(I.oldCssProps[V]=k.style[V],k.style[V]=$):k.style[V]=I.oldCssProps[V]||""}),B||(I.oldCssProps={})}}function Lt(I,B){var k=t.createEvent("Event");k.initEvent(I,!0,!0),k.gesture=B,B.target.dispatchEvent(k)}return A(Xe,{INPUT_START:Y,INPUT_MOVE:Z,INPUT_END:W,INPUT_CANCEL:K,STATE_POSSIBLE:Rt,STATE_BEGAN:ot,STATE_CHANGED:wt,STATE_ENDED:bt,STATE_RECOGNIZED:vt,STATE_CANCELLED:St,STATE_FAILED:Ke,DIRECTION_NONE:ne,DIRECTION_LEFT:ee,DIRECTION_RIGHT:te,DIRECTION_UP:ae,DIRECTION_DOWN:fe,DIRECTION_HORIZONTAL:se,DIRECTION_VERTICAL:he,DIRECTION_ALL:me,Manager:Ht,Input:ce,TouchAction:it,TouchInput:qe,MouseInput:Le,PointerEventInput:Pe,TouchMouseInput:nt,SingleTouchInput:gt,Recognizer:mt,AttrRecognizer:We,Tap:_t,Pan:Tt,Swipe:Be,Pinch:le,Rotate:Ce,Press:Se,on:_,off:S,each:h,merge:E,extend:m,assign:A,inherit:v,bindFn:y,prefixed:F}),Xe})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{});function calculateThreeMouse(n,t,e){var r=t.getBoundingClientRect(),o=r.top,s=r.left,u=r.width,l=r.height;return e&&(s=s+u*e.left,o=o+l*(1-e.bottom-e.height),u=u*e.width,l=l*e.height),new THREE__namespace.Vector2((n.x-s)/u*2-1,-(n.y-o)/l*2+1)}var BaseController=(function(n){__extends(t,n);function t(e){var r,o,s,u=n.call(this)||this,l=t.parseArgs(e);return u.mode="",u.pending=new Set,u.userAction=l.initial.userAction,u.destroyed=!1,u.ident=l.ident,u.scene=l.scene,u.modelScene=l.modelScene,u.xrCustomObjectsScene=l.xrCustomObjectsScene,u.helper=l.helper,u.boundingMesh=l.boundingMesh,u.camera=l.camera,u.renderer=l.renderer,u.viewport=l.viewport,u.element=l.element,u.enableWheel=l.enableWheel,u.works=l.works,u.imageOptions=l.imageOptions,u.videoTexture=l.videoTexture,u.extraElements=l.extraElements,u.initial=l.initial,u.currentPano=typeof u.initial.state.panoIndex=="number"?{workCode:(s=(r=u.initial.state.workCode)!==null&&r!==void 0?r:(o=l.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:u.initial.state.panoIndex}:{workCode:u.initial.currentState.workCode,panoIndex:u.initial.currentState.panoIndex},u.needsRender=!0,u.modelSceneNeedsRender=!0,u.cameraMotion=new Motion({longitude:{value:u.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:u.camera.pose.latitude,fov:u.camera.pose.fov}),u.inMomentumMovement=null,u.eventUnbinds=[l.element].concat(l.extraElements||[]).map(function(c){return u.bindEvents(c)}),u.initAnimationIsReady=!1,u.pending.add("init-animation"),u.initAnimationReady=new Promise(function(c){AnimationFrameLoop.shared.add(function(){u.initAnimation().then(function(){u.initAnimationIsReady=!0,u.pending.delete("init-animation"),c()})},!0,0)}),u}return t.parseArgs=function(e){return e instanceof t?e:__assign({},e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,p,d=this.parseArgs(e),h=d.initial,g=h.state,A=h.currentState,m=typeof g.panoIndex=="number"?{workCode:(s=(r=g.workCode)!==null&&r!==void 0?r:(o=d.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:g.panoIndex}:{workCode:A.workCode,panoIndex:A.panoIndex};return __assign(__assign({},m),{mode:"",longitude:(u=g.longitude)!==null&&u!==void 0?u:A.longitude,latitude:(l=g.latitude)!==null&&l!==void 0?l:A.latitude,fov:(c=g.fov)!==null&&c!==void 0?c:A.fov,offset:(f=g.offset)!==null&&f!==void 0?f:A.offset,distance:(p=g.distance)!==null&&p!==void 0?p:A.distance})},t.prototype.updateConfiguration=function(e){return!0},t.prototype.destroy=function(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];s()}this.copyEffect&&(this.copyEffect.dispose(),delete this.copyEffect),delete this.panState,(e=this.pressState)===null||e===void 0||e.stop(),delete this.pressState},t.prototype.isReady=function(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0},t.prototype.bindExtraElement=function(e){for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];if(s.element===e)return}this.eventUnbinds.push(this.bindEvents(e))},t.prototype.unbindExtraElement=function(e){for(var r=[],o=0,s=this.eventUnbinds;o<s.length;o++){var u=s[o];u.element===e?u():r.push(u)}this.eventUnbinds=r},t.prototype.updateModel=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0},t.prototype.updateWork=function(e,r,o,s){return this.works=e,this.userAction=s,!1},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={};this.cameraMotion.ended&&(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),isEmptyObject(o)&&this.setCamera(o)}},t.prototype.render=function(e,r){e.render(r)},t.prototype.postProcessing=function(e,r){this.destroyed},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={};return e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),s.cameraMotion.set(u,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=0,c=e;l<c.length;l++){var f=c[l];u.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.value.fov}})}return s.cameraMotion.setKeyframes(u,r)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})},t.prototype.initAnimation=function(){var e=this.initial;e.state,e.currentState,e.duration;var r=e.userAction,o=t.initAnimationEndState(this);return this.userAction=r,this.emit("initAnimation.start",createEvent("initAnimation.start",{state:o,userAction:this.userAction})),this.emit("initAnimation.end",createEvent("initAnimation.end",{state:o,userAction:this.userAction})),Promise.resolve()},t.prototype.setCamera=function(e){var r,o,s,u,l;e===void 0&&(e={});var c=(r=e.longitude)!==null&&r!==void 0?r:this.camera.pose.longitude,f=(o=e.latitude)!==null&&o!==void 0?o:this.camera.pose.latitude,p=(s=e.fov)!==null&&s!==void 0?s:this.camera.pose.fov,d=(u=e.distance)!==null&&u!==void 0?u:this.camera.pose.distance,h=(l=e.offset)!==null&&l!==void 0?l:this.camera.pose.offset,g=notSimilarValue(c,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(f,this.camera.pose.latitude),A=notSimilarValue(p,this.camera.pose.fov),m=notSimilarValue(d,this.camera.pose.distance),E=notSimilarVector3(h,this.camera.pose.offset);(A||g||E||m)&&(this.camera.setFromPose({longitude:c,latitude:f,fov:p,distance:d,offset:h}),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:p,offset:h,distance:d})})),this.needsRender=!0,this.modelSceneNeedsRender=!0)},t.prototype.stopMomentumMovement=function(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){var e=createEvent("gesture.momentum",__assign(__assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit("gesture.momentum",e)}this.inMomentumMovement=null},t.prototype.onPanGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pan",e)},t.prototype.onTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.tap",e)},t.prototype.onDblTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.dbltap",e),!e.defaultPrevented&&(e.type="gesture.tap",this.onTapGesture(e))},t.prototype.onPressGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.press",e)},t.prototype.onPinchGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pinch",e)},t.prototype.onMouseWheel=function(e){this.stopMomentumMovement(),this.emit("gesture.mousewheel",e)},t.prototype.onMouseMove=function(e){this.stopMomentumMovement(),this.emit("gesture.mousemove",e)},t.prototype.relativeClientPosition=function(e){return calculateThreeMouse(e,this.element,this.viewport)},t.prototype.createRaycasterFromCamera=function(e,r){var o=new THREE__namespace.Raycaster;return o.params.Points={threshold:.1},o.firstHitOnly=!0,o.near=r.near,o.far=r.far,o.setFromCamera(e,this.camera),o},t.prototype.bindEvents=function(e){var r=this,o=function(C){var P=calculateThreeMouse(C,r.element,r.viewport);return!(Math.abs(P.x)>1||Math.abs(P.y)>1)},s=new Hammer.Manager(e),u=function(C){var P=C.session;return P.firstInput||null},l=new Hammer.Pan({threshold:10,pointers:0}),c=new Hammer.Tap({interval:410}),f=new Hammer.Pinch({threshold:0,pointers:2});s.add([l,c,f]),s.on("panstart pan",function(C){var P=u(s);if(!(P&&!o(P.center))){var F=createEvent("gesture.pan",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}}),isFirst:C.isFirst,isFinal:C.isFinal,scale:C.scale,center:(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPanGesture(F),b()}}),s.on("tap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var P=u(s);if(!(P&&!o(P.center))){var F=createEvent("gesture.tap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onTapGesture(F),b()}}}),s.on("pinchstart pinch pinchend",function(C){var P=u(s);if(!(P&&!o(P.center))){var F=createEvent("gesture.pinch",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var H,N=r.relativeClientPosition(L),D=new THREE__namespace.Raycaster;return D.params.Points={threshold:.1},D.setFromCamera(N,r.camera),{x:L.x,y:L.y,delta:(H=L.delta)!==null&&H!==void 0?H:0,buttons:0,coords:N,raycaster:D}}),isFirst:C.type==="pinchstart",isFinal:C.type==="pinchend",scale:C.scale,center:(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPinchGesture(F),b()}}),s.on("dbltap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var P=u(s);if(!(P&&!o(P.center))){var F=createEvent("gesture.dbltap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onDblTapGesture(F),b()}}});var p=null,d=null,h=function(C,P,F){var L={x:F.clientX,y:F.clientY},H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera),D=__assign(__assign({},L),{coords:H,raycaster:N,buttons:F.buttons,delta:0}),Q=C==="pinchend"?P:P-F.deltaY/280,J=createEvent("gesture.pinch",{target:F.target,pointerType:"mouse",srcEvent:F,pointers:[__assign({},D)],isFirst:C==="pinchstart",isFinal:C==="pinchend",scale:clamp$1(Q,.1,10),center:__assign({},D),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return J},g=function(C){var P,F={x:C.clientX,y:C.clientY};if(o(F)){if(C.preventDefault(),C.ctrlKey){var L=(P=p==null?void 0:p.prevEvent.scale)!==null&&P!==void 0?P:1,H=h(p?"pinch":"pinchstart",L,C);p===null?p={firstEvent:H,prevEvent:H}:p.prevEvent=H,r.onPinchGesture(H),d!==null&&window.clearTimeout(d),d=window.setTimeout(function(){var q;d=null;var j=(q=p==null?void 0:p.prevEvent.scale)!==null&&q!==void 0?q:1,G=h("pinchend",j,C);p=null,r.onPinchGesture(G)},200)}else{var N=(Math.abs(C.deltaY)>Math.abs(C.deltaX)?C.deltaY:C.deltaX)/-60,D=r.mouseWheelState!==void 0,Q={x:C.clientX,y:C.clientY},J=r.relativeClientPosition(Q),U=r.createRaycasterFromCamera(J,r.camera),z=__assign(__assign({},Q),{coords:J,raycaster:U,buttons:C.buttons,delta:N}),H=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},z)],isFirst:D,isFinal:!1,scale:0,center:__assign({},z),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(H),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout(function(){delete r.mouseWheelState;var j=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign(__assign({},z),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},z),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(j)},100)}}b()}},A=function(C){if(!isMobile){if(!o({x:C.clientX,y:C.clientY})){m();return}var P=!1;r.mouseMoveState||(P=!0);var F={x:C.clientX,y:C.clientY},L=r.relativeClientPosition(F),H=r.createRaycasterFromCamera(L,r.camera),N=__assign(__assign({},F),{coords:L,raycaster:H,buttons:C.buttons,delta:0}),D=createEvent("gesture.mousemove",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},N)],isFirst:P,isFinal:!1,scale:0,center:__assign({},N),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.mouseMoveState={timeStamp:now(),event:D},r.onMouseMove(D),r.pressState&&Math.abs(C.clientX-r.pressState.event.center.y)>10&&Math.abs(C.clientY-r.pressState.event.center.y)>10&&b()}},m=function(){if(r.mouseMoveState){var C=createEvent(r.mouseMoveState.event.type,__assign(__assign({},r.mouseMoveState.event),{isFinal:!0}));delete r.mouseMoveState,r.onMouseMove(C)}b()},E=function(C){if(!o(C.center)){b();return}var P=!1;r.pressState||(P=!0,r.pressState={event:C,timeStamp:now(),stop:noop});var F=now()-r.pressState.timeStamp,L=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{isFirst:P,isFinal:!1,center:__assign(__assign({},r.pressState.event.center),{delta:F}),pointers:r.pressState.event.pointers.map(function(H){return __assign(__assign({},H),{delta:F})})}));r.onPressGesture(L),r.pressState&&(r.pressState.stop=AnimationFrameLoop.shared.add(function(H){E(C)},!0,1))},v=function(C){if(b(),!(C.touches.length>1||C.changedTouches.length<=0)){var P={x:C.changedTouches[0].clientX,y:C.changedTouches[0].clientY},F=r.relativeClientPosition(P),L=r.createRaycasterFromCamera(F,r.camera),H=__assign(__assign({},P),{coords:F,raycaster:L,buttons:0,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"touch",srcEvent:C,pointers:[__assign({},H)],isFirst:!1,isFinal:!1,scale:0,center:H,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});E(N)}},y=function(C){b();var P={x:C.clientX,y:C.clientY},F=r.relativeClientPosition(P),L=r.createRaycasterFromCamera(F,r.camera),H=__assign(__assign({},P),{coords:F,raycaster:L,buttons:C.buttons,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},H)],isFirst:!1,isFinal:!1,scale:0,center:H,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});E(N)},b=function(){var C;if(r.pressState){var P=now()-r.pressState.timeStamp,F=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{center:__assign(__assign({},r.pressState.event.center),{delta:P}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map(function(L){return __assign(__assign({},L),{delta:P})})}));r.onPressGesture(F),(C=r.pressState)===null||C===void 0||C.stop(),delete r.pressState}},T=null,_=function(C){var P,F=!1,L=!1;switch(C.type){case"gesturestart":F=!0;break;case"gestureend":L=!0;break}var H={x:C.clientX,y:C.clientY},N=r.relativeClientPosition(H),D=r.createRaycasterFromCamera(N,r.camera),Q=__assign(__assign({},H),{coords:N,raycaster:D,buttons:0,delta:0}),J=createEvent("gesture.pinch",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},Q)],isFirst:F,isFinal:L,scale:(P=C.scale)!==null&&P!==void 0?P:1,center:__assign({},Q),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return J},S=function(C){if(C.preventDefault(),!isMobile){var P=_(C);T={firstEvent:P};var F=T.firstEvent;F&&!o(F.center)||r.onPinchGesture(P)}},R=function(C){if(C.preventDefault(),!isMobile&&T){var P=_(C),F=T.firstEvent;F&&!o(F.center)||r.onPinchGesture(P)}},w=function(C){if(C.preventDefault(),!isMobile&&T){var P=_(C),F=T.firstEvent;T=null,!(F&&!o(F.center))&&r.onPinchGesture(P)}},M=function(C){if(C&&typeof C.preventDefault=="function"&&C.currentTarget===e&&C.preventDefault(),typeof getSelection=="function"){var P=getSelection();P&&P.focusNode&&(P.removeAllRanges&&P.removeAllRanges(),P.empty&&P.empty())}};this.enableWheel&&e.addEventListener("wheel",g,{passive:!1}),e.addEventListener("mousemove",A,!1),e.addEventListener("mouseout",m,!1),e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchend",b,!1),e.addEventListener("touchcancel",b,!1),e.addEventListener("mousedown",y,!1),e.addEventListener("mouseup",b,!1),e.addEventListener("gesturestart",S,{passive:!1}),e.addEventListener("gesturechange",R,{passive:!1}),e.addEventListener("gestureend",w,{passive:!1}),e.addEventListener("touchstart",M,{passive:!1}),e.addEventListener("contextmenu",M,!1);var O=function(){s.destroy(),e.removeEventListener("wheel",g,!1),e.removeEventListener("mousemove",A,!1),e.removeEventListener("mouseout",m,!1),e.removeEventListener("touchstart",v,!1),e.removeEventListener("touchend",b,!1),e.removeEventListener("touchcancel",b,!1),e.removeEventListener("mousedown",y,!1),e.removeEventListener("mouseup",b,!1),e.removeEventListener("gesturestart",S,!1),e.removeEventListener("gesturechange",R,!1),e.removeEventListener("gestureend",w,!1),e.removeEventListener("touchstart",M,!1),e.removeEventListener("contextmenu",M,!1)};return Object.assign(O,{element:e})},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop);var s=this.works.getObserver(e);if(!s)return Promise.resolve();var u=["right","left","up","down","front","back"];return Promise.all(u.map(function(l){var c=__assign({key:"pano.".concat(panoStringify(e),".").concat(l)},pick(o.imageOptions,["size","format","quality","mappings"])),f=s.work.getURL(s.images[l]),p=applyImageURLOptions(f,o.imageOptions.transform,c);return getFetcher(s.work).preload(p,{timeout:500})})).then(function(){return r(e),e})},t})(Subscribe),sharedGeometry$2=new THREE__namespace.CircleBufferGeometry(.1,16),vertexShader$3=`
|
|
1393
|
+
`;return function(){var $=new Error("get-stack-trace"),ie=$&&$.stack?$.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",ye=n.console&&(n.console.warn||n.console.log);return ye&&ye.call(n.console,V,ie),I.apply(this,arguments)}}var A;typeof Object.assign!="function"?A=function(B){if(B===r||B===null)throw new TypeError("Cannot convert undefined or null to object");for(var k=Object(B),V=1;V<arguments.length;V++){var $=arguments[V];if($!==r&&$!==null)for(var ie in $)$.hasOwnProperty(ie)&&(k[ie]=$[ie])}return k}:A=Object.assign;var m=g(function(B,k,V){for(var $=Object.keys(k),ie=0;ie<$.length;)(!V||V&&B[$[ie]]===r)&&(B[$[ie]]=k[$[ie]]),ie++;return B},"extend","Use `assign`."),E=g(function(B,k){return m(B,k,!0)},"merge","Use `assign`.");function v(I,B,k){var V=B.prototype,$;$=I.prototype=Object.create(V),$.constructor=I,$._super=V,k&&A($,k)}function y(I,B){return function(){return I.apply(B,arguments)}}function b(I,B){return typeof I==u?I.apply(B&&B[0]||r,B):I}function T(I,B){return I===r?B:I}function _(I,B,k){h(M(B),function(V){I.addEventListener(V,k,!1)})}function S(I,B,k){h(M(B),function(V){I.removeEventListener(V,k,!1)})}function R(I,B){for(;I;){if(I==B)return!0;I=I.parentNode}return!1}function w(I,B){return I.indexOf(B)>-1}function M(I){return I.trim().split(/\s+/g)}function O(I,B,k){if(I.indexOf&&!k)return I.indexOf(B);for(var V=0;V<I.length;){if(k&&I[V][k]==B||!k&&I[V]===B)return V;V++}return-1}function C(I){return Array.prototype.slice.call(I,0)}function P(I,B,k){for(var V=[],$=[],ie=0;ie<I.length;){var ye=I[ie][B];O($,ye)<0&&V.push(I[ie]),$[ie]=ye,ie++}return V=V.sort(function(ut,De){return ut[B]>De[B]}),V}function F(I,B){for(var k,V,$=B[0].toUpperCase()+B.slice(1),ie=0;ie<o.length;){if(k=o[ie],V=k?k+$:B,V in I)return V;ie++}return r}var L=1;function H(){return L++}function N(I){var B=I.ownerDocument||I;return B.defaultView||B.parentWindow||n}var D=/mobile|tablet|ip(ad|hone|od)|android/i,Q="ontouchstart"in n,J=F(n,"PointerEvent")!==r,U=Q&&D.test(navigator.userAgent),z="touch",q="pen",j="mouse",G="kinect",X=25,Y=1,Z=2,W=4,K=8,ne=1,ee=2,te=4,ae=8,fe=16,se=ee|te,he=ae|fe,me=se|he,be=["x","y"],Te=["clientX","clientY"];function ce(I,B){var k=this;this.manager=I,this.callback=B,this.element=I.element,this.target=I.options.inputTarget,this.domHandler=function(V){b(I.options.enable,[I])&&k.handler(V)},this.init()}ce.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(N(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(N(this.element),this.evWin,this.domHandler)}};function pe(I){var B,k=I.options.inputClass;return k?B=k:J?B=Pe:U?B=Ue:Q?B=nt:B=Ne,new B(I,re)}function re(I,B,k){var V=k.pointers.length,$=k.changedPointers.length,ie=B&Y&&V-$===0,ye=B&(W|K)&&V-$===0;k.isFirst=!!ie,k.isFinal=!!ye,ie&&(I.session={}),k.eventType=B,ue(I,k),I.emit("hammer.input",k),I.recognize(k),I.session.prevInput=k}function ue(I,B){var k=I.session,V=B.pointers,$=V.length;k.firstInput||(k.firstInput=Le(B)),$>1&&!k.firstMultiple?k.firstMultiple=Le(B):$===1&&(k.firstMultiple=!1);var ie=k.firstInput,ye=k.firstMultiple,ke=ye?ye.center:ie.center,ut=B.center=qe(V);B.timeStamp=f(),B.deltaTime=B.timeStamp-ie.timeStamp,B.angle=Ye(ke,ut),B.distance=de(ke,ut),ve(k,B),B.offsetDirection=Ve(B.deltaX,B.deltaY);var De=$e(B.deltaTime,B.deltaX,B.deltaY);B.overallVelocityX=De.x,B.overallVelocityY=De.y,B.overallVelocity=c(De.x)>c(De.y)?De.x:De.y,B.scale=ye?Oe(ye.pointers,V):1,B.rotation=ye?Ee(ye.pointers,V):0,B.maxPointers=k.prevInput?B.pointers.length>k.prevInput.maxPointers?B.pointers.length:k.prevInput.maxPointers:B.pointers.length,ge(k,B);var xt=I.element;R(B.srcEvent.target,xt)&&(xt=B.srcEvent.target),B.target=xt}function ve(I,B){var k=B.center,V=I.offsetDelta||{},$=I.prevDelta||{},ie=I.prevInput||{};(B.eventType===Y||ie.eventType===W)&&($=I.prevDelta={x:ie.deltaX||0,y:ie.deltaY||0},V=I.offsetDelta={x:k.x,y:k.y}),B.deltaX=$.x+(k.x-V.x),B.deltaY=$.y+(k.y-V.y)}function ge(I,B){var k=I.lastInterval||B,V=B.timeStamp-k.timeStamp,$,ie,ye,ke;if(B.eventType!=K&&(V>X||k.velocity===r)){var ut=B.deltaX-k.deltaX,De=B.deltaY-k.deltaY,xt=$e(V,ut,De);ie=xt.x,ye=xt.y,$=c(xt.x)>c(xt.y)?xt.x:xt.y,ke=Ve(ut,De),I.lastInterval=B}else $=k.velocity,ie=k.velocityX,ye=k.velocityY,ke=k.direction;B.velocity=$,B.velocityX=ie,B.velocityY=ye,B.direction=ke}function Le(I){for(var B=[],k=0;k<I.pointers.length;)B[k]={clientX:l(I.pointers[k].clientX),clientY:l(I.pointers[k].clientY)},k++;return{timeStamp:f(),pointers:B,center:qe(B),deltaX:I.deltaX,deltaY:I.deltaY}}function qe(I){var B=I.length;if(B===1)return{x:l(I[0].clientX),y:l(I[0].clientY)};for(var k=0,V=0,$=0;$<B;)k+=I[$].clientX,V+=I[$].clientY,$++;return{x:l(k/B),y:l(V/B)}}function $e(I,B,k){return{x:B/I||0,y:k/I||0}}function Ve(I,B){return I===B?ne:c(I)>=c(B)?I<0?ee:te:B<0?ae:fe}function de(I,B,k){k||(k=be);var V=B[k[0]]-I[k[0]],$=B[k[1]]-I[k[1]];return Math.sqrt(V*V+$*$)}function Ye(I,B,k){k||(k=be);var V=B[k[0]]-I[k[0]],$=B[k[1]]-I[k[1]];return Math.atan2($,V)*180/Math.PI}function Ee(I,B){return Ye(B[1],B[0],Te)+Ye(I[1],I[0],Te)}function Oe(I,B){return de(B[0],B[1],Te)/de(I[0],I[1],Te)}var Fe={mousedown:Y,mousemove:Z,mouseup:W},tt="mousedown",rt="mousemove mouseup";function Ne(){this.evEl=tt,this.evWin=rt,this.pressed=!1,ce.apply(this,arguments)}v(Ne,ce,{handler:function(B){var k=Fe[B.type];k&Y&&(B.button===0||B.button===2)&&(this.pressed=!0),k&Z&&B.which!==1&&(k=W),this.pressed&&(k&W&&(this.pressed=!1),this.callback(this.manager,k,{pointers:[B],changedPointers:[B],pointerType:j,srcEvent:B}))}});var Ie={pointerdown:Y,pointermove:Z,pointerup:W,pointercancel:K,pointerout:K},He={2:z,3:q,4:j,5:G},Ae="pointerdown",we="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(Ae="MSPointerDown",we="MSPointerMove MSPointerUp MSPointerCancel");function Pe(){this.evEl=Ae,this.evWin=we,ce.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}v(Pe,ce,{handler:function(B){var k=this.store,V=!1,$=!1,ie=B.type.toLowerCase().replace("ms",""),ye=Ie[ie],ke=He[B.pointerType]||B.pointerType,ut=ke==z,De=O(k,B.pointerId,"pointerId");ye&Y&&(B.button===0||B.button===2||ut)?De<0&&(k.push(B),De=k.length-1):ye&(W|K)?V=!0:!ut&&B.buttons===0&&(V=!0,$=!0,ye=Ie.pointerup),!(De<0)&&($||(k[De]=B),this.callback(this.manager,ye,{pointers:k,changedPointers:[B],pointerType:ke,srcEvent:k[De]}),V&&k.splice(De,1))}});var je={touchstart:Y,touchmove:Z,touchend:W,touchcancel:K},Qe="touchstart",Ze="touchstart touchmove touchend touchcancel";function gt(){this.evTarget=Qe,this.evWin=Ze,this.started=!1,ce.apply(this,arguments)}v(gt,ce,{handler:function(B){var k=je[B.type];if(k===Y&&(this.started=!0),!!this.started){var V=Je.call(this,B,k);k&(W|K)&&V[0].length-V[1].length===0&&(this.started=!1),this.callback(this.manager,k,{pointers:V[0],changedPointers:V[1],pointerType:z,srcEvent:B})}}});function Je(I,B){var k=C(I.touches),V=C(I.changedTouches);return B&(W|K)&&(k=P(k.concat(V),"identifier")),[k,V]}var At={touchstart:Y,touchmove:Z,touchend:W,touchcancel:K},Re="touchstart touchmove touchend touchcancel";function Ue(){this.evTarget=Re,this.targetIds={},ce.apply(this,arguments)}v(Ue,ce,{handler:function(B){var k=At[B.type],V=ft.call(this,B,k);V&&this.callback(this.manager,k,{pointers:V[0],changedPointers:V[1],pointerType:z,srcEvent:B})}});function ft(I,B){var k=C(I.touches),V=this.targetIds;if(B&(Y|Z)&&k.length===1)return V[k[0].identifier]=!0,[k,k];var $,ie,ye=C(I.changedTouches),ke=[],ut=this.target;if(ie=k.filter(function(De){return R(De.target,ut)}),B===Y)for($=0;$<ie.length;)V[ie[$].identifier]=!0,$++;for($=0;$<ye.length;)V[ye[$].identifier]&&ke.push(ye[$]),B&(W|K)&&delete V[ye[$].identifier],$++;if(ke.length)return[P(ie.concat(ke),"identifier"),ke]}var dt=2500,Ge=25;function nt(){ce.apply(this,arguments);var I=y(this.handler,this);this.touch=new Ue(this.manager,I),this.mouse=new Ne(this.manager,I),this.primaryTouch=null,this.lastTouches=[]}v(nt,ce,{handler:function(B,k,V){var $=V.pointerType==z,ie=V.pointerType==j;if(!(ie&&V.sourceCapabilities&&V.sourceCapabilities.firesTouchEvents)){if($)ct.call(this,k,V);else if(ie&&_e.call(this,V))return;this.callback(B,k,V)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function ct(I,B){I&Y?(this.primaryTouch=B.changedPointers[0].identifier,oe.call(this,B)):I&(W|K)&&oe.call(this,B)}function oe(I){var B=I.changedPointers[0];if(B.identifier===this.primaryTouch){var k={x:B.clientX,y:B.clientY};this.lastTouches.push(k);var V=this.lastTouches,$=function(){var ie=V.indexOf(k);ie>-1&&V.splice(ie,1)};setTimeout($,dt)}}function _e(I){for(var B=I.srcEvent.clientX,k=I.srcEvent.clientY,V=0;V<this.lastTouches.length;V++){var $=this.lastTouches[V],ie=Math.abs(B-$.x),ye=Math.abs(k-$.y);if(ie<=Ge&&ye<=Ge)return!0}return!1}var Me=s?F(s.style,"touchAction"):r,xe=Me!==r,ze="compute",at="auto",yt="manipulation",ht="none",Ct="pan-x",Mt="pan-y",It=Et();function it(I,B){this.manager=I,this.set(B)}it.prototype={set:function(I){I==ze&&(I=this.compute()),xe&&this.manager.element.style&&It[I]&&(this.manager.element.style[Me]=I),this.actions=I.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var I=[];return h(this.manager.recognizers,function(B){b(B.options.enable,[B])&&(I=I.concat(B.getTouchAction()))}),pt(I.join(" "))},preventDefaults:function(I){var B=I.srcEvent,k=I.offsetDirection;if(this.manager.session.prevented){B.preventDefault();return}var V=this.actions,$=w(V,ht)&&!It[ht],ie=w(V,Mt)&&!It[Mt],ye=w(V,Ct)&&!It[Ct];if($){var ke=I.pointers.length===1,ut=I.distance<2,De=I.deltaTime<250;if(ke&&ut&&De)return}if(!(ye&&ie)&&($||ie&&k&se||ye&&k&he))return this.preventSrc(B)},preventSrc:function(I){this.manager.session.prevented=!0,I.preventDefault()}};function pt(I){if(w(I,ht))return ht;var B=w(I,Ct),k=w(I,Mt);return B&&k?ht:B||k?B?Ct:Mt:w(I,yt)?yt:at}function Et(){if(!xe)return!1;var I={},B=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(k){I[k]=B?n.CSS.supports("touch-action",k):!0}),I}var Rt=1,ot=2,wt=4,bt=8,vt=bt,St=16,Ke=32;function mt(I){this.options=A({},this.defaults,I||{}),this.id=H(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=Rt,this.simultaneous={},this.requireFail=[]}mt.prototype={defaults:{},set:function(I){return A(this.options,I),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(I){if(d(I,"recognizeWith",this))return this;var B=this.simultaneous;return I=lt(I,this),B[I.id]||(B[I.id]=I,I.recognizeWith(this)),this},dropRecognizeWith:function(I){return d(I,"dropRecognizeWith",this)?this:(I=lt(I,this),delete this.simultaneous[I.id],this)},requireFailure:function(I){if(d(I,"requireFailure",this))return this;var B=this.requireFail;return I=lt(I,this),O(B,I)===-1&&(B.push(I),I.requireFailure(this)),this},dropRequireFailure:function(I){if(d(I,"dropRequireFailure",this))return this;I=lt(I,this);var B=O(this.requireFail,I);return B>-1&&this.requireFail.splice(B,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(I){return!!this.simultaneous[I.id]},emit:function(I){var B=this,k=this.state;function V($){B.manager.emit($,I)}k<bt&&V(B.options.event+Ft(k)),V(B.options.event),I.additionalEvent&&V(I.additionalEvent),k>=bt&&V(B.options.event+Ft(k))},tryEmit:function(I){if(this.canEmit())return this.emit(I);this.state=Ke},canEmit:function(){for(var I=0;I<this.requireFail.length;){if(!(this.requireFail[I].state&(Ke|Rt)))return!1;I++}return!0},recognize:function(I){var B=A({},I);if(!b(this.options.enable,[this,B])){this.reset(),this.state=Ke;return}this.state&(vt|St|Ke)&&(this.state=Rt),this.state=this.process(B),this.state&(ot|wt|bt|St)&&this.tryEmit(B)},process:function(I){},getTouchAction:function(){},reset:function(){}};function Ft(I){return I&St?"cancel":I&bt?"end":I&wt?"move":I&ot?"start":""}function Pt(I){return I==fe?"down":I==ae?"up":I==ee?"left":I==te?"right":""}function lt(I,B){var k=B.manager;return k?k.get(I):I}function We(){mt.apply(this,arguments)}v(We,mt,{defaults:{pointers:1},attrTest:function(I){var B=this.options.pointers;return B===0||I.pointers.length===B},process:function(I){var B=this.state,k=I.eventType,V=B&(ot|wt),$=this.attrTest(I);return V&&(k&K||!$)?B|St:V||$?k&W?B|bt:B&ot?B|wt:ot:Ke}});function Tt(){We.apply(this,arguments),this.pX=null,this.pY=null}v(Tt,We,{defaults:{event:"pan",threshold:10,pointers:1,direction:me},getTouchAction:function(){var I=this.options.direction,B=[];return I&se&&B.push(Mt),I&he&&B.push(Ct),B},directionTest:function(I){var B=this.options,k=!0,V=I.distance,$=I.direction,ie=I.deltaX,ye=I.deltaY;return $&B.direction||(B.direction&se?($=ie===0?ne:ie<0?ee:te,k=ie!=this.pX,V=Math.abs(I.deltaX)):($=ye===0?ne:ye<0?ae:fe,k=ye!=this.pY,V=Math.abs(I.deltaY))),I.direction=$,k&&V>B.threshold&&$&B.direction},attrTest:function(I){return We.prototype.attrTest.call(this,I)&&(this.state&ot||!(this.state&ot)&&this.directionTest(I))},emit:function(I){this.pX=I.deltaX,this.pY=I.deltaY;var B=Pt(I.direction);B&&(I.additionalEvent=this.options.event+B),this._super.emit.call(this,I)}});function le(){We.apply(this,arguments)}v(le,We,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ht]},attrTest:function(I){return this._super.attrTest.call(this,I)&&(Math.abs(I.scale-1)>this.options.threshold||this.state&ot)},emit:function(I){if(I.scale!==1){var B=I.scale<1?"in":"out";I.additionalEvent=this.options.event+B}this._super.emit.call(this,I)}});function Se(){mt.apply(this,arguments),this._timer=null,this._input=null}v(Se,mt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[at]},process:function(I){var B=this.options,k=I.pointers.length===B.pointers,V=I.distance<B.threshold,$=I.deltaTime>B.time;if(this._input=I,!V||!k||I.eventType&(W|K)&&!$)this.reset();else if(I.eventType&Y)this.reset(),this._timer=p(function(){this.state=vt,this.tryEmit()},B.time,this);else if(I.eventType&W)return vt;return Ke},reset:function(){clearTimeout(this._timer)},emit:function(I){this.state===vt&&(I&&I.eventType&W?this.manager.emit(this.options.event+"up",I):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}});function Ce(){We.apply(this,arguments)}v(Ce,We,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ht]},attrTest:function(I){return this._super.attrTest.call(this,I)&&(Math.abs(I.rotation)>this.options.threshold||this.state&ot)}});function Be(){We.apply(this,arguments)}v(Be,We,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:se|he,pointers:1},getTouchAction:function(){return Tt.prototype.getTouchAction.call(this)},attrTest:function(I){var B=this.options.direction,k;return B&(se|he)?k=I.overallVelocity:B&se?k=I.overallVelocityX:B&he&&(k=I.overallVelocityY),this._super.attrTest.call(this,I)&&B&I.offsetDirection&&I.distance>this.options.threshold&&I.maxPointers==this.options.pointers&&c(k)>this.options.velocity&&I.eventType&W},emit:function(I){var B=Pt(I.offsetDirection);B&&this.manager.emit(this.options.event+B,I),this.manager.emit(this.options.event,I)}});function _t(){mt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}v(_t,mt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[yt]},process:function(I){var B=this.options,k=I.pointers.length===B.pointers,V=I.distance<B.threshold,$=I.deltaTime<B.time;if(this.reset(),I.eventType&Y&&this.count===0)return this.failTimeout();if(V&&$&&k){if(I.eventType!=W)return this.failTimeout();var ie=this.pTime?I.timeStamp-this.pTime<B.interval:!0,ye=!this.pCenter||de(this.pCenter,I.center)<B.posThreshold;this.pTime=I.timeStamp,this.pCenter=I.center,!ye||!ie?this.count=1:this.count+=1,this._input=I;var ke=this.count%B.taps;if(ke===0)return this.hasRequireFailures()?(this._timer=p(function(){this.state=vt,this.tryEmit()},B.interval,this),ot):vt}return Ke},failTimeout:function(){return this._timer=p(function(){this.state=Ke},this.options.interval,this),Ke},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==vt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Xe(I,B){return B=B||{},B.recognizers=T(B.recognizers,Xe.defaults.preset),new Ht(I,B)}Xe.VERSION="2.0.7",Xe.defaults={domEvents:!1,touchAction:ze,enable:!0,inputTarget:null,inputClass:null,preset:[[Ce,{enable:!1}],[le,{enable:!1},["rotate"]],[Be,{direction:se}],[Tt,{direction:se},["swipe"]],[_t],[_t,{event:"doubletap",taps:2},["tap"]],[Se]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var st=1,Bt=2;function Ht(I,B){this.options=A({},Xe.defaults,B||{}),this.options.inputTarget=this.options.inputTarget||I,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=I,this.input=pe(this),this.touchAction=new it(this,this.options.touchAction),Ot(this,!0),h(this.options.recognizers,function(k){var V=this.add(new k[0](k[1]));k[2]&&V.recognizeWith(k[2]),k[3]&&V.requireFailure(k[3])},this)}Ht.prototype={set:function(I){return A(this.options,I),I.touchAction&&this.touchAction.update(),I.inputTarget&&(this.input.destroy(),this.input.target=I.inputTarget,this.input.init()),this},stop:function(I){this.session.stopped=I?Bt:st},recognize:function(I){var B=this.session;if(!B.stopped){this.touchAction.preventDefaults(I);var k,V=this.recognizers,$=B.curRecognizer;(!$||$&&$.state&vt)&&($=B.curRecognizer=null);for(var ie=0;ie<V.length;)k=V[ie],B.stopped!==Bt&&(!$||k==$||k.canRecognizeWith($))?k.recognize(I):k.reset(),!$&&k.state&(ot|wt|bt)&&($=B.curRecognizer=k),ie++}},get:function(I){if(I instanceof mt)return I;for(var B=this.recognizers,k=0;k<B.length;k++)if(B[k].options.event==I)return B[k];return null},add:function(I){if(d(I,"add",this))return this;var B=this.get(I.options.event);return B&&this.remove(B),this.recognizers.push(I),I.manager=this,this.touchAction.update(),I},remove:function(I){if(d(I,"remove",this))return this;if(I=this.get(I),I){var B=this.recognizers,k=O(B,I);k!==-1&&(B.splice(k,1),this.touchAction.update())}return this},on:function(I,B){if(I!==r&&B!==r){var k=this.handlers;return h(M(I),function(V){k[V]=k[V]||[],k[V].push(B)}),this}},off:function(I,B){if(I!==r){var k=this.handlers;return h(M(I),function(V){B?k[V]&&k[V].splice(O(k[V],B),1):delete k[V]}),this}},emit:function(I,B){this.options.domEvents&&Lt(I,B);var k=this.handlers[I]&&this.handlers[I].slice();if(!(!k||!k.length)){B.type=I,B.preventDefault=function(){B.srcEvent.preventDefault()};for(var V=0;V<k.length;)k[V](B),V++}},destroy:function(){this.element&&Ot(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ot(I,B){var k=I.element;if(k.style){var V;h(I.options.cssProps,function($,ie){V=F(k.style,ie),B?(I.oldCssProps[V]=k.style[V],k.style[V]=$):k.style[V]=I.oldCssProps[V]||""}),B||(I.oldCssProps={})}}function Lt(I,B){var k=t.createEvent("Event");k.initEvent(I,!0,!0),k.gesture=B,B.target.dispatchEvent(k)}return A(Xe,{INPUT_START:Y,INPUT_MOVE:Z,INPUT_END:W,INPUT_CANCEL:K,STATE_POSSIBLE:Rt,STATE_BEGAN:ot,STATE_CHANGED:wt,STATE_ENDED:bt,STATE_RECOGNIZED:vt,STATE_CANCELLED:St,STATE_FAILED:Ke,DIRECTION_NONE:ne,DIRECTION_LEFT:ee,DIRECTION_RIGHT:te,DIRECTION_UP:ae,DIRECTION_DOWN:fe,DIRECTION_HORIZONTAL:se,DIRECTION_VERTICAL:he,DIRECTION_ALL:me,Manager:Ht,Input:ce,TouchAction:it,TouchInput:Ue,MouseInput:Ne,PointerEventInput:Pe,TouchMouseInput:nt,SingleTouchInput:gt,Recognizer:mt,AttrRecognizer:We,Tap:_t,Pan:Tt,Swipe:Be,Pinch:le,Rotate:Ce,Press:Se,on:_,off:S,each:h,merge:E,extend:m,assign:A,inherit:v,bindFn:y,prefixed:F}),Xe})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{});function calculateThreeMouse(n,t,e){var r=t.getBoundingClientRect(),o=r.top,s=r.left,u=r.width,l=r.height;return e&&(s=s+u*e.left,o=o+l*(1-e.bottom-e.height),u=u*e.width,l=l*e.height),new THREE__namespace.Vector2((n.x-s)/u*2-1,-(n.y-o)/l*2+1)}var BaseController=(function(n){__extends(t,n);function t(e){var r,o,s,u=n.call(this)||this,l=t.parseArgs(e);return u.mode="",u.pending=new Set,u.userAction=l.initial.userAction,u.destroyed=!1,u.ident=l.ident,u.scene=l.scene,u.modelScene=l.modelScene,u.xrCustomObjectsScene=l.xrCustomObjectsScene,u.helper=l.helper,u.boundingMesh=l.boundingMesh,u.camera=l.camera,u.renderer=l.renderer,u.viewport=l.viewport,u.element=l.element,u.enableWheel=l.enableWheel,u.works=l.works,u.imageOptions=l.imageOptions,u.videoTexture=l.videoTexture,u.extraElements=l.extraElements,u.initial=l.initial,u.currentPano=typeof u.initial.state.panoIndex=="number"?{workCode:(s=(r=u.initial.state.workCode)!==null&&r!==void 0?r:(o=l.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:u.initial.state.panoIndex}:{workCode:u.initial.currentState.workCode,panoIndex:u.initial.currentState.panoIndex},u.needsRender=!0,u.modelSceneNeedsRender=!0,u.cameraMotion=new Motion({longitude:{value:u.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:u.camera.pose.latitude,fov:u.camera.pose.fov}),u.inMomentumMovement=null,u.eventUnbinds=[l.element].concat(l.extraElements||[]).map(function(c){return u.bindEvents(c)}),u.initAnimationIsReady=!1,u.pending.add("init-animation"),u.initAnimationReady=new Promise(function(c){AnimationFrameLoop.shared.add(function(){u.initAnimation().then(function(){u.initAnimationIsReady=!0,u.pending.delete("init-animation"),c()})},!0,0)}),u}return t.parseArgs=function(e){return e instanceof t?e:__assign({},e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,p,d=this.parseArgs(e),h=d.initial,g=h.state,A=h.currentState,m=typeof g.panoIndex=="number"?{workCode:(s=(r=g.workCode)!==null&&r!==void 0?r:(o=d.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:g.panoIndex}:{workCode:A.workCode,panoIndex:A.panoIndex};return __assign(__assign({},m),{mode:"",longitude:(u=g.longitude)!==null&&u!==void 0?u:A.longitude,latitude:(l=g.latitude)!==null&&l!==void 0?l:A.latitude,fov:(c=g.fov)!==null&&c!==void 0?c:A.fov,offset:(f=g.offset)!==null&&f!==void 0?f:A.offset,distance:(p=g.distance)!==null&&p!==void 0?p:A.distance})},t.prototype.updateConfiguration=function(e){return!0},t.prototype.destroy=function(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];s()}this.copyEffect&&(this.copyEffect.dispose(),delete this.copyEffect),delete this.panState,(e=this.pressState)===null||e===void 0||e.stop(),delete this.pressState},t.prototype.isReady=function(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0},t.prototype.bindExtraElement=function(e){for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];if(s.element===e)return}this.eventUnbinds.push(this.bindEvents(e))},t.prototype.unbindExtraElement=function(e){for(var r=[],o=0,s=this.eventUnbinds;o<s.length;o++){var u=s[o];u.element===e?u():r.push(u)}this.eventUnbinds=r},t.prototype.updateModel=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0},t.prototype.updateWork=function(e,r,o,s){return this.works=e,this.userAction=s,!1},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={};this.cameraMotion.ended&&(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),isEmptyObject(o)&&this.setCamera(o)}},t.prototype.render=function(e,r){e.render(r)},t.prototype.postProcessing=function(e,r){this.destroyed},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={};return e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),s.cameraMotion.set(u,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=0,c=e;l<c.length;l++){var f=c[l];u.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.value.fov}})}return s.cameraMotion.setKeyframes(u,r)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})},t.prototype.initAnimation=function(){var e=this.initial;e.state,e.currentState,e.duration;var r=e.userAction,o=t.initAnimationEndState(this);return this.userAction=r,this.emit("initAnimation.start",createEvent("initAnimation.start",{state:o,userAction:this.userAction})),this.emit("initAnimation.end",createEvent("initAnimation.end",{state:o,userAction:this.userAction})),Promise.resolve()},t.prototype.setCamera=function(e){var r,o,s,u,l;e===void 0&&(e={});var c=(r=e.longitude)!==null&&r!==void 0?r:this.camera.pose.longitude,f=(o=e.latitude)!==null&&o!==void 0?o:this.camera.pose.latitude,p=(s=e.fov)!==null&&s!==void 0?s:this.camera.pose.fov,d=(u=e.distance)!==null&&u!==void 0?u:this.camera.pose.distance,h=(l=e.offset)!==null&&l!==void 0?l:this.camera.pose.offset,g=notSimilarValue(c,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(f,this.camera.pose.latitude),A=notSimilarValue(p,this.camera.pose.fov),m=notSimilarValue(d,this.camera.pose.distance),E=notSimilarVector3(h,this.camera.pose.offset);(A||g||E||m)&&(this.camera.setFromPose({longitude:c,latitude:f,fov:p,distance:d,offset:h}),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:p,offset:h,distance:d})})),this.needsRender=!0,this.modelSceneNeedsRender=!0)},t.prototype.stopMomentumMovement=function(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){var e=createEvent("gesture.momentum",__assign(__assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit("gesture.momentum",e)}this.inMomentumMovement=null},t.prototype.onPanGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pan",e)},t.prototype.onTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.tap",e)},t.prototype.onDblTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.dbltap",e),!e.defaultPrevented&&(e.type="gesture.tap",this.onTapGesture(e))},t.prototype.onPressGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.press",e)},t.prototype.onPinchGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pinch",e)},t.prototype.onMouseWheel=function(e){this.stopMomentumMovement(),this.emit("gesture.mousewheel",e)},t.prototype.onMouseMove=function(e){this.stopMomentumMovement(),this.emit("gesture.mousemove",e)},t.prototype.relativeClientPosition=function(e){return calculateThreeMouse(e,this.element,this.viewport)},t.prototype.createRaycasterFromCamera=function(e,r){var o=new THREE__namespace.Raycaster;return o.params.Points={threshold:.1},o.firstHitOnly=!0,o.near=r.near,o.far=r.far,o.setFromCamera(e,this.camera),o},t.prototype.bindEvents=function(e){var r=this,o=function(C){var P=calculateThreeMouse(C,r.element,r.viewport);return!(Math.abs(P.x)>1||Math.abs(P.y)>1)},s=new Hammer.Manager(e),u=function(C){var P=C.session;return P.firstInput||null},l=new Hammer.Pan({threshold:10,pointers:0}),c=new Hammer.Tap({interval:410}),f=new Hammer.Pinch({threshold:0,pointers:2});s.add([l,c,f]),s.on("panstart pan",function(C){var P=u(s);if(!(P&&!o(P.center))){var F=createEvent("gesture.pan",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}}),isFirst:C.isFirst,isFinal:C.isFinal,scale:C.scale,center:(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPanGesture(F),b()}}),s.on("tap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var P=u(s);if(!(P&&!o(P.center))){var F=createEvent("gesture.tap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onTapGesture(F),b()}}}),s.on("pinchstart pinch pinchend",function(C){var P=u(s);if(!(P&&!o(P.center))){var F=createEvent("gesture.pinch",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var H,N=r.relativeClientPosition(L),D=new THREE__namespace.Raycaster;return D.params.Points={threshold:.1},D.setFromCamera(N,r.camera),{x:L.x,y:L.y,delta:(H=L.delta)!==null&&H!==void 0?H:0,buttons:0,coords:N,raycaster:D}}),isFirst:C.type==="pinchstart",isFinal:C.type==="pinchend",scale:C.scale,center:(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPinchGesture(F),b()}}),s.on("dbltap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var P=u(s);if(!(P&&!o(P.center))){var F=createEvent("gesture.dbltap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(L){var H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera);return{x:L.x,y:L.y,delta:0,buttons:0,coords:H,raycaster:N}})(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onDblTapGesture(F),b()}}});var p=null,d=null,h=function(C,P,F){var L={x:F.clientX,y:F.clientY},H=r.relativeClientPosition(L),N=r.createRaycasterFromCamera(H,r.camera),D=__assign(__assign({},L),{coords:H,raycaster:N,buttons:F.buttons,delta:0}),Q=C==="pinchend"?P:P-F.deltaY/280,J=createEvent("gesture.pinch",{target:F.target,pointerType:"mouse",srcEvent:F,pointers:[__assign({},D)],isFirst:C==="pinchstart",isFinal:C==="pinchend",scale:clamp$1(Q,.1,10),center:__assign({},D),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return J},g=function(C){var P,F={x:C.clientX,y:C.clientY};if(o(F)){if(C.preventDefault(),C.ctrlKey){var L=(P=p==null?void 0:p.prevEvent.scale)!==null&&P!==void 0?P:1,H=h(p?"pinch":"pinchstart",L,C);p===null?p={firstEvent:H,prevEvent:H}:p.prevEvent=H,r.onPinchGesture(H),d!==null&&window.clearTimeout(d),d=window.setTimeout(function(){var q;d=null;var j=(q=p==null?void 0:p.prevEvent.scale)!==null&&q!==void 0?q:1,G=h("pinchend",j,C);p=null,r.onPinchGesture(G)},200)}else{var N=(Math.abs(C.deltaY)>Math.abs(C.deltaX)?C.deltaY:C.deltaX)/-60,D=r.mouseWheelState!==void 0,Q={x:C.clientX,y:C.clientY},J=r.relativeClientPosition(Q),U=r.createRaycasterFromCamera(J,r.camera),z=__assign(__assign({},Q),{coords:J,raycaster:U,buttons:C.buttons,delta:N}),H=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},z)],isFirst:D,isFinal:!1,scale:0,center:__assign({},z),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(H),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout(function(){delete r.mouseWheelState;var j=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign(__assign({},z),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},z),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(j)},100)}}b()}},A=function(C){if(!isMobile){if(!o({x:C.clientX,y:C.clientY})){m();return}var P=!1;r.mouseMoveState||(P=!0);var F={x:C.clientX,y:C.clientY},L=r.relativeClientPosition(F),H=r.createRaycasterFromCamera(L,r.camera),N=__assign(__assign({},F),{coords:L,raycaster:H,buttons:C.buttons,delta:0}),D=createEvent("gesture.mousemove",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},N)],isFirst:P,isFinal:!1,scale:0,center:__assign({},N),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.mouseMoveState={timeStamp:now(),event:D},r.onMouseMove(D),r.pressState&&Math.abs(C.clientX-r.pressState.event.center.y)>10&&Math.abs(C.clientY-r.pressState.event.center.y)>10&&b()}},m=function(){if(r.mouseMoveState){var C=createEvent(r.mouseMoveState.event.type,__assign(__assign({},r.mouseMoveState.event),{isFinal:!0}));delete r.mouseMoveState,r.onMouseMove(C)}b()},E=function(C){if(!o(C.center)){b();return}var P=!1;r.pressState||(P=!0,r.pressState={event:C,timeStamp:now(),stop:noop});var F=now()-r.pressState.timeStamp,L=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{isFirst:P,isFinal:!1,center:__assign(__assign({},r.pressState.event.center),{delta:F}),pointers:r.pressState.event.pointers.map(function(H){return __assign(__assign({},H),{delta:F})})}));r.onPressGesture(L),r.pressState&&(r.pressState.stop=AnimationFrameLoop.shared.add(function(H){E(C)},!0,1))},v=function(C){if(b(),!(C.touches.length>1||C.changedTouches.length<=0)){var P={x:C.changedTouches[0].clientX,y:C.changedTouches[0].clientY},F=r.relativeClientPosition(P),L=r.createRaycasterFromCamera(F,r.camera),H=__assign(__assign({},P),{coords:F,raycaster:L,buttons:0,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"touch",srcEvent:C,pointers:[__assign({},H)],isFirst:!1,isFinal:!1,scale:0,center:H,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});E(N)}},y=function(C){b();var P={x:C.clientX,y:C.clientY},F=r.relativeClientPosition(P),L=r.createRaycasterFromCamera(F,r.camera),H=__assign(__assign({},P),{coords:F,raycaster:L,buttons:C.buttons,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},H)],isFirst:!1,isFinal:!1,scale:0,center:H,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});E(N)},b=function(){var C;if(r.pressState){var P=now()-r.pressState.timeStamp,F=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{center:__assign(__assign({},r.pressState.event.center),{delta:P}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map(function(L){return __assign(__assign({},L),{delta:P})})}));r.onPressGesture(F),(C=r.pressState)===null||C===void 0||C.stop(),delete r.pressState}},T=null,_=function(C){var P,F=!1,L=!1;switch(C.type){case"gesturestart":F=!0;break;case"gestureend":L=!0;break}var H={x:C.clientX,y:C.clientY},N=r.relativeClientPosition(H),D=r.createRaycasterFromCamera(N,r.camera),Q=__assign(__assign({},H),{coords:N,raycaster:D,buttons:0,delta:0}),J=createEvent("gesture.pinch",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},Q)],isFirst:F,isFinal:L,scale:(P=C.scale)!==null&&P!==void 0?P:1,center:__assign({},Q),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return J},S=function(C){if(C.preventDefault(),!isMobile){var P=_(C);T={firstEvent:P};var F=T.firstEvent;F&&!o(F.center)||r.onPinchGesture(P)}},R=function(C){if(C.preventDefault(),!isMobile&&T){var P=_(C),F=T.firstEvent;F&&!o(F.center)||r.onPinchGesture(P)}},w=function(C){if(C.preventDefault(),!isMobile&&T){var P=_(C),F=T.firstEvent;T=null,!(F&&!o(F.center))&&r.onPinchGesture(P)}},M=function(C){if(C&&typeof C.preventDefault=="function"&&C.currentTarget===e&&C.preventDefault(),typeof getSelection=="function"){var P=getSelection();P&&P.focusNode&&(P.removeAllRanges&&P.removeAllRanges(),P.empty&&P.empty())}};this.enableWheel&&e.addEventListener("wheel",g,{passive:!1}),e.addEventListener("mousemove",A,!1),e.addEventListener("mouseout",m,!1),e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchend",b,!1),e.addEventListener("touchcancel",b,!1),e.addEventListener("mousedown",y,!1),e.addEventListener("mouseup",b,!1),e.addEventListener("gesturestart",S,{passive:!1}),e.addEventListener("gesturechange",R,{passive:!1}),e.addEventListener("gestureend",w,{passive:!1}),e.addEventListener("touchstart",M,{passive:!1}),e.addEventListener("contextmenu",M,!1);var O=function(){s.destroy(),e.removeEventListener("wheel",g,!1),e.removeEventListener("mousemove",A,!1),e.removeEventListener("mouseout",m,!1),e.removeEventListener("touchstart",v,!1),e.removeEventListener("touchend",b,!1),e.removeEventListener("touchcancel",b,!1),e.removeEventListener("mousedown",y,!1),e.removeEventListener("mouseup",b,!1),e.removeEventListener("gesturestart",S,!1),e.removeEventListener("gesturechange",R,!1),e.removeEventListener("gestureend",w,!1),e.removeEventListener("touchstart",M,!1),e.removeEventListener("contextmenu",M,!1)};return Object.assign(O,{element:e})},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop);var s=this.works.getObserver(e);if(!s)return Promise.resolve();var u=["right","left","up","down","front","back"];return Promise.all(u.map(function(l){var c=__assign({key:"pano.".concat(panoStringify(e),".").concat(l)},pick(o.imageOptions,["size","format","quality","mappings"])),f=s.work.getURL(s.images[l]),p=applyImageURLOptions(f,o.imageOptions.transform,c);return getFetcher(s.work).preload(p,{timeout:500})})).then(function(){return r(e),e})},t})(Subscribe),sharedGeometry$2=new THREE__namespace.CircleBufferGeometry(.1,16),vertexShader$3=`
|
|
1394
1394
|
varying vec2 vUv;
|
|
1395
1395
|
#include <common>
|
|
1396
1396
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -1455,7 +1455,7 @@ void main() {
|
|
|
1455
1455
|
vec3 panoToVertex = normalize(vFinalPosition.xyz);
|
|
1456
1456
|
gl_FragColor = textureCube(map, vec3(FLIP_CUBE_MAP * panoToVertex.x, panoToVertex.yz));
|
|
1457
1457
|
}
|
|
1458
|
-
`,BoudningMaterial=(function(n){__extends(t,n);function t(){var e=n.call(this,{defines:{},uniforms:{map:{value:null}},vertexShader:BOUNDING_MATERIAL_VERTEX_SHADER,fragmentShader:BOUNDING_MATERIAL_FRAGMENT_SHADER,transparent:!1})||this;return defineProperty(e,"map",{get:function(){return this.uniforms.map.value},set:function(r){this.uniforms.map.value=r}}),e}return t})(THREE__namespace.ShaderMaterial),BoundingMesh=(function(n){__extends(t,n);function t(){var e=n.call(this,boundinghGeometry,new BoudningMaterial)||this;return e.disposed=!1,e.frustumCulled=!1,e.renderOrder=9999,e}return t.prototype.update=function(e,r){if(this.disposed){this.material.map=null,this.material.visible=!1;return}this.material.map=r,this.material.visible=r!==null},t.prototype.dispose=function(){this.disposed=!0,this.material.dispose()},t})(THREE__namespace.Mesh),Tiling=(function(){function n(){this.forceRenderWhenNextUpdate=!0,this.disposed=!1,this.level=0,this.pedding=0,this.maxRequest=1,this.appearDuration=.5,this.maxCacheTile=48,this.imageOptions={},this.boundingMesh=new BoundingMesh,this.boundingMesh.frustumCulled=!1,this.textureLoader=new TextureLoader,this.observer=null,this.tileTree=createTileCubeTree(0),this.tileMeshes=new Map,this.frustum=new THREE__namespace.Frustum,this.scene=new THREE__namespace.Scene,this.camera=new THREE__namespace.PerspectiveCamera(90,1,.1,100),this.scene.add(this.boundingMesh),this.renderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1,generateMipmaps:!1,magFilter:THREE__namespace.LinearFilter,minFilter:THREE__namespace.LinearFilter,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping})}return n.prototype.dispose=function(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.disposed=!0},n.prototype.cleanup=function(){var t=this;this.tileMeshes.forEach(function(e){e.dispose(),t.scene.remove(e)}),this.tileMeshes.clear(),this.forceRenderWhenNextUpdate=!0},n.prototype.setObserver=function(t){var e,r,o,s;if(!this.disposed&&this.observer!==t){this.cleanup(),this.observer=t;var u=(s=(o=(r=(e=this.observer)===null||e===void 0?void 0:e.images.tiles)===null||r===void 0?void 0:r.slice().sort(function(l,c){return c.level-l.level})[0])===null||o===void 0?void 0:o.level)!==null&&s!==void 0?s:0;this.tileTree=createTileCubeTree(u)}},n.prototype.update=function(t){var e=this,r=this.forceRenderWhenNextUpdate;if(this.disposed)return r;var o=t.time,s=t.resolution,u=t.pixelRatio,l=t.renderer,c=t.cameraMatrix,f=t.cameraProjectionMatrix,p=t.panoMap,d=t.panoMatrix,h=t.panoZoom,g=t.minLevel,A=t.level;if(this.boundingMesh.update(o,p),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),r=!0),!1;this.level=clamp$1(A,0,this.tileTree.maxLevel);var m=Math.floor(s.width*u),E=Math.floor(s.height*u),v=Math.max(m,E),y=l.capabilities.maxTextureSize;v>y&&(m=Math.floor(m/v*y),E=Math.floor(E/v*y)),(this.renderTarget.width!==m||this.renderTarget.height!==E)&&this.renderTarget.setSize(m,E),this.scene.matrix.equals(d)||(this.scene.matrix.copy(d),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,r=!0);var b=scratchCameraQuaternion.setFromRotationMatrix(c),T=scratchCameraMatrix.compose(this.scene.position,b,this.scene.scale);this.camera.matrix.equals(T)||(this.camera.matrix.copy(T),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(b),this.camera.scale.copy(this.scene.scale),r=!0);var _=scratchCameraProjectMatrix.copy(f);_.elements[0]*=h,_.elements[5]*=h,this.camera.projectionMatrix.equals(_)||(this.camera.projectionMatrix.copy(_),this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix),r=!0),scratchSceneQuaternionInverse.copy(this.scene.quaternion).inverse(),scratchSceneMatrixInverse.makeRotationFromQuaternion(scratchSceneQuaternionInverse),scratchFrustumMatrix.copy(this.camera.matrix),scratchFrustumMatrix.setPosition(0,0,0),scratchFrustumMatrix.premultiply(scratchSceneMatrixInverse),scratchFrustumMatrixInverse.getInverse(scratchFrustumMatrix),scratchFrustumProjectMatrix.multiplyMatrices(this.camera.projectionMatrix,scratchFrustumMatrixInverse),this.frustum.setFromProjectionMatrix(scratchFrustumProjectMatrix);var S=this.frustum.planes[5].normal,R=[];A>=g&&traverseTileCubeNode(this.tileTree,function(K){if(!(K.level<g)){if(K.level>A||!e.frustum.intersectsBox(K.box))return!1;R.push(K)}});var w=new WeakMap;R.sort(function(K,ne){if(K.level!==ne.level)return K.level-ne.level;var ee=w.get(K);ee===void 0&&(ee=K.box.getCenter(scratchSortVector3).angleTo(S),w.set(K,ee));var te=w.get(ne);return te===void 0&&(te=ne.box.getCenter(scratchSortVector3).angleTo(S),w.set(ne,te)),ee-te});var M=new WeakSet,O=this.observer.images.tiles;if(O)for(var C=function(K){var ne=O.find(function(re){return re.level===K.level});if(!ne)return"continue";M.add(K);var ee=P.tileMeshes.get(K);if(ee){ee.appearDuration=P.appearDuration;var te=ee.updateTime(o);return te&&(r=!0),"continue"}if(P.pedding>=P.maxRequest)return"continue";var ae=Math.pow(2,K.level)*K.position.y,fe=Math.pow(2,K.level)*K.position.x,se=panoStringify({panoIndex:P.observer.panoIndex,workCode:P.observer.work.workCode}),he="".concat(se,".").concat(K.face,".").concat(K.level,".").concat(ae,".").concat(fe),me=ne.work.getURL(ne[K.face]),be=ne.size,Te=P.imageOptions.transform,ce=__assign(__assign({},pick(P.imageOptions,["format","sharpen","mappings"])),{key:"pano_tile.".concat(he),size:ne.scale>=1?void 0:be*K.size*ne.scale,cut:K.size===1?void 0:[be*K.position.x,be*K.position.y,be*K.size,be*K.size]});K.level===1&&ne.scale>=.5&&(ce.format==="jpg"||/\.jpg$/.test(me))&&(ce.size=void 0,ce.quality||(ce.quality=70)),K.size===1&&console.warn("tile: ".concat(ce.key," should not appear.")),P.pedding++;var pe=P.textureLoader.loadTexture(me,{imageURL:{transform:Te,options:ce},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(P.observer.work)}).then(function(re){return re.body});pe.then(function(re){return initTexture(re,l)}).then(function(re){return e.pedding--,re},function(re){return e.pedding--,Promise.reject(re)}),ee=new TileMesh(K,pe),ee.name="tiling:tile-".concat(he),ee.visible=!1,ee.appearDuration=P.appearDuration,P.tileMeshes.set(K,ee),P.scene.add(ee),ee.updateTime(o),r=!0},P=this,F=0,L=R;F<L.length;F++){var H=L[F];C(H)}var N=[],D=[];this.tileMeshes.forEach(function(K,ne){M.has(ne)?N.push(K):D.push(K);var ee=ne.level>=g&&ne.level<=A;K.visible!==ee&&(K.visible=ee,r=!0)});for(var Q=D.sort(function(K,ne){return ne.activeTime-K.activeTime}).slice(Math.max(0,this.maxCacheTile-N.length)),J=0,U=Q;J<U.length;J++){var z=U[J];this.tileMeshes.delete(z.node),this.scene.remove(z),z.dispose(),r=!0}if(r){var q=l.getRenderTarget();scratchPrevClearColor$1.copy(l.getClearColor());var j=l.getClearAlpha(),G=l.autoClear,X=l.autoClearColor,Y=l.autoClearDepth,Z=l.autoClearStencil,W=l.clippingPlanes;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,l.clippingPlanes=clippingPlanes,l.setRenderTarget(this.renderTarget),l.setClearColor(clearColor$1,clearAlpha),l.render(this.scene,this.camera),l.setRenderTarget(q),l.setClearColor(scratchPrevClearColor$1,j),l.autoClear=G,l.autoClearColor=X,l.autoClearDepth=Y,l.autoClearStencil=Z,l.clippingPlanes=W}return this.forceRenderWhenNextUpdate=!1,r},n})(),ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),vertices$1=new Float32Array([-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1]),indices=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),sharedGeometry$1=new THREE__namespace.BufferGeometry;sharedGeometry$1.setAttribute("position",new THREE__namespace.BufferAttribute(vertices$1,3));sharedGeometry$1.setIndex(new THREE__namespace.BufferAttribute(indices,1));sharedGeometry$1.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var PANO_VIDEO_MATERIAL_VERTEX_SHADER=`
|
|
1458
|
+
`,BoudningMaterial=(function(n){__extends(t,n);function t(){var e=n.call(this,{defines:{},uniforms:{map:{value:null}},vertexShader:BOUNDING_MATERIAL_VERTEX_SHADER,fragmentShader:BOUNDING_MATERIAL_FRAGMENT_SHADER,transparent:!1})||this;return defineProperty(e,"map",{get:function(){return this.uniforms.map.value},set:function(r){this.uniforms.map.value=r}}),e}return t})(THREE__namespace.ShaderMaterial),BoundingMesh=(function(n){__extends(t,n);function t(){var e=n.call(this,boundinghGeometry,new BoudningMaterial)||this;return e.disposed=!1,e.frustumCulled=!1,e.renderOrder=9999,e}return t.prototype.update=function(e,r){if(this.disposed){this.material.map=null,this.material.visible=!1;return}this.material.map=r,this.material.visible=r!==null},t.prototype.dispose=function(){this.disposed=!0,this.material.dispose()},t})(THREE__namespace.Mesh),Tiling=(function(){function n(){this.forceRenderWhenNextUpdate=!0,this.disposed=!1,this.level=0,this.pedding=0,this.maxRequest=1,this.appearDuration=.5,this.maxCacheTile=48,this.imageOptions={},this.boundingMesh=new BoundingMesh,this.boundingMesh.frustumCulled=!1,this.textureLoader=new TextureLoader,this.observer=null,this.tileTree=createTileCubeTree(0),this.tileMeshes=new Map,this.frustum=new THREE__namespace.Frustum,this.scene=new THREE__namespace.Scene,this.camera=new THREE__namespace.PerspectiveCamera(90,1,.1,100),this.scene.add(this.boundingMesh),this.renderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1,generateMipmaps:!1,magFilter:THREE__namespace.LinearFilter,minFilter:THREE__namespace.LinearFilter,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping})}return n.prototype.dispose=function(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.scene.dispose(),this.disposed=!0},n.prototype.cleanup=function(){var t=this;this.tileMeshes.forEach(function(e){e.dispose(),t.scene.remove(e)}),this.tileMeshes.clear(),this.forceRenderWhenNextUpdate=!0},n.prototype.setObserver=function(t){var e,r,o,s;if(!this.disposed&&this.observer!==t){this.cleanup(),this.observer=t;var u=(s=(o=(r=(e=this.observer)===null||e===void 0?void 0:e.images.tiles)===null||r===void 0?void 0:r.slice().sort(function(l,c){return c.level-l.level})[0])===null||o===void 0?void 0:o.level)!==null&&s!==void 0?s:0;this.tileTree=createTileCubeTree(u)}},n.prototype.update=function(t){var e=this,r=this.forceRenderWhenNextUpdate;if(this.disposed)return r;var o=t.time,s=t.resolution,u=t.pixelRatio,l=t.renderer,c=t.cameraMatrix,f=t.cameraProjectionMatrix,p=t.panoMap,d=t.panoMatrix,h=t.panoZoom,g=t.minLevel,A=t.level;if(this.boundingMesh.update(o,p),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),r=!0),!1;this.level=clamp$1(A,0,this.tileTree.maxLevel);var m=Math.floor(s.width*u),E=Math.floor(s.height*u),v=Math.max(m,E),y=l.capabilities.maxTextureSize;v>y&&(m=Math.floor(m/v*y),E=Math.floor(E/v*y)),(this.renderTarget.width!==m||this.renderTarget.height!==E)&&this.renderTarget.setSize(m,E),this.scene.matrix.equals(d)||(this.scene.matrix.copy(d),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,r=!0);var b=scratchCameraQuaternion.setFromRotationMatrix(c),T=scratchCameraMatrix.compose(this.scene.position,b,this.scene.scale);this.camera.matrix.equals(T)||(this.camera.matrix.copy(T),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(b),this.camera.scale.copy(this.scene.scale),r=!0);var _=scratchCameraProjectMatrix.copy(f);_.elements[0]*=h,_.elements[5]*=h,this.camera.projectionMatrix.equals(_)||(this.camera.projectionMatrix.copy(_),this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix),r=!0),scratchSceneQuaternionInverse.copy(this.scene.quaternion).inverse(),scratchSceneMatrixInverse.makeRotationFromQuaternion(scratchSceneQuaternionInverse),scratchFrustumMatrix.copy(this.camera.matrix),scratchFrustumMatrix.setPosition(0,0,0),scratchFrustumMatrix.premultiply(scratchSceneMatrixInverse),scratchFrustumMatrixInverse.getInverse(scratchFrustumMatrix),scratchFrustumProjectMatrix.multiplyMatrices(this.camera.projectionMatrix,scratchFrustumMatrixInverse),this.frustum.setFromProjectionMatrix(scratchFrustumProjectMatrix);var S=this.frustum.planes[5].normal,R=[];A>=g&&traverseTileCubeNode(this.tileTree,function(K){if(!(K.level<g)){if(K.level>A||!e.frustum.intersectsBox(K.box))return!1;R.push(K)}});var w=new WeakMap;R.sort(function(K,ne){if(K.level!==ne.level)return K.level-ne.level;var ee=w.get(K);ee===void 0&&(ee=K.box.getCenter(scratchSortVector3).angleTo(S),w.set(K,ee));var te=w.get(ne);return te===void 0&&(te=ne.box.getCenter(scratchSortVector3).angleTo(S),w.set(ne,te)),ee-te});var M=new WeakSet,O=this.observer.images.tiles;if(O)for(var C=function(K){var ne=O.find(function(re){return re.level===K.level});if(!ne)return"continue";M.add(K);var ee=P.tileMeshes.get(K);if(ee){ee.appearDuration=P.appearDuration;var te=ee.updateTime(o);return te&&(r=!0),"continue"}if(P.pedding>=P.maxRequest)return"continue";var ae=Math.pow(2,K.level)*K.position.y,fe=Math.pow(2,K.level)*K.position.x,se=panoStringify({panoIndex:P.observer.panoIndex,workCode:P.observer.work.workCode}),he="".concat(se,".").concat(K.face,".").concat(K.level,".").concat(ae,".").concat(fe),me=ne.work.getURL(ne[K.face]),be=ne.size,Te=P.imageOptions.transform,ce=__assign(__assign({},pick(P.imageOptions,["format","sharpen","mappings"])),{key:"pano_tile.".concat(he),size:ne.scale>=1?void 0:be*K.size*ne.scale,cut:K.size===1?void 0:[be*K.position.x,be*K.position.y,be*K.size,be*K.size]});K.level===1&&ne.scale>=.5&&(ce.format==="jpg"||/\.jpg$/.test(me))&&(ce.size=void 0,ce.quality||(ce.quality=70)),K.size===1&&console.warn("tile: ".concat(ce.key," should not appear.")),P.pedding++;var pe=P.textureLoader.loadTexture(me,{imageURL:{transform:Te,options:ce},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(P.observer.work)}).then(function(re){return re.body});pe.then(function(re){return initTexture(re,l)}).then(function(re){return e.pedding--,re},function(re){return e.pedding--,Promise.reject(re)}),ee=new TileMesh(K,pe),ee.name="tiling:tile-".concat(he),ee.visible=!1,ee.appearDuration=P.appearDuration,P.tileMeshes.set(K,ee),P.scene.add(ee),ee.updateTime(o),r=!0},P=this,F=0,L=R;F<L.length;F++){var H=L[F];C(H)}var N=[],D=[];this.tileMeshes.forEach(function(K,ne){M.has(ne)?N.push(K):D.push(K);var ee=ne.level>=g&&ne.level<=A;K.visible!==ee&&(K.visible=ee,r=!0)});for(var Q=D.sort(function(K,ne){return ne.activeTime-K.activeTime}).slice(Math.max(0,this.maxCacheTile-N.length)),J=0,U=Q;J<U.length;J++){var z=U[J];this.tileMeshes.delete(z.node),this.scene.remove(z),z.dispose(),r=!0}if(r){var q=l.getRenderTarget();scratchPrevClearColor$1.copy(l.getClearColor());var j=l.getClearAlpha(),G=l.autoClear,X=l.autoClearColor,Y=l.autoClearDepth,Z=l.autoClearStencil,W=l.clippingPlanes;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,l.clippingPlanes=clippingPlanes,l.setRenderTarget(this.renderTarget),l.setClearColor(clearColor$1,clearAlpha),l.render(this.scene,this.camera),l.setRenderTarget(q),l.setClearColor(scratchPrevClearColor$1,j),l.autoClear=G,l.autoClearColor=X,l.autoClearDepth=Y,l.autoClearStencil=Z,l.clippingPlanes=W}return this.forceRenderWhenNextUpdate=!1,r},n})(),ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),vertices$1=new Float32Array([-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1]),indices=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),sharedGeometry$1=new THREE__namespace.BufferGeometry;sharedGeometry$1.setAttribute("position",new THREE__namespace.BufferAttribute(vertices$1,3));sharedGeometry$1.setIndex(new THREE__namespace.BufferAttribute(indices,1));sharedGeometry$1.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var PANO_VIDEO_MATERIAL_VERTEX_SHADER=`
|
|
1459
1459
|
|
|
1460
1460
|
#if defined(USE_PANO_VIDEO)
|
|
1461
1461
|
varying vec3 worldPosition;
|
|
@@ -1570,7 +1570,7 @@ void main() {
|
|
|
1570
1570
|
float cameraDepth = length(cameraVertex);
|
|
1571
1571
|
gl_FragColor = packDepthToRGBA(clamp(cameraDepth / maxDepth, 0.0, 1.0));
|
|
1572
1572
|
}
|
|
1573
|
-
`,depthMaterial=new THREE__namespace.ShaderMaterial({vertexShader:depthVertexShader,fragmentShader:depthFragmentShader,uniforms:{maxDepth:new THREE__namespace.Uniform(0)}});function renderDepthCube(n,t,e,r){r===void 0&&(r=1e3),depthMaterial.uniforms.maxDepth.value=r,scratchPrevClearColor.copy(n.getClearColor());var o=n.getClearAlpha(),s=t.overrideMaterial;t.overrideMaterial=depthMaterial,n.setClearColor(clearColor,0),e.update(n,t),n.setClearColor(scratchPrevClearColor,o),t.overrideMaterial=s}var scratchRaycaster$1=new THREE__namespace.Raycaster,scratchVector3$3=new THREE__namespace.Vector3,adjustPanoCircleMeshVectors=[new THREE__namespace.Vector3(0,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(1,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,+Math.sqrt(3)/2).multiplyScalar(.1)],defaultPanoramaControllerCustomInitArgs=__assign(__assign({},defaultPanoramaLikeControllerCustomInitArgs),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:function(n){return new PanoCircleMesh},adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:(function(n,t){var e,r=function(l){return l/180*Math.PI},o=(e=Math.log2)!==null&&e!==void 0?e:(function(l){return Math.log(l)*Math.LOG2E}),s=t.height/2/Math.tan(r(n/2))*Math.tan(r(45))*2,u=Math.max(o(s/512),0);return u<2.3&&u>.1&&(u=1),u=u%1>.75?Math.ceil(u):Math.floor(u),u}),tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),PanoramaController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="Panorama",r.initAnimationed=!1,r.maxAccessibleDistance=o.maxAccessibleDistance,r.panoTapTriggerRadius=o.panoTapTriggerRadius,r.panoCircleMeshCreator=o.panoCircleMeshCreator,r.adjustPanoCircleMeshPositionBasedOnModel=o.adjustPanoCircleMeshPositionBasedOnModel,r.tileLevelForFov=o.tileLevelForFov,r.tileAppearDuration=o.tileAppearDuration,r.tileMaxRequest=o.tileMaxRequest,r.flyEffectUseDepthBuffer=o.flyEffectUseDepthBuffer,r.adjustPanoCircleMeshPositionFix=new Map;var s=r.modelScene.parameter.resolveValue(),u=s.pano0,l=s.pano1;u&&(l==null?void 0:l.map)!==u.map&&(r.modelScene.parameter.set({pano0:l}),u.map.dispose());var c=new Set;return u&&c.add(u),l&&c.add(l),r.panoMeshes=new Map,r.locationMotion=new Motion({count:0,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),panoPicture:r.modelScene.parameter.resolveValue().pano1,position:r.camera.pose.offset.clone(),effect:"fly",fixCameraTransform:new THREE__namespace.Matrix4},r.panoPictureObserverMap=new WeakMap,r.textureLoader=new TextureLoader,r.tiling=new Tiling,r.panoVideo=new PanoVideo,r.scene.add(r.panoVideo.object),r.accessibleObserverFloorCheckCount=0,r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,p;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{maxAccessibleDistance:(r=e.maxAccessibleDistance)!==null&&r!==void 0?r:defaultPanoramaControllerCustomInitArgs.maxAccessibleDistance,panoTapTriggerRadius:(o=e.panoTapTriggerRadius)!==null&&o!==void 0?o:defaultPanoramaControllerCustomInitArgs.panoTapTriggerRadius,panoCircleMeshCreator:(s=e.panoCircleMeshCreator)!==null&&s!==void 0?s:defaultPanoramaControllerCustomInitArgs.panoCircleMeshCreator,adjustPanoCircleMeshPositionBasedOnModel:(u=e.adjustPanoCircleMeshPositionBasedOnModel)!==null&&u!==void 0?u:defaultPanoramaControllerCustomInitArgs.adjustPanoCircleMeshPositionBasedOnModel,tileLevelForFov:(l=e.tileLevelForFov)!==null&&l!==void 0?l:defaultPanoramaControllerCustomInitArgs.tileLevelForFov,tileAppearDuration:(c=e.tileAppearDuration)!==null&&c!==void 0?c:defaultPanoramaControllerCustomInitArgs.tileAppearDuration,tileMaxRequest:(f=e.tileMaxRequest)!==null&&f!==void 0?f:defaultPanoramaControllerCustomInitArgs.tileMaxRequest,flyEffectUseDepthBuffer:(p=e.flyEffectUseDepthBuffer)!==null&&p!==void 0?p:defaultPanoramaControllerCustomInitArgs.flyEffectUseDepthBuffer})},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"Panorama"})},Object.defineProperty(t.prototype,"tileLevel",{get:function(){return this.tiling.level},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e){var r=this,o=n.prototype.updateConfiguration.call(this,e);return o===!1?!1:(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,this.panoMeshes&&(this.panoMeshes.forEach(function(s){r.helper.remove(s),s.dispose()}),this.panoMeshes.clear())),e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)},t.prototype.destroy=function(){var e=this;n.prototype.destroy.call(this),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),delete this.pendingTextureTask,this.panoMeshes&&(this.panoMeshes.forEach(function(h){e.helper.remove(h),h.dispose()}),this.panoMeshes.clear());var r=this.videoTexture.image;r.pause(),r.oncanplay=function(){},r.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=this.modelScene.parameter.resolveValue(),s=o.pano0,u=o.pano1,l=0,c=Object.keys(this.panoResources);l<c.length;l++){var f=c[l],p=this.panoResources[f];if(p.panoPicture){var d=p.panoPicture.map;d&&d!==(s==null?void 0:s.map)&&d!==(u==null?void 0:u.map)&&(d.dispose(),p.panoPicture=null)}delete this.panoResources[f]}},t.prototype.isReady=function(){return this.locationMotion.ended!==!0?!1:n.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e=this.tiling.pedding,r=e<=0;return this.initAnimationed&&r},t.prototype.updateWork=function(e,r,o,s){var u=this;this.userAction=s,this.works=e;var l=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}})),c={workCode:l.workCode,panoIndex:l.panoIndex};return this.initAnimationed=!1,this.hideIntersectMesh(),this.moveToPano(c,{effect:o.effect,duration:o.duration,longitude:r.longitude,latitude:r.latitude,fov:r.fov,moveEndCallback:function(){u.initAnimationed=!0},moveCancelCallback:function(){u.initAnimationed=!0}},s),!0},t.prototype.updateModel=function(e){this.modelScene=e,this.hideIntersectMesh()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,p;if(!this.destroyed){var d={},h={},g=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],m=this.locationMotion.getKeyFrameSegment(e),E=m[0],v=m[1],y=this.panoResourceFromLocationMotionKeyframe(E),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(g),_=this.panoResourceFromLocationMotionKeyframe(A),S=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),h.longitude=this.cameraMotion.value.longitude,h.latitude=this.cameraMotion.value.latitude,h.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var R=new THREE__namespace.Vector3().copy(y.position),w=new THREE__namespace.Vector3().copy(b.position),M=this.locationMotion.value.count-v.value.count+1;if(d.progress=M,b.panoPicture&&(M<1?y.panoPicture&&(d.pano0=y.panoPicture):d.pano0=b.panoPicture,d.pano1=b.panoPicture),b.effect==="montage"?d.transition="BLACK":b.effect==="spread"?d.transition="SPREAD":d.transition="FADE",(b.effect==="zoomin"||b.effect==="zoomout")&&(d.progress=Math.pow(M,3)),M<1&&b.effect!=="fly"){if(d.pano0&&y.panoPicture){var O={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:y.panoPicture.matrix.clone().premultiply(y.fixCameraTransform).setPosition(b.position)},C=this.panoPictureObserverMap.get(d.pano0);C&&this.panoPictureObserverMap.set(O,C),d.pano0=O}R.copy(w),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(R.x+(w.x-R.x)*M,R.y+(w.y-R.y)*M,R.z+(w.z-R.z)*M);for(var P=[],F=[],L=0,H=this.locationMotion.keyframes;L<H.length;L++){var N=H[L],D=N.key,Q=N.progress;D!==void 0&&(P.push(D),Q>this.locationMotion.progress&&F.push(D))}for(var J=0,U=Object.keys(this.panoResources);J<U.length;J++){var z=U[J];if(!(F.indexOf(z)>=0)){var q=this.panoResources[z];if(q.panoPicture){var j=q.panoPicture.map;if(j){if(j===((s=d.pano0)===null||s===void 0?void 0:s.map)||j===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;j.dispose(),q.panoPicture=null}}P.indexOf(z)>=0||delete this.panoResources[z]}}var G=panoParse(b.panoId);G!==this.currentPano&&(this.currentPano=G,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(T.panoId),state:__assign(__assign(__assign(__assign({},panoParse(_.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),isEmptyObject(h)===!1&&this.setCamera(h);var X=this.works.getObserver(this.currentPano),Y=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,Z=this.works.getObserver(y.panoId),W=this.works.getObserver(b.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&X){for(var K=[],ne=X.work.observers,ee=0,te=X.accessibleNodes;ee<te.length;ee++){var ae=te[ee],C=ne[ae];C&&K.push(C)}var fe=new Map;if(K.sort(function(oe,_e){var Me=fe.get(oe);typeof Me=="undefined"&&(Me=oe.standingPosition.distanceTo(X.standingPosition),fe.set(oe,Me));var xe=fe.get(oe);return typeof xe=="undefined"&&(xe=_e.standingPosition.distanceTo(X.standingPosition),fe.set(_e,xe)),Me-xe}),K.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%K.length;var se=K[this.accessibleObserverFloorCheckCount],he=this.modelScene.models.find(function(oe){return oe.work===(se==null?void 0:se.work)});if(se&&he&&he.visible){var me=.3,be=.05,Te=.005,ce=se.standingPosition.clone().applyMatrix4(se.work.transform),pe=panoStringify({panoIndex:se.panoIndex,workCode:se.work.workCode}),re=adjustPanoCircleMeshVectors.map(function(oe){scratchRaycaster$1.ray.origin.copy(ce),scratchRaycaster$1.ray.origin.add(scratchVector3$3.copy(oe).setY(me)),scratchRaycaster$1.ray.direction.set(0,-1,0),scratchRaycaster$1.firstHitOnly=!0,scratchRaycaster$1.floorIndex=-1;var _e=he.intersectRaycaster(scratchRaycaster$1)[0];return _e&&_e.distance-Te<=me?new THREE__namespace.Vector3().copy(ce).setY(_e.point.y+Te):ce});re.sort(function(oe,_e){return _e.y-oe.y});var ue=re[Math.floor(re.length/2)],ve=re.filter(function(oe){return oe.distanceTo(ue)<=be})[0];if(ve){var ye=new THREE__namespace.Vector4(ce.x,ce.y,ce.z,ve.y-ce.y),De=this.adjustPanoCircleMeshPositionFix.get(pe);De&&!ye.equals(De)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(pe,ye)}}this.accessibleObserverFloorCheckCount++}}var Je=new Map;if(Z)for(var $e=0,Ue=Z.accessibleNodes;$e<Ue.length;$e++){var ae=Ue[$e],C=Z.work.observers[ae];if(C){var pe=panoStringify({panoIndex:C.panoIndex,workCode:C.work.workCode});Je.set(pe,C)}}if(W)for(var de=0,Ye=W.accessibleNodes;de<Ye.length;de++){var ae=Ye[de],C=W.work.observers[ae];if(C){var pe=panoStringify({panoIndex:C.panoIndex,workCode:C.work.workCode});Je.set(pe,C)}}if(this.panoMeshes.forEach(function(oe,_e){var Me=Je.get(_e);if(Me){oe.position.copy(Me.standingPosition).applyMatrix4(Me.work.transform);var xe=o.adjustPanoCircleMeshPositionFix.get(_e);xe&&(scratchVector3$3.set(xe.x,xe.y,xe.z),scratchVector3$3.equals(oe.position)&&(oe.position.y+=xe.w)),oe.scale.setScalar(1.2),Je.delete(_e)}else o.helper.remove(oe),oe.dispose(),o.panoMeshes.delete(_e)}),Je.forEach(function(oe,_e){var Me=o.panoCircleMeshCreator(panoParse(_e));Me.position.copy(oe.standingPosition).applyMatrix4(oe.work.transform);var xe=o.adjustPanoCircleMeshPositionFix.get(_e);xe&&(scratchVector3$3.set(xe.x,xe.y,xe.z),scratchVector3$3.equals(Me.position)&&(Me.position.y+=xe.w)),Me.scale.setScalar(1.2),o.panoMeshes.set(_e,Me),o.helper.add(Me),Je.delete(_e)}),this.camera.pose.distance>.1||S)this.panoMeshes.forEach(function(oe){oe.setOpacity(0),oe.setCurrent(!1),oe.updateTime&&oe.updateTime(e,r),oe.visible=!1});else if(X){var Ee=X.work.observers,Oe=arrayMin(X.accessibleNodes,function(oe){var _e=Ee[oe];return _e?X.standingPosition.distanceTo(_e.standingPosition):1/0},!0),Fe=Oe[1];Fe=clamp$1(Fe,2.5,1/0);var tt=X.visibleNodes.concat(X.panoIndex).map(function(oe){return panoStringify({panoIndex:oe,workCode:X.work.workCode})}),rt=this.camera.getDirection(new THREE__namespace.Vector3);this.panoMeshes.forEach(function(oe,_e){var Me=o.works.getObserver(_e);if(tt.indexOf(_e)===-1)oe.setCurrent(!1),oe.setOpacity(0);else if(!Me)oe.setCurrent(!1),oe.setOpacity(0);else if(!Me.loadable&&!Me.active)oe.setCurrent(!1),oe.setOpacity(0);else{var xe=oe.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);oe.setCurrent(!oe.loading&&oe.progress===0&&Y!==null&&panoStringify({panoIndex:Y.panoIndex,workCode:Y.work.workCode})===_e),oe.setOpacity(xe<.01?0:clamp$1(Fe/xe*1.2,.4,.85));var ze=o.camera.position.clone().setY(oe.position.y),at=new THREE__namespace.Vector3().copy(oe.position).sub(ze).normalize();if(_e===panoStringify(o.currentPano)){var yt=clamp$1((.5-ze.distanceTo(oe.position))/.5,0,1);at.multiplyScalar(1-yt).add(rt.clone().multiplyScalar(yt))}at.length()>0&&oe.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(at.x,at.z),0))}oe.updateTime&&oe.updateTime(e,r)})}{var M=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,Le=Math.round(M),Ie=this.modelScene.parameter.pano0,He=this.modelScene.parameter.pano1,ge=Le===0?Ie:He,C=void 0;if(ge&&(C=this.works.getObserver(ge.panoId),C||(C=this.panoPictureObserverMap.get(ge))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=M<=.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!C||!ge||this.tileLevelForFov===!1){this.tiling.setObserver(null);var we={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(we),this.modelScene.parameter.set("refinedScreen",null)}else{var Pe=getImageSizeLevel(ge.mapSize),je=Pe+1,Ve=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),Ze=Math.floor(this.tileLevelForFov(this.camera.fov,Ve)),gt=Ze>Pe?Ze:0;this.tiling.setObserver(C);var we={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:ge.map,panoMatrix:ge.matrix,panoZoom:ge.zoom,minLevel:je,level:gt},Qe=this.tiling.update(we),At={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Le,opacity:(Ie==null?void 0:Ie.panoId)===(He==null?void 0:He.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Re=this.modelScene.parameter.refinedScreen;(Qe||At.pano!==(Re==null?void 0:Re.pano)||At.opacity!==(Re==null?void 0:Re.opacity))&&this.modelScene.parameter.set("refinedScreen",At)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),X&&X.video&&(this.needsRender=!0),this.intersectMesh.scale.setScalar(clamp$1(this.cameraMotion.value.fov/45,0,1));{var qe=b.effect,ft=this.modelScene.parameter,Ie=ft.pano0,He=ft.pano1;if(Ie&&He&&Ie!==He&&qe==="fly"&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==Ie.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==He.panoId){var dt=500,Ge=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Ge&&this.pano0DepthCubeRenderTarget.setSize(Ge,Ge):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Ge,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Ge&&this.pano1DepthCubeRenderTarget.setSize(Ge,Ge):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Ge,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var nt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);nt.matrix.copy(Ie.matrix),nt.matrixWorld.copy(nt.matrix),nt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,nt,dt);var ct=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);ct.matrix.copy(He.matrix),ct.matrixWorld.copy(ct.matrix),ct.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,ct,dt),this.modelScene.parameter.set({pano0Depth:{panoId:Ie.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:dt},pano1Depth:{panoId:He.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:dt}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1],o=this.panoResourceFromLocationMotionKeyframe(r),s=this.works.getObserver(o.panoId);return{workCode:s?s.work.workCode:this.currentPano.workCode,panoIndex:s?s.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:s?s.position.clone().applyMatrix4(s.work.transform):this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c=(u=r.effect)!==null&&u!==void 0?u:"fly";this.userAction=o,this.stopMomentumMovement();var f=panoStringify(e),p=this.works.getObserver(e);if(!p)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));getImageSizeFromURL(p.images.up),this.imageOptions.size;var d=this.imageOptions.transform,h=__assign({key:"pano.".concat(f)},pick(this.imageOptions,["format","size","quality","sharpen","mappings"])),g={right:p.images.work.getURL(p.images.right),left:p.images.work.getURL(p.images.left),up:p.images.work.getURL(p.images.up),down:p.images.work.getURL(p.images.down),front:p.images.work.getURL(p.images.front),back:p.images.work.getURL(p.images.back)},A="pano:"+jsonHash([g,h,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===A)return;var m=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(m))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:{panoIndex:p.panoIndex,workCode:p.work.workCode}}))}var E="move-to-pano-"+f;this.pending.add(E);var v=this.modelScene.parameter.resolveValue(),y=v.pano0,b=v.pano1,T;if(y&&y.map.name===A?T=y:(b==null?void 0:b.map.name)===A&&(T=b),T){var _={panoId:f,effect:c,panoPicture:{panoId:T.panoId,map:T.map,mapSize:T.mapSize,matrix:p.matrix.clone().premultiply(p.work.transform),zoom:1},position:p.position.clone().applyMatrix4(p.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};_.panoPicture&&this.panoPictureObserverMap.set(_.panoPicture,p),AnimationFrameLoop.shared.add(function(){s.pending.delete(E),s.doMoveToPano(e,_,r)},!0,1);return}this.pendingTextureTask={panoId:f,hash:A,onLoad:function(R){var w;s.pending.delete(E);var M=R.body;if(s.destroyed)M.dispose();else{M.name=A;var O=Array.isArray(M.image)?M.image[0]:M.image,C=(w=O==null?void 0:O.width)!==null&&w!==void 0?w:2048,P={panoId:f,effect:c,panoPicture:{panoId:f,map:M,mapSize:C,matrix:p.matrix.clone().premultiply(p.work.transform),zoom:1},position:p.position.clone().applyMatrix4(p.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};P.panoPicture&&s.panoPictureObserverMap.set(P.panoPicture,p),s.doMoveToPano(e,P,r)}},onError:function(R){s.pending.delete(E);var w=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:R,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:R,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("error",R),r.moveCancelCallback&&r.moveCancelCallback()}};var S=this.panoMeshes.get(f);S&&S.tap&&S.tap(),this.textureLoader.loadCubeTexture(g,{imageURL:{transform:d,options:h},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(R){var w,M;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:R,meta:null,pano:e})),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===A&&((M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(R))},this.renderer).then(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===A?(s.pendingTextureTask.onLoad(R),(M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:R.meta,pano:e}))):R.body.dispose()}).catch(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===A&&(s.pendingTextureTask.onError(R),(M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:R,progress:0,meta:null,pano:e})),s.emit("error",R))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial,s=o.duration,u=o.effect,l=o.userAction;e.userAction=l;var c=t.initAnimationEndState(e),f={workCode:c.workCode,panoIndex:c.panoIndex},p={modelAlpha:0},d={perspToOrtho:0},h=!1;e.moveToPano(f,{longitude:c.longitude,latitude:c.latitude,fov:c.fov,effect:u,duration:s,moveStartCallback:function(g){h=!0,e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:p}],s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction}))},moveEndCallback:function(g){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()},moveCancelCallback:function(){var g=__assign(__assign(__assign({},f),{mode:e.mode}),clonePose(e.camera.pose));h===!1&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()}},l)})},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var r=0,o=1;o<e.length;o++){var s=this.panoResourceFromLocationMotionKeyframe(e[o-1]).position,u=this.panoResourceFromLocationMotionKeyframe(e[o]).position,l=s.distanceTo(u)*(e[o].value.count-e[o-1].value.count);r+=l}return r},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,A,m,E;o===void 0&&(o={});var v=now(),y=createUuid();this.panoResources[y]=r;var b=1,T,_,S;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(v);R[0];var w=R[1],M=this.locationMotion.value,O=((u=this.panoResourceFromLocationMotionKeyframe(w))!==null&&u!==void 0?u:this.camera).position,C=r.position;T=Math.max(O.distanceTo(C),b),_=[{key:w.key,progress:0,value:__assign(__assign({},M),{count:0})},{key:y,progress:1,value:{distance:0,count:1}}],S=0}else{var P=this.locationMotion.getKeyFrameSegment(v),F=P[0],w=P[1],M=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(F).position,O=this.panoResourceFromLocationMotionKeyframe(w).position,C=r.position,H=w.value.count-M.count,N=Math.max(L.distanceTo(O),b)*H,D=Math.max(O.distanceTo(C),b);T=N+D,_=[{key:F.key,progress:0,value:__assign({},M)},{key:w.key,progress:N/T,value:w.value},{key:y,progress:1,value:{count:w.value.count+1,distance:0}}];var Q=this.locationMotionKeyframesLength(this.locationMotion.keyframes),J=this.locationMotionKeyframesLength(_);Q===0||Q===0?S=0:S=this.locationMotion.getProgressVelocity(v)*Q/J}var U=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?T:0),z={longitude:o.longitude,latitude:o.latitude,fov:o.fov},q=__assign(__assign({},e),{mode:this.mode,longitude:(l=z.longitude)!==null&&l!==void 0?l:this.camera.pose.longitude,latitude:(c=z.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(f=z.fov)!==null&&f!==void 0?f:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),j=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:j,progress:0,state:q,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(q),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(z,U).catch(noop);else{var G=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),X=coordinatesToVector({longitude:(p=z.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(d=z.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),Y=new THREE__namespace.Object3D;Y.lookAt(G);var Z=new THREE__namespace.Matrix4().makeRotationFromQuaternion(Y.quaternion);Y.lookAt(X);var W=new THREE__namespace.Matrix4().makeRotationFromQuaternion(Y.quaternion),K=new THREE__namespace.Matrix4().getInverse(Z).premultiply(W),ne=this.cameraMotion.value.fov,ee=(h=z.fov)!==null&&h!==void 0?h:this.cameraMotion.value.fov,te=1;r.effect==="zoomin"?te=1.5:r.effect==="zoomout"&&(te=.4);for(var ae=clamp$1(ee*te,1,170),fe=0;fe<_.length-1;fe++){var se=_[fe].key;if(se){var he=this.panoResources[se];he&&(he.fixCameraTransform.copy(K),he.panoPicture&&(he.panoPicture.zoom=Math.tan(ae/2/180*Math.PI)/Math.tan(ne/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(g=z.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(A=z.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:ae}},{progress:1,value:{longitude:(m=z.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(E=z.latitude)!==null&&E!==void 0?E:this.cameraMotion.value.latitude,fov:ee}}],U).catch(noop)}var me=this.locationMotion.setKeyframes(_,U,S);me.then(function(){for(var be=0,Te=s.modelScene.children;be<Te.length;be++){var ce=Te[be];ce instanceof Model&&ce.show()}var pe=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:s.camera.pose.distance});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:j,progress:1,state:pe,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(pe);var re=s.works.getObserver(e);if(re&&re.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var ue={map:s.videoTexture,size:re.video.size.clone(),matrix:re.video.matrix.clone(),panoMatrix:re.matrix.clone().premultiply(re.work.transform),alpha:1},ve=createUuid(),ye=s.videoTexture.image;ye.setAttribute("uuid",ve),canplayVideo().then(function(De){De&&re.video&&ye.getAttribute("uuid")===ve&&(ye.oncanplay=function(){ye.oncanplay=noop,ye.play()},ye.ontimeupdate=function(){ye.currentTime>.5&&(ye.ontimeupdate=noop,s.panoVideo.setMaterial(ue))},ye.src=re.video.source)}).catch((function(){ye.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:j,progress:0,state:q,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.getForwardObserverOrNot=function(e,r){var o=this,s=this.works.getObserver(this.currentPano);if(!s)return null;var u=r!=null?r:new THREE__namespace.Raycaster(e.position.clone(),e.getWorldDirection(new THREE__namespace.Vector3));u.params.Points={threshold:.1},u.firstHitOnly=!0,u.floorIndex=-1;var l=s.standingPosition.clone().applyMatrix4(s.work.transform),c=s.position.clone().applyMatrix4(s.work.transform);if(c.distanceTo(u.ray.origin)>1){var f=new THREE__namespace.Raycaster(u.ray.origin,new THREE__namespace.Vector3(0,-1,0));f.firstHitOnly=u.firstHitOnly,f.floorIndex=u.floorIndex;var p=this.modelScene.intersectRaycaster(f)[0];p&&p.distance<=2?l.copy(p.point):l.copy(u.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var d=this.modelScene.intersectRaycaster(u)[0],h=d?d.point:u.ray.origin.clone().add(u.ray.direction.clone().normalize().multiplyScalar(3)),g=h.clone().sub(l).normalize();if(g.length()===0)return null;for(var A=s.work.observers,m=s.accessibleNodes.filter(function(O){if(O===o.currentPano.panoIndex&&s.work.workCode===o.currentPano.workCode)return!1;var C=A[O];if(!C)return!1;var P=C.standingPosition.clone().applyMatrix4(C.work.transform).project(e);return Math.abs(P.z)>1||Math.abs(P.x)>1||Math.abs(P.y)>1?!1:C.loadable||C.active}),E=new Map,v=m.slice().sort(function(O,C){var P=A[O],F=E.get(P);typeof F=="undefined"&&(F=scratchVector3$3.copy(P.standingPosition).applyMatrix4(P.work.transform).distanceTo(l),E.set(P,F));var L=A[C],H=E.get(L);return typeof H=="undefined"&&(H=scratchVector3$3.copy(L.standingPosition).applyMatrix4(L.work.transform).distanceTo(l),E.set(L,H)),F-H}),y=0,b=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];y<b.length;y++)for(var T=b[y],_=0,S=v;_<S.length;_++){var R=S[_],w=A[R];if(w){var M=scratchVector3$3.copy(w.standingPosition).applyMatrix4(w.work.transform).sub(l);if(M&&M.length()!==0&&g.angleTo(M)<T)return w}}return null},t.prototype.onTapGesture=function(e){var r=this,o;if(this.userAction=e.userAction,this.stopMomentumMovement(),!!this.initAnimationed){if(!this.locationMotion.ended){var s=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]);if(s.panoId!==panoStringify(this.currentPano))return}var u=e.center.raycaster;u.floorIndex=-1;var l=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),c=null,f=this.works.getObserver(this.currentPano);if(f){var p=f.work.observers,d=f.accessibleNodes.filter(function(G){if(G===r.currentPano.panoIndex&&f.work.workCode===r.currentPano.workCode)return!1;var X=p[G];if(!X)return!1;var Y=scratchVector3$3.copy(X.position).applyMatrix4(X.work.transform);return Y.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:X.loadable||X.active}),h=this.modelScene.intersectRaycaster(u)[0];if(h){var g=arrayMin(d,function(G){var X=p[G];if(!X)return 1/0;var Y=scratchVector3$3.copy(X.standingPosition).applyMatrix4(X.work.transform);return Y.distanceTo(h.point)},!0),A=g[0],m=g[1];typeof A=="number"&&m<this.panoTapTriggerRadius&&(c=(o=p[A])!==null&&o!==void 0?o:null)}c||(c=this.getForwardObserverOrNot(this.camera,u));for(var E=0,v=this.locationMotion.keyframes;E<v.length;E++){var y=v[E],b=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&c){var T=panoStringify({panoIndex:c.panoIndex,workCode:c.work.workCode});if(b.panoId===T){c=null;break}}}if(!c)this.emit("gesture.tap",e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{for(var _={},S=Math.PI/6,R=Math.PI/12,w=c.position.clone().applyMatrix4(c.work.transform).setY(0).sub(f.position.clone().applyMatrix4(c.work.transform).setY(0)).normalize(),M=[],O=[],C=[],P=c.work.observers,F=0,L=c.accessibleNodes;F<L.length;F++){var A=L[F];if(c.panoIndex!==A&&!(A===this.currentPano.panoIndex&&c.work.workCode===this.currentPano.workCode)){var H=P[A];if(H){var N=H.position.clone().applyMatrix4(H.work.transform).sub(c.position.clone().applyMatrix4(c.work.transform)).setY(0).normalize();w.angleTo(N)<S&&C.push(N)}}}var D=C.length>0?C:__spreadArray(__spreadArray([],M,!0),O,!0),Q=D.slice().sort(function(G,X){return G.angleTo(w)-X.angleTo(w)})[0];if(Q&&Q.angleTo(l)>R&&(_.longitude=Math.atan2(-Q.x,-Q.z)),this.cameraMotion.value.latitude<-Math.PI/4){var J=e.state.fov,U=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(J):this.minLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(J):this.maxLatitude,-Math.PI/2,Math.PI/2);_.latitude=clamp$1(0,U,z)}var q=__assign({},e.state);if(q.workCode=c.work.workCode,q.panoIndex=c.panoIndex,_.longitude!==void 0&&(q.longitude=_.longitude),_.latitude!==void 0&&(q.latitude=_.latitude),_.fov!==void 0&&(q.fov=_.fov),q.distance=0,q.offset=c.position.clone(),e.state=q,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:q,userAction:e.userAction,options:_,progress:0,error:null})),c&&!c.active){var T=panoStringify({panoIndex:c.panoIndex,workCode:c.work.workCode}),j=this.panoMeshes.get(T);j&&(j.setDisabled(!1),j.setLoading(!0))}c&&c.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:q,options:_,error:null}))}}}}},t})(PanoramaLikeController),DEG_TO_RAD=Math.PI/180,RAD_TO_DEG=180/Math.PI,MIN_TIMESTEP=.001,MAX_TIMESTEP=1,isIOS=(function(){var n=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return n}})(),isSafari=(function(){var n=typeof navigator!="undefined"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return n}})(),isFirefoxAndroid=(function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("Firefox")!==-1&&navigator.userAgent.indexOf("Android")!==-1;return function(){return n}})(),getChromeVersion=(function(){var n=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=n?parseInt(n[1],10):null;return function(){return t}})(),isChromeWithoutDeviceMotion=(function(){var n=!1;if(getChromeVersion()===65){var t=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var e=t[1].split(".");e[0],e[1];var r=e[2],o=e[3];n=parseInt(r,10)===3325&&parseInt(o,10)<148}}return function(){return n}})(),isSafariWithoutDeviceMotion=(function(){var n=isIOS()&&isSafari()&&typeof navigator!="undefined"&&navigator.userAgent.indexOf("13_4")!==-1;return function(){return n}})(),isR7=(function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("R7 Build")!==-1;return function(){return n}})();function isLandscapeMode(){var n=typeof window!="undefined"&&(window.orientation==90||window.orientation==-90);return isR7()?!n:n}function isTimestampDeltaValid(n){return!(isNaN(n)||n<=MIN_TIMESTEP||n>MAX_TIMESTEP)}function getQuaternionAngle(n){if(n.w>1)return 0;var t=2*Math.acos(n.w);return t}var warnOnce=(function(){var n={};return function(t,e){n[t]===void 0&&(console.warn("cardboard: "+e),n[t]=!0)}})();function getOriginFromUrl(n){var t,e=n.indexOf("://");e!==-1?t=e+3:t=0;var r=n.indexOf("/",t);return r===-1&&(r=n.length),n.substring(0,r)}function isInsideCrossOriginIFrame(){if(typeof window=="undefined"||typeof document=="undefined")return!1;var n=window.self!==window.top,t=getOriginFromUrl(document.referrer),e=getOriginFromUrl(window.location.href);return n&&t!==e}var updateEyeViewMatrices=(function(){function n(r,o,s){var u=o?o[0]:0,l=o?o[1]:0,c=o?o[2]:0,f=o?o[3]:1,p=u+u,d=l+l,h=c+c,g=u*p,A=u*d,m=u*h,E=l*d,v=l*h,y=c*h,b=f*p,T=f*d,_=f*h;return r[0]=1-(E+y),r[1]=A+_,r[2]=m-T,r[3]=0,r[4]=A-_,r[5]=1-(g+y),r[6]=v+b,r[7]=0,r[8]=m+T,r[9]=v-b,r[10]=1-(g+E),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function t(r,o,s){var u=s[0],l=s[1],c=s[2],f,p,d,h,g,A,m,E,v,y,b,T;return o===r?(r[12]=o[0]*u+o[4]*l+o[8]*c+o[12],r[13]=o[1]*u+o[5]*l+o[9]*c+o[13],r[14]=o[2]*u+o[6]*l+o[10]*c+o[14],r[15]=o[3]*u+o[7]*l+o[11]*c+o[15]):(f=o[0],p=o[1],d=o[2],h=o[3],g=o[4],A=o[5],m=o[6],E=o[7],v=o[8],y=o[9],b=o[10],T=o[11],r[0]=f,r[1]=p,r[2]=d,r[3]=h,r[4]=g,r[5]=A,r[6]=m,r[7]=E,r[8]=v,r[9]=y,r[10]=b,r[11]=T,r[12]=f*u+g*l+v*c+o[12],r[13]=p*u+A*l+y*c+o[13],r[14]=d*u+m*l+b*c+o[14],r[15]=h*u+E*l+T*c+o[15]),r}function e(r,o){var s=o[0],u=o[1],l=o[2],c=o[3],f=o[4],p=o[5],d=o[6],h=o[7],g=o[8],A=o[9],m=o[10],E=o[11],v=o[12],y=o[13],b=o[14],T=o[15],_=s*p-u*f,S=s*d-l*f,R=s*h-c*f,w=u*d-l*p,M=u*h-c*p,O=l*h-c*d,C=g*y-A*v,P=g*b-m*v,F=g*T-E*v,L=A*b-m*y,H=A*T-E*y,N=m*T-E*b,D=_*N-S*H+R*L+w*F-M*P+O*C;return D?(D=1/D,r[0]=(p*N-d*H+h*L)*D,r[1]=(l*H-u*N-c*L)*D,r[2]=(y*O-b*M+T*w)*D,r[3]=(m*M-A*O-E*w)*D,r[4]=(d*F-f*N-h*P)*D,r[5]=(s*N-l*F+c*P)*D,r[6]=(b*R-v*O-T*S)*D,r[7]=(g*O-m*R+E*S)*D,r[8]=(f*H-p*F+h*C)*D,r[9]=(u*F-s*H-c*C)*D,r[10]=(v*M-y*R+T*_)*D,r[11]=(A*R-g*M-E*_)*D,r[12]=(p*P-f*L-d*C)*D,r[13]=(s*L-u*P+l*C)*D,r[14]=(y*S-v*w-b*_)*D,r[15]=(g*w-A*S+m*_)*D,r):null}return function(r,o,s){n(r,o),s&&t(r,r,s),e(r,r)}})(),SensorSample=(function(){function n(t,e){t===void 0&&(t=new THREE__namespace.Vector3),e===void 0&&(e=0),this.sample=t,this.timestampS=e}return n.prototype.set=function(t,e){this.sample=t,this.timestampS=e},n.prototype.copy=function(t){this.set(t.sample,t.timestampS)},n})(),ComplementaryFilter=(function(){function n(t,e){this.kFilter=t,this.isDebug=e,this.currentAccelMeasurement=new SensorSample,this.currentGyroMeasurement=new SensorSample,this.previousGyroMeasurement=new SensorSample,isIOS()?this.filterQ=new THREE__namespace.Quaternion(-1,0,0,1):this.filterQ=new THREE__namespace.Quaternion(1,0,0,1),this.previousFilterQ=new THREE__namespace.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new THREE__namespace.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new THREE__namespace.Vector3,this.measuredGravity=new THREE__namespace.Vector3,this.gyroIntegralQ=new THREE__namespace.Quaternion}return n.prototype.addAccelMeasurement=function(t,e){this.currentAccelMeasurement.set(t,e)},n.prototype.addGyroMeasurement=function(t,e){this.currentGyroMeasurement.set(t,e);var r=e-this.previousGyroMeasurement.timestampS;isTimestampDeltaValid(r)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},n.prototype.getOrientation=function(){return this.filterQ},n.prototype.run_=function(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);var r=new THREE__namespace.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var o=new THREE__namespace.Quaternion;o.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),o.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",RAD_TO_DEG*getQuaternionAngle(o),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var s=new THREE__namespace.Quaternion;s.copy(this.filterQ),s.multiply(o),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},n.prototype.accelToQuaternion_=function(t){var e=new THREE__namespace.Vector3;e.copy(t),e.normalize();var r=new THREE__namespace.Quaternion;return r.setFromUnitVectors(new THREE__namespace.Vector3(0,0,-1),e),r.inverse(),r},n.prototype.gyroToQuaternionDelta_=function(t,e){var r=new THREE__namespace.Quaternion,o=new THREE__namespace.Vector3;return o.copy(t),o.normalize(),r.setFromAxisAngle(o,t.length()*e),r},n})(),PosePredictor=(function(){function n(t,e){this.predictionTimeS=t,this.isDebug=e,this.previousQ=new THREE__namespace.Quaternion,this.previousTimestampS=null,this.deltaQ=new THREE__namespace.Quaternion,this.outQ=new THREE__namespace.Quaternion}return n.prototype.getPrediction=function(t,e,r){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=r,t;var o=new THREE__namespace.Vector3;o.copy(e),o.normalize();var s=e.length();if(s<DEG_TO_RAD*20)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(RAD_TO_DEG*s).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var u=s*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(o,u),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=r,this.outQ},n})(),Distortion=(function(){function n(t){this.coefficients=t}return n.prototype.distortInverse=function(t){for(var e=0,r=1,o=t-this.distort(e);Math.abs(r-e)>1e-4;){var s=t-this.distort(r),u=r-s*((r-e)/(s-o));e=r,r=u,o=s}return r},n.prototype.distort=function(t){for(var e=t*t,r=0,o=0;o<this.coefficients.length;o++)r=e*(r+this.coefficients[o]);return(r+1)*t},n})(),Pose=(function(){function n(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}return n})(),FieldOfView=(function(){function n(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}return n})(),Sensor=(function(){function n(t,e,r,o){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new THREE__namespace.Vector3,this.gyroscope=new THREE__namespace.Vector3,this.filter=new ComplementaryFilter(t,o),this.posePredictor=new PosePredictor(e,o),this.isFirefoxAndroid=isFirefoxAndroid(),this.isIOS=isIOS();var s=getChromeVersion();this.isDeviceMotionInRadians=!this.isIOS&&s!==null&&s<66,this.isWithoutDeviceMotion=isChromeWithoutDeviceMotion()||isSafariWithoutDeviceMotion(),this.filterToWorldQ=new THREE__namespace.Quaternion,isIOS()?this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new THREE__namespace.Quaternion,this.worldToScreenQ=new THREE__namespace.Quaternion,this.originalPoseAdjustQ=new THREE__namespace.Quaternion;var u=typeof window!="undefined"?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),u),this.setScreenTransform_(),isLandscapeMode()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new THREE__namespace.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return n.prototype.getPosition=function(){return null},n.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(function(){var s=new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,0,-1),0),u=new THREE__namespace.Quaternion;return typeof window!="undefined"&&window.orientation===-90?u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/-2):u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/2),s.multiply(u)})(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||(function(){var s=new THREE__namespace.Quaternion;return s.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),s})(),t=this._deviceOrientationQ;var e=new THREE__namespace.Quaternion;return e.copy(t),e.multiply(this.deviceOrientationFilterToWorldQ),e.multiply(this.resetQ),e.multiply(this.worldToScreenQ),e.multiplyQuaternions(this.deviceOrientationFixQ,e),this.yawOnly&&(e.x=0,e.z=0,e.normalize()),this.orientationOut_[0]=e.x,this.orientationOut_[1]=e.y,this.orientationOut_[2]=e.z,this.orientationOut_[3]=e.w,this.orientationOut_}else{var r=this.filter.getOrientation();t=this.posePredictor.getPrediction(r,this.gyroscope,this.previousTimestampS)}var o=new THREE__namespace.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(t),o.multiply(this.worldToScreenQ),this.yawOnly&&(o.x=0,o.z=0,o.normalize()),this.orientationOut_[0]=o.x,this.orientationOut_[1]=o.y,this.orientationOut_[2]=o.z,this.orientationOut_[3]=o.w,this.orientationOut_},n.prototype.getPose=function(){var t=new Pose;return t.orientation=this.getOrientation(),t},n.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),isLandscapeMode()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},n.prototype.getFrameData=function(t){var e=this.getOrientation(),r=this.getEyeOffset(),o=this.getEyeProjectionMatrix();return t.pose.angularAcceleration=null,t.pose.angularVelocity=null,t.pose.linearAcceleration=null,t.pose.linearVelocity=null,t.pose.orientation=e,t.pose.position=null,t.timestamp=this.previousTimestampS,t.leftProjectionMatrix.set(o.left),t.rightProjectionMatrix.set(o.right),updateEyeViewMatrices(t.leftViewMatrix,e,r.left),updateEyeViewMatrices(t.rightViewMatrix,e,r.right),t},n.prototype.start=function(){if(typeof window=="undefined")return function(){};var t=this.onDeviceMotion_.bind(this),e=this.onOrientationChange_.bind(this),r=this.onMessage_.bind(this),o=this.onDeviceOrientation_.bind(this);return isIOS()&&isInsideCrossOriginIFrame()&&window.addEventListener("message",r),window.addEventListener("orientationchange",e),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",o):window.addEventListener("devicemotion",t),function(){window.removeEventListener("devicemotion",t),window.removeEventListener("deviceorientation",e),window.removeEventListener("orientationchange",e),window.removeEventListener("message",r)}},n.prototype.getEyeOffset=function(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}},n.prototype.getEyeProjectionMatrix=function(){var t=this.getEyeFieldOfView(),e=this.depthNear,r=this.depthFar,o={left:[],right:[]};{var s=t.left.upDegrees*DEG_TO_RAD,u=t.left.downDegrees*DEG_TO_RAD,l=t.left.leftDegrees*DEG_TO_RAD,c=t.left.rightDegrees*DEG_TO_RAD,f=2/(l+c),p=2/(s+u);o.left[0]=f,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=p,o.left[6]=0,o.left[7]=0,o.left[8]=-((l-c)*f*.5),o.left[9]=(s-u)*p*.5,o.left[10]=r/(e-r),o.left[11]=-1,o.left[12]=0,o.left[13]=0,o.left[14]=r*e/(e-r),o.left[15]=0}{var s=t.right.upDegrees*DEG_TO_RAD,u=t.right.downDegrees*DEG_TO_RAD,l=t.right.leftDegrees*DEG_TO_RAD,c=t.right.rightDegrees*DEG_TO_RAD,f=2/(l+c),p=2/(s+u);o.right[0]=f,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=p,o.right[6]=0,o.right[7]=0,o.right[8]=-((l-c)*f*.5),o.right[9]=(s-u)*p*.5,o.right[10]=r/(e-r),o.right[11]=-1,o.right[12]=0,o.right[13]=0,o.right[14]=r*e/(e-r),o.right[15]=0}return o},n.prototype.getEyeFieldOfView=function(){var t=this.viewer,e=this.device,r=new Distortion(t.distortionCoefficients),o=t.screenLensDistance,s=(e.widthMeters-t.interLensDistance)/2,u=t.interLensDistance/2,l=t.baselineLensDistance-e.bevelMeters,c=e.heightMeters-l,f=RAD_TO_DEG*Math.atan(r.distort(s/o)),p=RAD_TO_DEG*Math.atan(r.distort(u/o)),d=RAD_TO_DEG*Math.atan(r.distort(l/o)),h=RAD_TO_DEG*Math.atan(r.distort(c/o)),g=new FieldOfView,A=new FieldOfView;return g.leftDegrees=Math.min(f,t.fov),g.rightDegrees=Math.min(p,t.fov),g.downDegrees=Math.min(d,t.fov),g.upDegrees=Math.min(h,t.fov),A.leftDegrees=g.rightDegrees,A.rightDegrees=g.leftDegrees,A.upDegrees=g.upDegrees,A.downDegrees=g.downDegrees,{left:g,right:A}},n.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new THREE__namespace.Quaternion;var e=t.alpha,r=t.beta,o=t.gamma;e=(e||0)*Math.PI/180,r=(r||0)*Math.PI/180,o=(o||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new THREE__namespace.Euler(e,r,-o,"YXZ"))},n.prototype.onDeviceMotion_=function(t){this.updateDeviceMotion_(t)},n.prototype.updateDeviceMotion_=function(t){var e=t.accelerationIncludingGravity,r=t.rotationRate,o=t.timeStamp/1e3,s=o-this.previousTimestampS;if(s<0){warnOnce("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),this.previousTimestampS=o;return}else if(s<=MIN_TIMESTEP||s>MAX_TIMESTEP){warnOnce("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),this.previousTimestampS=o;return}e&&(this.accelerometer.set(-e.x,-e.y,-e.z),r&&(isR7()?this.gyroscope.set(-r.beta,r.alpha,r.gamma):this.gyroscope.set(r.alpha,r.beta,r.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,o)),this.filter.addAccelMeasurement(this.accelerometer,o)),this.previousTimestampS=o},n.prototype.onOrientationChange_=function(){this.setScreenTransform_()},n.prototype.onMessage_=function(t){var e=t.data;if(!(!e||!e.type)){var r=e.type.toLowerCase();r==="devicemotion"&&this.updateDeviceMotion_(e.deviceMotionEvent)}},n.prototype.setScreenTransform_=function(){this.worldToScreenQ.set(0,0,0,1);var t=typeof window!="undefined"?window.orientation:0;switch(t){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),Math.PI/2);break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},n})(),defaultLeftBounds=[0,0,.5,1],defaultRightBounds=[.5,0,.5,1],Cardboard=(function(){function n(t){var e=this;this.renderer=t,this.sensor=new Sensor(.98,.04,!1,!1),this.scale=1,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera;var r=this.sensor.start();this.dispose=function(){var o=e.renderer.getSize(new THREE__namespace.Vector2);e.renderer.setScissor(0,0,o.width,o.height),e.renderer.setViewport(0,0,o.width,o.height),e.renderer.setScissorTest(!1),r()}}return n.prototype.render=function(t,e){var r=this.renderer.getSize(new THREE__namespace.Vector2);if(r.width>r.height){var o=t.autoUpdate;o&&(t.updateMatrixWorld(),t.autoUpdate=!1);var s={x:Math.round(r.width*defaultLeftBounds[0]),y:Math.round(r.height*defaultLeftBounds[1]),width:Math.round(r.width*defaultLeftBounds[2]),height:Math.round(r.height*defaultLeftBounds[3])},u={x:Math.round(r.width*defaultRightBounds[0]),y:Math.round(r.height*defaultRightBounds[1]),width:Math.round(r.width*defaultRightBounds[2]),height:Math.round(r.height*defaultRightBounds[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),e.parent===null&&e.updateMatrixWorld(),e.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),e.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var l=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.left),this.scale),this.cameraR.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.right),this.scale);var c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(s.x,s.y,s.width,s.height),this.renderer.setScissor(s.x,s.y,s.width,s.height),this.renderer.render(t,this.cameraL),this.renderer.setViewport(u.x,u.y,u.width,u.height),this.renderer.setScissor(u.x,u.y,u.width,u.height),this.renderer.render(t,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),o&&(t.autoUpdate=!0)}else this.renderer.render(t,e)},n.prototype.dispose=function(){},n})();const cardboard="data:image/png;base64,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",phone="data:image/png;base64,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";var _a,LOCALE={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},TEXT=typeof navigator!="undefined"&&(_a=LOCALE[navigator.language.split("-")[0]])!==null&&_a!==void 0?_a:LOCALE.zh,CONTENTS=`
|
|
1573
|
+
`,depthMaterial=new THREE__namespace.ShaderMaterial({vertexShader:depthVertexShader,fragmentShader:depthFragmentShader,uniforms:{maxDepth:new THREE__namespace.Uniform(0)}});function renderDepthCube(n,t,e,r){r===void 0&&(r=1e3),depthMaterial.uniforms.maxDepth.value=r,scratchPrevClearColor.copy(n.getClearColor());var o=n.getClearAlpha(),s=t.overrideMaterial;t.overrideMaterial=depthMaterial,n.setClearColor(clearColor,0),e.update(n,t),n.setClearColor(scratchPrevClearColor,o),t.overrideMaterial=s}var scratchRaycaster$1=new THREE__namespace.Raycaster,scratchVector3$3=new THREE__namespace.Vector3,adjustPanoCircleMeshVectors=[new THREE__namespace.Vector3(0,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(1,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,+Math.sqrt(3)/2).multiplyScalar(.1)],defaultPanoramaControllerCustomInitArgs=__assign(__assign({},defaultPanoramaLikeControllerCustomInitArgs),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:function(n){return new PanoCircleMesh},adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:(function(n,t){var e,r=function(l){return l/180*Math.PI},o=(e=Math.log2)!==null&&e!==void 0?e:(function(l){return Math.log(l)*Math.LOG2E}),s=t.height/2/Math.tan(r(n/2))*Math.tan(r(45))*2,u=Math.max(o(s/512),0);return u<2.3&&u>.1&&(u=1),u=u%1>.75?Math.ceil(u):Math.floor(u),u}),tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),PanoramaController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="Panorama",r.initAnimationed=!1,r.maxAccessibleDistance=o.maxAccessibleDistance,r.panoTapTriggerRadius=o.panoTapTriggerRadius,r.panoCircleMeshCreator=o.panoCircleMeshCreator,r.adjustPanoCircleMeshPositionBasedOnModel=o.adjustPanoCircleMeshPositionBasedOnModel,r.tileLevelForFov=o.tileLevelForFov,r.tileAppearDuration=o.tileAppearDuration,r.tileMaxRequest=o.tileMaxRequest,r.flyEffectUseDepthBuffer=o.flyEffectUseDepthBuffer,r.adjustPanoCircleMeshPositionFix=new Map;var s=r.modelScene.parameter.resolveValue(),u=s.pano0,l=s.pano1;u&&(l==null?void 0:l.map)!==u.map&&(r.modelScene.parameter.set({pano0:l}),u.map.dispose());var c=new Set;return u&&c.add(u),l&&c.add(l),r.panoMeshes=new Map,r.locationMotion=new Motion({count:0,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),panoPicture:r.modelScene.parameter.resolveValue().pano1,position:r.camera.pose.offset.clone(),effect:"fly",fixCameraTransform:new THREE__namespace.Matrix4},r.panoPictureObserverMap=new WeakMap,r.textureLoader=new TextureLoader,r.tiling=new Tiling,r.panoVideo=new PanoVideo,r.scene.add(r.panoVideo.object),r.accessibleObserverFloorCheckCount=0,r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,p;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{maxAccessibleDistance:(r=e.maxAccessibleDistance)!==null&&r!==void 0?r:defaultPanoramaControllerCustomInitArgs.maxAccessibleDistance,panoTapTriggerRadius:(o=e.panoTapTriggerRadius)!==null&&o!==void 0?o:defaultPanoramaControllerCustomInitArgs.panoTapTriggerRadius,panoCircleMeshCreator:(s=e.panoCircleMeshCreator)!==null&&s!==void 0?s:defaultPanoramaControllerCustomInitArgs.panoCircleMeshCreator,adjustPanoCircleMeshPositionBasedOnModel:(u=e.adjustPanoCircleMeshPositionBasedOnModel)!==null&&u!==void 0?u:defaultPanoramaControllerCustomInitArgs.adjustPanoCircleMeshPositionBasedOnModel,tileLevelForFov:(l=e.tileLevelForFov)!==null&&l!==void 0?l:defaultPanoramaControllerCustomInitArgs.tileLevelForFov,tileAppearDuration:(c=e.tileAppearDuration)!==null&&c!==void 0?c:defaultPanoramaControllerCustomInitArgs.tileAppearDuration,tileMaxRequest:(f=e.tileMaxRequest)!==null&&f!==void 0?f:defaultPanoramaControllerCustomInitArgs.tileMaxRequest,flyEffectUseDepthBuffer:(p=e.flyEffectUseDepthBuffer)!==null&&p!==void 0?p:defaultPanoramaControllerCustomInitArgs.flyEffectUseDepthBuffer})},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"Panorama"})},Object.defineProperty(t.prototype,"tileLevel",{get:function(){return this.tiling.level},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e){var r=this,o=n.prototype.updateConfiguration.call(this,e);return o===!1?!1:(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,this.panoMeshes&&(this.panoMeshes.forEach(function(s){r.helper.remove(s),s.dispose()}),this.panoMeshes.clear())),e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)},t.prototype.destroy=function(){var e=this;n.prototype.destroy.call(this),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),delete this.pendingTextureTask,this.panoMeshes&&(this.panoMeshes.forEach(function(h){e.helper.remove(h),h.dispose()}),this.panoMeshes.clear());var r=this.videoTexture.image;r.pause(),r.oncanplay=noop,r.ontimeupdate=noop,this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=this.modelScene.parameter.resolveValue(),s=o.pano0,u=o.pano1,l=0,c=Object.keys(this.panoResources);l<c.length;l++){var f=c[l],p=this.panoResources[f];if(p.panoPicture){var d=p.panoPicture.map;d&&d!==(s==null?void 0:s.map)&&d!==(u==null?void 0:u.map)&&(d.dispose(),p.panoPicture=null)}delete this.panoResources[f]}},t.prototype.isReady=function(){return this.locationMotion.ended!==!0?!1:n.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e=this.tiling.pedding,r=e<=0;return this.initAnimationed&&r},t.prototype.updateWork=function(e,r,o,s){var u=this;this.userAction=s,this.works=e;var l=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}})),c={workCode:l.workCode,panoIndex:l.panoIndex};return this.initAnimationed=!1,this.hideIntersectMesh(),this.moveToPano(c,{effect:o.effect,duration:o.duration,longitude:r.longitude,latitude:r.latitude,fov:r.fov,moveEndCallback:function(){u.initAnimationed=!0},moveCancelCallback:function(){u.initAnimationed=!0}},s),!0},t.prototype.updateModel=function(e){this.modelScene=e,this.hideIntersectMesh()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,p;if(!this.destroyed){var d={},h={},g=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],m=this.locationMotion.getKeyFrameSegment(e),E=m[0],v=m[1],y=this.panoResourceFromLocationMotionKeyframe(E),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(g),_=this.panoResourceFromLocationMotionKeyframe(A),S=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),h.longitude=this.cameraMotion.value.longitude,h.latitude=this.cameraMotion.value.latitude,h.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var R=new THREE__namespace.Vector3().copy(y.position),w=new THREE__namespace.Vector3().copy(b.position),M=this.locationMotion.value.count-v.value.count+1;if(d.progress=M,b.panoPicture&&(M<1?y.panoPicture&&(d.pano0=y.panoPicture):d.pano0=b.panoPicture,d.pano1=b.panoPicture),b.effect==="montage"?d.transition="BLACK":b.effect==="spread"?d.transition="SPREAD":d.transition="FADE",(b.effect==="zoomin"||b.effect==="zoomout")&&(d.progress=Math.pow(M,3)),M<1&&b.effect!=="fly"){if(d.pano0&&y.panoPicture){var O={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:y.panoPicture.matrix.clone().premultiply(y.fixCameraTransform).setPosition(b.position)},C=this.panoPictureObserverMap.get(d.pano0);C&&this.panoPictureObserverMap.set(O,C),d.pano0=O}R.copy(w),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(R.x+(w.x-R.x)*M,R.y+(w.y-R.y)*M,R.z+(w.z-R.z)*M);for(var P=[],F=[],L=0,H=this.locationMotion.keyframes;L<H.length;L++){var N=H[L],D=N.key,Q=N.progress;D!==void 0&&(P.push(D),Q>this.locationMotion.progress&&F.push(D))}for(var J=0,U=Object.keys(this.panoResources);J<U.length;J++){var z=U[J];if(!(F.indexOf(z)>=0)){var q=this.panoResources[z];if(q.panoPicture){var j=q.panoPicture.map;if(j){if(j===((s=d.pano0)===null||s===void 0?void 0:s.map)||j===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;j.dispose(),q.panoPicture=null}}P.indexOf(z)>=0||delete this.panoResources[z]}}var G=panoParse(b.panoId);G!==this.currentPano&&(this.currentPano=G,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(T.panoId),state:__assign(__assign(__assign(__assign({},panoParse(_.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),isEmptyObject(h)===!1&&this.setCamera(h);var X=this.works.getObserver(this.currentPano),Y=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,Z=this.works.getObserver(y.panoId),W=this.works.getObserver(b.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&X){for(var K=[],ne=X.work.observers,ee=0,te=X.accessibleNodes;ee<te.length;ee++){var ae=te[ee],C=ne[ae];C&&K.push(C)}var fe=new Map;if(K.sort(function(oe,_e){var Me=fe.get(oe);typeof Me=="undefined"&&(Me=oe.standingPosition.distanceTo(X.standingPosition),fe.set(oe,Me));var xe=fe.get(oe);return typeof xe=="undefined"&&(xe=_e.standingPosition.distanceTo(X.standingPosition),fe.set(_e,xe)),Me-xe}),K.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%K.length;var se=K[this.accessibleObserverFloorCheckCount],he=this.modelScene.models.find(function(oe){return oe.work===(se==null?void 0:se.work)});if(se&&he&&he.visible){var me=.3,be=.05,Te=.005,ce=se.standingPosition.clone().applyMatrix4(se.work.transform),pe=panoStringify({panoIndex:se.panoIndex,workCode:se.work.workCode}),re=adjustPanoCircleMeshVectors.map(function(oe){scratchRaycaster$1.ray.origin.copy(ce),scratchRaycaster$1.ray.origin.add(scratchVector3$3.copy(oe).setY(me)),scratchRaycaster$1.ray.direction.set(0,-1,0),scratchRaycaster$1.firstHitOnly=!0,scratchRaycaster$1.floorIndex=-1;var _e=he.intersectRaycaster(scratchRaycaster$1)[0];return _e&&_e.distance-Te<=me?new THREE__namespace.Vector3().copy(ce).setY(_e.point.y+Te):ce});re.sort(function(oe,_e){return _e.y-oe.y});var ue=re[Math.floor(re.length/2)],ve=re.filter(function(oe){return oe.distanceTo(ue)<=be})[0];if(ve){var ge=new THREE__namespace.Vector4(ce.x,ce.y,ce.z,ve.y-ce.y),Le=this.adjustPanoCircleMeshPositionFix.get(pe);Le&&!ge.equals(Le)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(pe,ge)}}this.accessibleObserverFloorCheckCount++}}var qe=new Map;if(Z)for(var $e=0,Ve=Z.accessibleNodes;$e<Ve.length;$e++){var ae=Ve[$e],C=Z.work.observers[ae];if(C){var pe=panoStringify({panoIndex:C.panoIndex,workCode:C.work.workCode});qe.set(pe,C)}}if(W)for(var de=0,Ye=W.accessibleNodes;de<Ye.length;de++){var ae=Ye[de],C=W.work.observers[ae];if(C){var pe=panoStringify({panoIndex:C.panoIndex,workCode:C.work.workCode});qe.set(pe,C)}}if(this.panoMeshes.forEach(function(oe,_e){var Me=qe.get(_e);if(Me){oe.position.copy(Me.standingPosition).applyMatrix4(Me.work.transform);var xe=o.adjustPanoCircleMeshPositionFix.get(_e);xe&&(scratchVector3$3.set(xe.x,xe.y,xe.z),scratchVector3$3.equals(oe.position)&&(oe.position.y+=xe.w)),oe.scale.setScalar(1.2),qe.delete(_e)}else o.helper.remove(oe),oe.dispose(),o.panoMeshes.delete(_e)}),qe.forEach(function(oe,_e){var Me=o.panoCircleMeshCreator(panoParse(_e));Me.position.copy(oe.standingPosition).applyMatrix4(oe.work.transform);var xe=o.adjustPanoCircleMeshPositionFix.get(_e);xe&&(scratchVector3$3.set(xe.x,xe.y,xe.z),scratchVector3$3.equals(Me.position)&&(Me.position.y+=xe.w)),Me.scale.setScalar(1.2),o.panoMeshes.set(_e,Me),o.helper.add(Me),qe.delete(_e)}),this.camera.pose.distance>.1||S)this.panoMeshes.forEach(function(oe){oe.setOpacity(0),oe.setCurrent(!1),oe.updateTime&&oe.updateTime(e,r),oe.visible=!1});else if(X){var Ee=X.work.observers,Oe=arrayMin(X.accessibleNodes,function(oe){var _e=Ee[oe];return _e?X.standingPosition.distanceTo(_e.standingPosition):1/0},!0),Fe=Oe[1];Fe=clamp$1(Fe,2.5,1/0);var tt=X.visibleNodes.concat(X.panoIndex).map(function(oe){return panoStringify({panoIndex:oe,workCode:X.work.workCode})}),rt=this.camera.getDirection(new THREE__namespace.Vector3);this.panoMeshes.forEach(function(oe,_e){var Me=o.works.getObserver(_e);if(tt.indexOf(_e)===-1)oe.setCurrent(!1),oe.setOpacity(0);else if(!Me)oe.setCurrent(!1),oe.setOpacity(0);else if(!Me.loadable&&!Me.active)oe.setCurrent(!1),oe.setOpacity(0);else{var xe=oe.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);oe.setCurrent(!oe.loading&&oe.progress===0&&Y!==null&&panoStringify({panoIndex:Y.panoIndex,workCode:Y.work.workCode})===_e),oe.setOpacity(xe<.01?0:clamp$1(Fe/xe*1.2,.4,.85));var ze=o.camera.position.clone().setY(oe.position.y),at=new THREE__namespace.Vector3().copy(oe.position).sub(ze).normalize();if(_e===panoStringify(o.currentPano)){var yt=clamp$1((.5-ze.distanceTo(oe.position))/.5,0,1);at.multiplyScalar(1-yt).add(rt.clone().multiplyScalar(yt))}at.length()>0&&oe.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(at.x,at.z),0))}oe.updateTime&&oe.updateTime(e,r)})}{var M=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,Ne=Math.round(M),Ie=this.modelScene.parameter.pano0,He=this.modelScene.parameter.pano1,Ae=Ne===0?Ie:He,C=void 0;if(Ae&&(C=this.works.getObserver(Ae.panoId),C||(C=this.panoPictureObserverMap.get(Ae))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=M<=.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!C||!Ae||this.tileLevelForFov===!1){this.tiling.setObserver(null);var we={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(we),this.modelScene.parameter.set("refinedScreen",null)}else{var Pe=getImageSizeLevel(Ae.mapSize),je=Pe+1,Qe=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),Ze=Math.floor(this.tileLevelForFov(this.camera.fov,Qe)),gt=Ze>Pe?Ze:0;this.tiling.setObserver(C);var we={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:Ae.map,panoMatrix:Ae.matrix,panoZoom:Ae.zoom,minLevel:je,level:gt},Je=this.tiling.update(we),At={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Ne,opacity:(Ie==null?void 0:Ie.panoId)===(He==null?void 0:He.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Re=this.modelScene.parameter.refinedScreen;(Je||At.pano!==(Re==null?void 0:Re.pano)||At.opacity!==(Re==null?void 0:Re.opacity))&&this.modelScene.parameter.set("refinedScreen",At)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),X&&X.video&&(this.needsRender=!0),this.intersectMesh.scale.setScalar(clamp$1(this.cameraMotion.value.fov/45,0,1));{var Ue=b.effect,ft=this.modelScene.parameter,Ie=ft.pano0,He=ft.pano1;if(Ie&&He&&Ie!==He&&Ue==="fly"&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==Ie.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==He.panoId){var dt=500,Ge=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Ge&&this.pano0DepthCubeRenderTarget.setSize(Ge,Ge):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Ge,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Ge&&this.pano1DepthCubeRenderTarget.setSize(Ge,Ge):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Ge,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var nt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);nt.matrix.copy(Ie.matrix),nt.matrixWorld.copy(nt.matrix),nt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,nt,dt);var ct=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);ct.matrix.copy(He.matrix),ct.matrixWorld.copy(ct.matrix),ct.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,ct,dt),this.modelScene.parameter.set({pano0Depth:{panoId:Ie.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:dt},pano1Depth:{panoId:He.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:dt}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1],o=this.panoResourceFromLocationMotionKeyframe(r),s=this.works.getObserver(o.panoId);return{workCode:s?s.work.workCode:this.currentPano.workCode,panoIndex:s?s.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:s?s.position.clone().applyMatrix4(s.work.transform):this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c=(u=r.effect)!==null&&u!==void 0?u:"fly";this.userAction=o,this.stopMomentumMovement();var f=panoStringify(e),p=this.works.getObserver(e);if(!p)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));getImageSizeFromURL(p.images.up),this.imageOptions.size;var d=this.imageOptions.transform,h=__assign({key:"pano.".concat(f)},pick(this.imageOptions,["format","size","quality","sharpen","mappings"])),g={right:p.images.work.getURL(p.images.right),left:p.images.work.getURL(p.images.left),up:p.images.work.getURL(p.images.up),down:p.images.work.getURL(p.images.down),front:p.images.work.getURL(p.images.front),back:p.images.work.getURL(p.images.back)},A="pano:"+jsonHash([g,h,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===A)return;var m=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(m))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:{panoIndex:p.panoIndex,workCode:p.work.workCode}}))}var E="move-to-pano-"+f;this.pending.add(E);var v=this.modelScene.parameter.resolveValue(),y=v.pano0,b=v.pano1,T;if(y&&y.map.name===A?T=y:(b==null?void 0:b.map.name)===A&&(T=b),T){var _={panoId:f,effect:c,panoPicture:{panoId:T.panoId,map:T.map,mapSize:T.mapSize,matrix:p.matrix.clone().premultiply(p.work.transform),zoom:1},position:p.position.clone().applyMatrix4(p.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};_.panoPicture&&this.panoPictureObserverMap.set(_.panoPicture,p),AnimationFrameLoop.shared.add(function(){s.pending.delete(E),s.doMoveToPano(e,_,r)},!0,1);return}this.pendingTextureTask={panoId:f,hash:A,onLoad:function(R){var w;s.pending.delete(E);var M=R.body;if(s.destroyed)M.dispose();else{M.name=A;var O=Array.isArray(M.image)?M.image[0]:M.image,C=(w=O==null?void 0:O.width)!==null&&w!==void 0?w:2048,P={panoId:f,effect:c,panoPicture:{panoId:f,map:M,mapSize:C,matrix:p.matrix.clone().premultiply(p.work.transform),zoom:1},position:p.position.clone().applyMatrix4(p.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};P.panoPicture&&s.panoPictureObserverMap.set(P.panoPicture,p),s.doMoveToPano(e,P,r)}},onError:function(R){s.pending.delete(E);var w=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:R,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:R,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("error",R),r.moveCancelCallback&&r.moveCancelCallback()}};var S=this.panoMeshes.get(f);S&&S.tap&&S.tap(),this.textureLoader.loadCubeTexture(g,{imageURL:{transform:d,options:h},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(R){var w,M;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:R,meta:null,pano:e})),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===A&&((M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(R))},this.renderer).then(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===A?(s.pendingTextureTask.onLoad(R),(M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:R.meta,pano:e}))):R.body.dispose()}).catch(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===A&&(s.pendingTextureTask.onError(R),(M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:R,progress:0,meta:null,pano:e})),s.emit("error",R))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial,s=o.duration,u=o.effect,l=o.userAction;e.userAction=l;var c=t.initAnimationEndState(e),f={workCode:c.workCode,panoIndex:c.panoIndex},p={modelAlpha:0},d={perspToOrtho:0},h=!1;e.moveToPano(f,{longitude:c.longitude,latitude:c.latitude,fov:c.fov,effect:u,duration:s,moveStartCallback:function(g){h=!0,e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:p}],s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction}))},moveEndCallback:function(g){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()},moveCancelCallback:function(){var g=__assign(__assign(__assign({},f),{mode:e.mode}),clonePose(e.camera.pose));h===!1&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()}},l)})},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var r=0,o=1;o<e.length;o++){var s=this.panoResourceFromLocationMotionKeyframe(e[o-1]).position,u=this.panoResourceFromLocationMotionKeyframe(e[o]).position,l=s.distanceTo(u)*(e[o].value.count-e[o-1].value.count);r+=l}return r},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,A,m,E;o===void 0&&(o={});var v=now(),y=createUuid();this.panoResources[y]=r;var b=1,T,_,S;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(v);R[0];var w=R[1],M=this.locationMotion.value,O=((u=this.panoResourceFromLocationMotionKeyframe(w))!==null&&u!==void 0?u:this.camera).position,C=r.position;T=Math.max(O.distanceTo(C),b),_=[{key:w.key,progress:0,value:__assign(__assign({},M),{count:0})},{key:y,progress:1,value:{distance:0,count:1}}],S=0}else{var P=this.locationMotion.getKeyFrameSegment(v),F=P[0],w=P[1],M=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(F).position,O=this.panoResourceFromLocationMotionKeyframe(w).position,C=r.position,H=w.value.count-M.count,N=Math.max(L.distanceTo(O),b)*H,D=Math.max(O.distanceTo(C),b);T=N+D,_=[{key:F.key,progress:0,value:__assign({},M)},{key:w.key,progress:N/T,value:w.value},{key:y,progress:1,value:{count:w.value.count+1,distance:0}}];var Q=this.locationMotionKeyframesLength(this.locationMotion.keyframes),J=this.locationMotionKeyframesLength(_);Q===0||Q===0?S=0:S=this.locationMotion.getProgressVelocity(v)*Q/J}var U=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?T:0),z={longitude:o.longitude,latitude:o.latitude,fov:o.fov},q=__assign(__assign({},e),{mode:this.mode,longitude:(l=z.longitude)!==null&&l!==void 0?l:this.camera.pose.longitude,latitude:(c=z.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(f=z.fov)!==null&&f!==void 0?f:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),j=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:j,progress:0,state:q,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(q),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(z,U).catch(noop);else{var G=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),X=coordinatesToVector({longitude:(p=z.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(d=z.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),Y=new THREE__namespace.Object3D;Y.lookAt(G);var Z=new THREE__namespace.Matrix4().makeRotationFromQuaternion(Y.quaternion);Y.lookAt(X);var W=new THREE__namespace.Matrix4().makeRotationFromQuaternion(Y.quaternion),K=new THREE__namespace.Matrix4().getInverse(Z).premultiply(W),ne=this.cameraMotion.value.fov,ee=(h=z.fov)!==null&&h!==void 0?h:this.cameraMotion.value.fov,te=1;r.effect==="zoomin"?te=1.5:r.effect==="zoomout"&&(te=.4);for(var ae=clamp$1(ee*te,1,170),fe=0;fe<_.length-1;fe++){var se=_[fe].key;if(se){var he=this.panoResources[se];he&&(he.fixCameraTransform.copy(K),he.panoPicture&&(he.panoPicture.zoom=Math.tan(ae/2/180*Math.PI)/Math.tan(ne/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(g=z.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(A=z.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:ae}},{progress:1,value:{longitude:(m=z.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(E=z.latitude)!==null&&E!==void 0?E:this.cameraMotion.value.latitude,fov:ee}}],U).catch(noop)}var me=this.locationMotion.setKeyframes(_,U,S);me.then(function(){for(var be=0,Te=s.modelScene.children;be<Te.length;be++){var ce=Te[be];ce instanceof Model&&ce.show()}var pe=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:s.camera.pose.distance});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:j,progress:1,state:pe,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(pe);var re=s.works.getObserver(e);if(re&&re.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var ue={map:s.videoTexture,size:re.video.size.clone(),matrix:re.video.matrix.clone(),panoMatrix:re.matrix.clone().premultiply(re.work.transform),alpha:1},ve=createUuid(),ge=s.videoTexture.image;ge.setAttribute("uuid",ve),ge.oncanplay=noop,ge.ontimeupdate=noop,canplayVideo().then(function(qe){qe&&re.video&&ge.getAttribute("uuid")===ve&&(ge.oncanplay=function(){ge.oncanplay=noop,ge.play()},ge.ontimeupdate=function(){ge.currentTime>.5&&(ge.ontimeupdate=noop,s.panoVideo.setMaterial(ue))},ge.src=re.video.source)}).catch((function(){ge.removeAttribute("uuid")}))}else{var Le=s.videoTexture.image;Le.removeAttribute("uuid"),Le.oncanplay=noop,Le.ontimeupdate=noop}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:j,progress:0,state:q,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.getForwardObserverOrNot=function(e,r){var o=this,s=this.works.getObserver(this.currentPano);if(!s)return null;var u=r!=null?r:new THREE__namespace.Raycaster(e.position.clone(),e.getWorldDirection(new THREE__namespace.Vector3));u.params.Points={threshold:.1},u.firstHitOnly=!0,u.floorIndex=-1;var l=s.standingPosition.clone().applyMatrix4(s.work.transform),c=s.position.clone().applyMatrix4(s.work.transform);if(c.distanceTo(u.ray.origin)>1){var f=new THREE__namespace.Raycaster(u.ray.origin,new THREE__namespace.Vector3(0,-1,0));f.firstHitOnly=u.firstHitOnly,f.floorIndex=u.floorIndex;var p=this.modelScene.intersectRaycaster(f)[0];p&&p.distance<=2?l.copy(p.point):l.copy(u.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var d=this.modelScene.intersectRaycaster(u)[0],h=d?d.point:u.ray.origin.clone().add(u.ray.direction.clone().normalize().multiplyScalar(3)),g=h.clone().sub(l).normalize();if(g.length()===0)return null;for(var A=s.work.observers,m=s.accessibleNodes.filter(function(O){if(O===o.currentPano.panoIndex&&s.work.workCode===o.currentPano.workCode)return!1;var C=A[O];if(!C)return!1;var P=C.standingPosition.clone().applyMatrix4(C.work.transform).project(e);return Math.abs(P.z)>1||Math.abs(P.x)>1||Math.abs(P.y)>1?!1:C.loadable||C.active}),E=new Map,v=m.slice().sort(function(O,C){var P=A[O],F=E.get(P);typeof F=="undefined"&&(F=scratchVector3$3.copy(P.standingPosition).applyMatrix4(P.work.transform).distanceTo(l),E.set(P,F));var L=A[C],H=E.get(L);return typeof H=="undefined"&&(H=scratchVector3$3.copy(L.standingPosition).applyMatrix4(L.work.transform).distanceTo(l),E.set(L,H)),F-H}),y=0,b=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];y<b.length;y++)for(var T=b[y],_=0,S=v;_<S.length;_++){var R=S[_],w=A[R];if(w){var M=scratchVector3$3.copy(w.standingPosition).applyMatrix4(w.work.transform).sub(l);if(M&&M.length()!==0&&g.angleTo(M)<T)return w}}return null},t.prototype.onTapGesture=function(e){var r=this,o;if(this.userAction=e.userAction,this.stopMomentumMovement(),!!this.initAnimationed){if(!this.locationMotion.ended){var s=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]);if(s.panoId!==panoStringify(this.currentPano))return}var u=e.center.raycaster;u.floorIndex=-1;var l=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),c=null,f=this.works.getObserver(this.currentPano);if(f){var p=f.work.observers,d=f.accessibleNodes.filter(function(G){if(G===r.currentPano.panoIndex&&f.work.workCode===r.currentPano.workCode)return!1;var X=p[G];if(!X)return!1;var Y=scratchVector3$3.copy(X.position).applyMatrix4(X.work.transform);return Y.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:X.loadable||X.active}),h=this.modelScene.intersectRaycaster(u)[0];if(h){var g=arrayMin(d,function(G){var X=p[G];if(!X)return 1/0;var Y=scratchVector3$3.copy(X.standingPosition).applyMatrix4(X.work.transform);return Y.distanceTo(h.point)},!0),A=g[0],m=g[1];typeof A=="number"&&m<this.panoTapTriggerRadius&&(c=(o=p[A])!==null&&o!==void 0?o:null)}c||(c=this.getForwardObserverOrNot(this.camera,u));for(var E=0,v=this.locationMotion.keyframes;E<v.length;E++){var y=v[E],b=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&c){var T=panoStringify({panoIndex:c.panoIndex,workCode:c.work.workCode});if(b.panoId===T){c=null;break}}}if(!c)this.emit("gesture.tap",e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{for(var _={},S=Math.PI/6,R=Math.PI/12,w=c.position.clone().applyMatrix4(c.work.transform).setY(0).sub(f.position.clone().applyMatrix4(c.work.transform).setY(0)).normalize(),M=[],O=[],C=[],P=c.work.observers,F=0,L=c.accessibleNodes;F<L.length;F++){var A=L[F];if(c.panoIndex!==A&&!(A===this.currentPano.panoIndex&&c.work.workCode===this.currentPano.workCode)){var H=P[A];if(H){var N=H.position.clone().applyMatrix4(H.work.transform).sub(c.position.clone().applyMatrix4(c.work.transform)).setY(0).normalize();w.angleTo(N)<S&&C.push(N)}}}var D=C.length>0?C:__spreadArray(__spreadArray([],M,!0),O,!0),Q=D.slice().sort(function(G,X){return G.angleTo(w)-X.angleTo(w)})[0];if(Q&&Q.angleTo(l)>R&&(_.longitude=Math.atan2(-Q.x,-Q.z)),this.cameraMotion.value.latitude<-Math.PI/4){var J=e.state.fov,U=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(J):this.minLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(J):this.maxLatitude,-Math.PI/2,Math.PI/2);_.latitude=clamp$1(0,U,z)}var q=__assign({},e.state);if(q.workCode=c.work.workCode,q.panoIndex=c.panoIndex,_.longitude!==void 0&&(q.longitude=_.longitude),_.latitude!==void 0&&(q.latitude=_.latitude),_.fov!==void 0&&(q.fov=_.fov),q.distance=0,q.offset=c.position.clone(),e.state=q,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:q,userAction:e.userAction,options:_,progress:0,error:null})),c&&!c.active){var T=panoStringify({panoIndex:c.panoIndex,workCode:c.work.workCode}),j=this.panoMeshes.get(T);j&&(j.setDisabled(!1),j.setLoading(!0))}c&&c.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:q,options:_,error:null}))}}}}},t})(PanoramaLikeController),DEG_TO_RAD=Math.PI/180,RAD_TO_DEG=180/Math.PI,MIN_TIMESTEP=.001,MAX_TIMESTEP=1,isIOS=(function(){var n=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return n}})(),isSafari=(function(){var n=typeof navigator!="undefined"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return n}})(),isFirefoxAndroid=(function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("Firefox")!==-1&&navigator.userAgent.indexOf("Android")!==-1;return function(){return n}})(),getChromeVersion=(function(){var n=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=n?parseInt(n[1],10):null;return function(){return t}})(),isChromeWithoutDeviceMotion=(function(){var n=!1;if(getChromeVersion()===65){var t=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var e=t[1].split(".");e[0],e[1];var r=e[2],o=e[3];n=parseInt(r,10)===3325&&parseInt(o,10)<148}}return function(){return n}})(),isSafariWithoutDeviceMotion=(function(){var n=isIOS()&&isSafari()&&typeof navigator!="undefined"&&navigator.userAgent.indexOf("13_4")!==-1;return function(){return n}})(),isR7=(function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("R7 Build")!==-1;return function(){return n}})();function isLandscapeMode(){var n=typeof window!="undefined"&&(window.orientation==90||window.orientation==-90);return isR7()?!n:n}function isTimestampDeltaValid(n){return!(isNaN(n)||n<=MIN_TIMESTEP||n>MAX_TIMESTEP)}function getQuaternionAngle(n){if(n.w>1)return 0;var t=2*Math.acos(n.w);return t}var warnOnce=(function(){var n={};return function(t,e){n[t]===void 0&&(console.warn("cardboard: "+e),n[t]=!0)}})();function getOriginFromUrl(n){var t,e=n.indexOf("://");e!==-1?t=e+3:t=0;var r=n.indexOf("/",t);return r===-1&&(r=n.length),n.substring(0,r)}function isInsideCrossOriginIFrame(){if(typeof window=="undefined"||typeof document=="undefined")return!1;var n=window.self!==window.top,t=getOriginFromUrl(document.referrer),e=getOriginFromUrl(window.location.href);return n&&t!==e}var updateEyeViewMatrices=(function(){function n(r,o,s){var u=o?o[0]:0,l=o?o[1]:0,c=o?o[2]:0,f=o?o[3]:1,p=u+u,d=l+l,h=c+c,g=u*p,A=u*d,m=u*h,E=l*d,v=l*h,y=c*h,b=f*p,T=f*d,_=f*h;return r[0]=1-(E+y),r[1]=A+_,r[2]=m-T,r[3]=0,r[4]=A-_,r[5]=1-(g+y),r[6]=v+b,r[7]=0,r[8]=m+T,r[9]=v-b,r[10]=1-(g+E),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function t(r,o,s){var u=s[0],l=s[1],c=s[2],f,p,d,h,g,A,m,E,v,y,b,T;return o===r?(r[12]=o[0]*u+o[4]*l+o[8]*c+o[12],r[13]=o[1]*u+o[5]*l+o[9]*c+o[13],r[14]=o[2]*u+o[6]*l+o[10]*c+o[14],r[15]=o[3]*u+o[7]*l+o[11]*c+o[15]):(f=o[0],p=o[1],d=o[2],h=o[3],g=o[4],A=o[5],m=o[6],E=o[7],v=o[8],y=o[9],b=o[10],T=o[11],r[0]=f,r[1]=p,r[2]=d,r[3]=h,r[4]=g,r[5]=A,r[6]=m,r[7]=E,r[8]=v,r[9]=y,r[10]=b,r[11]=T,r[12]=f*u+g*l+v*c+o[12],r[13]=p*u+A*l+y*c+o[13],r[14]=d*u+m*l+b*c+o[14],r[15]=h*u+E*l+T*c+o[15]),r}function e(r,o){var s=o[0],u=o[1],l=o[2],c=o[3],f=o[4],p=o[5],d=o[6],h=o[7],g=o[8],A=o[9],m=o[10],E=o[11],v=o[12],y=o[13],b=o[14],T=o[15],_=s*p-u*f,S=s*d-l*f,R=s*h-c*f,w=u*d-l*p,M=u*h-c*p,O=l*h-c*d,C=g*y-A*v,P=g*b-m*v,F=g*T-E*v,L=A*b-m*y,H=A*T-E*y,N=m*T-E*b,D=_*N-S*H+R*L+w*F-M*P+O*C;return D?(D=1/D,r[0]=(p*N-d*H+h*L)*D,r[1]=(l*H-u*N-c*L)*D,r[2]=(y*O-b*M+T*w)*D,r[3]=(m*M-A*O-E*w)*D,r[4]=(d*F-f*N-h*P)*D,r[5]=(s*N-l*F+c*P)*D,r[6]=(b*R-v*O-T*S)*D,r[7]=(g*O-m*R+E*S)*D,r[8]=(f*H-p*F+h*C)*D,r[9]=(u*F-s*H-c*C)*D,r[10]=(v*M-y*R+T*_)*D,r[11]=(A*R-g*M-E*_)*D,r[12]=(p*P-f*L-d*C)*D,r[13]=(s*L-u*P+l*C)*D,r[14]=(y*S-v*w-b*_)*D,r[15]=(g*w-A*S+m*_)*D,r):null}return function(r,o,s){n(r,o),s&&t(r,r,s),e(r,r)}})(),SensorSample=(function(){function n(t,e){t===void 0&&(t=new THREE__namespace.Vector3),e===void 0&&(e=0),this.sample=t,this.timestampS=e}return n.prototype.set=function(t,e){this.sample=t,this.timestampS=e},n.prototype.copy=function(t){this.set(t.sample,t.timestampS)},n})(),ComplementaryFilter=(function(){function n(t,e){this.kFilter=t,this.isDebug=e,this.currentAccelMeasurement=new SensorSample,this.currentGyroMeasurement=new SensorSample,this.previousGyroMeasurement=new SensorSample,isIOS()?this.filterQ=new THREE__namespace.Quaternion(-1,0,0,1):this.filterQ=new THREE__namespace.Quaternion(1,0,0,1),this.previousFilterQ=new THREE__namespace.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new THREE__namespace.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new THREE__namespace.Vector3,this.measuredGravity=new THREE__namespace.Vector3,this.gyroIntegralQ=new THREE__namespace.Quaternion}return n.prototype.addAccelMeasurement=function(t,e){this.currentAccelMeasurement.set(t,e)},n.prototype.addGyroMeasurement=function(t,e){this.currentGyroMeasurement.set(t,e);var r=e-this.previousGyroMeasurement.timestampS;isTimestampDeltaValid(r)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},n.prototype.getOrientation=function(){return this.filterQ},n.prototype.run_=function(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);var r=new THREE__namespace.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var o=new THREE__namespace.Quaternion;o.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),o.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",RAD_TO_DEG*getQuaternionAngle(o),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var s=new THREE__namespace.Quaternion;s.copy(this.filterQ),s.multiply(o),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},n.prototype.accelToQuaternion_=function(t){var e=new THREE__namespace.Vector3;e.copy(t),e.normalize();var r=new THREE__namespace.Quaternion;return r.setFromUnitVectors(new THREE__namespace.Vector3(0,0,-1),e),r.inverse(),r},n.prototype.gyroToQuaternionDelta_=function(t,e){var r=new THREE__namespace.Quaternion,o=new THREE__namespace.Vector3;return o.copy(t),o.normalize(),r.setFromAxisAngle(o,t.length()*e),r},n})(),PosePredictor=(function(){function n(t,e){this.predictionTimeS=t,this.isDebug=e,this.previousQ=new THREE__namespace.Quaternion,this.previousTimestampS=null,this.deltaQ=new THREE__namespace.Quaternion,this.outQ=new THREE__namespace.Quaternion}return n.prototype.getPrediction=function(t,e,r){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=r,t;var o=new THREE__namespace.Vector3;o.copy(e),o.normalize();var s=e.length();if(s<DEG_TO_RAD*20)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(RAD_TO_DEG*s).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var u=s*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(o,u),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=r,this.outQ},n})(),Distortion=(function(){function n(t){this.coefficients=t}return n.prototype.distortInverse=function(t){for(var e=0,r=1,o=t-this.distort(e);Math.abs(r-e)>1e-4;){var s=t-this.distort(r),u=r-s*((r-e)/(s-o));e=r,r=u,o=s}return r},n.prototype.distort=function(t){for(var e=t*t,r=0,o=0;o<this.coefficients.length;o++)r=e*(r+this.coefficients[o]);return(r+1)*t},n})(),Pose=(function(){function n(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}return n})(),FieldOfView=(function(){function n(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}return n})(),Sensor=(function(){function n(t,e,r,o){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new THREE__namespace.Vector3,this.gyroscope=new THREE__namespace.Vector3,this.filter=new ComplementaryFilter(t,o),this.posePredictor=new PosePredictor(e,o),this.isFirefoxAndroid=isFirefoxAndroid(),this.isIOS=isIOS();var s=getChromeVersion();this.isDeviceMotionInRadians=!this.isIOS&&s!==null&&s<66,this.isWithoutDeviceMotion=isChromeWithoutDeviceMotion()||isSafariWithoutDeviceMotion(),this.filterToWorldQ=new THREE__namespace.Quaternion,isIOS()?this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new THREE__namespace.Quaternion,this.worldToScreenQ=new THREE__namespace.Quaternion,this.originalPoseAdjustQ=new THREE__namespace.Quaternion;var u=typeof window!="undefined"?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),u),this.setScreenTransform_(),isLandscapeMode()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new THREE__namespace.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return n.prototype.getPosition=function(){return null},n.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(function(){var s=new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,0,-1),0),u=new THREE__namespace.Quaternion;return typeof window!="undefined"&&window.orientation===-90?u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/-2):u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/2),s.multiply(u)})(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||(function(){var s=new THREE__namespace.Quaternion;return s.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),s})(),t=this._deviceOrientationQ;var e=new THREE__namespace.Quaternion;return e.copy(t),e.multiply(this.deviceOrientationFilterToWorldQ),e.multiply(this.resetQ),e.multiply(this.worldToScreenQ),e.multiplyQuaternions(this.deviceOrientationFixQ,e),this.yawOnly&&(e.x=0,e.z=0,e.normalize()),this.orientationOut_[0]=e.x,this.orientationOut_[1]=e.y,this.orientationOut_[2]=e.z,this.orientationOut_[3]=e.w,this.orientationOut_}else{var r=this.filter.getOrientation();t=this.posePredictor.getPrediction(r,this.gyroscope,this.previousTimestampS)}var o=new THREE__namespace.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(t),o.multiply(this.worldToScreenQ),this.yawOnly&&(o.x=0,o.z=0,o.normalize()),this.orientationOut_[0]=o.x,this.orientationOut_[1]=o.y,this.orientationOut_[2]=o.z,this.orientationOut_[3]=o.w,this.orientationOut_},n.prototype.getPose=function(){var t=new Pose;return t.orientation=this.getOrientation(),t},n.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),isLandscapeMode()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},n.prototype.getFrameData=function(t){var e=this.getOrientation(),r=this.getEyeOffset(),o=this.getEyeProjectionMatrix();return t.pose.angularAcceleration=null,t.pose.angularVelocity=null,t.pose.linearAcceleration=null,t.pose.linearVelocity=null,t.pose.orientation=e,t.pose.position=null,t.timestamp=this.previousTimestampS,t.leftProjectionMatrix.set(o.left),t.rightProjectionMatrix.set(o.right),updateEyeViewMatrices(t.leftViewMatrix,e,r.left),updateEyeViewMatrices(t.rightViewMatrix,e,r.right),t},n.prototype.start=function(){if(typeof window=="undefined")return function(){};var t=this.onDeviceMotion_.bind(this),e=this.onOrientationChange_.bind(this),r=this.onMessage_.bind(this),o=this.onDeviceOrientation_.bind(this);return isIOS()&&isInsideCrossOriginIFrame()&&window.addEventListener("message",r),window.addEventListener("orientationchange",e),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",o):window.addEventListener("devicemotion",t),function(){window.removeEventListener("devicemotion",t),window.removeEventListener("deviceorientation",e),window.removeEventListener("orientationchange",e),window.removeEventListener("message",r)}},n.prototype.getEyeOffset=function(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}},n.prototype.getEyeProjectionMatrix=function(){var t=this.getEyeFieldOfView(),e=this.depthNear,r=this.depthFar,o={left:[],right:[]};{var s=t.left.upDegrees*DEG_TO_RAD,u=t.left.downDegrees*DEG_TO_RAD,l=t.left.leftDegrees*DEG_TO_RAD,c=t.left.rightDegrees*DEG_TO_RAD,f=2/(l+c),p=2/(s+u);o.left[0]=f,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=p,o.left[6]=0,o.left[7]=0,o.left[8]=-((l-c)*f*.5),o.left[9]=(s-u)*p*.5,o.left[10]=r/(e-r),o.left[11]=-1,o.left[12]=0,o.left[13]=0,o.left[14]=r*e/(e-r),o.left[15]=0}{var s=t.right.upDegrees*DEG_TO_RAD,u=t.right.downDegrees*DEG_TO_RAD,l=t.right.leftDegrees*DEG_TO_RAD,c=t.right.rightDegrees*DEG_TO_RAD,f=2/(l+c),p=2/(s+u);o.right[0]=f,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=p,o.right[6]=0,o.right[7]=0,o.right[8]=-((l-c)*f*.5),o.right[9]=(s-u)*p*.5,o.right[10]=r/(e-r),o.right[11]=-1,o.right[12]=0,o.right[13]=0,o.right[14]=r*e/(e-r),o.right[15]=0}return o},n.prototype.getEyeFieldOfView=function(){var t=this.viewer,e=this.device,r=new Distortion(t.distortionCoefficients),o=t.screenLensDistance,s=(e.widthMeters-t.interLensDistance)/2,u=t.interLensDistance/2,l=t.baselineLensDistance-e.bevelMeters,c=e.heightMeters-l,f=RAD_TO_DEG*Math.atan(r.distort(s/o)),p=RAD_TO_DEG*Math.atan(r.distort(u/o)),d=RAD_TO_DEG*Math.atan(r.distort(l/o)),h=RAD_TO_DEG*Math.atan(r.distort(c/o)),g=new FieldOfView,A=new FieldOfView;return g.leftDegrees=Math.min(f,t.fov),g.rightDegrees=Math.min(p,t.fov),g.downDegrees=Math.min(d,t.fov),g.upDegrees=Math.min(h,t.fov),A.leftDegrees=g.rightDegrees,A.rightDegrees=g.leftDegrees,A.upDegrees=g.upDegrees,A.downDegrees=g.downDegrees,{left:g,right:A}},n.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new THREE__namespace.Quaternion;var e=t.alpha,r=t.beta,o=t.gamma;e=(e||0)*Math.PI/180,r=(r||0)*Math.PI/180,o=(o||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new THREE__namespace.Euler(e,r,-o,"YXZ"))},n.prototype.onDeviceMotion_=function(t){this.updateDeviceMotion_(t)},n.prototype.updateDeviceMotion_=function(t){var e=t.accelerationIncludingGravity,r=t.rotationRate,o=t.timeStamp/1e3,s=o-this.previousTimestampS;if(s<0){warnOnce("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),this.previousTimestampS=o;return}else if(s<=MIN_TIMESTEP||s>MAX_TIMESTEP){warnOnce("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),this.previousTimestampS=o;return}e&&(this.accelerometer.set(-e.x,-e.y,-e.z),r&&(isR7()?this.gyroscope.set(-r.beta,r.alpha,r.gamma):this.gyroscope.set(r.alpha,r.beta,r.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,o)),this.filter.addAccelMeasurement(this.accelerometer,o)),this.previousTimestampS=o},n.prototype.onOrientationChange_=function(){this.setScreenTransform_()},n.prototype.onMessage_=function(t){var e=t.data;if(!(!e||!e.type)){var r=e.type.toLowerCase();r==="devicemotion"&&this.updateDeviceMotion_(e.deviceMotionEvent)}},n.prototype.setScreenTransform_=function(){this.worldToScreenQ.set(0,0,0,1);var t=typeof window!="undefined"?window.orientation:0;switch(t){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),Math.PI/2);break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},n})(),defaultLeftBounds=[0,0,.5,1],defaultRightBounds=[.5,0,.5,1],Cardboard=(function(){function n(t){var e=this;this.renderer=t,this.sensor=new Sensor(.98,.04,!1,!1),this.scale=1,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera;var r=this.sensor.start();this.dispose=function(){var o=e.renderer.getSize(new THREE__namespace.Vector2);e.renderer.setScissor(0,0,o.width,o.height),e.renderer.setViewport(0,0,o.width,o.height),e.renderer.setScissorTest(!1),r()}}return n.prototype.render=function(t,e){var r=this.renderer.getSize(new THREE__namespace.Vector2);if(r.width>r.height){var o=t.autoUpdate;o&&(t.updateMatrixWorld(),t.autoUpdate=!1);var s={x:Math.round(r.width*defaultLeftBounds[0]),y:Math.round(r.height*defaultLeftBounds[1]),width:Math.round(r.width*defaultLeftBounds[2]),height:Math.round(r.height*defaultLeftBounds[3])},u={x:Math.round(r.width*defaultRightBounds[0]),y:Math.round(r.height*defaultRightBounds[1]),width:Math.round(r.width*defaultRightBounds[2]),height:Math.round(r.height*defaultRightBounds[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),e.parent===null&&e.updateMatrixWorld(),e.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),e.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var l=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.left),this.scale),this.cameraR.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.right),this.scale);var c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(s.x,s.y,s.width,s.height),this.renderer.setScissor(s.x,s.y,s.width,s.height),this.renderer.render(t,this.cameraL),this.renderer.setViewport(u.x,u.y,u.width,u.height),this.renderer.setScissor(u.x,u.y,u.width,u.height),this.renderer.render(t,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),o&&(t.autoUpdate=!0)}else this.renderer.render(t,e)},n.prototype.dispose=function(){},n})();const cardboard="data:image/png;base64,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",phone="data:image/png;base64,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";var _a,LOCALE={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},TEXT=typeof navigator!="undefined"&&(_a=LOCALE[navigator.language.split("-")[0]])!==null&&_a!==void 0?_a:LOCALE.zh,CONTENTS=`
|
|
1574
1574
|
<style>
|
|
1575
1575
|
.$id {
|
|
1576
1576
|
all: initial;
|
|
@@ -1931,7 +1931,7 @@ void main() {
|
|
|
1931
1931
|
|
|
1932
1932
|
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);
|
|
1933
1933
|
}
|
|
1934
|
-
`,PanoSphereMesh=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.progress=0,e.opacity=0,e.loading=!1,e.current=!1,e.disabled=!1,e.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),e.opacityMotion=new Motion({opacity:0}),e.loadingMotion=new Motion({opacity:0}),e.disableMotion=new Motion({opacity:0});var r={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return e.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},r),{color:0,opacity:0}))),e.hitTestMesh.scale.set(1.5,1.5,1.5),e.ringMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),e.panoMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:vertexShader$2,fragmentShader:fragmentShader$2,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),e.add(e.hitTestMesh),e.add(e.ringMesh),e.add(e.panoMesh),e.renderOrder=1e4,e.needsRender=!0,e}return t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var r=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}];this.currentMotion.setKeyframes(r,1500).catch(noop)}else{var r=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(r,200).catch(noop)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(noop):this.loadingMotion.set({opacity:0},0).catch(noop),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,r){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var o=this.opacityMotion.value.opacity;this.visible=o!==0;var s=this.currentMotion.value,u=s.ringScale,l=s.ringOpacity,c=s.circleFade,f=s.circleOpacity,p=s.circleScale;this.ringMesh.scale.set(u,1,u),this.ringMesh.material.uniforms.opacity.value=l*o,this.panoMesh.material.uniforms.opacity.value=o,this.panoMesh.material.uniforms.circleOpacity.value=f,this.panoMesh.material.uniforms.circleScale.value=p,this.panoMesh.material.uniforms.circleFade.value=c,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t})(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,defaultVRPanoramaControllerCustomInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"])),VRPanoramaController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var s=createHelper();r.helperElement=s;var u=new Hammer(s);return r.element.parentNode&&(r.element.parentNode.insertBefore(s,r.element),r.updateHelperElementSize(),u.on("tap",function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))})),r.destroyHelper=function(){u.destroy(),s.parentNode&&s.parentNode.removeChild(s),delete r.helperElement},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"VRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper()},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,p;if(!this.destroyed){this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0;var d={},h={},g=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],m=this.locationMotion.getKeyFrameSegment(e),E=m[0],v=m[1],y=this.panoResourceFromLocationMotionKeyframe(E),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(g),_=this.panoResourceFromLocationMotionKeyframe(A),S=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var R=this.locationMotion.getKeyFrameSegment(e),w=R[0],M=R[1],O=this.panoResourceFromLocationMotionKeyframe(w),C=this.panoResourceFromLocationMotionKeyframe(M),P=O.position,F=C.position,L=this.locationMotion.value.count-M.value.count+1;if(d.progress=L,C.panoPicture&&(L<1?O.panoPicture&&(d.pano0=O.panoPicture):d.pano0=C.panoPicture,d.pano1=C.panoPicture),C.effect==="montage"?d.transition="BLACK":C.effect==="spread"?d.transition="SPREAD":d.transition="FADE",(C.effect==="zoomin"||C.effect==="zoomout")&&(d.progress=Math.pow(L,3)),L<1&&C.effect!=="fly"){if(d.pano0&&O.panoPicture){var H={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:O.panoPicture.matrix.clone().setPosition(C.position)},N=this.panoPictureObserverMap.get(d.pano0);N&&this.panoPictureObserverMap.set(H,N),d.pano0=H}P.copy(F),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(P.x+(F.x-P.x)*L,P.y+(F.y-P.y)*L,P.z+(F.z-P.z)*L);for(var D=[],Q=[],J=0,U=this.locationMotion.keyframes;J<U.length;J++){var z=U[J],q=z.key,j=z.progress;q!==void 0&&(D.push(q),j>this.locationMotion.progress&&Q.push(q))}for(var G=0,X=Object.keys(this.panoResources);G<X.length;G++){var Y=X[G];if(!(Q.indexOf(Y)>=0)){var Z=this.panoResources[Y];if(Z.panoPicture){var W=Z.panoPicture.map;if(W){if(W===((s=d.pano0)===null||s===void 0?void 0:s.map)||W===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;W.dispose(),Z.panoPicture=null}}D.indexOf(Y)>=0||delete this.panoResources[Y]}}this.currentPano=panoParse(C.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(T.panoId),state:__assign(__assign(__assign(__assign({},panoParse(_.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),h.offset&&this.camera.position.copy(h.offset);var K=this.camera.pose.longitude,ne=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(K!==this.camera.pose.longitude||ne!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}))),this.works.getObserver(this.currentPano);var ee=this.works.getObserver(y.panoId),te=this.works.getObserver(b.panoId),ae=new Map;if(ee)for(var fe=0,se=ee.accessibleNodes;fe<se.length;fe++){var he=se[fe],N=ee.work.observers[he];if(N){var me=panoStringify({panoIndex:N.panoIndex,workCode:N.work.workCode});ae.set(me,N)}}if(te)for(var be=0,Te=te.accessibleNodes;be<Te.length;be++){var he=Te[be],N=te.work.observers[he];if(N){var me=panoStringify({panoIndex:N.panoIndex,workCode:N.work.workCode});ae.set(me,N)}}if(this.panoMeshes.forEach(function(ge,we){var Pe=ae.get(we);Pe?(ge.position.copy(Pe.position).applyMatrix4(Pe.work.transform),ae.delete(we)):(o.helper.remove(ge),ge.dispose(),o.panoMeshes.delete(we))}),ae.forEach(function(ge,we){var Pe=new PanoSphereMesh;Pe.position.copy(ge.position).applyMatrix4(ge.work.transform),o.panoMeshes.set(we,Pe),o.helper.add(Pe),ae.delete(we)}),this.camera.pose.distance>.1||S?this.panoMeshes.forEach(function(ge,we){ge.setOpacity(0),ge.updateTime&&ge.updateTime(e,r),ge.visible=!1}):this.panoMeshes.forEach(function(ge,we){var Pe=panoParse(we),je=o.works.getObserver(Pe);if(je){if(!je.loadable&&!je.active){ge.setOpacity(0);return}var Ve=ge.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Ve<.05?ge.setOpacity(0):ge.setOpacity(clamp$1(1.5/Ve,0,1)),panoEqual(o.currentPano,Pe)&&ge.setOpacity(0),ge.lookAt(o.camera.position)}}),this.locationMotion.ended){var ce=this.intersect(e);this.panoMeshes.forEach(function(ge,we){ge.setCurrent(ge===ce),ge.updateTime&&ge.updateTime(e,r)})}{var L=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,pe=Math.round(L),re=this.modelScene.parameter.pano0,ue=this.modelScene.parameter.pano1,ve=pe===0?re:ue,N=void 0;if(ve&&(N=this.works.getObserver(ve.panoId),N||(N=this.panoPictureObserverMap.get(ve))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=L<=.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!N||!ve||this.tileLevelForFov===!1){this.tiling.setObserver(null);var ye={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(ye),this.modelScene.parameter.set("refinedScreen",null)}else{var De=getImageSizeLevel(ve.mapSize),Je=De+1,$e=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),Ue=Math.floor(this.tileLevelForFov(this.camera.fov,$e)),de=Ue>De?Ue:0;this.tiling.setObserver(N);var ye={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:ve.map,panoMatrix:ve.matrix,panoZoom:ve.zoom,minLevel:Je,level:de},Ye=this.tiling.update(ye),Ee={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:pe,opacity:(re==null?void 0:re.panoId)===(ue==null?void 0:ue.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Oe=this.modelScene.parameter.refinedScreen;(Ye||Ee.pano!==(Oe==null?void 0:Oe.pano)||Ee.opacity!==(Oe==null?void 0:Oe.opacity))&&this.modelScene.parameter.set("refinedScreen",Ee)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var Fe=b.effect,tt=this.modelScene.parameter,re=tt.pano0,ue=tt.pano1;if(re&&ue&&re!==ue&&Fe==="fly"&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==re.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==ue.panoId){var rt=500,Le=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Le&&this.pano0DepthCubeRenderTarget.setSize(Le,Le):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Le,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Le&&this.pano1DepthCubeRenderTarget.setSize(Le,Le):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Le,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Ie=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Ie.matrix.copy(re.matrix),Ie.matrixWorld.copy(Ie.matrix),Ie.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Ie,rt);var He=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);He.matrix.copy(ue.matrix),He.matrixWorld.copy(He.matrix),He.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,He,rt),this.modelScene.parameter.set({pano0Depth:{panoId:re.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:rt},pano1Depth:{panoId:ue.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:rt}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},t.prototype.render=function(){this.renderer.setScissorTest(!1),this.cardboard.render(this.modelScene,this.camera),this.renderer.autoClear=!1,this.cardboard.render(this.scene,this.camera),this.renderer.autoClear=!0},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.updateHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.viewport.left,o=e.y*(1-this.viewport.bottom-this.viewport.height),s=e.x*this.viewport.width,u=e.y*this.viewport.height;this.helperElement.style.marginLeft!==r+"px"&&(this.helperElement.style.marginLeft=r+"px"),this.helperElement.style.marginTop!==o+"px"&&(this.helperElement.style.marginTop=o+"px"),this.helperElement.style.width!==s+"px"&&(this.helperElement.style.width=s+"px"),this.helperElement.style.height!==u+"px"&&(this.helperElement.style.height=u+"px")}},t.prototype.intersect=function(e){var r,o;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,delete this.activePanoMesh,delete this.activeTime;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){var s=this.activePanoMesh,u=null;return this.panoMeshes.forEach(function(w,M){w===s&&(u=M)}),u!==null&&this.moveToPano(panoParse(u),{},!0),delete this.activePanoMesh,delete this.activeTime,s}var l=this.camera.getDirection(new THREE__namespace.Vector3),c=new THREE__namespace.Raycaster(this.camera.position,l);c.params.Points={threshold:.1},c.firstHitOnly=!0,c.floorIndex=-1;for(var f=void 0,p=[],d=this.works.getObserver(this.currentPano),h=d?d.accessibleNodes.map(function(w){return panoStringify({panoIndex:w,workCode:d.work.workCode})}):[],g=0,A=h;g<A.length;g++){var m=A[g],E=this.panoMeshes.get(m);if(E){var v=c.intersectObject((r=E.hitTestMesh)!==null&&r!==void 0?r:E,!0)[0];if(v){var y=(o=d==null?void 0:d.floorIndex)!==null&&o!==void 0?o:0;p.push({panoMesh:E,intersection:__assign({floorIndex:y,floor:y},v)})}}}var b=p.sort(function(w,M){return w.intersection.distance-M.intersection.distance})[0];b?(f=b.intersection,this.activePanoMesh!==b.panoMesh&&(this.activePanoMesh=b.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(b.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),f||(f=this.modelScene.intersectRaycaster(c)[0]);var T=createEvent("intersect.update",{raycaster:c,intersection:f!=null?f:null,object:this.intersectMesh});if(this.emit("intersect.update",T),T.defaultPrevented){this.hideIntersectMesh();return}if(f&&f.face){var _=f.face.normal,S=new THREE__namespace.Quaternion;S.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),_),this.intersectMesh.quaternion.copy(S);var R=f.point.clone();this.intersectMesh.position.copy(R),b?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return b==null?void 0:b.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t})(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),scratchObserverBox$1=new THREE__namespace.Box3,scratchVector3$2=new THREE__namespace.Vector3,defaultModelControllerCustomInitArgs=__assign({},defaultPanoramaLikeControllerCustomInitArgs),ModelController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Model",r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r}return t.parseArgs=function(e){return e instanceof t?e:n.parseArgs.call(this,e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f=this.parseArgs(e),p=f.works,d=e.initial,h=d.state,g=d.currentState,A=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=p.getObserver(A),E=clamp$1((u=h.fov)!==null&&u!==void 0?u:!m||isFristPersonMode(g.mode)?g.fov:f.defaultFov,f.minFov,f.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:g.longitude,y=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(E):f.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(E):f.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:!m||isFristPersonMode(g.mode)?g.latitude:f.defaultLatitude,y,b),_=new THREE__namespace.Vector3;if(f.initial.state.offset)_.copy(f.initial.state.offset);else if(m)_.copy(m.position).applyMatrix4(m.work.transform);else{var S=coordinatesToVector(g).setLength(g.distance);_.copy(f.initial.currentState.offset).sub(S)}return{workCode:A.workCode,panoIndex:A.panoIndex,mode:"Model",longitude:v,latitude:T,fov:E,offset:_,distance:0}},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,e)},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));return this.hideIntersectMesh(),this.moveToPosition(u.offset,{duration:0,longitude:u.longitude,latitude:u.latitude,fov:u.fov},s),!0},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return u.distance=0,e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:0,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);for(var u=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=[],c=function(A){var m=f.modelScene.models.find(function(b){return b.work===A});if(!m||m.visible===!1||A.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(A.observerBox).expandByScalar(10).applyMatrix4(A.transform),scratchObserverBox$1.containsPoint(u))for(var E=0,v=A.observers;E<v.length;E++){var y=v[E];l.push(y)}},f=this,p=0,d=this.works;p<d.length;p++){var h=d[p];c(h)}var g=arrayMin(l,function(A){return scratchVector3$2.copy(A.position).applyMatrix4(A.work.transform).distanceTo(u)});this.currentPano=g?{workCode:g.work.workCode,panoIndex:g.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={modelAlpha:1},f={perspToOrtho:0},p={longitude:l.longitude,latitude:l.latitude,fov:l.fov,duration:s,moveStartCallback:function(d){e.perspToOrthoMotion.set(f,s).catch(noop),e.modelAlphaMotion.set(c,s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:d,userAction:e.userAction}))},moveEndCallback:function(d){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:d,userAction:e.userAction})),r()},moveCancelCallback:function(){var d=e.currentPano,h=__assign(__assign({},d),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:h,userAction:e.userAction})),r()}};e.moveToPosition(l.offset,p,u)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={});var s=this.works.getObserver(e);if(s){var u=new THREE__namespace.Vector3().copy(s.position).applyMatrix4(s.work.transform);this.moveToPosition(u,r,o)}},t.prototype.moveToPosition=function(e,r,o){var s=this,u,l,c;r===void 0&&(r={}),this.userAction=o,this.stopMomentumMovement();for(var f=now(),p=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),d=p.distanceTo(e),h=this.locationMotion.getProgressVelocity(f),g=0,A=1;A<this.locationMotion.keyframes.length;A++){var m=this.locationMotion.keyframes[A-1].value,E=m.x,v=m.y,y=m.z,b=this.locationMotion.keyframes[A].value,T=b.x,_=b.y,S=b.z;g+=Math.sqrt(Math.pow(T-E,2)+Math.pow(_-v,2)+Math.pow(S-y,2))}for(var R=d===0?0:h*g/d,w=this.calculateMovingDuration(r.duration,d),M={x:e.x,y:e.y,z:e.z,distance:0},O={longitude:r.longitude,latitude:r.latitude,fov:r.fov},C=[],P=function(z){var q=F.modelScene.models.find(function(Y){return Y.work===z});if(!q||q.visible===!1||z.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(z.observerBox).expandByScalar(10).applyMatrix4(z.transform),scratchObserverBox$1.containsPoint(p))for(var j=0,G=z.observers;j<G.length;j++){var X=G[j];C.push(X)}},F=this,L=0,H=this.works;L<H.length;L++){var N=H[L];P(N)}var D=arrayMin(C,function(z){return scratchVector3$2.copy(z.position).applyMatrix4(z.work.transform).distanceTo(p)}),Q=D?{workCode:D.work.workCode,panoIndex:D.panoIndex}:{workCode:"",panoIndex:0},J=__assign(__assign({},Q),{mode:this.mode,longitude:(u=O.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=O.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=O.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),U=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:U,progress:0,state:J,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(J),this.cameraMotion.set(O,w).catch(noop),this.locationMotion.set(M,w,R).then(function(){for(var z=0,q=s.modelScene.children;z<q.length;z++){var j=q[z];j instanceof Model&&j.show()}var G=__assign(__assign(__assign({},Q),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:U,progress:0,state:G,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(G)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:U,progress:0,state:J,userAction:s.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var o=this.modelScene.intersectRaycaster(r)[0];if(o&&o.face){var s=o.face.normal,u=o.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(s)>Math.PI/3){var l=s.clone().setLength(.3).add(u);r.set(l,new THREE__namespace.Vector3(0,-1,0)),o=this.modelScene.intersectRaycaster(r)[0]}}if(o){for(var c=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),f=[],p=function(b){var T=d.modelScene.models.find(function(w){return w.work===b});if(!T||T.visible===!1||b.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(b.observerBox).expandByScalar(10).applyMatrix4(b.transform),scratchObserverBox$1.containsPoint(c))for(var _=0,S=b.observers;_<S.length;_++){var R=S[_];f.push(R)}},d=this,h=0,g=this.works;h<g.length;h++){var A=g[h];p(A)}var m=arrayMin(f,function(b){return scratchVector3$2.copy(b.position).applyMatrix4(b.work.transform).distanceTo(c)},!0),E=m[0],v=m[1];if(E&&v<5){var y=scratchVector3$2.copy(E.position).applyMatrix4(E.work.transform);c.y=y.y}e.state.offset.copy(c),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(c,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t})(PanoramaLikeController),scratchObserverBox=new THREE__namespace.Box3,scratchVector3$1=new THREE__namespace.Vector3,minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,defaultMapviewControllerCustomInitArgs={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:+Math.PI/2,minLatitude:0,cameraType:"auto",cameraFence:null,intersectMeshCreator:function(){return new IntersectMesh}},MapviewController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.cameraFence=o.cameraFence,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.currentTapId=null,r.helper.add(r.intersectMesh),r.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{generateMipmaps:!1,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,p;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:defaultMapviewControllerCustomInitArgs.defaultLongitude,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:defaultMapviewControllerCustomInitArgs.defaultLatitude,defaultDistance:(s=e.defaultDistance)!==null&&s!==void 0?s:defaultMapviewControllerCustomInitArgs.defaultDistance,maxLatitude:(u=e.maxLatitude)!==null&&u!==void 0?u:defaultMapviewControllerCustomInitArgs.maxLatitude,minLatitude:(l=e.minLatitude)!==null&&l!==void 0?l:defaultMapviewControllerCustomInitArgs.minLatitude,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:defaultMapviewControllerCustomInitArgs.cameraType,cameraFence:(f=e.cameraFence)!==null&&f!==void 0?f:defaultMapviewControllerCustomInitArgs.cameraFence,intersectMeshCreator:(p=e.intersectMeshCreator)!==null&&p!==void 0?p:defaultMapviewControllerCustomInitArgs.intersectMeshCreator})},t.distanceFromModel=function(e,r,o){var s=e.boundingBox,u=s.isEmpty()?10:Math.pow(Math.pow(s.max.x-s.min.x+1,2)+Math.pow(s.max.y-s.min.y+1,2)+Math.pow(s.max.z-s.min.z+1,2),1/2);u=isNaN(u)||!isFinite(u)?1:u;var l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)||!isFinite(l)?u:l},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,p=this.parseArgs(e),d=p.works,h=p.modelScene,g=e.initial,A=g.state,m=g.currentState,E=typeof A.panoIndex=="number"?{workCode:(s=(r=A.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:A.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},v=(u=A.fov)!==null&&u!==void 0?u:60,y=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(v):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(v):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((l=A.latitude)!==null&&l!==void 0?l:isThirdPersonMode(m.mode)?m.latitude:p.defaultLatitude,y,b),_=t.distanceFromModel(p.modelScene,v,p.camera.aspect),S=new THREE__namespace.Vector3,R=(c=A.distance)!==null&&c!==void 0?c:Math.min(p.defaultDistance,_),w=(f=A.longitude)!==null&&f!==void 0?f:isThirdPersonMode(m.mode)?m.longitude:p.defaultLongitude;if(A.offset)S.copy(A.offset);else{var M=d.getObserver(E);p.defaultDistance<_&&M?(S.copy(M.position).applyMatrix4(M.work.transform),A.longitude===void 0&&(w=m.longitude)):(h.boundingBox.getCenter(S),R=_)}return __assign(__assign({},E),{mode:"Mapview",longitude:w,latitude:T,fov:v,offset:S,distance:R})},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof THREE__namespace.Box3&&e.cameraFence instanceof THREE__namespace.Box3?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):this.cameraFence instanceof THREE__namespace.Sphere&&e.cameraFence instanceof THREE__namespace.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!0},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.userAction=s,this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));this.currentPano={workCode:u.workCode,panoIndex:u.panoIndex};var l={longitude:u.longitude,latitude:u.latitude,fov:u.fov},c={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance,orthoDistance:u.distance};return this.locationMotion.set(c,o.duration).catch(noop),this.cameraMotion.set(l,o.duration).catch(noop),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e);var r=e.boundingBox.getCenter(new THREE__namespace.Vector3),o=t.distanceFromModel(e,this.cameraMotion.value.fov,this.camera.aspect);this.updateCamera({offset:r,distance:o},0,!0),this.hideIntersectMesh()},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return e.distance!==void 0&&(u.distance=e.distance),e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:p.value.distance,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};this.locationMotion.ended||(this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha);var u=0;if(this.cameraType==="auto"?u=Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02?1:0:this.cameraType==="perspective"?u=0:this.cameraType==="orthographic"&&(u=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==u&&this.perspToOrthoMotion.set({perspToOrtho:u},500).catch(noop),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){var l=coordinatesToVector(this.camera.pose,new THREE__namespace.Vector3),c=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(l.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(c)>.01){var f=this.cameraFence.clampPoint(c,new THREE__namespace.Vector3),p=this.camera.pose.offset.clone().add(f).sub(c),d=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:p,distance:this.camera.pose.distance});this.fixFinalState(d),this.locationMotion.set({x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance},300).catch(noop)}}if(this.intersectMesh&&this.intersectMesh.parent){var h=this.camera.position.distanceTo(this.intersectMesh.position),g=2*Math.tan(.5*this.camera.fov/180*Math.PI),A=h*g/5;this.intersectMesh.scale.setScalar(A)}}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={longitude:l.longitude,latitude:l.latitude,fov:l.fov},f={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},p={modelAlpha:1},d={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.set(p,s/3).catch(noop),e.cameraMotion.set(c,s).catch(noop),e.locationMotion.set(f,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){var g=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this.modelScene.intersectRaycaster(e)[0];if(!r)return null;for(var o=[],s=function(g){var A=u.modelScene.models.find(function(y){return y.work===g});if(!A||A.visible===!1||g.observers.length<=0)return"continue";if(scratchObserverBox.copy(g.observerBox).expandByScalar(10).applyMatrix4(g.transform),scratchObserverBox.containsPoint(e.ray.origin)||e.ray.intersectsBox(scratchObserverBox))for(var m=0,E=g.observers;m<E.length;m++){var v=E[m];o.push(v)}},u=this,l=0,c=this.works;l<c.length;l++){var f=c[l];s(f)}var p=arrayMin(o,function(g){return scratchVector3$1.copy(g.standingPosition).applyMatrix4(g.work.transform).distanceTo(r.point)},!0),d=p[0],h=p[1];return d&&h<10?d:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.viewport.width),latitude:2*e.y/(r.y*this.viewport.height)}},t.prototype.requestMomentumMovement=function(e,r,o,s){var u=this;if(this.inMomentumMovement!==null){s=Math.max(s,1);for(var l=__assign({},o),c={longitude:0,latitude:0,x:0,y:0,z:0},f=0;f<s;f++)l.longitude*=.996,l.latitude*=.996*.998,l.x*=.99,l.y*=.99,l.z*=.99,c.longitude+=l.longitude,c.latitude+=l.latitude,c.x+=l.x,c.y+=l.y,c.z+=l.z;var p=this.cameraMotion.value.fov,d=formatRad$1(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(p):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(p):this.maxLatitude,-Math.PI/2,Math.PI/2),A=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),m=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),E=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:A,offset:m,fov:p,distance:this.locationMotion.value.distance}),v=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(E.distance)),y=!(Math.abs(l.longitude)>1e-4||Math.abs(l.latitude)>1e-4||Math.abs(l.x)>1e-4||Math.abs(l.y)>1e-4||Math.abs(l.z)>1e-4),b=this.cameraFence?this.cameraFence.containsPoint(v):!0;b===!1&&(y=!0);var T=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:y,state:E}));if(this.inMomentumMovement.event=T,this.emit("gesture.momentum",T),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:A},0).catch(noop),this.locationMotion.set({x:E.offset.x,y:E.offset.y,z:E.offset.z,distance:E.distance},0).catch(noop),y?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(_,S){u.requestMomentumMovement(e,!1,l,S|0)},!0,1))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),o=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),s=new THREE__namespace.Raycaster(o,r);s.params.Points={threshold:.1},s.firstHitOnly=!0,s.near=this.camera.near,s.far=this.camera.far;var u;if(u=this.modelScene.intersectRaycaster(s).filter(function(d){var h,g=(h=d.face)===null||h===void 0?void 0:h.normal;return g&&s.ray.direction.dot(g)>=0?!1:d.distance>minDistance+s.near})[0],!u){var l=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),c=s.ray.intersectPlane(l,new THREE__namespace.Vector3);if(c){var f=c.distanceTo(s.ray.origin);f<1e3&&f>=s.near&&(u={distance:f,floorIndex:0,floor:0,point:c,object:this.scene,face:null})}}if(!u){var p=Math.max(e.distance,3);u={distance:p,floorIndex:0,floor:0,point:s.ray.direction.clone().setLength(p).add(s.ray.origin),object:this.scene,face:null}}u&&(e.distance=clamp$1(u.distance,0,1/0),e.offset.copy(o).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,o=this.panState,s=0,u=!1;e.pointerType==="mouse"&&(s=e.srcEvent.buttons,u=e.srcEvent.shiftKey),o&&s===0&&o.buttons!==0&&(s=o.buttons);var l=o==null?void 0:o.target;if(!l){var c=this.relativeClientPosition(e.center),f=this.createRaycasterFromCamera(c,this.camera);l=new THREE__namespace.Vector3().copy(f.ray.direction).multiplyScalar(3).add(f.ray.origin);var p=this.modelScene.intersectRaycaster(f)[0];if(!p&&f.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),h=f.ray.intersectPlane(d,new THREE__namespace.Vector3);if(h){var g=h.distanceTo(f.ray.origin);g<1e4&&g>=f.near&&(p={distance:g,floorIndex:0,floor:0,point:h,object:this.scene})}}if(p)l.copy(p.point);else{var A=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(A,this.camera.pose.offset);f.ray.intersectPlane(d,l)}}if(e.isFinal?delete this.panState:this.panState={target:l,buttons:s,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof o=="undefined"||o.pointerLength!==r)){var m=r>1||s===2||u;if(m){var E={x:e.center.x-o.x,y:e.center.y-o.y},v=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),y=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(v),b=new THREE__namespace.Vector3().copy(y).sub(o.target).length();b*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var T=this.renderer.getSize(new THREE__namespace.Vector2),_=2*E.x*b/T.y,S=2*E.y*b/T.y,R=new THREE__namespace.Vector3;R.setFromMatrixColumn(this.camera.matrix,0),R.multiplyScalar(-_),v.add(R),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?R.setFromMatrixColumn(this.camera.matrix,1):(R.setFromMatrixColumn(this.camera.matrix,0),R.crossVectors(this.camera.up,R)),R.multiplyScalar(S),v.add(R);var w=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:v,distance:this.camera.pose.distance});if(e.state=w,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop),e.isFinal&&(this.fixFinalState(w),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:w.distance,x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop)),e.isFinal){var M=this.renderer.getSize(new THREE__namespace.Vector2),O=2*e.velocityX*b/M.y,C=2*e.velocityY*b/M.y,P=new THREE__namespace.Vector3,F=new THREE__namespace.Vector3;P.setFromMatrixColumn(this.camera.matrix,0),P.multiplyScalar(-O),F.add(P),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?P.setFromMatrixColumn(this.camera.matrix,1):(P.setFromMatrixColumn(this.camera.matrix,0),P.crossVectors(this.camera.up,P)),P.multiplyScalar(C),F.add(P),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:F.x,y:F.y,z:F.z},0)}}else{var E={x:e.center.x-o.x,y:e.center.y-o.y},L=this.coordinatesForOffset(E),H=formatRad$1(this.cameraMotion.value.longitude+L.longitude),N=this.camera.pose.fov,D=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(N):this.minLatitude,-Math.PI/2,Math.PI/2),Q=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(N):this.maxLatitude,-Math.PI/2,Math.PI/2),J=clamp$1(this.cameraMotion.value.latitude+L.latitude,D,Q);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(J=this.cameraMotion.value.latitude);var w=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:H,latitude:J,fov:N,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=w,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:w.distance,x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop):this.cameraMotion.set({longitude:w.longitude,latitude:w.latitude},0).catch(noop),e.isFinal){var U=e.velocityX,z=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:U,y:z})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var o=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof o!="undefined"){var s=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),l=clamp$1(o/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(l)),f=this.modelScene.boundingBox.containsPoint(c),p;if(!f&&this.pinchState&&this.pinchState.scale>e.scale&&s.distanceTo(c)>u?p=e.state.distance:(p=l,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=p,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var d=e.state;this.fixFinalState(e.state);var h={x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance};this.locationMotion.set(h,0).catch(noop)}delete this.panState,delete this.pinchState}}}},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var s=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var u=this.modelScene.intersectRaycaster(s)[0],l=createEvent("intersect.update",{raycaster:s,intersection:u!=null?u:null,object:this.intersectMesh});if(this.emit("intersect.update",l),l.defaultPrevented){this.hideIntersectMesh();return}if(u){var c=(o=(r=u.face)===null||r===void 0?void 0:r.normal)!==null&&o!==void 0?o:new THREE__namespace.Vector3().copy(s.ray.direction).multiplyScalar(-1),f=c.clone(),p=u.point.clone();this.intersectMesh.position.copy(p);var d=p.clone().add(f);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(p);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var o={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(o,0).catch(noop)}else{var s=Math.max(this.locationMotion.value.distance-this.camera.near,0),u=e.center.delta/10*Math.max(s/5,.1);if(this.locationMotion.value.distance-u>=minDistance){var l=this.locationMotion.value.distance-u;e.state.distance=l}else{var c=coordinatesToVector(this.cameraMotion.value);c.setLength(u),e.state.offset.add(c)}if(this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:e.state.distance,x:e.state.offset.x,y:e.state.offset.y,z:e.state.offset.z},0).catch(noop)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=e.userAction,this.stopMomentumMovement();var o=e.center.raycaster,s=this.getForwardObserverOrNot(o);if(!s)this.emit("gesture.tap",e);else{var u={longitude:this.camera.pose.longitude,latitude:0},l=__assign(__assign({},e.state),{mode:"Panorama",workCode:s.work.workCode,panoIndex:s.panoIndex,longitude:u.longitude,latitude:u.latitude,offset:s?s.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=l,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:l,userAction:e.userAction,options:u,progress:0,error:null})),s&&s.active)){var c=this.currentTapId=createUuid(),f={panoIndex:s.panoIndex,workCode:s.work.workCode};this.preloadPano(f).then(function(p){r.currentTapId===c&&r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:l,options:u,error:null}))})}}},t.prototype.onDblTapGesture=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.state,o=e.center.raycaster,s=o.ray.origin.clone().add(o.ray.direction.clone().setLength(3)),u=1,l=3,c=u,f=this.modelScene.intersectRaycaster(o)[0];if(f&&(s=f.point.clone(),f.distance>(u+l)/2?c=u:c=l),e.state.distance=c,e.state.offset=s,this.emit("gesture.dbltap",e),!e.defaultPrevented){var p={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(p,360).catch(noop),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)},t})(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=(function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var o=null,s=null,u=null,l=this._targetRay,c=this._grip,f=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(l!==null&&(o=e.getPose(t.targetRaySpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),f&&t.hand){u=!0;for(var p=0,d=t.hand.values();p<d.length;p++){var h=d[p],g=e.getJointPose(h,r);if(f.joints[h.jointName]===void 0){var A=new THREE__namespace.Group;A.matrixAutoUpdate=!1,A.visible=!1,f.joints[h.jointName]=A,f.add(A)}var m=f.joints[h.jointName];g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=g.radius),m.visible=g!==null}var E=f.joints["index-finger-tip"],v=f.joints["thumb-tip"],y=E.position.distanceTo(v.position),b=.02,T=.005;f.inputState.pinching&&y>b+T?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&y<=b-T&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));return l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),f!==null&&(f.visible=u!==null),this},n})(),framebufferScaleFactor=1,isAppleVisionPro=function(){try{var n=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return n&&t}catch(e){return console.error("Error determining if the device is an Apple Vision Pro: ",e),!1}},isOculus=function(){try{return/Oculus/i.test(navigator.userAgent)}catch(n){return console.error("Error determining if the device is an Oculus: ",n),!1}},XRManager=(function(){function n(t,e,r){var o,s,u,l,c;this.isPanorama=(o=r==null?void 0:r.isPanorama)!==null&&o!==void 0?o:!0,navigator.userAgent.toLowerCase();var f;isAppleVisionPro()?f="VP":isOculus()?f="Oculus":f="Pico",this.machineType=(s=r==null?void 0:r.machineType)!==null&&s!==void 0?s:f,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(u=r==null?void 0:r.referenceSpaceType)!==null&&u!==void 0?u:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(l=r==null?void 0:r.onSessionStart)!==null&&l!==void 0?l:noop,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraVR.cameras.push(this.cameraL,this.cameraR),this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var o=this.cameraLPos.distanceTo(this.cameraRPos),s=e.projectionMatrix.elements,u=r.projectionMatrix.elements,l=s[14]/(s[10]-1),c=s[14]/(s[10]+1),f=(s[9]+1)/s[5],p=(s[9]-1)/s[5],d=(s[8]-1)/s[0],h=(u[8]+1)/u[0],g=l*d,A=l*h,m=o/(-d+h),E=m*-d;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(E),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=l+m,y=c+m,b=g-E,T=A+(o-E),_=f*c/y*v,S=p*c/y*v;t.projectionMatrix.makePerspective(b,T,_,S,v,y)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var o=0;o<r.length;o++)this.updateCamera(r[o],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var s=t.children,o=0,u=s.length;o<u;o++)s[o].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var o=t.removed[r],s=this.inputSourcesMap.get(o);s&&(s.dispatchEvent({type:"disconnected",data:o}),this.inputSourcesMap.delete(o))}for(var r=0;r<t.added.length;r++){var o=t.added[r],s=this.inputSourcesMap.get(o);s&&s.dispatchEvent({type:"connected",data:o})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectstart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeeze",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezestart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezeend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("end",function(o){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var o={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;case"Oculus":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(s){e.onRequestReferenceSpace(s)}),e.session.addEventListener("inputsourceschange",function(s){e.updateInputSources(s)})})}},n})(),LineSegmentsGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],o=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(s),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(o,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,o=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),o.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),o.setFromBufferAttribute(r),this.boundingBox.union(o)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=this.boundingSphere.center;this.boundingBox.getCenter(o);for(var s=0,u=new THREE__namespace.Vector3,l=0,c=e.count;l<c;l++)u.fromBufferAttribute(e,l),s=Math.max(s,o.distanceToSquared(u)),u.fromBufferAttribute(r,l),s=Math.max(s,o.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t})(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
|
|
1934
|
+
`,PanoSphereMesh=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.progress=0,e.opacity=0,e.loading=!1,e.current=!1,e.disabled=!1,e.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),e.opacityMotion=new Motion({opacity:0}),e.loadingMotion=new Motion({opacity:0}),e.disableMotion=new Motion({opacity:0});var r={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return e.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},r),{color:0,opacity:0}))),e.hitTestMesh.scale.set(1.5,1.5,1.5),e.ringMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),e.panoMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:vertexShader$2,fragmentShader:fragmentShader$2,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),e.add(e.hitTestMesh),e.add(e.ringMesh),e.add(e.panoMesh),e.renderOrder=1e4,e.needsRender=!0,e}return t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var r=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}];this.currentMotion.setKeyframes(r,1500).catch(noop)}else{var r=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(r,200).catch(noop)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(noop):this.loadingMotion.set({opacity:0},0).catch(noop),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,r){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var o=this.opacityMotion.value.opacity;this.visible=o!==0;var s=this.currentMotion.value,u=s.ringScale,l=s.ringOpacity,c=s.circleFade,f=s.circleOpacity,p=s.circleScale;this.ringMesh.scale.set(u,1,u),this.ringMesh.material.uniforms.opacity.value=l*o,this.panoMesh.material.uniforms.opacity.value=o,this.panoMesh.material.uniforms.circleOpacity.value=f,this.panoMesh.material.uniforms.circleScale.value=p,this.panoMesh.material.uniforms.circleFade.value=c,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t})(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,defaultVRPanoramaControllerCustomInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"])),VRPanoramaController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var s=createHelper();r.helperElement=s;var u=new Hammer(s);return r.element.parentNode&&(r.element.parentNode.insertBefore(s,r.element),r.updateHelperElementSize(),u.on("tap",function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))})),r.destroyHelper=function(){u.destroy(),s.parentNode&&s.parentNode.removeChild(s),delete r.helperElement},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"VRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper()},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,p;if(!this.destroyed){this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0;var d={},h={},g=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],m=this.locationMotion.getKeyFrameSegment(e),E=m[0],v=m[1],y=this.panoResourceFromLocationMotionKeyframe(E),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(g),_=this.panoResourceFromLocationMotionKeyframe(A),S=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var R=this.locationMotion.getKeyFrameSegment(e),w=R[0],M=R[1],O=this.panoResourceFromLocationMotionKeyframe(w),C=this.panoResourceFromLocationMotionKeyframe(M),P=O.position,F=C.position,L=this.locationMotion.value.count-M.value.count+1;if(d.progress=L,C.panoPicture&&(L<1?O.panoPicture&&(d.pano0=O.panoPicture):d.pano0=C.panoPicture,d.pano1=C.panoPicture),C.effect==="montage"?d.transition="BLACK":C.effect==="spread"?d.transition="SPREAD":d.transition="FADE",(C.effect==="zoomin"||C.effect==="zoomout")&&(d.progress=Math.pow(L,3)),L<1&&C.effect!=="fly"){if(d.pano0&&O.panoPicture){var H={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:O.panoPicture.matrix.clone().setPosition(C.position)},N=this.panoPictureObserverMap.get(d.pano0);N&&this.panoPictureObserverMap.set(H,N),d.pano0=H}P.copy(F),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(P.x+(F.x-P.x)*L,P.y+(F.y-P.y)*L,P.z+(F.z-P.z)*L);for(var D=[],Q=[],J=0,U=this.locationMotion.keyframes;J<U.length;J++){var z=U[J],q=z.key,j=z.progress;q!==void 0&&(D.push(q),j>this.locationMotion.progress&&Q.push(q))}for(var G=0,X=Object.keys(this.panoResources);G<X.length;G++){var Y=X[G];if(!(Q.indexOf(Y)>=0)){var Z=this.panoResources[Y];if(Z.panoPicture){var W=Z.panoPicture.map;if(W){if(W===((s=d.pano0)===null||s===void 0?void 0:s.map)||W===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;W.dispose(),Z.panoPicture=null}}D.indexOf(Y)>=0||delete this.panoResources[Y]}}this.currentPano=panoParse(C.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(T.panoId),state:__assign(__assign(__assign(__assign({},panoParse(_.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),h.offset&&this.camera.position.copy(h.offset);var K=this.camera.pose.longitude,ne=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(K!==this.camera.pose.longitude||ne!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}))),this.works.getObserver(this.currentPano);var ee=this.works.getObserver(y.panoId),te=this.works.getObserver(b.panoId),ae=new Map;if(ee)for(var fe=0,se=ee.accessibleNodes;fe<se.length;fe++){var he=se[fe],N=ee.work.observers[he];if(N){var me=panoStringify({panoIndex:N.panoIndex,workCode:N.work.workCode});ae.set(me,N)}}if(te)for(var be=0,Te=te.accessibleNodes;be<Te.length;be++){var he=Te[be],N=te.work.observers[he];if(N){var me=panoStringify({panoIndex:N.panoIndex,workCode:N.work.workCode});ae.set(me,N)}}if(this.panoMeshes.forEach(function(Ae,we){var Pe=ae.get(we);Pe?(Ae.position.copy(Pe.position).applyMatrix4(Pe.work.transform),ae.delete(we)):(o.helper.remove(Ae),Ae.dispose(),o.panoMeshes.delete(we))}),ae.forEach(function(Ae,we){var Pe=new PanoSphereMesh;Pe.position.copy(Ae.position).applyMatrix4(Ae.work.transform),o.panoMeshes.set(we,Pe),o.helper.add(Pe),ae.delete(we)}),this.camera.pose.distance>.1||S?this.panoMeshes.forEach(function(Ae,we){Ae.setOpacity(0),Ae.updateTime&&Ae.updateTime(e,r),Ae.visible=!1}):this.panoMeshes.forEach(function(Ae,we){var Pe=panoParse(we),je=o.works.getObserver(Pe);if(je){if(!je.loadable&&!je.active){Ae.setOpacity(0);return}var Qe=Ae.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Qe<.05?Ae.setOpacity(0):Ae.setOpacity(clamp$1(1.5/Qe,0,1)),panoEqual(o.currentPano,Pe)&&Ae.setOpacity(0),Ae.lookAt(o.camera.position)}}),this.locationMotion.ended){var ce=this.intersect(e);this.panoMeshes.forEach(function(Ae,we){Ae.setCurrent(Ae===ce),Ae.updateTime&&Ae.updateTime(e,r)})}{var L=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,pe=Math.round(L),re=this.modelScene.parameter.pano0,ue=this.modelScene.parameter.pano1,ve=pe===0?re:ue,N=void 0;if(ve&&(N=this.works.getObserver(ve.panoId),N||(N=this.panoPictureObserverMap.get(ve))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=L<=.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!N||!ve||this.tileLevelForFov===!1){this.tiling.setObserver(null);var ge={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(ge),this.modelScene.parameter.set("refinedScreen",null)}else{var Le=getImageSizeLevel(ve.mapSize),qe=Le+1,$e=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),Ve=Math.floor(this.tileLevelForFov(this.camera.fov,$e)),de=Ve>Le?Ve:0;this.tiling.setObserver(N);var ge={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:ve.map,panoMatrix:ve.matrix,panoZoom:ve.zoom,minLevel:qe,level:de},Ye=this.tiling.update(ge),Ee={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:pe,opacity:(re==null?void 0:re.panoId)===(ue==null?void 0:ue.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Oe=this.modelScene.parameter.refinedScreen;(Ye||Ee.pano!==(Oe==null?void 0:Oe.pano)||Ee.opacity!==(Oe==null?void 0:Oe.opacity))&&this.modelScene.parameter.set("refinedScreen",Ee)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var Fe=b.effect,tt=this.modelScene.parameter,re=tt.pano0,ue=tt.pano1;if(re&&ue&&re!==ue&&Fe==="fly"&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==re.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==ue.panoId){var rt=500,Ne=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Ne&&this.pano0DepthCubeRenderTarget.setSize(Ne,Ne):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Ne,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Ne&&this.pano1DepthCubeRenderTarget.setSize(Ne,Ne):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Ne,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Ie=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Ie.matrix.copy(re.matrix),Ie.matrixWorld.copy(Ie.matrix),Ie.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Ie,rt);var He=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);He.matrix.copy(ue.matrix),He.matrixWorld.copy(He.matrix),He.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,He,rt),this.modelScene.parameter.set({pano0Depth:{panoId:re.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:rt},pano1Depth:{panoId:ue.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:rt}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},t.prototype.render=function(){this.renderer.setScissorTest(!1),this.cardboard.render(this.modelScene,this.camera),this.renderer.autoClear=!1,this.cardboard.render(this.scene,this.camera),this.renderer.autoClear=!0},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.updateHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.viewport.left,o=e.y*(1-this.viewport.bottom-this.viewport.height),s=e.x*this.viewport.width,u=e.y*this.viewport.height;this.helperElement.style.marginLeft!==r+"px"&&(this.helperElement.style.marginLeft=r+"px"),this.helperElement.style.marginTop!==o+"px"&&(this.helperElement.style.marginTop=o+"px"),this.helperElement.style.width!==s+"px"&&(this.helperElement.style.width=s+"px"),this.helperElement.style.height!==u+"px"&&(this.helperElement.style.height=u+"px")}},t.prototype.intersect=function(e){var r,o;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,delete this.activePanoMesh,delete this.activeTime;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){var s=this.activePanoMesh,u=null;return this.panoMeshes.forEach(function(w,M){w===s&&(u=M)}),u!==null&&this.moveToPano(panoParse(u),{},!0),delete this.activePanoMesh,delete this.activeTime,s}var l=this.camera.getDirection(new THREE__namespace.Vector3),c=new THREE__namespace.Raycaster(this.camera.position,l);c.params.Points={threshold:.1},c.firstHitOnly=!0,c.floorIndex=-1;for(var f=void 0,p=[],d=this.works.getObserver(this.currentPano),h=d?d.accessibleNodes.map(function(w){return panoStringify({panoIndex:w,workCode:d.work.workCode})}):[],g=0,A=h;g<A.length;g++){var m=A[g],E=this.panoMeshes.get(m);if(E){var v=c.intersectObject((r=E.hitTestMesh)!==null&&r!==void 0?r:E,!0)[0];if(v){var y=(o=d==null?void 0:d.floorIndex)!==null&&o!==void 0?o:0;p.push({panoMesh:E,intersection:__assign({floorIndex:y,floor:y},v)})}}}var b=p.sort(function(w,M){return w.intersection.distance-M.intersection.distance})[0];b?(f=b.intersection,this.activePanoMesh!==b.panoMesh&&(this.activePanoMesh=b.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(b.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),f||(f=this.modelScene.intersectRaycaster(c)[0]);var T=createEvent("intersect.update",{raycaster:c,intersection:f!=null?f:null,object:this.intersectMesh});if(this.emit("intersect.update",T),T.defaultPrevented){this.hideIntersectMesh();return}if(f&&f.face){var _=f.face.normal,S=new THREE__namespace.Quaternion;S.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),_),this.intersectMesh.quaternion.copy(S);var R=f.point.clone();this.intersectMesh.position.copy(R),b?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return b==null?void 0:b.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t})(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),scratchObserverBox$1=new THREE__namespace.Box3,scratchVector3$2=new THREE__namespace.Vector3,defaultModelControllerCustomInitArgs=__assign({},defaultPanoramaLikeControllerCustomInitArgs),ModelController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Model",r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r}return t.parseArgs=function(e){return e instanceof t?e:n.parseArgs.call(this,e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f=this.parseArgs(e),p=f.works,d=e.initial,h=d.state,g=d.currentState,A=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=p.getObserver(A),E=clamp$1((u=h.fov)!==null&&u!==void 0?u:!m||isFristPersonMode(g.mode)?g.fov:f.defaultFov,f.minFov,f.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:g.longitude,y=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(E):f.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(E):f.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:!m||isFristPersonMode(g.mode)?g.latitude:f.defaultLatitude,y,b),_=new THREE__namespace.Vector3;if(f.initial.state.offset)_.copy(f.initial.state.offset);else if(m)_.copy(m.position).applyMatrix4(m.work.transform);else{var S=coordinatesToVector(g).setLength(g.distance);_.copy(f.initial.currentState.offset).sub(S)}return{workCode:A.workCode,panoIndex:A.panoIndex,mode:"Model",longitude:v,latitude:T,fov:E,offset:_,distance:0}},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,e)},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));return this.hideIntersectMesh(),this.moveToPosition(u.offset,{duration:0,longitude:u.longitude,latitude:u.latitude,fov:u.fov},s),!0},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return u.distance=0,e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:0,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);for(var u=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=[],c=function(A){var m=f.modelScene.models.find(function(b){return b.work===A});if(!m||m.visible===!1||A.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(A.observerBox).expandByScalar(10).applyMatrix4(A.transform),scratchObserverBox$1.containsPoint(u))for(var E=0,v=A.observers;E<v.length;E++){var y=v[E];l.push(y)}},f=this,p=0,d=this.works;p<d.length;p++){var h=d[p];c(h)}var g=arrayMin(l,function(A){return scratchVector3$2.copy(A.position).applyMatrix4(A.work.transform).distanceTo(u)});this.currentPano=g?{workCode:g.work.workCode,panoIndex:g.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={modelAlpha:1},f={perspToOrtho:0},p={longitude:l.longitude,latitude:l.latitude,fov:l.fov,duration:s,moveStartCallback:function(d){e.perspToOrthoMotion.set(f,s).catch(noop),e.modelAlphaMotion.set(c,s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:d,userAction:e.userAction}))},moveEndCallback:function(d){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:d,userAction:e.userAction})),r()},moveCancelCallback:function(){var d=e.currentPano,h=__assign(__assign({},d),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:h,userAction:e.userAction})),r()}};e.moveToPosition(l.offset,p,u)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={});var s=this.works.getObserver(e);if(s){var u=new THREE__namespace.Vector3().copy(s.position).applyMatrix4(s.work.transform);this.moveToPosition(u,r,o)}},t.prototype.moveToPosition=function(e,r,o){var s=this,u,l,c;r===void 0&&(r={}),this.userAction=o,this.stopMomentumMovement();for(var f=now(),p=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),d=p.distanceTo(e),h=this.locationMotion.getProgressVelocity(f),g=0,A=1;A<this.locationMotion.keyframes.length;A++){var m=this.locationMotion.keyframes[A-1].value,E=m.x,v=m.y,y=m.z,b=this.locationMotion.keyframes[A].value,T=b.x,_=b.y,S=b.z;g+=Math.sqrt(Math.pow(T-E,2)+Math.pow(_-v,2)+Math.pow(S-y,2))}for(var R=d===0?0:h*g/d,w=this.calculateMovingDuration(r.duration,d),M={x:e.x,y:e.y,z:e.z,distance:0},O={longitude:r.longitude,latitude:r.latitude,fov:r.fov},C=[],P=function(z){var q=F.modelScene.models.find(function(Y){return Y.work===z});if(!q||q.visible===!1||z.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(z.observerBox).expandByScalar(10).applyMatrix4(z.transform),scratchObserverBox$1.containsPoint(p))for(var j=0,G=z.observers;j<G.length;j++){var X=G[j];C.push(X)}},F=this,L=0,H=this.works;L<H.length;L++){var N=H[L];P(N)}var D=arrayMin(C,function(z){return scratchVector3$2.copy(z.position).applyMatrix4(z.work.transform).distanceTo(p)}),Q=D?{workCode:D.work.workCode,panoIndex:D.panoIndex}:{workCode:"",panoIndex:0},J=__assign(__assign({},Q),{mode:this.mode,longitude:(u=O.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=O.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=O.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),U=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:U,progress:0,state:J,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(J),this.cameraMotion.set(O,w).catch(noop),this.locationMotion.set(M,w,R).then(function(){for(var z=0,q=s.modelScene.children;z<q.length;z++){var j=q[z];j instanceof Model&&j.show()}var G=__assign(__assign(__assign({},Q),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:U,progress:0,state:G,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(G)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:U,progress:0,state:J,userAction:s.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var o=this.modelScene.intersectRaycaster(r)[0];if(o&&o.face){var s=o.face.normal,u=o.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(s)>Math.PI/3){var l=s.clone().setLength(.3).add(u);r.set(l,new THREE__namespace.Vector3(0,-1,0)),o=this.modelScene.intersectRaycaster(r)[0]}}if(o){for(var c=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),f=[],p=function(b){var T=d.modelScene.models.find(function(w){return w.work===b});if(!T||T.visible===!1||b.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(b.observerBox).expandByScalar(10).applyMatrix4(b.transform),scratchObserverBox$1.containsPoint(c))for(var _=0,S=b.observers;_<S.length;_++){var R=S[_];f.push(R)}},d=this,h=0,g=this.works;h<g.length;h++){var A=g[h];p(A)}var m=arrayMin(f,function(b){return scratchVector3$2.copy(b.position).applyMatrix4(b.work.transform).distanceTo(c)},!0),E=m[0],v=m[1];if(E&&v<5){var y=scratchVector3$2.copy(E.position).applyMatrix4(E.work.transform);c.y=y.y}e.state.offset.copy(c),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(c,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t})(PanoramaLikeController),scratchObserverBox=new THREE__namespace.Box3,scratchVector3$1=new THREE__namespace.Vector3,minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,defaultMapviewControllerCustomInitArgs={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:+Math.PI/2,minLatitude:0,cameraType:"auto",cameraFence:null,intersectMeshCreator:function(){return new IntersectMesh}},MapviewController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.cameraFence=o.cameraFence,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.currentTapId=null,r.helper.add(r.intersectMesh),r.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{generateMipmaps:!1,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,p;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:defaultMapviewControllerCustomInitArgs.defaultLongitude,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:defaultMapviewControllerCustomInitArgs.defaultLatitude,defaultDistance:(s=e.defaultDistance)!==null&&s!==void 0?s:defaultMapviewControllerCustomInitArgs.defaultDistance,maxLatitude:(u=e.maxLatitude)!==null&&u!==void 0?u:defaultMapviewControllerCustomInitArgs.maxLatitude,minLatitude:(l=e.minLatitude)!==null&&l!==void 0?l:defaultMapviewControllerCustomInitArgs.minLatitude,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:defaultMapviewControllerCustomInitArgs.cameraType,cameraFence:(f=e.cameraFence)!==null&&f!==void 0?f:defaultMapviewControllerCustomInitArgs.cameraFence,intersectMeshCreator:(p=e.intersectMeshCreator)!==null&&p!==void 0?p:defaultMapviewControllerCustomInitArgs.intersectMeshCreator})},t.distanceFromModel=function(e,r,o){var s=e.boundingBox,u=s.isEmpty()?10:Math.pow(Math.pow(s.max.x-s.min.x+1,2)+Math.pow(s.max.y-s.min.y+1,2)+Math.pow(s.max.z-s.min.z+1,2),1/2);u=isNaN(u)||!isFinite(u)?1:u;var l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)||!isFinite(l)?u:l},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,p=this.parseArgs(e),d=p.works,h=p.modelScene,g=e.initial,A=g.state,m=g.currentState,E=typeof A.panoIndex=="number"?{workCode:(s=(r=A.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:A.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},v=(u=A.fov)!==null&&u!==void 0?u:60,y=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(v):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(v):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((l=A.latitude)!==null&&l!==void 0?l:isThirdPersonMode(m.mode)?m.latitude:p.defaultLatitude,y,b),_=t.distanceFromModel(p.modelScene,v,p.camera.aspect),S=new THREE__namespace.Vector3,R=(c=A.distance)!==null&&c!==void 0?c:Math.min(p.defaultDistance,_),w=(f=A.longitude)!==null&&f!==void 0?f:isThirdPersonMode(m.mode)?m.longitude:p.defaultLongitude;if(A.offset)S.copy(A.offset);else{var M=d.getObserver(E);p.defaultDistance<_&&M?(S.copy(M.position).applyMatrix4(M.work.transform),A.longitude===void 0&&(w=m.longitude)):(h.boundingBox.getCenter(S),R=_)}return __assign(__assign({},E),{mode:"Mapview",longitude:w,latitude:T,fov:v,offset:S,distance:R})},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof THREE__namespace.Box3&&e.cameraFence instanceof THREE__namespace.Box3?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):this.cameraFence instanceof THREE__namespace.Sphere&&e.cameraFence instanceof THREE__namespace.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!0},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.userAction=s,this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));this.currentPano={workCode:u.workCode,panoIndex:u.panoIndex};var l={longitude:u.longitude,latitude:u.latitude,fov:u.fov},c={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance,orthoDistance:u.distance};return this.locationMotion.set(c,o.duration).catch(noop),this.cameraMotion.set(l,o.duration).catch(noop),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e);var r=e.boundingBox.getCenter(new THREE__namespace.Vector3),o=t.distanceFromModel(e,this.cameraMotion.value.fov,this.camera.aspect);this.updateCamera({offset:r,distance:o},0,!0),this.hideIntersectMesh()},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return e.distance!==void 0&&(u.distance=e.distance),e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:p.value.distance,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};this.locationMotion.ended||(this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha);var u=0;if(this.cameraType==="auto"?u=Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02?1:0:this.cameraType==="perspective"?u=0:this.cameraType==="orthographic"&&(u=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==u&&this.perspToOrthoMotion.set({perspToOrtho:u},500).catch(noop),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){var l=coordinatesToVector(this.camera.pose,new THREE__namespace.Vector3),c=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(l.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(c)>.01){var f=this.cameraFence.clampPoint(c,new THREE__namespace.Vector3),p=this.camera.pose.offset.clone().add(f).sub(c),d=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:p,distance:this.camera.pose.distance});this.fixFinalState(d),this.locationMotion.set({x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance},300).catch(noop)}}if(this.intersectMesh&&this.intersectMesh.parent){var h=this.camera.position.distanceTo(this.intersectMesh.position),g=2*Math.tan(.5*this.camera.fov/180*Math.PI),A=h*g/5;this.intersectMesh.scale.setScalar(A)}}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={longitude:l.longitude,latitude:l.latitude,fov:l.fov},f={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},p={modelAlpha:1},d={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.set(p,s/3).catch(noop),e.cameraMotion.set(c,s).catch(noop),e.locationMotion.set(f,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){var g=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this.modelScene.intersectRaycaster(e)[0];if(!r)return null;for(var o=[],s=function(g){var A=u.modelScene.models.find(function(y){return y.work===g});if(!A||A.visible===!1||g.observers.length<=0)return"continue";if(scratchObserverBox.copy(g.observerBox).expandByScalar(10).applyMatrix4(g.transform),scratchObserverBox.containsPoint(e.ray.origin)||e.ray.intersectsBox(scratchObserverBox))for(var m=0,E=g.observers;m<E.length;m++){var v=E[m];o.push(v)}},u=this,l=0,c=this.works;l<c.length;l++){var f=c[l];s(f)}var p=arrayMin(o,function(g){return scratchVector3$1.copy(g.standingPosition).applyMatrix4(g.work.transform).distanceTo(r.point)},!0),d=p[0],h=p[1];return d&&h<10?d:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.viewport.width),latitude:2*e.y/(r.y*this.viewport.height)}},t.prototype.requestMomentumMovement=function(e,r,o,s){var u=this;if(this.inMomentumMovement!==null){s=Math.max(s,1);for(var l=__assign({},o),c={longitude:0,latitude:0,x:0,y:0,z:0},f=0;f<s;f++)l.longitude*=.996,l.latitude*=.996*.998,l.x*=.99,l.y*=.99,l.z*=.99,c.longitude+=l.longitude,c.latitude+=l.latitude,c.x+=l.x,c.y+=l.y,c.z+=l.z;var p=this.cameraMotion.value.fov,d=formatRad$1(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(p):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(p):this.maxLatitude,-Math.PI/2,Math.PI/2),A=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),m=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),E=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:A,offset:m,fov:p,distance:this.locationMotion.value.distance}),v=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(E.distance)),y=!(Math.abs(l.longitude)>1e-4||Math.abs(l.latitude)>1e-4||Math.abs(l.x)>1e-4||Math.abs(l.y)>1e-4||Math.abs(l.z)>1e-4),b=this.cameraFence?this.cameraFence.containsPoint(v):!0;b===!1&&(y=!0);var T=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:y,state:E}));if(this.inMomentumMovement.event=T,this.emit("gesture.momentum",T),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:A},0).catch(noop),this.locationMotion.set({x:E.offset.x,y:E.offset.y,z:E.offset.z,distance:E.distance},0).catch(noop),y?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(_,S){u.requestMomentumMovement(e,!1,l,S|0)},!0,1))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),o=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),s=new THREE__namespace.Raycaster(o,r);s.params.Points={threshold:.1},s.firstHitOnly=!0,s.near=this.camera.near,s.far=this.camera.far;var u;if(u=this.modelScene.intersectRaycaster(s).filter(function(d){var h,g=(h=d.face)===null||h===void 0?void 0:h.normal;return g&&s.ray.direction.dot(g)>=0?!1:d.distance>minDistance+s.near})[0],!u){var l=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),c=s.ray.intersectPlane(l,new THREE__namespace.Vector3);if(c){var f=c.distanceTo(s.ray.origin);f<1e3&&f>=s.near&&(u={distance:f,floorIndex:0,floor:0,point:c,object:this.scene,face:null})}}if(!u){var p=Math.max(e.distance,3);u={distance:p,floorIndex:0,floor:0,point:s.ray.direction.clone().setLength(p).add(s.ray.origin),object:this.scene,face:null}}u&&(e.distance=clamp$1(u.distance,0,1/0),e.offset.copy(o).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,o=this.panState,s=0,u=!1;e.pointerType==="mouse"&&(s=e.srcEvent.buttons,u=e.srcEvent.shiftKey),o&&s===0&&o.buttons!==0&&(s=o.buttons);var l=o==null?void 0:o.target;if(!l){var c=this.relativeClientPosition(e.center),f=this.createRaycasterFromCamera(c,this.camera);l=new THREE__namespace.Vector3().copy(f.ray.direction).multiplyScalar(3).add(f.ray.origin);var p=this.modelScene.intersectRaycaster(f)[0];if(!p&&f.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),h=f.ray.intersectPlane(d,new THREE__namespace.Vector3);if(h){var g=h.distanceTo(f.ray.origin);g<1e4&&g>=f.near&&(p={distance:g,floorIndex:0,floor:0,point:h,object:this.scene})}}if(p)l.copy(p.point);else{var A=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(A,this.camera.pose.offset);f.ray.intersectPlane(d,l)}}if(e.isFinal?delete this.panState:this.panState={target:l,buttons:s,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof o=="undefined"||o.pointerLength!==r)){var m=r>1||s===2||u;if(m){var E={x:e.center.x-o.x,y:e.center.y-o.y},v=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),y=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(v),b=new THREE__namespace.Vector3().copy(y).sub(o.target).length();b*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var T=this.renderer.getSize(new THREE__namespace.Vector2),_=2*E.x*b/T.y,S=2*E.y*b/T.y,R=new THREE__namespace.Vector3;R.setFromMatrixColumn(this.camera.matrix,0),R.multiplyScalar(-_),v.add(R),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?R.setFromMatrixColumn(this.camera.matrix,1):(R.setFromMatrixColumn(this.camera.matrix,0),R.crossVectors(this.camera.up,R)),R.multiplyScalar(S),v.add(R);var w=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:v,distance:this.camera.pose.distance});if(e.state=w,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop),e.isFinal&&(this.fixFinalState(w),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:w.distance,x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop)),e.isFinal){var M=this.renderer.getSize(new THREE__namespace.Vector2),O=2*e.velocityX*b/M.y,C=2*e.velocityY*b/M.y,P=new THREE__namespace.Vector3,F=new THREE__namespace.Vector3;P.setFromMatrixColumn(this.camera.matrix,0),P.multiplyScalar(-O),F.add(P),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?P.setFromMatrixColumn(this.camera.matrix,1):(P.setFromMatrixColumn(this.camera.matrix,0),P.crossVectors(this.camera.up,P)),P.multiplyScalar(C),F.add(P),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:F.x,y:F.y,z:F.z},0)}}else{var E={x:e.center.x-o.x,y:e.center.y-o.y},L=this.coordinatesForOffset(E),H=formatRad$1(this.cameraMotion.value.longitude+L.longitude),N=this.camera.pose.fov,D=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(N):this.minLatitude,-Math.PI/2,Math.PI/2),Q=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(N):this.maxLatitude,-Math.PI/2,Math.PI/2),J=clamp$1(this.cameraMotion.value.latitude+L.latitude,D,Q);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(J=this.cameraMotion.value.latitude);var w=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:H,latitude:J,fov:N,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=w,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:w.distance,x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop):this.cameraMotion.set({longitude:w.longitude,latitude:w.latitude},0).catch(noop),e.isFinal){var U=e.velocityX,z=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:U,y:z})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var o=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof o!="undefined"){var s=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),l=clamp$1(o/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(l)),f=this.modelScene.boundingBox.containsPoint(c),p;if(!f&&this.pinchState&&this.pinchState.scale>e.scale&&s.distanceTo(c)>u?p=e.state.distance:(p=l,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=p,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var d=e.state;this.fixFinalState(e.state);var h={x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance};this.locationMotion.set(h,0).catch(noop)}delete this.panState,delete this.pinchState}}}},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var s=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var u=this.modelScene.intersectRaycaster(s)[0],l=createEvent("intersect.update",{raycaster:s,intersection:u!=null?u:null,object:this.intersectMesh});if(this.emit("intersect.update",l),l.defaultPrevented){this.hideIntersectMesh();return}if(u){var c=(o=(r=u.face)===null||r===void 0?void 0:r.normal)!==null&&o!==void 0?o:new THREE__namespace.Vector3().copy(s.ray.direction).multiplyScalar(-1),f=c.clone(),p=u.point.clone();this.intersectMesh.position.copy(p);var d=p.clone().add(f);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(p);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var o={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(o,0).catch(noop)}else{var s=Math.max(this.locationMotion.value.distance-this.camera.near,0),u=e.center.delta/10*Math.max(s/5,.1);if(this.locationMotion.value.distance-u>=minDistance){var l=this.locationMotion.value.distance-u;e.state.distance=l}else{var c=coordinatesToVector(this.cameraMotion.value);c.setLength(u),e.state.offset.add(c)}if(this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:e.state.distance,x:e.state.offset.x,y:e.state.offset.y,z:e.state.offset.z},0).catch(noop)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=e.userAction,this.stopMomentumMovement();var o=e.center.raycaster,s=this.getForwardObserverOrNot(o);if(!s)this.emit("gesture.tap",e);else{var u={longitude:this.camera.pose.longitude,latitude:0},l=__assign(__assign({},e.state),{mode:"Panorama",workCode:s.work.workCode,panoIndex:s.panoIndex,longitude:u.longitude,latitude:u.latitude,offset:s?s.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=l,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:l,userAction:e.userAction,options:u,progress:0,error:null})),s&&s.active)){var c=this.currentTapId=createUuid(),f={panoIndex:s.panoIndex,workCode:s.work.workCode};this.preloadPano(f).then(function(p){r.currentTapId===c&&r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:l,options:u,error:null}))})}}},t.prototype.onDblTapGesture=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.state,o=e.center.raycaster,s=o.ray.origin.clone().add(o.ray.direction.clone().setLength(3)),u=1,l=3,c=u,f=this.modelScene.intersectRaycaster(o)[0];if(f&&(s=f.point.clone(),f.distance>(u+l)/2?c=u:c=l),e.state.distance=c,e.state.offset=s,this.emit("gesture.dbltap",e),!e.defaultPrevented){var p={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(p,360).catch(noop),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)},t})(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=(function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var o=null,s=null,u=null,l=this._targetRay,c=this._grip,f=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(l!==null&&(o=e.getPose(t.targetRaySpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),f&&t.hand){u=!0;for(var p=0,d=t.hand.values();p<d.length;p++){var h=d[p],g=e.getJointPose(h,r);if(f.joints[h.jointName]===void 0){var A=new THREE__namespace.Group;A.matrixAutoUpdate=!1,A.visible=!1,f.joints[h.jointName]=A,f.add(A)}var m=f.joints[h.jointName];g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=g.radius),m.visible=g!==null}var E=f.joints["index-finger-tip"],v=f.joints["thumb-tip"],y=E.position.distanceTo(v.position),b=.02,T=.005;f.inputState.pinching&&y>b+T?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&y<=b-T&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));return l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),f!==null&&(f.visible=u!==null),this},n})(),framebufferScaleFactor=1,isAppleVisionPro=function(){try{var n=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return n&&t}catch(e){return console.error("Error determining if the device is an Apple Vision Pro: ",e),!1}},isOculus=function(){try{return/Oculus/i.test(navigator.userAgent)}catch(n){return console.error("Error determining if the device is an Oculus: ",n),!1}},XRManager=(function(){function n(t,e,r){var o,s,u,l,c;this.isPanorama=(o=r==null?void 0:r.isPanorama)!==null&&o!==void 0?o:!0,navigator.userAgent.toLowerCase();var f;isAppleVisionPro()?f="VP":isOculus()?f="Oculus":f="Pico",this.machineType=(s=r==null?void 0:r.machineType)!==null&&s!==void 0?s:f,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(u=r==null?void 0:r.referenceSpaceType)!==null&&u!==void 0?u:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(l=r==null?void 0:r.onSessionStart)!==null&&l!==void 0?l:noop,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraVR.cameras.push(this.cameraL,this.cameraR),this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var o=this.cameraLPos.distanceTo(this.cameraRPos),s=e.projectionMatrix.elements,u=r.projectionMatrix.elements,l=s[14]/(s[10]-1),c=s[14]/(s[10]+1),f=(s[9]+1)/s[5],p=(s[9]-1)/s[5],d=(s[8]-1)/s[0],h=(u[8]+1)/u[0],g=l*d,A=l*h,m=o/(-d+h),E=m*-d;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(E),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=l+m,y=c+m,b=g-E,T=A+(o-E),_=f*c/y*v,S=p*c/y*v;t.projectionMatrix.makePerspective(b,T,_,S,v,y)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var o=0;o<r.length;o++)this.updateCamera(r[o],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var s=t.children,o=0,u=s.length;o<u;o++)s[o].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var o=t.removed[r],s=this.inputSourcesMap.get(o);s&&(s.dispatchEvent({type:"disconnected",data:o}),this.inputSourcesMap.delete(o))}for(var r=0;r<t.added.length;r++){var o=t.added[r],s=this.inputSourcesMap.get(o);s&&s.dispatchEvent({type:"connected",data:o})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectstart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeeze",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezestart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezeend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("end",function(o){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var o={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;case"Oculus":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(s){e.onRequestReferenceSpace(s)}),e.session.addEventListener("inputsourceschange",function(s){e.updateInputSources(s)})})}},n})(),LineSegmentsGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],o=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(s),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(o,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,o=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),o.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),o.setFromBufferAttribute(r),this.boundingBox.union(o)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=this.boundingSphere.center;this.boundingBox.getCenter(o);for(var s=0,u=new THREE__namespace.Vector3,l=0,c=e.count;l<c;l++)u.fromBufferAttribute(e,l),s=Math.max(s,o.distanceToSquared(u)),u.fromBufferAttribute(r,l),s=Math.max(s,o.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t})(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
|
|
1935
1935
|
#include <common>
|
|
1936
1936
|
#include <color_pars_vertex>
|
|
1937
1937
|
#include <fog_pars_vertex>
|
|
@@ -2130,7 +2130,7 @@ void main() {
|
|
|
2130
2130
|
#include <premultiplied_alpha_fragment>
|
|
2131
2131
|
|
|
2132
2132
|
}
|
|
2133
|
-
`},LineMaterial=(function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(o){this.uniforms.diffuse.value=o}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(o){this.uniforms.linewidth.value=o}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(o){this.uniforms.dashScale.value=o}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(o){this.uniforms.dashSize.value=o}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(o){this.uniforms.gapSize.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}}}),r.setValues(e),r}return t})(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this)||this;return o.type="LineSegments2",o.geometry=e!==void 0?e:new LineSegmentsGeometry,o.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),o}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,o=e.attributes.instanceEnd,s=new Float32Array(2*r.count),u=new THREE__namespace.Vector3,l=new THREE__namespace.Vector3,c=0,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,A=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,E=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,y=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,m),m.w=1,m.applyMatrix4(s.matrixWorldInverse),m.applyMatrix4(u),m.multiplyScalar(1/m.w),m.x*=f.x/2,m.y*=f.y/2,m.z=0,E.copy(m);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){g.fromBufferAttribute(d,_),A.fromBufferAttribute(h,_),g.w=1,A.w=1,g.applyMatrix4(v),A.applyMatrix4(v),g.applyMatrix4(u),A.applyMatrix4(u),g.multiplyScalar(1/g.w),A.multiplyScalar(1/A.w);var R=g.z<-1&&A.z<-1,w=g.z>1&&A.z>1;if(!(R||w)){g.x*=f.x/2,g.y*=f.y/2,A.x*=f.x/2,A.y*=f.y/2,y.start.copy(g),y.start.z=0,y.end.copy(A),y.end.z=0;var M=y.closestPointToPointParameter(E,!0);y.at(M,b);var O=THREE__namespace.MathUtils.lerp(g.z,A.z,M),C=O>=-1&&O<=1,P=E.distanceTo(b)<p*.5;if(C&&P){y.start.fromBufferAttribute(d,_),y.end.fromBufferAttribute(h,_),y.start.applyMatrix4(T),y.end.applyMatrix4(T);var F=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;o.distanceSqToSegment(y.start,y.end,L,F),r.push({point:L,pointOnLine:F,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.6.0-alpha.8"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var o=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(o),3)),this.line.geometry.setPositions(o),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o];o==="dashed"?(r.dashed=s,s?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[o]=e[o]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var o=this.line.material.resolution;(o.x!==e||o.y!==r)&&(o.set(e,r),this.needsRender=!0)},t})(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,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 A=u[g];return A&&(l={profileId:g,profilePath:"".concat(r,"/").concat(A.path),deprecated:!!A.deprecated}),!!l}),!l){if(!o)throw new Error("No matching profile name found");if(c=u[o],!c)throw new Error('No matching profile name found and default profile "'.concat(o,'" missing.'));l={profileId:o,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(l.profilePath)];case 2:if(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",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=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var f=panoStringify(e),p=this.works.getObserver(e);if(!p)throw new Error("Invalid PanoIndex");getImageSizeFromURL(p.images.up),this.imageOptions.size;var d=this.imageOptions.transform,h=function(R,w){return mapPanoResource(applyImageURLOptions(R,d,w))},g=__assign({key:"pano.".concat(f)},pick(this.imageOptions,["format","size","quality"])),A={right:p.images.work.getURL(p.images.right),left:p.images.work.getURL(p.images.left),up:p.images.work.getURL(p.images.up),down:p.images.work.getURL(p.images.down),front:p.images.work.getURL(p.images.front),back:p.images.work.getURL(p.images.back)},m="pano:"+jsonHash([A,g,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===m)return;var E=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(E))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:e}))}var v=this.modelScene.parameter.resolveValue(),y=v.pano0,b=v.pano1,T;if((y==null?void 0:y.map.name)===m?T=y:(b==null?void 0:b.map.name)===m&&(T=b),T){var _={panoId:f,effect:c,leftPanoPicture:{panoId:T.panoId,map:T.map,mapSize:T.mapSize,matrix:p.matrix.clone().premultiply(p.work.transform),zoom:1},position:p.position.clone().applyMatrix4(p.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,_,r);return}var S="move-to-pano-"+f;this.pending.add(S),this.pendingTextureTask={panoId:f,hash:m,onLoad:function(R){var w;s.pending.delete(S);var M=R.body;if(s.destroyed)M.dispose();else{M.name=m;var O=Array.isArray(M.image)?M.image[0]:M.image,C=(w=O==null?void 0:O.width)!==null&&w!==void 0?w:2048,P={panoId:f,effect:c,leftPanoPicture:{panoId:f,map:M,mapSize:C,matrix:p.matrix.clone(),zoom:1},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,P,r)}},onError:function(R){s.pending.delete(S);var w=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:R,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),r.moveCancelCallback&&r.moveCancelCallback()}},this.textureLoader.loadCubeTexture(A,{imageURL:{transform:h,options:g},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(p.work)},void 0,void 0,function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===m&&((M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(R)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:R,meta:null,pano:e}))},this.renderer).then(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===m?(s.pendingTextureTask.onLoad(R),(M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:R.meta,pano:e}))):R.body.dispose()}).catch(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===m&&(s.pendingTextureTask.onError(R),(M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:R,progress:0,meta:null,pano:e})),s.emit("error",R))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,A,m;o===void 0&&(o={});var E=now(),v=createUuid();this.panoResources[v]=r;var y=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(E);S[0];var R=S[1],w=this.locationMotion.value,M=this.panoResourceFromLocationMotionKeyframe(R).position,O=r.position;b=Math.max(M.distanceTo(O),y),T=[{key:R.key,progress:0,value:__assign(__assign({},w),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(E),P=C[0],R=C[1],w=this.locationMotion.value,F=this.panoResourceFromLocationMotionKeyframe(P).position,M=this.panoResourceFromLocationMotionKeyframe(R).position,O=r.position,L=R.value.count-w.count,H=Math.max(F.distanceTo(M),y)*L,N=Math.max(M.distanceTo(O),y);b=H+N,T=[{key:P.key,progress:0,value:__assign({},w)},{key:R.key,progress:H/b,value:R.value},{key:v,progress:1,value:{count:R.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),Q=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(E)*D/Q}var J=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?b:0),U={longitude:o.longitude,latitude:o.latitude,fov:o.fov},z=__assign(__assign({},e),{mode:this.mode,longitude:(u=U.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=U.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=U.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:q,progress:0,state:z,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(z),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(U,J).catch(noop);else{var j=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),G=coordinatesToVector({longitude:(f=U.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(p=U.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude}),X=new THREE__namespace.Object3D;X.lookAt(j);var Y=new THREE__namespace.Matrix4().makeRotationFromQuaternion(X.quaternion);X.lookAt(G);var Z=new THREE__namespace.Matrix4().makeRotationFromQuaternion(X.quaternion),W=new THREE__namespace.Matrix4().getInverse(Y).premultiply(Z),K=this.cameraMotion.value.fov,ne=(d=U.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,ee=1;r.effect==="zoomin"?ee=1.5:r.effect==="zoomout"&&(ee=.4);for(var te=ne*ee,ae=0;ae<T.length-1;ae++){var fe=T[ae].key;if(fe){var se=this.panoResources[fe];se&&(se.fixCameraTransform.copy(W),se.leftPanoPicture&&(se.leftPanoPicture.zoom=Math.tan(te/2/180*Math.PI)/Math.tan(K/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(h=U.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(g=U.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:te}},{progress:1,value:{longitude:(A=U.longitude)!==null&&A!==void 0?A:this.cameraMotion.value.longitude,latitude:(m=U.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:ne}}],J).catch(noop)}var he=this.locationMotion.setKeyframes(T,J,_);he.then(function(){for(var me=0,be=s.modelScene.children;me<be.length;me++){var Te=be[me];Te instanceof Model&&Te.show()}var ce=__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:q,progress:1,state:ce,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ce);var pe=s.works.getObserver(s.currentPano);if(pe&&pe.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var re={map:s.videoTexture,size:pe.video.size.clone(),matrix:pe.video.matrix.clone(),panoMatrix:pe.matrix.clone().premultiply(pe.work.transform),alpha:1},ue=createUuid(),ve=s.videoTexture.image;ve.setAttribute("uuid",ue),canplayVideo().then(function(ye){ye&&pe.video&&ve.getAttribute("uuid")===ue&&(ve.oncanplay=function(){ve.oncanplay=noop,ve.play()},ve.ontimeupdate=function(){ve.currentTime>.5&&(ve.ontimeupdate=noop,s.panoVideo.setMaterial(re))},ve.src=pe.video.source)}).catch((function(){ve.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:q,progress:0,state:z,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o;this.stopMomentumMovement(),this.camera.getDirection(new THREE__namespace.Vector3).setY(0);var s=null,u=this.works.getObserver(this.currentPano);if(!u)return null;var l=u.work.observers,c=u.accessibleNodes.filter(function(_){if(_===r.currentPano.panoIndex&&u.work.workCode===r.currentPano.workCode)return!1;var S=l[_];if(!S)return!1;var R=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return R.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),f=this.modelScene.intersectRaycaster(e)[0];if(f){var p=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var R=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return R.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 A=0,m=this.locationMotion.keyframes;A<m.length;A++){var E=m[A],v=this.panoResourceFromLocationMotionKeyframe(E);if(!(E.progress<this.locationMotion.progress)&&s){var y=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===y){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var y=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(y);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,A=[],m=2;m<arguments.length;m++)A[m-2]=arguments[m];this.userAction=!0;var E={},v={},y=this.locationMotion.keyframes[0],b=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],T=this.locationMotion.getKeyFrameSegment(e),_=T[0],S=T[1],R=this.panoResourceFromLocationMotionKeyframe(_),w=this.panoResourceFromLocationMotionKeyframe(S),M=this.panoResourceFromLocationMotionKeyframe(y),O=this.panoResourceFromLocationMotionKeyframe(b),C=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),v.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),E.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 P=this.locationMotion.getKeyFrameSegment(e);P[0];var F=P[1],L=new THREE__namespace.Vector3().copy(R.position),H=new THREE__namespace.Vector3().copy(w.position),N=this.locationMotion.value.count-F.value.count+1;if(E.progress=N,w.leftPanoPicture&&(N<1?R.leftPanoPicture&&(E.pano0=R.leftPanoPicture):E.pano0=w.leftPanoPicture,E.pano1=w.leftPanoPicture),w.effect==="montage"?E.transition="BLACK":w.effect==="spread"?E.transition="SPREAD":E.transition="FADE",(w.effect==="zoomin"||w.effect==="zoomout")&&(E.progress=Math.pow(N,3)),N<1&&w.effect!=="fly"){if(E.pano0&&R.leftPanoPicture){var D={panoId:E.pano0.panoId,map:E.pano0.map,mapSize:E.pano0.mapSize,zoom:E.pano0.zoom,matrix:R.leftPanoPicture.matrix.clone().setPosition(w.position)},Q=this.panoPictureObserverMap.get(E.pano0);Q&&this.panoPictureObserverMap.set(D,Q),E.pano0=D}L.copy(H),C=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(L.x+(H.x-L.x)*N,L.y+(H.y-L.y)*N,L.z+(H.z-L.z)*N);for(var J=[],U=[],z=0,q=this.locationMotion.keyframes;z<q.length;z++){var j=q[z],G=j.key,X=j.progress;G!==void 0&&(J.push(G),X>this.locationMotion.progress&&U.push(G))}for(var Y=0,Z=Object.keys(this.panoResources);Y<Z.length;Y++){var W=Z[Y];if(!(U.indexOf(W)>=0)){var K=this.panoResources[W];if(K.leftPanoPicture){var ne=K.leftPanoPicture.map;if(ne){if(ne===((s=E.pano0)===null||s===void 0?void 0:s.map)||ne===((u=E.pano1)===null||u===void 0?void 0:u.map))continue;ne.dispose(),K.leftPanoPicture=null}}J.indexOf(W)>=0||delete this.panoResources[W]}}var ee=panoParse(w.panoId);ee!==this.currentPano&&(this.currentPano=ee,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(M.panoId),state:__assign(__assign(__assign(__assign({},panoParse(O.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 te=A,ae=te[1],fe=new THREE__namespace.Vector3(0,0,0),se=new THREE__namespace.Vector2().copy(this.camera.resolution);if(ae&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){var he=this.xrManager.cameraVR,me=this.xrManager.referenceSpace,be=this.xrManager.session.renderState.baseLayer,Te=ae.getViewerPose(me),ce=(l=Te==null?void 0:Te.views)!==null&&l!==void 0?l:[];this.renderer.setFramebuffer(be.framebuffer);for(var pe=0;pe<ce.length;pe++){var re=ce[pe],ue=he.cameras[pe],ve=be.getViewport(re);ve&&(ue.projectionMatrix.fromArray(re.projectionMatrix),ue.projectionMatrixInverse.getInverse(ue.projectionMatrix),ue.matrix.fromArray(re.transform.matrix),ue.matrix.setPosition(this.camera.position),ue.matrix.decompose(ue.position,ue.quaternion,ue.scale),ue.matrixWorld.copy(ue.matrix),ue.matrixWorldInverse.getInverse(ue.matrixWorld),ue.matrixAutoUpdate=!1,fe.copy(ue.position),ue.viewport.set(ve.x,ve.y,ve.width,ve.height),se.set(ve.width,ve.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((c=v.distance)!==null&&c!==void 0?c:this.camera.pose.distance),this.xrManager.session&&this.xrManager.session.inputSources){for(var pe=0;pe<this.xrManager.session.inputSources.length;pe++)if(this.xrManager.session.inputSources[pe]&&this.xrManager.session.inputSources[pe].targetRayMode==="transient-pointer"){var ye=ae.getPose(this.xrManager.session.inputSources[pe].targetRaySpace,me);if(ye){var De=ye.transform.orientation,Je=new THREE__namespace.Quaternion(De.x,De.y,De.z,De.w),$e=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(Je),Ue=new THREE__namespace.Raycaster(this.camera.position,$e);this.gazeRay=Ue}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var de=this.xrManager.session.inputSources,Ye=function(le){var Se=Ee.xrManager.controllers[le],Ce=de[le];if(!Ce)return"continue";Se&&Se.update(Ce,ae,me);var Be=Ee.xrManager.getController(le),_t=new THREE__namespace.Vector3(0,1.2,0),Xe=Be.position.clone().add(fe).sub(_t);Ce.handedness==="left"?Ee.xrControllerRay.left.set(Xe,new THREE__namespace.Vector3(0,0,-1).applyEuler(Be.rotation)):Ce.handedness==="right"&&Ee.xrControllerRay.right.set(Xe,new THREE__namespace.Vector3(0,0,-1).applyEuler(Be.rotation)),Ee.controllerWrappers[le].position.copy(new THREE__namespace.Vector3(0,0,0).add(fe).sub(_t));var st=Ee.modelScene.intersectRaycaster(Ee.xrControllerRay.right);if(st.length===0){var Bt=Ee.works.getResolvedObserver(Ee.currentPano);st=Ee.xrControllerRay.right.intersectObject(Ee.boundingMesh,!0).map(function(ie){var Ae,Ne=(Ae=Bt==null?void 0:Bt.floorIndex)!==null&&Ae!==void 0?Ae:0;return __assign({floorIndex:Ne,floor:Ne},ie)})}if(st.length>=1&&st[0].face)if(Ce.handedness==="right"){var Ht=Ee.xrControllerRay.right.intersectObject(Ee.xrCustomObjectsScene,!0),Ot=st[0].face.normal,Lt=Ot.clone(),I=st[0].point.clone();Ee.intersectMesh.position.copy(I);var B=I.clone().add(Lt);if(Ee.intersectMesh.lookAt(B),Math.abs(Ot.y)>.99){var k=Ee.camera.position.clone().sub(I);Ee.intersectMesh.rotation.z=-Math.atan2(k.z,k.x)}Ee.intersectMesh.visible=!0,Ee.needsRender=!0,Ht.length>0?(Ee.pointerLines.right.setPoints(Xe,Ht[0].point),Ee.pointerLines.right.points.visible=!0,Ee.intersectMesh.visible=!1):(Ee.pointerLines.right.points.visible=!1,Ee.pointerLines.right.setPoints(Xe,st[0].point));var V=st[0],$=createEvent("intersect.update",{raycaster:(f=Ee.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:V!=null?V:null,object:Ee.intersectMesh});if(Ee.emit("intersect.update",$),$.defaultPrevented)return Ee.hideIntersectMesh(),{value:void 0}}else Ee.pointerLines.left.setPoints(Xe,st[0].point)},Ee=this,pe=0;pe<de.length;pe++){var Oe=Ye(pe);if(typeof Oe=="object")return Oe.value}this.updateControllerHelper(de,e,r)}}else ae||console.error("xrFrame丢失,请重试"),this.xrManager.session||console.error("session丢失,请重试"),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error("no layer found");isEmptyObject(E)===!1&&this.modelScene.parameter.set(E),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));var Fe=this.works.getResolvedObserver(this.currentPano),tt=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,rt=this.works.getObserver(R.panoId),Le=this.works.getObserver(w.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Fe){for(var Ie=[],He=Fe.work.observers,ge=0,we=Fe.accessibleNodes;ge<we.length;ge++){var Pe=we[ge],Q=He[Pe];Q&&Ie.push(Q)}var je=new Map;if(Ie.sort(function(le,Se){var Ce=je.get(le);typeof Ce=="undefined"&&(Ce=le.standingPosition.distanceTo(Fe.standingPosition),je.set(le,Ce));var Be=je.get(le);return typeof Be=="undefined"&&(Be=Se.standingPosition.distanceTo(Fe.standingPosition),je.set(Se,Be)),Ce-Be}),Ie.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Ie.length;var Ve=Ie[this.accessibleObserverFloorCheckCount],Ze=this.modelScene.models.find(function(le){return le.work===(Ve==null?void 0:Ve.work)});if(Ve&&Ze&&Ze.visible){var gt=.3,Qe=.05,At=.005,Re=Ve.standingPosition.clone().applyMatrix4(Ve.work.transform),qe=panoStringify({panoIndex:Ve.panoIndex,workCode:Ve.work.workCode}),ft=adjustPanoCircleMeshVectors.map(function(le){scratchRaycaster.ray.origin.copy(Re),scratchRaycaster.ray.origin.add(scratchVector3.copy(le).setY(gt)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var Se=Ze.intersectRaycaster(scratchRaycaster)[0];return Se&&Se.distance-At<=gt?new THREE__namespace.Vector3().copy(Re).setY(Se.point.y+At):Re});ft.sort(function(le,Se){return Se.y-le.y});var dt=ft[Math.floor(ft.length/2)],Ge=ft.filter(function(le){return le.distanceTo(dt)<=Qe})[0];if(Ge){var nt=new THREE__namespace.Vector4(Re.x,Re.y,Re.z,Ge.y-Re.y),ct=this.adjustPanoCircleMeshPositionFix.get(qe);ct&&!nt.equals(ct)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(qe,nt)}}this.accessibleObserverFloorCheckCount++}}var oe=new Map;if(rt)for(var _e=0,Me=rt.accessibleNodes;_e<Me.length;_e++){var Pe=Me[_e],Q=rt.work.observers[Pe];if(Q){var qe=panoStringify({panoIndex:Q.panoIndex,workCode:Q.work.workCode});oe.set(qe,Q)}}if(Le)for(var xe=0,ze=Le.accessibleNodes;xe<ze.length;xe++){var Pe=ze[xe],Q=Le.work.observers[Pe];if(Q){var qe=panoStringify({panoIndex:Q.panoIndex,workCode:Q.work.workCode});oe.set(qe,Q)}}if(this.panoMeshes.forEach(function(le,Se){var Ce=oe.get(Se);if(Ce){le.position.copy(Ce.standingPosition).applyMatrix4(Ce.work.transform);var Be=o.adjustPanoCircleMeshPositionFix.get(Se);Be&&(scratchVector3.set(Be.x,Be.y,Be.z),scratchVector3.equals(le.position)&&(le.position.y+=Be.w)),le.scale.setScalar(1.2),oe.delete(Se)}else o.helper.remove(le),le.dispose(),o.panoMeshes.delete(Se)}),oe.forEach(function(le,Se){var Ce=o.panoCircleMeshCreator(panoParse(Se));Ce.position.copy(le.standingPosition).applyMatrix4(le.work.transform);var Be=o.adjustPanoCircleMeshPositionFix.get(Se);Be&&(scratchVector3.set(Be.x,Be.y,Be.z),scratchVector3.equals(Ce.position)&&(Ce.position.y+=Be.w)),Ce.scale.setScalar(1.2),o.panoMeshes.set(Se,Ce),o.helper.add(Ce),oe.delete(Se)}),this.camera.pose.distance>.1||C)this.panoMeshes.forEach(function(le){le.setOpacity(0),le.setCurrent(!1),le.updateTime&&le.updateTime(e,r),le.visible=!1});else if(Fe){var at=Fe.work.observers,yt=arrayMin(Fe.accessibleNodes,function(le){var Se=at[le];return Se?Fe.standingPosition.distanceTo(Se.standingPosition):1/0},!0),ht=yt[1];ht=clamp$1(ht,2.5,1/0);var Ct=Fe.visibleNodes.concat(Fe.panoIndex).map(function(le){return panoStringify({panoIndex:le,workCode:Fe.work.workCode})}),Mt=this.camera.getDirection(new THREE__namespace.Vector3);this.panoMeshes.forEach(function(le,Se){var Ce=o.works.getObserver(Se);if(Ct.indexOf(Se)===-1)le.setCurrent(!1),le.setOpacity(0);else if(!Ce)le.setCurrent(!1),le.setOpacity(0);else if(!Ce.loadable&&!Ce.active)le.setCurrent(!1),le.setOpacity(0);else{var Be=le.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);le.setCurrent(!le.loading&&le.progress===0&&tt!==null&&panoStringify({panoIndex:tt.panoIndex,workCode:tt.work.workCode})===Se),le.setOpacity(Be<.01?0:clamp$1(ht/Be*1.2,.65,.98));var _t=o.camera.position.clone().setY(le.position.y),Xe=new THREE__namespace.Vector3().copy(le.position).sub(_t).normalize();if(Se===panoStringify(o.currentPano)){var st=clamp$1((.5-_t.distanceTo(le.position))/.5,0,1);Xe.multiplyScalar(1-st).add(Mt.clone().multiplyScalar(st))}Xe.length()>0&&le.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(Xe.x,Xe.z),0))}le.updateTime&&le.updateTime(e,r)})}{var N=(p=this.modelScene.parameter.progress)!==null&&p!==void 0?p:1,It=Math.round(N),it=this.modelScene.parameter.pano0,pt=this.modelScene.parameter.pano1,Et=It===0?it:pt,Q=void 0;if(Et&&(Q=this.works.getObserver(Et.panoId),Q||(Q=this.panoPictureObserverMap.get(Et))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=N<=.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!Q||!Et||this.tileLevelForFov===!1){this.tiling.setObserver(null);var Rt={renderer:this.renderer,resolution:se,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(Rt),this.modelScene.parameter.set("refinedScreen",null)}else{var ot=getImageSizeLevel(Et.mapSize),wt=ot+1,bt=4;this.tiling.setObserver(Q);var Rt={renderer:this.renderer,resolution:se,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:Et.map,panoMatrix:Et.matrix,panoZoom:Et.zoom,minLevel:wt,level:bt},vt=this.tiling.update(Rt),St={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:It,opacity:(it==null?void 0:it.panoId)===(pt==null?void 0:pt.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},Ke=this.modelScene.parameter.refinedScreen;(vt||St.pano!==(Ke==null?void 0:Ke.pano)||St.opacity!==(Ke==null?void 0:Ke.opacity))&&this.modelScene.parameter.set("refinedScreen",St)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var mt=w.effect,Ft=this.modelScene.parameter,it=Ft.pano0,pt=Ft.pano1;if(it&&pt&&it!==pt&&mt==="fly"&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==it.panoId||((g=this.modelScene.parameter.pano1Depth)===null||g===void 0?void 0:g.panoId)!==pt.panoId){var Pt=500,lt=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==lt&&this.pano0DepthCubeRenderTarget.setSize(lt,lt):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(lt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==lt&&this.pano1DepthCubeRenderTarget.setSize(lt,lt):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(lt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var We=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);We.matrix.copy(it.matrix),We.matrixWorld.copy(We.matrix),We.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,We,Pt);var Tt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);Tt.matrix.copy(pt.matrix),Tt.matrixWorld.copy(Tt.matrix),Tt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Tt,Pt),this.modelScene.parameter.set({pano0Depth:{panoId:it.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:Pt},pano1Depth:{panoId:pt.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:Pt}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}},t.prototype.render=function(){this.renderer.setScissorTest(!1);var e=this.xrManager.cameraVR;this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var l={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var 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],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(){var n=new THREE__namespace.Group;n.name="internalLights";{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction0",t.position.copy(new THREE__namespace.Vector3(0,1,0)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction1",t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.name="direction2",t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);t.name="ambient0",n.add(t)}return n}function parseKeyValue(n){for(var t,e,r={},o=n.split(/(\;|\,)/),s=0,u=o;s<u.length;s++){var l=u[s],c=l.split("="),f=(t=c[0])===null||t===void 0?void 0:t.trim(),p=(e=c[1])===null||e===void 0?void 0:e.trim();f&&p&&(r[f]=p)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1}const textureURL="data:image/png;base64,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";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry$4=new THREE__namespace.BufferGeometry;geometry$4.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3));geometry$4.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2));geometry$4.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh$4=new THREE__namespace.Mesh(geometry$4,material);mesh$4.matrixAutoUpdate=!1;var scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4);scene$2.matrixAutoUpdate=!1;var camera$2=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera$2.position.set(0,0,.5);camera$2.lookAt(0,0,0);camera$2.updateMatrixWorld(!0);camera$2.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),o=n.getScissor(prevScissor),s=n.getScissorTest(),u=n.autoClear,l=o.x+imageOffset[0]/3,c=o.y+imageOffset[1]/3,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$2,camera$2),n.setViewport(r),n.setScissor(o),n.setScissorTest(s),n.autoClear=u}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop},e.src=textureURL,material.map=t}}var FRAGMENT$2=`
|
|
2133
|
+
`},LineMaterial=(function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(o){this.uniforms.diffuse.value=o}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(o){this.uniforms.linewidth.value=o}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(o){this.uniforms.dashScale.value=o}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(o){this.uniforms.dashSize.value=o}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(o){this.uniforms.gapSize.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}}}),r.setValues(e),r}return t})(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this)||this;return o.type="LineSegments2",o.geometry=e!==void 0?e:new LineSegmentsGeometry,o.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),o}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,o=e.attributes.instanceEnd,s=new Float32Array(2*r.count),u=new THREE__namespace.Vector3,l=new THREE__namespace.Vector3,c=0,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,A=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,E=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,y=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,m),m.w=1,m.applyMatrix4(s.matrixWorldInverse),m.applyMatrix4(u),m.multiplyScalar(1/m.w),m.x*=f.x/2,m.y*=f.y/2,m.z=0,E.copy(m);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){g.fromBufferAttribute(d,_),A.fromBufferAttribute(h,_),g.w=1,A.w=1,g.applyMatrix4(v),A.applyMatrix4(v),g.applyMatrix4(u),A.applyMatrix4(u),g.multiplyScalar(1/g.w),A.multiplyScalar(1/A.w);var R=g.z<-1&&A.z<-1,w=g.z>1&&A.z>1;if(!(R||w)){g.x*=f.x/2,g.y*=f.y/2,A.x*=f.x/2,A.y*=f.y/2,y.start.copy(g),y.start.z=0,y.end.copy(A),y.end.z=0;var M=y.closestPointToPointParameter(E,!0);y.at(M,b);var O=THREE__namespace.MathUtils.lerp(g.z,A.z,M),C=O>=-1&&O<=1,P=E.distanceTo(b)<p*.5;if(C&&P){y.start.fromBufferAttribute(d,_),y.end.fromBufferAttribute(h,_),y.start.applyMatrix4(T),y.end.applyMatrix4(T);var F=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;o.distanceSqToSegment(y.start,y.end,L,F),r.push({point:L,pointOnLine:F,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.6.0-alpha.9"},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 A=u[g];return A&&(l={profileId:g,profilePath:"".concat(r,"/").concat(A.path),deprecated:!!A.deprecated}),!!l}),!l){if(!o)throw new Error("No matching profile name found");if(c=u[o],!c)throw new Error('No matching profile name found and default profile "'.concat(o,'" missing.'));l={profileId:o,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(l.profilePath)];case 2:if(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",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=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var f=panoStringify(e),p=this.works.getObserver(e);if(!p)throw new Error("Invalid PanoIndex");getImageSizeFromURL(p.images.up),this.imageOptions.size;var d=this.imageOptions.transform,h=function(R,w){return mapPanoResource(applyImageURLOptions(R,d,w))},g=__assign({key:"pano.".concat(f)},pick(this.imageOptions,["format","size","quality"])),A={right:p.images.work.getURL(p.images.right),left:p.images.work.getURL(p.images.left),up:p.images.work.getURL(p.images.up),down:p.images.work.getURL(p.images.down),front:p.images.work.getURL(p.images.front),back:p.images.work.getURL(p.images.back)},m="pano:"+jsonHash([A,g,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===m)return;var E=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(E))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:e}))}var v=this.modelScene.parameter.resolveValue(),y=v.pano0,b=v.pano1,T;if((y==null?void 0:y.map.name)===m?T=y:(b==null?void 0:b.map.name)===m&&(T=b),T){var _={panoId:f,effect:c,leftPanoPicture:{panoId:T.panoId,map:T.map,mapSize:T.mapSize,matrix:p.matrix.clone().premultiply(p.work.transform),zoom:1},position:p.position.clone().applyMatrix4(p.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,_,r);return}var S="move-to-pano-"+f;this.pending.add(S),this.pendingTextureTask={panoId:f,hash:m,onLoad:function(R){var w;s.pending.delete(S);var M=R.body;if(s.destroyed)M.dispose();else{M.name=m;var O=Array.isArray(M.image)?M.image[0]:M.image,C=(w=O==null?void 0:O.width)!==null&&w!==void 0?w:2048,P={panoId:f,effect:c,leftPanoPicture:{panoId:f,map:M,mapSize:C,matrix:p.matrix.clone(),zoom:1},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,P,r)}},onError:function(R){s.pending.delete(S);var w=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:R,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),r.moveCancelCallback&&r.moveCancelCallback()}},this.textureLoader.loadCubeTexture(A,{imageURL:{transform:h,options:g},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(p.work)},void 0,void 0,function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===m&&((M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(R)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:R,meta:null,pano:e}))},this.renderer).then(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===m?(s.pendingTextureTask.onLoad(R),(M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:R.meta,pano:e}))):R.body.dispose()}).catch(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===m&&(s.pendingTextureTask.onError(R),(M=s.panoMeshes.get(f))===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:R,progress:0,meta:null,pano:e})),s.emit("error",R))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,A,m;o===void 0&&(o={});var E=now(),v=createUuid();this.panoResources[v]=r;var y=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(E);S[0];var R=S[1],w=this.locationMotion.value,M=this.panoResourceFromLocationMotionKeyframe(R).position,O=r.position;b=Math.max(M.distanceTo(O),y),T=[{key:R.key,progress:0,value:__assign(__assign({},w),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(E),P=C[0],R=C[1],w=this.locationMotion.value,F=this.panoResourceFromLocationMotionKeyframe(P).position,M=this.panoResourceFromLocationMotionKeyframe(R).position,O=r.position,L=R.value.count-w.count,H=Math.max(F.distanceTo(M),y)*L,N=Math.max(M.distanceTo(O),y);b=H+N,T=[{key:P.key,progress:0,value:__assign({},w)},{key:R.key,progress:H/b,value:R.value},{key:v,progress:1,value:{count:R.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),Q=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(E)*D/Q}var J=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?b:0),U={longitude:o.longitude,latitude:o.latitude,fov:o.fov},z=__assign(__assign({},e),{mode:this.mode,longitude:(u=U.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=U.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=U.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:q,progress:0,state:z,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(z),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(U,J).catch(noop);else{var j=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),G=coordinatesToVector({longitude:(f=U.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(p=U.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude}),X=new THREE__namespace.Object3D;X.lookAt(j);var Y=new THREE__namespace.Matrix4().makeRotationFromQuaternion(X.quaternion);X.lookAt(G);var Z=new THREE__namespace.Matrix4().makeRotationFromQuaternion(X.quaternion),W=new THREE__namespace.Matrix4().getInverse(Y).premultiply(Z),K=this.cameraMotion.value.fov,ne=(d=U.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,ee=1;r.effect==="zoomin"?ee=1.5:r.effect==="zoomout"&&(ee=.4);for(var te=ne*ee,ae=0;ae<T.length-1;ae++){var fe=T[ae].key;if(fe){var se=this.panoResources[fe];se&&(se.fixCameraTransform.copy(W),se.leftPanoPicture&&(se.leftPanoPicture.zoom=Math.tan(te/2/180*Math.PI)/Math.tan(K/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(h=U.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(g=U.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:te}},{progress:1,value:{longitude:(A=U.longitude)!==null&&A!==void 0?A:this.cameraMotion.value.longitude,latitude:(m=U.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:ne}}],J).catch(noop)}var he=this.locationMotion.setKeyframes(T,J,_);he.then(function(){for(var me=0,be=s.modelScene.children;me<be.length;me++){var Te=be[me];Te instanceof Model&&Te.show()}var ce=__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:q,progress:1,state:ce,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ce);var pe=s.works.getObserver(s.currentPano);if(pe&&pe.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var re={map:s.videoTexture,size:pe.video.size.clone(),matrix:pe.video.matrix.clone(),panoMatrix:pe.matrix.clone().premultiply(pe.work.transform),alpha:1},ue=createUuid(),ve=s.videoTexture.image;ve.setAttribute("uuid",ue),canplayVideo().then(function(ge){ge&&pe.video&&ve.getAttribute("uuid")===ue&&(ve.oncanplay=function(){ve.oncanplay=noop,ve.play()},ve.ontimeupdate=function(){ve.currentTime>.5&&(ve.ontimeupdate=noop,s.panoVideo.setMaterial(re))},ve.src=pe.video.source)}).catch((function(){ve.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:q,progress:0,state:z,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o;this.stopMomentumMovement(),this.camera.getDirection(new THREE__namespace.Vector3).setY(0);var s=null,u=this.works.getObserver(this.currentPano);if(!u)return null;var l=u.work.observers,c=u.accessibleNodes.filter(function(_){if(_===r.currentPano.panoIndex&&u.work.workCode===r.currentPano.workCode)return!1;var S=l[_];if(!S)return!1;var R=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return R.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),f=this.modelScene.intersectRaycaster(e)[0];if(f){var p=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var R=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return R.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 A=0,m=this.locationMotion.keyframes;A<m.length;A++){var E=m[A],v=this.panoResourceFromLocationMotionKeyframe(E);if(!(E.progress<this.locationMotion.progress)&&s){var y=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===y){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var y=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(y);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,A=[],m=2;m<arguments.length;m++)A[m-2]=arguments[m];this.userAction=!0;var E={},v={},y=this.locationMotion.keyframes[0],b=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],T=this.locationMotion.getKeyFrameSegment(e),_=T[0],S=T[1],R=this.panoResourceFromLocationMotionKeyframe(_),w=this.panoResourceFromLocationMotionKeyframe(S),M=this.panoResourceFromLocationMotionKeyframe(y),O=this.panoResourceFromLocationMotionKeyframe(b),C=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),v.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),E.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 P=this.locationMotion.getKeyFrameSegment(e);P[0];var F=P[1],L=new THREE__namespace.Vector3().copy(R.position),H=new THREE__namespace.Vector3().copy(w.position),N=this.locationMotion.value.count-F.value.count+1;if(E.progress=N,w.leftPanoPicture&&(N<1?R.leftPanoPicture&&(E.pano0=R.leftPanoPicture):E.pano0=w.leftPanoPicture,E.pano1=w.leftPanoPicture),w.effect==="montage"?E.transition="BLACK":w.effect==="spread"?E.transition="SPREAD":E.transition="FADE",(w.effect==="zoomin"||w.effect==="zoomout")&&(E.progress=Math.pow(N,3)),N<1&&w.effect!=="fly"){if(E.pano0&&R.leftPanoPicture){var D={panoId:E.pano0.panoId,map:E.pano0.map,mapSize:E.pano0.mapSize,zoom:E.pano0.zoom,matrix:R.leftPanoPicture.matrix.clone().setPosition(w.position)},Q=this.panoPictureObserverMap.get(E.pano0);Q&&this.panoPictureObserverMap.set(D,Q),E.pano0=D}L.copy(H),C=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(L.x+(H.x-L.x)*N,L.y+(H.y-L.y)*N,L.z+(H.z-L.z)*N);for(var J=[],U=[],z=0,q=this.locationMotion.keyframes;z<q.length;z++){var j=q[z],G=j.key,X=j.progress;G!==void 0&&(J.push(G),X>this.locationMotion.progress&&U.push(G))}for(var Y=0,Z=Object.keys(this.panoResources);Y<Z.length;Y++){var W=Z[Y];if(!(U.indexOf(W)>=0)){var K=this.panoResources[W];if(K.leftPanoPicture){var ne=K.leftPanoPicture.map;if(ne){if(ne===((s=E.pano0)===null||s===void 0?void 0:s.map)||ne===((u=E.pano1)===null||u===void 0?void 0:u.map))continue;ne.dispose(),K.leftPanoPicture=null}}J.indexOf(W)>=0||delete this.panoResources[W]}}var ee=panoParse(w.panoId);ee!==this.currentPano&&(this.currentPano=ee,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(M.panoId),state:__assign(__assign(__assign(__assign({},panoParse(O.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 te=A,ae=te[1],fe=new THREE__namespace.Vector3(0,0,0),se=new THREE__namespace.Vector2().copy(this.camera.resolution);if(ae&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){var he=this.xrManager.cameraVR,me=this.xrManager.referenceSpace,be=this.xrManager.session.renderState.baseLayer,Te=ae.getViewerPose(me),ce=(l=Te==null?void 0:Te.views)!==null&&l!==void 0?l:[];this.renderer.setFramebuffer(be.framebuffer);for(var pe=0;pe<ce.length;pe++){var re=ce[pe],ue=he.cameras[pe],ve=be.getViewport(re);ve&&(ue.projectionMatrix.fromArray(re.projectionMatrix),ue.projectionMatrixInverse.getInverse(ue.projectionMatrix),ue.matrix.fromArray(re.transform.matrix),ue.matrix.setPosition(this.camera.position),ue.matrix.decompose(ue.position,ue.quaternion,ue.scale),ue.matrixWorld.copy(ue.matrix),ue.matrixWorldInverse.getInverse(ue.matrixWorld),ue.matrixAutoUpdate=!1,fe.copy(ue.position),ue.viewport.set(ve.x,ve.y,ve.width,ve.height),se.set(ve.width,ve.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((c=v.distance)!==null&&c!==void 0?c:this.camera.pose.distance),this.xrManager.session&&this.xrManager.session.inputSources){for(var pe=0;pe<this.xrManager.session.inputSources.length;pe++)if(this.xrManager.session.inputSources[pe]&&this.xrManager.session.inputSources[pe].targetRayMode==="transient-pointer"){var ge=ae.getPose(this.xrManager.session.inputSources[pe].targetRaySpace,me);if(ge){var Le=ge.transform.orientation,qe=new THREE__namespace.Quaternion(Le.x,Le.y,Le.z,Le.w),$e=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(qe),Ve=new THREE__namespace.Raycaster(this.camera.position,$e);this.gazeRay=Ve}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var de=this.xrManager.session.inputSources,Ye=function(le){var Se=Ee.xrManager.controllers[le],Ce=de[le];if(!Ce)return"continue";Se&&Se.update(Ce,ae,me);var Be=Ee.xrManager.getController(le),_t=new THREE__namespace.Vector3(0,1.2,0),Xe=Be.position.clone().add(fe).sub(_t);Ce.handedness==="left"?Ee.xrControllerRay.left.set(Xe,new THREE__namespace.Vector3(0,0,-1).applyEuler(Be.rotation)):Ce.handedness==="right"&&Ee.xrControllerRay.right.set(Xe,new THREE__namespace.Vector3(0,0,-1).applyEuler(Be.rotation)),Ee.controllerWrappers[le].position.copy(new THREE__namespace.Vector3(0,0,0).add(fe).sub(_t));var st=Ee.modelScene.intersectRaycaster(Ee.xrControllerRay.right);if(st.length===0){var Bt=Ee.works.getResolvedObserver(Ee.currentPano);st=Ee.xrControllerRay.right.intersectObject(Ee.boundingMesh,!0).map(function(ie){var ye,ke=(ye=Bt==null?void 0:Bt.floorIndex)!==null&&ye!==void 0?ye:0;return __assign({floorIndex:ke,floor:ke},ie)})}if(st.length>=1&&st[0].face)if(Ce.handedness==="right"){var Ht=Ee.xrControllerRay.right.intersectObject(Ee.xrCustomObjectsScene,!0),Ot=st[0].face.normal,Lt=Ot.clone(),I=st[0].point.clone();Ee.intersectMesh.position.copy(I);var B=I.clone().add(Lt);if(Ee.intersectMesh.lookAt(B),Math.abs(Ot.y)>.99){var k=Ee.camera.position.clone().sub(I);Ee.intersectMesh.rotation.z=-Math.atan2(k.z,k.x)}Ee.intersectMesh.visible=!0,Ee.needsRender=!0,Ht.length>0?(Ee.pointerLines.right.setPoints(Xe,Ht[0].point),Ee.pointerLines.right.points.visible=!0,Ee.intersectMesh.visible=!1):(Ee.pointerLines.right.points.visible=!1,Ee.pointerLines.right.setPoints(Xe,st[0].point));var V=st[0],$=createEvent("intersect.update",{raycaster:(f=Ee.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:V!=null?V:null,object:Ee.intersectMesh});if(Ee.emit("intersect.update",$),$.defaultPrevented)return Ee.hideIntersectMesh(),{value:void 0}}else Ee.pointerLines.left.setPoints(Xe,st[0].point)},Ee=this,pe=0;pe<de.length;pe++){var Oe=Ye(pe);if(typeof Oe=="object")return Oe.value}this.updateControllerHelper(de,e,r)}}else ae||console.error("xrFrame丢失,请重试"),this.xrManager.session||console.error("session丢失,请重试"),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error("no layer found");isEmptyObject(E)===!1&&this.modelScene.parameter.set(E),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));var Fe=this.works.getResolvedObserver(this.currentPano),tt=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,rt=this.works.getObserver(R.panoId),Ne=this.works.getObserver(w.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Fe){for(var Ie=[],He=Fe.work.observers,Ae=0,we=Fe.accessibleNodes;Ae<we.length;Ae++){var Pe=we[Ae],Q=He[Pe];Q&&Ie.push(Q)}var je=new Map;if(Ie.sort(function(le,Se){var Ce=je.get(le);typeof Ce=="undefined"&&(Ce=le.standingPosition.distanceTo(Fe.standingPosition),je.set(le,Ce));var Be=je.get(le);return typeof Be=="undefined"&&(Be=Se.standingPosition.distanceTo(Fe.standingPosition),je.set(Se,Be)),Ce-Be}),Ie.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Ie.length;var Qe=Ie[this.accessibleObserverFloorCheckCount],Ze=this.modelScene.models.find(function(le){return le.work===(Qe==null?void 0:Qe.work)});if(Qe&&Ze&&Ze.visible){var gt=.3,Je=.05,At=.005,Re=Qe.standingPosition.clone().applyMatrix4(Qe.work.transform),Ue=panoStringify({panoIndex:Qe.panoIndex,workCode:Qe.work.workCode}),ft=adjustPanoCircleMeshVectors.map(function(le){scratchRaycaster.ray.origin.copy(Re),scratchRaycaster.ray.origin.add(scratchVector3.copy(le).setY(gt)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var Se=Ze.intersectRaycaster(scratchRaycaster)[0];return Se&&Se.distance-At<=gt?new THREE__namespace.Vector3().copy(Re).setY(Se.point.y+At):Re});ft.sort(function(le,Se){return Se.y-le.y});var dt=ft[Math.floor(ft.length/2)],Ge=ft.filter(function(le){return le.distanceTo(dt)<=Je})[0];if(Ge){var nt=new THREE__namespace.Vector4(Re.x,Re.y,Re.z,Ge.y-Re.y),ct=this.adjustPanoCircleMeshPositionFix.get(Ue);ct&&!nt.equals(ct)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Ue,nt)}}this.accessibleObserverFloorCheckCount++}}var oe=new Map;if(rt)for(var _e=0,Me=rt.accessibleNodes;_e<Me.length;_e++){var Pe=Me[_e],Q=rt.work.observers[Pe];if(Q){var Ue=panoStringify({panoIndex:Q.panoIndex,workCode:Q.work.workCode});oe.set(Ue,Q)}}if(Ne)for(var xe=0,ze=Ne.accessibleNodes;xe<ze.length;xe++){var Pe=ze[xe],Q=Ne.work.observers[Pe];if(Q){var Ue=panoStringify({panoIndex:Q.panoIndex,workCode:Q.work.workCode});oe.set(Ue,Q)}}if(this.panoMeshes.forEach(function(le,Se){var Ce=oe.get(Se);if(Ce){le.position.copy(Ce.standingPosition).applyMatrix4(Ce.work.transform);var Be=o.adjustPanoCircleMeshPositionFix.get(Se);Be&&(scratchVector3.set(Be.x,Be.y,Be.z),scratchVector3.equals(le.position)&&(le.position.y+=Be.w)),le.scale.setScalar(1.2),oe.delete(Se)}else o.helper.remove(le),le.dispose(),o.panoMeshes.delete(Se)}),oe.forEach(function(le,Se){var Ce=o.panoCircleMeshCreator(panoParse(Se));Ce.position.copy(le.standingPosition).applyMatrix4(le.work.transform);var Be=o.adjustPanoCircleMeshPositionFix.get(Se);Be&&(scratchVector3.set(Be.x,Be.y,Be.z),scratchVector3.equals(Ce.position)&&(Ce.position.y+=Be.w)),Ce.scale.setScalar(1.2),o.panoMeshes.set(Se,Ce),o.helper.add(Ce),oe.delete(Se)}),this.camera.pose.distance>.1||C)this.panoMeshes.forEach(function(le){le.setOpacity(0),le.setCurrent(!1),le.updateTime&&le.updateTime(e,r),le.visible=!1});else if(Fe){var at=Fe.work.observers,yt=arrayMin(Fe.accessibleNodes,function(le){var Se=at[le];return Se?Fe.standingPosition.distanceTo(Se.standingPosition):1/0},!0),ht=yt[1];ht=clamp$1(ht,2.5,1/0);var Ct=Fe.visibleNodes.concat(Fe.panoIndex).map(function(le){return panoStringify({panoIndex:le,workCode:Fe.work.workCode})}),Mt=this.camera.getDirection(new THREE__namespace.Vector3);this.panoMeshes.forEach(function(le,Se){var Ce=o.works.getObserver(Se);if(Ct.indexOf(Se)===-1)le.setCurrent(!1),le.setOpacity(0);else if(!Ce)le.setCurrent(!1),le.setOpacity(0);else if(!Ce.loadable&&!Ce.active)le.setCurrent(!1),le.setOpacity(0);else{var Be=le.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);le.setCurrent(!le.loading&&le.progress===0&&tt!==null&&panoStringify({panoIndex:tt.panoIndex,workCode:tt.work.workCode})===Se),le.setOpacity(Be<.01?0:clamp$1(ht/Be*1.2,.65,.98));var _t=o.camera.position.clone().setY(le.position.y),Xe=new THREE__namespace.Vector3().copy(le.position).sub(_t).normalize();if(Se===panoStringify(o.currentPano)){var st=clamp$1((.5-_t.distanceTo(le.position))/.5,0,1);Xe.multiplyScalar(1-st).add(Mt.clone().multiplyScalar(st))}Xe.length()>0&&le.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(Xe.x,Xe.z),0))}le.updateTime&&le.updateTime(e,r)})}{var N=(p=this.modelScene.parameter.progress)!==null&&p!==void 0?p:1,It=Math.round(N),it=this.modelScene.parameter.pano0,pt=this.modelScene.parameter.pano1,Et=It===0?it:pt,Q=void 0;if(Et&&(Q=this.works.getObserver(Et.panoId),Q||(Q=this.panoPictureObserverMap.get(Et))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=N<=.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!Q||!Et||this.tileLevelForFov===!1){this.tiling.setObserver(null);var Rt={renderer:this.renderer,resolution:se,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(Rt),this.modelScene.parameter.set("refinedScreen",null)}else{var ot=getImageSizeLevel(Et.mapSize),wt=ot+1,bt=4;this.tiling.setObserver(Q);var Rt={renderer:this.renderer,resolution:se,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:Et.map,panoMatrix:Et.matrix,panoZoom:Et.zoom,minLevel:wt,level:bt},vt=this.tiling.update(Rt),St={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:It,opacity:(it==null?void 0:it.panoId)===(pt==null?void 0:pt.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},Ke=this.modelScene.parameter.refinedScreen;(vt||St.pano!==(Ke==null?void 0:Ke.pano)||St.opacity!==(Ke==null?void 0:Ke.opacity))&&this.modelScene.parameter.set("refinedScreen",St)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var mt=w.effect,Ft=this.modelScene.parameter,it=Ft.pano0,pt=Ft.pano1;if(it&&pt&&it!==pt&&mt==="fly"&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==it.panoId||((g=this.modelScene.parameter.pano1Depth)===null||g===void 0?void 0:g.panoId)!==pt.panoId){var Pt=500,lt=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==lt&&this.pano0DepthCubeRenderTarget.setSize(lt,lt):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(lt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==lt&&this.pano1DepthCubeRenderTarget.setSize(lt,lt):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(lt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var We=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);We.matrix.copy(it.matrix),We.matrixWorld.copy(We.matrix),We.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,We,Pt);var Tt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);Tt.matrix.copy(pt.matrix),Tt.matrixWorld.copy(Tt.matrix),Tt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Tt,Pt),this.modelScene.parameter.set({pano0Depth:{panoId:it.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:Pt},pano1Depth:{panoId:pt.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:Pt}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}},t.prototype.render=function(){this.renderer.setScissorTest(!1);var e=this.xrManager.cameraVR;this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var l={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var 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],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(){var n=new THREE__namespace.Group;n.name="internalLights";{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction0",t.position.copy(new THREE__namespace.Vector3(0,1,0)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction1",t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.name="direction2",t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);t.name="ambient0",n.add(t)}return n}function parseKeyValue(n){for(var t,e,r={},o=n.split(/(\;|\,)/),s=0,u=o;s<u.length;s++){var l=u[s],c=l.split("="),f=(t=c[0])===null||t===void 0?void 0:t.trim(),p=(e=c[1])===null||e===void 0?void 0:e.trim();f&&p&&(r[f]=p)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1}const textureURL="data:image/png;base64,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";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry$4=new THREE__namespace.BufferGeometry;geometry$4.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3));geometry$4.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2));geometry$4.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh$4=new THREE__namespace.Mesh(geometry$4,material);mesh$4.matrixAutoUpdate=!1;var scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4);scene$2.matrixAutoUpdate=!1;var camera$2=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera$2.position.set(0,0,.5);camera$2.lookAt(0,0,0);camera$2.updateMatrixWorld(!0);camera$2.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),o=n.getScissor(prevScissor),s=n.getScissorTest(),u=n.autoClear,l=o.x+imageOffset[0]/3,c=o.y+imageOffset[1]/3,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$2,camera$2),n.setViewport(r),n.setScissor(o),n.setScissorTest(s),n.autoClear=u}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop},e.src=textureURL,material.map=t}}var FRAGMENT$2=`
|
|
2134
2134
|
precision mediump float;
|
|
2135
2135
|
precision mediump int;
|
|
2136
2136
|
uniform sampler2D depthBuffer;
|
|
@@ -2246,4 +2246,4 @@ void main() {
|
|
|
2246
2246
|
rgb = clamp(lumCompressed * rgb, 0.0, 1.0);
|
|
2247
2247
|
gl_FragColor = mix(inputColor, vec4(rgb, alpha), progress * 0.9);
|
|
2248
2248
|
}
|
|
2249
|
-
`})||this;return r.material.transparent=!0,r}return Object.defineProperty(t.prototype,"luminanceAdaptiveBuffer",{get:function(){return this.material.uniforms.luminanceAdaptiveBuffer.value},set:function(e){this.material.uniforms.luminanceAdaptiveBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),t})(Pass),LuminanceAdaptiveEffect=(function(n){__extends(t,n);function t(e,r,o,s){var u=n.call(this,e,r,o,s)||this;return u.enableTime=now(),u.renderer=e,u.valuePass=new ValuePass(u.renderer),u.luminancePass=new LuminancePass(u.renderer,Math.sqrt(1/3)),u.nextStepPass=new NextStepPass(u.renderer,.01),u.luminanceAdaptivePass=new LuminanceAdaptivePass(u.renderer),u}return t.prototype.render=function(e){this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera),this.enableTime===null&&(this.enableTime=now()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new THREE__namespace.WebGLRenderTarget(128,128,{minFilter:THREE__namespace.LinearMipmapLinearFilter,magFilter:THREE__namespace.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:THREE__namespace.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(e[0],this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminanceNextBuffer),this.luminanceAdaptivePass.luminanceAdaptiveBuffer=this.luminanceNextBuffer.texture),this.copyPass.render(this.luminanceNextBuffer,this.luminancePrevBuffer),this.nextStepPass.render(this.luminancePrevBuffer,this.luminanceNextBuffer),this.luminanceAdaptivePass.progress=Math.min((now()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(e[0],e[1])},t.prototype.dispose=function(){var e,r,o;(e=this.luminanceTargetBuffer)===null||e===void 0||e.dispose(),(r=this.luminancePrevBuffer)===null||r===void 0||r.dispose(),(o=this.luminanceNextBuffer)===null||o===void 0||o.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},t})(Effect),sharedV2=new THREE__namespace.Vector2,LuminanceRenderer=(function(n){__extends(t,n);function t(e){var r,o,s=n.call(this,e)||this;s.type="default",s.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(s.renderer,s.modelScene,s.camera,s.modelScene);var u=s.renderer.getDrawingBufferSize(sharedV2);return s.screenBuffers=[new THREE__namespace.WebGLRenderTarget(u.x,u.y,{generateMipmaps:!1,encoding:(o=(r=s.renderer)===null||r===void 0?void 0:r.outputEncoding)!==null&&o!==void 0?o:THREE__namespace.sRGBEncoding}),s.enableFragDepth?s.modelRenderTarget:null],s}return t.prototype.render=function(e){var r=this.renderer.getRenderTarget();this.enableFragDepth?(e&&(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers)),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,r),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,r),this.renderer.setRenderTarget(r),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0):(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0),this.modelScene.needsRender=!0},t})(BaseRenderer),DEFAULT_MODE_CHANGE_DURATION=800,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,scratchViewport=new THREE__namespace.Vector4,scratchScissor=new THREE__namespace.Vector4,scratchClearColor=new THREE__namespace.Color,scratchRenderSize=new THREE__namespace.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,p,d,h,g,A,m=n.call(this)||this;if(m.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[m.ident]=m),m.renderSwitch01=0,m.currentUpdateArgs={time:now(),args:[]},m.currentMode="Panorama",m.pano={workCode:"",panoIndex:0},m.needsRender=!1,m.modelSceneNeedsRender=!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(F){F instanceof Error&&m.throwError(F)}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(F,L,H,N){var D;m.emit("network.resource",createEvent("network.resource",{source:F,requestType:L,requestState:H,detail:N})),(D=m.analysis)===null||D===void 0||D.network(m.works,F,L,H,N)}),m.boundingMesh=new BoundingMesh$1,m.boundingMesh.name="bounding",m.readyCallbacks=[],m.syncingState=!1,m.helperGroup=new THREE__namespace.Group,m.helperGroup.name="helper",m.helperGroup.matrixAutoUpdate=!1,m.scene.add(m.helperGroup);var v=new Model(emptyWorks[0]);worksMap.set(m,emptyWorks),m.modelScene=new ModelScene,m.modelScene.add(v),m.modelScene.add(m.boundingMesh),defineProperty(v,"loaded",{get:function(){return!1},set:function(F){}}),m.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var y=initLights();m.scene.add(y);var b=new THREE__namespace.Group;defineProperty(b,"children",{get:function(){return y.children},set:function(F){y.children=F}}),defineProperty(b,"visible",{get:function(){return y.visible},set:function(F){y.visible=F}}),defineProperty(b,"name",{get:function(){return y.name},set:function(F){y.name=F}}),m.modelScene.add(b),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(F,L){for(var H=[],N=2;N<arguments.length;N++)H[N-2]=arguments[N];m.updateTime.apply(m,__spreadArray([F,L],H,!1))},!1,0,10));var T=function(){typeof document!="undefined"&&document.fullscreenElement===null&&m.currentMode==="VRPanorama"&&m.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},_=function(){m.needsRender=!0,m.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",T,!1),m.renderer&&m.renderer.domElement.addEventListener("webglcontextrestored",_,!1),m.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",T,!1),m.renderer&&m.renderer.domElement.removeEventListener("webglcontextrestored",_,!1)},m.plugins={},e.plugins&&e.plugins.length)for(var S=0,R=e.plugins;S<R.length;S++){var w=R[S];if(typeof w=="function")w(m);else if(Array.isArray(w)){var M=w[0],O=w[1],C=w[2];if(typeof M=="function"){var P=M(m,C);typeof O=="string"&&(m.plugins[O]?m.throwError(new Error("plugin name ".concat(O," is exists."))):m.plugins[O]=P)}}}return m.meshReplaceMaterialMap=new Map,m.meshOriginMaterialMap=new Map,initLegacyEvent(m),m.enableLayeringRendering=(A=e.enableLayeringRendering)!==null&&A!==void 0?A:!1,m._buildInRendererType="default",m._builtinRenderer=null,m}return Object.defineProperty(t,"version",{get:function(){return"6.6.0-alpha.8"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e,r;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),(e=this.renderer)===null||e===void 0||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var o=this.getElement();o&&o.parentNode&&o.parentNode.removeChild(o);var s=this.modelScene.parameter;s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((r=s.pano0)===null||r===void 0?void 0:r.map)&&s.pano1.map.dispose(),s.reset("pano0","pano1");for(var u=0,l=this.modelScene.children;u<l.length;u++){var c=l[u];c.dispose&&c.dispose(),this.modelScene.remove(c)}this.meshReplaceMaterialMap.forEach(function(f){f.dispose()}),this.meshOriginMaterialMap.forEach(function(f){f.dispose()}),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setViewport=function(e){Object.assign(this.viewport,e),this.needsRender=!0,this.modelSceneNeedsRender=!0},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),t.prototype.getBuiltinRenderer=function(e){var r=this._builtinRenderer;if((r==null?void 0:r.type)!==this._buildInRendererType)switch(r&&r.dispose(),this._buildInRendererType){case"default":this._builtinRenderer=new DefaultRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"edl":this._builtinRenderer=new EDLRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"hq":this._builtinRenderer=new HQRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"luminance":this._builtinRenderer=new LuminanceRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break}return this._builtinRenderer},Object.defineProperty(t.prototype,"renderEffect",{get:function(){return this._buildInRendererType},set:function(e){this._buildInRendererType=e,this.modelSceneNeedsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1;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")&&(o=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&o&&this.controller&&this.currentMode){var s=this.controller.updateConfiguration(this.controllerInits[this.currentMode]);s||this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var o=this.getElement();if(o){e.appendChild(o),this.refresh(r);var s=window.getComputedStyle(e).position;s!=="relative"&&s!=="absolute"&&s!=="fixed"&&s!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){var o,s;if(e===void 0&&(e={}),!!this.renderer){var u=this.renderer.domElement,l=u.parentNode,c=e.width,f=c===void 0?(o=l==null?void 0:l.offsetWidth)!==null&&o!==void 0?o:512:c,p=e.height,d=p===void 0?(s=l==null?void 0:l.offsetHeight)!==null&&s!==void 0?s:512:p;r=r!=null?r:this.renderer.getPixelRatio();var h=this.renderer.capabilities.maxTextureSize,g=Math.max(f,d)*r;g>h&&(r=r/g*h,r=Math.floor(r*100)/100),this.renderer.setPixelRatio(r),this.renderer.setSize(f,d),this.needsRender=!0,this.modelSceneNeedsRender=!0;var A=now(),m=A-this.currentUpdateArgs.time,E=this.currentUpdateArgs.args;this.updateTime(A,m,E)}},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,A,m,E;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 y=[];if(Array.isArray(e))for(var b=0,T=e;b<T.length;b++){var _=T[b];_ instanceof Work?y.push(_):typeof _!="string"&&"work"in _?y.push(parseWork(_.work,_)):y.push(parseWork(_))}else e instanceof Work?y.push(e):y.push(parseWork(e));for(var S=createWorks(y),R=function(W){var K=w,ne=new Fetcher({get networkSubscribe(){return K.networkSubscribe},requestProxy:function(ee){return Promise.resolve(ee).then(function(te){return K.requestProxy(te)}).then(function(te){return verifyURL(te,W.allowHosts)}).then(function(te){if(te instanceof Error)throw te;return te})}});registerFetcher(W,ne)},w=this,M=0,O=S;M<O.length;M++){var C=O[M];R(C)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var P=S.initial,F=P.work.observers[0],L=F?{workCode:F.work.workCode,panoIndex:F.panoIndex}:{workCode:P.work.workCode,panoIndex:0},H=(l=P.mode)!==null&&l!==void 0?l:F?"Panorama":"Mapview",N={};if(r==="inherit"){H=this.currentMode;var D=(f=(c=S[0])===null||c===void 0?void 0:c.observers)===null||f===void 0?void 0:f[this.panoIndex];D?L={workCode:D.work.workCode,panoIndex:D.panoIndex}:typeof S.initial.panoIndex=="number"?L={workCode:S.initial.work.workCode,panoIndex:S.initial.panoIndex}:(H==="Panorama"||H==="VRPanorama"||H==="XRPanorama")&&(H="Mapview"),N={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:void 0,offset:void 0}}else if(r==="initial")typeof P.panoIndex=="number"&&(L={workCode:P.work.workCode,panoIndex:P.panoIndex}),P.mode&&(H=P.mode),N={longitude:P.longitude,latitude:P.latitude,fov:P.fov,distance:P.distance,offset:(p=P.offset)===null||p===void 0?void 0:p.clone()};else{if(H=(d=r.mode)!==null&&d!==void 0?d:this.currentMode,typeof r.panoIndex=="number"){var D=S.getObserver({workCode:(g=(h=r.workCode)!==null&&h!==void 0?h:P.work.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex});D&&(L={workCode:D.work.workCode,panoIndex:D.panoIndex})}N={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var Q=__assign(__assign(__assign({},L),{mode:H}),N),J=this.getCurrentState(),U=(A=v.duration)!==null&&A!==void 0?A:this.modeChangeDuration;(H==="Floorplan"||H==="Topview"||H==="Mapview")&&this.currentMode===H&&(U=0);var z="fly";(H==="Panorama"||H==="VRPanorama"||H==="XRPanorama")&&this.currentMode===H&&(z=(m=v.effect)!==null&&m!==void 0?m:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:S,state:Q,userAction:s}));var q=function(){u.pano=L;var W=__assign(__assign({initial:{state:Q,currentState:J,duration:U,effect:z,userAction:s}},u.commonParams()),u.controllerInits[H]),K=Controllers[H].initAnimationEndState(W);if(u.controller&&u.currentMode===H)u.controller.updateWork(S,K,{effect:z,duration:U},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(H,W));else{var ne=u.currentMode;if(u.controller)u.controller.destroy();else{var ee=Controllers[H].initAnimationEndState(W);u.camera.setFromPose(ee),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(H,W);var te=createEvent("mode.change",{prevMode:ne,mode:H,state:K,userAction:s});try{u.emit("mode.change",te)}catch(ae){console.error(ae)}}u.updateTime(u.currentUpdateArgs.time,0,u.currentUpdateArgs.args)};worksMap.set(this,S);var j=Promise.resolve();if(H===t.Mode.Floorplan||H===t.Mode.Topview||H===t.Mode.Mapview||H===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(Q),assignPose(this.state,this.camera.pose)),this.controller||(this.currentMode=H);var G=this.loadModels(S,v);j=Promise.all(G.map(function(W){return W.loadedReady})).then(function(){u.needsRender=!0,u.modelSceneNeedsRender=!0,q(),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{q();var X=this.controller,Y=!1;this.modelScene.autoRefine=!1;var Z=function(){u.works===S&&Y===!1&&(u.needsRender=!0,u.modelSceneNeedsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),Y=!0,u.modelScene.autoRefine=!0),X.off("pano.arrived",Z),X.off("pano.cancel",Z)},G=this.loadModels(S,v);j=Promise.all(G.map(function(K){return K.initReady})).then(noop),X.once("pano.arrived",Z),X.once("pano.cancel",Z),setTimeout(Z,((E=v.duration)!==null&&E!==void 0?E:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:s,works:S})),j.then(function(){return u.ready()}).then(function(){var W;u.emit("works.ready",createEvent("works.ready",{input:e,state:u.getCurrentState(),userAction:s,works:S})),(W=u.analysis)===null||W===void 0||W.work(S)})},t.prototype.reset=function(){var e=this,r=this.loadWorkTask.then(function(){return e.reset_()});return this.loadWorkTask=r.catch(function(o){e.throwError(o)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var o;e.controller&&(e.controller.destroy(),e.controller=void 0);var s=e.modelScene.parameter;s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((o=s.pano0)===null||o===void 0?void 0:o.map)&&s.pano1.map.dispose(),s.set({pano0:null,pano1:null,modelAlpha:1}),e.renderer&&e.modelScene.update(e.renderer,e.camera);for(var u=0,l=e.modelScene.children;u<l.length;u++){var c=l[u];c instanceof Model&&(c.dispose(),e.modelScene.remove(c))}e.needsRender=!0,e.modelSceneNeedsRender=!0,worksMap.delete(e);var f=parseWork(null),p=new Model(f);p.work=f,worksMap.set(e,createWorks([f])),e.currentMode="Mapview",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.camera.needsRender=!1,e.needsRender=!1,e.modelSceneNeedsRender=!1,r()})},t.prototype.changeMode=function(e,r,o,s,u){var l=this;return r===void 0&&(r={}),s===void 0&&(s=!0),u===void 0&&(u=!1),new Promise(function(c,f){var p,d,h,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var A=0;l.controller&&(typeof o=="number"?A=o:A=(p=o==null?void 0:o.duration)!==null&&p!==void 0?p:l.modeChangeDuration);var m="fly";l.controller&&typeof o=="object"&&o.effect&&(m=o.effect);var E=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(E)){var v=new Error("PanoId ".concat(panoStringify(E)," 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.loaded||(A=0));var y=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,E)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(E,__assign({duration:A},r),s):l.controller.updateCamera(r,A,s).catch(noop):(panoEqual(l.pano,E)||(l.pano=E),l.controller.updateCamera(r,A,s).catch(noop));else{var S=__assign(__assign({},r),E),R=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:A,effect:m,userAction:s}},l.commonParams()),l.controllerInits[e]),w=Controllers[e].initAnimationEndState(R),M=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:w,userAction:s});if(l.emit("mode.change.request",M),!M.defaultPrevented){y&&y.destroy(),l.controller=l.applyController(e,R);var O=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:w,userAction:s});l.emit("mode.change",O)}}c()};if(e===t.Mode.VRPanorama)l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){S instanceof Error&&(l.exitFullscreen(),l.throwError(S),f(S))});else if(e===t.Mode.XRPanorama){var _=AnimationFrameLoop.shared.getContext();_?_.end():requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),T()}).catch(function(S){S instanceof Error&&(l.throwError(S),f(S))})}else T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var f=this.renderer.getPixelRatio(),p=this.renderer.getRenderTarget(),d=this.renderer.getSize(new THREE__namespace.Vector2),h=0,g=0,A=1,m=1,E,v,y,b,T;typeof e=="number"?(h=e,typeof r=="number"&&(g=r),typeof o=="number"&&(A=o),typeof s=="number"&&(m=s),E=u,v=l,T=c):(h=e.x,g=e.y,A=e.width,m=e.height,E=e.pixelRatio,v=e.flipY,y=e.helperVisible,b=e.skipPanorama,T=e.buffer),h=Math.ceil(h),g=Math.ceil(g),A=Math.ceil(A),m=Math.ceil(m),E=Math.ceil(E!=null?E:f),v=v!=null?v:!1;var _=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=y!=null?y:this.helperVisible,b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&b===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(A*E,m*E),this.renderer.setRenderTarget(R),this.camera.pixelRatio=E,this.camera.resolution.set(A,m),this.camera.setViewOffset(d.width,d.height,h,d.height-g-m,A,m),this.scene.update(this.renderer,this.camera),this.render(),this.helperVisible=_,S===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",S),this.renderer.setRenderTarget(p),this.camera.clearViewOffset(),this.camera.pixelRatio=f,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var w=A*E,M=m*E,O=w*M,C=O*4;if(T){if(T.length!==C)throw new Error("buffer length is not equals pixels ".concat(C))}else T=new Uint8Array(C);if(this.renderer.readRenderTargetPixels(R,0,0,A*E,m*E,T),v)for(var P=O/2,F=0,L=0,H=0,N=0;L<P;L++)for(N=(M-Math.floor(L/w)-1)*w+L%w,H=0;H<4;H++)F=T[L*4+H],T[L*4+H]=T[N*4+H],T[N*4+H]=F;return T},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},t.prototype.render=function(e){var r=this.renderer;if(r){var o=r.getRenderTarget(),s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,f=scratchClearColor.copy(r.getClearColor()),p=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),g=r.getScissorTest(),A=r.getSize(scratchRenderSize),m=r.getPixelRatio(),E=Math.floor(A.x*this.viewport.left),v=Math.floor(A.y*this.viewport.bottom),y=Math.floor(A.x*this.viewport.width),b=Math.floor(A.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(E,v,y,b),r.setScissor(E,v,y,b);var T=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(T);var _=this.scene.background;this.modelScene.background=this.camera.isOrthographicCamera?null:_,this.modelScene.environment=this.scene.environment,this.scene.background=null;var S=this.getBuiltinRenderer(r);S.setSize(A.x,A.y,m),this.controller?this.controller.render(S,this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0):S.render(this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0),this.scene.background=_,this.modelScene.background=null,this.modelScene.environment=null,this.poweredByRealsee&&this.currentMode!=="VRPanorama"&&this.currentMode!=="XRPanorama"&&r.getRenderTarget()!==this.getPixelsRenderTarget&&renderPoweredByRealsee(r),r.setRenderTarget(o),r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(f,p),r.setViewport(d),r.setScissor(h),r.setScissorTest(g),e&&AnimationFrameLoop.shared.add(e,!0)}},t.prototype.updateTime=function(e,r){for(var o,s=this,u=[],l=2;l<arguments.length;l++)u[l-2]=arguments[l];if(this.currentUpdateArgs={time:e,args:u},!this.destroyed){if(this.renderer&&ktx2.detectSupport(this.renderer),this.syncingState=this.syncState(e,r),this.controller&&(o=this.controller).updateTime.apply(o,__spreadArray([e,r],u,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.autoNearFar){var c=this.modelScene.boundingBox.getBoundingSphere(scratchSphere),f=c.radius*2;c.containsPoint(this.camera.position)||(f=this.camera.position.distanceTo(c.center)+c.radius),f=clamp$1(f,800,5e4),this.camera.far!==f&&(this.camera.far=f);var p=f/1e4;p=clamp$1(p,.03,.1),this.camera.near!==p&&(this.camera.near=p)}if(this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var d=this.modelScene.loaded,h=this.modelScene.refined;if(this.modelScene.loaded){for(var g=[],A=0,m=this.modelScene.children;A<m.length;A++){var E=m[A];E instanceof Model&&E.outdated&&g.push(E)}for(var v=0,y=g;v<y.length;v++){var b=y[v];this.modelScene.remove(b),b.dispose()}if(g.length>0)for(var T=0,_=this.modelScene.children;T<_.length;T++){var E=_[T];E instanceof Model&&(E.visible=!0,this.modelSceneNeedsRender=!0)}}this.modelScene.update(this.renderer,this.camera),d===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),AnimationFrameLoop.shared.add(function(){s.emit("models.load",createEvent("models.load",{modelScene:s.modelScene}))},!0,0,10)),h===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}this.renderer&&this.scene.update(this.renderer,this.camera),this.syncingState=!1,this.controller&&(this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.controller.modelSceneNeedsRender===!0&&(this.controller.modelSceneNeedsRender=!1,this.modelSceneNeedsRender=!0)),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0),this.modelSceneNeedsRender===!0&&(this.needsRender=!0);var S=this.camera.resolution.width*this.camera.pixelRatio*this.camera.resolution.height*this.camera.pixelRatio;S>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderSwitch01!==0&&(this.needsRender=!1),this.paused===!0&&(this.needsRender=!1);var R=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",R),R.defaultPrevented&&(this.needsRender=!1),this.renderer&&this.needsRender&&this.render(),this.emit("render",createEvent("render",{needsRender:this.needsRender})),this.needsRender=!1,this.modelSceneNeedsRender=!1,this.hasListener("fps")&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={}),o===void 0&&(o=!0);var s=this,u=s.controller,l=s.renderer;if(!u)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!l)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();var c=this.works.getObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var 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","mappings"])),d=s.images[c],h=o.imageOptions.transform?o.imageOptions.transform(d,p):imageURL(d,p);return getFetcher(s.work).preload(h)})).then(function(){var c=now()-l;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.camera.position,s=e.clone().sub(o),u=new THREE__namespace.Raycaster(o,s.clone().normalize());u.params.Points={threshold:.1};var l=this.modelScene.intersectRaycaster(u)[0];if(l&&l.distance+.01<s.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var 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,A;r===void 0&&(r=!1),o===void 0&&(o=!0),e=Object.assign({},e),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var m;if(typeof e.panoIndex=="number")if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{var E=(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(P){return P.workCode===v}).length>0&&(E=v),m={workCode:E,panoIndex:e.panoIndex}}var y=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,R;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==y){if(y==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var w={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude=="number"&&(w.longitude=e.longitude),typeof e.latitude=="number"&&(w.latitude=e.latitude),typeof e.fov=="number"&&(w.fov=e.fov),typeof e.distance=="number"&&(w.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(w.offset=e.offset);var M=__assign(__assign({initial:{state:w,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[y]),O=Controllers[y].initAnimationEndState(M);b=O.longitude,T=O.latitude,_=O.fov,S=O.offset,R=O.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,R=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(m!=null?m:this.pano).workCode,panoIndex:(m!=null?m:this.pano).panoIndex,mode:y,longitude:b,latitude:T,fov:_,offset:S,distance:R};this.emit("state.set",createEvent("state.set",{userAction:o,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode==="VRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("VRPanorama")):this.controller&&C.mode==="XRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("XRPanorama")):(assignState(this.state,C),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===C.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((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})),(A=this.analysis)===null||A===void 0||A.state(this.works,this.state)))},t.prototype.syncState=function(e,r,o){o===void 0&&(o=!1);var s=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){var u={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,u,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},l),{duration:o?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,l,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var f=1,p=.2,d=.2,h=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,f),A=Math.abs(this.camera.pose.distance-this.state.distance),m=A>d*15?A/15:p,E=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,m),v=this.camera.pose.offset.distanceTo(this.state.offset),y=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,y),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(E,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var R={x:b.x,y:b.y,z:b.z},w={fov:g};return Object.assign(R,{distance:E}),Object.assign(w,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(w,0).catch(noop),this.controller.locationMotion.set(R,0).catch(noop),!0}}else{var M=1,O=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,M),C=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},O),_=C.longitude,S=C.latitude,E=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(E,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 P=this.currentMode,F=P===t.Mode.Floorplan||P===t.Mode.Topview||P===t.Mode.Mapview||P===t.Mode.Model;if(!F||this.modelScene.loaded){var L=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var H=0,N=L;H<N.length;H++){var D=N[H];this.controller instanceof Controllers.Panorama&&D.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(D):D()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(o){var s;r.readyCallbacks.push(Object.assign(o,{tile:(s=e.tile)!==null&&s!==void 0?s:!1}))}).then(function(){return r.model.initReady})},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModels=function(e,r){for(var o=this,s,u,l,c,f,p,d=new Map,h=!1,g=[],A=0,m=this.modelScene.children;A<m.length;A++){var E=m[A];E instanceof Model&&(E.outdated=!0,d.set(E.work.workCode,E),h=!0)}for(var v=function(T){var _=e[T],S=_.workCode&&d.get(_.workCode);if(S)S.work=_,S.outdated=!1,d.delete(_.workCode),g.push(S);else{var R=(l=(u=(s=r.model)===null||s===void 0?void 0:s.textureOptions)!==null&&u!==void 0?u:r.textureOptions)!==null&&l!==void 0?l:y.textureOptions,w=(f=(c=r.model)===null||c===void 0?void 0:c["3d-tiles"])!==null&&f!==void 0?f:r["3d-tiles"],M=new Model(_,{light:(p=r.model)===null||p===void 0?void 0:p.light,textureOptions:R});M.initReady.then(function(){if(w)if(typeof w=="function")for(var L=0,H=M.viewLayers;L<H.length;L++){var N=H[L],D=w(N,M,T);D&&(D.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(D.viewerRequestVolume)),N.parameter.set(omit(D,["showLayers"])),D.showLayers===!1?N.visible=!1:Array.isArray(D.showLayers)&&(N.visible=D.showLayers.includes(N.name)))}else for(var Q=0,J=M.viewLayers;Q<J.length;Q++){var N=J[Q];w.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(w.viewerRequestVolume)),N.parameter.set(omit(w,["showLayers"])),w.showLayers===!1?N.visible=!1:Array.isArray(w.showLayers)&&(N.visible=w.showLayers.includes(N.name))}}),g.push(M),h&&(M.visible=!1),y.modelScene.add(M);var O=function(){AnimationFrameLoop.shared.add(function(){o.emit("model.load",createEvent("model.load",{work:_,model:M,error:null}))},!0)},C=function(L){var H=L.error;o.emit("model.error",createEvent("model.error",{work:_,model:M,error:H})),o.throwError(H)},P=function(){o.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:_,model:M,error:null}))},F=function(){M.removeEventListener("load",O),M.removeEventListener("error",C),M.removeEventListener("changeShownFloor",P),M.removeEventListener("dispose",F)};M.addEventListener("load",O),M.addEventListener("error",C),M.addEventListener("changeShownFloor",P),M.addEventListener("dispose",F),y.emit("model.request",createEvent("model.request",{work:_,model:M,error:null}))}},y=this,b=0;b<e.length;b++)v(b);return this.modelScene.loaded=!1,this.modelScene.refined=!1,g},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var A=[],m=0;m<arguments.length;m++)A[m]=arguments[m];var E=o.emit.apply(o,__spreadArray([g],A,!1));if(E)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 A;if(o.controller){var m=o.controller.getTargetState();g.userAction&&o.syncingState===!1&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:g.userAction,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:g.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(g){var A,m=g.state,E=g.userAction;E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.arrived",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.cancel",function(g){var A,m=g.state,E=g.userAction;E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var A=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:A,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;return r.matrix.copy(e.matrix).premultiply(e.work.transform),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1,cameraWorldToLocal(this.camera,r)}}return null},Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.renderEffect==="edl"},set:function(e){this.renderEffect=e?"edl":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.renderEffect==="hq"},set:function(e){this.renderEffect=e?"hq":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t})(Subscribe),__FIVE_DEBUG__={instances:{},constructor:Five};typeof window!="undefined"&&Object.assign(window,{__FIVE_DEBUG__});var XRButton=(function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function o(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function s(){o(),e.textContent="VR NOT SUPPORTED"}function u(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",u(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():s()}),e;var l=document.createElement("a");return window.isSecureContext===!1?(l.href=document.location.href.replace(/^http:/,"https:"),l.innerHTML="WEBXR NEEDS HTTPS"):(l.href="https://immersiveweb.dev/",l.innerHTML="WEBXR NOT AVAILABLE"),l.style.left="calc(50% - 90px)",l.style.width="180px",l.style.textDecoration="none",u(l),l},n})();exports.AnimationFrameLoop=AnimationFrameLoop;exports.Camera=Camera;exports.CustomShader=PBMCustomShader;exports.Fetcher=Fetcher;exports.Five=Five;exports.InternalWebGLRenderer=InternalWebGLRenderer;exports.Model=Model;exports.ModelScene=ModelScene;exports.Motion=Motion;exports.NetworkSubscribe=NetworkSubscribe;exports.PBMContainer=PBMContainer;exports.PBMCustomShader=PBMCustomShader;exports.PBMGroup=PBMGroup;exports.PBMMesh=PBMMesh;exports.PBMMeshMaterial=PBMMeshMaterial;exports.PBMPointCloud=PBMPointCloud;exports.PBMPointCloudMaterial=PBMPointCloudMaterial;exports.PBMSkinnedMesh=PBMSkinnedMesh;exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES;exports.PanoCircleMesh=PanoCircleMesh;exports.PanoCircleMeshCustom=PanoCircleMeshCustom;exports.PanoCircleMeshSolid=PanoCircleMeshSolid;exports.Parameter=Parameter;exports.Scene=Scene;exports.Subscribe=Subscribe;exports.TextureLoader=TextureLoader;exports.Tile=Tile;exports.Tile3DModel=Tile3D;exports.TileCache=TileCache;exports.TileNode=TileNode;exports.TileRequestScheduler=TileRequestScheduler;exports.Tileset=Tileset;exports.Trajectory=Trajectory;exports.TrajectoryNode=TrajectoryNode;exports.Work=Work;exports.WorkResolvedObserver=WorkResolvedObserver;exports.XRButton=XRButton;exports.controllersDefaultInitArgs=controllersDefaultInitArgs;exports.coordinatesToVector=coordinatesToVector;exports.createDebugBoundingMesh=createDebugBoundingMesh;exports.createWorks=createWorks;exports.defaultImageURLTransform=imageURL;exports.draco=draco;exports.getViewportScale=getViewportScale;exports.headingToLongitude=headingToLongitude;exports.imageSupport=imageSupport;exports.isBoundingVolume=isBoundingVolume;exports.isPanoId=isPanoId;exports.ktx2=ktx2;exports.loadAt3d=loadAt3d;exports.loadB3dm=loadB3dm;exports.loadDome=loadDome;exports.loadDomez=loadDomez;exports.loadFbx=loadFbx;exports.loadGltf=loadGltf;exports.loadPbm=loadPbm;exports.loadPly=loadPly;exports.loadPnts=loadPnts;exports.loadX3p=loadX3p;exports.longitudeToHeading=longitudeToHeading;exports.makeBoundingVolume=makeBoundingVolume;exports.panoEqual=panoEqual;exports.panoParse=panoParse;exports.panoStringify=panoStringify;exports.parseWork=parseWork;exports.vectorToCoordinates=vectorToCoordinates;exports.workToJson=workToJson;
|
|
2249
|
+
`})||this;return r.material.transparent=!0,r}return Object.defineProperty(t.prototype,"luminanceAdaptiveBuffer",{get:function(){return this.material.uniforms.luminanceAdaptiveBuffer.value},set:function(e){this.material.uniforms.luminanceAdaptiveBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),t})(Pass),LuminanceAdaptiveEffect=(function(n){__extends(t,n);function t(e,r,o,s){var u=n.call(this,e,r,o,s)||this;return u.enableTime=now(),u.renderer=e,u.valuePass=new ValuePass(u.renderer),u.luminancePass=new LuminancePass(u.renderer,Math.sqrt(1/3)),u.nextStepPass=new NextStepPass(u.renderer,.01),u.luminanceAdaptivePass=new LuminanceAdaptivePass(u.renderer),u}return t.prototype.render=function(e){this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera),this.enableTime===null&&(this.enableTime=now()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new THREE__namespace.WebGLRenderTarget(128,128,{minFilter:THREE__namespace.LinearMipmapLinearFilter,magFilter:THREE__namespace.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:THREE__namespace.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(e[0],this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminanceNextBuffer),this.luminanceAdaptivePass.luminanceAdaptiveBuffer=this.luminanceNextBuffer.texture),this.copyPass.render(this.luminanceNextBuffer,this.luminancePrevBuffer),this.nextStepPass.render(this.luminancePrevBuffer,this.luminanceNextBuffer),this.luminanceAdaptivePass.progress=Math.min((now()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(e[0],e[1])},t.prototype.dispose=function(){var e,r,o;(e=this.luminanceTargetBuffer)===null||e===void 0||e.dispose(),(r=this.luminancePrevBuffer)===null||r===void 0||r.dispose(),(o=this.luminanceNextBuffer)===null||o===void 0||o.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},t})(Effect),sharedV2=new THREE__namespace.Vector2,LuminanceRenderer=(function(n){__extends(t,n);function t(e){var r,o,s=n.call(this,e)||this;s.type="default",s.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(s.renderer,s.modelScene,s.camera,s.modelScene);var u=s.renderer.getDrawingBufferSize(sharedV2);return s.screenBuffers=[new THREE__namespace.WebGLRenderTarget(u.x,u.y,{generateMipmaps:!1,encoding:(o=(r=s.renderer)===null||r===void 0?void 0:r.outputEncoding)!==null&&o!==void 0?o:THREE__namespace.sRGBEncoding}),s.enableFragDepth?s.modelRenderTarget:null],s}return t.prototype.render=function(e){var r=this.renderer.getRenderTarget();this.enableFragDepth?(e&&(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers)),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,r),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,r),this.renderer.setRenderTarget(r),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0):(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0),this.modelScene.needsRender=!0},t})(BaseRenderer),DEFAULT_MODE_CHANGE_DURATION=800,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,scratchViewport=new THREE__namespace.Vector4,scratchScissor=new THREE__namespace.Vector4,scratchClearColor=new THREE__namespace.Color,scratchRenderSize=new THREE__namespace.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,p,d,h,g,A,m=n.call(this)||this;if(m.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[m.ident]=m),m.renderSwitch01=0,m.currentUpdateArgs={time:now(),args:[]},m.currentMode="Panorama",m.pano={workCode:"",panoIndex:0},m.needsRender=!1,m.modelSceneNeedsRender=!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(F){F instanceof Error&&m.throwError(F)}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(F,L,H,N){var D;m.emit("network.resource",createEvent("network.resource",{source:F,requestType:L,requestState:H,detail:N})),(D=m.analysis)===null||D===void 0||D.network(m.works,F,L,H,N)}),m.boundingMesh=new BoundingMesh$1,m.boundingMesh.name="bounding",m.readyCallbacks=[],m.syncingState=!1,m.helperGroup=new THREE__namespace.Group,m.helperGroup.name="helper",m.helperGroup.matrixAutoUpdate=!1,m.scene.add(m.helperGroup);var v=new Model(emptyWorks[0]);worksMap.set(m,emptyWorks),m.modelScene=new ModelScene,m.modelScene.add(v),m.modelScene.add(m.boundingMesh),defineProperty(v,"loaded",{get:function(){return!1},set:function(F){}}),m.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var y=initLights();m.scene.add(y);var b=new THREE__namespace.Group;defineProperty(b,"children",{get:function(){return y.children},set:function(F){y.children=F}}),defineProperty(b,"visible",{get:function(){return y.visible},set:function(F){y.visible=F}}),defineProperty(b,"name",{get:function(){return y.name},set:function(F){y.name=F}}),m.modelScene.add(b),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(F,L){for(var H=[],N=2;N<arguments.length;N++)H[N-2]=arguments[N];m.updateTime.apply(m,__spreadArray([F,L],H,!1))},!1,0,10));var T=function(){typeof document!="undefined"&&document.fullscreenElement===null&&m.currentMode==="VRPanorama"&&m.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},_=function(){m.needsRender=!0,m.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",T,!1),m.renderer&&m.renderer.domElement.addEventListener("webglcontextrestored",_,!1),m.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",T,!1),m.renderer&&m.renderer.domElement.removeEventListener("webglcontextrestored",_,!1)},m.plugins={},e.plugins&&e.plugins.length)for(var S=0,R=e.plugins;S<R.length;S++){var w=R[S];if(typeof w=="function")w(m);else if(Array.isArray(w)){var M=w[0],O=w[1],C=w[2];if(typeof M=="function"){var P=M(m,C);typeof O=="string"&&(m.plugins[O]?m.throwError(new Error("plugin name ".concat(O," is exists."))):m.plugins[O]=P)}}}return initLegacyEvent(m),m.enableLayeringRendering=(A=e.enableLayeringRendering)!==null&&A!==void 0?A:!1,m._buildInRendererType="default",m._builtinRenderer=null,m}return Object.defineProperty(t,"version",{get:function(){return"6.6.0-alpha.9"},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.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var r=this.getElement();r&&r.parentNode&&r.parentNode.removeChild(r);var o=this.modelScene.parameter;o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((e=o.pano0)===null||e===void 0?void 0:e.map)&&o.pano1.map.dispose(),o.reset("pano0","pano1");for(var s=0,u=this.modelScene.children.slice();s<u.length;s++){var l=u[s];l.dispose&&l.dispose(),this.modelScene.remove(l)}this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),worksMap.set(this,emptyWorks),this.renderer&&(this.renderer.render(new THREE__namespace.Scene,new THREE__namespace.Camera),this.renderer.setAnimationLoop(null)),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setViewport=function(e){Object.assign(this.viewport,e),this.needsRender=!0,this.modelSceneNeedsRender=!0},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),t.prototype.getBuiltinRenderer=function(e){var r=this._builtinRenderer;if((r==null?void 0:r.type)!==this._buildInRendererType)switch(r&&r.dispose(),this._buildInRendererType){case"default":this._builtinRenderer=new DefaultRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"edl":this._builtinRenderer=new EDLRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"hq":this._builtinRenderer=new HQRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"luminance":this._builtinRenderer=new LuminanceRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break}return this._builtinRenderer},Object.defineProperty(t.prototype,"renderEffect",{get:function(){return this._buildInRendererType},set:function(e){this._buildInRendererType=e,this.modelSceneNeedsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1;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")&&(o=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&o&&this.controller&&this.currentMode){var s=this.controller.updateConfiguration(this.controllerInits[this.currentMode]);s||this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var o=this.getElement();if(o){e.appendChild(o),this.refresh(r);var s=window.getComputedStyle(e).position;s!=="relative"&&s!=="absolute"&&s!=="fixed"&&s!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){var o,s;if(e===void 0&&(e={}),!!this.renderer){var u=this.renderer.domElement,l=u.parentNode,c=e.width,f=c===void 0?(o=l==null?void 0:l.offsetWidth)!==null&&o!==void 0?o:512:c,p=e.height,d=p===void 0?(s=l==null?void 0:l.offsetHeight)!==null&&s!==void 0?s:512:p;r=r!=null?r:this.renderer.getPixelRatio();var h=this.renderer.capabilities.maxTextureSize,g=Math.max(f,d)*r;g>h&&(r=r/g*h,r=Math.floor(r*100)/100),this.renderer.setPixelRatio(r),this.renderer.setSize(f,d),this.needsRender=!0,this.modelSceneNeedsRender=!0;var A=now(),m=A-this.currentUpdateArgs.time,E=this.currentUpdateArgs.args;this.updateTime(A,m,E)}},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,A,m,E;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 y=[];if(Array.isArray(e))for(var b=0,T=e;b<T.length;b++){var _=T[b];_ instanceof Work?y.push(_):typeof _!="string"&&"work"in _?y.push(parseWork(_.work,_)):y.push(parseWork(_))}else e instanceof Work?y.push(e):y.push(parseWork(e));for(var S=createWorks(y),R=function(W){var K=w,ne=new Fetcher({get networkSubscribe(){return K.networkSubscribe},requestProxy:function(ee){return Promise.resolve(ee).then(function(te){return K.requestProxy(te)}).then(function(te){return verifyURL(te,W.allowHosts)}).then(function(te){if(te instanceof Error)throw te;return te})}});registerFetcher(W,ne)},w=this,M=0,O=S;M<O.length;M++){var C=O[M];R(C)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var P=S.initial,F=P.work.observers[0],L=F?{workCode:F.work.workCode,panoIndex:F.panoIndex}:{workCode:P.work.workCode,panoIndex:0},H=(l=P.mode)!==null&&l!==void 0?l:F?"Panorama":"Mapview",N={};if(r==="inherit"){H=this.currentMode;var D=(f=(c=S[0])===null||c===void 0?void 0:c.observers)===null||f===void 0?void 0:f[this.panoIndex];D?L={workCode:D.work.workCode,panoIndex:D.panoIndex}:typeof S.initial.panoIndex=="number"?L={workCode:S.initial.work.workCode,panoIndex:S.initial.panoIndex}:(H==="Panorama"||H==="VRPanorama"||H==="XRPanorama")&&(H="Mapview"),N={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:void 0,offset:void 0}}else if(r==="initial")typeof P.panoIndex=="number"&&(L={workCode:P.work.workCode,panoIndex:P.panoIndex}),P.mode&&(H=P.mode),N={longitude:P.longitude,latitude:P.latitude,fov:P.fov,distance:P.distance,offset:(p=P.offset)===null||p===void 0?void 0:p.clone()};else{if(H=(d=r.mode)!==null&&d!==void 0?d:this.currentMode,typeof r.panoIndex=="number"){var D=S.getObserver({workCode:(g=(h=r.workCode)!==null&&h!==void 0?h:P.work.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex});D&&(L={workCode:D.work.workCode,panoIndex:D.panoIndex})}N={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var Q=__assign(__assign(__assign({},L),{mode:H}),N),J=this.getCurrentState(),U=(A=v.duration)!==null&&A!==void 0?A:this.modeChangeDuration;(H==="Floorplan"||H==="Topview"||H==="Mapview")&&this.currentMode===H&&(U=0);var z="fly";(H==="Panorama"||H==="VRPanorama"||H==="XRPanorama")&&this.currentMode===H&&(z=(m=v.effect)!==null&&m!==void 0?m:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:S,state:Q,userAction:s}));var q=function(){u.pano=L;var W=__assign(__assign({initial:{state:Q,currentState:J,duration:U,effect:z,userAction:s}},u.commonParams()),u.controllerInits[H]),K=Controllers[H].initAnimationEndState(W);if(u.controller&&u.currentMode===H)u.controller.updateWork(S,K,{effect:z,duration:U},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(H,W));else{var ne=u.currentMode;if(u.controller)u.controller.destroy();else{var ee=Controllers[H].initAnimationEndState(W);u.camera.setFromPose(ee),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(H,W);var te=createEvent("mode.change",{prevMode:ne,mode:H,state:K,userAction:s});try{u.emit("mode.change",te)}catch(ae){console.error(ae)}}u.updateTime(u.currentUpdateArgs.time,0,u.currentUpdateArgs.args)};worksMap.set(this,S);var j=Promise.resolve();if(H===t.Mode.Floorplan||H===t.Mode.Topview||H===t.Mode.Mapview||H===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(Q),assignPose(this.state,this.camera.pose)),this.controller||(this.currentMode=H);var G=this.loadModels(S,v);j=Promise.all(G.map(function(W){return W.loadedReady})).then(function(){u.needsRender=!0,u.modelSceneNeedsRender=!0,q(),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{q();var X=this.controller,Y=!1;this.modelScene.autoRefine=!1;var Z=function(){u.works===S&&Y===!1&&(u.needsRender=!0,u.modelSceneNeedsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),Y=!0,u.modelScene.autoRefine=!0),X.off("pano.arrived",Z),X.off("pano.cancel",Z)},G=this.loadModels(S,v);j=Promise.all(G.map(function(K){return K.initReady})).then(noop),X.once("pano.arrived",Z),X.once("pano.cancel",Z),setTimeout(Z,((E=v.duration)!==null&&E!==void 0?E:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:s,works:S})),j.then(function(){return u.ready()}).then(function(){var W;u.emit("works.ready",createEvent("works.ready",{input:e,state:u.getCurrentState(),userAction:s,works:S})),(W=u.analysis)===null||W===void 0||W.work(S)})},t.prototype.reset=function(){var e=this,r=this.loadWorkTask.then(function(){return e.reset_()});return this.loadWorkTask=r.catch(function(o){e.throwError(o)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var o;e.controller&&(e.controller.destroy(),e.controller=void 0);var s=e.modelScene.parameter;s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((o=s.pano0)===null||o===void 0?void 0:o.map)&&s.pano1.map.dispose(),s.set({pano0:null,pano1:null,modelAlpha:1}),e.renderer&&e.modelScene.update(e.renderer,e.camera);for(var u=0,l=e.modelScene.children;u<l.length;u++){var c=l[u];c instanceof Model&&(c.dispose(),e.modelScene.remove(c))}e.needsRender=!0,e.modelSceneNeedsRender=!0,worksMap.delete(e);var f=parseWork(null),p=new Model(f);p.work=f,worksMap.set(e,createWorks([f])),e.currentMode="Mapview",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.camera.needsRender=!1,e.needsRender=!1,e.modelSceneNeedsRender=!1,r()})},t.prototype.changeMode=function(e,r,o,s,u){var l=this;return r===void 0&&(r={}),s===void 0&&(s=!0),u===void 0&&(u=!1),new Promise(function(c,f){var p,d,h,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var A=0;l.controller&&(typeof o=="number"?A=o:A=(p=o==null?void 0:o.duration)!==null&&p!==void 0?p:l.modeChangeDuration);var m="fly";l.controller&&typeof o=="object"&&o.effect&&(m=o.effect);var E=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(E)){var v=new Error("PanoId ".concat(panoStringify(E)," 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.loaded||(A=0));var y=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,E)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(E,__assign({duration:A},r),s):l.controller.updateCamera(r,A,s).catch(noop):(panoEqual(l.pano,E)||(l.pano=E),l.controller.updateCamera(r,A,s).catch(noop));else{var S=__assign(__assign({},r),E),R=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:A,effect:m,userAction:s}},l.commonParams()),l.controllerInits[e]),w=Controllers[e].initAnimationEndState(R),M=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:w,userAction:s});if(l.emit("mode.change.request",M),!M.defaultPrevented){y&&y.destroy(),l.controller=l.applyController(e,R);var O=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:w,userAction:s});l.emit("mode.change",O)}}c()};if(e===t.Mode.VRPanorama)l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){S instanceof Error&&(l.exitFullscreen(),l.throwError(S),f(S))});else if(e===t.Mode.XRPanorama){var _=AnimationFrameLoop.shared.getContext();_?_.end():requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),T()}).catch(function(S){S instanceof Error&&(l.throwError(S),f(S))})}else T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var f=this.renderer.getPixelRatio(),p=this.renderer.getRenderTarget(),d=this.renderer.getSize(new THREE__namespace.Vector2),h=0,g=0,A=1,m=1,E,v,y,b,T;typeof e=="number"?(h=e,typeof r=="number"&&(g=r),typeof o=="number"&&(A=o),typeof s=="number"&&(m=s),E=u,v=l,T=c):(h=e.x,g=e.y,A=e.width,m=e.height,E=e.pixelRatio,v=e.flipY,y=e.helperVisible,b=e.skipPanorama,T=e.buffer),h=Math.ceil(h),g=Math.ceil(g),A=Math.ceil(A),m=Math.ceil(m),E=Math.ceil(E!=null?E:f),v=v!=null?v:!1;var _=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=y!=null?y:this.helperVisible,b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&b===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(A*E,m*E),this.renderer.setRenderTarget(R),this.camera.pixelRatio=E,this.camera.resolution.set(A,m),this.camera.setViewOffset(d.width,d.height,h,d.height-g-m,A,m),this.scene.update(this.renderer,this.camera),this.render(),this.helperVisible=_,S===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",S),this.renderer.setRenderTarget(p),this.camera.clearViewOffset(),this.camera.pixelRatio=f,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var w=A*E,M=m*E,O=w*M,C=O*4;if(T){if(T.length!==C)throw new Error("buffer length is not equals pixels ".concat(C))}else T=new Uint8Array(C);if(this.renderer.readRenderTargetPixels(R,0,0,A*E,m*E,T),v)for(var P=O/2,F=0,L=0,H=0,N=0;L<P;L++)for(N=(M-Math.floor(L/w)-1)*w+L%w,H=0;H<4;H++)F=T[L*4+H],T[L*4+H]=T[N*4+H],T[N*4+H]=F;return T},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},t.prototype.render=function(e){var r=this.renderer;if(r){var o=r.getRenderTarget(),s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,f=scratchClearColor.copy(r.getClearColor()),p=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),g=r.getScissorTest(),A=r.getSize(scratchRenderSize),m=r.getPixelRatio(),E=Math.floor(A.x*this.viewport.left),v=Math.floor(A.y*this.viewport.bottom),y=Math.floor(A.x*this.viewport.width),b=Math.floor(A.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(E,v,y,b),r.setScissor(E,v,y,b);var T=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(T);var _=this.scene.background;this.modelScene.background=this.camera.isOrthographicCamera?null:_,this.modelScene.environment=this.scene.environment,this.scene.background=null;var S=this.getBuiltinRenderer(r);S.setSize(A.x,A.y,m),this.controller?this.controller.render(S,this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0):S.render(this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0),this.scene.background=_,this.modelScene.background=null,this.modelScene.environment=null,this.poweredByRealsee&&this.currentMode!=="VRPanorama"&&this.currentMode!=="XRPanorama"&&r.getRenderTarget()!==this.getPixelsRenderTarget&&renderPoweredByRealsee(r),r.setRenderTarget(o),r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(f,p),r.setViewport(d),r.setScissor(h),r.setScissorTest(g),e&&AnimationFrameLoop.shared.add(e,!0)}},t.prototype.updateTime=function(e,r){for(var o,s=this,u=[],l=2;l<arguments.length;l++)u[l-2]=arguments[l];if(this.currentUpdateArgs={time:e,args:u},!this.destroyed){if(this.renderer&&ktx2.detectSupport(this.renderer),this.syncingState=this.syncState(e,r),this.controller&&(o=this.controller).updateTime.apply(o,__spreadArray([e,r],u,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.autoNearFar){var c=this.modelScene.boundingBox.getBoundingSphere(scratchSphere),f=c.radius*2;c.containsPoint(this.camera.position)||(f=this.camera.position.distanceTo(c.center)+c.radius),f=clamp$1(f,800,5e4),this.camera.far!==f&&(this.camera.far=f);var p=f/1e4;p=clamp$1(p,.03,.1),this.camera.near!==p&&(this.camera.near=p)}if(this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var d=this.modelScene.loaded,h=this.modelScene.refined;if(this.modelScene.loaded){for(var g=[],A=0,m=this.modelScene.children;A<m.length;A++){var E=m[A];E instanceof Model&&E.outdated&&g.push(E)}for(var v=0,y=g;v<y.length;v++){var b=y[v];this.modelScene.remove(b),b.dispose()}if(g.length>0)for(var T=0,_=this.modelScene.children;T<_.length;T++){var E=_[T];E instanceof Model&&(E.visible=!0,this.modelSceneNeedsRender=!0)}}this.modelScene.update(this.renderer,this.camera),d===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),AnimationFrameLoop.shared.add(function(){s.emit("models.load",createEvent("models.load",{modelScene:s.modelScene}))},!0,0,10)),h===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}this.renderer&&this.scene.update(this.renderer,this.camera),this.syncingState=!1,this.controller&&(this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.controller.modelSceneNeedsRender===!0&&(this.controller.modelSceneNeedsRender=!1,this.modelSceneNeedsRender=!0)),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0),this.modelSceneNeedsRender===!0&&(this.needsRender=!0);var S=this.camera.resolution.width*this.camera.pixelRatio*this.camera.resolution.height*this.camera.pixelRatio;S>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderSwitch01!==0&&(this.needsRender=!1),this.paused===!0&&(this.needsRender=!1);var R=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",R),R.defaultPrevented&&(this.needsRender=!1),this.renderer&&this.needsRender&&this.render(),this.emit("render",createEvent("render",{needsRender:this.needsRender})),this.needsRender=!1,this.modelSceneNeedsRender=!1,this.hasListener("fps")&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={}),o===void 0&&(o=!0);var s=this,u=s.controller,l=s.renderer;if(!u)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!l)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();var c=this.works.getObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var 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","mappings"])),d=s.images[c],h=o.imageOptions.transform?o.imageOptions.transform(d,p):imageURL(d,p);return getFetcher(s.work).preload(h)})).then(function(){var c=now()-l;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.camera.position,s=e.clone().sub(o),u=new THREE__namespace.Raycaster(o,s.clone().normalize());u.params.Points={threshold:.1};var l=this.modelScene.intersectRaycaster(u)[0];if(l&&l.distance+.01<s.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var 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,A;r===void 0&&(r=!1),o===void 0&&(o=!0),e=Object.assign({},e),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var m;if(typeof e.panoIndex=="number")if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{var E=(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(P){return P.workCode===v}).length>0&&(E=v),m={workCode:E,panoIndex:e.panoIndex}}var y=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,R;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==y){if(y==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var w={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude=="number"&&(w.longitude=e.longitude),typeof e.latitude=="number"&&(w.latitude=e.latitude),typeof e.fov=="number"&&(w.fov=e.fov),typeof e.distance=="number"&&(w.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(w.offset=e.offset);var M=__assign(__assign({initial:{state:w,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[y]),O=Controllers[y].initAnimationEndState(M);b=O.longitude,T=O.latitude,_=O.fov,S=O.offset,R=O.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,R=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(m!=null?m:this.pano).workCode,panoIndex:(m!=null?m:this.pano).panoIndex,mode:y,longitude:b,latitude:T,fov:_,offset:S,distance:R};this.emit("state.set",createEvent("state.set",{userAction:o,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode==="VRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("VRPanorama")):this.controller&&C.mode==="XRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("XRPanorama")):(assignState(this.state,C),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===C.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((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})),(A=this.analysis)===null||A===void 0||A.state(this.works,this.state)))},t.prototype.syncState=function(e,r,o){o===void 0&&(o=!1);var s=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){var u={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,u,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},l),{duration:o?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,l,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var f=1,p=.2,d=.2,h=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,f),A=Math.abs(this.camera.pose.distance-this.state.distance),m=A>d*15?A/15:p,E=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,m),v=this.camera.pose.offset.distanceTo(this.state.offset),y=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,y),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(E,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var R={x:b.x,y:b.y,z:b.z},w={fov:g};return Object.assign(R,{distance:E}),Object.assign(w,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(w,0).catch(noop),this.controller.locationMotion.set(R,0).catch(noop),!0}}else{var M=1,O=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,M),C=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},O),_=C.longitude,S=C.latitude,E=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(E,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 P=this.currentMode,F=P===t.Mode.Floorplan||P===t.Mode.Topview||P===t.Mode.Mapview||P===t.Mode.Model;if(!F||this.modelScene.loaded){var L=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var H=0,N=L;H<N.length;H++){var D=N[H];this.controller instanceof Controllers.Panorama&&D.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(D):D()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(o){var s;r.readyCallbacks.push(Object.assign(o,{tile:(s=e.tile)!==null&&s!==void 0?s:!1}))}).then(function(){return r.model.initReady})},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModels=function(e,r){for(var o=this,s,u,l,c,f,p,d=new Map,h=!1,g=[],A=0,m=this.modelScene.children;A<m.length;A++){var E=m[A];E instanceof Model&&(E.outdated=!0,d.set(E.work.workCode,E),h=!0)}for(var v=function(T){var _=e[T],S=_.workCode&&d.get(_.workCode);if(S)S.work=_,S.outdated=!1,d.delete(_.workCode),g.push(S);else{var R=(l=(u=(s=r.model)===null||s===void 0?void 0:s.textureOptions)!==null&&u!==void 0?u:r.textureOptions)!==null&&l!==void 0?l:y.textureOptions,w=(f=(c=r.model)===null||c===void 0?void 0:c["3d-tiles"])!==null&&f!==void 0?f:r["3d-tiles"],M=new Model(_,{light:(p=r.model)===null||p===void 0?void 0:p.light,textureOptions:R});M.initReady.then(function(){if(w)if(typeof w=="function")for(var L=0,H=M.viewLayers;L<H.length;L++){var N=H[L],D=w(N,M,T);D&&(D.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(D.viewerRequestVolume)),N.parameter.set(omit(D,["showLayers"])),D.showLayers===!1?N.visible=!1:Array.isArray(D.showLayers)&&(N.visible=D.showLayers.includes(N.name)))}else for(var Q=0,J=M.viewLayers;Q<J.length;Q++){var N=J[Q];w.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(w.viewerRequestVolume)),N.parameter.set(omit(w,["showLayers"])),w.showLayers===!1?N.visible=!1:Array.isArray(w.showLayers)&&(N.visible=w.showLayers.includes(N.name))}}),g.push(M),h&&(M.visible=!1),y.modelScene.add(M);var O=function(){AnimationFrameLoop.shared.add(function(){o.emit("model.load",createEvent("model.load",{work:_,model:M,error:null}))},!0)},C=function(L){var H=L.error;o.emit("model.error",createEvent("model.error",{work:_,model:M,error:H})),o.throwError(H)},P=function(){o.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:_,model:M,error:null}))},F=function(){M.removeEventListener("load",O),M.removeEventListener("error",C),M.removeEventListener("changeShownFloor",P),M.removeEventListener("dispose",F)};M.addEventListener("load",O),M.addEventListener("error",C),M.addEventListener("changeShownFloor",P),M.addEventListener("dispose",F),y.emit("model.request",createEvent("model.request",{work:_,model:M,error:null}))}},y=this,b=0;b<e.length;b++)v(b);return this.modelScene.loaded=!1,this.modelScene.refined=!1,g},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var A=[],m=0;m<arguments.length;m++)A[m]=arguments[m];var E=o.emit.apply(o,__spreadArray([g],A,!1));if(E)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 A;if(o.controller){var m=o.controller.getTargetState();g.userAction&&o.syncingState===!1&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:g.userAction,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:g.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(g){var A,m=g.state,E=g.userAction;E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.arrived",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.cancel",function(g){var A,m=g.state,E=g.userAction;E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var A=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:A,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;return r.matrix.copy(e.matrix).premultiply(e.work.transform),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1,cameraWorldToLocal(this.camera,r)}}return null},Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.renderEffect==="edl"},set:function(e){this.renderEffect=e?"edl":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.renderEffect==="hq"},set:function(e){this.renderEffect=e?"hq":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t})(Subscribe),__FIVE_DEBUG__={instances:{},constructor:Five};typeof window!="undefined"&&Object.assign(window,{__FIVE_DEBUG__});var XRButton=(function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function o(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function s(){o(),e.textContent="VR NOT SUPPORTED"}function u(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",u(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():s()}),e;var l=document.createElement("a");return window.isSecureContext===!1?(l.href=document.location.href.replace(/^http:/,"https:"),l.innerHTML="WEBXR NEEDS HTTPS"):(l.href="https://immersiveweb.dev/",l.innerHTML="WEBXR NOT AVAILABLE"),l.style.left="calc(50% - 90px)",l.style.width="180px",l.style.textDecoration="none",u(l),l},n})();exports.AnimationFrameLoop=AnimationFrameLoop;exports.Camera=Camera;exports.CustomShader=PBMCustomShader;exports.Fetcher=Fetcher;exports.Five=Five;exports.InternalWebGLRenderer=InternalWebGLRenderer;exports.Model=Model;exports.ModelScene=ModelScene;exports.Motion=Motion;exports.NetworkSubscribe=NetworkSubscribe;exports.PBMContainer=PBMContainer;exports.PBMCustomShader=PBMCustomShader;exports.PBMGroup=PBMGroup;exports.PBMMesh=PBMMesh;exports.PBMMeshMaterial=PBMMeshMaterial;exports.PBMPointCloud=PBMPointCloud;exports.PBMPointCloudMaterial=PBMPointCloudMaterial;exports.PBMSkinnedMesh=PBMSkinnedMesh;exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES;exports.PanoCircleMesh=PanoCircleMesh;exports.PanoCircleMeshCustom=PanoCircleMeshCustom;exports.PanoCircleMeshSolid=PanoCircleMeshSolid;exports.Parameter=Parameter;exports.Scene=Scene;exports.Subscribe=Subscribe;exports.TextureLoader=TextureLoader;exports.Tile=Tile;exports.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;
|