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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/five/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 1/3/2024
5
- * Version: 6.0.0-alpha.75
4
+ * Generated: 2024/1/20
5
+ * Version: 6.0.0-alpha.76
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
- `,nu=[];function uc(){var n=nu.pop();return n||new d.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:oc,fragmentShader:sc,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:d.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function lc(n){n.uniforms.map.value=null,nu.push(n)}function cc(n,t,e){var r=new d.Scene;r.matrixAutoUpdate=!1;var i=new d.Group;i.scale.set(1,1,-1),r.add(i);for(var a=[],o=0,s=n;o<s.length;o++){var u=s[o],c=uc();a.push(c),c.uniforms.map.value=u.texture,c.uniforms.flipY.value=u.flipY?1:0;var l=new d.Group,h=new d.Mesh(ac,c);h.position.set(u.position.x+u.size.x/2-.5,1-(u.position.y+u.size.y/2)-.5,-.5),h.scale.set(u.size.x,u.size.y,1),l.quaternion.copy(ic[u.face]),l.add(h),i.add(l)}var p=e.autoClear;e.autoClear=!1;var v=new d.CubeCamera(.1,2,t);v.matrixAutoUpdate=!1,v.update(e,r),e.autoClear=p;for(var m=0,A=a;m<A.length;m++){var c=A[m];lc(c)}}var dc=function(){return!1}();function ci(){var n=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){n.onerror=n.onload=n.close=Q,n.decoding="async";var t=n.src;n.removeAttribute("src"),/^blob\:/.test(t)&&URL.revokeObjectURL(t)}});return n}function da(n){return new Promise(function(t,e){var r=ci();r.onload=function(){/^blob\:/.test(r.src)&&URL.revokeObjectURL(r.src),r.onload=r.onerror=Q,setTimeout(function(){t(r)},0)},r.onerror=function(){var i=r.src;r.onload=r.onerror=Q,r.close(),e(new Error("image load error: ".concat(i)))},r.src=URL.createObjectURL(n)})}var yo=[];function fc(n,t){var e=yo.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=Q,yo.push(r)}});return r}function bo(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=fc(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 d.Texture(e);i.needsUpdate=!0,i.flipY=!0;var a=i.dispose;return i.dispose=function(){e.close(),a.call(i),i.dispose=a},i}else{var o=new d.Texture(n);o.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?o.flipY=!1:o.flipY=!0;var s=o.dispose;return o.dispose=function(){n.close(),s.call(o),o.dispose=s},o}}function hc(n){var t=new d.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 a=i[r];a.close()}e.call(t),t.dispose=e},t}var zr=["right","left","up","down","front","back"],pc=4,Le=function(){function n(t,e,r,i,a){this.tileTree=e,this.tileSources=r,this.options=i,this.renderer=a,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,a,o;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:d.RGBAFormat,t.texture.minFilter=(r=this.options.minFilter)!==null&&r!==void 0?r:d.LinearFilter,t.texture.magFilter=(i=this.options.magFilter)!==null&&i!==void 0?i:d.LinearFilter,t.texture.wrapS=(a=this.options.wrapS)!==null&&a!==void 0?a:d.ClampToEdgeWrapping,t.texture.wrapT=(o=this.options.wrapT)!==null&&o!==void 0?o:d.ClampToEdgeWrapping,this.baseCubeTexture&&(ca(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&ca(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),n.prototype.requestTile=function(t){var e=this,r,i,a,o,s,u,c=this.tileSources.filter(function(A){return A.level===t.level})[0];if(!c){this.loadedCubeNodes.add(t);return}var l=c.size,h=Math.pow(2,t.level)*t.position.y,p=Math.pow(2,t.level)*t.position.x,v="".concat(((a=(i=(r=this.options.imageURL)===null||r===void 0?void 0:r.options)===null||i===void 0?void 0:i.key)!==null&&a!==void 0?a:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(h,".").concat(p),m=F(F({},(s=(o=this.options.imageURL)===null||o===void 0?void 0:o.options)!==null&&s!==void 0?s:{key:"unknown"}),{key:v,size:l*t.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[l*t.position.x,l*t.position.y,l*t.size,l*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(c[t.face],{imageURL:{transform:(u=this.options.imageURL)===null||u===void 0?void 0:u.transform,options:F({},m)},format:d.RGBAFormat,timeout:this.options.timeout,fetcher:this.options.fetcher}).then(function(A){if(e.disposed){A.body.dispose();return}e.textures.push({face:t.face,level:t.level,position:t.position,size:new d.Vector2(t.size,t.size),texture:A.body,flipY:!A.body.flipY}),e.loadedCubeNodes.add(t)}).catch(Q).then(function(){e.disposed||e.loadingCubeNodes.delete(t)})},n.prototype.update=function(t,e){var r=this;if(!this.disposed){var i=[];Oa(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 a=0,o=i;a<o.length;a++){var s=o[a];this.requestTile(s)}if(this.cubeRenderTarget&&this.textures.length){var u=this.textures.splice(0,pc);cc(u,this.cubeRenderTarget,this.renderer),this.needsRender=!0;for(var c=0,l=u;c<l.length;c++){var h=l[c];h.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}(),An=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,i,a,o){var s,u,c,l;r===void 0&&(r=Q),i===void 0&&(i=Q),a===void 0&&(a=Q);var h={};typeof e.flipY!="undefined"&&(h.flipY=e.flipY),typeof e.format!="undefined"&&(h.format=e.format),typeof e.minFilter!="undefined"&&(h.minFilter=e.minFilter),typeof e.magFilter!="undefined"&&(h.magFilter=e.magFilter);var p=(u=(s=e.imageURL)===null||s===void 0?void 0:s.options)!==null&&u!==void 0?u:{key:"unknown"};t=li(t,(c=e.imageURL)===null||c===void 0?void 0:c.transform,p);var v=mo(t),m=(l=e.viaAjax)!==null&&l!==void 0?l:dc,A=Ao(t),y=/^https?:/.test(v);if(A?m=!0:y||(m=!1),m){var f=null,g="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:g},void 0,void 0,a).then(function(w){return da(w.body)}).then(function(w){return bo(w,e.maxSize)}).then(function(w){return Object.assign(w,h),w}).then(function(w){var E={meta:f,body:w};return r(E),E}).catch(function(w){return i(w),Promise.reject(w)})}else{var b=null,x;return Promise.resolve().then(function(){return ci()}).then(function(w){return x=w,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,a,w)}).then(function(w){return b=w.meta,bo(w.body,e.maxSize)}).then(function(w){return Object.assign(w,h),w}).then(function(w){var E={meta:b,body:w};return r(E),E}).catch(function(w){return x&&x.close(),i(w),Promise.reject(w)})}},n.prototype.loadCubeTexture=function(t,e,r,i,a,o){var s,u,c,l;r===void 0&&(r=Q),i===void 0&&(i=Q),a===void 0&&(a=Q),typeof e.format!="undefined"&&e.format,typeof e.minFilter!="undefined"&&e.minFilter,typeof e.magFilter!="undefined"&&e.magFilter;for(var h=[t[zr[0]],t[zr[1]],t[zr[2]],t[zr[3]],t[zr[4]],t[zr[5]]],p=[],v=[0,0,0,0,0,0],m=[],A=function(f){var g=(u=(s=e.imageURL)===null||s===void 0?void 0:s.options)!==null&&u!==void 0?u:{key:"unknown"},b=li(h[f],(c=e.imageURL)===null||c===void 0?void 0:c.transform,F(F({},g),{key:g.key+"."+zr[f]})),x=mo(b),w=function(B){v[f]=B,a(v.reduce(function(L,k){return L+k},0)/6)},E=(l=e.viaAjax)!==null&&l!==void 0?l:!1,M=/^https?:$/.test(x),C=Ao(b);if(C?E=!0:M||(E=!1),E){var S="blob",P=e.fetcher.ajax(b,{timeout:e.timeout,responseType:S},void 0,void 0,w).then(function(B){return m[f]=B.meta,da(B.body)});p.push(P)}else{var I,P=Promise.resolve().then(function(){return ci()}).then(function(L){return I=L,e.fetcher.loadImage(b,{timeout:e.timeout},void 0,void 0,w,L)}).then(function(L){return m[f]=L.meta,L.body}).catch(function(L){return I&&I.close(),Promise.reject(L)});p.push(P)}},y=0;y<6;y++)A(y);return Promise.all(p).then(function(f){return hc(f)}).then(function(f){return Object.assign(f,F({encoding:d.sRGBEncoding},e)),f}).then(function(f){var g={body:f,meta:m};return r(g),g}).catch(function(f){for(var g=0,b=p;g<b.length;g++){var x=b[g];x.then(function(w){return w.close()}).catch(Q)}return i(f),Promise.reject(f)})},n.prototype.loadTiledCubeTexture=function(t,e,r,i,a,o,s){var u=this;return i===void 0&&(i=Q),a===void 0&&(a=Q),o===void 0&&(o=Q),new Promise(function(c,l){var h,p;u.loadCubeTexture(t,{imageURL:{transform:(h=r.imageURL)===null||h===void 0?void 0:h.transform,options:(p=r.imageURL)===null||p===void 0?void 0:p.options},format:d.RGBAFormat,viaAjax:r.viaAjax,timeout:r.timeout,fetcher:r.fetcher},function(v){var m,A,y=v.meta,f=v.body,g=(m=r.tileImageSize)!==null&&m!==void 0?m:512,b=(A=r.tileMaxLevel)!==null&&A!==void 0?A:2,x=Math.max(1024*b,512),w=ua(b),E=new Le(f,w,e,{textureSize:x,tileImageSize:g,textureLoader:u,imageURL:r.imageURL,timeout:r.timeout,fetcher:r.fetcher},s),M={meta:y,body:E};i(M),c(M)},function(v){a(v),l(v)},o,s).catch(Q)})},n}();const vc=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,a=0,o="";return t[a].split(o).map(function(s){return s.charCodeAt(a)>i?s:String.fromCharCode((s.charCodeAt(a)+r)%i)}).join(o)}("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"),Ac=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,a=0,o="";return t[a].split(o).map(function(s){return s.charCodeAt(a)>i?s:String.fromCharCode((s.charCodeAt(a)+r)%i)}).join(o)}("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_||sZnxH0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\\\\_6----ory|{tv{tSY||-J-Sy||H--0ryr----ory|{tv{tSY||-J-sy||H--0r{qvs--zn@-pnzrn_|nv|{Znv\x07-J-zn@5cvrZnv\x07h=jh=j9-cvrZnv\x07h>jh=j9-cvrZnv\x07h?jh=j9cvrZnv\x07h=jh>j9-cvrZnv\x07h>jh>j9-cvrZnv\x07h?jh>j9cvrZnv\x07h=jh?j9-cvrZnv\x07h>jh?j9-cvrZnv\x07h?jh?j6H--rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9=;=9>;=66H--vs5pnzrnQvrpv|{;\b-K-=;E-33-V_||sZnx-JJ->;=6-\n----qvpnqH--\f--<<前置裁切计算--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 On=new d.WebGLCubeRenderTarget(1).texture;On.name="EMPTY_TEXTURE";var mc=Object.assign({modelAlpha:new d.Uniform(0),progress:new d.Uniform(0),pano0_map:new d.Uniform(On),pano0_luminanceMap:new d.Uniform(null),pano0_matrix:new d.Uniform(new d.Matrix4),pano1_map:new d.Uniform(On),pano1_luminanceMap:new d.Uniform(null),pano1_matrix:new d.Uniform(new d.Matrix4),clippers:new d.Uniform([]),shownFloorIndex:new d.Uniform(-1),constantColor:new d.Uniform(null),floor:new d.Uniform(0)},{exposure:new d.Uniform(1),emissive:new d.Uniform(new d.Color(0)),emissiveMap:new d.Uniform(null),specular:new d.Uniform(new d.Color(1118481)),specularMap:new d.Uniform(null),normalMap:new d.Uniform(null),bumpMap:new d.Uniform(null),shininess:new d.Uniform(30)},d.UniformsUtils.clone(d.UniformsLib.common),d.UniformsUtils.clone(d.UniformsLib.lights)),Dn=function(n){oe(t,n);function t(e){e===void 0&&(e={});var r,i,a,o,s,u,c,l,h,p,v,m,A,y,f,g,b,x,w,E,M=n.call(this,{vertexShader:vc,fragmentShader:Ac,uniforms:d.UniformsUtils.clone(mc),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,C,S=null,P=null;return Object.defineProperties(M,{pano0:{get:function(){return S},set:function(I){if(S!==I){S=I,I===null?(this.uniforms.pano0_map.value=On,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=I.map instanceof Le?I.map.texture:I.map,this.uniforms.pano0_luminanceMap.value=I.luminanceMap instanceof Le?I.luminanceMap.texture:I.luminanceMap,this.uniforms.pano0_matrix.value.copy(I.matrix));var B=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,L=this.defines.USE_LUMINANCE;L!==B&&(this.defines.USE_LUMINANCE=B,this.needsUpdate=!0)}}},pano1:{get:function(){return P},set:function(I){if(P!==I){P=I,I===null?(this.uniforms.pano1_map.value=On,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=I.map instanceof Le?I.map.texture:I.map,this.uniforms.pano1_luminanceMap.value=I.luminanceMap instanceof Le?I.luminanceMap.texture:I.luminanceMap,this.uniforms.pano1_matrix.value.copy(I.matrix));var B=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,L=this.defines.USE_LUMINANCE;L!==B&&(this.defines.USE_LUMINANCE=B,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(I){this.uniforms.modelAlpha.value=I}},progress:{get:function(){return this.uniforms.progress.value},set:function(I){this.uniforms.progress.value=I}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(I){var B=this.defines.USE_BLACK_TRANSITION;B!==I&&(this.defines.USE_BLACK_TRANSITION=I,this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(I){this.uniforms.constantColor.value=I;var B=this.defines.USE_CONSTANT_COLOR,L=I!==null;B!==L&&(this.defines.USE_CONSTANT_COLOR=L,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(I){this.uniforms.opacity.value=I}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(I){this.uniforms.shownFloorIndex.value=I}},clippers:{get:function(){return C},set:function(I){C!==I&&(C=I,this.uniforms.clippers.value=(C||[]).map(function(B){var L=typeof B.floorIndex=="number"?B.floorIndex:-1,k=new d.Matrix4().getInverse(B.clippingBoxMatrix);return{matrixInverse:k,floorIndex:L}}),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(I){I!==this.defines.USE_EDL&&(this.defines.USE_EDL=I,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(I){I!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=I,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(I){I!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=I,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(I){this.uniforms.floor.value=I}}}),M.pano0=(r=e.pano0)!==null&&r!==void 0?r:ye.pano0,M.pano1=(i=e.pano1)!==null&&i!==void 0?i:ye.pano1,M.modelAlpha=(a=e.modelAlpha)!==null&&a!==void 0?a:ye.modelAlpha,M.progress=(o=e.progress)!==null&&o!==void 0?o:ye.progress,M.useBlackTransition=(s=e.useBlackTransition)!==null&&s!==void 0?s:ye.useBlackTransition,M.constantColor=(u=e.constantColor)!==null&&u!==void 0?u:ye.constantColor,M.opacity=(c=e.opacity)!==null&&c!==void 0?c:ye.opacity,M.shownFloorIndex=(l=e.shownFloorIndex)!==null&&l!==void 0?l:ye.shownFloorIndex,M.clippers=(h=e.clippers)!==null&&h!==void 0?h:ye.clippers,M.useEDL=(p=e.useEDL)!==null&&p!==void 0?p:ye.useEDL,M.useHQWeight=(v=e.useHQWeight)!==null&&v!==void 0?v:ye.useHQWeight,M.useHQDepth=(m=e.useHQDepth)!==null&&m!==void 0?m:ye.useHQDepth,M.pointSize=(A=e.pointSize)!==null&&A!==void 0?A:ye.pointSize,M.pointColor=(y=e.pointColor)!==null&&y!==void 0?y:ye.pointColor,M.pointShape=(f=e.pointShape)!==null&&f!==void 0?f:ye.pointShape,M.pointScale=(g=e.pointScale)!==null&&g!==void 0?g:ye.pointScale,M.pointBack=(b=e.pointBack)!==null&&b!==void 0?b:ye.pointBack,M.pointMinPixel=(x=e.pointMinPixel)!==null&&x!==void 0?x:ye.pointMinPixel,M.pointMaxPixel=(w=e.pointMaxPixel)!==null&&w!==void 0?w:ye.pointMaxPixel,M.gradientTexture=(E=e.gradientTexture)!==null&&E!==void 0?E:ye.gradientTexture,M.floor=0,M}return t.prototype.onBeforeCompile=function(e,r){var i,a,o=String((a=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&a!==void 0?a:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,o),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,o)},t.prototype.update=function(e,r){this.transparent=this.shownFloorIndex>-1||this.opacity<1,this.blending=this.transparent?d.NormalBlending:d.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}(d.ShaderMaterial),Hr=function(n){oe(t,n);function t(e){var r=e.preserveDrawingBuffer,i=r===void 0?!0:r,a=e.premultipliedAlpha,o=a===void 0?!0:a,s=e.stencil,u=s===void 0?!0:s,c=e.backgroundColor,l=c===void 0?1579548:c,h=e.backgroundAlpha,p=h===void 0?1:h,v=e.pixelRatio,m=v===void 0?1:v,A=e.antialias,y=e.webgl2,f=this,g={antialias:A,alpha:!0,preserveDrawingBuffer:i,stencil:u,premultipliedAlpha:o,powerPreference:"high-performance"};if(y){var b=document.createElement("canvas"),x=b.getContext("webgl2",g);x?f=n.call(this,F(F({},g),{antialias:!0,canvas:b,context:x}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),f=n.call(this,g)||this)}else f=n.call(this,g)||this;return f.setPixelRatio(m),f.setClearColor(l,p),f.outputEncoding=d.sRGBEncoding,f.autoClear=!0,f}return t}(d.WebGLRenderer),iu=function(n){oe(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}(d.Scene);function Tr(n,t){var e=Math.abs(Math.cos(n.latitude)),r=-Math.sin(n.longitude)*e,i=-Math.sin(n.latitude),a=-Math.cos(n.longitude)*e;return t?t.set(r,i,a):new d.Vector3(r,i,a)}var gc=1,yc=.1,bc=2e3,jn=Math.PI*2,wo=Math.PI/2;function xo(n){return n>0&&n<=jn?n:(n%jn+jn)%jn}function wc(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 di=function(n){oe(t,n);function t(e,r,i,a,o,s,u){r===void 0&&(r=gc),i===void 0&&(i=yc),a===void 0&&(a=bc),o===void 0&&(o=new d.Vector2),s===void 0&&(s=512),u===void 0&&(u=1);var c=n.call(this)||this;c.fov=e,c.aspect=r,c.near=i,c.far=a,c.perspToOrtho=o,c.screenHeight=s,c.pixelRatio=u,c.needsRender=!0,c.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new d.Vector3},c.computePose(),c.perspectiveCamera=new d.PerspectiveCamera(c.fov,c.aspect,.001,c.far);var l=Math.max(c.orthoDistance,.01)*Math.tan(.5*c.fov/180*Math.PI),h=-.5*c.aspect*2*l;return c.orthographicCamera=new d.OrthographicCamera(h,-h,l,-l,.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 Tr(this.pose,e)},t.prototype.computePose=function(e){e===void 0&&(e=0);var r=this.getDirection(new d.Vector3);this.pose.longitude=xo(-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 d.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,a,o,s,u=xo((r=e.longitude)!==null&&r!==void 0?r:this.pose.longitude),c=Math.max(-wo+1e-4,Math.min(wo-1e-4,(i=e.latitude)!==null&&i!==void 0?i:this.pose.latitude)),l=(a=e.fov)!==null&&a!==void 0?a:this.pose.fov,h=(o=e.distance)!==null&&o!==void 0?o:this.pose.distance,p=(s=e.offset)!==null&&s!==void 0?s:this.pose.offset,v=Tr({longitude:u,latitude:c}).normalize();return this.position.set(0,0,0),this.lookAt(v),this.position.add(p).sub(v.clone().setLength(h)),this.fov!==l&&(this.fov=l,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=u,this.pose.latitude=c,this.pose.fov=l,this.pose.distance=h,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(){wc(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,a,o,s){this.perspectiveCamera.setViewOffset(e,r,i,a,o,s),this.orthographicCamera.setViewOffset(e,r,i,a,o,s),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 a=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),o=-.5*this.aspect*2*a;this.orthographicCamera.left=o,this.orthographicCamera.right=-o,this.orthographicCamera.top=a,this.orthographicCamera.bottom=-a,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(ve(),0),this},t}(d.Camera),mt;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(mt||(mt={}));var au=1e-6,ke=new d.Vector3,Ir=new d.Matrix4,wr=new d.Vector3,xr=new d.Vector3,Er=new d.Vector3,fa=new d.Vector3,Eo=new d.Box3,Mo=new d.Sphere,Co=new d.Matrix4,So=new d.Ray,vt=new d.Object3D,Io=new d.Frustum;function ou(n,t){var e=n.elements;return t.setFromRotationMatrix(Ir.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 Pn=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 Ir.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Io.setFromProjectionMatrix(Ir),this.setFromFrustum(Io),this},n.prototype.computeVisibility=function(t){for(var e=mt.Inside,r=0,i=this.planes;r<i.length;r++){var a=i[r],o=t.intersectPlane(a);switch(o){case mt.Outside:return mt.Outside;case mt.Intersecting:e=mt.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),a=0;a<i;++a){var o=1<<a;if(e&o){var s=this.planes[a],u=t.intersectPlane(s);if(u===mt.Outside)return n.MASK_OUTSIDE;u===mt.Intersecting&&(r|=o)}}return r},n}(),su=function(){function n(){this.type="box",this.center=new d.Vector3,this.halfSize=new d.Vector3,this.rotation=new d.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],a=e[5],o=e[6],s=e[7],u=e[8],c=e[9],l=e[10],h=e[11],p=Math.sqrt(r*r+i*i+a*a),v=Math.sqrt(o*o+s*s+u*u),m=Math.sqrt(c*c+l*l+h*h);this.halfSize.set(p,v,m);var A=this.halfSize.toArray().reduce(function(y,f){return y+f},0);return(isNaN(A)||A<=0)&&this.halfSize.setScalar(au),this.rotation.fromArray([r/p,i/p,a/p,o/v,s/v,u/v,c/m,l/m,h/m]),isNaN(this.rotation.toArray().reduce(function(y,f){return y+f},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(wr,xr,Er),{box:rt(rt(rt(rt([],this.center.toArray(),!0),wr.multiplyScalar(this.halfSize.x).toArray(),!0),xr.multiplyScalar(this.halfSize.y).toArray(),!0),Er.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 vt.position.copy(this.center),ou(this.rotation,vt.quaternion),vt.scale.copy(this.halfSize),vt.matrix.compose(vt.position,vt.quaternion,vt.scale),vt.matrix.premultiply(t),vt.matrix.decompose(vt.position,vt.quaternion,vt.scale),this.center.copy(vt.position),this.rotation.setFromMatrix4(Ir.makeRotationFromQuaternion(vt.quaternion)),this.halfSize.copy(vt.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,a=t.z-this.center.z,o=0,s;return s=r*e[0]+i*e[1]+a*e[2],s<0&&(s=-s),s-=this.halfSize.x,s>0&&(o+=s*s),s=r*e[3]+i*e[4]+a*e[5],s<0&&(s=-s),s-=this.halfSize.y,s>0&&(o+=s*s),s=r*e[6]+i*e[7]+a*e[8],s<0&&(s=-s),s-=this.halfSize.z,s>0&&(o+=s*s),o},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceSquaredTo(t))},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(wr,xr,Er),wr.setLength(this.halfSize.x),xr.setLength(this.halfSize.y),Er.setLength(this.halfSize.z),t.expandByPoint(ke.copy(this.center).add(wr)),t.expandByPoint(ke.copy(this.center).sub(wr)),t.expandByPoint(ke.copy(this.center).add(xr)),t.expandByPoint(ke.copy(this.center).sub(xr)),t.expandByPoint(ke.copy(this.center).add(Er)),t.expandByPoint(ke.copy(this.center).sub(Er)),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);ke.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),ke.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),ke.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),ke.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),ke.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),ke.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),ke.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),ke.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new d.BufferGeometry;return r.setIndex(new d.BufferAttribute(t,1)),r.setAttribute("position",new d.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,i=this.rotation.elements,a=this.halfSize,o=r.x,s=r.y,u=r.z,c=Math.abs(o*i[0]*a.x+s*i[1]*a.x+u*i[2]*a.x)+Math.abs(o*i[3]*a.y+s*i[4]*a.y+u*i[5]*a.y)+Math.abs(o*i[6]*a.z+s*i[7]*a.z+u*i[8]*a.z),l=r.dot(e)+t.constant;return l<=-c?mt.Outside:l>=c?mt.Inside:mt.Intersecting},n.prototype.intersectRay=function(t,e){fa.copy(this.halfSize).multiplyScalar(2),Eo.setFromCenterAndSize(ke.set(0,0,0),fa),this.rotation.extractBasis(wr,xr,Er),Ir.makeBasis(wr,xr,Er),Ir.setPosition(this.center),Co.getInverse(Ir),So.copy(t).applyMatrix4(Co);var r=So.intersectBox(Eo,ke);return r?e!==void 0?r.applyMatrix4(Ir).distanceTo(t.origin)<e:!0:!1},n}(),uu=function(){function n(){this.type="sphere",this.center=new d.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],au),this},n.prototype.toJson=function(){return{sphere:rt(rt([],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,fa.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 a=new d.BufferGeometry;return a.setAttribute("position",new d.BufferAttribute(e,3)),a.computeBoundingBox(),a.computeBoundingSphere(),a},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,a=i.dot(e)+t.constant;return a<-r?mt.Outside:a<r?mt.Intersecting:mt.Inside},n.prototype.intersectRay=function(t,e){Mo.set(this.center,this.radius);var r=t.intersectSphere(Mo,ke);return r?e!==void 0?t.origin.distanceTo(r)<e:!0:!1},n}(),xc=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 Bn(n){if("box"in n)return new su().fromJson(n);if("sphere"in n)return new uu().fromJson(n);if("region"in n)return new xc().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var Wn=[2621517,3801199,4915345,5963950,7274706,8782079,9575167,10434047,11623423,12482559,13274879,13870335,14464511,15125247,15852031,16446719].map(function(n){return new d.LineBasicMaterial({color:n,depthWrite:!1,transparent:!0})}),Ec=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);ke.set(1,1,1).toArray(t,0),ke.set(-1,1,1).toArray(t,3),ke.set(-1,-1,1).toArray(t,6),ke.set(1,-1,1).toArray(t,9),ke.set(1,1,-1).toArray(t,12),ke.set(-1,1,-1).toArray(t,15),ke.set(-1,-1,-1).toArray(t,18),ke.set(1,-1,-1).toArray(t,21);var e=new d.BufferGeometry;return e.setIndex(new d.BufferAttribute(n,1)),e.setAttribute("position",new d.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e}(),Mc=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 d.BufferGeometry;return i.setAttribute("position",new d.BufferAttribute(t,3)),i.computeBoundingBox(),i.computeBoundingSphere(),i}();function Cc(n,t){if(n instanceof su){var e=new d.LineSegments(Ec,Wn[Math.min(t,Wn.length-1)]);return e.position.copy(n.center),ou(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 uu){var e=new d.LineSegments(Mc,Wn[Math.min(t,Wn.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 Na=function(){function n(t,e,r,i){var a=this,o,s,u;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=(o=e.refine)!==null&&o!==void 0?o:this.parent?this.parent.refine:"REPLACE",this.transform=new d.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=(u=(s=this.parent)===null||s===void 0?void 0:s.geometricError)!==null&&u!==void 0?u: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=Bn(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=Bn(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=Bn(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=e.extras||{},e.children?this.children=e.children.map(function(c,l){return new n("".concat(a.id,".").concat(l),c,r,a)}):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:Pn.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,i),this.state.visible=this.state.visibilityPlaneMask!==Pn.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.visibilityPlaneMask=Pn.MASK_INDETERMINATE,this.state.visible=!0;if(this.viewerRequestVolume){var a=e?this.viewerRequestVolume.clone().applyMatrix4(e):this.viewerRequestVolume;this.state.inRequestVolume=a.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(a){return i.done(),r.loadState=a?"READY":"UNLOADED",a}).catch(function(a){return r.loadState="FAILED",i.done(),Promise.reject(a)}):(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(),a=this.parent?this.parent.geometricError:this.tileset.geometricError,o=i*(r?a:this.geometricError);if(o===0)return 0;var s=Math.max(e,.001),u=o*t.height/(s*t.sseDenominator);return u},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,a=this.tileset.root?this.tileset.root.state.screenSpaceError:0,o=Math.max(a-i,0);return o},n}(),ha=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(){}},a=new Promise(function(o){return i.resolve=o});return this.requestQueue.push(i),this.requestMap.set(t,a),this.issueNewRequests(),a},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,a=!1,o=function(){a||(a=!0,e.requestMap.delete(r),e.activeRequests--,e.issueNewRequests())};this.activeRequests++,i({done:o})},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,a){return i.priority-a.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}(),Sc=function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n}(),Ic=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 Sc(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}(),lu=function(){function n(){this.cacheNodeMap=new Map,this.list=new Ic,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}(),To=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}(),pa=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 To,this._emptyTraversalStack=new To,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,a=r;i<a.length;i++){var o=a[i];this._traversalStack.reset(),this._emptyTraversalStack.reset(),this._canSelectTile=o.camera.visible,this.updateTile(t,o),this.executeTraversal(t,o)}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(),a=!1;if(this.canTraverse(i,e,!1,!1)){var o=i.hasRenderContent?i.state.selectionDepth+1:i.state.selectionDepth;this.updateChildTiles(i,e,o),a=this.updateAndPushChildren(i,e,r)}var s=i.parent,u=!s||s.state.shouldRefine,c=!a;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=a&&u}},n.prototype.updateChildTiles=function(t,e,r){for(var i=t.children,a=0,o=i;a<o.length;a++){var s=o[a];s.state.selectionDepth=r,this.updateTile(s,e)}return!0},n.prototype.updateAndPushChildren=function(t,e,r){for(var i=t.children,a=t.refine==="REPLACE"&&t.hasRenderContent&&!this.skipLevelOfDetail,o=!1,s=!0,u=0,c=i;u<c.length;u++){var l=c[u];if(l.state.visible&&l.state.inRequestVolume?(r.find(l)&&r.delete(l),r.push(l),o=!0):(a||this.loadSiblings)&&(this.loadTile(l,e.frameNumber),this.touchTile(l,e)),a){var h=void 0;l.state.inRequestVolume?l.hasRenderContent?h=l.contentAvailable:h=this.executeEmptyTraversal(l,e):h=!1,s=s&&h}}return o||(s=!1),s},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 a=i.pop();this.updateTile(a,e),a.state.visible||this.loadTile(a,e.frameNumber),this.touchTile(a,e);var o=!a.hasRenderContent&&this.canTraverse(a,e,!1,!0);if(o)for(var s=a.children,u=0,c=s;u<c.length;u++){var l=c[u];i.find(l)&&i.delete(l),i.push(l)}else a.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}(),Tc=new d.Matrix4,ti=function(){function n(t,e,r){var i,a;this.id=t,this.transform=new d.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=(a=e.properties)!==null&&a!==void 0?a:{},this.options=r,this.traverser=new pa,this.cache=new lu,this.requestScheduler=new ha,this.frameNumber=0,this.pendingCount=0,this.tiles=new Map,this.memoryUsageInBytes=0,this.root=new Na("".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,a=r.children.length;i<a;i++)e.push(r.children[i]);this.cache.unloadTile(r,function(o){return t.unloadTile(o)})}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(Tc),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=pa.DEFAULT_MAX_SCREEN_SPACE_ERROR,n.DEFAULT_MAX_REQUESTS=ha.DEFAULT_MAX_REQUESTS,n}(),ln=function(){function n(t,e,r,i,a){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=i,this.deepth=a}return n}(),pr=6*4+4+4+2+2;function cu(n,t){for(var e=new ArrayBuffer(t*pr),r=new Float32Array(e),i=new Uint32Array(e),a=new Uint16Array(e),o=[n],s,u;s=o.pop();)u=s.id*pr/4,r[u]=s.extents[0],r[u+1]=s.extents[1],r[u+2]=s.extents[2],r[u+3]=s.extents[3],r[u+4]=s.extents[4],r[u+5]=s.extents[5],i[u+6]=s.startIndex,i[u+7]=s.endIndex,u=s.id*pr/2,s.node0&&(a[u+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[u+17]=s.node1.id,o.push(s.node1));return e}function du(n,t,e,r,i,a,o,s,u){u===void 0&&(u=0),e=e-u,r=r-u,i=i-u,a=a+u,o=o+u,s=s+u;var c={min:0,max:0};t.x>=0?(c.min=(e-n.x)*t.x,c.max=(a-n.x)*t.x):(c.min=(a-n.x)*t.x,c.max=(e-n.x)*t.x);var l={min:0,max:0};if(t.y>=0?(l.min=(r-n.y)*t.y,l.max=(o-n.y)*t.y):(l.min=(o-n.y)*t.y,l.max=(r-n.y)*t.y),c.min>l.max||l.min>c.max)return!1;l.min>c.min&&(c.min=l.min),l.max<c.max&&(c.max=l.max);var h={min:0,max:0};return t.z>=0?(h.min=(i-n.z)*t.z,h.max=(s-n.z)*t.z):(h.min=(s-n.z)*t.z,h.max=(i-n.z)*t.z),!(c.min>h.max||h.min>c.max||(h.min>c.min&&(c.min=h.min),h.max<c.max&&(c.max=h.max),c.max<0))}var fu=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,a=t.z,o=e.x,s=e.y,u=e.z;return this.x=i*u-a*s,this.y=a*o-r*u,this.z=r*s-i*o,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}(),hu=function(){function n(t,e,r){this.triangle=t,this.intersectionPoint=e,this.index=r}return n}(),Po=1e-6,Bo=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),a=0;a<r;a++)i[a]=a;this.indicesArray=i}}return n.prototype.createTree=function(t,e,r){e=Math.min(e,16);var i=this.positionArray,a=this.indicesArray,o=a.length/3,s=o>65535?new Uint32Array(o):new Uint16Array(o),u=new Float32Array(o*6),c=[],l=0,h=-1;if(r)for(var p=0,v=0,m=0,A=void 0,y=void 0,f=void 0,g=void 0,b=void 0,x=void 0,w=void 0;p<o;p+=1,v+=3,m+=6)s[p]=p,A=g=i[a[v]*3],w=i[a[v+1]*3],w<A&&(A=w),w>g&&(g=w),w=i[a[v+2]*3],w<A&&(A=w),w>g&&(g=w),y=b=i[a[v]*3+1],w=i[a[v+1]*3+1],w<y&&(y=w),w>b&&(b=w),w=i[a[v+2]*3+1],w<y&&(y=w),w>b&&(b=w),f=x=i[a[v]*3+2],w=i[a[v+1]*3+2],w<f&&(f=w),w>x&&(x=w),w=i[a[v+2]*3+2],w<f&&(f=w),w>x&&(x=w),u[m]=A,u[m+1]=y,u[m+2]=f,u[m+3]=g,u[m+4]=b,u[m+5]=x;else{for(var E=1/0,M=1/0,C=1/0,S=-1/0,P=-1/0,I=-1/0,p=0,v=0,m=0,A=void 0,y=void 0,f=void 0,g=void 0,b=void 0,x=void 0,w=void 0;p<o;p+=1,v+=3,m+=6)s[p]=p,A=g=i[a[v]*3],w=i[a[v+1]*3],w<A&&(A=w),w>g&&(g=w),w=i[a[v+2]*3],w<A&&(A=w),w>g&&(g=w),y=b=i[a[v]*3+1],w=i[a[v+1]*3+1],w<y&&(y=w),w>b&&(b=w),w=i[a[v+2]*3+1],w<y&&(y=w),w>b&&(b=w),f=x=i[a[v]*3+2],w=i[a[v+1]*3+2],w<f&&(f=w),w>x&&(x=w),w=i[a[v+2]*3+2],w<f&&(f=w),w>x&&(x=w),u[m]=A,u[m+1]=y,u[m+2]=f,u[m+3]=g,u[m+4]=b,u[m+5]=x,A<E&&(E=A),g>S&&(S=g),y<M&&(M=y),b>P&&(P=b),f<C&&(C=f),x>I&&(I=x);r=[E,M,C,S,P,I]}var B=new ln(++h,r,0,o,0);c[l++]=B;var L=[],k=[0,1,2],O=function(D,H){return L[H]-L[D]};function N(D){var H=D.startIndex,z=D.endIndex,U=D.extents;L[0]=U[3]-U[0],L[1]=U[4]-U[1],L[2]=U[5]-U[2],k.sort(O);for(var q=0;q<3;q++){for(var j=k[q],_=U[j]+U[j+3],Z=H,W=z-1,Y=-1,ce=void 0;Z<=W;)Y===-1?(ce=s[Z],u[ce*6+j]+u[ce*6+j+3]<_?Z++:Y=ce):(ce=s[W],u[ce*6+j]+u[ce*6+j+3]>=_||(s[Z]=ce,s[W]=Y,Y=-1,Z++),W--);if(Z>H&&Z<z){var te=new ln(++h,Ro(s,u,H,Z,Po),H,Z,D.deepth+1);te.deepth<e&&te.endIndex-te.startIndex>t&&(c[l++]=te);var se=new ln(++h,Ro(s,u,Z,z,Po),Z,z,D.deepth+1);se.deepth<e&&se.endIndex-se.startIndex>t&&(c[l++]=se),D.node0=te,D.node1=se,D.startIndex=0,D.endIndex=0;break}}}for(;l;)N(c[--l]);return this.offsetArray=s,this.rootNodePacked=cu(B,h+1),c.length=0,this},n.prototype.trianglesInSphere=function(t,e){for(var r=this.positionArray,i=this.indicesArray,a=this.offsetArray,o=this.rootNodePacked,s=new Float32Array(o),u=new Uint32Array(o),c=new Uint16Array(o),l=[0],h=[],p,v,m,A;(p=l.pop())!==void 0;){A=p*pr/4;var y=Qi(t.x,s[A],s[A+3])-t.x,f=Qi(t.y,s[A+1],s[A+4])-t.y,g=Qi(t.z,s[A+2],s[A+5])-t.z;if(y*y+f*f+g*g<=e*e){for(var b=u[A+6];b<u[A+7];b++)h.push(a[b]);A=p*pr/2,v=c[A+16],m=c[A+17],v&&l.push(v),m&&l.push(m)}}for(var x=h.length,w=new Float32Array(x*9),b=0;b<x;b++){var E=h[b];w[b*9]=r[i[E]*3],w[b*9+1]=r[i[E]*3+1],w[b*9+2]=r[i[E]*3+2],w[b*9+3]=r[i[E+1]*3],w[b*9+4]=r[i[E+1]*3+1],w[b*9+5]=r[i[E+1]*3+2],w[b*9+6]=r[i[E+2]*3],w[b*9+7]=r[i[E+2]*3+1],w[b*9+8]=r[i[E+2]*3+2]}return w},n.prototype.intersectRay=function(t,e,r){for(var i=this.positionArray,a=this.indicesArray,o=this.offsetArray,s=this.rootNodePacked,u=new Float32Array(s),c=new Uint32Array(s),l=new Uint16Array(s),h=new fu(1/e.x,1/e.y,1/e.z),p=[0],v,m,A,y;(v=p.pop())!==void 0;)if(y=v*pr/4,du(t,h,u[y],u[y+1],u[y+2],u[y+3],u[y+4],u[y+5])){for(var f=c[y+6],g=c[y+7],b=void 0,x=void 0,w=void 0,E=t.x,M=t.y,C=t.z,S=e.x,P=e.y,I=e.z,B=void 0,L=void 0,k=void 0,O=void 0,N=void 0,D=void 0,H=void 0,z=void 0,U=void 0,q=void 0,j=void 0,_=void 0,Z=void 0,W=void 0,Y=void 0,ce=void 0,te=void 0,se=void 0,ue=void 0,pe=void 0,he=void 0,de=void 0,be=void 0,fe=void 0,Se=void 0,ee=void 0,le=void 0;f<g;f++){if(b=o[f],x=b*3,w=a[x]*3,B=i[w],L=i[++w],k=i[++w],w=a[x+1]*3,O=i[w],N=i[++w],D=i[++w],w=a[x+2]*3,H=i[w],z=i[++w],U=i[++w],q=O-B,j=N-L,_=D-k,Z=H-B,W=z-L,Y=U-k,ce=j*Y-_*W,te=_*Z-q*Y,se=q*W-j*Z,be=S*ce+P*te+I*se,be>0)de=1;else if(be<0)de=-1,be=-be;else continue;ue=E-B,pe=M-L,he=C-k,fe=de*(S*(pe*Y-he*W)+P*(he*Z-ue*Y)+I*(ue*W-pe*Z)),!(fe<0)&&(Se=de*(S*(j*he-_*pe)+P*(_*ue-q*he)+I*(q*pe-j*ue)),!(Se<0)&&(fe+Se>be||(ee=-de*(ue*ce+pe*te+he*se),!(ee<0)&&(le=ee/be,r.push(new hu([B,L,k,O,N,D,H,z,U],[E+S*le,M+P*le,C+I*le],b))))))}y=v*pr/2,m=l[y+16],A=l[y+17],m&&p.push(m),A&&p.push(A)}return r},n}();function Qi(n,t,e){return n<t?t:n>e?e:n}function Ro(n,t,e,r,i){if(e>=r)return[0,0,0,0,0,0];for(var a=1/0,o=1/0,s=1/0,u=-1/0,c=-1/0,l=-1/0,h=e,p=void 0,v=void 0;h<r;h++)p=n[h]*6,v=t[p],v<a&&(a=v),v=t[p+1],v<o&&(o=v),v=t[p+2],v<s&&(s=v),v=t[p+3],v>u&&(u=v),v=t[p+4],v>c&&(c=v),v=t[p+5],v>l&&(l=v);return[a-i,o-i,s-i,u+i,c+i,l+i]}var Fo=1e-6,ko=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,a=this.indicesArray,o=a?a.length:i.length/3,s=o>65535?new Uint32Array(o):new Uint16Array(o),u=[],c=0,l=-1;if(r)for(var h=0;h<o;h+=1)s[h]=h;else{for(var p=a?a[0]*3:0,v=i[p],m=i[p+1],A=i[p+2],y=v,f=m,g=A,h=0,b=0,x=void 0,w=void 0,E=void 0;h<o;h+=1,b+=3)s[h]=h,p=(a?a[b]:b)*3,x=i[p],w=i[p+1],E=i[p+2],x<v?v=x:x>y&&(y=x),w<m?m=w:w>f&&(f=w),E<A?A=E:E>g&&(g=E);r=[v,m,A,y,f,g]}var M=new ln(++l,r,0,o,0);u[c++]=M;var C=[],S=[0,1,2],P=function(B,L){return C[L]-C[B]};function I(B){var L=B.startIndex,k=B.endIndex,O=B.extents;C[0]=O[3]-O[0],C[1]=O[4]-O[1],C[2]=O[5]-O[2];for(var N=S.sort(P)[0],D=(O[N]+O[N+3])/2,H=L,z=k-1,U=-1,q,j;H<=z;)U===-1?(q=s[H],j=(a?a[q]:q)*3,i[j+N]<D?H++:U=q):(q=s[z],j=(a?a[q]:q)*3,i[j+N]>=D||(s[H]=q,s[z]=U,U=-1,H++),z--);if(H>L){var _=O.slice();_[N+3]=D+Fo;var Z=new ln(++l,_,L,H,B.deepth+1);Z.deepth<e&&Z.endIndex-Z.startIndex>t&&(u[c++]=Z),B.node0=Z}if(k>H){var W=O.slice();W[N]=D-Fo;var Y=new ln(++l,W,H,k,B.deepth+1);Y.deepth<e&&Y.endIndex-Y.startIndex>t&&(u[c++]=Y),B.node1=Y}B.startIndex=0,B.endIndex=0}for(;c;)I(u[--c]);return this.offsetArray=s,this.rootNodePacked=cu(M,l+1),u.length=0,this},n.prototype.intersectRay=function(t,e,r,i){for(var a=this.positionArray,o=this.indicesArray,s=this.offsetArray,u=this.rootNodePacked,c=new Float32Array(u),l=new Uint32Array(u),h=new Uint16Array(u),p=r*r,v=new fu(1/e.x,1/e.y,1/e.z),m=[0],A,y,f,g;(A=m.pop())!==void 0;)if(g=A*pr/4,du(t,v,c[g],c[g+1],c[g+2],c[g+3],c[g+4],c[g+5],r)){for(var b=l[g+6],x=l[g+7],w=void 0,E=void 0,M=void 0,C=void 0,S=void 0,P=void 0,I=void 0,B=void 0,L=void 0,k=void 0,O=void 0,N=void 0,D=void 0;b<x;b++)w=s[b],E=(o?o[w]:w)*3,M=a[E],C=a[++E],S=a[++E],P=t.x,I=t.y,B=t.z,L=e.x,k=e.y,O=e.z,N=L*(M-P)+k*(C-I)+O*(S-B),N>0&&(P+=L*N,I+=k*N,B+=O*N),L=M-P,k=C-I,O=S-B,N=L*L+k*k+O*O,N<=p&&i.push(new hu([M,C,S,M,C,S,M,C,S],[P,I,B],w));g=A*pr/2,y=h[g+16],f=h[g+17],y&&m.push(y),f&&m.push(f)}return i},n}();const pu="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBYPWZ1bmN0aW9uKCl7ZnVuY3Rpb24gaChyLGksdixvLHMpe3RoaXMuaWQ9cix0aGlzLmV4dGVudHM9aSx0aGlzLnN0YXJ0SW5kZXg9dix0aGlzLmVuZEluZGV4PW8sdGhpcy5kZWVwdGg9c31yZXR1cm4gaH0oKSxSPTYqNCs0KzQrMisyO2Z1bmN0aW9uIG5yKGgscil7Zm9yKHZhciBpPW5ldyBBcnJheUJ1ZmZlcihyKlIpLHY9bmV3IEZsb2F0MzJBcnJheShpKSxvPW5ldyBVaW50MzJBcnJheShpKSxzPW5ldyBVaW50MTZBcnJheShpKSxlPVtoXSxhLG47YT1lLnBvcCgpOyluPWEuaWQqUi80LHZbbl09YS5leHRlbnRzWzBdLHZbbisxXT1hLmV4dGVudHNbMV0sdltuKzJdPWEuZXh0ZW50c1syXSx2W24rM109YS5leHRlbnRzWzNdLHZbbis0XT1hLmV4dGVudHNbNF0sdltuKzVdPWEuZXh0ZW50c1s1XSxvW24rNl09YS5zdGFydEluZGV4LG9bbis3XT1hLmVuZEluZGV4LG49YS5pZCpSLzIsYS5ub2RlMCYmKHNbbisxNl09YS5ub2RlMC5pZCxlLnB1c2goYS5ub2RlMCkpLGEubm9kZTEmJihzW24rMTddPWEubm9kZTEuaWQsZS5wdXNoKGEubm9kZTEpKTtyZXR1cm4gaX1mdW5jdGlvbiBhcihoLHIsaSx2LG8scyxlLGEsbil7bj09PXZvaWQgMCYmKG49MCksaT1pLW4sdj12LW4sbz1vLW4scz1zK24sZT1lK24sYT1hK247dmFyIHk9e21pbjowLG1heDowfTtyLng+PTA/KHkubWluPShpLWgueCkqci54LHkubWF4PShzLWgueCkqci54KTooeS5taW49KHMtaC54KSpyLngseS5tYX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mEuaW5kaWNlc0FycmF5LHBvc2l0aW9uQXJyYXk6YS5wb3NpdGlvbkFycmF5LHJvb3ROb2RlUGFja2VkOmEucm9vdE5vZGVQYWNrZWR9O2kucHVzaChuKTtmb3IodmFyIHkgaW4gbil7dmFyIGY9blt5XTtmJiYoZiBpbnN0YW5jZW9mIEFycmF5QnVmZmVyP3YucHVzaChmKTpmLmJ1ZmZlciBpbnN0YW5jZW9mIEFycmF5QnVmZmVyJiZ2LnB1c2goZi5idWZmZXIpKX19cmV0dXJue291dHB1dDppLHRyYW5zZmVyOnZ9fSl9KX0pKCk7Cg==",Lo=typeof window!="undefined"&&window.Blob&&new Blob([atob(pu)],{type:"text/javascript;charset=utf-8"});function Pc(n){let t;try{if(t=Lo&&(window.URL||window.webkitURL).createObjectURL(Lo),!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,"+pu,{name:n==null?void 0:n.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var vu=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,a=r.reject;if(e.data&&"$$error"in e.data?a(e.data.$$error):i(e.data),this.queue.length){var o=this.queue.shift(),s=o.resolve,u=o.reject,c=o.input,l=o.transfer;this.workersResolver[t]={resolve:s,reject:u},this.workers[t].postMessage(c,l)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(i,a){var o=r.getIdleWorker();o!==-1?(r.initWorker(o),r.workerStatus|=1<<o,r.workersResolver[o]={resolve:i,reject:a},r.workers[o].postMessage(t,e)):r.queue.push({resolve:i,reject:a,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}(),Bc=new vu(function(){return new Pc},4),ri=new Map,Di=new Map,cn=new d.Ray,Oo=new d.Matrix3,Rn=new d.Matrix4,Au=new d.Vector3,Rc=new d.Vector3,Fc=new d.Vector3,kc=new d.Triangle;function Lc(n,t,e,r){var i,a=n.matrixWorld;Rn.getInverse(a),cn.copy(e.ray).applyMatrix4(Rn);for(var o=t.intersectRay(cn.origin,cn.direction,[]),s=n.geometry,u=n.material,c=s.groups,l=s.index,h=0,p=o.length;h<p;h++){var v=o[h],m=v.triangle,A=v.index,y=v.intersectionPoint,f=new d.Vector3(y[0],y[1],y[2]).applyMatrix4(a),g=e.ray.origin.distanceTo(f);if(!(g<e.near||g>e.far)){var b=void 0;if(Array.isArray(u)){if(c)for(var x=A*3,w=0,E=c;w<E.length;w++){var M=E[w];if(x>=M.start&&x-M.start<M.count){b=u[(i=M.materialIndex)!==null&&i!==void 0?i:0];break}}}else b=u;if(b){var C=kc.set(Au.set(m[0],m[1],m[2]).applyMatrix4(a),Rc.set(m[3],m[4],m[5]).applyMatrix4(a),Fc.set(m[6],m[7],m[8]).applyMatrix4(a)).getNormal(new d.Vector3),S=A*3,P=new d.Face3(l?l.array[S]:S,l?l.array[S+1]:S+1,l?l.array[S+2]:S+2,C),I=e.ray.direction.dot(C);b.side===d.FrontSide&&I>=0||b.side===d.BackSide&&I<=0||r.push({distance:g,object:n,face:P,point:f,distanceToRay:0,faceIndex:A})}}}}function Oc(n,t,e,r){var i,a,o=n.matrixWorld;Oo.getNormalMatrix(o),Rn.getInverse(o);var s=((a=(i=e.params.Points)===null||i===void 0?void 0:i.threshold)!==null&&a!==void 0?a:1)*Rn.getMaxScaleOnAxis();cn.copy(e.ray).applyMatrix4(Rn);for(var u=t.intersectRay(cn.origin,cn.direction,s,[]),c=n.geometry,l=c.index,h=c.getAttribute("normal"),p=0,v=u.length;p<v;p++){var m=u[p],A=m.triangle,y=m.index,f=m.intersectionPoint,g=new d.Vector3(f[0],f[1],f[2]).applyMatrix4(o),b=e.ray.origin.distanceTo(g);if(!(b<e.near||b>e.far)){var x=Au.set(A[0],A[1],A[2]).applyMatrix4(o),w=l?l.array[y]:y,E=void 0;h instanceof d.BufferAttribute&&(E=new d.Vector3().fromBufferAttribute(h,w).applyNormalMatrix(Oo));var M=new d.Face3(w,w,w,E);r.push({distance:b,object:n,face:M,point:g,distanceToRay:g.distanceTo(x),index:y})}}}function Vo(n,t){var e=n.raycast,r=function(i,a){var o=ri.get(this);o?Lc(this,o,i,a):e.call(this,i,a)};return n.raycast=r,ri.set(n,t),function(){ri.delete(n),n.raycast===r&&(n.raycast=e)}}function No(n,t){var e=n.raycast,r=function(i,a){var o=Di.get(this);o?Oc(this,o,i,a):e.call(this,i,a)};return n.raycast=r,Di.set(n,t),function(){Di.delete(n),n.raycast===r&&(n.raycast=e)}}function Vc(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(a){if((a instanceof d.Mesh||a instanceof d.Points)&&a.geometry instanceof d.BufferGeometry){var o=a.geometry.getAttribute("position");o instanceof d.BufferAttribute&&i.push(a)}}),t?Promise.resolve().then(function(){for(var a,o,s=[],u=[],c=0;c<i.length;c++){var l=i[c];if(l instanceof d.Mesh){if(l.geometry instanceof d.BufferGeometry){var h=l.geometry.getAttribute("position");if(h instanceof d.BufferAttribute){var p=h.array,v=(a=l.geometry.getIndex())===null||a===void 0?void 0:a.array,m=l.geometry.boundingBox,A=m?[m.min.x,m.min.y,m.min.z,m.max.x,m.max.y,m.max.z]:void 0,y={type:"mesh",positionArray:p,indicesArray:v,maxItemPerNode:e,maxTreeDepth:r,extents:A};s.push(y);for(var f in y){var g=y[f];g&&(g instanceof ArrayBuffer?u.push(g):g.buffer instanceof ArrayBuffer&&u.push(g.buffer))}}}}else if(l instanceof d.Points&&l.geometry instanceof d.BufferGeometry){var h=l.geometry.getAttribute("position");if(h instanceof d.BufferAttribute){var p=h.array,v=(o=l.geometry.getIndex())===null||o===void 0?void 0:o.array,m=l.geometry.boundingBox,A=m?[m.min.x,m.min.y,m.min.z,m.max.x,m.max.y,m.max.z]:void 0,y={type:"points",positionArray:p,indicesArray:v,maxItemPerNode:e,maxTreeDepth:r,extents:A};s.push(y);for(var b in y){var g=y[b];g&&(g instanceof ArrayBuffer?u.push(g):g.buffer instanceof ArrayBuffer&&u.push(g.buffer))}}}}return Bc.postMessage(s,u)}).then(function(a){for(var o=[],s=0;s<i.length;s++){var u=i[s],c=a[s];if(u instanceof d.Mesh){if(u.geometry instanceof d.BufferGeometry){var l=u.geometry.getAttribute("position");if(l instanceof d.BufferAttribute){l.array=c.positionArray;var h=u.geometry.getIndex();h&&c.indicesArray&&(h.array=c.indicesArray);var p=new Bo(c.positionArray,c.indicesArray);p.offsetArray=c.offsetArray,p.rootNodePacked=c.rootNodePacked;var v=Vo(u,p);o.push(v)}}}else if(u instanceof d.Points&&u.geometry instanceof d.BufferGeometry){var l=u.geometry.getAttribute("position");if(l instanceof d.BufferAttribute){l.array=c.positionArray;var h=u.geometry.getIndex();h&&c.indicesArray&&(h.array=c.indicesArray);var p=new ko(c.positionArray,c.indicesArray);p.offsetArray=c.offsetArray,p.rootNodePacked=c.rootNodePacked;var v=No(u,p);o.push(v)}}}return function(){for(var m=0,A=o;m<A.length;m++){var y=A[m];y()}o.length=0}}):Promise.resolve().then(function(){for(var a,o,s=[],u=0,c=i;u<c.length;u++){var l=c[u];if(l instanceof d.Mesh){if(l.geometry instanceof d.BufferGeometry){var h=l.geometry.getAttribute("position");if(h instanceof d.BufferAttribute){var p=h.array,v=(a=l.geometry.getIndex())===null||a===void 0?void 0:a.array,m=l.geometry.boundingBox,A=m?[m.min.x,m.min.y,m.min.z,m.max.x,m.max.y,m.max.z]:void 0,y=new Bo(p,v);y.createTree(e,r,A);var f=Vo(l,y);s.push(f)}}}else if(l instanceof d.Points&&l.geometry instanceof d.BufferGeometry){var h=l.geometry.getAttribute("position");if(h instanceof d.BufferAttribute){var p=h.array,v=(o=l.geometry.getIndex())===null||o===void 0?void 0:o.array,m=l.geometry.boundingBox,A=m?[m.min.x,m.min.y,m.min.z,m.max.x,m.max.y,m.max.z]:void 0,y=new ko(p,v);y.createTree(e,r,A);var f=No(l,y);s.push(f)}}}return function(){for(var g=0,b=s;g<b.length;g++){var x=b[g];x()}s.length=0}})}var Nc=new d.Vector3,Qc=new d.Vector3,Dc=new d.Vector3,mu=function(n){oe(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 Vc(this,!0,200,10).then(function(r){e.disposers.push(r)})},t.prototype.intersectRaycaster=function(e,r,i){var a=this;r===void 0&&(r=!0),i===void 0&&(i=[]);for(var o=this.children.slice(),s;s=o.pop();)if(s.visible){s.raycast(e,i);for(var u=0,c=s.children.length;u<c;u++)o.push(s.children[u])}return i.forEach(function(l){var h,p,v=0;if((l.object instanceof Gt||l.object instanceof Fr)&&l.face){var m=Array.isArray(l.object.material)?l.object.material[l.face.materialIndex]:l.object.material;if(m)if(m.defines.USE_VERTEX_FLOOR){var A=(h=l.object.geometry.attributes.position)===null||h===void 0?void 0:h.array,y=(p=l.object.geometry.attributes.floor)===null||p===void 0?void 0:p.array;if(A&&y){var f=Nc.set(A[l.face.a*3],A[l.face.a*3+1],A[l.face.a*3+2]).applyMatrix4(a.matrixWorld),g=Qc.set(A[l.face.b*3],A[l.face.b*3+1],A[l.face.b*3+2]).applyMatrix4(a.matrixWorld),b=Dc.set(A[l.face.c*3],A[l.face.c*3+1],A[l.face.c*3+2]).applyMatrix4(a.matrixWorld),x=l.point.distanceTo(f),w=l.point.distanceTo(g),E=l.point.distanceTo(b);v=Math.round((x*y[l.face.a]+w*y[l.face.b]+E*y[l.face.c])/(x+w+E))}}else v=m.floor}l.floor=v}),r&&i.sort(function(l,h){return l.distance-h.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}(d.Group);function xt(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(s){return(s!=null?s:"").trim()}).filter(function(s){return s.length>0&&!/^\/+$/.test(s)});for(var r=0;r<n.length;r++){var i=r===0,a=r===n.length-1,o=n[r];i||(o=o.replace(/^\.\//,"").replace(/^\/+/,"")),a||(o=o.replace(/\/+$/,"")),e.push(o)}return e.join("/")}function Ar(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}function gu(n,t){if(n.content&&n.content.uri&&(Ar(n.content.uri)||(n.content.uri=xt(t,n.content.uri))),n.children)for(var e=0,r=n.children;e<r.length;e++){var i=r[e];gu(i,t)}return n}function Qo(n,t){return n.asset.overview&&(Ar(n.asset.overview.imageFile)||(n.asset.overview.imageFile=xt(t,n.asset.overview.imageFile)),Ar(n.asset.overview.worldFile)||(n.asset.overview.worldFile=xt(t,n.asset.overview.worldFile))),gu(n.root,t),n}function yu(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 Ui=4;function bu(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=Ui,n.version=r.getUint32(e,!0),e+=Ui,n.byteLength=r.getUint32(e,!0),e+=Ui,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var er,je;(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"})(je||(je={}));var Uc=(er={},er[je.DOUBLE]=Float64Array,er[je.FLOAT]=Float32Array,er[je.UNSIGNED_SHORT]=Uint16Array,er[je.UNSIGNED_INT]=Uint32Array,er[je.UNSIGNED_BYTE]=Uint8Array,er[je.BYTE]=Int8Array,er[je.SHORT]=Int16Array,er[je.INT]=Int32Array,er),zc={DOUBLE:je.DOUBLE,FLOAT:je.FLOAT,UNSIGNED_SHORT:je.UNSIGNED_SHORT,UNSIGNED_INT:je.UNSIGNED_INT,UNSIGNED_BYTE:je.UNSIGNED_BYTE,BYTE:je.BYTE,SHORT:je.SHORT,INT:je.INT};function fi(n){var t=Uc[n];if(!t)throw new Error("Failed to convert GL type");return t}function zi(n){var t=fi(n);return t.BYTES_PER_ELEMENT}function Do(n,t,e,r){e===void 0&&(e=0);var i=fi(n);if(e%zi(n)!==0){var a=r?t.slice(e,e+r*zi(n)):t.slice(e);return new i(a)}else return new i(t,e,r!=null?r:(t.byteLength-e)/zi(n))}function Gc(n){var t=zc[n];if(!t)throw new Error("Failed to convert GL type");return t}var wu=function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",je.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 a=fi(e);return new a([i])}else if(Array.isArray(i)){var a=fi(e);return new a(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=Gc(i.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,i.byteOffset)):this.getTypedArrayFromArray(t,e,i)},n.prototype.getProperty=function(t,e,r,i,a){var o=this.json[t];if(!o)return null;var s=this.getPropertyArray(t,e,r);if(r===1)return a[0]=s[i],a;for(var u=0;u<r;++u)a[u]=s[r*i+u];return a},n.prototype.getTypedArrayFromBinary=function(t,e,r,i,a){var o=this.cachedTypedArrays,s=o[t];return s||(s=Do(e,this.buffer.buffer,this.buffer.byteOffset+a,i*r),o[t]=s),s},n.prototype.getTypedArrayFromArray=function(t,e,r){var i=this.cachedTypedArrays,a=i[t];return a||(a=Do(e,r),i[t]=a),a},n}(),en=4,Uo="b3dm tile in legacy format.";function xu(n,t,e){var r=new TextDecoder("utf8"),i=new Uint8Array(n,t,e),a=r.decode(i);return a}function Eu(n,t,e){return e=Hc(n,t,e),e=qc(n,t,e),e=Kc(n,t,e),e}function Hc(n,t,e){var r=new DataView(t),i=0;n.header=n.header||{};var a=r.getUint32(e,!0);e+=en;var o=r.getUint32(e,!0);e+=en;var s=r.getUint32(e,!0);e+=en;var u=r.getUint32(e,!0);return e+=en,s>=570425344?(e-=en*2,i=a,s=o,u=0,a=0,o=0,console.warn(Uo)):u>=570425344&&(e-=en,i=s,s=a,u=o,a=0,o=0,console.warn(Uo)),n.header.featureTableJsonByteLength=a,n.header.featureTableBinaryByteLength=o,n.header.batchTableJsonByteLength=s,n.header.batchTableBinaryByteLength=u,n.header.batchLength=i,e}function qc(n,t,e){var r=n.header||{},i=r.featureTableJsonByteLength,a=r.featureTableBinaryByteLength,o=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:o||0},i&&i>0){var s=xu(t,e,i);n.featureTableJson=JSON.parse(s)}e+=i||0,n.featureTableBinary=new Uint8Array(t,e,a),e+=a||0,n.rtcCenter=[0,0,0];var u=new wu(n.featureTableJson,n.featureTableBinary);if(Array.isArray(u.json.RTC_CENTER)){var c=u.json.RTC_CENTER;n.rtcCenter[0]=c[0],n.rtcCenter[1]=c[1],n.rtcCenter[2]=c[2]}else{var c=u.getGlobalProperty("RTC_CENTER",je.FLOAT,3);c&&(n.rtcCenter[0]=c[0],n.rtcCenter[1]=c[1],n.rtcCenter[2]=c[2])}return e}function Kc(n,t,e){var r=n.header||{},i=r.batchTableJsonByteLength,a=r.batchTableBinaryByteLength;if(i&&i>0){var o=xu(t,e,i);n.batchTableJson=JSON.parse(o),e+=i,a&&a>0&&(n.batchTableBinary=new Uint8Array(t,e,a),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=a)}return e}function jc(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 Wc(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=jc(t,e,r),n.byteLength}function va(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 Re={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},wn={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},hi={9728:d.NearestFilter,9729:d.LinearFilter,9984:d.NearestMipmapNearestFilter,9985:d.LinearMipmapNearestFilter,9986:d.NearestMipmapLinearFilter,9987:d.LinearMipmapLinearFilter},pi={33071:d.ClampToEdgeWrapping,33648:d.MirroredRepeatWrapping,10497:d.RepeatWrapping},zo={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},It={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Mr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Xc={CUBICSPLINE:void 0,LINEAR:d.InterpolateLinear,STEP:d.InterpolateDiscrete},cr={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function At(n){var t=[];for(var e in n)t.push(n[e]);return t}var _c=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,a=e.length;i<a;i++)for(var o=e[i].joints,s=0,u=o.length;s<u;s++)t[o[s]].isBone=!0;for(var c=0,l=t.length;c<l;c++){var h=t[c];h.mesh!==void 0&&h.skin!==void 0&&(r[h.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.dispose(),this.markDefs();for(var i=0,a=At(r);i<a.length;i++){var o=a[i];o.markDefs(this)}return Promise.all(At(r).map(function(s){return s.prepare(t)})).then(function(){var s,u,c;return Promise.all([Promise.all(((s=e.scenes)!==null&&s!==void 0?s:[]).map(function(l,h){return t.loadScene(h)})),Promise.all(((u=e.animations)!==null&&u!==void 0?u:[]).map(function(l,h){return t.loadAnimation(h)})),Promise.all(((c=e.cameras)!==null&&c!==void 0?c:[]).map(function(l,h){return t.loadCamera(h)}))])}).then(function(s){var u=s[0],c=s[1],l=s[2],h={json:t.json,scene:u[e.scene||0],scenes:u,animations:c,cameras:l,dispose:function(){return t.dispose()}};return Promise.all(At(r).map(function(p){return p.emitResult(h,t)})).then(function(){return h})})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,a=0,o=At(this.extensions);a<o.length;a++){var s=o[a];if(i=s.loadCamera(t,this),i)break}if(!i){var u=void 0,c=this.json.cameras[t],l=c[c.type];l?c.type==="perspective"?u=new d.PerspectiveCamera(d.MathUtils.radToDeg(l.yfov),l.aspectRatio||1,l.znear||1,l.zfar||2e6):c.type==="orthographic"?u=new d.OrthographicCamera(-l.xmag,l.xmag,l.ymag,-l.ymag,l.znear,l.zfar):(console.warn("glTF: Invalid camera type ".concat(c.type,".")),u=new d.Camera):(console.warn("glTF: Missing camera parameters."),u=new d.Camera),c.name&&(u.name=this.createUniqueName(c.name)),i=Promise.resolve(u)}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,a=this.json.skins[t],o={joints:a.joints};return a.inverseBindMatrices===void 0?i=Promise.resolve(o):i=this.loadAccessor(a.inverseBindMatrices).then(function(s){return s&&(o.inverseBindMatrices=s),o}),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,a=0,o=At(this.extensions);a<o.length;a++){var s=o[a];if(i=s.loadAnimation(t,this),i)break}if(!i){for(var u=this.json,c=u.animations[t],l=[],h=[],p=[],v=[],m=[],A=0,y=c.channels.length;A<y;A++){var f=c.channels[A],g=c.samplers[f.sampler],b=f.target,x=b.node!==void 0?b.node:b.id,w=c.parameters!==void 0?c.parameters[g.input]:g.input,E=c.parameters!==void 0?c.parameters[g.output]:g.output;l.push(this.loadNode(x)),h.push(this.loadAccessor(w)),p.push(this.loadAccessor(E)),v.push(g),m.push(b)}i=Promise.all([Promise.all(l),Promise.all(h),Promise.all(p),Promise.all(v),Promise.all(m)]).then(function(M){for(var C=M[0],S=M[1],P=M[2],I=M[3],B=M[4],L=[],k=function(H,z){var U=C[H],q=S[H],j=P[H],_=I[H],Z=B[H];if(U===void 0)return"continue";U.updateMatrix(),U.matrixAutoUpdate=!0;var W=void 0;switch(Mr[Z.path]){case Mr.weights:W=d.NumberKeyframeTrack;break;case Mr.rotation:W=d.QuaternionKeyframeTrack;break;case Mr.position:case Mr.scale:default:W=d.VectorKeyframeTrack;break}var Y=U.name?U.name:U.uuid,ce=_.interpolation!==void 0?Xc[_.interpolation]:d.InterpolateLinear,te=[];Mr[Z.path]===Mr.weights?U.traverse(function(fe){fe.morphTargetInfluences&&te.push(fe.name?fe.name:fe.uuid)}):te.push(Y);var se=j.array;if(j.normalized){for(var ue=Gi(se.constructor),pe=new Float32Array(se.length),he=0,de=se.length;he<de;he++)pe[he]=se[he]*ue;se=pe}for(var he=0,de=te.length;he<de;he++){var be=new W(te[he]+"."+Mr[Z.path],q.array,se,ce);L.push(be)}},O=0,N=C.length;O<N;O++)k(O);var D=c.name?c.name:"animation_"+t;return new d.AnimationClip(D,void 0,L)})}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 a=null,o=0,s=At(this.extensions);o<s.length;o++){var u=s[o];if(a=u.loadBuffer(t,this),a)break}if(!a){var c=this.json.buffers[t];a=this.options.fetcher.ajax(this.resolveResouce(c.uri),{responseType:"arraybuffer"}).then(function(l){return l.body})}return this.cache.set(r,a),a},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,a=0,o=At(this.extensions);a<o.length;a++){var s=o[a];if(i=s.loadBufferView(t,this),i)break}if(!i){var u=this.json.bufferViews[t];i=this.loadBuffer(u.buffer).then(function(c){var l=u.byteLength||0,h=u.byteOffset||0;return c.slice(h,h+l)})}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 a=null;if(!a){var o=this.json.accessors[t];if(o.bufferView===void 0&&o.sparse===void 0)a=Promise.resolve(null);else{var s=[];o.bufferView!==void 0?s.push(this.loadBufferView(o.bufferView)):s.push(Promise.resolve(null)),o.sparse!==void 0&&(s.push(this.loadBufferView(o.sparse.indices.bufferView)),s.push(this.loadBufferView(o.sparse.values.bufferView))),a=Promise.all(s).then(function(u){var c=u[0],l=zo[o.type],h=wn[o.componentType],p=h.BYTES_PER_ELEMENT,v=p*l,m=o.byteOffset||0,A=o.bufferView!==void 0?e.json.bufferViews[o.bufferView].byteStride:void 0,y=o.normalized===!0,f,g;if(A&&A!==v){var b=Math.floor(m/A),x="InterleavedBuffer:"+o.bufferView+":"+o.componentType+":"+b+":"+o.count,w=e.cache.get(x);w||(f=new h(c,b*A,o.count*A/p),w=new d.InterleavedBuffer(f,A/p),e.cache.set(x,w)),g=new d.InterleavedBufferAttribute(w,l,m%A/p,y)}else c===null?f=new h(o.count*l):f=new h(c,m,o.count*l),g=new d.BufferAttribute(f,l,y);if(o.sparse!==void 0){var E=zo.SCALAR,M=wn[o.sparse.indices.componentType],C=o.sparse.indices.byteOffset||0,S=o.sparse.values.byteOffset||0,P=new M(u[1],C,o.sparse.count*E),I=new h(u[2],S,o.sparse.count*l);c!==null&&(g=new d.BufferAttribute(g.array.slice(),g.itemSize,g.normalized));for(var B=0,L=P.length;B<L;B++){var k=P[B];if(g.setX(k,I[B*l]),l>=2&&g.setY(k,I[B*l+1]),l>=3&&g.setZ(k,I[B*l+2]),l>=4&&g.setW(k,I[B*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}}return this.cache.set(r,a),a},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=At(this.extensions);e<r.length;e++){var i=r[e],a=i.createPrimitiveKey(t,this);if(a)return a}for(var o="",s=Object.keys(t.attributes).sort(),u=0,c=s.length;u<c;u++)o+=s[u]+":"+t.attributes[s[u]]+";";return t.indices+":"+o+":"+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 a=null,o=0,s=At(this.extensions);o<s.length;o++){var u=s[o];if(a=u.loadGeometry(t,this),a)break}return a||(a=this.addGeometryPrimitiveAttributes(new d.BufferGeometry,t)),a=a.then(function(c){return e.disposeSet.add(c),c}),this.cache.set(r,a),a},n.prototype.loadImage=function(t){var e="image:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,a=0,o=At(this.extensions);a<o.length;a++){var s=o[a];if(i=s.loadImage(t,this),i)break}if(!i){var u=this.json.images[t];if(u.bufferView)i=this.loadBufferView(u.bufferView).then(function(l){var h=new Blob([l],{type:u.mimeType});return da(h)});else if(u.uri){var c=this.resolveResouce(u.uri);i=this.options.fetcher.loadImage(c,{},void 0,void 0,void 0,ci()).then(function(l){return l.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 d.MeshStandardMaterial;if(i.color=new d.Color(1,1,1),i.opacity=1,Object.keys(t.attributes).filter(function(l){return It[l]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(l){return It[l]==="normal"}).length===0&&(i.flatShading=!0),Object.keys(t.attributes).filter(function(l){return It[l]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var a=this.json.materials[t.material];a.name&&(i.name=a.name);var o=a.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;i.color.fromArray(s),i.opacity=s[3]}o.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(o.baseColorTexture).then(function(l){l.encoding=d.sRGBEncoding,i.map=l,e.disposeSet.add(l)})),i.metalness=o.metallicFactor!==void 0?o.metallicFactor:1,i.roughness=o.roughnessFactor!==void 0?o.roughnessFactor:1,o.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(o.metallicRoughnessTexture).then(function(l){l.encoding=d.sRGBEncoding,i.metalnessMap=l,i.roughnessMap=l,e.disposeSet.add(l)})),a.doubleSided===!0&&(i.side=d.DoubleSide);var u=a.alphaMode||cr.OPAQUE;if(u===cr.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,u===cr.MASK&&(i.alphaTest=a.alphaCutoff!==void 0?a.alphaCutoff:.5)),a.normalTexture!==void 0&&(r.push(this.createMaterialTexture(a.normalTexture).then(function(l){i.normalMap=l,e.disposeSet.add(l)})),i.normalScale=new d.Vector2(1,1),a.normalTexture.scale!==void 0)){var c=a.normalTexture.scale;i.normalScale.set(c,c)}a.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(a.occlusionTexture).then(function(l){i.aoMap=l,e.disposeSet.add(l)})),a.occlusionTexture.strength!==void 0&&(i.aoMapIntensity=a.occlusionTexture.strength)),a.emissiveFactor!==void 0&&(i.emissive=new d.Color().fromArray(a.emissiveFactor)),a.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(a.emissiveTexture).then(function(l){i.emissiveMap=l,e.disposeSet.add(l)}))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new d.LineBasicMaterial;if(r.color=new d.Color(1,1,1),r.opacity=1,Object.keys(t.attributes).filter(function(u){return It[u]==="color"}).length>0&&(r.vertexColors=!0),Object.keys(t.attributes).filter(function(u){return It[u]==="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 a=i.pbrMetallicRoughness||{};if(Array.isArray(a.baseColorFactor)){var o=a.baseColorFactor;r.color.fromArray(o),r.opacity=o[3]}i.doubleSided===!0&&(r.side=d.DoubleSide);var s=i.alphaMode||cr.OPAQUE;s===cr.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,s===cr.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 d.PointsMaterial;if(i.color=new d.Color(1,1,1),i.opacity=1,i.sizeAttenuation=!1,Object.keys(t.attributes).filter(function(c){return It[c]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(c){return It[c]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var a=this.json.materials[t.material];a.name&&(i.name=a.name);var o=a.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;i.color.fromArray(s),i.opacity=s[3]}o.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(o.baseColorTexture).then(function(c){c.encoding=d.sRGBEncoding,i.map=c,e.disposeSet.add(c)})),a.doubleSided===!0&&(i.side=d.DoubleSide);var u=a.alphaMode||cr.OPAQUE;u===cr.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,u===cr.MASK&&(i.alphaTest=a.alphaCutoff!==void 0?a.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:Re.TRIANGLES,a="material:"+this.createPrimitiveKey(t),o=this.cache.get(a);if(o)return o;for(var s=null,u=0,c=At(this.extensions);u<c.length;u++){var l=c[u];if(s=l.loadMaterial(t,this),s)break}if(i===Re.TRIANGLES||i===Re.TRIANGLE_STRIP||i===Re.TRIANGLE_FAN)s=this.loadMaterialAsMeshStandardMaterial(t);else if(i===Re.LINES||i===Re.LINE_STRIP||i===Re.LINE_LOOP)s=this.loadMaterialAsLineBasicMaterial(t);else if(i===Re.POINTS)s=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+i);return s=s.then(function(h){return e.disposeSet.add(h),h}),this.cache.set(a,s),s},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,i=this.cache.get(r);if(i)return i;for(var a=null,o=0,s=At(this.extensions);o<s.length;o++){var u=s[o];if(a=u.loadTexture(t,this),a)break}if(!a){var c=this.json.textures[t];a=this.loadImage(c.source).then(function(l){var h=new d.Texture(l);h.needsUpdate=!0,h.flipY=!1,c.name&&(h.name=c.name);var p=e.json.samplers||{},v=p[c.sampler]||{};h.magFilter=hi[v.magFilter]||d.LinearFilter,h.minFilter=hi[v.minFilter]||d.LinearMipmapLinearFilter,h.wrapS=pi[v.wrapS]||d.RepeatWrapping,h.wrapT=pi[v.wrapT]||d.RepeatWrapping;var m=h.dispose;return h.dispose=function(){return h.dispose=m,l.close(),m.call(this)},h})}return a=a.then(function(l){return e.disposeSet.add(l),l}),this.cache.set(r,a),a},n.prototype.loadMesh=function(t){for(var e=this,r=null,i=0,a=At(this.extensions);i<a.length;i++){var o=a[i];if(r=o.loadMesh(t,this),r)break}if(!r){var s=this.json.meshes[t],u=s.primitives,c=Promise.all(u.map(function(h){return e.loadGeometry(h)})),l=Promise.all(u.map(function(h){return e.loadMaterial(h)}));r=Promise.all([c,l]).then(function(h){for(var p=h[0],v=h[1],m=[],A=0;A<u.length;A++){var y=u[A],f=p[A],g=v[A],b=y.mode||Re.TRIANGLES,x=void 0;if(b===Re.TRIANGLES||b===Re.TRIANGLE_STRIP||b===Re.TRIANGLE_FAN)if(b===Re.TRIANGLE_STRIP?f=e.toGeometryTrianglesDrawMode(f,d.TriangleStripDrawMode):b===Re.TRIANGLE_FAN&&(f=e.toGeometryTrianglesDrawMode(f,d.TriangleFanDrawMode)),s.isSkinnedMesh){var w=new d.SkinnedMesh(f,g);f.attributes.skinWeight.normalized||w.normalizeSkinWeights(),x=w}else x=new d.Mesh(f,g);else if(b===Re.POINTS)x=new d.Points(f,g);else if(b===Re.LINES)x=new d.LineSegments(f,g);else if(b===Re.LINE_STRIP)x=new d.Line(f,g);else if(b===Re.LINE_LOOP)x=new d.LineLoop(f,g);else throw new Error("glTF: Primitive mode unsupported: "+b);if(Object.keys(f.morphAttributes).length>0){if(s.weights!==void 0)for(var E=0,M=s.weights.length;E<M;E++)x.morphTargetInfluences[E]=s.weights[E];if(s.extras&&Array.isArray(s.extras.targetNames)){var C=s.extras.targetNames;if(x.morphTargetInfluences.length===C.length){x.morphTargetDictionary={};for(var E=0,M=C.length;E<M;E++)x.morphTargetDictionary[C[E]]=E}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}x.name=e.createUniqueName(s.name||"mesh_"+t),m.push(x)}if(m.length===1)return m[0];for(var S=new d.Group,P=0,I=m;P<I.length;P++){var x=I[P];S.add(x)}return S})}return r},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,i=At(this.extensions);r<i.length;r++){var a=i[r],o=a.loadNodeAttachments(t,this);o&&e.push(o)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var i=this.json,a=i.nodes[t],o=a.name?this.createUniqueName(a.name):"",s=[];a.mesh!==void 0&&s.push(this.loadMesh(a.mesh).then(function(p){if(a.weights!==void 0){var v=a.weights;p.traverse(function(m){if(m instanceof d.Mesh||m instanceof d.Line||m instanceof d.Points)for(var A=0,y=v.length;A<y;A++)m.morphTargetInfluences[A]=v[A]})}return p})),a.camera!==void 0&&s.push(this.loadCamera(a.camera));for(var u=this.loadNodeAttachments(t),c=0,l=u;c<l.length;c++){var h=l[c];s.push(h)}return Promise.all(s).then(function(p){var v;if(a.isBone===!0?v=new d.Bone:p.length>1?v=new d.Group:p.length===1?v=p[0]:v=new d.Object3D,v!==p[0])for(var m=0,A=p.length;m<A;m++)v.add(p[m]);if(a.name&&(v.name=o),a.matrix!==void 0){var y=new d.Matrix4;y.fromArray(a.matrix),v.applyMatrix4(y)}else a.translation!==void 0&&v.position.fromArray(a.translation),a.rotation!==void 0&&v.quaternion.fromArray(a.rotation),a.scale!==void 0&&v.scale.fromArray(a.scale);return v})},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],i=new d.Group;r.name&&(i.name=this.createUniqueName(r.name));for(var a=r.nodes||[],o=[],s=0,u=a.length;s<u;s++)o.push(this.buildNodeHierarchy(a[s],i));return Promise.all(o).then(function(){return i})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var i=0,a=At(e.extensions);i<a.length;i++){var o=a[i],s=o.extendTexture(r,t,e);s&&(r=s)}return r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,i=e.attributes,a=[],o=function(w){var E=It[w]||w.toLowerCase();if(E in t.attributes)return"continue";a.push(s.loadAccessor(i[w]).then(function(M){M&&t.setAttribute(E,M)}))},s=this;for(var u in i)o(u);e.indices!==void 0&&!t.index&&a.push(this.loadAccessor(e.indices).then(function(w){w&&t.setIndex(w)}));var c=new d.Box3;if(i.POSITION!==void 0){var l=this.json.accessors[i.POSITION],h=l.min,p=l.max;if(h!==void 0&&p!==void 0){if(c.set(new d.Vector3(h[0],h[1],h[2]),new d.Vector3(p[0],p[1],p[2])),l.normalized){var v=Gi(wn[l.componentType]);c.min.multiplyScalar(v),c.max.multiplyScalar(v)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var m=e.targets;if(m!==void 0){for(var A=new d.Vector3,y=new d.Vector3,f=0,g=m.length;f<g;f++){var b=m[f];if(b.POSITION!==void 0){var l=this.json.accessors[b.POSITION],h=l.min,p=l.max;if(h!==void 0&&p!==void 0){if(y.setX(Math.max(Math.abs(h[0]),Math.abs(p[0]))),y.setY(Math.max(Math.abs(h[1]),Math.abs(p[1]))),y.setZ(Math.max(Math.abs(h[2]),Math.abs(p[2]))),l.normalized){var v=Gi(wn[l.componentType]);y.multiplyScalar(v)}A.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}c.expandByVector(A)}t.boundingBox=c;var x=new d.Sphere;return c.getCenter(x.center),x.radius=c.min.distanceTo(c.max)/2,t.boundingSphere=x,Promise.all(a).then(function(){if(t.attributes.uv&&!t.attributes.uv2&&r.options.copyUV2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var w=!1,E=!1,M=0,C=e.targets.length;M<C;M++){var S=e.targets[M];if(S.POSITION!==void 0&&(w=!0),S.NORMAL!==void 0&&(E=!0),w&&E)break}if(!w&&!E)return t;var P=[];t.morphTargetsRelative=!0;for(var I=function(B,L){var k=e.targets[B];w?P.push(r.loadAccessor(k.POSITION).then(function(O){O&&(t.morphAttributes.position[B]=O)})):t.morphAttributes.position[B]=t.attributes.position,E?P.push(r.loadAccessor(k.NORMAL).then(function(O){O&&(t.morphAttributes.normal[B]=O)})):t.morphAttributes.normal[B]=t.attributes.normal},M=0,C=e.targets.length;M<C;M++)I(M,C);return Promise.all(P).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(a){if(i.skin===void 0)return a;var o;return r.loadSkin(i.skin).then(function(s){o=s;for(var u=[],c=0,l=o.joints.length;c<l;c++)u.push(r.loadNode(o.joints[c]));return Promise.all(u)}).then(function(s){return a.traverse(function(u){if(u instanceof d.SkinnedMesh){for(var c=[],l=[],h=0,p=s.length;h<p;h++){var v=s[h];if(v instanceof d.Bone){c.push(v);var m=new d.Matrix4;o.inverseBindMatrices!==void 0&&m.fromArray(o.inverseBindMatrices.array,h*16),l.push(m)}else console.warn('glTF: Joint "%s" could not be found.',o.joints[h])}u.bind(new d.Skeleton(c,l),u.matrixWorld)}}),a})}).then(function(a){e.add(a);var o=[];if(i.children)for(var s=i.children,u=0,c=s.length;u<c;u++){var l=s[u];o.push(r.buildNodeHierarchy(l,a))}return Promise.all(o).then(function(){return a})})},n.prototype.createUniqueName=function(t){for(var e=d.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 xt(this.options.resourcePath,yu(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var i=[],a=t.getAttribute("position");if(a!==void 0){for(var o=0;o<a.count;o++)i.push(o);t.setIndex(i),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var s=r.count-2,u=[];if(e===d.TriangleFanDrawMode)for(var o=1;o<=s;o++)u.push(r.getX(0)),u.push(r.getX(o)),u.push(r.getX(o+1));else for(var o=0;o<s;o++)o%2===0?(u.push(r.getX(o)),u.push(r.getX(o+1)),u.push(r.getX(o+2))):(u.push(r.getX(o+2)),u.push(r.getX(o+1)),u.push(r.getX(o)));u.length/3!==s&&console.error("glTF: Unable to generate correct amount of triangles.");var c=t.clone();return c.setIndex(u),c},n}();function Gi(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 mr=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}(),Zc=function(n){oe(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 va(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),a=0,o=null,s=null;a<i.byteLength;){var u=i.getUint32(a,!0);a+=4;var c=i.getUint32(a,!0);if(a+=4,c===t.CHUNK_TYPES.JSON){var l=new Uint8Array(e,t.HEADER_LENGTH+a,u);o=va(l)}else if(c===t.CHUNK_TYPES.BIN){var h=t.HEADER_LENGTH+a;s=e.slice(h,h+u)}a+=u}if(o===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=o,this.body=s},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}(mr),Yc="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",Go={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},Ho={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Jc=function(){function n(){this.decoderPath=Yc,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 a={attributeIDs:r||Go,attributeTypes:i||Ho,useUniqueIDs:!!r};this.decodeGeometry(t,a).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:Go,attributeTypes:Ho,useUniqueIDs:!1});for(var i in e.attributeTypes){var a=e.attributeTypes[i];a.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[i]=a.name)}var o,s=this.workerNextTaskID++,u=t.byteLength,c=this._getWorker(s,u).then(function(l){return o=l,new Promise(function(h,p){o._callbacks[s]={resolve:h,reject:p},o.postMessage({type:"decode",id:s,taskConfig:e,buffer:t},[t])})}).then(function(l){return r._createGeometry(l.geometry)});return c.catch(function(){return!0}).then(function(){o&&s&&r._releaseTask(o,s)}),c},n.prototype._createGeometry=function(t){var e=new d.BufferGeometry;t.index&&e.setIndex(new d.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var i=t.attributes[r],a=i.name,o=i.array,s=i.itemSize;e.setAttribute(a,new d.BufferAttribute(o,s))}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=un(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(a){return a.body});this.decoderPending=r.then(function(a){var o=["/* draco decoder */",a,"","/* worker */",qo].join(`
417
+ `,nu=[];function uc(){var n=nu.pop();return n||new d.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:oc,fragmentShader:sc,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:d.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function lc(n){n.uniforms.map.value=null,nu.push(n)}function cc(n,t,e){var r=new d.Scene;r.matrixAutoUpdate=!1;var i=new d.Group;i.scale.set(1,1,-1),r.add(i);for(var a=[],o=0,s=n;o<s.length;o++){var u=s[o],c=uc();a.push(c),c.uniforms.map.value=u.texture,c.uniforms.flipY.value=u.flipY?1:0;var l=new d.Group,h=new d.Mesh(ac,c);h.position.set(u.position.x+u.size.x/2-.5,1-(u.position.y+u.size.y/2)-.5,-.5),h.scale.set(u.size.x,u.size.y,1),l.quaternion.copy(ic[u.face]),l.add(h),i.add(l)}var p=e.autoClear;e.autoClear=!1;var v=new d.CubeCamera(.1,2,t);v.matrixAutoUpdate=!1,v.update(e,r),e.autoClear=p;for(var m=0,A=a;m<A.length;m++){var c=A[m];lc(c)}}var dc=function(){return!1}();function ci(){var n=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){n.onerror=n.onload=n.close=Q,n.decoding="async";var t=n.src;n.removeAttribute("src"),/^blob\:/.test(t)&&URL.revokeObjectURL(t)}});return n}function da(n){return new Promise(function(t,e){var r=ci();r.onload=function(){/^blob\:/.test(r.src)&&URL.revokeObjectURL(r.src),r.onload=r.onerror=Q,setTimeout(function(){t(r)},0)},r.onerror=function(){var i=r.src;r.onload=r.onerror=Q,r.close(),e(new Error("image load error: ".concat(i)))},r.src=URL.createObjectURL(n)})}var yo=[];function fc(n,t){var e=yo.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=Q,yo.push(r)}});return r}function bo(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=fc(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 d.Texture(e);i.needsUpdate=!0,i.flipY=!0;var a=i.dispose;return i.dispose=function(){e.close(),a.call(i),i.dispose=a},i}else{var o=new d.Texture(n);o.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?o.flipY=!1:o.flipY=!0;var s=o.dispose;return o.dispose=function(){n.close(),s.call(o),o.dispose=s},o}}function hc(n){var t=new d.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 a=i[r];a.close()}e.call(t),t.dispose=e},t}var zr=["right","left","up","down","front","back"],pc=4,Le=function(){function n(t,e,r,i,a){this.tileTree=e,this.tileSources=r,this.options=i,this.renderer=a,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,a,o;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:d.RGBAFormat,t.texture.minFilter=(r=this.options.minFilter)!==null&&r!==void 0?r:d.LinearFilter,t.texture.magFilter=(i=this.options.magFilter)!==null&&i!==void 0?i:d.LinearFilter,t.texture.wrapS=(a=this.options.wrapS)!==null&&a!==void 0?a:d.ClampToEdgeWrapping,t.texture.wrapT=(o=this.options.wrapT)!==null&&o!==void 0?o:d.ClampToEdgeWrapping,this.baseCubeTexture&&(ca(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&ca(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),n.prototype.requestTile=function(t){var e=this,r,i,a,o,s,u,c=this.tileSources.filter(function(A){return A.level===t.level})[0];if(!c){this.loadedCubeNodes.add(t);return}var l=c.size,h=Math.pow(2,t.level)*t.position.y,p=Math.pow(2,t.level)*t.position.x,v="".concat(((a=(i=(r=this.options.imageURL)===null||r===void 0?void 0:r.options)===null||i===void 0?void 0:i.key)!==null&&a!==void 0?a:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(h,".").concat(p),m=F(F({},(s=(o=this.options.imageURL)===null||o===void 0?void 0:o.options)!==null&&s!==void 0?s:{key:"unknown"}),{key:v,size:l*t.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[l*t.position.x,l*t.position.y,l*t.size,l*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(c[t.face],{imageURL:{transform:(u=this.options.imageURL)===null||u===void 0?void 0:u.transform,options:F({},m)},format:d.RGBAFormat,timeout:this.options.timeout,fetcher:this.options.fetcher}).then(function(A){if(e.disposed){A.body.dispose();return}e.textures.push({face:t.face,level:t.level,position:t.position,size:new d.Vector2(t.size,t.size),texture:A.body,flipY:!A.body.flipY}),e.loadedCubeNodes.add(t)}).catch(Q).then(function(){e.disposed||e.loadingCubeNodes.delete(t)})},n.prototype.update=function(t,e){var r=this;if(!this.disposed){var i=[];Oa(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 a=0,o=i;a<o.length;a++){var s=o[a];this.requestTile(s)}if(this.cubeRenderTarget&&this.textures.length){var u=this.textures.splice(0,pc);cc(u,this.cubeRenderTarget,this.renderer),this.needsRender=!0;for(var c=0,l=u;c<l.length;c++){var h=l[c];h.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}(),An=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,i,a,o){var s,u,c,l;r===void 0&&(r=Q),i===void 0&&(i=Q),a===void 0&&(a=Q);var h={};typeof e.flipY!="undefined"&&(h.flipY=e.flipY),typeof e.format!="undefined"&&(h.format=e.format),typeof e.minFilter!="undefined"&&(h.minFilter=e.minFilter),typeof e.magFilter!="undefined"&&(h.magFilter=e.magFilter);var p=(u=(s=e.imageURL)===null||s===void 0?void 0:s.options)!==null&&u!==void 0?u:{key:"unknown"};t=li(t,(c=e.imageURL)===null||c===void 0?void 0:c.transform,p);var v=mo(t),m=(l=e.viaAjax)!==null&&l!==void 0?l:dc,A=Ao(t),y=/^https?:/.test(v);if(A?m=!0:y||(m=!1),m){var f=null,g="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:g},void 0,void 0,a).then(function(w){return da(w.body)}).then(function(w){return bo(w,e.maxSize)}).then(function(w){return Object.assign(w,h),w}).then(function(w){var E={meta:f,body:w};return r(E),E}).catch(function(w){return i(w),Promise.reject(w)})}else{var b=null,x;return Promise.resolve().then(function(){return ci()}).then(function(w){return x=w,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,a,w)}).then(function(w){return b=w.meta,bo(w.body,e.maxSize)}).then(function(w){return Object.assign(w,h),w}).then(function(w){var E={meta:b,body:w};return r(E),E}).catch(function(w){return x&&x.close(),i(w),Promise.reject(w)})}},n.prototype.loadCubeTexture=function(t,e,r,i,a,o){var s,u,c,l;r===void 0&&(r=Q),i===void 0&&(i=Q),a===void 0&&(a=Q),typeof e.format!="undefined"&&e.format,typeof e.minFilter!="undefined"&&e.minFilter,typeof e.magFilter!="undefined"&&e.magFilter;for(var h=[t[zr[0]],t[zr[1]],t[zr[2]],t[zr[3]],t[zr[4]],t[zr[5]]],p=[],v=[0,0,0,0,0,0],m=[],A=function(f){var g=(u=(s=e.imageURL)===null||s===void 0?void 0:s.options)!==null&&u!==void 0?u:{key:"unknown"},b=li(h[f],(c=e.imageURL)===null||c===void 0?void 0:c.transform,F(F({},g),{key:g.key+"."+zr[f]})),x=mo(b),w=function(B){v[f]=B,a(v.reduce(function(L,k){return L+k},0)/6)},E=(l=e.viaAjax)!==null&&l!==void 0?l:!1,M=/^https?:$/.test(x),C=Ao(b);if(C?E=!0:M||(E=!1),E){var S="blob",P=e.fetcher.ajax(b,{timeout:e.timeout,responseType:S},void 0,void 0,w).then(function(B){return m[f]=B.meta,da(B.body)});p.push(P)}else{var I,P=Promise.resolve().then(function(){return ci()}).then(function(L){return I=L,e.fetcher.loadImage(b,{timeout:e.timeout},void 0,void 0,w,L)}).then(function(L){return m[f]=L.meta,L.body}).catch(function(L){return I&&I.close(),Promise.reject(L)});p.push(P)}},y=0;y<6;y++)A(y);return Promise.all(p).then(function(f){return hc(f)}).then(function(f){return Object.assign(f,F({encoding:d.sRGBEncoding},e)),f}).then(function(f){var g={body:f,meta:m};return r(g),g}).catch(function(f){for(var g=0,b=p;g<b.length;g++){var x=b[g];x.then(function(w){return w.close()}).catch(Q)}return i(f),Promise.reject(f)})},n.prototype.loadTiledCubeTexture=function(t,e,r,i,a,o,s){var u=this;return i===void 0&&(i=Q),a===void 0&&(a=Q),o===void 0&&(o=Q),new Promise(function(c,l){var h,p;u.loadCubeTexture(t,{imageURL:{transform:(h=r.imageURL)===null||h===void 0?void 0:h.transform,options:(p=r.imageURL)===null||p===void 0?void 0:p.options},format:d.RGBAFormat,viaAjax:r.viaAjax,timeout:r.timeout,fetcher:r.fetcher},function(v){var m,A,y=v.meta,f=v.body,g=(m=r.tileImageSize)!==null&&m!==void 0?m:512,b=(A=r.tileMaxLevel)!==null&&A!==void 0?A:2,x=Math.max(1024*b,512),w=ua(b),E=new Le(f,w,e,{textureSize:x,tileImageSize:g,textureLoader:u,imageURL:r.imageURL,timeout:r.timeout,fetcher:r.fetcher},s),M={meta:y,body:E};i(M),c(M)},function(v){a(v),l(v)},o,s).catch(Q)})},n}();const vc=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,a=0,o="";return t[a].split(o).map(function(s){return s.charCodeAt(a)>i?s:String.fromCharCode((s.charCodeAt(a)+r)%i)}).join(o)}("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"),Ac=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,a=0,o="";return t[a].split(o).map(function(s){return s.charCodeAt(a)>i?s:String.fromCharCode((s.charCodeAt(a)+r)%i)}).join(o)}("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\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\x079-rp|; 6H--r{-rp?5=;B-8-}uv-<-aNb9-urn-<-]V6H\f|vq-znv{56-\n--sy|n-ory|{tv{tSY||-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6----ory|{tv{tSY||-J-Sy||H--0ryr----ory|{tv{tSY||-J-sy||H--0r{qvs--zn@-pnzrn_|nv|{Znv\x07-J-zn@5cvrZnv\x07h=jh=j9-cvrZnv\x07h>jh=j9-cvrZnv\x07h?jh=j9-cvrZnv\x07h=jh>j9-cvrZnv\x07h>jh>j9-cvrZnv\x07h?jh>j9-cvrZnv\x07h=jh?j9-cvrZnv\x07h>jh?j9-cvrZnv\x07h?jh?j6H--rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9->;=66H--vs5pnzrnQvrpv|{;\b-K-=;E-33-no5V_||sZnx-:->;=6-I-=;>6-\n----qvpnqH--\f--<<前置裁切计算--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 On=new d.WebGLCubeRenderTarget(1).texture;On.name="EMPTY_TEXTURE";var mc=Object.assign({modelAlpha:new d.Uniform(0),progress:new d.Uniform(0),pano0_map:new d.Uniform(On),pano0_luminanceMap:new d.Uniform(null),pano0_matrix:new d.Uniform(new d.Matrix4),pano1_map:new d.Uniform(On),pano1_luminanceMap:new d.Uniform(null),pano1_matrix:new d.Uniform(new d.Matrix4),clippers:new d.Uniform([]),shownFloorIndex:new d.Uniform(-1),constantColor:new d.Uniform(null),floor:new d.Uniform(0)},{exposure:new d.Uniform(1),emissive:new d.Uniform(new d.Color(0)),emissiveMap:new d.Uniform(null),specular:new d.Uniform(new d.Color(1118481)),specularMap:new d.Uniform(null),normalMap:new d.Uniform(null),bumpMap:new d.Uniform(null),shininess:new d.Uniform(30)},d.UniformsUtils.clone(d.UniformsLib.common),d.UniformsUtils.clone(d.UniformsLib.lights)),Dn=function(n){oe(t,n);function t(e){e===void 0&&(e={});var r,i,a,o,s,u,c,l,h,p,v,m,A,y,f,g,b,x,w,E,M=n.call(this,{vertexShader:vc,fragmentShader:Ac,uniforms:d.UniformsUtils.clone(mc),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,C,S=null,P=null;return Object.defineProperties(M,{pano0:{get:function(){return S},set:function(I){if(S!==I){S=I,I===null?(this.uniforms.pano0_map.value=On,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=I.map instanceof Le?I.map.texture:I.map,this.uniforms.pano0_luminanceMap.value=I.luminanceMap instanceof Le?I.luminanceMap.texture:I.luminanceMap,this.uniforms.pano0_matrix.value.copy(I.matrix));var B=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,L=this.defines.USE_LUMINANCE;L!==B&&(this.defines.USE_LUMINANCE=B,this.needsUpdate=!0)}}},pano1:{get:function(){return P},set:function(I){if(P!==I){P=I,I===null?(this.uniforms.pano1_map.value=On,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=I.map instanceof Le?I.map.texture:I.map,this.uniforms.pano1_luminanceMap.value=I.luminanceMap instanceof Le?I.luminanceMap.texture:I.luminanceMap,this.uniforms.pano1_matrix.value.copy(I.matrix));var B=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,L=this.defines.USE_LUMINANCE;L!==B&&(this.defines.USE_LUMINANCE=B,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(I){this.uniforms.modelAlpha.value=I}},progress:{get:function(){return this.uniforms.progress.value},set:function(I){this.uniforms.progress.value=I}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(I){var B=this.defines.USE_BLACK_TRANSITION;B!==I&&(this.defines.USE_BLACK_TRANSITION=I,this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(I){this.uniforms.constantColor.value=I;var B=this.defines.USE_CONSTANT_COLOR,L=I!==null;B!==L&&(this.defines.USE_CONSTANT_COLOR=L,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(I){this.uniforms.opacity.value=I}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(I){this.uniforms.shownFloorIndex.value=I}},clippers:{get:function(){return C},set:function(I){C!==I&&(C=I,this.uniforms.clippers.value=(C||[]).map(function(B){var L=typeof B.floorIndex=="number"?B.floorIndex:-1,k=new d.Matrix4().getInverse(B.clippingBoxMatrix);return{matrixInverse:k,floorIndex:L}}),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(I){I!==this.defines.USE_EDL&&(this.defines.USE_EDL=I,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(I){I!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=I,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(I){I!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=I,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(I){this.uniforms.floor.value=I}}}),M.pano0=(r=e.pano0)!==null&&r!==void 0?r:ye.pano0,M.pano1=(i=e.pano1)!==null&&i!==void 0?i:ye.pano1,M.modelAlpha=(a=e.modelAlpha)!==null&&a!==void 0?a:ye.modelAlpha,M.progress=(o=e.progress)!==null&&o!==void 0?o:ye.progress,M.useBlackTransition=(s=e.useBlackTransition)!==null&&s!==void 0?s:ye.useBlackTransition,M.constantColor=(u=e.constantColor)!==null&&u!==void 0?u:ye.constantColor,M.opacity=(c=e.opacity)!==null&&c!==void 0?c:ye.opacity,M.shownFloorIndex=(l=e.shownFloorIndex)!==null&&l!==void 0?l:ye.shownFloorIndex,M.clippers=(h=e.clippers)!==null&&h!==void 0?h:ye.clippers,M.useEDL=(p=e.useEDL)!==null&&p!==void 0?p:ye.useEDL,M.useHQWeight=(v=e.useHQWeight)!==null&&v!==void 0?v:ye.useHQWeight,M.useHQDepth=(m=e.useHQDepth)!==null&&m!==void 0?m:ye.useHQDepth,M.pointSize=(A=e.pointSize)!==null&&A!==void 0?A:ye.pointSize,M.pointColor=(y=e.pointColor)!==null&&y!==void 0?y:ye.pointColor,M.pointShape=(f=e.pointShape)!==null&&f!==void 0?f:ye.pointShape,M.pointScale=(g=e.pointScale)!==null&&g!==void 0?g:ye.pointScale,M.pointBack=(b=e.pointBack)!==null&&b!==void 0?b:ye.pointBack,M.pointMinPixel=(x=e.pointMinPixel)!==null&&x!==void 0?x:ye.pointMinPixel,M.pointMaxPixel=(w=e.pointMaxPixel)!==null&&w!==void 0?w:ye.pointMaxPixel,M.gradientTexture=(E=e.gradientTexture)!==null&&E!==void 0?E:ye.gradientTexture,M.floor=0,M}return t.prototype.onBeforeCompile=function(e,r){var i,a,o=String((a=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&a!==void 0?a:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,o),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,o)},t.prototype.update=function(e,r){this.transparent=this.shownFloorIndex>-1||this.opacity<1,this.blending=this.transparent?d.NormalBlending:d.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}(d.ShaderMaterial),Hr=function(n){oe(t,n);function t(e){var r=e.preserveDrawingBuffer,i=r===void 0?!0:r,a=e.premultipliedAlpha,o=a===void 0?!0:a,s=e.stencil,u=s===void 0?!0:s,c=e.backgroundColor,l=c===void 0?1579548:c,h=e.backgroundAlpha,p=h===void 0?1:h,v=e.pixelRatio,m=v===void 0?1:v,A=e.antialias,y=e.webgl2,f=this,g={antialias:A,alpha:!0,preserveDrawingBuffer:i,stencil:u,premultipliedAlpha:o,powerPreference:"high-performance"};if(y){var b=document.createElement("canvas"),x=b.getContext("webgl2",g);x?f=n.call(this,F(F({},g),{antialias:!0,canvas:b,context:x}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),f=n.call(this,g)||this)}else f=n.call(this,g)||this;return f.setPixelRatio(m),f.setClearColor(l,p),f.outputEncoding=d.sRGBEncoding,f.autoClear=!0,f}return t}(d.WebGLRenderer),iu=function(n){oe(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}(d.Scene);function Tr(n,t){var e=Math.abs(Math.cos(n.latitude)),r=-Math.sin(n.longitude)*e,i=-Math.sin(n.latitude),a=-Math.cos(n.longitude)*e;return t?t.set(r,i,a):new d.Vector3(r,i,a)}var gc=1,yc=.1,bc=2e3,jn=Math.PI*2,wo=Math.PI/2;function xo(n){return n>0&&n<=jn?n:(n%jn+jn)%jn}function wc(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 di=function(n){oe(t,n);function t(e,r,i,a,o,s,u){r===void 0&&(r=gc),i===void 0&&(i=yc),a===void 0&&(a=bc),o===void 0&&(o=new d.Vector2),s===void 0&&(s=512),u===void 0&&(u=1);var c=n.call(this)||this;c.fov=e,c.aspect=r,c.near=i,c.far=a,c.perspToOrtho=o,c.screenHeight=s,c.pixelRatio=u,c.needsRender=!0,c.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new d.Vector3},c.computePose(),c.perspectiveCamera=new d.PerspectiveCamera(c.fov,c.aspect,.001,c.far);var l=Math.max(c.orthoDistance,.01)*Math.tan(.5*c.fov/180*Math.PI),h=-.5*c.aspect*2*l;return c.orthographicCamera=new d.OrthographicCamera(h,-h,l,-l,.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 Tr(this.pose,e)},t.prototype.computePose=function(e){e===void 0&&(e=0);var r=this.getDirection(new d.Vector3);this.pose.longitude=xo(-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 d.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,a,o,s,u=xo((r=e.longitude)!==null&&r!==void 0?r:this.pose.longitude),c=Math.max(-wo+1e-4,Math.min(wo-1e-4,(i=e.latitude)!==null&&i!==void 0?i:this.pose.latitude)),l=(a=e.fov)!==null&&a!==void 0?a:this.pose.fov,h=(o=e.distance)!==null&&o!==void 0?o:this.pose.distance,p=(s=e.offset)!==null&&s!==void 0?s:this.pose.offset,v=Tr({longitude:u,latitude:c}).normalize();return this.position.set(0,0,0),this.lookAt(v),this.position.add(p).sub(v.clone().setLength(h)),this.fov!==l&&(this.fov=l,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=u,this.pose.latitude=c,this.pose.fov=l,this.pose.distance=h,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(){wc(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,a,o,s){this.perspectiveCamera.setViewOffset(e,r,i,a,o,s),this.orthographicCamera.setViewOffset(e,r,i,a,o,s),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 a=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),o=-.5*this.aspect*2*a;this.orthographicCamera.left=o,this.orthographicCamera.right=-o,this.orthographicCamera.top=a,this.orthographicCamera.bottom=-a,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(ve(),0),this},t}(d.Camera),mt;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(mt||(mt={}));var au=1e-6,ke=new d.Vector3,Ir=new d.Matrix4,wr=new d.Vector3,xr=new d.Vector3,Er=new d.Vector3,fa=new d.Vector3,Eo=new d.Box3,Mo=new d.Sphere,Co=new d.Matrix4,So=new d.Ray,vt=new d.Object3D,Io=new d.Frustum;function ou(n,t){var e=n.elements;return t.setFromRotationMatrix(Ir.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 Pn=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 Ir.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Io.setFromProjectionMatrix(Ir),this.setFromFrustum(Io),this},n.prototype.computeVisibility=function(t){for(var e=mt.Inside,r=0,i=this.planes;r<i.length;r++){var a=i[r],o=t.intersectPlane(a);switch(o){case mt.Outside:return mt.Outside;case mt.Intersecting:e=mt.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),a=0;a<i;++a){var o=1<<a;if(e&o){var s=this.planes[a],u=t.intersectPlane(s);if(u===mt.Outside)return n.MASK_OUTSIDE;u===mt.Intersecting&&(r|=o)}}return r},n}(),su=function(){function n(){this.type="box",this.center=new d.Vector3,this.halfSize=new d.Vector3,this.rotation=new d.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],a=e[5],o=e[6],s=e[7],u=e[8],c=e[9],l=e[10],h=e[11],p=Math.sqrt(r*r+i*i+a*a),v=Math.sqrt(o*o+s*s+u*u),m=Math.sqrt(c*c+l*l+h*h);this.halfSize.set(p,v,m);var A=this.halfSize.toArray().reduce(function(y,f){return y+f},0);return(isNaN(A)||A<=0)&&this.halfSize.setScalar(au),this.rotation.fromArray([r/p,i/p,a/p,o/v,s/v,u/v,c/m,l/m,h/m]),isNaN(this.rotation.toArray().reduce(function(y,f){return y+f},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(wr,xr,Er),{box:rt(rt(rt(rt([],this.center.toArray(),!0),wr.multiplyScalar(this.halfSize.x).toArray(),!0),xr.multiplyScalar(this.halfSize.y).toArray(),!0),Er.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 vt.position.copy(this.center),ou(this.rotation,vt.quaternion),vt.scale.copy(this.halfSize),vt.matrix.compose(vt.position,vt.quaternion,vt.scale),vt.matrix.premultiply(t),vt.matrix.decompose(vt.position,vt.quaternion,vt.scale),this.center.copy(vt.position),this.rotation.setFromMatrix4(Ir.makeRotationFromQuaternion(vt.quaternion)),this.halfSize.copy(vt.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,a=t.z-this.center.z,o=0,s;return s=r*e[0]+i*e[1]+a*e[2],s<0&&(s=-s),s-=this.halfSize.x,s>0&&(o+=s*s),s=r*e[3]+i*e[4]+a*e[5],s<0&&(s=-s),s-=this.halfSize.y,s>0&&(o+=s*s),s=r*e[6]+i*e[7]+a*e[8],s<0&&(s=-s),s-=this.halfSize.z,s>0&&(o+=s*s),o},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceSquaredTo(t))},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(wr,xr,Er),wr.setLength(this.halfSize.x),xr.setLength(this.halfSize.y),Er.setLength(this.halfSize.z),t.expandByPoint(ke.copy(this.center).add(wr)),t.expandByPoint(ke.copy(this.center).sub(wr)),t.expandByPoint(ke.copy(this.center).add(xr)),t.expandByPoint(ke.copy(this.center).sub(xr)),t.expandByPoint(ke.copy(this.center).add(Er)),t.expandByPoint(ke.copy(this.center).sub(Er)),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);ke.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),ke.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),ke.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),ke.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),ke.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),ke.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),ke.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),ke.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new d.BufferGeometry;return r.setIndex(new d.BufferAttribute(t,1)),r.setAttribute("position",new d.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,i=this.rotation.elements,a=this.halfSize,o=r.x,s=r.y,u=r.z,c=Math.abs(o*i[0]*a.x+s*i[1]*a.x+u*i[2]*a.x)+Math.abs(o*i[3]*a.y+s*i[4]*a.y+u*i[5]*a.y)+Math.abs(o*i[6]*a.z+s*i[7]*a.z+u*i[8]*a.z),l=r.dot(e)+t.constant;return l<=-c?mt.Outside:l>=c?mt.Inside:mt.Intersecting},n.prototype.intersectRay=function(t,e){fa.copy(this.halfSize).multiplyScalar(2),Eo.setFromCenterAndSize(ke.set(0,0,0),fa),this.rotation.extractBasis(wr,xr,Er),Ir.makeBasis(wr,xr,Er),Ir.setPosition(this.center),Co.getInverse(Ir),So.copy(t).applyMatrix4(Co);var r=So.intersectBox(Eo,ke);return r?e!==void 0?r.applyMatrix4(Ir).distanceTo(t.origin)<e:!0:!1},n}(),uu=function(){function n(){this.type="sphere",this.center=new d.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],au),this},n.prototype.toJson=function(){return{sphere:rt(rt([],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,fa.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 a=new d.BufferGeometry;return a.setAttribute("position",new d.BufferAttribute(e,3)),a.computeBoundingBox(),a.computeBoundingSphere(),a},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,a=i.dot(e)+t.constant;return a<-r?mt.Outside:a<r?mt.Intersecting:mt.Inside},n.prototype.intersectRay=function(t,e){Mo.set(this.center,this.radius);var r=t.intersectSphere(Mo,ke);return r?e!==void 0?t.origin.distanceTo(r)<e:!0:!1},n}(),xc=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 Bn(n){if("box"in n)return new su().fromJson(n);if("sphere"in n)return new uu().fromJson(n);if("region"in n)return new xc().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var Wn=[2621517,3801199,4915345,5963950,7274706,8782079,9575167,10434047,11623423,12482559,13274879,13870335,14464511,15125247,15852031,16446719].map(function(n){return new d.LineBasicMaterial({color:n,depthWrite:!1,transparent:!0})}),Ec=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);ke.set(1,1,1).toArray(t,0),ke.set(-1,1,1).toArray(t,3),ke.set(-1,-1,1).toArray(t,6),ke.set(1,-1,1).toArray(t,9),ke.set(1,1,-1).toArray(t,12),ke.set(-1,1,-1).toArray(t,15),ke.set(-1,-1,-1).toArray(t,18),ke.set(1,-1,-1).toArray(t,21);var e=new d.BufferGeometry;return e.setIndex(new d.BufferAttribute(n,1)),e.setAttribute("position",new d.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e}(),Mc=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 d.BufferGeometry;return i.setAttribute("position",new d.BufferAttribute(t,3)),i.computeBoundingBox(),i.computeBoundingSphere(),i}();function Cc(n,t){if(n instanceof su){var e=new d.LineSegments(Ec,Wn[Math.min(t,Wn.length-1)]);return e.position.copy(n.center),ou(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 uu){var e=new d.LineSegments(Mc,Wn[Math.min(t,Wn.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 Na=function(){function n(t,e,r,i){var a=this,o,s,u;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=(o=e.refine)!==null&&o!==void 0?o:this.parent?this.parent.refine:"REPLACE",this.transform=new d.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=(u=(s=this.parent)===null||s===void 0?void 0:s.geometricError)!==null&&u!==void 0?u: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=Bn(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=Bn(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=Bn(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=e.extras||{},e.children?this.children=e.children.map(function(c,l){return new n("".concat(a.id,".").concat(l),c,r,a)}):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:Pn.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,i),this.state.visible=this.state.visibilityPlaneMask!==Pn.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.visibilityPlaneMask=Pn.MASK_INDETERMINATE,this.state.visible=!0;if(this.viewerRequestVolume){var a=e?this.viewerRequestVolume.clone().applyMatrix4(e):this.viewerRequestVolume;this.state.inRequestVolume=a.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(a){return i.done(),r.loadState=a?"READY":"UNLOADED",a}).catch(function(a){return r.loadState="FAILED",i.done(),Promise.reject(a)}):(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(),a=this.parent?this.parent.geometricError:this.tileset.geometricError,o=i*(r?a:this.geometricError);if(o===0)return 0;var s=Math.max(e,.001),u=o*t.height/(s*t.sseDenominator);return u},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,a=this.tileset.root?this.tileset.root.state.screenSpaceError:0,o=Math.max(a-i,0);return o},n}(),ha=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(){}},a=new Promise(function(o){return i.resolve=o});return this.requestQueue.push(i),this.requestMap.set(t,a),this.issueNewRequests(),a},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,a=!1,o=function(){a||(a=!0,e.requestMap.delete(r),e.activeRequests--,e.issueNewRequests())};this.activeRequests++,i({done:o})},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,a){return i.priority-a.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}(),Sc=function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n}(),Ic=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 Sc(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}(),lu=function(){function n(){this.cacheNodeMap=new Map,this.list=new Ic,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}(),To=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}(),pa=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 To,this._emptyTraversalStack=new To,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,a=r;i<a.length;i++){var o=a[i];this._traversalStack.reset(),this._emptyTraversalStack.reset(),this._canSelectTile=o.camera.visible,this.updateTile(t,o),this.executeTraversal(t,o)}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(),a=!1;if(this.canTraverse(i,e,!1,!1)){var o=i.hasRenderContent?i.state.selectionDepth+1:i.state.selectionDepth;this.updateChildTiles(i,e,o),a=this.updateAndPushChildren(i,e,r)}var s=i.parent,u=!s||s.state.shouldRefine,c=!a;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=a&&u}},n.prototype.updateChildTiles=function(t,e,r){for(var i=t.children,a=0,o=i;a<o.length;a++){var s=o[a];s.state.selectionDepth=r,this.updateTile(s,e)}return!0},n.prototype.updateAndPushChildren=function(t,e,r){for(var i=t.children,a=t.refine==="REPLACE"&&t.hasRenderContent&&!this.skipLevelOfDetail,o=!1,s=!0,u=0,c=i;u<c.length;u++){var l=c[u];if(l.state.visible&&l.state.inRequestVolume?(r.find(l)&&r.delete(l),r.push(l),o=!0):(a||this.loadSiblings)&&(this.loadTile(l,e.frameNumber),this.touchTile(l,e)),a){var h=void 0;l.state.inRequestVolume?l.hasRenderContent?h=l.contentAvailable:h=this.executeEmptyTraversal(l,e):h=!1,s=s&&h}}return o||(s=!1),s},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 a=i.pop();this.updateTile(a,e),a.state.visible||this.loadTile(a,e.frameNumber),this.touchTile(a,e);var o=!a.hasRenderContent&&this.canTraverse(a,e,!1,!0);if(o)for(var s=a.children,u=0,c=s;u<c.length;u++){var l=c[u];i.find(l)&&i.delete(l),i.push(l)}else a.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}(),Tc=new d.Matrix4,ti=function(){function n(t,e,r){var i,a;this.id=t,this.transform=new d.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=(a=e.properties)!==null&&a!==void 0?a:{},this.options=r,this.traverser=new pa,this.cache=new lu,this.requestScheduler=new ha,this.frameNumber=0,this.pendingCount=0,this.tiles=new Map,this.memoryUsageInBytes=0,this.root=new Na("".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,a=r.children.length;i<a;i++)e.push(r.children[i]);this.cache.unloadTile(r,function(o){return t.unloadTile(o)})}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(Tc),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=pa.DEFAULT_MAX_SCREEN_SPACE_ERROR,n.DEFAULT_MAX_REQUESTS=ha.DEFAULT_MAX_REQUESTS,n}(),ln=function(){function n(t,e,r,i,a){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=i,this.deepth=a}return n}(),pr=6*4+4+4+2+2;function cu(n,t){for(var e=new ArrayBuffer(t*pr),r=new Float32Array(e),i=new Uint32Array(e),a=new Uint16Array(e),o=[n],s,u;s=o.pop();)u=s.id*pr/4,r[u]=s.extents[0],r[u+1]=s.extents[1],r[u+2]=s.extents[2],r[u+3]=s.extents[3],r[u+4]=s.extents[4],r[u+5]=s.extents[5],i[u+6]=s.startIndex,i[u+7]=s.endIndex,u=s.id*pr/2,s.node0&&(a[u+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[u+17]=s.node1.id,o.push(s.node1));return e}function du(n,t,e,r,i,a,o,s,u){u===void 0&&(u=0),e=e-u,r=r-u,i=i-u,a=a+u,o=o+u,s=s+u;var c={min:0,max:0};t.x>=0?(c.min=(e-n.x)*t.x,c.max=(a-n.x)*t.x):(c.min=(a-n.x)*t.x,c.max=(e-n.x)*t.x);var l={min:0,max:0};if(t.y>=0?(l.min=(r-n.y)*t.y,l.max=(o-n.y)*t.y):(l.min=(o-n.y)*t.y,l.max=(r-n.y)*t.y),c.min>l.max||l.min>c.max)return!1;l.min>c.min&&(c.min=l.min),l.max<c.max&&(c.max=l.max);var h={min:0,max:0};return t.z>=0?(h.min=(i-n.z)*t.z,h.max=(s-n.z)*t.z):(h.min=(s-n.z)*t.z,h.max=(i-n.z)*t.z),!(c.min>h.max||h.min>c.max||(h.min>c.min&&(c.min=h.min),h.max<c.max&&(c.max=h.max),c.max<0))}var fu=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,a=t.z,o=e.x,s=e.y,u=e.z;return this.x=i*u-a*s,this.y=a*o-r*u,this.z=r*s-i*o,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}(),hu=function(){function n(t,e,r){this.triangle=t,this.intersectionPoint=e,this.index=r}return n}(),Po=1e-6,Bo=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),a=0;a<r;a++)i[a]=a;this.indicesArray=i}}return n.prototype.createTree=function(t,e,r){e=Math.min(e,16);var i=this.positionArray,a=this.indicesArray,o=a.length/3,s=o>65535?new Uint32Array(o):new Uint16Array(o),u=new Float32Array(o*6),c=[],l=0,h=-1;if(r)for(var p=0,v=0,m=0,A=void 0,y=void 0,f=void 0,g=void 0,b=void 0,x=void 0,w=void 0;p<o;p+=1,v+=3,m+=6)s[p]=p,A=g=i[a[v]*3],w=i[a[v+1]*3],w<A&&(A=w),w>g&&(g=w),w=i[a[v+2]*3],w<A&&(A=w),w>g&&(g=w),y=b=i[a[v]*3+1],w=i[a[v+1]*3+1],w<y&&(y=w),w>b&&(b=w),w=i[a[v+2]*3+1],w<y&&(y=w),w>b&&(b=w),f=x=i[a[v]*3+2],w=i[a[v+1]*3+2],w<f&&(f=w),w>x&&(x=w),w=i[a[v+2]*3+2],w<f&&(f=w),w>x&&(x=w),u[m]=A,u[m+1]=y,u[m+2]=f,u[m+3]=g,u[m+4]=b,u[m+5]=x;else{for(var E=1/0,M=1/0,C=1/0,S=-1/0,P=-1/0,I=-1/0,p=0,v=0,m=0,A=void 0,y=void 0,f=void 0,g=void 0,b=void 0,x=void 0,w=void 0;p<o;p+=1,v+=3,m+=6)s[p]=p,A=g=i[a[v]*3],w=i[a[v+1]*3],w<A&&(A=w),w>g&&(g=w),w=i[a[v+2]*3],w<A&&(A=w),w>g&&(g=w),y=b=i[a[v]*3+1],w=i[a[v+1]*3+1],w<y&&(y=w),w>b&&(b=w),w=i[a[v+2]*3+1],w<y&&(y=w),w>b&&(b=w),f=x=i[a[v]*3+2],w=i[a[v+1]*3+2],w<f&&(f=w),w>x&&(x=w),w=i[a[v+2]*3+2],w<f&&(f=w),w>x&&(x=w),u[m]=A,u[m+1]=y,u[m+2]=f,u[m+3]=g,u[m+4]=b,u[m+5]=x,A<E&&(E=A),g>S&&(S=g),y<M&&(M=y),b>P&&(P=b),f<C&&(C=f),x>I&&(I=x);r=[E,M,C,S,P,I]}var B=new ln(++h,r,0,o,0);c[l++]=B;var L=[],k=[0,1,2],O=function(D,H){return L[H]-L[D]};function N(D){var H=D.startIndex,z=D.endIndex,U=D.extents;L[0]=U[3]-U[0],L[1]=U[4]-U[1],L[2]=U[5]-U[2],k.sort(O);for(var q=0;q<3;q++){for(var j=k[q],_=U[j]+U[j+3],Z=H,W=z-1,Y=-1,ce=void 0;Z<=W;)Y===-1?(ce=s[Z],u[ce*6+j]+u[ce*6+j+3]<_?Z++:Y=ce):(ce=s[W],u[ce*6+j]+u[ce*6+j+3]>=_||(s[Z]=ce,s[W]=Y,Y=-1,Z++),W--);if(Z>H&&Z<z){var te=new ln(++h,Ro(s,u,H,Z,Po),H,Z,D.deepth+1);te.deepth<e&&te.endIndex-te.startIndex>t&&(c[l++]=te);var se=new ln(++h,Ro(s,u,Z,z,Po),Z,z,D.deepth+1);se.deepth<e&&se.endIndex-se.startIndex>t&&(c[l++]=se),D.node0=te,D.node1=se,D.startIndex=0,D.endIndex=0;break}}}for(;l;)N(c[--l]);return this.offsetArray=s,this.rootNodePacked=cu(B,h+1),c.length=0,this},n.prototype.trianglesInSphere=function(t,e){for(var r=this.positionArray,i=this.indicesArray,a=this.offsetArray,o=this.rootNodePacked,s=new Float32Array(o),u=new Uint32Array(o),c=new Uint16Array(o),l=[0],h=[],p,v,m,A;(p=l.pop())!==void 0;){A=p*pr/4;var y=Qi(t.x,s[A],s[A+3])-t.x,f=Qi(t.y,s[A+1],s[A+4])-t.y,g=Qi(t.z,s[A+2],s[A+5])-t.z;if(y*y+f*f+g*g<=e*e){for(var b=u[A+6];b<u[A+7];b++)h.push(a[b]);A=p*pr/2,v=c[A+16],m=c[A+17],v&&l.push(v),m&&l.push(m)}}for(var x=h.length,w=new Float32Array(x*9),b=0;b<x;b++){var E=h[b];w[b*9]=r[i[E]*3],w[b*9+1]=r[i[E]*3+1],w[b*9+2]=r[i[E]*3+2],w[b*9+3]=r[i[E+1]*3],w[b*9+4]=r[i[E+1]*3+1],w[b*9+5]=r[i[E+1]*3+2],w[b*9+6]=r[i[E+2]*3],w[b*9+7]=r[i[E+2]*3+1],w[b*9+8]=r[i[E+2]*3+2]}return w},n.prototype.intersectRay=function(t,e,r){for(var i=this.positionArray,a=this.indicesArray,o=this.offsetArray,s=this.rootNodePacked,u=new Float32Array(s),c=new Uint32Array(s),l=new Uint16Array(s),h=new fu(1/e.x,1/e.y,1/e.z),p=[0],v,m,A,y;(v=p.pop())!==void 0;)if(y=v*pr/4,du(t,h,u[y],u[y+1],u[y+2],u[y+3],u[y+4],u[y+5])){for(var f=c[y+6],g=c[y+7],b=void 0,x=void 0,w=void 0,E=t.x,M=t.y,C=t.z,S=e.x,P=e.y,I=e.z,B=void 0,L=void 0,k=void 0,O=void 0,N=void 0,D=void 0,H=void 0,z=void 0,U=void 0,q=void 0,j=void 0,_=void 0,Z=void 0,W=void 0,Y=void 0,ce=void 0,te=void 0,se=void 0,ue=void 0,pe=void 0,he=void 0,de=void 0,be=void 0,fe=void 0,Se=void 0,ee=void 0,le=void 0;f<g;f++){if(b=o[f],x=b*3,w=a[x]*3,B=i[w],L=i[++w],k=i[++w],w=a[x+1]*3,O=i[w],N=i[++w],D=i[++w],w=a[x+2]*3,H=i[w],z=i[++w],U=i[++w],q=O-B,j=N-L,_=D-k,Z=H-B,W=z-L,Y=U-k,ce=j*Y-_*W,te=_*Z-q*Y,se=q*W-j*Z,be=S*ce+P*te+I*se,be>0)de=1;else if(be<0)de=-1,be=-be;else continue;ue=E-B,pe=M-L,he=C-k,fe=de*(S*(pe*Y-he*W)+P*(he*Z-ue*Y)+I*(ue*W-pe*Z)),!(fe<0)&&(Se=de*(S*(j*he-_*pe)+P*(_*ue-q*he)+I*(q*pe-j*ue)),!(Se<0)&&(fe+Se>be||(ee=-de*(ue*ce+pe*te+he*se),!(ee<0)&&(le=ee/be,r.push(new hu([B,L,k,O,N,D,H,z,U],[E+S*le,M+P*le,C+I*le],b))))))}y=v*pr/2,m=l[y+16],A=l[y+17],m&&p.push(m),A&&p.push(A)}return r},n}();function Qi(n,t,e){return n<t?t:n>e?e:n}function Ro(n,t,e,r,i){if(e>=r)return[0,0,0,0,0,0];for(var a=1/0,o=1/0,s=1/0,u=-1/0,c=-1/0,l=-1/0,h=e,p=void 0,v=void 0;h<r;h++)p=n[h]*6,v=t[p],v<a&&(a=v),v=t[p+1],v<o&&(o=v),v=t[p+2],v<s&&(s=v),v=t[p+3],v>u&&(u=v),v=t[p+4],v>c&&(c=v),v=t[p+5],v>l&&(l=v);return[a-i,o-i,s-i,u+i,c+i,l+i]}var Fo=1e-6,ko=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,a=this.indicesArray,o=a?a.length:i.length/3,s=o>65535?new Uint32Array(o):new Uint16Array(o),u=[],c=0,l=-1;if(r)for(var h=0;h<o;h+=1)s[h]=h;else{for(var p=a?a[0]*3:0,v=i[p],m=i[p+1],A=i[p+2],y=v,f=m,g=A,h=0,b=0,x=void 0,w=void 0,E=void 0;h<o;h+=1,b+=3)s[h]=h,p=(a?a[b]:b)*3,x=i[p],w=i[p+1],E=i[p+2],x<v?v=x:x>y&&(y=x),w<m?m=w:w>f&&(f=w),E<A?A=E:E>g&&(g=E);r=[v,m,A,y,f,g]}var M=new ln(++l,r,0,o,0);u[c++]=M;var C=[],S=[0,1,2],P=function(B,L){return C[L]-C[B]};function I(B){var L=B.startIndex,k=B.endIndex,O=B.extents;C[0]=O[3]-O[0],C[1]=O[4]-O[1],C[2]=O[5]-O[2];for(var N=S.sort(P)[0],D=(O[N]+O[N+3])/2,H=L,z=k-1,U=-1,q,j;H<=z;)U===-1?(q=s[H],j=(a?a[q]:q)*3,i[j+N]<D?H++:U=q):(q=s[z],j=(a?a[q]:q)*3,i[j+N]>=D||(s[H]=q,s[z]=U,U=-1,H++),z--);if(H>L){var _=O.slice();_[N+3]=D+Fo;var Z=new ln(++l,_,L,H,B.deepth+1);Z.deepth<e&&Z.endIndex-Z.startIndex>t&&(u[c++]=Z),B.node0=Z}if(k>H){var W=O.slice();W[N]=D-Fo;var Y=new ln(++l,W,H,k,B.deepth+1);Y.deepth<e&&Y.endIndex-Y.startIndex>t&&(u[c++]=Y),B.node1=Y}B.startIndex=0,B.endIndex=0}for(;c;)I(u[--c]);return this.offsetArray=s,this.rootNodePacked=cu(M,l+1),u.length=0,this},n.prototype.intersectRay=function(t,e,r,i){for(var a=this.positionArray,o=this.indicesArray,s=this.offsetArray,u=this.rootNodePacked,c=new Float32Array(u),l=new Uint32Array(u),h=new Uint16Array(u),p=r*r,v=new fu(1/e.x,1/e.y,1/e.z),m=[0],A,y,f,g;(A=m.pop())!==void 0;)if(g=A*pr/4,du(t,v,c[g],c[g+1],c[g+2],c[g+3],c[g+4],c[g+5],r)){for(var b=l[g+6],x=l[g+7],w=void 0,E=void 0,M=void 0,C=void 0,S=void 0,P=void 0,I=void 0,B=void 0,L=void 0,k=void 0,O=void 0,N=void 0,D=void 0;b<x;b++)w=s[b],E=(o?o[w]:w)*3,M=a[E],C=a[++E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4scz1zK24sZT1lK24sYT1hK247dmFyIHk9e21pbjowLG1heDowfTtyLng+PTA/KHkubWluPShpLWgueCkqci54LHkubWF4PShzLWgueCkqci54KTooeS5taW49KHMtaC54KSpyLngseS5tYXg9KGktaC54KSpyLngpO3ZhciBmPXttaW46MCxtYXg6MH07aWYoci55Pj0wPyhmLm1pbj0odi1oLnkpKnIueSxmLm1heD0oZS1oLnkpKnIueSk6KGYubWluPShlLWgueSkqci55LGYubWF4PSh2LWgueSkqci55KSx5Lm1pbj5mLm1heHx8Zi5taW4+eS5tYXgpcmV0dXJuITE7Zi5taW4+eS5taW4mJih5Lm1pbj1mLm1pbiksZi5tYXg8eS5tYXgmJih5Lm1heD1mLm1heCk7dmFyIHc9e21pbjowLG1heDowfTtyZXR1cm4gci56Pj0wPyh3Lm1pbj0oby1oLnopKnIueix3Lm1heD0oYS1oLnopKnIueik6KHcubWluPShhLWgueikqci56LHcubWF4PShvLWgueikqci56KSwhKHkubWluPncubWF4fHx3Lm1pbj55Lm1heHx8KHcubWluPnkubWluJiYoeS5taW49dy5taW4pLHcubWF4PHkubWF4JiYoeS5tYXg9dy5tYXgpLHkubWF4PDApKX12YXIgdnI9ZnVuY3Rpb24oKXtmdW5jdGlvbiBoKHIsaSx2KXt0aGlzLng9cix0aGlzLnk9aSx0aGlzLno9dn1yZXR1cm4gaC5wcm90b3R5cGUuY29weT1mdW5jdGlvbihyKXtyZXR1cm4gdGhpcy54PXIueCx0aGlzLnk9ci55LHRoaXMuej1yLnosdGhpc30saC5wcm90b3R5cGUuc2V0PWZ1bmN0aW9uKHIsaSx2KXtyZXR1cm4gdGhpcy54PXIsdGhpcy55PWksdGhpcy56PXYsdGhpc30saC5wcm90b3R5cGUuZnJvbUFycmF5PWZ1bmN0aW9uKHIsaSl7cmV0dXJuIGk9PT12b2lkIDAmJihpPTApLHRoaXMueD1yW2ldLHRoaXMueT1yW2krMV0sdGhpcy56PXJbaSsyXSx0aGlzfSxoLnByb3RvdHlwZS50b0Fyc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lVHJlZShlLm1heEl0ZW1QZXJOb2RlLGUubWF4VHJlZURlcHRoLGUuZXh0ZW50cyk7dmFyIG49e29mZnNldEFycmF5OmEub2Zmc2V0QXJyYXksaW5kaWNlc0FycmF5OmEuaW5kaWNlc0FycmF5LHBvc2l0aW9uQXJyYXk6YS5wb3NpdGlvbkFycmF5LHJvb3ROb2RlUGFja2VkOmEucm9vdE5vZGVQYWNrZWR9O2kucHVzaChuKTtmb3IodmFyIHkgaW4gbil7dmFyIGY9blt5XTtmJiYoZiBpbnN0YW5jZW9mIEFycmF5QnVmZmVyP3YucHVzaChmKTpmLmJ1ZmZlciBpbnN0YW5jZW9mIEFycmF5QnVmZmVyJiZ2LnB1c2goZi5idWZmZXIpKX19cmV0dXJue291dHB1dDppLHRyYW5zZmVyOnZ9fSl9KX0pKCk7Cg==",Lo=typeof window!="undefined"&&window.Blob&&new Blob([atob(pu)],{type:"text/javascript;charset=utf-8"});function Pc(n){let t;try{if(t=Lo&&(window.URL||window.webkitURL).createObjectURL(Lo),!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,"+pu,{name:n==null?void 0:n.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var vu=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,a=r.reject;if(e.data&&"$$error"in e.data?a(e.data.$$error):i(e.data),this.queue.length){var o=this.queue.shift(),s=o.resolve,u=o.reject,c=o.input,l=o.transfer;this.workersResolver[t]={resolve:s,reject:u},this.workers[t].postMessage(c,l)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(i,a){var o=r.getIdleWorker();o!==-1?(r.initWorker(o),r.workerStatus|=1<<o,r.workersResolver[o]={resolve:i,reject:a},r.workers[o].postMessage(t,e)):r.queue.push({resolve:i,reject:a,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}(),Bc=new vu(function(){return new Pc},4),ri=new Map,Di=new Map,cn=new d.Ray,Oo=new d.Matrix3,Rn=new d.Matrix4,Au=new d.Vector3,Rc=new d.Vector3,Fc=new d.Vector3,kc=new d.Triangle;function Lc(n,t,e,r){var i,a=n.matrixWorld;Rn.getInverse(a),cn.copy(e.ray).applyMatrix4(Rn);for(var o=t.intersectRay(cn.origin,cn.direction,[]),s=n.geometry,u=n.material,c=s.groups,l=s.index,h=0,p=o.length;h<p;h++){var v=o[h],m=v.triangle,A=v.index,y=v.intersectionPoint,f=new d.Vector3(y[0],y[1],y[2]).applyMatrix4(a),g=e.ray.origin.distanceTo(f);if(!(g<e.near||g>e.far)){var b=void 0;if(Array.isArray(u)){if(c)for(var x=A*3,w=0,E=c;w<E.length;w++){var M=E[w];if(x>=M.start&&x-M.start<M.count){b=u[(i=M.materialIndex)!==null&&i!==void 0?i:0];break}}}else b=u;if(b){var C=kc.set(Au.set(m[0],m[1],m[2]).applyMatrix4(a),Rc.set(m[3],m[4],m[5]).applyMatrix4(a),Fc.set(m[6],m[7],m[8]).applyMatrix4(a)).getNormal(new d.Vector3),S=A*3,P=new d.Face3(l?l.array[S]:S,l?l.array[S+1]:S+1,l?l.array[S+2]:S+2,C),I=e.ray.direction.dot(C);b.side===d.FrontSide&&I>=0||b.side===d.BackSide&&I<=0||r.push({distance:g,object:n,face:P,point:f,distanceToRay:0,faceIndex:A})}}}}function Oc(n,t,e,r){var i,a,o=n.matrixWorld;Oo.getNormalMatrix(o),Rn.getInverse(o);var s=((a=(i=e.params.Points)===null||i===void 0?void 0:i.threshold)!==null&&a!==void 0?a:1)*Rn.getMaxScaleOnAxis();cn.copy(e.ray).applyMatrix4(Rn);for(var u=t.intersectRay(cn.origin,cn.direction,s,[]),c=n.geometry,l=c.index,h=c.getAttribute("normal"),p=0,v=u.length;p<v;p++){var m=u[p],A=m.triangle,y=m.index,f=m.intersectionPoint,g=new d.Vector3(f[0],f[1],f[2]).applyMatrix4(o),b=e.ray.origin.distanceTo(g);if(!(b<e.near||b>e.far)){var x=Au.set(A[0],A[1],A[2]).applyMatrix4(o),w=l?l.array[y]:y,E=void 0;h instanceof d.BufferAttribute&&(E=new d.Vector3().fromBufferAttribute(h,w).applyNormalMatrix(Oo));var M=new d.Face3(w,w,w,E);r.push({distance:b,object:n,face:M,point:g,distanceToRay:g.distanceTo(x),index:y})}}}function Vo(n,t){var e=n.raycast,r=function(i,a){var o=ri.get(this);o?Lc(this,o,i,a):e.call(this,i,a)};return n.raycast=r,ri.set(n,t),function(){ri.delete(n),n.raycast===r&&(n.raycast=e)}}function No(n,t){var e=n.raycast,r=function(i,a){var o=Di.get(this);o?Oc(this,o,i,a):e.call(this,i,a)};return n.raycast=r,Di.set(n,t),function(){Di.delete(n),n.raycast===r&&(n.raycast=e)}}function Vc(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(a){if((a instanceof d.Mesh||a instanceof d.Points)&&a.geometry instanceof d.BufferGeometry){var o=a.geometry.getAttribute("position");o instanceof d.BufferAttribute&&i.push(a)}}),t?Promise.resolve().then(function(){for(var a,o,s=[],u=[],c=0;c<i.length;c++){var l=i[c];if(l instanceof d.Mesh){if(l.geometry instanceof d.BufferGeometry){var h=l.geometry.getAttribute("position");if(h instanceof d.BufferAttribute){var p=h.array,v=(a=l.geometry.getIndex())===null||a===void 0?void 0:a.array,m=l.geometry.boundingBox,A=m?[m.min.x,m.min.y,m.min.z,m.max.x,m.max.y,m.max.z]:void 0,y={type:"mesh",positionArray:p,indicesArray:v,maxItemPerNode:e,maxTreeDepth:r,extents:A};s.push(y);for(var f in y){var g=y[f];g&&(g instanceof ArrayBuffer?u.push(g):g.buffer instanceof ArrayBuffer&&u.push(g.buffer))}}}}else if(l instanceof d.Points&&l.geometry instanceof d.BufferGeometry){var h=l.geometry.getAttribute("position");if(h instanceof d.BufferAttribute){var p=h.array,v=(o=l.geometry.getIndex())===null||o===void 0?void 0:o.array,m=l.geometry.boundingBox,A=m?[m.min.x,m.min.y,m.min.z,m.max.x,m.max.y,m.max.z]:void 0,y={type:"points",positionArray:p,indicesArray:v,maxItemPerNode:e,maxTreeDepth:r,extents:A};s.push(y);for(var b in y){var g=y[b];g&&(g instanceof ArrayBuffer?u.push(g):g.buffer instanceof ArrayBuffer&&u.push(g.buffer))}}}}return Bc.postMessage(s,u)}).then(function(a){for(var o=[],s=0;s<i.length;s++){var u=i[s],c=a[s];if(u instanceof d.Mesh){if(u.geometry instanceof d.BufferGeometry){var l=u.geometry.getAttribute("position");if(l instanceof d.BufferAttribute){l.array=c.positionArray;var h=u.geometry.getIndex();h&&c.indicesArray&&(h.array=c.indicesArray);var p=new Bo(c.positionArray,c.indicesArray);p.offsetArray=c.offsetArray,p.rootNodePacked=c.rootNodePacked;var v=Vo(u,p);o.push(v)}}}else if(u instanceof d.Points&&u.geometry instanceof d.BufferGeometry){var l=u.geometry.getAttribute("position");if(l instanceof d.BufferAttribute){l.array=c.positionArray;var h=u.geometry.getIndex();h&&c.indicesArray&&(h.array=c.indicesArray);var p=new ko(c.positionArray,c.indicesArray);p.offsetArray=c.offsetArray,p.rootNodePacked=c.rootNodePacked;var v=No(u,p);o.push(v)}}}return function(){for(var m=0,A=o;m<A.length;m++){var y=A[m];y()}o.length=0}}):Promise.resolve().then(function(){for(var a,o,s=[],u=0,c=i;u<c.length;u++){var l=c[u];if(l instanceof d.Mesh){if(l.geometry instanceof d.BufferGeometry){var h=l.geometry.getAttribute("position");if(h instanceof d.BufferAttribute){var p=h.array,v=(a=l.geometry.getIndex())===null||a===void 0?void 0:a.array,m=l.geometry.boundingBox,A=m?[m.min.x,m.min.y,m.min.z,m.max.x,m.max.y,m.max.z]:void 0,y=new Bo(p,v);y.createTree(e,r,A);var f=Vo(l,y);s.push(f)}}}else if(l instanceof d.Points&&l.geometry instanceof d.BufferGeometry){var h=l.geometry.getAttribute("position");if(h instanceof d.BufferAttribute){var p=h.array,v=(o=l.geometry.getIndex())===null||o===void 0?void 0:o.array,m=l.geometry.boundingBox,A=m?[m.min.x,m.min.y,m.min.z,m.max.x,m.max.y,m.max.z]:void 0,y=new ko(p,v);y.createTree(e,r,A);var f=No(l,y);s.push(f)}}}return function(){for(var g=0,b=s;g<b.length;g++){var x=b[g];x()}s.length=0}})}var Nc=new d.Vector3,Qc=new d.Vector3,Dc=new d.Vector3,mu=function(n){oe(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 Vc(this,!0,200,10).then(function(r){e.disposers.push(r)})},t.prototype.intersectRaycaster=function(e,r,i){var a=this;r===void 0&&(r=!0),i===void 0&&(i=[]);for(var o=this.children.slice(),s;s=o.pop();)if(s.visible){s.raycast(e,i);for(var u=0,c=s.children.length;u<c;u++)o.push(s.children[u])}return i.forEach(function(l){var h,p,v=0;if((l.object instanceof Gt||l.object instanceof Fr)&&l.face){var m=Array.isArray(l.object.material)?l.object.material[l.face.materialIndex]:l.object.material;if(m)if(m.defines.USE_VERTEX_FLOOR){var A=(h=l.object.geometry.attributes.position)===null||h===void 0?void 0:h.array,y=(p=l.object.geometry.attributes.floor)===null||p===void 0?void 0:p.array;if(A&&y){var f=Nc.set(A[l.face.a*3],A[l.face.a*3+1],A[l.face.a*3+2]).applyMatrix4(a.matrixWorld),g=Qc.set(A[l.face.b*3],A[l.face.b*3+1],A[l.face.b*3+2]).applyMatrix4(a.matrixWorld),b=Dc.set(A[l.face.c*3],A[l.face.c*3+1],A[l.face.c*3+2]).applyMatrix4(a.matrixWorld),x=l.point.distanceTo(f),w=l.point.distanceTo(g),E=l.point.distanceTo(b);v=Math.round((x*y[l.face.a]+w*y[l.face.b]+E*y[l.face.c])/(x+w+E))}}else v=m.floor}l.floor=v}),r&&i.sort(function(l,h){return l.distance-h.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}(d.Group);function xt(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(s){return(s!=null?s:"").trim()}).filter(function(s){return s.length>0&&!/^\/+$/.test(s)});for(var r=0;r<n.length;r++){var i=r===0,a=r===n.length-1,o=n[r];i||(o=o.replace(/^\.\//,"").replace(/^\/+/,"")),a||(o=o.replace(/\/+$/,"")),e.push(o)}return e.join("/")}function Ar(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}function gu(n,t){if(n.content&&n.content.uri&&(Ar(n.content.uri)||(n.content.uri=xt(t,n.content.uri))),n.children)for(var e=0,r=n.children;e<r.length;e++){var i=r[e];gu(i,t)}return n}function Qo(n,t){return n.asset.overview&&(Ar(n.asset.overview.imageFile)||(n.asset.overview.imageFile=xt(t,n.asset.overview.imageFile)),Ar(n.asset.overview.worldFile)||(n.asset.overview.worldFile=xt(t,n.asset.overview.worldFile))),gu(n.root,t),n}function yu(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 Ui=4;function bu(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=Ui,n.version=r.getUint32(e,!0),e+=Ui,n.byteLength=r.getUint32(e,!0),e+=Ui,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var er,je;(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"})(je||(je={}));var Uc=(er={},er[je.DOUBLE]=Float64Array,er[je.FLOAT]=Float32Array,er[je.UNSIGNED_SHORT]=Uint16Array,er[je.UNSIGNED_INT]=Uint32Array,er[je.UNSIGNED_BYTE]=Uint8Array,er[je.BYTE]=Int8Array,er[je.SHORT]=Int16Array,er[je.INT]=Int32Array,er),zc={DOUBLE:je.DOUBLE,FLOAT:je.FLOAT,UNSIGNED_SHORT:je.UNSIGNED_SHORT,UNSIGNED_INT:je.UNSIGNED_INT,UNSIGNED_BYTE:je.UNSIGNED_BYTE,BYTE:je.BYTE,SHORT:je.SHORT,INT:je.INT};function fi(n){var t=Uc[n];if(!t)throw new Error("Failed to convert GL type");return t}function zi(n){var t=fi(n);return t.BYTES_PER_ELEMENT}function Do(n,t,e,r){e===void 0&&(e=0);var i=fi(n);if(e%zi(n)!==0){var a=r?t.slice(e,e+r*zi(n)):t.slice(e);return new i(a)}else return new i(t,e,r!=null?r:(t.byteLength-e)/zi(n))}function Gc(n){var t=zc[n];if(!t)throw new Error("Failed to convert GL type");return t}var wu=function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",je.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 a=fi(e);return new a([i])}else if(Array.isArray(i)){var a=fi(e);return new a(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=Gc(i.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,i.byteOffset)):this.getTypedArrayFromArray(t,e,i)},n.prototype.getProperty=function(t,e,r,i,a){var o=this.json[t];if(!o)return null;var s=this.getPropertyArray(t,e,r);if(r===1)return a[0]=s[i],a;for(var u=0;u<r;++u)a[u]=s[r*i+u];return a},n.prototype.getTypedArrayFromBinary=function(t,e,r,i,a){var o=this.cachedTypedArrays,s=o[t];return s||(s=Do(e,this.buffer.buffer,this.buffer.byteOffset+a,i*r),o[t]=s),s},n.prototype.getTypedArrayFromArray=function(t,e,r){var i=this.cachedTypedArrays,a=i[t];return a||(a=Do(e,r),i[t]=a),a},n}(),en=4,Uo="b3dm tile in legacy format.";function xu(n,t,e){var r=new TextDecoder("utf8"),i=new Uint8Array(n,t,e),a=r.decode(i);return a}function Eu(n,t,e){return e=Hc(n,t,e),e=qc(n,t,e),e=Kc(n,t,e),e}function Hc(n,t,e){var r=new DataView(t),i=0;n.header=n.header||{};var a=r.getUint32(e,!0);e+=en;var o=r.getUint32(e,!0);e+=en;var s=r.getUint32(e,!0);e+=en;var u=r.getUint32(e,!0);return e+=en,s>=570425344?(e-=en*2,i=a,s=o,u=0,a=0,o=0,console.warn(Uo)):u>=570425344&&(e-=en,i=s,s=a,u=o,a=0,o=0,console.warn(Uo)),n.header.featureTableJsonByteLength=a,n.header.featureTableBinaryByteLength=o,n.header.batchTableJsonByteLength=s,n.header.batchTableBinaryByteLength=u,n.header.batchLength=i,e}function qc(n,t,e){var r=n.header||{},i=r.featureTableJsonByteLength,a=r.featureTableBinaryByteLength,o=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:o||0},i&&i>0){var s=xu(t,e,i);n.featureTableJson=JSON.parse(s)}e+=i||0,n.featureTableBinary=new Uint8Array(t,e,a),e+=a||0,n.rtcCenter=[0,0,0];var u=new wu(n.featureTableJson,n.featureTableBinary);if(Array.isArray(u.json.RTC_CENTER)){var c=u.json.RTC_CENTER;n.rtcCenter[0]=c[0],n.rtcCenter[1]=c[1],n.rtcCenter[2]=c[2]}else{var c=u.getGlobalProperty("RTC_CENTER",je.FLOAT,3);c&&(n.rtcCenter[0]=c[0],n.rtcCenter[1]=c[1],n.rtcCenter[2]=c[2])}return e}function Kc(n,t,e){var r=n.header||{},i=r.batchTableJsonByteLength,a=r.batchTableBinaryByteLength;if(i&&i>0){var o=xu(t,e,i);n.batchTableJson=JSON.parse(o),e+=i,a&&a>0&&(n.batchTableBinary=new Uint8Array(t,e,a),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=a)}return e}function jc(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 Wc(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=jc(t,e,r),n.byteLength}function va(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 Re={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},wn={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},hi={9728:d.NearestFilter,9729:d.LinearFilter,9984:d.NearestMipmapNearestFilter,9985:d.LinearMipmapNearestFilter,9986:d.NearestMipmapLinearFilter,9987:d.LinearMipmapLinearFilter},pi={33071:d.ClampToEdgeWrapping,33648:d.MirroredRepeatWrapping,10497:d.RepeatWrapping},zo={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},It={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Mr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Xc={CUBICSPLINE:void 0,LINEAR:d.InterpolateLinear,STEP:d.InterpolateDiscrete},cr={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function At(n){var t=[];for(var e in n)t.push(n[e]);return t}var _c=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,a=e.length;i<a;i++)for(var o=e[i].joints,s=0,u=o.length;s<u;s++)t[o[s]].isBone=!0;for(var c=0,l=t.length;c<l;c++){var h=t[c];h.mesh!==void 0&&h.skin!==void 0&&(r[h.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.dispose(),this.markDefs();for(var i=0,a=At(r);i<a.length;i++){var o=a[i];o.markDefs(this)}return Promise.all(At(r).map(function(s){return s.prepare(t)})).then(function(){var s,u,c;return Promise.all([Promise.all(((s=e.scenes)!==null&&s!==void 0?s:[]).map(function(l,h){return t.loadScene(h)})),Promise.all(((u=e.animations)!==null&&u!==void 0?u:[]).map(function(l,h){return t.loadAnimation(h)})),Promise.all(((c=e.cameras)!==null&&c!==void 0?c:[]).map(function(l,h){return t.loadCamera(h)}))])}).then(function(s){var u=s[0],c=s[1],l=s[2],h={json:t.json,scene:u[e.scene||0],scenes:u,animations:c,cameras:l,dispose:function(){return t.dispose()}};return Promise.all(At(r).map(function(p){return p.emitResult(h,t)})).then(function(){return h})})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,a=0,o=At(this.extensions);a<o.length;a++){var s=o[a];if(i=s.loadCamera(t,this),i)break}if(!i){var u=void 0,c=this.json.cameras[t],l=c[c.type];l?c.type==="perspective"?u=new d.PerspectiveCamera(d.MathUtils.radToDeg(l.yfov),l.aspectRatio||1,l.znear||1,l.zfar||2e6):c.type==="orthographic"?u=new d.OrthographicCamera(-l.xmag,l.xmag,l.ymag,-l.ymag,l.znear,l.zfar):(console.warn("glTF: Invalid camera type ".concat(c.type,".")),u=new d.Camera):(console.warn("glTF: Missing camera parameters."),u=new d.Camera),c.name&&(u.name=this.createUniqueName(c.name)),i=Promise.resolve(u)}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,a=this.json.skins[t],o={joints:a.joints};return a.inverseBindMatrices===void 0?i=Promise.resolve(o):i=this.loadAccessor(a.inverseBindMatrices).then(function(s){return s&&(o.inverseBindMatrices=s),o}),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,a=0,o=At(this.extensions);a<o.length;a++){var s=o[a];if(i=s.loadAnimation(t,this),i)break}if(!i){for(var u=this.json,c=u.animations[t],l=[],h=[],p=[],v=[],m=[],A=0,y=c.channels.length;A<y;A++){var f=c.channels[A],g=c.samplers[f.sampler],b=f.target,x=b.node!==void 0?b.node:b.id,w=c.parameters!==void 0?c.parameters[g.input]:g.input,E=c.parameters!==void 0?c.parameters[g.output]:g.output;l.push(this.loadNode(x)),h.push(this.loadAccessor(w)),p.push(this.loadAccessor(E)),v.push(g),m.push(b)}i=Promise.all([Promise.all(l),Promise.all(h),Promise.all(p),Promise.all(v),Promise.all(m)]).then(function(M){for(var C=M[0],S=M[1],P=M[2],I=M[3],B=M[4],L=[],k=function(H,z){var U=C[H],q=S[H],j=P[H],_=I[H],Z=B[H];if(U===void 0)return"continue";U.updateMatrix(),U.matrixAutoUpdate=!0;var W=void 0;switch(Mr[Z.path]){case Mr.weights:W=d.NumberKeyframeTrack;break;case Mr.rotation:W=d.QuaternionKeyframeTrack;break;case Mr.position:case Mr.scale:default:W=d.VectorKeyframeTrack;break}var Y=U.name?U.name:U.uuid,ce=_.interpolation!==void 0?Xc[_.interpolation]:d.InterpolateLinear,te=[];Mr[Z.path]===Mr.weights?U.traverse(function(fe){fe.morphTargetInfluences&&te.push(fe.name?fe.name:fe.uuid)}):te.push(Y);var se=j.array;if(j.normalized){for(var ue=Gi(se.constructor),pe=new Float32Array(se.length),he=0,de=se.length;he<de;he++)pe[he]=se[he]*ue;se=pe}for(var he=0,de=te.length;he<de;he++){var be=new W(te[he]+"."+Mr[Z.path],q.array,se,ce);L.push(be)}},O=0,N=C.length;O<N;O++)k(O);var D=c.name?c.name:"animation_"+t;return new d.AnimationClip(D,void 0,L)})}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 a=null,o=0,s=At(this.extensions);o<s.length;o++){var u=s[o];if(a=u.loadBuffer(t,this),a)break}if(!a){var c=this.json.buffers[t];a=this.options.fetcher.ajax(this.resolveResouce(c.uri),{responseType:"arraybuffer"}).then(function(l){return l.body})}return this.cache.set(r,a),a},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,a=0,o=At(this.extensions);a<o.length;a++){var s=o[a];if(i=s.loadBufferView(t,this),i)break}if(!i){var u=this.json.bufferViews[t];i=this.loadBuffer(u.buffer).then(function(c){var l=u.byteLength||0,h=u.byteOffset||0;return c.slice(h,h+l)})}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 a=null;if(!a){var o=this.json.accessors[t];if(o.bufferView===void 0&&o.sparse===void 0)a=Promise.resolve(null);else{var s=[];o.bufferView!==void 0?s.push(this.loadBufferView(o.bufferView)):s.push(Promise.resolve(null)),o.sparse!==void 0&&(s.push(this.loadBufferView(o.sparse.indices.bufferView)),s.push(this.loadBufferView(o.sparse.values.bufferView))),a=Promise.all(s).then(function(u){var c=u[0],l=zo[o.type],h=wn[o.componentType],p=h.BYTES_PER_ELEMENT,v=p*l,m=o.byteOffset||0,A=o.bufferView!==void 0?e.json.bufferViews[o.bufferView].byteStride:void 0,y=o.normalized===!0,f,g;if(A&&A!==v){var b=Math.floor(m/A),x="InterleavedBuffer:"+o.bufferView+":"+o.componentType+":"+b+":"+o.count,w=e.cache.get(x);w||(f=new h(c,b*A,o.count*A/p),w=new d.InterleavedBuffer(f,A/p),e.cache.set(x,w)),g=new d.InterleavedBufferAttribute(w,l,m%A/p,y)}else c===null?f=new h(o.count*l):f=new h(c,m,o.count*l),g=new d.BufferAttribute(f,l,y);if(o.sparse!==void 0){var E=zo.SCALAR,M=wn[o.sparse.indices.componentType],C=o.sparse.indices.byteOffset||0,S=o.sparse.values.byteOffset||0,P=new M(u[1],C,o.sparse.count*E),I=new h(u[2],S,o.sparse.count*l);c!==null&&(g=new d.BufferAttribute(g.array.slice(),g.itemSize,g.normalized));for(var B=0,L=P.length;B<L;B++){var k=P[B];if(g.setX(k,I[B*l]),l>=2&&g.setY(k,I[B*l+1]),l>=3&&g.setZ(k,I[B*l+2]),l>=4&&g.setW(k,I[B*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}}return this.cache.set(r,a),a},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=At(this.extensions);e<r.length;e++){var i=r[e],a=i.createPrimitiveKey(t,this);if(a)return a}for(var o="",s=Object.keys(t.attributes).sort(),u=0,c=s.length;u<c;u++)o+=s[u]+":"+t.attributes[s[u]]+";";return t.indices+":"+o+":"+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 a=null,o=0,s=At(this.extensions);o<s.length;o++){var u=s[o];if(a=u.loadGeometry(t,this),a)break}return a||(a=this.addGeometryPrimitiveAttributes(new d.BufferGeometry,t)),a=a.then(function(c){return e.disposeSet.add(c),c}),this.cache.set(r,a),a},n.prototype.loadImage=function(t){var e="image:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,a=0,o=At(this.extensions);a<o.length;a++){var s=o[a];if(i=s.loadImage(t,this),i)break}if(!i){var u=this.json.images[t];if(u.bufferView)i=this.loadBufferView(u.bufferView).then(function(l){var h=new Blob([l],{type:u.mimeType});return da(h)});else if(u.uri){var c=this.resolveResouce(u.uri);i=this.options.fetcher.loadImage(c,{},void 0,void 0,void 0,ci()).then(function(l){return l.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 d.MeshStandardMaterial;if(i.color=new d.Color(1,1,1),i.opacity=1,Object.keys(t.attributes).filter(function(l){return It[l]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(l){return It[l]==="normal"}).length===0&&(i.flatShading=!0),Object.keys(t.attributes).filter(function(l){return It[l]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var a=this.json.materials[t.material];a.name&&(i.name=a.name);var o=a.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;i.color.fromArray(s),i.opacity=s[3]}o.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(o.baseColorTexture).then(function(l){l.encoding=d.sRGBEncoding,i.map=l,e.disposeSet.add(l)})),i.metalness=o.metallicFactor!==void 0?o.metallicFactor:1,i.roughness=o.roughnessFactor!==void 0?o.roughnessFactor:1,o.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(o.metallicRoughnessTexture).then(function(l){l.encoding=d.sRGBEncoding,i.metalnessMap=l,i.roughnessMap=l,e.disposeSet.add(l)})),a.doubleSided===!0&&(i.side=d.DoubleSide);var u=a.alphaMode||cr.OPAQUE;if(u===cr.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,u===cr.MASK&&(i.alphaTest=a.alphaCutoff!==void 0?a.alphaCutoff:.5)),a.normalTexture!==void 0&&(r.push(this.createMaterialTexture(a.normalTexture).then(function(l){i.normalMap=l,e.disposeSet.add(l)})),i.normalScale=new d.Vector2(1,1),a.normalTexture.scale!==void 0)){var c=a.normalTexture.scale;i.normalScale.set(c,c)}a.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(a.occlusionTexture).then(function(l){i.aoMap=l,e.disposeSet.add(l)})),a.occlusionTexture.strength!==void 0&&(i.aoMapIntensity=a.occlusionTexture.strength)),a.emissiveFactor!==void 0&&(i.emissive=new d.Color().fromArray(a.emissiveFactor)),a.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(a.emissiveTexture).then(function(l){i.emissiveMap=l,e.disposeSet.add(l)}))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new d.LineBasicMaterial;if(r.color=new d.Color(1,1,1),r.opacity=1,Object.keys(t.attributes).filter(function(u){return It[u]==="color"}).length>0&&(r.vertexColors=!0),Object.keys(t.attributes).filter(function(u){return It[u]==="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 a=i.pbrMetallicRoughness||{};if(Array.isArray(a.baseColorFactor)){var o=a.baseColorFactor;r.color.fromArray(o),r.opacity=o[3]}i.doubleSided===!0&&(r.side=d.DoubleSide);var s=i.alphaMode||cr.OPAQUE;s===cr.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,s===cr.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 d.PointsMaterial;if(i.color=new d.Color(1,1,1),i.opacity=1,i.sizeAttenuation=!1,Object.keys(t.attributes).filter(function(c){return It[c]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(c){return It[c]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var a=this.json.materials[t.material];a.name&&(i.name=a.name);var o=a.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;i.color.fromArray(s),i.opacity=s[3]}o.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(o.baseColorTexture).then(function(c){c.encoding=d.sRGBEncoding,i.map=c,e.disposeSet.add(c)})),a.doubleSided===!0&&(i.side=d.DoubleSide);var u=a.alphaMode||cr.OPAQUE;u===cr.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,u===cr.MASK&&(i.alphaTest=a.alphaCutoff!==void 0?a.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:Re.TRIANGLES,a="material:"+this.createPrimitiveKey(t),o=this.cache.get(a);if(o)return o;for(var s=null,u=0,c=At(this.extensions);u<c.length;u++){var l=c[u];if(s=l.loadMaterial(t,this),s)break}if(i===Re.TRIANGLES||i===Re.TRIANGLE_STRIP||i===Re.TRIANGLE_FAN)s=this.loadMaterialAsMeshStandardMaterial(t);else if(i===Re.LINES||i===Re.LINE_STRIP||i===Re.LINE_LOOP)s=this.loadMaterialAsLineBasicMaterial(t);else if(i===Re.POINTS)s=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+i);return s=s.then(function(h){return e.disposeSet.add(h),h}),this.cache.set(a,s),s},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,i=this.cache.get(r);if(i)return i;for(var a=null,o=0,s=At(this.extensions);o<s.length;o++){var u=s[o];if(a=u.loadTexture(t,this),a)break}if(!a){var c=this.json.textures[t];a=this.loadImage(c.source).then(function(l){var h=new d.Texture(l);h.needsUpdate=!0,h.flipY=!1,c.name&&(h.name=c.name);var p=e.json.samplers||{},v=p[c.sampler]||{};h.magFilter=hi[v.magFilter]||d.LinearFilter,h.minFilter=hi[v.minFilter]||d.LinearMipmapLinearFilter,h.wrapS=pi[v.wrapS]||d.RepeatWrapping,h.wrapT=pi[v.wrapT]||d.RepeatWrapping;var m=h.dispose;return h.dispose=function(){return h.dispose=m,l.close(),m.call(this)},h})}return a=a.then(function(l){return e.disposeSet.add(l),l}),this.cache.set(r,a),a},n.prototype.loadMesh=function(t){for(var e=this,r=null,i=0,a=At(this.extensions);i<a.length;i++){var o=a[i];if(r=o.loadMesh(t,this),r)break}if(!r){var s=this.json.meshes[t],u=s.primitives,c=Promise.all(u.map(function(h){return e.loadGeometry(h)})),l=Promise.all(u.map(function(h){return e.loadMaterial(h)}));r=Promise.all([c,l]).then(function(h){for(var p=h[0],v=h[1],m=[],A=0;A<u.length;A++){var y=u[A],f=p[A],g=v[A],b=y.mode||Re.TRIANGLES,x=void 0;if(b===Re.TRIANGLES||b===Re.TRIANGLE_STRIP||b===Re.TRIANGLE_FAN)if(b===Re.TRIANGLE_STRIP?f=e.toGeometryTrianglesDrawMode(f,d.TriangleStripDrawMode):b===Re.TRIANGLE_FAN&&(f=e.toGeometryTrianglesDrawMode(f,d.TriangleFanDrawMode)),s.isSkinnedMesh){var w=new d.SkinnedMesh(f,g);f.attributes.skinWeight.normalized||w.normalizeSkinWeights(),x=w}else x=new d.Mesh(f,g);else if(b===Re.POINTS)x=new d.Points(f,g);else if(b===Re.LINES)x=new d.LineSegments(f,g);else if(b===Re.LINE_STRIP)x=new d.Line(f,g);else if(b===Re.LINE_LOOP)x=new d.LineLoop(f,g);else throw new Error("glTF: Primitive mode unsupported: "+b);if(Object.keys(f.morphAttributes).length>0){if(s.weights!==void 0)for(var E=0,M=s.weights.length;E<M;E++)x.morphTargetInfluences[E]=s.weights[E];if(s.extras&&Array.isArray(s.extras.targetNames)){var C=s.extras.targetNames;if(x.morphTargetInfluences.length===C.length){x.morphTargetDictionary={};for(var E=0,M=C.length;E<M;E++)x.morphTargetDictionary[C[E]]=E}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}x.name=e.createUniqueName(s.name||"mesh_"+t),m.push(x)}if(m.length===1)return m[0];for(var S=new d.Group,P=0,I=m;P<I.length;P++){var x=I[P];S.add(x)}return S})}return r},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,i=At(this.extensions);r<i.length;r++){var a=i[r],o=a.loadNodeAttachments(t,this);o&&e.push(o)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var i=this.json,a=i.nodes[t],o=a.name?this.createUniqueName(a.name):"",s=[];a.mesh!==void 0&&s.push(this.loadMesh(a.mesh).then(function(p){if(a.weights!==void 0){var v=a.weights;p.traverse(function(m){if(m instanceof d.Mesh||m instanceof d.Line||m instanceof d.Points)for(var A=0,y=v.length;A<y;A++)m.morphTargetInfluences[A]=v[A]})}return p})),a.camera!==void 0&&s.push(this.loadCamera(a.camera));for(var u=this.loadNodeAttachments(t),c=0,l=u;c<l.length;c++){var h=l[c];s.push(h)}return Promise.all(s).then(function(p){var v;if(a.isBone===!0?v=new d.Bone:p.length>1?v=new d.Group:p.length===1?v=p[0]:v=new d.Object3D,v!==p[0])for(var m=0,A=p.length;m<A;m++)v.add(p[m]);if(a.name&&(v.name=o),a.matrix!==void 0){var y=new d.Matrix4;y.fromArray(a.matrix),v.applyMatrix4(y)}else a.translation!==void 0&&v.position.fromArray(a.translation),a.rotation!==void 0&&v.quaternion.fromArray(a.rotation),a.scale!==void 0&&v.scale.fromArray(a.scale);return v})},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],i=new d.Group;r.name&&(i.name=this.createUniqueName(r.name));for(var a=r.nodes||[],o=[],s=0,u=a.length;s<u;s++)o.push(this.buildNodeHierarchy(a[s],i));return Promise.all(o).then(function(){return i})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var i=0,a=At(e.extensions);i<a.length;i++){var o=a[i],s=o.extendTexture(r,t,e);s&&(r=s)}return r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,i=e.attributes,a=[],o=function(w){var E=It[w]||w.toLowerCase();if(E in t.attributes)return"continue";a.push(s.loadAccessor(i[w]).then(function(M){M&&t.setAttribute(E,M)}))},s=this;for(var u in i)o(u);e.indices!==void 0&&!t.index&&a.push(this.loadAccessor(e.indices).then(function(w){w&&t.setIndex(w)}));var c=new d.Box3;if(i.POSITION!==void 0){var l=this.json.accessors[i.POSITION],h=l.min,p=l.max;if(h!==void 0&&p!==void 0){if(c.set(new d.Vector3(h[0],h[1],h[2]),new d.Vector3(p[0],p[1],p[2])),l.normalized){var v=Gi(wn[l.componentType]);c.min.multiplyScalar(v),c.max.multiplyScalar(v)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var m=e.targets;if(m!==void 0){for(var A=new d.Vector3,y=new d.Vector3,f=0,g=m.length;f<g;f++){var b=m[f];if(b.POSITION!==void 0){var l=this.json.accessors[b.POSITION],h=l.min,p=l.max;if(h!==void 0&&p!==void 0){if(y.setX(Math.max(Math.abs(h[0]),Math.abs(p[0]))),y.setY(Math.max(Math.abs(h[1]),Math.abs(p[1]))),y.setZ(Math.max(Math.abs(h[2]),Math.abs(p[2]))),l.normalized){var v=Gi(wn[l.componentType]);y.multiplyScalar(v)}A.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}c.expandByVector(A)}t.boundingBox=c;var x=new d.Sphere;return c.getCenter(x.center),x.radius=c.min.distanceTo(c.max)/2,t.boundingSphere=x,Promise.all(a).then(function(){if(t.attributes.uv&&!t.attributes.uv2&&r.options.copyUV2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var w=!1,E=!1,M=0,C=e.targets.length;M<C;M++){var S=e.targets[M];if(S.POSITION!==void 0&&(w=!0),S.NORMAL!==void 0&&(E=!0),w&&E)break}if(!w&&!E)return t;var P=[];t.morphTargetsRelative=!0;for(var I=function(B,L){var k=e.targets[B];w?P.push(r.loadAccessor(k.POSITION).then(function(O){O&&(t.morphAttributes.position[B]=O)})):t.morphAttributes.position[B]=t.attributes.position,E?P.push(r.loadAccessor(k.NORMAL).then(function(O){O&&(t.morphAttributes.normal[B]=O)})):t.morphAttributes.normal[B]=t.attributes.normal},M=0,C=e.targets.length;M<C;M++)I(M,C);return Promise.all(P).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(a){if(i.skin===void 0)return a;var o;return r.loadSkin(i.skin).then(function(s){o=s;for(var u=[],c=0,l=o.joints.length;c<l;c++)u.push(r.loadNode(o.joints[c]));return Promise.all(u)}).then(function(s){return a.traverse(function(u){if(u instanceof d.SkinnedMesh){for(var c=[],l=[],h=0,p=s.length;h<p;h++){var v=s[h];if(v instanceof d.Bone){c.push(v);var m=new d.Matrix4;o.inverseBindMatrices!==void 0&&m.fromArray(o.inverseBindMatrices.array,h*16),l.push(m)}else console.warn('glTF: Joint "%s" could not be found.',o.joints[h])}u.bind(new d.Skeleton(c,l),u.matrixWorld)}}),a})}).then(function(a){e.add(a);var o=[];if(i.children)for(var s=i.children,u=0,c=s.length;u<c;u++){var l=s[u];o.push(r.buildNodeHierarchy(l,a))}return Promise.all(o).then(function(){return a})})},n.prototype.createUniqueName=function(t){for(var e=d.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 xt(this.options.resourcePath,yu(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var i=[],a=t.getAttribute("position");if(a!==void 0){for(var o=0;o<a.count;o++)i.push(o);t.setIndex(i),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var s=r.count-2,u=[];if(e===d.TriangleFanDrawMode)for(var o=1;o<=s;o++)u.push(r.getX(0)),u.push(r.getX(o)),u.push(r.getX(o+1));else for(var o=0;o<s;o++)o%2===0?(u.push(r.getX(o)),u.push(r.getX(o+1)),u.push(r.getX(o+2))):(u.push(r.getX(o+2)),u.push(r.getX(o+1)),u.push(r.getX(o)));u.length/3!==s&&console.error("glTF: Unable to generate correct amount of triangles.");var c=t.clone();return c.setIndex(u),c},n}();function Gi(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 mr=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}(),Zc=function(n){oe(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 va(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),a=0,o=null,s=null;a<i.byteLength;){var u=i.getUint32(a,!0);a+=4;var c=i.getUint32(a,!0);if(a+=4,c===t.CHUNK_TYPES.JSON){var l=new Uint8Array(e,t.HEADER_LENGTH+a,u);o=va(l)}else if(c===t.CHUNK_TYPES.BIN){var h=t.HEADER_LENGTH+a;s=e.slice(h,h+u)}a+=u}if(o===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=o,this.body=s},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}(mr),Yc="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",Go={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},Ho={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Jc=function(){function n(){this.decoderPath=Yc,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 a={attributeIDs:r||Go,attributeTypes:i||Ho,useUniqueIDs:!!r};this.decodeGeometry(t,a).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:Go,attributeTypes:Ho,useUniqueIDs:!1});for(var i in e.attributeTypes){var a=e.attributeTypes[i];a.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[i]=a.name)}var o,s=this.workerNextTaskID++,u=t.byteLength,c=this._getWorker(s,u).then(function(l){return o=l,new Promise(function(h,p){o._callbacks[s]={resolve:h,reject:p},o.postMessage({type:"decode",id:s,taskConfig:e,buffer:t},[t])})}).then(function(l){return r._createGeometry(l.geometry)});return c.catch(function(){return!0}).then(function(){o&&s&&r._releaseTask(o,s)}),c},n.prototype._createGeometry=function(t){var e=new d.BufferGeometry;t.index&&e.setIndex(new d.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var i=t.attributes[r],a=i.name,o=i.array,s=i.itemSize;e.setAttribute(a,new d.BufferAttribute(o,s))}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=un(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(a){return a.body});this.decoderPending=r.then(function(a){var o=["/* draco decoder */",a,"","/* worker */",qo].join(`
418
418
  `);t.workerSourceURL=URL.createObjectURL(new Blob([o]))})}else{var r=un(this.decoderPath+"draco_wasm_wrapper.js",{responseType:"text"}).then(function(o){return o.body}),i=un(this.decoderPath+"draco_decoder.wasm",{responseType:"arraybuffer"}).then(function(o){return o.body});this.decoderPending=Promise.all([r,i]).then(function(o){var s=o[0],u=o[1];t.decoderConfig.wasmBinary=u;var c=["/* draco decoder */",s,"","/* worker */",qo].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(o){var s=o.data;switch(s.type){case"decode":i._callbacks[s.id].resolve(s);break;case"error":i._callbacks[s.id].reject(s);break;default:console.error('DRACO: Unexpected message, "'+s.type+'"')}},r.workerPool.push(i)}else r.workerPool.sort(function(o,s){return o._taskLoad>s._taskLoad?-1:1});var a=r.workerPool[r.workerPool.length-1];return a._taskCosts[t]=e,a._taskLoad+=e,a})},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}(),vi=new Jc,qo=`
