@realsee/five 6.0.0-alpha.75 → 6.0.0-alpha.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/umd/five.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 1/3/2024
5
- * Version: 6.0.0-alpha.75
4
+ * Generated: 1/31/2024
5
+ * Version: 6.0.0-alpha.77
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -414,7 +414,7 @@ varying vec2 vUv;
414
414
  void main() {
415
415
  gl_FragColor = texture2D(map, vUv);
416
416
  }
417
- `,cacheMaterials=[];function getMaterial(){var n=cacheMaterials.pop();return n||new THREE__namespace.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:PLANE_VERTEX_SHADER,fragmentShader:PLANE_FRAGMENT_SHADER,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function releaseMaterial(n){n.uniforms.map.value=null,cacheMaterials.push(n)}function renderTexturesToCubeRenderTarget(n,t,e){var r=new THREE__namespace.Scene;r.matrixAutoUpdate=!1;var i=new THREE__namespace.Group;i.scale.set(1,1,-1),r.add(i);for(var o=[],s=0,u=n;s<u.length;s++){var l=u[s],c=getMaterial();o.push(c),c.uniforms.map.value=l.texture,c.uniforms.flipY.value=l.flipY?1:0;var d=new THREE__namespace.Group,f=new THREE__namespace.Mesh(PLAME_GEOMETRY,c);f.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),f.scale.set(l.size.x,l.size.y,1),d.quaternion.copy(QUATERNION[l.face]),d.add(f),i.add(d)}var p=e.autoClear;e.autoClear=!1;var v=new THREE__namespace.CubeCamera(.1,2,t);v.matrixAutoUpdate=!1,v.update(e,r),e.autoClear=p;for(var A=0,m=o;A<m.length;A++){var c=m[A];releaseMaterial(c)}}var canUseNativeImageBitmap=function(){return!1}();function createImageBitmapLikeImage(){var n=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){n.onerror=n.onload=n.close=noop$1,n.decoding="async";var t=n.src;n.removeAttribute("src"),/^blob\:/.test(t)&&URL.revokeObjectURL(t)}});return n}function createImageBitmapLike(n){return new Promise(function(t,e){var r=createImageBitmapLikeImage();r.onload=function(){/^blob\:/.test(r.src)&&URL.revokeObjectURL(r.src),r.onload=r.onerror=noop$1,setTimeout(function(){t(r)},0)},r.onerror=function(){var i=r.src;r.onload=r.onerror=noop$1,r.close(),e(new Error("image load error: ".concat(i)))},r.src=URL.createObjectURL(n)})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.shift();if(e)return e.width=n,e.height=t,e;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop$1,canvasPool.push(r)}});return r}function poolImageToTexture(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=createCanvas(Math.min(n.width,t.width),Math.min(n.height,t.height)),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.drawImage(n,0,0,e.width,e.height),n.close();var i=new THREE__namespace.Texture(e);i.needsUpdate=!0,i.flipY=!0;var o=i.dispose;return i.dispose=function(){e.close(),o.call(i),i.dispose=o},i}else{var s=new THREE__namespace.Texture(n);s.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?s.flipY=!1:s.flipY=!0;var u=s.dispose;return s.dispose=function(){n.close(),u.call(s),s.dispose=u},s}}function poolImagesToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){for(var r=0,i=n;r<i.length;r++){var o=i[r];o.close()}e.call(t),t.dispose=e},t}var FACE_ORDER=["right","left","up","down","front","back"],MAX_TILE_RENDER_EACH_FRAME=4,TileCubeTextureTarget=function(){function n(t,e,r,i,o){this.tileTree=e,this.tileSources=r,this.options=i,this.renderer=o,this.name="",this.needsRender=!1,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.textures=[],this.baseCubeTexture=t}return Object.defineProperty(n.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var e,r,i,o,s;if(t===null)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=(e=this.options.format)!==null&&e!==void 0?e:THREE__namespace.RGBAFormat,t.texture.minFilter=(r=this.options.minFilter)!==null&&r!==void 0?r:THREE__namespace.LinearFilter,t.texture.magFilter=(i=this.options.magFilter)!==null&&i!==void 0?i:THREE__namespace.LinearFilter,t.texture.wrapS=(o=this.options.wrapS)!==null&&o!==void 0?o:THREE__namespace.ClampToEdgeWrapping,t.texture.wrapT=(s=this.options.wrapT)!==null&&s!==void 0?s:THREE__namespace.ClampToEdgeWrapping,this.baseCubeTexture&&(renderCubeTextureToCubeRenderTarget(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&renderCubeTextureToCubeRenderTarget(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),n.prototype.requestTile=function(t){var e=this,r,i,o,s,u,l,c=this.tileSources.filter(function(m){return m.level===t.level})[0];if(!c){this.loadedCubeNodes.add(t);return}var d=c.size,f=Math.pow(2,t.level)*t.position.y,p=Math.pow(2,t.level)*t.position.x,v="".concat(((o=(i=(r=this.options.imageURL)===null||r===void 0?void 0:r.options)===null||i===void 0?void 0:i.key)!==null&&o!==void 0?o:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(f,".").concat(p),A=__assign(__assign({},(u=(s=this.options.imageURL)===null||s===void 0?void 0:s.options)!==null&&u!==void 0?u:{key:"unknown"}),{key:v,size:d*t.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[d*t.position.x,d*t.position.y,d*t.size,d*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(c[t.face],{imageURL:{transform:(l=this.options.imageURL)===null||l===void 0?void 0:l.transform,options:__assign({},A)},format:THREE__namespace.RGBAFormat,timeout:this.options.timeout,fetcher:this.options.fetcher}).then(function(m){if(e.disposed){m.body.dispose();return}e.textures.push({face:t.face,level:t.level,position:t.position,size:new THREE__namespace.Vector2(t.size,t.size),texture:m.body,flipY:!m.body.flipY}),e.loadedCubeNodes.add(t)}).catch(noop$1).then(function(){e.disposed||e.loadingCubeNodes.delete(t)})},n.prototype.update=function(t,e){var r=this;if(!this.disposed){var i=[];traverseTileCubeNode(this.tileTree,function(p){if(r.loadingCubeNodes.has(p)||p.level>e||!t.intersectsBox(p.box))return!1;if(!r.loadedCubeNodes.has(p))return i.push(p),!1});for(var o=0,s=i;o<s.length;o++){var u=s[o];this.requestTile(u)}if(this.cubeRenderTarget&&this.textures.length){var l=this.textures.splice(0,MAX_TILE_RENDER_EACH_FRAME);renderTexturesToCubeRenderTarget(l,this.cubeRenderTarget,this.renderer),this.needsRender=!0;for(var c=0,d=l;c<d.length;c++){var f=d[c];f.texture.dispose()}}}},Object.defineProperty(n.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var t=0,e=this.textures;t<e.length;t++){var r=e[t];r.texture.dispose()}this.textures.length=0}},n}(),TextureLoader=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,i,o,s){var u,l,c,d;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var f={};typeof e.flipY!="undefined"&&(f.flipY=e.flipY),typeof e.format!="undefined"&&(f.format=e.format),typeof e.minFilter!="undefined"&&(f.minFilter=e.minFilter),typeof e.magFilter!="undefined"&&(f.magFilter=e.magFilter);var p=(l=(u=e.imageURL)===null||u===void 0?void 0:u.options)!==null&&l!==void 0?l:{key:"unknown"};t=applyImageURLOptions(t,(c=e.imageURL)===null||c===void 0?void 0:c.transform,p);var v=getProtocol(t),A=(d=e.viaAjax)!==null&&d!==void 0?d:canUseNativeImageBitmap,m=isJsonpSource(t),y=/^https?:/.test(v);if(m?A=!0:y||(A=!1),A){var h=null,g="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:g},void 0,void 0,o).then(function(E){return createImageBitmapLike(E.body)}).then(function(E){return poolImageToTexture(E,e.maxSize)}).then(function(E){return Object.assign(E,f),E}).then(function(E){var _={meta:h,body:E};return r(_),_}).catch(function(E){return i(E),Promise.reject(E)})}else{var b=null,T;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(E){return T=E,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,o,E)}).then(function(E){return b=E.meta,poolImageToTexture(E.body,e.maxSize)}).then(function(E){return Object.assign(E,f),E}).then(function(E){var _={meta:b,body:E};return r(_),_}).catch(function(E){return T&&T.close(),i(E),Promise.reject(E)})}},n.prototype.loadCubeTexture=function(t,e,r,i,o,s){var u,l,c,d;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1),typeof e.format!="undefined"&&e.format,typeof e.minFilter!="undefined"&&e.minFilter,typeof e.magFilter!="undefined"&&e.magFilter;for(var f=[t[FACE_ORDER[0]],t[FACE_ORDER[1]],t[FACE_ORDER[2]],t[FACE_ORDER[3]],t[FACE_ORDER[4]],t[FACE_ORDER[5]]],p=[],v=[0,0,0,0,0,0],A=[],m=function(h){var g=(l=(u=e.imageURL)===null||u===void 0?void 0:u.options)!==null&&l!==void 0?l:{key:"unknown"},b=applyImageURLOptions(f[h],(c=e.imageURL)===null||c===void 0?void 0:c.transform,__assign(__assign({},g),{key:g.key+"."+FACE_ORDER[h]})),T=getProtocol(b),E=function(I){v[h]=I,o(v.reduce(function(F,B){return F+B},0)/6)},_=(d=e.viaAjax)!==null&&d!==void 0?d:!1,x=/^https?:$/.test(T),w=isJsonpSource(b);if(w?_=!0:x||(_=!1),_){var S="blob",C=e.fetcher.ajax(b,{timeout:e.timeout,responseType:S},void 0,void 0,E).then(function(I){return A[h]=I.meta,createImageBitmapLike(I.body)});p.push(C)}else{var M,C=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(F){return M=F,e.fetcher.loadImage(b,{timeout:e.timeout},void 0,void 0,E,F)}).then(function(F){return A[h]=F.meta,F.body}).catch(function(F){return M&&M.close(),Promise.reject(F)});p.push(C)}},y=0;y<6;y++)m(y);return Promise.all(p).then(function(h){return poolImagesToCubeTexture(h)}).then(function(h){return Object.assign(h,__assign({encoding:THREE__namespace.sRGBEncoding},e)),h}).then(function(h){var g={body:h,meta:A};return r(g),g}).catch(function(h){for(var g=0,b=p;g<b.length;g++){var T=b[g];T.then(function(E){return E.close()}).catch(noop$1)}return i(h),Promise.reject(h)})},n.prototype.loadTiledCubeTexture=function(t,e,r,i,o,s,u){var l=this;return i===void 0&&(i=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1),new Promise(function(c,d){var f,p;l.loadCubeTexture(t,{imageURL:{transform:(f=r.imageURL)===null||f===void 0?void 0:f.transform,options:(p=r.imageURL)===null||p===void 0?void 0:p.options},format:THREE__namespace.RGBAFormat,viaAjax:r.viaAjax,timeout:r.timeout,fetcher:r.fetcher},function(v){var A,m,y=v.meta,h=v.body,g=(A=r.tileImageSize)!==null&&A!==void 0?A:512,b=(m=r.tileMaxLevel)!==null&&m!==void 0?m:2,T=Math.max(1024*b,512),E=createTileCubeTree(b),_=new TileCubeTextureTarget(h,E,e,{textureSize:T,tileImageSize:g,textureLoader:l,imageURL:r.imageURL,timeout:r.timeout,fetcher:r.fetcher},u),x={meta:y,body:_};i(x),c(x)},function(v){o(v),d(v)},s,u).catch(noop$1)})},n}();const vertexShader$6=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--nvor-sy|n-sy||H--n\bv{t-sy|n-Sy||H0r{qvsnvor-sy|n-v_||sZnxHn\bv{t-sy|n-V_||sZnxHn\bv{t-rp@-[|znyHn\bv{t-rp@-cvr]|vv|{Hn\bv{t-rpA-|yq]|vv|{Hn\bv{t-sy|n-Y|tQr}uHn\bv{t-znA-cvrZnv\x07H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v{pyqr-I?l}nlrr\x07K0v{pyqr-Ip|y|l}nlrr\x07K0v{pyqr-Iunq|zn}l}nlrr\x07K|vq-znv{56-\n--0v{pyqr-Ilrr\x07K--0v{pyqr-I?lrr\x07K--0v{pyqr-Ip|y|lrr\x07K--0v{pyqr-Iortv{{|znylrr\x07K--0v{pyqr-Iqrsny{|znylrr\x07K--rpA-n{s|zrq-J-rpA5}|vv|{9->;=6H--rpA-z]|vv|{-J-z|qrycvrZnv\x07-7-n{s|zrqH--[|zny-J-{|znyv r5n{s|zrq[|zny6H--0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6----Sy||-J-sy||H--0r{qvs--cvr]|vv|{-J-:z]|vv|{;\x07\b H--|yq]|vv|{-J-z|qryZnv\x07-7-n{s|zrqH--tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z|qrycvrZnv\x07-7-n{s|zrqH--0v{pyqr-Iunq|zn}lrr\x07K--Y|tQr}u-J-y|t?5:z]|vv|{; 6H--cvrZnv\x07-J-vrZnv\x07H--V_||sZnx-J-v_||sZnxH\f"),fragmentShader$6=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=60qrsv{r-aNb-C;?E@>EB?{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-rp@-qvssrH{vs|z-rp@-rzvvrH{vs|z-rp@-}rpynH{vs|z-sy|n-uv{v{rH{vs|z-sy|n-r\x07}|rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH{vs|z-sy|n-u|{Sy||V{qr\x07Hn\bv{t-sy|n-V_||sZnxH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6--{vs|z-rp?-}n{|cvqr|lv rH--{vs|z-znA-}n{|cvqr|lznv\x07H--{vs|z-sy|n-}n{|cvqr|lny}unH--{vs|z-nz}yr?Q-}n{|cvqr|lzn}H0r{qvs0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--n\bv{t-sy|n-Sy||H0ryr--{vs|z-sy|n-sy||H0r{qvsn\bv{t-rpA-|yq]|vv|{Hn\bv{t-sy|n-Y|tQr}uHn\bv{t-znA-cvrZnv\x07Hp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlP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}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5ory|{tv{tSY||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9->;=6H----r{H--0r{qvs--<<楼层选择计算--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-KJ-=;=-33-no5ory|{tv{tSY||-:-u|{Sy||V{qr\x076-KJ->;=6-\n----sy||\\}npv\b-J-=;>H--\f--rpA-qvssrP|y|-J-rpA5qvssr;to9-|}npv\b6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5rp@5=;=69-rp@5=;=69-rp@5=;=69-rp@5=;=66H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--<<-调整曝光值--vnqvn{pr-J-vnqvn{pr-7-r\x07}|rH--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--0v{pyqr-In|zn}lsntzr{K--<<-减少方向光对模型的影响--rp@-|t|v{tYvtu-J-5rsyrprqYvtu;qvrpQvssr-7-=;?6-8----rsyrprqYvtu;v{qvrpQvssr-8----rsyrprqYvtu;v{qvrp`}rpyn-8----|nyRzvvr_nqvn{prH--<<-修复黑色面片的问题--vs-5|t|v{tYvtu;-K-=;=-\v\v-|t|v{tYvtu;t-K-=;=-\v\v-|t|v{tYvtu;o-K-=;=6-\n----tylSntP|y|-J-rpA5|t|v{tYvtu9-qvssrP|y|;n6H--\f-ryr-\n----tylSntP|y|-J-rpA5OYNPXlP\\Y\\_;\x07\b 9-qvssrP|y|;n6H--\f--rp@-}n{|=a|crr\x07-J-5|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-5|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-?;=66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6----rp@-pnzrna|crr\x07-J-|yq]|vv|{;\x07\b -:-pnzrn]|vv|{H----rpA-zn}P||q-J-rpA5pnzrna|crr\x079->;=6-7-}n{|cvqr|lznv\x07H----rp?--J-rp?5------=;B-8-zn}P||q;\x07-<-zn}P||q; -<-}n{|cvqr|lv r;\x079------=;B-:-zn}P||q;\b-<-zn}P||q; -<-}n{|cvqr|lv r;\b----6H----rpA-vqr|P|y|-J-r\x07r?Q5}n{|cvqr|lzn}9-6H----sy|n-znpu-J-5>;=-:-r}5=;=9-zn}P||q; 66-7-5>;=-:-r}5=;B9-no5;\x07-:-=;B666-7-5>;=-:-r}5=;B9-no5;\b-:-=;B666H----sy|n-ny}un-J-pynz}5=;=9->;=9-B;=-7-5>;=-:-pynz}5qvn{pr59-rp?5=;B9-=;B66-<-=;BB-9-=;=9->;=666H----}n{|P|y|-J-zv\x075}n{|P|y|9-vqr|P|y|9-znpu-7-ny}un-7-}n{|cvqr|lny}un6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\l\\]NPVaf6----tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H----tylSntP|y|;n-J-|}npv\bH--0ryr----tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b-7-sy||\\}npv\b6H----tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f");var EMPTY_CUBE_TEXTURE=new THREE__namespace.WebGLCubeRenderTarget(1).texture;EMPTY_CUBE_TEXTURE.name="EMPTY_TEXTURE";var shaderUniforms$2=Object.assign({modelAlpha:new THREE__namespace.Uniform(0),progress:new THREE__namespace.Uniform(0),pano0_map:new THREE__namespace.Uniform(EMPTY_CUBE_TEXTURE),pano0_luminanceMap:new THREE__namespace.Uniform(null),pano0_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano1_map:new THREE__namespace.Uniform(EMPTY_CUBE_TEXTURE),pano1_luminanceMap:new THREE__namespace.Uniform(null),pano1_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),floor:new THREE__namespace.Uniform(0)},{exposure:new THREE__namespace.Uniform(1),emissive:new THREE__namespace.Uniform(new THREE__namespace.Color(0)),emissiveMap:new THREE__namespace.Uniform(null),specular:new THREE__namespace.Uniform(new THREE__namespace.Color(1118481)),specularMap:new THREE__namespace.Uniform(null),normalMap:new THREE__namespace.Uniform(null),bumpMap:new THREE__namespace.Uniform(null),shininess:new THREE__namespace.Uniform(30)},THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.common),THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.lights)),PBMMeshMaterial=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,l,c,d,f,p,v,A,m,y,h,g,b,T,E,_,x=n.call(this,{vertexShader:vertexShader$6,fragmentShader:fragmentShader$6,uniforms:THREE__namespace.UniformsUtils.clone(shaderUniforms$2),defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_FLOOR:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_POINT_NORMAL:!1,USE_POINT_CIRCLE:!1,USE_POINT_ADAPTIVE_SIZE:!1,USE_POINT_COLOR_ALTITUDE:!1},lights:!0})||this,w,S=null,C=null;return Object.defineProperties(x,{pano0:{get:function(){return S},set:function(M){if(S!==M){S=M,M===null?(this.uniforms.pano0_map.value=EMPTY_CUBE_TEXTURE,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=M.map instanceof TileCubeTextureTarget?M.map.texture:M.map,this.uniforms.pano0_luminanceMap.value=M.luminanceMap instanceof TileCubeTextureTarget?M.luminanceMap.texture:M.luminanceMap,this.uniforms.pano0_matrix.value.copy(M.matrix));var I=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,F=this.defines.USE_LUMINANCE;F!==I&&(this.defines.USE_LUMINANCE=I,this.needsUpdate=!0)}}},pano1:{get:function(){return C},set:function(M){if(C!==M){C=M,M===null?(this.uniforms.pano1_map.value=EMPTY_CUBE_TEXTURE,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=M.map instanceof TileCubeTextureTarget?M.map.texture:M.map,this.uniforms.pano1_luminanceMap.value=M.luminanceMap instanceof TileCubeTextureTarget?M.luminanceMap.texture:M.luminanceMap,this.uniforms.pano1_matrix.value.copy(M.matrix));var I=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,F=this.defines.USE_LUMINANCE;F!==I&&(this.defines.USE_LUMINANCE=I,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(M){this.uniforms.modelAlpha.value=M}},progress:{get:function(){return this.uniforms.progress.value},set:function(M){this.uniforms.progress.value=M}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(M){var I=this.defines.USE_BLACK_TRANSITION;I!==M&&(this.defines.USE_BLACK_TRANSITION=M,this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(M){this.uniforms.constantColor.value=M;var I=this.defines.USE_CONSTANT_COLOR,F=M!==null;I!==F&&(this.defines.USE_CONSTANT_COLOR=F,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(M){this.uniforms.opacity.value=M}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(M){this.uniforms.shownFloorIndex.value=M}},clippers:{get:function(){return w},set:function(M){w!==M&&(w=M,this.uniforms.clippers.value=(w||[]).map(function(I){var F=typeof I.floorIndex=="number"?I.floorIndex:-1,B=new THREE__namespace.Matrix4().getInverse(I.clippingBoxMatrix);return{matrixInverse:B,floorIndex:F}}),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(M){M!==this.defines.USE_EDL&&(this.defines.USE_EDL=M,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(M){M!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=M,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(M){M!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=M,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(M){this.uniforms.floor.value=M}}}),x.pano0=(r=e.pano0)!==null&&r!==void 0?r:defaultPbmParameters.pano0,x.pano1=(i=e.pano1)!==null&&i!==void 0?i:defaultPbmParameters.pano1,x.modelAlpha=(o=e.modelAlpha)!==null&&o!==void 0?o:defaultPbmParameters.modelAlpha,x.progress=(s=e.progress)!==null&&s!==void 0?s:defaultPbmParameters.progress,x.useBlackTransition=(u=e.useBlackTransition)!==null&&u!==void 0?u:defaultPbmParameters.useBlackTransition,x.constantColor=(l=e.constantColor)!==null&&l!==void 0?l:defaultPbmParameters.constantColor,x.opacity=(c=e.opacity)!==null&&c!==void 0?c:defaultPbmParameters.opacity,x.shownFloorIndex=(d=e.shownFloorIndex)!==null&&d!==void 0?d:defaultPbmParameters.shownFloorIndex,x.clippers=(f=e.clippers)!==null&&f!==void 0?f:defaultPbmParameters.clippers,x.useEDL=(p=e.useEDL)!==null&&p!==void 0?p:defaultPbmParameters.useEDL,x.useHQWeight=(v=e.useHQWeight)!==null&&v!==void 0?v:defaultPbmParameters.useHQWeight,x.useHQDepth=(A=e.useHQDepth)!==null&&A!==void 0?A:defaultPbmParameters.useHQDepth,x.pointSize=(m=e.pointSize)!==null&&m!==void 0?m:defaultPbmParameters.pointSize,x.pointColor=(y=e.pointColor)!==null&&y!==void 0?y:defaultPbmParameters.pointColor,x.pointShape=(h=e.pointShape)!==null&&h!==void 0?h:defaultPbmParameters.pointShape,x.pointScale=(g=e.pointScale)!==null&&g!==void 0?g:defaultPbmParameters.pointScale,x.pointBack=(b=e.pointBack)!==null&&b!==void 0?b:defaultPbmParameters.pointBack,x.pointMinPixel=(T=e.pointMinPixel)!==null&&T!==void 0?T:defaultPbmParameters.pointMinPixel,x.pointMaxPixel=(E=e.pointMaxPixel)!==null&&E!==void 0?E:defaultPbmParameters.pointMaxPixel,x.gradientTexture=(_=e.gradientTexture)!==null&&_!==void 0?_:defaultPbmParameters.gradientTexture,x.floor=0,x}return t.prototype.onBeforeCompile=function(e,r){var i,o,s=String((o=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,s),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,s)},t.prototype.update=function(e,r){this.transparent=this.shownFloorIndex>-1||this.opacity<1,this.blending=this.transparent?THREE__namespace.NormalBlending:THREE__namespace.NoBlending},t.prototype.syncModel=function(e){var r="".concat(e.id,":").concat(e.materialVersion);r!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.syncModelVersion=r)},t}(THREE__namespace.ShaderMaterial),InternalWebGLRenderer=function(n){__extends(t,n);function t(e){var r=e.preserveDrawingBuffer,i=r===void 0?!0:r,o=e.premultipliedAlpha,s=o===void 0?!0:o,u=e.stencil,l=u===void 0?!0:u,c=e.backgroundColor,d=c===void 0?1579548:c,f=e.backgroundAlpha,p=f===void 0?1:f,v=e.pixelRatio,A=v===void 0?1:v,m=e.antialias,y=e.webgl2,h=this,g={antialias:m,alpha:!0,preserveDrawingBuffer:i,stencil:l,premultipliedAlpha:s,powerPreference:"high-performance"};if(y){var b=document.createElement("canvas"),T=b.getContext("webgl2",g);T?h=n.call(this,__assign(__assign({},g),{antialias:!0,canvas:b,context:T}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),h=n.call(this,g)||this)}else h=n.call(this,g)||this;return h.setPixelRatio(A),h.setClearColor(d,p),h.outputEncoding=THREE__namespace.sRGBEncoding,h.autoClear=!0,h}return t}(THREE__namespace.WebGLRenderer),Scene=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.add.apply(this,e)},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.remove.apply(this,e)},t}(THREE__namespace.Scene);function coordinatesToVector(n,t){var e=Math.abs(Math.cos(n.latitude)),r=-Math.sin(n.longitude)*e,i=-Math.sin(n.latitude),o=-Math.cos(n.longitude)*e;return t?t.set(r,i,o):new THREE__namespace.Vector3(r,i,o)}var DEFAULT_ASPECT=1,DEFAULT_NEAR=.1,DEFAULT_FAR=2e3,TAU$2=Math.PI*2,PI_2=Math.PI/2;function formatRad$1(n){return n>0&&n<=TAU$2?n:(n%TAU$2+TAU$2)%TAU$2}function matrixLerp(n,t,e,r){e=Math.pow(e,4);for(var i=0;i<16;i++)r.elements[i]=n.elements[i]+(t.elements[i]-n.elements[i])*e;return r}var Camera=function(n){__extends(t,n);function t(e,r,i,o,s,u,l){r===void 0&&(r=DEFAULT_ASPECT),i===void 0&&(i=DEFAULT_NEAR),o===void 0&&(o=DEFAULT_FAR),s===void 0&&(s=new THREE__namespace.Vector2),u===void 0&&(u=512),l===void 0&&(l=1);var c=n.call(this)||this;c.fov=e,c.aspect=r,c.near=i,c.far=o,c.perspToOrtho=s,c.screenHeight=u,c.pixelRatio=l,c.needsRender=!0,c.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new THREE__namespace.Vector3},c.computePose(),c.perspectiveCamera=new THREE__namespace.PerspectiveCamera(c.fov,c.aspect,.001,c.far);var d=Math.max(c.orthoDistance,.01)*Math.tan(.5*c.fov/180*Math.PI),f=-.5*c.aspect*2*d;return c.orthographicCamera=new THREE__namespace.OrthographicCamera(f,-f,d,-d,.001,c.far),c.computeProjectionMatrix(),c.lastValues={position:c.position.clone(),quaternion:c.quaternion.clone(),scale:c.scale.clone(),fov:c.fov,aspect:c.aspect,near:c.near,far:c.far,perspToOrtho:c.perspToOrtho.clone()},c.type=c.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera",c}return Object.defineProperty(t.prototype,"orthoDistance",{get:function(){return this.pose.distance>1?this.pose.distance:1+(this.pose.distance-1)*this.perspToOrtho.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.zoom:this.type==="PerspectiveCamera"?this.perspectiveCamera.zoom:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.top:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.bottom:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.left:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.right:0},enumerable:!1,configurable:!0}),t.prototype.getDirection=function(e){return coordinatesToVector(this.pose,e)},t.prototype.computePose=function(e){e===void 0&&(e=0);var r=this.getDirection(new THREE__namespace.Vector3);this.pose.longitude=formatRad$1(-Math.atan2(r.x,-r.z)),this.pose.latitude=-Math.asin(r.y/1),this.pose.fov=this.fov,this.pose.distance=e;var i=new THREE__namespace.Vector3().add(this.position).add(r.clone().setLength(this.pose.distance));return this.pose.offset.copy(i),this},t.prototype.setFromPose=function(e){var r,i,o,s,u,l=formatRad$1((r=e.longitude)!==null&&r!==void 0?r:this.pose.longitude),c=Math.max(-PI_2+1e-4,Math.min(PI_2-1e-4,(i=e.latitude)!==null&&i!==void 0?i:this.pose.latitude)),d=(o=e.fov)!==null&&o!==void 0?o:this.pose.fov,f=(s=e.distance)!==null&&s!==void 0?s:this.pose.distance,p=(u=e.offset)!==null&&u!==void 0?u:this.pose.offset,v=coordinatesToVector({longitude:l,latitude:c}).normalize();return this.position.set(0,0,0),this.lookAt(v),this.position.add(p).sub(v.clone().setLength(f)),this.fov!==d&&(this.fov=d,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=l,this.pose.latitude=c,this.pose.fov=d,this.pose.distance=f,this.pose.offset.copy(p),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){matrixLerp(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,r,i,o,s,u){this.perspectiveCamera.setViewOffset(e,r,i,o,s,u),this.orthographicCamera.setViewOffset(e,r,i,o,s,u),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e,r){var i=!1;if((this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect)&&(this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),i=!0),!this.lastValues.position.equals(this.position)||!this.lastValues.quaternion.equals(this.quaternion)||!this.lastValues.scale.equals(this.scale)||!this.lastValues.perspToOrtho.equals(this.perspToOrtho)||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect){var o=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),s=-.5*this.aspect*2*o;this.orthographicCamera.left=s,this.orthographicCamera.right=-s,this.orthographicCamera.top=o,this.orthographicCamera.bottom=-o,this.orthographicCamera.updateProjectionMatrix(),i=!0}i&&this.computeProjectionMatrix(),this.lastValues.position.copy(this.position),this.lastValues.quaternion.copy(this.quaternion),this.lastValues.scale.copy(this.scale),this.lastValues.fov=this.fov,this.lastValues.aspect=this.aspect,this.lastValues.near=this.near,this.lastValues.far=this.far,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.type=this.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera"},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e,r){return n.prototype.copy.call(this,e,r),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.updateTime(now(),0),this},t}(THREE__namespace.Camera),VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,scratchVector=new THREE__namespace.Vector3,scratchMatrix4$3=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3=new THREE__namespace.Box3,scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$3.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$3.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$3),this.setFromFrustum(scratchFrustum),this},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,i=this.planes;r<i.length;r++){var o=i[r],s=t.intersectPlane(o);switch(s){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,i=Math.min(32,this.planes.length),o=0;o<i;++o){var s=1<<o;if(e&s){var u=this.planes[o],l=t.intersectPlane(u);if(l===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;l===VolumePlaneIntersect.Intersecting&&(r|=s)}}return r},n}(),BoxBoundingVolume=function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],i=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=e[9],d=e[10],f=e[11],p=Math.sqrt(r*r+i*i+o*o),v=Math.sqrt(s*s+u*u+l*l),A=Math.sqrt(c*c+d*d+f*f);this.halfSize.set(p,v,A);var m=this.halfSize.toArray().reduce(function(y,h){return y+h},0);return(isNaN(m)||m<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/p,i/p,o/p,s/v,u/v,l/v,c/A,d/A,f/A]),isNaN(this.rotation.toArray().reduce(function(y,h){return y+h},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$3.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredTo=function(t){var e=this.rotation.elements,r=t.x-this.center.x,i=t.y-this.center.y,o=t.z-this.center.z,s=0,u;return u=r*e[0]+i*e[1]+o*e[2],u<0&&(u=-u),u-=this.halfSize.x,u>0&&(s+=u*u),u=r*e[3]+i*e[4]+o*e[5],u<0&&(u=-u),u-=this.halfSize.y,u>0&&(s+=u*u),u=r*e[6]+i*e[7]+o*e[8],u<0&&(u=-u),u-=this.halfSize.z,u>0&&(s+=u*u),s},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceSquaredTo(t))},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),e=new Float32Array(8*3);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,i=this.rotation.elements,o=this.halfSize,s=r.x,u=r.y,l=r.z,c=Math.abs(s*i[0]*o.x+u*i[1]*o.x+l*i[2]*o.x)+Math.abs(s*i[3]*o.y+u*i[4]*o.y+l*i[5]*o.y)+Math.abs(s*i[6]*o.z+u*i[7]*o.z+l*i[8]*o.z),d=r.dot(e)+t.constant;return d<=-c?VolumePlaneIntersect.Outside:d>=c?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e){scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$3.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$3.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$3),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1);var r=scratchRay$1.intersectBox(scratchBox3,scratchVector);return r?e!==void 0?r.applyMatrix4(scratchMatrix4$3).distanceTo(t.origin)<e:!0:!1},n}(),SphereBoundingVolume=function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+Math.sin(i)*this.radius,e[r*6+2]=this.center.z+0,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+Math.sin(i)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(i)*this.radius,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(i)*this.radius}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o},n.prototype.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredTo=function(t){var e=this.distanceTo(t);return e*e},n.prototype.distanceTo=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,i=t.normal,o=i.dot(e)+t.constant;return o<-r?VolumePlaneIntersect.Outside:o<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e){scratchSphere$1.set(this.center,this.radius);var r=t.intersectSphere(scratchSphere$1,scratchVector);return r?e!==void 0?t.origin.distanceTo(r)<e:!0:!1},n}(),RegionBoundingVolume=function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceTo=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredTo=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t){throw new Error("not implemented")},n}();function makeBoundingVolume(n){if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[2621517,3801199,4915345,5963950,7274706,8782079,9575167,10434047,11623423,12482559,13274879,13870335,14464511,15125247,15852031,16446719].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,transparent:!0})}),debugBoxGeometry=function(){var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(8*3);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e}(),debugSphereGeometry=function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var i=new THREE__namespace.BufferGeometry;return i.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),i.computeBoundingBox(),i.computeBoundingSphere(),i}();function createDebugBoundingMesh(n,t){if(n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}throw new Error("never")}var Tile=function(){function n(t,e,r,i){var o=this,s,u,l;this.parent=null,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,selectionDepth:0,shouldRefine:!1,distanceToCamera:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1},this.parent=i!=null?i:null,this.tileset=r,this.refine=(s=e.refine)!==null&&s!==void 0?s:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(l=(u=this.parent)===null||u===void 0?void 0:u.geometricError)!==null&&l!==void 0?l:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",byteLength:0},e.content.group!==void 0&&(this.content.group=e.content.group),e.content.boundingVolume&&(this.content.boundingVolume=makeBoundingVolume(e.content.boundingVolume).applyMatrix4(this.transform)),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=e.extras||{},e.children?this.children=e.children.map(function(c,d){return new n("".concat(o.id,".").concat(d),c,r,o)}):this.children=[]}return n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transformIsIdentity?null:this.tileset.transform;if(this.boundingVolume){var r=e?this.boundingVolume.clone().applyMatrix4(e):this.boundingVolume;this.state.distanceToCamera=r.distanceTo(t.camera.position);var i=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,i),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if(this.viewerRequestVolume){var o=e?this.viewerRequestVolume.clone().applyMatrix4(e):this.viewerRequestVolume;this.state.inRequestVolume=o.distanceSquaredTo(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="MESH"||this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),n.prototype.loadContent=function(){var t=this,e;if(this.hasEmptyContent||!(!((e=this.content)===null||e===void 0)&&e.uri))return Promise.resolve(!1);var r=this.content;return r.data?Promise.resolve(!0):(r.loadState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,function(){return t.getPriority()}).then(function(i){return i?t.tileset.options.contentLoader(t).then(function(o){return i.done(),r.loadState=o?"READY":"UNLOADED",o}).catch(function(o){return r.loadState="FAILED",i.done(),Promise.reject(o)}):(r.loadState="UNLOADED",Promise.resolve(!1))}))},n.prototype.unloadContent=function(){return this.content&&(this.content.loadState="UNLOADED",this.content.byteLength=0),!0},n.prototype.getScreenSpaceError=function(t,e,r){var i=this.tileset.transformIsIdentity?1:this.tileset.transform.getMaxScaleOnAxis(),o=this.parent?this.parent.geometricError:this.tileset.geometricError,s=i*(r?o:this.geometricError);if(s===0)return 0;var u=Math.max(e,.001),l=s*t.height/(u*t.sseDenominator);return l},n.prototype.getPriority=function(){var t=this.refine==="ADD"||this.tileset.skipLevelOfDetail;if(t&&!this.state.visible||this.tileset.frameNumber-this.state.touchedFrameNumber>=1||this.content.loadState==="UNLOADED")return-1;var e=this.parent,r=e&&(!t||this.state.screenSpaceError===0),i=r?e.state.screenSpaceError:this.state.screenSpaceError,o=this.tileset.root?this.tileset.root.state.screenSpaceError:0,s=Math.max(o-i,0);return s},n}(),RequestScheduler=function(){function n(){this.maxRequests=n.DEFAULT_MAX_REQUESTS,this.activeRequests=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return n.prototype.scheduleRequest=function(t,e){var r=this.requestMap.get(t);if(r)return r;var i={identiy:t,priority:0,getPriority:e,resolve:function(){}},o=new Promise(function(s){return i.resolve=s});return this.requestQueue.push(i),this.requestMap.set(t,o),this.issueNewRequests(),o},n.prototype.reset=function(){for(var t=0,e=this.requestQueue;t<e.length;t++){var r=e[t];r.resolve(null)}this.requestQueue.length=0,this.requestMap.clear(),this.activeRequests=0},n.prototype.issueRequest=function(t){var e=this,r=t.identiy,i=t.resolve,o=!1,s=function(){o||(o=!0,e.requestMap.delete(r),e.activeRequests--,e.issueNewRequests())};this.activeRequests++,i({done:s})},n.prototype.issueNewRequests=function(){var t=this;this.deferred||(this.deferred=setTimeout(function(){return t.issueNewRequestsAsync()},0))},n.prototype.issueNewRequestsAsync=function(){this.deferred=null;var t=Math.max(this.maxRequests-this.activeRequests,0);if(t!==0){this.updateAllRequests();for(var e=0;e<t;e++){var r=this.requestQueue.shift();if(r)this.issueRequest(r);else break}}},n.prototype.updateAllRequests=function(){for(var t=this.requestQueue,e=0;e<t.length;e++){var r=t[e];this.updateRequest(r)===!1&&(t.splice(e,1),this.requestMap.delete(r.identiy),e--)}t.sort(function(i,o){return i.priority-o.priority})},n.prototype.updateRequest=function(t){return t.priority=t.getPriority(t.identiy),t.priority<0?(t.resolve(null),!1):!0},n.DEFAULT_MAX_REQUESTS=6,n}(),CacheNode=function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n}(),CacheNodeList=function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n}(),TilesetCache=function(){function n(){this.cacheNodeMap=new Map,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touch=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.add=function(t,e){if(!this.cacheNodeMap.has(t)){var r=this.list.add(t);this.cacheNodeMap.set(t,r),e&&e(t)}},n.prototype.unloadTile=function(t,e){var r=this.cacheNodeMap.get(t);r&&(this.list.remove(r),this.cacheNodeMap.delete(t),e&&e(t))},n.prototype.unloadTiles=function(t,e){for(var r=this.list.head;r!==this.sentinel&&t();){var i=r.item;r=r.next,this.unloadTile(i,e)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var i=r[e];i.item!=="sentinel"&&t.push(i.item)}return t},n}(),ManagedArray=function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n}(),TilesetTraverser=function(){function n(){this.loadSiblings=n.DEFAULT_LOAD_SIBLINGS,this.skipLevelOfDetail=n.DEFAULT_SKIP_LEVEL_OF_DETAIL,this.maxScreenSpaceError=n.DEFAULT_MAX_SCREEN_SPACE_ERROR,this._canSelectTile=!0,this._traversalStack=new ManagedArray,this._emptyTraversalStack=new ManagedArray,this.root=null,this.selectedTiles=new Map,this.requestedTiles=new Map,this.needsRefinedTiles=new Map,this.emptyTiles=new Map}return n.prototype.traverse=function(t,e,r){r===void 0&&(r=[]),this.root=t,this.reset();for(var i=0,o=r;i<o.length;i++){var s=o[i];this._traversalStack.reset(),this._emptyTraversalStack.reset(),this._canSelectTile=s.camera.visible,this.updateTile(t,s),this.executeTraversal(t,s)}this._traversalStack.reset(),this._emptyTraversalStack.reset(),this._canSelectTile=!0,this.updateTile(t,e),this.executeTraversal(t,e)},n.prototype.reset=function(){this.needsRefinedTiles.clear(),this.requestedTiles.clear(),this.selectedTiles.clear(),this.emptyTiles.clear(),this._traversalStack.reset(),this._emptyTraversalStack.reset()},n.prototype.executeTraversal=function(t,e){var r=this._traversalStack;if(t.state.selectionDepth=0,e.maxLevelOfDetail>=0)for(t.state.visible&&t.state.inRequestVolume&&r.push(t);r.length>0;){var i=r.pop(),o=!1;if(this.canTraverse(i,e,!1,!1)){var s=i.hasRenderContent?i.state.selectionDepth+1:i.state.selectionDepth;this.updateChildTiles(i,e,s),o=this.updateAndPushChildren(i,e,r)}var u=i.parent,l=!u||u.state.shouldRefine,c=!o;i.hasRenderContent?i.refine==="ADD"?(this.loadTile(i,e.frameNumber),this.selectTile(i,e)):i.refine==="REPLACE"&&(this.loadTile(i,e.frameNumber),c&&this.selectTile(i,e)):(this.emptyTiles.set(i.id,i),this.loadTile(i,e.frameNumber),c&&this.selectTile(i,e)),this.touchTile(i,e),i.state.shouldRefine=o&&l}},n.prototype.updateChildTiles=function(t,e,r){for(var i=t.children,o=0,s=i;o<s.length;o++){var u=s[o];u.state.selectionDepth=r,this.updateTile(u,e)}return!0},n.prototype.updateAndPushChildren=function(t,e,r){for(var i=t.children,o=t.refine==="REPLACE"&&t.hasRenderContent&&!this.skipLevelOfDetail,s=!1,u=!0,l=0,c=i;l<c.length;l++){var d=c[l];if(d.state.visible&&d.state.inRequestVolume?(r.find(d)&&r.delete(d),r.push(d),s=!0):(o||this.loadSiblings)&&(this.loadTile(d,e.frameNumber),this.touchTile(d,e)),o){var f=void 0;d.state.inRequestVolume?d.hasRenderContent?f=d.contentAvailable:f=this.executeEmptyTraversal(d,e):f=!1,u=u&&f}}return s||(u=!1),u},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e)},n.prototype.selectTile=function(t,e){this.shouldSelectTile(t)&&(t.state.selectedFrameNumber=e.frameNumber,this.selectedTiles.set(t.id,t)),this.needsRefinedTiles.set(t.id,t)},n.prototype.loadTile=function(t,e){this.shouldLoadTile(t)&&(t.state.requestedFrameNumber=e,this.requestedTiles.set(t.id,t)),this.needsRefinedTiles.set(t.id,t)},n.prototype.touchTile=function(t,e){t.tileset.cache.touch(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e,r,i){return t.hasChildren?t.hasTilesetContent?!0:!i&&!t.state.visible?!1:this.shouldRefine(t,e,r):!1},n.prototype.shouldLoadTile=function(t){return t.hasUnloadedContent},n.prototype.shouldSelectTile=function(t){return t.contentAvailable&&!this.skipLevelOfDetail&&this._canSelectTile},n.prototype.shouldRefine=function(t,e,r){if(t.hasEmptyContent)return!0;if(t.hasRenderContent){if(t.state.selectionDepth>=e.maxLevelOfDetail)return!1;if(t.state.selectionDepth<e.minLevelOfDetail)return!0}var i=t.state.screenSpaceError;return r&&(i=t.getScreenSpaceError(e,t.state.distanceToCamera,!0)),i>this.maxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var i=t.children[0];this.updateTileVisibility(i,e),t.state.visible=i.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}}},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"?!1:!this.shouldRefine(t,e,!0)},n.prototype.compareDistanceToCamera=function(t,e){return e.state.distanceToCamera-t.state.distanceToCamera},n.prototype.executeEmptyTraversal=function(t,e){var r=!0,i=this._emptyTraversalStack;for(i.push(t);i.length>0&&r;){var o=i.pop();this.updateTile(o,e),o.state.visible||this.loadTile(o,e.frameNumber),this.touchTile(o,e);var s=!o.hasRenderContent&&this.canTraverse(o,e,!1,!0);if(s)for(var u=o.children,l=0,c=u;l<c.length;l++){var d=c[l];i.find(d)&&i.delete(d),i.push(d)}else o.contentAvailable||(r=!1)}return r},n.DEFAULT_SKIP_LEVEL_OF_DETAIL=!1,n.DEFAULT_LOAD_SIBLINGS=!1,n.DEFAULT_MAX_SCREEN_SPACE_ERROR=4,n}(),identityMatrix4=new THREE__namespace.Matrix4,Tileset=function(){function n(t,e,r){var i,o;this.id=t,this.transform=new THREE__namespace.Matrix4,this.transformIsIdentity=!0,this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||"",gltfUpAxis:(i=e.asset.gltfUpAxis)!==null&&i!==void 0?i:"Y",overview:e.asset.overview},this.properties=(o=e.properties)!==null&&o!==void 0?o:{},this.options=r,this.traverser=new TilesetTraverser,this.cache=new TilesetCache,this.requestScheduler=new RequestScheduler,this.frameNumber=0,this.pendingCount=0,this.tiles=new Map,this.memoryUsageInBytes=0,this.root=new Tile("".concat(this.id,".0"),e.root,this),this.geometricError=e.geometricError,this.maxMemoryUsage=n.DEFAULT_MAX_MEMORY_USAGE}return Object.defineProperty(n.prototype,"maxRequests",{get:function(){return this.requestScheduler.maxRequests},set:function(t){this.requestScheduler.maxRequests=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"skipLevelOfDetail",{get:function(){return this.traverser.skipLevelOfDetail},set:function(t){this.traverser.skipLevelOfDetail=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxScreenSpaceError",{get:function(){return this.traverser.maxScreenSpaceError},set:function(t){this.traverser.maxScreenSpaceError=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"selectedTiles",{get:function(){return this.traverser.selectedTiles},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"needsRefinedTiles",{get:function(){return this.traverser.needsRefinedTiles},enumerable:!1,configurable:!0}),n.prototype.reset=function(){for(var t=this,e=[this.root],r;r=e.pop();){for(var i=0,o=r.children.length;i<o;i++)e.push(r.children[i]);this.cache.unloadTile(r,function(s){return t.unloadTile(s)})}this.cache.reset(),this.traverser.reset(),this.requestScheduler.reset(),this.tiles.clear()},n.prototype.isLoaded=function(){return this.pendingCount===0&&this.frameNumber!==0},n.prototype.traverse=function(t,e){var r=this;e===void 0&&(e=[]),this.transformIsIdentity=this.transform.equals(identityMatrix4),this.traverser.traverse(this.root,t,e),this.selectedTiles.forEach(function(i){r.tiles.set(i.id,i)}),this.traverser.requestedTiles.forEach(function(i){i.hasUnloadedContent&&r.loadTile(i)}),this.cache.unloadTiles(function(){var i=r.memoryUsageInBytes>r.maxMemoryUsage*1024*1024;return i},function(i){r.unloadTile(i),r.tiles.delete(i.id)})},n.prototype.loadTile=function(t){var e=this;this.pendingCount++,t.loadContent().catch(function(r){return e.options.onTileError(t,r),!1}).then(function(r){var i;e.pendingCount--,r&&(!((i=t.content)===null||i===void 0)&&i.data&&e.cache.add(t,function(){e.memoryUsageInBytes+=t.contentByteLength}),e.options.onTileLoad(t))})},n.prototype.unloadTile=function(t){this.memoryUsageInBytes-=t.contentByteLength,this.options.onTileUnload(t),t.unloadContent()},n.DEFAULT_VIEW_DISTANCE_SCALE=1,n.DEFAULT_MAX_MEMORY_USAGE=16,n.DEFAULT_MAX_SCREEN_SPACE_ERROR=TilesetTraverser.DEFAULT_MAX_SCREEN_SPACE_ERROR,n.DEFAULT_MAX_REQUESTS=RequestScheduler.DEFAULT_MAX_REQUESTS,n}(),BVHNode=function(){function n(t,e,r,i,o){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=i,this.deepth=o}return n}(),BYTES_PER_NODE=6*4+4+4+2+2;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),i=new Uint32Array(e),o=new Uint16Array(e),s=[n],u,l;u=s.pop();)l=u.id*BYTES_PER_NODE/4,r[l]=u.extents[0],r[l+1]=u.extents[1],r[l+2]=u.extents[2],r[l+3]=u.extents[3],r[l+4]=u.extents[4],r[l+5]=u.extents[5],i[l+6]=u.startIndex,i[l+7]=u.endIndex,l=u.id*BYTES_PER_NODE/2,u.node0&&(o[l+16]=u.node0.id,s.push(u.node0)),u.node1&&(o[l+17]=u.node1.id,s.push(u.node1));return e}function intersectNodeBox(n,t,e,r,i,o,s,u,l){l===void 0&&(l=0),e=e-l,r=r-l,i=i-l,o=o+l,s=s+l,u=u+l;var c={min:0,max:0};t.x>=0?(c.min=(e-n.x)*t.x,c.max=(o-n.x)*t.x):(c.min=(o-n.x)*t.x,c.max=(e-n.x)*t.x);var d={min:0,max:0};if(t.y>=0?(d.min=(r-n.y)*t.y,d.max=(s-n.y)*t.y):(d.min=(s-n.y)*t.y,d.max=(r-n.y)*t.y),c.min>d.max||d.min>c.max)return!1;d.min>c.min&&(c.min=d.min),d.max<c.max&&(c.max=d.max);var f={min:0,max:0};return t.z>=0?(f.min=(i-n.z)*t.z,f.max=(u-n.z)*t.z):(f.min=(u-n.z)*t.z,f.max=(i-n.z)*t.z),!(c.min>f.max||f.min>c.max||(f.min>c.min&&(c.min=f.min),f.max<c.max&&(c.max=f.max),c.max<0))}var BVHVector3=function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,i=t.y,o=t.z,s=e.x,u=e.y,l=e.z;return this.x=i*l-o*u,this.y=o*s-r*l,this.z=r*u-i*s,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n}(),BVHIntersect=function(){function n(t,e,r){this.triangle=t,this.intersectionPoint=e,this.index=r}return n}(),EPSILON$1=1e-6,BVHMesh=function(){function n(t,e){if(this.positionArray=t,e)this.indicesArray=e;else{for(var r=t.length/3,i=r>65535?new Uint32Array(r):new Uint16Array(r),o=0;o<r;o++)i[o]=o;this.indicesArray=i}}return n.prototype.createTree=function(t,e,r){e=Math.min(e,16);var i=this.positionArray,o=this.indicesArray,s=o.length/3,u=s>65535?new Uint32Array(s):new Uint16Array(s),l=new Float32Array(s*6),c=[],d=0,f=-1;if(r)for(var p=0,v=0,A=0,m=void 0,y=void 0,h=void 0,g=void 0,b=void 0,T=void 0,E=void 0;p<s;p+=1,v+=3,A+=6)u[p]=p,m=g=i[o[v]*3],E=i[o[v+1]*3],E<m&&(m=E),E>g&&(g=E),E=i[o[v+2]*3],E<m&&(m=E),E>g&&(g=E),y=b=i[o[v]*3+1],E=i[o[v+1]*3+1],E<y&&(y=E),E>b&&(b=E),E=i[o[v+2]*3+1],E<y&&(y=E),E>b&&(b=E),h=T=i[o[v]*3+2],E=i[o[v+1]*3+2],E<h&&(h=E),E>T&&(T=E),E=i[o[v+2]*3+2],E<h&&(h=E),E>T&&(T=E),l[A]=m,l[A+1]=y,l[A+2]=h,l[A+3]=g,l[A+4]=b,l[A+5]=T;else{for(var _=1/0,x=1/0,w=1/0,S=-1/0,C=-1/0,M=-1/0,p=0,v=0,A=0,m=void 0,y=void 0,h=void 0,g=void 0,b=void 0,T=void 0,E=void 0;p<s;p+=1,v+=3,A+=6)u[p]=p,m=g=i[o[v]*3],E=i[o[v+1]*3],E<m&&(m=E),E>g&&(g=E),E=i[o[v+2]*3],E<m&&(m=E),E>g&&(g=E),y=b=i[o[v]*3+1],E=i[o[v+1]*3+1],E<y&&(y=E),E>b&&(b=E),E=i[o[v+2]*3+1],E<y&&(y=E),E>b&&(b=E),h=T=i[o[v]*3+2],E=i[o[v+1]*3+2],E<h&&(h=E),E>T&&(T=E),E=i[o[v+2]*3+2],E<h&&(h=E),E>T&&(T=E),l[A]=m,l[A+1]=y,l[A+2]=h,l[A+3]=g,l[A+4]=b,l[A+5]=T,m<_&&(_=m),g>S&&(S=g),y<x&&(x=y),b>C&&(C=b),h<w&&(w=h),T>M&&(M=T);r=[_,x,w,S,C,M]}var I=new BVHNode(++f,r,0,s,0);c[d++]=I;var F=[],B=[0,1,2],L=function(O,U){return F[U]-F[O]};function k(O){var U=O.startIndex,V=O.endIndex,N=O.extents;F[0]=N[3]-N[0],F[1]=N[4]-N[1],F[2]=N[5]-N[2],B.sort(L);for(var Q=0;Q<3;Q++){for(var G=B[Q],q=N[G]+N[G+3],W=U,z=V-1,X=-1,re=void 0;W<=z;)X===-1?(re=u[W],l[re*6+G]+l[re*6+G+3]<q?W++:X=re):(re=u[z],l[re*6+G]+l[re*6+G+3]>=q||(u[W]=re,u[z]=X,X=-1,W++),z--);if(W>U&&W<V){var J=new BVHNode(++f,calcExtents(u,l,U,W,EPSILON$1),U,W,O.deepth+1);J.deepth<e&&J.endIndex-J.startIndex>t&&(c[d++]=J);var $=new BVHNode(++f,calcExtents(u,l,W,V,EPSILON$1),W,V,O.deepth+1);$.deepth<e&&$.endIndex-$.startIndex>t&&(c[d++]=$),O.node0=J,O.node1=$,O.startIndex=0,O.endIndex=0;break}}}for(;d;)k(c[--d]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(I,f+1),c.length=0,this},n.prototype.trianglesInSphere=function(t,e){for(var r=this.positionArray,i=this.indicesArray,o=this.offsetArray,s=this.rootNodePacked,u=new Float32Array(s),l=new Uint32Array(s),c=new Uint16Array(s),d=[0],f=[],p,v,A,m;(p=d.pop())!==void 0;){m=p*BYTES_PER_NODE/4;var y=clamp$1(t.x,u[m],u[m+3])-t.x,h=clamp$1(t.y,u[m+1],u[m+4])-t.y,g=clamp$1(t.z,u[m+2],u[m+5])-t.z;if(y*y+h*h+g*g<=e*e){for(var b=l[m+6];b<l[m+7];b++)f.push(o[b]);m=p*BYTES_PER_NODE/2,v=c[m+16],A=c[m+17],v&&d.push(v),A&&d.push(A)}}for(var T=f.length,E=new Float32Array(T*9),b=0;b<T;b++){var _=f[b];E[b*9]=r[i[_]*3],E[b*9+1]=r[i[_]*3+1],E[b*9+2]=r[i[_]*3+2],E[b*9+3]=r[i[_+1]*3],E[b*9+4]=r[i[_+1]*3+1],E[b*9+5]=r[i[_+1]*3+2],E[b*9+6]=r[i[_+2]*3],E[b*9+7]=r[i[_+2]*3+1],E[b*9+8]=r[i[_+2]*3+2]}return E},n.prototype.intersectRay=function(t,e,r){for(var i=this.positionArray,o=this.indicesArray,s=this.offsetArray,u=this.rootNodePacked,l=new Float32Array(u),c=new Uint32Array(u),d=new Uint16Array(u),f=new BVHVector3(1/e.x,1/e.y,1/e.z),p=[0],v,A,m,y;(v=p.pop())!==void 0;)if(y=v*BYTES_PER_NODE/4,intersectNodeBox(t,f,l[y],l[y+1],l[y+2],l[y+3],l[y+4],l[y+5])){for(var h=c[y+6],g=c[y+7],b=void 0,T=void 0,E=void 0,_=t.x,x=t.y,w=t.z,S=e.x,C=e.y,M=e.z,I=void 0,F=void 0,B=void 0,L=void 0,k=void 0,O=void 0,U=void 0,V=void 0,N=void 0,Q=void 0,G=void 0,q=void 0,W=void 0,z=void 0,X=void 0,re=void 0,J=void 0,$=void 0,ee=void 0,oe=void 0,ae=void 0,ne=void 0,le=void 0,ie=void 0,fe=void 0,Z=void 0,te=void 0;h<g;h++){if(b=s[h],T=b*3,E=o[T]*3,I=i[E],F=i[++E],B=i[++E],E=o[T+1]*3,L=i[E],k=i[++E],O=i[++E],E=o[T+2]*3,U=i[E],V=i[++E],N=i[++E],Q=L-I,G=k-F,q=O-B,W=U-I,z=V-F,X=N-B,re=G*X-q*z,J=q*W-Q*X,$=Q*z-G*W,le=S*re+C*J+M*$,le>0)ne=1;else if(le<0)ne=-1,le=-le;else continue;ee=_-I,oe=x-F,ae=w-B,ie=ne*(S*(oe*X-ae*z)+C*(ae*W-ee*X)+M*(ee*z-oe*W)),!(ie<0)&&(fe=ne*(S*(G*ae-q*oe)+C*(q*ee-Q*ae)+M*(Q*oe-G*ee)),!(fe<0)&&(ie+fe>le||(Z=-ne*(ee*re+oe*J+ae*$),!(Z<0)&&(te=Z/le,r.push(new BVHIntersect([I,F,B,L,k,O,U,V,N],[_+S*te,x+C*te,w+M*te],b))))))}y=v*BYTES_PER_NODE/2,A=d[y+16],m=d[y+17],A&&p.push(A),m&&p.push(m)}return r},n}();function clamp$1(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,i){if(e>=r)return[0,0,0,0,0,0];for(var o=1/0,s=1/0,u=1/0,l=-1/0,c=-1/0,d=-1/0,f=e,p=void 0,v=void 0;f<r;f++)p=n[f]*6,v=t[p],v<o&&(o=v),v=t[p+1],v<s&&(s=v),v=t[p+2],v<u&&(u=v),v=t[p+3],v>l&&(l=v),v=t[p+4],v>c&&(c=v),v=t[p+5],v>d&&(d=v);return[o-i,s-i,u-i,l+i,c+i,d+i]}var EPSILON=1e-6,BVHPoints=function(){function n(t,e){this.positionArray=t,this.indicesArray=e}return n.prototype.createTree=function(t,e,r){e=Math.min(e,16);var i=this.positionArray,o=this.indicesArray,s=o?o.length:i.length/3,u=s>65535?new Uint32Array(s):new Uint16Array(s),l=[],c=0,d=-1;if(r)for(var f=0;f<s;f+=1)u[f]=f;else{for(var p=o?o[0]*3:0,v=i[p],A=i[p+1],m=i[p+2],y=v,h=A,g=m,f=0,b=0,T=void 0,E=void 0,_=void 0;f<s;f+=1,b+=3)u[f]=f,p=(o?o[b]:b)*3,T=i[p],E=i[p+1],_=i[p+2],T<v?v=T:T>y&&(y=T),E<A?A=E:E>h&&(h=E),_<m?m=_:_>g&&(g=_);r=[v,A,m,y,h,g]}var x=new BVHNode(++d,r,0,s,0);l[c++]=x;var w=[],S=[0,1,2],C=function(I,F){return w[F]-w[I]};function M(I){var F=I.startIndex,B=I.endIndex,L=I.extents;w[0]=L[3]-L[0],w[1]=L[4]-L[1],w[2]=L[5]-L[2];for(var k=S.sort(C)[0],O=(L[k]+L[k+3])/2,U=F,V=B-1,N=-1,Q,G;U<=V;)N===-1?(Q=u[U],G=(o?o[Q]:Q)*3,i[G+k]<O?U++:N=Q):(Q=u[V],G=(o?o[Q]:Q)*3,i[G+k]>=O||(u[U]=Q,u[V]=N,N=-1,U++),V--);if(U>F){var q=L.slice();q[k+3]=O+EPSILON;var W=new BVHNode(++d,q,F,U,I.deepth+1);W.deepth<e&&W.endIndex-W.startIndex>t&&(l[c++]=W),I.node0=W}if(B>U){var z=L.slice();z[k]=O-EPSILON;var X=new BVHNode(++d,z,U,B,I.deepth+1);X.deepth<e&&X.endIndex-X.startIndex>t&&(l[c++]=X),I.node1=X}I.startIndex=0,I.endIndex=0}for(;c;)M(l[--c]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(x,d+1),l.length=0,this},n.prototype.intersectRay=function(t,e,r,i){for(var o=this.positionArray,s=this.indicesArray,u=this.offsetArray,l=this.rootNodePacked,c=new Float32Array(l),d=new Uint32Array(l),f=new Uint16Array(l),p=r*r,v=new BVHVector3(1/e.x,1/e.y,1/e.z),A=[0],m,y,h,g;(m=A.pop())!==void 0;)if(g=m*BYTES_PER_NODE/4,intersectNodeBox(t,v,c[g],c[g+1],c[g+2],c[g+3],c[g+4],c[g+5],r)){for(var b=d[g+6],T=d[g+7],E=void 0,_=void 0,x=void 0,w=void 0,S=void 0,C=void 0,M=void 0,I=void 0,F=void 0,B=void 0,L=void 0,k=void 0,O=void 0;b<T;b++)E=u[b],_=(s?s[E]:E)*3,x=o[_],w=o[++_],S=o[++_],C=t.x,M=t.y,I=t.z,F=e.x,B=e.y,L=e.z,k=F*(x-C)+B*(w-M)+L*(S-I),k>0&&(C+=F*k,M+=B*k,I+=L*k),F=x-C,B=w-M,L=S-I,k=F*F+B*B+L*L,k<=p&&i.push(new BVHIntersect([x,w,S,x,w,S,x,w,S],[C,M,I],E));g=m*BYTES_PER_NODE/2,y=f[g+16],h=f[g+17],y&&A.push(y),h&&A.push(h)}return i},n}();const encodedJs$1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBYPWZ1bmN0aW9uKCl7ZnVuY3Rpb24gaChyLGksdixvLHMpe3RoaXMuaWQ9cix0aGlzLmV4dGVudHM9aSx0aGlzLnN0YXJ0SW5kZXg9dix0aGlzLmVuZEluZGV4PW8sdGhpcy5kZWVwdGg9c31yZXR1cm4gaH0oKSxSPTYqNCs0KzQrMisyO2Z1bmN0aW9uIG5yKGgscil7Zm9yKHZhciBpPW5ldyBBcnJheUJ1ZmZlcihyKlIpLHY9bmV3IEZsb2F0MzJBcnJheShpKSxvPW5ldyBVaW50MzJBcnJheShpKSxzPW5ldyBVaW50MTZBcnJheShpKSxlPVtoXSxhLG47YT1lLnBvcCgpOyluPWEuaWQqUi80LHZbbl09YS5leHRlbnRzWzBdLHZbbisxXT1hLmV4dGVudHNbMV0sdltuKzJdPWEuZXh0ZW50c1syXSx2W24rM109YS5leHRlbnRzWzNdLHZbbis0XT1hLmV4dGVudHNbNF0sdltuKzVdPWEuZXh0ZW50c1s1XSxvW24rNl09YS5zdGFydEluZGV4LG9bbis3XT1hLmVuZEluZGV4LG49YS5pZCpSLzIsYS5ub2RlMCYmKHNbbisxNl09YS5ub2RlMC5pZCxlLnB1c2goYS5ub2RlMCkpLGEubm9kZTEmJihzW24rMTddPWEubm9kZTEuaWQsZS5wdXNoKGEubm9kZTEpKTtyZXR1cm4gaX1mdW5jdGlvbiBhcihoLHIsaSx2LG8scyxlLGEsbil7bj09PXZvaWQgMCYmKG49MCksaT1pLW4sdj12LW4sbz1vLW4scz1zK24sZT1lK24sYT1hK247dmFyIHk9e21pbjowLG1heDowfTtyLng+PTA/KHkubWluPShpLWgueCkqci54LHkubWF4PShzLWgueCkqci54KTooeS5taW49KHMtaC54KSpyLngseS5tYXg9KGktaC54KSpyLngpO3ZhciBmPXttaW46MCxtYXg6MH07aWYoci55Pj0wPyhmLm1pbj0odi1oLnkpKnIueSxmLm1heD0oZS1oLnkpKnIueSk6KGYubWluPShlLWgueSkqci55LGYubWF4PSh2LWgueSkqci55KSx5Lm1pbj5mLm1heHx8Zi5taW4+eS5tYXgpcmV0dXJuITE7Zi5taW4+eS5taW4mJih5Lm1pbj1mLm1pbiksZi5tYXg8eS5tYXgmJih5Lm1heD1mLm1heCk7dmFyIHc9e21pbjowLG1heDowfTtyZXR1cm4gci56Pj0wPyh3Lm1pbj0oby1oLnopKnIueix3Lm1heD0oYS1oLnopKnIueik6KHcubWluPShhLWgueikqci56LHcubWF4PShvLWgueikqci56KSwhKHkubWluPncubWF4fHx3Lm1pbj55Lm1heHx8KHcubWluPnkubWluJiYoeS5taW49dy5taW4pLHcubWF4PHkubWF4JiYoeS5tYXg9dy5tYXgpLHkubWF4PDApKX12YXIg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oaSl7cmV0dXJuIHBvc3RNZXNzYWdlKHskJGVycm9yOml9KX0pfX1mcihmdW5jdGlvbihoKXtyZXR1cm4gUHJvbWlzZS5yZXNvbHZlKGgpLnRoZW4oZnVuY3Rpb24ocil7Zm9yKHZhciBpPVtdLHY9W10sbz0wLHM9cjtvPHMubGVuZ3RoO28rKyl7dmFyIGU9c1tvXSxhPXZvaWQgMDtpZihlLnR5cGU9PT0ibWVzaCIpYT1uZXcgeXIoZS5wb3NpdGlvbkFycmF5LGUuaW5kaWNlc0FycmF5KTtlbHNlIGlmKGUudHlwZT09PSJwb2ludHMiKWE9bmV3IEFyKGUucG9zaXRpb25BcnJheSxlLmluZGljZXNBcnJheSk7ZWxzZSB0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgVHlwZSIpO2EuY3JlYXRlVHJlZShlLm1heEl0ZW1QZXJOb2RlLGUubWF4VHJlZURlcHRoLGUuZXh0ZW50cyk7dmFyIG49e29mZnNldEFycmF5OmEub2Zmc2V0QXJyYXksaW5kaWNlc0FycmF5OmEuaW5kaWNlc0FycmF5LHBvc2l0aW9uQXJyYXk6YS5wb3NpdGlvbkFycmF5LHJvb3ROb2RlUGFja2VkOmEucm9vdE5vZGVQYWNrZWR9O2kucHVzaChuKTtmb3IodmFyIHkgaW4gbil7dmFyIGY9blt5XTtmJiYoZiBpbnN0YW5jZW9mIEFycmF5QnVmZmVyP3YucHVzaChmKTpmLmJ1ZmZlciBpbnN0YW5jZW9mIEFycmF5QnVmZmVyJiZ2LnB1c2goZi5idWZmZXIpKX19cmV0dXJue291dHB1dDppLHRyYW5zZmVyOnZ9fSl9KX0pKCk7Cg==",blob$2=typeof window!="undefined"&&window.Blob&&new Blob([atob(encodedJs$1)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(n){let t;try{if(t=blob$2&&(window.URL||window.webkitURL).createObjectURL(blob$2),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:application/javascript;base64,"+encodedJs$1,{name:n==null?void 0:n.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var WorkerPool$1=function(){function n(t,e){this.pool=e,this.workerCreator=t,this.queue=[],this.workers=[],this.workersResolver=[],this.workerStatus=0}return n.prototype.initWorker=function(t){if(this.workerCreator&&!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this.onMessage.bind(this,t)),this.workers[t]=e}},n.prototype.getIdleWorker=function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1},n.prototype.onMessage=function(t,e){var r=this.workersResolver[t],i=r.resolve,o=r.reject;if(e.data&&"$$error"in e.data?o(e.data.$$error):i(e.data),this.queue.length){var s=this.queue.shift(),u=s.resolve,l=s.reject,c=s.input,d=s.transfer;this.workersResolver[t]={resolve:u,reject:l},this.workers[t].postMessage(c,d)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(i,o){var s=r.getIdleWorker();s!==-1?(r.initWorker(s),r.workerStatus|=1<<s,r.workersResolver[s]={resolve:i,reject:o},r.workers[s].postMessage(t,e)):r.queue.push({resolve:i,reject:o,input:t,transfer:e})})},n.prototype.dispose=function(){this.workers.forEach(function(t){return t.terminate()}),this.workersResolver.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0},n}(),bvhWorkerPool=new WorkerPool$1(function(){return new WorkerWrapper$1},4),bvhMeshMap=new Map,bvhPointsMap=new Map,scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA$1=new THREE__namespace.Vector3,scratchIntersectionFaceB$1=new THREE__namespace.Vector3,scratchIntersectionFaceC$1=new THREE__namespace.Vector3,scratchIntersectionTriangle=new THREE__namespace.Triangle;function raycastMesh(n,t,e,r){var i,o=n.matrixWorld;scratchInverseMatrix.getInverse(o),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var s=t.intersectRay(scratchRay.origin,scratchRay.direction,[]),u=n.geometry,l=n.material,c=u.groups,d=u.index,f=0,p=s.length;f<p;f++){var v=s[f],A=v.triangle,m=v.index,y=v.intersectionPoint,h=new THREE__namespace.Vector3(y[0],y[1],y[2]).applyMatrix4(o),g=e.ray.origin.distanceTo(h);if(!(g<e.near||g>e.far)){var b=void 0;if(Array.isArray(l)){if(c)for(var T=m*3,E=0,_=c;E<_.length;E++){var x=_[E];if(T>=x.start&&T-x.start<x.count){b=l[(i=x.materialIndex)!==null&&i!==void 0?i:0];break}}}else b=l;if(b){var w=scratchIntersectionTriangle.set(scratchIntersectionFaceA$1.set(A[0],A[1],A[2]).applyMatrix4(o),scratchIntersectionFaceB$1.set(A[3],A[4],A[5]).applyMatrix4(o),scratchIntersectionFaceC$1.set(A[6],A[7],A[8]).applyMatrix4(o)).getNormal(new THREE__namespace.Vector3),S=m*3,C=new THREE__namespace.Face3(d?d.array[S]:S,d?d.array[S+1]:S+1,d?d.array[S+2]:S+2,w),M=e.ray.direction.dot(w);b.side===THREE__namespace.FrontSide&&M>=0||b.side===THREE__namespace.BackSide&&M<=0||r.push({distance:g,object:n,face:C,point:h,distanceToRay:0,faceIndex:m})}}}}function raycastPoints(n,t,e,r){var i,o,s=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(s),scratchInverseMatrix.getInverse(s);var u=((o=(i=e.params.Points)===null||i===void 0?void 0:i.threshold)!==null&&o!==void 0?o:1)*scratchInverseMatrix.getMaxScaleOnAxis();scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var l=t.intersectRay(scratchRay.origin,scratchRay.direction,u,[]),c=n.geometry,d=c.index,f=c.getAttribute("normal"),p=0,v=l.length;p<v;p++){var A=l[p],m=A.triangle,y=A.index,h=A.intersectionPoint,g=new THREE__namespace.Vector3(h[0],h[1],h[2]).applyMatrix4(s),b=e.ray.origin.distanceTo(g);if(!(b<e.near||b>e.far)){var T=scratchIntersectionFaceA$1.set(m[0],m[1],m[2]).applyMatrix4(s),E=d?d.array[y]:y,_=void 0;f instanceof THREE__namespace.BufferAttribute&&(_=new THREE__namespace.Vector3().fromBufferAttribute(f,E).applyNormalMatrix(scratchNormalMatrix));var x=new THREE__namespace.Face3(E,E,E,_);r.push({distance:b,object:n,face:x,point:g,distanceToRay:g.distanceTo(T),index:y})}}}function bindBvhTreeForMesh(n,t){var e=n.raycast,r=function(i,o){var s=bvhMeshMap.get(this);s?raycastMesh(this,s,i,o):e.call(this,i,o)};return n.raycast=r,bvhMeshMap.set(n,t),function(){bvhMeshMap.delete(n),n.raycast===r&&(n.raycast=e)}}function bindBvhTreeForPoints(n,t){var e=n.raycast,r=function(i,o){var s=bvhPointsMap.get(this);s?raycastPoints(this,s,i,o):e.call(this,i,o)};return n.raycast=r,bvhPointsMap.set(n,t),function(){bvhPointsMap.delete(n),n.raycast===r&&(n.raycast=e)}}function generateBvhTree(n,t,e,r){t===void 0&&(t=!0),e===void 0&&(e=100),r===void 0&&(r=10);var i=[];return n.traverse(function(o){if((o instanceof THREE__namespace.Mesh||o instanceof THREE__namespace.Points)&&o.geometry instanceof THREE__namespace.BufferGeometry){var s=o.geometry.getAttribute("position");s instanceof THREE__namespace.BufferAttribute&&i.push(o)}}),t?Promise.resolve().then(function(){for(var o,s,u=[],l=[],c=0;c<i.length;c++){var d=i[c];if(d instanceof THREE__namespace.Mesh){if(d.geometry instanceof THREE__namespace.BufferGeometry){var f=d.geometry.getAttribute("position");if(f instanceof THREE__namespace.BufferAttribute){var p=f.array,v=(o=d.geometry.getIndex())===null||o===void 0?void 0:o.array,A=d.geometry.boundingBox,m=A?[A.min.x,A.min.y,A.min.z,A.max.x,A.max.y,A.max.z]:void 0,y={type:"mesh",positionArray:p,indicesArray:v,maxItemPerNode:e,maxTreeDepth:r,extents:m};u.push(y);for(var h in y){var g=y[h];g&&(g instanceof ArrayBuffer?l.push(g):g.buffer instanceof ArrayBuffer&&l.push(g.buffer))}}}}else if(d instanceof THREE__namespace.Points&&d.geometry instanceof THREE__namespace.BufferGeometry){var f=d.geometry.getAttribute("position");if(f instanceof THREE__namespace.BufferAttribute){var p=f.array,v=(s=d.geometry.getIndex())===null||s===void 0?void 0:s.array,A=d.geometry.boundingBox,m=A?[A.min.x,A.min.y,A.min.z,A.max.x,A.max.y,A.max.z]:void 0,y={type:"points",positionArray:p,indicesArray:v,maxItemPerNode:e,maxTreeDepth:r,extents:m};u.push(y);for(var b in y){var g=y[b];g&&(g instanceof ArrayBuffer?l.push(g):g.buffer instanceof ArrayBuffer&&l.push(g.buffer))}}}}return bvhWorkerPool.postMessage(u,l)}).then(function(o){for(var s=[],u=0;u<i.length;u++){var l=i[u],c=o[u];if(l instanceof THREE__namespace.Mesh){if(l.geometry instanceof THREE__namespace.BufferGeometry){var d=l.geometry.getAttribute("position");if(d instanceof THREE__namespace.BufferAttribute){d.array=c.positionArray;var f=l.geometry.getIndex();f&&c.indicesArray&&(f.array=c.indicesArray);var p=new BVHMesh(c.positionArray,c.indicesArray);p.offsetArray=c.offsetArray,p.rootNodePacked=c.rootNodePacked;var v=bindBvhTreeForMesh(l,p);s.push(v)}}}else if(l instanceof THREE__namespace.Points&&l.geometry instanceof THREE__namespace.BufferGeometry){var d=l.geometry.getAttribute("position");if(d instanceof THREE__namespace.BufferAttribute){d.array=c.positionArray;var f=l.geometry.getIndex();f&&c.indicesArray&&(f.array=c.indicesArray);var p=new BVHPoints(c.positionArray,c.indicesArray);p.offsetArray=c.offsetArray,p.rootNodePacked=c.rootNodePacked;var v=bindBvhTreeForPoints(l,p);s.push(v)}}}return function(){for(var A=0,m=s;A<m.length;A++){var y=m[A];y()}s.length=0}}):Promise.resolve().then(function(){for(var o,s,u=[],l=0,c=i;l<c.length;l++){var d=c[l];if(d instanceof THREE__namespace.Mesh){if(d.geometry instanceof THREE__namespace.BufferGeometry){var f=d.geometry.getAttribute("position");if(f instanceof THREE__namespace.BufferAttribute){var p=f.array,v=(o=d.geometry.getIndex())===null||o===void 0?void 0:o.array,A=d.geometry.boundingBox,m=A?[A.min.x,A.min.y,A.min.z,A.max.x,A.max.y,A.max.z]:void 0,y=new BVHMesh(p,v);y.createTree(e,r,m);var h=bindBvhTreeForMesh(d,y);u.push(h)}}}else if(d instanceof THREE__namespace.Points&&d.geometry instanceof THREE__namespace.BufferGeometry){var f=d.geometry.getAttribute("position");if(f instanceof THREE__namespace.BufferAttribute){var p=f.array,v=(s=d.geometry.getIndex())===null||s===void 0?void 0:s.array,A=d.geometry.boundingBox,m=A?[A.min.x,A.min.y,A.min.z,A.max.x,A.max.y,A.max.z]:void 0,y=new BVHPoints(p,v);y.createTree(e,r,m);var h=bindBvhTreeForPoints(d,y);u.push(h)}}}return function(){for(var g=0,b=u;g<b.length;g++){var T=b[g];T()}u.length=0}})}var scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,TileNode=function(n){__extends(t,n);function t(e,r){var i=n.call(this)||this;return i.renderOrder=-4,i.disposers=[r],i.add(e),i}return t.prototype.generateBvhTree=function(){var e=this;return generateBvhTree(this,!0,200,10).then(function(r){e.disposers.push(r)})},t.prototype.intersectRaycaster=function(e,r,i){var o=this;r===void 0&&(r=!0),i===void 0&&(i=[]);for(var s=this.children.slice(),u;u=s.pop();)if(u.visible){u.raycast(e,i);for(var l=0,c=u.children.length;l<c;l++)s.push(u.children[l])}return i.forEach(function(d){var f,p,v=0;if((d.object instanceof PBMMesh||d.object instanceof PBMPointCloud)&&d.face){var A=Array.isArray(d.object.material)?d.object.material[d.face.materialIndex]:d.object.material;if(A)if(A.defines.USE_VERTEX_FLOOR){var m=(f=d.object.geometry.attributes.position)===null||f===void 0?void 0:f.array,y=(p=d.object.geometry.attributes.floor)===null||p===void 0?void 0:p.array;if(m&&y){var h=scratchIntersectionFaceA.set(m[d.face.a*3],m[d.face.a*3+1],m[d.face.a*3+2]).applyMatrix4(o.matrixWorld),g=scratchIntersectionFaceB.set(m[d.face.b*3],m[d.face.b*3+1],m[d.face.b*3+2]).applyMatrix4(o.matrixWorld),b=scratchIntersectionFaceC.set(m[d.face.c*3],m[d.face.c*3+1],m[d.face.c*3+2]).applyMatrix4(o.matrixWorld),T=d.point.distanceTo(h),E=d.point.distanceTo(g),_=d.point.distanceTo(b);v=Math.round((T*y[d.face.a]+E*y[d.face.b]+_*y[d.face.c])/(T+E+_))}}else v=A.floor}d.floor=v}),r&&i.sort(function(d,f){return d.distance-f.distance}),i},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var i=r[e];i()}this.disposers.length=0},t}(THREE__namespace.Group);function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(u){return(u!=null?u:"").trim()}).filter(function(u){return u.length>0&&!/^\/+$/.test(u)});for(var r=0;r<n.length;r++){var i=r===0,o=r===n.length-1,s=n[r];i||(s=s.replace(/^\.\//,"").replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),e.push(s)}return e.join("/")}function isAbsoluteURL(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}function normalizeTileHeader(n,t){if(n.content&&n.content.uri&&(isAbsoluteURL(n.content.uri)||(n.content.uri=pathJoin(t,n.content.uri))),n.children)for(var e=0,r=n.children;e<r.length;e++){var i=r[e];normalizeTileHeader(i,t)}return n}function normalizeTilesetHeader(n,t){return n.asset.overview&&(isAbsoluteURL(n.asset.overview.imageFile)||(n.asset.overview.imageFile=pathJoin(t,n.asset.overview.imageFile)),isAbsoluteURL(n.asset.overview.worldFile)||(n.asset.overview.worldFile=pathJoin(t,n.asset.overview.worldFile))),normalizeTileHeader(n.root,t),n}function appendSearch(n,t){return(t[0]==="?"||t[0]==="&")&&(t=t.slice(1)),t?((n[n.length-1]==="?"||n[n.length-1]==="&")&&(n=n.slice(0,-1)),n.indexOf("?")>=0?"".concat(n,"&").concat(t):"".concat(n,"?").concat(t)):n}var SIZEOF_UINT32$1=4;function parseHeader(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.byteLength=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var _a$2,GL_TYPE;(function(n){n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.INT=5124]="INT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.DOUBLE=5130]="DOUBLE"})(GL_TYPE||(GL_TYPE={}));var GL_TYPE_TO_ARRAY_TYPE=(_a$2={},_a$2[GL_TYPE.DOUBLE]=Float64Array,_a$2[GL_TYPE.FLOAT]=Float32Array,_a$2[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$2[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$2[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$2[GL_TYPE.BYTE]=Int8Array,_a$2[GL_TYPE.SHORT]=Int16Array,_a$2[GL_TYPE.INT]=Int32Array,_a$2),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(n){var t=GL_TYPE_TO_ARRAY_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(n){var t=getArrayType(n);return t.BYTES_PER_ELEMENT}function createTypedArray(n,t,e,r){e===void 0&&(e=0);var i=getArrayType(n);if(e%getByteSize(n)!==0){var o=r?t.slice(e,e+r*getByteSize(n)):t.slice(e);return new i(o)}else return new i(t,e,r!=null?r:(t.byteLength-e)/getByteSize(n))}function glTypeFromName(n){var t=NAME_TO_GL_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return n.prototype.getExtension=function(t){return this.json.extensions&&this.json.extensions[t]},n.prototype.hasProperty=function(t){return!!this.json[t]},n.prototype.getGlobalProperty=function(t,e,r){var i=this.json[t];if(typeof i=="number"){var o=getArrayType(e);return new o([i])}else if(Array.isArray(i)){var o=getArrayType(e);return new o(i)}else if(i&&Number.isFinite(i.byteOffset))return this.getTypedArrayFromBinary(t,e,r,1,i.byteOffset);return null},n.prototype.getPropertyArray=function(t,e,r){var i=this.json[t];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(e=glTypeFromName(i.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,i.byteOffset)):this.getTypedArrayFromArray(t,e,i)},n.prototype.getProperty=function(t,e,r,i,o){var s=this.json[t];if(!s)return null;var u=this.getPropertyArray(t,e,r);if(r===1)return o[0]=u[i],o;for(var l=0;l<r;++l)o[l]=u[r*i+l];return o},n.prototype.getTypedArrayFromBinary=function(t,e,r,i,o){var s=this.cachedTypedArrays,u=s[t];return u||(u=createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+o,i*r),s[t]=u),u},n.prototype.getTypedArrayFromArray=function(t,e,r){var i=this.cachedTypedArrays,o=i[t];return o||(o=createTypedArray(e,r),i[t]=o),o},n}(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(n,t,e){var r=new TextDecoder("utf8"),i=new Uint8Array(n,t,e),o=r.decode(i);return o}function parseTable(n,t,e){return e=parseTablesHeader(n,t,e),e=parseFeatureTable(n,t,e),e=parseBatchTable(n,t,e),e}function parseTablesHeader(n,t,e){var r=new DataView(t),i=0;n.header=n.header||{};var o=r.getUint32(e,!0);e+=SIZEOF_UINT32;var s=r.getUint32(e,!0);e+=SIZEOF_UINT32;var u=r.getUint32(e,!0);e+=SIZEOF_UINT32;var l=r.getUint32(e,!0);return e+=SIZEOF_UINT32,u>=570425344?(e-=SIZEOF_UINT32*2,i=o,u=s,l=0,o=0,s=0,console.warn(DEPRECATION_WARNING)):l>=570425344&&(e-=SIZEOF_UINT32,i=u,u=o,l=s,o=0,s=0,console.warn(DEPRECATION_WARNING)),n.header.featureTableJsonByteLength=o,n.header.featureTableBinaryByteLength=s,n.header.batchTableJsonByteLength=u,n.header.batchTableBinaryByteLength=l,n.header.batchLength=i,e}function parseFeatureTable(n,t,e){var r=n.header||{},i=r.featureTableJsonByteLength,o=r.featureTableBinaryByteLength,s=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:s||0},i&&i>0){var u=getStringFromArrayBuffer(t,e,i);n.featureTableJson=JSON.parse(u)}e+=i||0,n.featureTableBinary=new Uint8Array(t,e,o),e+=o||0,n.rtcCenter=[0,0,0];var l=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(l.json.RTC_CENTER)){var c=l.json.RTC_CENTER;n.rtcCenter[0]=c[0],n.rtcCenter[1]=c[1],n.rtcCenter[2]=c[2]}else{var c=l.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);c&&(n.rtcCenter[0]=c[0],n.rtcCenter[1]=c[1],n.rtcCenter[2]=c[2])}return e}function parseBatchTable(n,t,e){var r=n.header||{},i=r.batchTableJsonByteLength,o=r.batchTableBinaryByteLength;if(i&&i>0){var s=getStringFromArrayBuffer(t,e,i);n.batchTableJson=JSON.parse(s),e+=i,o&&o>0&&(n.batchTableBinary=new Uint8Array(t,e,o),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=o)}return e}function sliceArrayBuffer(n,t,e){var r=e!==void 0?new Uint8Array(n).subarray(t,t+e):new Uint8Array(n).subarray(t),i=new Uint8Array(r);return i.buffer}function parseGlTFArrayBuffer(n,t,e){var r=n.byteLength-e;if(r===0)throw new Error("glTF byte length must be greater than 0.");return e%4!==0&&console.warn("".concat(n.type,": embedded glb is not aligned to a 4-byte boundary.")),n.gltfArrayBuffer=sliceArrayBuffer(t,e,r),n.byteLength}function decodeText(n){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(n);for(var t="",e=0,r=n.length;e<r;e++)t+=String.fromCharCode(n[e]);try{return decodeURIComponent(escape(t))}catch(i){return t}}var WEBGL_CONSTANTS={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},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(n){var t=[];for(var e in n)t.push(n[e]);return t}var Parser=function(){function n(t,e,r){this.json=t,this.extensions=e,this.options=r,this.cache=new Map,this.disposeSet=new Set,this.nodeNamesUsed={}}return n.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach(function(t){t.dispose()}),this.disposeSet.clear()},n.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],i=0,o=e.length;i<o;i++)for(var s=e[i].joints,u=0,l=s.length;u<l;u++)t[s[u]].isBone=!0;for(var c=0,d=t.length;c<d;c++){var f=t[c];f.mesh!==void 0&&f.skin!==void 0&&(r[f.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.dispose(),this.markDefs();for(var i=0,o=values(r);i<o.length;i++){var s=o[i];s.markDefs(this)}return Promise.all(values(r).map(function(u){return u.prepare(t)})).then(function(){var u,l,c;return Promise.all([Promise.all(((u=e.scenes)!==null&&u!==void 0?u:[]).map(function(d,f){return t.loadScene(f)})),Promise.all(((l=e.animations)!==null&&l!==void 0?l:[]).map(function(d,f){return t.loadAnimation(f)})),Promise.all(((c=e.cameras)!==null&&c!==void 0?c:[]).map(function(d,f){return t.loadCamera(f)}))])}).then(function(u){var l=u[0],c=u[1],d=u[2],f={json:t.json,scene:l[e.scene||0],scenes:l,animations:c,cameras:d,dispose:function(){return t.dispose()}};return Promise.all(values(r).map(function(p){return p.emitResult(f,t)})).then(function(){return f})})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadCamera(t,this),i)break}if(!i){var l=void 0,c=this.json.cameras[t],d=c[c.type];d?c.type==="perspective"?l=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(d.yfov),d.aspectRatio||1,d.znear||1,d.zfar||2e6):c.type==="orthographic"?l=new THREE__namespace.OrthographicCamera(-d.xmag,d.xmag,d.ymag,-d.ymag,d.znear,d.zfar):(console.warn("glTF: Invalid camera type ".concat(c.type,".")),l=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),l=new THREE__namespace.Camera),c.name&&(l.name=this.createUniqueName(c.name)),i=Promise.resolve(l)}return this.cache.set(e,i),i},n.prototype.loadSkin=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;var i,o=this.json.skins[t],s={joints:o.joints};return o.inverseBindMatrices===void 0?i=Promise.resolve(s):i=this.loadAccessor(o.inverseBindMatrices).then(function(u){return u&&(s.inverseBindMatrices=u),s}),this.cache.set(e,i),i},n.prototype.loadAnimation=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadAnimation(t,this),i)break}if(!i){for(var l=this.json,c=l.animations[t],d=[],f=[],p=[],v=[],A=[],m=0,y=c.channels.length;m<y;m++){var h=c.channels[m],g=c.samplers[h.sampler],b=h.target,T=b.node!==void 0?b.node:b.id,E=c.parameters!==void 0?c.parameters[g.input]:g.input,_=c.parameters!==void 0?c.parameters[g.output]:g.output;d.push(this.loadNode(T)),f.push(this.loadAccessor(E)),p.push(this.loadAccessor(_)),v.push(g),A.push(b)}i=Promise.all([Promise.all(d),Promise.all(f),Promise.all(p),Promise.all(v),Promise.all(A)]).then(function(x){for(var w=x[0],S=x[1],C=x[2],M=x[3],I=x[4],F=[],B=function(U,V){var N=w[U],Q=S[U],G=C[U],q=M[U],W=I[U];if(N===void 0)return"continue";N.updateMatrix(),N.matrixAutoUpdate=!0;var z=void 0;switch(PATH_PROPERTIES[W.path]){case PATH_PROPERTIES.weights:z=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:z=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:z=THREE__namespace.VectorKeyframeTrack;break}var X=N.name?N.name:N.uuid,re=q.interpolation!==void 0?INTERPOLATION[q.interpolation]:THREE__namespace.InterpolateLinear,J=[];PATH_PROPERTIES[W.path]===PATH_PROPERTIES.weights?N.traverse(function(ie){ie.morphTargetInfluences&&J.push(ie.name?ie.name:ie.uuid)}):J.push(X);var $=G.array;if(G.normalized){for(var ee=getNormalizedComponentScale($.constructor),oe=new Float32Array($.length),ae=0,ne=$.length;ae<ne;ae++)oe[ae]=$[ae]*ee;$=oe}for(var ae=0,ne=J.length;ae<ne;ae++){var le=new z(J[ae]+"."+PATH_PROPERTIES[W.path],Q.array,$,re);F.push(le)}},L=0,k=w.length;L<k;L++)B(L);var O=c.name?c.name:"animation_"+t;return new THREE__namespace.AnimationClip(O,void 0,F)})}return this.cache.set(e,i),i},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadBuffer(t,this),o)break}if(!o){var c=this.json.buffers[t];o=this.options.fetcher.ajax(this.resolveResouce(c.uri),{responseType:"arraybuffer"}).then(function(d){return d.body})}return this.cache.set(r,o),o},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadBufferView(t,this),i)break}if(!i){var l=this.json.bufferViews[t];i=this.loadBuffer(l.buffer).then(function(c){var d=l.byteLength||0,f=l.byteOffset||0;return c.slice(f,f+d)})}return this.cache.set(e,i),i},n.prototype.loadAccessor=function(t){var e=this,r="accessor:"+t,i=this.cache.get(r);if(i)return i;var o=null;if(!o){var s=this.json.accessors[t];if(s.bufferView===void 0&&s.sparse===void 0)o=Promise.resolve(null);else{var u=[];s.bufferView!==void 0?u.push(this.loadBufferView(s.bufferView)):u.push(Promise.resolve(null)),s.sparse!==void 0&&(u.push(this.loadBufferView(s.sparse.indices.bufferView)),u.push(this.loadBufferView(s.sparse.values.bufferView))),o=Promise.all(u).then(function(l){var c=l[0],d=WEBGL_TYPE_SIZES[s.type],f=WEBGL_COMPONENT_TYPES[s.componentType],p=f.BYTES_PER_ELEMENT,v=p*d,A=s.byteOffset||0,m=s.bufferView!==void 0?e.json.bufferViews[s.bufferView].byteStride:void 0,y=s.normalized===!0,h,g;if(m&&m!==v){var b=Math.floor(A/m),T="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+b+":"+s.count,E=e.cache.get(T);E||(h=new f(c,b*m,s.count*m/p),E=new THREE__namespace.InterleavedBuffer(h,m/p),e.cache.set(T,E)),g=new THREE__namespace.InterleavedBufferAttribute(E,d,A%m/p,y)}else c===null?h=new f(s.count*d):h=new f(c,A,s.count*d),g=new THREE__namespace.BufferAttribute(h,d,y);if(s.sparse!==void 0){var _=WEBGL_TYPE_SIZES.SCALAR,x=WEBGL_COMPONENT_TYPES[s.sparse.indices.componentType],w=s.sparse.indices.byteOffset||0,S=s.sparse.values.byteOffset||0,C=new x(l[1],w,s.sparse.count*_),M=new f(l[2],S,s.sparse.count*d);c!==null&&(g=new THREE__namespace.BufferAttribute(g.array.slice(),g.itemSize,g.normalized));for(var I=0,F=C.length;I<F;I++){var B=C[I];if(g.setX(B,M[I*d]),d>=2&&g.setY(B,M[I*d+1]),d>=3&&g.setZ(B,M[I*d+2]),d>=4&&g.setW(B,M[I*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}}return this.cache.set(r,o),o},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var i=r[e],o=i.createPrimitiveKey(t,this);if(o)return o}for(var s="",u=Object.keys(t.attributes).sort(),l=0,c=u.length;l<c;l++)s+=u[l]+":"+t.attributes[u[l]]+";";return t.indices+":"+s+":"+t.mode},n.prototype.loadGeometry=function(t){var e=this,r="geometry:"+this.createPrimitiveKey(t),i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadGeometry(t,this),o)break}return o||(o=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,t)),o=o.then(function(c){return e.disposeSet.add(c),c}),this.cache.set(r,o),o},n.prototype.loadImage=function(t){var e="image:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadImage(t,this),i)break}if(!i){var l=this.json.images[t];if(l.bufferView)i=this.loadBufferView(l.bufferView).then(function(d){var f=new Blob([d],{type:l.mimeType});return createImageBitmapLike(f)});else if(l.uri){var c=this.resolveResouce(l.uri);i=this.options.fetcher.loadImage(c,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(d){return d.body})}else throw new Error("glTF: Invalid image defs.")}return this.cache.set(e,i),i},n.prototype.loadMaterialAsMeshStandardMaterial=function(t){var e=this,r=[],i=new THREE__namespace.MeshStandardMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="normal"}).length===0&&(i.flatShading=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.map=d,e.disposeSet.add(d)})),i.metalness=s.metallicFactor!==void 0?s.metallicFactor:1,i.roughness=s.roughnessFactor!==void 0?s.roughnessFactor:1,s.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(s.metallicRoughnessTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.metalnessMap=d,i.roughnessMap=d,e.disposeSet.add(d)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var l=o.alphaMode||ALPHA_MODES.OPAQUE;if(l===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,l===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&(r.push(this.createMaterialTexture(o.normalTexture).then(function(d){i.normalMap=d,e.disposeSet.add(d)})),i.normalScale=new THREE__namespace.Vector2(1,1),o.normalTexture.scale!==void 0)){var c=o.normalTexture.scale;i.normalScale.set(c,c)}o.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(o.occlusionTexture).then(function(d){i.aoMap=d,e.disposeSet.add(d)})),o.occlusionTexture.strength!==void 0&&(i.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&(i.emissive=new THREE__namespace.Color().fromArray(o.emissiveFactor)),o.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(o.emissiveTexture).then(function(d){i.emissiveMap=d,e.disposeSet.add(d)}))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new THREE__namespace.LineBasicMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="color"}).length>0&&(r.vertexColors=!0),Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="tangent"}).length===0&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),t.material!==void 0){var i=this.json.materials[t.material];i.name&&(r.name=i.name);var o=i.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;r.color.fromArray(s),r.opacity=s[3]}i.doubleSided===!0&&(r.side=THREE__namespace.DoubleSide);var u=i.alphaMode||ALPHA_MODES.OPAQUE;u===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,u===ALPHA_MODES.MASK&&(r.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(e).then(function(){return r})},n.prototype.loadMaterialAsPointsMaterial=function(t){var e=this,r=[],i=new THREE__namespace.PointsMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,i.sizeAttenuation=!1,Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(c){c.encoding=THREE__namespace.sRGBEncoding,i.map=c,e.disposeSet.add(c)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var l=o.alphaMode||ALPHA_MODES.OPAQUE;l===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,l===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterial=function(t){var e=this,r,i=(r=t.mode)!==null&&r!==void 0?r:WEBGL_CONSTANTS.TRIANGLES,o="material:"+this.createPrimitiveKey(t),s=this.cache.get(o);if(s)return s;for(var u=null,l=0,c=values(this.extensions);l<c.length;l++){var d=c[l];if(u=d.loadMaterial(t,this),u)break}if(i===WEBGL_CONSTANTS.TRIANGLES||i===WEBGL_CONSTANTS.TRIANGLE_STRIP||i===WEBGL_CONSTANTS.TRIANGLE_FAN)u=this.loadMaterialAsMeshStandardMaterial(t);else if(i===WEBGL_CONSTANTS.LINES||i===WEBGL_CONSTANTS.LINE_STRIP||i===WEBGL_CONSTANTS.LINE_LOOP)u=this.loadMaterialAsLineBasicMaterial(t);else if(i===WEBGL_CONSTANTS.POINTS)u=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+i);return u=u.then(function(f){return e.disposeSet.add(f),f}),this.cache.set(o,u),u},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadTexture(t,this),o)break}if(!o){var c=this.json.textures[t];o=this.loadImage(c.source).then(function(d){var f=new THREE__namespace.Texture(d);f.needsUpdate=!0,f.flipY=!1,c.name&&(f.name=c.name);var p=e.json.samplers||{},v=p[c.sampler]||{};f.magFilter=WEBGL_FILTERS[v.magFilter]||THREE__namespace.LinearFilter,f.minFilter=WEBGL_FILTERS[v.minFilter]||THREE__namespace.LinearMipmapLinearFilter,f.wrapS=WEBGL_WRAPPINGS[v.wrapS]||THREE__namespace.RepeatWrapping,f.wrapT=WEBGL_WRAPPINGS[v.wrapT]||THREE__namespace.RepeatWrapping;var A=f.dispose;return f.dispose=function(){return f.dispose=A,d.close(),A.call(this)},f})}return o=o.then(function(d){return e.disposeSet.add(d),d}),this.cache.set(r,o),o},n.prototype.loadMesh=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadMesh(t,this),r)break}if(!r){var u=this.json.meshes[t],l=u.primitives,c=Promise.all(l.map(function(f){return e.loadGeometry(f)})),d=Promise.all(l.map(function(f){return e.loadMaterial(f)}));r=Promise.all([c,d]).then(function(f){for(var p=f[0],v=f[1],A=[],m=0;m<l.length;m++){var y=l[m],h=p[m],g=v[m],b=y.mode||WEBGL_CONSTANTS.TRIANGLES,T=void 0;if(b===WEBGL_CONSTANTS.TRIANGLES||b===WEBGL_CONSTANTS.TRIANGLE_STRIP||b===WEBGL_CONSTANTS.TRIANGLE_FAN)if(b===WEBGL_CONSTANTS.TRIANGLE_STRIP?h=e.toGeometryTrianglesDrawMode(h,THREE__namespace.TriangleStripDrawMode):b===WEBGL_CONSTANTS.TRIANGLE_FAN&&(h=e.toGeometryTrianglesDrawMode(h,THREE__namespace.TriangleFanDrawMode)),u.isSkinnedMesh){var E=new THREE__namespace.SkinnedMesh(h,g);h.attributes.skinWeight.normalized||E.normalizeSkinWeights(),T=E}else T=new THREE__namespace.Mesh(h,g);else if(b===WEBGL_CONSTANTS.POINTS)T=new THREE__namespace.Points(h,g);else if(b===WEBGL_CONSTANTS.LINES)T=new THREE__namespace.LineSegments(h,g);else if(b===WEBGL_CONSTANTS.LINE_STRIP)T=new THREE__namespace.Line(h,g);else if(b===WEBGL_CONSTANTS.LINE_LOOP)T=new THREE__namespace.LineLoop(h,g);else throw new Error("glTF: Primitive mode unsupported: "+b);if(Object.keys(h.morphAttributes).length>0){if(u.weights!==void 0)for(var _=0,x=u.weights.length;_<x;_++)T.morphTargetInfluences[_]=u.weights[_];if(u.extras&&Array.isArray(u.extras.targetNames)){var w=u.extras.targetNames;if(T.morphTargetInfluences.length===w.length){T.morphTargetDictionary={};for(var _=0,x=w.length;_<x;_++)T.morphTargetDictionary[w[_]]=_}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}T.name=e.createUniqueName(u.name||"mesh_"+t),A.push(T)}if(A.length===1)return A[0];for(var S=new THREE__namespace.Group,C=0,M=A;C<M.length;C++){var T=M[C];S.add(T)}return S})}return r},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,i=values(this.extensions);r<i.length;r++){var o=i[r],s=o.loadNodeAttachments(t,this);s&&e.push(s)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var i=this.json,o=i.nodes[t],s=o.name?this.createUniqueName(o.name):"",u=[];o.mesh!==void 0&&u.push(this.loadMesh(o.mesh).then(function(p){if(o.weights!==void 0){var v=o.weights;p.traverse(function(A){if(A instanceof THREE__namespace.Mesh||A instanceof THREE__namespace.Line||A instanceof THREE__namespace.Points)for(var m=0,y=v.length;m<y;m++)A.morphTargetInfluences[m]=v[m]})}return p})),o.camera!==void 0&&u.push(this.loadCamera(o.camera));for(var l=this.loadNodeAttachments(t),c=0,d=l;c<d.length;c++){var f=d[c];u.push(f)}return Promise.all(u).then(function(p){var v;if(o.isBone===!0?v=new THREE__namespace.Bone:p.length>1?v=new THREE__namespace.Group:p.length===1?v=p[0]:v=new THREE__namespace.Object3D,v!==p[0])for(var A=0,m=p.length;A<m;A++)v.add(p[A]);if(o.name&&(v.name=s),o.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(o.matrix),v.applyMatrix4(y)}else o.translation!==void 0&&v.position.fromArray(o.translation),o.rotation!==void 0&&v.quaternion.fromArray(o.rotation),o.scale!==void 0&&v.scale.fromArray(o.scale);return v})},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],i=new THREE__namespace.Group;r.name&&(i.name=this.createUniqueName(r.name));for(var o=r.nodes||[],s=[],u=0,l=o.length;u<l;u++)s.push(this.buildNodeHierarchy(o[u],i));return Promise.all(s).then(function(){return i})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var i=0,o=values(e.extensions);i<o.length;i++){var s=o[i],u=s.extendTexture(r,t,e);u&&(r=u)}return r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,i=e.attributes,o=[],s=function(E){var _=ATTRIBUTES[E]||E.toLowerCase();if(_ in t.attributes)return"continue";o.push(u.loadAccessor(i[E]).then(function(x){x&&t.setAttribute(_,x)}))},u=this;for(var l in i)s(l);e.indices!==void 0&&!t.index&&o.push(this.loadAccessor(e.indices).then(function(E){E&&t.setIndex(E)}));var c=new THREE__namespace.Box3;if(i.POSITION!==void 0){var d=this.json.accessors[i.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(c.set(new THREE__namespace.Vector3(f[0],f[1],f[2]),new THREE__namespace.Vector3(p[0],p[1],p[2])),d.normalized){var v=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);c.min.multiplyScalar(v),c.max.multiplyScalar(v)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var A=e.targets;if(A!==void 0){for(var m=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,h=0,g=A.length;h<g;h++){var b=A[h];if(b.POSITION!==void 0){var d=this.json.accessors[b.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(y.setX(Math.max(Math.abs(f[0]),Math.abs(p[0]))),y.setY(Math.max(Math.abs(f[1]),Math.abs(p[1]))),y.setZ(Math.max(Math.abs(f[2]),Math.abs(p[2]))),d.normalized){var v=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);y.multiplyScalar(v)}m.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}c.expandByVector(m)}t.boundingBox=c;var T=new THREE__namespace.Sphere;return c.getCenter(T.center),T.radius=c.min.distanceTo(c.max)/2,t.boundingSphere=T,Promise.all(o).then(function(){if(t.attributes.uv&&!t.attributes.uv2&&r.options.copyUV2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var E=!1,_=!1,x=0,w=e.targets.length;x<w;x++){var S=e.targets[x];if(S.POSITION!==void 0&&(E=!0),S.NORMAL!==void 0&&(_=!0),E&&_)break}if(!E&&!_)return t;var C=[];t.morphTargetsRelative=!0;for(var M=function(I,F){var B=e.targets[I];E?C.push(r.loadAccessor(B.POSITION).then(function(L){L&&(t.morphAttributes.position[I]=L)})):t.morphAttributes.position[I]=t.attributes.position,_?C.push(r.loadAccessor(B.NORMAL).then(function(L){L&&(t.morphAttributes.normal[I]=L)})):t.morphAttributes.normal[I]=t.attributes.normal},x=0,w=e.targets.length;x<w;x++)M(x,w);return Promise.all(C).then(function(){return t})}else return t})},n.prototype.buildNodeHierarchy=function(t,e){var r=this,i=this.json.nodes[t];return this.loadNode(t).then(function(o){if(i.skin===void 0)return o;var s;return r.loadSkin(i.skin).then(function(u){s=u;for(var l=[],c=0,d=s.joints.length;c<d;c++)l.push(r.loadNode(s.joints[c]));return Promise.all(l)}).then(function(u){return o.traverse(function(l){if(l instanceof THREE__namespace.SkinnedMesh){for(var c=[],d=[],f=0,p=u.length;f<p;f++){var v=u[f];if(v instanceof THREE__namespace.Bone){c.push(v);var A=new THREE__namespace.Matrix4;s.inverseBindMatrices!==void 0&&A.fromArray(s.inverseBindMatrices.array,f*16),d.push(A)}else console.warn('glTF: Joint "%s" could not be found.',s.joints[f])}l.bind(new THREE__namespace.Skeleton(c,d),l.matrixWorld)}}),o})}).then(function(o){e.add(o);var s=[];if(i.children)for(var u=i.children,l=0,c=u.length;l<c;l++){var d=u[l];s.push(r.buildNodeHierarchy(d,o))}return Promise.all(s).then(function(){return o})})},n.prototype.createUniqueName=function(t){for(var e=THREE__namespace.PropertyBinding.sanitizeNodeName(t||""),r=e,i=1;this.nodeNamesUsed[r];++i)r=e+"_"+i;return this.nodeNamesUsed[r]=!0,r},n.prototype.resolveResouce=function(t){return pathJoin(this.options.resourcePath,appendSearch(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var i=[],o=t.getAttribute("position");if(o!==void 0){for(var s=0;s<o.count;s++)i.push(s);t.setIndex(i),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var u=r.count-2,l=[];if(e===THREE__namespace.TriangleFanDrawMode)for(var s=1;s<=u;s++)l.push(r.getX(0)),l.push(r.getX(s)),l.push(r.getX(s+1));else for(var s=0;s<u;s++)s%2===0?(l.push(r.getX(s)),l.push(r.getX(s+1)),l.push(r.getX(s+2))):(l.push(r.getX(s+2)),l.push(r.getX(s+1)),l.push(r.getX(s)));l.length/3!==u&&console.error("glTF: Unable to generate correct amount of triangles.");var c=t.clone();return c.setIndex(l),c},n}();function getNormalizedComponentScale(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=function(){function n(){}return n.prototype.markDefs=function(t){},n.prototype.prepare=function(t){},n.prototype.emitResult=function(t,e){},n.prototype.createPrimitiveKey=function(t,e){},n.prototype.extendTexture=function(t,e,r){return null},n.prototype.loadBuffer=function(t,e){return null},n.prototype.loadBufferView=function(t,e){return null},n.prototype.loadImage=function(t,e){return null},n.prototype.loadTexture=function(t,e){return null},n.prototype.loadGeometry=function(t,e){return null},n.prototype.loadMaterial=function(t,e){return null},n.prototype.loadMesh=function(t,e){return null},n.prototype.loadNodeAttachments=function(t,e){return null},n.prototype.loadCamera=function(t,e){return null},n.prototype.loadAnimation=function(t,e){return null},n}(),KHR_binary_glTF=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.header={magic:"",version:0,length:0},e.content="",e.body=null,e}return t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var r=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var i=new DataView(e,t.HEADER_LENGTH),o=0,s=null,u=null;o<i.byteLength;){var l=i.getUint32(o,!0);o+=4;var c=i.getUint32(o,!0);if(o+=4,c===t.CHUNK_TYPES.JSON){var d=new Uint8Array(e,t.HEADER_LENGTH+o,l);s=decodeText(d)}else if(c===t.CHUNK_TYPES.BIN){var f=t.HEADER_LENGTH+o;u=e.slice(f,f+l)}o+=l}if(s===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=s,this.body=u},t.prototype.loadBuffer=function(e,r){var i=r.json.buffers[e];return i.uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t}(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=function(){function n(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return n.prototype.setDecoderPath=function(t){this.decoderPath=t},n.prototype.setDecoderConfig=function(t){return this.decoderConfig=t,this},n.prototype.setWorkerLimit=function(t){return this.workerLimit=t,this},n.prototype.decodeDracoFile=function(t,e,r,i){var o={attributeIDs:r||defaultAttributeIDs,attributeTypes:i||defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(t,o).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1});for(var i in e.attributeTypes){var o=e.attributeTypes[i];o.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[i]=o.name)}var s,u=this.workerNextTaskID++,l=t.byteLength,c=this._getWorker(u,l).then(function(d){return s=d,new Promise(function(f,p){s._callbacks[u]={resolve:f,reject:p},s.postMessage({type:"decode",id:u,taskConfig:e,buffer:t},[t])})}).then(function(d){return r._createGeometry(d.geometry)});return c.catch(function(){return!0}).then(function(){s&&u&&r._releaseTask(s,u)}),c},n.prototype._createGeometry=function(t){var e=new THREE__namespace.BufferGeometry;t.index&&e.setIndex(new THREE__namespace.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var i=t.attributes[r],o=i.name,s=i.array,u=i.itemSize;e.setAttribute(o,new THREE__namespace.BufferAttribute(s,u))}return e},n.prototype._initDecoder=function(){var t=this;if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!="object"||this.decoderConfig.type==="js";if(e){var r=ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(o){return o.body});this.decoderPending=r.then(function(o){var s=["/* draco decoder */",o,"","/* worker */",DRACOWorker].join(`
417
+ `,cacheMaterials=[];function getMaterial(){var n=cacheMaterials.pop();return n||new THREE__namespace.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:PLANE_VERTEX_SHADER,fragmentShader:PLANE_FRAGMENT_SHADER,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function releaseMaterial(n){n.uniforms.map.value=null,cacheMaterials.push(n)}function renderTexturesToCubeRenderTarget(n,t,e){var r=new THREE__namespace.Scene;r.matrixAutoUpdate=!1;var i=new THREE__namespace.Group;i.scale.set(1,1,-1),r.add(i);for(var o=[],s=0,u=n;s<u.length;s++){var l=u[s],c=getMaterial();o.push(c),c.uniforms.map.value=l.texture,c.uniforms.flipY.value=l.flipY?1:0;var d=new THREE__namespace.Group,f=new THREE__namespace.Mesh(PLAME_GEOMETRY,c);f.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),f.scale.set(l.size.x,l.size.y,1),d.quaternion.copy(QUATERNION[l.face]),d.add(f),i.add(d)}var p=e.autoClear;e.autoClear=!1;var v=new THREE__namespace.CubeCamera(.1,2,t);v.matrixAutoUpdate=!1,v.update(e,r),e.autoClear=p;for(var A=0,m=o;A<m.length;A++){var c=m[A];releaseMaterial(c)}}var canUseNativeImageBitmap=function(){return!1}();function createImageBitmapLikeImage(){var n=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){n.onerror=n.onload=n.close=noop$1,n.decoding="async";var t=n.src;n.removeAttribute("src"),/^blob\:/.test(t)&&URL.revokeObjectURL(t)}});return n}function createImageBitmapLike(n){return new Promise(function(t,e){var r=createImageBitmapLikeImage();r.onload=function(){/^blob\:/.test(r.src)&&URL.revokeObjectURL(r.src),r.onload=r.onerror=noop$1,setTimeout(function(){t(r)},0)},r.onerror=function(){var i=r.src;r.onload=r.onerror=noop$1,r.close(),e(new Error("image load error: ".concat(i)))},r.src=URL.createObjectURL(n)})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.shift();if(e)return e.width=n,e.height=t,e;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop$1,canvasPool.push(r)}});return r}function poolImageToTexture(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=createCanvas(Math.min(n.width,t.width),Math.min(n.height,t.height)),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.drawImage(n,0,0,e.width,e.height),n.close();var i=new THREE__namespace.Texture(e);i.needsUpdate=!0,i.flipY=!0;var o=i.dispose;return i.dispose=function(){e.close(),o.call(i),i.dispose=o},i}else{var s=new THREE__namespace.Texture(n);s.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?s.flipY=!1:s.flipY=!0;var u=s.dispose;return s.dispose=function(){n.close(),u.call(s),s.dispose=u},s}}function poolImagesToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){for(var r=0,i=n;r<i.length;r++){var o=i[r];o.close()}e.call(t),t.dispose=e},t}var FACE_ORDER=["right","left","up","down","front","back"],MAX_TILE_RENDER_EACH_FRAME=4,TileCubeTextureTarget=function(){function n(t,e,r,i,o){this.tileTree=e,this.tileSources=r,this.options=i,this.renderer=o,this.name="",this.needsRender=!1,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.textures=[],this.baseCubeTexture=t}return Object.defineProperty(n.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var e,r,i,o,s;if(t===null)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=(e=this.options.format)!==null&&e!==void 0?e:THREE__namespace.RGBAFormat,t.texture.minFilter=(r=this.options.minFilter)!==null&&r!==void 0?r:THREE__namespace.LinearFilter,t.texture.magFilter=(i=this.options.magFilter)!==null&&i!==void 0?i:THREE__namespace.LinearFilter,t.texture.wrapS=(o=this.options.wrapS)!==null&&o!==void 0?o:THREE__namespace.ClampToEdgeWrapping,t.texture.wrapT=(s=this.options.wrapT)!==null&&s!==void 0?s:THREE__namespace.ClampToEdgeWrapping,this.baseCubeTexture&&(renderCubeTextureToCubeRenderTarget(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&renderCubeTextureToCubeRenderTarget(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),n.prototype.requestTile=function(t){var e=this,r,i,o,s,u,l,c=this.tileSources.filter(function(m){return m.level===t.level})[0];if(!c){this.loadedCubeNodes.add(t);return}var d=c.size,f=Math.pow(2,t.level)*t.position.y,p=Math.pow(2,t.level)*t.position.x,v="".concat(((o=(i=(r=this.options.imageURL)===null||r===void 0?void 0:r.options)===null||i===void 0?void 0:i.key)!==null&&o!==void 0?o:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(f,".").concat(p),A=__assign(__assign({},(u=(s=this.options.imageURL)===null||s===void 0?void 0:s.options)!==null&&u!==void 0?u:{key:"unknown"}),{key:v,size:d*t.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[d*t.position.x,d*t.position.y,d*t.size,d*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(c[t.face],{imageURL:{transform:(l=this.options.imageURL)===null||l===void 0?void 0:l.transform,options:__assign({},A)},format:THREE__namespace.RGBAFormat,timeout:this.options.timeout,fetcher:this.options.fetcher}).then(function(m){if(e.disposed){m.body.dispose();return}e.textures.push({face:t.face,level:t.level,position:t.position,size:new THREE__namespace.Vector2(t.size,t.size),texture:m.body,flipY:!m.body.flipY}),e.loadedCubeNodes.add(t)}).catch(noop$1).then(function(){e.disposed||e.loadingCubeNodes.delete(t)})},n.prototype.update=function(t,e){var r=this;if(!this.disposed){var i=[];traverseTileCubeNode(this.tileTree,function(p){if(r.loadingCubeNodes.has(p)||p.level>e||!t.intersectsBox(p.box))return!1;if(!r.loadedCubeNodes.has(p))return i.push(p),!1});for(var o=0,s=i;o<s.length;o++){var u=s[o];this.requestTile(u)}if(this.cubeRenderTarget&&this.textures.length){var l=this.textures.splice(0,MAX_TILE_RENDER_EACH_FRAME);renderTexturesToCubeRenderTarget(l,this.cubeRenderTarget,this.renderer),this.needsRender=!0;for(var c=0,d=l;c<d.length;c++){var f=d[c];f.texture.dispose()}}}},Object.defineProperty(n.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var t=0,e=this.textures;t<e.length;t++){var r=e[t];r.texture.dispose()}this.textures.length=0}},n}(),TextureLoader=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,i,o,s){var u,l,c,d;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var f={};typeof e.flipY!="undefined"&&(f.flipY=e.flipY),typeof e.format!="undefined"&&(f.format=e.format),typeof e.minFilter!="undefined"&&(f.minFilter=e.minFilter),typeof e.magFilter!="undefined"&&(f.magFilter=e.magFilter);var p=(l=(u=e.imageURL)===null||u===void 0?void 0:u.options)!==null&&l!==void 0?l:{key:"unknown"};t=applyImageURLOptions(t,(c=e.imageURL)===null||c===void 0?void 0:c.transform,p);var v=getProtocol(t),A=(d=e.viaAjax)!==null&&d!==void 0?d:canUseNativeImageBitmap,m=isJsonpSource(t),y=/^https?:/.test(v);if(m?A=!0:y||(A=!1),A){var h=null,g="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:g},void 0,void 0,o).then(function(E){return createImageBitmapLike(E.body)}).then(function(E){return poolImageToTexture(E,e.maxSize)}).then(function(E){return Object.assign(E,f),E}).then(function(E){var _={meta:h,body:E};return r(_),_}).catch(function(E){return i(E),Promise.reject(E)})}else{var b=null,T;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(E){return T=E,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,o,E)}).then(function(E){return b=E.meta,poolImageToTexture(E.body,e.maxSize)}).then(function(E){return Object.assign(E,f),E}).then(function(E){var _={meta:b,body:E};return r(_),_}).catch(function(E){return T&&T.close(),i(E),Promise.reject(E)})}},n.prototype.loadCubeTexture=function(t,e,r,i,o,s){var u,l,c,d;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1),typeof e.format!="undefined"&&e.format,typeof e.minFilter!="undefined"&&e.minFilter,typeof e.magFilter!="undefined"&&e.magFilter;for(var f=[t[FACE_ORDER[0]],t[FACE_ORDER[1]],t[FACE_ORDER[2]],t[FACE_ORDER[3]],t[FACE_ORDER[4]],t[FACE_ORDER[5]]],p=[],v=[0,0,0,0,0,0],A=[],m=function(h){var g=(l=(u=e.imageURL)===null||u===void 0?void 0:u.options)!==null&&l!==void 0?l:{key:"unknown"},b=applyImageURLOptions(f[h],(c=e.imageURL)===null||c===void 0?void 0:c.transform,__assign(__assign({},g),{key:g.key+"."+FACE_ORDER[h]})),T=getProtocol(b),E=function(I){v[h]=I,o(v.reduce(function(F,B){return F+B},0)/6)},_=(d=e.viaAjax)!==null&&d!==void 0?d:!1,x=/^https?:$/.test(T),w=isJsonpSource(b);if(w?_=!0:x||(_=!1),_){var S="blob",C=e.fetcher.ajax(b,{timeout:e.timeout,responseType:S},void 0,void 0,E).then(function(I){return A[h]=I.meta,createImageBitmapLike(I.body)});p.push(C)}else{var M,C=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(F){return M=F,e.fetcher.loadImage(b,{timeout:e.timeout},void 0,void 0,E,F)}).then(function(F){return A[h]=F.meta,F.body}).catch(function(F){return M&&M.close(),Promise.reject(F)});p.push(C)}},y=0;y<6;y++)m(y);return Promise.all(p).then(function(h){return poolImagesToCubeTexture(h)}).then(function(h){return Object.assign(h,__assign({encoding:THREE__namespace.sRGBEncoding},e)),h}).then(function(h){var g={body:h,meta:A};return r(g),g}).catch(function(h){for(var g=0,b=p;g<b.length;g++){var T=b[g];T.then(function(E){return E.close()}).catch(noop$1)}return i(h),Promise.reject(h)})},n.prototype.loadTiledCubeTexture=function(t,e,r,i,o,s,u){var l=this;return i===void 0&&(i=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1),new Promise(function(c,d){var f,p;l.loadCubeTexture(t,{imageURL:{transform:(f=r.imageURL)===null||f===void 0?void 0:f.transform,options:(p=r.imageURL)===null||p===void 0?void 0:p.options},format:THREE__namespace.RGBAFormat,viaAjax:r.viaAjax,timeout:r.timeout,fetcher:r.fetcher},function(v){var A,m,y=v.meta,h=v.body,g=(A=r.tileImageSize)!==null&&A!==void 0?A:512,b=(m=r.tileMaxLevel)!==null&&m!==void 0?m:2,T=Math.max(1024*b,512),E=createTileCubeTree(b),_=new TileCubeTextureTarget(h,E,e,{textureSize:T,tileImageSize:g,textureLoader:l,imageURL:r.imageURL,timeout:r.timeout,fetcher:r.fetcher},u),x={meta:y,body:_};i(x),c(x)},function(v){o(v),d(v)},s,u).catch(noop$1)})},n}();const vertexShader$6=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--nvor-sy|n-sy||H--n\bv{t-sy|n-Sy||H0r{qvsnvor-sy|n-v_||sZnxHn\bv{t-sy|n-V_||sZnxHn\bv{t-rp@-[|znyHn\bv{t-rp@-cvr]|vv|{Hn\bv{t-rpA-|yq]|vv|{Hn\bv{t-sy|n-Y|tQr}uHn\bv{t-znA-cvrZnv\x07H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v{pyqr-I?l}nlrr\x07K0v{pyqr-Ip|y|l}nlrr\x07K0v{pyqr-Iunq|zn}l}nlrr\x07K|vq-znv{56-\n--0v{pyqr-Ilrr\x07K--0v{pyqr-I?lrr\x07K--0v{pyqr-Ip|y|lrr\x07K--0v{pyqr-Iortv{{|znylrr\x07K--0v{pyqr-Iqrsny{|znylrr\x07K--rpA-n{s|zrq-J-rpA5}|vv|{9->;=6H--rpA-z]|vv|{-J-z|qrycvrZnv\x07-7-n{s|zrqH--[|zny-J-{|znyv r5n{s|zrq[|zny6H--0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6----Sy||-J-sy||H--0r{qvs--cvr]|vv|{-J-:z]|vv|{;\x07\b H--|yq]|vv|{-J-z|qryZnv\x07-7-n{s|zrqH--tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z|qrycvrZnv\x07-7-n{s|zrqH--0v{pyqr-Iunq|zn}lrr\x07K--Y|tQr}u-J-y|t?5:z]|vv|{; 6H--cvrZnv\x07-J-vrZnv\x07H--V_||sZnx-J-v_||sZnxH\f"),fragmentShader$6=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=60qrsv{r-aNb-C;?E@>EB?{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-rp@-qvssrH{vs|z-rp@-rzvvrH{vs|z-rp@-}rpynH{vs|z-sy|n-uv{v{rH{vs|z-sy|n-r\x07}|rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH{vs|z-sy|n-u|{Sy||V{qr\x07Hn\bv{t-sy|n-V_||sZnxH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6--{vs|z-rp?-}n{|cvqr|lv rH--{vs|z-znA-}n{|cvqr|lznv\x07H--{vs|z-sy|n-}n{|cvqr|lny}unH--{vs|z-nz}yr?Q-}n{|cvqr|lzn}H0r{qvs0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--n\bv{t-sy|n-Sy||H0ryr--{vs|z-sy|n-sy||H0r{qvsn\bv{t-rpA-|yq]|vv|{Hn\bv{t-sy|n-Y|tQr}uHn\bv{t-znA-cvrZnv\x07Hp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V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算--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5ory|{tv{tSY||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9->;=6H----r{H--0r{qvs--<<楼层选择计算--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-KJ-=;=-33-no5ory|{tv{tSY||-:-u|{Sy||V{qr\x076-KJ->;=6-\n----sy||\\}npv\b-J-=;>H--\f--rpA-qvssrP|y|-J-rpA5qvssr;to9-|}npv\b6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5rp@5=;=69-rp@5=;=69-rp@5=;=69-rp@5=;=66H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--<<-调整曝光值--vnqvn{pr-J-vnqvn{pr-7-r\x07}|rH--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--0v{pyqr-In|zn}lsntzr{K--<<-减少方向光对模型的影响--rp@-|t|v{tYvtu-J-5rsyrprqYvtu;qvrpQvssr-7-=;?6-8----rsyrprqYvtu;v{qvrpQvssr-8----rsyrprqYvtu;v{qvrp`}rpyn-8----|nyRzvvr_nqvn{prH--<<-修复黑色面片的问题--vs-5|t|v{tYvtu;-K-=;=-\v\v-|t|v{tYvtu;t-K-=;=-\v\v-|t|v{tYvtu;o-K-=;=6-\n----tylSntP|y|-J-rpA5|t|v{tYvtu9-qvssrP|y|;n6H--\f-ryr-\n----tylSntP|y|-J-rpA5OYNPXlP\\Y\\_;\x07\b 9-qvssrP|y|;n6H--\f--rp@-}n{|=a|crr\x07-J-5|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-5|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-?;=66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6----rp@-pnzrna|crr\x07-J-|yq]|vv|{;\x07\b -:-pnzrn]|vv|{H----rpA-zn}P||q-J-rpA5pnzrna|crr\x079->;=6-7-}n{|cvqr|lznv\x07H----rp?--J-rp?5------=;B-8-zn}P||q;\x07-<-zn}P||q; -<-}n{|cvqr|lv r;\x079------=;B-:-zn}P||q;\b-<-zn}P||q; -<-}n{|cvqr|lv r;\b----6H----rpA-vqr|P|y|-J-r\x07r?Q5}n{|cvqr|lzn}9-6H----sy|n-znpu-J-5>;=-:-r}5=;=9-zn}P||q; 66-7-5>;=-:-r}5=;B9-no5;\x07-:-=;B666-7-5>;=-:-r}5=;B9-no5;\b-:-=;B666H----sy|n-ny}un-J-pynz}5=;=9->;=9-B;=-7-5>;=-:-pynz}5qvn{pr59-rp?5=;B9-=;B66-<-=;BB-9-=;=9->;=666H----}n{|P|y|-J-zv\x075}n{|P|y|9-vqr|P|y|9-znpu-7-ny}un-7-}n{|cvqr|lny}un6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\l\\]NPVaf6----tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H----tylSntP|y|;n-J-|}npv\bH--0ryr----tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b-7-sy||\\}npv\b6H----tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f");var EMPTY_CUBE_TEXTURE=new THREE__namespace.WebGLCubeRenderTarget(1).texture;EMPTY_CUBE_TEXTURE.name="EMPTY_TEXTURE";var shaderUniforms$2=Object.assign({modelAlpha:new THREE__namespace.Uniform(0),progress:new THREE__namespace.Uniform(0),pano0_map:new THREE__namespace.Uniform(EMPTY_CUBE_TEXTURE),pano0_luminanceMap:new THREE__namespace.Uniform(null),pano0_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano1_map:new THREE__namespace.Uniform(EMPTY_CUBE_TEXTURE),pano1_luminanceMap:new THREE__namespace.Uniform(null),pano1_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),floor:new THREE__namespace.Uniform(0)},{exposure:new THREE__namespace.Uniform(1),emissive:new THREE__namespace.Uniform(new THREE__namespace.Color(0)),emissiveMap:new THREE__namespace.Uniform(null),specular:new THREE__namespace.Uniform(new THREE__namespace.Color(1118481)),specularMap:new THREE__namespace.Uniform(null),normalMap:new THREE__namespace.Uniform(null),bumpMap:new THREE__namespace.Uniform(null),shininess:new THREE__namespace.Uniform(30)},THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.common),THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.lights)),PBMMeshMaterial=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,l,c,d,f,p,v,A,m,y,h,g,b,T,E,_,x=n.call(this,{vertexShader:vertexShader$6,fragmentShader:fragmentShader$6,uniforms:THREE__namespace.UniformsUtils.clone(shaderUniforms$2),defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_FLOOR:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_POINT_NORMAL:!1,USE_POINT_CIRCLE:!1,USE_POINT_ADAPTIVE_SIZE:!1,USE_POINT_COLOR_ALTITUDE:!1},lights:!0})||this,w,S=null,C=null;return Object.defineProperties(x,{pano0:{get:function(){return S},set:function(M){if(S!==M){S=M,M===null?(this.uniforms.pano0_map.value=EMPTY_CUBE_TEXTURE,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=M.map instanceof TileCubeTextureTarget?M.map.texture:M.map,this.uniforms.pano0_luminanceMap.value=M.luminanceMap instanceof TileCubeTextureTarget?M.luminanceMap.texture:M.luminanceMap,this.uniforms.pano0_matrix.value.copy(M.matrix));var I=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,F=this.defines.USE_LUMINANCE;F!==I&&(this.defines.USE_LUMINANCE=I,this.needsUpdate=!0)}}},pano1:{get:function(){return C},set:function(M){if(C!==M){C=M,M===null?(this.uniforms.pano1_map.value=EMPTY_CUBE_TEXTURE,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=M.map instanceof TileCubeTextureTarget?M.map.texture:M.map,this.uniforms.pano1_luminanceMap.value=M.luminanceMap instanceof TileCubeTextureTarget?M.luminanceMap.texture:M.luminanceMap,this.uniforms.pano1_matrix.value.copy(M.matrix));var I=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,F=this.defines.USE_LUMINANCE;F!==I&&(this.defines.USE_LUMINANCE=I,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(M){this.uniforms.modelAlpha.value=M}},progress:{get:function(){return this.uniforms.progress.value},set:function(M){this.uniforms.progress.value=M}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(M){var I=this.defines.USE_BLACK_TRANSITION;I!==M&&(this.defines.USE_BLACK_TRANSITION=M,this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(M){this.uniforms.constantColor.value=M;var I=this.defines.USE_CONSTANT_COLOR,F=M!==null;I!==F&&(this.defines.USE_CONSTANT_COLOR=F,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(M){this.uniforms.opacity.value=M}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(M){this.uniforms.shownFloorIndex.value=M}},clippers:{get:function(){return w},set:function(M){w!==M&&(w=M,this.uniforms.clippers.value=(w||[]).map(function(I){var F=typeof I.floorIndex=="number"?I.floorIndex:-1,B=new THREE__namespace.Matrix4().getInverse(I.clippingBoxMatrix);return{matrixInverse:B,floorIndex:F}}),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(M){M!==this.defines.USE_EDL&&(this.defines.USE_EDL=M,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(M){M!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=M,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(M){M!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=M,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(M){this.uniforms.floor.value=M}}}),x.pano0=(r=e.pano0)!==null&&r!==void 0?r:defaultPbmParameters.pano0,x.pano1=(i=e.pano1)!==null&&i!==void 0?i:defaultPbmParameters.pano1,x.modelAlpha=(o=e.modelAlpha)!==null&&o!==void 0?o:defaultPbmParameters.modelAlpha,x.progress=(s=e.progress)!==null&&s!==void 0?s:defaultPbmParameters.progress,x.useBlackTransition=(u=e.useBlackTransition)!==null&&u!==void 0?u:defaultPbmParameters.useBlackTransition,x.constantColor=(l=e.constantColor)!==null&&l!==void 0?l:defaultPbmParameters.constantColor,x.opacity=(c=e.opacity)!==null&&c!==void 0?c:defaultPbmParameters.opacity,x.shownFloorIndex=(d=e.shownFloorIndex)!==null&&d!==void 0?d:defaultPbmParameters.shownFloorIndex,x.clippers=(f=e.clippers)!==null&&f!==void 0?f:defaultPbmParameters.clippers,x.useEDL=(p=e.useEDL)!==null&&p!==void 0?p:defaultPbmParameters.useEDL,x.useHQWeight=(v=e.useHQWeight)!==null&&v!==void 0?v:defaultPbmParameters.useHQWeight,x.useHQDepth=(A=e.useHQDepth)!==null&&A!==void 0?A:defaultPbmParameters.useHQDepth,x.pointSize=(m=e.pointSize)!==null&&m!==void 0?m:defaultPbmParameters.pointSize,x.pointColor=(y=e.pointColor)!==null&&y!==void 0?y:defaultPbmParameters.pointColor,x.pointShape=(h=e.pointShape)!==null&&h!==void 0?h:defaultPbmParameters.pointShape,x.pointScale=(g=e.pointScale)!==null&&g!==void 0?g:defaultPbmParameters.pointScale,x.pointBack=(b=e.pointBack)!==null&&b!==void 0?b:defaultPbmParameters.pointBack,x.pointMinPixel=(T=e.pointMinPixel)!==null&&T!==void 0?T:defaultPbmParameters.pointMinPixel,x.pointMaxPixel=(E=e.pointMaxPixel)!==null&&E!==void 0?E:defaultPbmParameters.pointMaxPixel,x.gradientTexture=(_=e.gradientTexture)!==null&&_!==void 0?_:defaultPbmParameters.gradientTexture,x.floor=0,x}return t.prototype.onBeforeCompile=function(e,r){var i,o,s=String((o=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,s),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,s)},t.prototype.update=function(e,r){this.transparent=this.shownFloorIndex>-1||this.opacity<1,this.blending=this.transparent?THREE__namespace.NormalBlending:THREE__namespace.NoBlending},t.prototype.syncModel=function(e){var r="".concat(e.id,":").concat(e.materialVersion);r!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.syncModelVersion=r)},t}(THREE__namespace.ShaderMaterial),InternalWebGLRenderer=function(n){__extends(t,n);function t(e){var r=e.preserveDrawingBuffer,i=r===void 0?!0:r,o=e.premultipliedAlpha,s=o===void 0?!0:o,u=e.stencil,l=u===void 0?!0:u,c=e.backgroundColor,d=c===void 0?1579548:c,f=e.backgroundAlpha,p=f===void 0?1:f,v=e.pixelRatio,A=v===void 0?1:v,m=e.antialias,y=e.webgl2,h=this,g={antialias:m,alpha:!0,preserveDrawingBuffer:i,stencil:l,premultipliedAlpha:s,powerPreference:"high-performance"};if(y){var b=document.createElement("canvas"),T=b.getContext("webgl2",g);T?h=n.call(this,__assign(__assign({},g),{antialias:!0,canvas:b,context:T}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),h=n.call(this,g)||this)}else h=n.call(this,g)||this;return h.setPixelRatio(A),h.setClearColor(d,p),h.outputEncoding=THREE__namespace.sRGBEncoding,h.autoClear=!0,h}return t}(THREE__namespace.WebGLRenderer),Scene=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.add.apply(this,e)},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.remove.apply(this,e)},t}(THREE__namespace.Scene);function coordinatesToVector(n,t){var e=Math.abs(Math.cos(n.latitude)),r=-Math.sin(n.longitude)*e,i=-Math.sin(n.latitude),o=-Math.cos(n.longitude)*e;return t?t.set(r,i,o):new THREE__namespace.Vector3(r,i,o)}var DEFAULT_ASPECT=1,DEFAULT_NEAR=.1,DEFAULT_FAR=2e3,TAU$2=Math.PI*2,PI_2=Math.PI/2;function formatRad$1(n){return n>0&&n<=TAU$2?n:(n%TAU$2+TAU$2)%TAU$2}function matrixLerp(n,t,e,r){e=Math.pow(e,4);for(var i=0;i<16;i++)r.elements[i]=n.elements[i]+(t.elements[i]-n.elements[i])*e;return r}var Camera=function(n){__extends(t,n);function t(e,r,i,o,s,u,l){r===void 0&&(r=DEFAULT_ASPECT),i===void 0&&(i=DEFAULT_NEAR),o===void 0&&(o=DEFAULT_FAR),s===void 0&&(s=new THREE__namespace.Vector2),u===void 0&&(u=512),l===void 0&&(l=1);var c=n.call(this)||this;c.fov=e,c.aspect=r,c.near=i,c.far=o,c.perspToOrtho=s,c.screenHeight=u,c.pixelRatio=l,c.needsRender=!0,c.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new THREE__namespace.Vector3},c.computePose(),c.perspectiveCamera=new THREE__namespace.PerspectiveCamera(c.fov,c.aspect,.001,c.far);var d=Math.max(c.orthoDistance,.01)*Math.tan(.5*c.fov/180*Math.PI),f=-.5*c.aspect*2*d;return c.orthographicCamera=new THREE__namespace.OrthographicCamera(f,-f,d,-d,.001,c.far),c.computeProjectionMatrix(),c.lastValues={position:c.position.clone(),quaternion:c.quaternion.clone(),scale:c.scale.clone(),fov:c.fov,aspect:c.aspect,near:c.near,far:c.far,perspToOrtho:c.perspToOrtho.clone()},c.type=c.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera",c}return Object.defineProperty(t.prototype,"orthoDistance",{get:function(){return this.pose.distance>1?this.pose.distance:1+(this.pose.distance-1)*this.perspToOrtho.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.zoom:this.type==="PerspectiveCamera"?this.perspectiveCamera.zoom:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.top:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.bottom:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.left:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.right:0},enumerable:!1,configurable:!0}),t.prototype.getDirection=function(e){return coordinatesToVector(this.pose,e)},t.prototype.computePose=function(e){e===void 0&&(e=0);var r=this.getDirection(new THREE__namespace.Vector3);this.pose.longitude=formatRad$1(-Math.atan2(r.x,-r.z)),this.pose.latitude=-Math.asin(r.y/1),this.pose.fov=this.fov,this.pose.distance=e;var i=new THREE__namespace.Vector3().add(this.position).add(r.clone().setLength(this.pose.distance));return this.pose.offset.copy(i),this},t.prototype.setFromPose=function(e){var r,i,o,s,u,l=formatRad$1((r=e.longitude)!==null&&r!==void 0?r:this.pose.longitude),c=Math.max(-PI_2+1e-4,Math.min(PI_2-1e-4,(i=e.latitude)!==null&&i!==void 0?i:this.pose.latitude)),d=(o=e.fov)!==null&&o!==void 0?o:this.pose.fov,f=(s=e.distance)!==null&&s!==void 0?s:this.pose.distance,p=(u=e.offset)!==null&&u!==void 0?u:this.pose.offset,v=coordinatesToVector({longitude:l,latitude:c}).normalize();return this.position.set(0,0,0),this.lookAt(v),this.position.add(p).sub(v.clone().setLength(f)),this.fov!==d&&(this.fov=d,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=l,this.pose.latitude=c,this.pose.fov=d,this.pose.distance=f,this.pose.offset.copy(p),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){matrixLerp(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,r,i,o,s,u){this.perspectiveCamera.setViewOffset(e,r,i,o,s,u),this.orthographicCamera.setViewOffset(e,r,i,o,s,u),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e,r){var i=!1;if((this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect)&&(this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),i=!0),!this.lastValues.position.equals(this.position)||!this.lastValues.quaternion.equals(this.quaternion)||!this.lastValues.scale.equals(this.scale)||!this.lastValues.perspToOrtho.equals(this.perspToOrtho)||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect){var o=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),s=-.5*this.aspect*2*o;this.orthographicCamera.left=s,this.orthographicCamera.right=-s,this.orthographicCamera.top=o,this.orthographicCamera.bottom=-o,this.orthographicCamera.updateProjectionMatrix(),i=!0}i&&this.computeProjectionMatrix(),this.lastValues.position.copy(this.position),this.lastValues.quaternion.copy(this.quaternion),this.lastValues.scale.copy(this.scale),this.lastValues.fov=this.fov,this.lastValues.aspect=this.aspect,this.lastValues.near=this.near,this.lastValues.far=this.far,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.type=this.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera"},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e,r){return n.prototype.copy.call(this,e,r),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.updateTime(now(),0),this},t}(THREE__namespace.Camera),VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,scratchVector=new THREE__namespace.Vector3,scratchMatrix4$3=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3=new THREE__namespace.Box3,scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$3.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$3.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$3),this.setFromFrustum(scratchFrustum),this},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,i=this.planes;r<i.length;r++){var o=i[r],s=t.intersectPlane(o);switch(s){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,i=Math.min(32,this.planes.length),o=0;o<i;++o){var s=1<<o;if(e&s){var u=this.planes[o],l=t.intersectPlane(u);if(l===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;l===VolumePlaneIntersect.Intersecting&&(r|=s)}}return r},n}(),BoxBoundingVolume=function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],i=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=e[9],d=e[10],f=e[11],p=Math.sqrt(r*r+i*i+o*o),v=Math.sqrt(s*s+u*u+l*l),A=Math.sqrt(c*c+d*d+f*f);this.halfSize.set(p,v,A);var m=this.halfSize.toArray().reduce(function(y,h){return y+h},0);return(isNaN(m)||m<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/p,i/p,o/p,s/v,u/v,l/v,c/A,d/A,f/A]),isNaN(this.rotation.toArray().reduce(function(y,h){return y+h},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$3.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredTo=function(t){var e=this.rotation.elements,r=t.x-this.center.x,i=t.y-this.center.y,o=t.z-this.center.z,s=0,u;return u=r*e[0]+i*e[1]+o*e[2],u<0&&(u=-u),u-=this.halfSize.x,u>0&&(s+=u*u),u=r*e[3]+i*e[4]+o*e[5],u<0&&(u=-u),u-=this.halfSize.y,u>0&&(s+=u*u),u=r*e[6]+i*e[7]+o*e[8],u<0&&(u=-u),u-=this.halfSize.z,u>0&&(s+=u*u),s},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceSquaredTo(t))},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),e=new Float32Array(8*3);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,i=this.rotation.elements,o=this.halfSize,s=r.x,u=r.y,l=r.z,c=Math.abs(s*i[0]*o.x+u*i[1]*o.x+l*i[2]*o.x)+Math.abs(s*i[3]*o.y+u*i[4]*o.y+l*i[5]*o.y)+Math.abs(s*i[6]*o.z+u*i[7]*o.z+l*i[8]*o.z),d=r.dot(e)+t.constant;return d<=-c?VolumePlaneIntersect.Outside:d>=c?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e){scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$3.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$3.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$3),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1);var r=scratchRay$1.intersectBox(scratchBox3,scratchVector);return r?e!==void 0?r.applyMatrix4(scratchMatrix4$3).distanceTo(t.origin)<e:!0:!1},n}(),SphereBoundingVolume=function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+Math.sin(i)*this.radius,e[r*6+2]=this.center.z+0,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+Math.sin(i)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(i)*this.radius,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(i)*this.radius}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o},n.prototype.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredTo=function(t){var e=this.distanceTo(t);return e*e},n.prototype.distanceTo=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,i=t.normal,o=i.dot(e)+t.constant;return o<-r?VolumePlaneIntersect.Outside:o<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e){scratchSphere$1.set(this.center,this.radius);var r=t.intersectSphere(scratchSphere$1,scratchVector);return r?e!==void 0?t.origin.distanceTo(r)<e:!0:!1},n}(),RegionBoundingVolume=function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceTo=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredTo=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t){throw new Error("not implemented")},n}();function makeBoundingVolume(n){if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[2621517,3801199,4915345,5963950,7274706,8782079,9575167,10434047,11623423,12482559,13274879,13870335,14464511,15125247,15852031,16446719].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,transparent:!0})}),debugBoxGeometry=function(){var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(8*3);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e}(),debugSphereGeometry=function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var i=new THREE__namespace.BufferGeometry;return i.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),i.computeBoundingBox(),i.computeBoundingSphere(),i}();function createDebugBoundingMesh(n,t){if(n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}throw new Error("never")}var Tile=function(){function n(t,e,r,i){var o=this,s,u,l;this.parent=null,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,selectionDepth:0,shouldRefine:!1,distanceToCamera:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1},this.parent=i!=null?i:null,this.tileset=r,this.refine=(s=e.refine)!==null&&s!==void 0?s:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(l=(u=this.parent)===null||u===void 0?void 0:u.geometricError)!==null&&l!==void 0?l:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",byteLength:0},e.content.group!==void 0&&(this.content.group=e.content.group),e.content.boundingVolume&&(this.content.boundingVolume=makeBoundingVolume(e.content.boundingVolume).applyMatrix4(this.transform)),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=e.extras||{},e.children?this.children=e.children.map(function(c,d){return new n("".concat(o.id,".").concat(d),c,r,o)}):this.children=[]}return n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transformIsIdentity?null:this.tileset.transform;if(this.boundingVolume){var r=e?this.boundingVolume.clone().applyMatrix4(e):this.boundingVolume;this.state.distanceToCamera=r.distanceTo(t.camera.position);var i=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,i),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if(this.viewerRequestVolume){var o=e?this.viewerRequestVolume.clone().applyMatrix4(e):this.viewerRequestVolume;this.state.inRequestVolume=o.distanceSquaredTo(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="MESH"||this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),n.prototype.loadContent=function(){var t=this,e;if(this.hasEmptyContent||!(!((e=this.content)===null||e===void 0)&&e.uri))return Promise.resolve(!1);var r=this.content;return r.data?Promise.resolve(!0):(r.loadState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,function(){return t.getPriority()}).then(function(i){return i?t.tileset.options.contentLoader(t).then(function(o){return i.done(),r.loadState=o?"READY":"UNLOADED",o}).catch(function(o){return r.loadState="FAILED",i.done(),Promise.reject(o)}):(r.loadState="UNLOADED",Promise.resolve(!1))}))},n.prototype.unloadContent=function(){return this.content&&(this.content.loadState="UNLOADED",this.content.byteLength=0),!0},n.prototype.getScreenSpaceError=function(t,e,r){var i=this.tileset.transformIsIdentity?1:this.tileset.transform.getMaxScaleOnAxis(),o=this.parent?this.parent.geometricError:this.tileset.geometricError,s=i*(r?o:this.geometricError);if(s===0)return 0;var u=Math.max(e,.001),l=s*t.height/(u*t.sseDenominator);return l},n.prototype.getPriority=function(){var t=this.refine==="ADD"||this.tileset.skipLevelOfDetail;if(t&&!this.state.visible||this.tileset.frameNumber-this.state.touchedFrameNumber>=1||this.content.loadState==="UNLOADED")return-1;var e=this.parent,r=e&&(!t||this.state.screenSpaceError===0),i=r?e.state.screenSpaceError:this.state.screenSpaceError,o=this.tileset.root?this.tileset.root.state.screenSpaceError:0,s=Math.max(o-i,0);return s},n}(),RequestScheduler=function(){function n(){this.maxRequests=n.DEFAULT_MAX_REQUESTS,this.activeRequests=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return n.prototype.scheduleRequest=function(t,e){var r=this.requestMap.get(t);if(r)return r;var i={identiy:t,priority:0,getPriority:e,resolve:function(){}},o=new Promise(function(s){return i.resolve=s});return this.requestQueue.push(i),this.requestMap.set(t,o),this.issueNewRequests(),o},n.prototype.reset=function(){for(var t=0,e=this.requestQueue;t<e.length;t++){var r=e[t];r.resolve(null)}this.requestQueue.length=0,this.requestMap.clear(),this.activeRequests=0},n.prototype.issueRequest=function(t){var e=this,r=t.identiy,i=t.resolve,o=!1,s=function(){o||(o=!0,e.requestMap.delete(r),e.activeRequests--,e.issueNewRequests())};this.activeRequests++,i({done:s})},n.prototype.issueNewRequests=function(){var t=this;this.deferred||(this.deferred=setTimeout(function(){return t.issueNewRequestsAsync()},0))},n.prototype.issueNewRequestsAsync=function(){this.deferred=null;var t=Math.max(this.maxRequests-this.activeRequests,0);if(t!==0){this.updateAllRequests();for(var e=0;e<t;e++){var r=this.requestQueue.shift();if(r)this.issueRequest(r);else break}}},n.prototype.updateAllRequests=function(){for(var t=this.requestQueue,e=0;e<t.length;e++){var r=t[e];this.updateRequest(r)===!1&&(t.splice(e,1),this.requestMap.delete(r.identiy),e--)}t.sort(function(i,o){return i.priority-o.priority})},n.prototype.updateRequest=function(t){return t.priority=t.getPriority(t.identiy),t.priority<0?(t.resolve(null),!1):!0},n.DEFAULT_MAX_REQUESTS=6,n}(),CacheNode=function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n}(),CacheNodeList=function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n}(),TilesetCache=function(){function n(){this.cacheNodeMap=new Map,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touch=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.add=function(t,e){if(!this.cacheNodeMap.has(t)){var r=this.list.add(t);this.cacheNodeMap.set(t,r),e&&e(t)}},n.prototype.unloadTile=function(t,e){var r=this.cacheNodeMap.get(t);r&&(this.list.remove(r),this.cacheNodeMap.delete(t),e&&e(t))},n.prototype.unloadTiles=function(t,e){for(var r=this.list.head;r!==this.sentinel&&t();){var i=r.item;r=r.next,this.unloadTile(i,e)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var i=r[e];i.item!=="sentinel"&&t.push(i.item)}return t},n}(),ManagedArray=function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n}(),TilesetTraverser=function(){function n(){this.loadSiblings=n.DEFAULT_LOAD_SIBLINGS,this.skipLevelOfDetail=n.DEFAULT_SKIP_LEVEL_OF_DETAIL,this.maxScreenSpaceError=n.DEFAULT_MAX_SCREEN_SPACE_ERROR,this._canSelectTile=!0,this._traversalStack=new ManagedArray,this._emptyTraversalStack=new ManagedArray,this.root=null,this.selectedTiles=new Map,this.requestedTiles=new Map,this.needsRefinedTiles=new Map,this.emptyTiles=new Map}return n.prototype.traverse=function(t,e,r){r===void 0&&(r=[]),this.root=t,this.reset();for(var i=0,o=r;i<o.length;i++){var s=o[i];this._traversalStack.reset(),this._emptyTraversalStack.reset(),this._canSelectTile=s.camera.visible,this.updateTile(t,s),this.executeTraversal(t,s)}this._traversalStack.reset(),this._emptyTraversalStack.reset(),this._canSelectTile=!0,this.updateTile(t,e),this.executeTraversal(t,e)},n.prototype.reset=function(){this.needsRefinedTiles.clear(),this.requestedTiles.clear(),this.selectedTiles.clear(),this.emptyTiles.clear(),this._traversalStack.reset(),this._emptyTraversalStack.reset()},n.prototype.executeTraversal=function(t,e){var r=this._traversalStack;if(t.state.selectionDepth=0,e.maxLevelOfDetail>=0)for(t.state.visible&&t.state.inRequestVolume&&r.push(t);r.length>0;){var i=r.pop(),o=!1;if(this.canTraverse(i,e,!1,!1)){var s=i.hasRenderContent?i.state.selectionDepth+1:i.state.selectionDepth;this.updateChildTiles(i,e,s),o=this.updateAndPushChildren(i,e,r)}var u=i.parent,l=!u||u.state.shouldRefine,c=!o;i.hasRenderContent?i.refine==="ADD"?(this.loadTile(i,e.frameNumber),this.selectTile(i,e)):i.refine==="REPLACE"&&(this.loadTile(i,e.frameNumber),c&&this.selectTile(i,e)):(this.emptyTiles.set(i.id,i),this.loadTile(i,e.frameNumber),c&&this.selectTile(i,e)),this.touchTile(i,e),i.state.shouldRefine=o&&l}},n.prototype.updateChildTiles=function(t,e,r){for(var i=t.children,o=0,s=i;o<s.length;o++){var u=s[o];u.state.selectionDepth=r,this.updateTile(u,e)}return!0},n.prototype.updateAndPushChildren=function(t,e,r){for(var i=t.children,o=t.refine==="REPLACE"&&t.hasRenderContent&&!this.skipLevelOfDetail,s=!1,u=!0,l=0,c=i;l<c.length;l++){var d=c[l];if(d.state.visible&&d.state.inRequestVolume?(r.find(d)&&r.delete(d),r.push(d),s=!0):(o||this.loadSiblings)&&(this.loadTile(d,e.frameNumber),this.touchTile(d,e)),o){var f=void 0;d.state.inRequestVolume?d.hasRenderContent?f=d.contentAvailable:f=this.executeEmptyTraversal(d,e):f=!1,u=u&&f}}return s||(u=!1),u},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e)},n.prototype.selectTile=function(t,e){this.shouldSelectTile(t)&&(t.state.selectedFrameNumber=e.frameNumber,this.selectedTiles.set(t.id,t)),this.needsRefinedTiles.set(t.id,t)},n.prototype.loadTile=function(t,e){this.shouldLoadTile(t)&&(t.state.requestedFrameNumber=e,this.requestedTiles.set(t.id,t)),this.needsRefinedTiles.set(t.id,t)},n.prototype.touchTile=function(t,e){t.tileset.cache.touch(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e,r,i){return t.hasChildren?t.hasTilesetContent?!0:!i&&!t.state.visible?!1:this.shouldRefine(t,e,r):!1},n.prototype.shouldLoadTile=function(t){return t.hasUnloadedContent},n.prototype.shouldSelectTile=function(t){return t.contentAvailable&&!this.skipLevelOfDetail&&this._canSelectTile},n.prototype.shouldRefine=function(t,e,r){if(t.hasEmptyContent)return!0;if(t.hasRenderContent){if(t.state.selectionDepth>=e.maxLevelOfDetail)return!1;if(t.state.selectionDepth<e.minLevelOfDetail)return!0}var i=t.state.screenSpaceError;return r&&(i=t.getScreenSpaceError(e,t.state.distanceToCamera,!0)),i>this.maxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var i=t.children[0];this.updateTileVisibility(i,e),t.state.visible=i.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}}},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"?!1:!this.shouldRefine(t,e,!0)},n.prototype.compareDistanceToCamera=function(t,e){return e.state.distanceToCamera-t.state.distanceToCamera},n.prototype.executeEmptyTraversal=function(t,e){var r=!0,i=this._emptyTraversalStack;for(i.push(t);i.length>0&&r;){var o=i.pop();this.updateTile(o,e),o.state.visible||this.loadTile(o,e.frameNumber),this.touchTile(o,e);var s=!o.hasRenderContent&&this.canTraverse(o,e,!1,!0);if(s)for(var u=o.children,l=0,c=u;l<c.length;l++){var d=c[l];i.find(d)&&i.delete(d),i.push(d)}else o.contentAvailable||(r=!1)}return r},n.DEFAULT_SKIP_LEVEL_OF_DETAIL=!1,n.DEFAULT_LOAD_SIBLINGS=!1,n.DEFAULT_MAX_SCREEN_SPACE_ERROR=4,n}(),identityMatrix4=new THREE__namespace.Matrix4,Tileset=function(){function n(t,e,r){var i,o;this.id=t,this.transform=new THREE__namespace.Matrix4,this.transformIsIdentity=!0,this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||"",gltfUpAxis:(i=e.asset.gltfUpAxis)!==null&&i!==void 0?i:"Y",overview:e.asset.overview},this.properties=(o=e.properties)!==null&&o!==void 0?o:{},this.options=r,this.traverser=new TilesetTraverser,this.cache=new TilesetCache,this.requestScheduler=new RequestScheduler,this.frameNumber=0,this.pendingCount=0,this.tiles=new Map,this.memoryUsageInBytes=0,this.root=new Tile("".concat(this.id,".0"),e.root,this),this.geometricError=e.geometricError,this.maxMemoryUsage=n.DEFAULT_MAX_MEMORY_USAGE}return Object.defineProperty(n.prototype,"maxRequests",{get:function(){return this.requestScheduler.maxRequests},set:function(t){this.requestScheduler.maxRequests=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"skipLevelOfDetail",{get:function(){return this.traverser.skipLevelOfDetail},set:function(t){this.traverser.skipLevelOfDetail=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxScreenSpaceError",{get:function(){return this.traverser.maxScreenSpaceError},set:function(t){this.traverser.maxScreenSpaceError=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"selectedTiles",{get:function(){return this.traverser.selectedTiles},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"needsRefinedTiles",{get:function(){return this.traverser.needsRefinedTiles},enumerable:!1,configurable:!0}),n.prototype.reset=function(){for(var t=this,e=[this.root],r;r=e.pop();){for(var i=0,o=r.children.length;i<o;i++)e.push(r.children[i]);this.cache.unloadTile(r,function(s){return t.unloadTile(s)})}this.cache.reset(),this.traverser.reset(),this.requestScheduler.reset(),this.tiles.clear()},n.prototype.isLoaded=function(){return this.pendingCount===0&&this.frameNumber!==0},n.prototype.traverse=function(t,e){var r=this;e===void 0&&(e=[]),this.transformIsIdentity=this.transform.equals(identityMatrix4),this.traverser.traverse(this.root,t,e),this.selectedTiles.forEach(function(i){r.tiles.set(i.id,i)}),this.traverser.requestedTiles.forEach(function(i){i.hasUnloadedContent&&r.loadTile(i)}),this.cache.unloadTiles(function(){var i=r.memoryUsageInBytes>r.maxMemoryUsage*1024*1024;return i},function(i){r.unloadTile(i),r.tiles.delete(i.id)})},n.prototype.loadTile=function(t){var e=this;this.pendingCount++,t.loadContent().catch(function(r){return e.options.onTileError(t,r),!1}).then(function(r){var i;e.pendingCount--,r&&(!((i=t.content)===null||i===void 0)&&i.data&&e.cache.add(t,function(){e.memoryUsageInBytes+=t.contentByteLength}),e.options.onTileLoad(t))})},n.prototype.unloadTile=function(t){this.memoryUsageInBytes-=t.contentByteLength,this.options.onTileUnload(t),t.unloadContent()},n.DEFAULT_VIEW_DISTANCE_SCALE=1,n.DEFAULT_MAX_MEMORY_USAGE=16,n.DEFAULT_MAX_SCREEN_SPACE_ERROR=TilesetTraverser.DEFAULT_MAX_SCREEN_SPACE_ERROR,n.DEFAULT_MAX_REQUESTS=RequestScheduler.DEFAULT_MAX_REQUESTS,n}(),BVHNode=function(){function n(t,e,r,i,o){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=i,this.deepth=o}return n}(),BYTES_PER_NODE=6*4+4+4+2+2;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),i=new Uint32Array(e),o=new Uint16Array(e),s=[n],u,l;u=s.pop();)l=u.id*BYTES_PER_NODE/4,r[l]=u.extents[0],r[l+1]=u.extents[1],r[l+2]=u.extents[2],r[l+3]=u.extents[3],r[l+4]=u.extents[4],r[l+5]=u.extents[5],i[l+6]=u.startIndex,i[l+7]=u.endIndex,l=u.id*BYTES_PER_NODE/2,u.node0&&(o[l+16]=u.node0.id,s.push(u.node0)),u.node1&&(o[l+17]=u.node1.id,s.push(u.node1));return e}function intersectNodeBox(n,t,e,r,i,o,s,u,l){l===void 0&&(l=0),e=e-l,r=r-l,i=i-l,o=o+l,s=s+l,u=u+l;var c={min:0,max:0};t.x>=0?(c.min=(e-n.x)*t.x,c.max=(o-n.x)*t.x):(c.min=(o-n.x)*t.x,c.max=(e-n.x)*t.x);var d={min:0,max:0};if(t.y>=0?(d.min=(r-n.y)*t.y,d.max=(s-n.y)*t.y):(d.min=(s-n.y)*t.y,d.max=(r-n.y)*t.y),c.min>d.max||d.min>c.max)return!1;d.min>c.min&&(c.min=d.min),d.max<c.max&&(c.max=d.max);var f={min:0,max:0};return t.z>=0?(f.min=(i-n.z)*t.z,f.max=(u-n.z)*t.z):(f.min=(u-n.z)*t.z,f.max=(i-n.z)*t.z),!(c.min>f.max||f.min>c.max||(f.min>c.min&&(c.min=f.min),f.max<c.max&&(c.max=f.max),c.max<0))}var BVHVector3=function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,i=t.y,o=t.z,s=e.x,u=e.y,l=e.z;return this.x=i*l-o*u,this.y=o*s-r*l,this.z=r*u-i*s,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n}(),BVHIntersect=function(){function n(t,e,r){this.triangle=t,this.intersectionPoint=e,this.index=r}return n}(),EPSILON$1=1e-6,BVHMesh=function(){function n(t,e){if(this.positionArray=t,e)this.indicesArray=e;else{for(var r=t.length/3,i=r>65535?new Uint32Array(r):new Uint16Array(r),o=0;o<r;o++)i[o]=o;this.indicesArray=i}}return n.prototype.createTree=function(t,e,r){e=Math.min(e,16);var i=this.positionArray,o=this.indicesArray,s=o.length/3,u=s>65535?new Uint32Array(s):new Uint16Array(s),l=new Float32Array(s*6),c=[],d=0,f=-1;if(r)for(var p=0,v=0,A=0,m=void 0,y=void 0,h=void 0,g=void 0,b=void 0,T=void 0,E=void 0;p<s;p+=1,v+=3,A+=6)u[p]=p,m=g=i[o[v]*3],E=i[o[v+1]*3],E<m&&(m=E),E>g&&(g=E),E=i[o[v+2]*3],E<m&&(m=E),E>g&&(g=E),y=b=i[o[v]*3+1],E=i[o[v+1]*3+1],E<y&&(y=E),E>b&&(b=E),E=i[o[v+2]*3+1],E<y&&(y=E),E>b&&(b=E),h=T=i[o[v]*3+2],E=i[o[v+1]*3+2],E<h&&(h=E),E>T&&(T=E),E=i[o[v+2]*3+2],E<h&&(h=E),E>T&&(T=E),l[A]=m,l[A+1]=y,l[A+2]=h,l[A+3]=g,l[A+4]=b,l[A+5]=T;else{for(var _=1/0,x=1/0,w=1/0,S=-1/0,C=-1/0,M=-1/0,p=0,v=0,A=0,m=void 0,y=void 0,h=void 0,g=void 0,b=void 0,T=void 0,E=void 0;p<s;p+=1,v+=3,A+=6)u[p]=p,m=g=i[o[v]*3],E=i[o[v+1]*3],E<m&&(m=E),E>g&&(g=E),E=i[o[v+2]*3],E<m&&(m=E),E>g&&(g=E),y=b=i[o[v]*3+1],E=i[o[v+1]*3+1],E<y&&(y=E),E>b&&(b=E),E=i[o[v+2]*3+1],E<y&&(y=E),E>b&&(b=E),h=T=i[o[v]*3+2],E=i[o[v+1]*3+2],E<h&&(h=E),E>T&&(T=E),E=i[o[v+2]*3+2],E<h&&(h=E),E>T&&(T=E),l[A]=m,l[A+1]=y,l[A+2]=h,l[A+3]=g,l[A+4]=b,l[A+5]=T,m<_&&(_=m),g>S&&(S=g),y<x&&(x=y),b>C&&(C=b),h<w&&(w=h),T>M&&(M=T);r=[_,x,w,S,C,M]}var I=new BVHNode(++f,r,0,s,0);c[d++]=I;var F=[],B=[0,1,2],L=function(O,U){return F[U]-F[O]};function k(O){var U=O.startIndex,V=O.endIndex,N=O.extents;F[0]=N[3]-N[0],F[1]=N[4]-N[1],F[2]=N[5]-N[2],B.sort(L);for(var Q=0;Q<3;Q++){for(var G=B[Q],q=N[G]+N[G+3],W=U,z=V-1,X=-1,re=void 0;W<=z;)X===-1?(re=u[W],l[re*6+G]+l[re*6+G+3]<q?W++:X=re):(re=u[z],l[re*6+G]+l[re*6+G+3]>=q||(u[W]=re,u[z]=X,X=-1,W++),z--);if(W>U&&W<V){var J=new BVHNode(++f,calcExtents(u,l,U,W,EPSILON$1),U,W,O.deepth+1);J.deepth<e&&J.endIndex-J.startIndex>t&&(c[d++]=J);var $=new BVHNode(++f,calcExtents(u,l,W,V,EPSILON$1),W,V,O.deepth+1);$.deepth<e&&$.endIndex-$.startIndex>t&&(c[d++]=$),O.node0=J,O.node1=$,O.startIndex=0,O.endIndex=0;break}}}for(;d;)k(c[--d]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(I,f+1),c.length=0,this},n.prototype.trianglesInSphere=function(t,e){for(var r=this.positionArray,i=this.indicesArray,o=this.offsetArray,s=this.rootNodePacked,u=new Float32Array(s),l=new Uint32Array(s),c=new Uint16Array(s),d=[0],f=[],p,v,A,m;(p=d.pop())!==void 0;){m=p*BYTES_PER_NODE/4;var y=clamp$1(t.x,u[m],u[m+3])-t.x,h=clamp$1(t.y,u[m+1],u[m+4])-t.y,g=clamp$1(t.z,u[m+2],u[m+5])-t.z;if(y*y+h*h+g*g<=e*e){for(var b=l[m+6];b<l[m+7];b++)f.push(o[b]);m=p*BYTES_PER_NODE/2,v=c[m+16],A=c[m+17],v&&d.push(v),A&&d.push(A)}}for(var T=f.length,E=new Float32Array(T*9),b=0;b<T;b++){var _=f[b];E[b*9]=r[i[_]*3],E[b*9+1]=r[i[_]*3+1],E[b*9+2]=r[i[_]*3+2],E[b*9+3]=r[i[_+1]*3],E[b*9+4]=r[i[_+1]*3+1],E[b*9+5]=r[i[_+1]*3+2],E[b*9+6]=r[i[_+2]*3],E[b*9+7]=r[i[_+2]*3+1],E[b*9+8]=r[i[_+2]*3+2]}return E},n.prototype.intersectRay=function(t,e,r){for(var i=this.positionArray,o=this.indicesArray,s=this.offsetArray,u=this.rootNodePacked,l=new Float32Array(u),c=new Uint32Array(u),d=new Uint16Array(u),f=new BVHVector3(1/e.x,1/e.y,1/e.z),p=[0],v,A,m,y;(v=p.pop())!==void 0;)if(y=v*BYTES_PER_NODE/4,intersectNodeBox(t,f,l[y],l[y+1],l[y+2],l[y+3],l[y+4],l[y+5])){for(var h=c[y+6],g=c[y+7],b=void 0,T=void 0,E=void 0,_=t.x,x=t.y,w=t.z,S=e.x,C=e.y,M=e.z,I=void 0,F=void 0,B=void 0,L=void 0,k=void 0,O=void 0,U=void 0,V=void 0,N=void 0,Q=void 0,G=void 0,q=void 0,W=void 0,z=void 0,X=void 0,re=void 0,J=void 0,$=void 0,ee=void 0,oe=void 0,ae=void 0,ne=void 0,le=void 0,ie=void 0,fe=void 0,Z=void 0,te=void 0;h<g;h++){if(b=s[h],T=b*3,E=o[T]*3,I=i[E],F=i[++E],B=i[++E],E=o[T+1]*3,L=i[E],k=i[++E],O=i[++E],E=o[T+2]*3,U=i[E],V=i[++E],N=i[++E],Q=L-I,G=k-F,q=O-B,W=U-I,z=V-F,X=N-B,re=G*X-q*z,J=q*W-Q*X,$=Q*z-G*W,le=S*re+C*J+M*$,le>0)ne=1;else if(le<0)ne=-1,le=-le;else continue;ee=_-I,oe=x-F,ae=w-B,ie=ne*(S*(oe*X-ae*z)+C*(ae*W-ee*X)+M*(ee*z-oe*W)),!(ie<0)&&(fe=ne*(S*(G*ae-q*oe)+C*(q*ee-Q*ae)+M*(Q*oe-G*ee)),!(fe<0)&&(ie+fe>le||(Z=-ne*(ee*re+oe*J+ae*$),!(Z<0)&&(te=Z/le,r.push(new BVHIntersect([I,F,B,L,k,O,U,V,N],[_+S*te,x+C*te,w+M*te],b))))))}y=v*BYTES_PER_NODE/2,A=d[y+16],m=d[y+17],A&&p.push(A),m&&p.push(m)}return r},n}();function clamp$1(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,i){if(e>=r)return[0,0,0,0,0,0];for(var o=1/0,s=1/0,u=1/0,l=-1/0,c=-1/0,d=-1/0,f=e,p=void 0,v=void 0;f<r;f++)p=n[f]*6,v=t[p],v<o&&(o=v),v=t[p+1],v<s&&(s=v),v=t[p+2],v<u&&(u=v),v=t[p+3],v>l&&(l=v),v=t[p+4],v>c&&(c=v),v=t[p+5],v>d&&(d=v);return[o-i,s-i,u-i,l+i,c+i,d+i]}var EPSILON=1e-6,BVHPoints=function(){function n(t,e){this.positionArray=t,this.indicesArray=e}return n.prototype.createTree=function(t,e,r){e=Math.min(e,16);var i=this.positionArray,o=this.indicesArray,s=o?o.length:i.length/3,u=s>65535?new Uint32Array(s):new Uint16Array(s),l=[],c=0,d=-1;if(r)for(var f=0;f<s;f+=1)u[f]=f;else{for(var p=o?o[0]*3:0,v=i[p],A=i[p+1],m=i[p+2],y=v,h=A,g=m,f=0,b=0,T=void 0,E=void 0,_=void 0;f<s;f+=1,b+=3)u[f]=f,p=(o?o[b]:b)*3,T=i[p],E=i[p+1],_=i[p+2],T<v?v=T:T>y&&(y=T),E<A?A=E:E>h&&(h=E),_<m?m=_:_>g&&(g=_);r=[v,A,m,y,h,g]}var x=new BVHNode(++d,r,0,s,0);l[c++]=x;var w=[],S=[0,1,2],C=function(I,F){return w[F]-w[I]};function M(I){var F=I.startIndex,B=I.endIndex,L=I.extents;w[0]=L[3]-L[0],w[1]=L[4]-L[1],w[2]=L[5]-L[2];for(var k=S.sort(C)[0],O=(L[k]+L[k+3])/2,U=F,V=B-1,N=-1,Q,G;U<=V;)N===-1?(Q=u[U],G=(o?o[Q]:Q)*3,i[G+k]<O?U++:N=Q):(Q=u[V],G=(o?o[Q]:Q)*3,i[G+k]>=O||(u[U]=Q,u[V]=N,N=-1,U++),V--);if(U>F){var q=L.slice();q[k+3]=O+EPSILON;var W=new BVHNode(++d,q,F,U,I.deepth+1);W.deepth<e&&W.endIndex-W.startIndex>t&&(l[c++]=W),I.node0=W}if(B>U){var z=L.slice();z[k]=O-EPSILON;var X=new BVHNode(++d,z,U,B,I.deepth+1);X.deepth<e&&X.endIndex-X.startIndex>t&&(l[c++]=X),I.node1=X}I.startIndex=0,I.endIndex=0}for(;c;)M(l[--c]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(x,d+1),l.length=0,this},n.prototype.intersectRay=function(t,e,r,i){for(var o=this.positionArray,s=this.indicesArray,u=this.offsetArray,l=this.rootNodePacked,c=new Float32Array(l),d=new Uint32Array(l),f=new Uint16Array(l),p=r*r,v=new BVHVector3(1/e.x,1/e.y,1/e.z),A=[0],m,y,h,g;(m=A.pop())!==void 0;)if(g=m*BYTES_PER_NODE/4,intersectNodeBox(t,v,c[g],c[g+1],c[g+2],c[g+3],c[g+4],c[g+5],r)){for(var b=d[g+6],T=d[g+7],E=void 0,_=void 0,x=void 0,w=void 0,S=void 0,C=void 0,M=void 0,I=void 0,F=void 0,B=void 0,L=void 0,k=void 0,O=void 0;b<T;b++)E=u[b],_=(s?s[E]:E)*3,x=o[_],w=o[++_],S=o[++_],C=t.x,M=t.y,I=t.z,F=e.x,B=e.y,L=e.z,k=F*(x-C)+B*(w-M)+L*(S-I),k>0&&(C+=F*k,M+=B*k,I+=L*k),F=x-C,B=w-M,L=S-I,k=F*F+B*B+L*L,k<=p&&i.push(new BVHIntersect([x,w,S,x,w,S,x,w,S],[C,M,I],E));g=m*BYTES_PER_NODE/2,y=f[g+16],h=f[g+17],y&&A.push(y),h&&A.push(h)}return i},n}();const encodedJs$1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBYPWZ1bmN0aW9uKCl7ZnVuY3Rpb24gaChyLGksdixvLHMpe3RoaXMuaWQ9cix0aGlzLmV4dGVudHM9aSx0aGlzLnN0YXJ0SW5kZXg9dix0aGlzLmVuZEluZGV4PW8sdGhpcy5kZWVwdGg9c31yZXR1cm4gaH0oKSxSPTYqNCs0KzQrMisyO2Z1bmN0aW9uIG5yKGgscil7Zm9yKHZhciBpPW5ldyBBcnJheUJ1ZmZlcihyKlIpLHY9bmV3IEZsb2F0MzJBcnJheShpKSxvPW5ldyBVaW50MzJBcnJheShpKSxzPW5ldyBVaW50MTZBcnJheShpKSxlPVtoXSxhLG47YT1lLnBvcCgpOyluPWEuaWQqUi80LHZbbl09YS5leHRlbnRzWzBdLHZbbisxXT1hLmV4dGVudHNbMV0sdltuKzJdPWEuZXh0ZW50c1syXSx2W24rM109YS5leHRlbnRzWzNdLHZbbis0XT1hLmV4dGVudHNbNF0sdltuKzVdPWEuZXh0ZW50c1s1XSxvW24rNl09YS5zdGFydEluZGV4LG9bbis3XT1hLmVuZEluZGV4LG49YS5pZCpSLzIsYS5ub2RlMCYmKHNbbisxNl09YS5ub2RlMC5pZCxlLnB1c2goYS5ub2RlMCkpLGEubm9kZTEmJihzW24rMTddPWEubm9kZTEuaWQsZS5wdXNoKGEubm9kZTEpKTtyZXR1cm4gaX1mdW5jdGlvbiBhcihoLHIsaSx2LG8scyxlLGEsbil7bj09PXZvaWQgMCYmKG49MCksaT1pLW4sdj12LW4sbz1vLW4scz1zK24sZT1lK24sYT1hK247dmFyIHk9e21pbjowLG1heDowfTtyLng+PTA/KHkubWluPShpLWgueCkqci54LHkubWF4PShzLWgueCkqci54KTooeS5taW49KHMtaC54KSpyLngseS5tYXg9KGktaC54KSpyLngpO3ZhciBmPXttaW46MCxtYXg6MH07aWYoci55Pj0wPyhmLm1pbj0odi1oLnkpKnIueSxmLm1heD0oZS1oLnkpKnIueSk6KGYubWluPShlLWgueSkqci55LGYubWF4PSh2LWgueSkqci55KSx5Lm1pbj5mLm1heHx8Zi5taW4+eS5tYXgpcmV0dXJuITE7Zi5taW4+eS5taW4mJih5Lm1pbj1mLm1pbiksZi5tYXg8eS5tYXgmJih5Lm1heD1mLm1heCk7dmFyIHc9e21pbjowLG1heDowfTtyZXR1cm4gci56Pj0wPyh3Lm1pbj0oby1oLnopKnIueix3Lm1heD0oYS1oLnopKnIueik6KHcubWluPShhLWgueikqci56LHcubWF4PShvLWgueikqci56KSwhKHkubWluPncubWF4fHx3Lm1pbj55Lm1heHx8KHcubWluPnkubWluJ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1pLnRyYW5zZmVyO3JldHVybiBwb3N0TWVzc2FnZSh2LG8pfSkuY2F0Y2goZnVuY3Rpb24oaSl7cmV0dXJuIHBvc3RNZXNzYWdlKHskJGVycm9yOml9KX0pfX1mcihmdW5jdGlvbihoKXtyZXR1cm4gUHJvbWlzZS5yZXNvbHZlKGgpLnRoZW4oZnVuY3Rpb24ocil7Zm9yKHZhciBpPVtdLHY9W10sbz0wLHM9cjtvPHMubGVuZ3RoO28rKyl7dmFyIGU9c1tvXSxhPXZvaWQgMDtpZihlLnR5cGU9PT0ibWVzaCIpYT1uZXcgeXIoZS5wb3NpdGlvbkFycmF5LGUuaW5kaWNlc0FycmF5KTtlbHNlIGlmKGUudHlwZT09PSJwb2ludHMiKWE9bmV3IEFyKGUucG9zaXRpb25BcnJheSxlLmluZGljZXNBcnJheSk7ZWxzZSB0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgVHlwZSIpO2EuY3JlYXRlVHJlZShlLm1heEl0ZW1QZXJOb2RlLGUubWF4VHJlZURlcHRoLGUuZXh0ZW50cyk7dmFyIG49e29mZnNldEFycmF5OmEub2Zmc2V0QXJyYXksaW5kaWNlc0FycmF5OmEuaW5kaWNlc0FycmF5LHBvc2l0aW9uQXJyYXk6YS5wb3NpdGlvbkFycmF5LHJvb3ROb2RlUGFja2VkOmEucm9vdE5vZGVQYWNrZWR9O2kucHVzaChuKTtmb3IodmFyIHkgaW4gbil7dmFyIGY9blt5XTtmJiYoZiBpbnN0YW5jZW9mIEFycmF5QnVmZmVyP3YucHVzaChmKTpmLmJ1ZmZlciBpbnN0YW5jZW9mIEFycmF5QnVmZmVyJiZ2LnB1c2goZi5idWZmZXIpKX19cmV0dXJue291dHB1dDppLHRyYW5zZmVyOnZ9fSl9KX0pKCk7Cg==",blob$2=typeof window!="undefined"&&window.Blob&&new Blob([atob(encodedJs$1)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(n){let t;try{if(t=blob$2&&(window.URL||window.webkitURL).createObjectURL(blob$2),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:application/javascript;base64,"+encodedJs$1,{name:n==null?void 0:n.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var WorkerPool$1=function(){function n(t,e){this.pool=e,this.workerCreator=t,this.queue=[],this.workers=[],this.workersResolver=[],this.workerStatus=0}return n.prototype.initWorker=function(t){if(this.workerCreator&&!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this.onMessage.bind(this,t)),this.workers[t]=e}},n.prototype.getIdleWorker=function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1},n.prototype.onMessage=function(t,e){var r=this.workersResolver[t],i=r.resolve,o=r.reject;if(e.data&&"$$error"in e.data?o(e.data.$$error):i(e.data),this.queue.length){var s=this.queue.shift(),u=s.resolve,l=s.reject,c=s.input,d=s.transfer;this.workersResolver[t]={resolve:u,reject:l},this.workers[t].postMessage(c,d)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(i,o){var s=r.getIdleWorker();s!==-1?(r.initWorker(s),r.workerStatus|=1<<s,r.workersResolver[s]={resolve:i,reject:o},r.workers[s].postMessage(t,e)):r.queue.push({resolve:i,reject:o,input:t,transfer:e})})},n.prototype.dispose=function(){this.workers.forEach(function(t){return t.terminate()}),this.workersResolver.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0},n}(),bvhWorkerPool=new WorkerPool$1(function(){return new WorkerWrapper$1},4),bvhMeshMap=new Map,bvhPointsMap=new Map,scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA$1=new THREE__namespace.Vector3,scratchIntersectionFaceB$1=new THREE__namespace.Vector3,scratchIntersectionFaceC$1=new THREE__namespace.Vector3,scratchIntersectionTriangle=new THREE__namespace.Triangle;function raycastMesh(n,t,e,r){var i,o=n.matrixWorld;scratchInverseMatrix.getInverse(o),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var s=t.intersectRay(scratchRay.origin,scratchRay.direction,[]),u=n.geometry,l=n.material,c=u.groups,d=u.index,f=0,p=s.length;f<p;f++){var v=s[f],A=v.triangle,m=v.index,y=v.intersectionPoint,h=new THREE__namespace.Vector3(y[0],y[1],y[2]).applyMatrix4(o),g=e.ray.origin.distanceTo(h);if(!(g<e.near||g>e.far)){var b=void 0;if(Array.isArray(l)){if(c)for(var T=m*3,E=0,_=c;E<_.length;E++){var x=_[E];if(T>=x.start&&T-x.start<x.count){b=l[(i=x.materialIndex)!==null&&i!==void 0?i:0];break}}}else b=l;if(b){var w=scratchIntersectionTriangle.set(scratchIntersectionFaceA$1.set(A[0],A[1],A[2]).applyMatrix4(o),scratchIntersectionFaceB$1.set(A[3],A[4],A[5]).applyMatrix4(o),scratchIntersectionFaceC$1.set(A[6],A[7],A[8]).applyMatrix4(o)).getNormal(new THREE__namespace.Vector3),S=m*3,C=new THREE__namespace.Face3(d?d.array[S]:S,d?d.array[S+1]:S+1,d?d.array[S+2]:S+2,w),M=e.ray.direction.dot(w);b.side===THREE__namespace.FrontSide&&M>=0||b.side===THREE__namespace.BackSide&&M<=0||r.push({distance:g,object:n,face:C,point:h,distanceToRay:0,faceIndex:m})}}}}function raycastPoints(n,t,e,r){var i,o,s=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(s),scratchInverseMatrix.getInverse(s);var u=((o=(i=e.params.Points)===null||i===void 0?void 0:i.threshold)!==null&&o!==void 0?o:1)*scratchInverseMatrix.getMaxScaleOnAxis();scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var l=t.intersectRay(scratchRay.origin,scratchRay.direction,u,[]),c=n.geometry,d=c.index,f=c.getAttribute("normal"),p=0,v=l.length;p<v;p++){var A=l[p],m=A.triangle,y=A.index,h=A.intersectionPoint,g=new THREE__namespace.Vector3(h[0],h[1],h[2]).applyMatrix4(s),b=e.ray.origin.distanceTo(g);if(!(b<e.near||b>e.far)){var T=scratchIntersectionFaceA$1.set(m[0],m[1],m[2]).applyMatrix4(s),E=d?d.array[y]:y,_=void 0;f instanceof THREE__namespace.BufferAttribute&&(_=new THREE__namespace.Vector3().fromBufferAttribute(f,E).applyNormalMatrix(scratchNormalMatrix));var x=new THREE__namespace.Face3(E,E,E,_);r.push({distance:b,object:n,face:x,point:g,distanceToRay:g.distanceTo(T),index:y})}}}function bindBvhTreeForMesh(n,t){var e=n.raycast,r=function(i,o){var s=bvhMeshMap.get(this);s?raycastMesh(this,s,i,o):e.call(this,i,o)};return n.raycast=r,bvhMeshMap.set(n,t),function(){bvhMeshMap.delete(n),n.raycast===r&&(n.raycast=e)}}function bindBvhTreeForPoints(n,t){var e=n.raycast,r=function(i,o){var s=bvhPointsMap.get(this);s?raycastPoints(this,s,i,o):e.call(this,i,o)};return n.raycast=r,bvhPointsMap.set(n,t),function(){bvhPointsMap.delete(n),n.raycast===r&&(n.raycast=e)}}function generateBvhTree(n,t,e,r){t===void 0&&(t=!0),e===void 0&&(e=100),r===void 0&&(r=10);var i=[];return n.traverse(function(o){if((o instanceof THREE__namespace.Mesh||o instanceof THREE__namespace.Points)&&o.geometry instanceof THREE__namespace.BufferGeometry){var s=o.geometry.getAttribute("position");s instanceof THREE__namespace.BufferAttribute&&i.push(o)}}),t?Promise.resolve().then(function(){for(var o,s,u=[],l=[],c=0;c<i.length;c++){var d=i[c];if(d instanceof THREE__namespace.Mesh){if(d.geometry instanceof THREE__namespace.BufferGeometry){var f=d.geometry.getAttribute("position");if(f instanceof THREE__namespace.BufferAttribute){var p=f.array,v=(o=d.geometry.getIndex())===null||o===void 0?void 0:o.array,A=d.geometry.boundingBox,m=A?[A.min.x,A.min.y,A.min.z,A.max.x,A.max.y,A.max.z]:void 0,y={type:"mesh",positionArray:p,indicesArray:v,maxItemPerNode:e,maxTreeDepth:r,extents:m};u.push(y);for(var h in y){var g=y[h];g&&(g instanceof ArrayBuffer?l.push(g):g.buffer instanceof ArrayBuffer&&l.push(g.buffer))}}}}else if(d instanceof THREE__namespace.Points&&d.geometry instanceof THREE__namespace.BufferGeometry){var f=d.geometry.getAttribute("position");if(f instanceof THREE__namespace.BufferAttribute){var p=f.array,v=(s=d.geometry.getIndex())===null||s===void 0?void 0:s.array,A=d.geometry.boundingBox,m=A?[A.min.x,A.min.y,A.min.z,A.max.x,A.max.y,A.max.z]:void 0,y={type:"points",positionArray:p,indicesArray:v,maxItemPerNode:e,maxTreeDepth:r,extents:m};u.push(y);for(var b in y){var g=y[b];g&&(g instanceof ArrayBuffer?l.push(g):g.buffer instanceof ArrayBuffer&&l.push(g.buffer))}}}}return bvhWorkerPool.postMessage(u,l)}).then(function(o){for(var s=[],u=0;u<i.length;u++){var l=i[u],c=o[u];if(l instanceof THREE__namespace.Mesh){if(l.geometry instanceof THREE__namespace.BufferGeometry){var d=l.geometry.getAttribute("position");if(d instanceof THREE__namespace.BufferAttribute){d.array=c.positionArray;var f=l.geometry.getIndex();f&&c.indicesArray&&(f.array=c.indicesArray);var p=new BVHMesh(c.positionArray,c.indicesArray);p.offsetArray=c.offsetArray,p.rootNodePacked=c.rootNodePacked;var v=bindBvhTreeForMesh(l,p);s.push(v)}}}else if(l instanceof THREE__namespace.Points&&l.geometry instanceof THREE__namespace.BufferGeometry){var d=l.geometry.getAttribute("position");if(d instanceof THREE__namespace.BufferAttribute){d.array=c.positionArray;var f=l.geometry.getIndex();f&&c.indicesArray&&(f.array=c.indicesArray);var p=new BVHPoints(c.positionArray,c.indicesArray);p.offsetArray=c.offsetArray,p.rootNodePacked=c.rootNodePacked;var v=bindBvhTreeForPoints(l,p);s.push(v)}}}return function(){for(var A=0,m=s;A<m.length;A++){var y=m[A];y()}s.length=0}}):Promise.resolve().then(function(){for(var o,s,u=[],l=0,c=i;l<c.length;l++){var d=c[l];if(d instanceof THREE__namespace.Mesh){if(d.geometry instanceof THREE__namespace.BufferGeometry){var f=d.geometry.getAttribute("position");if(f instanceof THREE__namespace.BufferAttribute){var p=f.array,v=(o=d.geometry.getIndex())===null||o===void 0?void 0:o.array,A=d.geometry.boundingBox,m=A?[A.min.x,A.min.y,A.min.z,A.max.x,A.max.y,A.max.z]:void 0,y=new BVHMesh(p,v);y.createTree(e,r,m);var h=bindBvhTreeForMesh(d,y);u.push(h)}}}else if(d instanceof THREE__namespace.Points&&d.geometry instanceof THREE__namespace.BufferGeometry){var f=d.geometry.getAttribute("position");if(f instanceof THREE__namespace.BufferAttribute){var p=f.array,v=(s=d.geometry.getIndex())===null||s===void 0?void 0:s.array,A=d.geometry.boundingBox,m=A?[A.min.x,A.min.y,A.min.z,A.max.x,A.max.y,A.max.z]:void 0,y=new BVHPoints(p,v);y.createTree(e,r,m);var h=bindBvhTreeForPoints(d,y);u.push(h)}}}return function(){for(var g=0,b=u;g<b.length;g++){var T=b[g];T()}u.length=0}})}var scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,TileNode=function(n){__extends(t,n);function t(e,r){var i=n.call(this)||this;return i.renderOrder=-4,i.disposers=[r],i.add(e),i}return t.prototype.generateBvhTree=function(){var e=this;return generateBvhTree(this,!0,200,10).then(function(r){e.disposers.push(r)})},t.prototype.intersectRaycaster=function(e,r,i){var o=this;r===void 0&&(r=!0),i===void 0&&(i=[]);for(var s=this.children.slice(),u;u=s.pop();)if(u.visible){u.raycast(e,i);for(var l=0,c=u.children.length;l<c;l++)s.push(u.children[l])}return i.forEach(function(d){var f,p,v=0;if((d.object instanceof PBMMesh||d.object instanceof PBMPointCloud)&&d.face){var A=Array.isArray(d.object.material)?d.object.material[d.face.materialIndex]:d.object.material;if(A)if(A.defines.USE_VERTEX_FLOOR){var m=(f=d.object.geometry.attributes.position)===null||f===void 0?void 0:f.array,y=(p=d.object.geometry.attributes.floor)===null||p===void 0?void 0:p.array;if(m&&y){var h=scratchIntersectionFaceA.set(m[d.face.a*3],m[d.face.a*3+1],m[d.face.a*3+2]).applyMatrix4(o.matrixWorld),g=scratchIntersectionFaceB.set(m[d.face.b*3],m[d.face.b*3+1],m[d.face.b*3+2]).applyMatrix4(o.matrixWorld),b=scratchIntersectionFaceC.set(m[d.face.c*3],m[d.face.c*3+1],m[d.face.c*3+2]).applyMatrix4(o.matrixWorld),T=d.point.distanceTo(h),E=d.point.distanceTo(g),_=d.point.distanceTo(b);v=Math.round((T*y[d.face.a]+E*y[d.face.b]+_*y[d.face.c])/(T+E+_))}}else v=A.floor}d.floor=v}),r&&i.sort(function(d,f){return d.distance-f.distance}),i},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var i=r[e];i()}this.disposers.length=0},t}(THREE__namespace.Group);function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(u){return(u!=null?u:"").trim()}).filter(function(u){return u.length>0&&!/^\/+$/.test(u)});for(var r=0;r<n.length;r++){var i=r===0,o=r===n.length-1,s=n[r];i||(s=s.replace(/^\.\//,"").replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),e.push(s)}return e.join("/")}function isAbsoluteURL(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}function normalizeTileHeader(n,t){if(n.content&&n.content.uri&&(isAbsoluteURL(n.content.uri)||(n.content.uri=pathJoin(t,n.content.uri))),n.children)for(var e=0,r=n.children;e<r.length;e++){var i=r[e];normalizeTileHeader(i,t)}return n}function normalizeTilesetHeader(n,t){return n.asset.overview&&(isAbsoluteURL(n.asset.overview.imageFile)||(n.asset.overview.imageFile=pathJoin(t,n.asset.overview.imageFile)),isAbsoluteURL(n.asset.overview.worldFile)||(n.asset.overview.worldFile=pathJoin(t,n.asset.overview.worldFile))),normalizeTileHeader(n.root,t),n}function appendSearch(n,t){return(t[0]==="?"||t[0]==="&")&&(t=t.slice(1)),t?((n[n.length-1]==="?"||n[n.length-1]==="&")&&(n=n.slice(0,-1)),n.indexOf("?")>=0?"".concat(n,"&").concat(t):"".concat(n,"?").concat(t)):n}var SIZEOF_UINT32$1=4;function parseHeader(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.byteLength=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var _a$2,GL_TYPE;(function(n){n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.INT=5124]="INT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.DOUBLE=5130]="DOUBLE"})(GL_TYPE||(GL_TYPE={}));var GL_TYPE_TO_ARRAY_TYPE=(_a$2={},_a$2[GL_TYPE.DOUBLE]=Float64Array,_a$2[GL_TYPE.FLOAT]=Float32Array,_a$2[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$2[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$2[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$2[GL_TYPE.BYTE]=Int8Array,_a$2[GL_TYPE.SHORT]=Int16Array,_a$2[GL_TYPE.INT]=Int32Array,_a$2),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(n){var t=GL_TYPE_TO_ARRAY_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(n){var t=getArrayType(n);return t.BYTES_PER_ELEMENT}function createTypedArray(n,t,e,r){e===void 0&&(e=0);var i=getArrayType(n);if(e%getByteSize(n)!==0){var o=r?t.slice(e,e+r*getByteSize(n)):t.slice(e);return new i(o)}else return new i(t,e,r!=null?r:(t.byteLength-e)/getByteSize(n))}function glTypeFromName(n){var t=NAME_TO_GL_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return n.prototype.getExtension=function(t){return this.json.extensions&&this.json.extensions[t]},n.prototype.hasProperty=function(t){return!!this.json[t]},n.prototype.getGlobalProperty=function(t,e,r){var i=this.json[t];if(typeof i=="number"){var o=getArrayType(e);return new o([i])}else if(Array.isArray(i)){var o=getArrayType(e);return new o(i)}else if(i&&Number.isFinite(i.byteOffset))return this.getTypedArrayFromBinary(t,e,r,1,i.byteOffset);return null},n.prototype.getPropertyArray=function(t,e,r){var i=this.json[t];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(e=glTypeFromName(i.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,i.byteOffset)):this.getTypedArrayFromArray(t,e,i)},n.prototype.getProperty=function(t,e,r,i,o){var s=this.json[t];if(!s)return null;var u=this.getPropertyArray(t,e,r);if(r===1)return o[0]=u[i],o;for(var l=0;l<r;++l)o[l]=u[r*i+l];return o},n.prototype.getTypedArrayFromBinary=function(t,e,r,i,o){var s=this.cachedTypedArrays,u=s[t];return u||(u=createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+o,i*r),s[t]=u),u},n.prototype.getTypedArrayFromArray=function(t,e,r){var i=this.cachedTypedArrays,o=i[t];return o||(o=createTypedArray(e,r),i[t]=o),o},n}(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(n,t,e){var r=new TextDecoder("utf8"),i=new Uint8Array(n,t,e),o=r.decode(i);return o}function parseTable(n,t,e){return e=parseTablesHeader(n,t,e),e=parseFeatureTable(n,t,e),e=parseBatchTable(n,t,e),e}function parseTablesHeader(n,t,e){var r=new DataView(t),i=0;n.header=n.header||{};var o=r.getUint32(e,!0);e+=SIZEOF_UINT32;var s=r.getUint32(e,!0);e+=SIZEOF_UINT32;var u=r.getUint32(e,!0);e+=SIZEOF_UINT32;var l=r.getUint32(e,!0);return e+=SIZEOF_UINT32,u>=570425344?(e-=SIZEOF_UINT32*2,i=o,u=s,l=0,o=0,s=0,console.warn(DEPRECATION_WARNING)):l>=570425344&&(e-=SIZEOF_UINT32,i=u,u=o,l=s,o=0,s=0,console.warn(DEPRECATION_WARNING)),n.header.featureTableJsonByteLength=o,n.header.featureTableBinaryByteLength=s,n.header.batchTableJsonByteLength=u,n.header.batchTableBinaryByteLength=l,n.header.batchLength=i,e}function parseFeatureTable(n,t,e){var r=n.header||{},i=r.featureTableJsonByteLength,o=r.featureTableBinaryByteLength,s=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:s||0},i&&i>0){var u=getStringFromArrayBuffer(t,e,i);n.featureTableJson=JSON.parse(u)}e+=i||0,n.featureTableBinary=new Uint8Array(t,e,o),e+=o||0,n.rtcCenter=[0,0,0];var l=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(l.json.RTC_CENTER)){var c=l.json.RTC_CENTER;n.rtcCenter[0]=c[0],n.rtcCenter[1]=c[1],n.rtcCenter[2]=c[2]}else{var c=l.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);c&&(n.rtcCenter[0]=c[0],n.rtcCenter[1]=c[1],n.rtcCenter[2]=c[2])}return e}function parseBatchTable(n,t,e){var r=n.header||{},i=r.batchTableJsonByteLength,o=r.batchTableBinaryByteLength;if(i&&i>0){var s=getStringFromArrayBuffer(t,e,i);n.batchTableJson=JSON.parse(s),e+=i,o&&o>0&&(n.batchTableBinary=new Uint8Array(t,e,o),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=o)}return e}function sliceArrayBuffer(n,t,e){var r=e!==void 0?new Uint8Array(n).subarray(t,t+e):new Uint8Array(n).subarray(t),i=new Uint8Array(r);return i.buffer}function parseGlTFArrayBuffer(n,t,e){var r=n.byteLength-e;if(r===0)throw new Error("glTF byte length must be greater than 0.");return e%4!==0&&console.warn("".concat(n.type,": embedded glb is not aligned to a 4-byte boundary.")),n.gltfArrayBuffer=sliceArrayBuffer(t,e,r),n.byteLength}function decodeText(n){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(n);for(var t="",e=0,r=n.length;e<r;e++)t+=String.fromCharCode(n[e]);try{return decodeURIComponent(escape(t))}catch(i){return t}}var WEBGL_CONSTANTS={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},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(n){var t=[];for(var e in n)t.push(n[e]);return t}var Parser=function(){function n(t,e,r){this.json=t,this.extensions=e,this.options=r,this.cache=new Map,this.disposeSet=new Set,this.nodeNamesUsed={}}return n.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach(function(t){t.dispose()}),this.disposeSet.clear()},n.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],i=0,o=e.length;i<o;i++)for(var s=e[i].joints,u=0,l=s.length;u<l;u++)t[s[u]].isBone=!0;for(var c=0,d=t.length;c<d;c++){var f=t[c];f.mesh!==void 0&&f.skin!==void 0&&(r[f.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.dispose(),this.markDefs();for(var i=0,o=values(r);i<o.length;i++){var s=o[i];s.markDefs(this)}return Promise.all(values(r).map(function(u){return u.prepare(t)})).then(function(){var u,l,c;return Promise.all([Promise.all(((u=e.scenes)!==null&&u!==void 0?u:[]).map(function(d,f){return t.loadScene(f)})),Promise.all(((l=e.animations)!==null&&l!==void 0?l:[]).map(function(d,f){return t.loadAnimation(f)})),Promise.all(((c=e.cameras)!==null&&c!==void 0?c:[]).map(function(d,f){return t.loadCamera(f)}))])}).then(function(u){var l=u[0],c=u[1],d=u[2],f={json:t.json,scene:l[e.scene||0],scenes:l,animations:c,cameras:d,dispose:function(){return t.dispose()}};return Promise.all(values(r).map(function(p){return p.emitResult(f,t)})).then(function(){return f})})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadCamera(t,this),i)break}if(!i){var l=void 0,c=this.json.cameras[t],d=c[c.type];d?c.type==="perspective"?l=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(d.yfov),d.aspectRatio||1,d.znear||1,d.zfar||2e6):c.type==="orthographic"?l=new THREE__namespace.OrthographicCamera(-d.xmag,d.xmag,d.ymag,-d.ymag,d.znear,d.zfar):(console.warn("glTF: Invalid camera type ".concat(c.type,".")),l=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),l=new THREE__namespace.Camera),c.name&&(l.name=this.createUniqueName(c.name)),i=Promise.resolve(l)}return this.cache.set(e,i),i},n.prototype.loadSkin=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;var i,o=this.json.skins[t],s={joints:o.joints};return o.inverseBindMatrices===void 0?i=Promise.resolve(s):i=this.loadAccessor(o.inverseBindMatrices).then(function(u){return u&&(s.inverseBindMatrices=u),s}),this.cache.set(e,i),i},n.prototype.loadAnimation=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadAnimation(t,this),i)break}if(!i){for(var l=this.json,c=l.animations[t],d=[],f=[],p=[],v=[],A=[],m=0,y=c.channels.length;m<y;m++){var h=c.channels[m],g=c.samplers[h.sampler],b=h.target,T=b.node!==void 0?b.node:b.id,E=c.parameters!==void 0?c.parameters[g.input]:g.input,_=c.parameters!==void 0?c.parameters[g.output]:g.output;d.push(this.loadNode(T)),f.push(this.loadAccessor(E)),p.push(this.loadAccessor(_)),v.push(g),A.push(b)}i=Promise.all([Promise.all(d),Promise.all(f),Promise.all(p),Promise.all(v),Promise.all(A)]).then(function(x){for(var w=x[0],S=x[1],C=x[2],M=x[3],I=x[4],F=[],B=function(U,V){var N=w[U],Q=S[U],G=C[U],q=M[U],W=I[U];if(N===void 0)return"continue";N.updateMatrix(),N.matrixAutoUpdate=!0;var z=void 0;switch(PATH_PROPERTIES[W.path]){case PATH_PROPERTIES.weights:z=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:z=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:z=THREE__namespace.VectorKeyframeTrack;break}var X=N.name?N.name:N.uuid,re=q.interpolation!==void 0?INTERPOLATION[q.interpolation]:THREE__namespace.InterpolateLinear,J=[];PATH_PROPERTIES[W.path]===PATH_PROPERTIES.weights?N.traverse(function(ie){ie.morphTargetInfluences&&J.push(ie.name?ie.name:ie.uuid)}):J.push(X);var $=G.array;if(G.normalized){for(var ee=getNormalizedComponentScale($.constructor),oe=new Float32Array($.length),ae=0,ne=$.length;ae<ne;ae++)oe[ae]=$[ae]*ee;$=oe}for(var ae=0,ne=J.length;ae<ne;ae++){var le=new z(J[ae]+"."+PATH_PROPERTIES[W.path],Q.array,$,re);F.push(le)}},L=0,k=w.length;L<k;L++)B(L);var O=c.name?c.name:"animation_"+t;return new THREE__namespace.AnimationClip(O,void 0,F)})}return this.cache.set(e,i),i},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadBuffer(t,this),o)break}if(!o){var c=this.json.buffers[t];o=this.options.fetcher.ajax(this.resolveResouce(c.uri),{responseType:"arraybuffer"}).then(function(d){return d.body})}return this.cache.set(r,o),o},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadBufferView(t,this),i)break}if(!i){var l=this.json.bufferViews[t];i=this.loadBuffer(l.buffer).then(function(c){var d=l.byteLength||0,f=l.byteOffset||0;return c.slice(f,f+d)})}return this.cache.set(e,i),i},n.prototype.loadAccessor=function(t){var e=this,r="accessor:"+t,i=this.cache.get(r);if(i)return i;var o=null;if(!o){var s=this.json.accessors[t];if(s.bufferView===void 0&&s.sparse===void 0)o=Promise.resolve(null);else{var u=[];s.bufferView!==void 0?u.push(this.loadBufferView(s.bufferView)):u.push(Promise.resolve(null)),s.sparse!==void 0&&(u.push(this.loadBufferView(s.sparse.indices.bufferView)),u.push(this.loadBufferView(s.sparse.values.bufferView))),o=Promise.all(u).then(function(l){var c=l[0],d=WEBGL_TYPE_SIZES[s.type],f=WEBGL_COMPONENT_TYPES[s.componentType],p=f.BYTES_PER_ELEMENT,v=p*d,A=s.byteOffset||0,m=s.bufferView!==void 0?e.json.bufferViews[s.bufferView].byteStride:void 0,y=s.normalized===!0,h,g;if(m&&m!==v){var b=Math.floor(A/m),T="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+b+":"+s.count,E=e.cache.get(T);E||(h=new f(c,b*m,s.count*m/p),E=new THREE__namespace.InterleavedBuffer(h,m/p),e.cache.set(T,E)),g=new THREE__namespace.InterleavedBufferAttribute(E,d,A%m/p,y)}else c===null?h=new f(s.count*d):h=new f(c,A,s.count*d),g=new THREE__namespace.BufferAttribute(h,d,y);if(s.sparse!==void 0){var _=WEBGL_TYPE_SIZES.SCALAR,x=WEBGL_COMPONENT_TYPES[s.sparse.indices.componentType],w=s.sparse.indices.byteOffset||0,S=s.sparse.values.byteOffset||0,C=new x(l[1],w,s.sparse.count*_),M=new f(l[2],S,s.sparse.count*d);c!==null&&(g=new THREE__namespace.BufferAttribute(g.array.slice(),g.itemSize,g.normalized));for(var I=0,F=C.length;I<F;I++){var B=C[I];if(g.setX(B,M[I*d]),d>=2&&g.setY(B,M[I*d+1]),d>=3&&g.setZ(B,M[I*d+2]),d>=4&&g.setW(B,M[I*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}}return this.cache.set(r,o),o},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var i=r[e],o=i.createPrimitiveKey(t,this);if(o)return o}for(var s="",u=Object.keys(t.attributes).sort(),l=0,c=u.length;l<c;l++)s+=u[l]+":"+t.attributes[u[l]]+";";return t.indices+":"+s+":"+t.mode},n.prototype.loadGeometry=function(t){var e=this,r="geometry:"+this.createPrimitiveKey(t),i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadGeometry(t,this),o)break}return o||(o=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,t)),o=o.then(function(c){return e.disposeSet.add(c),c}),this.cache.set(r,o),o},n.prototype.loadImage=function(t){var e="image:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadImage(t,this),i)break}if(!i){var l=this.json.images[t];if(l.bufferView)i=this.loadBufferView(l.bufferView).then(function(d){var f=new Blob([d],{type:l.mimeType});return createImageBitmapLike(f)});else if(l.uri){var c=this.resolveResouce(l.uri);i=this.options.fetcher.loadImage(c,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(d){return d.body})}else throw new Error("glTF: Invalid image defs.")}return this.cache.set(e,i),i},n.prototype.loadMaterialAsMeshStandardMaterial=function(t){var e=this,r=[],i=new THREE__namespace.MeshStandardMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="normal"}).length===0&&(i.flatShading=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.map=d,e.disposeSet.add(d)})),i.metalness=s.metallicFactor!==void 0?s.metallicFactor:1,i.roughness=s.roughnessFactor!==void 0?s.roughnessFactor:1,s.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(s.metallicRoughnessTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.metalnessMap=d,i.roughnessMap=d,e.disposeSet.add(d)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var l=o.alphaMode||ALPHA_MODES.OPAQUE;if(l===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,l===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&(r.push(this.createMaterialTexture(o.normalTexture).then(function(d){i.normalMap=d,e.disposeSet.add(d)})),i.normalScale=new THREE__namespace.Vector2(1,1),o.normalTexture.scale!==void 0)){var c=o.normalTexture.scale;i.normalScale.set(c,c)}o.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(o.occlusionTexture).then(function(d){i.aoMap=d,e.disposeSet.add(d)})),o.occlusionTexture.strength!==void 0&&(i.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&(i.emissive=new THREE__namespace.Color().fromArray(o.emissiveFactor)),o.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(o.emissiveTexture).then(function(d){i.emissiveMap=d,e.disposeSet.add(d)}))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new THREE__namespace.LineBasicMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="color"}).length>0&&(r.vertexColors=!0),Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="tangent"}).length===0&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),t.material!==void 0){var i=this.json.materials[t.material];i.name&&(r.name=i.name);var o=i.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;r.color.fromArray(s),r.opacity=s[3]}i.doubleSided===!0&&(r.side=THREE__namespace.DoubleSide);var u=i.alphaMode||ALPHA_MODES.OPAQUE;u===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,u===ALPHA_MODES.MASK&&(r.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(e).then(function(){return r})},n.prototype.loadMaterialAsPointsMaterial=function(t){var e=this,r=[],i=new THREE__namespace.PointsMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,i.sizeAttenuation=!1,Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(c){c.encoding=THREE__namespace.sRGBEncoding,i.map=c,e.disposeSet.add(c)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var l=o.alphaMode||ALPHA_MODES.OPAQUE;l===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,l===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterial=function(t){var e=this,r,i=(r=t.mode)!==null&&r!==void 0?r:WEBGL_CONSTANTS.TRIANGLES,o="material:"+this.createPrimitiveKey(t),s=this.cache.get(o);if(s)return s;for(var u=null,l=0,c=values(this.extensions);l<c.length;l++){var d=c[l];if(u=d.loadMaterial(t,this),u)break}if(i===WEBGL_CONSTANTS.TRIANGLES||i===WEBGL_CONSTANTS.TRIANGLE_STRIP||i===WEBGL_CONSTANTS.TRIANGLE_FAN)u=this.loadMaterialAsMeshStandardMaterial(t);else if(i===WEBGL_CONSTANTS.LINES||i===WEBGL_CONSTANTS.LINE_STRIP||i===WEBGL_CONSTANTS.LINE_LOOP)u=this.loadMaterialAsLineBasicMaterial(t);else if(i===WEBGL_CONSTANTS.POINTS)u=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+i);return u=u.then(function(f){return e.disposeSet.add(f),f}),this.cache.set(o,u),u},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadTexture(t,this),o)break}if(!o){var c=this.json.textures[t];o=this.loadImage(c.source).then(function(d){var f=new THREE__namespace.Texture(d);f.needsUpdate=!0,f.flipY=!1,c.name&&(f.name=c.name);var p=e.json.samplers||{},v=p[c.sampler]||{};f.magFilter=WEBGL_FILTERS[v.magFilter]||THREE__namespace.LinearFilter,f.minFilter=WEBGL_FILTERS[v.minFilter]||THREE__namespace.LinearMipmapLinearFilter,f.wrapS=WEBGL_WRAPPINGS[v.wrapS]||THREE__namespace.RepeatWrapping,f.wrapT=WEBGL_WRAPPINGS[v.wrapT]||THREE__namespace.RepeatWrapping;var A=f.dispose;return f.dispose=function(){return f.dispose=A,d.close(),A.call(this)},f})}return o=o.then(function(d){return e.disposeSet.add(d),d}),this.cache.set(r,o),o},n.prototype.loadMesh=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadMesh(t,this),r)break}if(!r){var u=this.json.meshes[t],l=u.primitives,c=Promise.all(l.map(function(f){return e.loadGeometry(f)})),d=Promise.all(l.map(function(f){return e.loadMaterial(f)}));r=Promise.all([c,d]).then(function(f){for(var p=f[0],v=f[1],A=[],m=0;m<l.length;m++){var y=l[m],h=p[m],g=v[m],b=y.mode||WEBGL_CONSTANTS.TRIANGLES,T=void 0;if(b===WEBGL_CONSTANTS.TRIANGLES||b===WEBGL_CONSTANTS.TRIANGLE_STRIP||b===WEBGL_CONSTANTS.TRIANGLE_FAN)if(b===WEBGL_CONSTANTS.TRIANGLE_STRIP?h=e.toGeometryTrianglesDrawMode(h,THREE__namespace.TriangleStripDrawMode):b===WEBGL_CONSTANTS.TRIANGLE_FAN&&(h=e.toGeometryTrianglesDrawMode(h,THREE__namespace.TriangleFanDrawMode)),u.isSkinnedMesh){var E=new THREE__namespace.SkinnedMesh(h,g);h.attributes.skinWeight.normalized||E.normalizeSkinWeights(),T=E}else T=new THREE__namespace.Mesh(h,g);else if(b===WEBGL_CONSTANTS.POINTS)T=new THREE__namespace.Points(h,g);else if(b===WEBGL_CONSTANTS.LINES)T=new THREE__namespace.LineSegments(h,g);else if(b===WEBGL_CONSTANTS.LINE_STRIP)T=new THREE__namespace.Line(h,g);else if(b===WEBGL_CONSTANTS.LINE_LOOP)T=new THREE__namespace.LineLoop(h,g);else throw new Error("glTF: Primitive mode unsupported: "+b);if(Object.keys(h.morphAttributes).length>0){if(u.weights!==void 0)for(var _=0,x=u.weights.length;_<x;_++)T.morphTargetInfluences[_]=u.weights[_];if(u.extras&&Array.isArray(u.extras.targetNames)){var w=u.extras.targetNames;if(T.morphTargetInfluences.length===w.length){T.morphTargetDictionary={};for(var _=0,x=w.length;_<x;_++)T.morphTargetDictionary[w[_]]=_}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}T.name=e.createUniqueName(u.name||"mesh_"+t),A.push(T)}if(A.length===1)return A[0];for(var S=new THREE__namespace.Group,C=0,M=A;C<M.length;C++){var T=M[C];S.add(T)}return S})}return r},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,i=values(this.extensions);r<i.length;r++){var o=i[r],s=o.loadNodeAttachments(t,this);s&&e.push(s)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var i=this.json,o=i.nodes[t],s=o.name?this.createUniqueName(o.name):"",u=[];o.mesh!==void 0&&u.push(this.loadMesh(o.mesh).then(function(p){if(o.weights!==void 0){var v=o.weights;p.traverse(function(A){if(A instanceof THREE__namespace.Mesh||A instanceof THREE__namespace.Line||A instanceof THREE__namespace.Points)for(var m=0,y=v.length;m<y;m++)A.morphTargetInfluences[m]=v[m]})}return p})),o.camera!==void 0&&u.push(this.loadCamera(o.camera));for(var l=this.loadNodeAttachments(t),c=0,d=l;c<d.length;c++){var f=d[c];u.push(f)}return Promise.all(u).then(function(p){var v;if(o.isBone===!0?v=new THREE__namespace.Bone:p.length>1?v=new THREE__namespace.Group:p.length===1?v=p[0]:v=new THREE__namespace.Object3D,v!==p[0])for(var A=0,m=p.length;A<m;A++)v.add(p[A]);if(o.name&&(v.name=s),o.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(o.matrix),v.applyMatrix4(y)}else o.translation!==void 0&&v.position.fromArray(o.translation),o.rotation!==void 0&&v.quaternion.fromArray(o.rotation),o.scale!==void 0&&v.scale.fromArray(o.scale);return v})},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],i=new THREE__namespace.Group;r.name&&(i.name=this.createUniqueName(r.name));for(var o=r.nodes||[],s=[],u=0,l=o.length;u<l;u++)s.push(this.buildNodeHierarchy(o[u],i));return Promise.all(s).then(function(){return i})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var i=0,o=values(e.extensions);i<o.length;i++){var s=o[i],u=s.extendTexture(r,t,e);u&&(r=u)}return r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,i=e.attributes,o=[],s=function(E){var _=ATTRIBUTES[E]||E.toLowerCase();if(_ in t.attributes)return"continue";o.push(u.loadAccessor(i[E]).then(function(x){x&&t.setAttribute(_,x)}))},u=this;for(var l in i)s(l);e.indices!==void 0&&!t.index&&o.push(this.loadAccessor(e.indices).then(function(E){E&&t.setIndex(E)}));var c=new THREE__namespace.Box3;if(i.POSITION!==void 0){var d=this.json.accessors[i.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(c.set(new THREE__namespace.Vector3(f[0],f[1],f[2]),new THREE__namespace.Vector3(p[0],p[1],p[2])),d.normalized){var v=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);c.min.multiplyScalar(v),c.max.multiplyScalar(v)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var A=e.targets;if(A!==void 0){for(var m=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,h=0,g=A.length;h<g;h++){var b=A[h];if(b.POSITION!==void 0){var d=this.json.accessors[b.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(y.setX(Math.max(Math.abs(f[0]),Math.abs(p[0]))),y.setY(Math.max(Math.abs(f[1]),Math.abs(p[1]))),y.setZ(Math.max(Math.abs(f[2]),Math.abs(p[2]))),d.normalized){var v=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);y.multiplyScalar(v)}m.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}c.expandByVector(m)}t.boundingBox=c;var T=new THREE__namespace.Sphere;return c.getCenter(T.center),T.radius=c.min.distanceTo(c.max)/2,t.boundingSphere=T,Promise.all(o).then(function(){if(t.attributes.uv&&!t.attributes.uv2&&r.options.copyUV2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var E=!1,_=!1,x=0,w=e.targets.length;x<w;x++){var S=e.targets[x];if(S.POSITION!==void 0&&(E=!0),S.NORMAL!==void 0&&(_=!0),E&&_)break}if(!E&&!_)return t;var C=[];t.morphTargetsRelative=!0;for(var M=function(I,F){var B=e.targets[I];E?C.push(r.loadAccessor(B.POSITION).then(function(L){L&&(t.morphAttributes.position[I]=L)})):t.morphAttributes.position[I]=t.attributes.position,_?C.push(r.loadAccessor(B.NORMAL).then(function(L){L&&(t.morphAttributes.normal[I]=L)})):t.morphAttributes.normal[I]=t.attributes.normal},x=0,w=e.targets.length;x<w;x++)M(x,w);return Promise.all(C).then(function(){return t})}else return t})},n.prototype.buildNodeHierarchy=function(t,e){var r=this,i=this.json.nodes[t];return this.loadNode(t).then(function(o){if(i.skin===void 0)return o;var s;return r.loadSkin(i.skin).then(function(u){s=u;for(var l=[],c=0,d=s.joints.length;c<d;c++)l.push(r.loadNode(s.joints[c]));return Promise.all(l)}).then(function(u){return o.traverse(function(l){if(l instanceof THREE__namespace.SkinnedMesh){for(var c=[],d=[],f=0,p=u.length;f<p;f++){var v=u[f];if(v instanceof THREE__namespace.Bone){c.push(v);var A=new THREE__namespace.Matrix4;s.inverseBindMatrices!==void 0&&A.fromArray(s.inverseBindMatrices.array,f*16),d.push(A)}else console.warn('glTF: Joint "%s" could not be found.',s.joints[f])}l.bind(new THREE__namespace.Skeleton(c,d),l.matrixWorld)}}),o})}).then(function(o){e.add(o);var s=[];if(i.children)for(var u=i.children,l=0,c=u.length;l<c;l++){var d=u[l];s.push(r.buildNodeHierarchy(d,o))}return Promise.all(s).then(function(){return o})})},n.prototype.createUniqueName=function(t){for(var e=THREE__namespace.PropertyBinding.sanitizeNodeName(t||""),r=e,i=1;this.nodeNamesUsed[r];++i)r=e+"_"+i;return this.nodeNamesUsed[r]=!0,r},n.prototype.resolveResouce=function(t){return pathJoin(this.options.resourcePath,appendSearch(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var i=[],o=t.getAttribute("position");if(o!==void 0){for(var s=0;s<o.count;s++)i.push(s);t.setIndex(i),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var u=r.count-2,l=[];if(e===THREE__namespace.TriangleFanDrawMode)for(var s=1;s<=u;s++)l.push(r.getX(0)),l.push(r.getX(s)),l.push(r.getX(s+1));else for(var s=0;s<u;s++)s%2===0?(l.push(r.getX(s)),l.push(r.getX(s+1)),l.push(r.getX(s+2))):(l.push(r.getX(s+2)),l.push(r.getX(s+1)),l.push(r.getX(s)));l.length/3!==u&&console.error("glTF: Unable to generate correct amount of triangles.");var c=t.clone();return c.setIndex(l),c},n}();function getNormalizedComponentScale(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=function(){function n(){}return n.prototype.markDefs=function(t){},n.prototype.prepare=function(t){},n.prototype.emitResult=function(t,e){},n.prototype.createPrimitiveKey=function(t,e){},n.prototype.extendTexture=function(t,e,r){return null},n.prototype.loadBuffer=function(t,e){return null},n.prototype.loadBufferView=function(t,e){return null},n.prototype.loadImage=function(t,e){return null},n.prototype.loadTexture=function(t,e){return null},n.prototype.loadGeometry=function(t,e){return null},n.prototype.loadMaterial=function(t,e){return null},n.prototype.loadMesh=function(t,e){return null},n.prototype.loadNodeAttachments=function(t,e){return null},n.prototype.loadCamera=function(t,e){return null},n.prototype.loadAnimation=function(t,e){return null},n}(),KHR_binary_glTF=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.header={magic:"",version:0,length:0},e.content="",e.body=null,e}return t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var r=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var i=new DataView(e,t.HEADER_LENGTH),o=0,s=null,u=null;o<i.byteLength;){var l=i.getUint32(o,!0);o+=4;var c=i.getUint32(o,!0);if(o+=4,c===t.CHUNK_TYPES.JSON){var d=new Uint8Array(e,t.HEADER_LENGTH+o,l);s=decodeText(d)}else if(c===t.CHUNK_TYPES.BIN){var f=t.HEADER_LENGTH+o;u=e.slice(f,f+l)}o+=l}if(s===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=s,this.body=u},t.prototype.loadBuffer=function(e,r){var i=r.json.buffers[e];return i.uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t}(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=function(){function n(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return n.prototype.setDecoderPath=function(t){this.decoderPath=t},n.prototype.setDecoderConfig=function(t){return this.decoderConfig=t,this},n.prototype.setWorkerLimit=function(t){return this.workerLimit=t,this},n.prototype.decodeDracoFile=function(t,e,r,i){var o={attributeIDs:r||defaultAttributeIDs,attributeTypes:i||defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(t,o).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1});for(var i in e.attributeTypes){var o=e.attributeTypes[i];o.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[i]=o.name)}var s,u=this.workerNextTaskID++,l=t.byteLength,c=this._getWorker(u,l).then(function(d){return s=d,new Promise(function(f,p){s._callbacks[u]={resolve:f,reject:p},s.postMessage({type:"decode",id:u,taskConfig:e,buffer:t},[t])})}).then(function(d){return r._createGeometry(d.geometry)});return c.catch(function(){return!0}).then(function(){s&&u&&r._releaseTask(s,u)}),c},n.prototype._createGeometry=function(t){var e=new THREE__namespace.BufferGeometry;t.index&&e.setIndex(new THREE__namespace.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var i=t.attributes[r],o=i.name,s=i.array,u=i.itemSize;e.setAttribute(o,new THREE__namespace.BufferAttribute(s,u))}return e},n.prototype._initDecoder=function(){var t=this;if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!="object"||this.decoderConfig.type==="js";if(e){var r=ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(o){return o.body});this.decoderPending=r.then(function(o){var s=["/* draco decoder */",o,"","/* worker */",DRACOWorker].join(`
418
418
  `);t.workerSourceURL=URL.createObjectURL(new Blob([s]))})}else{var r=ajax(this.decoderPath+"draco_wasm_wrapper.js",{responseType:"text"}).then(function(s){return s.body}),i=ajax(this.decoderPath+"draco_decoder.wasm",{responseType:"arraybuffer"}).then(function(s){return s.body});this.decoderPending=Promise.all([r,i]).then(function(s){var u=s[0],l=s[1];t.decoderConfig.wasmBinary=l;var c=["/* draco decoder */",u,"","/* worker */",DRACOWorker].join(`
419
419
  `);t.workerSourceURL=URL.createObjectURL(new Blob([c]))})}return this.decoderPending},n.prototype._getWorker=function(t,e){var r=this;return this._initDecoder().then(function(){if(r.workerPool.length<r.workerLimit){var i=new Worker(r.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:r.decoderConfig}),i.onmessage=function(s){var u=s.data;switch(u.type){case"decode":i._callbacks[u.id].resolve(u);break;case"error":i._callbacks[u.id].reject(u);break;default:console.error('DRACO: Unexpected message, "'+u.type+'"')}},r.workerPool.push(i)}else r.workerPool.sort(function(s,u){return s._taskLoad>u._taskLoad?-1:1});var o=r.workerPool[r.workerPool.length-1];return o._taskCosts[t]=e,o._taskLoad+=e,o})},n.prototype._releaseTask=function(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]},n.prototype.dispose=function(){for(var t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this},n}(),draco=new Draco,DRACOWorker=`
420
420
  let decoderConfig;
@@ -1818,7 +1818,7 @@ void main() {
1818
1818
  `,e},t.prototype.updateShaderSource=function(){var e=this.getDefines()+edlVertexShader,r=this.getDefines()+edlFragmentShader;this.setValues({vertexShader:e,fragmentShader:r}),this.needsUpdate=!0},__decorate([uniform$1("screenWidth"),__metadata("design:type",Number)],t.prototype,"screenWidth",void 0),__decorate([uniform$1("screenHeight"),__metadata("design:type",Number)],t.prototype,"screenHeight",void 0),__decorate([uniform$1("edlStrength"),__metadata("design:type",Number)],t.prototype,"edlStrength",void 0),__decorate([uniform$1("uNear"),__metadata("design:type",Number)],t.prototype,"uNear",void 0),__decorate([uniform$1("uFar"),__metadata("design:type",Number)],t.prototype,"uFar",void 0),__decorate([uniform$1("radius"),__metadata("design:type",Number)],t.prototype,"radius",void 0),__decorate([uniform$1("neighbours",!0),__metadata("design:type",Float32Array)],t.prototype,"neighbours",void 0),__decorate([uniform$1("depthMap"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"depthMap",void 0),__decorate([uniform$1("uEDLColor"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"uEDLColor",void 0),__decorate([uniform$1("uEDLDepth"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"uEDLDepth",void 0),__decorate([uniform$1("uProj"),__metadata("design:type",Array)],t.prototype,"uProj",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform$1(n,t){return{type:n,value:t}}function uniform$1(n,t){return t===void 0&&(t=!1),function(e,r){Object.defineProperty(e,r,{get:function(){return this.getUniform(n)},set:function(i){i!==this.getUniform(n)&&(this.setUniform(n,i),t&&this.updateShaderSource())}})}}var passCamera$1=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$2=new THREE__namespace.BufferGeometry;geometry$2.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$2.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$2=new THREE__namespace.Mesh(geometry$2),edlEffectScene=new THREE__namespace.Scene;edlEffectScene.add(mesh$2);var EDLEffect=function(n){__extends(t,n);function t(e,r,i,o){var s=n.call(this,e,r,i,o)||this;return s.sharedV2=new THREE__namespace.Vector2,s.renderer=e,s.material=new EDLMaterial,mesh$2.material=s.material,s}return t.prototype.render=function(e){var r=this.camera,i=this.material.uniforms,o=this.renderer.getSize(this.sharedV2);i.screenWidth.value=o.x,i.screenHeight.value=o.y;var s=r.projectionMatrix,u=new Float32Array(16);u.set(s.elements);for(var l=new Float32Array(this.material.neighbourCount*2),c=0;c<this.material.neighbourCount;c++)l[2*c+0]=Math.cos(2*c*Math.PI/this.material.neighbourCount),l[2*c+1]=Math.sin(2*c*Math.PI/this.material.neighbourCount);i.neighbours.value=l,i.uNear.value=r.near,i.uFar.value=r.far,i.uEDLColor.value=e[0].texture,i.uProj.value=u,i.edlStrength.value=.25,i.radius.value=1,i.opacity.value=1,this.renderer.setRenderTarget(null),this.renderer.render(edlEffectScene,passCamera$1)},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect);const fragment=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}(`}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{H{vs|z-nz}yr?Q-drvtuZn}H{vs|z-nz}yr?Q-Qr}uZn}Hn\bv{t-rp?-bH|vq-znv{56-
1819
1819
  sy|n-qr}u-J-r\x07r?Q5Qr}uZn}9-b6;Hvs5qr}u-KJ->;=6
1820
1820
  qvpnqH\frpA-p|y|-J-r\x07r?Q5drvtuZn}9-b6H-p|y|-J-p|y|-<-p|y|;HtylSntP|y|-J-rpA5p|y|;\x07\b 9->;=6H-\f`),vertex=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}(`}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{Znv\x07H{vs|z-znA-z|qrycvrZnv\x07Hn\bv{t-rp?-bH|vq-znv{56-
1821
- b-J-Htyl]|vv|{-J-}|wrpv|{Znv\x07-7-z|qrycvrZnv\x07-7-rpA5}|vv|{9>;=6H\f`);var HQMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{vertexShader:vertex,fragmentShader:fragment})||this;return r.uniforms={uDepthMap:makeUniform("t",null),uWeightMap:makeUniform("t",null)},r.depthTest=!0,r.depthWrite=!0,r.opacity=1,r}return t.prototype.getUniform=function(e){return this.uniforms===void 0?void 0:this.uniforms[e].value},t.prototype.setUniform=function(e,r){if(this.uniforms!==void 0){var i=this.uniforms[e];i.value=r}},__decorate([uniform("uDepthMap"),__metadata("design:type",Number)],t.prototype,"uDepthMap",void 0),__decorate([uniform("uWeightMap"),__metadata("design:type",Number)],t.prototype,"uWeightMap",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform(n,t){return{type:n,value:t}}function uniform(n,t){return t===void 0&&(t=!1),function(e,r){Object.defineProperty(e,r,{get:function(){return this.getUniform(n)},set:function(i){i!==this.getUniform(n)&&(this.setUniform(n,i),t&&this.updateShaderSource())}})}}var passCamera=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$1=new THREE__namespace.BufferGeometry;geometry$1.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$1.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$1=new THREE__namespace.Mesh(geometry$1),hqScene=new THREE__namespace.Scene;hqScene.add(mesh$1);var HQEffect=function(n){__extends(t,n);function t(e,r,i,o){var s=n.call(this,e,r,i,o)||this;return s.sharedV2=new THREE__namespace.Vector2,s.renderer=e,s.material=new HQMaterial,s.scene=r,s.camera=i,mesh$1.material=s.material,s}return t.prototype.render=function(e){var r=this.material.uniforms;this.models.setMaterial({useHQWeight:!0,useHQDepth:!1}),this.renderer.setRenderTarget(e[1]),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearDepth=!1,this.renderer.setClearAlpha(0),this.renderer.render(this.scene,this.camera),r.uWeightMap.value=e[1].texture,r.uDepthMap.value=e[0].depthTexture,this.renderer.setRenderTarget(null),this.renderer.autoClearDepth=!0,this.renderer.setClearAlpha(1),this.renderer.render(hqScene,passCamera),this.models.setMaterial({useHQWeight:!1,useHQDepth:!0}),this.models.update(this.renderer,this.camera,"Mapview")},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect),RAYCASTER_NEAR=.5,minDistance=0,MapviewController=function(n){__extends(t,n);function t(e){var r=this,i,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(i=r.models.getMaterial().modelAlpha)!==null&&i!==void 0?i:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.currentTapId=null,r.helper.add(r.intersectMesh),r.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),r.edlEffect=new EDLEffect(r.renderer,r.scene,r.camera,r.models),r.hqEffect=new HQEffect(r.renderer,r.scene,r.camera,r.models),r}return t.parseArgs=function(e){var r,i,o,s,u,l;if(e instanceof t)return e;var c=n.parseArgs.call(this,e);return __assign(__assign({},c),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:Math.PI/4,defaultLatitude:(i=e.defaultLatitude)!==null&&i!==void 0?i:Math.PI/4,defaultDistance:(o=e.defaultDistance)!==null&&o!==void 0?o:150,maxLatitude:(s=e.maxLatitude)!==null&&s!==void 0?s:+Math.PI/2,minLatitude:(u=e.minLatitude)!==null&&u!==void 0?u:0,intersectMeshCreator:(l=e.intersectMeshCreator)!==null&&l!==void 0?l:function(){return new IntersectMesh}})},t.distanceFromModel=function(e,r,i){var o=e.bounding,s=Math.pow(Math.pow(o.max.x-o.min.x+1,2)+Math.pow(o.max.y-o.min.y+1,2)+Math.pow(o.max.z-o.min.z+1,2),1/2),u=s/2/Math.tan(Math.PI*r/360);return i<1&&(u=u/i),isNaN(u)?s:u},t.initAnimationEndState=function(e){var r,i,o,s,u,l,c,d=this.parseArgs(e),f=d.works,p=d.models,v=e.initial,A=v.state,m=v.currentState,y=typeof A.panoIndex=="number"?{workCode:(o=(r=A.workCode)!==null&&r!==void 0?r:(i=d.works[0])===null||i===void 0?void 0:i.workCode)!==null&&o!==void 0?o:"",panoIndex:A.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},h=f.getResolvedObserver(y),g=(s=A.fov)!==null&&s!==void 0?s:60,b=clamp((u=A.latitude)!==null&&u!==void 0?u:isThirdPersonMode(m.mode)?m.latitude:d.defaultLatitude,d.minLatitude,d.maxLatitude),T=t.distanceFromModel(d.models,g,d.camera.aspect),E=new THREE__namespace.Vector3,_=(l=A.distance)!==null&&l!==void 0?l:Math.min(d.defaultDistance,T),x=(c=A.longitude)!==null&&c!==void 0?c:isThirdPersonMode(m.mode)?m.longitude:d.defaultLongitude;return A.offset?E.copy(A.offset):d.defaultDistance<T&&h?(E.copy(h.position),A.longitude===void 0&&(x=m.longitude)):E.copy(p.bounding.getCenter(E)),p.bounding.containsPoint(E)||p.bounding.getCenter(E),__assign(__assign({},y),{mode:"Mapview",longitude:x,latitude:b,fov:g,offset:E,distance:_})},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,i,o){this.userAction=o,this.works=e;var s=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:i,state:r,userAction:o}}));this.currentPano={workCode:s.workCode,panoIndex:s.panoIndex};var u={longitude:s.longitude,latitude:s.latitude,fov:s.fov},l={x:s.offset.x,y:s.offset.y,z:s.offset.z,distance:s.distance,orthoDistance:s.distance};return this.locationMotion.set(l,i).catch(noop$1),this.cameraMotion.set(u,i).catch(noop$1),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e)},t.prototype.updateCamera=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();var s={},u={};return e.distance!==void 0&&(s.distance=e.distance),e.offset!==void 0&&(s.x=e.offset.x,s.y=e.offset.y,s.z=e.offset.z),e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),o.locationMotion.set(s,r).catch(noop$1),o.cameraMotion.set(u,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();for(var s=[],u=[],l=0,c=e;l<c.length;l++){var d=c[l];s.push({key:d.key,progress:d.progress,value:{distance:d.value.distance,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),u.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return o.locationMotion.setKeyframes(s,r).catch(noop$1),o.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var i={},o={};if(this.locationMotion.ended||(this.locationMotion.update(e),o.distance=this.locationMotion.value.distance,o.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),!this.cameraMotion.ended){this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov;var s=Math.PI/2-o.latitude<.02?1:0;this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==s&&this.perspToOrthoMotion.set({perspToOrtho:s},500).catch(noop$1)}this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(i)||this.models.setMaterial(i),isEmptyObject(o)||this.setCamera(o)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var i=e.initial;i.state,i.currentState;var o=i.duration,s=i.userAction;e.userAction=s;var u=t.initAnimationEndState(e),l={longitude:u.longitude,latitude:u.latitude,fov:u.fov},c={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance},d={modelAlpha:1},f={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:u,userAction:e.userAction})),e.perspToOrthoMotion.set(f,o).catch(noop$1),e.modelAlphaMotion.set(d,o/3).catch(noop$1),e.cameraMotion.set(l,o).catch(noop$1),e.locationMotion.set(c,o).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:u,userAction:e.userAction}))},function(p){var v=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:v,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this.models.intersectRaycaster(e)[0];if(!r)return null;var i=this.works.resolvedObservers,o=arrayMin(i,function(l){return l.standingPosition.distanceTo(r.point)},!0),s=o[0],u=o[1];return s&&u<10?s:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.scissor.width),latitude:2*e.y/(r.y*this.scissor.height)}},t.prototype.requestMomentumMovement=function(e,r,i,o){var s=this;if(this.inMomentumMovement!==null){for(var u=__assign({},i),l={longitude:0,latitude:0,x:0,y:0,z:0},c=0;c<o;c++)u.longitude*=.996,u.latitude*=.996*.998,u.x*=.99,u.y*=.99,u.z*=.99,l.longitude+=u.longitude,l.latitude+=u.latitude,l.x+=u.x,l.y+=u.y,l.z+=u.z;var d=formatRad(this.cameraMotion.value.longitude+l.longitude),f=clamp(this.cameraMotion.value.latitude+l.latitude,this.minLatitude,this.maxLatitude),p=clamp(this.locationMotion.value.x+l.x,this.models.bounding.min.x,this.models.bounding.max.x),v=clamp(this.locationMotion.value.y+l.y,this.models.bounding.min.y,this.models.bounding.max.y),A=clamp(this.locationMotion.value.z+l.z,this.models.bounding.min.z,this.models.bounding.max.z),m=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:f,offset:new THREE__namespace.Vector3(p,v,A),fov:this.cameraMotion.value.fov,distance:this.camera.pose.distance}),y=!(Math.abs(u.longitude)>1e-4||Math.abs(u.latitude)>1e-4||Math.abs(u.x)>1e-4||Math.abs(u.y)>1e-4||Math.abs(u.z)>1e-4),h=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:y,state:m}));if(this.inMomentumMovement.event=h,this.emit("gesture.momentum",h),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:f},0).catch(noop$1),this.locationMotion.set({x:m.offset.x,y:m.offset.y,z:m.offset.z},0).catch(noop$1),y?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(g,b){s.requestMomentumMovement(e,!1,u,b|0)},!0,1))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),i=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),o=new THREE__namespace.Raycaster(i,r);o.params.Points={threshold:.1},o.near=RAYCASTER_NEAR;var s=this.models.intersectRaycaster(o)[0];if(!s&&o.ray.direction.y<-.3){var u=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),l=o.ray.intersectPlane(u,new THREE__namespace.Vector3);if(l){var c=l.distanceTo(o.ray.origin);c<1e4&&c>=o.near&&(s={distance:c,floor:0,point:l,object:this.scene,face:null})}}s&&(e.distance=clamp(s.distance,minDistance,1/0),e.offset.copy(i).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,i=this.panState,o=0;e.pointerType==="mouse"&&(o=e.srcEvent.buttons),i&&o===0&&i.buttons!==0&&(o=i.buttons);var s=i==null?void 0:i.target;if(!s){var u=this.relativeClientPosition(e.center),l=new THREE__namespace.Raycaster;l.params.Points={threshold:.1},l.setFromCamera(u,this.camera),l.near=RAYCASTER_NEAR,s=new THREE__namespace.Vector3().copy(l.ray.direction).multiplyScalar(3).add(l.ray.origin);var c=this.models.intersectRaycaster(l)[0];if(!c&&l.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),f=l.ray.intersectPlane(d,new THREE__namespace.Vector3);if(f){var p=f.distanceTo(l.ray.origin);p<1e4&&p>=l.near&&(c={distance:p,floor:0,point:f,object:this.scene})}}if(c)s.copy(c.point);else{var v=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(v,this.camera.pose.offset);l.ray.intersectPlane(d,s)}}if(e.isFinal?delete this.panState:this.panState={target:s,buttons:o,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof i=="undefined"||i.pointerLength!==r)){var A=r>1||o===2;if(A){var m={x:e.center.x-i.x,y:e.center.y-i.y},y=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),h=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(y),g=new THREE__namespace.Vector3().copy(h).sub(i.target).length();g*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var b=this.renderer.getSize(new THREE__namespace.Vector2),T=2*m.x*g/b.y,E=2*m.y*g/b.y,_=new THREE__namespace.Vector3;_.setFromMatrixColumn(this.camera.matrix,0),_.multiplyScalar(-T),y.add(_),this.camera.pose.latitude<Math.PI/9?_.setFromMatrixColumn(this.camera.matrix,1):(_.setFromMatrixColumn(this.camera.matrix,0),_.crossVectors(this.camera.up,_)),_.multiplyScalar(E),y.add(_),y.clamp(this.models.bounding.min,this.models.bounding.max);var x=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:y,distance:this.camera.pose.distance});if(e.state=x,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:x.offset.x,y:x.offset.y,z:x.offset.z},0).catch(noop$1),e.isFinal&&(this.fixFinalState(x),this.locationMotion.set({distance:x.distance,x:x.offset.x,y:x.offset.y,z:x.offset.z},0).catch(noop$1)),e.isFinal){var w=this.renderer.getSize(new THREE__namespace.Vector2),S=2*e.velocityX*g/w.y,C=2*e.velocityY*g/w.y,M=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3;M.setFromMatrixColumn(this.camera.matrix,0),M.multiplyScalar(-S),I.add(M),this.camera.pose.latitude<Math.PI/4?M.setFromMatrixColumn(this.camera.matrix,1):(M.setFromMatrixColumn(this.camera.matrix,0),M.crossVectors(this.camera.up,M)),M.multiplyScalar(C),I.add(M),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:I.x,y:I.y,z:I.z},0)}}else{var m={x:e.center.x-i.x,y:e.center.y-i.y},F=this.coordinatesForOffset(m),B=formatRad(this.cameraMotion.value.longitude+F.longitude),L=clamp(this.cameraMotion.value.latitude+F.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(L=this.cameraMotion.value.latitude);var x=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:B,latitude:L,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&this.fixFinalState(x),e.state=x,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:x.distance,x:x.offset.x,y:x.offset.y,z:x.offset.z},0).catch(noop$1):this.cameraMotion.set({longitude:x.longitude,latitude:x.latitude},0).catch(noop$1),e.isFinal){var k=e.velocityX,O=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:k,y:O})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var i=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(e.isFinal){delete this.panState,delete this.pinchState;return}if(typeof i!="undefined"){var o=this.models.bounding.getCenter(new THREE__namespace.Vector3),s=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),u=clamp(i/e.scale,minDistance,1/0),l=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(u)),c=this.models.bounding.containsPoint(l),d;!c&&this.pinchState&&this.pinchState.scale>e.scale&&o.distanceTo(l)>s?d=e.state.distance:(d=u,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=d,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop$1),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)))}},t.prototype.onMouseMove=function(e){var r,i;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var o=e.center.raycaster;if(o.near=RAYCASTER_NEAR,o.far=500,e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var s=this.models.intersectRaycaster(o)[0],u=createEvent("intersect.update",{raycaster:o,intersection:s!=null?s:null,object:this.intersectMesh});if(this.emit("intersect.update",u),u.defaultPrevented){this.hideIntersectMesh();return}if(s){var l=(i=(r=s.face)===null||r===void 0?void 0:r.normal)!==null&&i!==void 0?i:new THREE__namespace.Vector3().copy(o.ray.direction).multiplyScalar(-1),c=l.clone().multiplyScalar(.05),d=s.point.clone().add(c);this.intersectMesh.position.copy(d);var f=d.clone().add(c);if(this.intersectMesh.lookAt(f),Math.abs(l.y)>.99){var p=this.camera.position.clone().sub(d);this.intersectMesh.rotation.z=-Math.atan2(p.z,p.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var i={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(i,0).catch(noop$1)}else{var o=e.center.delta/2*Math.max(Math.log(this.locationMotion.value.distance),1),s=this.models.bounding.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),l=clamp(this.locationMotion.value.distance-o,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(l)),d=this.models.bounding.containsPoint(c),f=!d&&o<0&&s.distanceTo(c)>u?e.state.distance:l;if(e.state.distance=l,this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:f},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=e.userAction,this.stopMomentumMovement();var i=e.center.raycaster,o=this.getForwardObserverOrNot(i);if(!o)this.emit("gesture.tap",e);else{var s={longitude:this.camera.pose.longitude,latitude:0},u=__assign(__assign({},e.state),{mode:"Panorama",workCode:o.pano.workCode,panoIndex:o.pano.panoIndex,longitude:s.longitude,latitude:s.latitude,offset:o?o.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=u,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:u,userAction:e.userAction,options:s,progress:0,error:null})),o&&o.active)){var l=this.currentTapId=createUuid();this.preloadPano(o.pano).then(function(c){r.currentTapId===l&&r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:u,options:s,error:null}))})}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t.prototype.postProcessing=function(e,r){var i;if(!this.destroyed){if(r==="edl")return this.edlEffect.render(e);if(r==="hq")return(i=this.hqEffect)===null||i===void 0?void 0:i.render(e)}},t}(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var i=null,o=null,s=null,u=this._targetRay,l=this._grip,c=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(u!==null&&(i=e.getPose(t.targetRaySpace,r),i!==null&&(u.matrix.fromArray(i.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),i.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(i.linearVelocity)):u.hasLinearVelocity=!1,i.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(i.angularVelocity)):u.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),c&&t.hand){s=!0;for(var d=0,f=t.hand.values();d<f.length;d++){var p=f[d],v=e.getJointPose(p,r);if(c.joints[p.jointName]===void 0){var A=new THREE__namespace.Group;A.matrixAutoUpdate=!1,A.visible=!1,c.joints[p.jointName]=A,c.add(A)}var m=c.joints[p.jointName];v!==null&&(m.matrix.fromArray(v.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=v.radius),m.visible=v!==null}var y=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],g=y.position.distanceTo(h.position),b=.02,T=.005;c.inputState.pinching&&g>b+T?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&g<=b-T&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(o=e.getPose(t.gripSpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1));return u!==null&&(u.visible=i!==null),l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),this},n}(),framebufferScaleFactor=1,XRManager=function(){function n(t,e,r){var i,o,s,u,l;this.isPanorama=(i=r==null?void 0:r.isPanorama)!==null&&i!==void 0?i:!0,this.machineType=(o=r==null?void 0:r.machineType)!==null&&o!==void 0?o:"Pico",this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(s=r==null?void 0:r.referenceSpaceType)!==null&&s!==void 0?s:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(u=r==null?void 0:r.onSessionStart)!==null&&u!==void 0?u:noop$1,this.onSessionEndCallback=(l=r==null?void 0:r.onSessionEnd)!==null&&l!==void 0?l:noop$1,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var i=this.cameraLPos.distanceTo(this.cameraRPos),o=e.projectionMatrix.elements,s=r.projectionMatrix.elements,u=o[14]/(o[10]-1),l=o[14]/(o[10]+1),c=(o[9]+1)/o[5],d=(o[9]-1)/o[5],f=(o[8]-1)/o[0],p=(s[8]+1)/s[0],v=u*f,A=u*p,m=i/(-f+p),y=m*-f;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var h=u+m,g=l+m,b=v-y,T=A+(i-y),E=c*l/g*h,_=d*l/g*h;t.projectionMatrix.makePerspective(b,T,E,_,h,g)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var i=0;i<r.length;i++)this.updateCamera(r[i],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var o=t.children,i=0,s=o.length;i<s;i++)o[i].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var i=t.removed[r],o=this.inputSourcesMap.get(i);o&&(o.dispatchEvent({type:"disconnected",data:i}),this.inputSourcesMap.delete(i))}for(var r=0;r<t.added.length;r++){var i=t.added[r],o=this.inputSourcesMap.get(i);o&&o.dispatchEvent({type:"connected",data:i})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectstart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeeze",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezestart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezeend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("end",function(i){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var i={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,i)});break;case"Oculus":e.session.updateRenderState({layers:[new XRWebGLLayer(e.session,e.gl,i)]});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(o){e.onRequestReferenceSpace(o)}),e.session.addEventListener("inputsourceschange",function(o){e.updateInputSources(o)})})}},n}(),LineSegmentsGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],i=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(o),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(i,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,i=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),i.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),i.setFromBufferAttribute(r),this.boundingBox.union(i)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var o=0,s=new THREE__namespace.Vector3,u=0,l=e.count;u<l;u++)s.fromBufferAttribute(e,u),o=Math.max(o,i.distanceToSquared(s)),s.fromBufferAttribute(r,u),o=Math.max(o,i.distanceToSquared(s));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t}(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
1821
+ b-J-Htyl]|vv|{-J-}|wrpv|{Znv\x07-7-z|qrycvrZnv\x07-7-rpA5}|vv|{9>;=6H\f`);var HQMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{vertexShader:vertex,fragmentShader:fragment})||this;return r.uniforms={uDepthMap:makeUniform("t",null),uWeightMap:makeUniform("t",null)},r.depthTest=!0,r.depthWrite=!0,r.opacity=1,r}return t.prototype.getUniform=function(e){return this.uniforms===void 0?void 0:this.uniforms[e].value},t.prototype.setUniform=function(e,r){if(this.uniforms!==void 0){var i=this.uniforms[e];i.value=r}},__decorate([uniform("uDepthMap"),__metadata("design:type",Number)],t.prototype,"uDepthMap",void 0),__decorate([uniform("uWeightMap"),__metadata("design:type",Number)],t.prototype,"uWeightMap",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform(n,t){return{type:n,value:t}}function uniform(n,t){return t===void 0&&(t=!1),function(e,r){Object.defineProperty(e,r,{get:function(){return this.getUniform(n)},set:function(i){i!==this.getUniform(n)&&(this.setUniform(n,i),t&&this.updateShaderSource())}})}}var passCamera=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$1=new THREE__namespace.BufferGeometry;geometry$1.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$1.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$1=new THREE__namespace.Mesh(geometry$1),hqScene=new THREE__namespace.Scene;hqScene.add(mesh$1);var HQEffect=function(n){__extends(t,n);function t(e,r,i,o){var s=n.call(this,e,r,i,o)||this;return s.sharedV2=new THREE__namespace.Vector2,s.renderer=e,s.material=new HQMaterial,s.scene=r,s.camera=i,mesh$1.material=s.material,s}return t.prototype.render=function(e){var r=this.material.uniforms;this.models.setMaterial({useHQWeight:!0,useHQDepth:!1}),this.renderer.setRenderTarget(e[1]),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearDepth=!1,this.renderer.setClearAlpha(0),this.renderer.render(this.scene,this.camera),r.uWeightMap.value=e[1].texture,r.uDepthMap.value=e[0].depthTexture,this.renderer.setRenderTarget(null),this.renderer.autoClearDepth=!0,this.renderer.setClearAlpha(1),this.renderer.render(hqScene,passCamera),this.models.setMaterial({useHQWeight:!1,useHQDepth:!0}),this.models.update(this.renderer,this.camera,"Mapview")},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect),RAYCASTER_NEAR=.5,minDistance=0,MapviewController=function(n){__extends(t,n);function t(e){var r=this,i,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(i=r.models.getMaterial().modelAlpha)!==null&&i!==void 0?i:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.currentTapId=null,r.helper.add(r.intersectMesh),r.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),r.edlEffect=new EDLEffect(r.renderer,r.scene,r.camera,r.models),r.hqEffect=new HQEffect(r.renderer,r.scene,r.camera,r.models),r}return t.parseArgs=function(e){var r,i,o,s,u,l;if(e instanceof t)return e;var c=n.parseArgs.call(this,e);return __assign(__assign({},c),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:Math.PI/4,defaultLatitude:(i=e.defaultLatitude)!==null&&i!==void 0?i:Math.PI/4,defaultDistance:(o=e.defaultDistance)!==null&&o!==void 0?o:150,maxLatitude:(s=e.maxLatitude)!==null&&s!==void 0?s:+Math.PI/2,minLatitude:(u=e.minLatitude)!==null&&u!==void 0?u:0,intersectMeshCreator:(l=e.intersectMeshCreator)!==null&&l!==void 0?l:function(){return new IntersectMesh}})},t.distanceFromModel=function(e,r,i){var o=e.bounding,s=Math.pow(Math.pow(o.max.x-o.min.x+1,2)+Math.pow(o.max.y-o.min.y+1,2)+Math.pow(o.max.z-o.min.z+1,2),1/2),u=s/2/Math.tan(Math.PI*r/360);return i<1&&(u=u/i),isNaN(u)?s:u},t.initAnimationEndState=function(e){var r,i,o,s,u,l,c,d=this.parseArgs(e),f=d.works,p=d.models,v=e.initial,A=v.state,m=v.currentState,y=typeof A.panoIndex=="number"?{workCode:(o=(r=A.workCode)!==null&&r!==void 0?r:(i=d.works[0])===null||i===void 0?void 0:i.workCode)!==null&&o!==void 0?o:"",panoIndex:A.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},h=f.getResolvedObserver(y),g=(s=A.fov)!==null&&s!==void 0?s:60,b=clamp((u=A.latitude)!==null&&u!==void 0?u:isThirdPersonMode(m.mode)?m.latitude:d.defaultLatitude,d.minLatitude,d.maxLatitude),T=t.distanceFromModel(d.models,g,d.camera.aspect),E=new THREE__namespace.Vector3,_=(l=A.distance)!==null&&l!==void 0?l:Math.min(d.defaultDistance,T),x=(c=A.longitude)!==null&&c!==void 0?c:isThirdPersonMode(m.mode)?m.longitude:d.defaultLongitude;return A.offset?E.copy(A.offset):d.defaultDistance<T&&h?(E.copy(h.position),A.longitude===void 0&&(x=m.longitude)):E.copy(p.bounding.getCenter(E)),p.bounding.containsPoint(E)||p.bounding.getCenter(E),__assign(__assign({},y),{mode:"Mapview",longitude:x,latitude:b,fov:g,offset:E,distance:_})},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,i,o){this.userAction=o,this.works=e;var s=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:i,state:r,userAction:o}}));this.currentPano={workCode:s.workCode,panoIndex:s.panoIndex};var u={longitude:s.longitude,latitude:s.latitude,fov:s.fov},l={x:s.offset.x,y:s.offset.y,z:s.offset.z,distance:s.distance,orthoDistance:s.distance};return this.locationMotion.set(l,i).catch(noop$1),this.cameraMotion.set(u,i).catch(noop$1),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e)},t.prototype.updateCamera=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();var s={},u={};return e.distance!==void 0&&(s.distance=e.distance),e.offset!==void 0&&(s.x=e.offset.x,s.y=e.offset.y,s.z=e.offset.z),e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),o.locationMotion.set(s,r).catch(noop$1),o.cameraMotion.set(u,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();for(var s=[],u=[],l=0,c=e;l<c.length;l++){var d=c[l];s.push({key:d.key,progress:d.progress,value:{distance:d.value.distance,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),u.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return o.locationMotion.setKeyframes(s,r).catch(noop$1),o.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var i={},o={};if(this.locationMotion.ended||(this.locationMotion.update(e),o.distance=this.locationMotion.value.distance,o.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),!this.cameraMotion.ended){this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov;var s=Math.PI/2-o.latitude<.02?1:0;this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==s&&this.perspToOrthoMotion.set({perspToOrtho:s},500).catch(noop$1)}this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(i)||this.models.setMaterial(i),isEmptyObject(o)||this.setCamera(o)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var i=e.initial;i.state,i.currentState;var o=i.duration,s=i.userAction;e.userAction=s;var u=t.initAnimationEndState(e),l={longitude:u.longitude,latitude:u.latitude,fov:u.fov},c={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance},d={modelAlpha:1},f={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:u,userAction:e.userAction})),e.perspToOrthoMotion.set(f,o).catch(noop$1),e.modelAlphaMotion.set(d,o/3).catch(noop$1),e.cameraMotion.set(l,o).catch(noop$1),e.locationMotion.set(c,o).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:u,userAction:e.userAction}))},function(p){var v=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:v,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this.models.intersectRaycaster(e)[0];if(!r)return null;var i=this.works.resolvedObservers,o=arrayMin(i,function(l){return l.standingPosition.distanceTo(r.point)},!0),s=o[0],u=o[1];return s&&u<10?s:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.scissor.width),latitude:2*e.y/(r.y*this.scissor.height)}},t.prototype.requestMomentumMovement=function(e,r,i,o){var s=this;if(this.inMomentumMovement!==null){for(var u=__assign({},i),l={longitude:0,latitude:0,x:0,y:0,z:0},c=0;c<o;c++)u.longitude*=.996,u.latitude*=.996*.998,u.x*=.99,u.y*=.99,u.z*=.99,l.longitude+=u.longitude,l.latitude+=u.latitude,l.x+=u.x,l.y+=u.y,l.z+=u.z;var d=formatRad(this.cameraMotion.value.longitude+l.longitude),f=clamp(this.cameraMotion.value.latitude+l.latitude,this.minLatitude,this.maxLatitude),p=clamp(this.locationMotion.value.x+l.x,this.models.bounding.min.x,this.models.bounding.max.x),v=clamp(this.locationMotion.value.y+l.y,this.models.bounding.min.y,this.models.bounding.max.y),A=clamp(this.locationMotion.value.z+l.z,this.models.bounding.min.z,this.models.bounding.max.z),m=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:f,offset:new THREE__namespace.Vector3(p,v,A),fov:this.cameraMotion.value.fov,distance:this.camera.pose.distance}),y=!(Math.abs(u.longitude)>1e-4||Math.abs(u.latitude)>1e-4||Math.abs(u.x)>1e-4||Math.abs(u.y)>1e-4||Math.abs(u.z)>1e-4),h=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:y,state:m}));if(this.inMomentumMovement.event=h,this.emit("gesture.momentum",h),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:f},0).catch(noop$1),this.locationMotion.set({x:m.offset.x,y:m.offset.y,z:m.offset.z},0).catch(noop$1),y?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(g,b){s.requestMomentumMovement(e,!1,u,b|0)},!0,1))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),i=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),o=new THREE__namespace.Raycaster(i,r);o.params.Points={threshold:.1},o.near=RAYCASTER_NEAR;var s=this.models.intersectRaycaster(o)[0];if(!s&&o.ray.direction.y<-.3){var u=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.models.bounding.min.y),l=o.ray.intersectPlane(u,new THREE__namespace.Vector3);if(l){var c=l.distanceTo(o.ray.origin);c<1e4&&c>=o.near&&(s={distance:c,floor:0,point:l,object:this.scene,face:null})}}s&&(e.distance=clamp(s.distance,minDistance,1/0),e.offset.copy(i).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,i=this.panState,o=0;e.pointerType==="mouse"&&(o=e.srcEvent.buttons),i&&o===0&&i.buttons!==0&&(o=i.buttons);var s=i==null?void 0:i.target;if(!s){var u=this.relativeClientPosition(e.center),l=new THREE__namespace.Raycaster;l.params.Points={threshold:.1},l.setFromCamera(u,this.camera),l.near=RAYCASTER_NEAR,s=new THREE__namespace.Vector3().copy(l.ray.direction).multiplyScalar(3).add(l.ray.origin);var c=this.models.intersectRaycaster(l)[0];if(!c&&l.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),f=l.ray.intersectPlane(d,new THREE__namespace.Vector3);if(f){var p=f.distanceTo(l.ray.origin);p<1e4&&p>=l.near&&(c={distance:p,floor:0,point:f,object:this.scene})}}if(c)s.copy(c.point);else{var v=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(v,this.camera.pose.offset);l.ray.intersectPlane(d,s)}}if(e.isFinal?delete this.panState:this.panState={target:s,buttons:o,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof i=="undefined"||i.pointerLength!==r)){var A=r>1||o===2;if(A){var m={x:e.center.x-i.x,y:e.center.y-i.y},y=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),h=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(y),g=new THREE__namespace.Vector3().copy(h).sub(i.target).length();g*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var b=this.renderer.getSize(new THREE__namespace.Vector2),T=2*m.x*g/b.y,E=2*m.y*g/b.y,_=new THREE__namespace.Vector3;_.setFromMatrixColumn(this.camera.matrix,0),_.multiplyScalar(-T),y.add(_),this.camera.pose.latitude<Math.PI/9?_.setFromMatrixColumn(this.camera.matrix,1):(_.setFromMatrixColumn(this.camera.matrix,0),_.crossVectors(this.camera.up,_)),_.multiplyScalar(E),y.add(_),y.clamp(this.models.bounding.min,this.models.bounding.max);var x=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:y,distance:this.camera.pose.distance});if(e.state=x,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:x.offset.x,y:x.offset.y,z:x.offset.z},0).catch(noop$1),e.isFinal&&(this.fixFinalState(x),this.locationMotion.set({distance:x.distance,x:x.offset.x,y:x.offset.y,z:x.offset.z},0).catch(noop$1)),e.isFinal){var w=this.renderer.getSize(new THREE__namespace.Vector2),S=2*e.velocityX*g/w.y,C=2*e.velocityY*g/w.y,M=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3;M.setFromMatrixColumn(this.camera.matrix,0),M.multiplyScalar(-S),I.add(M),this.camera.pose.latitude<Math.PI/4?M.setFromMatrixColumn(this.camera.matrix,1):(M.setFromMatrixColumn(this.camera.matrix,0),M.crossVectors(this.camera.up,M)),M.multiplyScalar(C),I.add(M),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:I.x,y:I.y,z:I.z},0)}}else{var m={x:e.center.x-i.x,y:e.center.y-i.y},F=this.coordinatesForOffset(m),B=formatRad(this.cameraMotion.value.longitude+F.longitude),L=clamp(this.cameraMotion.value.latitude+F.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(L=this.cameraMotion.value.latitude);var x=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:B,latitude:L,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&this.fixFinalState(x),e.state=x,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:x.distance,x:x.offset.x,y:x.offset.y,z:x.offset.z},0).catch(noop$1):this.cameraMotion.set({longitude:x.longitude,latitude:x.latitude},0).catch(noop$1),e.isFinal){var k=e.velocityX,O=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:k,y:O})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var i=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(e.isFinal){delete this.panState,delete this.pinchState;return}if(typeof i!="undefined"){var o=this.models.bounding.getCenter(new THREE__namespace.Vector3),s=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),u=clamp(i/e.scale,minDistance,1/0),l=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(u)),c=this.models.bounding.containsPoint(l),d;!c&&this.pinchState&&this.pinchState.scale>e.scale&&o.distanceTo(l)>s?d=e.state.distance:(d=u,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=d,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop$1),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)))}},t.prototype.onMouseMove=function(e){var r,i;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var o=e.center.raycaster;if(o.near=RAYCASTER_NEAR,o.far=500,e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var s=this.models.intersectRaycaster(o)[0],u=createEvent("intersect.update",{raycaster:o,intersection:s!=null?s:null,object:this.intersectMesh});if(this.emit("intersect.update",u),u.defaultPrevented){this.hideIntersectMesh();return}if(s){var l=(i=(r=s.face)===null||r===void 0?void 0:r.normal)!==null&&i!==void 0?i:new THREE__namespace.Vector3().copy(o.ray.direction).multiplyScalar(-1),c=l.clone().multiplyScalar(.05),d=s.point.clone().add(c);this.intersectMesh.position.copy(d);var f=d.clone().add(c);if(this.intersectMesh.lookAt(f),Math.abs(l.y)>.99){var p=this.camera.position.clone().sub(d);this.intersectMesh.rotation.z=-Math.atan2(p.z,p.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var i={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(i,0).catch(noop$1)}else{var o=e.center.delta/2*Math.max(Math.log(this.locationMotion.value.distance),1),s=this.models.bounding.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),l=clamp(this.locationMotion.value.distance-o,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(l)),d=this.models.bounding.containsPoint(c),f=!d&&o<0&&s.distanceTo(c)>u?e.state.distance:l;if(e.state.distance=l,this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:f},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=e.userAction,this.stopMomentumMovement();var i=e.center.raycaster,o=this.getForwardObserverOrNot(i);if(!o)this.emit("gesture.tap",e);else{var s={longitude:this.camera.pose.longitude,latitude:0},u=__assign(__assign({},e.state),{mode:"Panorama",workCode:o.pano.workCode,panoIndex:o.pano.panoIndex,longitude:s.longitude,latitude:s.latitude,offset:o?o.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=u,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:u,userAction:e.userAction,options:s,progress:0,error:null})),o&&o.active)){var l=this.currentTapId=createUuid();this.preloadPano(o.pano).then(function(c){r.currentTapId===l&&r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:u,options:s,error:null}))})}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t.prototype.postProcessing=function(e,r){var i;if(!this.destroyed){if(r==="edl")return this.edlEffect.render(e);if(r==="hq")return(i=this.hqEffect)===null||i===void 0?void 0:i.render(e)}},t}(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var i=null,o=null,s=null,u=this._targetRay,l=this._grip,c=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(u!==null&&(i=e.getPose(t.targetRaySpace,r),i!==null&&(u.matrix.fromArray(i.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),i.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(i.linearVelocity)):u.hasLinearVelocity=!1,i.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(i.angularVelocity)):u.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),c&&t.hand){s=!0;for(var d=0,f=t.hand.values();d<f.length;d++){var p=f[d],v=e.getJointPose(p,r);if(c.joints[p.jointName]===void 0){var A=new THREE__namespace.Group;A.matrixAutoUpdate=!1,A.visible=!1,c.joints[p.jointName]=A,c.add(A)}var m=c.joints[p.jointName];v!==null&&(m.matrix.fromArray(v.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=v.radius),m.visible=v!==null}var y=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],g=y.position.distanceTo(h.position),b=.02,T=.005;c.inputState.pinching&&g>b+T?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&g<=b-T&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(o=e.getPose(t.gripSpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1));return u!==null&&(u.visible=i!==null),l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),this},n}(),framebufferScaleFactor=1,XRManager=function(){function n(t,e,r){var i,o,s,u,l;this.isPanorama=(i=r==null?void 0:r.isPanorama)!==null&&i!==void 0?i:!0,this.machineType=(o=r==null?void 0:r.machineType)!==null&&o!==void 0?o:"Pico",this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(s=r==null?void 0:r.referenceSpaceType)!==null&&s!==void 0?s:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(u=r==null?void 0:r.onSessionStart)!==null&&u!==void 0?u:noop$1,this.onSessionEndCallback=(l=r==null?void 0:r.onSessionEnd)!==null&&l!==void 0?l:noop$1,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var i=this.cameraLPos.distanceTo(this.cameraRPos),o=e.projectionMatrix.elements,s=r.projectionMatrix.elements,u=o[14]/(o[10]-1),l=o[14]/(o[10]+1),c=(o[9]+1)/o[5],d=(o[9]-1)/o[5],f=(o[8]-1)/o[0],p=(s[8]+1)/s[0],v=u*f,A=u*p,m=i/(-f+p),y=m*-f;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var h=u+m,g=l+m,b=v-y,T=A+(i-y),E=c*l/g*h,_=d*l/g*h;t.projectionMatrix.makePerspective(b,T,E,_,h,g)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var i=0;i<r.length;i++)this.updateCamera(r[i],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var o=t.children,i=0,s=o.length;i<s;i++)o[i].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var i=t.removed[r],o=this.inputSourcesMap.get(i);o&&(o.dispatchEvent({type:"disconnected",data:i}),this.inputSourcesMap.delete(i))}for(var r=0;r<t.added.length;r++){var i=t.added[r],o=this.inputSourcesMap.get(i);o&&o.dispatchEvent({type:"connected",data:i})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectstart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeeze",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezestart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezeend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("end",function(i){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var i={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,i)});break;case"Oculus":e.session.updateRenderState({layers:[new XRWebGLLayer(e.session,e.gl,i)]});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(o){e.onRequestReferenceSpace(o)}),e.session.addEventListener("inputsourceschange",function(o){e.updateInputSources(o)})})}},n}(),LineSegmentsGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],i=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(o),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(i,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,i=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),i.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),i.setFromBufferAttribute(r),this.boundingBox.union(i)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var o=0,s=new THREE__namespace.Vector3,u=0,l=e.count;u<l;u++)s.fromBufferAttribute(e,u),o=Math.max(o,i.distanceToSquared(s)),s.fromBufferAttribute(r,u),o=Math.max(o,i.distanceToSquared(s));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t}(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
1822
1822
  #include <common>
1823
1823
  #include <color_pars_vertex>
1824
1824
  #include <fog_pars_vertex>
@@ -2017,7 +2017,7 @@ void main() {
2017
2017
  #include <premultiplied_alpha_fragment>
2018
2018
 
2019
2019
  }
2020
- `},LineMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(i){this.uniforms.diffuse.value=i}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(i){this.uniforms.linewidth.value=i}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(i){this.uniforms.dashScale.value=i}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(i){this.uniforms.dashSize.value=i}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(i){this.uniforms.gapSize.value=i}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(i){this.uniforms.opacity.value=i}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(i){this.uniforms.resolution.value.copy(i)}}}),r.setValues(e),r}return t}(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=function(n){__extends(t,n);function t(e,r){var i=n.call(this)||this;return i.type="LineSegments2",i.geometry=e!==void 0?e:new LineSegmentsGeometry,i.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),i}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,i=e.attributes.instanceEnd,o=new Float32Array(2*r.count),s=new THREE__namespace.Vector3,u=new THREE__namespace.Vector3,l=0,c=0,d=r.count;l<d;l++,c+=2)s.fromBufferAttribute(r,l),u.fromBufferAttribute(i,l),o[c]=c===0?0:o[c-1],o[c+1]=o[c]+s.distanceTo(u);var f=new THREE__namespace.InstancedInterleavedBuffer(o,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(f,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(f,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=e.ray,o=e.camera,s=o.projectionMatrix,u=this.geometry,l=this.material,c=l.resolution,d=l.linewidth,f=u.attributes.instanceStart,p=u.attributes.instanceEnd,v=new THREE__namespace.Vector4,A=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,h=new THREE__namespace.Matrix4,g=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;i.at(1,m),m.w=1,m.applyMatrix4(o.matrixWorldInverse),m.applyMatrix4(s),m.multiplyScalar(1/m.w),m.x*=c.x/2,m.y*=c.y/2,m.z=0,y.copy(m);var T=this.matrixWorld;h.multiplyMatrices(o.matrixWorldInverse,T);for(var E=0,_=f.count;E<_;E++){v.fromBufferAttribute(f,E),A.fromBufferAttribute(p,E),v.w=1,A.w=1,v.applyMatrix4(h),A.applyMatrix4(h),v.applyMatrix4(s),A.applyMatrix4(s),v.multiplyScalar(1/v.w),A.multiplyScalar(1/A.w);var x=v.z<-1&&A.z<-1,w=v.z>1&&A.z>1;if(!(x||w)){v.x*=c.x/2,v.y*=c.y/2,A.x*=c.x/2,A.y*=c.y/2,g.start.copy(v),g.start.z=0,g.end.copy(A),g.end.z=0;var S=g.closestPointToPointParameter(y,!0);g.at(S,b);var C=THREE__namespace.MathUtils.lerp(v.z,A.z,S),M=C>=-1&&C<=1,I=y.distanceTo(b)<d*.5;if(M&&I){g.start.fromBufferAttribute(f,E),g.end.fromBufferAttribute(p,E),g.start.applyMatrix4(T),g.end.applyMatrix4(T);var F=new THREE__namespace.Vector3,B=new THREE__namespace.Vector3;i.distanceSqToSegment(g.start,g.end,B,F),r.push({point:B,pointOnLine:F,distance:i.origin.distanceTo(B),object:this,faceIndex:E})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(n){__extends(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.type="Line2",i}return t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setPositions.call(this,i),this},t.prototype.setColors=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setColors.call(this,i),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkat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ALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var i=n.call(this)||this;i.type="FiveLine",i.needsRender=!0;var o=new LineGeometry,s=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});i.line=new Line2(o,s);var u=new THREE__namespace.BufferGeometry,l=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return i.points=new THREE__namespace.Points(u,l),i.points.renderOrder=11,i.points.frustumCulled=!1,i.setPoints(e,r),i.add(i.line,i.points),i}return Object.defineProperty(t,"version",{get:function(){return"6.0.0-alpha.75"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var i=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];i==="dashed"?(r.dashed=o,o?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[i]=e[i]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var i=this.line.material.resolution;(i.x!==e||i.y!==r)&&(i.set(e,r),this.needsRender=!0)},t}(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={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 fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t,e,r){return e===void 0&&(e=null),r===void 0&&(r=!0),__awaiter(this,void 0,void 0,function(){var i,o,s,u,l,c;return __generator(this,function(d){switch(d.label){case 0:if(!n)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No basePath supplied");return[4,fetchProfilesList(t)];case 1:if(i=d.sent(),n.profiles.some(function(f){var p=i[f];return p&&(o={profileId:f,profilePath:"".concat(t,"/").concat(p.path),deprecated:!!p.deprecated}),!!o}),!o){if(!e)throw new Error("No matching profile name found");if(s=i[e],!s)throw new Error('No matching profile name found and default profile "'.concat(e,'" missing.'));o={profileId:e,profilePath:"".concat(t,"/").concat(s.path),deprecated:!!s.deprecated}}return[4,fetchJsonFile(o.profilePath)];case 2:if(u=d.sent(),r){if(c=void 0,c=u.layouts[n.handedness],!c)throw new Error("No matching handedness, ".concat(n.handedness,", in profile ").concat(o.profileId));c.assetPath&&(l=o.profilePath.replace("profile.json",c.assetPath))}return[2,{profile:u,assetPath:l}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,i=Math.sqrt(n*n+t*t);if(i>1){var o=Math.atan2(t,n);e=Math.cos(o),r=Math.sin(o)}var s={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return s}var VisualResponse=function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,i=t.button,o=t.state,s=normalizeAxes(e,r),u=s.normalizedXAxis,l=s.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(o)?u:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(o)?l:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(o)?i:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(o):this.value=this.states.includes(o)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n}(),Component=function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(i){var o=new VisualResponse(e.visualResponses[i]);r.visualResponses[i]=o}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(i){i.updateFromComponent(e.values)})},n}(),MotionController=function(){function n(t,e,r){var i=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(o){var s=i.layoutDescription.components[o];i.components[o]=new Component(o,s)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n}(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(i){i instanceof THREE__namespace.Mesh&&i.isMesh&&(i.material.envMap=r.envMap,i.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(i){var o=i.valueNode,s=i.minNode,u=i.maxNode,l=i.value,c=i.valueNodeProperty;o&&(c===Constants.VisualResponseProperty.VISIBILITY?o.visible=l:c===Constants.VisualResponseProperty.TRANSFORM&&(o.quaternion.copy(s.quaternion).slerp(u.quaternion,l),o.position.lerpVectors(s.position,u.position,l)))})}))},t}(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,i=e.touchPointNodeName,o=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(i),e.touchPointNode){var s=new THREE.SphereGeometry(.001),u=new THREE.MeshBasicMaterial({color:255}),l=new THREE.Mesh(s,u);e.touchPointNode.add(l)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(o).forEach(function(c){var d=c.valueNodeName,f=c.minNodeName,p=c.maxNodeName,v=c.valueNodeProperty;if(v===Constants.VisualResponseProperty.TRANSFORM){if(c.minNode=t.getObjectByName(f),c.maxNode=t.getObjectByName(p),!c.minNode){console.warn("Could not find ".concat(f," in the model"));return}if(!c.maxNode){console.warn("Could not find ".concat(p," in the model"));return}}c.valueNode=t.getObjectByName(d),c.valueNode||console.warn("Could not find ".concat(d," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,i=null;return t.addEventListener("connected",function(o){var s=o.data;s.targetRayMode!=="tracked-pointer"||!s.gamepad||fetchProfile(s,e.path,DEFAULT_PROFILE).then(function(u){var l=u.profile,c=u.assetPath;r.motionController=new MotionController(s,l,c);var d=e._assetCache[r.motionController.assetUrl];if(d)i=d.scene.clone(),addAssetSceneToControllerModel(r,i);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(f){e._assetCache[r.motionController.assetUrl]=f,i=f.scene.clone(),addAssetSceneToControllerModel(r,i)})}}).catch(function(u){console.warn(u)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(i),i=null}),r},n}();function mapPanoResource(n,t){if(!t)return n;var e=n.match(/\d+_[a-z].png/);return n.substring(0,e.index)+t+"/"+n.substring(e.index)}var CONTROLLER_EVNET_DELTA_TIME=300,ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(l){r.emit("xr.session.start",createEvent("xr.session.start",{session:l,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.scene.add(r.pointerLines.left,r.pointerLines.right),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade"},r.parallaxCameraMatrixs=[];var i=AnimationFrameLoop.shared.getContext();if(!i)return console.error("获取session失败,请退出重试"),r;r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(i),r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group],r.scene.add(r.controllerWrappers[0],r.controllerWrappers[1]);var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var s=r.xrManager.getController(1);r.controllerWrappers[1].add(s);var u=new XRControllerModelFactory;return u.gltfLoader={load:function(l,c){internalFetcher.ajax(l,{responseType:"arraybuffer"}).then(function(d){var f;return parseGltf(d.body,{resourcePath:l.slice(0,l.lastIndexOf("/")+1),search:(f=l.split("?")[1])!==null&&f!==void 0?f:"",fetcher:internalFetcher})}).then(function(d){return c(d)})}},r.on("xr.session.start",function(){var l=r.xrManager.getControllerGrip(0);l.add(u.createControllerModel(l)),r.controllerWrappers[0].add(l);var c=r.xrManager.getControllerGrip(1);c.add(u.createControllerModel(c)),r.controllerWrappers[1].add(c)}),r.xrControllerState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),i=n.initAnimationEndState.call(this,r);return __assign(__assign({},i),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,r,i){var o=this,s,u,l,c;this.userAction=i,this.stopMomentumMovement();var d=this.works.getResolvedObserver(e);if(!d)throw new Error("Invalid PanoIndex");var f=this.imageOptions.size;if(typeof f=="undefined"&&d){var p=d.images.up.match(/\/cube_(\d+)\//);p&&(f=Number(p[1]))}typeof f=="undefined"&&(f=2048);var v=this.imageOptions.transform,A=function(C,M){return mapPanoResource(applyImageURLOptions(C,v,M))},m=__assign({key:"pano.".concat(d.panoId)},pick(this.imageOptions,["format","size","quality"])),y=d.images,h=(u=(s=d.images.tiles)===null||s===void 0?void 0:s.filter(function(C){return C.size>f}))!==null&&u!==void 0?u:null,g="pano:"+jsonHash([y,m,v]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;var b=this.pendingTextureTask.panoId;(l=this.panoMeshes[b])===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:d.pano})),this.pendingTextureTask.onError(new Error("texture aborted"))}var T=this.models.getMaterial()||{},E=T.pano0,_=T.pano1,x;if((E==null?void 0:E.map.name)===g?x=E:(_==null?void 0:_.map.name)===g&&(x=_),x){var w={panoId:d.panoId,effect:(c=r.effect)!==null&&c!==void 0?c:"fade",leftPanoPicture:{map:x.map,luminanceMap:x.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(d.position,d.quaternion,PANO_TEXTURE_SCALE)},position:d.position.clone()};this.doMoveToPano(d.pano,w,r);return}var S="move-to-pano-"+d.panoId;this.pending.add(S),this.pendingTextureTask={panoId:d.panoId,hash:g,onLoad:function(C){var M;if(o.pending.delete(S),o.destroyed)C.body.dispose();else{C.body.name=g;var I={panoId:d.panoId,effect:(M=r.effect)!==null&&M!==void 0?M:"fade",leftPanoPicture:{map:C.body,luminanceMap:null,matrix:new THREE__namespace.Matrix4().compose(d.position,d.quaternion,PANO_TEXTURE_SCALE)},position:d.position.clone()};o.doMoveToPano(d.pano,I,r)}},onError:function(C){o.pending.delete(S);var M=__assign(__assign(__assign({},d.pano),{mode:o.mode}),clonePose(o.camera.pose));o.emit("pano.error",createEvent("pano.error",{error:C,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:M})),o.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:M})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&h&&h.length?this.textureLoader.loadTiledCubeTexture(y,h,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:A,options:m},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(d.work)},void 0,void 0,function(C){var M,I;o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:C,meta:null,pano:d.pano})),((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===g&&((I=o.panoMeshes[d.panoId])===null||I===void 0||I.setProgress(C))},this.renderer):this.textureLoader.loadCubeTexture(y,{imageURL:{transform:A,options:m},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(d.work)},void 0,void 0,function(C){var M,I;((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===g&&((I=o.panoMeshes[d.panoId])===null||I===void 0||I.setProgress(C)),o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:C,meta:null,pano:d.pano}))},this.renderer)]).then(function(C){var M,I,F=C[0];((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===g?(o.pendingTextureTask.onLoad(F),(I=o.panoMeshes[d.panoId])===null||I===void 0||I.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:F.meta,pano:d.pano}))):F.body.dispose()}).catch(function(C){var M,I;((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===g&&(o.pendingTextureTask.onError(C),(I=o.panoMeshes[d.panoId])===null||I===void 0||I.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.error",createEvent("pano.texture.error",{error:C,progress:0,meta:null,pano:d.pano})),o.emit("error",C))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:d.pano}))},t.prototype.doMoveToPano=function(e,r,i){var o=this,s,u,l;i===void 0&&(i={});var c=now(),d=createUuid();this.panoResources[d]=r;var f=1,p,v,A;if(this.locationMotion.ended){var m=this.locationMotion.getKeyFrameSegment(c);m[0];var y=m[1],h=this.locationMotion.value,g=this.panoResourceFromLocationMotionKeyframe(y).position,b=r.position;p=Math.max(g.distanceTo(b),f),v=[{key:y.key,progress:0,value:__assign(__assign({},h),{count:0})},{key:d,progress:1,value:{distance:0,count:1}}],A=0}else{var T=this.locationMotion.getKeyFrameSegment(c),E=T[0],y=T[1],h=this.locationMotion.value,_=this.panoResourceFromLocationMotionKeyframe(E).position,g=this.panoResourceFromLocationMotionKeyframe(y).position,b=r.position,x=y.value.count-h.count,w=Math.max(_.distanceTo(g),f)*x,S=Math.max(g.distanceTo(b),f);p=w+S,v=[{key:E.key,progress:0,value:__assign({},h)},{key:y.key,progress:w/p,value:y.value},{key:d,progress:1,value:{count:y.value.count+1,distance:0}}];var C=this.locationMotionKeyframesLength(this.locationMotion.keyframes),M=this.locationMotionKeyframesLength(v);A=this.locationMotion.getProgressVelocity(c)*C/M}var I=this.calculateMovingDuration(i.duration,p),F={longitude:i.longitude,latitude:i.latitude,fov:i.fov},B=__assign(__assign({},e),{mode:this.mode,longitude:(s=F.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=F.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(l=F.fov)!==null&&l!==void 0?l:this.camera.pose.fov,offset:r.position.clone(),distance:0}),L=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:i,prevPano:L,progress:0,state:B,userAction:this.userAction,error:null})),i.moveStartCallback&&i.moveStartCallback(B),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(F,I).catch(noop$1);var k=this.locationMotion.setKeyframes(v,I,A);k.then(function(){var O,U,V,N=__assign(__assign({},e),{mode:o.mode,longitude:o.camera.pose.longitude,latitude:o.camera.pose.latitude,fov:o.camera.pose.fov,offset:o.camera.pose.offset.clone(),distance:0});o.emit("pano.arrived",createEvent("pano.arrived",{options:i,prevPano:L,progress:1,state:N,userAction:o.userAction,error:null})),i.moveEndCallback&&i.moveEndCallback(N);var Q=o.works.getResolvedObserver(o.currentPano);if(Q&&Q.video&&o.videoTexture&&o.videoTexture.image instanceof HTMLVideoElement){var G=ROTATE_Y_PI_MATRIX.clone().multiply((V=(U=(O=o.models.getMaterial())===null||O===void 0?void 0:O.pano1)===null||U===void 0?void 0:U.matrix)!==null&&V!==void 0?V:new THREE__namespace.Matrix4).multiply(Q.video.matrix),q={map:o.videoTexture,size:Q.video.size,matrix:G,alpha:1},W=createUuid(),z=o.videoTexture.image;z.setAttribute("uuid",W),canplayVideo().then(function(X){X&&Q.video&&z.getAttribute("uuid")===W&&(z.oncanplay=function(){z.oncanplay=noop$1,z.play()},z.ontimeupdate=function(){z.currentTime>.5&&(z.ontimeupdate=noop$1,o.panoVideo.setMaterial(q))},z.src=Q.video.source)}).catch(function(){z.removeAttribute("uuid")})}},function(){o.emit("pano.cancel",createEvent("pano.cancel",{options:i,prevPano:L,progress:0,state:B,userAction:o.userAction,error:null})),i.moveCancelCallback&&i.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,i,o,s,u;this.stopMomentumMovement();var l=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),c=null,d=this.works.getResolvedObserver(this.currentPano);if(!d)return null;var f=d.accessibleIds.filter(function(W){var z=panoParse(W);if(panoEqual(z,r.currentPano))return!1;var X=r.works.getResolvedObserver(z);return!X||X.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:X.loadable||X.active}),p=this.models.intersectRaycaster(e)[0];if(p){var v=arrayMin(f,function(W){var z=r.works.getResolvedObserver(W);if(!z)return 1/0;var X=z.standingPosition.clone();return X.distanceTo(p.point)},!0),A=v[0],m=v[1];A&&m<this.panoTapTriggerRadius&&(c=(i=this.works.getResolvedObserver(A))!==null&&i!==void 0?i:null)}if(isNil(c)){var y=this.getForwardObserverOrNot(e);y&&(c=y)}for(var h=0,g=this.locationMotion.keyframes;h<g.length;h++){var b=g[h],T=this.panoResourceFromLocationMotionKeyframe(b);if(!(b.progress<this.locationMotion.progress)&&c&&T.panoId===c.panoId){c=null;break}}if(isNil(c))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(c&&!c.active){var E=c.panoId;this.panoMeshes[E]&&(this.panoMeshes[E].setDisabled(!1),this.panoMeshes[E].setLoading(!0))}var _={};if(c){_.effect="fade";for(var x=Math.PI/6,w=Math.PI/12,S=new THREE__namespace.Vector3(0,1,0),C=c.position.clone().setY(0).sub(d.position.clone().setY(0)).normalize(),M=C.clone().applyAxisAngle(S,x),I=C.clone().applyAxisAngle(S,-x),F=[],B=[],L=[],k=0,O=c.accessibleIds;k<O.length;k++){var A=O[k],U=panoParse(A);if(!(panoEqual(U,this.currentPano)||panoEqual(U,c.pano))){var V=this.works.getResolvedObserver(A);if(V){var N=V.position.clone().sub(c.position).setY(0);C.angleTo(N)<x?L.push(N):M.angleTo(N)<x?F.push(N):I.angleTo(N)<x&&B.push(N)}}}var Q=L.length>0?L:__spreadArray(__spreadArray([],F,!0),B,!0),G=Q.slice().sort(function(W,z){return W.angleTo(C)-z.angleTo(C)})[0];G&&G.angleTo(l)>w&&(_.longitude=Math.atan2(-G.x,-G.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(_.latitude=clamp(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(_.fov=this.defaultFov);var q={workCode:c.pano.workCode,panoIndex:c.pano.panoIndex,mode:this.mode,longitude:(o=_.longitude)!==null&&o!==void 0?o:this.camera.pose.longitude,latitude:(s=_.latitude)!==null&&s!==void 0?s:this.camera.pose.latitude,fov:(u=_.fov)!==null&&u!==void 0?u:this.camera.pose.fov,distance:0,offset:c?c.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:q,userAction:!0,options:_,progress:0,error:null})),c&&c.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:q,options:_,error:null})),c.pano):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,i){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,i){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var i=this,o,s,u,l,c,d,f,p,v=[],A=2;A<arguments.length;A++)v[A-2]=arguments[A];this.userAction=!0;var m={},y={},h=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),m.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var T=this.locationMotion.getKeyFrameSegment(e),E=T[0],_=T[1],x=this.panoResourceFromLocationMotionKeyframe(E),w=this.panoResourceFromLocationMotionKeyframe(_),S=new THREE__namespace.Vector3().copy(x.position),C=new THREE__namespace.Vector3().copy(w.position),M=this.locationMotion.value.count-_.value.count+1;m.progress=M,w.leftPanoPicture&&(M<1?x.leftPanoPicture&&(m.pano0=x.leftPanoPicture):m.pano0=w.leftPanoPicture,m.pano1=w.leftPanoPicture),b=m.useBlackTransition=w.effect==="instant"||w.effect==="montage",(w.effect==="fade"||w.effect==="montage")&&(m.pano0&&x.leftPanoPicture&&(m.pano0={map:m.pano0.map,luminanceMap:m.pano0.luminanceMap,matrix:x.leftPanoPicture.matrix.clone().setPosition(w.position)}),S.copy(C)),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(S.x+(C.x-S.x)*M,S.y+(C.y-S.y)*M,S.z+(C.z-S.z)*M);for(var I=[],F=[],B=0,L=this.locationMotion.keyframes;B<L.length;B++){var k=L[B],O=k.key,U=k.progress;O!==void 0&&(I.push(O),U>=this.locationMotion.progress&&F.push(O))}for(var V=0,N=Object.keys(this.panoResources);V<N.length;V++){var Q=N[V];if(!(F.indexOf(Q)>=0)){var G=this.panoResources[Q];if(G.leftPanoPicture){var q=G.leftPanoPicture.map;if(q){if(q===((o=m.pano0)===null||o===void 0?void 0:o.map)||q===((s=m.pano1)===null||s===void 0?void 0:s.map))continue;q instanceof TileCubeTextureTarget&&q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(q.cubeRenderTarget),q.dispose(),G.leftPanoPicture=null}}I.indexOf(Q)>=0||delete this.panoResources[Q]}}this.currentPano=panoParse(w.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(h.panoId),state:__assign(__assign(__assign(__assign({},panoParse(g.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(m)===!1&&(!((u=m.pano0)===null||u===void 0)&&u.map&&m.pano0.map instanceof TileCubeTextureTarget&&!m.pano0.map.cubeRenderTarget&&(m.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((l=m.pano1)===null||l===void 0)&&l.map&&m.pano1.map instanceof TileCubeTextureTarget&&!m.pano1.map.cubeRenderTarget&&(m.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(m)),isEmptyObject(y)===!1&&this.setCamera(y);var W=this.works.getResolvedObserver(this.currentPano),z=v[1];if(!z){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var X=this.xrManager.referenceSpace;if(X){var re=this.xrManager.cameraVR,J=this.xrManager.cameraL,$=this.xrManager.cameraR,ee=[J,$],oe=z.getViewerPose(X),ae=new THREE__namespace.Vector3(0,0,0);if(oe){var ne;ne=this.xrManager.session.renderState.baseLayer;var le=oe.views;if(!ne){console.error("no layer found");return}this.renderer.setFramebuffer(ne.framebuffer);var ie=!1;le.length!==re.cameras.length&&(re.cameras.length=0,ie=!0),this.parallaxCameraMatrixs=[];var fe=new THREE__namespace.Vector3,Z=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(le[0].transform.matrix).decompose(fe,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(le[1].transform.matrix).decompose(Z,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),Z.clone().sub(fe).normalize();var te=new THREE__namespace.Vector3,K=new THREE__namespace.Quaternion,pe=new THREE__namespace.Vector3;this.camera.matrix.decompose(te,K,pe);for(var ve=0;ve<le.length;ve++){var we=le[ve],_e=ne.getViewport(we),ye=ee[ve];ye.matrix.fromArray(we.transform.matrix);var Be=new THREE__namespace.Vector3,Ae=new THREE__namespace.Quaternion,ue=new THREE__namespace.Vector3;ye.matrix.decompose(Be,Ae,ue),ae.copy(te),ye.position.copy(te),ye.quaternion.copy(Ae),ye.scale.copy(ue),ye.updateMatrix(),ye.projectionMatrix.fromArray(we.projectionMatrix),ye.viewport.set(_e.x,_e.y,_e.width,_e.height),ie===!0&&re.cameras.push(ye)}oe.views[0].transform.position,oe.views[1].transform.position;for(var se=this.xrManager.session.inputSources,ve=0;ve<this.xrManager.controllers.length;ve++){var Ce=this.xrManager.controllers[ve],de=se[ve];if(de){Ce.update(de,z,X);var be=this.xrManager.getController(ve),me=new THREE__namespace.Vector3(0,1.2,0),Ie=be.position.clone().add(ae).sub(me);de.handedness==="left"?this.xrControllerRay.left.set(Ie,new THREE__namespace.Vector3(0,0,-1).applyEuler(be.rotation)):de.handedness==="right"&&this.xrControllerRay.right.set(Ie,new THREE__namespace.Vector3(0,0,-1).applyEuler(be.rotation)),this.controllerWrappers[ve].position.copy(new THREE__namespace.Vector3(0,0,0).add(ae).sub(me));var Ee=this.models.intersectRaycaster(this.xrControllerRay.right);if(Ee.length===0&&(Ee=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(Le){var ke;return __assign({floor:(ke=W==null?void 0:W.floorIndex)!==null&&ke!==void 0?ke:0},Le)})),Ee.length>=1&&Ee[0].face)if(de.handedness==="right"){var Xe=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),ot=Ee[0].face.normal,Se=ot.clone().multiplyScalar(.05),Ve=Ee[0].point.clone().add(Se);this.intersectMesh.position.copy(Ve);var ft=Ve.clone().add(Se);if(this.intersectMesh.lookAt(ft),Math.abs(ot.y)>.99){var Me=this.camera.position.clone().sub(Ve);this.intersectMesh.rotation.z=-Math.atan2(Me.z,Me.x)}this.intersectMesh.visible=!0,this.needsRender=!0,Xe.length>0?(this.pointerLines.right.setPoints(Ie,Xe[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(Ie,Ee[0].point));var De=Ee[0],Ue=createEvent("intersect.update",{raycaster:(c=this.xrControllerRay.right)!==null&&c!==void 0?c:null,intersection:De!=null?De:null,object:this.intersectMesh});if(this.emit("intersect.update",Ue),Ue.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(Ie,Ee[0].point)}}if(this.camera.pose.distance>.1||b){if(W)for(var qe=0,je=Object.keys(this.panoMeshes);qe<je.length;qe++){var He=je[qe],he=this.panoMeshes[He];he.setOpacity(0),he.setCurrent(!1),he.updateTime&&he.updateTime(e,r)}}else if(W){var it=arrayMin(W.visibleIds,function(Pe){var Le=i.works.getResolvedObserver(Pe);return Le?W.standingPosition.distanceTo(Le.standingPosition):1/0},!0),Qe=it[1];Qe=clamp(Qe,2.5,1/0);for(var Ye=W.visibleIds.concat(panoStringify(this.currentPano)),Ge=this.getForwardObserverOrNot(),vt=this.camera.getDirection(new THREE__namespace.Vector3),st=0,ut=Object.keys(this.panoMeshes);st<ut.length;st++){var He=ut[st],he=this.panoMeshes[He],$e=this.works.getResolvedObserver(He);if(Ye.indexOf(He)===-1)he.setCurrent(!1),he.setOpacity(0);else if(!$e)he.setCurrent(!1),he.setOpacity(0);else if(!$e.loadable&&!$e.active)he.setCurrent(!1),he.setOpacity(0);else{var et=he.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);he.setCurrent(!he.loading&&he.progress===0&&Ge!==null&&Ge.panoId===He),he.setOpacity(et<.01?0:clamp(Qe/et*1.2,.65,.98));var Re=this.camera.position.clone().setY(he.position.y),Te=new THREE__namespace.Vector3().copy(he.position).sub(Re).normalize();if(He===panoStringify(this.currentPano)){var ze=clamp((.5-Re.distanceTo(he.position))/.5,0,1);Te.multiplyScalar(1-ze).add(vt.clone().multiplyScalar(ze))}Te.length()>0&&he.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(Te.x,Te.z),0))}he.updateTime&&he.updateTime(e,r)}}var tt=function(){if(i.tileLevelForFov===!1)return 0;var Pe=new THREE__namespace.Vector2(4e3,4e3),Le=g.panoId,ke=i.works.getResolvedObserver(Le),Oe=i.imageOptions.size;if(typeof Oe=="undefined"&&ke){var yt=ke.images.up.match(/\/cube_(\d+)\//);yt&&(Oe=Number(yt[1]))}typeof Oe=="undefined"&&(Oe=2048);var ct=0;Oe>=1024&&(ct=1),Oe>=2048&&(ct=2),Oe>=4096&&(ct=3),Oe>=8192&&(ct=4);var dt=i.tileLevelForFov(J.fov,Pe);return dt>ct?dt:0}(),mt=function(){var Pe=new THREE__namespace.PerspectiveCamera;Pe.applyMatrix4(re.matrix),Pe.position.set(0,0,0);var Le=i.works.getResolvedObserver(g.panoId),ke=Le!=null?Le:W;ke&&Pe.quaternion.premultiply(ke.quaternion.clone().inverse()),Pe.updateProjectionMatrix(),Pe.updateMatrixWorld(!0);var Oe=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(Pe.projectionMatrix,Pe.matrixWorldInverse));return Oe}();g.panoId===panoStringify(this.currentPano)&&((d=g.leftPanoPicture)===null||d===void 0?void 0:d.map)instanceof TileCubeTextureTarget&&(g.leftPanoPicture.map.update(mt,tt),g.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0));{var gt=this.tiling.object.visible;if(tt>this.TILED_CUBE_TEXTURE_LEVEL&&this.initAnimationed){var lt=g.panoId,Fe=this.works.getResolvedObserver(lt);Fe?isSimilarVector3(this.camera.position,Fe.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==lt&&this.tiling.cleanup(),this.tiling.panoId=lt,this.tiling.setResource((p=(f=Fe.images)===null||f===void 0?void 0:f.tiles)!==null&&p!==void 0?p:[],this.enableIOSEDR&&Fe.images.luminance?Fe.images.luminance:null),this.tiling.setFetcher(getFetcher(Fe.work)),this.tiling.setRotation(Fe.quaternion),this.tiling.setPosition(Fe.position),this.tiling.update(mt,tt,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;gt!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),!(!se||se.length<1)&&this.updateControllerHelper(se,e,r)}}},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.scene,e)},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var u={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},l=0;l<e.length;l++){var c=e[l].handedness,d=e[l].gamepad;switch(c){case"left":d.axes&&(this.emitEvent(d.axes[2]===-1,"LeftAxesLeft",r),this.emitEvent(d.axes[2]===1,"LeftAxesRight",r),this.emitEvent(d.axes[3]===-1,"LeftAxesUp",r),this.emitEvent(d.axes[3]===1,"LeftAxesDown",r)),d!=null&&d.buttons&&(this.emitEvent(d==null?void 0:d.buttons[4].pressed,"X",r),this.emitEvent(d.buttons[5].pressed,"Y",r),this.emitEvent(d==null?void 0:d.buttons[0].pressed,"LeftTrigger",r),this.emitEvent(d==null?void 0:d.buttons[1].pressed,"LeftPinch",r));var f={raycaster:o,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.buttons.X=d.buttons&&d.buttons[4]?d.buttons[4].pressed:!1,u.buttons.Y=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.LeftTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.LeftPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1,u.left=f;break;case"right":d.axes&&(this.emitEvent(d.axes[2]===-1,"RightAxesLeft",r),this.emitEvent(d.axes[2]===1,"RightAxesRight",r),this.emitEvent(d.axes[3]===-1,"RightAxesUp",r),this.emitEvent(d.axes[3]===1,"RightAxesDown",r)),d.buttons&&(this.emitEvent(d==null?void 0:d.buttons[4].pressed,"A",r),this.emitEvent(d.buttons[5].pressed,"B",r),this.emitEvent(d==null?void 0:d.buttons[0].pressed,"RightTrigger",r),this.emitEvent(d==null?void 0:d.buttons[1].pressed,"RightPinch",r));var p={raycaster:s,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.right=p,u.buttons.A=d.buttons&&d.buttons[4]?d==null?void 0:d.buttons[4].pressed:!1,u.buttons.B=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.RightTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.RightPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",u))}},t.prototype.emitEvent=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(e)if(this.xrControllerState[r].touchStart===!1)this.xrControllerState[r].touchStartTime=i,this.xrControllerState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}));else{var u=i-this.xrControllerState[r].touchStartTime;u>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}))}else if(this.xrControllerState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}));var u=i-this.xrControllerState[r].touchStartTime;if(u<=CONTROLLER_EVNET_DELTA_TIME){var l=this.emit("xr.gesture.tap",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}));l||r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrControllerState[r].touchStart=!1,this.xrControllerState[r].touchStartTime=0}},t}(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,DepthPanorama:DepthPanoramaController,Mapview:MapviewController,XRPanorama:XRPanoramaController},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}function initLights(n){{var t=new THREE__namespace.DirectionalLight(16777215,.5);t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.3);n.add(t)}}function parseKeyValue(n){for(var t,e,r={},i=n.split(/(\;|\,)/),o=0,s=i;o<s.length;o++){var u=s[o],l=u.split("="),c=(t=l[0])===null||t===void 0?void 0:t.trim(),d=(e=l[1])===null||e===void 0?void 0:e.trim();c&&d&&(r[c]=d)}return r}function getViewportScale(){for(var n,t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var i=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),o=Number(i["initial-scale"]);if(!isNaN(o))return o}}return 1}const textureURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKW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aidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),i=n.getScissor(prevScissor),o=n.getScissorTest(),s=n.autoClear,u=i.x+imageOffset[0]/3,l=i.y+imageOffset[1]/3,c=imageSize[0]/3,d=imageSize[1]/3;n.setViewport(u,l,c,d),n.setScissor(u,l,c,d),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(i),n.setScissorTest(o),n.autoClear=s}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop$1},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},BUILTIN_COORDINATESSYSTEMTRANSFORMERS=[{name:"Z",transformToUpAxisZ:function(){return new THREE__namespace.Matrix4}},{name:"Y",transformToUpAxisZ:function(){return new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(1,0,0),+Math.PI/2)}},{name:"-Y",transformToUpAxisZ:function(){return new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(1,0,0),-Math.PI/2)}},{name:"WGS84",transformToEarthCentered:function(){return new THREE__namespace.Matrix4}},{name:"GCJ02",transformToEarthCentered:function(){return new THREE__namespace.Matrix4}},{name:"BD09",transformToEarthCentered:function(){return new THREE__namespace.Matrix4}}],sharedVector2=new THREE__namespace.Vector2,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]),Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,l,c,d,f,p,v=n.call(this)||this;v.ident=createUuid(),__FIVE_DEBUG__.instances[v.ident]=v,v.renderSwitch01=0,v.currentMode="Panorama",v.pano={workCode:"",panoIndex:0},v.needsRender=!1,v.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,v.imageOptions=__assign({},(i=e.imageOptions)!==null&&i!==void 0?i:{}),v.textureOptions=__assign({},(o=e.textureOptions)!==null&&o!==void 0?o:{}),v.poweredByRealsee=(s=e.poweredByRealsee)!==null&&s!==void 0?s:!0,v.extraElements=[],v.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),DepthPanorama:Object.assign({},e.depthPanorama),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},v.coordinatesSystemTransformers=__spreadArray([],(u=e.coordinatesSystemTransformers)!==null&&u!==void 0?u:[],!0);for(var A=function(F){var B=m.coordinatesSystemTransformers.find(function(L){return L.name===F.name});B||m.coordinatesSystemTransformers.push(__assign({},F))},m=this,y=0,h=BUILTIN_COORDINATESSYSTEMTRANSFORMERS;y<h.length;y++){var g=h[y];A(g)}if(v.fps={testCount:0,testTime:now()},v.info=null,v.modeChangeDuration=(l=e.modeChangeDuration)!==null&&l!==void 0?l:DEFAULT_MODE_CHANGE_DURATION,v.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if(e.renderer)e.renderer instanceof InternalWebGLRenderer&&v.throwError(new Error("cannot render a internal renderer")),v.renderer=e.renderer;else try{v.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e==null?void 0:e.webgl2});var b=getViewportScale();v.renderer.setPixelRatio(b===1?window.devicePixelRatio:1),v.renderer.setSize(512,512)}catch(F){F instanceof Error&&v.throwError(F)}v.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(f=(d=v.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&f!==void 0?f:THREE__namespace.sRGBEncoding}),v.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),v.camera=new Camera(90),v.scene=new Scene,v.xrCustomObjectsScene=new THREE__namespace.Scene,v.scene.add(v.xrCustomObjectsScene),v.scene.matrixAutoUpdate=!1,v.lastLoadWorkTask=Promise.resolve(),v.requestProxy=(p=e.requestProxy)!==null&&p!==void 0?p:DEFAULT_REQUEST_PROXY,v.networkSubscribe=new NetworkSubscribe,v.networkSubscribe.on("network",function(F,B,L,k){var O;v.emit("network.resource",createEvent("network.resource",{source:F,requestType:B,requestState:L,detail:k})),(O=v.analysis)===null||O===void 0||O.network(v.works,F,B,L,k)}),v.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),v.boundingMesh.name="bounding",v.scene.add(v.boundingMesh),v.models=createModels(),v.models.push(new Model),v.lastModels=createModels(),v.readyCallbacks=[],v.syncingState=!1,v.modelGroup=new THREE__namespace.Group,v.modelGroup.visible=!1,v.modelGroup.name="model",v.modelGroup.matrixAutoUpdate=!1,v.modelGroup.renderOrder=-4,v.scene.add(v.modelGroup),v.helperGroup=new THREE__namespace.Group,v.helperGroup.name="helper",v.helperGroup.matrixAutoUpdate=!1,v.scene.add(v.helperGroup),v.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement()),initLights(v.scene),v.copyEffect=new Effect(v.renderer,v.scene,v.camera,v.models),v.state={mode:v.currentMode,workCode:v.pano.workCode,panoIndex:v.pano.panoIndex,longitude:v.camera.pose.longitude,latitude:v.camera.pose.latitude,fov:v.camera.pose.fov,offset:v.camera.pose.offset.clone(),distance:v.camera.pose.distance},v.stateSynced=!1,v._enableIOSEDR=!1,v.destroyed=!1,v.paused=!0,typeof window!="undefined"&&(e.play!==!1&&v.play(),v.stopAnimationLoop=AnimationFrameLoop.shared.add(function(F,B){for(var L=[],k=2;k<arguments.length;k++)L[k-2]=arguments[k];v.updateTime.apply(v,__spreadArray([F,B],L,!1))},!1,0,10));var T=function(){typeof document!="undefined"&&document.fullscreenElement===null&&v.currentMode==="VRPanorama"&&v.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},E=function(){v.needsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",T,!1),v.renderer&&v.renderer.domElement.addEventListener("webglcontextrestored",E,!1),v.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",T,!1),v.renderer&&v.renderer.domElement.removeEventListener("webglcontextrestored",E,!1)},v.plugins={},e.plugins&&e.plugins.length)for(var _=0,x=e.plugins;_<x.length;_++){var w=x[_];if(typeof w=="function")w(v);else if(Array.isArray(w)){var S=w[0],C=w[1],M=w[2];if(typeof S=="function"){var I=S(v,M);typeof C=="string"&&(v.plugins[C]?v.throwError(new Error("plugin name ".concat(C," is exists."))):v.plugins[C]=I)}}}return v.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1),v.meshReplaceMaterialMap=new Map,v.meshOriginMaterialMap=new Map,initLegacyEvent(v),v}return Object.defineProperty(t,"version",{get:function(){return"6.0.0-alpha.75"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,r,i,o,s){var u=this;if(o===void 0&&(o=1),s===void 0&&(s=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.models.setMaterial({constantColor:s}),this.scene.traverse(function(f){if(!(!(f instanceof THREE__namespace.Mesh)||f instanceof PBMMesh)){var p=Object.keys(i).filter(function(A){return A===f.uuid})[0];if(p)if(u.meshOriginMaterialMap.set(p,f.material),u.meshReplaceMaterialMap.get(p))f.material=u.meshReplaceMaterialMap.get(p);else{var v=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:i[p]}},vertexShader:`
2020
+ `},LineMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(i){this.uniforms.diffuse.value=i}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(i){this.uniforms.linewidth.value=i}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(i){this.uniforms.dashScale.value=i}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(i){this.uniforms.dashSize.value=i}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(i){this.uniforms.gapSize.value=i}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(i){this.uniforms.opacity.value=i}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(i){this.uniforms.resolution.value.copy(i)}}}),r.setValues(e),r}return t}(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=function(n){__extends(t,n);function t(e,r){var i=n.call(this)||this;return i.type="LineSegments2",i.geometry=e!==void 0?e:new LineSegmentsGeometry,i.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),i}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,i=e.attributes.instanceEnd,o=new Float32Array(2*r.count),s=new THREE__namespace.Vector3,u=new THREE__namespace.Vector3,l=0,c=0,d=r.count;l<d;l++,c+=2)s.fromBufferAttribute(r,l),u.fromBufferAttribute(i,l),o[c]=c===0?0:o[c-1],o[c+1]=o[c]+s.distanceTo(u);var f=new THREE__namespace.InstancedInterleavedBuffer(o,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(f,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(f,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=e.ray,o=e.camera,s=o.projectionMatrix,u=this.geometry,l=this.material,c=l.resolution,d=l.linewidth,f=u.attributes.instanceStart,p=u.attributes.instanceEnd,v=new THREE__namespace.Vector4,A=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,h=new THREE__namespace.Matrix4,g=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;i.at(1,m),m.w=1,m.applyMatrix4(o.matrixWorldInverse),m.applyMatrix4(s),m.multiplyScalar(1/m.w),m.x*=c.x/2,m.y*=c.y/2,m.z=0,y.copy(m);var T=this.matrixWorld;h.multiplyMatrices(o.matrixWorldInverse,T);for(var E=0,_=f.count;E<_;E++){v.fromBufferAttribute(f,E),A.fromBufferAttribute(p,E),v.w=1,A.w=1,v.applyMatrix4(h),A.applyMatrix4(h),v.applyMatrix4(s),A.applyMatrix4(s),v.multiplyScalar(1/v.w),A.multiplyScalar(1/A.w);var x=v.z<-1&&A.z<-1,w=v.z>1&&A.z>1;if(!(x||w)){v.x*=c.x/2,v.y*=c.y/2,A.x*=c.x/2,A.y*=c.y/2,g.start.copy(v),g.start.z=0,g.end.copy(A),g.end.z=0;var S=g.closestPointToPointParameter(y,!0);g.at(S,b);var C=THREE__namespace.MathUtils.lerp(v.z,A.z,S),M=C>=-1&&C<=1,I=y.distanceTo(b)<d*.5;if(M&&I){g.start.fromBufferAttribute(f,E),g.end.fromBufferAttribute(p,E),g.start.applyMatrix4(T),g.end.applyMatrix4(T);var F=new THREE__namespace.Vector3,B=new THREE__namespace.Vector3;i.distanceSqToSegment(g.start,g.end,B,F),r.push({point:B,pointOnLine:F,distance:i.origin.distanceTo(B),object:this,faceIndex:E})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(n){__extends(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.type="Line2",i}return t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setPositions.call(this,i),this},t.prototype.setColors=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setColors.call(this,i),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVB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RN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var i=n.call(this)||this;i.type="FiveLine",i.needsRender=!0;var o=new LineGeometry,s=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});i.line=new Line2(o,s);var u=new THREE__namespace.BufferGeometry,l=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return i.points=new THREE__namespace.Points(u,l),i.points.renderOrder=11,i.points.frustumCulled=!1,i.setPoints(e,r),i.add(i.line,i.points),i}return Object.defineProperty(t,"version",{get:function(){return"6.0.0-alpha.77"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var i=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];i==="dashed"?(r.dashed=o,o?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[i]=e[i]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var i=this.line.material.resolution;(i.x!==e||i.y!==r)&&(i.set(e,r),this.needsRender=!0)},t}(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={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 fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t,e,r){return e===void 0&&(e=null),r===void 0&&(r=!0),__awaiter(this,void 0,void 0,function(){var i,o,s,u,l,c;return __generator(this,function(d){switch(d.label){case 0:if(!n)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No basePath supplied");return[4,fetchProfilesList(t)];case 1:if(i=d.sent(),n.profiles.some(function(f){var p=i[f];return p&&(o={profileId:f,profilePath:"".concat(t,"/").concat(p.path),deprecated:!!p.deprecated}),!!o}),!o){if(!e)throw new Error("No matching profile name found");if(s=i[e],!s)throw new Error('No matching profile name found and default profile "'.concat(e,'" missing.'));o={profileId:e,profilePath:"".concat(t,"/").concat(s.path),deprecated:!!s.deprecated}}return[4,fetchJsonFile(o.profilePath)];case 2:if(u=d.sent(),r){if(c=void 0,c=u.layouts[n.handedness],!c)throw new Error("No matching handedness, ".concat(n.handedness,", in profile ").concat(o.profileId));c.assetPath&&(l=o.profilePath.replace("profile.json",c.assetPath))}return[2,{profile:u,assetPath:l}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,i=Math.sqrt(n*n+t*t);if(i>1){var o=Math.atan2(t,n);e=Math.cos(o),r=Math.sin(o)}var s={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return s}var VisualResponse=function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,i=t.button,o=t.state,s=normalizeAxes(e,r),u=s.normalizedXAxis,l=s.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(o)?u:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(o)?l:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(o)?i:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(o):this.value=this.states.includes(o)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n}(),Component=function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(i){var o=new VisualResponse(e.visualResponses[i]);r.visualResponses[i]=o}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(i){i.updateFromComponent(e.values)})},n}(),MotionController=function(){function n(t,e,r){var i=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(o){var s=i.layoutDescription.components[o];i.components[o]=new Component(o,s)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n}(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(i){i instanceof THREE__namespace.Mesh&&i.isMesh&&(i.material.envMap=r.envMap,i.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(i){var o=i.valueNode,s=i.minNode,u=i.maxNode,l=i.value,c=i.valueNodeProperty;o&&(c===Constants.VisualResponseProperty.VISIBILITY?o.visible=l:c===Constants.VisualResponseProperty.TRANSFORM&&(o.quaternion.copy(s.quaternion).slerp(u.quaternion,l),o.position.lerpVectors(s.position,u.position,l)))})}))},t}(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,i=e.touchPointNodeName,o=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(i),e.touchPointNode){var s=new THREE.SphereGeometry(.001),u=new THREE.MeshBasicMaterial({color:255}),l=new THREE.Mesh(s,u);e.touchPointNode.add(l)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(o).forEach(function(c){var d=c.valueNodeName,f=c.minNodeName,p=c.maxNodeName,v=c.valueNodeProperty;if(v===Constants.VisualResponseProperty.TRANSFORM){if(c.minNode=t.getObjectByName(f),c.maxNode=t.getObjectByName(p),!c.minNode){console.warn("Could not find ".concat(f," in the model"));return}if(!c.maxNode){console.warn("Could not find ".concat(p," in the model"));return}}c.valueNode=t.getObjectByName(d),c.valueNode||console.warn("Could not find ".concat(d," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,i=null;return t.addEventListener("connected",function(o){var s=o.data;s.targetRayMode!=="tracked-pointer"||!s.gamepad||fetchProfile(s,e.path,DEFAULT_PROFILE).then(function(u){var l=u.profile,c=u.assetPath;r.motionController=new MotionController(s,l,c);var d=e._assetCache[r.motionController.assetUrl];if(d)i=d.scene.clone(),addAssetSceneToControllerModel(r,i);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(f){e._assetCache[r.motionController.assetUrl]=f,i=f.scene.clone(),addAssetSceneToControllerModel(r,i)})}}).catch(function(u){console.warn(u)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(i),i=null}),r},n}();function mapPanoResource(n,t){if(!t)return n;var e=n.match(/\d+_[a-z].png/);return n.substring(0,e.index)+t+"/"+n.substring(e.index)}var CONTROLLER_EVNET_DELTA_TIME=300,ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(l){r.emit("xr.session.start",createEvent("xr.session.start",{session:l,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.scene.add(r.pointerLines.left,r.pointerLines.right),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade"},r.parallaxCameraMatrixs=[];var i=AnimationFrameLoop.shared.getContext();if(!i)return console.error("获取session失败,请退出重试"),r;r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(i),r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group],r.scene.add(r.controllerWrappers[0],r.controllerWrappers[1]);var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var s=r.xrManager.getController(1);r.controllerWrappers[1].add(s);var u=new XRControllerModelFactory;return u.gltfLoader={load:function(l,c){internalFetcher.ajax(l,{responseType:"arraybuffer"}).then(function(d){var f;return parseGltf(d.body,{resourcePath:l.slice(0,l.lastIndexOf("/")+1),search:(f=l.split("?")[1])!==null&&f!==void 0?f:"",fetcher:internalFetcher})}).then(function(d){return c(d)})}},r.on("xr.session.start",function(){var l=r.xrManager.getControllerGrip(0);l.add(u.createControllerModel(l)),r.controllerWrappers[0].add(l);var c=r.xrManager.getControllerGrip(1);c.add(u.createControllerModel(c)),r.controllerWrappers[1].add(c)}),r.xrControllerState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),i=n.initAnimationEndState.call(this,r);return __assign(__assign({},i),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,r,i){var o=this,s,u,l,c;this.userAction=i,this.stopMomentumMovement();var d=this.works.getResolvedObserver(e);if(!d)throw new Error("Invalid PanoIndex");var f=this.imageOptions.size;if(typeof f=="undefined"&&d){var p=d.images.up.match(/\/cube_(\d+)\//);p&&(f=Number(p[1]))}typeof f=="undefined"&&(f=2048);var v=this.imageOptions.transform,A=function(C,M){return mapPanoResource(applyImageURLOptions(C,v,M))},m=__assign({key:"pano.".concat(d.panoId)},pick(this.imageOptions,["format","size","quality"])),y=d.images,h=(u=(s=d.images.tiles)===null||s===void 0?void 0:s.filter(function(C){return C.size>f}))!==null&&u!==void 0?u:null,g="pano:"+jsonHash([y,m,v]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;var b=this.pendingTextureTask.panoId;(l=this.panoMeshes[b])===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:d.pano})),this.pendingTextureTask.onError(new Error("texture aborted"))}var T=this.models.getMaterial()||{},E=T.pano0,_=T.pano1,x;if((E==null?void 0:E.map.name)===g?x=E:(_==null?void 0:_.map.name)===g&&(x=_),x){var w={panoId:d.panoId,effect:(c=r.effect)!==null&&c!==void 0?c:"fade",leftPanoPicture:{map:x.map,luminanceMap:x.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(d.position,d.quaternion,PANO_TEXTURE_SCALE)},position:d.position.clone()};this.doMoveToPano(d.pano,w,r);return}var S="move-to-pano-"+d.panoId;this.pending.add(S),this.pendingTextureTask={panoId:d.panoId,hash:g,onLoad:function(C){var M;if(o.pending.delete(S),o.destroyed)C.body.dispose();else{C.body.name=g;var I={panoId:d.panoId,effect:(M=r.effect)!==null&&M!==void 0?M:"fade",leftPanoPicture:{map:C.body,luminanceMap:null,matrix:new THREE__namespace.Matrix4().compose(d.position,d.quaternion,PANO_TEXTURE_SCALE)},position:d.position.clone()};o.doMoveToPano(d.pano,I,r)}},onError:function(C){o.pending.delete(S);var M=__assign(__assign(__assign({},d.pano),{mode:o.mode}),clonePose(o.camera.pose));o.emit("pano.error",createEvent("pano.error",{error:C,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:M})),o.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:M})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&h&&h.length?this.textureLoader.loadTiledCubeTexture(y,h,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:A,options:m},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(d.work)},void 0,void 0,function(C){var M,I;o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:C,meta:null,pano:d.pano})),((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===g&&((I=o.panoMeshes[d.panoId])===null||I===void 0||I.setProgress(C))},this.renderer):this.textureLoader.loadCubeTexture(y,{imageURL:{transform:A,options:m},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(d.work)},void 0,void 0,function(C){var M,I;((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===g&&((I=o.panoMeshes[d.panoId])===null||I===void 0||I.setProgress(C)),o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:C,meta:null,pano:d.pano}))},this.renderer)]).then(function(C){var M,I,F=C[0];((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===g?(o.pendingTextureTask.onLoad(F),(I=o.panoMeshes[d.panoId])===null||I===void 0||I.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:F.meta,pano:d.pano}))):F.body.dispose()}).catch(function(C){var M,I;((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===g&&(o.pendingTextureTask.onError(C),(I=o.panoMeshes[d.panoId])===null||I===void 0||I.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.error",createEvent("pano.texture.error",{error:C,progress:0,meta:null,pano:d.pano})),o.emit("error",C))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:d.pano}))},t.prototype.doMoveToPano=function(e,r,i){var o=this,s,u,l;i===void 0&&(i={});var c=now(),d=createUuid();this.panoResources[d]=r;var f=1,p,v,A;if(this.locationMotion.ended){var m=this.locationMotion.getKeyFrameSegment(c);m[0];var y=m[1],h=this.locationMotion.value,g=this.panoResourceFromLocationMotionKeyframe(y).position,b=r.position;p=Math.max(g.distanceTo(b),f),v=[{key:y.key,progress:0,value:__assign(__assign({},h),{count:0})},{key:d,progress:1,value:{distance:0,count:1}}],A=0}else{var T=this.locationMotion.getKeyFrameSegment(c),E=T[0],y=T[1],h=this.locationMotion.value,_=this.panoResourceFromLocationMotionKeyframe(E).position,g=this.panoResourceFromLocationMotionKeyframe(y).position,b=r.position,x=y.value.count-h.count,w=Math.max(_.distanceTo(g),f)*x,S=Math.max(g.distanceTo(b),f);p=w+S,v=[{key:E.key,progress:0,value:__assign({},h)},{key:y.key,progress:w/p,value:y.value},{key:d,progress:1,value:{count:y.value.count+1,distance:0}}];var C=this.locationMotionKeyframesLength(this.locationMotion.keyframes),M=this.locationMotionKeyframesLength(v);A=this.locationMotion.getProgressVelocity(c)*C/M}var I=this.calculateMovingDuration(i.duration,p),F={longitude:i.longitude,latitude:i.latitude,fov:i.fov},B=__assign(__assign({},e),{mode:this.mode,longitude:(s=F.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=F.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(l=F.fov)!==null&&l!==void 0?l:this.camera.pose.fov,offset:r.position.clone(),distance:0}),L=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:i,prevPano:L,progress:0,state:B,userAction:this.userAction,error:null})),i.moveStartCallback&&i.moveStartCallback(B),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(F,I).catch(noop$1);var k=this.locationMotion.setKeyframes(v,I,A);k.then(function(){var O,U,V,N=__assign(__assign({},e),{mode:o.mode,longitude:o.camera.pose.longitude,latitude:o.camera.pose.latitude,fov:o.camera.pose.fov,offset:o.camera.pose.offset.clone(),distance:0});o.emit("pano.arrived",createEvent("pano.arrived",{options:i,prevPano:L,progress:1,state:N,userAction:o.userAction,error:null})),i.moveEndCallback&&i.moveEndCallback(N);var Q=o.works.getResolvedObserver(o.currentPano);if(Q&&Q.video&&o.videoTexture&&o.videoTexture.image instanceof HTMLVideoElement){var G=ROTATE_Y_PI_MATRIX.clone().multiply((V=(U=(O=o.models.getMaterial())===null||O===void 0?void 0:O.pano1)===null||U===void 0?void 0:U.matrix)!==null&&V!==void 0?V:new THREE__namespace.Matrix4).multiply(Q.video.matrix),q={map:o.videoTexture,size:Q.video.size,matrix:G,alpha:1},W=createUuid(),z=o.videoTexture.image;z.setAttribute("uuid",W),canplayVideo().then(function(X){X&&Q.video&&z.getAttribute("uuid")===W&&(z.oncanplay=function(){z.oncanplay=noop$1,z.play()},z.ontimeupdate=function(){z.currentTime>.5&&(z.ontimeupdate=noop$1,o.panoVideo.setMaterial(q))},z.src=Q.video.source)}).catch(function(){z.removeAttribute("uuid")})}},function(){o.emit("pano.cancel",createEvent("pano.cancel",{options:i,prevPano:L,progress:0,state:B,userAction:o.userAction,error:null})),i.moveCancelCallback&&i.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,i,o,s,u;this.stopMomentumMovement();var l=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),c=null,d=this.works.getResolvedObserver(this.currentPano);if(!d)return null;var f=d.accessibleIds.filter(function(W){var z=panoParse(W);if(panoEqual(z,r.currentPano))return!1;var X=r.works.getResolvedObserver(z);return!X||X.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:X.loadable||X.active}),p=this.models.intersectRaycaster(e)[0];if(p){var v=arrayMin(f,function(W){var z=r.works.getResolvedObserver(W);if(!z)return 1/0;var X=z.standingPosition.clone();return X.distanceTo(p.point)},!0),A=v[0],m=v[1];A&&m<this.panoTapTriggerRadius&&(c=(i=this.works.getResolvedObserver(A))!==null&&i!==void 0?i:null)}if(isNil(c)){var y=this.getForwardObserverOrNot(e);y&&(c=y)}for(var h=0,g=this.locationMotion.keyframes;h<g.length;h++){var b=g[h],T=this.panoResourceFromLocationMotionKeyframe(b);if(!(b.progress<this.locationMotion.progress)&&c&&T.panoId===c.panoId){c=null;break}}if(isNil(c))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(c&&!c.active){var E=c.panoId;this.panoMeshes[E]&&(this.panoMeshes[E].setDisabled(!1),this.panoMeshes[E].setLoading(!0))}var _={};if(c){_.effect="fade";for(var x=Math.PI/6,w=Math.PI/12,S=new THREE__namespace.Vector3(0,1,0),C=c.position.clone().setY(0).sub(d.position.clone().setY(0)).normalize(),M=C.clone().applyAxisAngle(S,x),I=C.clone().applyAxisAngle(S,-x),F=[],B=[],L=[],k=0,O=c.accessibleIds;k<O.length;k++){var A=O[k],U=panoParse(A);if(!(panoEqual(U,this.currentPano)||panoEqual(U,c.pano))){var V=this.works.getResolvedObserver(A);if(V){var N=V.position.clone().sub(c.position).setY(0);C.angleTo(N)<x?L.push(N):M.angleTo(N)<x?F.push(N):I.angleTo(N)<x&&B.push(N)}}}var Q=L.length>0?L:__spreadArray(__spreadArray([],F,!0),B,!0),G=Q.slice().sort(function(W,z){return W.angleTo(C)-z.angleTo(C)})[0];G&&G.angleTo(l)>w&&(_.longitude=Math.atan2(-G.x,-G.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(_.latitude=clamp(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(_.fov=this.defaultFov);var q={workCode:c.pano.workCode,panoIndex:c.pano.panoIndex,mode:this.mode,longitude:(o=_.longitude)!==null&&o!==void 0?o:this.camera.pose.longitude,latitude:(s=_.latitude)!==null&&s!==void 0?s:this.camera.pose.latitude,fov:(u=_.fov)!==null&&u!==void 0?u:this.camera.pose.fov,distance:0,offset:c?c.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:q,userAction:!0,options:_,progress:0,error:null})),c&&c.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:q,options:_,error:null})),c.pano):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,i){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,i){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var i=this,o,s,u,l,c,d,f,p,v=[],A=2;A<arguments.length;A++)v[A-2]=arguments[A];this.userAction=!0;var m={},y={},h=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),m.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var T=this.locationMotion.getKeyFrameSegment(e),E=T[0],_=T[1],x=this.panoResourceFromLocationMotionKeyframe(E),w=this.panoResourceFromLocationMotionKeyframe(_),S=new THREE__namespace.Vector3().copy(x.position),C=new THREE__namespace.Vector3().copy(w.position),M=this.locationMotion.value.count-_.value.count+1;m.progress=M,w.leftPanoPicture&&(M<1?x.leftPanoPicture&&(m.pano0=x.leftPanoPicture):m.pano0=w.leftPanoPicture,m.pano1=w.leftPanoPicture),b=m.useBlackTransition=w.effect==="instant"||w.effect==="montage",(w.effect==="fade"||w.effect==="montage")&&(m.pano0&&x.leftPanoPicture&&(m.pano0={map:m.pano0.map,luminanceMap:m.pano0.luminanceMap,matrix:x.leftPanoPicture.matrix.clone().setPosition(w.position)}),S.copy(C)),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(S.x+(C.x-S.x)*M,S.y+(C.y-S.y)*M,S.z+(C.z-S.z)*M);for(var I=[],F=[],B=0,L=this.locationMotion.keyframes;B<L.length;B++){var k=L[B],O=k.key,U=k.progress;O!==void 0&&(I.push(O),U>=this.locationMotion.progress&&F.push(O))}for(var V=0,N=Object.keys(this.panoResources);V<N.length;V++){var Q=N[V];if(!(F.indexOf(Q)>=0)){var G=this.panoResources[Q];if(G.leftPanoPicture){var q=G.leftPanoPicture.map;if(q){if(q===((o=m.pano0)===null||o===void 0?void 0:o.map)||q===((s=m.pano1)===null||s===void 0?void 0:s.map))continue;q instanceof TileCubeTextureTarget&&q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(q.cubeRenderTarget),q.dispose(),G.leftPanoPicture=null}}I.indexOf(Q)>=0||delete this.panoResources[Q]}}this.currentPano=panoParse(w.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(h.panoId),state:__assign(__assign(__assign(__assign({},panoParse(g.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(m)===!1&&(!((u=m.pano0)===null||u===void 0)&&u.map&&m.pano0.map instanceof TileCubeTextureTarget&&!m.pano0.map.cubeRenderTarget&&(m.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((l=m.pano1)===null||l===void 0)&&l.map&&m.pano1.map instanceof TileCubeTextureTarget&&!m.pano1.map.cubeRenderTarget&&(m.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(m)),isEmptyObject(y)===!1&&this.setCamera(y);var W=this.works.getResolvedObserver(this.currentPano),z=v[1];if(!z){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var X=this.xrManager.referenceSpace;if(X){var re=this.xrManager.cameraVR,J=this.xrManager.cameraL,$=this.xrManager.cameraR,ee=[J,$],oe=z.getViewerPose(X),ae=new THREE__namespace.Vector3(0,0,0);if(oe){var ne;ne=this.xrManager.session.renderState.baseLayer;var le=oe.views;if(!ne){console.error("no layer found");return}this.renderer.setFramebuffer(ne.framebuffer);var ie=!1;le.length!==re.cameras.length&&(re.cameras.length=0,ie=!0),this.parallaxCameraMatrixs=[];var fe=new THREE__namespace.Vector3,Z=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(le[0].transform.matrix).decompose(fe,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(le[1].transform.matrix).decompose(Z,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),Z.clone().sub(fe).normalize();var te=new THREE__namespace.Vector3,K=new THREE__namespace.Quaternion,pe=new THREE__namespace.Vector3;this.camera.matrix.decompose(te,K,pe);for(var ve=0;ve<le.length;ve++){var we=le[ve],_e=ne.getViewport(we),ye=ee[ve];ye.matrix.fromArray(we.transform.matrix);var Be=new THREE__namespace.Vector3,Ae=new THREE__namespace.Quaternion,ue=new THREE__namespace.Vector3;ye.matrix.decompose(Be,Ae,ue),ae.copy(te),ye.position.copy(te),ye.quaternion.copy(Ae),ye.scale.copy(ue),ye.updateMatrix(),ye.projectionMatrix.fromArray(we.projectionMatrix),ye.viewport.set(_e.x,_e.y,_e.width,_e.height),ie===!0&&re.cameras.push(ye)}oe.views[0].transform.position,oe.views[1].transform.position;for(var se=this.xrManager.session.inputSources,ve=0;ve<this.xrManager.controllers.length;ve++){var Ce=this.xrManager.controllers[ve],de=se[ve];if(de){Ce.update(de,z,X);var be=this.xrManager.getController(ve),me=new THREE__namespace.Vector3(0,1.2,0),Ie=be.position.clone().add(ae).sub(me);de.handedness==="left"?this.xrControllerRay.left.set(Ie,new THREE__namespace.Vector3(0,0,-1).applyEuler(be.rotation)):de.handedness==="right"&&this.xrControllerRay.right.set(Ie,new THREE__namespace.Vector3(0,0,-1).applyEuler(be.rotation)),this.controllerWrappers[ve].position.copy(new THREE__namespace.Vector3(0,0,0).add(ae).sub(me));var Ee=this.models.intersectRaycaster(this.xrControllerRay.right);if(Ee.length===0&&(Ee=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(Le){var ke;return __assign({floor:(ke=W==null?void 0:W.floorIndex)!==null&&ke!==void 0?ke:0},Le)})),Ee.length>=1&&Ee[0].face)if(de.handedness==="right"){var Xe=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),ot=Ee[0].face.normal,Se=ot.clone().multiplyScalar(.05),Ve=Ee[0].point.clone().add(Se);this.intersectMesh.position.copy(Ve);var ft=Ve.clone().add(Se);if(this.intersectMesh.lookAt(ft),Math.abs(ot.y)>.99){var Me=this.camera.position.clone().sub(Ve);this.intersectMesh.rotation.z=-Math.atan2(Me.z,Me.x)}this.intersectMesh.visible=!0,this.needsRender=!0,Xe.length>0?(this.pointerLines.right.setPoints(Ie,Xe[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(Ie,Ee[0].point));var De=Ee[0],Ue=createEvent("intersect.update",{raycaster:(c=this.xrControllerRay.right)!==null&&c!==void 0?c:null,intersection:De!=null?De:null,object:this.intersectMesh});if(this.emit("intersect.update",Ue),Ue.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(Ie,Ee[0].point)}}if(this.camera.pose.distance>.1||b){if(W)for(var qe=0,je=Object.keys(this.panoMeshes);qe<je.length;qe++){var He=je[qe],he=this.panoMeshes[He];he.setOpacity(0),he.setCurrent(!1),he.updateTime&&he.updateTime(e,r)}}else if(W){var it=arrayMin(W.visibleIds,function(Pe){var Le=i.works.getResolvedObserver(Pe);return Le?W.standingPosition.distanceTo(Le.standingPosition):1/0},!0),Qe=it[1];Qe=clamp(Qe,2.5,1/0);for(var Ye=W.visibleIds.concat(panoStringify(this.currentPano)),Ge=this.getForwardObserverOrNot(),vt=this.camera.getDirection(new THREE__namespace.Vector3),st=0,ut=Object.keys(this.panoMeshes);st<ut.length;st++){var He=ut[st],he=this.panoMeshes[He],$e=this.works.getResolvedObserver(He);if(Ye.indexOf(He)===-1)he.setCurrent(!1),he.setOpacity(0);else if(!$e)he.setCurrent(!1),he.setOpacity(0);else if(!$e.loadable&&!$e.active)he.setCurrent(!1),he.setOpacity(0);else{var et=he.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);he.setCurrent(!he.loading&&he.progress===0&&Ge!==null&&Ge.panoId===He),he.setOpacity(et<.01?0:clamp(Qe/et*1.2,.65,.98));var Re=this.camera.position.clone().setY(he.position.y),Te=new THREE__namespace.Vector3().copy(he.position).sub(Re).normalize();if(He===panoStringify(this.currentPano)){var ze=clamp((.5-Re.distanceTo(he.position))/.5,0,1);Te.multiplyScalar(1-ze).add(vt.clone().multiplyScalar(ze))}Te.length()>0&&he.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(Te.x,Te.z),0))}he.updateTime&&he.updateTime(e,r)}}var tt=function(){if(i.tileLevelForFov===!1)return 0;var Pe=new THREE__namespace.Vector2(4e3,4e3),Le=g.panoId,ke=i.works.getResolvedObserver(Le),Oe=i.imageOptions.size;if(typeof Oe=="undefined"&&ke){var yt=ke.images.up.match(/\/cube_(\d+)\//);yt&&(Oe=Number(yt[1]))}typeof Oe=="undefined"&&(Oe=2048);var ct=0;Oe>=1024&&(ct=1),Oe>=2048&&(ct=2),Oe>=4096&&(ct=3),Oe>=8192&&(ct=4);var dt=i.tileLevelForFov(J.fov,Pe);return dt>ct?dt:0}(),mt=function(){var Pe=new THREE__namespace.PerspectiveCamera;Pe.applyMatrix4(re.matrix),Pe.position.set(0,0,0);var Le=i.works.getResolvedObserver(g.panoId),ke=Le!=null?Le:W;ke&&Pe.quaternion.premultiply(ke.quaternion.clone().inverse()),Pe.updateProjectionMatrix(),Pe.updateMatrixWorld(!0);var Oe=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(Pe.projectionMatrix,Pe.matrixWorldInverse));return Oe}();g.panoId===panoStringify(this.currentPano)&&((d=g.leftPanoPicture)===null||d===void 0?void 0:d.map)instanceof TileCubeTextureTarget&&(g.leftPanoPicture.map.update(mt,tt),g.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0));{var gt=this.tiling.object.visible;if(tt>this.TILED_CUBE_TEXTURE_LEVEL&&this.initAnimationed){var lt=g.panoId,Fe=this.works.getResolvedObserver(lt);Fe?isSimilarVector3(this.camera.position,Fe.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==lt&&this.tiling.cleanup(),this.tiling.panoId=lt,this.tiling.setResource((p=(f=Fe.images)===null||f===void 0?void 0:f.tiles)!==null&&p!==void 0?p:[],this.enableIOSEDR&&Fe.images.luminance?Fe.images.luminance:null),this.tiling.setFetcher(getFetcher(Fe.work)),this.tiling.setRotation(Fe.quaternion),this.tiling.setPosition(Fe.position),this.tiling.update(mt,tt,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;gt!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),!(!se||se.length<1)&&this.updateControllerHelper(se,e,r)}}},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.scene,e)},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var u={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},l=0;l<e.length;l++){var c=e[l].handedness,d=e[l].gamepad;switch(c){case"left":d.axes&&(this.emitEvent(d.axes[2]===-1,"LeftAxesLeft",r),this.emitEvent(d.axes[2]===1,"LeftAxesRight",r),this.emitEvent(d.axes[3]===-1,"LeftAxesUp",r),this.emitEvent(d.axes[3]===1,"LeftAxesDown",r)),d!=null&&d.buttons&&(this.emitEvent(d==null?void 0:d.buttons[4].pressed,"X",r),this.emitEvent(d.buttons[5].pressed,"Y",r),this.emitEvent(d==null?void 0:d.buttons[0].pressed,"LeftTrigger",r),this.emitEvent(d==null?void 0:d.buttons[1].pressed,"LeftPinch",r));var f={raycaster:o,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.buttons.X=d.buttons&&d.buttons[4]?d.buttons[4].pressed:!1,u.buttons.Y=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.LeftTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.LeftPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1,u.left=f;break;case"right":d.axes&&(this.emitEvent(d.axes[2]===-1,"RightAxesLeft",r),this.emitEvent(d.axes[2]===1,"RightAxesRight",r),this.emitEvent(d.axes[3]===-1,"RightAxesUp",r),this.emitEvent(d.axes[3]===1,"RightAxesDown",r)),d.buttons&&(this.emitEvent(d==null?void 0:d.buttons[4].pressed,"A",r),this.emitEvent(d.buttons[5].pressed,"B",r),this.emitEvent(d==null?void 0:d.buttons[0].pressed,"RightTrigger",r),this.emitEvent(d==null?void 0:d.buttons[1].pressed,"RightPinch",r));var p={raycaster:s,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.right=p,u.buttons.A=d.buttons&&d.buttons[4]?d==null?void 0:d.buttons[4].pressed:!1,u.buttons.B=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.RightTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.RightPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",u))}},t.prototype.emitEvent=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(e)if(this.xrControllerState[r].touchStart===!1)this.xrControllerState[r].touchStartTime=i,this.xrControllerState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}));else{var u=i-this.xrControllerState[r].touchStartTime;u>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}))}else if(this.xrControllerState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}));var u=i-this.xrControllerState[r].touchStartTime;if(u<=CONTROLLER_EVNET_DELTA_TIME){var l=this.emit("xr.gesture.tap",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}));l||r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrControllerState[r].touchStart=!1,this.xrControllerState[r].touchStartTime=0}},t}(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,DepthPanorama:DepthPanoramaController,Mapview:MapviewController,XRPanorama:XRPanoramaController},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(n){{var t=new THREE__namespace.DirectionalLight(16777215,.5);t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.3);n.add(t)}}function parseKeyValue(n){for(var t,e,r={},i=n.split(/(\;|\,)/),o=0,s=i;o<s.length;o++){var u=s[o],l=u.split("="),c=(t=l[0])===null||t===void 0?void 0:t.trim(),d=(e=l[1])===null||e===void 0?void 0:e.trim();c&&d&&(r[c]=d)}return r}function getViewportScale(){for(var n,t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var i=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),o=Number(i["initial-scale"]);if(!isNaN(o))return o}}return 1}const textureURL="data:image/png;base64,iVBORw0KGgoAAAANS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JKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),i=n.getScissor(prevScissor),o=n.getScissorTest(),s=n.autoClear,u=i.x+imageOffset[0]/3,l=i.y+imageOffset[1]/3,c=imageSize[0]/3,d=imageSize[1]/3;n.setViewport(u,l,c,d),n.setScissor(u,l,c,d),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(i),n.setScissorTest(o),n.autoClear=s}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop$1},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},BUILTIN_COORDINATESSYSTEMTRANSFORMERS=[{name:"Z",transformToUpAxisZ:function(){return new THREE__namespace.Matrix4}},{name:"Y",transformToUpAxisZ:function(){return new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(1,0,0),+Math.PI/2)}},{name:"-Y",transformToUpAxisZ:function(){return new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(1,0,0),-Math.PI/2)}},{name:"WGS84",transformToEarthCentered:function(){return new THREE__namespace.Matrix4}},{name:"GCJ02",transformToEarthCentered:function(){return new THREE__namespace.Matrix4}},{name:"BD09",transformToEarthCentered:function(){return new THREE__namespace.Matrix4}}],sharedVector2=new THREE__namespace.Vector2,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]),Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,l,c,d,f,p,v=n.call(this)||this;v.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[v.ident]=v),v.renderSwitch01=0,v.currentMode="Panorama",v.pano={workCode:"",panoIndex:0},v.needsRender=!1,v.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,v.imageOptions=__assign({},(i=e.imageOptions)!==null&&i!==void 0?i:{}),v.textureOptions=__assign({},(o=e.textureOptions)!==null&&o!==void 0?o:{}),v.poweredByRealsee=(s=e.poweredByRealsee)!==null&&s!==void 0?s:!0,v.extraElements=[],v.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),DepthPanorama:Object.assign({},e.depthPanorama),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},v.coordinatesSystemTransformers=__spreadArray([],(u=e.coordinatesSystemTransformers)!==null&&u!==void 0?u:[],!0);for(var A=function(F){var B=m.coordinatesSystemTransformers.find(function(L){return L.name===F.name});B||m.coordinatesSystemTransformers.push(__assign({},F))},m=this,y=0,h=BUILTIN_COORDINATESSYSTEMTRANSFORMERS;y<h.length;y++){var g=h[y];A(g)}if(v.fps={testCount:0,testTime:now()},v.info=null,v.modeChangeDuration=(l=e.modeChangeDuration)!==null&&l!==void 0?l:DEFAULT_MODE_CHANGE_DURATION,v.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if(e.renderer)e.renderer instanceof InternalWebGLRenderer&&v.throwError(new Error("cannot render a internal renderer")),v.renderer=e.renderer;else try{v.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e==null?void 0:e.webgl2});var b=getViewportScale();v.renderer.setPixelRatio(b===1?window.devicePixelRatio:1),v.renderer.setSize(512,512)}catch(F){F instanceof Error&&v.throwError(F)}v.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(f=(d=v.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&f!==void 0?f:THREE__namespace.sRGBEncoding}),v.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),v.camera=new Camera(90),v.scene=new Scene,v.xrCustomObjectsScene=new THREE__namespace.Scene,v.scene.add(v.xrCustomObjectsScene),v.scene.matrixAutoUpdate=!1,v.lastLoadWorkTask=Promise.resolve(),v.requestProxy=(p=e.requestProxy)!==null&&p!==void 0?p:DEFAULT_REQUEST_PROXY,v.networkSubscribe=new NetworkSubscribe,v.networkSubscribe.on("network",function(F,B,L,k){var O;v.emit("network.resource",createEvent("network.resource",{source:F,requestType:B,requestState:L,detail:k})),(O=v.analysis)===null||O===void 0||O.network(v.works,F,B,L,k)}),v.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),v.boundingMesh.name="bounding",v.scene.add(v.boundingMesh),v.models=createModels(),v.models.push(new Model),v.lastModels=createModels(),v.readyCallbacks=[],v.syncingState=!1,v.modelGroup=new THREE__namespace.Group,v.modelGroup.visible=!1,v.modelGroup.name="model",v.modelGroup.matrixAutoUpdate=!1,v.modelGroup.renderOrder=-4,v.scene.add(v.modelGroup),v.helperGroup=new THREE__namespace.Group,v.helperGroup.name="helper",v.helperGroup.matrixAutoUpdate=!1,v.scene.add(v.helperGroup),v.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement()),initLights(v.scene),v.copyEffect=new Effect(v.renderer,v.scene,v.camera,v.models),v.state={mode:v.currentMode,workCode:v.pano.workCode,panoIndex:v.pano.panoIndex,longitude:v.camera.pose.longitude,latitude:v.camera.pose.latitude,fov:v.camera.pose.fov,offset:v.camera.pose.offset.clone(),distance:v.camera.pose.distance},v.stateSynced=!1,v._enableIOSEDR=!1,v.destroyed=!1,v.paused=!0,typeof window!="undefined"&&(e.play!==!1&&v.play(),v.stopAnimationLoop=AnimationFrameLoop.shared.add(function(F,B){for(var L=[],k=2;k<arguments.length;k++)L[k-2]=arguments[k];v.updateTime.apply(v,__spreadArray([F,B],L,!1))},!1,0,10));var T=function(){typeof document!="undefined"&&document.fullscreenElement===null&&v.currentMode==="VRPanorama"&&v.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},E=function(){v.needsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",T,!1),v.renderer&&v.renderer.domElement.addEventListener("webglcontextrestored",E,!1),v.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",T,!1),v.renderer&&v.renderer.domElement.removeEventListener("webglcontextrestored",E,!1)},v.plugins={},e.plugins&&e.plugins.length)for(var _=0,x=e.plugins;_<x.length;_++){var w=x[_];if(typeof w=="function")w(v);else if(Array.isArray(w)){var S=w[0],C=w[1],M=w[2];if(typeof S=="function"){var I=S(v,M);typeof C=="string"&&(v.plugins[C]?v.throwError(new Error("plugin name ".concat(C," is exists."))):v.plugins[C]=I)}}}return v.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1),v.meshReplaceMaterialMap=new Map,v.meshOriginMaterialMap=new Map,initLegacyEvent(v),v}return Object.defineProperty(t,"version",{get:function(){return"6.0.0-alpha.77"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,r,i,o,s){var u=this;if(o===void 0&&(o=1),s===void 0&&(s=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.models.setMaterial({constantColor:s}),this.scene.traverse(function(f){if(!(!(f instanceof THREE__namespace.Mesh)||f instanceof PBMMesh)){var p=Object.keys(i).filter(function(A){return A===f.uuid})[0];if(p)if(u.meshOriginMaterialMap.set(p,f.material),u.meshReplaceMaterialMap.get(p))f.material=u.meshReplaceMaterialMap.get(p);else{var v=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:i[p]}},vertexShader:`
2021
2021
  void main() {
2022
2022
  vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
2023
2023
  gl_Position = projectionMatrix * mvPosition;