@realsee/five 6.8.0-alpha.18 → 6.8.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/five/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 3/17/2026
5
- * Version: 6.8.0-alpha.18
4
+ * Generated: 3/18/2026
5
+ * Version: 6.8.0-alpha.19
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -359,7 +359,7 @@ self.onmessage = function(event) {
359
359
  }
360
360
  postMessage({ id: packet.id, error: "type never matched." });
361
361
  };
362
- `,qi=typeof Worker<`u`&&typeof Blob<`u`,Ji=``;if(qi)try{let e=new Blob([Ki],{type:`text/javascript`});Ji=URL.createObjectURL(e)}catch(e){}var Yi=class{constructor(){if(!qi)throw Error(`LZMAWorker cannot work in this broswer.`);this.callCounter=0,this.requests={};let e=this.worker=new Worker(Ji);e.onmessage=e=>{let{id:t,result:n,error:r}=e.data,i=this.getKey(t);this.requests[i]&&(r?this.requests[i](Error(r)):this.requests[i](null,n),delete this.requests[i])},e.onerror=e=>console.error(e)}getKey(e){return`key_`+String(e)}decompress(e,t){let n=++this.callCounter;this.requests[this.getKey(n)]=t,this.worker.postMessage({type:`decompress`,id:n,data:e},[e.buffer])}terminate(){this.worker.terminate()}};Yi.support=qi;function Xi(e){return Array.prototype.reduce.call(e,(e,t,n)=>e|t<<n*8,0)}function Zi(e){let t=[],n=e.length;for(let i=0;i<n;i++){let n={data:e[i],offset:0,readByte(){return this.data[this.offset++]}},a=n.data.length,o={data:[],offset:0,writeByte(e){let t=Math.floor(this.offset/a);this.data[t]||(this.data[t]=new Uint8Array(a)),this.data[t][this.offset%a]=e,this.offset++}};Hi.decompressFile(n,o);var r=new Uint8Array(o.offset);for(let e=0;e<o.offset;e++)r[e]=o.data[Math.floor(e/a)][e%a];t.push(r)}return t}function Qi(e){let t=[],n=e.length;for(let r=0;r<n;r++)t.push(new Promise((t,n)=>{let i=new Yi;i.decompress(e[r],(e,r)=>{if(i.terminate(),e)return n(e);t(r)})}));return Promise.all(t)}function $i(e){let t=new Uint8Array(e),n=Xi(t.slice(0,4));if(n>10)return Promise.reject(Error(`LZMA got too many sub chunks.`));let r=[],i=[],a=4+n*4;for(let e=0;e<n;e++)i[e]=Xi(t.slice(4+e*4,8+e*4)),e===n-1?r[e]=t.subarray(a,a+i[e]):r[e]=t.slice(a,a+i[e]),a+=i[e];return Yi.support?Qi(r):Promise.resolve(Zi(r))}function ea(e,t={}){var n,r,i,a,o,s,l;let u=(n=t.upAxis)==null?`Z`:n,d=(r=t.light)==null?!1:r,f=(i=t.fetcher)==null?pr:i,p=(a=t.onDownloadProgress)==null?q:a,m=(o=t.textureBaseUri)==null?ji(e):o,h=t.textureBaseUri===void 0?[]:((s=t.textureArray)==null?[]:s).slice(),g=Bi((l=t.textureOptions)==null?{}:l,h.length),_=new Map;for(let e of h){let t=vr(e)?e:br(m,e);_.set(t,Ri(t,g,f))}let v={byteLength:0};return Promise.resolve().then(()=>f.ajax(e,{responseType:`arraybuffer`},void 0,void 0,p)).then(e=>$i(e.body)).then(e=>{let t={chunks:[],createAt:void 0,description:void 0};for(let n of e){let e=yi.decode(n);if(e.chunks.length){for(let n=0;n<e.chunks.length;n++)t.chunks.push(e.chunks[n]);t.createAt=e.createAt,t.description=e.description}}return t}).then(e=>zi(e,d,m,h,g,_,f)).then(t=>{_.clear();let n=new c.Group;n.name=e;for(let e of t.objects)n.add(e);return u===`Y`&&n.applyMatrix4(Zn),{type:`at3d`,modelUpAxis:`Z`,upAxis:u,uri:e,byteLength:v.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}var ta=l.Reader,na=l.util,Y=l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto`]||(l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto`]={}),ra=Y.Model=(()=>{function e(e){if(this.meshes=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.meshes=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Model;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.meshes&&i.meshes.length||(i.meshes=[]),i.meshes.push(Y.Mesh.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Model`},e})();Y.Mesh=(()=>{function e(e){if(this.chunks=[],this.matrix=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.name=``,e.prototype.chunks=na.emptyArray,e.prototype.matrix=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Mesh;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.name=e.string();break;case 2:i.chunks&&i.chunks.length||(i.chunks=[]),i.chunks.push(Y.Chunk.decode(e,e.uint32()));break;case 3:i.matrix&&i.matrix.length||(i.matrix=[]),i.matrix.push(Y.Matrix.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`name`))throw na.ProtocolError(`missing required 'name'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Mesh`},e})(),Y.Matrix=(()=>{function e(e){if(this.elements=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.elements=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Matrix;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.elements&&i.elements.length||(i.elements=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.elements.push(e.float())}else i.elements.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Matrix`},e})(),Y.Chunk=(()=>{function e(e){if(this.material=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.geometry=null,e.prototype.material=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Chunk;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 2:i.geometry=Y.Geometry.decode(e,e.uint32());break;case 3:i.material&&i.material.length||(i.material=[]),i.material.push(Y.Material.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`geometry`))throw na.ProtocolError(`missing required 'geometry'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Chunk`},e})(),Y.Geometry=(()=>{function e(e){if(this.groups=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.position=null,e.prototype.uv=null,e.prototype.uv2=null,e.prototype.normal=null,e.prototype.groups=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Geometry;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.position=Y.Position.decode(e,e.uint32());break;case 2:i.uv=Y.UV.decode(e,e.uint32());break;case 3:i.uv2=Y.UV.decode(e,e.uint32());break;case 4:i.normal=Y.Normal.decode(e,e.uint32());break;case 5:i.groups&&i.groups.length||(i.groups=[]),i.groups.push(Y.Group.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`position`))throw na.ProtocolError(`missing required 'position'`,{instance:i});if(!i.hasOwnProperty(`normal`))throw na.ProtocolError(`missing required 'normal'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Geometry`},e})(),Y.Position=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Position;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Position`},e})(),Y.UV=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.UV;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/UV`},e})(),Y.Normal=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Normal;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Normal`},e})(),Y.Group=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.start=0,e.prototype.count=0,e.prototype.materialIndex=0,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Group;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.start=e.uint32();break;case 2:i.count=e.uint32();break;case 3:i.materialIndex=e.uint32();break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`start`))throw na.ProtocolError(`missing required 'start'`,{instance:i});if(!i.hasOwnProperty(`count`))throw na.ProtocolError(`missing required 'count'`,{instance:i});if(!i.hasOwnProperty(`materialIndex`))throw na.ProtocolError(`missing required 'materialIndex'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Group`},e})(),Y.Material=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.kd=null,e.prototype.ks=null,e.prototype.ke=null,e.prototype.mapkd=``,e.prototype.mapks=``,e.prototype.mapke=``,e.prototype.norm=``,e.prototype.mapbump=``,e.prototype.bump=``,e.prototype.mapd=``,e.prototype.ns=0,e.prototype.d=0,e.prototype.tr=0,e.prototype.mapkdrepeat=``,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Material;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.kd=Y.Color.decode(e,e.uint32());break;case 2:i.ks=Y.Color.decode(e,e.uint32());break;case 3:i.ke=Y.Color.decode(e,e.uint32());break;case 4:i.mapkd=e.string();break;case 5:i.mapks=e.string();break;case 6:i.mapke=e.string();break;case 7:i.norm=e.string();break;case 8:i.mapbump=e.string();break;case 9:i.bump=e.string();break;case 10:i.mapd=e.string();break;case 11:i.ns=e.float();break;case 12:i.d=e.float();break;case 13:i.tr=e.float();break;case 14:i.mapkdrepeat=e.string();break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Material`},e})(),Y.Color=(()=>{function e(e){if(this.rgb=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.rgb=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Color;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.rgb&&i.rgb.length||(i.rgb=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.rgb.push(e.float())}else i.rgb.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Color`},e})();function ia(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(e=>{var n,r;return l.byteLength=e.body.byteLength,ua(new Uint8Array(e.body),(n=t.light)==null?!0:n,t.textureBaseUri||``,(r=t.textureOptions)==null?{}:r,o)}).then(t=>{let n=new c.Group;n.matrixAutoUpdate=!1,a===`Z`&&n.applyMatrix4(Xn),n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(let e of t.objects)n.add(e);return{type:`dome`,modelUpAxis:`Y`,upAxis:a,uri:e,byteLength:l.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}function aa(e){let t=[0,0,0];for(let n=0;n<e.attributes.normal.array.length/9;n++)t[0]=e.attributes.normal.array[n*9],t[1]=e.attributes.normal.array[n*9+1],t[2]=e.attributes.normal.array[n*9+2],e.attributes.normal.array[n*9]=e.attributes.normal.array[n*9+6],e.attributes.normal.array[n*9+1]=e.attributes.normal.array[n*9+7],e.attributes.normal.array[n*9+2]=e.attributes.normal.array[n*9+8],e.attributes.normal.array[n*9+6]=t[0],e.attributes.normal.array[n*9+7]=t[1],e.attributes.normal.array[n*9+8]=t[2];for(let n=0;n<e.attributes.position.array.length/9;n++)t[0]=e.attributes.position.array[n*9],t[1]=e.attributes.position.array[n*9+1],t[2]=e.attributes.position.array[n*9+2],e.attributes.position.array[n*9]=e.attributes.position.array[n*9+6],e.attributes.position.array[n*9+1]=e.attributes.position.array[n*9+7],e.attributes.position.array[n*9+2]=e.attributes.position.array[n*9+8],e.attributes.position.array[n*9+6]=t[0],e.attributes.position.array[n*9+7]=t[1],e.attributes.position.array[n*9+8]=t[2];for(let n=0;n<e.attributes.uv.array.length/6;n++)t[0]=e.attributes.uv.array[n*6],t[1]=e.attributes.uv.array[n*6+1],e.attributes.uv.array[n*6]=e.attributes.uv.array[n*6+4],e.attributes.uv.array[n*6+1]=e.attributes.uv.array[n*6+5],e.attributes.uv.array[n*6+4]=t[0],e.attributes.uv.array[n*6+5]=t[1];e.attributes.normal.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.uv.needsUpdate=!0}function oa({position:e,normal:t,uv:n,uv2:r,groups:i}){let a=new c.BufferGeometry;a.setAttribute(`position`,new c.BufferAttribute(new Float32Array(e.array),3)),t&&a.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(t.array),3)),n&&a.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(n.array),2)),r&&a.setAttribute(`uv2`,new c.BufferAttribute(new Float32Array(r.array),2));for(let e of i)a.addGroup(e.start,e.count,e.materialIndex);return a}function sa(e,t,n,r,i,a,o){if(o.hasOwnProperty(e))return o[e];e=e.split(`?`)[0],vr(e)||(e=br(t,e)),e=e.replace(/\/\/vrlab-image\d*.ljcdn.com\//,`//vrlab-public.ljcdn.com/`),e.indexOf(`//`)===0&&(e=`https:`+e);let s=Object.assign({key:`texture.dome`,size:64},mr(n,[`quality`,`format`,`sharpen`,`forceUseExifOrientation`,`mappings`]));return o[e]=i.loadTexture(e,{imageURL:{transform:n.transform,options:s},wrapS:c.RepeatWrapping,wrapT:c.RepeatWrapping,fetcher:a}).then(e=>{let t=e.body;return r&&t.repeat.copy(r),t.needsUpdate=!0,t.updateMatrix(),t})}function ca(e,t,n,r,i,a,o,s,l){let u=[],d=new vn(t?`phong`:`basic`);if(s.add(d),e.kd&&(d.color=new c.Color().fromArray(e.kd.rgb).convertLinearToSRGB()),e.mapkd){let t=null;if(e.mapkdrepeat){let[n,r]=e.mapkdrepeat.split(/\s+/).map(e=>Number(e));t=new c.Vector2(n,r)}u.push(sa(e.mapkd,n,r,t,i,a,o).then(e=>{e.encoding=c.sRGBEncoding,d.map=e,s.add(e),l.add(e),d.needsUpdate=!0}).catch(q))}if(e.ks&&(d.specular=new c.Color().fromArray(e.ks.rgb).convertLinearToSRGB()),e.mapks&&u.push(sa(e.mapks,n,r,null,i,a,o).then(e=>{d.specularMap=e,s.add(e),l.add(e)}).catch(q)),e.ke&&(d.emissive=new c.Color().fromArray(e.ke.rgb).convertLinearToSRGB()),e.mapke&&u.push(sa(e.mapke,n,r,null,i,a,o).then(e=>{e.encoding=c.sRGBEncoding,d.emissiveMap=e,s.add(e),l.add(e)}).catch(q)),e.norm&&u.push(sa(e.norm,n,r,null,i,a,o).then(e=>{d.normalMap=e,s.add(e),l.add(e)}).catch(q)),e.mapbump&&u.push(sa(e.mapbump,n,r,null,i,a,o).then(e=>{d.bumpMap=e,s.add(e),l.add(e)}).catch(q)),e.bump&&u.push(sa(e.bump,n,r,null,i,a,o).then(e=>{d.bumpMap=e,s.add(e),l.add(e)}).catch(q)),typeof e.ns==`number`&&(d.shininess=e.ns),typeof e.d==`number`){let t=e.d;t>0&&t<1&&(d.opacity=t)}return d.floorIndex=0,{material:d,textureReady:Promise.all(u).then(q)}}function la(e){return ra.decode(e).meshes}function ua(e,t,n,r,i){let a=[],o=[],s=new Set,l=la(e),u=new hi,d=new c.Matrix4,f=new c.Vector3,p=new c.Quaternion,m=new c.Vector3,h={},g=new Set;for(let{name:e,chunks:_,matrix:v}of l)if(!(e===`Ceiling`||e===`CeilingDrop`))for(let l of v){d.elements=l.elements;let v=new c.Group;for(let e=0;e<_.length;e++){let a=oa(_[e].geometry);a.applyMatrix4(d),d.decompose(f,p,m),m.x*m.y*m.z<0&&a.attributes.normal&&a.attributes.position&&a.attributes.uv&&aa(a),s.add(a);let c=[];for(let a of _[e].material){let{material:e,textureReady:l}=ca(a,t,n||``,r,u,i,h,s,g);o.push(l),c.push(e)}let l=new yn(a,c);l.name=`chunk_`+e,l.matrix.compose(l.position,l.quaternion,l.scale),l.matrixAutoUpdate=!1,l.frustumCulled=!1,v.add(l)}v.name=e,a.push(v)}return Promise.all(o).catch(q).then(()=>({createAt:0,description:``,objects:a,textures:Array.from(g),dispose:()=>{s.forEach(e=>{e.dispose()}),s.clear()}}))}function da(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(e=>(l.byteLength=e.body.byteLength,$i(e.body))).then(e=>{let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;return e.forEach(e=>{n.set(e,r),r+=e.length}),n}).then(e=>{var n,r;return ua(e,(n=t.light)==null?!0:n,t.textureBaseUri||``,(r=t.textureOptions)==null?{}:r,o)}).then(t=>{let n=new c.Group;n.matrixAutoUpdate=!1,a===`Z`&&n.applyMatrix4(Xn),n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(let e of t.objects)n.add(e);return{type:`domez`,modelUpAxis:`Y`,upAxis:`Z`,uri:e,byteLength:l.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}var fa=4;function pa(e,t,n){let r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=fa,e.version=r.getUint32(n,!0),n+=fa,e.byteLength=r.getUint32(n,!0),n+=fa,e.version!==1)throw Error(`3D Tile Version ${e.version} not supported`);return n}var ma;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(ma||(ma={}));var ha={[ma.DOUBLE]:Float64Array,[ma.FLOAT]:Float32Array,[ma.UNSIGNED_SHORT]:Uint16Array,[ma.UNSIGNED_INT]:Uint32Array,[ma.UNSIGNED_BYTE]:Uint8Array,[ma.BYTE]:Int8Array,[ma.SHORT]:Int16Array,[ma.INT]:Int32Array},ga={DOUBLE:ma.DOUBLE,FLOAT:ma.FLOAT,UNSIGNED_SHORT:ma.UNSIGNED_SHORT,UNSIGNED_INT:ma.UNSIGNED_INT,UNSIGNED_BYTE:ma.UNSIGNED_BYTE,BYTE:ma.BYTE,SHORT:ma.SHORT,INT:ma.INT};function _a(e){let t=ha[e];if(!t)throw Error(`Failed to convert GL type`);return t}function va(e){return _a(e).BYTES_PER_ELEMENT}function ya(e,t,n=0,r){let i=_a(e);return n%va(e)===0?new i(t,n,r==null?(t.byteLength-n)/va(e):r):new i(r?t.slice(n,n+r*va(e)):t.slice(n))}function ba(e){let t=ga[e];if(!t)throw Error(`Failed to convert GL type`);return t}var xa=class{constructor(e,t){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=t;let n=this.getGlobalProperty(`POINTS_LENGTH`,ma.UNSIGNED_INT,1);n&&n.length&&(this.featuresLength=n[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(_a(t))([r]):Array.isArray(r)?new(_a(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=ba(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,o=a[e];return o||(o=ya(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=o),o}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=ya(t,n),r[e]=i),i}},Sa=4,Ca=`b3dm tile in legacy format.`;function wa(e,t,n){let r=new TextDecoder(`utf8`),i=new Uint8Array(e,t,n);return r.decode(i)}function Ta(e,t,n){return n=Ea(e,t,n),n=Da(e,t,n),n=Oa(e,t,n),n}function Ea(e,t,n){let r=new DataView(t),i=0;e.header=e.header||{};let a=r.getUint32(n,!0);n+=Sa;let o=r.getUint32(n,!0);n+=Sa;let s=r.getUint32(n,!0);n+=Sa;let c=r.getUint32(n,!0);return n+=Sa,s>=570425344?(n-=Sa*2,i=a,s=o,c=0,a=0,o=0,console.warn(Ca)):c>=570425344&&(n-=Sa,i=s,s=a,c=o,a=0,o=0,console.warn(Ca)),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=c,e.header.batchLength=i,n}function Da(e,t,n){let{featureTableJsonByteLength:r,featureTableBinaryByteLength:i,batchLength:a}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:a||0},r&&r>0){let i=wa(t,n,r);e.featureTableJson=JSON.parse(i)}n+=r||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0;let o=new xa(e.featureTableJson,e.featureTableBinary);if(Array.isArray(o.json.RTC_CENTER)){let t=o.json.RTC_CENTER;e.rtcCenter=[t[0],t[1],t[2]]}else{let t=o.getGlobalProperty(`RTC_CENTER`,ma.FLOAT,3);t&&(e.rtcCenter=[t[0],t[1],t[2]])}return n}function Oa(e,t,n){let{batchTableJsonByteLength:r,batchTableBinaryByteLength:i}=e.header||{};if(r&&r>0){let a=wa(t,n,r);e.batchTableJson=JSON.parse(a),n+=r,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,n,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=i)}return n}function ka(e,t,n){let r=n===void 0?new Uint8Array(e).subarray(t):new Uint8Array(e).subarray(t,t+n);return new Uint8Array(r).buffer}function Aa(e,t,n){let r=e.byteLength-n;if(r===0)throw Error(`glTF byte length must be greater than 0.`);return n%4!=0&&console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),e.gltfArrayBuffer=ka(t,n,r),e.byteLength}function ja(e){if(typeof TextDecoder<`u`)return new TextDecoder().decode(e);let t=``;for(let n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}var Ma={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Na={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Pa={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},Fa={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},Ia={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},La={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv2`,TEXCOORD_2:`uv3`,TEXCOORD_3:`uv4`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},Ra={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},za={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete},Ba={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`};function Va(e){let t=[];for(let n in e)t.push(e[n]);return t}function Ha(e){let t=Array.from(e);return()=>{for(let e of t)typeof e.dispose==`function`&&e.dispose(),typeof e.close==`function`&&e.close()}}var Ua=class{constructor(e,t,n){if(this.json=e,this.json.materials){let e=new Set;for(let t of this.json.materials){if(typeof t.name!=`string`)continue;let n=0;for(;t.name;){let r=t.name+(n>0?`__${n}`:``);if(!e.has(r)){e.add(r),t.name=r;break}console.warn(`glTF: material name "${t.name}" duplicated.`),n++}}e.clear()}if(this.json.nodes){let e=new Set;for(let t of this.json.nodes){if(typeof t.name!=`string`)continue;let n=0;for(;t.name;){let r=t.name+(n>0?`__${n}`:``);if(!e.has(r)){e.add(r),t.name=r;break}console.warn(`glTF: node name "${t.name}" duplicated.`),n++}}e.clear()}this.extensions=t,this.options=n,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}dispose(){this.cache.clear(),this.disposeSet.forEach(e=>{typeof e.dispose==`function`&&e.dispose(),typeof e.close==`function`&&e.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:`unknown`}}}markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)}}parse(){let e=this.json,t=this.extensions;this.markDefs();for(let e of Va(t))e.markDefs(this);return Promise.all(Va(t).map(e=>e.prepare(this))).then(()=>{var t,n,r;return Promise.all([Promise.all(((t=e.scenes)==null?[]:t).map((e,t)=>this.loadScene(t))),Promise.all(((n=e.cameras)==null?[]:n).map((e,t)=>this.loadCamera(t))),Promise.all(((r=e.animations)==null?[]:r).map((e,t)=>this.loadAnimation(t)))])}).then(([t,n,r])=>({json:e,scene:t[e.scene||0],scenes:t,animations:r,cameras:n,textures:[],dispose:q})).then(e=>Promise.all(Va(t).map(t=>t.emitResult(e,this))).then(()=>e)).then(e=>{let t=Array.from(this.textureSet),n=Ha(this.disposeSet);return Object.assign(e,{textures:t,dispose:n}),this.textureSet.clear(),this.disposeSet.clear(),this.dispose(),e})}loadCamera(e){let t=`camera:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadCamera(e,this),r)break;if(!r){let t,n=this.json.cameras[e],i=n[n.type];i?n.type===`perspective`?t=new c.PerspectiveCamera(c.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type===`orthographic`?t=new c.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar):(console.warn(`glTF: Invalid camera type ${n.type}.`),t=new c.Camera):(console.warn(`glTF: Missing camera parameters.`),t=new c.Camera),n.name&&(t.name=n.name),r=Promise.resolve(t)}return this.cache.set(t,r),r}loadSkin(e){let t=`skin:`+e,n=this.cache.get(t);if(n)return n;let r,i=this.json.skins[e],a={joints:i.joints};return r=i.inverseBindMatrices===void 0?Promise.resolve(a):this.loadAccessor(i.inverseBindMatrices).then(e=>(e&&(a.inverseBindMatrices=e),a)),this.cache.set(t,r),r}loadAnimation(e){var t;let n=`animation:`+e,r=this.cache.get(n);if(r)return r;let i=null;for(let t of Va(this.extensions))if(i=t.loadAnimation(e,this),i)break;if(!i){let n=this.json.animations[e],r=n.name?n.name:`animation_`+e,a=[],o=[],s=[],l=[],u=[];for(let e=0,r=n.channels.length;e<r;e++){let r=n.channels[e],i=n.samplers[r.sampler],c=r.target,d=c.node===void 0?c.id:c.node,f=n.parameters===void 0?i.input:n.parameters[i.input],p=n.parameters===void 0?i.output:n.parameters[i.output],m=(t=c.extensions)==null?{}:t;if(c.path===`pointer`&&m.KHR_animation_pointer&&m.KHR_animation_pointer.pointer&&/^\/nodes\/\d+\//.test(m.KHR_animation_pointer.pointer)){let e=m.KHR_animation_pointer.pointer.slice(1).split(`/`),t=Number(e[1]);a.push(this.loadNode(t))}else d===void 0?a.push(Promise.resolve(null)):a.push(this.loadNode(d));o.push(this.loadAccessor(f)),s.push(this.loadAccessor(p)),l.push(i),u.push(c)}i=Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(u)]).then(([e,t,n,i,a])=>{var o;let s=[];for(let r=0,l=e.length;r<l;r++){let l=e[r],u=t[r],d=n[r],f=i[r],p=a[r];l&&(l.updateMatrix(),l.matrixAutoUpdate=!0);let m=d.array;if(d.normalized){let e=Wa(m.constructor),t=new Float32Array(m.length);for(let n=0,r=m.length;n<r;n++)t[n]=m[n]*e;m=t}let h=f.interpolation===void 0?c.InterpolateLinear:za[f.interpolation],g=(o=p.extensions)==null?{}:o;if(g.KHR_animation_pointer&&p.path&&p.path===`pointer`){let e=g.KHR_animation_pointer.pointer;if(e.indexOf(`/nodes/`)===0){let t=e.match(/^\/nodes\/(\d+)\/(.+)/);if(!t)continue;Number(t[1]);let n=t[2],r;switch(n){case`weights`:n=`morphTargetInfluences`,r=c.NumberKeyframeTrack;break;case`rotation`:n=`quaternion`,r=c.QuaternionKeyframeTrack;break;case`translation`:n=`position`,r=c.VectorKeyframeTrack;break;case`scale`:n=`scale`,r=c.VectorKeyframeTrack;break;case`extensions/KHR_node_visibility/visible`:n=`visible`,r=c.BooleanKeyframeTrack;break;default:break}if(!r)continue;let i=[];if(l){let e=l.name?l.name:l.uuid;n===`morphTargetInfluences`?l.traverse(e=>{e.morphTargetInfluences&&i.push(e.name?e.name:e.uuid)}):i.push(e)}for(let e=0,t=i.length;e<t;e++){let t=new r(`.nodes.${i[e]}.${n}`,u.array,r===c.BooleanKeyframeTrack?Array.from(m).map(e=>e>0):m,h);s.push(t)}}else if(e.indexOf(`/materials/`)===0){let t=e.match(/^\/materials\/(\d+)\/(.+)/);if(!t)continue;let n=Number(t[1]),r=t[2],i=this.json.materials[n].name,a;switch(r){case`pbrMetallicRoughness/baseColorFactor`:r=`color`,a=c.ColorKeyframeTrack;break;case`pbrMetallicRoughness/roughnessFactor`:r=`roughness`,a=c.NumberKeyframeTrack;break;case`pbrMetallicRoughness/metallicFactor`:r=`metalness`,a=c.NumberKeyframeTrack;break;case`emissiveFactor`:r=`emissive`,a=c.NumberKeyframeTrack;break;case`alphaCutoff`:r=`alphaTest`,a=c.NumberKeyframeTrack;break;case`occlusionTexture/strength`:r=`aoMapIntensity`,a=c.NumberKeyframeTrack;break;case`normalTexture/scale`:r=`normalScale`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale`:r=`map.repeat`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset`:r=`map.offset`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation`:r=`map.rotation`,a=c.NumberKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/scale`:r=`normalMap.repeat`,a=c.VectorKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/offset`:r=`normalMap.offset`,a=c.VectorKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/rotation`:r=`normalMap.rotation`,a=c.NumberKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/scale`:r=`emissiveMap.repeat`,a=c.VectorKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/offset`:r=`emissiveMap.offset`,a=c.VectorKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/rotation`:r=`emissiveMap.rotation`,a=c.NumberKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/scale`:r=`aoMap.repeat`,a=c.VectorKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/offset`:r=`aoMap.offset`,a=c.VectorKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/rotation`:r=`aoMap.rotation`,a=c.NumberKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale`:r=`clearcoatNormalMap.scale`,a=c.NumberKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset`:r=`clearcoatNormalMap.offset`,a=c.VectorKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation`:r=`clearcoatNormalMap.rotation`,a=c.NumberKeyframeTrack;break;default:break}if(!a)continue;let o=new a(`.materials.${i}.${r}`,u.array,m,h);if(s.push(o),r===`color`&&d.itemSize===4){let e=new Float32Array(m.length/4);for(let t=0,n=m.length/4;t<n;t+=1)e[t]=m[t*4+3];let t=new c.NumberKeyframeTrack(`.materials.${i}.opacity`,u.array,e,h);s.push(t)}}else if(e.indexOf(`/cameras/`)===0){let t=e.match(/^\/cameras\/(\d+)\/(.+)/);if(!t)continue;let n=Number(t[1]),r=t[2],i=this.json.cameras[n].name,a;switch(r){case`perspective/yfov`:r=`fov`,a=c.NumberKeyframeTrack;break;case`perspective/znear`:case`orthographic/znear`:r=`near`,a=c.NumberKeyframeTrack;break;case`perspective/zfar`:case`orthographic/zfar`:r=`far`,a=c.NumberKeyframeTrack;break;case`perspective/aspect`:r=`aspect`,a=c.NumberKeyframeTrack;break;default:break}if(!a)continue;let o=new a(`.cameras.${i}.${r}`,u.array,m,h);s.push(o)}}else{let e;switch(Ra[p.path]){case Ra.weights:e=c.NumberKeyframeTrack;break;case Ra.rotation:e=c.QuaternionKeyframeTrack;break;case Ra.position:case Ra.scale:default:e=c.VectorKeyframeTrack;break}let t=[];if(l){let e=l.name?l.name:l.uuid;Ra[p.path]===Ra.weights?l.traverse(e=>{e.morphTargetInfluences&&t.push(e.name?e.name:e.uuid)}):t.push(e)}let n=d.array;if(d.normalized){let e=Wa(n.constructor),t=new Float32Array(n.length);for(let r=0,i=n.length;r<i;r++)t[r]=n[r]*e;n=t}for(let r=0,i=t.length;r<i;r++){let i=new e(t[r]+`.`+Ra[p.path],u.array,n,h);s.push(i)}}}return new c.AnimationClip(r,void 0,s)})}return this.cache.set(n,i),i}loadBuffer(e){let t=this.json.buffers[e];if(t.type&&t.type!==`arraybuffer`)throw Error(`glTF: `+t.type+` buffer type is not supported.`);let n=`buffer:`+e,r=this.cache.get(n);if(r)return r;let i=null;for(let t of Va(this.extensions))if(i=t.loadBuffer(e,this),i)break;if(!i){let t=this.json.buffers[e];i=this.options.fetcher.ajax(this.resolveResouce(t.uri),{responseType:`arraybuffer`}).then(e=>e.body)}return this.cache.set(n,i),i}loadBufferView(e){let t=`bufferView:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadBufferView(e,this),r)break;if(!r){let t=this.json.bufferViews[e];r=this.loadBuffer(t.buffer).then(e=>{let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}return this.cache.set(t,r),r}loadAccessor(e){let t=`accessor:`+e,n=this.cache.get(t);if(n)return n;let r=null;if(!r){let t=this.json.accessors[e];if(t.bufferView===void 0&&t.sparse===void 0)r=Promise.resolve(null);else{let e=[];t.bufferView===void 0?e.push(Promise.resolve(null)):e.push(this.loadBufferView(t.bufferView)),t.sparse!==void 0&&(e.push(this.loadBufferView(t.sparse.indices.bufferView)),e.push(this.loadBufferView(t.sparse.values.bufferView))),r=Promise.all(e).then(e=>{let n=e[0],r=Ia[t.type],i=Na[t.componentType],a=i.BYTES_PER_ELEMENT,o=a*r,s=t.byteOffset||0,l=t.bufferView===void 0?void 0:this.json.bufferViews[t.bufferView].byteStride,u=t.normalized===!0,d,f;if(l&&l!==o){let e=Math.floor(s/l),o=`InterleavedBuffer:`+t.bufferView+`:`+t.componentType+`:`+e+`:`+t.count,p=this.cache.get(o);p||(d=new i(n,e*l,t.count*l/a),p=new c.InterleavedBuffer(d,l/a),this.cache.set(o,p)),f=new c.InterleavedBufferAttribute(p,r,s%l/a,u)}else d=n===null?new i(t.count*r):new i(n,s,t.count*r),f=new c.BufferAttribute(d,r,u);if(t.sparse!==void 0){let a=Ia.SCALAR,o=Na[t.sparse.indices.componentType],s=t.sparse.indices.byteOffset||0,l=t.sparse.values.byteOffset||0,u=new o(e[1],s,t.sparse.count*a),d=new i(e[2],l,t.sparse.count*r);n!==null&&(f=new c.BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let e=0,t=u.length;e<t;e++){let t=u[e];if(f.setX(t,d[e*r]),r>=2&&f.setY(t,d[e*r+1]),r>=3&&f.setZ(t,d[e*r+2]),r>=4&&f.setW(t,d[e*r+3]),r>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}}return f})}}return this.cache.set(t,r),r}createPrimitiveKey(e){for(let t of Va(this.extensions)){let n=t.createPrimitiveKey(e,this);if(n)return n}let t=``,n=Object.keys(e.attributes).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e.attributes[n[r]]+`;`;return e.indices+`:`+t+`:`+e.mode}loadGeometry(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadGeometry(e,this),t)break;return t||(t=this.addGeometryPrimitiveAttributes(new c.BufferGeometry,e)),t=t.then(e=>(this.disposeSet.add(e),e)),t}loadImage(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadImage(e,this),t)break;if(!t){let n=this.json.images[e];if(n.bufferView!==void 0){let e=this.json.bufferViews[n.bufferView];t=this.loadBuffer(e.buffer).then(t=>{let r=e.byteOffset||0,i=e.byteLength||0,a=new Uint8Array(t,r,i);return li(new Blob([a],{type:n.mimeType}))})}else if(n.uri){let e=this.resolveResouce(n.uri);t=si()?this.options.fetcher.ajax(e,{responseType:`blob`}).then(e=>{let t=e.body;return li(t)}):this.options.fetcher.loadImage(e,{},void 0,void 0,void 0,ci()).then(e=>e.body)}else throw Error(`glTF: Invalid image defs.`)}return t=t.then(e=>(this.disposeSet.add(e),e)),t}loadMesh(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadMesh(e,this),t)break;if(!t){let n=this.json.meshes[e],r=n.primitives,i=Promise.all(r.map(e=>this.loadGeometry(e))),a=Promise.all(r.map(e=>this.loadMaterial(e)));t=Promise.all([i,a]).then(([t,i])=>{var a;let o=[];for(let s=0;s<r.length;s++){let l=r[s],u=t[s],d=i[s],f=(a=l.mode)==null?Ma.TRIANGLES:a,p;if(f===Ma.TRIANGLES||f===Ma.TRIANGLE_STRIP||f===Ma.TRIANGLE_FAN)if(f===Ma.TRIANGLE_STRIP?u=this.toGeometryTrianglesDrawMode(u,c.TriangleStripDrawMode):f===Ma.TRIANGLE_FAN&&(u=this.toGeometryTrianglesDrawMode(u,c.TriangleFanDrawMode)),u.clearGroups(),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),this.disposeSet.add(u),n.isSkinnedMesh){let e=new bn(u,[d]);this.normalizeSkinWeights(e),p=e}else p=new yn(u,[d]);else if(f===Ma.LINES)p=new c.LineSegments(u,d);else if(f===Ma.LINE_STRIP)p=new c.Line(u,d);else if(f===Ma.LINE_LOOP)p=new c.LineLoop(u,d);else if(f===Ma.POINTS)p=new kn(u,d);else throw Error(`glTF: Primitive mode unsupported: `+f);if(Object.keys(u.morphAttributes).length>0){if(n.weights!==void 0)for(let e=0,t=n.weights.length;e<t;e++)p.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){let e=n.extras.targetNames;if(p.morphTargetInfluences.length===e.length){p.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++)p.morphTargetDictionary[e[t]]=t}else console.warn(`glTF: Invalid extras.targetNames length. Ignoring names.`)}}p.name=n.name||`mesh_`+e,this.assignFinalMaterial(p),o.push(p)}if(o.length===1)return o[0];let s=new c.Group;for(let e of o)s.add(e);return s})}return t}loadMaterial(e){var t;let n=(t=e.mode)==null?Ma.TRIANGLES:t,r=`material:`+this.createPrimitiveKey(e),i=this.cache.get(r);if(i)return i;let a=null;for(let t of Va(this.extensions))if(a=t.loadMaterial(e,this),a)break;if(!a){if(n===Ma.TRIANGLES||n===Ma.TRIANGLE_STRIP||n===Ma.TRIANGLE_FAN)a=this.loadMaterialAsPBMMeshMaterial(e);else if(n===Ma.LINES||n===Ma.LINE_STRIP||n===Ma.LINE_LOOP)a=this.loadMaterialAsLineBasicMaterial(e);else if(n===Ma.POINTS)a=this.loadMaterialAsPBMPointCloudMaterial(e);else throw Error(`glTF: Primitive mode unsupported: `+n);a=a.then(t=>Promise.all(Va(this.extensions).map(n=>n.extendMaterial(t,e,this))).then(()=>t))}return a}loadMaterialAsPBMPointCloudMaterial(e){let t=new On;return this.disposeSet.add(t),Promise.resolve(t)}loadMaterialAsPBMMeshMaterial(e){let t=[],n=new vn(`standard`);if(n.color=new c.Color(1,1,1),n.opacity=1,n.colorAlpha=1,e.material!==void 0){let r=this.json.materials[e.material];r.name&&(n.name=r.name);let i=r.pbrMetallicRoughness||{};if(Array.isArray(i.baseColorFactor)){let e=i.baseColorFactor;n.color=new c.Color().fromArray(e),n.colorAlpha=e[3]}i.baseColorTexture!==void 0&&t.push(this.createMaterialTexture(i.baseColorTexture).then(e=>{e.encoding=c.sRGBEncoding,n.map=e,r.alphaMode===Ba.MASK&&!(e instanceof c.CompressedTexture)&&e.minFilter!==c.LinearMipmapLinearFilter&&(e.minFilter=c.LinearMipmapLinearFilter,e.generateMipmaps=!0),this.disposeSet.add(e)})),n.metalness=i.metallicFactor===void 0?1:i.metallicFactor,n.roughness=i.roughnessFactor===void 0?1:i.roughnessFactor,i.metallicRoughnessTexture!==void 0&&t.push(this.createMaterialTexture(i.metallicRoughnessTexture).then(e=>{e.format=c.RGBFormat,n.roughnessMap=e,n.metalnessMap=e,this.disposeSet.add(e)})),r.doubleSided===!0&&(n.side=c.DoubleSide);let a=r.alphaMode||Ba.OPAQUE;if(n.alphaMode=`OPAQUE`,a===Ba.BLEND?(n.alphaMode=`BLEND`,n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,a===Ba.MASK&&(n.alphaMode=`MASK`,n.alphaTest=r.alphaCutoff===void 0?.5:r.alphaCutoff)),r.normalTexture!==void 0&&(t.push(this.createMaterialTexture(r.normalTexture).then(e=>{this.disposeSet.add(e),n.normalMap=e})),n.normalScale=new c.Vector2(1,1),r.normalTexture.scale!==void 0)){let e=r.normalTexture.scale;n.normalScale.set(e,e)}r.occlusionTexture!==void 0&&(t.push(this.createMaterialTexture(r.occlusionTexture).then(e=>{e.format=c.RGBFormat,n.aoMap=e,this.disposeSet.add(e)})),r.occlusionTexture.strength!==void 0&&(n.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&(n.emissive=new c.Color().fromArray(r.emissiveFactor)),r.emissiveTexture!==void 0&&t.push(this.createMaterialTexture(r.emissiveTexture).then(e=>{e.format=c.RGBFormat,n.emissiveMap=e,this.disposeSet.add(e)}))}return this.disposeSet.add(n),Promise.all(t).then(()=>n)}loadMaterialAsLineBasicMaterial(e){let t=[],n=new c.LineBasicMaterial;if(n.color=new c.Color(1,1,1),n.opacity=1,e.material!==void 0){let t=this.json.materials[e.material];t.name&&(n.name=t.name);let r=t.pbrMetallicRoughness||{};if(Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;n.color.fromArray(e),n.opacity=e[3]}t.doubleSided===!0&&(n.side=c.DoubleSide);let i=t.alphaMode||Ba.OPAQUE;i===Ba.BLEND?(n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,i===Ba.MASK&&(n.alphaTest=t.alphaCutoff===void 0?.5:t.alphaCutoff))}return this.disposeSet.add(n),Promise.all(t).then(()=>n)}loadTexture(e){let t=`texture:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadTexture(e,this),r)break;if(!r){let t=this.json.textures[e];r=this.loadImage(t.source).then(e=>{let n=new c.Texture(e);n.needsUpdate=!0,n.flipY=!1,t.name&&(n.name=t.name);let r=(this.json.samplers||{})[t.sampler]||{};return n.magFilter=Pa[r.magFilter]||c.LinearFilter,n.minFilter=Pa[r.minFilter]||c.LinearMipmapLinearFilter,n.wrapS=Fa[r.wrapS]||c.RepeatWrapping,n.wrapT=Fa[r.wrapT]||c.RepeatWrapping,n.onUpdate=function(){e.close()},n})}return r=r.then(e=>(this.disposeSet.add(e),e)),this.cache.set(t,r),r}normalizeSkinWeights(e){let t=e.geometry.attributes.skinWeight;if(!t.normalized)e.normalizeSkinWeights();else{let e=0;if(t.array instanceof Uint8Array)e=255;else if(t.array instanceof Uint16Array)e=65535;else if(t.array instanceof Uint32Array)e=4294967295;else return;let n=new c.Vector4;for(let r=0,i=t.count;r<i;r++){n.x=t.getX(r),n.y=t.getY(r),n.z=t.getZ(r),n.w=t.getW(r);let i=e/n.manhattanLength();i!==1&&(!isNaN(i)&&isFinite(i)?n.multiplyScalar(i):n.set(e,0,0,0),t.setXYZW(r,n.x,n.y,n.z,n.w))}}}assignFinalMaterial(e){let t=e.geometry,n=[].concat(e.material),r=t.attributes.tangent!==void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0,o=e instanceof c.SkinnedMesh,s=Object.keys(t.morphAttributes).length>0,l=s&&t.morphAttributes.normal!==void 0;n=n.map(e=>{if(r||i||a||o||s||l){let t=`cloned-material:`+e.uuid+`:`;r&&(t+=`vertex-tangents:`),i&&(t+=`vertex-colors:`),a&&(t+=`flat-shading:`),o&&(t+=`skinning:`),s&&(t+=`morph-targets:`),l&&(t+=`morph-normals:`);let n=this.cache.get(t);n||(n=e.clone(),r&&(n.vertexTangents=!0),i&&(n.vertexColors=!0),a&&(n.flatShading=!0),o&&(n.skinning=!0),s&&(n.morphTargets=!0),l&&(n.morphNormals=!0),r&&(n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.set(t,n)),e=n}return e}),Array.isArray(e.material)?e.material=n:e.material=n[0]}loadNodeAttachments(e){let t=[];for(let n of Va(this.extensions)){let r=n.loadNodeAttachments(e,this);r&&t.push(r)}return t}loadNode(e){let t=`node:`+e,n=this.cache.get(t);if(n)return n;let r=this.json.nodes[e],i=[];r.mesh!==void 0&&i.push(this.loadMesh(r.mesh).then(e=>{if(r.weights!==void 0){let t=r.weights;e.traverse(e=>{if(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)for(let n=0,r=t.length;n<r;n++)e.morphTargetInfluences[n]=t[n]})}return e})),r.camera!==void 0&&i.push(this.loadCamera(r.camera));let a=this.loadNodeAttachments(e);for(let e of a)i.push(e);let o=Promise.all(i).then(e=>{let t;if(t=r.isBone===!0?new c.Bone:e.length>1?new c.Group:e.length===1?e[0]:new c.Object3D,t!==e[0])for(let n=0,r=e.length;n<r;n++)t.add(e[n]);if(r.name&&(t.userData.name=r.name,t.name=c.PropertyBinding.sanitizeNodeName(r.name)),r.matrix!==void 0){let e=new c.Matrix4;e.fromArray(r.matrix),t.applyMatrix4(e)}else r.translation!==void 0&&t.position.fromArray(r.translation),r.rotation!==void 0&&t.quaternion.fromArray(r.rotation),r.scale!==void 0&&t.scale.fromArray(r.scale);return o=o.then(e=>Promise.all(Va(this.extensions).map(t=>t.extendNode(e,r,this))).then(()=>e)),t});return this.cache.set(t,o),o}loadScene(e){let t=this.json.scenes[e],n=new c.Group;t.name&&(n.name=t.name);let r=t.nodes||[],i=[];for(let e=0,t=r.length;e<t;e++)i.push(this.buildNodeHierarchy(r[e],n));return Promise.all(i).then(()=>n)}createMaterialTexture(e){return this.loadTexture(e.index).then(t=>{t instanceof c.CompressedTexture||(t.minFilter=c.LinearFilter,t.magFilter=c.LinearFilter,t.generateMipmaps=!1);for(let n of Va(this.extensions)){let r=n.extendTexture(t,e,this);r&&(t=r)}return this.textureSet.add(t),this.disposeSet.add(t),t})}addGeometryPrimitiveAttributes(e,t){let n=t.attributes,r=[];for(let t in n){let i=La[t]||t.toLowerCase();i in e.attributes||r.push(this.loadAccessor(n[t]).then(t=>{t&&e.setAttribute(i,t)}))}t.indices!==void 0&&!e.index&&r.push(this.loadAccessor(t.indices).then(t=>{t&&e.setIndex(t)}));let i=new c.Box3;if(n.POSITION!==void 0){let e=this.json.accessors[n.POSITION],t=e.min,r=e.max;if(t!==void 0&&r!==void 0){if(i.set(new c.Vector3(t[0],t[1],t[2]),new c.Vector3(r[0],r[1],r[2])),e.normalized){let t=Wa(Na[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else console.warn(`glTF: Missing min/max properties for accessor POSITION.`)}let a=t.targets;if(a!==void 0){let e=new c.Vector3,t=new c.Vector3;for(let n=0,r=a.length;n<r;n++){let r=a[n];if(r.POSITION!==void 0){let n=this.json.accessors[r.POSITION],i=n.min,a=n.max;if(i!==void 0&&a!==void 0){if(t.setX(Math.max(Math.abs(i[0]),Math.abs(a[0]))),t.setY(Math.max(Math.abs(i[1]),Math.abs(a[1]))),t.setZ(Math.max(Math.abs(i[2]),Math.abs(a[2]))),n.normalized){let e=Wa(Na[n.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`glTF: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new c.Sphere;return i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o,Promise.all(r).then(()=>{let n=!1;if(t.material!==void 0&&this.json.materials[t.material].occlusionTexture&&(n=!0),(n||this.options.copyUV2)&&e.attributes.uv&&!e.attributes.uv2&&e.setAttribute(`uv2`,e.attributes.uv),t.targets){let n=!1,r=!1;for(let e=0,i=t.targets.length;e<i;e++){let i=t.targets[e];if(i.POSITION!==void 0&&(n=!0),i.NORMAL!==void 0&&(r=!0),n&&r)break}if(!n&&!r)return e;let i=[];e.morphTargetsRelative=!0;for(let a=0,o=t.targets.length;a<o;a++){let o=t.targets[a];n?i.push(this.loadAccessor(o.POSITION).then(t=>{t&&(e.morphAttributes.position=e.morphAttributes.position||[],e.morphAttributes.position[a]=t)})):e.attributes.position&&(e.morphAttributes.position=e.morphAttributes.position||[],e.morphAttributes.position[a]=e.attributes.position),r?i.push(this.loadAccessor(o.NORMAL).then(t=>{t&&(e.morphAttributes.normal=e.morphAttributes.normal||[],e.morphAttributes.normal[a]=t)})):e.attributes.normal&&(e.morphAttributes.normal=e.morphAttributes.normal||[],e.morphAttributes.normal[a]=e.attributes.normal)}return Promise.all(i).then(()=>e)}else return e})}buildNodeHierarchy(e,t){let n=this.json.nodes[e];return this.loadNode(e).then(e=>{if(n.skin===void 0)return e;let t;return this.loadSkin(n.skin).then(e=>{t=e;let n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this.loadNode(t.joints[e]));return Promise.all(n)}).then(n=>(e.traverse(e=>{if(!(e instanceof c.SkinnedMesh))return;let r=[],i=[];for(let e=0,a=n.length;e<a;e++){let a=n[e];if(a instanceof c.Bone){r.push(a);let n=new c.Matrix4;t.inverseBindMatrices!==void 0&&n.fromArray(t.inverseBindMatrices.array,e*16),i.push(n)}else console.warn(`glTF: Joint "%s" could not be found.`,t.joints[e])}let a=new c.Skeleton(r,i);e.bind(a,e.matrixWorld)}),e))}).then(e=>{t.add(e);let r=[];if(n.children){let t=n.children;for(let n=0,i=t.length;n<i;n++){let i=t[n];r.push(this.buildNodeHierarchy(i,e))}}return Promise.all(r).then(()=>e)})}resolveResouce(e){return/^[a-z]{0,8}\:/i.test(e)?e:br(this.options.resourcePath,xr(e,this.options.search))}toGeometryTrianglesDrawMode(e,t){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}}if(n===null)return console.error(`glTF: Undefined position attribute. Processing not possible.`),e;let r=n.count-2,i=[];if(t===c.TriangleFanDrawMode)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error(`glTF: Unable to generate correct amount of triangles.`);let a=e.clone();return a.setIndex(i),this.disposeSet.add(a),a}};function Wa(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`glTF: Unsupported normalized accessor component type.`)}}var Ga=!1,Ka=null;function qa(){if(Ga)return;Ga=!0;let e=Ka||(Ka=c.PropertyBinding.findNode);c.PropertyBinding.findNode=function(t,n){if(!n)return e(t,n);if(n.startsWith(`.materials.`)){let e=n.substring(11).substring(n.indexOf(`.`)),r=e.indexOf(`.`),i=r<0?e:e.substring(0,r),a=r<0?null:e.slice(r+1),o=null;return t.traverse(e=>{if(o!==null||e.type!==`Mesh`&&e.type!==`SkinnedMesh`)return;let t=[].concat(e.material);for(let e of t)e&&(e.uuid===i||e.name===i)&&(o=e,o!==null&&a&&(o=o[a]))}),o}else if(n.startsWith(`.nodes.`)||n.startsWith(`.lights.`)||n.startsWith(`.cameras.`)){let r=n.split(`.`),i;for(let e=1;e<r.length;e++){let n=r[e];if(n.length==36)i=t.getObjectByProperty(`uuid`,n);else if(i&&i[n]){let e=Number.parseInt(n),t=n;e>=0&&(t=e),i=i[t]}else{let e=t.getObjectByName(n);e&&(i=e)}}if(!i){let i=e(t,r[2]);return i||console.warn(`KHR_animation_pointer: Property binding not found`,n,t,t.name,r),i}return i}let r=e(t,n);return r||(console.error(`THREE.PropertyBinding: Trying to update node for track: `+n+` but it wasn't found.`),r=new c.Object3D,r.name=n,r.visible=!1,t.add(r)),r=e(t,n),r}}qa();var Ja=class{markDefs(e){}prepare(e){}emitResult(e,t){}createPrimitiveKey(e,t){}extendTexture(e,t,n){return null}loadBuffer(e,t){return null}loadBufferView(e,t){return null}loadImage(e,t){return null}loadTexture(e,t){return null}loadGeometry(e,t){return null}loadMaterial(e,t){return null}extendMaterial(e,t,n){return Promise.resolve()}loadMesh(e,t){return null}extendNode(e,t,n){return Promise.resolve()}loadNodeAttachments(e,t){return null}loadCamera(e,t){return null}loadAnimation(e,t){return null}},Ya=`KHR_binary_glTF`,Xa=class e extends Ja{static getMagic(e){return ja(new Uint8Array(e.slice(0,4)))}constructor(){super(),this.header={magic:``,version:0,length:0},this.content=``,this.body=null}loadGlbBinary(t){let n=new DataView(t,0,e.HEADER_LENGTH);if(this.header={magic:e.getMagic(t),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==e.HEADER_MAGIC)throw Error(`glTF:KHR_binary_glTF: Unsupported.`);if(this.header.version<2)throw Error(`glTF:KHR_binary_glTF: Legacy binary file detected.`);let r=new DataView(t,e.HEADER_LENGTH),i=0,a=null,o=null;for(;i<r.byteLength;){let n=r.getUint32(i,!0);if(i+=4,n===0)continue;let s=r.getUint32(i,!0);if(i+=4,s===e.CHUNK_TYPES.JSON)a=ja(new Uint8Array(t,e.HEADER_LENGTH+i,n));else if(s===e.CHUNK_TYPES.BIN){let r=e.HEADER_LENGTH+i;o=t.slice(r,r+n)}i+=n}if(a===null)throw Error(`glTF:${Ya}: JSON content not found.`);this.content=a,this.body=o}loadBuffer(e,t){return t.json.buffers[e].uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null}clear(){this.body=null,this.content=``}};Xa.HEADER_MAGIC=`glTF`,Xa.HEADER_LENGTH=12,Xa.CHUNK_TYPES={JSON:1313821514,BIN:5130562};var Za=`https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/`,Qa={position:`POSITION`,normal:`NORMAL`,color:`COLOR`,uv:`TEX_COORD`},$a={position:`Float32Array`,normal:`Float32Array`,color:`Float32Array`,uv:`Float32Array`},eo=new class{constructor(){this.decoderPath=Za,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=``}setDecoderPath(e){this.decoderPath=e}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}decodeDracoFile(e,t,n,r){let i={attributeIDs:n||Qa,attributeTypes:r||$a,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t={attributeIDs:Qa,attributeTypes:$a,useUniqueIDs:!1}){for(let e in t.attributeTypes){let n=t.attributeTypes[e];n.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[e]=n.name)}let n,r=this.workerNextTaskID++,i=e.byteLength,a=this._getWorker(r,i).then(i=>(n=i,new Promise((i,a)=>{n._callbacks[r]={resolve:i,reject:a},n.postMessage({type:`decode`,id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),a}_createGeometry(e){let t=new c.BufferGeometry;e.index&&t.setIndex(new c.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n],i=r.name,a=r.array,o=r.itemSize,s=!(a instanceof Float32Array||a instanceof Float64Array);t.setAttribute(i,new c.BufferAttribute(a,o,s))}return t}_initDecoder(){if(this.decoderPending)return this.decoderPending;if(typeof WebAssembly!=`object`||this.decoderConfig.type===`js`)this.decoderPending=pr.ajax(this.decoderPath+`draco_decoder.js`,{responseType:`text`}).then(e=>e.body).then(e=>{let t=[`/* draco decoder */`,e,``,`/* worker */`,to].join(`
362
+ `,qi=typeof Worker<`u`&&typeof Blob<`u`,Ji=``;if(qi)try{let e=new Blob([Ki],{type:`text/javascript`});Ji=URL.createObjectURL(e)}catch(e){}var Yi=class{constructor(){if(!qi)throw Error(`LZMAWorker cannot work in this broswer.`);this.callCounter=0,this.requests={};let e=this.worker=new Worker(Ji);e.onmessage=e=>{let{id:t,result:n,error:r}=e.data,i=this.getKey(t);this.requests[i]&&(r?this.requests[i](Error(r)):this.requests[i](null,n),delete this.requests[i])},e.onerror=e=>console.error(e)}getKey(e){return`key_`+String(e)}decompress(e,t){let n=++this.callCounter;this.requests[this.getKey(n)]=t,this.worker.postMessage({type:`decompress`,id:n,data:e},[e.buffer])}terminate(){this.worker.terminate()}};Yi.support=qi;function Xi(e){return Array.prototype.reduce.call(e,(e,t,n)=>e|t<<n*8,0)}function Zi(e){let t=[],n=e.length;for(let i=0;i<n;i++){let n={data:e[i],offset:0,readByte(){return this.data[this.offset++]}},a=n.data.length,o={data:[],offset:0,writeByte(e){let t=Math.floor(this.offset/a);this.data[t]||(this.data[t]=new Uint8Array(a)),this.data[t][this.offset%a]=e,this.offset++}};Hi.decompressFile(n,o);var r=new Uint8Array(o.offset);for(let e=0;e<o.offset;e++)r[e]=o.data[Math.floor(e/a)][e%a];t.push(r)}return t}function Qi(e){let t=[],n=e.length;for(let r=0;r<n;r++)t.push(new Promise((t,n)=>{let i=new Yi;i.decompress(e[r],(e,r)=>{if(i.terminate(),e)return n(e);t(r)})}));return Promise.all(t)}function $i(e){let t=new Uint8Array(e),n=Xi(t.slice(0,4));if(n>10)return Promise.reject(Error(`LZMA got too many sub chunks.`));let r=[],i=[],a=4+n*4;for(let e=0;e<n;e++)i[e]=Xi(t.slice(4+e*4,8+e*4)),e===n-1?r[e]=t.subarray(a,a+i[e]):r[e]=t.slice(a,a+i[e]),a+=i[e];return Yi.support?Qi(r):Promise.resolve(Zi(r))}function ea(e,t={}){var n,r,i,a,o,s,l;let u=(n=t.upAxis)==null?`Z`:n,d=(r=t.light)==null?!1:r,f=(i=t.fetcher)==null?pr:i,p=(a=t.onDownloadProgress)==null?q:a,m=(o=t.textureBaseUri)==null?ji(e):o,h=t.textureBaseUri===void 0?[]:((s=t.textureArray)==null?[]:s).slice(),g=Bi((l=t.textureOptions)==null?{}:l,h.length),_=new Map;for(let e of h){let t=vr(e)?e:br(m,e);_.set(t,Ri(t,g,f))}let v={byteLength:0};return Promise.resolve().then(()=>f.ajax(e,{responseType:`arraybuffer`},void 0,void 0,p)).then(e=>$i(e.body)).then(e=>{let t={chunks:[],createAt:void 0,description:void 0};for(let n of e){let e=yi.decode(n);if(e.chunks.length){for(let n=0;n<e.chunks.length;n++)t.chunks.push(e.chunks[n]);t.createAt=e.createAt,t.description=e.description}}return t}).then(e=>zi(e,d,m,h,g,_,f)).then(t=>{_.clear();let n=new c.Group;n.name=e;for(let e of t.objects)n.add(e);return u===`Y`&&n.applyMatrix4(Zn),{type:`at3d`,modelUpAxis:`Z`,upAxis:u,uri:e,byteLength:v.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}var ta=l.Reader,na=l.util,Y=l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto`]||(l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto`]={}),ra=Y.Model=(()=>{function e(e){if(this.meshes=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.meshes=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Model;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.meshes&&i.meshes.length||(i.meshes=[]),i.meshes.push(Y.Mesh.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Model`},e})();Y.Mesh=(()=>{function e(e){if(this.chunks=[],this.matrix=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.name=``,e.prototype.chunks=na.emptyArray,e.prototype.matrix=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Mesh;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.name=e.string();break;case 2:i.chunks&&i.chunks.length||(i.chunks=[]),i.chunks.push(Y.Chunk.decode(e,e.uint32()));break;case 3:i.matrix&&i.matrix.length||(i.matrix=[]),i.matrix.push(Y.Matrix.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`name`))throw na.ProtocolError(`missing required 'name'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Mesh`},e})(),Y.Matrix=(()=>{function e(e){if(this.elements=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.elements=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Matrix;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.elements&&i.elements.length||(i.elements=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.elements.push(e.float())}else i.elements.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Matrix`},e})(),Y.Chunk=(()=>{function e(e){if(this.material=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.geometry=null,e.prototype.material=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Chunk;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 2:i.geometry=Y.Geometry.decode(e,e.uint32());break;case 3:i.material&&i.material.length||(i.material=[]),i.material.push(Y.Material.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`geometry`))throw na.ProtocolError(`missing required 'geometry'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Chunk`},e})(),Y.Geometry=(()=>{function e(e){if(this.groups=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.position=null,e.prototype.uv=null,e.prototype.uv2=null,e.prototype.normal=null,e.prototype.groups=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Geometry;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.position=Y.Position.decode(e,e.uint32());break;case 2:i.uv=Y.UV.decode(e,e.uint32());break;case 3:i.uv2=Y.UV.decode(e,e.uint32());break;case 4:i.normal=Y.Normal.decode(e,e.uint32());break;case 5:i.groups&&i.groups.length||(i.groups=[]),i.groups.push(Y.Group.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`position`))throw na.ProtocolError(`missing required 'position'`,{instance:i});if(!i.hasOwnProperty(`normal`))throw na.ProtocolError(`missing required 'normal'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Geometry`},e})(),Y.Position=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Position;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Position`},e})(),Y.UV=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.UV;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/UV`},e})(),Y.Normal=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Normal;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Normal`},e})(),Y.Group=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.start=0,e.prototype.count=0,e.prototype.materialIndex=0,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Group;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.start=e.uint32();break;case 2:i.count=e.uint32();break;case 3:i.materialIndex=e.uint32();break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`start`))throw na.ProtocolError(`missing required 'start'`,{instance:i});if(!i.hasOwnProperty(`count`))throw na.ProtocolError(`missing required 'count'`,{instance:i});if(!i.hasOwnProperty(`materialIndex`))throw na.ProtocolError(`missing required 'materialIndex'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Group`},e})(),Y.Material=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.kd=null,e.prototype.ks=null,e.prototype.ke=null,e.prototype.mapkd=``,e.prototype.mapks=``,e.prototype.mapke=``,e.prototype.norm=``,e.prototype.mapbump=``,e.prototype.bump=``,e.prototype.mapd=``,e.prototype.ns=0,e.prototype.d=0,e.prototype.tr=0,e.prototype.mapkdrepeat=``,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Material;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.kd=Y.Color.decode(e,e.uint32());break;case 2:i.ks=Y.Color.decode(e,e.uint32());break;case 3:i.ke=Y.Color.decode(e,e.uint32());break;case 4:i.mapkd=e.string();break;case 5:i.mapks=e.string();break;case 6:i.mapke=e.string();break;case 7:i.norm=e.string();break;case 8:i.mapbump=e.string();break;case 9:i.bump=e.string();break;case 10:i.mapd=e.string();break;case 11:i.ns=e.float();break;case 12:i.d=e.float();break;case 13:i.tr=e.float();break;case 14:i.mapkdrepeat=e.string();break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Material`},e})(),Y.Color=(()=>{function e(e){if(this.rgb=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.rgb=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Color;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.rgb&&i.rgb.length||(i.rgb=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.rgb.push(e.float())}else i.rgb.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Color`},e})();function ia(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(e=>{var n,r;return l.byteLength=e.body.byteLength,ua(new Uint8Array(e.body),(n=t.light)==null?!0:n,t.textureBaseUri||``,(r=t.textureOptions)==null?{}:r,o)}).then(t=>{let n=new c.Group;n.matrixAutoUpdate=!1,a===`Z`&&n.applyMatrix4(Xn),n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(let e of t.objects)n.add(e);return{type:`dome`,modelUpAxis:`Y`,upAxis:a,uri:e,byteLength:l.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}function aa(e){let t=[0,0,0];for(let n=0;n<e.attributes.normal.array.length/9;n++)t[0]=e.attributes.normal.array[n*9],t[1]=e.attributes.normal.array[n*9+1],t[2]=e.attributes.normal.array[n*9+2],e.attributes.normal.array[n*9]=e.attributes.normal.array[n*9+6],e.attributes.normal.array[n*9+1]=e.attributes.normal.array[n*9+7],e.attributes.normal.array[n*9+2]=e.attributes.normal.array[n*9+8],e.attributes.normal.array[n*9+6]=t[0],e.attributes.normal.array[n*9+7]=t[1],e.attributes.normal.array[n*9+8]=t[2];for(let n=0;n<e.attributes.position.array.length/9;n++)t[0]=e.attributes.position.array[n*9],t[1]=e.attributes.position.array[n*9+1],t[2]=e.attributes.position.array[n*9+2],e.attributes.position.array[n*9]=e.attributes.position.array[n*9+6],e.attributes.position.array[n*9+1]=e.attributes.position.array[n*9+7],e.attributes.position.array[n*9+2]=e.attributes.position.array[n*9+8],e.attributes.position.array[n*9+6]=t[0],e.attributes.position.array[n*9+7]=t[1],e.attributes.position.array[n*9+8]=t[2];for(let n=0;n<e.attributes.uv.array.length/6;n++)t[0]=e.attributes.uv.array[n*6],t[1]=e.attributes.uv.array[n*6+1],e.attributes.uv.array[n*6]=e.attributes.uv.array[n*6+4],e.attributes.uv.array[n*6+1]=e.attributes.uv.array[n*6+5],e.attributes.uv.array[n*6+4]=t[0],e.attributes.uv.array[n*6+5]=t[1];e.attributes.normal.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.uv.needsUpdate=!0}function oa({position:e,normal:t,uv:n,uv2:r,groups:i}){let a=new c.BufferGeometry;a.setAttribute(`position`,new c.BufferAttribute(new Float32Array(e.array),3)),t&&a.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(t.array),3)),n&&a.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(n.array),2)),r&&a.setAttribute(`uv2`,new c.BufferAttribute(new Float32Array(r.array),2));for(let e of i)a.addGroup(e.start,e.count,e.materialIndex);return a}function sa(e,t,n,r,i,a,o){if(o.hasOwnProperty(e))return o[e];e=e.split(`?`)[0],vr(e)||(e=br(t,e)),e=e.replace(/\/\/vrlab-image\d*.ljcdn.com\//,`//vrlab-public.ljcdn.com/`),e.indexOf(`//`)===0&&(e=`https:`+e);let s=Object.assign({key:`texture.dome`,size:64},mr(n,[`quality`,`format`,`sharpen`,`forceUseExifOrientation`,`mappings`]));return o[e]=i.loadTexture(e,{imageURL:{transform:n.transform,options:s},wrapS:c.RepeatWrapping,wrapT:c.RepeatWrapping,fetcher:a}).then(e=>{let t=e.body;return r&&t.repeat.copy(r),t.needsUpdate=!0,t.updateMatrix(),t})}function ca(e,t,n,r,i,a,o,s,l){let u=[],d=new vn(t?`phong`:`basic`);if(s.add(d),e.kd&&(d.color=new c.Color().fromArray(e.kd.rgb).convertLinearToSRGB()),e.mapkd){let t=null;if(e.mapkdrepeat){let[n,r]=e.mapkdrepeat.split(/\s+/).map(e=>Number(e));t=new c.Vector2(n,r)}u.push(sa(e.mapkd,n,r,t,i,a,o).then(e=>{e.encoding=c.sRGBEncoding,d.map=e,s.add(e),l.add(e),d.needsUpdate=!0}).catch(q))}if(e.ks&&(d.specular=new c.Color().fromArray(e.ks.rgb).convertLinearToSRGB()),e.mapks&&u.push(sa(e.mapks,n,r,null,i,a,o).then(e=>{d.specularMap=e,s.add(e),l.add(e)}).catch(q)),e.ke&&(d.emissive=new c.Color().fromArray(e.ke.rgb).convertLinearToSRGB()),e.mapke&&u.push(sa(e.mapke,n,r,null,i,a,o).then(e=>{e.encoding=c.sRGBEncoding,d.emissiveMap=e,s.add(e),l.add(e)}).catch(q)),e.norm&&u.push(sa(e.norm,n,r,null,i,a,o).then(e=>{d.normalMap=e,s.add(e),l.add(e)}).catch(q)),e.mapbump&&u.push(sa(e.mapbump,n,r,null,i,a,o).then(e=>{d.bumpMap=e,s.add(e),l.add(e)}).catch(q)),e.bump&&u.push(sa(e.bump,n,r,null,i,a,o).then(e=>{d.bumpMap=e,s.add(e),l.add(e)}).catch(q)),typeof e.ns==`number`&&(d.shininess=e.ns),typeof e.d==`number`){let t=e.d;t>0&&t<1&&(d.opacity=t)}return d.floorIndex=0,{material:d,textureReady:Promise.all(u).then(q)}}function la(e){return ra.decode(e).meshes}function ua(e,t,n,r,i){let a=[],o=[],s=new Set,l=la(e),u=new hi,d=new c.Matrix4,f=new c.Vector3,p=new c.Quaternion,m=new c.Vector3,h={},g=new Set;for(let{name:e,chunks:_,matrix:v}of l)if(!(e===`Ceiling`||e===`CeilingDrop`))for(let l of v){d.elements=l.elements;let v=new c.Group;for(let e=0;e<_.length;e++){let a=oa(_[e].geometry);a.applyMatrix4(d),d.decompose(f,p,m),m.x*m.y*m.z<0&&a.attributes.normal&&a.attributes.position&&a.attributes.uv&&aa(a),s.add(a);let c=[];for(let a of _[e].material){let{material:e,textureReady:l}=ca(a,t,n||``,r,u,i,h,s,g);o.push(l),c.push(e)}let l=new yn(a,c);l.name=`chunk_`+e,l.matrix.compose(l.position,l.quaternion,l.scale),l.matrixAutoUpdate=!1,l.frustumCulled=!1,v.add(l)}v.name=e,a.push(v)}return Promise.all(o).catch(q).then(()=>({createAt:0,description:``,objects:a,textures:Array.from(g),dispose:()=>{s.forEach(e=>{e.dispose()}),s.clear()}}))}function da(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(e=>(l.byteLength=e.body.byteLength,$i(e.body))).then(e=>{let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;return e.forEach(e=>{n.set(e,r),r+=e.length}),n}).then(e=>{var n,r;return ua(e,(n=t.light)==null?!0:n,t.textureBaseUri||``,(r=t.textureOptions)==null?{}:r,o)}).then(t=>{let n=new c.Group;n.matrixAutoUpdate=!1,a===`Z`&&n.applyMatrix4(Xn),n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(let e of t.objects)n.add(e);return{type:`domez`,modelUpAxis:`Y`,upAxis:`Z`,uri:e,byteLength:l.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}var fa=4;function pa(e,t,n){let r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=fa,e.version=r.getUint32(n,!0),n+=fa,e.byteLength=r.getUint32(n,!0),n+=fa,e.version!==1)throw Error(`3D Tile Version ${e.version} not supported`);return n}var ma;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(ma||(ma={}));var ha={[ma.DOUBLE]:Float64Array,[ma.FLOAT]:Float32Array,[ma.UNSIGNED_SHORT]:Uint16Array,[ma.UNSIGNED_INT]:Uint32Array,[ma.UNSIGNED_BYTE]:Uint8Array,[ma.BYTE]:Int8Array,[ma.SHORT]:Int16Array,[ma.INT]:Int32Array},ga={DOUBLE:ma.DOUBLE,FLOAT:ma.FLOAT,UNSIGNED_SHORT:ma.UNSIGNED_SHORT,UNSIGNED_INT:ma.UNSIGNED_INT,UNSIGNED_BYTE:ma.UNSIGNED_BYTE,BYTE:ma.BYTE,SHORT:ma.SHORT,INT:ma.INT};function _a(e){let t=ha[e];if(!t)throw Error(`Failed to convert GL type`);return t}function va(e){return _a(e).BYTES_PER_ELEMENT}function ya(e,t,n=0,r){let i=_a(e);return n%va(e)===0?new i(t,n,r==null?(t.byteLength-n)/va(e):r):new i(r?t.slice(n,n+r*va(e)):t.slice(n))}function ba(e){let t=ga[e];if(!t)throw Error(`Failed to convert GL type`);return t}var xa=class{constructor(e,t){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=t;let n=this.getGlobalProperty(`POINTS_LENGTH`,ma.UNSIGNED_INT,1);n&&n.length&&(this.featuresLength=n[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(_a(t))([r]):Array.isArray(r)?new(_a(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=ba(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,o=a[e];return o||(o=ya(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=o),o}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=ya(t,n),r[e]=i),i}},Sa=4,Ca=`b3dm tile in legacy format.`;function wa(e,t,n){let r=new TextDecoder(`utf8`),i=new Uint8Array(e,t,n);return r.decode(i)}function Ta(e,t,n){return n=Ea(e,t,n),n=Da(e,t,n),n=Oa(e,t,n),n}function Ea(e,t,n){let r=new DataView(t),i=0;e.header=e.header||{};let a=r.getUint32(n,!0);n+=Sa;let o=r.getUint32(n,!0);n+=Sa;let s=r.getUint32(n,!0);n+=Sa;let c=r.getUint32(n,!0);return n+=Sa,s>=570425344?(n-=Sa*2,i=a,s=o,c=0,a=0,o=0,console.warn(Ca)):c>=570425344&&(n-=Sa,i=s,s=a,c=o,a=0,o=0,console.warn(Ca)),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=c,e.header.batchLength=i,n}function Da(e,t,n){let{featureTableJsonByteLength:r,featureTableBinaryByteLength:i,batchLength:a}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:a||0},r&&r>0){let i=wa(t,n,r);e.featureTableJson=JSON.parse(i)}n+=r||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0;let o=new xa(e.featureTableJson,e.featureTableBinary);if(Array.isArray(o.json.RTC_CENTER)){let t=o.json.RTC_CENTER;e.rtcCenter=[t[0],t[1],t[2]]}else{let t=o.getGlobalProperty(`RTC_CENTER`,ma.FLOAT,3);t&&(e.rtcCenter=[t[0],t[1],t[2]])}return n}function Oa(e,t,n){let{batchTableJsonByteLength:r,batchTableBinaryByteLength:i}=e.header||{};if(r&&r>0){let a=wa(t,n,r);e.batchTableJson=JSON.parse(a),n+=r,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,n,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=i)}return n}function ka(e,t,n){let r=n===void 0?new Uint8Array(e).subarray(t):new Uint8Array(e).subarray(t,t+n);return new Uint8Array(r).buffer}function Aa(e,t,n){let r=e.byteLength-n;if(r===0)throw Error(`glTF byte length must be greater than 0.`);return n%4!=0&&console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),e.gltfArrayBuffer=ka(t,n,r),e.byteLength}function ja(e){if(typeof TextDecoder<`u`)return new TextDecoder().decode(e);let t=``;for(let n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}var Ma={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Na={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Pa={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},Fa={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},Ia={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},La={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv2`,TEXCOORD_2:`uv3`,TEXCOORD_3:`uv4`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},Ra={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},za={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete},Ba={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`};function Va(e){let t=[];for(let n in e)t.push(e[n]);return t}function Ha(e){let t=Array.from(e);return()=>{for(let e of t)typeof e.dispose==`function`&&e.dispose(),typeof e.close==`function`&&e.close()}}var Ua=class{constructor(e,t,n){if(this.json=e,this.json.materials){let e=new Set;for(let t of this.json.materials){if(typeof t.name!=`string`)continue;let n=0;for(;t.name;){let r=t.name+(n>0?`__${n}`:``);if(!e.has(r)){e.add(r),t.name=r;break}console.warn(`glTF: material name "${t.name}" duplicated.`),n++}}e.clear()}if(this.json.nodes){let e=new Set;for(let t of this.json.nodes){if(typeof t.name!=`string`)continue;let n=0;for(;t.name;){let r=t.name+(n>0?`__${n}`:``);if(!e.has(r)){e.add(r),t.name=r;break}console.warn(`glTF: node name "${t.name}" duplicated.`),n++}}e.clear()}this.extensions=t,this.options=n,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}dispose(){this.cache.clear(),this.disposeSet.forEach(e=>{typeof e.dispose==`function`&&e.dispose(),typeof e.close==`function`&&e.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:`unknown`}}}markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)}}parse(){let e=this.json,t=this.extensions;this.markDefs();for(let e of Va(t))e.markDefs(this);return Promise.all(Va(t).map(e=>e.prepare(this))).then(()=>{var t,n,r;return Promise.all([Promise.all(((t=e.scenes)==null?[]:t).map((e,t)=>this.loadScene(t))),Promise.all(((n=e.cameras)==null?[]:n).map((e,t)=>this.loadCamera(t))),Promise.all(((r=e.animations)==null?[]:r).map((e,t)=>this.loadAnimation(t)))])}).then(([t,n,r])=>({json:e,scene:t[e.scene||0],scenes:t,animations:r,cameras:n,textures:[],dispose:q})).then(e=>Promise.all(Va(t).map(t=>t.emitResult(e,this))).then(()=>e)).then(e=>{let t=Array.from(this.textureSet),n=Ha(this.disposeSet);return Object.assign(e,{textures:t,dispose:n}),this.textureSet.clear(),this.disposeSet.clear(),this.dispose(),e})}loadCamera(e){let t=`camera:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadCamera(e,this),r)break;if(!r){let t,n=this.json.cameras[e],i=n[n.type];i?n.type===`perspective`?t=new c.PerspectiveCamera(c.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type===`orthographic`?t=new c.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar):(console.warn(`glTF: Invalid camera type ${n.type}.`),t=new c.Camera):(console.warn(`glTF: Missing camera parameters.`),t=new c.Camera),n.name&&(t.name=n.name),r=Promise.resolve(t)}return this.cache.set(t,r),r}loadSkin(e){let t=`skin:`+e,n=this.cache.get(t);if(n)return n;let r,i=this.json.skins[e],a={joints:i.joints};return r=i.inverseBindMatrices===void 0?Promise.resolve(a):this.loadAccessor(i.inverseBindMatrices).then(e=>(e&&(a.inverseBindMatrices=e),a)),this.cache.set(t,r),r}loadAnimation(e){var t;let n=`animation:`+e,r=this.cache.get(n);if(r)return r;let i=null;for(let t of Va(this.extensions))if(i=t.loadAnimation(e,this),i)break;if(!i){let n=this.json.animations[e],r=n.name?n.name:`animation_`+e,a=[],o=[],s=[],l=[],u=[];for(let e=0,r=n.channels.length;e<r;e++){let r=n.channels[e],i=n.samplers[r.sampler],c=r.target,d=c.node===void 0?c.id:c.node,f=n.parameters===void 0?i.input:n.parameters[i.input],p=n.parameters===void 0?i.output:n.parameters[i.output],m=(t=c.extensions)==null?{}:t;if(c.path===`pointer`&&m.KHR_animation_pointer&&m.KHR_animation_pointer.pointer&&/^\/nodes\/\d+\//.test(m.KHR_animation_pointer.pointer)){let e=m.KHR_animation_pointer.pointer.slice(1).split(`/`),t=Number(e[1]);a.push(this.loadNode(t))}else d===void 0?a.push(Promise.resolve(null)):a.push(this.loadNode(d));o.push(this.loadAccessor(f)),s.push(this.loadAccessor(p)),l.push(i),u.push(c)}i=Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(u)]).then(([e,t,n,i,a])=>{var o;let s=[];for(let r=0,l=e.length;r<l;r++){let l=e[r],u=t[r],d=n[r],f=i[r],p=a[r];l&&(l.updateMatrix(),l.matrixAutoUpdate=!0);let m=d.array;if(d.normalized){let e=Wa(m.constructor),t=new Float32Array(m.length);for(let n=0,r=m.length;n<r;n++)t[n]=m[n]*e;m=t}let h=f.interpolation===void 0?c.InterpolateLinear:za[f.interpolation],g=(o=p.extensions)==null?{}:o;if(g.KHR_animation_pointer&&p.path&&p.path===`pointer`){let e=g.KHR_animation_pointer.pointer;if(e.indexOf(`/nodes/`)===0){let t=e.match(/^\/nodes\/(\d+)\/(.+)/);if(!t)continue;Number(t[1]);let n=t[2],r;switch(n){case`weights`:n=`morphTargetInfluences`,r=c.NumberKeyframeTrack;break;case`rotation`:n=`quaternion`,r=c.QuaternionKeyframeTrack;break;case`translation`:n=`position`,r=c.VectorKeyframeTrack;break;case`scale`:n=`scale`,r=c.VectorKeyframeTrack;break;case`extensions/KHR_node_visibility/visible`:n=`visible`,r=c.BooleanKeyframeTrack;break;default:break}if(!r)continue;let i=[];if(l){let e=l.name?l.name:l.uuid;n===`morphTargetInfluences`?l.traverse(e=>{e.morphTargetInfluences&&i.push(e.name?e.name:e.uuid)}):i.push(e)}for(let e=0,t=i.length;e<t;e++){let t=new r(`.nodes.${i[e]}.${n}`,u.array,r===c.BooleanKeyframeTrack?Array.from(m).map(e=>e>0):m,h);s.push(t)}}else if(e.indexOf(`/materials/`)===0){let t=e.match(/^\/materials\/(\d+)\/(.+)/);if(!t)continue;let n=Number(t[1]),r=t[2],i=this.json.materials[n].name,a;switch(r){case`pbrMetallicRoughness/baseColorFactor`:r=`color`,a=c.ColorKeyframeTrack;break;case`pbrMetallicRoughness/roughnessFactor`:r=`roughness`,a=c.NumberKeyframeTrack;break;case`pbrMetallicRoughness/metallicFactor`:r=`metalness`,a=c.NumberKeyframeTrack;break;case`emissiveFactor`:r=`emissive`,a=c.NumberKeyframeTrack;break;case`alphaCutoff`:r=`alphaTest`,a=c.NumberKeyframeTrack;break;case`occlusionTexture/strength`:r=`aoMapIntensity`,a=c.NumberKeyframeTrack;break;case`normalTexture/scale`:r=`normalScale`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale`:r=`map.repeat`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset`:r=`map.offset`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation`:r=`map.rotation`,a=c.NumberKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/scale`:r=`normalMap.repeat`,a=c.VectorKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/offset`:r=`normalMap.offset`,a=c.VectorKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/rotation`:r=`normalMap.rotation`,a=c.NumberKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/scale`:r=`emissiveMap.repeat`,a=c.VectorKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/offset`:r=`emissiveMap.offset`,a=c.VectorKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/rotation`:r=`emissiveMap.rotation`,a=c.NumberKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/scale`:r=`aoMap.repeat`,a=c.VectorKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/offset`:r=`aoMap.offset`,a=c.VectorKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/rotation`:r=`aoMap.rotation`,a=c.NumberKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale`:r=`clearcoatNormalMap.scale`,a=c.NumberKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset`:r=`clearcoatNormalMap.offset`,a=c.VectorKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation`:r=`clearcoatNormalMap.rotation`,a=c.NumberKeyframeTrack;break;default:break}if(!a)continue;let o=new a(`.materials.${i}.${r}`,u.array,m,h);if(s.push(o),r===`color`&&d.itemSize===4){let e=new Float32Array(m.length/4);for(let t=0,n=m.length/4;t<n;t+=1)e[t]=m[t*4+3];let t=new c.NumberKeyframeTrack(`.materials.${i}.opacity`,u.array,e,h);s.push(t)}}else if(e.indexOf(`/cameras/`)===0){let t=e.match(/^\/cameras\/(\d+)\/(.+)/);if(!t)continue;let n=Number(t[1]),r=t[2],i=this.json.cameras[n].name,a;switch(r){case`perspective/yfov`:r=`fov`,a=c.NumberKeyframeTrack;break;case`perspective/znear`:case`orthographic/znear`:r=`near`,a=c.NumberKeyframeTrack;break;case`perspective/zfar`:case`orthographic/zfar`:r=`far`,a=c.NumberKeyframeTrack;break;case`perspective/aspect`:r=`aspect`,a=c.NumberKeyframeTrack;break;default:break}if(!a)continue;let o=new a(`.cameras.${i}.${r}`,u.array,m,h);s.push(o)}}else{let e;switch(Ra[p.path]){case Ra.weights:e=c.NumberKeyframeTrack;break;case Ra.rotation:e=c.QuaternionKeyframeTrack;break;case Ra.position:case Ra.scale:default:e=c.VectorKeyframeTrack;break}let t=[];if(l){let e=l.name?l.name:l.uuid;Ra[p.path]===Ra.weights?l.traverse(e=>{e.morphTargetInfluences&&t.push(e.name?e.name:e.uuid)}):t.push(e)}let n=d.array;if(d.normalized){let e=Wa(n.constructor),t=new Float32Array(n.length);for(let r=0,i=n.length;r<i;r++)t[r]=n[r]*e;n=t}for(let r=0,i=t.length;r<i;r++){let i=new e(t[r]+`.`+Ra[p.path],u.array,n,h);s.push(i)}}}return new c.AnimationClip(r,void 0,s)})}return this.cache.set(n,i),i}loadBuffer(e){let t=this.json.buffers[e];if(t.type&&t.type!==`arraybuffer`)throw Error(`glTF: `+t.type+` buffer type is not supported.`);let n=`buffer:`+e,r=this.cache.get(n);if(r)return r;let i=null;for(let t of Va(this.extensions))if(i=t.loadBuffer(e,this),i)break;if(!i){let t=this.json.buffers[e];i=this.options.fetcher.ajax(this.resolveResouce(t.uri),{responseType:`arraybuffer`}).then(e=>e.body)}return this.cache.set(n,i),i}loadBufferView(e){let t=`bufferView:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadBufferView(e,this),r)break;if(!r){let t=this.json.bufferViews[e];r=this.loadBuffer(t.buffer).then(e=>{let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}return this.cache.set(t,r),r}loadAccessor(e){let t=`accessor:`+e,n=this.cache.get(t);if(n)return n;let r=null;if(!r){let t=this.json.accessors[e];if(t.bufferView===void 0&&t.sparse===void 0)r=Promise.resolve(null);else{let e=[];t.bufferView===void 0?e.push(Promise.resolve(null)):e.push(this.loadBufferView(t.bufferView)),t.sparse!==void 0&&(e.push(this.loadBufferView(t.sparse.indices.bufferView)),e.push(this.loadBufferView(t.sparse.values.bufferView))),r=Promise.all(e).then(e=>{let n=e[0],r=Ia[t.type],i=Na[t.componentType],a=i.BYTES_PER_ELEMENT,o=a*r,s=t.byteOffset||0,l=t.bufferView===void 0?void 0:this.json.bufferViews[t.bufferView].byteStride,u=t.normalized===!0,d,f;if(l&&l!==o){let e=Math.floor(s/l),o=`InterleavedBuffer:`+t.bufferView+`:`+t.componentType+`:`+e+`:`+t.count,p=this.cache.get(o);p||(d=new i(n,e*l,t.count*l/a),p=new c.InterleavedBuffer(d,l/a),this.cache.set(o,p)),f=new c.InterleavedBufferAttribute(p,r,s%l/a,u)}else d=n===null?new i(t.count*r):new i(n,s,t.count*r),f=new c.BufferAttribute(d,r,u);if(t.sparse!==void 0){let a=Ia.SCALAR,o=Na[t.sparse.indices.componentType],s=t.sparse.indices.byteOffset||0,l=t.sparse.values.byteOffset||0,u=new o(e[1],s,t.sparse.count*a),d=new i(e[2],l,t.sparse.count*r);n!==null&&(f=new c.BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let e=0,t=u.length;e<t;e++){let t=u[e];if(f.setX(t,d[e*r]),r>=2&&f.setY(t,d[e*r+1]),r>=3&&f.setZ(t,d[e*r+2]),r>=4&&f.setW(t,d[e*r+3]),r>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}}return f})}}return this.cache.set(t,r),r}createPrimitiveKey(e){for(let t of Va(this.extensions)){let n=t.createPrimitiveKey(e,this);if(n)return n}let t=``,n=Object.keys(e.attributes).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e.attributes[n[r]]+`;`;return e.indices+`:`+t+`:`+e.mode}loadGeometry(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadGeometry(e,this),t)break;return t||(t=this.addGeometryPrimitiveAttributes(new c.BufferGeometry,e)),t=t.then(e=>(this.disposeSet.add(e),e)),t}loadImage(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadImage(e,this),t)break;if(!t){let n=this.json.images[e];if(n.bufferView!==void 0){let e=this.json.bufferViews[n.bufferView];t=this.loadBuffer(e.buffer).then(t=>{let r=e.byteOffset||0,i=e.byteLength||0,a=new Uint8Array(t,r,i);return li(new Blob([a],{type:n.mimeType}))})}else if(n.uri){let e=this.resolveResouce(n.uri);t=si()?this.options.fetcher.ajax(e,{responseType:`blob`}).then(e=>{let t=e.body;return li(t)}):this.options.fetcher.loadImage(e,{},void 0,void 0,void 0,ci()).then(e=>e.body)}else throw Error(`glTF: Invalid image defs.`)}return t=t.then(e=>(this.disposeSet.add(e),e)),t}loadMesh(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadMesh(e,this),t)break;if(!t){let n=this.json.meshes[e],r=n.primitives,i=Promise.all(r.map(e=>this.loadGeometry(e))),a=Promise.all(r.map(e=>this.loadMaterial(e)));t=Promise.all([i,a]).then(([t,i])=>{var a;let o=[];for(let s=0;s<r.length;s++){let l=r[s],u=t[s],d=i[s],f=(a=l.mode)==null?Ma.TRIANGLES:a,p;if(f===Ma.TRIANGLES||f===Ma.TRIANGLE_STRIP||f===Ma.TRIANGLE_FAN)if(f===Ma.TRIANGLE_STRIP?u=this.toGeometryTrianglesDrawMode(u,c.TriangleStripDrawMode):f===Ma.TRIANGLE_FAN&&(u=this.toGeometryTrianglesDrawMode(u,c.TriangleFanDrawMode)),u.clearGroups(),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),this.disposeSet.add(u),n.isSkinnedMesh){let e=new bn(u,[d]);this.normalizeSkinWeights(e),p=e}else p=new yn(u,[d]);else if(f===Ma.LINES)p=new c.LineSegments(u,d);else if(f===Ma.LINE_STRIP)p=new c.Line(u,d);else if(f===Ma.LINE_LOOP)p=new c.LineLoop(u,d);else if(f===Ma.POINTS)p=new kn(u,d);else throw Error(`glTF: Primitive mode unsupported: `+f);if(Object.keys(u.morphAttributes).length>0){if(n.weights!==void 0)for(let e=0,t=n.weights.length;e<t;e++)p.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){let e=n.extras.targetNames;if(p.morphTargetInfluences.length===e.length){p.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++)p.morphTargetDictionary[e[t]]=t}else console.warn(`glTF: Invalid extras.targetNames length. Ignoring names.`)}}p.name=n.name||`mesh_`+e,this.assignFinalMaterial(p),o.push(p)}if(o.length===1)return o[0];let s=new c.Group;for(let e of o)s.add(e);return s})}return t}loadMaterial(e){var t;let n=(t=e.mode)==null?Ma.TRIANGLES:t,r=`material:`+this.createPrimitiveKey(e),i=this.cache.get(r);if(i)return i;let a=null;for(let t of Va(this.extensions))if(a=t.loadMaterial(e,this),a)break;if(!a){if(n===Ma.TRIANGLES||n===Ma.TRIANGLE_STRIP||n===Ma.TRIANGLE_FAN)a=this.loadMaterialAsPBMMeshMaterial(e);else if(n===Ma.LINES||n===Ma.LINE_STRIP||n===Ma.LINE_LOOP)a=this.loadMaterialAsLineBasicMaterial(e);else if(n===Ma.POINTS)a=this.loadMaterialAsPBMPointCloudMaterial(e);else throw Error(`glTF: Primitive mode unsupported: `+n);a=a.then(t=>Promise.all(Va(this.extensions).map(n=>n.extendMaterial(t,e,this))).then(()=>t))}return a}loadMaterialAsPBMPointCloudMaterial(e){let t=new On;return this.disposeSet.add(t),Promise.resolve(t)}loadMaterialAsPBMMeshMaterial(e){let t=[],n=new vn(`standard`);if(n.color=new c.Color(1,1,1),n.opacity=1,n.colorAlpha=1,e.material!==void 0){let r=this.json.materials[e.material];r.name&&(n.name=r.name);let i=r.pbrMetallicRoughness||{};if(Array.isArray(i.baseColorFactor)){let e=i.baseColorFactor;n.color=new c.Color().fromArray(e),n.colorAlpha=e[3]}i.baseColorTexture!==void 0&&t.push(this.createMaterialTexture(i.baseColorTexture).then(e=>{e.encoding=c.sRGBEncoding,n.map=e,r.alphaMode===Ba.MASK&&!(e instanceof c.CompressedTexture)&&e.minFilter!==c.LinearMipmapLinearFilter&&(e.minFilter=c.LinearMipmapLinearFilter,e.generateMipmaps=!0),this.disposeSet.add(e)})),n.metalness=i.metallicFactor===void 0?1:i.metallicFactor,n.roughness=i.roughnessFactor===void 0?1:i.roughnessFactor,i.metallicRoughnessTexture!==void 0&&t.push(this.createMaterialTexture(i.metallicRoughnessTexture).then(e=>{e.format=c.RGBFormat,n.roughnessMap=e,n.metalnessMap=e,this.disposeSet.add(e)})),r.doubleSided===!0&&(n.side=c.DoubleSide);let a=r.alphaMode||Ba.OPAQUE;if(n.alphaMode=`OPAQUE`,a===Ba.BLEND?(n.alphaMode=`BLEND`,n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,a===Ba.MASK&&(n.alphaMode=`MASK`,n.alphaTest=r.alphaCutoff===void 0?.5:r.alphaCutoff)),r.normalTexture!==void 0&&(t.push(this.createMaterialTexture(r.normalTexture).then(e=>{this.disposeSet.add(e),n.normalMap=e})),n.normalScale=new c.Vector2(1,1),r.normalTexture.scale!==void 0)){let e=r.normalTexture.scale;n.normalScale.set(e,e)}r.occlusionTexture!==void 0&&(t.push(this.createMaterialTexture(r.occlusionTexture).then(e=>{e.format=c.RGBFormat,n.aoMap=e,this.disposeSet.add(e)})),r.occlusionTexture.strength!==void 0&&(n.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&(n.emissive=new c.Color().fromArray(r.emissiveFactor)),r.emissiveTexture!==void 0&&t.push(this.createMaterialTexture(r.emissiveTexture).then(e=>{e.format=c.RGBFormat,n.emissiveMap=e,this.disposeSet.add(e)}))}return this.disposeSet.add(n),Promise.all(t).then(()=>n)}loadMaterialAsLineBasicMaterial(e){let t=[],n=new c.LineBasicMaterial;if(n.color=new c.Color(1,1,1),n.opacity=1,e.material!==void 0){let t=this.json.materials[e.material];t.name&&(n.name=t.name);let r=t.pbrMetallicRoughness||{};if(Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;n.color.fromArray(e),n.opacity=e[3]}t.doubleSided===!0&&(n.side=c.DoubleSide);let i=t.alphaMode||Ba.OPAQUE;i===Ba.BLEND?(n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,i===Ba.MASK&&(n.alphaTest=t.alphaCutoff===void 0?.5:t.alphaCutoff))}return this.disposeSet.add(n),Promise.all(t).then(()=>n)}loadTexture(e){let t=`texture:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadTexture(e,this),r)break;if(!r){let t=this.json.textures[e];r=this.loadImage(t.source).then(e=>{let n=new c.Texture(e);n.needsUpdate=!0,n.flipY=!1,t.name&&(n.name=t.name);let r=(this.json.samplers||{})[t.sampler]||{};return n.magFilter=Pa[r.magFilter]||c.LinearFilter,n.minFilter=Pa[r.minFilter]||c.LinearMipmapLinearFilter,n.wrapS=Fa[r.wrapS]||c.RepeatWrapping,n.wrapT=Fa[r.wrapT]||c.RepeatWrapping,n.onUpdate=function(){e.close()},n})}return r=r.then(e=>(this.disposeSet.add(e),e)),this.cache.set(t,r),r}normalizeSkinWeights(e){let t=e.geometry,n=t.attributes.skinWeight,r=1;if(n.array instanceof Uint8Array?r=255:n.array instanceof Uint16Array?r=65535:n.array instanceof Uint32Array&&(r=4294967295),r>1){let e=n.count,i=n.itemSize,a=n.normalized,o=new c.BufferAttribute(new Float32Array(e*i),i,a);for(let t=0;t<e;t++)o.setX(t,n.getX(t)/r),o.setY(t,n.getY(t)/r),o.setZ(t,n.getZ(t)/r),o.setW(t,n.getW(t)/r);t.attributes.skinWeight=o}n.normalized||e.normalizeSkinWeights()}assignFinalMaterial(e){let t=e.geometry,n=[].concat(e.material),r=t.attributes.tangent!==void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0,o=e instanceof c.SkinnedMesh,s=Object.keys(t.morphAttributes).length>0,l=s&&t.morphAttributes.normal!==void 0;n=n.map(e=>{if(r||i||a||o||s||l){let t=`cloned-material:`+e.uuid+`:`;r&&(t+=`vertex-tangents:`),i&&(t+=`vertex-colors:`),a&&(t+=`flat-shading:`),o&&(t+=`skinning:`),s&&(t+=`morph-targets:`),l&&(t+=`morph-normals:`);let n=this.cache.get(t);n||(n=e.clone(),r&&(n.vertexTangents=!0),i&&(n.vertexColors=!0),a&&(n.flatShading=!0),o&&(n.skinning=!0),s&&(n.morphTargets=!0),l&&(n.morphNormals=!0),r&&(n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.set(t,n)),e=n}return e}),Array.isArray(e.material)?e.material=n:e.material=n[0]}loadNodeAttachments(e){let t=[];for(let n of Va(this.extensions)){let r=n.loadNodeAttachments(e,this);r&&t.push(r)}return t}loadNode(e){let t=`node:`+e,n=this.cache.get(t);if(n)return n;let r=this.json.nodes[e],i=[];r.mesh!==void 0&&i.push(this.loadMesh(r.mesh).then(e=>{if(r.weights!==void 0){let t=r.weights;e.traverse(e=>{if(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)for(let n=0,r=t.length;n<r;n++)e.morphTargetInfluences[n]=t[n]})}return e})),r.camera!==void 0&&i.push(this.loadCamera(r.camera));let a=this.loadNodeAttachments(e);for(let e of a)i.push(e);let o=Promise.all(i).then(e=>{let t;if(t=r.isBone===!0?new c.Bone:e.length>1?new c.Group:e.length===1?e[0]:new c.Object3D,t!==e[0])for(let n=0,r=e.length;n<r;n++)t.add(e[n]);if(r.name&&(t.userData.name=r.name,t.name=c.PropertyBinding.sanitizeNodeName(r.name)),r.matrix!==void 0){let e=new c.Matrix4;e.fromArray(r.matrix),t.applyMatrix4(e)}else r.translation!==void 0&&t.position.fromArray(r.translation),r.rotation!==void 0&&t.quaternion.fromArray(r.rotation),r.scale!==void 0&&t.scale.fromArray(r.scale);return o=o.then(e=>Promise.all(Va(this.extensions).map(t=>t.extendNode(e,r,this))).then(()=>e)),t});return this.cache.set(t,o),o}loadScene(e){let t=this.json.scenes[e],n=new c.Group;t.name&&(n.name=t.name);let r=t.nodes||[],i=[];for(let e=0,t=r.length;e<t;e++)i.push(this.buildNodeHierarchy(r[e],n));return Promise.all(i).then(()=>n)}createMaterialTexture(e){return this.loadTexture(e.index).then(t=>{t instanceof c.CompressedTexture||(t.minFilter=c.LinearFilter,t.magFilter=c.LinearFilter,t.generateMipmaps=!1);for(let n of Va(this.extensions)){let r=n.extendTexture(t,e,this);r&&(t=r)}return this.textureSet.add(t),this.disposeSet.add(t),t})}addGeometryPrimitiveAttributes(e,t){let n=t.attributes,r=[];for(let t in n){let i=La[t]||t.toLowerCase();i in e.attributes||r.push(this.loadAccessor(n[t]).then(t=>{t&&e.setAttribute(i,t)}))}t.indices!==void 0&&!e.index&&r.push(this.loadAccessor(t.indices).then(t=>{t&&e.setIndex(t)}));let i=new c.Box3;if(n.POSITION!==void 0){let e=this.json.accessors[n.POSITION],t=e.min,r=e.max;if(t!==void 0&&r!==void 0){if(i.set(new c.Vector3(t[0],t[1],t[2]),new c.Vector3(r[0],r[1],r[2])),e.normalized){let t=Wa(Na[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else console.warn(`glTF: Missing min/max properties for accessor POSITION.`)}let a=t.targets;if(a!==void 0){let e=new c.Vector3,t=new c.Vector3;for(let n=0,r=a.length;n<r;n++){let r=a[n];if(r.POSITION!==void 0){let n=this.json.accessors[r.POSITION],i=n.min,a=n.max;if(i!==void 0&&a!==void 0){if(t.setX(Math.max(Math.abs(i[0]),Math.abs(a[0]))),t.setY(Math.max(Math.abs(i[1]),Math.abs(a[1]))),t.setZ(Math.max(Math.abs(i[2]),Math.abs(a[2]))),n.normalized){let e=Wa(Na[n.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`glTF: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new c.Sphere;return i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o,Promise.all(r).then(()=>{let n=!1;if(t.material!==void 0&&this.json.materials[t.material].occlusionTexture&&(n=!0),(n||this.options.copyUV2)&&e.attributes.uv&&!e.attributes.uv2&&e.setAttribute(`uv2`,e.attributes.uv),t.targets){let n=!1,r=!1;for(let e=0,i=t.targets.length;e<i;e++){let i=t.targets[e];if(i.POSITION!==void 0&&(n=!0),i.NORMAL!==void 0&&(r=!0),n&&r)break}if(!n&&!r)return e;let i=[];e.morphTargetsRelative=!0;for(let a=0,o=t.targets.length;a<o;a++){let o=t.targets[a];n?i.push(this.loadAccessor(o.POSITION).then(t=>{t&&(e.morphAttributes.position=e.morphAttributes.position||[],e.morphAttributes.position[a]=t)})):e.attributes.position&&(e.morphAttributes.position=e.morphAttributes.position||[],e.morphAttributes.position[a]=e.attributes.position),r?i.push(this.loadAccessor(o.NORMAL).then(t=>{t&&(e.morphAttributes.normal=e.morphAttributes.normal||[],e.morphAttributes.normal[a]=t)})):e.attributes.normal&&(e.morphAttributes.normal=e.morphAttributes.normal||[],e.morphAttributes.normal[a]=e.attributes.normal)}return Promise.all(i).then(()=>e)}else return e})}buildNodeHierarchy(e,t){let n=this.json.nodes[e];return this.loadNode(e).then(e=>{if(n.skin===void 0)return e;let t;return this.loadSkin(n.skin).then(e=>{t=e;let n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this.loadNode(t.joints[e]));return Promise.all(n)}).then(n=>(e.traverse(e=>{if(!(e instanceof c.SkinnedMesh))return;let r=[],i=[];for(let e=0,a=n.length;e<a;e++){let a=n[e];if(a instanceof c.Bone){r.push(a);let n=new c.Matrix4;t.inverseBindMatrices!==void 0&&n.fromArray(t.inverseBindMatrices.array,e*16),i.push(n)}else console.warn(`glTF: Joint "%s" could not be found.`,t.joints[e])}let a=new c.Skeleton(r,i);e.bind(a,e.matrixWorld)}),e))}).then(e=>{t.add(e);let r=[];if(n.children){let t=n.children;for(let n=0,i=t.length;n<i;n++){let i=t[n];r.push(this.buildNodeHierarchy(i,e))}}return Promise.all(r).then(()=>e)})}resolveResouce(e){return/^[a-z]{0,8}\:/i.test(e)?e:br(this.options.resourcePath,xr(e,this.options.search))}toGeometryTrianglesDrawMode(e,t){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}}if(n===null)return console.error(`glTF: Undefined position attribute. Processing not possible.`),e;let r=n.count-2,i=[];if(t===c.TriangleFanDrawMode)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error(`glTF: Unable to generate correct amount of triangles.`);let a=e.clone();return a.setIndex(i),this.disposeSet.add(a),a}};function Wa(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`glTF: Unsupported normalized accessor component type.`)}}var Ga=!1,Ka=null;function qa(){if(Ga)return;Ga=!0;let e=Ka||(Ka=c.PropertyBinding.findNode);c.PropertyBinding.findNode=function(t,n){if(!n)return e(t,n);if(n.startsWith(`.materials.`)){let e=n.substring(11).substring(n.indexOf(`.`)),r=e.indexOf(`.`),i=r<0?e:e.substring(0,r),a=r<0?null:e.slice(r+1),o=null;return t.traverse(e=>{if(o!==null||e.type!==`Mesh`&&e.type!==`SkinnedMesh`)return;let t=[].concat(e.material);for(let e of t)e&&(e.uuid===i||e.name===i)&&(o=e,o!==null&&a&&(o=o[a]))}),o}else if(n.startsWith(`.nodes.`)||n.startsWith(`.lights.`)||n.startsWith(`.cameras.`)){let r=n.split(`.`),i;for(let e=1;e<r.length;e++){let n=r[e];if(n.length==36)i=t.getObjectByProperty(`uuid`,n);else if(i&&i[n]){let e=Number.parseInt(n),t=n;e>=0&&(t=e),i=i[t]}else{let e=t.getObjectByName(n);e&&(i=e)}}if(!i){let i=e(t,r[2]);return i||console.warn(`KHR_animation_pointer: Property binding not found`,n,t,t.name,r),i}return i}let r=e(t,n);return r||(console.error(`THREE.PropertyBinding: Trying to update node for track: `+n+` but it wasn't found.`),r=new c.Object3D,r.name=n,r.visible=!1,t.add(r)),r=e(t,n),r}}qa();var Ja=class{markDefs(e){}prepare(e){}emitResult(e,t){}createPrimitiveKey(e,t){}extendTexture(e,t,n){return null}loadBuffer(e,t){return null}loadBufferView(e,t){return null}loadImage(e,t){return null}loadTexture(e,t){return null}loadGeometry(e,t){return null}loadMaterial(e,t){return null}extendMaterial(e,t,n){return Promise.resolve()}loadMesh(e,t){return null}extendNode(e,t,n){return Promise.resolve()}loadNodeAttachments(e,t){return null}loadCamera(e,t){return null}loadAnimation(e,t){return null}},Ya=`KHR_binary_glTF`,Xa=class e extends Ja{static getMagic(e){return ja(new Uint8Array(e.slice(0,4)))}constructor(){super(),this.header={magic:``,version:0,length:0},this.content=``,this.body=null}loadGlbBinary(t){let n=new DataView(t,0,e.HEADER_LENGTH);if(this.header={magic:e.getMagic(t),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==e.HEADER_MAGIC)throw Error(`glTF:KHR_binary_glTF: Unsupported.`);if(this.header.version<2)throw Error(`glTF:KHR_binary_glTF: Legacy binary file detected.`);let r=new DataView(t,e.HEADER_LENGTH),i=0,a=null,o=null;for(;i<r.byteLength;){let n=r.getUint32(i,!0);if(i+=4,n===0)continue;let s=r.getUint32(i,!0);if(i+=4,s===e.CHUNK_TYPES.JSON)a=ja(new Uint8Array(t,e.HEADER_LENGTH+i,n));else if(s===e.CHUNK_TYPES.BIN){let r=e.HEADER_LENGTH+i;o=t.slice(r,r+n)}i+=n}if(a===null)throw Error(`glTF:${Ya}: JSON content not found.`);this.content=a,this.body=o}loadBuffer(e,t){return t.json.buffers[e].uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null}clear(){this.body=null,this.content=``}};Xa.HEADER_MAGIC=`glTF`,Xa.HEADER_LENGTH=12,Xa.CHUNK_TYPES={JSON:1313821514,BIN:5130562};var Za=`https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/`,Qa={position:`POSITION`,normal:`NORMAL`,color:`COLOR`,uv:`TEX_COORD`},$a={position:`Float32Array`,normal:`Float32Array`,color:`Float32Array`,uv:`Float32Array`},eo=new class{constructor(){this.decoderPath=Za,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=``}setDecoderPath(e){this.decoderPath=e}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}decodeDracoFile(e,t,n,r){let i={attributeIDs:n||Qa,attributeTypes:r||$a,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t={attributeIDs:Qa,attributeTypes:$a,useUniqueIDs:!1}){for(let e in t.attributeTypes){let n=t.attributeTypes[e];n.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[e]=n.name)}let n,r=this.workerNextTaskID++,i=e.byteLength,a=this._getWorker(r,i).then(i=>(n=i,new Promise((i,a)=>{n._callbacks[r]={resolve:i,reject:a},n.postMessage({type:`decode`,id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),a}_createGeometry(e){let t=new c.BufferGeometry;e.index&&t.setIndex(new c.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n],i=r.name,a=r.array,o=r.itemSize,s=!(a instanceof Float32Array||a instanceof Float64Array);t.setAttribute(i,new c.BufferAttribute(a,o,s))}return t}_initDecoder(){if(this.decoderPending)return this.decoderPending;if(typeof WebAssembly!=`object`||this.decoderConfig.type===`js`)this.decoderPending=pr.ajax(this.decoderPath+`draco_decoder.js`,{responseType:`text`}).then(e=>e.body).then(e=>{let t=[`/* draco decoder */`,e,``,`/* worker */`,to].join(`
363
363
  `);this.workerSourceURL=URL.createObjectURL(new Blob([t]))});else{let e=pr.ajax(this.decoderPath+`draco_wasm_wrapper.js`,{responseType:`text`}).then(e=>e.body),t=pr.ajax(this.decoderPath+`draco_decoder.wasm`,{responseType:`arraybuffer`}).then(e=>e.body);this.decoderPending=Promise.all([e,t]).then(([e,t])=>{this.decoderConfig.wasmBinary=t;let n=[`/* draco decoder */`,e,``,`/* worker */`,to].join(`
364
364
  `);this.workerSourceURL=URL.createObjectURL(new Blob([n]))})}return this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:`init`,decoderConfig:this.decoderConfig}),e.onmessage=t=>{let n=t.data;switch(n.type){case`decode`:e._callbacks[n.id].resolve(n);break;case`error`:e._callbacks[n.id].reject(n);break;default:console.error(`DRACO: Unexpected message, "`+n.type+`"`)}},this.workerPool.push(e)}else this.workerPool.sort((e,t)=>e._taskLoad>t._taskLoad?-1:1);let n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}},to=`
365
365
  let decoderConfig;
@@ -2234,7 +2234,7 @@ void main() {
2234
2234
  #include <premultiplied_alpha_fragment>
2235
2235
 
2236
2236
  }
2237
- `},lv=class extends c.ShaderMaterial{constructor(e){super({uniforms:c.UniformsUtils.clone(cv.uniforms),vertexShader:cv.vertexShader,fragmentShader:cv.fragmentShader,clipping:!0}),this.type=`LineMaterial`,this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get(){return this.uniforms.diffuse.value},set(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get(){return this.uniforms.linewidth.value},set(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get(){return this.uniforms.dashScale.value},set(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get(){return this.uniforms.dashSize.value},set(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get(){return this.uniforms.gapSize.value},set(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}}}),this.setValues(e)}};Object.assign(lv.prototype,{isLineMaterial:!0});var uv=class extends c.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new sv:e,this.material=t===void 0?new lv({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),i=new c.Vector3,a=new c.Vector3;for(var o=0,s=0,l=t.count;o<l;o++,s+=2)i.fromBufferAttribute(t,o),a.fromBufferAttribute(n,o),r[s]=s===0?0:r[s-1],r[s+1]=r[s]+i.distanceTo(a);let u=new c.InstancedInterleavedBuffer(r,2,1);return e.setAttribute(`instanceDistanceStart`,new c.InterleavedBufferAttribute(u,1,0)),e.setAttribute(`instanceDistanceEnd`,new c.InterleavedBufferAttribute(u,1,1)),this}raycast(e,t){e.camera===null&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.`);let n=e.ray,r=e.camera,i=r.projectionMatrix,a=this.geometry,o=this.material,s=o.resolution,l=o.linewidth,u=a.attributes.instanceStart,d=a.attributes.instanceEnd,f=new c.Vector4,p=new c.Vector4,m=new c.Vector4,h=new c.Vector3,g=new c.Matrix4,_=new c.Line3,v=new c.Vector3;n.at(1,m),m.w=1,m.applyMatrix4(r.matrixWorldInverse),m.applyMatrix4(i),m.multiplyScalar(1/m.w),m.x*=s.x/2,m.y*=s.y/2,m.z=0,h.copy(m);let y=this.matrixWorld;g.multiplyMatrices(r.matrixWorldInverse,y);for(var b=0,x=u.count;b<x;b++){f.fromBufferAttribute(u,b),p.fromBufferAttribute(d,b),f.w=1,p.w=1,f.applyMatrix4(g),p.applyMatrix4(g),f.applyMatrix4(i),p.applyMatrix4(i),f.multiplyScalar(1/f.w),p.multiplyScalar(1/p.w);var S=f.z<-1&&p.z<-1,C=f.z>1&&p.z>1;if(S||C)continue;f.x*=s.x/2,f.y*=s.y/2,p.x*=s.x/2,p.y*=s.y/2,_.start.copy(f),_.start.z=0,_.end.copy(p),_.end.z=0;let e=_.closestPointToPointParameter(h,!0);_.at(e,v);let r=c.MathUtils.lerp(f.z,p.z,e),a=r>=-1&&r<=1;var w=h.distanceTo(v)<l*.5;if(a&&w){_.start.fromBufferAttribute(u,b),_.end.fromBufferAttribute(d,b),_.start.applyMatrix4(y),_.end.applyMatrix4(y);var T=new c.Vector3,E=new c.Vector3;n.distanceSqToSegment(_.start,_.end,E,T),t.push({point:E,pointOnLine:T,distance:n.origin.distanceTo(E),object:this,faceIndex:b})}}}};Object.assign(uv.prototype,{isLineSegments2:!0});var dv=class extends uv{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(dv.prototype,{isLine2:!0});var fv=class extends sv{constructor(){super(),this.type=`LineGeometry`}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}fromLine(e){let t=e.geometry;if(t instanceof c.Geometry){let e=new c.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof c.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}copy(){return this}};Object.assign(fv.prototype,{isLineGeometry:!0});var pv=14467195,mv=8,hv=2,gv=20,_v=null,vv=class extends c.Object3D{static get version(){return`6.8.0-alpha.18`}constructor(e=new c.Vector3,t=new c.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0,this.line=new dv(new fv,new lv({color:pv,linewidth:hv,dashScale:gv,dashed:!1}));let n=new c.BufferGeometry,r=new c.PointsMaterial({color:pv,size:mv,map:_v||(_v=new c.TextureLoader().load(`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==`)),sizeAttenuation:!1,transparent:!0});this.points=new c.Points(n,r),this.points.renderOrder=11,this.points.frustumCulled=!1,this.setPoints(e,t),this.add(this.line,this.points)}setPoints(e,t){let n=[].concat(e.toArray(),t.toArray());this.points.geometry.setAttribute(`position`,new c.BufferAttribute(new Float32Array(n),3)),this.line.geometry.setPositions(n),this.line.computeLineDistances(),this.needsRender=!0}getPoints(){let e=this.points.geometry.attributes.position.array;return[new c.Vector3(e[0],e[1],e[2]),new c.Vector3(e[3],e[4],e[5])]}setMaterial(e){let t=this.line.material;for(let n in e){if(!e.hasOwnProperty(n))continue;let r=e[n];n===`dashed`?(t.dashed=r,r?t.defines.USE_DASH=``:delete t.defines.USE_DASH,t.needsUpdate=!0):t[n]=e[n]}this.needsRender=!0}setResolution(e,t){let n=this.line.material.resolution;(n.x!==e||n.y!==t)&&(n.set(e,t),this.needsRender=!0)}};Object.assign(vv.prototype,{isFiveLine:!0});var yv={Handedness:Object.freeze({NONE:`none`,LEFT:`left`,RIGHT:`right`}),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 bv(e){return Vo(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function xv(e){return Vo(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield bv(`${e}/profilesList.json`)})}function Sv(e,t){return Vo(this,arguments,void 0,function*(e,t,n=null,r=!0){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No basePath supplied`);let i=yield xv(t),a;if(e.profiles.some(e=>{let n=i[e];return n&&(a={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!n)throw Error(`No matching profile name found`);let e=i[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);a={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let o=yield bv(a.profilePath),s;if(r){let t;if(t=o.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${a.profileId}`);t.assetPath&&(s=a.profilePath.replace(`profile.json`,t.assetPath))}return{profile:o,assetPath:s}})}var Cv={xAxis:0,yAxis:0,button:0,state:yv.ComponentState.DEFAULT};function wv(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var Tv=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===yv.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Cv)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:i,normalizedYAxis:a}=wv(e,t);switch(this.componentProperty){case yv.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?i:.5;break;case yv.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case yv.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case yv.ComponentProperty.STATE:this.valueNodeProperty===yv.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Ev=class{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw Error(`Invalid arguments supplied`);this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(e=>{let n=new Tv(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:yv.ComponentState.DEFAULT,button:this.gamepadIndices.button===void 0?void 0:0,xAxis:this.gamepadIndices.xAxis===void 0?void 0:0,yAxis:this.gamepadIndices.yAxis===void 0?void 0:0}}get data(){return Object.assign({id:this.id},this.values)}updateFromGamepad(e){if(this.values.state=yv.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){let t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=yv.ComponentState.PRESSED:(t.touched||this.values.button>yv.ButtonTouchThreshold)&&(this.values.state=yv.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.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===yv.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>yv.AxisTouchThreshold&&(this.values.state=yv.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.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===yv.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>yv.AxisTouchThreshold&&(this.values.state=yv.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},Dv=class{constructor(e,t,n){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No profile supplied`);this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(e=>{let t=this.layoutDescription.components[e];this.components[e]=new Ev(e,t)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){let e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}},Ov=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,kv=`generic-trigger`,Av=class extends c.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof c.Mesh&&e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:n,maxNode:r,value:i,valueNodeProperty:a}=e;t&&(a===yv.VisualResponseProperty.VISIBILITY?t.visible=i:a===yv.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))})}))}};function jv(e,t){Object.values(e.components).forEach(e=>{let{type:n,touchPointNodeName:r,visualResponses:i}=e;if(n===yv.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(r),e.touchPointNode){let t=new c.Mesh(new c.SphereGeometry(.001),new c.MeshBasicMaterial({color:255}));e.touchPointNode.add(t)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(i).forEach(e=>{let{valueNodeName:n,minNodeName:r,maxNodeName:i,valueNodeProperty:a}=e;if(a===yv.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(r),e.maxNode=t.getObjectByName(i),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=t.getObjectByName(n),e.valueNode||console.warn(`Could not find ${n} in the model`)})})}function Mv(e,t){jv(e.motionController,t),e.envMap&&t.traverse(t=>{t instanceof c.Mesh&&t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)}),e.add(t)}var Nv=class{constructor(e=null){this.gltfLoader=e,this.path=Ov,this._assetCache={}}createControllerModel(e){let t=new Av,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||Sv(r,this.path,kv).then(({profile:e,assetPath:i})=>{t.motionController=new Dv(r,e,i);let a=this._assetCache[t.motionController.assetUrl];if(a)n=a.scene.clone(),Mv(t,n);else{if(!this.gltfLoader)throw Error(`GLTFLoader not set.`);this.gltfLoader.load(t.motionController.assetUrl,e=>{this._assetCache[t.motionController.assetUrl]=e,n=e.scene.clone(),Mv(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},Pv=Object.assign({},hr(Xg,[`maxLatitude`,`minLatitude`]));function Fv(e,t){if(!t)return e;let n=e.match(/\d+_[a-z].png/);return e.substring(0,n.index)+t+`/`+e.substring(n.index)}var Iv=300,Lv=new c.Raycaster,Rv=new c.Vector3,zv={Floorplan:Xh,Topview:Qh,Panorama:Zg,VRPanorama:H_,Model:q_,Mapview:$_,XRPanorama:class e extends Zg{static parseArgs(t){if(t instanceof e)return t;let n=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return super.parseArgs(n)}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`XRPanorama`})}constructor(e){super(e),this.xrManager=new ov(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,$(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,$(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new c.Raycaster,right:new c.Raycaster},this.xrControllerRay.left.params.Points={threshold:.1},this.xrControllerRay.left.firstHitOnly=!0,this.xrControllerRay.left.floorIndex=-1,this.xrControllerRay.right.params.Points={threshold:.1},this.xrControllerRay.right.firstHitOnly=!0,this.xrControllerRay.right.floorIndex=-1,this.gazeRay=null,this.pointerLines={left:new vv,right:new vv},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new c.Group,new c.Group];let t=this.xrManager.getController(0);this.controllerWrappers[0].add(t);let n=this.xrManager.getController(1);this.controllerWrappers[1].add(n);let r=new Nv;r.gltfLoader={load(e,t){pr.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return ns(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:pr})}).then(e=>t(e))}},(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`)&&this.scene.add(this.pointerLines.left,this.pointerLines.right,this.controllerWrappers[0],this.controllerWrappers[1]),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=nn()]={panoId:Q(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:`fade`,effectEasing:Kg,fixCameraTransform:new c.Matrix4},this.parallaxCameraMatrixs=[];let i=ri.shared.getContext();if(!i){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(i),this.on(`xr.session.start`,()=>{let e=this.xrManager.getControllerGrip(0);e.add(r.createControllerModel(e)),this.controllerWrappers[0].add(e);let t=this.xrManager.getControllerGrip(1);t.add(r.createControllerModel(t)),this.controllerWrappers[1].add(t)}),this.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}},this.xrManager.machineType===`VP`&&this.initHandEvent()}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}moveToPano(e,t,n){var r,i,a;let o=(r=t.effect)==null?`fade`:r;this.userAction=n,this.stopMomentumMovement();let s=Q(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoIndex`);let u=Yr(l.images.up),d=this.imageOptions.size;d===void 0&&l&&u&&(d=Number(u)),d===void 0&&(d=2048);let f=this.imageOptions.transform,p=(e,t)=>Fv(qr(e,f,t)),m=Object.assign({key:`pano.${s}`},mr(this.imageOptions,[`format`,`size`,`quality`])),h={right:l.images.work.getURL(l.images.right),left:l.images.work.getURL(l.images.left),up:l.images.work.getURL(l.images.up),down:l.images.work.getURL(l.images.down),front:l.images.work.getURL(l.images.front),back:l.images.work.getURL(l.images.back)},g=`pano:`+pp([h,m,f]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;{let t=this.pendingTextureTask.panoId;(i=this.panoMeshes.get(t))==null||i.setProgress(0),this.emit(`pano.texture.abort`,$(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let{pano0:_,pano1:v}=this.modelScene.parameter.resolveValue(),y;if((_==null?void 0:_.map.name)===g?y=_:(v==null?void 0:v.map.name)===g&&(y=v),y){let n={panoId:s,effect:o,effectEasing:(a=t.effectEasing)==null?Kg:a,leftPanoPicture:{panoId:y.panoId,map:y.map,mapHistogram:y.mapHistogram,mapSize:y.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};this.doMoveToPano(e,n,t);return}let b=`move-to-pano-`+s;this.pending.add(b),this.pendingTextureTask={panoId:s,hash:g,onLoad:n=>{var r,i;let a=n.body;if(this.destroyed)a.dispose();else{a.name=g;let n=Array.isArray(a.image)?a.image[0]:a.image,u=(r=n==null?void 0:n.width)==null?2048:r,d=new _m().formPixels(Vh(this.renderer,a,!0,pm).data),f={panoId:s,effect:o,effectEasing:(i=t.effectEasing)==null?Kg:i,leftPanoPicture:{panoId:s,map:a,mapSize:u,mapHistogram:new c.Vector4().fromArray(d.toArray()),matrix:l.matrix.clone(),zoom:1},position:l.position.clone(),fixCameraTransform:new c.Matrix4};this.doMoveToPano(e,f,t)}},onError:n=>{let r=Object.assign(Object.assign(Object.assign({},e),{mode:this.mode}),jh(this.camera.pose));this.emit(`pano.error`,$(`pano.error`,{error:n,userAction:this.userAction,options:t,prevPano:this.currentPano,progress:0,state:r})),this.emit(`pano.cancel`,$(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,progress:0,state:r})),t.moveCancelCallback&&t.moveCancelCallback()}};let x=this.panoMeshes.get(s);x&&x.tap&&x.tap(),this.textureLoader.loadCubeTexture(h,{imageURL:{transform:p,options:m},format:c.RGBFormat,fetcher:_f(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;((n=this.pendingTextureTask)==null?void 0:n.hash)===g&&((r=this.panoMeshes.get(s))==null||r.setProgress(t)),this.emit(`pano.texture.progress`,$(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e}))},this.renderer).then(t=>{var n,r;this.pending.delete(b),((n=this.pendingTextureTask)==null?void 0:n.hash)===g?(this.pendingTextureTask.onLoad(t),this.pendingTextureTask=void 0,(r=this.panoMeshes.get(s))==null||r.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,$(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}))}).then(()=>new Promise(e=>{ri.shared.add(()=>e(),!0)})).catch(t=>{var n,r;this.pending.delete(b),((n=this.pendingTextureTask)==null?void 0:n.hash)===g&&(this.pendingTextureTask.onError(t),this.pendingTextureTask=void 0,(r=this.panoMeshes.get(s))==null||r.setProgress(0)),this.emit(`pano.texture.error`,$(`pano.texture.error`,{error:t,progress:0,meta:null,pano:e})),this.emit(`error`,t)}),this.emit(`pano.texture.load`,$(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}doMoveToPano(e,t,n={}){var r,i,a,o,s,l,u,d,f,p;let m=U(),h=nn();this.panoResources[h]=t;let g,_,v;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(n).position,a=t.position;g=Math.max(i.distanceTo(a),1),_=[{key:n.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:h,progress:1,value:{distance:0,count:1}}],v=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(n).position,o=t.position,s=n.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;g=c+Math.max(a.distanceTo(o),1),_=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:c/g,value:n.value},{key:h,progress:1,value:{count:n.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(_);v=this.locationMotion.getProgressVelocity(m)*l/u}let y=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?g:0),b={longitude:n.longitude,latitude:n.latitude,fov:n.fov},x=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(r=b.longitude)==null?this.camera.pose.longitude:r,latitude:(i=b.latitude)==null?this.camera.pose.latitude:i,fov:(a=b.fov)==null?this.camera.pose.fov:a,offset:t.position.clone(),distance:0}),S=this.currentPano;if(this.emit(`pano.moveTo`,$(`pano.moveTo`,{options:n,prevPano:S,progress:0,state:x,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(x),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=q,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(b,y).catch(q);else{let e=Vt({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=Vt({longitude:(o=b.longitude)==null?this.cameraMotion.value.longitude:o,latitude:(s=b.latitude)==null?this.cameraMotion.value.latitude:s}),r=new c.Object3D;r.lookAt(e);let i=new c.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let a=new c.Matrix4().makeRotationFromQuaternion(r.quaternion),m=new c.Matrix4().getInverse(i).premultiply(a),h=this.cameraMotion.value.fov,g=(l=b.fov)==null?this.cameraMotion.value.fov:l,v=1;t.effect===`zoomin`?v=1.5:t.effect===`zoomout`&&(v=.4);let x=g*v;for(let e=0;e<_.length-1;e++){let t=_[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(m),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(x/2/180*Math.PI)/Math.tan(h/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:(u=b.longitude)==null?this.cameraMotion.value.longitude:u,latitude:(d=b.latitude)==null?this.cameraMotion.value.latitude:d,fov:x}},{progress:1,value:{longitude:(f=b.longitude)==null?this.cameraMotion.value.longitude:f,latitude:(p=b.latitude)==null?this.cameraMotion.value.latitude:p,fov:g}}],y).catch(q)}this.locationMotion.setKeyframes(_,y,v).then(()=>{for(let e of this.modelScene.children)e instanceof If&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:0});this.emit(`pano.arrived`,$(`pano.arrived`,{options:n,prevPano:S,progress:1,state:t,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(t);let r=this.works.getObserver(this.currentPano);if(r&&r.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:r.images.video.size.clone(),matrix:r.images.video.matrix.clone(),panoMatrix:r.matrix.clone().premultiply(r.work.transform),alpha:1},t=nn(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),rg().then(i=>{i&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=q,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=q,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}},()=>{this.emit(`pano.cancel`,$(`pano.cancel`,{options:n,prevPano:S,progress:0,state:x,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}checkSelectedPano(e){var t;this.stopMomentumMovement(),this.camera.getDirection(new c.Vector3).setY(0);let n=null,r=this.works.getObserver(this.currentPano);if(!r)return null;let i=r.work.observers,a=r.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let t=i[e];return!t||Rv.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[o]=this.modelScene.intersectRaycaster(e);if(o){let[e,r]=Nl(a,e=>{let t=i[e];return t?Rv.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(o.point):1/0},!0);typeof e==`number`&&r<this.panoTapTriggerRadius&&(n=(t=i[e])==null?null:t)}if(ev(n)){let t=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);t&&(n=t)}for(let e of this.locationMotion.keyframes){let t=this.panoResourceFromLocationMotionKeyframe(e);if(!(e.progress<this.locationMotion.progress)&&n){let e=Q({panoIndex:n.panoIndex,workCode:n.work.workCode});if(t.panoId===e){n=null;break}}}if(ev(n))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!n.active){let e=Q({panoIndex:n.panoIndex,workCode:n.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let s={workCode:n.work.workCode,panoIndex:n.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:n?n.position.clone():new c.Vector3};return this.emit(`pano.select`,$(`pano.select`,{prevPano:this.currentPano,state:s,userAction:!0,options:{},progress:0,error:null})),n&&n.active?(this.emit(`pano.request`,$(`pano.request`,{userAction:!0,prevPano:this.currentPano,progress:0,state:s,options:{},error:null})),{workCode:n.work.workCode,panoIndex:n.panoIndex}):null}destroy(){super.destroy()}isReady(){return!1}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,t,...n){var r,i,a,o,s,l,u,d,f;this.userAction=!0;let p={},m={},h=this.camera.getDirection(new c.Vector3),g=this.locationMotion.keyframes[0],_=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[v,y]=this.locationMotion.getKeyFrameSegment(e),b=this.panoResourceFromLocationMotionKeyframe(v),x=this.panoResourceFromLocationMotionKeyframe(y),S=this.panoResourceFromLocationMotionKeyframe(g),C=this.panoResourceFromLocationMotionKeyframe(_),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(W(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-y.value.count+1,n=new c.Vector3().copy(b.position),a=new c.Vector3().copy(x.position);if(p.progress=t,t>=.01&&t<=.99&&(p.progress=W(x.effectEasing(t),.01,.99)),x.leftPanoPicture&&(t<1?b.leftPanoPicture&&(p.pano0=b.leftPanoPicture):p.pano0=x.leftPanoPicture,p.pano1=x.leftPanoPicture),x.effect===`montage`?p.transition=`BLACK`:x.effect===`spread`?p.transition=`SPREAD`:p.transition=`FADE`,x.effect===`zoomin`||x.effect===`zoomout`?p.progress=Math.pow(t,3):x.effect===`model`&&this.camera.pose.distance<.01&&(p.modelAlpha=1-Math.pow(W(Math.abs(t-.5)*2,0,1),4)),t<1&&x.effect!==`fly`){if(p.pano0&&b.leftPanoPicture){let e={panoId:p.pano0.panoId,map:p.pano0.map,mapHistogram:p.pano0.mapHistogram,mapSize:p.pano0.mapSize,zoom:p.pano0.zoom,matrix:b.leftPanoPicture.matrix.clone().setPosition(x.position)},t=this.panoPictureObserverMap.get(p.pano0);t&&this.panoPictureObserverMap.set(e,t),p.pano0=e}n.copy(a),w=!0}m.distance=this.locationMotion.value.distance,m.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((r=p.pano0)==null?void 0:r.map)||e===((i=p.pano1)==null?void 0:i.map))continue;e.dispose(),t.leftPanoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}let l=hp(x.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,$(`pano.moving`,{userAction:this.userAction,prevPano:hp(S.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},hp(C.panoId)),{mode:this.mode}),jh(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(m),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);let[T,E]=n,D=new c.Vector3(0,0,0),O=new c.Vector2().copy(this.camera.resolution);if(E&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let n=this.xrManager.cameraVR,r=this.xrManager.referenceSpace,i=this.xrManager.session.renderState.baseLayer,l=E.getViewerPose(r),u=(a=l==null?void 0:l.views)==null?[]:a;for(let e=0;e<u.length;e++){let t=u[e],r=n.cameras[e],a=i.getViewport(t);a&&(r.projectionMatrix.fromArray(t.projectionMatrix),r.projectionMatrixInverse.getInverse(r.projectionMatrix),r.matrix.fromArray(t.transform.matrix),r.matrix.setPosition(this.camera.position),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixWorld.copy(r.matrix),r.matrixWorldInverse.getInverse(r.matrixWorld),r.matrixAutoUpdate=!1,D.copy(r.position),r.viewport.set(a.x,a.y,a.width,a.height),O.set(a.width,a.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((o=m.distance)==null?this.camera.pose.distance:o),this.xrManager.session.inputSources){for(let e=0;e<this.xrManager.session.inputSources.length;e++)if(this.xrManager.session.inputSources[e]&&this.xrManager.session.inputSources[e].targetRayMode===`transient-pointer`){let t=E.getPose(this.xrManager.session.inputSources[e].targetRaySpace,r);if(t){let e=t.transform.orientation,n=new c.Quaternion(e.x,e.y,e.z,e.w),r=new c.Vector3(0,0,-1).applyQuaternion(n);this.gazeRay=new c.Raycaster(this.camera.position,r)}}}if(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`){let n=this.xrManager.session.inputSources;for(let e=0;e<n.length;e++){let t=this.xrManager.controllers[e],i=n[e];if(!i)continue;t&&t.update(i,E,r);let a=this.xrManager.getController(e),o=new c.Vector3(0,1.2,0),l=a.position.clone().add(D).sub(o);i.handedness===`left`?this.xrControllerRay.left.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)):i.handedness===`right`&&this.xrControllerRay.right.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)),this.controllerWrappers[e].position.copy(new c.Vector3(0,0,0).add(D).sub(o));let u=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(u.length===0){let e=this.works.getResolvedObserver(this.currentPano);u=this.xrControllerRay.right.intersectObject(this.modelScene.boundingMesh,!0).map(t=>{var n;let r=(n=e==null?void 0:e.floorIndex)==null?0:n;return Object.assign({floorIndex:r,floor:r},t)})}if(u.length>=1&&u[0].face)if(i.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=u[0].face.normal,n=t.clone(),r=u[0].point.clone();this.intersectMesh.position.copy(r);let i=r.clone().add(n);if(this.intersectMesh.lookAt(i),Math.abs(t.y)>.99){let e=this.camera.position.clone().sub(r);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,e.length>0?(this.pointerLines.right.setPoints(l,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(l,u[0].point));let a=u[0],o=$(`intersect.update`,{raycaster:(s=this.xrControllerRay.right)==null?null:s,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(l,u[0].point)}this.updateControllerHelper(n,e,t)}}else E||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);Ph(p)===!1&&this.modelScene.parameter.set(p),this.emit(`camera.update`,$(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),jh(this.camera.pose))}));let k=this.works.getResolvedObserver(this.currentPano),A=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,j=this.works.getObserver(b.panoId),M=this.works.getObserver(x.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&k){let e=[],t=k.work.observers;for(let n of k.accessibleNodes){let r=t[n];r&&e.push(r)}let n=new Map;if(e.sort((e,t)=>{let r=n.get(e);r===void 0&&(r=e.standingPosition.distanceTo(k.standingPosition),n.set(e,r));let i=n.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(k.standingPosition),n.set(t,i)),r-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let t=e[this.accessibleObserverFloorCheckCount],n=this.modelScene.models.find(e=>e.work===(t==null?void 0:t.work));if(t&&n&&n.visible){let e=.3,r=.005,i=t.standingPosition.clone().applyMatrix4(t.work.transform),a=Q({panoIndex:t.panoIndex,workCode:t.work.workCode}),o=Yg.map(t=>{Lv.ray.origin.copy(i),Lv.ray.origin.add(Rv.copy(t).setY(e)),Lv.ray.direction.set(0,-1,0),Lv.firstHitOnly=!0,Lv.floorIndex=-1;let[a]=n.intersectRaycaster(Lv);return a&&a.distance-r<=e?new c.Vector3().copy(i).setY(a.point.y+r):i});o.sort((e,t)=>t.y-e.y);let s=o[Math.floor(o.length/2)],[l]=o.filter(e=>e.distanceTo(s)<=.05);if(l){let e=new c.Vector4(i.x,i.y,i.z,l.y-i.y),t=this.adjustPanoCircleMeshPositionFix.get(a);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(a,e)}}this.accessibleObserverFloorCheckCount++}}let N=new Map;if(j)for(let e of j.accessibleNodes){let t=j.work.observers[e];if(t){let e=Q({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(M)for(let e of M.accessibleNodes){let t=M.work.observers[e];if(t){let e=Q({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{N.get(t)?N.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),N.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),N.delete(t)}),this.panoMeshes.forEach((e,t)=>{let n=this.works.getObserver(t);if(n){let r=n.position.distanceTo(n.standingPosition)>this.aerialObserverMinHeight;if(r)e.position.copy(n.position).applyMatrix4(n.work.transform),e.scale.setScalar(18);else{e.position.copy(n.standingPosition).applyMatrix4(n.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(n.panoId);t&&(Rv.set(t.x,t.y,t.z),Rv.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let i=this.camera.position.clone().setY(e.position.y),a=new c.Vector3().copy(e.position).sub(i).normalize();if(t===Q(this.currentPano)){let t=W((.5-i.distanceTo(e.position))/.5,0,1);a.multiplyScalar(1-t).add(h.clone().multiplyScalar(t))}if(a.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(a.x,a.z);e.quaternion.setFromEuler(new c.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(k){let n=k.work.observers,[,r]=Nl(k.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:k.standingPosition.distanceTo(t.standingPosition)},!0);r=W(r,2.5,1/0);let i=k.accessibleNodes.concat(k.panoIndex).map(e=>Q({panoIndex:e,workCode:k.work.workCode}));this.panoMeshes.forEach((n,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=n.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&A!==null&&Q({panoIndex:A.panoIndex,workCode:A.work.workCode})===a;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=t<.01?0:W(r/t,.1,.85)}o&&o===M&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue().modelAlpha>0&&(c=0),n.setCurrent(s),n.setOpacity(c),n.updateTime&&n.updateTime(e,t)})}{let e=(l=this.modelScene.parameter.progress)==null?1:l,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,a;if(i&&(a=this.works.getObserver(i.panoId),a||(a=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(si()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!a||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Qr(i.mapSize)+1;this.tiling.setObserver(a);let o={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:i.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:e,level:4},s=this.tiling.update(o),c={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:Vu(Math.abs(((u=this.modelScene.parameter.progress)==null?0:u)-.5)*2)},l=this.modelScene.parameter.refinedScreen;(s||c.pano!==(l==null?void 0:l.pano)||c.opacity!==(l==null?void 0:l.opacity))&&this.modelScene.parameter.set(`refinedScreen`,c)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&k&&k.position.y-k.standingPosition.y>10){let e=W(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=x.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((d=this.modelScene.parameter.pano0Depth)==null?void 0:d.panoId)!==t.panoId||((f=this.modelScene.parameter.pano1Depth)==null?void 0:f.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,Gg(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,Gg(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}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))}}render(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){let e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}updateControllerHelper(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(!e||e.length===0)return;let a={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let o=0;o<e.length;o++){let s=e[o].handedness,c=e[o].gamepad;switch(s){case`left`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`LeftAxesDown`,t)),c!=null&&c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`X`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`Y`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`LeftTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n};a.buttons.X=c.buttons&&c.buttons[4]?c.buttons[4].pressed:!1,a.buttons.Y=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.LeftTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.LeftPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1,a.left=e;break;case`right`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`RightAxesDown`,t)),c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`A`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`B`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`RightTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`RightPinch`,t)),a.right={raycaster:i,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n},a.buttons.A=c.buttons&&c.buttons[4]?c==null?void 0:c.buttons[4].pressed:!1,a.buttons.B=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.RightTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.RightPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,$(`xr.controller.update`,a))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)this.xrHandleState[t].touchStart===!1?(this.xrHandleState[t].touchStartTime=n,this.xrHandleState[t].touchStart=!0,this.emit(`xr.gesture.buttonDown`,$(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrHandleState[t].touchStartTime>Iv&&this.emit(`xr.gesture.press`,$(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,$(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrHandleState[t].touchStartTime<=Iv){let e=$(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}});!this.emit(`xr.gesture.tap`,e)&&!e.defaultPrevented&&t===`RightTrigger`&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[t].touchStart=!1,this.xrHandleState[t].touchStartTime=0}}initHandEvent(){if(!this.xrManager.session)throw Error(`初始化失败`);this.xrManager.session.addEventListener(`select`,e=>{this.gazeRay&&this.checkSelectedPano(this.gazeRay)})}}},Bv={Floorplan:Yh,Topview:Zh,Panorama:Xg,VRPanorama:V_,Model:K_,Mapview:Q_,XRPanorama:Pv},Vv=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.create,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`.split(`,`);function Hv(e){e.on(`initAnimation.start`,t=>{e.emit(`initAnimationWillStart`,t.state.panoIndex,t.state,t.userAction)}),e.on(`initAnimation.end`,t=>{e.emit(`initAnimationEnded`,t.state.panoIndex,t.state,t.userAction)}),e.on(`gesture.pan`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pan`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPanGesture`,t.state,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pan`,t.pointers,t.isFinal),e.emit(`panGesture`,t.state,t.isFinal))}),e.on(`gesture.tap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`tap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`tap`,t.pointers,t.isFinal),e.emit(`tapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.dbltap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`dbltap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsDblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`dbltap`,t.pointers,t.isFinal),e.emit(`dblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.press`,t=>{let n=!1;n=e.emit(`wantsGesture`,`press`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`press`,t.pointers,t.isFinal),e.emit(`pressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),e.on(`gesture.pinch`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pinch`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPinchGesture`,t.scale,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pinch`,t.pointers,t.isFinal),e.emit(`pinchGesture`,t.scale,t.state.fov,t.isFinal))}),e.on(`gesture.mousewheel`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseWheel`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsMouseWheel`,t.center.delta,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseWheel`,t.pointers,t.isFinal),e.emit(`mouseWheel`,t.center.delta,t.state.fov,t.isFinal))}),e.on(`gesture.mousemove`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseMove`,t.pointers,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseMove`,t.pointers,t.isFinal),n=e.emit(`wantsChangeCameraFov`,t.state.fov),n&&t.preventDefault())}),e.on(`gesture.momentum`,t=>{let n=!1;n=e.emit(`wantsInteriaPan`,t.state),n&&t.preventDefault(),t.defaultPrevented||e.emit(`interiaPan`,t.state,t.isFinal)}),e.on(`camera.update`,t=>{e.emit(`cameraFovUpdate`,t.state.fov,t.userAction),e.emit(`cameraDirectionUpdate`,t.state,t.userAction);let n=Vt(t.state);n.setLength(t.state.distance);let r=t.state.offset.clone().sub(n);e.emit(`cameraPositionUpdate`,r,t.userAction),e.emit(`cameraUpdate`,t.state,t.userAction)}),e.on(`intersect.update`,t=>{if(t.intersection){let n=!1;n=e.emit(`wantsShowIntersectionOnModel`,t.raycaster),n&&t.preventDefault(),t.defaultPrevented||e.emit(`intersectionOnModelUpdate`,t.intersection,t.object)}else e.emit(`intersectionHidden`)}),e.on(`pano.request`,t=>{let n=e.emit(`wantsMoveToPano`,t.state.panoIndex,t.options,t.userAction);n||(n=e.emit(`wantsToMoveToPano`,t.state.panoIndex,t.options,t.userAction)),n&&t.preventDefault(),t.defaultPrevented||e.emit(`panoWillLoad`,t.state.panoIndex)}),e.on(`pano.select`,t=>{e.emit(`panoSelected`,t.state.panoIndex)}),e.on(`pano.moveTo`,t=>{e.emit(`panoLoaded`,t.state.panoIndex),e.emit(`moveToPano`,t.state.panoIndex,t.userAction),e.emit(`panoWillArrive`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.moving`,t=>{e.emit(`movingToPano`,t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),e.on(`pano.arrived`,t=>{e.emit(`panoArrived`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.cancel`,t=>{e.emit(`moveToPanoCanceled`,t.state.panoIndex)}),e.on(`pano.error`,t=>{e.emit(`panoLoadError`,t.error,t.state.panoIndex)}),e.on(`pano.texture.load`,t=>{e.emit(`textureStartLoad`,t.pano.panoIndex)}),e.on(`pano.texture.success`,t=>{e.emit(`textureLoaded`,t.pano.panoIndex,t.meta)}),e.on(`pano.texture.error`,t=>{e.emit(`textureError`,t.error,t.pano.panoIndex)}),e.on(`pano.texture.abort`,t=>{e.emit(`textureAbort`,t.pano.panoIndex)}),e.on(`pano.texture.progress`,t=>{e.emit(`textureLoading`,t.progress,t.pano.panoIndex)}),e.on(`xr.session.start`,t=>{e.emit(`webXRSessionStart`)}),e.on(`xr.session.end`,t=>{e.emit(`webXRSessionEnd`)}),e.on(`xr.gesture.tap`,t=>{e.emit(`webXRControllerEvent`,`tap`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.press`,t=>{e.emit(`webXRControllerEvent`,`press`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonUp`,t=>{e.emit(`webXRControllerEvent`,`buttonUp`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonDown`,t=>{e.emit(`webXRControllerEvent`,`buttonDown`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.controller.update`,t=>{e.emit(`webXRControllerRayUpdate`,{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&e.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&&e.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})}),e.on(`works.request`,t=>{e.emit(`willLoad`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.load`,t=>{e.emit(`load`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.ready`,t=>{e.emit(`loaded`,t.input,t.works[0])}),e.on(`state.change`,t=>{e.emit(`stateChange`,t.state,t.userAction)}),e.on(`currentState.change`,t=>{e.emit(`currentStateChange`,t.state,t.userAction)}),e.on(`state.set`,t=>{e.emit(`setState`,t.state)}),e.on(`state.synced`,t=>{e.emit(`stateSynced`,t.state)}),e.on(`model.request`,t=>{e.emit(`modelWillLoad`,t.work.model)}),e.on(`model.error`,t=>{e.emit(`modelLoadError`,t.error,t.model)}),e.on(`model.load`,t=>{e.emit(`modelLoaded`,t.model)}),e.on(`model.changeShownFloor`,t=>{e.emit(`modelShownFloorChange`,t.model.shownFloor,t.model.floorLength)}),e.on(`render`,t=>{e.emit(`renderFrame`,t.needsRender)}),e.on(`mode.change.request`,t=>{e.emit(`wantsChangeMode`,t.mode,t.prevMode)}),e.on(`mode.change`,t=>{e.emit(`modeChange`,t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),e.on(`helpers.visible`,t=>{e.emit(`helpersVisibleChange`,t.object.visible)}),e.on(`network.resource`,t=>{e.emit(`network`,t.source,t.requestType,t.requestState,t.detail)})}function Uv(){if(typeof window<`u`){let e=document.createElement(`video`);e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin=``;let t=()=>{document.removeEventListener(`touchstart`,t,!1),document.removeEventListener(`mousedown`,t,!1),e.muted=!1};return document.addEventListener(`touchstart`,t,!1),document.addEventListener(`mousedown`,t,!1),e}else return{}}function Wv(){let e=new c.Group;e.name=`internalLights`;{let t=new c.DirectionalLight(16777215,.1);t.name=`direction0`,t.position.copy(new c.Vector3(0,1,0)),e.add(t)}{let t=new c.DirectionalLight(16777215,.1);t.name=`direction1`,t.position.copy(new c.Vector3(-1,-1,-1)),e.add(t)}{let t=new c.DirectionalLight(16777215,.3);t.name=`direction2`,t.position.copy(new c.Vector3(1,1,1)),e.add(t)}{let t=new c.AmbientLight(16777215,.6);t.name=`ambient0`,e.add(t)}return e}function Gv(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function Kv(){var e;if(typeof document<`u`){let t=document.getElementsByTagName(`meta`);for(let n=0;n<t.length;n++){let r=t[n];if(r.getAttribute(`name`)===`viewport`){let t=Gv((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var qv=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==`,Jv=[351,63],Yv=[20,20],Xv=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Zv=new Float32Array([0,0,1,0,0,1,1,1]),Qv=new Uint8Array([0,1,2,1,3,2]),$v=new c.BufferGeometry;$v.setAttribute(`position`,new c.BufferAttribute(Xv,3)),$v.setAttribute(`uv`,new c.BufferAttribute(Zv,2)),$v.setIndex(new c.BufferAttribute(Qv,1));var ey=new c.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),ty=new c.Mesh($v,ey);ty.matrixAutoUpdate=!1;var ny=new c.Scene;ny.add(ty),ny.matrixAutoUpdate=!1;var ry=new c.OrthographicCamera(-.5,.5,.5,-.5,.1,1);ry.position.set(0,0,.5),ry.lookAt(0,0,0),ry.updateMatrixWorld(!0),ry.matrixAutoUpdate=!1;var iy=new c.Vector4,ay=new c.Vector4;function oy(e){if(ey.map){let t=e.getViewport(iy),n=e.getScissor(ay),r=e.getScissorTest(),i=e.autoClear,a=n.x+Yv[0]/3,o=n.y+Yv[1]/3,s=Jv[0]/3,c=Jv[1]/3;e.setViewport(a,o,s,c),e.setScissor(a,o,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(ny,ry),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{let e=new c.Texture,t=new Image;t.onload=()=>{e.image=t,e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,ey.needsUpdate=!0,t.onload=q},t.src=qv,ey.map=e}}var sy=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}async function t(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i)try{new URL(\`.\`,a).href}catch{}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==\`function\`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==\`function\`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(\`\\0asm\\0\\0\\0&\\\`\\\`}}\\\`}\\\`\\0\\\`\\v\\0\\\`\\0\\0\\x07aa\\0\\0\\b\\x07\\0\\0\\x07‚€€\\bA€Œ\\v\\x07b\\0c\\0\\x07d\\0e\\0f\\0\\f
2237
+ `},lv=class extends c.ShaderMaterial{constructor(e){super({uniforms:c.UniformsUtils.clone(cv.uniforms),vertexShader:cv.vertexShader,fragmentShader:cv.fragmentShader,clipping:!0}),this.type=`LineMaterial`,this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get(){return this.uniforms.diffuse.value},set(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get(){return this.uniforms.linewidth.value},set(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get(){return this.uniforms.dashScale.value},set(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get(){return this.uniforms.dashSize.value},set(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get(){return this.uniforms.gapSize.value},set(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}}}),this.setValues(e)}};Object.assign(lv.prototype,{isLineMaterial:!0});var uv=class extends c.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new sv:e,this.material=t===void 0?new lv({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),i=new c.Vector3,a=new c.Vector3;for(var o=0,s=0,l=t.count;o<l;o++,s+=2)i.fromBufferAttribute(t,o),a.fromBufferAttribute(n,o),r[s]=s===0?0:r[s-1],r[s+1]=r[s]+i.distanceTo(a);let u=new c.InstancedInterleavedBuffer(r,2,1);return e.setAttribute(`instanceDistanceStart`,new c.InterleavedBufferAttribute(u,1,0)),e.setAttribute(`instanceDistanceEnd`,new c.InterleavedBufferAttribute(u,1,1)),this}raycast(e,t){e.camera===null&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.`);let n=e.ray,r=e.camera,i=r.projectionMatrix,a=this.geometry,o=this.material,s=o.resolution,l=o.linewidth,u=a.attributes.instanceStart,d=a.attributes.instanceEnd,f=new c.Vector4,p=new c.Vector4,m=new c.Vector4,h=new c.Vector3,g=new c.Matrix4,_=new c.Line3,v=new c.Vector3;n.at(1,m),m.w=1,m.applyMatrix4(r.matrixWorldInverse),m.applyMatrix4(i),m.multiplyScalar(1/m.w),m.x*=s.x/2,m.y*=s.y/2,m.z=0,h.copy(m);let y=this.matrixWorld;g.multiplyMatrices(r.matrixWorldInverse,y);for(var b=0,x=u.count;b<x;b++){f.fromBufferAttribute(u,b),p.fromBufferAttribute(d,b),f.w=1,p.w=1,f.applyMatrix4(g),p.applyMatrix4(g),f.applyMatrix4(i),p.applyMatrix4(i),f.multiplyScalar(1/f.w),p.multiplyScalar(1/p.w);var S=f.z<-1&&p.z<-1,C=f.z>1&&p.z>1;if(S||C)continue;f.x*=s.x/2,f.y*=s.y/2,p.x*=s.x/2,p.y*=s.y/2,_.start.copy(f),_.start.z=0,_.end.copy(p),_.end.z=0;let e=_.closestPointToPointParameter(h,!0);_.at(e,v);let r=c.MathUtils.lerp(f.z,p.z,e),a=r>=-1&&r<=1;var w=h.distanceTo(v)<l*.5;if(a&&w){_.start.fromBufferAttribute(u,b),_.end.fromBufferAttribute(d,b),_.start.applyMatrix4(y),_.end.applyMatrix4(y);var T=new c.Vector3,E=new c.Vector3;n.distanceSqToSegment(_.start,_.end,E,T),t.push({point:E,pointOnLine:T,distance:n.origin.distanceTo(E),object:this,faceIndex:b})}}}};Object.assign(uv.prototype,{isLineSegments2:!0});var dv=class extends uv{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(dv.prototype,{isLine2:!0});var fv=class extends sv{constructor(){super(),this.type=`LineGeometry`}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}fromLine(e){let t=e.geometry;if(t instanceof c.Geometry){let e=new c.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof c.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}copy(){return this}};Object.assign(fv.prototype,{isLineGeometry:!0});var pv=14467195,mv=8,hv=2,gv=20,_v=null,vv=class extends c.Object3D{static get version(){return`6.8.0-alpha.19`}constructor(e=new c.Vector3,t=new c.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0,this.line=new dv(new fv,new lv({color:pv,linewidth:hv,dashScale:gv,dashed:!1}));let n=new c.BufferGeometry,r=new c.PointsMaterial({color:pv,size:mv,map:_v||(_v=new c.TextureLoader().load(`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==`)),sizeAttenuation:!1,transparent:!0});this.points=new c.Points(n,r),this.points.renderOrder=11,this.points.frustumCulled=!1,this.setPoints(e,t),this.add(this.line,this.points)}setPoints(e,t){let n=[].concat(e.toArray(),t.toArray());this.points.geometry.setAttribute(`position`,new c.BufferAttribute(new Float32Array(n),3)),this.line.geometry.setPositions(n),this.line.computeLineDistances(),this.needsRender=!0}getPoints(){let e=this.points.geometry.attributes.position.array;return[new c.Vector3(e[0],e[1],e[2]),new c.Vector3(e[3],e[4],e[5])]}setMaterial(e){let t=this.line.material;for(let n in e){if(!e.hasOwnProperty(n))continue;let r=e[n];n===`dashed`?(t.dashed=r,r?t.defines.USE_DASH=``:delete t.defines.USE_DASH,t.needsUpdate=!0):t[n]=e[n]}this.needsRender=!0}setResolution(e,t){let n=this.line.material.resolution;(n.x!==e||n.y!==t)&&(n.set(e,t),this.needsRender=!0)}};Object.assign(vv.prototype,{isFiveLine:!0});var yv={Handedness:Object.freeze({NONE:`none`,LEFT:`left`,RIGHT:`right`}),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 bv(e){return Vo(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function xv(e){return Vo(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield bv(`${e}/profilesList.json`)})}function Sv(e,t){return Vo(this,arguments,void 0,function*(e,t,n=null,r=!0){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No basePath supplied`);let i=yield xv(t),a;if(e.profiles.some(e=>{let n=i[e];return n&&(a={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!n)throw Error(`No matching profile name found`);let e=i[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);a={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let o=yield bv(a.profilePath),s;if(r){let t;if(t=o.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${a.profileId}`);t.assetPath&&(s=a.profilePath.replace(`profile.json`,t.assetPath))}return{profile:o,assetPath:s}})}var Cv={xAxis:0,yAxis:0,button:0,state:yv.ComponentState.DEFAULT};function wv(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var Tv=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===yv.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Cv)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:i,normalizedYAxis:a}=wv(e,t);switch(this.componentProperty){case yv.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?i:.5;break;case yv.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case yv.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case yv.ComponentProperty.STATE:this.valueNodeProperty===yv.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Ev=class{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw Error(`Invalid arguments supplied`);this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(e=>{let n=new Tv(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:yv.ComponentState.DEFAULT,button:this.gamepadIndices.button===void 0?void 0:0,xAxis:this.gamepadIndices.xAxis===void 0?void 0:0,yAxis:this.gamepadIndices.yAxis===void 0?void 0:0}}get data(){return Object.assign({id:this.id},this.values)}updateFromGamepad(e){if(this.values.state=yv.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){let t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=yv.ComponentState.PRESSED:(t.touched||this.values.button>yv.ButtonTouchThreshold)&&(this.values.state=yv.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.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===yv.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>yv.AxisTouchThreshold&&(this.values.state=yv.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.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===yv.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>yv.AxisTouchThreshold&&(this.values.state=yv.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},Dv=class{constructor(e,t,n){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No profile supplied`);this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(e=>{let t=this.layoutDescription.components[e];this.components[e]=new Ev(e,t)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){let e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}},Ov=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,kv=`generic-trigger`,Av=class extends c.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof c.Mesh&&e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:n,maxNode:r,value:i,valueNodeProperty:a}=e;t&&(a===yv.VisualResponseProperty.VISIBILITY?t.visible=i:a===yv.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))})}))}};function jv(e,t){Object.values(e.components).forEach(e=>{let{type:n,touchPointNodeName:r,visualResponses:i}=e;if(n===yv.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(r),e.touchPointNode){let t=new c.Mesh(new c.SphereGeometry(.001),new c.MeshBasicMaterial({color:255}));e.touchPointNode.add(t)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(i).forEach(e=>{let{valueNodeName:n,minNodeName:r,maxNodeName:i,valueNodeProperty:a}=e;if(a===yv.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(r),e.maxNode=t.getObjectByName(i),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=t.getObjectByName(n),e.valueNode||console.warn(`Could not find ${n} in the model`)})})}function Mv(e,t){jv(e.motionController,t),e.envMap&&t.traverse(t=>{t instanceof c.Mesh&&t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)}),e.add(t)}var Nv=class{constructor(e=null){this.gltfLoader=e,this.path=Ov,this._assetCache={}}createControllerModel(e){let t=new Av,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||Sv(r,this.path,kv).then(({profile:e,assetPath:i})=>{t.motionController=new Dv(r,e,i);let a=this._assetCache[t.motionController.assetUrl];if(a)n=a.scene.clone(),Mv(t,n);else{if(!this.gltfLoader)throw Error(`GLTFLoader not set.`);this.gltfLoader.load(t.motionController.assetUrl,e=>{this._assetCache[t.motionController.assetUrl]=e,n=e.scene.clone(),Mv(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},Pv=Object.assign({},hr(Xg,[`maxLatitude`,`minLatitude`]));function Fv(e,t){if(!t)return e;let n=e.match(/\d+_[a-z].png/);return e.substring(0,n.index)+t+`/`+e.substring(n.index)}var Iv=300,Lv=new c.Raycaster,Rv=new c.Vector3,zv={Floorplan:Xh,Topview:Qh,Panorama:Zg,VRPanorama:H_,Model:q_,Mapview:$_,XRPanorama:class e extends Zg{static parseArgs(t){if(t instanceof e)return t;let n=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return super.parseArgs(n)}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`XRPanorama`})}constructor(e){super(e),this.xrManager=new ov(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,$(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,$(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new c.Raycaster,right:new c.Raycaster},this.xrControllerRay.left.params.Points={threshold:.1},this.xrControllerRay.left.firstHitOnly=!0,this.xrControllerRay.left.floorIndex=-1,this.xrControllerRay.right.params.Points={threshold:.1},this.xrControllerRay.right.firstHitOnly=!0,this.xrControllerRay.right.floorIndex=-1,this.gazeRay=null,this.pointerLines={left:new vv,right:new vv},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new c.Group,new c.Group];let t=this.xrManager.getController(0);this.controllerWrappers[0].add(t);let n=this.xrManager.getController(1);this.controllerWrappers[1].add(n);let r=new Nv;r.gltfLoader={load(e,t){pr.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return ns(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:pr})}).then(e=>t(e))}},(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`)&&this.scene.add(this.pointerLines.left,this.pointerLines.right,this.controllerWrappers[0],this.controllerWrappers[1]),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=nn()]={panoId:Q(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:`fade`,effectEasing:Kg,fixCameraTransform:new c.Matrix4},this.parallaxCameraMatrixs=[];let i=ri.shared.getContext();if(!i){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(i),this.on(`xr.session.start`,()=>{let e=this.xrManager.getControllerGrip(0);e.add(r.createControllerModel(e)),this.controllerWrappers[0].add(e);let t=this.xrManager.getControllerGrip(1);t.add(r.createControllerModel(t)),this.controllerWrappers[1].add(t)}),this.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}},this.xrManager.machineType===`VP`&&this.initHandEvent()}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}moveToPano(e,t,n){var r,i,a;let o=(r=t.effect)==null?`fade`:r;this.userAction=n,this.stopMomentumMovement();let s=Q(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoIndex`);let u=Yr(l.images.up),d=this.imageOptions.size;d===void 0&&l&&u&&(d=Number(u)),d===void 0&&(d=2048);let f=this.imageOptions.transform,p=(e,t)=>Fv(qr(e,f,t)),m=Object.assign({key:`pano.${s}`},mr(this.imageOptions,[`format`,`size`,`quality`])),h={right:l.images.work.getURL(l.images.right),left:l.images.work.getURL(l.images.left),up:l.images.work.getURL(l.images.up),down:l.images.work.getURL(l.images.down),front:l.images.work.getURL(l.images.front),back:l.images.work.getURL(l.images.back)},g=`pano:`+pp([h,m,f]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;{let t=this.pendingTextureTask.panoId;(i=this.panoMeshes.get(t))==null||i.setProgress(0),this.emit(`pano.texture.abort`,$(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let{pano0:_,pano1:v}=this.modelScene.parameter.resolveValue(),y;if((_==null?void 0:_.map.name)===g?y=_:(v==null?void 0:v.map.name)===g&&(y=v),y){let n={panoId:s,effect:o,effectEasing:(a=t.effectEasing)==null?Kg:a,leftPanoPicture:{panoId:y.panoId,map:y.map,mapHistogram:y.mapHistogram,mapSize:y.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};this.doMoveToPano(e,n,t);return}let b=`move-to-pano-`+s;this.pending.add(b),this.pendingTextureTask={panoId:s,hash:g,onLoad:n=>{var r,i;let a=n.body;if(this.destroyed)a.dispose();else{a.name=g;let n=Array.isArray(a.image)?a.image[0]:a.image,u=(r=n==null?void 0:n.width)==null?2048:r,d=new _m().formPixels(Vh(this.renderer,a,!0,pm).data),f={panoId:s,effect:o,effectEasing:(i=t.effectEasing)==null?Kg:i,leftPanoPicture:{panoId:s,map:a,mapSize:u,mapHistogram:new c.Vector4().fromArray(d.toArray()),matrix:l.matrix.clone(),zoom:1},position:l.position.clone(),fixCameraTransform:new c.Matrix4};this.doMoveToPano(e,f,t)}},onError:n=>{let r=Object.assign(Object.assign(Object.assign({},e),{mode:this.mode}),jh(this.camera.pose));this.emit(`pano.error`,$(`pano.error`,{error:n,userAction:this.userAction,options:t,prevPano:this.currentPano,progress:0,state:r})),this.emit(`pano.cancel`,$(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,progress:0,state:r})),t.moveCancelCallback&&t.moveCancelCallback()}};let x=this.panoMeshes.get(s);x&&x.tap&&x.tap(),this.textureLoader.loadCubeTexture(h,{imageURL:{transform:p,options:m},format:c.RGBFormat,fetcher:_f(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;((n=this.pendingTextureTask)==null?void 0:n.hash)===g&&((r=this.panoMeshes.get(s))==null||r.setProgress(t)),this.emit(`pano.texture.progress`,$(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e}))},this.renderer).then(t=>{var n,r;this.pending.delete(b),((n=this.pendingTextureTask)==null?void 0:n.hash)===g?(this.pendingTextureTask.onLoad(t),this.pendingTextureTask=void 0,(r=this.panoMeshes.get(s))==null||r.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,$(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}))}).then(()=>new Promise(e=>{ri.shared.add(()=>e(),!0)})).catch(t=>{var n,r;this.pending.delete(b),((n=this.pendingTextureTask)==null?void 0:n.hash)===g&&(this.pendingTextureTask.onError(t),this.pendingTextureTask=void 0,(r=this.panoMeshes.get(s))==null||r.setProgress(0)),this.emit(`pano.texture.error`,$(`pano.texture.error`,{error:t,progress:0,meta:null,pano:e})),this.emit(`error`,t)}),this.emit(`pano.texture.load`,$(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}doMoveToPano(e,t,n={}){var r,i,a,o,s,l,u,d,f,p;let m=U(),h=nn();this.panoResources[h]=t;let g,_,v;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(n).position,a=t.position;g=Math.max(i.distanceTo(a),1),_=[{key:n.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:h,progress:1,value:{distance:0,count:1}}],v=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(n).position,o=t.position,s=n.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;g=c+Math.max(a.distanceTo(o),1),_=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:c/g,value:n.value},{key:h,progress:1,value:{count:n.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(_);v=this.locationMotion.getProgressVelocity(m)*l/u}let y=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?g:0),b={longitude:n.longitude,latitude:n.latitude,fov:n.fov},x=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(r=b.longitude)==null?this.camera.pose.longitude:r,latitude:(i=b.latitude)==null?this.camera.pose.latitude:i,fov:(a=b.fov)==null?this.camera.pose.fov:a,offset:t.position.clone(),distance:0}),S=this.currentPano;if(this.emit(`pano.moveTo`,$(`pano.moveTo`,{options:n,prevPano:S,progress:0,state:x,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(x),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=q,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(b,y).catch(q);else{let e=Vt({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=Vt({longitude:(o=b.longitude)==null?this.cameraMotion.value.longitude:o,latitude:(s=b.latitude)==null?this.cameraMotion.value.latitude:s}),r=new c.Object3D;r.lookAt(e);let i=new c.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let a=new c.Matrix4().makeRotationFromQuaternion(r.quaternion),m=new c.Matrix4().getInverse(i).premultiply(a),h=this.cameraMotion.value.fov,g=(l=b.fov)==null?this.cameraMotion.value.fov:l,v=1;t.effect===`zoomin`?v=1.5:t.effect===`zoomout`&&(v=.4);let x=g*v;for(let e=0;e<_.length-1;e++){let t=_[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(m),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(x/2/180*Math.PI)/Math.tan(h/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:(u=b.longitude)==null?this.cameraMotion.value.longitude:u,latitude:(d=b.latitude)==null?this.cameraMotion.value.latitude:d,fov:x}},{progress:1,value:{longitude:(f=b.longitude)==null?this.cameraMotion.value.longitude:f,latitude:(p=b.latitude)==null?this.cameraMotion.value.latitude:p,fov:g}}],y).catch(q)}this.locationMotion.setKeyframes(_,y,v).then(()=>{for(let e of this.modelScene.children)e instanceof If&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:0});this.emit(`pano.arrived`,$(`pano.arrived`,{options:n,prevPano:S,progress:1,state:t,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(t);let r=this.works.getObserver(this.currentPano);if(r&&r.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:r.images.video.size.clone(),matrix:r.images.video.matrix.clone(),panoMatrix:r.matrix.clone().premultiply(r.work.transform),alpha:1},t=nn(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),rg().then(i=>{i&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=q,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=q,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}},()=>{this.emit(`pano.cancel`,$(`pano.cancel`,{options:n,prevPano:S,progress:0,state:x,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}checkSelectedPano(e){var t;this.stopMomentumMovement(),this.camera.getDirection(new c.Vector3).setY(0);let n=null,r=this.works.getObserver(this.currentPano);if(!r)return null;let i=r.work.observers,a=r.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let t=i[e];return!t||Rv.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[o]=this.modelScene.intersectRaycaster(e);if(o){let[e,r]=Nl(a,e=>{let t=i[e];return t?Rv.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(o.point):1/0},!0);typeof e==`number`&&r<this.panoTapTriggerRadius&&(n=(t=i[e])==null?null:t)}if(ev(n)){let t=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);t&&(n=t)}for(let e of this.locationMotion.keyframes){let t=this.panoResourceFromLocationMotionKeyframe(e);if(!(e.progress<this.locationMotion.progress)&&n){let e=Q({panoIndex:n.panoIndex,workCode:n.work.workCode});if(t.panoId===e){n=null;break}}}if(ev(n))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!n.active){let e=Q({panoIndex:n.panoIndex,workCode:n.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let s={workCode:n.work.workCode,panoIndex:n.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:n?n.position.clone():new c.Vector3};return this.emit(`pano.select`,$(`pano.select`,{prevPano:this.currentPano,state:s,userAction:!0,options:{},progress:0,error:null})),n&&n.active?(this.emit(`pano.request`,$(`pano.request`,{userAction:!0,prevPano:this.currentPano,progress:0,state:s,options:{},error:null})),{workCode:n.work.workCode,panoIndex:n.panoIndex}):null}destroy(){super.destroy()}isReady(){return!1}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,t,...n){var r,i,a,o,s,l,u,d,f;this.userAction=!0;let p={},m={},h=this.camera.getDirection(new c.Vector3),g=this.locationMotion.keyframes[0],_=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[v,y]=this.locationMotion.getKeyFrameSegment(e),b=this.panoResourceFromLocationMotionKeyframe(v),x=this.panoResourceFromLocationMotionKeyframe(y),S=this.panoResourceFromLocationMotionKeyframe(g),C=this.panoResourceFromLocationMotionKeyframe(_),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(W(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-y.value.count+1,n=new c.Vector3().copy(b.position),a=new c.Vector3().copy(x.position);if(p.progress=t,t>=.01&&t<=.99&&(p.progress=W(x.effectEasing(t),.01,.99)),x.leftPanoPicture&&(t<1?b.leftPanoPicture&&(p.pano0=b.leftPanoPicture):p.pano0=x.leftPanoPicture,p.pano1=x.leftPanoPicture),x.effect===`montage`?p.transition=`BLACK`:x.effect===`spread`?p.transition=`SPREAD`:p.transition=`FADE`,x.effect===`zoomin`||x.effect===`zoomout`?p.progress=Math.pow(t,3):x.effect===`model`&&this.camera.pose.distance<.01&&(p.modelAlpha=1-Math.pow(W(Math.abs(t-.5)*2,0,1),4)),t<1&&x.effect!==`fly`){if(p.pano0&&b.leftPanoPicture){let e={panoId:p.pano0.panoId,map:p.pano0.map,mapHistogram:p.pano0.mapHistogram,mapSize:p.pano0.mapSize,zoom:p.pano0.zoom,matrix:b.leftPanoPicture.matrix.clone().setPosition(x.position)},t=this.panoPictureObserverMap.get(p.pano0);t&&this.panoPictureObserverMap.set(e,t),p.pano0=e}n.copy(a),w=!0}m.distance=this.locationMotion.value.distance,m.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((r=p.pano0)==null?void 0:r.map)||e===((i=p.pano1)==null?void 0:i.map))continue;e.dispose(),t.leftPanoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}let l=hp(x.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,$(`pano.moving`,{userAction:this.userAction,prevPano:hp(S.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},hp(C.panoId)),{mode:this.mode}),jh(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(m),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);let[T,E]=n,D=new c.Vector3(0,0,0),O=new c.Vector2().copy(this.camera.resolution);if(E&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let n=this.xrManager.cameraVR,r=this.xrManager.referenceSpace,i=this.xrManager.session.renderState.baseLayer,l=E.getViewerPose(r),u=(a=l==null?void 0:l.views)==null?[]:a;for(let e=0;e<u.length;e++){let t=u[e],r=n.cameras[e],a=i.getViewport(t);a&&(r.projectionMatrix.fromArray(t.projectionMatrix),r.projectionMatrixInverse.getInverse(r.projectionMatrix),r.matrix.fromArray(t.transform.matrix),r.matrix.setPosition(this.camera.position),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixWorld.copy(r.matrix),r.matrixWorldInverse.getInverse(r.matrixWorld),r.matrixAutoUpdate=!1,D.copy(r.position),r.viewport.set(a.x,a.y,a.width,a.height),O.set(a.width,a.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((o=m.distance)==null?this.camera.pose.distance:o),this.xrManager.session.inputSources){for(let e=0;e<this.xrManager.session.inputSources.length;e++)if(this.xrManager.session.inputSources[e]&&this.xrManager.session.inputSources[e].targetRayMode===`transient-pointer`){let t=E.getPose(this.xrManager.session.inputSources[e].targetRaySpace,r);if(t){let e=t.transform.orientation,n=new c.Quaternion(e.x,e.y,e.z,e.w),r=new c.Vector3(0,0,-1).applyQuaternion(n);this.gazeRay=new c.Raycaster(this.camera.position,r)}}}if(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`){let n=this.xrManager.session.inputSources;for(let e=0;e<n.length;e++){let t=this.xrManager.controllers[e],i=n[e];if(!i)continue;t&&t.update(i,E,r);let a=this.xrManager.getController(e),o=new c.Vector3(0,1.2,0),l=a.position.clone().add(D).sub(o);i.handedness===`left`?this.xrControllerRay.left.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)):i.handedness===`right`&&this.xrControllerRay.right.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)),this.controllerWrappers[e].position.copy(new c.Vector3(0,0,0).add(D).sub(o));let u=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(u.length===0){let e=this.works.getResolvedObserver(this.currentPano);u=this.xrControllerRay.right.intersectObject(this.modelScene.boundingMesh,!0).map(t=>{var n;let r=(n=e==null?void 0:e.floorIndex)==null?0:n;return Object.assign({floorIndex:r,floor:r},t)})}if(u.length>=1&&u[0].face)if(i.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=u[0].face.normal,n=t.clone(),r=u[0].point.clone();this.intersectMesh.position.copy(r);let i=r.clone().add(n);if(this.intersectMesh.lookAt(i),Math.abs(t.y)>.99){let e=this.camera.position.clone().sub(r);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,e.length>0?(this.pointerLines.right.setPoints(l,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(l,u[0].point));let a=u[0],o=$(`intersect.update`,{raycaster:(s=this.xrControllerRay.right)==null?null:s,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(l,u[0].point)}this.updateControllerHelper(n,e,t)}}else E||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);Ph(p)===!1&&this.modelScene.parameter.set(p),this.emit(`camera.update`,$(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),jh(this.camera.pose))}));let k=this.works.getResolvedObserver(this.currentPano),A=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,j=this.works.getObserver(b.panoId),M=this.works.getObserver(x.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&k){let e=[],t=k.work.observers;for(let n of k.accessibleNodes){let r=t[n];r&&e.push(r)}let n=new Map;if(e.sort((e,t)=>{let r=n.get(e);r===void 0&&(r=e.standingPosition.distanceTo(k.standingPosition),n.set(e,r));let i=n.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(k.standingPosition),n.set(t,i)),r-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let t=e[this.accessibleObserverFloorCheckCount],n=this.modelScene.models.find(e=>e.work===(t==null?void 0:t.work));if(t&&n&&n.visible){let e=.3,r=.005,i=t.standingPosition.clone().applyMatrix4(t.work.transform),a=Q({panoIndex:t.panoIndex,workCode:t.work.workCode}),o=Yg.map(t=>{Lv.ray.origin.copy(i),Lv.ray.origin.add(Rv.copy(t).setY(e)),Lv.ray.direction.set(0,-1,0),Lv.firstHitOnly=!0,Lv.floorIndex=-1;let[a]=n.intersectRaycaster(Lv);return a&&a.distance-r<=e?new c.Vector3().copy(i).setY(a.point.y+r):i});o.sort((e,t)=>t.y-e.y);let s=o[Math.floor(o.length/2)],[l]=o.filter(e=>e.distanceTo(s)<=.05);if(l){let e=new c.Vector4(i.x,i.y,i.z,l.y-i.y),t=this.adjustPanoCircleMeshPositionFix.get(a);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(a,e)}}this.accessibleObserverFloorCheckCount++}}let N=new Map;if(j)for(let e of j.accessibleNodes){let t=j.work.observers[e];if(t){let e=Q({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(M)for(let e of M.accessibleNodes){let t=M.work.observers[e];if(t){let e=Q({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{N.get(t)?N.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),N.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),N.delete(t)}),this.panoMeshes.forEach((e,t)=>{let n=this.works.getObserver(t);if(n){let r=n.position.distanceTo(n.standingPosition)>this.aerialObserverMinHeight;if(r)e.position.copy(n.position).applyMatrix4(n.work.transform),e.scale.setScalar(18);else{e.position.copy(n.standingPosition).applyMatrix4(n.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(n.panoId);t&&(Rv.set(t.x,t.y,t.z),Rv.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let i=this.camera.position.clone().setY(e.position.y),a=new c.Vector3().copy(e.position).sub(i).normalize();if(t===Q(this.currentPano)){let t=W((.5-i.distanceTo(e.position))/.5,0,1);a.multiplyScalar(1-t).add(h.clone().multiplyScalar(t))}if(a.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(a.x,a.z);e.quaternion.setFromEuler(new c.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(k){let n=k.work.observers,[,r]=Nl(k.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:k.standingPosition.distanceTo(t.standingPosition)},!0);r=W(r,2.5,1/0);let i=k.accessibleNodes.concat(k.panoIndex).map(e=>Q({panoIndex:e,workCode:k.work.workCode}));this.panoMeshes.forEach((n,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=n.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&A!==null&&Q({panoIndex:A.panoIndex,workCode:A.work.workCode})===a;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=t<.01?0:W(r/t,.1,.85)}o&&o===M&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue().modelAlpha>0&&(c=0),n.setCurrent(s),n.setOpacity(c),n.updateTime&&n.updateTime(e,t)})}{let e=(l=this.modelScene.parameter.progress)==null?1:l,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,a;if(i&&(a=this.works.getObserver(i.panoId),a||(a=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(si()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!a||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Qr(i.mapSize)+1;this.tiling.setObserver(a);let o={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:i.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:e,level:4},s=this.tiling.update(o),c={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:Vu(Math.abs(((u=this.modelScene.parameter.progress)==null?0:u)-.5)*2)},l=this.modelScene.parameter.refinedScreen;(s||c.pano!==(l==null?void 0:l.pano)||c.opacity!==(l==null?void 0:l.opacity))&&this.modelScene.parameter.set(`refinedScreen`,c)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&k&&k.position.y-k.standingPosition.y>10){let e=W(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=x.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((d=this.modelScene.parameter.pano0Depth)==null?void 0:d.panoId)!==t.panoId||((f=this.modelScene.parameter.pano1Depth)==null?void 0:f.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,Gg(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,Gg(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}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))}}render(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){let e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}updateControllerHelper(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(!e||e.length===0)return;let a={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let o=0;o<e.length;o++){let s=e[o].handedness,c=e[o].gamepad;switch(s){case`left`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`LeftAxesDown`,t)),c!=null&&c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`X`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`Y`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`LeftTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n};a.buttons.X=c.buttons&&c.buttons[4]?c.buttons[4].pressed:!1,a.buttons.Y=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.LeftTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.LeftPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1,a.left=e;break;case`right`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`RightAxesDown`,t)),c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`A`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`B`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`RightTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`RightPinch`,t)),a.right={raycaster:i,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n},a.buttons.A=c.buttons&&c.buttons[4]?c==null?void 0:c.buttons[4].pressed:!1,a.buttons.B=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.RightTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.RightPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,$(`xr.controller.update`,a))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)this.xrHandleState[t].touchStart===!1?(this.xrHandleState[t].touchStartTime=n,this.xrHandleState[t].touchStart=!0,this.emit(`xr.gesture.buttonDown`,$(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrHandleState[t].touchStartTime>Iv&&this.emit(`xr.gesture.press`,$(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,$(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrHandleState[t].touchStartTime<=Iv){let e=$(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}});!this.emit(`xr.gesture.tap`,e)&&!e.defaultPrevented&&t===`RightTrigger`&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[t].touchStart=!1,this.xrHandleState[t].touchStartTime=0}}initHandEvent(){if(!this.xrManager.session)throw Error(`初始化失败`);this.xrManager.session.addEventListener(`select`,e=>{this.gazeRay&&this.checkSelectedPano(this.gazeRay)})}}},Bv={Floorplan:Yh,Topview:Zh,Panorama:Xg,VRPanorama:V_,Model:K_,Mapview:Q_,XRPanorama:Pv},Vv=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.create,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`.split(`,`);function Hv(e){e.on(`initAnimation.start`,t=>{e.emit(`initAnimationWillStart`,t.state.panoIndex,t.state,t.userAction)}),e.on(`initAnimation.end`,t=>{e.emit(`initAnimationEnded`,t.state.panoIndex,t.state,t.userAction)}),e.on(`gesture.pan`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pan`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPanGesture`,t.state,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pan`,t.pointers,t.isFinal),e.emit(`panGesture`,t.state,t.isFinal))}),e.on(`gesture.tap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`tap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`tap`,t.pointers,t.isFinal),e.emit(`tapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.dbltap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`dbltap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsDblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`dbltap`,t.pointers,t.isFinal),e.emit(`dblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.press`,t=>{let n=!1;n=e.emit(`wantsGesture`,`press`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`press`,t.pointers,t.isFinal),e.emit(`pressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),e.on(`gesture.pinch`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pinch`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPinchGesture`,t.scale,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pinch`,t.pointers,t.isFinal),e.emit(`pinchGesture`,t.scale,t.state.fov,t.isFinal))}),e.on(`gesture.mousewheel`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseWheel`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsMouseWheel`,t.center.delta,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseWheel`,t.pointers,t.isFinal),e.emit(`mouseWheel`,t.center.delta,t.state.fov,t.isFinal))}),e.on(`gesture.mousemove`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseMove`,t.pointers,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseMove`,t.pointers,t.isFinal),n=e.emit(`wantsChangeCameraFov`,t.state.fov),n&&t.preventDefault())}),e.on(`gesture.momentum`,t=>{let n=!1;n=e.emit(`wantsInteriaPan`,t.state),n&&t.preventDefault(),t.defaultPrevented||e.emit(`interiaPan`,t.state,t.isFinal)}),e.on(`camera.update`,t=>{e.emit(`cameraFovUpdate`,t.state.fov,t.userAction),e.emit(`cameraDirectionUpdate`,t.state,t.userAction);let n=Vt(t.state);n.setLength(t.state.distance);let r=t.state.offset.clone().sub(n);e.emit(`cameraPositionUpdate`,r,t.userAction),e.emit(`cameraUpdate`,t.state,t.userAction)}),e.on(`intersect.update`,t=>{if(t.intersection){let n=!1;n=e.emit(`wantsShowIntersectionOnModel`,t.raycaster),n&&t.preventDefault(),t.defaultPrevented||e.emit(`intersectionOnModelUpdate`,t.intersection,t.object)}else e.emit(`intersectionHidden`)}),e.on(`pano.request`,t=>{let n=e.emit(`wantsMoveToPano`,t.state.panoIndex,t.options,t.userAction);n||(n=e.emit(`wantsToMoveToPano`,t.state.panoIndex,t.options,t.userAction)),n&&t.preventDefault(),t.defaultPrevented||e.emit(`panoWillLoad`,t.state.panoIndex)}),e.on(`pano.select`,t=>{e.emit(`panoSelected`,t.state.panoIndex)}),e.on(`pano.moveTo`,t=>{e.emit(`panoLoaded`,t.state.panoIndex),e.emit(`moveToPano`,t.state.panoIndex,t.userAction),e.emit(`panoWillArrive`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.moving`,t=>{e.emit(`movingToPano`,t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),e.on(`pano.arrived`,t=>{e.emit(`panoArrived`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.cancel`,t=>{e.emit(`moveToPanoCanceled`,t.state.panoIndex)}),e.on(`pano.error`,t=>{e.emit(`panoLoadError`,t.error,t.state.panoIndex)}),e.on(`pano.texture.load`,t=>{e.emit(`textureStartLoad`,t.pano.panoIndex)}),e.on(`pano.texture.success`,t=>{e.emit(`textureLoaded`,t.pano.panoIndex,t.meta)}),e.on(`pano.texture.error`,t=>{e.emit(`textureError`,t.error,t.pano.panoIndex)}),e.on(`pano.texture.abort`,t=>{e.emit(`textureAbort`,t.pano.panoIndex)}),e.on(`pano.texture.progress`,t=>{e.emit(`textureLoading`,t.progress,t.pano.panoIndex)}),e.on(`xr.session.start`,t=>{e.emit(`webXRSessionStart`)}),e.on(`xr.session.end`,t=>{e.emit(`webXRSessionEnd`)}),e.on(`xr.gesture.tap`,t=>{e.emit(`webXRControllerEvent`,`tap`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.press`,t=>{e.emit(`webXRControllerEvent`,`press`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonUp`,t=>{e.emit(`webXRControllerEvent`,`buttonUp`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonDown`,t=>{e.emit(`webXRControllerEvent`,`buttonDown`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.controller.update`,t=>{e.emit(`webXRControllerRayUpdate`,{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&e.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&&e.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})}),e.on(`works.request`,t=>{e.emit(`willLoad`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.load`,t=>{e.emit(`load`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.ready`,t=>{e.emit(`loaded`,t.input,t.works[0])}),e.on(`state.change`,t=>{e.emit(`stateChange`,t.state,t.userAction)}),e.on(`currentState.change`,t=>{e.emit(`currentStateChange`,t.state,t.userAction)}),e.on(`state.set`,t=>{e.emit(`setState`,t.state)}),e.on(`state.synced`,t=>{e.emit(`stateSynced`,t.state)}),e.on(`model.request`,t=>{e.emit(`modelWillLoad`,t.work.model)}),e.on(`model.error`,t=>{e.emit(`modelLoadError`,t.error,t.model)}),e.on(`model.load`,t=>{e.emit(`modelLoaded`,t.model)}),e.on(`model.changeShownFloor`,t=>{e.emit(`modelShownFloorChange`,t.model.shownFloor,t.model.floorLength)}),e.on(`render`,t=>{e.emit(`renderFrame`,t.needsRender)}),e.on(`mode.change.request`,t=>{e.emit(`wantsChangeMode`,t.mode,t.prevMode)}),e.on(`mode.change`,t=>{e.emit(`modeChange`,t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),e.on(`helpers.visible`,t=>{e.emit(`helpersVisibleChange`,t.object.visible)}),e.on(`network.resource`,t=>{e.emit(`network`,t.source,t.requestType,t.requestState,t.detail)})}function Uv(){if(typeof window<`u`){let e=document.createElement(`video`);e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin=``;let t=()=>{document.removeEventListener(`touchstart`,t,!1),document.removeEventListener(`mousedown`,t,!1),e.muted=!1};return document.addEventListener(`touchstart`,t,!1),document.addEventListener(`mousedown`,t,!1),e}else return{}}function Wv(){let e=new c.Group;e.name=`internalLights`;{let t=new c.DirectionalLight(16777215,.1);t.name=`direction0`,t.position.copy(new c.Vector3(0,1,0)),e.add(t)}{let t=new c.DirectionalLight(16777215,.1);t.name=`direction1`,t.position.copy(new c.Vector3(-1,-1,-1)),e.add(t)}{let t=new c.DirectionalLight(16777215,.3);t.name=`direction2`,t.position.copy(new c.Vector3(1,1,1)),e.add(t)}{let t=new c.AmbientLight(16777215,.6);t.name=`ambient0`,e.add(t)}return e}function Gv(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function Kv(){var e;if(typeof document<`u`){let t=document.getElementsByTagName(`meta`);for(let n=0;n<t.length;n++){let r=t[n];if(r.getAttribute(`name`)===`viewport`){let t=Gv((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var qv=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==`,Jv=[351,63],Yv=[20,20],Xv=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Zv=new Float32Array([0,0,1,0,0,1,1,1]),Qv=new Uint8Array([0,1,2,1,3,2]),$v=new c.BufferGeometry;$v.setAttribute(`position`,new c.BufferAttribute(Xv,3)),$v.setAttribute(`uv`,new c.BufferAttribute(Zv,2)),$v.setIndex(new c.BufferAttribute(Qv,1));var ey=new c.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),ty=new c.Mesh($v,ey);ty.matrixAutoUpdate=!1;var ny=new c.Scene;ny.add(ty),ny.matrixAutoUpdate=!1;var ry=new c.OrthographicCamera(-.5,.5,.5,-.5,.1,1);ry.position.set(0,0,.5),ry.lookAt(0,0,0),ry.updateMatrixWorld(!0),ry.matrixAutoUpdate=!1;var iy=new c.Vector4,ay=new c.Vector4;function oy(e){if(ey.map){let t=e.getViewport(iy),n=e.getScissor(ay),r=e.getScissorTest(),i=e.autoClear,a=n.x+Yv[0]/3,o=n.y+Yv[1]/3,s=Jv[0]/3,c=Jv[1]/3;e.setViewport(a,o,s,c),e.setScissor(a,o,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(ny,ry),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{let e=new c.Texture,t=new Image;t.onload=()=>{e.image=t,e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,ey.needsUpdate=!0,t.onload=q},t.src=qv,ey.map=e}}var sy=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}async function t(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i)try{new URL(\`.\`,a).href}catch{}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==\`function\`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==\`function\`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(\`\\0asm\\0\\0\\0&\\\`\\\`}}\\\`}\\\`\\0\\\`\\v\\0\\\`\\0\\0\\x07aa\\0\\0\\b\\x07\\0\\0\\x07‚€€\\bA€Œ\\v\\x07b\\0c\\0\\x07d\\0e\\0f\\0\\f
2238
2238
  ™@\\x07T~@A€\\b(\\0"­ \\0­B\\x07|Bøÿÿÿƒ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vA„\\bA06\\0A\\vA€\\b \\x006\\0 \\v\\0 \\0 Atr\\vr \\0¼"Aÿÿÿq!@ AvAÿq"E\\r\\0 Að\\0M@ A€€€rAñ\\0 kv!\\f\\v AK@A€ø!A\\0!\\f\\v A
2239
2239
  tA€€\\x07k!\\v  AvA€€qr A\\rvr\\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r  (\\0"k"A˜\\b(\\0I\\r \\0 j!\\0@@@Aœ\\b(\\0 G@ (\\f! AÿM@  (\\b"G\\rAˆ\\bAˆ\\b(\\0A~ Avwq6\\0\\f\\v (!\\x07  G@ (\\b" 6\\f  6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rA\\b \\x006\\0  A~q6  \\0Ar6  \\x006\\0\\v  6\\f  6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(¸
2240
2240
  F@ A¸
@@ -2320,4 +2320,4 @@ A\\0H@@@ \\0 F\\r\\0 \\x07  \\0Atj(\\0Atj" (\\0"Aj6\\0  Atj \\x
2320
2320
  At"j \\b Aj"j(\\0  \\x07j(\\0j6\\0
2321
2321
  Ak!
2322
2322
  \\f\\v\\v\\v\\0\\v\\v \\0A\\b\\v\`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:P}}function b(){function e(e,t){return I=e.exports,N(I),d(),I}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h??=g(),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch{}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==\`function\`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._sort=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var P={a:k};function F(){f();function e(){n.calledRun=!0,!o&&(p(),c?.(n),n.onRuntimeInitialized?.(),m())}n.setStatus?(n.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>n.setStatus(\`\`),1),e()},1)):e()}var I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}let n;function r(){return e(this,void 0,void 0,function*(){n=yield t()})}let i,a,o,s,c,l,u,d,f,p=0,m=0,h=[],g=!0,_=!1,v=!1,y=!1,b=()=>e(void 0,void 0,void 0,function*(){if(_){v=!0;return}_=!0,v=!1,n||(yield r());let e=2**Math.ceil(Math.log2(i.vertexCount));p<e&&(p>0&&(n._free(a),n._free(s),n._free(c),n._free(l),n._free(u),n._free(d),n._free(f)),p=e,a=n._malloc(64),s=n._malloc(p*4),c=n._malloc(3*p*4),l=n._malloc(p*4),u=n._malloc(p*4),d=n._malloc(p*4),f=n._malloc(p*4)),m<i.transforms.length&&(m>0&&n._free(o),m=i.transforms.length,o=n._malloc(m*4)),_=!1,v&&(v=!1,yield b())}),x=()=>{if(_||v||!n)return;_=!0,n.HEAPF32.set(i.positions,c/4),n.HEAPF32.set(i.transforms,o/4),n.HEAPU32.set(i.transformIndices,s/4),n.HEAPF32.set(new Float32Array(h),a/4),n._sort(a,o,s,i.vertexCount,c,l,u,d,f);let e=new Uint32Array(n.HEAPU32.buffer,u,i.vertexCount),t=new Uint32Array(e.slice().buffer);self.postMessage({depthIndex:t},[t.buffer]),_=!1,g=!1},S=()=>{y||(y=!0,g&&x(),setTimeout(()=>{y=!1,S()}))};self.onmessage=e=>new Promise((t,n)=>{e.data.sortData&&(i={positions:new Float32Array(e.data.sortData.positions),transforms:new Float32Array(e.data.sortData.transforms),transformIndices:new Uint32Array(e.data.sortData.transformIndices),vertexCount:e.data.sortData.vertexCount},g=!0,b()),e.data.viewProj&&(e.data.viewProj.every(e=>h.includes(e))===!1&&(h=e.data.viewProj,g=!0),S(),t(!0))})})();`,gy=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,hy],{type:`text/javascript;charset=utf-8`});function _y(e){let t;try{if(t=gy&&(self.URL||self.webkitURL).createObjectURL(gy),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(hy),{name:e==null?void 0:e.name})}}var vy=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{Hnvor-v{-}ynV{qr\x07H{vs|z-uvtu}-nz}yr?Q-lr\x07rH{vs|z-uvtu}-nz}yr?Q-ln{s|zH{vs|z-uvtu}-nz}yr?Q-ln{s|zV{qvprH{vs|z-uvtu}-nz}yr?Q-luar\x07rH{vs|z-rp?-luar\x07r`v rH{vs|z-v{-lzn\x07`uQrtrrH{vs|z-rp?-r|yv|{Hn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH<<参考Tnvn{`}yn@qp|{-sy|n-\0E-J-\05E;=6H<<原版的固定xr{ry`v r,不要轻易调整这个数p|{-sy|n-xr{ry?Q`v r-J-=;@Hp|{-sy|n-zn\x07`prr{`}npr`}yn`v r-J-?=AE;=H<<固定的u相关系数p|{-sy|n-`UlP>-J-=;AEEC=?B>>F=?F>FFHp|{-sy|n-`UlP?l=-J->;=F?BAEAHp|{-sy|n-`UlP?l>-J-:>;=F?BAEAHp|{-sy|n-`UlP?l?-J-=;@>B@F>CHp|{-sy|n-`UlP?l@-J-:>;=F?BAEAHp|{-sy|n-`UlP?lA-J-=;BAC?DA?Hrp?-tr`UQnnbc5v{-}ynVq\x079-v{-p|z}|{r{\\ssr9-rp?-r\x07r`v r6-\n----v{-uP|z}|{r{P|{-J-=H----vs-5lzn\x07`uQrtrr-KJ->6-uP|z}|{r{P|{-8J-FH----vs-5lzn\x07`uQrtrr-KJ-?6-uP|z}|{r{P|{-8J->BH----vs-5lzn\x07`uQrtrr-KJ-@6-uP|z}|{r{P|{-8J-?>H--------v{-}nqqrqP|z}|{r{P|{-J-uP|z}|{r{P|{H----vs-5}nqqrqP|z}|{r{P|{-2-A-.J-=6-\n--------}nqqrqP|z}|{r{P|{-J-55}nqqrqP|z}|{r{P|{-<-A6-8->6-7-AH----\f--------sy|n-yv{rnP|z}|{r{V{qr\x07-J-sy|n5}ynVq\x07-7-}nqqrqP|z}|{r{P|{-8-p|z}|{r{\\ssr6H----sy|n-r\x07ryV{qr\x07-J-yv{rnP|z}|{r{V{qr\x07-<-A;=H------sy|n-q-J-r\x07ryV{qr\x07-<-r\x07r`v r;\x07H----sy|n-\b-J-sy||5q6-<-r\x07r`v r;\bH----sy|n-\x07-J-snp5q6H----r{-rp?5\x079-\b6H\f|vq-znv{-56-\n----rpA-pr{-J-r\x07rySrpu5lr\x07r9-vrp?55v{5}ynV{qr\x076-3-=\x07@ss6-II->9-v{5}ynV{qr\x076-KK->=69-=6H--------v{-n{s|zV{qr\x07-J-r\x07rySrpu5ln{s|zV{qvpr9-vrp?5v{5}ynV{qr\x076-3-=\x07@ss9-v{5}ynV{qr\x076-KK->=69-=6;\x07H----znA-n{s|z-J-znA5--------r\x07rySrpu5ln{s|z9-vrp?5=9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5>9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5?9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5@9-n{s|zV{qr\x0769-=6----6H----znA-n{s|zZ|qrycvrZnv\x07-J-vrZnv\x07-7-n{s|zH----rp@-}ynPr{r-J-v{Ova|Sy|n5pr{;\x07\b 6H----rpA-vrPr{r-J-n{s|zZ|qrycvrZnv\x07-7-rpA5}ynPr{r9->;=6H----rpA-pyv}Pr{r-J-}|wrpv|{Znv\x07-7-vrPr{rH----<<剔除超出视锥体的}yn----sy|n-pyv}-J->;?-7-pyv}Pr{r;H----vs-5pyv}Pr{r; -I-:pyv}Pr{r;-\v\v-pyv}Pr{r; -K-pyv}Pr{r;-\v\v---------pyv}Pr{r;\x07-I-:pyv}-\v\v-pyv}Pr{r;\x07-K-pyv}-\v\v---------pyv}Pr{r;\b-I-:pyv}-\v\v-pyv}Pr{r;\b-K-pyv}6-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f----rp@-{qpPr{r-J-pyv}Pr{r;\x07\b -<-pyv}Pr{r;H----rp?-s|pny-J-rp?5--------}|wrpv|{Znv\x07h=jh=j-7-r|yv|{;\x07-7-=;B9--------}|wrpv|{Znv\x07h>jh>j-7-r|yv|{;\b-7-=;B----6H--------]|vv|{-J-}|vv|{;\x07\bH----<<-读取协方差数据(使用-unys?\x07>C-打包)----rpA-p|-J-r\x07rySrpu5lr\x07r9-vrp?555v{5}ynV{qr\x076-3-=\x07@ss6-II->6-\v->9-v{5}ynV{qr\x076-KK->=69-=6H----rp?->-J-{}npxUnys?\x07>C5p|;\x076H-----rp?-?-J-{}npxUnys?\x07>C5p|;\b6H------rp?-@-J-{}npxUnys?\x07>C5p|; 6H----------sy|n-Z>>-J->;\x07-<-A;=H----sy|n-Z>?-J->;\b-<-A;=H----sy|n-Z>@-J-?;\x07-<-A;=H----sy|n-Z??-J-?;\b-<-A;=H----sy|n-Z?@-J-@;\x07-<-A;=H----sy|n-Z@@-J-@;\b-<-A;=H--------zn@-cx-J-zn@5--------Z>>9-Z>?9-Z>@9--------Z>?9-Z??9-Z?@9----------Z>@9-Z?@9-Z@@-------6H----<<-判断是否是正交模式:透视时-}|wrpv|{Znv\x07h@jh@j-J-=,正交时-J->----o||y-v\\u|tn}uvp-J-}|wrpv|{Znv\x07h@jh@j-K-=;DH----sy|n-n{vznv|{]|tr-J--}|wrpv|{Znv\x07h@jh@jH----zn@-WH----vs-5v\\u|tn}uvp6-\n--------<<-正交模式的雅可比矩阵--------W-J-n{}|r5zn@5------------s|pny;\x079-=;=9-=;=9------------=;=9-s|pny;\b9-=;=9------------=;=9-=;=9-=;=--------66H----\f-ryr-\n--------<<-透视模式的雅可比矩阵--------sy|n--J->;=-<-5vrPr{r; -7-vrPr{r; 6H--------W-J-zn@5------------s|pny;\x07-<-vrPr{r; 9-=;=9-:5s|pny;\x07-7-vrPr{r;\x076-7-9------------=;=9-s|pny;\b-<-vrPr{r; 9-:5s|pny;\b-7-vrPr{r;\b6-7-9------------=;=9-=;=9-=;=--------6H----\f----zn@-d-J-n{}|r5zn@5n{s|zZ|qrycvrZnv\x0766H----zn@-a-J-d-7-WH----<<-将-@Q-协方差矩阵变换为-?Q-协方差矩阵----zn@-p|?Qz-J-n{}|r5a6-7-cx-7-aH----p|?Qzh=jh=j-8J-xr{ry?Q`v rH----p|?Qzh>jh>j-8J-xr{ry?Q`v rH----rp@-p|?Q-J-rp@5p|?Qzh=jh=j9-p|?Qzh=jh>j9-p|?Qzh>jh>j6H----sy|n-n-J-p|?Q;\x07H----sy|n-q-J-p|?Q; H----sy|n-o-J-p|?Q;\bH----sy|n-Q-J-n-7-q-:-o-7-oH----sy|n-npr-J-n-8-qH----sy|n-npr\\r?-J-=;B-7-nprH----sy|n-rz?-J-\05zn\x075=;>9-npr\\r?-7-npr\\r?-:-Q66H----sy|n-rvtr{cnyr>-J-npr\\r?-8-rz?H----sy|n-rvtr{cnyr?-J-npr\\r?-:-rz?H----vs-5rvtr{cnyr?-IJ-=;=6-\n--------r{H----\f----rp?-rvtr{crp|>-J-{|znyv r5rp?5o9-rvtr{cnyr>-:-n66H----rp?-rvtr{crp|?-J-rp?5rvtr{crp|>;\b9-:rvtr{crp|>;\x076H----rp?-onvcrp|>-J-rvtr{crp|>--7-zv{5\0E-7-\05rvtr{cnyr>69-zn\x07`prr{`}npr`}yn`v r6H----rp?-onvcrp|?-J-rvtr{crp|?--7-zv{5\0E-7-\05rvtr{cnyr?69-zn\x07`prr{`}npr`}yn`v r6H----rp?-onvcvr}|-J-rp?5>;=-<-r|yv|{;\x079->;=-<-r|yv|{;\b6H----rp?-{qp\\ssr-J-rp?5]|vv|{;\x07-7-onvcrp|>-8-]|vv|{;\b-7-onvcrp|?6-7---------------------onvcvr}|-7-?;=H----rpA-\0nq]|-J-rpA5{qpPr{r;\x07\b-8-{qp\\ssr9-{qpPr{r; 9->;=6H----tyl]|vv|{-J-\0nq]|H----<<-读取颜色----rpA-p|y|-J-rpA5--------5p|;6-3-=\x07ss9--------5p|;-KK-E6-3-=\x07ss9--------5p|;-KK->C6-3-=\x07ss9--------5p|;-KK-?A6-3-=\x07ss----6-<-?BB;=H----<<应用球谐光照,目前只兼容=>?----vs-5lzn\x07`uQrtrr-KJ->6-\n--------rp@-pnzrn]|V{\\owrp-J-rp@5v{rr5n{s|z6-7-rpA5pnzrn]|vv|{9->;=66H--------rp@-|owrpcvrQv-J-{|znyv r5}ynPr{r-:-pnzrn]|V{\\owrp6H----------------rpA-u=>?@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079-=9-luar\x07r`v r66H----------rpA-uABCD-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079-A9-luar\x07r`v r66H----------rpA-uEF>=>>-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079-E9-luar\x07r`v r66H-----------------rp@-u>-J-u=>?@;toH-----------------------------------rp@-u?-J-rp@5u=>?@;n9-uABCD;t6H---------------------rp@-u@-J-rp@5uABCD;on9-uEF>=>>;6H-----------------------------sy|n-\x07-J-|owrpcvrQv;\x07H--------sy|n-\b-J-|owrpcvrQv;\bH--------sy|n- -J-|owrpcvrQv; H--------rp@-uP|y|-J-u>-7-5:=;AEEC=?B-7-\b6-8-u?-7-5=;AEEC=?B-7- 6-8-u@-7-5:=;AEEC=?B-7-\x076H--------p|y|;to-8J-uP|y|H----------------vs-5lzn\x07`uQrtrr-KJ-?6-\n----------------------rpA-u>?>@>A>B-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079->?9-luar\x07r`v r66H------------rpA-u>C>D>E>F-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079->C9-luar\x07r`v r66H-------------rpA-u?=?>???@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079-?=9-luar\x07r`v r66H-------------------------rp@-uA-J-uEF>=>>;tonH------------------------------------rp@-uB-J-u>?>@>A>B;toH----------------------------------rp@-uC-J-rp@5u>?>@>A>B;n9-u>C>D>E>F;t6H---------------rp@-uD-J-rp@5u>C>D>E>F;on9-u?=?>???@;6H---------------rp@-uElqrt?-J-u?=?>???@;tonH-----------------------------------------sy|n-\x07\x07-J-\x07-7-\x07H------------sy|n-\b\b-J-\b-7-\bH------------sy|n- -J- -7- H------------sy|n-\x07\b-J-\x07-7-\bH------------sy|n-\b -J-\b-7- H------------sy|n-\x07 -J-\x07-7- H------------------------p|y|;to-8J----------------5`UlP?l=-7-\x07\b6-7-uA-8----------------5`UlP?l>-7-\b 6-7-uB-8----------------5`UlP?l?-7-5?;=-7- -:-\x07\x07-:-\b\b66-7-uC-8----------------5`UlP?l@-7-\x07 6-7-uD-8----------------5`UlP?lA-7-5\x07\x07-:-\b\b66-7-uElqrt?H--------\f----\f--------p|y|;to-J-pynz}5p|y|;to9-rp@5=;=69-rp@5>;=66H----P|y|-J-p|y|H----]|vv|{-7J-\0EH----b-J-}|vv|{;\x07\bH\f"),yy=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`}rpvv|{-uvtu}-sy|nH0v{pyqr-Ip|zz|{Kn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH|vq-znv{-56-
2323
- ----<<-计算从-}yn-中心到当前片段的平方距离----<<-由于-]|vv|{-已经按-\05E6-缩放,平方结果会被缩放-E-倍----<<-如果平方结果大于-E,说明在椭圆外,距离均值超过-\05E6-个标准差----sy|n-N-J-q|5]|vv|{9-]|vv|{6H----vs-5N-K-E;=6-qvpnqH--------rp@-p|y|-J-P|y|;toH--------<<-由于渲染的-}yn-按-\05E6-缩放,高斯公式中的逆协方差矩阵部分变成单位矩阵----<<-因此只剩下-5e-:-zrn{6-7-5e-:-zrn{6,而-zrn{-为零,所以是-e-7-e,即-N----sy|n-|}npv\b-J-r\x07}5:=;B-7-N6-7-P|y|;nH--------tylSntP|y|-J-rpA5p|y|;to9-|}npv\b6H\f`),by=class extends c.Mesh{constructor(){super(),this.renderData=null,this.needsRender=!1,this.sortWorker=null,this.depthIndex=new Uint32Array,this.splatIndexCapacity=0,this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.shTexture=null,this.usedSHDegree=0,this.onBeforeRender=(e,t,n)=>{var r,i;let a=n,o=this.collectObjects(t);if(o.length===0){this.geometry.instanceCount=0;return}let s=0;if(o.forEach(e=>{e.usedSHDegree>s&&(s=e.usedSHDegree)}),this.setMaxShDegree(s),this.isSceneNeedsRebuild(o)&&(this.renderData&&this.renderData.dispose(),this.shTexture&&(this.shTexture.dispose(),this.shTexture=null),this.renderData=new my(o),this.createTextures(),this.ensureSplatIndexCapacity(this.renderData.numPoints)),!this.renderData)return;if(o.forEach(e=>{e.transformChanged&&this.renderData.updateTransform(e)}),this.renderData.dataChanged||this.renderData.transformsChanged){let e=new Float32Array(this.renderData.positions.slice().buffer),t=new Float32Array(this.renderData.transforms.slice().buffer),n=new Uint32Array(this.renderData.transformIndices.slice().buffer);(r=this.sortWorker)==null||r.postMessage({sortData:{positions:e,transforms:t,transformIndices:n,vertexCount:this.renderData.numPoints}},[e.buffer,t.buffer,n.buffer])}this.renderData.dataChanged&&this.dataTexture&&(this.dataTexture.needsUpdate=!0,this.renderData.dataChanged=!1),this.renderData.transformsChanged&&this.transformsTexture&&this.transformIndicesTexture&&(this.transformsTexture.needsUpdate=!0,this.transformIndicesTexture.needsUpdate=!0,this.renderData.transformsChanged=!1);let l=Math.min(this.usedSHDegree,this.renderData.maxShDegree);this.material.uniforms.u_maxShDegree.value=l,l>0&&!this.shTexture?this.createSHTexture():l===0&&this.shTexture&&(this.shTexture.dispose(),this.shTexture=null,this.material.uniforms.u_shTexture.value=null);let u=new c.Matrix4().multiplyMatrices(a.perspectiveProjectionMatrix,a.matrixWorldInverse);(i=this.sortWorker)==null||i.postMessage({viewProj:u.elements}),this.material.uniforms.resolution.value.set(a.resolution.x,a.resolution.y)};let e=this.createGeometry(),t=this.createMaterial();this.geometry=e,this.material=t,this.frustumCulled=!1,this.renderOrder=-99999999999,this.gsSceneState={lastObjectsHash:``},this.sortWorker=new _y,this.sortWorker.onmessage=e=>{if(e.data.depthIndex){this.depthIndex=e.data.depthIndex;let t=this.depthIndex.length,n=this.ensureSplatIndexCapacity(t);n.array.set(this.depthIndex,0),n.count=this.depthIndex.length,n.updateRange.offset=0,n.updateRange.count=t,n.needsUpdate=!0,this.geometry.instanceCount=this.depthIndex.length,this.needsRender=!0}}}ensureSplatIndexCapacity(e){let t=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return t;let n=this.getExpandedCapacity(e),r=t.array,i=new Int32Array(n);i.set(r.subarray(0,Math.min(r.length,n)));let a=new c.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(c.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=n,this.geometry._maxInstanceCount=n,a}getExpandedCapacity(e){let t=Math.max(this.splatIndexCapacity,1);for(;t<e;)t*=2;return t}createGeometry(){let e=new c.InstancedBufferGeometry,t=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]);e.setAttribute(`position`,new c.BufferAttribute(t,3));let n=new Uint16Array([0,1,2,0,2,3]);e.setIndex(new c.BufferAttribute(n,1)),this.splatIndexCapacity=1;let r=new Int32Array(this.splatIndexCapacity);for(let e=0;e<r.length;e++)r[e]=e;let i=new c.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(c.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}createMaterial(){return new c.ShaderMaterial({vertexShader:vy,fragmentShader:yy,uniforms:{u_texture:{value:null},u_transforms:{value:null},u_transformIndices:{value:null},u_shTexture:{value:null},u_shTextureSize:{value:new c.Vector2},u_maxShDegree:{value:0},resolution:{value:new c.Vector2}},side:c.DoubleSide,transparent:!0,blending:c.NormalBlending,depthTest:!0,depthWrite:!1})}createTextures(){this.renderData&&(this.dataTexture=new c.DataTexture(this.renderData.data,this.renderData.width,this.renderData.height,c.RGBAIntegerFormat,c.UnsignedIntType),this.dataTexture.internalFormat=`RGBA32UI`,this.dataTexture.minFilter=c.NearestFilter,this.dataTexture.magFilter=c.NearestFilter,this.dataTexture.needsUpdate=!0,this.transformsTexture=new c.DataTexture(this.renderData.transforms,this.renderData.transformsWidth,this.renderData.transformsHeight,c.RGBAFormat,c.FloatType),this.transformsTexture.internalFormat=`RGBA32F`,this.transformsTexture.minFilter=c.NearestFilter,this.transformsTexture.magFilter=c.NearestFilter,this.transformsTexture.needsUpdate=!0,this.transformIndicesTexture=new c.DataTexture(this.renderData.transformIndices,this.renderData.transformIndicesWidth,this.renderData.transformIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType),this.transformIndicesTexture.internalFormat=`R32UI`,this.transformIndicesTexture.minFilter=c.NearestFilter,this.transformIndicesTexture.magFilter=c.NearestFilter,this.transformIndicesTexture.needsUpdate=!0,this.material.uniforms.u_texture.value=this.dataTexture,this.material.uniforms.u_transforms.value=this.transformsTexture,this.material.uniforms.u_transformIndices.value=this.transformIndicesTexture,this.usedSHDegree>0&&this.renderData.maxShDegree>0&&this.createSHTexture())}createSHTexture(){if(!this.renderData)return;this.shTexture&&(this.shTexture.dispose(),this.shTexture=null);let e=Math.min(this.usedSHDegree,this.renderData.maxShDegree),t=0;if(e>=1&&(t+=9),e>=2&&(t+=15),e>=3&&(t+=21),t===0)return;let n=t;n%4!=0&&(n=Math.ceil(n/4)*4);let r=this.renderData.numPoints*n/4,i=2048,a=Math.ceil(r/i),o=new Float32Array(i*a*4);for(let t=0;t<this.renderData.numPoints;t++){let r=n/4*t,i=0;if(this.renderData.sh1&&e>=1)for(let e=0;e<9;e++){let n=r+Math.floor(i/4),a=i%4,s=n*4+a;o[s]=this.renderData.sh1[t*9+e],i++}if(this.renderData.sh2&&e>=2)for(let e=0;e<15;e++){let n=r+Math.floor(i/4),a=i%4,s=n*4+a;o[s]=this.renderData.sh2[t*15+e],i++}if(this.renderData.sh3&&e>=3)for(let e=0;e<21;e++){let n=r+Math.floor(i/4),a=i%4,s=n*4+a;o[s]=this.renderData.sh3[t*21+e],i++}}this.shTexture=new c.DataTexture(o,i,a,c.RGBAFormat,c.FloatType),this.shTexture.internalFormat=`RGBA32F`,this.shTexture.minFilter=c.NearestFilter,this.shTexture.magFilter=c.NearestFilter,this.shTexture.needsUpdate=!0,this.material.uniforms.u_shTexture.value=this.shTexture,this.material.uniforms.u_shTextureSize.value.set(i,a),this.material.uniforms.u_maxShDegree.value=e}setMaxShDegree(e){if(e<0||e>2){console.warn(`现在只支持012三种阶数,你输入的是${e}`);return}let t=this.usedSHDegree;this.usedSHDegree=e,t!==e&&(this.shTexture&&(this.shTexture.dispose(),this.shTexture=null),this.material.uniforms.u_maxShDegree.value=e,e===0?this.material.uniforms.u_shTexture.value=null:this.renderData&&this.renderData.maxShDegree>0&&this.createSHTexture())}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof Yn&&e.visible&&t.push(e)}),t}isSceneNeedsRebuild(e){let t=e.reduce((e,t)=>e+t.uuid,``),n=t!==this.gsSceneState.lastObjectsHash;return this.gsSceneState.lastObjectsHash=t,n}dispose(){this.renderData&&this.renderData.dispose(),this.sortWorker&&this.sortWorker.terminate(),this.dataTexture&&this.dataTexture.dispose(),this.transformsTexture&&this.transformsTexture.dispose(),this.transformIndicesTexture&&this.transformIndicesTexture.dispose(),this.shTexture&&this.shTexture.dispose(),this.geometry.dispose(),this.material.dispose()}},xy=1e3,Sy=90,Cy=e=>e.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/`),wy=new c.Sphere,Ty=new c.Box3,Ey=new c.Vector4,Dy=new c.Vector4,Oy=new c.Color,ky=new c.Vector2,Ay=new WeakMap,jy=nm([$p(null)]),My={},Ny=class e extends cn{static get version(){return`6.8.0-alpha.18`}static get dracoPath(){return eo.decoderPath}static set dracoPath(e){eo.setDecoderPath(e)}static get ktx2Path(){return co.transcoderPath}static set ktx2Path(e){co.setTranscoderPath(e)}static get useNativeImageBitmap(){return si()}static set useNativeImageBitmap(e){oi(e)}constructor(e={}){var t,n,r,i,a,o,s,l,u,d,f;if(super(),this.pbmGSRenderMesh=null,this.fiveId=nn(),My[this.fiveId]=this,this.currentUpdateArgs={time:U(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!1,this.onlyRenderIfNeeds=(t=e.onlyRenderIfNeeds)==null?!0:t,this.imageOptions=Object.assign({},(n=e.imageOptions)==null?{}:n),this.textureOptions=Object.assign({},(r=e.textureOptions)==null?{}:r),this.poweredByRealsee=(i=e.poweredByRealsee)==null?!0:i,this.backgroundColor=new c.Color((a=e.backgroundColor)==null?1579548:a),this.backgroundAlpha=(o=e.backgroundAlpha)==null?1:o,this.extraElements=[],this.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)},this.fps={testCount:0,testTime:U()},this.modeChangeDuration=(s=e.modeChangeDuration)==null?xy:s,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof Ym&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new Ym({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=Kv();this.renderer.setPixelRatio(t===1?window.devicePixelRatio:1),this.renderer.setSize(512,512),this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha)}catch(e){let t=e instanceof Error?e:Error(String(e));this.throwError(t)}this.getPixelsRenderTarget=new c.WebGLRenderTarget(1,1,{encoding:(d=(u=this.renderer)==null?void 0:u.outputEncoding)==null?c.sRGBEncoding:d,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new en(Sy),this.scene=new nh,this.xrCustomObjectsScene=new c.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.requestProxy=(f=e.requestProxy)==null?Cy:f,this.networkSubscribe=new sr,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,$(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new c.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),Ay.set(this,jy),this.modelScene=new qf({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(jy,{forceReplaceImmediately:!0});H(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new c.VideoTexture(e.videoInstance||Uv());let m=Wv();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=ri.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,$(`vr.requestExit`,{}))},g=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,g,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,g,!1)},this.loadWorkTask=this.prepare(),this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}Hv(this),this.fiveRenderer=new Jm,this.adaptiveLuminancePass=new Dm,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new Am(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGSRenderMesh=new by,this.scene.add(this.pbmGSRenderMesh)):console.warn(`未开启webgl2,3dgs功能不可用`)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}prepare(){return Promise.all([kr().catch(q)]).then(q)}dispose(){var e;if(this.destroyed===!0)return;delete My[this.fiveId],this.emit(`dispose`),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);let t=this.getElement();t&&t.parentNode&&t.parentNode.removeChild(t);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((e=n.pano0)==null?void 0:e.map)&&n.pano1.map.dispose(),n.reset(`pano0`,`pano1`),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),Ay.set(this,jy),this.renderer&&this.renderer.render(new c.Scene,new c.Camera),this.fiveRenderer.dispose(),this.renderer instanceof Ym&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}setViewport(e){Object.assign(this.viewport,e),this.needsRender=!0}get boundingMesh(){return this.modelScene.boundingMesh}get helperVisible(){return this.helperGroup.visible}set helperVisible(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit(`helpers.visible`,$(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,gr(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,gr(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,gr(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,gr(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,gr(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,gr(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode===`Panorama`||this.currentMode===`VRPanorama`)&&(r=!0,n=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),t&&n&&this.controller&&this.currentMode&&(!this.controller.updateConfiguration(this.controllerInits[this.currentMode])||r)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}appendTo(e,t={}){if(!this.renderer)return;if(!(this.renderer instanceof Ym)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i;if(!this.renderer)return;let a=this.renderer.domElement.parentNode,{width:o=(n=a==null?void 0:a.offsetWidth)==null?512:n,height:s=(r=a==null?void 0:a.offsetHeight)==null?512:r}=e;if(o=Math.max(1,o),s=Math.max(1,s),!t){let e=Kv(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(o,s)*t,n=Math.min(this.renderer.capabilities.maxTextureSize,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(o,s),this.needsRender=!0;let c=U(),l=c-this.currentUpdateArgs.time,u=this.currentUpdateArgs.args;this.updateTime(c,l,...u)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return Ay.get(this)||jy}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>Sh(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(t,n,r,i=!0){var a,o,s,l,u,d,f,p,m,h;let g={};typeof r==`number`?g.duration=r:typeof r==`object`&&Object.assign(g,r),this.works===jy&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(t))for(let e of t)e instanceof Qp?v.push(e):typeof e!=`string`&&`work`in e?v.push($p(e.work,e)):v.push($p(e));else t instanceof Qp?v.push(t):v.push($p(t));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=nm(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);n===void 0&&(n=`inherit`),n===`inherit`&&this.works===jy&&(n=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(a=x.mode)==null?S?`Panorama`:`Mapview`:a,T={};if(n===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{n={mode:b};let e=(s=(o=y[0])==null?void 0:o.observers)==null?void 0:s[this.panoIndex];e?(n.workCode=e.work.workCode,n.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(n.workCode=y.initial.work.workCode,n.panoIndex=y.initial.panoIndex):(n.mode===`Panorama`||n.mode===`VRPanorama`||n.mode===`XRPanorama`)&&(n.mode=`Mapview`),n.mode===b&&(n.longitude=this.camera.pose.longitude,n.latitude=this.camera.pose.latitude,n.fov=this.camera.pose.fov)}}if(n===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof n==`object`){if(w=(u=n.mode)==null?b:u,typeof n.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=n.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:n.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset?new c.Vector3().copy(n.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;(w===`Panorama`||w===`VRPanorama`||w===`XRPanorama`)&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,$(`works.request`,{input:t,works:y,userAction:i}));let O=(e,t,r)=>{let a=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),r);n===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:a,duration:E,effect:D,userAction:i}},this.commonParams()),this.controllerInits[e]),c=zv[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},i)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=zv[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i}))}this.controller=this.applyController(e,s);let t=$(`mode.change`,{prevMode:b,mode:e,state:c,userAction:i});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};Ay.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),Ah(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(q),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,$(`works.load`,{input:t,userAction:i,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,$(`works.ready`,{input:t,userAction:i,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var t;this.controller&&(this.controller.destroy(),this.controller=void 0);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((t=n.pano0)==null?void 0:t.map)&&n.pano1.map.dispose(),n.set({pano0:null,pano1:null,modelAlpha:1}),Ay.set(this,jy),this.modelScene.setModels(jy,{forceReplaceImmediately:!0}),this.renderer&&this.modelScene.update(this.renderer,this.camera),this.needsRender=!0,this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.camera.setFromPose({distance:0,fov:Sy,longitude:0,latitude:0,offset:new c.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(m)){let e=Error(`PanoId ${Q(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!gp(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(q):(gp(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(q));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=zv[t].initAnimationEndState(r),o=$(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=$(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=ri.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),ri.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),Eh().then(()=>_()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),s(t)})):t===e.Mode.XRPanorama?Dh().then(e=>{ri.shared.setContext(e),a=!0,_()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),s(t)}):_()})}getPixels(e,t,n,r,i,a,o){if(!this.renderer)throw Error(`renderer is not initialized.`);let s=U(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new c.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof t==`number`&&(p=t),typeof n==`number`&&(m=n),typeof r==`number`&&(h=r),g=i,_=a,b=o):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&(this.controller instanceof zv.Panorama||this.controller instanceof zv.VRPanorama||this.controller instanceof zv.XRPanorama)&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(s),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=Oy.copy(this.renderer.getClearColor()),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(s),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,P=ee*4;if(b){if(b.length!==P)throw Error(`buffer length is not equals pixels ${P}`)}else b=new Uint8Array(P);if(this.renderer.readRenderTargetPixels(C,0,0,m*g,h*g,b),_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=Oy.copy(t.getClearColor()),c=t.getClearAlpha(),l=t.getViewport(Ey),u=t.getScissor(Dy),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(ky),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;if(this.controller&&this.controller.render()&&(y=!1),y){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&oy(t)}this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&ri.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&co.detectSupport(this.renderer),this.syncingState=this.syncState(e,t),this.controller&&this.controller.updateTime(e,t,...n),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){let e=this.modelScene.loaded,t=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),e===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),ri.shared.add(()=>{this.emit(`models.load`,$(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&ri.shared.add(()=>{this.emit(`models.refined`,$(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){Ty.makeEmpty(),Ty.expandByObject(this.modelScene.boundingMesh);let t=Ty.getBoundingSphere(wy),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius);let r=W(n/500,.001,.1),i=W(n,800);this.camera.near!==r&&(this.camera.near=r),this.camera.far!==i&&(this.camera.far=i),this.camera.updateTime(e)}if(this.renderer){let e=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=e}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.pbmGSRenderMesh&&this.pbmGSRenderMesh.needsRender===!0&&(this.pbmGSRenderMesh.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused===!0)return;let r=$(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,$(`render`,{needsRender:i})),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))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof Ym&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=q){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=U();return Promise.all(r.map(e=>{let t=Q({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},mr(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Kr(i,r);return _f(this.fiveId,n.work).preload(a)})).then(()=>{let e=U()-i;return t(e),e})}project2d(e,t=!1){if(!this.renderer)return null;if(t){let t=this.camera.position,n=e.clone().sub(t),r=new c.Raycaster(t,n.clone().normalize());r.params.Points={threshold:.1};let[i]=this.modelScene.intersectRaycaster(r);if(i&&i.distance+.01<n.length())return null}let n=e.clone().project(this.camera);if(Math.abs(n.z)>1)return null;let r=this.renderer.getSize(new c.Vector2),i=r.x*this.viewport.width,a=r.y*this.viewport.height,o=r.x*this.viewport.left+(n.x+1)/2*i,s=r.y*(1-this.viewport.bottom-this.viewport.height)+(-n.y+1)/2*a;return new c.Vector2(o,s)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,t=!1,n=!0){var r,i,a,o,s,l,u,d,f,p;e=mr(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof c.Vector3)&&(e.offset=new c.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(i=(r=this.work)==null?void 0:r.workCode)==null?``:i,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(a=e.mode)==null?this.state.mode:a,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){if(h===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let t={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(t.longitude=e.longitude),typeof e.latitude==`number`&&(t.latitude=e.latitude),typeof e.fov==`number`&&(t.fov=e.fov),typeof e.distance==`number`&&(t.distance=e.distance),e.offset instanceof c.Vector3&&(t.offset=e.offset);let n=Object.assign(Object.assign({initial:{state:t,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),r=zv[h].initAnimationEndState(n);g=r.longitude,_=r.latitude,v=r.fov,y=r.offset,b=r.distance}else g=(o=e.longitude)==null?this.state.longitude:o,_=(s=e.latitude)==null?this.state.latitude:s,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,$(`state.set`,{userAction:n,state:x})),kh(this.state,x)||(this.controller&&x.mode===`VRPanorama`&&x.mode!==this.state.mode?(Oh(this.state,x),this.changeMode(`VRPanorama`)):this.controller&&x.mode===`XRPanorama`&&x.mode!==this.state.mode?(Oh(this.state,x),this.changeMode(`XRPanorama`)):(Oh(this.state,x),this.controller&&n&&(this.controller.userAction=!1),t&&this.state.mode===x.mode&&(this.syncingState=this.syncState(U(),0,t),this.syncingState&&((f=this.controller)==null||f.updateTime(U(),0),this.syncingState=!1)),this.emit(`state.change`,$(`state.change`,{userAction:n,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state)))}syncState(t,n,r=!1){let i=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){let e={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,e,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof zv.Model){if(xh(this.camera.pose.offset,this.state.offset)){let e={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,Object.assign(Object.assign({},e),{duration:r?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!gp(e,this.pano)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`){let t={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(e,t,!1),!0}}if(this.controller instanceof zv.Floorplan||this.controller instanceof zv.Topview||this.controller instanceof zv.Mapview){let e=.2,t=Math.PI/45,n=r?this.state.fov:bm(this.camera.pose.fov,this.state.fov,1),i=Math.abs(this.camera.pose.distance-this.state.distance),a=i>e*15?i/15:.2,o=r?this.state.distance:bm(this.camera.pose.distance,this.state.distance,a),s=this.camera.pose.offset.distanceTo(this.state.offset),l=s>e*15?s/15:e,u=r?new c.Vector3().copy(this.state.offset):xm(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Sm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},t);if(yh(n,this.camera.pose.fov)||xh(u,this.camera.pose.offset)||yh(o,this.camera.pose.distance)||yh(d,this.camera.pose.longitude,Math.PI*2)||yh(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:n};return Object.assign(e,{distance:o}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(q),this.controller.locationMotion.set(e,0).catch(q),!0}}else{let e=Math.PI/45,t=r?this.state.fov:bm(this.camera.pose.fov,this.state.fov,1),{longitude:n,latitude:i}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Sm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),a=this.state.distance,o=new c.Vector3().copy(this.state.offset);if(yh(a,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),xh(o,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),yh(n,this.camera.pose.longitude,Math.PI*2)||yh(i,this.camera.pose.latitude)||yh(t,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:n,latitude:i,fov:t},0).catch(q),!0}if(this.stateSynced=!0,i===!1&&this.emit(`state.synced`,$(`state.synced`,{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){let t=this.currentMode;if(!(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)||this.modelScene.loaded){let e=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(let t of e)this.controller instanceof zv.Panorama&&t.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(t):t()}}return!1}ready(e={}){return new Promise(t=>{var n;this.readyCallbacks.push(Object.assign(t,{tile:(n=e.tile)==null?!1:n}))}).then(()=>this.model.initReady).then(q)}requestFullscreen(){var e;if(!Th)return;let t=(e=this.getElement())==null?void 0:e.parentNode;t&&`requestFullscreen`in t&&typeof document<`u`&&document.fullscreenElement===null&&t.requestFullscreen()}exitFullscreen(){typeof document<`u`&&document.fullscreenElement&&`exitFullscreen`in document&&document.exitFullscreen()}throwError(e){this.hasListener(`error`)?this.emit(`error`,e):console.error(e)}bindModel(e){let t=()=>{ri.shared.add(()=>{this.emit(`model.load`,$(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,$(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,$(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,$(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,$(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,$(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new fr({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=zp(e,r);return t instanceof Error?Promise.reject(t):t})}});vf(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(t,n){if(!this.renderer)throw Error(`renderer is not initialized.`);let r=zv[t];this.currentMode=t;let i=new r(n);for(let e of Vv)i.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=zv[t].initAnimationEndState(n),r=n.initial.userAction;kh(this.state,e)||(Oh(this.state,e),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,$(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return i.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,$(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),i.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,$(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),i.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),i.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),i.on(`error`,e=>this.throwError(e)),i}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let t=new c.Object3D;t.matrix.copy(e.matrix).premultiply(e.work.transform),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixAutoUpdate=!1;let n=new c.Vector3(0,0,-1);n.applyQuaternion(this.camera.quaternion);let r=t.quaternion.clone().inverse();return n.applyQuaternion(r),{theta:Math.atan2(n.x,-n.z),phi:-Math.asin(n.y),lookAtVector:n}}}return null}addPass(e){this.fiveRenderer.composer.addPass(e)}removePass(e){let t=this.fiveRenderer.composer.passes.indexOf(e);t!==-1&&this.fiveRenderer.composer.passes.splice(t,1)}insertPass(e,t){this.fiveRenderer.composer.insertPass(e,t)}get renderMode(){return this.fiveRenderer.renderMode}set renderMode(e){this.fiveRenderer.renderMode=e}get enableHQ(){return this.fiveRenderer.renderMode===`point-cloud-high-quality`}set enableHQ(e){this.fiveRenderer.renderMode=e?`point-cloud-high-quality`:`default`,this.needsRender=!0}get enableEDL(){return this.eyeDomeLightingPass.enabled}set enableEDL(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0}get enableAdaptiveLuminance(){return this.adaptiveLuminancePass.enabled}set enableAdaptiveLuminance(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0}get enableIOSEDR(){return!1}set enableIOSEDR(e){}get enablePostProcessing(){return!0}set enablePostProcessing(e){}get modelSceneNeedsRender(){return this.modelScene.needsRender}set modelSceneNeedsRender(e){this.modelScene.needsRender=e}};if(Ny.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`){let e={THREE:c,constructor:Ny,instances:My};Object.assign(window,{__FIVE_DEBUG__:e})}var Py=class{static createButton(e){let t=document.createElement(`button`);function n(){t.style.display=``,t.style.cursor=`pointer`,t.style.left=`calc(50% - 50px)`,t.style.width=`100px`,t.textContent=`ENTER VR`,t.onmouseenter=function(){t.style.opacity=`1.0`},t.onmouseleave=function(){t.style.opacity=`0.5`},t.onclick=function(){e&&e()}}function r(){t.style.display=``,t.style.cursor=`auto`,t.style.left=`calc(50% - 75px)`,t.style.width=`150px`,t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function i(){r(),t.textContent=`VR NOT SUPPORTED`}function a(e){e.style.position=`absolute`,e.style.bottom=`20px`,e.style.padding=`12px 6px`,e.style.border=`1px solid #fff`,e.style.borderRadius=`4px`,e.style.background=`rgba(0,0,0,0.1)`,e.style.color=`#fff`,e.style.font=`normal 13px sans-serif`,e.style.textAlign=`center`,e.style.opacity=`0.5`,e.style.outline=`none`,e.style.zIndex=`999`}if(`xr`in navigator)return t.id=`VRButton`,t.style.display=`none`,a(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():i()}),t;{let e=document.createElement(`a`);return window.isSecureContext===!1?(e.href=document.location.href.replace(/^http:/,`https:`),e.innerHTML=`WEBXR NEEDS HTTPS`):(e.href=`https://immersiveweb.dev/`,e.innerHTML=`WEBXR NOT AVAILABLE`),e.style.left=`calc(50% - 90px)`,e.style.width=`180px`,e.style.textDecoration=`none`,a(e),e}}};exports.AdaptiveLuminancePass=Dm,exports.AnimationFrameLoop=ri,exports.BoundingMesh=Gf,exports.Camera=en,exports.CustomShader=un,exports.PBMCustomShader=un,exports.EffectComposer=rm,exports.EyeDomeLightingPass=Am,exports.Fetcher=fr,exports.Five=Ny,exports.FivePass=am,exports.FiveRenderer=Jm,exports.FullScreenQuad=im,exports.Histogram=_m,exports.InternalWebGLRenderer=Ym,exports.Model=If,exports.ModelScene=qf,exports.Motion=Z,exports.NetworkSubscribe=sr,exports.PBMContainer=Kn,exports.PBMGSObject=Yn,exports.PBMGroup=Ct,exports.PBMMesh=yn,exports.PBMMeshMaterial=vn,exports.PBMPanoFilter=dn,exports.PBMPointCloud=kn,exports.PBMPointCloudMaterial=On,exports.PBMSkinnedMesh=bn,exports.PBMUpdateable=ln,exports.PROXY_CONTROLLER_EVENT_NAMES=Vv,exports.PanoCircleMesh=sh,exports.PanoCircleMeshCustom=_h,exports.PanoCircleMeshSolid=fh,exports.Parameter=K,exports.Scene=nh,exports.Subscribe=cn,exports.TextureLoader=hi,exports.Tile=jl,exports.Tile3D=hf,exports.Tile3DModel=hf,exports.TileCache=rd,exports.TileNode=Ku,exports.TileRequestScheduler=ed,exports.Tileset=ld,exports.Trajectory=Xu,exports.TrajectoryNode=Zu,exports.Work=Qp,exports.WorkResolvedObserver=tm,exports.XRButton=Py,exports.controllersDefaultInitArgs=Bv,exports.coordinatesToVector=Vt,exports.createDebugBoundingMesh=El,exports.createWorks=nm,exports.defaultImageURLTransform=Kr,exports.draco=eo,exports.getViewportScale=Kv,exports.headingToLongitude=Wt,exports.imageSupport=kr,exports.isBoundingVolume=xl,exports.isPanoId=_p,exports.ktx2=co,exports.loadAt3d=ea,exports.loadB3dm=rs,exports.loadDome=ia,exports.loadDomez=da,exports.loadFbx=vc,exports.loadGltf=fs,exports.loadPbm=Mi,exports.loadPly=ms,exports.loadPnts=us,exports.loadSplat=tl,exports.loadSpz=Qo,exports.loadX3p=Qc,exports.longitudeToHeading=Ut,exports.makeBoundingVolume=Sl,exports.panoEqual=gp,exports.panoParse=hp,exports.panoStringify=Q,exports.parseWork=$p,exports.vectorToCoordinates=Ht,exports.workToJson=Qf;
2323
+ ----<<-计算从-}yn-中心到当前片段的平方距离----<<-由于-]|vv|{-已经按-\05E6-缩放,平方结果会被缩放-E-倍----<<-如果平方结果大于-E,说明在椭圆外,距离均值超过-\05E6-个标准差----sy|n-N-J-q|5]|vv|{9-]|vv|{6H----vs-5N-K-E;=6-qvpnqH--------rp@-p|y|-J-P|y|;toH--------<<-由于渲染的-}yn-按-\05E6-缩放,高斯公式中的逆协方差矩阵部分变成单位矩阵----<<-因此只剩下-5e-:-zrn{6-7-5e-:-zrn{6,而-zrn{-为零,所以是-e-7-e,即-N----sy|n-|}npv\b-J-r\x07}5:=;B-7-N6-7-P|y|;nH--------tylSntP|y|-J-rpA5p|y|;to9-|}npv\b6H\f`),by=class extends c.Mesh{constructor(){super(),this.renderData=null,this.needsRender=!1,this.sortWorker=null,this.depthIndex=new Uint32Array,this.splatIndexCapacity=0,this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.shTexture=null,this.usedSHDegree=0,this.onBeforeRender=(e,t,n)=>{var r,i;let a=n,o=this.collectObjects(t);if(o.length===0){this.geometry.instanceCount=0;return}let s=0;if(o.forEach(e=>{e.usedSHDegree>s&&(s=e.usedSHDegree)}),this.setMaxShDegree(s),this.isSceneNeedsRebuild(o)&&(this.renderData&&this.renderData.dispose(),this.shTexture&&(this.shTexture.dispose(),this.shTexture=null),this.renderData=new my(o),this.createTextures(),this.ensureSplatIndexCapacity(this.renderData.numPoints)),!this.renderData)return;if(o.forEach(e=>{e.transformChanged&&this.renderData.updateTransform(e)}),this.renderData.dataChanged||this.renderData.transformsChanged){let e=new Float32Array(this.renderData.positions.slice().buffer),t=new Float32Array(this.renderData.transforms.slice().buffer),n=new Uint32Array(this.renderData.transformIndices.slice().buffer);(r=this.sortWorker)==null||r.postMessage({sortData:{positions:e,transforms:t,transformIndices:n,vertexCount:this.renderData.numPoints}},[e.buffer,t.buffer,n.buffer])}this.renderData.dataChanged&&this.dataTexture&&(this.dataTexture.needsUpdate=!0,this.renderData.dataChanged=!1),this.renderData.transformsChanged&&this.transformsTexture&&this.transformIndicesTexture&&(this.transformsTexture.needsUpdate=!0,this.transformIndicesTexture.needsUpdate=!0,this.renderData.transformsChanged=!1);let l=Math.min(this.usedSHDegree,this.renderData.maxShDegree);this.material.uniforms.u_maxShDegree.value=l,l>0&&!this.shTexture?this.createSHTexture():l===0&&this.shTexture&&(this.shTexture.dispose(),this.shTexture=null,this.material.uniforms.u_shTexture.value=null);let u=new c.Matrix4().multiplyMatrices(a.perspectiveProjectionMatrix,a.matrixWorldInverse);(i=this.sortWorker)==null||i.postMessage({viewProj:u.elements}),this.material.uniforms.resolution.value.set(a.resolution.x,a.resolution.y)};let e=this.createGeometry(),t=this.createMaterial();this.geometry=e,this.material=t,this.frustumCulled=!1,this.renderOrder=-99999999999,this.gsSceneState={lastObjectsHash:``},this.sortWorker=new _y,this.sortWorker.onmessage=e=>{if(e.data.depthIndex){this.depthIndex=e.data.depthIndex;let t=this.depthIndex.length,n=this.ensureSplatIndexCapacity(t);n.array.set(this.depthIndex,0),n.count=this.depthIndex.length,n.updateRange.offset=0,n.updateRange.count=t,n.needsUpdate=!0,this.geometry.instanceCount=this.depthIndex.length,this.needsRender=!0}}}ensureSplatIndexCapacity(e){let t=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return t;let n=this.getExpandedCapacity(e),r=t.array,i=new Int32Array(n);i.set(r.subarray(0,Math.min(r.length,n)));let a=new c.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(c.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=n,this.geometry._maxInstanceCount=n,a}getExpandedCapacity(e){let t=Math.max(this.splatIndexCapacity,1);for(;t<e;)t*=2;return t}createGeometry(){let e=new c.InstancedBufferGeometry,t=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]);e.setAttribute(`position`,new c.BufferAttribute(t,3));let n=new Uint16Array([0,1,2,0,2,3]);e.setIndex(new c.BufferAttribute(n,1)),this.splatIndexCapacity=1;let r=new Int32Array(this.splatIndexCapacity);for(let e=0;e<r.length;e++)r[e]=e;let i=new c.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(c.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}createMaterial(){return new c.ShaderMaterial({vertexShader:vy,fragmentShader:yy,uniforms:{u_texture:{value:null},u_transforms:{value:null},u_transformIndices:{value:null},u_shTexture:{value:null},u_shTextureSize:{value:new c.Vector2},u_maxShDegree:{value:0},resolution:{value:new c.Vector2}},side:c.DoubleSide,transparent:!0,blending:c.NormalBlending,depthTest:!0,depthWrite:!1})}createTextures(){this.renderData&&(this.dataTexture=new c.DataTexture(this.renderData.data,this.renderData.width,this.renderData.height,c.RGBAIntegerFormat,c.UnsignedIntType),this.dataTexture.internalFormat=`RGBA32UI`,this.dataTexture.minFilter=c.NearestFilter,this.dataTexture.magFilter=c.NearestFilter,this.dataTexture.needsUpdate=!0,this.transformsTexture=new c.DataTexture(this.renderData.transforms,this.renderData.transformsWidth,this.renderData.transformsHeight,c.RGBAFormat,c.FloatType),this.transformsTexture.internalFormat=`RGBA32F`,this.transformsTexture.minFilter=c.NearestFilter,this.transformsTexture.magFilter=c.NearestFilter,this.transformsTexture.needsUpdate=!0,this.transformIndicesTexture=new c.DataTexture(this.renderData.transformIndices,this.renderData.transformIndicesWidth,this.renderData.transformIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType),this.transformIndicesTexture.internalFormat=`R32UI`,this.transformIndicesTexture.minFilter=c.NearestFilter,this.transformIndicesTexture.magFilter=c.NearestFilter,this.transformIndicesTexture.needsUpdate=!0,this.material.uniforms.u_texture.value=this.dataTexture,this.material.uniforms.u_transforms.value=this.transformsTexture,this.material.uniforms.u_transformIndices.value=this.transformIndicesTexture,this.usedSHDegree>0&&this.renderData.maxShDegree>0&&this.createSHTexture())}createSHTexture(){if(!this.renderData)return;this.shTexture&&(this.shTexture.dispose(),this.shTexture=null);let e=Math.min(this.usedSHDegree,this.renderData.maxShDegree),t=0;if(e>=1&&(t+=9),e>=2&&(t+=15),e>=3&&(t+=21),t===0)return;let n=t;n%4!=0&&(n=Math.ceil(n/4)*4);let r=this.renderData.numPoints*n/4,i=2048,a=Math.ceil(r/i),o=new Float32Array(i*a*4);for(let t=0;t<this.renderData.numPoints;t++){let r=n/4*t,i=0;if(this.renderData.sh1&&e>=1)for(let e=0;e<9;e++){let n=r+Math.floor(i/4),a=i%4,s=n*4+a;o[s]=this.renderData.sh1[t*9+e],i++}if(this.renderData.sh2&&e>=2)for(let e=0;e<15;e++){let n=r+Math.floor(i/4),a=i%4,s=n*4+a;o[s]=this.renderData.sh2[t*15+e],i++}if(this.renderData.sh3&&e>=3)for(let e=0;e<21;e++){let n=r+Math.floor(i/4),a=i%4,s=n*4+a;o[s]=this.renderData.sh3[t*21+e],i++}}this.shTexture=new c.DataTexture(o,i,a,c.RGBAFormat,c.FloatType),this.shTexture.internalFormat=`RGBA32F`,this.shTexture.minFilter=c.NearestFilter,this.shTexture.magFilter=c.NearestFilter,this.shTexture.needsUpdate=!0,this.material.uniforms.u_shTexture.value=this.shTexture,this.material.uniforms.u_shTextureSize.value.set(i,a),this.material.uniforms.u_maxShDegree.value=e}setMaxShDegree(e){if(e<0||e>2){console.warn(`现在只支持012三种阶数,你输入的是${e}`);return}let t=this.usedSHDegree;this.usedSHDegree=e,t!==e&&(this.shTexture&&(this.shTexture.dispose(),this.shTexture=null),this.material.uniforms.u_maxShDegree.value=e,e===0?this.material.uniforms.u_shTexture.value=null:this.renderData&&this.renderData.maxShDegree>0&&this.createSHTexture())}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof Yn&&e.visible&&t.push(e)}),t}isSceneNeedsRebuild(e){let t=e.reduce((e,t)=>e+t.uuid,``),n=t!==this.gsSceneState.lastObjectsHash;return this.gsSceneState.lastObjectsHash=t,n}dispose(){this.renderData&&this.renderData.dispose(),this.sortWorker&&this.sortWorker.terminate(),this.dataTexture&&this.dataTexture.dispose(),this.transformsTexture&&this.transformsTexture.dispose(),this.transformIndicesTexture&&this.transformIndicesTexture.dispose(),this.shTexture&&this.shTexture.dispose(),this.geometry.dispose(),this.material.dispose()}},xy=1e3,Sy=90,Cy=e=>e.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/`),wy=new c.Sphere,Ty=new c.Box3,Ey=new c.Vector4,Dy=new c.Vector4,Oy=new c.Color,ky=new c.Vector2,Ay=new WeakMap,jy=nm([$p(null)]),My={},Ny=class e extends cn{static get version(){return`6.8.0-alpha.19`}static get dracoPath(){return eo.decoderPath}static set dracoPath(e){eo.setDecoderPath(e)}static get ktx2Path(){return co.transcoderPath}static set ktx2Path(e){co.setTranscoderPath(e)}static get useNativeImageBitmap(){return si()}static set useNativeImageBitmap(e){oi(e)}constructor(e={}){var t,n,r,i,a,o,s,l,u,d,f;if(super(),this.pbmGSRenderMesh=null,this.fiveId=nn(),My[this.fiveId]=this,this.currentUpdateArgs={time:U(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!1,this.onlyRenderIfNeeds=(t=e.onlyRenderIfNeeds)==null?!0:t,this.imageOptions=Object.assign({},(n=e.imageOptions)==null?{}:n),this.textureOptions=Object.assign({},(r=e.textureOptions)==null?{}:r),this.poweredByRealsee=(i=e.poweredByRealsee)==null?!0:i,this.backgroundColor=new c.Color((a=e.backgroundColor)==null?1579548:a),this.backgroundAlpha=(o=e.backgroundAlpha)==null?1:o,this.extraElements=[],this.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)},this.fps={testCount:0,testTime:U()},this.modeChangeDuration=(s=e.modeChangeDuration)==null?xy:s,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof Ym&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new Ym({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=Kv();this.renderer.setPixelRatio(t===1?window.devicePixelRatio:1),this.renderer.setSize(512,512),this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha)}catch(e){let t=e instanceof Error?e:Error(String(e));this.throwError(t)}this.getPixelsRenderTarget=new c.WebGLRenderTarget(1,1,{encoding:(d=(u=this.renderer)==null?void 0:u.outputEncoding)==null?c.sRGBEncoding:d,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new en(Sy),this.scene=new nh,this.xrCustomObjectsScene=new c.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.requestProxy=(f=e.requestProxy)==null?Cy:f,this.networkSubscribe=new sr,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,$(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new c.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),Ay.set(this,jy),this.modelScene=new qf({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(jy,{forceReplaceImmediately:!0});H(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new c.VideoTexture(e.videoInstance||Uv());let m=Wv();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=ri.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,$(`vr.requestExit`,{}))},g=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,g,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,g,!1)},this.loadWorkTask=this.prepare(),this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}Hv(this),this.fiveRenderer=new Jm,this.adaptiveLuminancePass=new Dm,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new Am(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGSRenderMesh=new by,this.scene.add(this.pbmGSRenderMesh)):console.warn(`未开启webgl2,3dgs功能不可用`)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}prepare(){return Promise.all([kr().catch(q)]).then(q)}dispose(){var e;if(this.destroyed===!0)return;delete My[this.fiveId],this.emit(`dispose`),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);let t=this.getElement();t&&t.parentNode&&t.parentNode.removeChild(t);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((e=n.pano0)==null?void 0:e.map)&&n.pano1.map.dispose(),n.reset(`pano0`,`pano1`),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),Ay.set(this,jy),this.renderer&&this.renderer.render(new c.Scene,new c.Camera),this.fiveRenderer.dispose(),this.renderer instanceof Ym&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}setViewport(e){Object.assign(this.viewport,e),this.needsRender=!0}get boundingMesh(){return this.modelScene.boundingMesh}get helperVisible(){return this.helperGroup.visible}set helperVisible(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit(`helpers.visible`,$(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,gr(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,gr(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,gr(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,gr(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,gr(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,gr(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode===`Panorama`||this.currentMode===`VRPanorama`)&&(r=!0,n=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),t&&n&&this.controller&&this.currentMode&&(!this.controller.updateConfiguration(this.controllerInits[this.currentMode])||r)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}appendTo(e,t={}){if(!this.renderer)return;if(!(this.renderer instanceof Ym)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i;if(!this.renderer)return;let a=this.renderer.domElement.parentNode,{width:o=(n=a==null?void 0:a.offsetWidth)==null?512:n,height:s=(r=a==null?void 0:a.offsetHeight)==null?512:r}=e;if(o=Math.max(1,o),s=Math.max(1,s),!t){let e=Kv(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(o,s)*t,n=Math.min(this.renderer.capabilities.maxTextureSize,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(o,s),this.needsRender=!0;let c=U(),l=c-this.currentUpdateArgs.time,u=this.currentUpdateArgs.args;this.updateTime(c,l,...u)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return Ay.get(this)||jy}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>Sh(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(t,n,r,i=!0){var a,o,s,l,u,d,f,p,m,h;let g={};typeof r==`number`?g.duration=r:typeof r==`object`&&Object.assign(g,r),this.works===jy&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(t))for(let e of t)e instanceof Qp?v.push(e):typeof e!=`string`&&`work`in e?v.push($p(e.work,e)):v.push($p(e));else t instanceof Qp?v.push(t):v.push($p(t));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=nm(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);n===void 0&&(n=`inherit`),n===`inherit`&&this.works===jy&&(n=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(a=x.mode)==null?S?`Panorama`:`Mapview`:a,T={};if(n===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{n={mode:b};let e=(s=(o=y[0])==null?void 0:o.observers)==null?void 0:s[this.panoIndex];e?(n.workCode=e.work.workCode,n.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(n.workCode=y.initial.work.workCode,n.panoIndex=y.initial.panoIndex):(n.mode===`Panorama`||n.mode===`VRPanorama`||n.mode===`XRPanorama`)&&(n.mode=`Mapview`),n.mode===b&&(n.longitude=this.camera.pose.longitude,n.latitude=this.camera.pose.latitude,n.fov=this.camera.pose.fov)}}if(n===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof n==`object`){if(w=(u=n.mode)==null?b:u,typeof n.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=n.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:n.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset?new c.Vector3().copy(n.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;(w===`Panorama`||w===`VRPanorama`||w===`XRPanorama`)&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,$(`works.request`,{input:t,works:y,userAction:i}));let O=(e,t,r)=>{let a=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),r);n===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:a,duration:E,effect:D,userAction:i}},this.commonParams()),this.controllerInits[e]),c=zv[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},i)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=zv[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i}))}this.controller=this.applyController(e,s);let t=$(`mode.change`,{prevMode:b,mode:e,state:c,userAction:i});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};Ay.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),Ah(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(q),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,$(`works.load`,{input:t,userAction:i,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,$(`works.ready`,{input:t,userAction:i,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var t;this.controller&&(this.controller.destroy(),this.controller=void 0);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((t=n.pano0)==null?void 0:t.map)&&n.pano1.map.dispose(),n.set({pano0:null,pano1:null,modelAlpha:1}),Ay.set(this,jy),this.modelScene.setModels(jy,{forceReplaceImmediately:!0}),this.renderer&&this.modelScene.update(this.renderer,this.camera),this.needsRender=!0,this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.camera.setFromPose({distance:0,fov:Sy,longitude:0,latitude:0,offset:new c.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(m)){let e=Error(`PanoId ${Q(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!gp(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(q):(gp(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(q));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=zv[t].initAnimationEndState(r),o=$(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=$(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=ri.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),ri.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),Eh().then(()=>_()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),s(t)})):t===e.Mode.XRPanorama?Dh().then(e=>{ri.shared.setContext(e),a=!0,_()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),s(t)}):_()})}getPixels(e,t,n,r,i,a,o){if(!this.renderer)throw Error(`renderer is not initialized.`);let s=U(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new c.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof t==`number`&&(p=t),typeof n==`number`&&(m=n),typeof r==`number`&&(h=r),g=i,_=a,b=o):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&(this.controller instanceof zv.Panorama||this.controller instanceof zv.VRPanorama||this.controller instanceof zv.XRPanorama)&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(s),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=Oy.copy(this.renderer.getClearColor()),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(s),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,P=ee*4;if(b){if(b.length!==P)throw Error(`buffer length is not equals pixels ${P}`)}else b=new Uint8Array(P);if(this.renderer.readRenderTargetPixels(C,0,0,m*g,h*g,b),_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=Oy.copy(t.getClearColor()),c=t.getClearAlpha(),l=t.getViewport(Ey),u=t.getScissor(Dy),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(ky),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;if(this.controller&&this.controller.render()&&(y=!1),y){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&oy(t)}this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&ri.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&co.detectSupport(this.renderer),this.syncingState=this.syncState(e,t),this.controller&&this.controller.updateTime(e,t,...n),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){let e=this.modelScene.loaded,t=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),e===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),ri.shared.add(()=>{this.emit(`models.load`,$(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&ri.shared.add(()=>{this.emit(`models.refined`,$(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){Ty.makeEmpty(),Ty.expandByObject(this.modelScene.boundingMesh);let t=Ty.getBoundingSphere(wy),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius);let r=W(n/500,.001,.1),i=W(n,800);this.camera.near!==r&&(this.camera.near=r),this.camera.far!==i&&(this.camera.far=i),this.camera.updateTime(e)}if(this.renderer){let e=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=e}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.pbmGSRenderMesh&&this.pbmGSRenderMesh.needsRender===!0&&(this.pbmGSRenderMesh.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused===!0)return;let r=$(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,$(`render`,{needsRender:i})),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))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof Ym&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=q){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=U();return Promise.all(r.map(e=>{let t=Q({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},mr(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Kr(i,r);return _f(this.fiveId,n.work).preload(a)})).then(()=>{let e=U()-i;return t(e),e})}project2d(e,t=!1){if(!this.renderer)return null;if(t){let t=this.camera.position,n=e.clone().sub(t),r=new c.Raycaster(t,n.clone().normalize());r.params.Points={threshold:.1};let[i]=this.modelScene.intersectRaycaster(r);if(i&&i.distance+.01<n.length())return null}let n=e.clone().project(this.camera);if(Math.abs(n.z)>1)return null;let r=this.renderer.getSize(new c.Vector2),i=r.x*this.viewport.width,a=r.y*this.viewport.height,o=r.x*this.viewport.left+(n.x+1)/2*i,s=r.y*(1-this.viewport.bottom-this.viewport.height)+(-n.y+1)/2*a;return new c.Vector2(o,s)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,t=!1,n=!0){var r,i,a,o,s,l,u,d,f,p;e=mr(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof c.Vector3)&&(e.offset=new c.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(i=(r=this.work)==null?void 0:r.workCode)==null?``:i,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(a=e.mode)==null?this.state.mode:a,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){if(h===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let t={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(t.longitude=e.longitude),typeof e.latitude==`number`&&(t.latitude=e.latitude),typeof e.fov==`number`&&(t.fov=e.fov),typeof e.distance==`number`&&(t.distance=e.distance),e.offset instanceof c.Vector3&&(t.offset=e.offset);let n=Object.assign(Object.assign({initial:{state:t,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),r=zv[h].initAnimationEndState(n);g=r.longitude,_=r.latitude,v=r.fov,y=r.offset,b=r.distance}else g=(o=e.longitude)==null?this.state.longitude:o,_=(s=e.latitude)==null?this.state.latitude:s,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,$(`state.set`,{userAction:n,state:x})),kh(this.state,x)||(this.controller&&x.mode===`VRPanorama`&&x.mode!==this.state.mode?(Oh(this.state,x),this.changeMode(`VRPanorama`)):this.controller&&x.mode===`XRPanorama`&&x.mode!==this.state.mode?(Oh(this.state,x),this.changeMode(`XRPanorama`)):(Oh(this.state,x),this.controller&&n&&(this.controller.userAction=!1),t&&this.state.mode===x.mode&&(this.syncingState=this.syncState(U(),0,t),this.syncingState&&((f=this.controller)==null||f.updateTime(U(),0),this.syncingState=!1)),this.emit(`state.change`,$(`state.change`,{userAction:n,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state)))}syncState(t,n,r=!1){let i=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){let e={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,e,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof zv.Model){if(xh(this.camera.pose.offset,this.state.offset)){let e={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,Object.assign(Object.assign({},e),{duration:r?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!gp(e,this.pano)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`){let t={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(e,t,!1),!0}}if(this.controller instanceof zv.Floorplan||this.controller instanceof zv.Topview||this.controller instanceof zv.Mapview){let e=.2,t=Math.PI/45,n=r?this.state.fov:bm(this.camera.pose.fov,this.state.fov,1),i=Math.abs(this.camera.pose.distance-this.state.distance),a=i>e*15?i/15:.2,o=r?this.state.distance:bm(this.camera.pose.distance,this.state.distance,a),s=this.camera.pose.offset.distanceTo(this.state.offset),l=s>e*15?s/15:e,u=r?new c.Vector3().copy(this.state.offset):xm(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Sm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},t);if(yh(n,this.camera.pose.fov)||xh(u,this.camera.pose.offset)||yh(o,this.camera.pose.distance)||yh(d,this.camera.pose.longitude,Math.PI*2)||yh(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:n};return Object.assign(e,{distance:o}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(q),this.controller.locationMotion.set(e,0).catch(q),!0}}else{let e=Math.PI/45,t=r?this.state.fov:bm(this.camera.pose.fov,this.state.fov,1),{longitude:n,latitude:i}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Sm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),a=this.state.distance,o=new c.Vector3().copy(this.state.offset);if(yh(a,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),xh(o,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),yh(n,this.camera.pose.longitude,Math.PI*2)||yh(i,this.camera.pose.latitude)||yh(t,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:n,latitude:i,fov:t},0).catch(q),!0}if(this.stateSynced=!0,i===!1&&this.emit(`state.synced`,$(`state.synced`,{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){let t=this.currentMode;if(!(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)||this.modelScene.loaded){let e=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(let t of e)this.controller instanceof zv.Panorama&&t.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(t):t()}}return!1}ready(e={}){return new Promise(t=>{var n;this.readyCallbacks.push(Object.assign(t,{tile:(n=e.tile)==null?!1:n}))}).then(()=>this.model.initReady).then(q)}requestFullscreen(){var e;if(!Th)return;let t=(e=this.getElement())==null?void 0:e.parentNode;t&&`requestFullscreen`in t&&typeof document<`u`&&document.fullscreenElement===null&&t.requestFullscreen()}exitFullscreen(){typeof document<`u`&&document.fullscreenElement&&`exitFullscreen`in document&&document.exitFullscreen()}throwError(e){this.hasListener(`error`)?this.emit(`error`,e):console.error(e)}bindModel(e){let t=()=>{ri.shared.add(()=>{this.emit(`model.load`,$(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,$(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,$(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,$(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,$(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,$(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new fr({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=zp(e,r);return t instanceof Error?Promise.reject(t):t})}});vf(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(t,n){if(!this.renderer)throw Error(`renderer is not initialized.`);let r=zv[t];this.currentMode=t;let i=new r(n);for(let e of Vv)i.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=zv[t].initAnimationEndState(n),r=n.initial.userAction;kh(this.state,e)||(Oh(this.state,e),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,$(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return i.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,$(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),i.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,$(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),i.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),i.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),i.on(`error`,e=>this.throwError(e)),i}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let t=new c.Object3D;t.matrix.copy(e.matrix).premultiply(e.work.transform),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixAutoUpdate=!1;let n=new c.Vector3(0,0,-1);n.applyQuaternion(this.camera.quaternion);let r=t.quaternion.clone().inverse();return n.applyQuaternion(r),{theta:Math.atan2(n.x,-n.z),phi:-Math.asin(n.y),lookAtVector:n}}}return null}addPass(e){this.fiveRenderer.composer.addPass(e)}removePass(e){let t=this.fiveRenderer.composer.passes.indexOf(e);t!==-1&&this.fiveRenderer.composer.passes.splice(t,1)}insertPass(e,t){this.fiveRenderer.composer.insertPass(e,t)}get renderMode(){return this.fiveRenderer.renderMode}set renderMode(e){this.fiveRenderer.renderMode=e}get enableHQ(){return this.fiveRenderer.renderMode===`point-cloud-high-quality`}set enableHQ(e){this.fiveRenderer.renderMode=e?`point-cloud-high-quality`:`default`,this.needsRender=!0}get enableEDL(){return this.eyeDomeLightingPass.enabled}set enableEDL(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0}get enableAdaptiveLuminance(){return this.adaptiveLuminancePass.enabled}set enableAdaptiveLuminance(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0}get enableIOSEDR(){return!1}set enableIOSEDR(e){}get enablePostProcessing(){return!0}set enablePostProcessing(e){}get modelSceneNeedsRender(){return this.modelScene.needsRender}set modelSceneNeedsRender(e){this.modelScene.needsRender=e}};if(Ny.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`){let e={THREE:c,constructor:Ny,instances:My};Object.assign(window,{__FIVE_DEBUG__:e})}var Py=class{static createButton(e){let t=document.createElement(`button`);function n(){t.style.display=``,t.style.cursor=`pointer`,t.style.left=`calc(50% - 50px)`,t.style.width=`100px`,t.textContent=`ENTER VR`,t.onmouseenter=function(){t.style.opacity=`1.0`},t.onmouseleave=function(){t.style.opacity=`0.5`},t.onclick=function(){e&&e()}}function r(){t.style.display=``,t.style.cursor=`auto`,t.style.left=`calc(50% - 75px)`,t.style.width=`150px`,t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function i(){r(),t.textContent=`VR NOT SUPPORTED`}function a(e){e.style.position=`absolute`,e.style.bottom=`20px`,e.style.padding=`12px 6px`,e.style.border=`1px solid #fff`,e.style.borderRadius=`4px`,e.style.background=`rgba(0,0,0,0.1)`,e.style.color=`#fff`,e.style.font=`normal 13px sans-serif`,e.style.textAlign=`center`,e.style.opacity=`0.5`,e.style.outline=`none`,e.style.zIndex=`999`}if(`xr`in navigator)return t.id=`VRButton`,t.style.display=`none`,a(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():i()}),t;{let e=document.createElement(`a`);return window.isSecureContext===!1?(e.href=document.location.href.replace(/^http:/,`https:`),e.innerHTML=`WEBXR NEEDS HTTPS`):(e.href=`https://immersiveweb.dev/`,e.innerHTML=`WEBXR NOT AVAILABLE`),e.style.left=`calc(50% - 90px)`,e.style.width=`180px`,e.style.textDecoration=`none`,a(e),e}}};exports.AdaptiveLuminancePass=Dm,exports.AnimationFrameLoop=ri,exports.BoundingMesh=Gf,exports.Camera=en,exports.CustomShader=un,exports.PBMCustomShader=un,exports.EffectComposer=rm,exports.EyeDomeLightingPass=Am,exports.Fetcher=fr,exports.Five=Ny,exports.FivePass=am,exports.FiveRenderer=Jm,exports.FullScreenQuad=im,exports.Histogram=_m,exports.InternalWebGLRenderer=Ym,exports.Model=If,exports.ModelScene=qf,exports.Motion=Z,exports.NetworkSubscribe=sr,exports.PBMContainer=Kn,exports.PBMGSObject=Yn,exports.PBMGroup=Ct,exports.PBMMesh=yn,exports.PBMMeshMaterial=vn,exports.PBMPanoFilter=dn,exports.PBMPointCloud=kn,exports.PBMPointCloudMaterial=On,exports.PBMSkinnedMesh=bn,exports.PBMUpdateable=ln,exports.PROXY_CONTROLLER_EVENT_NAMES=Vv,exports.PanoCircleMesh=sh,exports.PanoCircleMeshCustom=_h,exports.PanoCircleMeshSolid=fh,exports.Parameter=K,exports.Scene=nh,exports.Subscribe=cn,exports.TextureLoader=hi,exports.Tile=jl,exports.Tile3D=hf,exports.Tile3DModel=hf,exports.TileCache=rd,exports.TileNode=Ku,exports.TileRequestScheduler=ed,exports.Tileset=ld,exports.Trajectory=Xu,exports.TrajectoryNode=Zu,exports.Work=Qp,exports.WorkResolvedObserver=tm,exports.XRButton=Py,exports.controllersDefaultInitArgs=Bv,exports.coordinatesToVector=Vt,exports.createDebugBoundingMesh=El,exports.createWorks=nm,exports.defaultImageURLTransform=Kr,exports.draco=eo,exports.getViewportScale=Kv,exports.headingToLongitude=Wt,exports.imageSupport=kr,exports.isBoundingVolume=xl,exports.isPanoId=_p,exports.ktx2=co,exports.loadAt3d=ea,exports.loadB3dm=rs,exports.loadDome=ia,exports.loadDomez=da,exports.loadFbx=vc,exports.loadGltf=fs,exports.loadPbm=Mi,exports.loadPly=ms,exports.loadPnts=us,exports.loadSplat=tl,exports.loadSpz=Qo,exports.loadX3p=Qc,exports.longitudeToHeading=Ut,exports.makeBoundingVolume=Sl,exports.panoEqual=gp,exports.panoParse=hp,exports.panoStringify=Q,exports.parseWork=$p,exports.vectorToCoordinates=Ht,exports.workToJson=Qf;