420
420
  let decoderConfig;
@@ -2017,7 +2017,7 @@ void main() {
2017
2017
  #include <premultiplied_alpha_fragment>
2018
2018
 
2019
2019
  }
2020
- `},to=function(n){oe(t,n);function t(e){var r=n.call(this,{uniforms:d.UniformsUtils.clone(ia.uniforms),vertexShader:ia.vertexShader,fragmentShader:ia.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}(d.ShaderMaterial);Object.assign(to.prototype,{isLineMaterial:!0});var a0=function(n){oe(t,n);function t(e,r){var i=n.call(this)||this;return i.type="LineSegments2",i.geometry=e!==void 0?e:new eo,i.material=r!==void 0?r:new to({color:Math.random()*16777215}),i}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,i=e.attributes.instanceEnd,a=new Float32Array(2*r.count),o=new d.Vector3,s=new d.Vector3,u=0,c=0,l=r.count;u<l;u++,c+=2)o.fromBufferAttribute(r,u),s.fromBufferAttribute(i,u),a[c]=c===0?0:a[c-1],a[c+1]=a[c]+o.distanceTo(s);var h=new d.InstancedInterleavedBuffer(a,2,1);return e.setAttribute("instanceDistanceStart",new d.InterleavedBufferAttribute(h,1,0)),e.setAttribute("instanceDistanceEnd",new d.InterleavedBufferAttribute(h,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,a=e.camera,o=a.projectionMatrix,s=this.geometry,u=this.material,c=u.resolution,l=u.linewidth,h=s.attributes.instanceStart,p=s.attributes.instanceEnd,v=new d.Vector4,m=new d.Vector4,A=new d.Vector4,y=new d.Vector3,f=new d.Matrix4,g=new d.Line3,b=new d.Vector3;i.at(1,A),A.w=1,A.applyMatrix4(a.matrixWorldInverse),A.applyMatrix4(o),A.multiplyScalar(1/A.w),A.x*=c.x/2,A.y*=c.y/2,A.z=0,y.copy(A);var x=this.matrixWorld;f.multiplyMatrices(a.matrixWorldInverse,x);for(var w=0,E=h.count;w<E;w++){v.fromBufferAttribute(h,w),m.fromBufferAttribute(p,w),v.w=1,m.w=1,v.applyMatrix4(f),m.applyMatrix4(f),v.applyMatrix4(o),m.applyMatrix4(o),v.multiplyScalar(1/v.w),m.multiplyScalar(1/m.w);var M=v.z<-1&&m.z<-1,C=v.z>1&&m.z>1;if(!(M||C)){v.x*=c.x/2,v.y*=c.y/2,m.x*=c.x/2,m.y*=c.y/2,g.start.copy(v),g.start.z=0,g.end.copy(m),g.end.z=0;var S=g.closestPointToPointParameter(y,!0);g.at(S,b);var P=d.MathUtils.lerp(v.z,m.z,S),I=P>=-1&&P<=1,B=y.distanceTo(b)<l*.5;if(I&&B){g.start.fromBufferAttribute(h,w),g.end.fromBufferAttribute(p,w),g.start.applyMatrix4(x),g.end.applyMatrix4(x);var L=new d.Vector3,k=new d.Vector3;i.distanceSqToSegment(g.start,g.end,k,L),r.push({point:k,pointOnLine:L,distance:i.origin.distanceTo(k),object:this,faceIndex:w})}}}},t}(d.Mesh);Object.assign(a0.prototype,{isLineSegments2:!0});var o0=function(n){oe(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.type="Line2",i}return t}(a0);Object.assign(o0.prototype,{isLine2:!0});var s0=function(n){oe(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),a=0;a<r;a+=3)i[2*a]=e[a],i[2*a+1]=e[a+1],i[2*a+2]=e[a+2],i[2*a+3]=e[a+3],i[2*a+4]=e[a+4],i[2*a+5]=e[a+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),a=0;a<r;a+=3)i[2*a]=e[a],i[2*a+1]=e[a+1],i[2*a+2]=e[a+2],i[2*a+3]=e[a+3],i[2*a+4]=e[a+4],i[2*a+5]=e[a+5];return n.prototype.setColors.call(this,i),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof d.Geometry){var i=new d.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof d.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(eo);Object.assign(s0.prototype,{isLineGeometry:!0});var ap="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2c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He3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",Ps=14467195,op=8,sp=2,up=20,Bs=null,Ca=function(n){oe(t,n);function t(e,r){e===void 0&&(e=new d.Vector3),r===void 0&&(r=new d.Vector3);var i=n.call(this)||this;i.type="FiveLine",i.needsRender=!0;var a=new s0,o=new to({color:Ps,linewidth:sp,dashScale:up,dashed:!1});i.line=new o0(a,o);var s=new d.BufferGeometry,u=new d.PointsMaterial({color:Ps,size:op,map:Bs||(Bs=new d.TextureLoader().load(ap)),sizeAttenuation:!1,transparent:!0});return i.points=new d.Points(s,u),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 d.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 d.Vector3(e[0],e[1],e[2]),new d.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 a=e[i];i==="dashed"?(r.dashed=a,a?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}(d.Object3D);Object.assign(Ca.prototype,{isFiveLine:!0});var Ue={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 u0(n){return bi(this,void 0,void 0,function(){var t;return wi(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 lp(n){return bi(this,void 0,void 0,function(){var t,e;return wi(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,u0("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function cp(n,t,e,r){return e===void 0&&(e=null),r===void 0&&(r=!0),bi(this,void 0,void 0,function(){var i,a,o,s,u,c;return wi(this,function(l){switch(l.label){case 0:if(!n)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No basePath supplied");return[4,lp(t)];case 1:if(i=l.sent(),n.profiles.some(function(h){var p=i[h];return p&&(a={profileId:h,profilePath:"".concat(t,"/").concat(p.path),deprecated:!!p.deprecated}),!!a}),!a){if(!e)throw new Error("No matching profile name found");if(o=i[e],!o)throw new Error('No matching profile name found and default profile "'.concat(e,'" missing.'));a={profileId:e,profilePath:"".concat(t,"/").concat(o.path),deprecated:!!o.deprecated}}return[4,u0(a.profilePath)];case 2:if(s=l.sent(),r){if(c=void 0,c=s.layouts[n.handedness],!c)throw new Error("No matching handedness, ".concat(n.handedness,", in profile ").concat(a.profileId));c.assetPath&&(u=a.profilePath.replace("profile.json",c.assetPath))}return[2,{profile:s,assetPath:u}]}})})}var dp={xAxis:0,yAxis:0,button:0,state:Ue.ComponentState.DEFAULT};function fp(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 a=Math.atan2(t,n);e=Math.cos(a),r=Math.sin(a)}var o={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return o}var hp=function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Ue.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(dp)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,i=t.button,a=t.state,o=fp(e,r),s=o.normalizedXAxis,u=o.normalizedYAxis;switch(this.componentProperty){case Ue.ComponentProperty.X_AXIS:this.value=this.states.includes(a)?s:.5;break;case Ue.ComponentProperty.Y_AXIS:this.value=this.states.includes(a)?u:.5;break;case Ue.ComponentProperty.BUTTON:this.value=this.states.includes(a)?i:0;break;case Ue.ComponentProperty.STATE:this.valueNodeProperty===Ue.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(a):this.value=this.states.includes(a)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n}(),pp=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 a=new hp(e.visualResponses[i]);r.visualResponses[i]=a}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Ue.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=F({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Ue.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=Ue.ComponentState.PRESSED:(r.touched||this.values.button>Ue.ButtonTouchThreshold)&&(this.values.state=Ue.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===Ue.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Ue.AxisTouchThreshold&&(this.values.state=Ue.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===Ue.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Ue.AxisTouchThreshold&&(this.values.state=Ue.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(i){i.updateFromComponent(e.values)})},n}(),vp=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(a){var o=i.layoutDescription.components[a];i.components[a]=new pp(a,o)}),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}(),Ap="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",mp="generic-trigger",gp=function(n){oe(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 d.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 a=i.valueNode,o=i.minNode,s=i.maxNode,u=i.value,c=i.valueNodeProperty;a&&(c===Ue.VisualResponseProperty.VISIBILITY?a.visible=u:c===Ue.VisualResponseProperty.TRANSFORM&&(a.quaternion.copy(o.quaternion).slerp(s.quaternion,u),a.position.lerpVectors(o.position,s.position,u)))})}))},t}(In.Object3D);function yp(n,t){Object.values(n.components).forEach(function(e){var r=e.type,i=e.touchPointNodeName,a=e.visualResponses;if(r===Ue.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(i),e.touchPointNode){var o=new In.SphereGeometry(.001),s=new In.MeshBasicMaterial({color:255}),u=new In.Mesh(o,s);e.touchPointNode.add(u)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(a).forEach(function(c){var l=c.valueNodeName,h=c.minNodeName,p=c.maxNodeName,v=c.valueNodeProperty;if(v===Ue.VisualResponseProperty.TRANSFORM){if(c.minNode=t.getObjectByName(h),c.maxNode=t.getObjectByName(p),!c.minNode){console.warn("Could not find ".concat(h," in the model"));return}if(!c.maxNode){console.warn("Could not find ".concat(p," in the model"));return}}c.valueNode=t.getObjectByName(l),c.valueNode||console.warn("Could not find ".concat(l," in the model"))})})}function Rs(n,t){yp(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof d.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var bp=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=Ap,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new gp,i=null;return t.addEventListener("connected",function(a){var o=a.data;o.targetRayMode!=="tracked-pointer"||!o.gamepad||cp(o,e.path,mp).then(function(s){var u=s.profile,c=s.assetPath;r.motionController=new vp(o,u,c);var l=e._assetCache[r.motionController.assetUrl];if(l)i=l.scene.clone(),Rs(r,i);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(h){e._assetCache[r.motionController.assetUrl]=h,i=h.scene.clone(),Rs(r,i)})}}).catch(function(s){console.warn(s)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(i),i=null}),r},n}();function wp(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 Fs=300,xp=new d.Matrix4().makeRotationAxis(new d.Vector3(0,1,0),Math.PI),ks=new d.Vector3(-1,1,1),Ep=function(n){oe(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new ip(r.renderer,r.renderer.getContext(),{onSessionStart:function(u){r.emit("xr.session.start",K("xr.session.start",{session:u,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",K("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new d.Raycaster,right:new d.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.pointerLines={left:new Ca,right:new Ca},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new d.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new d.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=ht()]={panoId:Be(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade"},r.parallaxCameraMatrixs=[];var i=ft.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 d.Group,new d.Group],r.scene.add(r.controllerWrappers[0],r.controllerWrappers[1]);var a=r.xrManager.getController(0);r.controllerWrappers[0].add(a);var o=r.xrManager.getController(1);r.controllerWrappers[1].add(o);var s=new bp;return s.gltfLoader={load:function(u,c){ui.ajax(u,{responseType:"arraybuffer"}).then(function(l){var h;return Qa(l.body,{resourcePath:u.slice(0,u.lastIndexOf("/")+1),search:(h=u.split("?")[1])!==null&&h!==void 0?h:"",fetcher:ui})}).then(function(l){return c(l)})}},r.on("xr.session.start",function(){var u=r.xrManager.getControllerGrip(0);u.add(s.createControllerModel(u)),r.controllerWrappers[0].add(u);var c=r.xrManager.getControllerGrip(1);c.add(s.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=F(F({},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 F(F({},i),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,r,i){var a=this,o,s,u,c;this.userAction=i,this.stopMomentumMovement();var l=this.works.getResolvedObserver(e);if(!l)throw new Error("Invalid PanoIndex");var h=this.imageOptions.size;if(typeof h=="undefined"&&l){var p=l.images.up.match(/\/cube_(\d+)\//);p&&(h=Number(p[1]))}typeof h=="undefined"&&(h=2048);var v=this.imageOptions.transform,m=function(P,I){return wp(li(P,v,I))},A=F({key:"pano.".concat(l.panoId)},nr(this.imageOptions,["format","size","quality"])),y=l.images,f=(s=(o=l.images.tiles)===null||o===void 0?void 0:o.filter(function(P){return P.size>h}))!==null&&s!==void 0?s:null,g="pano:"+dn([y,A,v]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;var b=this.pendingTextureTask.panoId;(u=this.panoMeshes[b])===null||u===void 0||u.setProgress(0),this.emit("pano.texture.abort",K("pano.texture.abort",{error:null,progress:0,meta:null,pano:l.pano})),this.pendingTextureTask.onError(new Error("texture aborted"))}var x=this.models.getMaterial()||{},w=x.pano0,E=x.pano1,M;if((w==null?void 0:w.map.name)===g?M=w:(E==null?void 0:E.map.name)===g&&(M=E),M){var C={panoId:l.panoId,effect:(c=r.effect)!==null&&c!==void 0?c:"fade",leftPanoPicture:{map:M.map,luminanceMap:M.luminanceMap,matrix:new d.Matrix4().compose(l.position,l.quaternion,ks)},position:l.position.clone()};this.doMoveToPano(l.pano,C,r);return}var S="move-to-pano-"+l.panoId;this.pending.add(S),this.pendingTextureTask={panoId:l.panoId,hash:g,onLoad:function(P){var I;if(a.pending.delete(S),a.destroyed)P.body.dispose();else{P.body.name=g;var B={panoId:l.panoId,effect:(I=r.effect)!==null&&I!==void 0?I:"fade",leftPanoPicture:{map:P.body,luminanceMap:null,matrix:new d.Matrix4().compose(l.position,l.quaternion,ks)},position:l.position.clone()};a.doMoveToPano(l.pano,B,r)}},onError:function(P){a.pending.delete(S);var I=F(F(F({},l.pano),{mode:a.mode}),Ve(a.camera.pose));a.emit("pano.error",K("pano.error",{error:P,userAction:a.userAction,options:r,prevPano:a.currentPano,progress:0,state:I})),a.emit("pano.cancel",K("pano.cancel",{error:null,userAction:a.userAction,options:r,prevPano:a.currentPano,progress:0,state:I})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&f&&f.length?this.textureLoader.loadTiledCubeTexture(y,f,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:m,options:A},format:d.RGBAFormat,viaAjax:!0,fetcher:dt(l.work)},void 0,void 0,function(P){var I,B;a.emit("pano.texture.progress",K("pano.texture.progress",{error:null,progress:P,meta:null,pano:l.pano})),((I=a.pendingTextureTask)===null||I===void 0?void 0:I.hash)===g&&((B=a.panoMeshes[l.panoId])===null||B===void 0||B.setProgress(P))},this.renderer):this.textureLoader.loadCubeTexture(y,{imageURL:{transform:m,options:A},format:d.RGBAFormat,fetcher:dt(l.work)},void 0,void 0,function(P){var I,B;((I=a.pendingTextureTask)===null||I===void 0?void 0:I.hash)===g&&((B=a.panoMeshes[l.panoId])===null||B===void 0||B.setProgress(P)),a.emit("pano.texture.progress",K("pano.texture.progress",{error:null,progress:P,meta:null,pano:l.pano}))},this.renderer)]).then(function(P){var I,B,L=P[0];((I=a.pendingTextureTask)===null||I===void 0?void 0:I.hash)===g?(a.pendingTextureTask.onLoad(L),(B=a.panoMeshes[l.panoId])===null||B===void 0||B.setProgress(0),delete a.pendingTextureTask,a.emit("pano.texture.success",K("pano.texture.success",{error:null,progress:1,meta:L.meta,pano:l.pano}))):L.body.dispose()}).catch(function(P){var I,B;((I=a.pendingTextureTask)===null||I===void 0?void 0:I.hash)===g&&(a.pendingTextureTask.onError(P),(B=a.panoMeshes[l.panoId])===null||B===void 0||B.setProgress(0),delete a.pendingTextureTask,a.emit("pano.texture.error",K("pano.texture.error",{error:P,progress:0,meta:null,pano:l.pano})),a.emit("error",P))}),this.emit("pano.texture.load",K("pano.texture.load",{error:null,progress:0,meta:null,pano:l.pano}))},t.prototype.doMoveToPano=function(e,r,i){var a=this,o,s,u;i===void 0&&(i={});var c=ve(),l=ht();this.panoResources[l]=r;var h=1,p,v,m;if(this.locationMotion.ended){var A=this.locationMotion.getKeyFrameSegment(c);A[0];var y=A[1],f=this.locationMotion.value,g=this.panoResourceFromLocationMotionKeyframe(y).position,b=r.position;p=Math.max(g.distanceTo(b),h),v=[{key:y.key,progress:0,value:F(F({},f),{count:0})},{key:l,progress:1,value:{distance:0,count:1}}],m=0}else{var x=this.locationMotion.getKeyFrameSegment(c),w=x[0],y=x[1],f=this.locationMotion.value,E=this.panoResourceFromLocationMotionKeyframe(w).position,g=this.panoResourceFromLocationMotionKeyframe(y).position,b=r.position,M=y.value.count-f.count,C=Math.max(E.distanceTo(g),h)*M,S=Math.max(g.distanceTo(b),h);p=C+S,v=[{key:w.key,progress:0,value:F({},f)},{key:y.key,progress:C/p,value:y.value},{key:l,progress:1,value:{count:y.value.count+1,distance:0}}];var P=this.locationMotionKeyframesLength(this.locationMotion.keyframes),I=this.locationMotionKeyframesLength(v);m=this.locationMotion.getProgressVelocity(c)*P/I}var B=this.calculateMovingDuration(i.duration,p),L={longitude:i.longitude,latitude:i.latitude,fov:i.fov},k=F(F({},e),{mode:this.mode,longitude:(o=L.longitude)!==null&&o!==void 0?o:this.camera.pose.longitude,latitude:(s=L.latitude)!==null&&s!==void 0?s:this.camera.pose.latitude,fov:(u=L.fov)!==null&&u!==void 0?u:this.camera.pose.fov,offset:r.position.clone(),distance:0}),O=this.currentPano;this.emit("pano.moveTo",K("pano.moveTo",{options:i,prevPano:O,progress:0,state:k,userAction:this.userAction,error:null})),i.moveStartCallback&&i.moveStartCallback(k),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=Q,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(L,B).catch(Q);var N=this.locationMotion.setKeyframes(v,B,m);N.then(function(){var D,H,z,U=F(F({},e),{mode:a.mode,longitude:a.camera.pose.longitude,latitude:a.camera.pose.latitude,fov:a.camera.pose.fov,offset:a.camera.pose.offset.clone(),distance:0});a.emit("pano.arrived",K("pano.arrived",{options:i,prevPano:O,progress:1,state:U,userAction:a.userAction,error:null})),i.moveEndCallback&&i.moveEndCallback(U);var q=a.works.getResolvedObserver(a.currentPano);if(q&&q.video&&a.videoTexture&&a.videoTexture.image instanceof HTMLVideoElement){var j=xp.clone().multiply((z=(H=(D=a.models.getMaterial())===null||D===void 0?void 0:D.pano1)===null||H===void 0?void 0:H.matrix)!==null&&z!==void 0?z:new d.Matrix4).multiply(q.video.matrix),_={map:a.videoTexture,size:q.video.size,matrix:j,alpha:1},Z=ht(),W=a.videoTexture.image;W.setAttribute("uuid",Z),_u().then(function(Y){Y&&q.video&&W.getAttribute("uuid")===Z&&(W.oncanplay=function(){W.oncanplay=Q,W.play()},W.ontimeupdate=function(){W.currentTime>.5&&(W.ontimeupdate=Q,a.panoVideo.setMaterial(_))},W.src=q.video.source)}).catch(function(){W.removeAttribute("uuid")})}},function(){a.emit("pano.cancel",K("pano.cancel",{options:i,prevPano:O,progress:0,state:k,userAction:a.userAction,error:null})),i.moveCancelCallback&&i.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,i,a,o,s;this.stopMomentumMovement();var u=this.camera.getDirection(new d.Vector3).setY(0),c=null,l=this.works.getResolvedObserver(this.currentPano);if(!l)return null;var h=l.accessibleIds.filter(function(Z){var W=We(Z);if(Tt(W,r.currentPano))return!1;var Y=r.works.getResolvedObserver(W);return!Y||Y.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:Y.loadable||Y.active}),p=this.models.intersectRaycaster(e)[0];if(p){var v=Pt(h,function(Z){var W=r.works.getResolvedObserver(Z);if(!W)return 1/0;var Y=W.standingPosition.clone();return Y.distanceTo(p.point)},!0),m=v[0],A=v[1];m&&A<this.panoTapTriggerRadius&&(c=(i=this.works.getResolvedObserver(m))!==null&&i!==void 0?i:null)}if(Is(c)){var y=this.getForwardObserverOrNot(e);y&&(c=y)}for(var f=0,g=this.locationMotion.keyframes;f<g.length;f++){var b=g[f],x=this.panoResourceFromLocationMotionKeyframe(b);if(!(b.progress<this.locationMotion.progress)&&c&&x.panoId===c.panoId){c=null;break}}if(Is(c))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(c&&!c.active){var w=c.panoId;this.panoMeshes[w]&&(this.panoMeshes[w].setDisabled(!1),this.panoMeshes[w].setLoading(!0))}var E={};if(c){E.effect="fade";for(var M=Math.PI/6,C=Math.PI/12,S=new d.Vector3(0,1,0),P=c.position.clone().setY(0).sub(l.position.clone().setY(0)).normalize(),I=P.clone().applyAxisAngle(S,M),B=P.clone().applyAxisAngle(S,-M),L=[],k=[],O=[],N=0,D=c.accessibleIds;N<D.length;N++){var m=D[N],H=We(m);if(!(Tt(H,this.currentPano)||Tt(H,c.pano))){var z=this.works.getResolvedObserver(m);if(z){var U=z.position.clone().sub(c.position).setY(0);P.angleTo(U)<M?O.push(U):I.angleTo(U)<M?L.push(U):B.angleTo(U)<M&&k.push(U)}}}var q=O.length>0?O:rt(rt([],L,!0),k,!0),j=q.slice().sort(function(Z,W){return Z.angleTo(P)-W.angleTo(P)})[0];j&&j.angleTo(u)>C&&(E.longitude=Math.atan2(-j.x,-j.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(E.latitude=ae(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(E.fov=this.defaultFov);var _={workCode:c.pano.workCode,panoIndex:c.pano.panoIndex,mode:this.mode,longitude:(a=E.longitude)!==null&&a!==void 0?a:this.camera.pose.longitude,latitude:(o=E.latitude)!==null&&o!==void 0?o:this.camera.pose.latitude,fov:(s=E.fov)!==null&&s!==void 0?s:this.camera.pose.fov,distance:0,offset:c?c.position.clone():new d.Vector3};return this.emit("pano.select",K("pano.select",{prevPano:this.currentPano,state:_,userAction:!0,options:E,progress:0,error:null})),c&&c.active?(this.emit("pano.request",K("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:_,options:E,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,a,o,s,u,c,l,h,p,v=[],m=2;m<arguments.length;m++)v[m-2]=arguments[m];this.userAction=!0;var A={},y={},f=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),A.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(ae(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var x=this.locationMotion.getKeyFrameSegment(e),w=x[0],E=x[1],M=this.panoResourceFromLocationMotionKeyframe(w),C=this.panoResourceFromLocationMotionKeyframe(E),S=new d.Vector3().copy(M.position),P=new d.Vector3().copy(C.position),I=this.locationMotion.value.count-E.value.count+1;A.progress=I,C.leftPanoPicture&&(I<1?M.leftPanoPicture&&(A.pano0=M.leftPanoPicture):A.pano0=C.leftPanoPicture,A.pano1=C.leftPanoPicture),b=A.useBlackTransition=C.effect==="instant"||C.effect==="montage",(C.effect==="fade"||C.effect==="montage")&&(A.pano0&&M.leftPanoPicture&&(A.pano0={map:A.pano0.map,luminanceMap:A.pano0.luminanceMap,matrix:M.leftPanoPicture.matrix.clone().setPosition(C.position)}),S.copy(P)),y.distance=this.locationMotion.value.distance,y.offset=new d.Vector3(S.x+(P.x-S.x)*I,S.y+(P.y-S.y)*I,S.z+(P.z-S.z)*I);for(var B=[],L=[],k=0,O=this.locationMotion.keyframes;k<O.length;k++){var N=O[k],D=N.key,H=N.progress;D!==void 0&&(B.push(D),H>=this.locationMotion.progress&&L.push(D))}for(var z=0,U=Object.keys(this.panoResources);z<U.length;z++){var q=U[z];if(!(L.indexOf(q)>=0)){var j=this.panoResources[q];if(j.leftPanoPicture){var _=j.leftPanoPicture.map;if(_){if(_===((a=A.pano0)===null||a===void 0?void 0:a.map)||_===((o=A.pano1)===null||o===void 0?void 0:o.map))continue;_ instanceof Le&&_.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(_.cubeRenderTarget),_.dispose(),j.leftPanoPicture=null}}B.indexOf(q)>=0||delete this.panoResources[q]}}this.currentPano=We(C.panoId),this.emit("pano.moving",K("pano.moving",{userAction:this.userAction,prevPano:We(f.panoId),state:F(F(F(F({},We(g.panoId)),{mode:this.mode}),Ve(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}Et(A)===!1&&(!((s=A.pano0)===null||s===void 0)&&s.map&&A.pano0.map instanceof Le&&!A.pano0.map.cubeRenderTarget&&(A.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((u=A.pano1)===null||u===void 0)&&u.map&&A.pano1.map instanceof Le&&!A.pano1.map.cubeRenderTarget&&(A.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(A)),Et(y)===!1&&this.setCamera(y);var Z=this.works.getResolvedObserver(this.currentPano),W=v[1];if(!W){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var Y=this.xrManager.referenceSpace;if(Y){var ce=this.xrManager.cameraVR,te=this.xrManager.cameraL,se=this.xrManager.cameraR,ue=[te,se],pe=W.getViewerPose(Y),he=new d.Vector3(0,0,0);if(pe){var de;de=this.xrManager.session.renderState.baseLayer;var be=pe.views;if(!de){console.error("no layer found");return}this.renderer.setFramebuffer(de.framebuffer);var fe=!1;be.length!==ce.cameras.length&&(ce.cameras.length=0,fe=!0),this.parallaxCameraMatrixs=[];var Se=new d.Vector3,ee=new d.Vector3;new d.Matrix4().fromArray(be[0].transform.matrix).decompose(Se,new d.Quaternion,new d.Vector3),new d.Matrix4().fromArray(be[1].transform.matrix).decompose(ee,new d.Quaternion,new d.Vector3),ee.clone().sub(Se).normalize();var le=new d.Vector3,X=new d.Quaternion,Te=new d.Vector3;this.camera.matrix.decompose(le,X,Te);for(var Fe=0;Fe<be.length;Fe++){var Ye=be[Fe],Xe=de.getViewport(Ye),Ge=ue[Fe];Ge.matrix.fromArray(Ye.transform.matrix);var st=new d.Vector3,Ne=new d.Quaternion,me=new d.Vector3;Ge.matrix.decompose(st,Ne,me),he.copy(le),Ge.position.copy(le),Ge.quaternion.copy(Ne),Ge.scale.copy(me),Ge.updateMatrix(),Ge.projectionMatrix.fromArray(Ye.projectionMatrix),Ge.viewport.set(Xe.x,Xe.y,Xe.width,Xe.height),fe===!0&&ce.cameras.push(Ge)}pe.views[0].transform.position,pe.views[1].transform.position;for(var Ae=this.xrManager.session.inputSources,Fe=0;Fe<this.xrManager.controllers.length;Fe++){var nt=this.xrManager.controllers[Fe],Ce=Ae[Fe];if(Ce){nt.update(Ce,W,Y);var He=this.xrManager.getController(Fe),Oe=new d.Vector3(0,1.2,0),it=He.position.clone().add(he).sub(Oe);Ce.handedness==="left"?this.xrControllerRay.left.set(it,new d.Vector3(0,0,-1).applyEuler(He.rotation)):Ce.handedness==="right"&&this.xrControllerRay.right.set(it,new d.Vector3(0,0,-1).applyEuler(He.rotation)),this.controllerWrappers[Fe].position.copy(new d.Vector3(0,0,0).add(he).sub(Oe));var qe=this.models.intersectRaycaster(this.xrControllerRay.right);if(qe.length===0&&(qe=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(lt){var gt;return F({floor:(gt=Z==null?void 0:Z.floorIndex)!==null&&gt!==void 0?gt:0},lt)})),qe.length>=1&&qe[0].face)if(Ce.handedness==="right"){var Zt=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),Or=qe[0].face.normal,Je=Or.clone().multiplyScalar(.05),Mt=qe[0].point.clone().add(Je);this.intersectMesh.position.copy(Mt);var _r=Mt.clone().add(Je);if(this.intersectMesh.lookAt(_r),Math.abs(Or.y)>.99){var $e=this.camera.position.clone().sub(Mt);this.intersectMesh.rotation.z=-Math.atan2($e.z,$e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,Zt.length>0?(this.pointerLines.right.setPoints(it,Zt[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(it,qe[0].point));var Bt=qe[0],Rt=K("intersect.update",{raycaster:(c=this.xrControllerRay.right)!==null&&c!==void 0?c:null,intersection:Bt!=null?Bt:null,object:this.intersectMesh});if(this.emit("intersect.update",Rt),Rt.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(it,qe[0].point)}}if(this.camera.pose.distance>.1||b){if(Z)for(var Ht=0,Yt=Object.keys(this.panoMeshes);Ht<Yt.length;Ht++){var pt=Yt[Ht],Ie=this.panoMeshes[pt];Ie.setOpacity(0),Ie.setCurrent(!1),Ie.updateTime&&Ie.updateTime(e,r)}}else if(Z){var gr=Pt(Z.visibleIds,function(at){var lt=i.works.getResolvedObserver(at);return lt?Z.standingPosition.distanceTo(lt.standingPosition):1/0},!0),Ft=gr[1];Ft=ae(Ft,2.5,1/0);for(var ir=Z.visibleIds.concat(Be(this.currentPano)),kt=this.getForwardObserverOrNot(),mn=this.camera.getDirection(new d.Vector3),Vr=0,Nr=Object.keys(this.panoMeshes);Vr<Nr.length;Vr++){var pt=Nr[Vr],Ie=this.panoMeshes[pt],ar=this.works.getResolvedObserver(pt);if(ir.indexOf(pt)===-1)Ie.setCurrent(!1),Ie.setOpacity(0);else if(!ar)Ie.setCurrent(!1),Ie.setOpacity(0);else if(!ar.loadable&&!ar.active)Ie.setCurrent(!1),Ie.setOpacity(0);else{var or=Ie.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Ie.setCurrent(!Ie.loading&&Ie.progress===0&&kt!==null&&kt.panoId===pt),Ie.setOpacity(or<.01?0:ae(Ft/or*1.2,.65,.98));var et=this.camera.position.clone().setY(Ie.position.y),Ke=new d.Vector3().copy(Ie.position).sub(et).normalize();if(pt===Be(this.currentPano)){var Lt=ae((.5-et.distanceTo(Ie.position))/.5,0,1);Ke.multiplyScalar(1-Lt).add(mn.clone().multiplyScalar(Lt))}Ke.length()>0&&Ie.quaternion.setFromEuler(new d.Euler(0,Math.atan2(Ke.x,Ke.z),0))}Ie.updateTime&&Ie.updateTime(e,r)}}var sr=function(){if(i.tileLevelForFov===!1)return 0;var at=new d.Vector2(4e3,4e3),lt=g.panoId,gt=i.works.getResolvedObserver(lt),yt=i.imageOptions.size;if(typeof yt=="undefined"&&gt){var Gn=gt.images.up.match(/\/cube_(\d+)\//);Gn&&(yt=Number(Gn[1]))}typeof yt=="undefined"&&(yt=2048);var Dr=0;yt>=1024&&(Dr=1),yt>=2048&&(Dr=2),yt>=4096&&(Dr=3),yt>=8192&&(Dr=4);var Ur=i.tileLevelForFov(te.fov,at);return Ur>Dr?Ur:0}(),gn=function(){var at=new d.PerspectiveCamera;at.applyMatrix4(ce.matrix),at.position.set(0,0,0);var lt=i.works.getResolvedObserver(g.panoId),gt=lt!=null?lt:Z;gt&&at.quaternion.premultiply(gt.quaternion.clone().inverse()),at.updateProjectionMatrix(),at.updateMatrixWorld(!0);var yt=new d.Frustum().setFromProjectionMatrix(new d.Matrix4().multiplyMatrices(at.projectionMatrix,at.matrixWorldInverse));return yt}();g.panoId===Be(this.currentPano)&&((l=g.leftPanoPicture)===null||l===void 0?void 0:l.map)instanceof Le&&(g.leftPanoPicture.map.update(gn,sr),g.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0));{var zn=this.tiling.object.visible;if(sr>this.TILED_CUBE_TEXTURE_LEVEL&&this.initAnimationed){var Qr=g.panoId,ut=this.works.getResolvedObserver(Qr);ut?Mi(this.camera.position,ut.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Qr&&this.tiling.cleanup(),this.tiling.panoId=Qr,this.tiling.setResource((p=(h=ut.images)===null||h===void 0?void 0:h.tiles)!==null&&p!==void 0?p:[],this.enableIOSEDR&&ut.images.luminance?ut.images.luminance:null),this.tiling.setFetcher(dt(ut.work)),this.tiling.setRotation(ut.quaternion),this.tiling.setPosition(ut.position),this.tiling.update(gn,sr,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;zn!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),!(!Ae||Ae.length<1)&&this.updateControllerHelper(Ae,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 a=this.xrControllerRay.left,o=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var s={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},u=0;u<e.length;u++){var c=e[u].handedness,l=e[u].gamepad;switch(c){case"left":l.axes&&(this.emitEvent(l.axes[2]===-1,"LeftAxesLeft",r),this.emitEvent(l.axes[2]===1,"LeftAxesRight",r),this.emitEvent(l.axes[3]===-1,"LeftAxesUp",r),this.emitEvent(l.axes[3]===1,"LeftAxesDown",r)),l!=null&&l.buttons&&(this.emitEvent(l==null?void 0:l.buttons[4].pressed,"X",r),this.emitEvent(l.buttons[5].pressed,"Y",r),this.emitEvent(l==null?void 0:l.buttons[0].pressed,"LeftTrigger",r),this.emitEvent(l==null?void 0:l.buttons[1].pressed,"LeftPinch",r));var h={raycaster:a,axes:{up:l.axes&&l.axes[3]<0?Math.abs(l.axes[3]):0,down:l.axes&&l.axes[3]<0?0:Math.abs(l.axes[3]),left:l.axes&&l.axes[2]<0?Math.abs(l.axes[2]):0,right:l.axes&&l.axes[2]<0?0:Math.abs(l.axes[2])},deltaTime:i};s.buttons.X=l.buttons&&l.buttons[4]?l.buttons[4].pressed:!1,s.buttons.Y=l.buttons&&l.buttons[5]?l==null?void 0:l.buttons[5].pressed:!1,s.buttons.LeftTrigger=l.buttons&&l.buttons[0]?l==null?void 0:l.buttons[0].pressed:!1,s.buttons.LeftPinch=l.buttons&&l.buttons[1]?l==null?void 0:l.buttons[1].pressed:!1,s.left=h;break;case"right":l.axes&&(this.emitEvent(l.axes[2]===-1,"RightAxesLeft",r),this.emitEvent(l.axes[2]===1,"RightAxesRight",r),this.emitEvent(l.axes[3]===-1,"RightAxesUp",r),this.emitEvent(l.axes[3]===1,"RightAxesDown",r)),l.buttons&&(this.emitEvent(l==null?void 0:l.buttons[4].pressed,"A",r),this.emitEvent(l.buttons[5].pressed,"B",r),this.emitEvent(l==null?void 0:l.buttons[0].pressed,"RightTrigger",r),this.emitEvent(l==null?void 0:l.buttons[1].pressed,"RightPinch",r));var p={raycaster:o,axes:{up:l.axes&&l.axes[3]<0?Math.abs(l.axes[3]):0,down:l.axes&&l.axes[3]<0?0:Math.abs(l.axes[3]),left:l.axes&&l.axes[2]<0?Math.abs(l.axes[2]):0,right:l.axes&&l.axes[2]<0?0:Math.abs(l.axes[2])},deltaTime:i};s.right=p,s.buttons.A=l.buttons&&l.buttons[4]?l==null?void 0:l.buttons[4].pressed:!1,s.buttons.B=l.buttons&&l.buttons[5]?l==null?void 0:l.buttons[5].pressed:!1,s.buttons.RightTrigger=l.buttons&&l.buttons[0]?l==null?void 0:l.buttons[0].pressed:!1,s.buttons.RightPinch=l.buttons&&l.buttons[1]?l==null?void 0:l.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",K("xr.controller.update",s))}},t.prototype.emitEvent=function(e,r,i){var a=this.xrControllerRay.left,o=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",K("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:a,rightRay:o}}}));else{var s=i-this.xrControllerState[r].touchStartTime;s>Fs&&this.emit("xr.gesture.press",K("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:a,rightRay:o}}}))}else if(this.xrControllerState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",K("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:a,rightRay:o}}}));var s=i-this.xrControllerState[r].touchStartTime;if(s<=Fs){var u=this.emit("xr.gesture.tap",K("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:a,rightRay:o}}}));u||r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrControllerState[r].touchStart=!1,this.xrControllerState[r].touchStartTime=0}},t}(Ya),Nt={Floorplan:ai,Topview:Lf,Panorama:Ya,VRPanorama:Lh,Model:Vh,DepthPanorama:qh,Mapview:tp,XRPanorama:Ep},l0=["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 Mp(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=Tr(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 Cp(){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 Sp(n){{var t=new d.DirectionalLight(16777215,.5);t.position.copy(new d.Vector3(1,1,1)),n.add(t)}{var t=new d.DirectionalLight(16777215,.3);n.add(t)}{var t=new d.AmbientLight(16777215,.3);n.add(t)}}function Ip(n){for(var t,e,r={},i=n.split(/(\;|\,)/),a=0,o=i;a<o.length;a++){var s=o[a],u=s.split("="),c=(t=u[0])===null||t===void 0?void 0:t.trim(),l=(e=u[1])===null||e===void 0?void 0:e.trim();c&&l&&(r[c]=l)}return r}function c0(){for(var n,t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var i=Ip((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),a=Number(i["initial-scale"]);if(!isNaN(a))return a}}return 1}const Tp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5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Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";var Ls=[351,63],Os=[20,20],Pp=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Bp=new Float32Array([0,0,1,0,0,1,1,1]),Rp=new Uint8Array([0,1,2,1,3,2]),Ti=new d.BufferGeometry;Ti.setAttribute("position",new d.BufferAttribute(Pp,3));Ti.setAttribute("uv",new d.BufferAttribute(Bp,2));Ti.setIndex(new d.BufferAttribute(Rp,1));var oi=new d.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),d0=new d.Mesh(Ti,oi);d0.matrixAutoUpdate=!1;var ro=new d.Scene;ro.add(d0);ro.matrixAutoUpdate=!1;var Un=new d.OrthographicCamera(-.5,.5,.5,-.5,.1,1);Un.position.set(0,0,.5);Un.lookAt(0,0,0);Un.updateMatrixWorld(!0);Un.matrixAutoUpdate=!1;var Fp=new d.Vector4,kp=new d.Vector4;function Vs(n){if(oi.map){var r=n.getViewport(Fp),i=n.getScissor(kp),a=n.getScissorTest(),o=n.autoClear,s=i.x+Os[0]/3,u=i.y+Os[1]/3,c=Ls[0]/3,l=Ls[1]/3;n.setViewport(s,u,c,l),n.setScissor(s,u,c,l),n.setScissorTest(!0),n.autoClear=!1,n.render(ro,Un),n.setViewport(r),n.setScissor(i),n.setScissorTest(a),n.autoClear=o}else{var t=new d.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=d.ClampToEdgeWrapping,t.wrapT=d.ClampToEdgeWrapping,t.minFilter=d.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,oi.needsUpdate=!0,e.onload=Q},e.src=Tp,oi.map=t}}var Lp=800,Op=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/")},Vp=[{name:"Z",transformToUpAxisZ:function(){return new d.Matrix4}},{name:"Y",transformToUpAxisZ:function(){return new d.Matrix4().makeRotationAxis(new d.Vector3(1,0,0),+Math.PI/2)}},{name:"-Y",transformToUpAxisZ:function(){return new d.Matrix4().makeRotationAxis(new d.Vector3(1,0,0),-Math.PI/2)}},{name:"WGS84",transformToEarthCentered:function(){return new d.Matrix4}},{name:"GCJ02",transformToEarthCentered:function(){return new d.Matrix4}},{name:"BD09",transformToEarthCentered:function(){return new d.Matrix4}}],an=new d.Vector2,$n=new d.Frustum,ei=new d.Matrix4,Ns=new WeakMap,Qs=new WeakMap,Ds=Hu([]),f0=function(n){oe(t,n);function t(e){e===void 0&&(e={});var r,i,a,o,s,u,c,l,h,p,v=n.call(this)||this;v.ident=ht(),Sa.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=F({},(i=e.imageOptions)!==null&&i!==void 0?i:{}),v.textureOptions=F({},(a=e.textureOptions)!==null&&a!==void 0?a:{}),v.poweredByRealsee=(o=e.poweredByRealsee)!==null&&o!==void 0?o:!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=rt([],(s=e.coordinatesSystemTransformers)!==null&&s!==void 0?s:[],!0);for(var m=function(L){var k=A.coordinatesSystemTransformers.find(function(O){return O.name===L.name});k||A.coordinatesSystemTransformers.push(F({},L))},A=this,y=0,f=Vp;y<f.length;y++){var g=f[y];m(g)}if(v.fps={testCount:0,testTime:ve()},v.info=null,v.modeChangeDuration=(u=e.modeChangeDuration)!==null&&u!==void 0?u:Lp,v.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if(e.renderer)e.renderer instanceof Hr&&v.throwError(new Error("cannot render a internal renderer")),v.renderer=e.renderer;else try{v.renderer=new Hr({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e==null?void 0:e.webgl2});var b=c0();v.renderer.setPixelRatio(b===1?window.devicePixelRatio:1),v.renderer.setSize(512,512)}catch(L){L instanceof Error&&v.throwError(L)}v.getPixelsRenderTarget=new d.WebGLRenderTarget(1,1,{encoding:(h=(l=v.renderer)===null||l===void 0?void 0:l.outputEncoding)!==null&&h!==void 0?h:d.sRGBEncoding}),v.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),v.camera=new di(90),v.scene=new iu,v.xrCustomObjectsScene=new d.Scene,v.scene.add(v.xrCustomObjectsScene),v.scene.matrixAutoUpdate=!1,v.lastLoadWorkTask=Promise.resolve(),v.requestProxy=(p=e.requestProxy)!==null&&p!==void 0?p:Op,v.networkSubscribe=new Ws,v.networkSubscribe.on("network",function(L,k,O,N){var D;v.emit("network.resource",K("network.resource",{source:L,requestType:k,requestState:O,detail:N})),(D=v.analysis)===null||D===void 0||D.network(v.works,L,k,O,N)}),v.boundingMesh=Cf(new d.Box3(new d.Vector3(-.5,-.5,-.5),new d.Vector3(.5,.5,.5))),v.boundingMesh.name="bounding",v.scene.add(v.boundingMesh),v.models=cs(),v.models.push(new xa),v.lastModels=cs(),v.readyCallbacks=[],v.syncingState=!1,v.modelGroup=new d.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 d.Group,v.helperGroup.name="helper",v.helperGroup.matrixAutoUpdate=!1,v.scene.add(v.helperGroup),v.videoTexture=new d.VideoTexture(e.videoInstance||Cp()),Sp(v.scene),v.copyEffect=new Si(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=ft.shared.add(function(L,k){for(var O=[],N=2;N<arguments.length;N++)O[N-2]=arguments[N];v.updateTime.apply(v,rt([L,k],O,!1))},!1,0,10));var x=function(){typeof document!="undefined"&&document.fullscreenElement===null&&v.currentMode==="VRPanorama"&&v.controller.emit("vr.requestExit",K("vr.requestExit",{}))},w=function(){v.needsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",x,!1),v.renderer&&v.renderer.domElement.addEventListener("webglcontextrestored",w,!1),v.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",x,!1),v.renderer&&v.renderer.domElement.removeEventListener("webglcontextrestored",w,!1)},v.plugins={},e.plugins&&e.plugins.length)for(var E=0,M=e.plugins;E<M.length;E++){var C=M[E];if(typeof C=="function")C(v);else if(Array.isArray(C)){var S=C[0],P=C[1],I=C[2];if(typeof S=="function"){var B=S(v,I);typeof P=="string"&&(v.plugins[P]?v.throwError(new Error("plugin name ".concat(P," is exists."))):v.plugins[P]=B)}}}return v.gpuPickingRenderTarget=new d.WebGLRenderTarget(1,1),v.meshReplaceMaterialMap=new Map,v.meshOriginMaterialMap=new Map,Mp(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 vi.decoderPath},set:function(e){vi.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return Fn.transcoderPath},set:function(e){Fn.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,a,o){var s=this;if(a===void 0&&(a=1),o===void 0&&(o=new d.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.models.setMaterial({constantColor:o}),this.scene.traverse(function(h){if(!(!(h instanceof d.Mesh)||h instanceof Gt)){var p=Object.keys(i).filter(function(m){return m===h.uuid})[0];if(p)if(s.meshOriginMaterialMap.set(p,h.material),s.meshReplaceMaterialMap.get(p))h.material=s.meshReplaceMaterialMap.get(p);else{var v=new d.ShaderMaterial({uniforms:{color:{value:i[p]}},vertexShader:`
2020
+ `},to=function(n){oe(t,n);function t(e){var r=n.call(this,{uniforms:d.UniformsUtils.clone(ia.uniforms),vertexShader:ia.vertexShader,fragmentShader:ia.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}(d.ShaderMaterial);Object.assign(to.prototype,{isLineMaterial:!0});var a0=function(n){oe(t,n);function t(e,r){var i=n.call(this)||this;return i.type="LineSegments2",i.geometry=e!==void 0?e:new eo,i.material=r!==void 0?r:new to({color:Math.random()*16777215}),i}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,i=e.attributes.instanceEnd,a=new Float32Array(2*r.count),o=new d.Vector3,s=new d.Vector3,u=0,c=0,l=r.count;u<l;u++,c+=2)o.fromBufferAttribute(r,u),s.fromBufferAttribute(i,u),a[c]=c===0?0:a[c-1],a[c+1]=a[c]+o.distanceTo(s);var h=new d.InstancedInterleavedBuffer(a,2,1);return e.setAttribute("instanceDistanceStart",new d.InterleavedBufferAttribute(h,1,0)),e.setAttribute("instanceDistanceEnd",new d.InterleavedBufferAttribute(h,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,a=e.camera,o=a.projectionMatrix,s=this.geometry,u=this.material,c=u.resolution,l=u.linewidth,h=s.attributes.instanceStart,p=s.attributes.instanceEnd,v=new d.Vector4,m=new d.Vector4,A=new d.Vector4,y=new d.Vector3,f=new d.Matrix4,g=new d.Line3,b=new d.Vector3;i.at(1,A),A.w=1,A.applyMatrix4(a.matrixWorldInverse),A.applyMatrix4(o),A.multiplyScalar(1/A.w),A.x*=c.x/2,A.y*=c.y/2,A.z=0,y.copy(A);var x=this.matrixWorld;f.multiplyMatrices(a.matrixWorldInverse,x);for(var w=0,E=h.count;w<E;w++){v.fromBufferAttribute(h,w),m.fromBufferAttribute(p,w),v.w=1,m.w=1,v.applyMatrix4(f),m.applyMatrix4(f),v.applyMatrix4(o),m.applyMatrix4(o),v.multiplyScalar(1/v.w),m.multiplyScalar(1/m.w);var M=v.z<-1&&m.z<-1,C=v.z>1&&m.z>1;if(!(M||C)){v.x*=c.x/2,v.y*=c.y/2,m.x*=c.x/2,m.y*=c.y/2,g.start.copy(v),g.start.z=0,g.end.copy(m),g.end.z=0;var S=g.closestPointToPointParameter(y,!0);g.at(S,b);var P=d.MathUtils.lerp(v.z,m.z,S),I=P>=-1&&P<=1,B=y.distanceTo(b)<l*.5;if(I&&B){g.start.fromBufferAttribute(h,w),g.end.fromBufferAttribute(p,w),g.start.applyMatrix4(x),g.end.applyMatrix4(x);var L=new d.Vector3,k=new d.Vector3;i.distanceSqToSegment(g.start,g.end,k,L),r.push({point:k,pointOnLine:L,distance:i.origin.distanceTo(k),object:this,faceIndex:w})}}}},t}(d.Mesh);Object.assign(a0.prototype,{isLineSegments2:!0});var o0=function(n){oe(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.type="Line2",i}return t}(a0);Object.assign(o0.prototype,{isLine2:!0});var s0=function(n){oe(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),a=0;a<r;a+=3)i[2*a]=e[a],i[2*a+1]=e[a+1],i[2*a+2]=e[a+2],i[2*a+3]=e[a+3],i[2*a+4]=e[a+4],i[2*a+5]=e[a+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),a=0;a<r;a+=3)i[2*a]=e[a],i[2*a+1]=e[a+1],i[2*a+2]=e[a+2],i[2*a+3]=e[a+3],i[2*a+4]=e[a+4],i[2*a+5]=e[a+5];return n.prototype.setColors.call(this,i),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof d.Geometry){var i=new d.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof d.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(eo);Object.assign(s0.prototype,{isLineGeometry:!0});var ap="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1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==",Ps=14467195,op=8,sp=2,up=20,Bs=null,Ca=function(n){oe(t,n);function t(e,r){e===void 0&&(e=new d.Vector3),r===void 0&&(r=new d.Vector3);var i=n.call(this)||this;i.type="FiveLine",i.needsRender=!0;var a=new s0,o=new to({color:Ps,linewidth:sp,dashScale:up,dashed:!1});i.line=new o0(a,o);var s=new d.BufferGeometry,u=new d.PointsMaterial({color:Ps,size:op,map:Bs||(Bs=new d.TextureLoader().load(ap)),sizeAttenuation:!1,transparent:!0});return i.points=new d.Points(s,u),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.76"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var i=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new d.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 d.Vector3(e[0],e[1],e[2]),new d.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 a=e[i];i==="dashed"?(r.dashed=a,a?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}(d.Object3D);Object.assign(Ca.prototype,{isFiveLine:!0});var Ue={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 u0(n){return bi(this,void 0,void 0,function(){var t;return wi(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 lp(n){return bi(this,void 0,void 0,function(){var t,e;return wi(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,u0("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function cp(n,t,e,r){return e===void 0&&(e=null),r===void 0&&(r=!0),bi(this,void 0,void 0,function(){var i,a,o,s,u,c;return wi(this,function(l){switch(l.label){case 0:if(!n)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No basePath supplied");return[4,lp(t)];case 1:if(i=l.sent(),n.profiles.some(function(h){var p=i[h];return p&&(a={profileId:h,profilePath:"".concat(t,"/").concat(p.path),deprecated:!!p.deprecated}),!!a}),!a){if(!e)throw new Error("No matching profile name found");if(o=i[e],!o)throw new Error('No matching profile name found and default profile "'.concat(e,'" missing.'));a={profileId:e,profilePath:"".concat(t,"/").concat(o.path),deprecated:!!o.deprecated}}return[4,u0(a.profilePath)];case 2:if(s=l.sent(),r){if(c=void 0,c=s.layouts[n.handedness],!c)throw new Error("No matching handedness, ".concat(n.handedness,", in profile ").concat(a.profileId));c.assetPath&&(u=a.profilePath.replace("profile.json",c.assetPath))}return[2,{profile:s,assetPath:u}]}})})}var dp={xAxis:0,yAxis:0,button:0,state:Ue.ComponentState.DEFAULT};function fp(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 a=Math.atan2(t,n);e=Math.cos(a),r=Math.sin(a)}var o={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return o}var hp=function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Ue.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(dp)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,i=t.button,a=t.state,o=fp(e,r),s=o.normalizedXAxis,u=o.normalizedYAxis;switch(this.componentProperty){case Ue.ComponentProperty.X_AXIS:this.value=this.states.includes(a)?s:.5;break;case Ue.ComponentProperty.Y_AXIS:this.value=this.states.includes(a)?u:.5;break;case Ue.ComponentProperty.BUTTON:this.value=this.states.includes(a)?i:0;break;case Ue.ComponentProperty.STATE:this.valueNodeProperty===Ue.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(a):this.value=this.states.includes(a)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n}(),pp=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 a=new hp(e.visualResponses[i]);r.visualResponses[i]=a}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Ue.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=F({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Ue.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=Ue.ComponentState.PRESSED:(r.touched||this.values.button>Ue.ButtonTouchThreshold)&&(this.values.state=Ue.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===Ue.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Ue.AxisTouchThreshold&&(this.values.state=Ue.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===Ue.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Ue.AxisTouchThreshold&&(this.values.state=Ue.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(i){i.updateFromComponent(e.values)})},n}(),vp=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(a){var o=i.layoutDescription.components[a];i.components[a]=new pp(a,o)}),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}(),Ap="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",mp="generic-trigger",gp=function(n){oe(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 d.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 a=i.valueNode,o=i.minNode,s=i.maxNode,u=i.value,c=i.valueNodeProperty;a&&(c===Ue.VisualResponseProperty.VISIBILITY?a.visible=u:c===Ue.VisualResponseProperty.TRANSFORM&&(a.quaternion.copy(o.quaternion).slerp(s.quaternion,u),a.position.lerpVectors(o.position,s.position,u)))})}))},t}(In.Object3D);function yp(n,t){Object.values(n.components).forEach(function(e){var r=e.type,i=e.touchPointNodeName,a=e.visualResponses;if(r===Ue.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(i),e.touchPointNode){var o=new In.SphereGeometry(.001),s=new In.MeshBasicMaterial({color:255}),u=new In.Mesh(o,s);e.touchPointNode.add(u)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(a).forEach(function(c){var l=c.valueNodeName,h=c.minNodeName,p=c.maxNodeName,v=c.valueNodeProperty;if(v===Ue.VisualResponseProperty.TRANSFORM){if(c.minNode=t.getObjectByName(h),c.maxNode=t.getObjectByName(p),!c.minNode){console.warn("Could not find ".concat(h," in the model"));return}if(!c.maxNode){console.warn("Could not find ".concat(p," in the model"));return}}c.valueNode=t.getObjectByName(l),c.valueNode||console.warn("Could not find ".concat(l," in the model"))})})}function Rs(n,t){yp(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof d.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var bp=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=Ap,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new gp,i=null;return t.addEventListener("connected",function(a){var o=a.data;o.targetRayMode!=="tracked-pointer"||!o.gamepad||cp(o,e.path,mp).then(function(s){var u=s.profile,c=s.assetPath;r.motionController=new vp(o,u,c);var l=e._assetCache[r.motionController.assetUrl];if(l)i=l.scene.clone(),Rs(r,i);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(h){e._assetCache[r.motionController.assetUrl]=h,i=h.scene.clone(),Rs(r,i)})}}).catch(function(s){console.warn(s)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(i),i=null}),r},n}();function wp(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 Fs=300,xp=new d.Matrix4().makeRotationAxis(new d.Vector3(0,1,0),Math.PI),ks=new d.Vector3(-1,1,1),Ep=function(n){oe(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new ip(r.renderer,r.renderer.getContext(),{onSessionStart:function(u){r.emit("xr.session.start",K("xr.session.start",{session:u,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",K("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new d.Raycaster,right:new d.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.pointerLines={left:new Ca,right:new Ca},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new d.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new d.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=ht()]={panoId:Be(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade"},r.parallaxCameraMatrixs=[];var i=ft.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 d.Group,new d.Group],r.scene.add(r.controllerWrappers[0],r.controllerWrappers[1]);var a=r.xrManager.getController(0);r.controllerWrappers[0].add(a);var o=r.xrManager.getController(1);r.controllerWrappers[1].add(o);var s=new bp;return s.gltfLoader={load:function(u,c){ui.ajax(u,{responseType:"arraybuffer"}).then(function(l){var h;return Qa(l.body,{resourcePath:u.slice(0,u.lastIndexOf("/")+1),search:(h=u.split("?")[1])!==null&&h!==void 0?h:"",fetcher:ui})}).then(function(l){return c(l)})}},r.on("xr.session.start",function(){var u=r.xrManager.getControllerGrip(0);u.add(s.createControllerModel(u)),r.controllerWrappers[0].add(u);var c=r.xrManager.getControllerGrip(1);c.add(s.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=F(F({},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 F(F({},i),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,r,i){var a=this,o,s,u,c;this.userAction=i,this.stopMomentumMovement();var l=this.works.getResolvedObserver(e);if(!l)throw new Error("Invalid PanoIndex");var h=this.imageOptions.size;if(typeof h=="undefined"&&l){var p=l.images.up.match(/\/cube_(\d+)\//);p&&(h=Number(p[1]))}typeof h=="undefined"&&(h=2048);var v=this.imageOptions.transform,m=function(P,I){return wp(li(P,v,I))},A=F({key:"pano.".concat(l.panoId)},nr(this.imageOptions,["format","size","quality"])),y=l.images,f=(s=(o=l.images.tiles)===null||o===void 0?void 0:o.filter(function(P){return P.size>h}))!==null&&s!==void 0?s:null,g="pano:"+dn([y,A,v]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;var b=this.pendingTextureTask.panoId;(u=this.panoMeshes[b])===null||u===void 0||u.setProgress(0),this.emit("pano.texture.abort",K("pano.texture.abort",{error:null,progress:0,meta:null,pano:l.pano})),this.pendingTextureTask.onError(new Error("texture aborted"))}var x=this.models.getMaterial()||{},w=x.pano0,E=x.pano1,M;if((w==null?void 0:w.map.name)===g?M=w:(E==null?void 0:E.map.name)===g&&(M=E),M){var C={panoId:l.panoId,effect:(c=r.effect)!==null&&c!==void 0?c:"fade",leftPanoPicture:{map:M.map,luminanceMap:M.luminanceMap,matrix:new d.Matrix4().compose(l.position,l.quaternion,ks)},position:l.position.clone()};this.doMoveToPano(l.pano,C,r);return}var S="move-to-pano-"+l.panoId;this.pending.add(S),this.pendingTextureTask={panoId:l.panoId,hash:g,onLoad:function(P){var I;if(a.pending.delete(S),a.destroyed)P.body.dispose();else{P.body.name=g;var B={panoId:l.panoId,effect:(I=r.effect)!==null&&I!==void 0?I:"fade",leftPanoPicture:{map:P.body,luminanceMap:null,matrix:new d.Matrix4().compose(l.position,l.quaternion,ks)},position:l.position.clone()};a.doMoveToPano(l.pano,B,r)}},onError:function(P){a.pending.delete(S);var I=F(F(F({},l.pano),{mode:a.mode}),Ve(a.camera.pose));a.emit("pano.error",K("pano.error",{error:P,userAction:a.userAction,options:r,prevPano:a.currentPano,progress:0,state:I})),a.emit("pano.cancel",K("pano.cancel",{error:null,userAction:a.userAction,options:r,prevPano:a.currentPano,progress:0,state:I})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&f&&f.length?this.textureLoader.loadTiledCubeTexture(y,f,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:m,options:A},format:d.RGBAFormat,viaAjax:!0,fetcher:dt(l.work)},void 0,void 0,function(P){var I,B;a.emit("pano.texture.progress",K("pano.texture.progress",{error:null,progress:P,meta:null,pano:l.pano})),((I=a.pendingTextureTask)===null||I===void 0?void 0:I.hash)===g&&((B=a.panoMeshes[l.panoId])===null||B===void 0||B.setProgress(P))},this.renderer):this.textureLoader.loadCubeTexture(y,{imageURL:{transform:m,options:A},format:d.RGBAFormat,fetcher:dt(l.work)},void 0,void 0,function(P){var I,B;((I=a.pendingTextureTask)===null||I===void 0?void 0:I.hash)===g&&((B=a.panoMeshes[l.panoId])===null||B===void 0||B.setProgress(P)),a.emit("pano.texture.progress",K("pano.texture.progress",{error:null,progress:P,meta:null,pano:l.pano}))},this.renderer)]).then(function(P){var I,B,L=P[0];((I=a.pendingTextureTask)===null||I===void 0?void 0:I.hash)===g?(a.pendingTextureTask.onLoad(L),(B=a.panoMeshes[l.panoId])===null||B===void 0||B.setProgress(0),delete a.pendingTextureTask,a.emit("pano.texture.success",K("pano.texture.success",{error:null,progress:1,meta:L.meta,pano:l.pano}))):L.body.dispose()}).catch(function(P){var I,B;((I=a.pendingTextureTask)===null||I===void 0?void 0:I.hash)===g&&(a.pendingTextureTask.onError(P),(B=a.panoMeshes[l.panoId])===null||B===void 0||B.setProgress(0),delete a.pendingTextureTask,a.emit("pano.texture.error",K("pano.texture.error",{error:P,progress:0,meta:null,pano:l.pano})),a.emit("error",P))}),this.emit("pano.texture.load",K("pano.texture.load",{error:null,progress:0,meta:null,pano:l.pano}))},t.prototype.doMoveToPano=function(e,r,i){var a=this,o,s,u;i===void 0&&(i={});var c=ve(),l=ht();this.panoResources[l]=r;var h=1,p,v,m;if(this.locationMotion.ended){var A=this.locationMotion.getKeyFrameSegment(c);A[0];var y=A[1],f=this.locationMotion.value,g=this.panoResourceFromLocationMotionKeyframe(y).position,b=r.position;p=Math.max(g.distanceTo(b),h),v=[{key:y.key,progress:0,value:F(F({},f),{count:0})},{key:l,progress:1,value:{distance:0,count:1}}],m=0}else{var x=this.locationMotion.getKeyFrameSegment(c),w=x[0],y=x[1],f=this.locationMotion.value,E=this.panoResourceFromLocationMotionKeyframe(w).position,g=this.panoResourceFromLocationMotionKeyframe(y).position,b=r.position,M=y.value.count-f.count,C=Math.max(E.distanceTo(g),h)*M,S=Math.max(g.distanceTo(b),h);p=C+S,v=[{key:w.key,progress:0,value:F({},f)},{key:y.key,progress:C/p,value:y.value},{key:l,progress:1,value:{count:y.value.count+1,distance:0}}];var P=this.locationMotionKeyframesLength(this.locationMotion.keyframes),I=this.locationMotionKeyframesLength(v);m=this.locationMotion.getProgressVelocity(c)*P/I}var B=this.calculateMovingDuration(i.duration,p),L={longitude:i.longitude,latitude:i.latitude,fov:i.fov},k=F(F({},e),{mode:this.mode,longitude:(o=L.longitude)!==null&&o!==void 0?o:this.camera.pose.longitude,latitude:(s=L.latitude)!==null&&s!==void 0?s:this.camera.pose.latitude,fov:(u=L.fov)!==null&&u!==void 0?u:this.camera.pose.fov,offset:r.position.clone(),distance:0}),O=this.currentPano;this.emit("pano.moveTo",K("pano.moveTo",{options:i,prevPano:O,progress:0,state:k,userAction:this.userAction,error:null})),i.moveStartCallback&&i.moveStartCallback(k),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=Q,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(L,B).catch(Q);var N=this.locationMotion.setKeyframes(v,B,m);N.then(function(){var D,H,z,U=F(F({},e),{mode:a.mode,longitude:a.camera.pose.longitude,latitude:a.camera.pose.latitude,fov:a.camera.pose.fov,offset:a.camera.pose.offset.clone(),distance:0});a.emit("pano.arrived",K("pano.arrived",{options:i,prevPano:O,progress:1,state:U,userAction:a.userAction,error:null})),i.moveEndCallback&&i.moveEndCallback(U);var q=a.works.getResolvedObserver(a.currentPano);if(q&&q.video&&a.videoTexture&&a.videoTexture.image instanceof HTMLVideoElement){var j=xp.clone().multiply((z=(H=(D=a.models.getMaterial())===null||D===void 0?void 0:D.pano1)===null||H===void 0?void 0:H.matrix)!==null&&z!==void 0?z:new d.Matrix4).multiply(q.video.matrix),_={map:a.videoTexture,size:q.video.size,matrix:j,alpha:1},Z=ht(),W=a.videoTexture.image;W.setAttribute("uuid",Z),_u().then(function(Y){Y&&q.video&&W.getAttribute("uuid")===Z&&(W.oncanplay=function(){W.oncanplay=Q,W.play()},W.ontimeupdate=function(){W.currentTime>.5&&(W.ontimeupdate=Q,a.panoVideo.setMaterial(_))},W.src=q.video.source)}).catch(function(){W.removeAttribute("uuid")})}},function(){a.emit("pano.cancel",K("pano.cancel",{options:i,prevPano:O,progress:0,state:k,userAction:a.userAction,error:null})),i.moveCancelCallback&&i.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,i,a,o,s;this.stopMomentumMovement();var u=this.camera.getDirection(new d.Vector3).setY(0),c=null,l=this.works.getResolvedObserver(this.currentPano);if(!l)return null;var h=l.accessibleIds.filter(function(Z){var W=We(Z);if(Tt(W,r.currentPano))return!1;var Y=r.works.getResolvedObserver(W);return!Y||Y.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:Y.loadable||Y.active}),p=this.models.intersectRaycaster(e)[0];if(p){var v=Pt(h,function(Z){var W=r.works.getResolvedObserver(Z);if(!W)return 1/0;var Y=W.standingPosition.clone();return Y.distanceTo(p.point)},!0),m=v[0],A=v[1];m&&A<this.panoTapTriggerRadius&&(c=(i=this.works.getResolvedObserver(m))!==null&&i!==void 0?i:null)}if(Is(c)){var y=this.getForwardObserverOrNot(e);y&&(c=y)}for(var f=0,g=this.locationMotion.keyframes;f<g.length;f++){var b=g[f],x=this.panoResourceFromLocationMotionKeyframe(b);if(!(b.progress<this.locationMotion.progress)&&c&&x.panoId===c.panoId){c=null;break}}if(Is(c))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(c&&!c.active){var w=c.panoId;this.panoMeshes[w]&&(this.panoMeshes[w].setDisabled(!1),this.panoMeshes[w].setLoading(!0))}var E={};if(c){E.effect="fade";for(var M=Math.PI/6,C=Math.PI/12,S=new d.Vector3(0,1,0),P=c.position.clone().setY(0).sub(l.position.clone().setY(0)).normalize(),I=P.clone().applyAxisAngle(S,M),B=P.clone().applyAxisAngle(S,-M),L=[],k=[],O=[],N=0,D=c.accessibleIds;N<D.length;N++){var m=D[N],H=We(m);if(!(Tt(H,this.currentPano)||Tt(H,c.pano))){var z=this.works.getResolvedObserver(m);if(z){var U=z.position.clone().sub(c.position).setY(0);P.angleTo(U)<M?O.push(U):I.angleTo(U)<M?L.push(U):B.angleTo(U)<M&&k.push(U)}}}var q=O.length>0?O:rt(rt([],L,!0),k,!0),j=q.slice().sort(function(Z,W){return Z.angleTo(P)-W.angleTo(P)})[0];j&&j.angleTo(u)>C&&(E.longitude=Math.atan2(-j.x,-j.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(E.latitude=ae(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(E.fov=this.defaultFov);var _={workCode:c.pano.workCode,panoIndex:c.pano.panoIndex,mode:this.mode,longitude:(a=E.longitude)!==null&&a!==void 0?a:this.camera.pose.longitude,latitude:(o=E.latitude)!==null&&o!==void 0?o:this.camera.pose.latitude,fov:(s=E.fov)!==null&&s!==void 0?s:this.camera.pose.fov,distance:0,offset:c?c.position.clone():new d.Vector3};return this.emit("pano.select",K("pano.select",{prevPano:this.currentPano,state:_,userAction:!0,options:E,progress:0,error:null})),c&&c.active?(this.emit("pano.request",K("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:_,options:E,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,a,o,s,u,c,l,h,p,v=[],m=2;m<arguments.length;m++)v[m-2]=arguments[m];this.userAction=!0;var A={},y={},f=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),A.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(ae(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var x=this.locationMotion.getKeyFrameSegment(e),w=x[0],E=x[1],M=this.panoResourceFromLocationMotionKeyframe(w),C=this.panoResourceFromLocationMotionKeyframe(E),S=new d.Vector3().copy(M.position),P=new d.Vector3().copy(C.position),I=this.locationMotion.value.count-E.value.count+1;A.progress=I,C.leftPanoPicture&&(I<1?M.leftPanoPicture&&(A.pano0=M.leftPanoPicture):A.pano0=C.leftPanoPicture,A.pano1=C.leftPanoPicture),b=A.useBlackTransition=C.effect==="instant"||C.effect==="montage",(C.effect==="fade"||C.effect==="montage")&&(A.pano0&&M.leftPanoPicture&&(A.pano0={map:A.pano0.map,luminanceMap:A.pano0.luminanceMap,matrix:M.leftPanoPicture.matrix.clone().setPosition(C.position)}),S.copy(P)),y.distance=this.locationMotion.value.distance,y.offset=new d.Vector3(S.x+(P.x-S.x)*I,S.y+(P.y-S.y)*I,S.z+(P.z-S.z)*I);for(var B=[],L=[],k=0,O=this.locationMotion.keyframes;k<O.length;k++){var N=O[k],D=N.key,H=N.progress;D!==void 0&&(B.push(D),H>=this.locationMotion.progress&&L.push(D))}for(var z=0,U=Object.keys(this.panoResources);z<U.length;z++){var q=U[z];if(!(L.indexOf(q)>=0)){var j=this.panoResources[q];if(j.leftPanoPicture){var _=j.leftPanoPicture.map;if(_){if(_===((a=A.pano0)===null||a===void 0?void 0:a.map)||_===((o=A.pano1)===null||o===void 0?void 0:o.map))continue;_ instanceof Le&&_.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(_.cubeRenderTarget),_.dispose(),j.leftPanoPicture=null}}B.indexOf(q)>=0||delete this.panoResources[q]}}this.currentPano=We(C.panoId),this.emit("pano.moving",K("pano.moving",{userAction:this.userAction,prevPano:We(f.panoId),state:F(F(F(F({},We(g.panoId)),{mode:this.mode}),Ve(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}Et(A)===!1&&(!((s=A.pano0)===null||s===void 0)&&s.map&&A.pano0.map instanceof Le&&!A.pano0.map.cubeRenderTarget&&(A.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((u=A.pano1)===null||u===void 0)&&u.map&&A.pano1.map instanceof Le&&!A.pano1.map.cubeRenderTarget&&(A.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(A)),Et(y)===!1&&this.setCamera(y);var Z=this.works.getResolvedObserver(this.currentPano),W=v[1];if(!W){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var Y=this.xrManager.referenceSpace;if(Y){var ce=this.xrManager.cameraVR,te=this.xrManager.cameraL,se=this.xrManager.cameraR,ue=[te,se],pe=W.getViewerPose(Y),he=new d.Vector3(0,0,0);if(pe){var de;de=this.xrManager.session.renderState.baseLayer;var be=pe.views;if(!de){console.error("no layer found");return}this.renderer.setFramebuffer(de.framebuffer);var fe=!1;be.length!==ce.cameras.length&&(ce.cameras.length=0,fe=!0),this.parallaxCameraMatrixs=[];var Se=new d.Vector3,ee=new d.Vector3;new d.Matrix4().fromArray(be[0].transform.matrix).decompose(Se,new d.Quaternion,new d.Vector3),new d.Matrix4().fromArray(be[1].transform.matrix).decompose(ee,new d.Quaternion,new d.Vector3),ee.clone().sub(Se).normalize();var le=new d.Vector3,X=new d.Quaternion,Te=new d.Vector3;this.camera.matrix.decompose(le,X,Te);for(var Fe=0;Fe<be.length;Fe++){var Ye=be[Fe],Xe=de.getViewport(Ye),Ge=ue[Fe];Ge.matrix.fromArray(Ye.transform.matrix);var st=new d.Vector3,Ne=new d.Quaternion,me=new d.Vector3;Ge.matrix.decompose(st,Ne,me),he.copy(le),Ge.position.copy(le),Ge.quaternion.copy(Ne),Ge.scale.copy(me),Ge.updateMatrix(),Ge.projectionMatrix.fromArray(Ye.projectionMatrix),Ge.viewport.set(Xe.x,Xe.y,Xe.width,Xe.height),fe===!0&&ce.cameras.push(Ge)}pe.views[0].transform.position,pe.views[1].transform.position;for(var Ae=this.xrManager.session.inputSources,Fe=0;Fe<this.xrManager.controllers.length;Fe++){var nt=this.xrManager.controllers[Fe],Ce=Ae[Fe];if(Ce){nt.update(Ce,W,Y);var He=this.xrManager.getController(Fe),Oe=new d.Vector3(0,1.2,0),it=He.position.clone().add(he).sub(Oe);Ce.handedness==="left"?this.xrControllerRay.left.set(it,new d.Vector3(0,0,-1).applyEuler(He.rotation)):Ce.handedness==="right"&&this.xrControllerRay.right.set(it,new d.Vector3(0,0,-1).applyEuler(He.rotation)),this.controllerWrappers[Fe].position.copy(new d.Vector3(0,0,0).add(he).sub(Oe));var qe=this.models.intersectRaycaster(this.xrControllerRay.right);if(qe.length===0&&(qe=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(lt){var gt;return F({floor:(gt=Z==null?void 0:Z.floorIndex)!==null&&gt!==void 0?gt:0},lt)})),qe.length>=1&&qe[0].face)if(Ce.handedness==="right"){var Zt=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),Or=qe[0].face.normal,Je=Or.clone().multiplyScalar(.05),Mt=qe[0].point.clone().add(Je);this.intersectMesh.position.copy(Mt);var _r=Mt.clone().add(Je);if(this.intersectMesh.lookAt(_r),Math.abs(Or.y)>.99){var $e=this.camera.position.clone().sub(Mt);this.intersectMesh.rotation.z=-Math.atan2($e.z,$e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,Zt.length>0?(this.pointerLines.right.setPoints(it,Zt[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(it,qe[0].point));var Bt=qe[0],Rt=K("intersect.update",{raycaster:(c=this.xrControllerRay.right)!==null&&c!==void 0?c:null,intersection:Bt!=null?Bt:null,object:this.intersectMesh});if(this.emit("intersect.update",Rt),Rt.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(it,qe[0].point)}}if(this.camera.pose.distance>.1||b){if(Z)for(var Ht=0,Yt=Object.keys(this.panoMeshes);Ht<Yt.length;Ht++){var pt=Yt[Ht],Ie=this.panoMeshes[pt];Ie.setOpacity(0),Ie.setCurrent(!1),Ie.updateTime&&Ie.updateTime(e,r)}}else if(Z){var gr=Pt(Z.visibleIds,function(at){var lt=i.works.getResolvedObserver(at);return lt?Z.standingPosition.distanceTo(lt.standingPosition):1/0},!0),Ft=gr[1];Ft=ae(Ft,2.5,1/0);for(var ir=Z.visibleIds.concat(Be(this.currentPano)),kt=this.getForwardObserverOrNot(),mn=this.camera.getDirection(new d.Vector3),Vr=0,Nr=Object.keys(this.panoMeshes);Vr<Nr.length;Vr++){var pt=Nr[Vr],Ie=this.panoMeshes[pt],ar=this.works.getResolvedObserver(pt);if(ir.indexOf(pt)===-1)Ie.setCurrent(!1),Ie.setOpacity(0);else if(!ar)Ie.setCurrent(!1),Ie.setOpacity(0);else if(!ar.loadable&&!ar.active)Ie.setCurrent(!1),Ie.setOpacity(0);else{var or=Ie.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Ie.setCurrent(!Ie.loading&&Ie.progress===0&&kt!==null&&kt.panoId===pt),Ie.setOpacity(or<.01?0:ae(Ft/or*1.2,.65,.98));var et=this.camera.position.clone().setY(Ie.position.y),Ke=new d.Vector3().copy(Ie.position).sub(et).normalize();if(pt===Be(this.currentPano)){var Lt=ae((.5-et.distanceTo(Ie.position))/.5,0,1);Ke.multiplyScalar(1-Lt).add(mn.clone().multiplyScalar(Lt))}Ke.length()>0&&Ie.quaternion.setFromEuler(new d.Euler(0,Math.atan2(Ke.x,Ke.z),0))}Ie.updateTime&&Ie.updateTime(e,r)}}var sr=function(){if(i.tileLevelForFov===!1)return 0;var at=new d.Vector2(4e3,4e3),lt=g.panoId,gt=i.works.getResolvedObserver(lt),yt=i.imageOptions.size;if(typeof yt=="undefined"&&gt){var Gn=gt.images.up.match(/\/cube_(\d+)\//);Gn&&(yt=Number(Gn[1]))}typeof yt=="undefined"&&(yt=2048);var Dr=0;yt>=1024&&(Dr=1),yt>=2048&&(Dr=2),yt>=4096&&(Dr=3),yt>=8192&&(Dr=4);var Ur=i.tileLevelForFov(te.fov,at);return Ur>Dr?Ur:0}(),gn=function(){var at=new d.PerspectiveCamera;at.applyMatrix4(ce.matrix),at.position.set(0,0,0);var lt=i.works.getResolvedObserver(g.panoId),gt=lt!=null?lt:Z;gt&&at.quaternion.premultiply(gt.quaternion.clone().inverse()),at.updateProjectionMatrix(),at.updateMatrixWorld(!0);var yt=new d.Frustum().setFromProjectionMatrix(new d.Matrix4().multiplyMatrices(at.projectionMatrix,at.matrixWorldInverse));return yt}();g.panoId===Be(this.currentPano)&&((l=g.leftPanoPicture)===null||l===void 0?void 0:l.map)instanceof Le&&(g.leftPanoPicture.map.update(gn,sr),g.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0));{var zn=this.tiling.object.visible;if(sr>this.TILED_CUBE_TEXTURE_LEVEL&&this.initAnimationed){var Qr=g.panoId,ut=this.works.getResolvedObserver(Qr);ut?Mi(this.camera.position,ut.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Qr&&this.tiling.cleanup(),this.tiling.panoId=Qr,this.tiling.setResource((p=(h=ut.images)===null||h===void 0?void 0:h.tiles)!==null&&p!==void 0?p:[],this.enableIOSEDR&&ut.images.luminance?ut.images.luminance:null),this.tiling.setFetcher(dt(ut.work)),this.tiling.setRotation(ut.quaternion),this.tiling.setPosition(ut.position),this.tiling.update(gn,sr,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;zn!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),!(!Ae||Ae.length<1)&&this.updateControllerHelper(Ae,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 a=this.xrControllerRay.left,o=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var s={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},u=0;u<e.length;u++){var c=e[u].handedness,l=e[u].gamepad;switch(c){case"left":l.axes&&(this.emitEvent(l.axes[2]===-1,"LeftAxesLeft",r),this.emitEvent(l.axes[2]===1,"LeftAxesRight",r),this.emitEvent(l.axes[3]===-1,"LeftAxesUp",r),this.emitEvent(l.axes[3]===1,"LeftAxesDown",r)),l!=null&&l.buttons&&(this.emitEvent(l==null?void 0:l.buttons[4].pressed,"X",r),this.emitEvent(l.buttons[5].pressed,"Y",r),this.emitEvent(l==null?void 0:l.buttons[0].pressed,"LeftTrigger",r),this.emitEvent(l==null?void 0:l.buttons[1].pressed,"LeftPinch",r));var h={raycaster:a,axes:{up:l.axes&&l.axes[3]<0?Math.abs(l.axes[3]):0,down:l.axes&&l.axes[3]<0?0:Math.abs(l.axes[3]),left:l.axes&&l.axes[2]<0?Math.abs(l.axes[2]):0,right:l.axes&&l.axes[2]<0?0:Math.abs(l.axes[2])},deltaTime:i};s.buttons.X=l.buttons&&l.buttons[4]?l.buttons[4].pressed:!1,s.buttons.Y=l.buttons&&l.buttons[5]?l==null?void 0:l.buttons[5].pressed:!1,s.buttons.LeftTrigger=l.buttons&&l.buttons[0]?l==null?void 0:l.buttons[0].pressed:!1,s.buttons.LeftPinch=l.buttons&&l.buttons[1]?l==null?void 0:l.buttons[1].pressed:!1,s.left=h;break;case"right":l.axes&&(this.emitEvent(l.axes[2]===-1,"RightAxesLeft",r),this.emitEvent(l.axes[2]===1,"RightAxesRight",r),this.emitEvent(l.axes[3]===-1,"RightAxesUp",r),this.emitEvent(l.axes[3]===1,"RightAxesDown",r)),l.buttons&&(this.emitEvent(l==null?void 0:l.buttons[4].pressed,"A",r),this.emitEvent(l.buttons[5].pressed,"B",r),this.emitEvent(l==null?void 0:l.buttons[0].pressed,"RightTrigger",r),this.emitEvent(l==null?void 0:l.buttons[1].pressed,"RightPinch",r));var p={raycaster:o,axes:{up:l.axes&&l.axes[3]<0?Math.abs(l.axes[3]):0,down:l.axes&&l.axes[3]<0?0:Math.abs(l.axes[3]),left:l.axes&&l.axes[2]<0?Math.abs(l.axes[2]):0,right:l.axes&&l.axes[2]<0?0:Math.abs(l.axes[2])},deltaTime:i};s.right=p,s.buttons.A=l.buttons&&l.buttons[4]?l==null?void 0:l.buttons[4].pressed:!1,s.buttons.B=l.buttons&&l.buttons[5]?l==null?void 0:l.buttons[5].pressed:!1,s.buttons.RightTrigger=l.buttons&&l.buttons[0]?l==null?void 0:l.buttons[0].pressed:!1,s.buttons.RightPinch=l.buttons&&l.buttons[1]?l==null?void 0:l.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",K("xr.controller.update",s))}},t.prototype.emitEvent=function(e,r,i){var a=this.xrControllerRay.left,o=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",K("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:a,rightRay:o}}}));else{var s=i-this.xrControllerState[r].touchStartTime;s>Fs&&this.emit("xr.gesture.press",K("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:a,rightRay:o}}}))}else if(this.xrControllerState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",K("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:a,rightRay:o}}}));var s=i-this.xrControllerState[r].touchStartTime;if(s<=Fs){var u=this.emit("xr.gesture.tap",K("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:a,rightRay:o}}}));u||r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrControllerState[r].touchStart=!1,this.xrControllerState[r].touchStartTime=0}},t}(Ya),Nt={Floorplan:ai,Topview:Lf,Panorama:Ya,VRPanorama:Lh,Model:Vh,DepthPanorama:qh,Mapview:tp,XRPanorama:Ep},l0=["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 Mp(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=Tr(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 Cp(){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 Sp(n){{var t=new d.DirectionalLight(16777215,.5);t.position.copy(new d.Vector3(1,1,1)),n.add(t)}{var t=new d.DirectionalLight(16777215,.3);n.add(t)}{var t=new d.AmbientLight(16777215,.3);n.add(t)}}function Ip(n){for(var t,e,r={},i=n.split(/(\;|\,)/),a=0,o=i;a<o.length;a++){var s=o[a],u=s.split("="),c=(t=u[0])===null||t===void 0?void 0:t.trim(),l=(e=u[1])===null||e===void 0?void 0:e.trim();c&&l&&(r[c]=l)}return r}function c0(){for(var n,t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var i=Ip((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),a=Number(i["initial-scale"]);if(!isNaN(a))return a}}return 1}const Tp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQ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.5,.5,0,.5,.5,0]),Bp=new Float32Array([0,0,1,0,0,1,1,1]),Rp=new Uint8Array([0,1,2,1,3,2]),Ti=new d.BufferGeometry;Ti.setAttribute("position",new d.BufferAttribute(Pp,3));Ti.setAttribute("uv",new d.BufferAttribute(Bp,2));Ti.setIndex(new d.BufferAttribute(Rp,1));var oi=new d.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),d0=new d.Mesh(Ti,oi);d0.matrixAutoUpdate=!1;var ro=new d.Scene;ro.add(d0);ro.matrixAutoUpdate=!1;var Un=new d.OrthographicCamera(-.5,.5,.5,-.5,.1,1);Un.position.set(0,0,.5);Un.lookAt(0,0,0);Un.updateMatrixWorld(!0);Un.matrixAutoUpdate=!1;var Fp=new d.Vector4,kp=new d.Vector4;function Vs(n){if(oi.map){var r=n.getViewport(Fp),i=n.getScissor(kp),a=n.getScissorTest(),o=n.autoClear,s=i.x+Os[0]/3,u=i.y+Os[1]/3,c=Ls[0]/3,l=Ls[1]/3;n.setViewport(s,u,c,l),n.setScissor(s,u,c,l),n.setScissorTest(!0),n.autoClear=!1,n.render(ro,Un),n.setViewport(r),n.setScissor(i),n.setScissorTest(a),n.autoClear=o}else{var t=new d.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=d.ClampToEdgeWrapping,t.wrapT=d.ClampToEdgeWrapping,t.minFilter=d.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,oi.needsUpdate=!0,e.onload=Q},e.src=Tp,oi.map=t}}var Lp=800,Op=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/")},Vp=[{name:"Z",transformToUpAxisZ:function(){return new d.Matrix4}},{name:"Y",transformToUpAxisZ:function(){return new d.Matrix4().makeRotationAxis(new d.Vector3(1,0,0),+Math.PI/2)}},{name:"-Y",transformToUpAxisZ:function(){return new d.Matrix4().makeRotationAxis(new d.Vector3(1,0,0),-Math.PI/2)}},{name:"WGS84",transformToEarthCentered:function(){return new d.Matrix4}},{name:"GCJ02",transformToEarthCentered:function(){return new d.Matrix4}},{name:"BD09",transformToEarthCentered:function(){return new d.Matrix4}}],an=new d.Vector2,$n=new d.Frustum,ei=new d.Matrix4,Ns=new WeakMap,Qs=new WeakMap,Ds=Hu([]),f0=function(n){oe(t,n);function t(e){e===void 0&&(e={});var r,i,a,o,s,u,c,l,h,p,v=n.call(this)||this;v.ident=ht(),Sa.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=F({},(i=e.imageOptions)!==null&&i!==void 0?i:{}),v.textureOptions=F({},(a=e.textureOptions)!==null&&a!==void 0?a:{}),v.poweredByRealsee=(o=e.poweredByRealsee)!==null&&o!==void 0?o:!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=rt([],(s=e.coordinatesSystemTransformers)!==null&&s!==void 0?s:[],!0);for(var m=function(L){var k=A.coordinatesSystemTransformers.find(function(O){return O.name===L.name});k||A.coordinatesSystemTransformers.push(F({},L))},A=this,y=0,f=Vp;y<f.length;y++){var g=f[y];m(g)}if(v.fps={testCount:0,testTime:ve()},v.info=null,v.modeChangeDuration=(u=e.modeChangeDuration)!==null&&u!==void 0?u:Lp,v.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if(e.renderer)e.renderer instanceof Hr&&v.throwError(new Error("cannot render a internal renderer")),v.renderer=e.renderer;else try{v.renderer=new Hr({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e==null?void 0:e.webgl2});var b=c0();v.renderer.setPixelRatio(b===1?window.devicePixelRatio:1),v.renderer.setSize(512,512)}catch(L){L instanceof Error&&v.throwError(L)}v.getPixelsRenderTarget=new d.WebGLRenderTarget(1,1,{encoding:(h=(l=v.renderer)===null||l===void 0?void 0:l.outputEncoding)!==null&&h!==void 0?h:d.sRGBEncoding}),v.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),v.camera=new di(90),v.scene=new iu,v.xrCustomObjectsScene=new d.Scene,v.scene.add(v.xrCustomObjectsScene),v.scene.matrixAutoUpdate=!1,v.lastLoadWorkTask=Promise.resolve(),v.requestProxy=(p=e.requestProxy)!==null&&p!==void 0?p:Op,v.networkSubscribe=new Ws,v.networkSubscribe.on("network",function(L,k,O,N){var D;v.emit("network.resource",K("network.resource",{source:L,requestType:k,requestState:O,detail:N})),(D=v.analysis)===null||D===void 0||D.network(v.works,L,k,O,N)}),v.boundingMesh=Cf(new d.Box3(new d.Vector3(-.5,-.5,-.5),new d.Vector3(.5,.5,.5))),v.boundingMesh.name="bounding",v.scene.add(v.boundingMesh),v.models=cs(),v.models.push(new xa),v.lastModels=cs(),v.readyCallbacks=[],v.syncingState=!1,v.modelGroup=new d.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 d.Group,v.helperGroup.name="helper",v.helperGroup.matrixAutoUpdate=!1,v.scene.add(v.helperGroup),v.videoTexture=new d.VideoTexture(e.videoInstance||Cp()),Sp(v.scene),v.copyEffect=new Si(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=ft.shared.add(function(L,k){for(var O=[],N=2;N<arguments.length;N++)O[N-2]=arguments[N];v.updateTime.apply(v,rt([L,k],O,!1))},!1,0,10));var x=function(){typeof document!="undefined"&&document.fullscreenElement===null&&v.currentMode==="VRPanorama"&&v.controller.emit("vr.requestExit",K("vr.requestExit",{}))},w=function(){v.needsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",x,!1),v.renderer&&v.renderer.domElement.addEventListener("webglcontextrestored",w,!1),v.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",x,!1),v.renderer&&v.renderer.domElement.removeEventListener("webglcontextrestored",w,!1)},v.plugins={},e.plugins&&e.plugins.length)for(var E=0,M=e.plugins;E<M.length;E++){var C=M[E];if(typeof C=="function")C(v);else if(Array.isArray(C)){var S=C[0],P=C[1],I=C[2];if(typeof S=="function"){var B=S(v,I);typeof P=="string"&&(v.plugins[P]?v.throwError(new Error("plugin name ".concat(P," is exists."))):v.plugins[P]=B)}}}return v.gpuPickingRenderTarget=new d.WebGLRenderTarget(1,1),v.meshReplaceMaterialMap=new Map,v.meshOriginMaterialMap=new Map,Mp(v),v}return Object.defineProperty(t,"version",{get:function(){return"6.0.0-alpha.76"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return vi.decoderPath},set:function(e){vi.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return Fn.transcoderPath},set:function(e){Fn.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,a,o){var s=this;if(a===void 0&&(a=1),o===void 0&&(o=new d.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.models.setMaterial({constantColor:o}),this.scene.traverse(function(h){if(!(!(h instanceof d.Mesh)||h instanceof Gt)){var p=Object.keys(i).filter(function(m){return m===h.uuid})[0];if(p)if(s.meshOriginMaterialMap.set(p,h.material),s.meshReplaceMaterialMap.get(p))h.material=s.meshReplaceMaterialMap.get(p);else{var v=new d.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;