@file-viewer/renderer-3d 3.3.3 → 3.3.5

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.
@@ -1,10 +1,10 @@
1
- var mc=Object.create;var Us=Object.defineProperty;var gc=Object.getOwnPropertyDescriptor;var _c=Object.getOwnPropertyNames;var yc=Object.getPrototypeOf,vc=Object.prototype.hasOwnProperty;var Ns=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var te=(s,e)=>()=>{try{return e||s((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var xc=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _c(e))!vc.call(s,i)&&i!==t&&Us(s,i,{get:()=>e[i],enumerable:!(n=gc(e,i))||n.enumerable});return s};var On=(s,e,t)=>(t=s!=null?mc(yc(s)):{},xc(e||!s||!s.__esModule?Us(t,"default",{value:s,enumerable:!0}):t,s));var Os=te(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0})});var Bs=te(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.Hierarchy=void 0;Bn.Hierarchy={parse:Sc};function Sc(s){return Object.entries(s).reduce((e,[t,n])=>(n===-1?e.pages[t]={}:n&&(e.nodes[t]={pointCount:n}),e),{nodes:{},pages:{}})}});var Vs=te(ht=>{"use strict";var bc=ht&&ht.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),zs=ht&&ht.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&bc(e,s,t)};Object.defineProperty(ht,"__esModule",{value:!0});zs(Os(),ht);zs(Bs(),ht)});var zn=te(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.hierarchyItemLength=zt.infoLength=void 0;zt.infoLength=160;zt.hierarchyItemLength=32});var Vn=te(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.evlrHeaderLength=ft.vlrHeaderLength=ft.minHeaderLength=void 0;ft.minHeaderLength=375;ft.vlrHeaderLength=54;ft.evlrHeaderLength=60});var ks=te(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.getBigUint64=Vt.parseBigInt=void 0;function Mc(s){if(s>BigInt(Number.MAX_SAFE_INTEGER)||s<BigInt(-Number.MAX_SAFE_INTEGER))throw new Error(`Cannot convert bigint to number: ${s}`);return Number(s)}Vt.parseBigInt=Mc;function wc(s,e,t){if(s.getBigUint64)return s.getBigUint64(e,t);let[n,i]=t?[4,0]:[0,4],r=BigInt(s.getUint32(e+n,t)),l=BigInt(s.getUint32(e+i,t));return(r<<BigInt(32))+l}Vt.getBigUint64=wc});var Ki=te(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.toCString=dt.toDataView=dt.Binary=void 0;dt.Binary={toDataView:ji,toCString:Gs};function ji(s){return new DataView(s.buffer,s.byteOffset,s.length)}dt.toDataView=ji;function Gs(s){let e=ji(s),t="";for(let n=0;n<e.byteLength;++n){let i=e.getInt8(n);if(i===0)return t;t+=String.fromCharCode(i)}return t}dt.toCString=Gs});var Ys=te(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.Bounds=void 0;kn.Bounds={min:Tc,max:Ec,mid:Qi,width:Hs,depth:Ws,height:Xs,cube:Ac,step:qs,stepTo:Cc,intersection:Rc};function Tc(s){return[s[0],s[1],s[2]]}function Ec(s){return[s[3],s[4],s[5]]}function Qi([s,e,t,n,i,r]){return[s+(n-s)/2,e+(i-e)/2,t+(r-t)/2]}function Hs(s){return s[3]-s[0]}function Ws(s){return s[4]-s[1]}function Xs(s){return s[5]-s[2]}function Ac(s){let e=Qi(s),t=Math.max(Hs(s),Ws(s),Xs(s))/2;return[e[0]-t,e[1]-t,e[2]-t,e[0]+t,e[1]+t,e[2]+t]}function qs(s,[e,t,n]){let[i,r,l,c,h,u]=s,[d,p,g]=Qi(s);return[e?d:i,t?p:r,n?g:l,e?c:d,t?h:p,n?u:g]}function Cc(s,[e,t,n,i]){for(let r=e-1;r>=0;--r)s=qs(s,[t>>r&1,n>>r&1,i>>r&1]);return s}function Rc(s,e){return[Math.max(s[0],e[0]),Math.max(s[1],e[1]),Math.max(s[2],e[2]),Math.min(s[3],e[3]),Math.min(s[4],e[4]),Math.min(s[5],e[5])]}});var $s=te(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.Dimension=void 0;var Pc={int8:{type:"signed",size:1},int16:{type:"signed",size:2},int32:{type:"signed",size:4},int64:{type:"signed",size:8},uint8:{type:"unsigned",size:1},uint16:{type:"unsigned",size:2},uint32:{type:"unsigned",size:4},uint64:{type:"unsigned",size:8},float32:{type:"float",size:4},float64:{type:"float",size:8},float:{type:"float",size:4},double:{type:"float",size:8},bool:{type:"unsigned",size:1},boolean:{type:"unsigned",size:1}};Gn.Dimension={Type:Pc,ctype:Ic};function Ic({type:s,size:e}){switch(s){case"signed":switch(e){case 1:return"int8";case 2:return"int16";case 4:return"int32";case 8:return"int64"}case"unsigned":switch(e){case 1:return"uint8";case 2:return"uint16";case 4:return"uint32";case 8:return"uint64"}case"float":switch(e){case 4:return"float";case 8:return"double"}}throw new Error(`Invalid dimension type/size: ${s}/${e}`)}});var Js=te((pt,Zs)=>{var Hn=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,Wn=(function(){function s(){this.fetch=!1,this.DOMException=Hn.DOMException}return s.prototype=Hn,new s})();(function(s){var e=(function(t){var n=typeof s<"u"&&s||typeof self<"u"&&self||typeof global<"u"&&global||{},i={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function r(_){return _&&DataView.prototype.isPrototypeOf(_)}if(i.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(_){return _&&l.indexOf(Object.prototype.toString.call(_))>-1};function h(_){if(typeof _!="string"&&(_=String(_)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(_)||_==="")throw new TypeError('Invalid character in header field name: "'+_+'"');return _.toLowerCase()}function u(_){return typeof _!="string"&&(_=String(_)),_}function d(_){var T={next:function(){var D=_.shift();return{done:D===void 0,value:D}}};return i.iterable&&(T[Symbol.iterator]=function(){return T}),T}function p(_){this.map={},_ instanceof p?_.forEach(function(T,D){this.append(D,T)},this):Array.isArray(_)?_.forEach(function(T){if(T.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+T.length);this.append(T[0],T[1])},this):_&&Object.getOwnPropertyNames(_).forEach(function(T){this.append(T,_[T])},this)}p.prototype.append=function(_,T){_=h(_),T=u(T);var D=this.map[_];this.map[_]=D?D+", "+T:T},p.prototype.delete=function(_){delete this.map[h(_)]},p.prototype.get=function(_){return _=h(_),this.has(_)?this.map[_]:null},p.prototype.has=function(_){return this.map.hasOwnProperty(h(_))},p.prototype.set=function(_,T){this.map[h(_)]=u(T)},p.prototype.forEach=function(_,T){for(var D in this.map)this.map.hasOwnProperty(D)&&_.call(T,this.map[D],D,this)},p.prototype.keys=function(){var _=[];return this.forEach(function(T,D){_.push(D)}),d(_)},p.prototype.values=function(){var _=[];return this.forEach(function(T){_.push(T)}),d(_)},p.prototype.entries=function(){var _=[];return this.forEach(function(T,D){_.push([D,T])}),d(_)},i.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function g(_){if(!_._noBody){if(_.bodyUsed)return Promise.reject(new TypeError("Already read"));_.bodyUsed=!0}}function y(_){return new Promise(function(T,D){_.onload=function(){T(_.result)},_.onerror=function(){D(_.error)}})}function v(_){var T=new FileReader,D=y(T);return T.readAsArrayBuffer(_),D}function M(_){var T=new FileReader,D=y(T),k=/charset=([A-Za-z0-9_-]+)/.exec(_.type),G=k?k[1]:"utf-8";return T.readAsText(_,G),D}function b(_){for(var T=new Uint8Array(_),D=new Array(T.length),k=0;k<T.length;k++)D[k]=String.fromCharCode(T[k]);return D.join("")}function S(_){if(_.slice)return _.slice(0);var T=new Uint8Array(_.byteLength);return T.set(new Uint8Array(_)),T.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(_){this.bodyUsed=this.bodyUsed,this._bodyInit=_,_?typeof _=="string"?this._bodyText=_:i.blob&&Blob.prototype.isPrototypeOf(_)?this._bodyBlob=_:i.formData&&FormData.prototype.isPrototypeOf(_)?this._bodyFormData=_:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(_)?this._bodyText=_.toString():i.arrayBuffer&&i.blob&&r(_)?(this._bodyArrayBuffer=S(_.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(_)||c(_))?this._bodyArrayBuffer=S(_):this._bodyText=_=Object.prototype.toString.call(_):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof _=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(_)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var _=g(this);if(_)return _;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var _=g(this);return _||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(i.blob)return this.blob().then(v);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var _=g(this);if(_)return _;if(this._bodyBlob)return M(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(b(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(V)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function B(_){var T=_.toUpperCase();return L.indexOf(T)>-1?T:_}function C(_,T){if(!(this instanceof C))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');T=T||{};var D=T.body;if(_ instanceof C){if(_.bodyUsed)throw new TypeError("Already read");this.url=_.url,this.credentials=_.credentials,T.headers||(this.headers=new p(_.headers)),this.method=_.method,this.mode=_.mode,this.signal=_.signal,!D&&_._bodyInit!=null&&(D=_._bodyInit,_.bodyUsed=!0)}else this.url=String(_);if(this.credentials=T.credentials||this.credentials||"same-origin",(T.headers||!this.headers)&&(this.headers=new p(T.headers)),this.method=B(T.method||this.method||"GET"),this.mode=T.mode||this.mode||null,this.signal=T.signal||this.signal||(function(){if("AbortController"in n){var Y=new AbortController;return Y.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(D),(this.method==="GET"||this.method==="HEAD")&&(T.cache==="no-store"||T.cache==="no-cache")){var k=/([?&])_=[^&]*/;if(k.test(this.url))this.url=this.url.replace(k,"$1_="+new Date().getTime());else{var G=/\?/;this.url+=(G.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function V(_){var T=new FormData;return _.trim().split("&").forEach(function(D){if(D){var k=D.split("="),G=k.shift().replace(/\+/g," "),Y=k.join("=").replace(/\+/g," ");T.append(decodeURIComponent(G),decodeURIComponent(Y))}}),T}function O(_){var T=new p,D=_.replace(/\r?\n[\t ]+/g," ");return D.split("\r").map(function(k){return k.indexOf(`
2
- `)===0?k.substr(1,k.length):k}).forEach(function(k){var G=k.split(":"),Y=G.shift().trim();if(Y){var U=G.join(":").trim();try{T.append(Y,U)}catch(ge){console.warn("Response "+ge.message)}}}),T}R.call(C.prototype);function W(_,T){if(!(this instanceof W))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(T||(T={}),this.type="default",this.status=T.status===void 0?200:T.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=T.statusText===void 0?"":""+T.statusText,this.headers=new p(T.headers),this.url=T.url||"",this._initBody(_)}R.call(W.prototype),W.prototype.clone=function(){return new W(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},W.error=function(){var _=new W(null,{status:200,statusText:""});return _.ok=!1,_.status=0,_.type="error",_};var $=[301,302,303,307,308];W.redirect=function(_,T){if($.indexOf(T)===-1)throw new RangeError("Invalid status code");return new W(null,{status:T,headers:{location:_}})},t.DOMException=n.DOMException;try{new t.DOMException}catch{t.DOMException=function(T,D){this.message=T,this.name=D;var k=Error(T);this.stack=k.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function j(_,T){return new Promise(function(D,k){var G=new C(_,T);if(G.signal&&G.signal.aborted)return k(new t.DOMException("Aborted","AbortError"));var Y=new XMLHttpRequest;function U(){Y.abort()}Y.onload=function(){var K={statusText:Y.statusText,headers:O(Y.getAllResponseHeaders()||"")};G.url.indexOf("file://")===0&&(Y.status<200||Y.status>599)?K.status=200:K.status=Y.status,K.url="responseURL"in Y?Y.responseURL:K.headers.get("X-Request-URL");var ue="response"in Y?Y.response:Y.responseText;setTimeout(function(){D(new W(ue,K))},0)},Y.onerror=function(){setTimeout(function(){k(new TypeError("Network request failed"))},0)},Y.ontimeout=function(){setTimeout(function(){k(new TypeError("Network request timed out"))},0)},Y.onabort=function(){setTimeout(function(){k(new t.DOMException("Aborted","AbortError"))},0)};function ge(K){try{return K===""&&n.location.href?n.location.href:K}catch{return K}}if(Y.open(G.method,ge(G.url),!0),G.credentials==="include"?Y.withCredentials=!0:G.credentials==="omit"&&(Y.withCredentials=!1),"responseType"in Y&&(i.blob?Y.responseType="blob":i.arrayBuffer&&(Y.responseType="arraybuffer")),T&&typeof T.headers=="object"&&!(T.headers instanceof p||n.Headers&&T.headers instanceof n.Headers)){var ve=[];Object.getOwnPropertyNames(T.headers).forEach(function(K){ve.push(h(K)),Y.setRequestHeader(K,u(T.headers[K]))}),G.headers.forEach(function(K,ue){ve.indexOf(ue)===-1&&Y.setRequestHeader(ue,K)})}else G.headers.forEach(function(K,ue){Y.setRequestHeader(ue,K)});G.signal&&(G.signal.addEventListener("abort",U),Y.onreadystatechange=function(){Y.readyState===4&&G.signal.removeEventListener("abort",U)}),Y.send(typeof G._bodyInit>"u"?null:G._bodyInit)})}return j.polyfill=!0,n.fetch||(n.fetch=j,n.Headers=p,n.Request=C,n.Response=W),t.Headers=p,t.Request=C,t.Response=W,t.fetch=j,Object.defineProperty(t,"__esModule",{value:!0}),t})({})})(Wn);Wn.fetch.ponyfill=!0;delete Wn.fetch.polyfill;var kt=Hn.fetch?Hn:Wn;pt=kt.fetch;pt.default=kt.fetch;pt.fetch=kt.fetch;pt.Headers=kt.Headers;pt.Request=kt.Request;pt.Response=kt.Response;Zs.exports=pt});var js=te(()=>{});var ea=te(Be=>{"use strict";var Lc=Be&&Be.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Dc=Be&&Be.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Uc=Be&&Be.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Lc(e,s,t);return Dc(e,s),e},Nc=Be&&Be.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Be,"__esModule",{value:!0});Be.Getter=void 0;var Fc=Nc(Js());Be.Getter={create:Oc,http:Ks,file:Qs};function Oc(s){return typeof s=="function"?s:s.startsWith("http://")||s.startsWith("https://")?Ks(s):Qs(s)}function Ks(s){return async function(t,n){if(t<0||n<0||t>n)throw new Error("Invalid range");let r=await(await(0,Fc.default)(s,{headers:{Range:`bytes=${t}-${n-1}`}})).arrayBuffer();return new Uint8Array(r)}}function Qs(s){return async function(t,n){let i=await Promise.resolve().then(()=>Uc(js()));async function r(l=0,c=1/0){if(l<0||c<0||l>c)throw new Error("Invalid range");await i.promises.access(s);let h=i.createReadStream(s,{start:l,end:c-1,autoClose:!0});return Bc(h)}return r(t,n)}}async function Bc(s){return await new Promise((e,t)=>{let n=[];s.on("data",i=>n.push(i)),s.on("error",t),s.on("end",()=>e(Buffer.concat(n)))})}});var na=te(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.Key=void 0;Gt.Key={create:zc,parse:ta,toString:Vc,step:kc,up:Gc,compare:Hc,depth:Wc};function zc(s,e=0,t=0,n=0){return typeof s!="number"?ta(s):[s,e,t,n]}function ta(s){if(typeof s!="string")return s;let[e,t,n,i,...r]=s.split("-").map(c=>parseInt(c,10)),l=[e,t,n,i];if(r.length!==0||l.some(c=>typeof c!="number"||Number.isNaN(c)))throw new Error(`Invalid key: ${s}`);return l}function Vc(s){return typeof s=="string"?s:s.join("-")}function kc(s,[e,t,n]){let[i,r,l,c]=Gt.Key.create(s);return[i+1,r*2+e,l*2+t,c*2+n]}function Gc(s,e=1){let[t,n,i,r]=Gt.Key.create(s);return[t-e,n>>e,i>>e,r>>e]}function Hc(s,e){for(let t=0;t<s.length;++t){if(s[t]<e[t])return-1;if(s[t]>e[t])return 1}return 0}function Wc(s){return s[0]}});var ia=te(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.Scale=void 0;Xn.Scale={apply:(s,e=1,t=0)=>(s-t)/e,unapply:(s,e=1,t=0)=>s*e+t}});var ra=te(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.Step=void 0;qn.Step={fromIndex:Xc,list:qc};function Xc(s){if(s<0||s>=8)throw new Error(`Invalid step index: ${s}`);let e=s>>0&1?1:0,t=s>>1&1?1:0,n=s>>2&1?1:0;return[e,t,n]}function qc(){return[[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]]}});var ze=te(fe=>{"use strict";var Yc=fe&&fe.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),$c=fe&&fe.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Yc(e,s,t)};Object.defineProperty(fe,"__esModule",{value:!0});fe.Step=fe.Scale=fe.Key=fe.Getter=fe.Dimension=fe.Bounds=fe.Binary=void 0;$c(ks(),fe);var Zc=Ki();Object.defineProperty(fe,"Binary",{enumerable:!0,get:function(){return Zc.Binary}});var Jc=Ys();Object.defineProperty(fe,"Bounds",{enumerable:!0,get:function(){return Jc.Bounds}});var jc=$s();Object.defineProperty(fe,"Dimension",{enumerable:!0,get:function(){return jc.Dimension}});var Kc=ea();Object.defineProperty(fe,"Getter",{enumerable:!0,get:function(){return Kc.Getter}});var Qc=na();Object.defineProperty(fe,"Key",{enumerable:!0,get:function(){return Qc.Key}});var eu=ia();Object.defineProperty(fe,"Scale",{enumerable:!0,get:function(){return eu.Scale}});var tu=ra();Object.defineProperty(fe,"Step",{enumerable:!0,get:function(){return tu.Step}})});var er=te($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.ExtraBytes=void 0;var Se=ze();$n.ExtraBytes={getDimension:nu,parse:iu,parseOne:sa};var Yn=192;function nu({type:s,length:e}){switch(s){case"signed":case"unsigned":switch(e){case 1:case 2:case 4:case 8:return{type:s,size:e}}case"float":switch(e){case 4:case 8:return{type:s,size:e}}}}function iu(s){if(s.byteLength%Yn!==0)throw new Error(`Invalid extra bytes VLR length: ${s.byteLength}`);let e=[];for(let t=0;t<s.byteLength;t+=Yn)e.push(sa(s.slice(t,t+Yn)));return e}function sa(s){if(s.byteLength!==Yn)throw new Error(`Invalid extra bytes entry length: ${s.byteLength}`);let e=Se.Binary.toDataView(s),t=Se.Binary.toCString(s.slice(4,36)),n=Se.Binary.toCString(s.slice(60,192)),i=e.getUint8(2),r=e.getUint8(3);if(i>=11)throw new Error(`Invalid extra bytes "type" value: ${i}`);if(i===0)return{name:t,description:n,length:r};let l=su(r),c=ru(i);if(!c)throw new Error(`Failed to extract dimension type: ${i}`);let{type:h,size:u}=c;function d(g){switch(h){case"signed":return(0,Se.parseBigInt)(e.getBigInt64(g,!0));case"unsigned":return(0,Se.parseBigInt)((0,Se.getBigUint64)(e,g,!0));case"float":return e.getFloat64(g,!0)}}let p={name:t,description:n,type:h,length:u};return l.hasNodata&&(p.nodata=d(40)),l.hasMin&&(p.min=d(64)),l.hasMax&&(p.max=d(88)),l.hasScale&&(p.scale=e.getFloat64(112)),l.hasOffset&&(p.offset=e.getFloat64(136)),p}function ru(s){switch(s){case 1:return Se.Dimension.Type.uint8;case 2:return Se.Dimension.Type.int8;case 3:return Se.Dimension.Type.uint16;case 4:return Se.Dimension.Type.int16;case 5:return Se.Dimension.Type.uint32;case 6:return Se.Dimension.Type.int32;case 7:return Se.Dimension.Type.uint64;case 8:return Se.Dimension.Type.int64;case 9:return Se.Dimension.Type.float32;case 10:return Se.Dimension.Type.float64}}function su(s){return{hasNodata:!!(s&1),hasMin:!!(s>>1&1),hasMax:!!(s>>2&1),hasScale:!!(s>>3&1),hasOffset:!!(s>>4&1)}}});var tr=te(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.Dimensions=void 0;var au=ze(),ou=er();Zn.Dimensions={create:cu};var{Type:he}=au.Dimension,lu={X:he.float64,Y:he.float64,Z:he.float64,Intensity:he.uint16,ReturnNumber:he.uint8,NumberOfReturns:he.uint8,ScanDirectionFlag:he.boolean,EdgeOfFlightLine:he.boolean,Classification:he.uint8,Synthetic:he.boolean,KeyPoint:he.boolean,Withheld:he.boolean,Overlap:he.boolean,ScanAngle:he.float32,UserData:he.uint8,PointSourceId:he.uint16,GpsTime:he.float64,Red:he.uint16,Green:he.uint16,Blue:he.uint16,ScannerChannel:he.uint8,Infrared:he.uint16};function cu(s,e=[]){return Object.keys(s).reduce((t,n)=>{let i=lu[n];if(i)return{...t,[n]:i};let r=e.find(c=>c.name===n),l=r&&ou.ExtraBytes.getDimension(r);if(l)return{...t,[n]:l};throw new Error(`Failed to look up LAS type: ${n}`)},{})}});var nr=te(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.Extractor=void 0;var Je=ze();jn.Extractor={create:du};function uu(s){switch(s){case 0:return 20;case 1:return 28;case 2:return 26;case 3:return 34;case 6:return 30;case 7:return 36;case 8:return 38;default:throw new Error(`Unsupported point data record format: ${s}`)}}function hu(s,e,{type:t,length:n}){let i=mt(s);switch(t){case"signed":switch(n){case 1:return(r,l)=>r.getInt8(i(l)+e);case 2:return(r,l)=>r.getInt16(i(l)+e,!0);case 4:return(r,l)=>r.getInt32(i(l)+e,!0);case 8:return(r,l)=>(0,Je.parseBigInt)(r.getBigInt64(i(l)+e,!0))}case"unsigned":switch(n){case 1:return(r,l)=>r.getUint8(i(l)+e);case 2:return(r,l)=>r.getUint16(i(l)+e,!0);case 4:return(r,l)=>r.getUint32(i(l)+e,!0);case 8:return(r,l)=>(0,Je.parseBigInt)((0,Je.getBigUint64)(r,i(l)+e,!0))}case"float":switch(n){case 4:return(r,l)=>r.getFloat32(i(l)+e,!0);case 8:return(r,l)=>r.getFloat64(i(l)+e,!0)}}}function fu(s,e){let n=uu(s.pointDataRecordFormat);return e.reduce((i,r)=>{let l=n;n+=r.length;let c=hu(s,l,r);if(!c)return i;let h=(u,d)=>Je.Scale.unapply(c(u,d),r.scale,r.offset);return{...i,[r.name]:h}},{})}function du(s,e=[]){let t=fu(s,e);return{...(()=>{let{pointDataRecordFormat:i}=s;switch(i){case 0:return Jn(s);case 1:return pu(s);case 2:return mu(s);case 3:return gu(s);case 6:return aa(s);case 7:return oa(s);case 8:return _u(s);default:throw new Error(`Unsupported point data record format: ${i}`)}})(),...t}}function Jn(s){let{scale:e,offset:t}=s,n=mt(s);function i(c,h){return c.getUint8(n(h)+14)}function r(c,h){return c.getUint8(n(h)+15)}function l(c,h){return r(c,h)&31}return{X:(c,h)=>Je.Scale.unapply(c.getInt32(n(h),!0),e[0],t[0]),Y:(c,h)=>Je.Scale.unapply(c.getInt32(n(h)+4,!0),e[1],t[1]),Z:(c,h)=>Je.Scale.unapply(c.getInt32(n(h)+8,!0),e[2],t[2]),Intensity:(c,h)=>c.getUint16(n(h)+12,!0),ReturnNumber:(c,h)=>i(c,h)&7,NumberOfReturns:(c,h)=>(i(c,h)&56)>>3,ScanDirectionFlag:(c,h)=>(i(c,h)&64)>>6,EdgeOfFlightLine:(c,h)=>(i(c,h)&128)>>7,Classification:(c,h)=>{let u=l(c,h);return u===12?0:u},Synthetic:(c,h)=>(r(c,h)&32)>>5,KeyPoint:(c,h)=>(r(c,h)&64)>>6,Withheld:(c,h)=>(r(c,h)&128)>>7,Overlap:(c,h)=>l(c,h)===12?1:0,ScanAngle:(c,h)=>c.getInt8(n(h)+16),UserData:(c,h)=>c.getUint8(n(h)+17),PointSourceId:(c,h)=>c.getUint16(n(h)+18,!0)}}function pu(s){let e=mt(s);return{...Jn(s),GpsTime:(t,n)=>t.getFloat64(e(n)+20,!0)}}function mu(s){let e=mt(s);return{...Jn(s),Red:(t,n)=>t.getUint16(e(n)+20,!0),Green:(t,n)=>t.getUint16(e(n)+22,!0),Blue:(t,n)=>t.getUint16(e(n)+24,!0)}}function gu(s){let e=mt(s);return{...Jn(s),GpsTime:(t,n)=>t.getFloat64(e(n)+20,!0),Red:(t,n)=>t.getUint16(e(n)+28,!0),Green:(t,n)=>t.getUint16(e(n)+30,!0),Blue:(t,n)=>t.getUint16(e(n)+32,!0)}}function aa(s){let{scale:e,offset:t}=s,n=mt(s);function i(r,l){return r.getUint8(n(l)+15)}return{X:(r,l)=>Je.Scale.unapply(r.getInt32(n(l),!0),e[0],t[0]),Y:(r,l)=>Je.Scale.unapply(r.getInt32(n(l)+4,!0),e[1],t[1]),Z:(r,l)=>Je.Scale.unapply(r.getInt32(n(l)+8,!0),e[2],t[2]),Intensity:(r,l)=>r.getUint16(n(l)+12,!0),ReturnNumber:(r,l)=>r.getUint16(n(l)+14,!0)&15,NumberOfReturns:(r,l)=>(r.getUint16(n(l)+14,!0)&240)>>4,Synthetic:(r,l)=>i(r,l)&1,KeyPoint:(r,l)=>(i(r,l)&2)>>1,Withheld:(r,l)=>(i(r,l)&4)>>2,Overlap:(r,l)=>(i(r,l)&8)>>3,ScannerChannel:(r,l)=>(i(r,l)&48)>>4,ScanDirectionFlag:(r,l)=>(i(r,l)&64)>>6,EdgeOfFlightLine:(r,l)=>(i(r,l)&128)>>7,Classification:(r,l)=>r.getUint8(n(l)+16),UserData:(r,l)=>r.getUint8(n(l)+17),ScanAngle:(r,l)=>r.getInt16(n(l)+18,!0)*.006,PointSourceId:(r,l)=>r.getUint16(n(l)+20,!0),GpsTime:(r,l)=>r.getFloat64(n(l)+22,!0)}}function oa(s){let e=mt(s);return{...aa(s),Red:(t,n)=>t.getUint16(e(n)+30,!0),Green:(t,n)=>t.getUint16(e(n)+32,!0),Blue:(t,n)=>t.getUint16(e(n)+34,!0)}}function _u(s){let e=mt(s);return{...oa(s),Infrared:(t,n)=>t.getUint16(e(n)+36,!0)}}function mt(s){let{pointDataRecordLength:e}=s;return function(n){return n*e}}});var ca=te(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.formatGuid=Ht.parsePoint=void 0;var la=ze();function yu(s){let e=la.Binary.toDataView(s);if(e.byteLength!==24)throw new Error(`Invalid tuple buffer length: ${e.byteLength}`);return[e.getFloat64(0,!0),e.getFloat64(8,!0),e.getFloat64(16,!0)]}Ht.parsePoint=yu;function vu(s){let e=la.Binary.toDataView(s);if(e.byteLength!==16)throw new Error(`Invalid GUID buffer length: ${e.byteLength}`);let t="";for(let n=0;n<e.byteLength;n+=4){let i=e.getUint32(n,!0);t+=i.toString(16).padStart(8,"0")}return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,32)].join("-")}Ht.formatGuid=vu});var rr=te(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.Header=void 0;var Ie=ze(),ua=Vn(),ir=ca();Kn.Header={parse:xu};function xu(s){if(s.byteLength<ua.minHeaderLength)throw new Error(`Invalid header: must be at least ${ua.minHeaderLength} bytes`);let e=Ie.Binary.toDataView(s),t=Ie.Binary.toCString(s.slice(0,4));if(t!=="LASF")throw new Error(`Invalid file signature: ${t}`);let n=e.getUint8(24),i=e.getUint8(25);if(n!==1||i!==2&&i!==4)throw new Error(`Invalid version (only 1.2 and 1.4 supported): ${n}.${i}`);let r={fileSignature:t,fileSourceId:e.getUint16(4,!0),globalEncoding:e.getUint16(6,!0),projectId:(0,ir.formatGuid)(s.slice(8,24)),majorVersion:n,minorVersion:i,systemIdentifier:Ie.Binary.toCString(s.slice(26,58)),generatingSoftware:Ie.Binary.toCString(s.slice(58,90)),fileCreationDayOfYear:e.getUint16(90,!0),fileCreationYear:e.getUint16(92,!0),headerLength:e.getUint16(94,!0),pointDataOffset:e.getUint32(96,!0),vlrCount:e.getUint32(100,!0),pointDataRecordFormat:e.getUint8(104)&15,pointDataRecordLength:e.getUint16(105,!0),pointCount:e.getUint32(107,!0),pointCountByReturn:bu(s.slice(111,131)),scale:(0,ir.parsePoint)(s.slice(131,155)),offset:(0,ir.parsePoint)(s.slice(155,179)),min:[e.getFloat64(187,!0),e.getFloat64(203,!0),e.getFloat64(219,!0)],max:[e.getFloat64(179,!0),e.getFloat64(195,!0),e.getFloat64(211,!0)],waveformDataOffset:0,evlrOffset:0,evlrCount:0};return i==2?r:{...r,pointCount:(0,Ie.parseBigInt)((0,Ie.getBigUint64)(e,247,!0)),pointCountByReturn:Su(s.slice(255,375)),waveformDataOffset:(0,Ie.parseBigInt)((0,Ie.getBigUint64)(e,227,!0)),evlrOffset:(0,Ie.parseBigInt)((0,Ie.getBigUint64)(e,235,!0)),evlrCount:e.getUint32(243,!0)}}function Su(s){let e=Ie.Binary.toDataView(s),t=[];for(let n=0;n<120;n+=8)t.push((0,Ie.getBigUint64)(e,n,!0));return t.map(n=>(0,Ie.parseBigInt)(n))}function bu(s){let e=Ie.Binary.toDataView(s),t=[];for(let n=0;n<20;n+=4)t.push(e.getUint32(n,!0));return t}});var ha=te((Qn,ar)=>{var sr=(()=>{var s=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return(function(e){e=e||{};var t=typeof e<"u"?e:{},n,i;t.ready=new Promise(function(a,o){n=a,i=o}),["_main","___getTypeName","__embind_initialize_bindings","_fflush","onRuntimeInitialized"].forEach(a=>{Object.getOwnPropertyDescriptor(t.ready,a)||Object.defineProperty(t.ready,a,{get:()=>Re("You are getting "+a+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"),set:()=>Re("You are setting "+a+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")})});var r=Object.assign({},t),l=[],c="./this.program",h=(a,o)=>{throw o},u=!0,d=!1,p=!1,g=!1;if(t.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");var y="";function v(a){return t.locateFile?t.locateFile(a,y):y+a}var M,b,S,R;function L(a){if(a instanceof Po)return;let o=a;a&&typeof a=="object"&&a.stack&&(o=[a,a.stack]),C("exiting due to exception: "+o)}if(g){if(typeof process=="object"&&typeof Ns=="function"||typeof window=="object"||typeof importScripts=="function")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");typeof read<"u"&&(M=function(o){return read(o)}),S=function(o){let f;return typeof readbuffer=="function"?new Uint8Array(readbuffer(o)):(f=read(o,"binary"),U(typeof f=="object"),f)},b=function(o,f,m){setTimeout(()=>f(S(o)),0)},typeof scriptArgs<"u"?l=scriptArgs:typeof arguments<"u"&&(l=arguments),typeof quit=="function"&&(h=(a,o)=>{L(o),quit(a)}),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)}else if(u||d){if(d?y=self.location.href:typeof document<"u"&&document.currentScript&&(y=document.currentScript.src),s&&(y=s),y.indexOf("blob:")!==0?y=y.substr(0,y.replace(/[?#].*/,"").lastIndexOf("/")+1):y="",!(typeof window=="object"||typeof importScripts=="function"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");M=a=>{var o=new XMLHttpRequest;return o.open("GET",a,!1),o.send(null),o.responseText},d&&(S=a=>{var o=new XMLHttpRequest;return o.open("GET",a,!1),o.responseType="arraybuffer",o.send(null),new Uint8Array(o.response)}),b=(a,o,f)=>{var m=new XMLHttpRequest;m.open("GET",a,!0),m.responseType="arraybuffer",m.onload=()=>{if(m.status==200||m.status==0&&m.response){o(m.response);return}f()},m.onerror=f,m.send(null)},R=a=>document.title=a}else throw new Error("environment detection error");var B=t.print||console.log.bind(console),C=t.printErr||console.warn.bind(console);Object.assign(t,r),r=null,rc(),t.arguments&&(l=t.arguments),O("arguments","arguments_"),t.thisProgram&&(c=t.thisProgram),O("thisProgram","thisProgram"),t.quit&&(h=t.quit),O("quit","quit_"),U(typeof t.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),U(typeof t.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),U(typeof t.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),U(typeof t.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),U(typeof t.read>"u","Module.read option was removed (modify read_ in JS)"),U(typeof t.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),U(typeof t.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),U(typeof t.setWindowTitle>"u","Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),U(typeof t.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),O("read","read_"),O("readAsync","readAsync"),O("readBinary","readBinary"),O("setWindowTitle","setWindowTitle"),U(!d,"worker environment detected but not enabled at build time. Add 'worker' to `-sENVIRONMENT` to enable."),U(!p,"node environment detected but not enabled at build time. Add 'node' to `-sENVIRONMENT` to enable."),U(!g,"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");var V=4;function O(a,o){Object.getOwnPropertyDescriptor(t,a)||Object.defineProperty(t,a,{configurable:!0,get:function(){Re("Module."+a+" has been replaced with plain "+o+" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}})}function W(a){Object.getOwnPropertyDescriptor(t,a)&&Re("`Module."+a+"` was supplied but `"+a+"` not included in INCOMING_MODULE_JS_API")}function $(a){return a==="FS_createPath"||a==="FS_createDataFile"||a==="FS_createPreloadedFile"||a==="FS_unlink"||a==="addRunDependency"||a==="FS_createLazyFile"||a==="FS_createDevice"||a==="removeRunDependency"}function j(a){typeof globalThis<"u"&&!Object.getOwnPropertyDescriptor(globalThis,a)&&Object.defineProperty(globalThis,a,{configurable:!0,get:function(){var o="`"+a+"` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line";$(a)&&(o+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),lt(o)}})}function _(a){Object.getOwnPropertyDescriptor(t,a)||Object.defineProperty(t,a,{configurable:!0,get:function(){var o="'"+a+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";$(a)&&(o+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),Re(o)}})}var T;t.wasmBinary&&(T=t.wasmBinary),O("wasmBinary","wasmBinary");var D=t.noExitRuntime||!0;O("noExitRuntime","noExitRuntime"),typeof WebAssembly!="object"&&Re("no native wasm support detected");var k,G=!1,Y;function U(a,o){a||Re("Assertion failed"+(o?": "+o:""))}var ge=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ve(a,o,f){for(var m=o+f,x=o;a[x]&&!(x>=m);)++x;if(x-o>16&&a.buffer&&ge)return ge.decode(a.subarray(o,x));for(var E="";o<x;){var A=a[o++];if(!(A&128)){E+=String.fromCharCode(A);continue}var w=a[o++]&63;if((A&224)==192){E+=String.fromCharCode((A&31)<<6|w);continue}var I=a[o++]&63;if((A&240)==224?A=(A&15)<<12|w<<6|I:((A&248)!=240&&lt("Invalid UTF-8 leading byte 0x"+A.toString(16)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),A=(A&7)<<18|w<<12|I<<6|a[o++]&63),A<65536)E+=String.fromCharCode(A);else{var N=A-65536;E+=String.fromCharCode(55296|N>>10,56320|N&1023)}}return E}function K(a,o){return a?ve(Ce,a,o):""}function ue(a,o,f,m){if(!(m>0))return 0;for(var x=f,E=f+m-1,A=0;A<a.length;++A){var w=a.charCodeAt(A);if(w>=55296&&w<=57343){var I=a.charCodeAt(++A);w=65536+((w&1023)<<10)|I&1023}if(w<=127){if(f>=E)break;o[f++]=w}else if(w<=2047){if(f+1>=E)break;o[f++]=192|w>>6,o[f++]=128|w&63}else if(w<=65535){if(f+2>=E)break;o[f++]=224|w>>12,o[f++]=128|w>>6&63,o[f++]=128|w&63}else{if(f+3>=E)break;w>1114111&&lt("Invalid Unicode code point 0x"+w.toString(16)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),o[f++]=240|w>>18,o[f++]=128|w>>12&63,o[f++]=128|w>>6&63,o[f++]=128|w&63}}return o[f]=0,f-x}function an(a,o,f){return U(typeof f=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),ue(a,Ce,o,f)}function It(a){for(var o=0,f=0;f<a.length;++f){var m=a.charCodeAt(f);m<=127?o++:m<=2047?o+=2:m>=55296&&m<=57343?(o+=4,++f):o+=3}return o}var Lt,Ye,Ce,Dt,Cn,oe,re,ns,is;function rs(a){Lt=a,t.HEAP8=Ye=new Int8Array(a),t.HEAP16=Dt=new Int16Array(a),t.HEAP32=oe=new Int32Array(a),t.HEAPU8=Ce=new Uint8Array(a),t.HEAPU16=Cn=new Uint16Array(a),t.HEAPU32=re=new Uint32Array(a),t.HEAPF32=ns=new Float32Array(a),t.HEAPF64=is=new Float64Array(a)}var Ii=65536;t.TOTAL_STACK&&U(Ii===t.TOTAL_STACK,"the stack size can no longer be determined at runtime");var Li=t.INITIAL_MEMORY||262144;O("INITIAL_MEMORY","INITIAL_MEMORY"),U(Li>=Ii,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+Li+"! (TOTAL_STACK="+Ii+")"),U(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,"JS engine does not provide full typed array support"),U(!t.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),U(Li==262144,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var ot;function _o(){var a=Ji();U((a&3)==0),re[a>>2]=34821223,re[a+4>>2]=2310721022,re[0]=1668509029}function Di(){if(!G){var a=Ji(),o=re[a>>2],f=re[a+4>>2];(o!=34821223||f!=2310721022)&&Re("Stack overflow! Stack cookie has been overwritten at 0x"+a.toString(16)+", expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+f.toString(16)+" 0x"+o.toString(16)),re[0]!==1668509029&&Re("Runtime error: The application has corrupted its heap memory area (address zero)!")}}(function(){var a=new Int16Array(1),o=new Int8Array(a.buffer);if(a[0]=25459,o[0]!==115||o[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();var ss=[],as=[],os=[],Ui=!1;function yo(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)So(t.preRun.shift());Ni(ss)}function vo(){U(!Ui),Ui=!0,Di(),Ni(as)}function xo(){if(Di(),t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)Mo(t.postRun.shift());Ni(os)}function So(a){ss.unshift(a)}function bo(a){as.unshift(a)}function Mo(a){os.unshift(a)}U(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),U(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),U(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),U(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var Tt=0,Et=null,on=null,ln={};function wo(a){Tt++,t.monitorRunDependencies&&t.monitorRunDependencies(Tt),a?(U(!ln[a]),ln[a]=1,Et===null&&typeof setInterval<"u"&&(Et=setInterval(function(){if(G){clearInterval(Et),Et=null;return}var o=!1;for(var f in ln)o||(o=!0,C("still waiting on run dependencies:")),C("dependency: "+f);o&&C("(end of list)")},1e4))):C("warning: run dependency added without ID")}function To(a){if(Tt--,t.monitorRunDependencies&&t.monitorRunDependencies(Tt),a?(U(ln[a]),delete ln[a]):C("warning: run dependency removed without ID"),Tt==0&&(Et!==null&&(clearInterval(Et),Et=null),on)){var o=on;on=null,o()}}function Re(a){t.onAbort&&t.onAbort(a),a="Aborted("+a+")",C(a),G=!0,Y=1;var o=new WebAssembly.RuntimeError(a);throw i(o),o}var Fe={error:function(){Re("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM")},init:function(){Fe.error()},createDataFile:function(){Fe.error()},createPreloadedFile:function(){Fe.error()},createLazyFile:function(){Fe.error()},open:function(){Fe.error()},mkdev:function(){Fe.error()},registerDevice:function(){Fe.error()},analyzePath:function(){Fe.error()},loadFilesFromDB:function(){Fe.error()},ErrnoError:function(){Fe.error()}};t.FS_createDataFile=Fe.createDataFile,t.FS_createPreloadedFile=Fe.createPreloadedFile;var Eo="data:application/octet-stream;base64,";function ls(a){return a.startsWith(Eo)}function Ao(a){return a.startsWith("file://")}function _e(a,o){return function(){var f=a,m=o;return o||(m=t.asm),U(Ui,"native function `"+f+"` called before runtime initialization"),m[a]||U(m[a],"exported native function `"+f+"` not found"),m[a].apply(null,arguments)}}var De;De="laz-perf.wasm",ls(De)||(De=v(De));function cs(a){try{if(a==De&&T)return new Uint8Array(T);if(S)return S(a);throw"both async and sync fetching of the wasm failed"}catch(o){Re(o)}}function Co(){return!T&&(u||d)&&typeof fetch=="function"?fetch(De,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+De+"'";return a.arrayBuffer()}).catch(function(){return cs(De)}):Promise.resolve().then(function(){return cs(De)})}function Ro(){var a={env:Ps,wasi_snapshot_preview1:Ps};function o(w,I){var N=w.exports;t.asm=N,k=t.asm.memory,U(k,"memory not found in wasm exports"),rs(k.buffer),ot=t.asm.__indirect_function_table,U(ot,"table not found in wasm exports"),bo(t.asm.__wasm_call_ctors),To("wasm-instantiate")}wo("wasm-instantiate");var f=t;function m(w){U(t===f,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),f=null,o(w.instance)}function x(w){return Co().then(function(I){return WebAssembly.instantiate(I,a)}).then(function(I){return I}).then(w,function(I){C("failed to asynchronously prepare wasm: "+I),Ao(De)&&C("warning: Loading from a file URI ("+De+") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"),Re(I)})}function E(){return!T&&typeof WebAssembly.instantiateStreaming=="function"&&!ls(De)&&typeof fetch=="function"?fetch(De,{credentials:"same-origin"}).then(function(w){var I=WebAssembly.instantiateStreaming(w,a);return I.then(m,function(N){return C("wasm streaming compile failed: "+N),C("falling back to ArrayBuffer instantiation"),x(m)})}):x(m)}if(t.instantiateWasm)try{var A=t.instantiateWasm(a,o);return A}catch(w){return C("Module.instantiateWasm callback failed with error: "+w),!1}return E().catch(i),{}}var kp,Gp;function Po(a){this.name="ExitStatus",this.message="Program terminated with exit("+a+")",this.status=a}function Ni(a){for(;a.length>0;)a.shift()(t)}function Io(a){return lt("warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling"),a}function Hp(a){var o=/\b_Z[\w\d_]+/g;return a.replace(o,function(f){var m=Io(f);return f===m?f:m+" ["+f+"]"})}function Wp(){var a=new Error;if(!a.stack){try{throw new Error}catch(o){a=o}if(!a.stack)return"(no stack trace available)"}return a.stack.toString()}function lt(a){lt.shown||(lt.shown={}),lt.shown[a]||(lt.shown[a]=1,C(a))}function us(a,o){U(a.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),Ye.set(a,o)}function Lo(a){return Zi(a+24)+24}function Do(a){this.excPtr=a,this.ptr=a-24,this.set_type=function(o){re[this.ptr+4>>2]=o},this.get_type=function(){return re[this.ptr+4>>2]},this.set_destructor=function(o){re[this.ptr+8>>2]=o},this.get_destructor=function(){return re[this.ptr+8>>2]},this.set_refcount=function(o){oe[this.ptr>>2]=o},this.set_caught=function(o){o=o?1:0,Ye[this.ptr+12>>0]=o},this.get_caught=function(){return Ye[this.ptr+12>>0]!=0},this.set_rethrown=function(o){o=o?1:0,Ye[this.ptr+13>>0]=o},this.get_rethrown=function(){return Ye[this.ptr+13>>0]!=0},this.init=function(o,f){this.set_adjusted_ptr(0),this.set_type(o),this.set_destructor(f),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var o=oe[this.ptr>>2];oe[this.ptr>>2]=o+1},this.release_ref=function(){var o=oe[this.ptr>>2];return oe[this.ptr>>2]=o-1,U(o>0),o===1},this.set_adjusted_ptr=function(o){re[this.ptr+16>>2]=o},this.get_adjusted_ptr=function(){return re[this.ptr+16>>2]},this.get_exception_ptr=function(){var o=hc(this.get_type());if(o)return re[this.excPtr>>2];var f=this.get_adjusted_ptr();return f!==0?f:this.excPtr}}var Uo=0,No=0;function Fo(a,o,f){var m=new Do(a);throw m.init(o,f),Uo=a,No++,a+" - Exception catching is disabled, this exception cannot be caught. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch."}function Oo(a,o,f,m,x){}function Fi(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a)}}function Bo(){for(var a=new Array(256),o=0;o<256;++o)a[o]=String.fromCharCode(o);hs=a}var hs=void 0;function Oe(a){for(var o="",f=a;Ce[f];)o+=hs[Ce[f++]];return o}var Ut={},Nt={},Rn={},zo=48,Vo=57;function fs(a){if(a===void 0)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var o=a.charCodeAt(0);return o>=zo&&o<=Vo?"_"+a:a}function ds(a,o){return a=fs(a),function(){"use strict";return o.apply(this,arguments)}}function Oi(a,o){var f=ds(o,function(m){this.name=o,this.message=m;var x=new Error(m).stack;x!==void 0&&(this.stack=this.toString()+`
3
- `+x.replace(/^Error(:[^\n]*)?\n/,""))});return f.prototype=Object.create(a.prototype),f.prototype.constructor=f,f.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},f}var Ft=void 0;function ne(a){throw new Ft(a)}var ps=void 0;function Pn(a){throw new ps(a)}function cn(a,o,f){a.forEach(function(w){Rn[w]=o});function m(w){var I=f(w);I.length!==a.length&&Pn("Mismatched type converter count");for(var N=0;N<a.length;++N)et(a[N],I[N])}var x=new Array(o.length),E=[],A=0;o.forEach((w,I)=>{Nt.hasOwnProperty(w)?x[I]=Nt[w]:(E.push(w),Ut.hasOwnProperty(w)||(Ut[w]=[]),Ut[w].push(()=>{x[I]=Nt[w],++A,A===E.length&&m(x)}))}),E.length===0&&m(x)}function et(a,o,f={}){if(!("argPackAdvance"in o))throw new TypeError("registerType registeredInstance requires argPackAdvance");var m=o.name;if(a||ne('type "'+m+'" must have a positive integer typeid pointer'),Nt.hasOwnProperty(a)){if(f.ignoreDuplicateRegistrations)return;ne("Cannot register type '"+m+"' twice")}if(Nt[a]=o,delete Rn[a],Ut.hasOwnProperty(a)){var x=Ut[a];delete Ut[a],x.forEach(E=>E())}}function ko(a,o,f,m,x){var E=Fi(f);o=Oe(o),et(a,{name:o,fromWireType:function(A){return!!A},toWireType:function(A,w){return w?m:x},argPackAdvance:8,readValueFromPointer:function(A){var w;if(f===1)w=Ye;else if(f===2)w=Dt;else if(f===4)w=oe;else throw new TypeError("Unknown boolean type size: "+o);return this.fromWireType(w[A>>E])},destructorFunction:null})}function Go(a){if(!(this instanceof ct)||!(a instanceof ct))return!1;for(var o=this.$$.ptrType.registeredClass,f=this.$$.ptr,m=a.$$.ptrType.registeredClass,x=a.$$.ptr;o.baseClass;)f=o.upcast(f),o=o.baseClass;for(;m.baseClass;)x=m.upcast(x),m=m.baseClass;return o===m&&f===x}function Ho(a){return{count:a.count,deleteScheduled:a.deleteScheduled,preservePointerOnDelete:a.preservePointerOnDelete,ptr:a.ptr,ptrType:a.ptrType,smartPtr:a.smartPtr,smartPtrType:a.smartPtrType}}function Bi(a){function o(f){return f.$$.ptrType.registeredClass.name}ne(o(a)+" instance already deleted")}var zi=!1;function ms(a){}function Wo(a){a.smartPtr?a.smartPtrType.rawDestructor(a.smartPtr):a.ptrType.registeredClass.rawDestructor(a.ptr)}function gs(a){a.count.value-=1;var o=a.count.value===0;o&&Wo(a)}function _s(a,o,f){if(o===f)return a;if(f.baseClass===void 0)return null;var m=_s(a,o,f.baseClass);return m===null?null:f.downcast(m)}var ys={};function Xo(){return Object.keys(fn).length}function qo(){var a=[];for(var o in fn)fn.hasOwnProperty(o)&&a.push(fn[o]);return a}var un=[];function Vi(){for(;un.length;){var a=un.pop();a.$$.deleteScheduled=!1,a.delete()}}var hn=void 0;function Yo(a){hn=a,un.length&&hn&&hn(Vi)}function $o(){t.getInheritedInstanceCount=Xo,t.getLiveInheritedInstances=qo,t.flushPendingDeletes=Vi,t.setDelayFunction=Yo}var fn={};function Zo(a,o){for(o===void 0&&ne("ptr should not be undefined");a.baseClass;)o=a.upcast(o),a=a.baseClass;return o}function Jo(a,o){return o=Zo(a,o),fn[o]}function In(a,o){(!o.ptrType||!o.ptr)&&Pn("makeClassHandle requires ptr and ptrType");var f=!!o.smartPtrType,m=!!o.smartPtr;return f!==m&&Pn("Both smartPtrType and smartPtr must be specified"),o.count={value:1},dn(Object.create(a,{$$:{value:o}}))}function vs(a){var o=this.getPointee(a);if(!o)return this.destructor(a),null;var f=Jo(this.registeredClass,o);if(f!==void 0){if(f.$$.count.value===0)return f.$$.ptr=o,f.$$.smartPtr=a,f.clone();var m=f.clone();return this.destructor(a),m}function x(){return this.isSmartPointer?In(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:o,smartPtrType:this,smartPtr:a}):In(this.registeredClass.instancePrototype,{ptrType:this,ptr:a})}var E=this.registeredClass.getActualType(o),A=ys[E];if(!A)return x.call(this);var w;this.isConst?w=A.constPointerType:w=A.pointerType;var I=_s(o,this.registeredClass,w.registeredClass);return I===null?x.call(this):this.isSmartPointer?In(w.registeredClass.instancePrototype,{ptrType:w,ptr:I,smartPtrType:this,smartPtr:a}):In(w.registeredClass.instancePrototype,{ptrType:w,ptr:I})}function dn(a){return typeof FinalizationRegistry>"u"?(dn=o=>o,a):(zi=new FinalizationRegistry(o=>{console.warn(o.leakWarning.stack.replace(/^Error: /,"")),gs(o.$$)}),dn=o=>{var f=o.$$,m=!!f.smartPtr;if(m){var x={$$:f},E=f.ptrType.registeredClass;x.leakWarning=new Error("Embind found a leaked C++ instance "+E.name+" <0x"+f.ptr.toString(16)+`>.
1
+ var fc=Object.create;var Ls=Object.defineProperty;var pc=Object.getOwnPropertyDescriptor;var mc=Object.getOwnPropertyNames;var gc=Object.getPrototypeOf,_c=Object.prototype.hasOwnProperty;var Ds=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var te=(s,e)=>()=>{try{return e||s((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var yc=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of mc(e))!_c.call(s,i)&&i!==t&&Ls(s,i,{get:()=>e[i],enumerable:!(n=pc(e,i))||n.enumerable});return s};var Nn=(s,e,t)=>(t=s!=null?fc(gc(s)):{},yc(e||!s||!s.__esModule?Ls(t,"default",{value:s,enumerable:!0}):t,s));var Us=te(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0})});var Fs=te(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.Hierarchy=void 0;Un.Hierarchy={parse:vc};function vc(s){return Object.entries(s).reduce((e,[t,n])=>(n===-1?e.pages[t]={}:n&&(e.nodes[t]={pointCount:n}),e),{nodes:{},pages:{}})}});var Bs=te(ut=>{"use strict";var xc=ut&&ut.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Os=ut&&ut.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&xc(e,s,t)};Object.defineProperty(ut,"__esModule",{value:!0});Os(Us(),ut);Os(Fs(),ut)});var Fn=te(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.hierarchyItemLength=Bt.infoLength=void 0;Bt.infoLength=160;Bt.hierarchyItemLength=32});var On=te(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.evlrHeaderLength=ht.vlrHeaderLength=ht.minHeaderLength=void 0;ht.minHeaderLength=375;ht.vlrHeaderLength=54;ht.evlrHeaderLength=60});var zs=te(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.getBigUint64=zt.parseBigInt=void 0;function Sc(s){if(s>BigInt(Number.MAX_SAFE_INTEGER)||s<BigInt(-Number.MAX_SAFE_INTEGER))throw new Error(`Cannot convert bigint to number: ${s}`);return Number(s)}zt.parseBigInt=Sc;function Mc(s,e,t){if(s.getBigUint64)return s.getBigUint64(e,t);let[n,i]=t?[4,0]:[0,4],r=BigInt(s.getUint32(e+n,t)),l=BigInt(s.getUint32(e+i,t));return(r<<BigInt(32))+l}zt.getBigUint64=Mc});var ji=te(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.toCString=dt.toDataView=dt.Binary=void 0;dt.Binary={toDataView:Ji,toCString:ks};function Ji(s){return new DataView(s.buffer,s.byteOffset,s.length)}dt.toDataView=Ji;function ks(s){let e=Ji(s),t="";for(let n=0;n<e.byteLength;++n){let i=e.getInt8(n);if(i===0)return t;t+=String.fromCharCode(i)}return t}dt.toCString=ks});var Xs=te(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.Bounds=void 0;Bn.Bounds={min:bc,max:wc,mid:Ki,width:Vs,depth:Gs,height:Hs,cube:Tc,step:Ws,stepTo:Ec,intersection:Ac};function bc(s){return[s[0],s[1],s[2]]}function wc(s){return[s[3],s[4],s[5]]}function Ki([s,e,t,n,i,r]){return[s+(n-s)/2,e+(i-e)/2,t+(r-t)/2]}function Vs(s){return s[3]-s[0]}function Gs(s){return s[4]-s[1]}function Hs(s){return s[5]-s[2]}function Tc(s){let e=Ki(s),t=Math.max(Vs(s),Gs(s),Hs(s))/2;return[e[0]-t,e[1]-t,e[2]-t,e[0]+t,e[1]+t,e[2]+t]}function Ws(s,[e,t,n]){let[i,r,l,c,h,u]=s,[f,p,g]=Ki(s);return[e?f:i,t?p:r,n?g:l,e?c:f,t?h:p,n?u:g]}function Ec(s,[e,t,n,i]){for(let r=e-1;r>=0;--r)s=Ws(s,[t>>r&1,n>>r&1,i>>r&1]);return s}function Ac(s,e){return[Math.max(s[0],e[0]),Math.max(s[1],e[1]),Math.max(s[2],e[2]),Math.min(s[3],e[3]),Math.min(s[4],e[4]),Math.min(s[5],e[5])]}});var qs=te(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.Dimension=void 0;var Cc={int8:{type:"signed",size:1},int16:{type:"signed",size:2},int32:{type:"signed",size:4},int64:{type:"signed",size:8},uint8:{type:"unsigned",size:1},uint16:{type:"unsigned",size:2},uint32:{type:"unsigned",size:4},uint64:{type:"unsigned",size:8},float32:{type:"float",size:4},float64:{type:"float",size:8},float:{type:"float",size:4},double:{type:"float",size:8},bool:{type:"unsigned",size:1},boolean:{type:"unsigned",size:1}};zn.Dimension={Type:Cc,ctype:Rc};function Rc({type:s,size:e}){switch(s){case"signed":switch(e){case 1:return"int8";case 2:return"int16";case 4:return"int32";case 8:return"int64"}case"unsigned":switch(e){case 1:return"uint8";case 2:return"uint16";case 4:return"uint32";case 8:return"uint64"}case"float":switch(e){case 4:return"float";case 8:return"double"}}throw new Error(`Invalid dimension type/size: ${s}/${e}`)}});var $s=te((ft,Ys)=>{var kn=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,Vn=(function(){function s(){this.fetch=!1,this.DOMException=kn.DOMException}return s.prototype=kn,new s})();(function(s){var e=(function(t){var n=typeof s<"u"&&s||typeof self<"u"&&self||typeof global<"u"&&global||{},i={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function r(_){return _&&DataView.prototype.isPrototypeOf(_)}if(i.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(_){return _&&l.indexOf(Object.prototype.toString.call(_))>-1};function h(_){if(typeof _!="string"&&(_=String(_)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(_)||_==="")throw new TypeError('Invalid character in header field name: "'+_+'"');return _.toLowerCase()}function u(_){return typeof _!="string"&&(_=String(_)),_}function f(_){var T={next:function(){var D=_.shift();return{done:D===void 0,value:D}}};return i.iterable&&(T[Symbol.iterator]=function(){return T}),T}function p(_){this.map={},_ instanceof p?_.forEach(function(T,D){this.append(D,T)},this):Array.isArray(_)?_.forEach(function(T){if(T.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+T.length);this.append(T[0],T[1])},this):_&&Object.getOwnPropertyNames(_).forEach(function(T){this.append(T,_[T])},this)}p.prototype.append=function(_,T){_=h(_),T=u(T);var D=this.map[_];this.map[_]=D?D+", "+T:T},p.prototype.delete=function(_){delete this.map[h(_)]},p.prototype.get=function(_){return _=h(_),this.has(_)?this.map[_]:null},p.prototype.has=function(_){return this.map.hasOwnProperty(h(_))},p.prototype.set=function(_,T){this.map[h(_)]=u(T)},p.prototype.forEach=function(_,T){for(var D in this.map)this.map.hasOwnProperty(D)&&_.call(T,this.map[D],D,this)},p.prototype.keys=function(){var _=[];return this.forEach(function(T,D){_.push(D)}),f(_)},p.prototype.values=function(){var _=[];return this.forEach(function(T){_.push(T)}),f(_)},p.prototype.entries=function(){var _=[];return this.forEach(function(T,D){_.push([D,T])}),f(_)},i.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function g(_){if(!_._noBody){if(_.bodyUsed)return Promise.reject(new TypeError("Already read"));_.bodyUsed=!0}}function y(_){return new Promise(function(T,D){_.onload=function(){T(_.result)},_.onerror=function(){D(_.error)}})}function v(_){var T=new FileReader,D=y(T);return T.readAsArrayBuffer(_),D}function b(_){var T=new FileReader,D=y(T),V=/charset=([A-Za-z0-9_-]+)/.exec(_.type),G=V?V[1]:"utf-8";return T.readAsText(_,G),D}function M(_){for(var T=new Uint8Array(_),D=new Array(T.length),V=0;V<T.length;V++)D[V]=String.fromCharCode(T[V]);return D.join("")}function S(_){if(_.slice)return _.slice(0);var T=new Uint8Array(_.byteLength);return T.set(new Uint8Array(_)),T.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(_){this.bodyUsed=this.bodyUsed,this._bodyInit=_,_?typeof _=="string"?this._bodyText=_:i.blob&&Blob.prototype.isPrototypeOf(_)?this._bodyBlob=_:i.formData&&FormData.prototype.isPrototypeOf(_)?this._bodyFormData=_:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(_)?this._bodyText=_.toString():i.arrayBuffer&&i.blob&&r(_)?(this._bodyArrayBuffer=S(_.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(_)||c(_))?this._bodyArrayBuffer=S(_):this._bodyText=_=Object.prototype.toString.call(_):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof _=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(_)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var _=g(this);if(_)return _;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var _=g(this);return _||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(i.blob)return this.blob().then(v);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var _=g(this);if(_)return _;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(M(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(z)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function B(_){var T=_.toUpperCase();return L.indexOf(T)>-1?T:_}function C(_,T){if(!(this instanceof C))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');T=T||{};var D=T.body;if(_ instanceof C){if(_.bodyUsed)throw new TypeError("Already read");this.url=_.url,this.credentials=_.credentials,T.headers||(this.headers=new p(_.headers)),this.method=_.method,this.mode=_.mode,this.signal=_.signal,!D&&_._bodyInit!=null&&(D=_._bodyInit,_.bodyUsed=!0)}else this.url=String(_);if(this.credentials=T.credentials||this.credentials||"same-origin",(T.headers||!this.headers)&&(this.headers=new p(T.headers)),this.method=B(T.method||this.method||"GET"),this.mode=T.mode||this.mode||null,this.signal=T.signal||this.signal||(function(){if("AbortController"in n){var Y=new AbortController;return Y.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(D),(this.method==="GET"||this.method==="HEAD")&&(T.cache==="no-store"||T.cache==="no-cache")){var V=/([?&])_=[^&]*/;if(V.test(this.url))this.url=this.url.replace(V,"$1_="+new Date().getTime());else{var G=/\?/;this.url+=(G.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function z(_){var T=new FormData;return _.trim().split("&").forEach(function(D){if(D){var V=D.split("="),G=V.shift().replace(/\+/g," "),Y=V.join("=").replace(/\+/g," ");T.append(decodeURIComponent(G),decodeURIComponent(Y))}}),T}function O(_){var T=new p,D=_.replace(/\r?\n[\t ]+/g," ");return D.split("\r").map(function(V){return V.indexOf(`
2
+ `)===0?V.substr(1,V.length):V}).forEach(function(V){var G=V.split(":"),Y=G.shift().trim();if(Y){var N=G.join(":").trim();try{T.append(Y,N)}catch(ge){console.warn("Response "+ge.message)}}}),T}R.call(C.prototype);function W(_,T){if(!(this instanceof W))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(T||(T={}),this.type="default",this.status=T.status===void 0?200:T.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=T.statusText===void 0?"":""+T.statusText,this.headers=new p(T.headers),this.url=T.url||"",this._initBody(_)}R.call(W.prototype),W.prototype.clone=function(){return new W(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},W.error=function(){var _=new W(null,{status:200,statusText:""});return _.ok=!1,_.status=0,_.type="error",_};var $=[301,302,303,307,308];W.redirect=function(_,T){if($.indexOf(T)===-1)throw new RangeError("Invalid status code");return new W(null,{status:T,headers:{location:_}})},t.DOMException=n.DOMException;try{new t.DOMException}catch{t.DOMException=function(T,D){this.message=T,this.name=D;var V=Error(T);this.stack=V.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function j(_,T){return new Promise(function(D,V){var G=new C(_,T);if(G.signal&&G.signal.aborted)return V(new t.DOMException("Aborted","AbortError"));var Y=new XMLHttpRequest;function N(){Y.abort()}Y.onload=function(){var K={statusText:Y.statusText,headers:O(Y.getAllResponseHeaders()||"")};G.url.indexOf("file://")===0&&(Y.status<200||Y.status>599)?K.status=200:K.status=Y.status,K.url="responseURL"in Y?Y.responseURL:K.headers.get("X-Request-URL");var ue="response"in Y?Y.response:Y.responseText;setTimeout(function(){D(new W(ue,K))},0)},Y.onerror=function(){setTimeout(function(){V(new TypeError("Network request failed"))},0)},Y.ontimeout=function(){setTimeout(function(){V(new TypeError("Network request timed out"))},0)},Y.onabort=function(){setTimeout(function(){V(new t.DOMException("Aborted","AbortError"))},0)};function ge(K){try{return K===""&&n.location.href?n.location.href:K}catch{return K}}if(Y.open(G.method,ge(G.url),!0),G.credentials==="include"?Y.withCredentials=!0:G.credentials==="omit"&&(Y.withCredentials=!1),"responseType"in Y&&(i.blob?Y.responseType="blob":i.arrayBuffer&&(Y.responseType="arraybuffer")),T&&typeof T.headers=="object"&&!(T.headers instanceof p||n.Headers&&T.headers instanceof n.Headers)){var ve=[];Object.getOwnPropertyNames(T.headers).forEach(function(K){ve.push(h(K)),Y.setRequestHeader(K,u(T.headers[K]))}),G.headers.forEach(function(K,ue){ve.indexOf(ue)===-1&&Y.setRequestHeader(ue,K)})}else G.headers.forEach(function(K,ue){Y.setRequestHeader(ue,K)});G.signal&&(G.signal.addEventListener("abort",N),Y.onreadystatechange=function(){Y.readyState===4&&G.signal.removeEventListener("abort",N)}),Y.send(typeof G._bodyInit>"u"?null:G._bodyInit)})}return j.polyfill=!0,n.fetch||(n.fetch=j,n.Headers=p,n.Request=C,n.Response=W),t.Headers=p,t.Request=C,t.Response=W,t.fetch=j,Object.defineProperty(t,"__esModule",{value:!0}),t})({})})(Vn);Vn.fetch.ponyfill=!0;delete Vn.fetch.polyfill;var kt=kn.fetch?kn:Vn;ft=kt.fetch;ft.default=kt.fetch;ft.fetch=kt.fetch;ft.Headers=kt.Headers;ft.Request=kt.Request;ft.Response=kt.Response;Ys.exports=ft});var Zs=te(()=>{});var Ks=te(Oe=>{"use strict";var Pc=Oe&&Oe.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Ic=Oe&&Oe.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Lc=Oe&&Oe.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Pc(e,s,t);return Ic(e,s),e},Dc=Oe&&Oe.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Oe,"__esModule",{value:!0});Oe.Getter=void 0;var Nc=Dc($s());Oe.Getter={create:Uc,http:Js,file:js};function Uc(s){return typeof s=="function"?s:s.startsWith("http://")||s.startsWith("https://")?Js(s):js(s)}function Js(s){return async function(t,n){if(t<0||n<0||t>n)throw new Error("Invalid range");let r=await(await(0,Nc.default)(s,{headers:{Range:`bytes=${t}-${n-1}`}})).arrayBuffer();return new Uint8Array(r)}}function js(s){return async function(t,n){let i=await Promise.resolve().then(()=>Lc(Zs()));async function r(l=0,c=1/0){if(l<0||c<0||l>c)throw new Error("Invalid range");await i.promises.access(s);let h=i.createReadStream(s,{start:l,end:c-1,autoClose:!0});return Fc(h)}return r(t,n)}}async function Fc(s){return await new Promise((e,t)=>{let n=[];s.on("data",i=>n.push(i)),s.on("error",t),s.on("end",()=>e(Buffer.concat(n)))})}});var ea=te(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.Key=void 0;Vt.Key={create:Oc,parse:Qs,toString:Bc,step:zc,up:kc,compare:Vc,depth:Gc};function Oc(s,e=0,t=0,n=0){return typeof s!="number"?Qs(s):[s,e,t,n]}function Qs(s){if(typeof s!="string")return s;let[e,t,n,i,...r]=s.split("-").map(c=>parseInt(c,10)),l=[e,t,n,i];if(r.length!==0||l.some(c=>typeof c!="number"||Number.isNaN(c)))throw new Error(`Invalid key: ${s}`);return l}function Bc(s){return typeof s=="string"?s:s.join("-")}function zc(s,[e,t,n]){let[i,r,l,c]=Vt.Key.create(s);return[i+1,r*2+e,l*2+t,c*2+n]}function kc(s,e=1){let[t,n,i,r]=Vt.Key.create(s);return[t-e,n>>e,i>>e,r>>e]}function Vc(s,e){for(let t=0;t<s.length;++t){if(s[t]<e[t])return-1;if(s[t]>e[t])return 1}return 0}function Gc(s){return s[0]}});var ta=te(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.Scale=void 0;Gn.Scale={apply:(s,e=1,t=0)=>(s-t)/e,unapply:(s,e=1,t=0)=>s*e+t}});var na=te(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.Step=void 0;Hn.Step={fromIndex:Hc,list:Wc};function Hc(s){if(s<0||s>=8)throw new Error(`Invalid step index: ${s}`);let e=s>>0&1?1:0,t=s>>1&1?1:0,n=s>>2&1?1:0;return[e,t,n]}function Wc(){return[[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]]}});var Be=te(de=>{"use strict";var Xc=de&&de.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),qc=de&&de.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Xc(e,s,t)};Object.defineProperty(de,"__esModule",{value:!0});de.Step=de.Scale=de.Key=de.Getter=de.Dimension=de.Bounds=de.Binary=void 0;qc(zs(),de);var Yc=ji();Object.defineProperty(de,"Binary",{enumerable:!0,get:function(){return Yc.Binary}});var $c=Xs();Object.defineProperty(de,"Bounds",{enumerable:!0,get:function(){return $c.Bounds}});var Zc=qs();Object.defineProperty(de,"Dimension",{enumerable:!0,get:function(){return Zc.Dimension}});var Jc=Ks();Object.defineProperty(de,"Getter",{enumerable:!0,get:function(){return Jc.Getter}});var jc=ea();Object.defineProperty(de,"Key",{enumerable:!0,get:function(){return jc.Key}});var Kc=ta();Object.defineProperty(de,"Scale",{enumerable:!0,get:function(){return Kc.Scale}});var Qc=na();Object.defineProperty(de,"Step",{enumerable:!0,get:function(){return Qc.Step}})});var Qi=te(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.ExtraBytes=void 0;var Se=Be();Xn.ExtraBytes={getDimension:eu,parse:tu,parseOne:ia};var Wn=192;function eu({type:s,length:e}){switch(s){case"signed":case"unsigned":switch(e){case 1:case 2:case 4:case 8:return{type:s,size:e}}case"float":switch(e){case 4:case 8:return{type:s,size:e}}}}function tu(s){if(s.byteLength%Wn!==0)throw new Error(`Invalid extra bytes VLR length: ${s.byteLength}`);let e=[];for(let t=0;t<s.byteLength;t+=Wn)e.push(ia(s.slice(t,t+Wn)));return e}function ia(s){if(s.byteLength!==Wn)throw new Error(`Invalid extra bytes entry length: ${s.byteLength}`);let e=Se.Binary.toDataView(s),t=Se.Binary.toCString(s.slice(4,36)),n=Se.Binary.toCString(s.slice(60,192)),i=e.getUint8(2),r=e.getUint8(3);if(i>=11)throw new Error(`Invalid extra bytes "type" value: ${i}`);if(i===0)return{name:t,description:n,length:r};let l=iu(r),c=nu(i);if(!c)throw new Error(`Failed to extract dimension type: ${i}`);let{type:h,size:u}=c;function f(g){switch(h){case"signed":return(0,Se.parseBigInt)(e.getBigInt64(g,!0));case"unsigned":return(0,Se.parseBigInt)((0,Se.getBigUint64)(e,g,!0));case"float":return e.getFloat64(g,!0)}}let p={name:t,description:n,type:h,length:u};return l.hasNodata&&(p.nodata=f(40)),l.hasMin&&(p.min=f(64)),l.hasMax&&(p.max=f(88)),l.hasScale&&(p.scale=e.getFloat64(112)),l.hasOffset&&(p.offset=e.getFloat64(136)),p}function nu(s){switch(s){case 1:return Se.Dimension.Type.uint8;case 2:return Se.Dimension.Type.int8;case 3:return Se.Dimension.Type.uint16;case 4:return Se.Dimension.Type.int16;case 5:return Se.Dimension.Type.uint32;case 6:return Se.Dimension.Type.int32;case 7:return Se.Dimension.Type.uint64;case 8:return Se.Dimension.Type.int64;case 9:return Se.Dimension.Type.float32;case 10:return Se.Dimension.Type.float64}}function iu(s){return{hasNodata:!!(s&1),hasMin:!!(s>>1&1),hasMax:!!(s>>2&1),hasScale:!!(s>>3&1),hasOffset:!!(s>>4&1)}}});var er=te(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.Dimensions=void 0;var ru=Be(),su=Qi();qn.Dimensions={create:ou};var{Type:he}=ru.Dimension,au={X:he.float64,Y:he.float64,Z:he.float64,Intensity:he.uint16,ReturnNumber:he.uint8,NumberOfReturns:he.uint8,ScanDirectionFlag:he.boolean,EdgeOfFlightLine:he.boolean,Classification:he.uint8,Synthetic:he.boolean,KeyPoint:he.boolean,Withheld:he.boolean,Overlap:he.boolean,ScanAngle:he.float32,UserData:he.uint8,PointSourceId:he.uint16,GpsTime:he.float64,Red:he.uint16,Green:he.uint16,Blue:he.uint16,ScannerChannel:he.uint8,Infrared:he.uint16};function ou(s,e=[]){return Object.keys(s).reduce((t,n)=>{let i=au[n];if(i)return{...t,[n]:i};let r=e.find(c=>c.name===n),l=r&&su.ExtraBytes.getDimension(r);if(l)return{...t,[n]:l};throw new Error(`Failed to look up LAS type: ${n}`)},{})}});var tr=te($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.Extractor=void 0;var Ze=Be();$n.Extractor={create:hu};function lu(s){switch(s){case 0:return 20;case 1:return 28;case 2:return 26;case 3:return 34;case 6:return 30;case 7:return 36;case 8:return 38;default:throw new Error(`Unsupported point data record format: ${s}`)}}function cu(s,e,{type:t,length:n}){let i=pt(s);switch(t){case"signed":switch(n){case 1:return(r,l)=>r.getInt8(i(l)+e);case 2:return(r,l)=>r.getInt16(i(l)+e,!0);case 4:return(r,l)=>r.getInt32(i(l)+e,!0);case 8:return(r,l)=>(0,Ze.parseBigInt)(r.getBigInt64(i(l)+e,!0))}case"unsigned":switch(n){case 1:return(r,l)=>r.getUint8(i(l)+e);case 2:return(r,l)=>r.getUint16(i(l)+e,!0);case 4:return(r,l)=>r.getUint32(i(l)+e,!0);case 8:return(r,l)=>(0,Ze.parseBigInt)((0,Ze.getBigUint64)(r,i(l)+e,!0))}case"float":switch(n){case 4:return(r,l)=>r.getFloat32(i(l)+e,!0);case 8:return(r,l)=>r.getFloat64(i(l)+e,!0)}}}function uu(s,e){let n=lu(s.pointDataRecordFormat);return e.reduce((i,r)=>{let l=n;n+=r.length;let c=cu(s,l,r);if(!c)return i;let h=(u,f)=>Ze.Scale.unapply(c(u,f),r.scale,r.offset);return{...i,[r.name]:h}},{})}function hu(s,e=[]){let t=uu(s,e);return{...(()=>{let{pointDataRecordFormat:i}=s;switch(i){case 0:return Yn(s);case 1:return du(s);case 2:return fu(s);case 3:return pu(s);case 6:return ra(s);case 7:return sa(s);case 8:return mu(s);default:throw new Error(`Unsupported point data record format: ${i}`)}})(),...t}}function Yn(s){let{scale:e,offset:t}=s,n=pt(s);function i(c,h){return c.getUint8(n(h)+14)}function r(c,h){return c.getUint8(n(h)+15)}function l(c,h){return r(c,h)&31}return{X:(c,h)=>Ze.Scale.unapply(c.getInt32(n(h),!0),e[0],t[0]),Y:(c,h)=>Ze.Scale.unapply(c.getInt32(n(h)+4,!0),e[1],t[1]),Z:(c,h)=>Ze.Scale.unapply(c.getInt32(n(h)+8,!0),e[2],t[2]),Intensity:(c,h)=>c.getUint16(n(h)+12,!0),ReturnNumber:(c,h)=>i(c,h)&7,NumberOfReturns:(c,h)=>(i(c,h)&56)>>3,ScanDirectionFlag:(c,h)=>(i(c,h)&64)>>6,EdgeOfFlightLine:(c,h)=>(i(c,h)&128)>>7,Classification:(c,h)=>{let u=l(c,h);return u===12?0:u},Synthetic:(c,h)=>(r(c,h)&32)>>5,KeyPoint:(c,h)=>(r(c,h)&64)>>6,Withheld:(c,h)=>(r(c,h)&128)>>7,Overlap:(c,h)=>l(c,h)===12?1:0,ScanAngle:(c,h)=>c.getInt8(n(h)+16),UserData:(c,h)=>c.getUint8(n(h)+17),PointSourceId:(c,h)=>c.getUint16(n(h)+18,!0)}}function du(s){let e=pt(s);return{...Yn(s),GpsTime:(t,n)=>t.getFloat64(e(n)+20,!0)}}function fu(s){let e=pt(s);return{...Yn(s),Red:(t,n)=>t.getUint16(e(n)+20,!0),Green:(t,n)=>t.getUint16(e(n)+22,!0),Blue:(t,n)=>t.getUint16(e(n)+24,!0)}}function pu(s){let e=pt(s);return{...Yn(s),GpsTime:(t,n)=>t.getFloat64(e(n)+20,!0),Red:(t,n)=>t.getUint16(e(n)+28,!0),Green:(t,n)=>t.getUint16(e(n)+30,!0),Blue:(t,n)=>t.getUint16(e(n)+32,!0)}}function ra(s){let{scale:e,offset:t}=s,n=pt(s);function i(r,l){return r.getUint8(n(l)+15)}return{X:(r,l)=>Ze.Scale.unapply(r.getInt32(n(l),!0),e[0],t[0]),Y:(r,l)=>Ze.Scale.unapply(r.getInt32(n(l)+4,!0),e[1],t[1]),Z:(r,l)=>Ze.Scale.unapply(r.getInt32(n(l)+8,!0),e[2],t[2]),Intensity:(r,l)=>r.getUint16(n(l)+12,!0),ReturnNumber:(r,l)=>r.getUint16(n(l)+14,!0)&15,NumberOfReturns:(r,l)=>(r.getUint16(n(l)+14,!0)&240)>>4,Synthetic:(r,l)=>i(r,l)&1,KeyPoint:(r,l)=>(i(r,l)&2)>>1,Withheld:(r,l)=>(i(r,l)&4)>>2,Overlap:(r,l)=>(i(r,l)&8)>>3,ScannerChannel:(r,l)=>(i(r,l)&48)>>4,ScanDirectionFlag:(r,l)=>(i(r,l)&64)>>6,EdgeOfFlightLine:(r,l)=>(i(r,l)&128)>>7,Classification:(r,l)=>r.getUint8(n(l)+16),UserData:(r,l)=>r.getUint8(n(l)+17),ScanAngle:(r,l)=>r.getInt16(n(l)+18,!0)*.006,PointSourceId:(r,l)=>r.getUint16(n(l)+20,!0),GpsTime:(r,l)=>r.getFloat64(n(l)+22,!0)}}function sa(s){let e=pt(s);return{...ra(s),Red:(t,n)=>t.getUint16(e(n)+30,!0),Green:(t,n)=>t.getUint16(e(n)+32,!0),Blue:(t,n)=>t.getUint16(e(n)+34,!0)}}function mu(s){let e=pt(s);return{...sa(s),Infrared:(t,n)=>t.getUint16(e(n)+36,!0)}}function pt(s){let{pointDataRecordLength:e}=s;return function(n){return n*e}}});var oa=te(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.formatGuid=Gt.parsePoint=void 0;var aa=Be();function gu(s){let e=aa.Binary.toDataView(s);if(e.byteLength!==24)throw new Error(`Invalid tuple buffer length: ${e.byteLength}`);return[e.getFloat64(0,!0),e.getFloat64(8,!0),e.getFloat64(16,!0)]}Gt.parsePoint=gu;function _u(s){let e=aa.Binary.toDataView(s);if(e.byteLength!==16)throw new Error(`Invalid GUID buffer length: ${e.byteLength}`);let t="";for(let n=0;n<e.byteLength;n+=4){let i=e.getUint32(n,!0);t+=i.toString(16).padStart(8,"0")}return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,32)].join("-")}Gt.formatGuid=_u});var ir=te(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.Header=void 0;var Ie=Be(),la=On(),nr=oa();Zn.Header={parse:yu};function yu(s){if(s.byteLength<la.minHeaderLength)throw new Error(`Invalid header: must be at least ${la.minHeaderLength} bytes`);let e=Ie.Binary.toDataView(s),t=Ie.Binary.toCString(s.slice(0,4));if(t!=="LASF")throw new Error(`Invalid file signature: ${t}`);let n=e.getUint8(24),i=e.getUint8(25);if(n!==1||i!==2&&i!==4)throw new Error(`Invalid version (only 1.2 and 1.4 supported): ${n}.${i}`);let r={fileSignature:t,fileSourceId:e.getUint16(4,!0),globalEncoding:e.getUint16(6,!0),projectId:(0,nr.formatGuid)(s.slice(8,24)),majorVersion:n,minorVersion:i,systemIdentifier:Ie.Binary.toCString(s.slice(26,58)),generatingSoftware:Ie.Binary.toCString(s.slice(58,90)),fileCreationDayOfYear:e.getUint16(90,!0),fileCreationYear:e.getUint16(92,!0),headerLength:e.getUint16(94,!0),pointDataOffset:e.getUint32(96,!0),vlrCount:e.getUint32(100,!0),pointDataRecordFormat:e.getUint8(104)&15,pointDataRecordLength:e.getUint16(105,!0),pointCount:e.getUint32(107,!0),pointCountByReturn:xu(s.slice(111,131)),scale:(0,nr.parsePoint)(s.slice(131,155)),offset:(0,nr.parsePoint)(s.slice(155,179)),min:[e.getFloat64(187,!0),e.getFloat64(203,!0),e.getFloat64(219,!0)],max:[e.getFloat64(179,!0),e.getFloat64(195,!0),e.getFloat64(211,!0)],waveformDataOffset:0,evlrOffset:0,evlrCount:0};return i==2?r:{...r,pointCount:(0,Ie.parseBigInt)((0,Ie.getBigUint64)(e,247,!0)),pointCountByReturn:vu(s.slice(255,375)),waveformDataOffset:(0,Ie.parseBigInt)((0,Ie.getBigUint64)(e,227,!0)),evlrOffset:(0,Ie.parseBigInt)((0,Ie.getBigUint64)(e,235,!0)),evlrCount:e.getUint32(243,!0)}}function vu(s){let e=Ie.Binary.toDataView(s),t=[];for(let n=0;n<120;n+=8)t.push((0,Ie.getBigUint64)(e,n,!0));return t.map(n=>(0,Ie.parseBigInt)(n))}function xu(s){let e=Ie.Binary.toDataView(s),t=[];for(let n=0;n<20;n+=4)t.push(e.getUint32(n,!0));return t}});var ca=te((Jn,sr)=>{var rr=(()=>{var s=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return(function(e){e=e||{};var t=typeof e<"u"?e:{},n,i;t.ready=new Promise(function(a,o){n=a,i=o}),["_main","___getTypeName","__embind_initialize_bindings","_fflush","onRuntimeInitialized"].forEach(a=>{Object.getOwnPropertyDescriptor(t.ready,a)||Object.defineProperty(t.ready,a,{get:()=>Re("You are getting "+a+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"),set:()=>Re("You are setting "+a+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")})});var r=Object.assign({},t),l=[],c="./this.program",h=(a,o)=>{throw o},u=!0,f=!1,p=!1,g=!1;if(t.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");var y="";function v(a){return t.locateFile?t.locateFile(a,y):y+a}var b,M,S,R;function L(a){if(a instanceof Co)return;let o=a;a&&typeof a=="object"&&a.stack&&(o=[a,a.stack]),C("exiting due to exception: "+o)}if(g){if(typeof process=="object"&&typeof Ds=="function"||typeof window=="object"||typeof importScripts=="function")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");typeof read<"u"&&(b=function(o){return read(o)}),S=function(o){let d;return typeof readbuffer=="function"?new Uint8Array(readbuffer(o)):(d=read(o,"binary"),N(typeof d=="object"),d)},M=function(o,d,m){setTimeout(()=>d(S(o)),0)},typeof scriptArgs<"u"?l=scriptArgs:typeof arguments<"u"&&(l=arguments),typeof quit=="function"&&(h=(a,o)=>{L(o),quit(a)}),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)}else if(u||f){if(f?y=self.location.href:typeof document<"u"&&document.currentScript&&(y=document.currentScript.src),s&&(y=s),y.indexOf("blob:")!==0?y=y.substr(0,y.replace(/[?#].*/,"").lastIndexOf("/")+1):y="",!(typeof window=="object"||typeof importScripts=="function"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");b=a=>{var o=new XMLHttpRequest;return o.open("GET",a,!1),o.send(null),o.responseText},f&&(S=a=>{var o=new XMLHttpRequest;return o.open("GET",a,!1),o.responseType="arraybuffer",o.send(null),new Uint8Array(o.response)}),M=(a,o,d)=>{var m=new XMLHttpRequest;m.open("GET",a,!0),m.responseType="arraybuffer",m.onload=()=>{if(m.status==200||m.status==0&&m.response){o(m.response);return}d()},m.onerror=d,m.send(null)},R=a=>document.title=a}else throw new Error("environment detection error");var B=t.print||console.log.bind(console),C=t.printErr||console.warn.bind(console);Object.assign(t,r),r=null,nc(),t.arguments&&(l=t.arguments),O("arguments","arguments_"),t.thisProgram&&(c=t.thisProgram),O("thisProgram","thisProgram"),t.quit&&(h=t.quit),O("quit","quit_"),N(typeof t.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),N(typeof t.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),N(typeof t.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),N(typeof t.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),N(typeof t.read>"u","Module.read option was removed (modify read_ in JS)"),N(typeof t.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),N(typeof t.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),N(typeof t.setWindowTitle>"u","Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),N(typeof t.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),O("read","read_"),O("readAsync","readAsync"),O("readBinary","readBinary"),O("setWindowTitle","setWindowTitle"),N(!f,"worker environment detected but not enabled at build time. Add 'worker' to `-sENVIRONMENT` to enable."),N(!p,"node environment detected but not enabled at build time. Add 'node' to `-sENVIRONMENT` to enable."),N(!g,"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");var z=4;function O(a,o){Object.getOwnPropertyDescriptor(t,a)||Object.defineProperty(t,a,{configurable:!0,get:function(){Re("Module."+a+" has been replaced with plain "+o+" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}})}function W(a){Object.getOwnPropertyDescriptor(t,a)&&Re("`Module."+a+"` was supplied but `"+a+"` not included in INCOMING_MODULE_JS_API")}function $(a){return a==="FS_createPath"||a==="FS_createDataFile"||a==="FS_createPreloadedFile"||a==="FS_unlink"||a==="addRunDependency"||a==="FS_createLazyFile"||a==="FS_createDevice"||a==="removeRunDependency"}function j(a){typeof globalThis<"u"&&!Object.getOwnPropertyDescriptor(globalThis,a)&&Object.defineProperty(globalThis,a,{configurable:!0,get:function(){var o="`"+a+"` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line";$(a)&&(o+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),ot(o)}})}function _(a){Object.getOwnPropertyDescriptor(t,a)||Object.defineProperty(t,a,{configurable:!0,get:function(){var o="'"+a+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";$(a)&&(o+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),Re(o)}})}var T;t.wasmBinary&&(T=t.wasmBinary),O("wasmBinary","wasmBinary");var D=t.noExitRuntime||!0;O("noExitRuntime","noExitRuntime"),typeof WebAssembly!="object"&&Re("no native wasm support detected");var V,G=!1,Y;function N(a,o){a||Re("Assertion failed"+(o?": "+o:""))}var ge=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ve(a,o,d){for(var m=o+d,x=o;a[x]&&!(x>=m);)++x;if(x-o>16&&a.buffer&&ge)return ge.decode(a.subarray(o,x));for(var E="";o<x;){var A=a[o++];if(!(A&128)){E+=String.fromCharCode(A);continue}var w=a[o++]&63;if((A&224)==192){E+=String.fromCharCode((A&31)<<6|w);continue}var I=a[o++]&63;if((A&240)==224?A=(A&15)<<12|w<<6|I:((A&248)!=240&&ot("Invalid UTF-8 leading byte 0x"+A.toString(16)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),A=(A&7)<<18|w<<12|I<<6|a[o++]&63),A<65536)E+=String.fromCharCode(A);else{var U=A-65536;E+=String.fromCharCode(55296|U>>10,56320|U&1023)}}return E}function K(a,o){return a?ve(Ce,a,o):""}function ue(a,o,d,m){if(!(m>0))return 0;for(var x=d,E=d+m-1,A=0;A<a.length;++A){var w=a.charCodeAt(A);if(w>=55296&&w<=57343){var I=a.charCodeAt(++A);w=65536+((w&1023)<<10)|I&1023}if(w<=127){if(d>=E)break;o[d++]=w}else if(w<=2047){if(d+1>=E)break;o[d++]=192|w>>6,o[d++]=128|w&63}else if(w<=65535){if(d+2>=E)break;o[d++]=224|w>>12,o[d++]=128|w>>6&63,o[d++]=128|w&63}else{if(d+3>=E)break;w>1114111&&ot("Invalid Unicode code point 0x"+w.toString(16)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),o[d++]=240|w>>18,o[d++]=128|w>>12&63,o[d++]=128|w>>6&63,o[d++]=128|w&63}}return o[d]=0,d-x}function rn(a,o,d){return N(typeof d=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),ue(a,Ce,o,d)}function Pt(a){for(var o=0,d=0;d<a.length;++d){var m=a.charCodeAt(d);m<=127?o++:m<=2047?o+=2:m>=55296&&m<=57343?(o+=4,++d):o+=3}return o}var It,qe,Ce,Lt,Tn,oe,re,es,ts;function ns(a){It=a,t.HEAP8=qe=new Int8Array(a),t.HEAP16=Lt=new Int16Array(a),t.HEAP32=oe=new Int32Array(a),t.HEAPU8=Ce=new Uint8Array(a),t.HEAPU16=Tn=new Uint16Array(a),t.HEAPU32=re=new Uint32Array(a),t.HEAPF32=es=new Float32Array(a),t.HEAPF64=ts=new Float64Array(a)}var Pi=65536;t.TOTAL_STACK&&N(Pi===t.TOTAL_STACK,"the stack size can no longer be determined at runtime");var Ii=t.INITIAL_MEMORY||262144;O("INITIAL_MEMORY","INITIAL_MEMORY"),N(Ii>=Pi,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+Ii+"! (TOTAL_STACK="+Pi+")"),N(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,"JS engine does not provide full typed array support"),N(!t.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),N(Ii==262144,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var at;function mo(){var a=Zi();N((a&3)==0),re[a>>2]=34821223,re[a+4>>2]=2310721022,re[0]=1668509029}function Li(){if(!G){var a=Zi(),o=re[a>>2],d=re[a+4>>2];(o!=34821223||d!=2310721022)&&Re("Stack overflow! Stack cookie has been overwritten at 0x"+a.toString(16)+", expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+d.toString(16)+" 0x"+o.toString(16)),re[0]!==1668509029&&Re("Runtime error: The application has corrupted its heap memory area (address zero)!")}}(function(){var a=new Int16Array(1),o=new Int8Array(a.buffer);if(a[0]=25459,o[0]!==115||o[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();var is=[],rs=[],ss=[],Di=!1;function go(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)vo(t.preRun.shift());Ni(is)}function _o(){N(!Di),Di=!0,Li(),Ni(rs)}function yo(){if(Li(),t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)So(t.postRun.shift());Ni(ss)}function vo(a){is.unshift(a)}function xo(a){rs.unshift(a)}function So(a){ss.unshift(a)}N(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),N(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),N(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),N(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var wt=0,Tt=null,sn=null,an={};function Mo(a){wt++,t.monitorRunDependencies&&t.monitorRunDependencies(wt),a?(N(!an[a]),an[a]=1,Tt===null&&typeof setInterval<"u"&&(Tt=setInterval(function(){if(G){clearInterval(Tt),Tt=null;return}var o=!1;for(var d in an)o||(o=!0,C("still waiting on run dependencies:")),C("dependency: "+d);o&&C("(end of list)")},1e4))):C("warning: run dependency added without ID")}function bo(a){if(wt--,t.monitorRunDependencies&&t.monitorRunDependencies(wt),a?(N(an[a]),delete an[a]):C("warning: run dependency removed without ID"),wt==0&&(Tt!==null&&(clearInterval(Tt),Tt=null),sn)){var o=sn;sn=null,o()}}function Re(a){t.onAbort&&t.onAbort(a),a="Aborted("+a+")",C(a),G=!0,Y=1;var o=new WebAssembly.RuntimeError(a);throw i(o),o}var Ue={error:function(){Re("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM")},init:function(){Ue.error()},createDataFile:function(){Ue.error()},createPreloadedFile:function(){Ue.error()},createLazyFile:function(){Ue.error()},open:function(){Ue.error()},mkdev:function(){Ue.error()},registerDevice:function(){Ue.error()},analyzePath:function(){Ue.error()},loadFilesFromDB:function(){Ue.error()},ErrnoError:function(){Ue.error()}};t.FS_createDataFile=Ue.createDataFile,t.FS_createPreloadedFile=Ue.createPreloadedFile;var wo="data:application/octet-stream;base64,";function as(a){return a.startsWith(wo)}function To(a){return a.startsWith("file://")}function _e(a,o){return function(){var d=a,m=o;return o||(m=t.asm),N(Di,"native function `"+d+"` called before runtime initialization"),m[a]||N(m[a],"exported native function `"+d+"` not found"),m[a].apply(null,arguments)}}var Le;Le="laz-perf.wasm",as(Le)||(Le=v(Le));function os(a){try{if(a==Le&&T)return new Uint8Array(T);if(S)return S(a);throw"both async and sync fetching of the wasm failed"}catch(o){Re(o)}}function Eo(){return!T&&(u||f)&&typeof fetch=="function"?fetch(Le,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Le+"'";return a.arrayBuffer()}).catch(function(){return os(Le)}):Promise.resolve().then(function(){return os(Le)})}function Ao(){var a={env:Cs,wasi_snapshot_preview1:Cs};function o(w,I){var U=w.exports;t.asm=U,V=t.asm.memory,N(V,"memory not found in wasm exports"),ns(V.buffer),at=t.asm.__indirect_function_table,N(at,"table not found in wasm exports"),xo(t.asm.__wasm_call_ctors),bo("wasm-instantiate")}Mo("wasm-instantiate");var d=t;function m(w){N(t===d,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),d=null,o(w.instance)}function x(w){return Eo().then(function(I){return WebAssembly.instantiate(I,a)}).then(function(I){return I}).then(w,function(I){C("failed to asynchronously prepare wasm: "+I),To(Le)&&C("warning: Loading from a file URI ("+Le+") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"),Re(I)})}function E(){return!T&&typeof WebAssembly.instantiateStreaming=="function"&&!as(Le)&&typeof fetch=="function"?fetch(Le,{credentials:"same-origin"}).then(function(w){var I=WebAssembly.instantiateStreaming(w,a);return I.then(m,function(U){return C("wasm streaming compile failed: "+U),C("falling back to ArrayBuffer instantiation"),x(m)})}):x(m)}if(t.instantiateWasm)try{var A=t.instantiateWasm(a,o);return A}catch(w){return C("Module.instantiateWasm callback failed with error: "+w),!1}return E().catch(i),{}}var kp,Vp;function Co(a){this.name="ExitStatus",this.message="Program terminated with exit("+a+")",this.status=a}function Ni(a){for(;a.length>0;)a.shift()(t)}function Ro(a){return ot("warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling"),a}function Gp(a){var o=/\b_Z[\w\d_]+/g;return a.replace(o,function(d){var m=Ro(d);return d===m?d:m+" ["+d+"]"})}function Hp(){var a=new Error;if(!a.stack){try{throw new Error}catch(o){a=o}if(!a.stack)return"(no stack trace available)"}return a.stack.toString()}function ot(a){ot.shown||(ot.shown={}),ot.shown[a]||(ot.shown[a]=1,C(a))}function ls(a,o){N(a.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),qe.set(a,o)}function Po(a){return $i(a+24)+24}function Io(a){this.excPtr=a,this.ptr=a-24,this.set_type=function(o){re[this.ptr+4>>2]=o},this.get_type=function(){return re[this.ptr+4>>2]},this.set_destructor=function(o){re[this.ptr+8>>2]=o},this.get_destructor=function(){return re[this.ptr+8>>2]},this.set_refcount=function(o){oe[this.ptr>>2]=o},this.set_caught=function(o){o=o?1:0,qe[this.ptr+12>>0]=o},this.get_caught=function(){return qe[this.ptr+12>>0]!=0},this.set_rethrown=function(o){o=o?1:0,qe[this.ptr+13>>0]=o},this.get_rethrown=function(){return qe[this.ptr+13>>0]!=0},this.init=function(o,d){this.set_adjusted_ptr(0),this.set_type(o),this.set_destructor(d),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var o=oe[this.ptr>>2];oe[this.ptr>>2]=o+1},this.release_ref=function(){var o=oe[this.ptr>>2];return oe[this.ptr>>2]=o-1,N(o>0),o===1},this.set_adjusted_ptr=function(o){re[this.ptr+16>>2]=o},this.get_adjusted_ptr=function(){return re[this.ptr+16>>2]},this.get_exception_ptr=function(){var o=cc(this.get_type());if(o)return re[this.excPtr>>2];var d=this.get_adjusted_ptr();return d!==0?d:this.excPtr}}var Lo=0,Do=0;function No(a,o,d){var m=new Io(a);throw m.init(o,d),Lo=a,Do++,a+" - Exception catching is disabled, this exception cannot be caught. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch."}function Uo(a,o,d,m,x){}function Ui(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a)}}function Fo(){for(var a=new Array(256),o=0;o<256;++o)a[o]=String.fromCharCode(o);cs=a}var cs=void 0;function Fe(a){for(var o="",d=a;Ce[d];)o+=cs[Ce[d++]];return o}var Dt={},Nt={},En={},Oo=48,Bo=57;function us(a){if(a===void 0)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var o=a.charCodeAt(0);return o>=Oo&&o<=Bo?"_"+a:a}function hs(a,o){return a=us(a),function(){"use strict";return o.apply(this,arguments)}}function Fi(a,o){var d=hs(o,function(m){this.name=o,this.message=m;var x=new Error(m).stack;x!==void 0&&(this.stack=this.toString()+`
3
+ `+x.replace(/^Error(:[^\n]*)?\n/,""))});return d.prototype=Object.create(a.prototype),d.prototype.constructor=d,d.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},d}var Ut=void 0;function ne(a){throw new Ut(a)}var ds=void 0;function An(a){throw new ds(a)}function on(a,o,d){a.forEach(function(w){En[w]=o});function m(w){var I=d(w);I.length!==a.length&&An("Mismatched type converter count");for(var U=0;U<a.length;++U)Qe(a[U],I[U])}var x=new Array(o.length),E=[],A=0;o.forEach((w,I)=>{Nt.hasOwnProperty(w)?x[I]=Nt[w]:(E.push(w),Dt.hasOwnProperty(w)||(Dt[w]=[]),Dt[w].push(()=>{x[I]=Nt[w],++A,A===E.length&&m(x)}))}),E.length===0&&m(x)}function Qe(a,o,d={}){if(!("argPackAdvance"in o))throw new TypeError("registerType registeredInstance requires argPackAdvance");var m=o.name;if(a||ne('type "'+m+'" must have a positive integer typeid pointer'),Nt.hasOwnProperty(a)){if(d.ignoreDuplicateRegistrations)return;ne("Cannot register type '"+m+"' twice")}if(Nt[a]=o,delete En[a],Dt.hasOwnProperty(a)){var x=Dt[a];delete Dt[a],x.forEach(E=>E())}}function zo(a,o,d,m,x){var E=Ui(d);o=Fe(o),Qe(a,{name:o,fromWireType:function(A){return!!A},toWireType:function(A,w){return w?m:x},argPackAdvance:8,readValueFromPointer:function(A){var w;if(d===1)w=qe;else if(d===2)w=Lt;else if(d===4)w=oe;else throw new TypeError("Unknown boolean type size: "+o);return this.fromWireType(w[A>>E])},destructorFunction:null})}function ko(a){if(!(this instanceof lt)||!(a instanceof lt))return!1;for(var o=this.$$.ptrType.registeredClass,d=this.$$.ptr,m=a.$$.ptrType.registeredClass,x=a.$$.ptr;o.baseClass;)d=o.upcast(d),o=o.baseClass;for(;m.baseClass;)x=m.upcast(x),m=m.baseClass;return o===m&&d===x}function Vo(a){return{count:a.count,deleteScheduled:a.deleteScheduled,preservePointerOnDelete:a.preservePointerOnDelete,ptr:a.ptr,ptrType:a.ptrType,smartPtr:a.smartPtr,smartPtrType:a.smartPtrType}}function Oi(a){function o(d){return d.$$.ptrType.registeredClass.name}ne(o(a)+" instance already deleted")}var Bi=!1;function fs(a){}function Go(a){a.smartPtr?a.smartPtrType.rawDestructor(a.smartPtr):a.ptrType.registeredClass.rawDestructor(a.ptr)}function ps(a){a.count.value-=1;var o=a.count.value===0;o&&Go(a)}function ms(a,o,d){if(o===d)return a;if(d.baseClass===void 0)return null;var m=ms(a,o,d.baseClass);return m===null?null:d.downcast(m)}var gs={};function Ho(){return Object.keys(un).length}function Wo(){var a=[];for(var o in un)un.hasOwnProperty(o)&&a.push(un[o]);return a}var ln=[];function zi(){for(;ln.length;){var a=ln.pop();a.$$.deleteScheduled=!1,a.delete()}}var cn=void 0;function Xo(a){cn=a,ln.length&&cn&&cn(zi)}function qo(){t.getInheritedInstanceCount=Ho,t.getLiveInheritedInstances=Wo,t.flushPendingDeletes=zi,t.setDelayFunction=Xo}var un={};function Yo(a,o){for(o===void 0&&ne("ptr should not be undefined");a.baseClass;)o=a.upcast(o),a=a.baseClass;return o}function $o(a,o){return o=Yo(a,o),un[o]}function Cn(a,o){(!o.ptrType||!o.ptr)&&An("makeClassHandle requires ptr and ptrType");var d=!!o.smartPtrType,m=!!o.smartPtr;return d!==m&&An("Both smartPtrType and smartPtr must be specified"),o.count={value:1},hn(Object.create(a,{$$:{value:o}}))}function _s(a){var o=this.getPointee(a);if(!o)return this.destructor(a),null;var d=$o(this.registeredClass,o);if(d!==void 0){if(d.$$.count.value===0)return d.$$.ptr=o,d.$$.smartPtr=a,d.clone();var m=d.clone();return this.destructor(a),m}function x(){return this.isSmartPointer?Cn(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:o,smartPtrType:this,smartPtr:a}):Cn(this.registeredClass.instancePrototype,{ptrType:this,ptr:a})}var E=this.registeredClass.getActualType(o),A=gs[E];if(!A)return x.call(this);var w;this.isConst?w=A.constPointerType:w=A.pointerType;var I=ms(o,this.registeredClass,w.registeredClass);return I===null?x.call(this):this.isSmartPointer?Cn(w.registeredClass.instancePrototype,{ptrType:w,ptr:I,smartPtrType:this,smartPtr:a}):Cn(w.registeredClass.instancePrototype,{ptrType:w,ptr:I})}function hn(a){return typeof FinalizationRegistry>"u"?(hn=o=>o,a):(Bi=new FinalizationRegistry(o=>{console.warn(o.leakWarning.stack.replace(/^Error: /,"")),ps(o.$$)}),hn=o=>{var d=o.$$,m=!!d.smartPtr;if(m){var x={$$:d},E=d.ptrType.registeredClass;x.leakWarning=new Error("Embind found a leaked C++ instance "+E.name+" <0x"+d.ptr.toString(16)+`>.
4
4
  We'll free it automatically in this case, but this functionality is not reliable across various environments.
5
5
  Make sure to invoke .delete() manually once you're done with the instance instead.
6
- Originally allocated`),"captureStackTrace"in Error&&Error.captureStackTrace(x.leakWarning,vs),zi.register(o,x,o)}return o},ms=o=>zi.unregister(o),dn(a))}function jo(){if(this.$$.ptr||Bi(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var a=dn(Object.create(Object.getPrototypeOf(this),{$$:{value:Ho(this.$$)}}));return a.$$.count.value+=1,a.$$.deleteScheduled=!1,a}function Ko(){this.$$.ptr||Bi(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ne("Object already scheduled for deletion"),ms(this),gs(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Qo(){return!this.$$.ptr}function el(){return this.$$.ptr||Bi(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ne("Object already scheduled for deletion"),un.push(this),un.length===1&&hn&&hn(Vi),this.$$.deleteScheduled=!0,this}function tl(){ct.prototype.isAliasOf=Go,ct.prototype.clone=jo,ct.prototype.delete=Ko,ct.prototype.isDeleted=Qo,ct.prototype.deleteLater=el}function ct(){}function xs(a,o,f){if(a[o].overloadTable===void 0){var m=a[o];a[o]=function(){return a[o].overloadTable.hasOwnProperty(arguments.length)||ne("Function '"+f+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+a[o].overloadTable+")!"),a[o].overloadTable[arguments.length].apply(this,arguments)},a[o].overloadTable=[],a[o].overloadTable[m.argCount]=m}}function nl(a,o,f){t.hasOwnProperty(a)?((f===void 0||t[a].overloadTable!==void 0&&t[a].overloadTable[f]!==void 0)&&ne("Cannot register public name '"+a+"' twice"),xs(t,a,a),t.hasOwnProperty(f)&&ne("Cannot register multiple overloads of a function with the same number of arguments ("+f+")!"),t[a].overloadTable[f]=o):(t[a]=o,f!==void 0&&(t[a].numArguments=f))}function il(a,o,f,m,x,E,A,w){this.name=a,this.constructor=o,this.instancePrototype=f,this.rawDestructor=m,this.baseClass=x,this.getActualType=E,this.upcast=A,this.downcast=w,this.pureVirtualFunctions=[]}function ki(a,o,f){for(;o!==f;)o.upcast||ne("Expected null or instance of "+f.name+", got an instance of "+o.name),a=o.upcast(a),o=o.baseClass;return a}function rl(a,o){if(o===null)return this.isReference&&ne("null is not a valid "+this.name),0;o.$$||ne('Cannot pass "'+Bt(o)+'" as a '+this.name),o.$$.ptr||ne("Cannot pass deleted object as a pointer of type "+this.name);var f=o.$$.ptrType.registeredClass,m=ki(o.$$.ptr,f,this.registeredClass);return m}function sl(a,o){var f;if(o===null)return this.isReference&&ne("null is not a valid "+this.name),this.isSmartPointer?(f=this.rawConstructor(),a!==null&&a.push(this.rawDestructor,f),f):0;o.$$||ne('Cannot pass "'+Bt(o)+'" as a '+this.name),o.$$.ptr||ne("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&o.$$.ptrType.isConst&&ne("Cannot convert argument of type "+(o.$$.smartPtrType?o.$$.smartPtrType.name:o.$$.ptrType.name)+" to parameter type "+this.name);var m=o.$$.ptrType.registeredClass;if(f=ki(o.$$.ptr,m,this.registeredClass),this.isSmartPointer)switch(o.$$.smartPtr===void 0&&ne("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:o.$$.smartPtrType===this?f=o.$$.smartPtr:ne("Cannot convert argument of type "+(o.$$.smartPtrType?o.$$.smartPtrType.name:o.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:f=o.$$.smartPtr;break;case 2:if(o.$$.smartPtrType===this)f=o.$$.smartPtr;else{var x=o.clone();f=this.rawShare(f,Wi.toHandle(function(){x.delete()})),a!==null&&a.push(this.rawDestructor,f)}break;default:ne("Unsupporting sharing policy")}return f}function al(a,o){if(o===null)return this.isReference&&ne("null is not a valid "+this.name),0;o.$$||ne('Cannot pass "'+Bt(o)+'" as a '+this.name),o.$$.ptr||ne("Cannot pass deleted object as a pointer of type "+this.name),o.$$.ptrType.isConst&&ne("Cannot convert argument of type "+o.$$.ptrType.name+" to parameter type "+this.name);var f=o.$$.ptrType.registeredClass,m=ki(o.$$.ptr,f,this.registeredClass);return m}function Ln(a){return this.fromWireType(oe[a>>2])}function ol(a){return this.rawGetPointee&&(a=this.rawGetPointee(a)),a}function ll(a){this.rawDestructor&&this.rawDestructor(a)}function cl(a){a!==null&&a.delete()}function ul(){tt.prototype.getPointee=ol,tt.prototype.destructor=ll,tt.prototype.argPackAdvance=8,tt.prototype.readValueFromPointer=Ln,tt.prototype.deleteObject=cl,tt.prototype.fromWireType=vs}function tt(a,o,f,m,x,E,A,w,I,N,X){this.name=a,this.registeredClass=o,this.isReference=f,this.isConst=m,this.isSmartPointer=x,this.pointeeType=E,this.sharingPolicy=A,this.rawGetPointee=w,this.rawConstructor=I,this.rawShare=N,this.rawDestructor=X,!x&&o.baseClass===void 0?m?(this.toWireType=rl,this.destructorFunction=null):(this.toWireType=al,this.destructorFunction=null):this.toWireType=sl}function hl(a,o,f){t.hasOwnProperty(a)||Pn("Replacing nonexistant public symbol"),t[a].overloadTable!==void 0&&f!==void 0?t[a].overloadTable[f]=o:(t[a]=o,t[a].argCount=f)}function fl(a,o,f){U("dynCall_"+a in t,"bad function pointer type - no table for sig '"+a+"'"),f&&f.length?U(f.length===a.substring(1).replace(/j/g,"--").length):U(a.length==1);var m=t["dynCall_"+a];return f&&f.length?m.apply(null,[o].concat(f)):m.call(null,o)}var pn=[];function Dn(a){var o=pn[a];return o||(a>=pn.length&&(pn.length=a+1),pn[a]=o=ot.get(a)),U(ot.get(a)==o,"JavaScript-side Wasm function table mirror is out of date!"),o}function dl(a,o,f){if(a.includes("j"))return fl(a,o,f);U(Dn(o),"missing table entry in dynCall: "+o);var m=Dn(o).apply(null,f);return m}function pl(a,o){U(a.includes("j")||a.includes("p"),"getDynCaller should only be called with i64 sigs");var f=[];return function(){return f.length=0,Object.assign(f,arguments),dl(a,o,f)}}function Ot(a,o){a=Oe(a);function f(){return a.includes("j")?pl(a,o):Dn(o)}var m=f();return typeof m!="function"&&ne("unknown function pointer with signature "+a+": "+o),m}var Ss=void 0;function ml(a){var o=sc(a),f=Oe(o);return ut(o),f}function Gi(a,o){var f=[],m={};function x(E){if(!m[E]&&!Nt[E]){if(Rn[E]){Rn[E].forEach(x);return}f.push(E),m[E]=!0}}throw o.forEach(x),new Ss(a+": "+f.map(ml).join([", "]))}function gl(a,o,f,m,x,E,A,w,I,N,X,Z,q){X=Oe(X),E=Ot(x,E),w&&(w=Ot(A,w)),N&&(N=Ot(I,N)),q=Ot(Z,q);var ce=fs(X);nl(ce,function(){Gi("Cannot construct "+X+" due to unbound types",[m])}),cn([a,o,f],m?[m]:[],function(ie){ie=ie[0];var se,Pe;m?(se=ie.registeredClass,Pe=se.instancePrototype):Pe=ct.prototype;var Ze=ds(ce,function(){if(Object.getPrototypeOf(this)!==P)throw new Ft("Use 'new' to construct "+X);if(H.constructor_body===void 0)throw new Ft(X+" has no accessible constructor");var Fn=H.constructor_body[arguments.length];if(Fn===void 0)throw new Ft("Tried to invoke ctor of "+X+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(H.constructor_body).toString()+") parameters instead!");return Fn.apply(this,arguments)}),P=Object.create(Pe,{constructor:{value:Ze}});Ze.prototype=P;var H=new il(X,Ze,P,q,se,E,w,N),xe=new tt(X,H,!0,!1,!1),ye=new tt(X+"*",H,!1,!1,!1),At=new tt(X+" const*",H,!1,!0,!1);return ys[a]={pointerType:ye,constPointerType:At},hl(ce,Ze),[xe,ye,At]})}function bs(a,o){for(var f=[],m=0;m<a;m++)f.push(re[o+m*4>>2]);return f}function _l(a){for(;a.length;){var o=a.pop(),f=a.pop();f(o)}}function Ms(a,o,f,m,x){var E=o.length;E<2&&ne("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var A=o[1]!==null&&f!==null,w=!1,I=1;I<o.length;++I)if(o[I]!==null&&o[I].destructorFunction===void 0){w=!0;break}var N=o[0].name!=="void",X=E-2,Z=new Array(X),q=[],ce=[];return function(){arguments.length!==X&&ne("function "+a+" called with "+arguments.length+" arguments, expected "+X+" args!"),ce.length=0;var ie;q.length=A?2:1,q[0]=x,A&&(ie=o[1].toWireType(ce,this),q[1]=ie);for(var se=0;se<X;++se)Z[se]=o[se+2].toWireType(ce,arguments[se]),q.push(Z[se]);var Pe=m.apply(null,q);function Ze(P){if(w)_l(ce);else for(var H=A?1:2;H<o.length;H++){var xe=H===1?ie:Z[H-2];o[H].destructorFunction!==null&&o[H].destructorFunction(xe)}if(N)return o[0].fromWireType(P)}return Ze(Pe)}}function yl(a,o,f,m,x,E){U(o>0);var A=bs(o,f);x=Ot(m,x),cn([],[a],function(w){w=w[0];var I="constructor "+w.name;if(w.registeredClass.constructor_body===void 0&&(w.registeredClass.constructor_body=[]),w.registeredClass.constructor_body[o-1]!==void 0)throw new Ft("Cannot register multiple constructors with identical number of parameters ("+(o-1)+") for class '"+w.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return w.registeredClass.constructor_body[o-1]=()=>{Gi("Cannot construct "+w.name+" due to unbound types",A)},cn([],A,function(N){return N.splice(1,0,null),w.registeredClass.constructor_body[o-1]=Ms(I,N,null,x,E),[]}),[]})}function vl(a,o,f,m,x,E,A,w){var I=bs(f,m);o=Oe(o),E=Ot(x,E),cn([],[a],function(N){N=N[0];var X=N.name+"."+o;o.startsWith("@@")&&(o=Symbol[o.substring(2)]),w&&N.registeredClass.pureVirtualFunctions.push(o);function Z(){Gi("Cannot call "+X+" due to unbound types",I)}var q=N.registeredClass.instancePrototype,ce=q[o];return ce===void 0||ce.overloadTable===void 0&&ce.className!==N.name&&ce.argCount===f-2?(Z.argCount=f-2,Z.className=N.name,q[o]=Z):(xs(q,o,X),q[o].overloadTable[f-2]=Z),cn([],I,function(ie){var se=Ms(X,ie,N,E,A);return q[o].overloadTable===void 0?(se.argCount=f-2,q[o]=se):q[o].overloadTable[f-2]=se,[]}),[]})}var Hi=[],$e=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function xl(a){a>4&&--$e[a].refcount===0&&($e[a]=void 0,Hi.push(a))}function Sl(){for(var a=0,o=5;o<$e.length;++o)$e[o]!==void 0&&++a;return a}function bl(){for(var a=5;a<$e.length;++a)if($e[a]!==void 0)return $e[a];return null}function Ml(){t.count_emval_handles=Sl,t.get_first_emval=bl}var Wi={toValue:a=>(a||ne("Cannot use deleted val. handle = "+a),$e[a].value),toHandle:a=>{switch(a){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var o=Hi.length?Hi.pop():$e.length;return $e[o]={refcount:1,value:a},o}}}};function wl(a,o){o=Oe(o),et(a,{name:o,fromWireType:function(f){var m=Wi.toValue(f);return xl(f),m},toWireType:function(f,m){return Wi.toHandle(m)},argPackAdvance:8,readValueFromPointer:Ln,destructorFunction:null})}function Bt(a){if(a===null)return"null";var o=typeof a;return o==="object"||o==="array"||o==="function"?a.toString():""+a}function Tl(a,o){switch(o){case 2:return function(f){return this.fromWireType(ns[f>>2])};case 3:return function(f){return this.fromWireType(is[f>>3])};default:throw new TypeError("Unknown float type: "+a)}}function El(a,o,f){var m=Fi(f);o=Oe(o),et(a,{name:o,fromWireType:function(x){return x},toWireType:function(x,E){if(typeof E!="number"&&typeof E!="boolean")throw new TypeError('Cannot convert "'+Bt(E)+'" to '+this.name);return E},argPackAdvance:8,readValueFromPointer:Tl(o,m),destructorFunction:null})}function Al(a,o,f){switch(o){case 0:return f?function(x){return Ye[x]}:function(x){return Ce[x]};case 1:return f?function(x){return Dt[x>>1]}:function(x){return Cn[x>>1]};case 2:return f?function(x){return oe[x>>2]}:function(x){return re[x>>2]};default:throw new TypeError("Unknown integer type: "+a)}}function Cl(a,o,f,m,x){o=Oe(o),x===-1&&(x=4294967295);var E=Fi(f),A=Z=>Z;if(m===0){var w=32-8*f;A=Z=>Z<<w>>>w}var I=o.includes("unsigned"),N=(Z,q)=>{if(typeof Z!="number"&&typeof Z!="boolean")throw new TypeError('Cannot convert "'+Bt(Z)+'" to '+q);if(Z<m||Z>x)throw new TypeError('Passing a number "'+Bt(Z)+'" from JS side to C/C++ side to an argument of type "'+o+'", which is outside the valid range ['+m+", "+x+"]!")},X;I?X=function(Z,q){return N(q,this.name),q>>>0}:X=function(Z,q){return N(q,this.name),q},et(a,{name:o,fromWireType:A,toWireType:X,argPackAdvance:8,readValueFromPointer:Al(o,E,m!==0),destructorFunction:null})}function Rl(a,o,f){var m=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],x=m[o];function E(A){A=A>>2;var w=re,I=w[A],N=w[A+1];return new x(Lt,N,I)}f=Oe(f),et(a,{name:f,fromWireType:E,argPackAdvance:8,readValueFromPointer:E},{ignoreDuplicateRegistrations:!0})}function Pl(a,o){o=Oe(o);var f=o==="std::string";et(a,{name:o,fromWireType:function(m){var x=re[m>>2],E=m+4,A;if(f)for(var w=E,I=0;I<=x;++I){var N=E+I;if(I==x||Ce[N]==0){var X=N-w,Z=K(w,X);A===void 0?A=Z:(A+="\0",A+=Z),w=N+1}}else{for(var q=new Array(x),I=0;I<x;++I)q[I]=String.fromCharCode(Ce[E+I]);A=q.join("")}return ut(m),A},toWireType:function(m,x){x instanceof ArrayBuffer&&(x=new Uint8Array(x));var E,A=typeof x=="string";A||x instanceof Uint8Array||x instanceof Uint8ClampedArray||x instanceof Int8Array||ne("Cannot pass non-string to std::string"),f&&A?E=It(x):E=x.length;var w=Zi(4+E+1),I=w+4;if(re[w>>2]=E,f&&A)an(x,I,E+1);else if(A)for(var N=0;N<E;++N){var X=x.charCodeAt(N);X>255&&(ut(I),ne("String has UTF-16 code units that do not fit in 8 bits")),Ce[I+N]=X}else for(var N=0;N<E;++N)Ce[I+N]=x[N];return m!==null&&m.push(ut,w),w},argPackAdvance:8,readValueFromPointer:Ln,destructorFunction:function(m){ut(m)}})}var ws=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Il(a,o){U(a%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var f=a,m=f>>1,x=m+o/2;!(m>=x)&&Cn[m];)++m;if(f=m<<1,f-a>32&&ws)return ws.decode(Ce.subarray(a,f));for(var E="",A=0;!(A>=o/2);++A){var w=Dt[a+A*2>>1];if(w==0)break;E+=String.fromCharCode(w)}return E}function Ll(a,o,f){if(U(o%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),U(typeof f=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),f===void 0&&(f=2147483647),f<2)return 0;f-=2;for(var m=o,x=f<a.length*2?f/2:a.length,E=0;E<x;++E){var A=a.charCodeAt(E);Dt[o>>1]=A,o+=2}return Dt[o>>1]=0,o-m}function Dl(a){return a.length*2}function Ul(a,o){U(a%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var f=0,m="";!(f>=o/4);){var x=oe[a+f*4>>2];if(x==0)break;if(++f,x>=65536){var E=x-65536;m+=String.fromCharCode(55296|E>>10,56320|E&1023)}else m+=String.fromCharCode(x)}return m}function Nl(a,o,f){if(U(o%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),U(typeof f=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),f===void 0&&(f=2147483647),f<4)return 0;for(var m=o,x=m+f-4,E=0;E<a.length;++E){var A=a.charCodeAt(E);if(A>=55296&&A<=57343){var w=a.charCodeAt(++E);A=65536+((A&1023)<<10)|w&1023}if(oe[o>>2]=A,o+=4,o+4>x)break}return oe[o>>2]=0,o-m}function Fl(a){for(var o=0,f=0;f<a.length;++f){var m=a.charCodeAt(f);m>=55296&&m<=57343&&++f,o+=4}return o}function Ol(a,o,f){f=Oe(f);var m,x,E,A,w;o===2?(m=Il,x=Ll,A=Dl,E=()=>Cn,w=1):o===4&&(m=Ul,x=Nl,A=Fl,E=()=>re,w=2),et(a,{name:f,fromWireType:function(I){for(var N=re[I>>2],X=E(),Z,q=I+4,ce=0;ce<=N;++ce){var ie=I+4+ce*o;if(ce==N||X[ie>>w]==0){var se=ie-q,Pe=m(q,se);Z===void 0?Z=Pe:(Z+="\0",Z+=Pe),q=ie+o}}return ut(I),Z},toWireType:function(I,N){typeof N!="string"&&ne("Cannot pass non-string to C++ string type "+f);var X=A(N),Z=Zi(4+X+o);return re[Z>>2]=X>>w,x(N,Z+4,X+o),I!==null&&I.push(ut,Z),Z},argPackAdvance:8,readValueFromPointer:Ln,destructorFunction:function(I){ut(I)}})}function Bl(a,o){o=Oe(o),et(a,{isVoid:!0,name:o,argPackAdvance:0,fromWireType:function(){},toWireType:function(f,m){}})}function zl(){Re("native code called abort()")}function Vl(a,o,f){Ce.copyWithin(a,o,o+f)}function kl(){return 2147483648}function Gl(a){try{return k.grow(a-Lt.byteLength+65535>>>16),rs(k.buffer),1}catch(o){C("emscripten_realloc_buffer: Attempted to grow heap from "+Lt.byteLength+" bytes to "+a+" bytes, but got error: "+o)}}function Hl(a){var o=Ce.length;a=a>>>0,U(a>o);var f=kl();if(a>f)return C("Cannot enlarge memory, asked to go up to "+a+" bytes, but the limit is "+f+" bytes!"),!1;let m=(I,N)=>I+(N-I%N)%N;for(var x=1;x<=4;x*=2){var E=o*(1+.2/x);E=Math.min(E,a+100663296);var A=Math.min(f,m(Math.max(a,E),65536)),w=Gl(A);if(w)return!0}return C("Failed to grow the heap from "+o+" bytes to "+A+" bytes, not enough memory!"),!1}var Xi={};function Wl(){return c||"./this.program"}function mn(){if(!mn.strings){var a=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",o={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:a,_:Wl()};for(var f in Xi)Xi[f]===void 0?delete o[f]:o[f]=Xi[f];var m=[];for(var f in o)m.push(f+"="+o[f]);mn.strings=m}return mn.strings}function Xl(a,o,f){for(var m=0;m<a.length;++m)U(a.charCodeAt(m)===(a.charCodeAt(m)&255)),Ye[o++>>0]=a.charCodeAt(m);f||(Ye[o>>0]=0)}var qi={varargs:void 0,get:function(){U(qi.varargs!=null),qi.varargs+=4;var a=oe[qi.varargs-4>>2];return a},getStr:function(a){var o=K(a);return o}};function ql(a,o){var f=0;return mn().forEach(function(m,x){var E=o+f;re[a+x*4>>2]=E,Xl(m,E),f+=m.length+1}),0}function Yl(a,o){var f=mn();re[a>>2]=f.length;var m=0;return f.forEach(function(x){m+=x.length+1}),re[o>>2]=m,0}function $l(a){Re("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM")}function Zl(a,o,f,m,x){return 70}var Yi=[null,[],[]];function $i(a,o){var f=Yi[a];U(f),o===0||o===10?((a===1?B:C)(ve(f,0)),f.length=0):f.push(o)}function Xp(){ac(0),Yi[1].length&&$i(1,10),Yi[2].length&&$i(2,10)}function Jl(a,o,f,m){for(var x=0,E=0;E<f;E++){var A=re[o>>2],w=re[o+4>>2];o+=8;for(var I=0;I<w;I++)$i(a,Ce[A+I]);x+=w}return re[m>>2]=x,0}function Un(a){return a%4===0&&(a%100!==0||a%400===0)}function jl(a,o){for(var f=0,m=0;m<=o;f+=a[m++]);return f}var Ts=[31,29,31,30,31,30,31,31,30,31,30,31],Es=[31,28,31,30,31,30,31,31,30,31,30,31];function Kl(a,o){for(var f=new Date(a.getTime());o>0;){var m=Un(f.getFullYear()),x=f.getMonth(),E=(m?Ts:Es)[x];if(o>E-f.getDate())o-=E-f.getDate()+1,f.setDate(1),x<11?f.setMonth(x+1):(f.setMonth(0),f.setFullYear(f.getFullYear()+1));else return f.setDate(f.getDate()+o),f}return f}function Ql(a,o,f){var m=f>0?f:It(a)+1,x=new Array(m),E=ue(a,x,0,x.length);return o&&(x.length=E),x}function ec(a,o,f,m){var x=oe[m+40>>2],E={tm_sec:oe[m>>2],tm_min:oe[m+4>>2],tm_hour:oe[m+8>>2],tm_mday:oe[m+12>>2],tm_mon:oe[m+16>>2],tm_year:oe[m+20>>2],tm_wday:oe[m+24>>2],tm_yday:oe[m+28>>2],tm_isdst:oe[m+32>>2],tm_gmtoff:oe[m+36>>2],tm_zone:x?K(x):""},A=K(f),w={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var I in w)A=A.replace(new RegExp(I,"g"),w[I]);var N=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],X=["January","February","March","April","May","June","July","August","September","October","November","December"];function Z(P,H,xe){for(var ye=typeof P=="number"?P.toString():P||"";ye.length<H;)ye=xe[0]+ye;return ye}function q(P,H){return Z(P,H,"0")}function ce(P,H){function xe(At){return At<0?-1:At>0?1:0}var ye;return(ye=xe(P.getFullYear()-H.getFullYear()))===0&&(ye=xe(P.getMonth()-H.getMonth()))===0&&(ye=xe(P.getDate()-H.getDate())),ye}function ie(P){switch(P.getDay()){case 0:return new Date(P.getFullYear()-1,11,29);case 1:return P;case 2:return new Date(P.getFullYear(),0,3);case 3:return new Date(P.getFullYear(),0,2);case 4:return new Date(P.getFullYear(),0,1);case 5:return new Date(P.getFullYear()-1,11,31);case 6:return new Date(P.getFullYear()-1,11,30)}}function se(P){var H=Kl(new Date(P.tm_year+1900,0,1),P.tm_yday),xe=new Date(H.getFullYear(),0,4),ye=new Date(H.getFullYear()+1,0,4),At=ie(xe),Fn=ie(ye);return ce(At,H)<=0?ce(Fn,H)<=0?H.getFullYear()+1:H.getFullYear():H.getFullYear()-1}var Pe={"%a":function(P){return N[P.tm_wday].substring(0,3)},"%A":function(P){return N[P.tm_wday]},"%b":function(P){return X[P.tm_mon].substring(0,3)},"%B":function(P){return X[P.tm_mon]},"%C":function(P){var H=P.tm_year+1900;return q(H/100|0,2)},"%d":function(P){return q(P.tm_mday,2)},"%e":function(P){return Z(P.tm_mday,2," ")},"%g":function(P){return se(P).toString().substring(2)},"%G":function(P){return se(P)},"%H":function(P){return q(P.tm_hour,2)},"%I":function(P){var H=P.tm_hour;return H==0?H=12:H>12&&(H-=12),q(H,2)},"%j":function(P){return q(P.tm_mday+jl(Un(P.tm_year+1900)?Ts:Es,P.tm_mon-1),3)},"%m":function(P){return q(P.tm_mon+1,2)},"%M":function(P){return q(P.tm_min,2)},"%n":function(){return`
7
- `},"%p":function(P){return P.tm_hour>=0&&P.tm_hour<12?"AM":"PM"},"%S":function(P){return q(P.tm_sec,2)},"%t":function(){return" "},"%u":function(P){return P.tm_wday||7},"%U":function(P){var H=P.tm_yday+7-P.tm_wday;return q(Math.floor(H/7),2)},"%V":function(P){var H=Math.floor((P.tm_yday+7-(P.tm_wday+6)%7)/7);if((P.tm_wday+371-P.tm_yday-2)%7<=2&&H++,H){if(H==53){var ye=(P.tm_wday+371-P.tm_yday)%7;ye!=4&&(ye!=3||!Un(P.tm_year))&&(H=1)}}else{H=52;var xe=(P.tm_wday+7-P.tm_yday-1)%7;(xe==4||xe==5&&Un(P.tm_year%400-1))&&H++}return q(H,2)},"%w":function(P){return P.tm_wday},"%W":function(P){var H=P.tm_yday+7-(P.tm_wday+6)%7;return q(Math.floor(H/7),2)},"%y":function(P){return(P.tm_year+1900).toString().substring(2)},"%Y":function(P){return P.tm_year+1900},"%z":function(P){var H=P.tm_gmtoff,xe=H>=0;return H=Math.abs(H)/60,H=H/60*100+H%60,(xe?"+":"-")+("0000"+H).slice(-4)},"%Z":function(P){return P.tm_zone},"%%":function(){return"%"}};A=A.replace(/%%/g,"\0\0");for(var I in Pe)A.includes(I)&&(A=A.replace(new RegExp(I,"g"),Pe[I](E)));A=A.replace(/\0\0/g,"%");var Ze=Ql(A,!1);return Ze.length>o?0:(us(Ze,a),Ze.length-1)}function tc(a,o,f,m){return ec(a,o,f,m)}function As(a,o){U(a<16384),a<128?o.push(a):o.push(a%128|128,a>>7)}function nc(a){for(var o={i:"i32",j:"i64",f:"f32",d:"f64",p:"i32"},f={parameters:[],results:a[0]=="v"?[]:[o[a[0]]]},m=1;m<a.length;++m)U(a[m]in o,"invalid signature char: "+a[m]),f.parameters.push(o[a[m]]);return f}function qp(a,o){if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(nc(o),a);var f=[1,96],m=o.slice(0,1),x=o.slice(1),E={i:127,p:127,j:126,f:125,d:124};As(x.length,f);for(var A=0;A<x.length;++A)U(x[A]in E,"invalid signature char: "+x[A]),f.push(E[x[A]]);m=="v"?f.push(0):f.push(1,E[m]);var w=[0,97,115,109,1,0,0,0,1];As(f.length,w),w.push.apply(w,f),w.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var I=new WebAssembly.Module(new Uint8Array(w)),N=new WebAssembly.Instance(I,{e:{f:a}}),X=N.exports.f;return X}function Yp(a,o){if(Cs)for(var f=a;f<a+o;f++){var m=Dn(f);m&&Cs.set(m,f)}}var Cs=void 0,Rs=[];function $p(){if(Rs.length)return Rs.pop();try{ot.grow(1)}catch(a){throw a instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":a}return ot.length-1}function Zp(a,o){ot.set(a,o),pn[a]=ot.get(a)}var Jp=1;function ic(a){var o=t["_"+a];return U(o,"Cannot call unknown function "+a+", make sure it is exported"),o}function jp(a,o,f,m,x){var E={string:ie=>{var se=0;if(ie!=null&&ie!==0){var Pe=(ie.length<<2)+1;se=Ls(Pe),an(ie,se,Pe)}return se},array:ie=>{var se=Ls(ie.length);return us(ie,se),se}};function A(ie){return o==="string"?K(ie):o==="boolean"?!!ie:ie}var w=ic(a),I=[],N=0;if(U(o!=="array",'Return type should not be "array".'),m)for(var X=0;X<m.length;X++){var Z=E[f[X]];Z?(N===0&&(N=cc()),I[X]=Z(m[X])):I[X]=m[X]}var q=w.apply(null,I);function ce(ie){return N!==0&&uc(N),A(ie)}return q=ce(q),q}Bo(),Ft=t.BindingError=Oi(Error,"BindingError"),ps=t.InternalError=Oi(Error,"InternalError"),tl(),$o(),ul(),Ss=t.UnboundTypeError=Oi(Error,"UnboundTypeError"),Ml();var Kp=!0;function rc(){W("fetchSettings")}var Ps={__cxa_allocate_exception:Lo,__cxa_throw:Fo,_embind_register_bigint:Oo,_embind_register_bool:ko,_embind_register_class:gl,_embind_register_class_constructor:yl,_embind_register_class_function:vl,_embind_register_emval:wl,_embind_register_float:El,_embind_register_integer:Cl,_embind_register_memory_view:Rl,_embind_register_std_string:Pl,_embind_register_std_wstring:Ol,_embind_register_void:Bl,abort:zl,emscripten_memcpy_big:Vl,emscripten_resize_heap:Hl,environ_get:ql,environ_sizes_get:Yl,fd_close:$l,fd_seek:Zl,fd_write:Jl,strftime_l:tc},Qp=Ro(),em=t.___wasm_call_ctors=_e("__wasm_call_ctors"),Zi=t._malloc=_e("malloc"),ut=t._free=_e("free"),sc=t.___getTypeName=_e("__getTypeName"),tm=t.__embind_initialize_bindings=_e("_embind_initialize_bindings"),nm=t.___errno_location=_e("__errno_location"),ac=t._fflush=_e("fflush"),Is=t._emscripten_stack_init=function(){return(Is=t._emscripten_stack_init=t.asm.emscripten_stack_init).apply(null,arguments)},oc=t._emscripten_stack_get_free=function(){return(oc=t._emscripten_stack_get_free=t.asm.emscripten_stack_get_free).apply(null,arguments)},lc=t._emscripten_stack_get_base=function(){return(lc=t._emscripten_stack_get_base=t.asm.emscripten_stack_get_base).apply(null,arguments)},Ji=t._emscripten_stack_get_end=function(){return(Ji=t._emscripten_stack_get_end=t.asm.emscripten_stack_get_end).apply(null,arguments)},cc=t.stackSave=_e("stackSave"),uc=t.stackRestore=_e("stackRestore"),Ls=t.stackAlloc=_e("stackAlloc"),hc=t.___cxa_is_pointer_type=_e("__cxa_is_pointer_type"),im=t.dynCall_viijii=_e("dynCall_viijii"),rm=t.dynCall_ji=_e("dynCall_ji"),sm=t.dynCall_jiji=_e("dynCall_jiji"),am=t.dynCall_iiiiij=_e("dynCall_iiiiij"),om=t.dynCall_iiiiijj=_e("dynCall_iiiiijj"),lm=t.dynCall_iiiiiijj=_e("dynCall_iiiiiijj"),fc=["run","UTF8ArrayToString","UTF8ToString","stringToUTF8Array","stringToUTF8","lengthBytesUTF8","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","FS_createFolder","FS_createPath","FS_createDataFile","FS_createPreloadedFile","FS_createLazyFile","FS_createLink","FS_createDevice","FS_unlink","getLEB","getFunctionTables","alignFunctionTables","registerFunctions","prettyPrint","getCompilerSetting","print","printErr","callMain","abort","keepRuntimeAlive","wasmMemory","stackAlloc","stackSave","stackRestore","getTempRet0","setTempRet0","writeStackCookie","checkStackCookie","ptrToString","zeroMemory","stringToNewUTF8","exitJS","getHeapMax","emscripten_realloc_buffer","ENV","ERRNO_CODES","ERRNO_MESSAGES","setErrNo","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","DNS","getHostByName","Protocols","Sockets","getRandomDevice","warnOnce","traverseStack","UNWIND_CACHE","convertPCtoSourceLocation","readAsmConstArgsArray","readAsmConstArgs","mainThreadEM_ASM","jstoi_q","jstoi_s","getExecutableName","listenOnce","autoResumeAudioContext","dynCallLegacy","getDynCaller","dynCall","handleException","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","safeSetTimeout","asmjsMangle","asyncLoad","alignMemory","mmapAlloc","writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getCFunc","ccall","cwrap","uleb128Encode","sigToWasmTypes","convertJsFunctionToWasm","freeTableIndexes","functionsInTableMap","getEmptyTableSlot","updateTableMap","addFunction","removeFunction","reallyNegative","unSign","strLen","reSign","formatString","setValue","getValue","PATH","PATH_FS","intArrayFromString","intArrayToString","AsciiToString","stringToAscii","UTF16Decoder","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","allocateUTF8","allocateUTF8OnStack","writeStringToMemory","writeArrayToMemory","writeAsciiToMemory","SYSCALLS","getSocketFromFD","getSocketAddress","JSEvents","registerKeyEventCallback","specialHTMLTargets","maybeCStringToJsString","findEventTarget","findCanvasEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","currentFullscreenStrategy","restoreOldWindowedStyle","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","demangle","demangleAll","jsStackTrace","stackTrace","ExitStatus","getEnvStrings","checkWasiClock","flush_NO_FILESYSTEM","dlopenMissingError","setImmediateWrapped","clearImmediateWrapped","polyfillSetImmediate","uncaughtExceptionCount","exceptionLast","exceptionCaught","ExceptionInfo","exception_addRef","exception_decRef","Browser","setMainLoop","wget","FS","MEMFS","TTY","PIPEFS","SOCKFS","_setNetworkCallback","tempFixedLengthArray","miniTempWebGLFloatBuffers","heapObjectForWebGLType","heapAccessShiftForWebGLHeap","GL","emscriptenWebGLGet","computeUnpackAlignedImageSize","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","writeGLArray","AL","SDL_unicode","SDL_ttfContext","SDL_audio","SDL","SDL_gfx","GLUT","EGL","GLFW_Window","GLFW","GLEW","IDBStore","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","InternalError","BindingError","UnboundTypeError","PureVirtualError","init_embind","throwInternalError","throwBindingError","throwUnboundTypeError","ensureOverloadTable","exposePublicSymbol","replacePublicSymbol","extendError","createNamedFunction","embindRepr","registeredInstances","getBasestPointer","registerInheritedInstance","unregisterInheritedInstance","getInheritedInstance","getInheritedInstanceCount","getLiveInheritedInstances","registeredTypes","awaitingDependencies","typeDependencies","registeredPointers","registerType","whenDependentTypesAreResolved","embind_charCodes","embind_init_charCodes","readLatin1String","getTypeName","heap32VectorToArray","requireRegisteredType","getShiftFromSize","integerReadValueFromPointer","enumReadValueFromPointer","floatReadValueFromPointer","simpleReadValueFromPointer","runDestructors","new_","craftInvokerFunction","embind__requireFunction","tupleRegistrations","structRegistrations","genericPointerToWireType","constNoSmartPtrRawPointerToWireType","nonConstNoSmartPtrRawPointerToWireType","init_RegisteredPointer","RegisteredPointer","RegisteredPointer_getPointee","RegisteredPointer_destructor","RegisteredPointer_deleteObject","RegisteredPointer_fromWireType","runDestructor","releaseClassHandle","finalizationRegistry","detachFinalizer_deps","detachFinalizer","attachFinalizer","makeClassHandle","init_ClassHandle","ClassHandle","ClassHandle_isAliasOf","throwInstanceAlreadyDeleted","ClassHandle_clone","ClassHandle_delete","deletionQueue","ClassHandle_isDeleted","ClassHandle_deleteLater","flushPendingDeletes","delayFunction","setDelayFunction","RegisteredClass","shallowCopyInternalPointer","downcastPointer","upcastPointer","validateThis","char_0","char_9","makeLegalFunctionName","emval_handle_array","emval_free_list","emval_symbols","init_emval","count_emval_handles","get_first_emval","getStringOrSymbol","Emval","emval_newers","craftEmvalAllocator","emval_get_global","emval_lookupTypes","emval_allocateDestructors","emval_methodCallers","emval_addMethodCaller","emval_registeredMethods"];fc.forEach(_);var dc=["ptrToString","zeroMemory","stringToNewUTF8","exitJS","setErrNo","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","getHostByName","getRandomDevice","traverseStack","convertPCtoSourceLocation","readAsmConstArgs","mainThreadEM_ASM","jstoi_q","jstoi_s","listenOnce","autoResumeAudioContext","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","safeSetTimeout","asmjsMangle","asyncLoad","alignMemory","mmapAlloc","writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertU32PairToI53","reallyNegative","unSign","strLen","reSign","formatString","getSocketFromFD","getSocketAddress","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","findCanvasEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","checkWasiClock","setImmediateWrapped","clearImmediateWrapped","polyfillSetImmediate","exception_addRef","exception_decRef","setMainLoop","_setNetworkCallback","heapObjectForWebGLType","heapAccessShiftForWebGLHeap","emscriptenWebGLGet","computeUnpackAlignedImageSize","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","writeGLArray","SDL_unicode","SDL_ttfContext","SDL_audio","GLFW_Window","runAndAbortIfError","registerInheritedInstance","unregisterInheritedInstance","requireRegisteredType","enumReadValueFromPointer","validateThis","getStringOrSymbol","craftEmvalAllocator","emval_get_global","emval_lookupTypes","emval_allocateDestructors","emval_addMethodCaller"];dc.forEach(j);var Nn;on=function a(){Nn||Ds(),Nn||(on=a)};function pc(){Is(),_o()}function Ds(a){if(a=a||l,Tt>0||(pc(),yo(),Tt>0))return;function o(){Nn||(Nn=!0,t.calledRun=!0,!G&&(vo(),n(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),U(!t._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),xo()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),o()},1)):o(),Di()}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return Ds(),e.ready})})();typeof Qn=="object"&&typeof ar=="object"?ar.exports=sr:typeof define=="function"&&define.amd?define([],function(){return sr}):typeof Qn=="object"&&(Qn.createLazPerf=sr)});var fa=te(je=>{"use strict";var Mu=je&&je.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(je,"__esModule",{value:!0});je.LazPerf=je.create=je.createLazPerf=void 0;var or=Mu(ha());je.createLazPerf=or.default;je.create=or.default;je.LazPerf={create:or.default}});var _a=te(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.decompressFile=gt.decompressChunk=gt.PointData=void 0;var da=fa(),wu=rr();gt.PointData={createLazPerf:da.createLazPerf,decompressChunk:ma,decompressFile:ga};var lr;async function pa(s){return s||(lr||(lr=(0,da.createLazPerf)()),lr)}async function ma(s,{pointCount:e,pointDataRecordFormat:t,pointDataRecordLength:n},i){let r=await pa(i),l=new Uint8Array(e*n),c=r._malloc(s.byteLength),h=r._malloc(n),u=new r.ChunkDecoder;try{r.HEAPU8.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),c),u.open(t,n,c);for(let d=0;d<e;++d)u.getPoint(h),l.set(new Uint8Array(r.HEAPU8.buffer,h,n),d*n)}finally{r._free(c),r._free(h),u.delete()}return l}gt.decompressChunk=ma;async function ga(s,e){let t=await pa(e),n=wu.Header.parse(s),{pointCount:i,pointDataRecordLength:r}=n,l=new Uint8Array(i*r),c=t._malloc(s.byteLength),h=t._malloc(r),u=new t.LASZip;try{t.HEAPU8.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),c),u.open(c,s.byteLength);for(let d=0;d<i;++d)u.getPoint(h),l.set(new Uint8Array(t.HEAPU8.buffer,h,r),d*r)}finally{u.delete()}return l}gt.decompressFile=ga});var ya=te(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.View=void 0;var Tu=ze(),Eu=tr(),Au=nr();ei.View={create:Cu};function Cu(s,e,t=[],n){let i=Au.Extractor.create(e,t);if(n){let d=new Set([...n]);i=Object.entries(i).reduce((p,[g,y])=>(d.has(g)&&(p[g]=y),p),{})}let r=Eu.Dimensions.create(i,t),l=Tu.Binary.toDataView(s),c=e.pointDataRecordLength;if(l.byteLength%c!==0)throw new Error(`Invalid buffer length (${l.byteLength}) for point length ${c}`);let h=l.byteLength/e.pointDataRecordLength;function u(d){let p=i[d];if(!p)throw new Error(`No extractor for dimension: ${d}`);return function(g){if(g>=h)throw new RangeError(`View index (${g}) out of range: ${h}`);return p(l,g)}}return{pointCount:h,dimensions:r,getter:u}}});var ba=te(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.Vlr=void 0;var Ke=ze(),Wt=Vn();ti.Vlr={walk:Iu,parse:Sa,find:xa,at:Ru,fetch:Pu};function xa(s,e,t){return s.find(n=>n.userId===e&&n.recordId===t)}function Ru(s,e,t){let n=xa(s,e,t);if(!n)throw new Error(`VLR not found: ${e}/${t}`);return n}function Pu(s,{contentOffset:e,contentLength:t}){return t===0?new Uint8Array:Ke.Getter.create(s)(e,e+t)}async function Iu(s,e){let t=Ke.Getter.create(s),n=await va({get:t,startOffset:e.headerLength,count:e.vlrCount,isExtended:!1}),i=await va({get:t,startOffset:e.evlrOffset,count:e.evlrCount,isExtended:!0});return[...n,...i]}function Sa(s,e){return(e?Du:Lu)(s)}function Lu(s){let e=Ke.Binary.toDataView(s);if(e.byteLength!==Wt.vlrHeaderLength)throw new Error(`Invalid VLR header length (must be ${Wt.vlrHeaderLength}): ${e.byteLength}`);return{userId:Ke.Binary.toCString(s.slice(2,18)),recordId:e.getUint16(18,!0),contentLength:e.getUint16(20,!0),description:Ke.Binary.toCString(s.slice(22,54)),isExtended:!1}}function Du(s){let e=Ke.Binary.toDataView(s);if(e.byteLength!==Wt.evlrHeaderLength)throw new Error(`Invalid EVLR header length (must be ${Wt.evlrHeaderLength}): ${e.byteLength}`);return{userId:Ke.Binary.toCString(s.slice(2,18)),recordId:e.getUint16(18,!0),contentLength:(0,Ke.parseBigInt)((0,Ke.getBigUint64)(e,20,!0)),description:Ke.Binary.toCString(s.slice(28,60)),isExtended:!0}}async function va({get:s,startOffset:e,count:t,isExtended:n}){let i=[],r=e,l=n?Wt.evlrHeaderLength:Wt.vlrHeaderLength;for(let c=0;c<t;++c){let h=l?await s(r,r+l):new Uint8Array,{userId:u,recordId:d,contentLength:p,description:g}=Sa(h,n);i.push({userId:u,recordId:d,contentOffset:r+l,contentLength:p,description:g,isExtended:n}),r+=l+p}return i}});var ni=te(le=>{"use strict";var Uu=le&&le.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Nu=le&&le.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Fu=le&&le.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Uu(e,s,t);return Nu(e,s),e};Object.defineProperty(le,"__esModule",{value:!0});le.Vlr=le.View=le.PointData=le.Header=le.Extractor=le.ExtraBytes=le.Dimensions=le.Constants=void 0;le.Constants=Fu(Vn());var Ou=tr();Object.defineProperty(le,"Dimensions",{enumerable:!0,get:function(){return Ou.Dimensions}});var Bu=er();Object.defineProperty(le,"ExtraBytes",{enumerable:!0,get:function(){return Bu.ExtraBytes}});var zu=nr();Object.defineProperty(le,"Extractor",{enumerable:!0,get:function(){return zu.Extractor}});var Vu=rr();Object.defineProperty(le,"Header",{enumerable:!0,get:function(){return Vu.Header}});var ku=_a();Object.defineProperty(le,"PointData",{enumerable:!0,get:function(){return ku.PointData}});var Gu=ya();Object.defineProperty(le,"View",{enumerable:!0,get:function(){return Gu.View}});var Hu=ba();Object.defineProperty(le,"Vlr",{enumerable:!0,get:function(){return Hu.Vlr}})});var cr=te(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.Hierarchy=void 0;var gn=ze(),Ma=zn();ii.Hierarchy={parse:wa,load:Wu};function wa(s){let e=gn.Binary.toDataView(s);if(e.byteLength%Ma.hierarchyItemLength!==0)throw new Error(`Invalid hierarchy page length: ${e.byteLength}`);let t={},n={};for(let i=0;i<e.byteLength;i+=Ma.hierarchyItemLength){let r=e.getInt32(i+0,!0),l=e.getInt32(i+4,!0),c=e.getInt32(i+8,!0),h=e.getInt32(i+12,!0),u=(0,gn.parseBigInt)((0,gn.getBigUint64)(e,i+16,!0)),d=e.getInt32(i+24,!0),p=e.getInt32(i+28,!0),g=gn.Key.toString([r,l,c,h]);if(p<-1)throw new Error(`Invalid hierarchy point count at key: ${g}`);p===-1?n[g]={pageOffset:u,pageLength:d}:t[g]={pointCount:p,pointDataOffset:u,pointDataLength:d}}return{nodes:t,pages:n}}async function Wu(s,e){let t=gn.Getter.create(s);return wa(await t(e.pageOffset,e.pageOffset+e.pageLength))}});var ur=te(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.Info=void 0;var _n=ze(),Ta=zn();ri.Info={parse:Xu};function Xu(s){let e=_n.Binary.toDataView(s);if(e.byteLength!==Ta.infoLength)throw new Error(`Invalid COPC info VLR length (should be ${Ta.infoLength}): ${e.byteLength}`);let t=[e.getFloat64(0,!0),e.getFloat64(8,!0),e.getFloat64(16,!0)],n=e.getFloat64(24,!0);return{cube:[t[0]-n,t[1]-n,t[2]-n,t[0]+n,t[1]+n,t[2]+n],spacing:e.getFloat64(32,!0),rootHierarchyPage:{pageOffset:(0,_n.parseBigInt)((0,_n.getBigUint64)(e,40,!0)),pageLength:(0,_n.parseBigInt)((0,_n.getBigUint64)(e,48,!0))},gpsTimeRange:[e.getFloat64(56,!0),e.getFloat64(64,!0)]}}});var Ca=te(Qe=>{"use strict";var qu=Qe&&Qe.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Yu=Qe&&Qe.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),$u=Qe&&Qe.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&qu(e,s,t);return Yu(e,s),e};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.Copc=void 0;var Ve=$u(ni()),si=ze(),Zu=cr(),Ju=ur();Qe.Copc={create:ju,loadHierarchyPage:Ku,loadCompressedPointDataBuffer:Ea,loadPointDataBuffer:Aa,loadPointDataView:Qu};async function ju(s){let e=si.Getter.create(s),t=65536,n=e(0,t);async function i(y,v){return v>=t?e(y,v):(await n).slice(y,v)}let r=Ve.Header.parse(await i(0,Ve.Constants.minHeaderLength)),l=await Ve.Vlr.walk(i,r),c=Ve.Vlr.find(l,"copc",1);if(!c)throw new Error("COPC info VLR is required");let h=Ju.Info.parse(await Ve.Vlr.fetch(i,c)),u,d=Ve.Vlr.find(l,"LASF_Projection",2112);d&&d.contentLength&&(u=si.Binary.toCString(await Ve.Vlr.fetch(i,d)),u===""&&(u=void 0));let p=[],g=Ve.Vlr.find(l,"LASF_Spec",4);return g&&(p=Ve.ExtraBytes.parse(await Ve.Vlr.fetch(i,g))),{header:r,vlrs:l,info:h,wkt:u,eb:p}}async function Ku(s,e){let t=si.Getter.create(s);return Zu.Hierarchy.load(t,e)}async function Ea(s,{pointDataOffset:e,pointDataLength:t}){return si.Getter.create(s)(e,e+t)}async function Aa(s,{pointDataRecordFormat:e,pointDataRecordLength:t},n,i){let r=await Ea(s,n),{pointCount:l}=n;return Ve.PointData.decompressChunk(r,{pointCount:l,pointDataRecordFormat:e,pointDataRecordLength:t},i)}async function Qu(s,e,t,{lazPerf:n,include:i}={}){let r=await Aa(s,e.header,t,n);return Ve.View.create(r,e.header,e.eb,i)}});var Ra=te(be=>{"use strict";var eh=be&&be.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),th=be&&be.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),nh=be&&be.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&eh(e,s,t);return th(e,s),e};Object.defineProperty(be,"__esModule",{value:!0});be.Info=be.Hierarchy=be.Copc=be.Constants=void 0;be.Constants=nh(zn());var ih=Ca();Object.defineProperty(be,"Copc",{enumerable:!0,get:function(){return ih.Copc}});var rh=cr();Object.defineProperty(be,"Hierarchy",{enumerable:!0,get:function(){return rh.Hierarchy}});var sh=ur();Object.defineProperty(be,"Info",{enumerable:!0,get:function(){return sh.Info}})});var hr=te(Me=>{"use strict";var Pa=Me&&Me.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),ah=Me&&Me.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Ia=Me&&Me.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Pa(e,s,t);return ah(e,s),e},La=Me&&Me.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Pa(e,s,t)};Object.defineProperty(Me,"__esModule",{value:!0});Me.Las=Me.Ept=void 0;Me.Ept=Ia(Vs());La(Ra(),Me);Me.Las=Ia(ni());La(ze(),Me)});import zp from"@giro3d/giro3d/entities/PointCloud.js";var Pi=On(hr()),fo=On(ni()),po=On(Ki());var qa=1;var Ya=3;var Sr=0,br=1,Mr=2,wr=3,Tr=4,Er=5,Ar=6,Cr=7,$a=0,Za=1,Ja=2;var Gr=1,Hr=2,Wr=3,Xr=4,qr=5,Yr=6,$r=7;var Zr=300,ja=301,Jr=302;var Ka=306,Rr=1e3,Sn=1001,Pr=1002;var Qa=1006;var eo=1008;var to=1009;var no=1015;var io=1023;var Mn=2300,mi=2301,di=2302,Ir=2303,Lr=2400,Dr=2401,Ur=2402;var jr="",Ge="srgb",Nr="srgb-linear",Fr="linear",pi="srgb";var ro=35044;var bn=2e3,Or=2001;function oh(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function Br(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}var Da={},gi=null;function so(s){let e=s[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=s[1];t&&t.isStackTrace?s[0]+=" "+t.getLocation():s[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return s}function Ee(...s){s=so(s);let e="THREE."+s.shift();if(gi)gi("warn",e,...s);else{let t=s[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...s)}}function pe(...s){s=so(s);let e="THREE."+s.shift();if(gi)gi("error",e,...s);else{let t=s[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...s)}}function Qt(...s){let e=s.join(" ");e in Da||(Da[e]=!0,Ee(...s))}var lh={[Sr]:br,[Mr]:Ar,[Tr]:Cr,[wr]:Er,[br]:Sr,[Ar]:Mr,[Cr]:Tr,[Er]:wr},tn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,l=i.length;r<l;r++)i[r].call(this,e);e.target=null}}},we=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var Gm=Math.PI/180,ch=180/Math.PI;function Kr(){let s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(we[s&255]+we[s>>8&255]+we[s>>16&255]+we[s>>24&255]+"-"+we[e&255]+we[e>>8&255]+"-"+we[e>>16&15|64]+we[e>>24&255]+"-"+we[t&63|128]+we[t>>8&255]+"-"+we[t>>16&255]+we[t>>24&255]+we[n&255]+we[n>>8&255]+we[n>>16&255]+we[n>>24&255]).toLowerCase()}function ee(s,e,t){return Math.max(e,Math.min(t,s))}function uh(s,e){return(s%e+e)%e}function fr(s,e,t){return(1-t)*s+t*e}function yn(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:case Uint8ClampedArray:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Le(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var He=class s{static{s.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ee(this.x,e.x,t.x),this.y=ee(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ee(this.x,e,t),this.y=ee(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ee(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(ee(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,l=this.y-e.y;return this.x=r*n-l*i+e.x,this.y=r*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},at=class{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,l,c){let h=n[i+0],u=n[i+1],d=n[i+2],p=n[i+3],g=r[l+0],y=r[l+1],v=r[l+2],M=r[l+3];if(p!==M||h!==g||u!==y||d!==v){let b=h*g+u*y+d*v+p*M;b<0&&(g=-g,y=-y,v=-v,M=-M,b=-b);let S=1-c;if(b<.9995){let R=Math.acos(b),L=Math.sin(R);S=Math.sin(S*R)/L,c=Math.sin(c*R)/L,h=h*S+g*c,u=u*S+y*c,d=d*S+v*c,p=p*S+M*c}else{h=h*S+g*c,u=u*S+y*c,d=d*S+v*c,p=p*S+M*c;let R=1/Math.sqrt(h*h+u*u+d*d+p*p);h*=R,u*=R,d*=R,p*=R}}e[t]=h,e[t+1]=u,e[t+2]=d,e[t+3]=p}static multiplyQuaternionsFlat(e,t,n,i,r,l){let c=n[i],h=n[i+1],u=n[i+2],d=n[i+3],p=r[l],g=r[l+1],y=r[l+2],v=r[l+3];return e[t]=c*v+d*p+h*y-u*g,e[t+1]=h*v+d*g+u*p-c*y,e[t+2]=u*v+d*y+c*g-h*p,e[t+3]=d*v-c*p-h*g-u*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,i=e._y,r=e._z,l=e._order,c=Math.cos,h=Math.sin,u=c(n/2),d=c(i/2),p=c(r/2),g=h(n/2),y=h(i/2),v=h(r/2);switch(l){case"XYZ":this._x=g*d*p+u*y*v,this._y=u*y*p-g*d*v,this._z=u*d*v+g*y*p,this._w=u*d*p-g*y*v;break;case"YXZ":this._x=g*d*p+u*y*v,this._y=u*y*p-g*d*v,this._z=u*d*v-g*y*p,this._w=u*d*p+g*y*v;break;case"ZXY":this._x=g*d*p-u*y*v,this._y=u*y*p+g*d*v,this._z=u*d*v+g*y*p,this._w=u*d*p-g*y*v;break;case"ZYX":this._x=g*d*p-u*y*v,this._y=u*y*p+g*d*v,this._z=u*d*v-g*y*p,this._w=u*d*p+g*y*v;break;case"YZX":this._x=g*d*p+u*y*v,this._y=u*y*p+g*d*v,this._z=u*d*v-g*y*p,this._w=u*d*p-g*y*v;break;case"XZY":this._x=g*d*p-u*y*v,this._y=u*y*p-g*d*v,this._z=u*d*v+g*y*p,this._w=u*d*p+g*y*v;break;default:Ee("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],l=t[1],c=t[5],h=t[9],u=t[2],d=t[6],p=t[10],g=n+c+p;if(g>0){let y=.5/Math.sqrt(g+1);this._w=.25/y,this._x=(d-h)*y,this._y=(r-u)*y,this._z=(l-i)*y}else if(n>c&&n>p){let y=2*Math.sqrt(1+n-c-p);this._w=(d-h)/y,this._x=.25*y,this._y=(i+l)/y,this._z=(r+u)/y}else if(c>p){let y=2*Math.sqrt(1+c-n-p);this._w=(r-u)/y,this._x=(i+l)/y,this._y=.25*y,this._z=(h+d)/y}else{let y=2*Math.sqrt(1+p-n-c);this._w=(l-i)/y,this._x=(r+u)/y,this._y=(h+d)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ee(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,r=e._z,l=e._w,c=t._x,h=t._y,u=t._z,d=t._w;return this._x=n*d+l*c+i*u-r*h,this._y=i*d+l*h+r*c-n*u,this._z=r*d+l*u+n*h-i*c,this._w=l*d-n*c-i*h-r*u,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,r=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,r=-r,l=-l,c=-c);let h=1-t;if(c<.9995){let u=Math.acos(c),d=Math.sin(u);h=Math.sin(h*u)/d,t=Math.sin(t*u)/d,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+r*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+r*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},z=class s{static{s.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ua.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ua.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,l=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*l,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*l,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*l,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,l=e.y,c=e.z,h=e.w,u=2*(l*i-c*n),d=2*(c*t-r*i),p=2*(r*n-l*t);return this.x=t+h*u+l*p-c*d,this.y=n+h*d+c*u-r*p,this.z=i+h*p+r*d-l*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ee(this.x,e.x,t.x),this.y=ee(this.y,e.y,t.y),this.z=ee(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ee(this.x,e,t),this.y=ee(this.y,e,t),this.z=ee(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ee(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-r*c,this.y=r*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return dr.copy(this).projectOnVector(e),this.sub(dr)}reflect(e){return this.sub(dr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(ee(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},dr=new z,Ua=new at,J=class s{static{s.prototype.isMatrix3=!0}constructor(e,t,n,i,r,l,c,h,u){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,l,c,h,u)}set(e,t,n,i,r,l,c,h,u){let d=this.elements;return d[0]=e,d[1]=i,d[2]=c,d[3]=t,d[4]=r,d[5]=h,d[6]=n,d[7]=l,d[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,l=n[0],c=n[3],h=n[6],u=n[1],d=n[4],p=n[7],g=n[2],y=n[5],v=n[8],M=i[0],b=i[3],S=i[6],R=i[1],L=i[4],B=i[7],C=i[2],V=i[5],O=i[8];return r[0]=l*M+c*R+h*C,r[3]=l*b+c*L+h*V,r[6]=l*S+c*B+h*O,r[1]=u*M+d*R+p*C,r[4]=u*b+d*L+p*V,r[7]=u*S+d*B+p*O,r[2]=g*M+y*R+v*C,r[5]=g*b+y*L+v*V,r[8]=g*S+y*B+v*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],h=e[6],u=e[7],d=e[8];return t*l*d-t*c*u-n*r*d+n*c*h+i*r*u-i*l*h}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],h=e[6],u=e[7],d=e[8],p=d*l-c*u,g=c*h-d*r,y=u*r-l*h,v=t*p+n*g+i*y;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);let M=1/v;return e[0]=p*M,e[1]=(i*u-d*n)*M,e[2]=(c*n-i*l)*M,e[3]=g*M,e[4]=(d*t-i*h)*M,e[5]=(i*r-c*t)*M,e[6]=y*M,e[7]=(n*h-u*t)*M,e[8]=(l*t-n*r)*M,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,l,c){let h=Math.cos(r),u=Math.sin(r);return this.set(n*h,n*u,-n*(h*l+u*c)+l+e,-i*u,i*h,-i*(-u*l+h*c)+c+t,0,0,1),this}scale(e,t){return Qt("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(pr.makeScale(e,t)),this}rotate(e){return Qt("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(pr.makeRotation(-e)),this}translate(e,t){return Qt("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(pr.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},pr=new J,Na=new J().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Fa=new J().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function hh(){let s={enabled:!0,workingColorSpace:Nr,spaces:{},convert:function(i,r,l){return this.enabled===!1||r===l||!r||!l||(this.spaces[r].transfer===pi&&(i.r=rt(i.r),i.g=rt(i.g),i.b=rt(i.b)),this.spaces[r].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===pi&&(i.r=en(i.r),i.g=en(i.g),i.b=en(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===jr?Fr:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,l){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return Qt("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return Qt("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[Nr]:{primaries:e,whitePoint:n,transfer:Fr,toXYZ:Na,fromXYZ:Fa,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ge},outputColorSpaceConfig:{drawingBufferColorSpace:Ge}},[Ge]:{primaries:e,whitePoint:n,transfer:pi,toXYZ:Na,fromXYZ:Fa,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ge}}}),s}var ke=hh();function rt(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function en(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}var Xt,_i=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Xt===void 0&&(Xt=Br("canvas")),Xt.width=e.width,Xt.height=e.height;let i=Xt.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Xt}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Br("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let l=0;l<r.length;l++)r[l]=rt(r[l]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(rt(t[n]/255)*255):t[n]=rt(t[n]);return{data:t,width:e.width,height:e.height}}else return Ee("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},fh=0,yi=class{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:fh++}),this.uuid=Kr(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let l=0,c=i.length;l<c;l++)i[l].isDataTexture?r.push(mr(i[l].image)):r.push(mr(i[l]))}else r=mr(i);n.url=r}return t||(e.images[this.uuid]=n),n}};function mr(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?_i.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(Ee("Texture: Unable to serialize Texture."),{})}var dh=0,gr=new z,nn=class s extends tn{constructor(e=s.DEFAULT_IMAGE,t=s.DEFAULT_MAPPING,n=Sn,i=Sn,r=Qa,l=eo,c=io,h=to,u=s.DEFAULT_ANISOTROPY,d=jr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:dh++}),this.uuid=Kr(),this.name="",this.source=new yi(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=l,this.anisotropy=u,this.format=c,this.internalFormat=null,this.type=h,this.offset=new He(0,0),this.repeat=new He(1,1),this.center=new He(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new J,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(gr).x}get height(){return this.source.getSize(gr).y}get depth(){return this.source.getSize(gr).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Ee(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Ee(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Zr)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Rr:e.x=e.x-Math.floor(e.x);break;case Sn:e.x=e.x<0?0:1;break;case Pr:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Rr:e.y=e.y-Math.floor(e.y);break;case Sn:e.y=e.y<0?0:1;break;case Pr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};nn.DEFAULT_IMAGE=null;nn.DEFAULT_MAPPING=Zr;nn.DEFAULT_ANISOTROPY=1;var zr=class s{static{s.prototype.isVector4=!0}constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*r,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*r,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*r,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,h=e.elements,u=h[0],d=h[4],p=h[8],g=h[1],y=h[5],v=h[9],M=h[2],b=h[6],S=h[10];if(Math.abs(d-g)<.01&&Math.abs(p-M)<.01&&Math.abs(v-b)<.01){if(Math.abs(d+g)<.1&&Math.abs(p+M)<.1&&Math.abs(v+b)<.1&&Math.abs(u+y+S-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let L=(u+1)/2,B=(y+1)/2,C=(S+1)/2,V=(d+g)/4,O=(p+M)/4,W=(v+b)/4;return L>B&&L>C?L<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(L),i=V/n,r=O/n):B>C?B<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(B),n=V/i,r=W/i):C<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(C),n=O/r,i=W/r),this.set(n,i,r,t),this}let R=Math.sqrt((b-v)*(b-v)+(p-M)*(p-M)+(g-d)*(g-d));return Math.abs(R)<.001&&(R=1),this.x=(b-v)/R,this.y=(p-M)/R,this.z=(g-d)/R,this.w=Math.acos((u+y+S-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ee(this.x,e.x,t.x),this.y=ee(this.y,e.y,t.y),this.z=ee(this.z,e.z,t.z),this.w=ee(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ee(this.x,e,t),this.y=ee(this.y,e,t),this.z=ee(this.z,e,t),this.w=ee(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ee(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};var st=class s{static{s.prototype.isMatrix4=!0}constructor(e,t,n,i,r,l,c,h,u,d,p,g,y,v,M,b){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,l,c,h,u,d,p,g,y,v,M,b)}set(e,t,n,i,r,l,c,h,u,d,p,g,y,v,M,b){let S=this.elements;return S[0]=e,S[4]=t,S[8]=n,S[12]=i,S[1]=r,S[5]=l,S[9]=c,S[13]=h,S[2]=u,S[6]=d,S[10]=p,S[14]=g,S[3]=y,S[7]=v,S[11]=M,S[15]=b,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new s().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,i=1/qt.setFromMatrixColumn(e,0).length(),r=1/qt.setFromMatrixColumn(e,1).length(),l=1/qt.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*l,t[9]=n[9]*l,t[10]=n[10]*l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,r=e.z,l=Math.cos(n),c=Math.sin(n),h=Math.cos(i),u=Math.sin(i),d=Math.cos(r),p=Math.sin(r);if(e.order==="XYZ"){let g=l*d,y=l*p,v=c*d,M=c*p;t[0]=h*d,t[4]=-h*p,t[8]=u,t[1]=y+v*u,t[5]=g-M*u,t[9]=-c*h,t[2]=M-g*u,t[6]=v+y*u,t[10]=l*h}else if(e.order==="YXZ"){let g=h*d,y=h*p,v=u*d,M=u*p;t[0]=g+M*c,t[4]=v*c-y,t[8]=l*u,t[1]=l*p,t[5]=l*d,t[9]=-c,t[2]=y*c-v,t[6]=M+g*c,t[10]=l*h}else if(e.order==="ZXY"){let g=h*d,y=h*p,v=u*d,M=u*p;t[0]=g-M*c,t[4]=-l*p,t[8]=v+y*c,t[1]=y+v*c,t[5]=l*d,t[9]=M-g*c,t[2]=-l*u,t[6]=c,t[10]=l*h}else if(e.order==="ZYX"){let g=l*d,y=l*p,v=c*d,M=c*p;t[0]=h*d,t[4]=v*u-y,t[8]=g*u+M,t[1]=h*p,t[5]=M*u+g,t[9]=y*u-v,t[2]=-u,t[6]=c*h,t[10]=l*h}else if(e.order==="YZX"){let g=l*h,y=l*u,v=c*h,M=c*u;t[0]=h*d,t[4]=M-g*p,t[8]=v*p+y,t[1]=p,t[5]=l*d,t[9]=-c*d,t[2]=-u*d,t[6]=y*p+v,t[10]=g-M*p}else if(e.order==="XZY"){let g=l*h,y=l*u,v=c*h,M=c*u;t[0]=h*d,t[4]=-p,t[8]=u*d,t[1]=g*p+M,t[5]=l*d,t[9]=y*p-v,t[2]=v*p-y,t[6]=c*d,t[10]=M*p+g}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ph,e,mh)}lookAt(e,t,n){let i=this.elements;return Ue.subVectors(e,t),Ue.lengthSq()===0&&(Ue.z=1),Ue.normalize(),_t.crossVectors(n,Ue),_t.lengthSq()===0&&(Math.abs(n.z)===1?Ue.x+=1e-4:Ue.z+=1e-4,Ue.normalize(),_t.crossVectors(n,Ue)),_t.normalize(),ai.crossVectors(Ue,_t),i[0]=_t.x,i[4]=ai.x,i[8]=Ue.x,i[1]=_t.y,i[5]=ai.y,i[9]=Ue.y,i[2]=_t.z,i[6]=ai.z,i[10]=Ue.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,l=n[0],c=n[4],h=n[8],u=n[12],d=n[1],p=n[5],g=n[9],y=n[13],v=n[2],M=n[6],b=n[10],S=n[14],R=n[3],L=n[7],B=n[11],C=n[15],V=i[0],O=i[4],W=i[8],$=i[12],j=i[1],_=i[5],T=i[9],D=i[13],k=i[2],G=i[6],Y=i[10],U=i[14],ge=i[3],ve=i[7],K=i[11],ue=i[15];return r[0]=l*V+c*j+h*k+u*ge,r[4]=l*O+c*_+h*G+u*ve,r[8]=l*W+c*T+h*Y+u*K,r[12]=l*$+c*D+h*U+u*ue,r[1]=d*V+p*j+g*k+y*ge,r[5]=d*O+p*_+g*G+y*ve,r[9]=d*W+p*T+g*Y+y*K,r[13]=d*$+p*D+g*U+y*ue,r[2]=v*V+M*j+b*k+S*ge,r[6]=v*O+M*_+b*G+S*ve,r[10]=v*W+M*T+b*Y+S*K,r[14]=v*$+M*D+b*U+S*ue,r[3]=R*V+L*j+B*k+C*ge,r[7]=R*O+L*_+B*G+C*ve,r[11]=R*W+L*T+B*Y+C*K,r[15]=R*$+L*D+B*U+C*ue,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],l=e[1],c=e[5],h=e[9],u=e[13],d=e[2],p=e[6],g=e[10],y=e[14],v=e[3],M=e[7],b=e[11],S=e[15],R=h*y-u*g,L=c*y-u*p,B=c*g-h*p,C=l*y-u*d,V=l*g-h*d,O=l*p-c*d;return t*(M*R-b*L+S*B)-n*(v*R-b*C+S*V)+i*(v*L-M*C+S*O)-r*(v*B-M*V+b*O)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[1],l=e[5],c=e[9],h=e[2],u=e[6],d=e[10];return t*(l*d-c*u)-n*(r*d-c*h)+i*(r*u-l*h)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],h=e[6],u=e[7],d=e[8],p=e[9],g=e[10],y=e[11],v=e[12],M=e[13],b=e[14],S=e[15],R=t*c-n*l,L=t*h-i*l,B=t*u-r*l,C=n*h-i*c,V=n*u-r*c,O=i*u-r*h,W=d*M-p*v,$=d*b-g*v,j=d*S-y*v,_=p*b-g*M,T=p*S-y*M,D=g*S-y*b,k=R*D-L*T+B*_+C*j-V*$+O*W;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let G=1/k;return e[0]=(c*D-h*T+u*_)*G,e[1]=(i*T-n*D-r*_)*G,e[2]=(M*O-b*V+S*C)*G,e[3]=(g*V-p*O-y*C)*G,e[4]=(h*j-l*D-u*$)*G,e[5]=(t*D-i*j+r*$)*G,e[6]=(b*B-v*O-S*L)*G,e[7]=(d*O-g*B+y*L)*G,e[8]=(l*T-c*j+u*W)*G,e[9]=(n*j-t*T-r*W)*G,e[10]=(v*V-M*B+S*R)*G,e[11]=(p*B-d*V-y*R)*G,e[12]=(c*$-l*_-h*W)*G,e[13]=(t*_-n*$+i*W)*G,e[14]=(M*L-v*C-b*R)*G,e[15]=(d*C-p*L+g*R)*G,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,l=e.x,c=e.y,h=e.z,u=r*l,d=r*c;return this.set(u*l+n,u*c-i*h,u*h+i*c,0,u*c+i*h,d*c+n,d*h-i*l,0,u*h-i*c,d*h+i*l,r*h*h+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,l){return this.set(1,n,r,0,e,1,l,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,l=t._y,c=t._z,h=t._w,u=r+r,d=l+l,p=c+c,g=r*u,y=r*d,v=r*p,M=l*d,b=l*p,S=c*p,R=h*u,L=h*d,B=h*p,C=n.x,V=n.y,O=n.z;return i[0]=(1-(M+S))*C,i[1]=(y+B)*C,i[2]=(v-L)*C,i[3]=0,i[4]=(y-B)*V,i[5]=(1-(g+S))*V,i[6]=(b+R)*V,i[7]=0,i[8]=(v+L)*O,i[9]=(b-R)*O,i[10]=(1-(g+M))*O,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinantAffine();if(r===0)return n.set(1,1,1),t.identity(),this;let l=qt.set(i[0],i[1],i[2]).length(),c=qt.set(i[4],i[5],i[6]).length(),h=qt.set(i[8],i[9],i[10]).length();r<0&&(l=-l),Xe.copy(this);let u=1/l,d=1/c,p=1/h;return Xe.elements[0]*=u,Xe.elements[1]*=u,Xe.elements[2]*=u,Xe.elements[4]*=d,Xe.elements[5]*=d,Xe.elements[6]*=d,Xe.elements[8]*=p,Xe.elements[9]*=p,Xe.elements[10]*=p,t.setFromRotationMatrix(Xe),n.x=l,n.y=c,n.z=h,this}makePerspective(e,t,n,i,r,l,c=bn,h=!1){let u=this.elements,d=2*r/(t-e),p=2*r/(n-i),g=(t+e)/(t-e),y=(n+i)/(n-i),v,M;if(h)v=r/(l-r),M=l*r/(l-r);else if(c===bn)v=-(l+r)/(l-r),M=-2*l*r/(l-r);else if(c===Or)v=-l/(l-r),M=-l*r/(l-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return u[0]=d,u[4]=0,u[8]=g,u[12]=0,u[1]=0,u[5]=p,u[9]=y,u[13]=0,u[2]=0,u[6]=0,u[10]=v,u[14]=M,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,i,r,l,c=bn,h=!1){let u=this.elements,d=2/(t-e),p=2/(n-i),g=-(t+e)/(t-e),y=-(n+i)/(n-i),v,M;if(h)v=1/(l-r),M=l/(l-r);else if(c===bn)v=-2/(l-r),M=-(l+r)/(l-r);else if(c===Or)v=-1/(l-r),M=-r/(l-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return u[0]=d,u[4]=0,u[8]=0,u[12]=g,u[1]=0,u[5]=p,u[9]=0,u[13]=y,u[2]=0,u[6]=0,u[10]=v,u[14]=M,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},qt=new z,Xe=new st,ph=new z(0,0,0),mh=new z(1,1,1),_t=new z,ai=new z,Ue=new z,Oa=new st,Ba=new at,wn=class s{constructor(e=0,t=0,n=0,i=s.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],l=i[4],c=i[8],h=i[1],u=i[5],d=i[9],p=i[2],g=i[6],y=i[10];switch(t){case"XYZ":this._y=Math.asin(ee(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-l,r)):(this._x=Math.atan2(g,u),this._z=0);break;case"YXZ":this._x=Math.asin(-ee(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(c,y),this._z=Math.atan2(h,u)):(this._y=Math.atan2(-p,r),this._z=0);break;case"ZXY":this._x=Math.asin(ee(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-p,y),this._z=Math.atan2(-l,u)):(this._y=0,this._z=Math.atan2(h,r));break;case"ZYX":this._y=Math.asin(-ee(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(g,y),this._z=Math.atan2(h,r)):(this._x=0,this._z=Math.atan2(-l,u));break;case"YZX":this._z=Math.asin(ee(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-d,u),this._y=Math.atan2(-p,r)):(this._x=0,this._y=Math.atan2(c,y));break;case"XZY":this._z=Math.asin(-ee(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(g,u),this._y=Math.atan2(c,r)):(this._x=Math.atan2(-d,y),this._y=0);break;default:Ee("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Oa.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Oa,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ba.setFromEuler(this),this.setFromQuaternion(Ba,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};wn.DEFAULT_ORDER="XYZ";var vi=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},gh=0,za=new z,Yt=new at,nt=new st,oi=new z,vn=new z,_h=new z,yh=new at,Va=new z(1,0,0),ka=new z(0,1,0),Ga=new z(0,0,1),Ha={type:"added"},vh={type:"removed"},$t={type:"childadded",child:null},_r={type:"childremoved",child:null},rn=class s extends tn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gh++}),this.uuid=Kr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=s.DEFAULT_UP.clone();let e=new z,t=new wn,n=new at,i=new z(1,1,1);function r(){n.setFromEuler(t,!1)}function l(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(l),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new st},normalMatrix:{value:new J}}),this.matrix=new st,this.matrixWorld=new st,this.matrixAutoUpdate=s.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=s.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new vi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Yt.setFromAxisAngle(e,t),this.quaternion.multiply(Yt),this}rotateOnWorldAxis(e,t){return Yt.setFromAxisAngle(e,t),this.quaternion.premultiply(Yt),this}rotateX(e){return this.rotateOnAxis(Va,e)}rotateY(e){return this.rotateOnAxis(ka,e)}rotateZ(e){return this.rotateOnAxis(Ga,e)}translateOnAxis(e,t){return za.copy(e).applyQuaternion(this.quaternion),this.position.add(za.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Va,e)}translateY(e){return this.translateOnAxis(ka,e)}translateZ(e){return this.translateOnAxis(Ga,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(nt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?oi.copy(e):oi.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),vn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?nt.lookAt(vn,oi,this.up):nt.lookAt(oi,vn,this.up),this.quaternion.setFromRotationMatrix(nt),i&&(nt.extractRotation(i.matrixWorld),Yt.setFromRotationMatrix(nt),this.quaternion.premultiply(Yt.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(pe("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ha),$t.child=e,this.dispatchEvent($t),$t.child=null):pe("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(vh),_r.child=e,this.dispatchEvent(_r),_r.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),nt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),nt.multiply(e.parent.matrixWorld)),e.applyMatrix4(nt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ha),$t.child=e,this.dispatchEvent($t),$t.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let l=this.children[n].getObjectByProperty(e,t);if(l!==void 0)return l}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let i=this.children;for(let r=0,l=i.length;r<l;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(vn,e,_h),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(vn,yh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let r=this.children;for(let l=0,c=r.length;l<c;l++)r[l].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,i.name=this.name,i.castShadow=this.castShadow,i.receiveShadow=this.receiveShadow,i.visible=this.visible,i.frustumCulled=this.frustumCulled,i.renderOrder=this.renderOrder,i.static=this.static,i.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){let h=c.shapes;if(Array.isArray(h))for(let u=0,d=h.length;u<d;u++){let p=h[u];r(e.shapes,p)}else r(e.shapes,h)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let c=[];for(let h=0,u=this.material.length;h<u;h++)c.push(r(e.materials,this.material[h]));i.material=c}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let c=0;c<this.children.length;c++)i.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let c=0;c<this.animations.length;c++){let h=this.animations[c];i.animations.push(r(e.animations,h))}}if(t){let c=l(e.geometries),h=l(e.materials),u=l(e.textures),d=l(e.images),p=l(e.shapes),g=l(e.skeletons),y=l(e.animations),v=l(e.nodes);c.length>0&&(n.geometries=c),h.length>0&&(n.materials=h),u.length>0&&(n.textures=u),d.length>0&&(n.images=d),p.length>0&&(n.shapes=p),g.length>0&&(n.skeletons=g),y.length>0&&(n.animations=y),v.length>0&&(n.nodes=v)}return n.object=i,n;function l(c){let h=[];for(let u in c){let d=c[u];delete d.metadata,h.push(d)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};rn.DEFAULT_UP=new z(0,1,0);rn.DEFAULT_MATRIX_AUTO_UPDATE=!0;rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var ao={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},yt={h:0,s:0,l:0},li={h:0,s:0,l:0};function yr(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}var me=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ge){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ke.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=ke.workingColorSpace){return this.r=e,this.g=t,this.b=n,ke.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=ke.workingColorSpace){if(e=uh(e,1),t=ee(t,0,1),n=ee(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,l=2*n-r;this.r=yr(l,r,e+1/3),this.g=yr(l,r,e),this.b=yr(l,r,e-1/3)}return ke.colorSpaceToWorking(this,i),this}setStyle(e,t=Ge){function n(r){r!==void 0&&parseFloat(r)<1&&Ee("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:Ee("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],l=r.length;if(l===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(r,16),t);Ee("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ge){let n=ao[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Ee("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=rt(e.r),this.g=rt(e.g),this.b=rt(e.b),this}copyLinearToSRGB(e){return this.r=en(e.r),this.g=en(e.g),this.b=en(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ge){return ke.workingToColorSpace(Te.copy(this),e),Math.round(ee(Te.r*255,0,255))*65536+Math.round(ee(Te.g*255,0,255))*256+Math.round(ee(Te.b*255,0,255))}getHexString(e=Ge){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ke.workingColorSpace){ke.workingToColorSpace(Te.copy(this),t);let n=Te.r,i=Te.g,r=Te.b,l=Math.max(n,i,r),c=Math.min(n,i,r),h,u,d=(c+l)/2;if(c===l)h=0,u=0;else{let p=l-c;switch(u=d<=.5?p/(l+c):p/(2-l-c),l){case n:h=(i-r)/p+(i<r?6:0);break;case i:h=(r-n)/p+2;break;case r:h=(n-i)/p+4;break}h/=6}return e.h=h,e.s=u,e.l=d,e}getRGB(e,t=ke.workingColorSpace){return ke.workingToColorSpace(Te.copy(this),t),e.r=Te.r,e.g=Te.g,e.b=Te.b,e}getStyle(e=Ge){ke.workingToColorSpace(Te.copy(this),e);let t=Te.r,n=Te.g,i=Te.b;return e!==Ge?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(yt),this.setHSL(yt.h+e,yt.s+t,yt.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(yt),e.getHSL(li);let n=fr(yt.h,li.h,t),i=fr(yt.s,li.s,t),r=fr(yt.l,li.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Te=new me;me.NAMES=ao;var We=class{constructor(e=new z(1/0,1/0,1/0),t=new z(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(qe.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qe.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=qe.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let l=0,c=r.count;l<c;l++)e.isMesh===!0?e.getVertexPosition(l,qe):qe.fromBufferAttribute(r,l),qe.applyMatrix4(e.matrixWorld),this.expandByPoint(qe);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ci.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),ci.copy(n.boundingBox)),ci.applyMatrix4(e.matrixWorld),this.union(ci)}let i=e.children;for(let r=0,l=i.length;r<l;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,qe),qe.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(xn),ui.subVectors(this.max,xn),Zt.subVectors(e.a,xn),Jt.subVectors(e.b,xn),jt.subVectors(e.c,xn),vt.subVectors(Jt,Zt),xt.subVectors(jt,Jt),Ct.subVectors(Zt,jt);let t=[0,-vt.z,vt.y,0,-xt.z,xt.y,0,-Ct.z,Ct.y,vt.z,0,-vt.x,xt.z,0,-xt.x,Ct.z,0,-Ct.x,-vt.y,vt.x,0,-xt.y,xt.x,0,-Ct.y,Ct.x,0];return!vr(t,Zt,Jt,jt,ui)||(t=[1,0,0,0,1,0,0,0,1],!vr(t,Zt,Jt,jt,ui))?!1:(hi.crossVectors(vt,xt),t=[hi.x,hi.y,hi.z],vr(t,Zt,Jt,jt,ui))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qe).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qe).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(it[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),it[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),it[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),it[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),it[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),it[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),it[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),it[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(it),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},it=[new z,new z,new z,new z,new z,new z,new z,new z],qe=new z,ci=new We,Zt=new z,Jt=new z,jt=new z,vt=new z,xt=new z,Ct=new z,xn=new z,ui=new z,hi=new z,Rt=new z;function vr(s,e,t,n,i){for(let r=0,l=s.length-3;r<=l;r+=3){Rt.fromArray(s,r);let c=i.x*Math.abs(Rt.x)+i.y*Math.abs(Rt.y)+i.z*Math.abs(Rt.z),h=e.dot(Rt),u=t.dot(Rt),d=n.dot(Rt);if(Math.max(-Math.max(h,u,d),Math.min(h,u,d))>c)return!1}return!0}var de=new z,fi=new He,xh=0,sn=class extends tn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:xh++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ro,this.updateRanges=[],this.gpuType=no,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)fi.fromBufferAttribute(this,t),fi.applyMatrix3(e),this.setXY(t,fi.x,fi.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)de.fromBufferAttribute(this,t),de.applyMatrix3(e),this.setXYZ(t,de.x,de.y,de.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)de.fromBufferAttribute(this,t),de.applyMatrix4(e),this.setXYZ(t,de.x,de.y,de.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)de.fromBufferAttribute(this,t),de.applyNormalMatrix(e),this.setXYZ(t,de.x,de.y,de.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)de.fromBufferAttribute(this,t),de.transformDirection(e),this.setXYZ(t,de.x,de.y,de.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=yn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Le(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=yn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=yn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=yn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=yn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array),r=Le(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:"dispose"})}};var Tn=class extends sn{constructor(e,t,n){super(new Float32Array(e),t,n)}};function oo(s){let e={};for(let t in s){e[t]={};for(let n in s[t]){let i=s[t][n];if(Wa(i))i.isRenderTargetTexture?(Ee("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone();else if(Array.isArray(i))if(Wa(i[0])){let r=[];for(let l=0,c=i.length;l<c;l++)r[l]=i[l].clone();e[t][n]=r}else e[t][n]=i.slice();else e[t][n]=i}}return e}function Ae(s){let e={};for(let t=0;t<s.length;t++){let n=oo(s[t]);for(let i in n)e[i]=n[i]}return e}function Wa(s){return s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)}function Kt(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function xr(s){return s!==void 0&&s.inTangents!==void 0&&s.outTangents!==void 0}var St=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];n:{e:{let l;t:{i:if(!(e<i)){for(let c=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(r=i,i=t[++n],e<i)break e}l=t.length;break t}if(!(e>=r)){let c=t[1];e<c&&(n=2,r=c);for(let h=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===h)break;if(i=r,r=t[--n-1],e>=r)break e}l=n,n=0;break t}break n}for(;n<l;){let c=n+l>>>1;e<t[c]?l=c:n=c+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let l=0;l!==i;++l)t[l]=n[r+l];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},xi=class extends St{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Lr,endingEnd:Lr}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,l=e+1,c=i[r],h=i[l];if(c===void 0)switch(this.getSettings_().endingStart){case Dr:r=e,c=2*t-n;break;case Ur:r=i.length-2,c=t+i[r]-i[r+1];break;default:r=e,c=n}if(h===void 0)switch(this.getSettings_().endingEnd){case Dr:l=e,h=2*n-t;break;case Ur:l=1,h=n+i[1]-i[0];break;default:l=e-1,h=t}let u=(n-t)*.5,d=this.valueSize;this._weightPrev=u/(t-c),this._weightNext=u/(h-n),this._offsetPrev=r*d,this._offsetNext=l*d}interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,u=h-c,d=this._offsetPrev,p=this._offsetNext,g=this._weightPrev,y=this._weightNext,v=(n-t)/(i-t),M=v*v,b=M*v,S=-g*b+2*g*M-g*v,R=(1+g)*b+(-1.5-2*g)*M+(-.5+g)*v+1,L=(-1-y)*b+(1.5+y)*M+.5*v,B=y*b-y*M;for(let C=0;C!==c;++C)r[C]=S*l[d+C]+R*l[u+C]+L*l[h+C]+B*l[p+C];return r}},Si=class extends St{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,u=h-c,d=(n-t)/(i-t),p=1-d;for(let g=0;g!==c;++g)r[g]=l[u+g]*p+l[h+g]*d;return r}},bi=class extends St{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},Mi=class extends St{interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,u=h-c,d=this.inTangents,p=this.outTangents;if(!d||!p){let v=(n-t)/(i-t),M=1-v;for(let b=0;b!==c;++b)r[b]=l[u+b]*M+l[h+b]*v;return r}let g=c*2,y=e-1;for(let v=0;v!==c;++v){let M=l[u+v],b=l[h+v],S=y*g+v*2,R=p[S],L=p[S+1],B=e*g+v*2,C=d[B],V=d[B+1],O=bh(n,t,R,C,i);r[v]=lo(O,M,L,V,b)}return r}};function lo(s,e,t,n,i){let r=1-s;return r*r*r*e+3*r*r*s*t+3*r*s*s*n+s*s*s*i}function Sh(s,e,t,n,i){let r=1-s;return 3*r*r*(t-e)+6*r*s*(n-t)+3*s*s*(i-n)}function bh(s,e,t,n,i){let r=(s-e)/(i-e);for(let l=0;l<8;l++){let c=lo(r,e,t,n,i)-s;if(Math.abs(c)<1e-10)break;let h=Sh(r,e,t,n,i);if(Math.abs(h)<1e-10)break;r=Math.max(0,Math.min(1,r-c/h))}return r}var Ne=class{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Kt(t,this.TimeBufferType),this.values=Kt(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Kt(e.times,Array),values:Kt(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i),xr(e.settings)&&(n.settings={inTangents:Kt(e.settings.inTangents,Array),outTangents:Kt(e.settings.outTangents,Array)})}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new bi(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Si(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new xi(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Mi(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case Mn:t=this.InterpolantFactoryMethodDiscrete;break;case mi:t=this.InterpolantFactoryMethodLinear;break;case di:t=this.InterpolantFactoryMethodSmooth;break;case Ir:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Ee("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Mn;case this.InterpolantFactoryMethodLinear:return mi;case this.InterpolantFactoryMethodSmooth:return di;case this.InterpolantFactoryMethodBezier:return Ir}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e;xr(this.settings)&&(Xa(this.settings.inTangents,e),Xa(this.settings.outTangents,e))}return this}trim(e,t){let n=this.times,i=n.length,r=0,l=i-1;for(;r!==i&&n[r]<e;)++r;for(;l!==-1&&n[l]>t;)--l;if(++l,r!==0||l!==i){r>=l&&(l=Math.max(l,1),r=l-1);let c=this.getValueSize();this.times=n.slice(r,l),this.values=this.values.slice(r*c,l*c)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(pe("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;r===0&&(pe("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==r;c++){let h=n[c];if(typeof h=="number"&&isNaN(h)){pe("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){pe("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&oh(i))for(let c=0,h=i.length;c!==h;++c){let u=i[c];if(isNaN(u)){pe("KeyframeTrack: Value is not a valid number.",this,c,u),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===di,r=e.length-1,l=1;for(let c=1;c<r;++c){let h=!1,u=e[c],d=e[c+1];if(u!==d&&(c!==1||u!==e[0]))if(i)h=!0;else{let p=c*n,g=p-n,y=p+n;for(let v=0;v!==n;++v){let M=t[p+v];if(M!==t[g+v]||M!==t[y+v]){h=!0;break}}}if(h){if(c!==l){e[l]=e[c];let p=c*n,g=l*n;for(let y=0;y!==n;++y)t[g+y]=t[p+y]}++l}}if(r>0){e[l]=e[r];for(let c=r*n,h=l*n,u=0;u!==n;++u)t[h+u]=t[c+u];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,xr(this.settings)&&(i.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),i}};function Xa(s,e){for(let t=0,n=s.length;t!==n;t+=2)s[t]*=e}Ne.prototype.ValueTypeName="";Ne.prototype.TimeBufferType=Float32Array;Ne.prototype.ValueBufferType=Float32Array;Ne.prototype.DefaultInterpolation=mi;var bt=class extends Ne{constructor(e,t,n){super(e,t,n)}};bt.prototype.ValueTypeName="bool";bt.prototype.ValueBufferType=Array;bt.prototype.DefaultInterpolation=Mn;bt.prototype.InterpolantFactoryMethodLinear=void 0;bt.prototype.InterpolantFactoryMethodSmooth=void 0;var wi=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}};wi.prototype.ValueTypeName="color";var Ti=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}};Ti.prototype.ValueTypeName="number";var Ei=class extends St{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t),u=e*c;for(let d=u+c;u!==d;u+=4)at.slerpFlat(r,0,l,u-c,l,u,h);return r}},En=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Ei(this.times,this.values,this.getValueSize(),e)}};En.prototype.ValueTypeName="quaternion";En.prototype.InterpolantFactoryMethodSmooth=void 0;var Mt=class extends Ne{constructor(e,t,n){super(e,t,n)}};Mt.prototype.ValueTypeName="string";Mt.prototype.ValueBufferType=Array;Mt.prototype.DefaultInterpolation=Mn;Mt.prototype.InterpolantFactoryMethodLinear=void 0;Mt.prototype.InterpolantFactoryMethodSmooth=void 0;var Ai=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}};Ai.prototype.ValueTypeName="vector";var Ci=class{constructor(e,t,n){let i=this,r=!1,l=0,c=0,h,u=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(d){c++,r===!1&&i.onStart!==void 0&&i.onStart(d,l,c),r=!0},this.itemEnd=function(d){l++,i.onProgress!==void 0&&i.onProgress(d,l,c),l===c&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return d=d.normalize("NFC"),h?h(d):d},this.setURLModifier=function(d){return h=d,this},this.addHandler=function(d,p){return u.push(d,p),this},this.removeHandler=function(d){let p=u.indexOf(d);return p!==-1&&u.splice(p,2),this},this.getHandler=function(d){for(let p=0,g=u.length;p<g;p+=2){let y=u[p],v=u[p+1];if(y.global&&(y.lastIndex=0),y.test(d))return v}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},co=new Ci,Ri=class{constructor(e){this.manager=e!==void 0?e:co,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Ri.DEFAULT_MATERIAL_NAME="__DEFAULT";var Qr="\\[\\]\\.:\\/",Mh=new RegExp("["+Qr+"]","g"),es="[^"+Qr+"]",wh="[^"+Qr.replace("\\.","")+"]",Th=/((?:WC+[\/:])*)/.source.replace("WC",es),Eh=/(WCOD+)?/.source.replace("WCOD",wh),Ah=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",es),Ch=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",es),Rh=new RegExp("^"+Th+Eh+Ah+Ch+"$"),Ph=["material","materials","bones","map"],Vr=class{constructor(e,t,n){let i=n||ae.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},ae=class s{constructor(e,t,n){this.path=t,this.parsedPath=n||s.parseTrackName(t),this.node=s.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new s.Composite(e,t,n):new s(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Mh,"")}static parseTrackName(e){let t=Rh.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);Ph.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let l=0;l<r.length;l++){let c=r[l];if(c.name===t||c.uuid===t)return c;let h=n(c.children);if(h)return h}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=s.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Ee("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let u=t.objectIndex;switch(n){case"materials":if(!e.material){pe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){pe("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){pe("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===u){u=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){pe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){pe("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){pe("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(u!==void 0){if(e[u]===void 0){pe("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[u]}}let l=e[i];if(l===void 0){let u=t.nodeName;pe("PropertyBinding: Trying to update property for track: "+u+"."+i+" but it wasn't found.",e);return}let c=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?c=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){pe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){pe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}h=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=r}else l.fromArray!==void 0&&l.toArray!==void 0?(h=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(h=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=i;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};ae.Composite=Vr;ae.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ae.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ae.prototype.GetterByBindingType=[ae.prototype._getValue_direct,ae.prototype._getValue_array,ae.prototype._getValue_arrayElement,ae.prototype._getValue_toArray];ae.prototype.SetterByBindingTypeAndVersioning=[[ae.prototype._setValue_direct,ae.prototype._setValue_direct_setNeedsUpdate,ae.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ae.prototype._setValue_array,ae.prototype._setValue_array_setNeedsUpdate,ae.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ae.prototype._setValue_arrayElement,ae.prototype._setValue_arrayElement_setNeedsUpdate,ae.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ae.prototype._setValue_fromArray,ae.prototype._setValue_fromArray_setNeedsUpdate,ae.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Hm=new Float32Array(1);var kr=class s{static{s.prototype.isMatrix2=!0}constructor(e,t,n,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"186"}}));typeof window<"u"&&(window.__THREE__?Ee("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="186");var Ih=`#ifdef USE_ALPHAHASH
6
+ Originally allocated`),"captureStackTrace"in Error&&Error.captureStackTrace(x.leakWarning,_s),Bi.register(o,x,o)}return o},fs=o=>Bi.unregister(o),hn(a))}function Zo(){if(this.$$.ptr||Oi(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var a=hn(Object.create(Object.getPrototypeOf(this),{$$:{value:Vo(this.$$)}}));return a.$$.count.value+=1,a.$$.deleteScheduled=!1,a}function Jo(){this.$$.ptr||Oi(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ne("Object already scheduled for deletion"),fs(this),ps(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function jo(){return!this.$$.ptr}function Ko(){return this.$$.ptr||Oi(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ne("Object already scheduled for deletion"),ln.push(this),ln.length===1&&cn&&cn(zi),this.$$.deleteScheduled=!0,this}function Qo(){lt.prototype.isAliasOf=ko,lt.prototype.clone=Zo,lt.prototype.delete=Jo,lt.prototype.isDeleted=jo,lt.prototype.deleteLater=Ko}function lt(){}function ys(a,o,d){if(a[o].overloadTable===void 0){var m=a[o];a[o]=function(){return a[o].overloadTable.hasOwnProperty(arguments.length)||ne("Function '"+d+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+a[o].overloadTable+")!"),a[o].overloadTable[arguments.length].apply(this,arguments)},a[o].overloadTable=[],a[o].overloadTable[m.argCount]=m}}function el(a,o,d){t.hasOwnProperty(a)?((d===void 0||t[a].overloadTable!==void 0&&t[a].overloadTable[d]!==void 0)&&ne("Cannot register public name '"+a+"' twice"),ys(t,a,a),t.hasOwnProperty(d)&&ne("Cannot register multiple overloads of a function with the same number of arguments ("+d+")!"),t[a].overloadTable[d]=o):(t[a]=o,d!==void 0&&(t[a].numArguments=d))}function tl(a,o,d,m,x,E,A,w){this.name=a,this.constructor=o,this.instancePrototype=d,this.rawDestructor=m,this.baseClass=x,this.getActualType=E,this.upcast=A,this.downcast=w,this.pureVirtualFunctions=[]}function ki(a,o,d){for(;o!==d;)o.upcast||ne("Expected null or instance of "+d.name+", got an instance of "+o.name),a=o.upcast(a),o=o.baseClass;return a}function nl(a,o){if(o===null)return this.isReference&&ne("null is not a valid "+this.name),0;o.$$||ne('Cannot pass "'+Ot(o)+'" as a '+this.name),o.$$.ptr||ne("Cannot pass deleted object as a pointer of type "+this.name);var d=o.$$.ptrType.registeredClass,m=ki(o.$$.ptr,d,this.registeredClass);return m}function il(a,o){var d;if(o===null)return this.isReference&&ne("null is not a valid "+this.name),this.isSmartPointer?(d=this.rawConstructor(),a!==null&&a.push(this.rawDestructor,d),d):0;o.$$||ne('Cannot pass "'+Ot(o)+'" as a '+this.name),o.$$.ptr||ne("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&o.$$.ptrType.isConst&&ne("Cannot convert argument of type "+(o.$$.smartPtrType?o.$$.smartPtrType.name:o.$$.ptrType.name)+" to parameter type "+this.name);var m=o.$$.ptrType.registeredClass;if(d=ki(o.$$.ptr,m,this.registeredClass),this.isSmartPointer)switch(o.$$.smartPtr===void 0&&ne("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:o.$$.smartPtrType===this?d=o.$$.smartPtr:ne("Cannot convert argument of type "+(o.$$.smartPtrType?o.$$.smartPtrType.name:o.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:d=o.$$.smartPtr;break;case 2:if(o.$$.smartPtrType===this)d=o.$$.smartPtr;else{var x=o.clone();d=this.rawShare(d,Hi.toHandle(function(){x.delete()})),a!==null&&a.push(this.rawDestructor,d)}break;default:ne("Unsupporting sharing policy")}return d}function rl(a,o){if(o===null)return this.isReference&&ne("null is not a valid "+this.name),0;o.$$||ne('Cannot pass "'+Ot(o)+'" as a '+this.name),o.$$.ptr||ne("Cannot pass deleted object as a pointer of type "+this.name),o.$$.ptrType.isConst&&ne("Cannot convert argument of type "+o.$$.ptrType.name+" to parameter type "+this.name);var d=o.$$.ptrType.registeredClass,m=ki(o.$$.ptr,d,this.registeredClass);return m}function Rn(a){return this.fromWireType(oe[a>>2])}function sl(a){return this.rawGetPointee&&(a=this.rawGetPointee(a)),a}function al(a){this.rawDestructor&&this.rawDestructor(a)}function ol(a){a!==null&&a.delete()}function ll(){et.prototype.getPointee=sl,et.prototype.destructor=al,et.prototype.argPackAdvance=8,et.prototype.readValueFromPointer=Rn,et.prototype.deleteObject=ol,et.prototype.fromWireType=_s}function et(a,o,d,m,x,E,A,w,I,U,X){this.name=a,this.registeredClass=o,this.isReference=d,this.isConst=m,this.isSmartPointer=x,this.pointeeType=E,this.sharingPolicy=A,this.rawGetPointee=w,this.rawConstructor=I,this.rawShare=U,this.rawDestructor=X,!x&&o.baseClass===void 0?m?(this.toWireType=nl,this.destructorFunction=null):(this.toWireType=rl,this.destructorFunction=null):this.toWireType=il}function cl(a,o,d){t.hasOwnProperty(a)||An("Replacing nonexistant public symbol"),t[a].overloadTable!==void 0&&d!==void 0?t[a].overloadTable[d]=o:(t[a]=o,t[a].argCount=d)}function ul(a,o,d){N("dynCall_"+a in t,"bad function pointer type - no table for sig '"+a+"'"),d&&d.length?N(d.length===a.substring(1).replace(/j/g,"--").length):N(a.length==1);var m=t["dynCall_"+a];return d&&d.length?m.apply(null,[o].concat(d)):m.call(null,o)}var dn=[];function Pn(a){var o=dn[a];return o||(a>=dn.length&&(dn.length=a+1),dn[a]=o=at.get(a)),N(at.get(a)==o,"JavaScript-side Wasm function table mirror is out of date!"),o}function hl(a,o,d){if(a.includes("j"))return ul(a,o,d);N(Pn(o),"missing table entry in dynCall: "+o);var m=Pn(o).apply(null,d);return m}function dl(a,o){N(a.includes("j")||a.includes("p"),"getDynCaller should only be called with i64 sigs");var d=[];return function(){return d.length=0,Object.assign(d,arguments),hl(a,o,d)}}function Ft(a,o){a=Fe(a);function d(){return a.includes("j")?dl(a,o):Pn(o)}var m=d();return typeof m!="function"&&ne("unknown function pointer with signature "+a+": "+o),m}var vs=void 0;function fl(a){var o=ic(a),d=Fe(o);return ct(o),d}function Vi(a,o){var d=[],m={};function x(E){if(!m[E]&&!Nt[E]){if(En[E]){En[E].forEach(x);return}d.push(E),m[E]=!0}}throw o.forEach(x),new vs(a+": "+d.map(fl).join([", "]))}function pl(a,o,d,m,x,E,A,w,I,U,X,Z,q){X=Fe(X),E=Ft(x,E),w&&(w=Ft(A,w)),U&&(U=Ft(I,U)),q=Ft(Z,q);var ce=us(X);el(ce,function(){Vi("Cannot construct "+X+" due to unbound types",[m])}),on([a,o,d],m?[m]:[],function(ie){ie=ie[0];var se,Pe;m?(se=ie.registeredClass,Pe=se.instancePrototype):Pe=lt.prototype;var $e=hs(ce,function(){if(Object.getPrototypeOf(this)!==P)throw new Ut("Use 'new' to construct "+X);if(H.constructor_body===void 0)throw new Ut(X+" has no accessible constructor");var Dn=H.constructor_body[arguments.length];if(Dn===void 0)throw new Ut("Tried to invoke ctor of "+X+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(H.constructor_body).toString()+") parameters instead!");return Dn.apply(this,arguments)}),P=Object.create(Pe,{constructor:{value:$e}});$e.prototype=P;var H=new tl(X,$e,P,q,se,E,w,U),xe=new et(X,H,!0,!1,!1),ye=new et(X+"*",H,!1,!1,!1),Et=new et(X+" const*",H,!1,!0,!1);return gs[a]={pointerType:ye,constPointerType:Et},cl(ce,$e),[xe,ye,Et]})}function xs(a,o){for(var d=[],m=0;m<a;m++)d.push(re[o+m*4>>2]);return d}function ml(a){for(;a.length;){var o=a.pop(),d=a.pop();d(o)}}function Ss(a,o,d,m,x){var E=o.length;E<2&&ne("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var A=o[1]!==null&&d!==null,w=!1,I=1;I<o.length;++I)if(o[I]!==null&&o[I].destructorFunction===void 0){w=!0;break}var U=o[0].name!=="void",X=E-2,Z=new Array(X),q=[],ce=[];return function(){arguments.length!==X&&ne("function "+a+" called with "+arguments.length+" arguments, expected "+X+" args!"),ce.length=0;var ie;q.length=A?2:1,q[0]=x,A&&(ie=o[1].toWireType(ce,this),q[1]=ie);for(var se=0;se<X;++se)Z[se]=o[se+2].toWireType(ce,arguments[se]),q.push(Z[se]);var Pe=m.apply(null,q);function $e(P){if(w)ml(ce);else for(var H=A?1:2;H<o.length;H++){var xe=H===1?ie:Z[H-2];o[H].destructorFunction!==null&&o[H].destructorFunction(xe)}if(U)return o[0].fromWireType(P)}return $e(Pe)}}function gl(a,o,d,m,x,E){N(o>0);var A=xs(o,d);x=Ft(m,x),on([],[a],function(w){w=w[0];var I="constructor "+w.name;if(w.registeredClass.constructor_body===void 0&&(w.registeredClass.constructor_body=[]),w.registeredClass.constructor_body[o-1]!==void 0)throw new Ut("Cannot register multiple constructors with identical number of parameters ("+(o-1)+") for class '"+w.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return w.registeredClass.constructor_body[o-1]=()=>{Vi("Cannot construct "+w.name+" due to unbound types",A)},on([],A,function(U){return U.splice(1,0,null),w.registeredClass.constructor_body[o-1]=Ss(I,U,null,x,E),[]}),[]})}function _l(a,o,d,m,x,E,A,w){var I=xs(d,m);o=Fe(o),E=Ft(x,E),on([],[a],function(U){U=U[0];var X=U.name+"."+o;o.startsWith("@@")&&(o=Symbol[o.substring(2)]),w&&U.registeredClass.pureVirtualFunctions.push(o);function Z(){Vi("Cannot call "+X+" due to unbound types",I)}var q=U.registeredClass.instancePrototype,ce=q[o];return ce===void 0||ce.overloadTable===void 0&&ce.className!==U.name&&ce.argCount===d-2?(Z.argCount=d-2,Z.className=U.name,q[o]=Z):(ys(q,o,X),q[o].overloadTable[d-2]=Z),on([],I,function(ie){var se=Ss(X,ie,U,E,A);return q[o].overloadTable===void 0?(se.argCount=d-2,q[o]=se):q[o].overloadTable[d-2]=se,[]}),[]})}var Gi=[],Ye=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function yl(a){a>4&&--Ye[a].refcount===0&&(Ye[a]=void 0,Gi.push(a))}function vl(){for(var a=0,o=5;o<Ye.length;++o)Ye[o]!==void 0&&++a;return a}function xl(){for(var a=5;a<Ye.length;++a)if(Ye[a]!==void 0)return Ye[a];return null}function Sl(){t.count_emval_handles=vl,t.get_first_emval=xl}var Hi={toValue:a=>(a||ne("Cannot use deleted val. handle = "+a),Ye[a].value),toHandle:a=>{switch(a){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var o=Gi.length?Gi.pop():Ye.length;return Ye[o]={refcount:1,value:a},o}}}};function Ml(a,o){o=Fe(o),Qe(a,{name:o,fromWireType:function(d){var m=Hi.toValue(d);return yl(d),m},toWireType:function(d,m){return Hi.toHandle(m)},argPackAdvance:8,readValueFromPointer:Rn,destructorFunction:null})}function Ot(a){if(a===null)return"null";var o=typeof a;return o==="object"||o==="array"||o==="function"?a.toString():""+a}function bl(a,o){switch(o){case 2:return function(d){return this.fromWireType(es[d>>2])};case 3:return function(d){return this.fromWireType(ts[d>>3])};default:throw new TypeError("Unknown float type: "+a)}}function wl(a,o,d){var m=Ui(d);o=Fe(o),Qe(a,{name:o,fromWireType:function(x){return x},toWireType:function(x,E){if(typeof E!="number"&&typeof E!="boolean")throw new TypeError('Cannot convert "'+Ot(E)+'" to '+this.name);return E},argPackAdvance:8,readValueFromPointer:bl(o,m),destructorFunction:null})}function Tl(a,o,d){switch(o){case 0:return d?function(x){return qe[x]}:function(x){return Ce[x]};case 1:return d?function(x){return Lt[x>>1]}:function(x){return Tn[x>>1]};case 2:return d?function(x){return oe[x>>2]}:function(x){return re[x>>2]};default:throw new TypeError("Unknown integer type: "+a)}}function El(a,o,d,m,x){o=Fe(o),x===-1&&(x=4294967295);var E=Ui(d),A=Z=>Z;if(m===0){var w=32-8*d;A=Z=>Z<<w>>>w}var I=o.includes("unsigned"),U=(Z,q)=>{if(typeof Z!="number"&&typeof Z!="boolean")throw new TypeError('Cannot convert "'+Ot(Z)+'" to '+q);if(Z<m||Z>x)throw new TypeError('Passing a number "'+Ot(Z)+'" from JS side to C/C++ side to an argument of type "'+o+'", which is outside the valid range ['+m+", "+x+"]!")},X;I?X=function(Z,q){return U(q,this.name),q>>>0}:X=function(Z,q){return U(q,this.name),q},Qe(a,{name:o,fromWireType:A,toWireType:X,argPackAdvance:8,readValueFromPointer:Tl(o,E,m!==0),destructorFunction:null})}function Al(a,o,d){var m=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],x=m[o];function E(A){A=A>>2;var w=re,I=w[A],U=w[A+1];return new x(It,U,I)}d=Fe(d),Qe(a,{name:d,fromWireType:E,argPackAdvance:8,readValueFromPointer:E},{ignoreDuplicateRegistrations:!0})}function Cl(a,o){o=Fe(o);var d=o==="std::string";Qe(a,{name:o,fromWireType:function(m){var x=re[m>>2],E=m+4,A;if(d)for(var w=E,I=0;I<=x;++I){var U=E+I;if(I==x||Ce[U]==0){var X=U-w,Z=K(w,X);A===void 0?A=Z:(A+="\0",A+=Z),w=U+1}}else{for(var q=new Array(x),I=0;I<x;++I)q[I]=String.fromCharCode(Ce[E+I]);A=q.join("")}return ct(m),A},toWireType:function(m,x){x instanceof ArrayBuffer&&(x=new Uint8Array(x));var E,A=typeof x=="string";A||x instanceof Uint8Array||x instanceof Uint8ClampedArray||x instanceof Int8Array||ne("Cannot pass non-string to std::string"),d&&A?E=Pt(x):E=x.length;var w=$i(4+E+1),I=w+4;if(re[w>>2]=E,d&&A)rn(x,I,E+1);else if(A)for(var U=0;U<E;++U){var X=x.charCodeAt(U);X>255&&(ct(I),ne("String has UTF-16 code units that do not fit in 8 bits")),Ce[I+U]=X}else for(var U=0;U<E;++U)Ce[I+U]=x[U];return m!==null&&m.push(ct,w),w},argPackAdvance:8,readValueFromPointer:Rn,destructorFunction:function(m){ct(m)}})}var Ms=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Rl(a,o){N(a%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var d=a,m=d>>1,x=m+o/2;!(m>=x)&&Tn[m];)++m;if(d=m<<1,d-a>32&&Ms)return Ms.decode(Ce.subarray(a,d));for(var E="",A=0;!(A>=o/2);++A){var w=Lt[a+A*2>>1];if(w==0)break;E+=String.fromCharCode(w)}return E}function Pl(a,o,d){if(N(o%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),N(typeof d=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),d===void 0&&(d=2147483647),d<2)return 0;d-=2;for(var m=o,x=d<a.length*2?d/2:a.length,E=0;E<x;++E){var A=a.charCodeAt(E);Lt[o>>1]=A,o+=2}return Lt[o>>1]=0,o-m}function Il(a){return a.length*2}function Ll(a,o){N(a%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var d=0,m="";!(d>=o/4);){var x=oe[a+d*4>>2];if(x==0)break;if(++d,x>=65536){var E=x-65536;m+=String.fromCharCode(55296|E>>10,56320|E&1023)}else m+=String.fromCharCode(x)}return m}function Dl(a,o,d){if(N(o%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),N(typeof d=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),d===void 0&&(d=2147483647),d<4)return 0;for(var m=o,x=m+d-4,E=0;E<a.length;++E){var A=a.charCodeAt(E);if(A>=55296&&A<=57343){var w=a.charCodeAt(++E);A=65536+((A&1023)<<10)|w&1023}if(oe[o>>2]=A,o+=4,o+4>x)break}return oe[o>>2]=0,o-m}function Nl(a){for(var o=0,d=0;d<a.length;++d){var m=a.charCodeAt(d);m>=55296&&m<=57343&&++d,o+=4}return o}function Ul(a,o,d){d=Fe(d);var m,x,E,A,w;o===2?(m=Rl,x=Pl,A=Il,E=()=>Tn,w=1):o===4&&(m=Ll,x=Dl,A=Nl,E=()=>re,w=2),Qe(a,{name:d,fromWireType:function(I){for(var U=re[I>>2],X=E(),Z,q=I+4,ce=0;ce<=U;++ce){var ie=I+4+ce*o;if(ce==U||X[ie>>w]==0){var se=ie-q,Pe=m(q,se);Z===void 0?Z=Pe:(Z+="\0",Z+=Pe),q=ie+o}}return ct(I),Z},toWireType:function(I,U){typeof U!="string"&&ne("Cannot pass non-string to C++ string type "+d);var X=A(U),Z=$i(4+X+o);return re[Z>>2]=X>>w,x(U,Z+4,X+o),I!==null&&I.push(ct,Z),Z},argPackAdvance:8,readValueFromPointer:Rn,destructorFunction:function(I){ct(I)}})}function Fl(a,o){o=Fe(o),Qe(a,{isVoid:!0,name:o,argPackAdvance:0,fromWireType:function(){},toWireType:function(d,m){}})}function Ol(){Re("native code called abort()")}function Bl(a,o,d){Ce.copyWithin(a,o,o+d)}function zl(){return 2147483648}function kl(a){try{return V.grow(a-It.byteLength+65535>>>16),ns(V.buffer),1}catch(o){C("emscripten_realloc_buffer: Attempted to grow heap from "+It.byteLength+" bytes to "+a+" bytes, but got error: "+o)}}function Vl(a){var o=Ce.length;a=a>>>0,N(a>o);var d=zl();if(a>d)return C("Cannot enlarge memory, asked to go up to "+a+" bytes, but the limit is "+d+" bytes!"),!1;let m=(I,U)=>I+(U-I%U)%U;for(var x=1;x<=4;x*=2){var E=o*(1+.2/x);E=Math.min(E,a+100663296);var A=Math.min(d,m(Math.max(a,E),65536)),w=kl(A);if(w)return!0}return C("Failed to grow the heap from "+o+" bytes to "+A+" bytes, not enough memory!"),!1}var Wi={};function Gl(){return c||"./this.program"}function fn(){if(!fn.strings){var a=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",o={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:a,_:Gl()};for(var d in Wi)Wi[d]===void 0?delete o[d]:o[d]=Wi[d];var m=[];for(var d in o)m.push(d+"="+o[d]);fn.strings=m}return fn.strings}function Hl(a,o,d){for(var m=0;m<a.length;++m)N(a.charCodeAt(m)===(a.charCodeAt(m)&255)),qe[o++>>0]=a.charCodeAt(m);d||(qe[o>>0]=0)}var Xi={varargs:void 0,get:function(){N(Xi.varargs!=null),Xi.varargs+=4;var a=oe[Xi.varargs-4>>2];return a},getStr:function(a){var o=K(a);return o}};function Wl(a,o){var d=0;return fn().forEach(function(m,x){var E=o+d;re[a+x*4>>2]=E,Hl(m,E),d+=m.length+1}),0}function Xl(a,o){var d=fn();re[a>>2]=d.length;var m=0;return d.forEach(function(x){m+=x.length+1}),re[o>>2]=m,0}function ql(a){Re("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM")}function Yl(a,o,d,m,x){return 70}var qi=[null,[],[]];function Yi(a,o){var d=qi[a];N(d),o===0||o===10?((a===1?B:C)(ve(d,0)),d.length=0):d.push(o)}function Wp(){rc(0),qi[1].length&&Yi(1,10),qi[2].length&&Yi(2,10)}function $l(a,o,d,m){for(var x=0,E=0;E<d;E++){var A=re[o>>2],w=re[o+4>>2];o+=8;for(var I=0;I<w;I++)Yi(a,Ce[A+I]);x+=w}return re[m>>2]=x,0}function In(a){return a%4===0&&(a%100!==0||a%400===0)}function Zl(a,o){for(var d=0,m=0;m<=o;d+=a[m++]);return d}var bs=[31,29,31,30,31,30,31,31,30,31,30,31],ws=[31,28,31,30,31,30,31,31,30,31,30,31];function Jl(a,o){for(var d=new Date(a.getTime());o>0;){var m=In(d.getFullYear()),x=d.getMonth(),E=(m?bs:ws)[x];if(o>E-d.getDate())o-=E-d.getDate()+1,d.setDate(1),x<11?d.setMonth(x+1):(d.setMonth(0),d.setFullYear(d.getFullYear()+1));else return d.setDate(d.getDate()+o),d}return d}function jl(a,o,d){var m=d>0?d:Pt(a)+1,x=new Array(m),E=ue(a,x,0,x.length);return o&&(x.length=E),x}function Kl(a,o,d,m){var x=oe[m+40>>2],E={tm_sec:oe[m>>2],tm_min:oe[m+4>>2],tm_hour:oe[m+8>>2],tm_mday:oe[m+12>>2],tm_mon:oe[m+16>>2],tm_year:oe[m+20>>2],tm_wday:oe[m+24>>2],tm_yday:oe[m+28>>2],tm_isdst:oe[m+32>>2],tm_gmtoff:oe[m+36>>2],tm_zone:x?K(x):""},A=K(d),w={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var I in w)A=A.replace(new RegExp(I,"g"),w[I]);var U=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],X=["January","February","March","April","May","June","July","August","September","October","November","December"];function Z(P,H,xe){for(var ye=typeof P=="number"?P.toString():P||"";ye.length<H;)ye=xe[0]+ye;return ye}function q(P,H){return Z(P,H,"0")}function ce(P,H){function xe(Et){return Et<0?-1:Et>0?1:0}var ye;return(ye=xe(P.getFullYear()-H.getFullYear()))===0&&(ye=xe(P.getMonth()-H.getMonth()))===0&&(ye=xe(P.getDate()-H.getDate())),ye}function ie(P){switch(P.getDay()){case 0:return new Date(P.getFullYear()-1,11,29);case 1:return P;case 2:return new Date(P.getFullYear(),0,3);case 3:return new Date(P.getFullYear(),0,2);case 4:return new Date(P.getFullYear(),0,1);case 5:return new Date(P.getFullYear()-1,11,31);case 6:return new Date(P.getFullYear()-1,11,30)}}function se(P){var H=Jl(new Date(P.tm_year+1900,0,1),P.tm_yday),xe=new Date(H.getFullYear(),0,4),ye=new Date(H.getFullYear()+1,0,4),Et=ie(xe),Dn=ie(ye);return ce(Et,H)<=0?ce(Dn,H)<=0?H.getFullYear()+1:H.getFullYear():H.getFullYear()-1}var Pe={"%a":function(P){return U[P.tm_wday].substring(0,3)},"%A":function(P){return U[P.tm_wday]},"%b":function(P){return X[P.tm_mon].substring(0,3)},"%B":function(P){return X[P.tm_mon]},"%C":function(P){var H=P.tm_year+1900;return q(H/100|0,2)},"%d":function(P){return q(P.tm_mday,2)},"%e":function(P){return Z(P.tm_mday,2," ")},"%g":function(P){return se(P).toString().substring(2)},"%G":function(P){return se(P)},"%H":function(P){return q(P.tm_hour,2)},"%I":function(P){var H=P.tm_hour;return H==0?H=12:H>12&&(H-=12),q(H,2)},"%j":function(P){return q(P.tm_mday+Zl(In(P.tm_year+1900)?bs:ws,P.tm_mon-1),3)},"%m":function(P){return q(P.tm_mon+1,2)},"%M":function(P){return q(P.tm_min,2)},"%n":function(){return`
7
+ `},"%p":function(P){return P.tm_hour>=0&&P.tm_hour<12?"AM":"PM"},"%S":function(P){return q(P.tm_sec,2)},"%t":function(){return" "},"%u":function(P){return P.tm_wday||7},"%U":function(P){var H=P.tm_yday+7-P.tm_wday;return q(Math.floor(H/7),2)},"%V":function(P){var H=Math.floor((P.tm_yday+7-(P.tm_wday+6)%7)/7);if((P.tm_wday+371-P.tm_yday-2)%7<=2&&H++,H){if(H==53){var ye=(P.tm_wday+371-P.tm_yday)%7;ye!=4&&(ye!=3||!In(P.tm_year))&&(H=1)}}else{H=52;var xe=(P.tm_wday+7-P.tm_yday-1)%7;(xe==4||xe==5&&In(P.tm_year%400-1))&&H++}return q(H,2)},"%w":function(P){return P.tm_wday},"%W":function(P){var H=P.tm_yday+7-(P.tm_wday+6)%7;return q(Math.floor(H/7),2)},"%y":function(P){return(P.tm_year+1900).toString().substring(2)},"%Y":function(P){return P.tm_year+1900},"%z":function(P){var H=P.tm_gmtoff,xe=H>=0;return H=Math.abs(H)/60,H=H/60*100+H%60,(xe?"+":"-")+("0000"+H).slice(-4)},"%Z":function(P){return P.tm_zone},"%%":function(){return"%"}};A=A.replace(/%%/g,"\0\0");for(var I in Pe)A.includes(I)&&(A=A.replace(new RegExp(I,"g"),Pe[I](E)));A=A.replace(/\0\0/g,"%");var $e=jl(A,!1);return $e.length>o?0:(ls($e,a),$e.length-1)}function Ql(a,o,d,m){return Kl(a,o,d,m)}function Ts(a,o){N(a<16384),a<128?o.push(a):o.push(a%128|128,a>>7)}function ec(a){for(var o={i:"i32",j:"i64",f:"f32",d:"f64",p:"i32"},d={parameters:[],results:a[0]=="v"?[]:[o[a[0]]]},m=1;m<a.length;++m)N(a[m]in o,"invalid signature char: "+a[m]),d.parameters.push(o[a[m]]);return d}function Xp(a,o){if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(ec(o),a);var d=[1,96],m=o.slice(0,1),x=o.slice(1),E={i:127,p:127,j:126,f:125,d:124};Ts(x.length,d);for(var A=0;A<x.length;++A)N(x[A]in E,"invalid signature char: "+x[A]),d.push(E[x[A]]);m=="v"?d.push(0):d.push(1,E[m]);var w=[0,97,115,109,1,0,0,0,1];Ts(d.length,w),w.push.apply(w,d),w.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var I=new WebAssembly.Module(new Uint8Array(w)),U=new WebAssembly.Instance(I,{e:{f:a}}),X=U.exports.f;return X}function qp(a,o){if(Es)for(var d=a;d<a+o;d++){var m=Pn(d);m&&Es.set(m,d)}}var Es=void 0,As=[];function Yp(){if(As.length)return As.pop();try{at.grow(1)}catch(a){throw a instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":a}return at.length-1}function $p(a,o){at.set(a,o),dn[a]=at.get(a)}var Zp=1;function tc(a){var o=t["_"+a];return N(o,"Cannot call unknown function "+a+", make sure it is exported"),o}function Jp(a,o,d,m,x){var E={string:ie=>{var se=0;if(ie!=null&&ie!==0){var Pe=(ie.length<<2)+1;se=Ps(Pe),rn(ie,se,Pe)}return se},array:ie=>{var se=Ps(ie.length);return ls(ie,se),se}};function A(ie){return o==="string"?K(ie):o==="boolean"?!!ie:ie}var w=tc(a),I=[],U=0;if(N(o!=="array",'Return type should not be "array".'),m)for(var X=0;X<m.length;X++){var Z=E[d[X]];Z?(U===0&&(U=oc()),I[X]=Z(m[X])):I[X]=m[X]}var q=w.apply(null,I);function ce(ie){return U!==0&&lc(U),A(ie)}return q=ce(q),q}Fo(),Ut=t.BindingError=Fi(Error,"BindingError"),ds=t.InternalError=Fi(Error,"InternalError"),Qo(),qo(),ll(),vs=t.UnboundTypeError=Fi(Error,"UnboundTypeError"),Sl();var jp=!0;function nc(){W("fetchSettings")}var Cs={__cxa_allocate_exception:Po,__cxa_throw:No,_embind_register_bigint:Uo,_embind_register_bool:zo,_embind_register_class:pl,_embind_register_class_constructor:gl,_embind_register_class_function:_l,_embind_register_emval:Ml,_embind_register_float:wl,_embind_register_integer:El,_embind_register_memory_view:Al,_embind_register_std_string:Cl,_embind_register_std_wstring:Ul,_embind_register_void:Fl,abort:Ol,emscripten_memcpy_big:Bl,emscripten_resize_heap:Vl,environ_get:Wl,environ_sizes_get:Xl,fd_close:ql,fd_seek:Yl,fd_write:$l,strftime_l:Ql},Kp=Ao(),Qp=t.___wasm_call_ctors=_e("__wasm_call_ctors"),$i=t._malloc=_e("malloc"),ct=t._free=_e("free"),ic=t.___getTypeName=_e("__getTypeName"),em=t.__embind_initialize_bindings=_e("_embind_initialize_bindings"),tm=t.___errno_location=_e("__errno_location"),rc=t._fflush=_e("fflush"),Rs=t._emscripten_stack_init=function(){return(Rs=t._emscripten_stack_init=t.asm.emscripten_stack_init).apply(null,arguments)},sc=t._emscripten_stack_get_free=function(){return(sc=t._emscripten_stack_get_free=t.asm.emscripten_stack_get_free).apply(null,arguments)},ac=t._emscripten_stack_get_base=function(){return(ac=t._emscripten_stack_get_base=t.asm.emscripten_stack_get_base).apply(null,arguments)},Zi=t._emscripten_stack_get_end=function(){return(Zi=t._emscripten_stack_get_end=t.asm.emscripten_stack_get_end).apply(null,arguments)},oc=t.stackSave=_e("stackSave"),lc=t.stackRestore=_e("stackRestore"),Ps=t.stackAlloc=_e("stackAlloc"),cc=t.___cxa_is_pointer_type=_e("__cxa_is_pointer_type"),nm=t.dynCall_viijii=_e("dynCall_viijii"),im=t.dynCall_ji=_e("dynCall_ji"),rm=t.dynCall_jiji=_e("dynCall_jiji"),sm=t.dynCall_iiiiij=_e("dynCall_iiiiij"),am=t.dynCall_iiiiijj=_e("dynCall_iiiiijj"),om=t.dynCall_iiiiiijj=_e("dynCall_iiiiiijj"),uc=["run","UTF8ArrayToString","UTF8ToString","stringToUTF8Array","stringToUTF8","lengthBytesUTF8","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","FS_createFolder","FS_createPath","FS_createDataFile","FS_createPreloadedFile","FS_createLazyFile","FS_createLink","FS_createDevice","FS_unlink","getLEB","getFunctionTables","alignFunctionTables","registerFunctions","prettyPrint","getCompilerSetting","print","printErr","callMain","abort","keepRuntimeAlive","wasmMemory","stackAlloc","stackSave","stackRestore","getTempRet0","setTempRet0","writeStackCookie","checkStackCookie","ptrToString","zeroMemory","stringToNewUTF8","exitJS","getHeapMax","emscripten_realloc_buffer","ENV","ERRNO_CODES","ERRNO_MESSAGES","setErrNo","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","DNS","getHostByName","Protocols","Sockets","getRandomDevice","warnOnce","traverseStack","UNWIND_CACHE","convertPCtoSourceLocation","readAsmConstArgsArray","readAsmConstArgs","mainThreadEM_ASM","jstoi_q","jstoi_s","getExecutableName","listenOnce","autoResumeAudioContext","dynCallLegacy","getDynCaller","dynCall","handleException","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","safeSetTimeout","asmjsMangle","asyncLoad","alignMemory","mmapAlloc","writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getCFunc","ccall","cwrap","uleb128Encode","sigToWasmTypes","convertJsFunctionToWasm","freeTableIndexes","functionsInTableMap","getEmptyTableSlot","updateTableMap","addFunction","removeFunction","reallyNegative","unSign","strLen","reSign","formatString","setValue","getValue","PATH","PATH_FS","intArrayFromString","intArrayToString","AsciiToString","stringToAscii","UTF16Decoder","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","allocateUTF8","allocateUTF8OnStack","writeStringToMemory","writeArrayToMemory","writeAsciiToMemory","SYSCALLS","getSocketFromFD","getSocketAddress","JSEvents","registerKeyEventCallback","specialHTMLTargets","maybeCStringToJsString","findEventTarget","findCanvasEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","currentFullscreenStrategy","restoreOldWindowedStyle","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","demangle","demangleAll","jsStackTrace","stackTrace","ExitStatus","getEnvStrings","checkWasiClock","flush_NO_FILESYSTEM","dlopenMissingError","setImmediateWrapped","clearImmediateWrapped","polyfillSetImmediate","uncaughtExceptionCount","exceptionLast","exceptionCaught","ExceptionInfo","exception_addRef","exception_decRef","Browser","setMainLoop","wget","FS","MEMFS","TTY","PIPEFS","SOCKFS","_setNetworkCallback","tempFixedLengthArray","miniTempWebGLFloatBuffers","heapObjectForWebGLType","heapAccessShiftForWebGLHeap","GL","emscriptenWebGLGet","computeUnpackAlignedImageSize","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","writeGLArray","AL","SDL_unicode","SDL_ttfContext","SDL_audio","SDL","SDL_gfx","GLUT","EGL","GLFW_Window","GLFW","GLEW","IDBStore","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","InternalError","BindingError","UnboundTypeError","PureVirtualError","init_embind","throwInternalError","throwBindingError","throwUnboundTypeError","ensureOverloadTable","exposePublicSymbol","replacePublicSymbol","extendError","createNamedFunction","embindRepr","registeredInstances","getBasestPointer","registerInheritedInstance","unregisterInheritedInstance","getInheritedInstance","getInheritedInstanceCount","getLiveInheritedInstances","registeredTypes","awaitingDependencies","typeDependencies","registeredPointers","registerType","whenDependentTypesAreResolved","embind_charCodes","embind_init_charCodes","readLatin1String","getTypeName","heap32VectorToArray","requireRegisteredType","getShiftFromSize","integerReadValueFromPointer","enumReadValueFromPointer","floatReadValueFromPointer","simpleReadValueFromPointer","runDestructors","new_","craftInvokerFunction","embind__requireFunction","tupleRegistrations","structRegistrations","genericPointerToWireType","constNoSmartPtrRawPointerToWireType","nonConstNoSmartPtrRawPointerToWireType","init_RegisteredPointer","RegisteredPointer","RegisteredPointer_getPointee","RegisteredPointer_destructor","RegisteredPointer_deleteObject","RegisteredPointer_fromWireType","runDestructor","releaseClassHandle","finalizationRegistry","detachFinalizer_deps","detachFinalizer","attachFinalizer","makeClassHandle","init_ClassHandle","ClassHandle","ClassHandle_isAliasOf","throwInstanceAlreadyDeleted","ClassHandle_clone","ClassHandle_delete","deletionQueue","ClassHandle_isDeleted","ClassHandle_deleteLater","flushPendingDeletes","delayFunction","setDelayFunction","RegisteredClass","shallowCopyInternalPointer","downcastPointer","upcastPointer","validateThis","char_0","char_9","makeLegalFunctionName","emval_handle_array","emval_free_list","emval_symbols","init_emval","count_emval_handles","get_first_emval","getStringOrSymbol","Emval","emval_newers","craftEmvalAllocator","emval_get_global","emval_lookupTypes","emval_allocateDestructors","emval_methodCallers","emval_addMethodCaller","emval_registeredMethods"];uc.forEach(_);var hc=["ptrToString","zeroMemory","stringToNewUTF8","exitJS","setErrNo","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","getHostByName","getRandomDevice","traverseStack","convertPCtoSourceLocation","readAsmConstArgs","mainThreadEM_ASM","jstoi_q","jstoi_s","listenOnce","autoResumeAudioContext","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","safeSetTimeout","asmjsMangle","asyncLoad","alignMemory","mmapAlloc","writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertU32PairToI53","reallyNegative","unSign","strLen","reSign","formatString","getSocketFromFD","getSocketAddress","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","findCanvasEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","checkWasiClock","setImmediateWrapped","clearImmediateWrapped","polyfillSetImmediate","exception_addRef","exception_decRef","setMainLoop","_setNetworkCallback","heapObjectForWebGLType","heapAccessShiftForWebGLHeap","emscriptenWebGLGet","computeUnpackAlignedImageSize","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","writeGLArray","SDL_unicode","SDL_ttfContext","SDL_audio","GLFW_Window","runAndAbortIfError","registerInheritedInstance","unregisterInheritedInstance","requireRegisteredType","enumReadValueFromPointer","validateThis","getStringOrSymbol","craftEmvalAllocator","emval_get_global","emval_lookupTypes","emval_allocateDestructors","emval_addMethodCaller"];hc.forEach(j);var Ln;sn=function a(){Ln||Is(),Ln||(sn=a)};function dc(){Rs(),mo()}function Is(a){if(a=a||l,wt>0||(dc(),go(),wt>0))return;function o(){Ln||(Ln=!0,t.calledRun=!0,!G&&(_o(),n(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),N(!t._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),yo()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),o()},1)):o(),Li()}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return Is(),e.ready})})();typeof Jn=="object"&&typeof sr=="object"?sr.exports=rr:typeof define=="function"&&define.amd?define([],function(){return rr}):typeof Jn=="object"&&(Jn.createLazPerf=rr)});var ua=te(Je=>{"use strict";var Su=Je&&Je.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Je,"__esModule",{value:!0});Je.LazPerf=Je.create=Je.createLazPerf=void 0;var ar=Su(ca());Je.createLazPerf=ar.default;Je.create=ar.default;Je.LazPerf={create:ar.default}});var ma=te(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.decompressFile=mt.decompressChunk=mt.PointData=void 0;var ha=ua(),Mu=ir();mt.PointData={createLazPerf:ha.createLazPerf,decompressChunk:fa,decompressFile:pa};var or;async function da(s){return s||(or||(or=(0,ha.createLazPerf)()),or)}async function fa(s,{pointCount:e,pointDataRecordFormat:t,pointDataRecordLength:n},i){let r=await da(i),l=new Uint8Array(e*n),c=r._malloc(s.byteLength),h=r._malloc(n),u=new r.ChunkDecoder;try{r.HEAPU8.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),c),u.open(t,n,c);for(let f=0;f<e;++f)u.getPoint(h),l.set(new Uint8Array(r.HEAPU8.buffer,h,n),f*n)}finally{r._free(c),r._free(h),u.delete()}return l}mt.decompressChunk=fa;async function pa(s,e){let t=await da(e),n=Mu.Header.parse(s),{pointCount:i,pointDataRecordLength:r}=n,l=new Uint8Array(i*r),c=t._malloc(s.byteLength),h=t._malloc(r),u=new t.LASZip;try{t.HEAPU8.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),c),u.open(c,s.byteLength);for(let f=0;f<i;++f)u.getPoint(h),l.set(new Uint8Array(t.HEAPU8.buffer,h,r),f*r)}finally{u.delete()}return l}mt.decompressFile=pa});var ga=te(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.View=void 0;var bu=Be(),wu=er(),Tu=tr();jn.View={create:Eu};function Eu(s,e,t=[],n){let i=Tu.Extractor.create(e,t);if(n){let f=new Set([...n]);i=Object.entries(i).reduce((p,[g,y])=>(f.has(g)&&(p[g]=y),p),{})}let r=wu.Dimensions.create(i,t),l=bu.Binary.toDataView(s),c=e.pointDataRecordLength;if(l.byteLength%c!==0)throw new Error(`Invalid buffer length (${l.byteLength}) for point length ${c}`);let h=l.byteLength/e.pointDataRecordLength;function u(f){let p=i[f];if(!p)throw new Error(`No extractor for dimension: ${f}`);return function(g){if(g>=h)throw new RangeError(`View index (${g}) out of range: ${h}`);return p(l,g)}}return{pointCount:h,dimensions:r,getter:u}}});var xa=te(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.Vlr=void 0;var je=Be(),Ht=On();Kn.Vlr={walk:Ru,parse:va,find:ya,at:Au,fetch:Cu};function ya(s,e,t){return s.find(n=>n.userId===e&&n.recordId===t)}function Au(s,e,t){let n=ya(s,e,t);if(!n)throw new Error(`VLR not found: ${e}/${t}`);return n}function Cu(s,{contentOffset:e,contentLength:t}){return t===0?new Uint8Array:je.Getter.create(s)(e,e+t)}async function Ru(s,e){let t=je.Getter.create(s),n=await _a({get:t,startOffset:e.headerLength,count:e.vlrCount,isExtended:!1}),i=await _a({get:t,startOffset:e.evlrOffset,count:e.evlrCount,isExtended:!0});return[...n,...i]}function va(s,e){return(e?Iu:Pu)(s)}function Pu(s){let e=je.Binary.toDataView(s);if(e.byteLength!==Ht.vlrHeaderLength)throw new Error(`Invalid VLR header length (must be ${Ht.vlrHeaderLength}): ${e.byteLength}`);return{userId:je.Binary.toCString(s.slice(2,18)),recordId:e.getUint16(18,!0),contentLength:e.getUint16(20,!0),description:je.Binary.toCString(s.slice(22,54)),isExtended:!1}}function Iu(s){let e=je.Binary.toDataView(s);if(e.byteLength!==Ht.evlrHeaderLength)throw new Error(`Invalid EVLR header length (must be ${Ht.evlrHeaderLength}): ${e.byteLength}`);return{userId:je.Binary.toCString(s.slice(2,18)),recordId:e.getUint16(18,!0),contentLength:(0,je.parseBigInt)((0,je.getBigUint64)(e,20,!0)),description:je.Binary.toCString(s.slice(28,60)),isExtended:!0}}async function _a({get:s,startOffset:e,count:t,isExtended:n}){let i=[],r=e,l=n?Ht.evlrHeaderLength:Ht.vlrHeaderLength;for(let c=0;c<t;++c){let h=l?await s(r,r+l):new Uint8Array,{userId:u,recordId:f,contentLength:p,description:g}=va(h,n);i.push({userId:u,recordId:f,contentOffset:r+l,contentLength:p,description:g,isExtended:n}),r+=l+p}return i}});var Qn=te(le=>{"use strict";var Lu=le&&le.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Du=le&&le.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Nu=le&&le.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Lu(e,s,t);return Du(e,s),e};Object.defineProperty(le,"__esModule",{value:!0});le.Vlr=le.View=le.PointData=le.Header=le.Extractor=le.ExtraBytes=le.Dimensions=le.Constants=void 0;le.Constants=Nu(On());var Uu=er();Object.defineProperty(le,"Dimensions",{enumerable:!0,get:function(){return Uu.Dimensions}});var Fu=Qi();Object.defineProperty(le,"ExtraBytes",{enumerable:!0,get:function(){return Fu.ExtraBytes}});var Ou=tr();Object.defineProperty(le,"Extractor",{enumerable:!0,get:function(){return Ou.Extractor}});var Bu=ir();Object.defineProperty(le,"Header",{enumerable:!0,get:function(){return Bu.Header}});var zu=ma();Object.defineProperty(le,"PointData",{enumerable:!0,get:function(){return zu.PointData}});var ku=ga();Object.defineProperty(le,"View",{enumerable:!0,get:function(){return ku.View}});var Vu=xa();Object.defineProperty(le,"Vlr",{enumerable:!0,get:function(){return Vu.Vlr}})});var lr=te(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.Hierarchy=void 0;var pn=Be(),Sa=Fn();ei.Hierarchy={parse:Ma,load:Gu};function Ma(s){let e=pn.Binary.toDataView(s);if(e.byteLength%Sa.hierarchyItemLength!==0)throw new Error(`Invalid hierarchy page length: ${e.byteLength}`);let t={},n={};for(let i=0;i<e.byteLength;i+=Sa.hierarchyItemLength){let r=e.getInt32(i+0,!0),l=e.getInt32(i+4,!0),c=e.getInt32(i+8,!0),h=e.getInt32(i+12,!0),u=(0,pn.parseBigInt)((0,pn.getBigUint64)(e,i+16,!0)),f=e.getInt32(i+24,!0),p=e.getInt32(i+28,!0),g=pn.Key.toString([r,l,c,h]);if(p<-1)throw new Error(`Invalid hierarchy point count at key: ${g}`);p===-1?n[g]={pageOffset:u,pageLength:f}:t[g]={pointCount:p,pointDataOffset:u,pointDataLength:f}}return{nodes:t,pages:n}}async function Gu(s,e){let t=pn.Getter.create(s);return Ma(await t(e.pageOffset,e.pageOffset+e.pageLength))}});var cr=te(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.Info=void 0;var mn=Be(),ba=Fn();ti.Info={parse:Hu};function Hu(s){let e=mn.Binary.toDataView(s);if(e.byteLength!==ba.infoLength)throw new Error(`Invalid COPC info VLR length (should be ${ba.infoLength}): ${e.byteLength}`);let t=[e.getFloat64(0,!0),e.getFloat64(8,!0),e.getFloat64(16,!0)],n=e.getFloat64(24,!0);return{cube:[t[0]-n,t[1]-n,t[2]-n,t[0]+n,t[1]+n,t[2]+n],spacing:e.getFloat64(32,!0),rootHierarchyPage:{pageOffset:(0,mn.parseBigInt)((0,mn.getBigUint64)(e,40,!0)),pageLength:(0,mn.parseBigInt)((0,mn.getBigUint64)(e,48,!0))},gpsTimeRange:[e.getFloat64(56,!0),e.getFloat64(64,!0)]}}});var Ea=te(Ke=>{"use strict";var Wu=Ke&&Ke.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Xu=Ke&&Ke.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),qu=Ke&&Ke.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Wu(e,s,t);return Xu(e,s),e};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.Copc=void 0;var ze=qu(Qn()),ni=Be(),Yu=lr(),$u=cr();Ke.Copc={create:Zu,loadHierarchyPage:Ju,loadCompressedPointDataBuffer:wa,loadPointDataBuffer:Ta,loadPointDataView:ju};async function Zu(s){let e=ni.Getter.create(s),t=65536,n=e(0,t);async function i(y,v){return v>=t?e(y,v):(await n).slice(y,v)}let r=ze.Header.parse(await i(0,ze.Constants.minHeaderLength)),l=await ze.Vlr.walk(i,r),c=ze.Vlr.find(l,"copc",1);if(!c)throw new Error("COPC info VLR is required");let h=$u.Info.parse(await ze.Vlr.fetch(i,c)),u,f=ze.Vlr.find(l,"LASF_Projection",2112);f&&f.contentLength&&(u=ni.Binary.toCString(await ze.Vlr.fetch(i,f)),u===""&&(u=void 0));let p=[],g=ze.Vlr.find(l,"LASF_Spec",4);return g&&(p=ze.ExtraBytes.parse(await ze.Vlr.fetch(i,g))),{header:r,vlrs:l,info:h,wkt:u,eb:p}}async function Ju(s,e){let t=ni.Getter.create(s);return Yu.Hierarchy.load(t,e)}async function wa(s,{pointDataOffset:e,pointDataLength:t}){return ni.Getter.create(s)(e,e+t)}async function Ta(s,{pointDataRecordFormat:e,pointDataRecordLength:t},n,i){let r=await wa(s,n),{pointCount:l}=n;return ze.PointData.decompressChunk(r,{pointCount:l,pointDataRecordFormat:e,pointDataRecordLength:t},i)}async function ju(s,e,t,{lazPerf:n,include:i}={}){let r=await Ta(s,e.header,t,n);return ze.View.create(r,e.header,e.eb,i)}});var Aa=te(Me=>{"use strict";var Ku=Me&&Me.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Qu=Me&&Me.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),eh=Me&&Me.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Ku(e,s,t);return Qu(e,s),e};Object.defineProperty(Me,"__esModule",{value:!0});Me.Info=Me.Hierarchy=Me.Copc=Me.Constants=void 0;Me.Constants=eh(Fn());var th=Ea();Object.defineProperty(Me,"Copc",{enumerable:!0,get:function(){return th.Copc}});var nh=lr();Object.defineProperty(Me,"Hierarchy",{enumerable:!0,get:function(){return nh.Hierarchy}});var ih=cr();Object.defineProperty(Me,"Info",{enumerable:!0,get:function(){return ih.Info}})});var ur=te(be=>{"use strict";var Ca=be&&be.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),rh=be&&be.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Ra=be&&be.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Ca(e,s,t);return rh(e,s),e},Pa=be&&be.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ca(e,s,t)};Object.defineProperty(be,"__esModule",{value:!0});be.Las=be.Ept=void 0;be.Ept=Ra(Bs());Pa(Aa(),be);be.Las=Ra(Qn());Pa(Be(),be)});import Bp from"@giro3d/giro3d/entities/PointCloud.js";var Ri=Nn(ur()),uo=Nn(Qn()),ho=Nn(ji());var Xa=1;var qa=3;var vr=0,xr=1,Sr=2,Mr=3,br=4,wr=5,Tr=6,Er=7,Ya=0,$a=1,Za=2;var kr=1,Vr=2,Gr=3,Hr=4,Wr=5,Xr=6,qr=7;var Yr=300;var Ja=302;var Ar=1e3,yn=1001,Cr=1002;var ja=1006;var Ka=1008;var Qa=1009;var eo=1015;var to=1023;var xn=2300,pi=2301,hi=2302,Rr=2303,Pr=2400,Ir=2401,Lr=2402;var $r="",Ve="srgb",Dr="srgb-linear",Nr="linear",di="srgb";var no=35044;var vn=2e3,Ur=2001;function sh(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function Fr(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}var Ia={},mi=null;function io(s){let e=s[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=s[1];t&&t.isStackTrace?s[0]+=" "+t.getLocation():s[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return s}function Ee(...s){s=io(s);let e="THREE."+s.shift();if(mi)mi("warn",e,...s);else{let t=s[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...s)}}function pe(...s){s=io(s);let e="THREE."+s.shift();if(mi)mi("error",e,...s);else{let t=s[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...s)}}function fi(...s){let e=s.join(" ");e in Ia||(Ia[e]=!0,Ee(...s))}var ah={[vr]:vr,[Sr]:Tr,[br]:br,[Mr]:wr,[xr]:xr,[Tr]:Sr,[Er]:Er,[wr]:Mr},Qt=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,l=i.length;r<l;r++)i[r].call(this,e);e.target=null}}},we=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var Vm=Math.PI/180,oh=180/Math.PI;function Zr(){let s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(we[s&255]+we[s>>8&255]+we[s>>16&255]+we[s>>24&255]+"-"+we[e&255]+we[e>>8&255]+"-"+we[e>>16&15|64]+we[e>>24&255]+"-"+we[t&63|128]+we[t>>8&255]+"-"+we[t>>16&255]+we[t>>24&255]+we[n&255]+we[n>>8&255]+we[n>>16&255]+we[n>>24&255]).toLowerCase()}function ee(s,e,t){return Math.max(e,Math.min(t,s))}function lh(s,e){return(s%e+e)%e}function hr(s,e,t){return(1-t)*s+t*e}function Jr(s){switch(s.constructor){case Uint32Array:return 4294967295;case Uint16Array:return 65535;case Uint8Array:case Uint8ClampedArray:return 255;case Int32Array:return 2147483647;case Int16Array:return 32767;case Int8Array:return 127;default:return}}function ch(s,e){if(e.constructor===Float32Array)return s;let t=Jr(e);if(t===void 0)throw new Error("THREE.MathUtils: Invalid component type.");return Math.max(s/t,-1)}function uh(s,e){if(e.constructor===Float32Array)return s;let t=Jr(e);if(t===void 0)throw new Error("THREE.MathUtils: Invalid component type.");return Math.round(s*t)}var Ge=class{static{this.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ee(this.x,e.x,t.x),this.y=ee(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ee(this.x,e,t),this.y=ee(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ee(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(ee(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,l=this.y-e.y;return this.x=r*n-l*i+e.x,this.y=r*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},st=class{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,l,c){let h=n[i+0],u=n[i+1],f=n[i+2],p=n[i+3],g=r[l+0],y=r[l+1],v=r[l+2],b=r[l+3];if(p!==b||h!==g||u!==y||f!==v){let M=h*g+u*y+f*v+p*b;M<0&&(g=-g,y=-y,v=-v,b=-b,M=-M);let S=1-c;if(M<.9995){let R=Math.acos(M),L=Math.sin(R);S=Math.sin(S*R)/L,c=Math.sin(c*R)/L,h=h*S+g*c,u=u*S+y*c,f=f*S+v*c,p=p*S+b*c}else{h=h*S+g*c,u=u*S+y*c,f=f*S+v*c,p=p*S+b*c;let R=1/Math.sqrt(h*h+u*u+f*f+p*p);h*=R,u*=R,f*=R,p*=R}}e[t]=h,e[t+1]=u,e[t+2]=f,e[t+3]=p}static multiplyQuaternionsFlat(e,t,n,i,r,l){let c=n[i],h=n[i+1],u=n[i+2],f=n[i+3],p=r[l],g=r[l+1],y=r[l+2],v=r[l+3];return e[t]=c*v+f*p+h*y-u*g,e[t+1]=h*v+f*g+u*p-c*y,e[t+2]=u*v+f*y+c*g-h*p,e[t+3]=f*v-c*p-h*g-u*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,i=e._y,r=e._z,l=e._order,c=Math.cos,h=Math.sin,u=c(n/2),f=c(i/2),p=c(r/2),g=h(n/2),y=h(i/2),v=h(r/2);switch(l){case"XYZ":this._x=g*f*p+u*y*v,this._y=u*y*p-g*f*v,this._z=u*f*v+g*y*p,this._w=u*f*p-g*y*v;break;case"YXZ":this._x=g*f*p+u*y*v,this._y=u*y*p-g*f*v,this._z=u*f*v-g*y*p,this._w=u*f*p+g*y*v;break;case"ZXY":this._x=g*f*p-u*y*v,this._y=u*y*p+g*f*v,this._z=u*f*v+g*y*p,this._w=u*f*p-g*y*v;break;case"ZYX":this._x=g*f*p-u*y*v,this._y=u*y*p+g*f*v,this._z=u*f*v-g*y*p,this._w=u*f*p+g*y*v;break;case"YZX":this._x=g*f*p+u*y*v,this._y=u*y*p+g*f*v,this._z=u*f*v-g*y*p,this._w=u*f*p-g*y*v;break;case"XZY":this._x=g*f*p-u*y*v,this._y=u*y*p-g*f*v,this._z=u*f*v+g*y*p,this._w=u*f*p+g*y*v;break;default:Ee("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],l=t[1],c=t[5],h=t[9],u=t[2],f=t[6],p=t[10],g=n+c+p;if(g>0){let y=.5/Math.sqrt(g+1);this._w=.25/y,this._x=(f-h)*y,this._y=(r-u)*y,this._z=(l-i)*y}else if(n>c&&n>p){let y=2*Math.sqrt(1+n-c-p);this._w=(f-h)/y,this._x=.25*y,this._y=(i+l)/y,this._z=(r+u)/y}else if(c>p){let y=2*Math.sqrt(1+c-n-p);this._w=(r-u)/y,this._x=(i+l)/y,this._y=.25*y,this._z=(h+f)/y}else{let y=2*Math.sqrt(1+p-n-c);this._w=(l-i)/y,this._x=(r+u)/y,this._y=(h+f)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ee(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,r=e._z,l=e._w,c=t._x,h=t._y,u=t._z,f=t._w;return this._x=n*f+l*c+i*u-r*h,this._y=i*f+l*h+r*c-n*u,this._z=r*f+l*u+n*h-i*c,this._w=l*f-n*c-i*h-r*u,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,r=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,r=-r,l=-l,c=-c);let h=1-t;if(c<.9995){let u=Math.acos(c),f=Math.sin(u);h=Math.sin(h*u)/f,t=Math.sin(t*u)/f,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+r*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+r*t,this._w=this._w*h+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},k=class{static{this.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(La.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(La.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,l=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*l,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*l,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*l,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,l=e.y,c=e.z,h=e.w,u=2*(l*i-c*n),f=2*(c*t-r*i),p=2*(r*n-l*t);return this.x=t+h*u+l*p-c*f,this.y=n+h*f+c*u-r*p,this.z=i+h*p+r*f-l*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ee(this.x,e.x,t.x),this.y=ee(this.y,e.y,t.y),this.z=ee(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ee(this.x,e,t),this.y=ee(this.y,e,t),this.z=ee(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ee(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,l=t.x,c=t.y,h=t.z;return this.x=i*h-r*c,this.y=r*l-n*h,this.z=n*c-i*l,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return dr.copy(this).projectOnVector(e),this.sub(dr)}reflect(e){return this.sub(dr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(ee(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},dr=new k,La=new st,J=class{static{this.prototype.isMatrix3=!0}constructor(e,t,n,i,r,l,c,h,u){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,l,c,h,u)}set(e,t,n,i,r,l,c,h,u){let f=this.elements;return f[0]=e,f[1]=i,f[2]=c,f[3]=t,f[4]=r,f[5]=h,f[6]=n,f[7]=l,f[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,l=n[0],c=n[3],h=n[6],u=n[1],f=n[4],p=n[7],g=n[2],y=n[5],v=n[8],b=i[0],M=i[3],S=i[6],R=i[1],L=i[4],B=i[7],C=i[2],z=i[5],O=i[8];return r[0]=l*b+c*R+h*C,r[3]=l*M+c*L+h*z,r[6]=l*S+c*B+h*O,r[1]=u*b+f*R+p*C,r[4]=u*M+f*L+p*z,r[7]=u*S+f*B+p*O,r[2]=g*b+y*R+v*C,r[5]=g*M+y*L+v*z,r[8]=g*S+y*B+v*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],h=e[6],u=e[7],f=e[8];return t*l*f-t*c*u-n*r*f+n*c*h+i*r*u-i*l*h}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],h=e[6],u=e[7],f=e[8],p=f*l-c*u,g=c*h-f*r,y=u*r-l*h,v=t*p+n*g+i*y;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);let b=1/v;return e[0]=p*b,e[1]=(i*u-f*n)*b,e[2]=(c*n-i*l)*b,e[3]=g*b,e[4]=(f*t-i*h)*b,e[5]=(i*r-c*t)*b,e[6]=y*b,e[7]=(n*h-u*t)*b,e[8]=(l*t-n*r)*b,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,l,c){let h=Math.cos(r),u=Math.sin(r);return this.set(n*h,n*u,-n*(h*l+u*c)+l+e,-i*u,i*h,-i*(-u*l+h*c)+c+t,0,0,1),this}scale(e,t){return fi("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(fr.makeScale(e,t)),this}rotate(e){return fi("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(fr.makeRotation(-e)),this}translate(e,t){return fi("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(fr.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},fr=new J,Da=new J().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Na=new J().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function hh(){let s={enabled:!0,workingColorSpace:Dr,spaces:{},convert:function(i,r,l){return this.enabled===!1||r===l||!r||!l||(this.spaces[r].transfer===di&&(i.r=it(i.r),i.g=it(i.g),i.b=it(i.b)),this.spaces[r].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===di&&(i.r=Kt(i.r),i.g=Kt(i.g),i.b=Kt(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===$r?Nr:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,l){return i.copy(this.spaces[l].fromXYZ).multiply(this.spaces[r].toXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[Dr]:{primaries:e,whitePoint:n,transfer:Nr,toXYZ:Da,fromXYZ:Na,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ve},outputColorSpaceConfig:{drawingBufferColorSpace:Ve}},[Ve]:{primaries:e,whitePoint:n,transfer:di,toXYZ:Da,fromXYZ:Na,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ve}}}),s}var ke=hh();function it(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Kt(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}var Wt,gi=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Wt===void 0&&(Wt=Fr("canvas")),Wt.width=e.width,Wt.height=e.height;let i=Wt.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Wt}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Fr("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let l=0;l<r.length;l++)r[l]=it(r[l]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(it(t[n]/255)*255):t[n]=it(t[n]);return{data:t,width:e.width,height:e.height}}else return Ee("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},dh=0,_i=class{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:dh++}),this.uuid=Zr(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width||0,t.height||0,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let l=0,c=i.length;l<c;l++)i[l].isDataTexture?r.push(pr(i[l].image)):r.push(pr(i[l]))}else r=pr(i);n.url=r}return t||(e.images[this.uuid]=n),n}};function pr(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?gi.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(Ee("Texture: Unable to serialize Texture."),{})}var fh=0,mr=new k,en=class s extends Qt{constructor(e=s.DEFAULT_IMAGE,t=s.DEFAULT_MAPPING,n=yn,i=yn,r=ja,l=Ka,c=to,h=Qa,u=s.DEFAULT_ANISOTROPY,f=$r){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:fh++}),this.uuid=Zr(),this.name="",this.source=new _i(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=l,this.anisotropy=u,this.format=c,this.internalFormat=null,this.type=h,this.offset=new Ge(0,0),this.repeat=new Ge(1,1),this.center=new Ge(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new J,this.generateMipmaps=!0,this.mipmapsAutoUpdate=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.isPMREMTexture=!1,this.normalized=!1}get width(){return this.source.getSize(mr).x}get height(){return this.source.getSize(mr).y}get depth(){return this.source.getSize(mr).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.mipmapsAutoUpdate=e.mipmapsAutoUpdate,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isPMREMTexture=e.isPMREMTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Ee(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Ee(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,mipmapsAutoUpdate:this.mipmapsAutoUpdate,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Yr)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ar:e.x=e.x-Math.floor(e.x);break;case yn:e.x=e.x<0?0:1;break;case Cr:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ar:e.y=e.y-Math.floor(e.y);break;case yn:e.y=e.y<0?0:1;break;case Cr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};en.DEFAULT_IMAGE=null;en.DEFAULT_MAPPING=Yr;en.DEFAULT_ANISOTROPY=1;var Or=class{static{this.prototype.isVector4=!0}constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*r,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*r,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*r,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,h=e.elements,u=h[0],f=h[4],p=h[8],g=h[1],y=h[5],v=h[9],b=h[2],M=h[6],S=h[10];if(Math.abs(f-g)<.01&&Math.abs(p-b)<.01&&Math.abs(v-M)<.01){if(Math.abs(f+g)<.1&&Math.abs(p+b)<.1&&Math.abs(v+M)<.1&&Math.abs(u+y+S-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let L=(u+1)/2,B=(y+1)/2,C=(S+1)/2,z=(f+g)/4,O=(p+b)/4,W=(v+M)/4;return L>B&&L>C?L<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(L),i=z/n,r=O/n):B>C?B<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(B),n=z/i,r=W/i):C<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(C),n=O/r,i=W/r),this.set(n,i,r,t),this}let R=Math.sqrt((M-v)*(M-v)+(p-b)*(p-b)+(g-f)*(g-f));return Math.abs(R)<.001&&(R=1),this.x=(M-v)/R,this.y=(p-b)/R,this.z=(g-f)/R,this.w=Math.acos((u+y+S-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ee(this.x,e.x,t.x),this.y=ee(this.y,e.y,t.y),this.z=ee(this.z,e.z,t.z),this.w=ee(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ee(this.x,e,t),this.y=ee(this.y,e,t),this.z=ee(this.z,e,t),this.w=ee(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ee(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};var rt=class s{static{this.prototype.isMatrix4=!0}constructor(e,t,n,i,r,l,c,h,u,f,p,g,y,v,b,M){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,l,c,h,u,f,p,g,y,v,b,M)}set(e,t,n,i,r,l,c,h,u,f,p,g,y,v,b,M){let S=this.elements;return S[0]=e,S[4]=t,S[8]=n,S[12]=i,S[1]=r,S[5]=l,S[9]=c,S[13]=h,S[2]=u,S[6]=f,S[10]=p,S[14]=g,S[3]=y,S[7]=v,S[11]=b,S[15]=M,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new s().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Xt.setFromMatrixColumn(e,0).length(),r=1/Xt.setFromMatrixColumn(e,1).length(),l=1/Xt.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*l,t[9]=n[9]*l,t[10]=n[10]*l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,r=e.z,l=Math.cos(n),c=Math.sin(n),h=Math.cos(i),u=Math.sin(i),f=Math.cos(r),p=Math.sin(r);if(e.order==="XYZ"){let g=l*f,y=l*p,v=c*f,b=c*p;t[0]=h*f,t[4]=-h*p,t[8]=u,t[1]=y+v*u,t[5]=g-b*u,t[9]=-c*h,t[2]=b-g*u,t[6]=v+y*u,t[10]=l*h}else if(e.order==="YXZ"){let g=h*f,y=h*p,v=u*f,b=u*p;t[0]=g+b*c,t[4]=v*c-y,t[8]=l*u,t[1]=l*p,t[5]=l*f,t[9]=-c,t[2]=y*c-v,t[6]=b+g*c,t[10]=l*h}else if(e.order==="ZXY"){let g=h*f,y=h*p,v=u*f,b=u*p;t[0]=g-b*c,t[4]=-l*p,t[8]=v+y*c,t[1]=y+v*c,t[5]=l*f,t[9]=b-g*c,t[2]=-l*u,t[6]=c,t[10]=l*h}else if(e.order==="ZYX"){let g=l*f,y=l*p,v=c*f,b=c*p;t[0]=h*f,t[4]=v*u-y,t[8]=g*u+b,t[1]=h*p,t[5]=b*u+g,t[9]=y*u-v,t[2]=-u,t[6]=c*h,t[10]=l*h}else if(e.order==="YZX"){let g=l*h,y=l*u,v=c*h,b=c*u;t[0]=h*f,t[4]=b-g*p,t[8]=v*p+y,t[1]=p,t[5]=l*f,t[9]=-c*f,t[2]=-u*f,t[6]=y*p+v,t[10]=g-b*p}else if(e.order==="XZY"){let g=l*h,y=l*u,v=c*h,b=c*u;t[0]=h*f,t[4]=-p,t[8]=u*f,t[1]=g*p+b,t[5]=l*f,t[9]=y*p-v,t[2]=v*p-y,t[6]=c*f,t[10]=b*p+g}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ph,e,mh)}lookAt(e,t,n){let i=this.elements;return De.subVectors(e,t),De.lengthSq()===0&&(De.z=1),De.normalize(),gt.crossVectors(n,De),gt.lengthSq()===0&&(Math.abs(n.z)===1?De.x+=1e-4:De.z+=1e-4,De.normalize(),gt.crossVectors(n,De)),gt.normalize(),ii.crossVectors(De,gt),i[0]=gt.x,i[4]=ii.x,i[8]=De.x,i[1]=gt.y,i[5]=ii.y,i[9]=De.y,i[2]=gt.z,i[6]=ii.z,i[10]=De.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,l=n[0],c=n[4],h=n[8],u=n[12],f=n[1],p=n[5],g=n[9],y=n[13],v=n[2],b=n[6],M=n[10],S=n[14],R=n[3],L=n[7],B=n[11],C=n[15],z=i[0],O=i[4],W=i[8],$=i[12],j=i[1],_=i[5],T=i[9],D=i[13],V=i[2],G=i[6],Y=i[10],N=i[14],ge=i[3],ve=i[7],K=i[11],ue=i[15];return r[0]=l*z+c*j+h*V+u*ge,r[4]=l*O+c*_+h*G+u*ve,r[8]=l*W+c*T+h*Y+u*K,r[12]=l*$+c*D+h*N+u*ue,r[1]=f*z+p*j+g*V+y*ge,r[5]=f*O+p*_+g*G+y*ve,r[9]=f*W+p*T+g*Y+y*K,r[13]=f*$+p*D+g*N+y*ue,r[2]=v*z+b*j+M*V+S*ge,r[6]=v*O+b*_+M*G+S*ve,r[10]=v*W+b*T+M*Y+S*K,r[14]=v*$+b*D+M*N+S*ue,r[3]=R*z+L*j+B*V+C*ge,r[7]=R*O+L*_+B*G+C*ve,r[11]=R*W+L*T+B*Y+C*K,r[15]=R*$+L*D+B*N+C*ue,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],l=e[1],c=e[5],h=e[9],u=e[13],f=e[2],p=e[6],g=e[10],y=e[14],v=e[3],b=e[7],M=e[11],S=e[15],R=h*y-u*g,L=c*y-u*p,B=c*g-h*p,C=l*y-u*f,z=l*g-h*f,O=l*p-c*f;return t*(b*R-M*L+S*B)-n*(v*R-M*C+S*z)+i*(v*L-b*C+S*O)-r*(v*B-b*z+M*O)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[1],l=e[5],c=e[9],h=e[2],u=e[6],f=e[10];return t*(l*f-c*u)-n*(r*f-c*h)+i*(r*u-l*h)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],h=e[6],u=e[7],f=e[8],p=e[9],g=e[10],y=e[11],v=e[12],b=e[13],M=e[14],S=e[15],R=t*c-n*l,L=t*h-i*l,B=t*u-r*l,C=n*h-i*c,z=n*u-r*c,O=i*u-r*h,W=f*b-p*v,$=f*M-g*v,j=f*S-y*v,_=p*M-g*b,T=p*S-y*b,D=g*S-y*M,V=R*D-L*T+B*_+C*j-z*$+O*W;if(V===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let G=1/V;return e[0]=(c*D-h*T+u*_)*G,e[1]=(i*T-n*D-r*_)*G,e[2]=(b*O-M*z+S*C)*G,e[3]=(g*z-p*O-y*C)*G,e[4]=(h*j-l*D-u*$)*G,e[5]=(t*D-i*j+r*$)*G,e[6]=(M*B-v*O-S*L)*G,e[7]=(f*O-g*B+y*L)*G,e[8]=(l*T-c*j+u*W)*G,e[9]=(n*j-t*T-r*W)*G,e[10]=(v*z-b*B+S*R)*G,e[11]=(p*B-f*z-y*R)*G,e[12]=(c*$-l*_-h*W)*G,e[13]=(t*_-n*$+i*W)*G,e[14]=(b*L-v*C-M*R)*G,e[15]=(f*C-p*L+g*R)*G,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,l=e.x,c=e.y,h=e.z,u=r*l,f=r*c;return this.set(u*l+n,u*c-i*h,u*h+i*c,0,u*c+i*h,f*c+n,f*h-i*l,0,u*h-i*c,f*h+i*l,r*h*h+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,l){return this.set(1,n,r,0,e,1,l,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,l=t._y,c=t._z,h=t._w,u=r+r,f=l+l,p=c+c,g=r*u,y=r*f,v=r*p,b=l*f,M=l*p,S=c*p,R=h*u,L=h*f,B=h*p,C=n.x,z=n.y,O=n.z;return i[0]=(1-(b+S))*C,i[1]=(y+B)*C,i[2]=(v-L)*C,i[3]=0,i[4]=(y-B)*z,i[5]=(1-(g+S))*z,i[6]=(M+R)*z,i[7]=0,i[8]=(v+L)*O,i[9]=(M-R)*O,i[10]=(1-(g+b))*O,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinantAffine();if(r===0)return n.set(1,1,1),t.identity(),this;let l=Xt.set(i[0],i[1],i[2]).length(),c=Xt.set(i[4],i[5],i[6]).length(),h=Xt.set(i[8],i[9],i[10]).length();r<0&&(l=-l),We.copy(this);let u=1/l,f=1/c,p=1/h;return We.elements[0]*=u,We.elements[1]*=u,We.elements[2]*=u,We.elements[4]*=f,We.elements[5]*=f,We.elements[6]*=f,We.elements[8]*=p,We.elements[9]*=p,We.elements[10]*=p,t.setFromRotationMatrix(We),n.x=l,n.y=c,n.z=h,this}makePerspective(e,t,n,i,r,l,c=vn,h=!1){let u=this.elements,f=2*r/(t-e),p=2*r/(n-i),g=(t+e)/(t-e),y=(n+i)/(n-i),v,b;if(h)v=r/(l-r),b=l*r/(l-r);else if(c===vn)v=-(l+r)/(l-r),b=-2*l*r/(l-r);else if(c===Ur)v=-l/(l-r),b=-l*r/(l-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return u[0]=f,u[4]=0,u[8]=g,u[12]=0,u[1]=0,u[5]=p,u[9]=y,u[13]=0,u[2]=0,u[6]=0,u[10]=v,u[14]=b,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,i,r,l,c=vn,h=!1){let u=this.elements,f=2/(t-e),p=2/(n-i),g=-(t+e)/(t-e),y=-(n+i)/(n-i),v,b;if(h)v=1/(l-r),b=l/(l-r);else if(c===vn)v=-2/(l-r),b=-(l+r)/(l-r);else if(c===Ur)v=-1/(l-r),b=-r/(l-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return u[0]=f,u[4]=0,u[8]=0,u[12]=g,u[1]=0,u[5]=p,u[9]=0,u[13]=y,u[2]=0,u[6]=0,u[10]=v,u[14]=b,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},Xt=new k,We=new rt,ph=new k(0,0,0),mh=new k(1,1,1),gt=new k,ii=new k,De=new k,Ua=new rt,Fa=new st,Sn=class s{constructor(e=0,t=0,n=0,i=s.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],l=i[4],c=i[8],h=i[1],u=i[5],f=i[9],p=i[2],g=i[6],y=i[10];switch(t){case"XYZ":this._y=Math.asin(ee(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,y),this._z=Math.atan2(-l,r)):(this._x=Math.atan2(g,u),this._z=0);break;case"YXZ":this._x=Math.asin(-ee(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(c,y),this._z=Math.atan2(h,u)):(this._y=Math.atan2(-p,r),this._z=0);break;case"ZXY":this._x=Math.asin(ee(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-p,y),this._z=Math.atan2(-l,u)):(this._y=0,this._z=Math.atan2(h,r));break;case"ZYX":this._y=Math.asin(-ee(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(g,y),this._z=Math.atan2(h,r)):(this._x=0,this._z=Math.atan2(-l,u));break;case"YZX":this._z=Math.asin(ee(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-f,u),this._y=Math.atan2(-p,r)):(this._x=0,this._y=Math.atan2(c,y));break;case"XZY":this._z=Math.asin(-ee(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(g,u),this._y=Math.atan2(c,r)):(this._x=Math.atan2(-f,y),this._y=0);break;default:Ee("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ua.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ua,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Fa.setFromEuler(this),this.setFromQuaternion(Fa,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Sn.DEFAULT_ORDER="XYZ";var yi=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},gh=0,Oa=new k,qt=new st,tt=new rt,ri=new k,gn=new k,_h=new k,yh=new st,Ba=new k(1,0,0),za=new k(0,1,0),ka=new k(0,0,1),Va={type:"added"},vh={type:"removed"},Yt={type:"childadded",child:null},gr={type:"childremoved",child:null},tn=class s extends Qt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gh++}),this.uuid=Zr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=s.DEFAULT_UP.clone();let e=new k,t=new Sn,n=new st,i=new k(1,1,1);function r(){n.setFromEuler(t,!1)}function l(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(l),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new rt},normalMatrix:{value:new J}}),this.matrix=new rt,this.matrixWorld=new rt,this.matrixAutoUpdate=s.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=s.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new yi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale),this.pivot!==null&&this.position.copy(this.pivot).applyMatrix4(this.matrix).sub(this.pivot)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return qt.setFromAxisAngle(e,t),this.quaternion.multiply(qt),this}rotateOnWorldAxis(e,t){return qt.setFromAxisAngle(e,t),this.quaternion.premultiply(qt),this}rotateX(e){return this.rotateOnAxis(Ba,e)}rotateY(e){return this.rotateOnAxis(za,e)}rotateZ(e){return this.rotateOnAxis(ka,e)}translateOnAxis(e,t){return Oa.copy(e).applyQuaternion(this.quaternion),this.position.add(Oa.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ba,e)}translateY(e){return this.translateOnAxis(za,e)}translateZ(e){return this.translateOnAxis(ka,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(tt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ri.copy(e):ri.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),gn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?tt.lookAt(gn,ri,this.up):tt.lookAt(ri,gn,this.up),this.quaternion.setFromRotationMatrix(tt),i&&(tt.extractRotation(i.matrixWorld),qt.setFromRotationMatrix(tt),this.quaternion.premultiply(qt.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(pe("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Va),Yt.child=e,this.dispatchEvent(Yt),Yt.child=null):pe("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(vh),gr.child=e,this.dispatchEvent(gr),gr.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),tt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),tt.multiply(e.parent.matrixWorld)),e.applyMatrix4(tt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Va),Yt.child=e,this.dispatchEvent(Yt),Yt.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let l=this.children[n].getObjectByProperty(e,t);if(l!==void 0)return l}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let i=this.children;for(let r=0,l=i.length;r<l;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gn,e,_h),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gn,yh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){return!0}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let r=this.children;for(let l=0,c=r.length;l<c;l++)r[l].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,i.name=this.name,i.castShadow=this.castShadow,i.receiveShadow=this.receiveShadow,i.visible=this.visible,i.frustumCulled=this.frustumCulled,i.renderOrder=this.renderOrder,i.static=this.static,i.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){let h=c.shapes;if(Array.isArray(h))for(let u=0,f=h.length;u<f;u++){let p=h[u];r(e.shapes,p)}else r(e.shapes,h)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let c=[];for(let h=0,u=this.material.length;h<u;h++)c.push(r(e.materials,this.material[h]));i.material=c}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let c=0;c<this.children.length;c++)i.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let c=0;c<this.animations.length;c++){let h=this.animations[c];i.animations.push(r(e.animations,h))}}if(t){let c=l(e.geometries),h=l(e.materials),u=l(e.textures),f=l(e.images),p=l(e.shapes),g=l(e.skeletons),y=l(e.animations),v=l(e.nodes);c.length>0&&(n.geometries=c),h.length>0&&(n.materials=h),u.length>0&&(n.textures=u),f.length>0&&(n.images=f),p.length>0&&(n.shapes=p),g.length>0&&(n.skeletons=g),y.length>0&&(n.animations=y),v.length>0&&(n.nodes=v)}return n.object=i,n;function l(c){let h=[];for(let u in c){let f=c[u];delete f.metadata,h.push(f)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};tn.DEFAULT_UP=new k(0,1,0);tn.DEFAULT_MATRIX_AUTO_UPDATE=!0;tn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var ro={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},_t={h:0,s:0,l:0},si={h:0,s:0,l:0};function _r(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}var me=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ve){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ke.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=ke.workingColorSpace){return this.r=e,this.g=t,this.b=n,ke.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=ke.workingColorSpace){if(e=lh(e,1),t=ee(t,0,1),n=ee(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,l=2*n-r;this.r=_r(l,r,e+1/3),this.g=_r(l,r,e),this.b=_r(l,r,e-1/3)}return ke.colorSpaceToWorking(this,i),this}setStyle(e,t=Ve){function n(r){r!==void 0&&parseFloat(r)<1&&Ee("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(100,parseFloat(r[1]))/100,Math.min(100,parseFloat(r[2]))/100,Math.min(100,parseFloat(r[3]))/100,t);break;case"hsl":case"hsla":if(r=/^\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(c))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:Ee("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],l=r.length;if(l===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(r,16),t);Ee("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ve){let n=ro[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Ee("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=it(e.r),this.g=it(e.g),this.b=it(e.b),this}copyLinearToSRGB(e){return this.r=Kt(e.r),this.g=Kt(e.g),this.b=Kt(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ve){return ke.workingToColorSpace(Te.copy(this),e),Math.round(ee(Te.r*255,0,255))*65536+Math.round(ee(Te.g*255,0,255))*256+Math.round(ee(Te.b*255,0,255))}getHexString(e=Ve){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ke.workingColorSpace){ke.workingToColorSpace(Te.copy(this),t);let n=Te.r,i=Te.g,r=Te.b,l=Math.max(n,i,r),c=Math.min(n,i,r),h,u,f=(c+l)/2;if(c===l)h=0,u=0;else{let p=l-c;switch(u=f<=.5?p/(l+c):p/(2-l-c),l){case n:h=(i-r)/p+(i<r?6:0);break;case i:h=(r-n)/p+2;break;case r:h=(n-i)/p+4;break}h/=6}return e.h=h,e.s=u,e.l=f,e}getRGB(e,t=ke.workingColorSpace){return ke.workingToColorSpace(Te.copy(this),t),e.r=Te.r,e.g=Te.g,e.b=Te.b,e}getStyle(e=Ve){ke.workingToColorSpace(Te.copy(this),e);let t=Te.r,n=Te.g,i=Te.b;return e!==Ve?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(_t),this.setHSL(_t.h+e,_t.s+t,_t.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(_t),e.getHSL(si);let n=hr(_t.h,si.h,t),i=hr(_t.s,si.s,t),r=hr(_t.l,si.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Te=new me;me.NAMES=ro;var He=class{constructor(e=new k(1/0,1/0,1/0),t=new k(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Xe.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Xe.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Xe.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0&&e.isBatchedMesh!==!0)for(let l=0,c=r.count;l<c;l++)e.isMesh===!0?e.getVertexPosition(l,Xe):Xe.fromBufferAttribute(r,l),Xe.applyMatrix4(e.matrixWorld),this.expandByPoint(Xe);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ai.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),ai.copy(n.boundingBox)),ai.applyMatrix4(e.matrixWorld),this.union(ai)}let i=e.children;for(let r=0,l=i.length;r<l;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Xe),Xe.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(_n),oi.subVectors(this.max,_n),$t.subVectors(e.a,_n),Zt.subVectors(e.b,_n),Jt.subVectors(e.c,_n),yt.subVectors(Zt,$t),vt.subVectors(Jt,Zt),At.subVectors($t,Jt);let t=[0,-yt.z,yt.y,0,-vt.z,vt.y,0,-At.z,At.y,yt.z,0,-yt.x,vt.z,0,-vt.x,At.z,0,-At.x,-yt.y,yt.x,0,-vt.y,vt.x,0,-At.y,At.x,0];return!yr(t,$t,Zt,Jt,oi)||(t=[1,0,0,0,1,0,0,0,1],!yr(t,$t,Zt,Jt,oi))?!1:(li.crossVectors(yt,vt),t=[li.x,li.y,li.z],yr(t,$t,Zt,Jt,oi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xe).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Xe).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(nt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),nt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),nt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),nt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),nt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),nt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),nt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),nt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(nt),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},nt=[new k,new k,new k,new k,new k,new k,new k,new k],Xe=new k,ai=new He,$t=new k,Zt=new k,Jt=new k,yt=new k,vt=new k,At=new k,_n=new k,oi=new k,li=new k,Ct=new k;function yr(s,e,t,n,i){for(let r=0,l=s.length-3;r<=l;r+=3){Ct.fromArray(s,r);let c=i.x*Math.abs(Ct.x)+i.y*Math.abs(Ct.y)+i.z*Math.abs(Ct.z),h=e.dot(Ct),u=t.dot(Ct),f=n.dot(Ct);if(Math.max(-Math.max(h,u,f),Math.min(h,u,f))>c)return!1}return!0}var fe=new k,ci=new Ge,xh=0,nn=class extends Qt{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:xh++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=no,this.updateRanges=[],this.gpuType=eo,this.version=0,this._normalizationScale=e!==void 0?Jr(e):void 0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this._normalizationScale=e._normalizationScale,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ci.fromBufferAttribute(this,t),ci.applyMatrix3(e),this.setXY(t,ci.x,ci.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)fe.fromBufferAttribute(this,t),fe.applyMatrix3(e),this.setXYZ(t,fe.x,fe.y,fe.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)fe.fromBufferAttribute(this,t),fe.applyMatrix4(e),this.setXYZ(t,fe.x,fe.y,fe.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)fe.fromBufferAttribute(this,t),fe.applyNormalMatrix(e),this.setXYZ(t,fe.x,fe.y,fe.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)fe.fromBufferAttribute(this,t),fe.transformDirection(e),this.setXYZ(t,fe.x,fe.y,fe.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=this._denormalize(n)),n}setComponent(e,t,n){return this.normalized&&(n=this._normalize(n)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=this._denormalize(t)),t}setX(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=this._denormalize(t)),t}setY(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=this._denormalize(t)),t}setZ(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=this._denormalize(t)),t}setW(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n),i=this._normalize(i)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n),i=this._normalize(i),r=this._normalize(r)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:"dispose"})}_denormalize(e){let t=this._normalizationScale;return t!==void 0?Math.max(e/t,-1):ch(e,this.array)}_normalize(e){let t=this._normalizationScale;return t!==void 0?Math.round(e*t):uh(e,this.array)}};var Mn=class extends nn{constructor(e,t,n){super(new Float32Array(e),t,n)}};function so(s){let e={};for(let t in s){e[t]={};for(let n in s[t]){let i=s[t][n];if(Ga(i))i.isRenderTargetTexture?(Ee("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone();else if(Array.isArray(i))if(Ga(i[0])){let r=[];for(let l=0,c=i.length;l<c;l++)r[l]=i[l].clone();e[t][n]=r}else e[t][n]=i.slice();else e[t][n]=i}}return e}function Ae(s){let e={};for(let t=0;t<s.length;t++){let n=so(s[t]);for(let i in n)e[i]=n[i]}return e}function Ga(s){return s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)}function jt(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function ui(s){return s!==void 0&&s.inTangents!==void 0&&s.outTangents!==void 0}var xt=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];n:{e:{let l;t:{i:if(!(e<i)){for(let c=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(r=i,i=t[++n],e<i)break e}l=t.length;break t}if(!(e>=r)){let c=t[1];e<c&&(n=2,r=c);for(let h=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===h)break;if(i=r,r=t[--n-1],e>=r)break e}l=n,n=0;break t}break n}for(;n<l;){let c=n+l>>>1;e<t[c]?l=c:n=c+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let l=0;l!==i;++l)t[l]=n[r+l];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},vi=class extends xt{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Pr,endingEnd:Pr}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,l=e+1,c=i[r],h=i[l];if(c===void 0)switch(this.getSettings_().endingStart){case Ir:r=e,c=2*t-n;break;case Lr:r=i.length-2,c=t+i[r]-i[r+1];break;default:r=e,c=n}if(h===void 0)switch(this.getSettings_().endingEnd){case Ir:l=e,h=2*n-t;break;case Lr:l=1,h=n+i[1]-i[0];break;default:l=e-1,h=t}let u=(n-t)*.5,f=this.valueSize;this._weightPrev=u/(t-c),this._weightNext=u/(h-n),this._offsetPrev=r*f,this._offsetNext=l*f}interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,u=h-c,f=this._offsetPrev,p=this._offsetNext,g=this._weightPrev,y=this._weightNext,v=(n-t)/(i-t),b=v*v,M=b*v,S=-g*M+2*g*b-g*v,R=(1+g)*M+(-1.5-2*g)*b+(-.5+g)*v+1,L=(-1-y)*M+(1.5+y)*b+.5*v,B=y*M-y*b;for(let C=0;C!==c;++C)r[C]=S*l[f+C]+R*l[u+C]+L*l[h+C]+B*l[p+C];return r}},xi=class extends xt{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,u=h-c,f=(n-t)/(i-t),p=1-f;for(let g=0;g!==c;++g)r[g]=l[u+g]*p+l[h+g]*f;return r}},Si=class extends xt{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},Mi=class extends xt{interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,u=h-c,f=this.inTangents,p=this.outTangents;if(!f||!p){let v=(n-t)/(i-t),b=1-v;for(let M=0;M!==c;++M)r[M]=l[u+M]*b+l[h+M]*v;return r}let g=c*2,y=e-1;for(let v=0;v!==c;++v){let b=l[u+v],M=l[h+v],S=y*g+v*2,R=p[S],L=p[S+1],B=e*g+v*2,C=f[B],z=f[B+1],O=Mh(n,t,R,C,i);r[v]=ao(O,b,L,z,M)}return r}};function ao(s,e,t,n,i){let r=1-s;return r*r*r*e+3*r*r*s*t+3*r*s*s*n+s*s*s*i}function Sh(s,e,t,n,i){let r=1-s;return 3*r*r*(t-e)+6*r*s*(n-t)+3*s*s*(i-n)}function Mh(s,e,t,n,i){let r=(s-e)/(i-e);for(let l=0;l<8;l++){let c=ao(r,e,t,n,i)-s;if(Math.abs(c)<1e-10)break;let h=Sh(r,e,t,n,i);if(Math.abs(h)<1e-10)break;r=Math.max(0,Math.min(1,r-c/h))}return r}var Ne=class{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=jt(t,this.TimeBufferType),this.values=jt(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:jt(e.times,Array),values:jt(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i),ui(e.settings)&&(n.settings={inTangents:jt(e.settings.inTangents,Array),outTangents:jt(e.settings.outTangents,Array)})}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Si(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new xi(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new vi(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Mi(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case xn:t=this.InterpolantFactoryMethodDiscrete;break;case pi:t=this.InterpolantFactoryMethodLinear;break;case hi:t=this.InterpolantFactoryMethodSmooth;break;case Rr:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Ee("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return xn;case this.InterpolantFactoryMethodLinear:return pi;case this.InterpolantFactoryMethodSmooth:return hi;case this.InterpolantFactoryMethodBezier:return Rr}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e;ui(this.settings)&&(Ha(this.settings.inTangents,e),Ha(this.settings.outTangents,e))}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e;ui(this.settings)&&(Wa(this.settings.inTangents,e),Wa(this.settings.outTangents,e))}return this}trim(e,t){let n=this.times,i=n.length,r=0,l=i-1;for(;r!==i&&n[r]<e;)++r;for(;l!==-1&&n[l]>t;)--l;if(++l,r!==0||l!==i){r>=l&&(l=Math.max(l,1),r=l-1);let c=this.getValueSize();this.times=n.slice(r,l),this.values=this.values.slice(r*c,l*c)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(pe("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;r===0&&(pe("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==r;c++){let h=n[c];if(typeof h=="number"&&isNaN(h)){pe("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){pe("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(i!==void 0&&sh(i))for(let c=0,h=i.length;c!==h;++c){let u=i[c];if(isNaN(u)){pe("KeyframeTrack: Value is not a valid number.",this,c,u),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===hi,r=e.length-1,l=1;for(let c=1;c<r;++c){let h=!1,u=e[c],f=e[c+1];if(u!==f&&(c!==1||u!==e[0]))if(i)h=!0;else{let p=c*n,g=p-n,y=p+n;for(let v=0;v!==n;++v){let b=t[p+v];if(b!==t[g+v]||b!==t[y+v]){h=!0;break}}}if(h){if(c!==l){e[l]=e[c];let p=c*n,g=l*n;for(let y=0;y!==n;++y)t[g+y]=t[p+y]}++l}}if(r>0){e[l]=e[r];for(let c=r*n,h=l*n,u=0;u!==n;++u)t[h+u]=t[c+u];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,ui(this.settings)&&(i.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),i}};function Ha(s,e){for(let t=0,n=s.length;t!==n;t+=2)s[t]+=e}function Wa(s,e){for(let t=0,n=s.length;t!==n;t+=2)s[t]*=e}Ne.prototype.ValueTypeName="";Ne.prototype.TimeBufferType=Float32Array;Ne.prototype.ValueBufferType=Float32Array;Ne.prototype.DefaultInterpolation=pi;var St=class extends Ne{constructor(e,t,n){super(e,t,n)}};St.prototype.ValueTypeName="bool";St.prototype.ValueBufferType=Array;St.prototype.DefaultInterpolation=xn;St.prototype.InterpolantFactoryMethodLinear=void 0;St.prototype.InterpolantFactoryMethodSmooth=void 0;var bi=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}};bi.prototype.ValueTypeName="color";var wi=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}};wi.prototype.ValueTypeName="number";var Ti=class extends xt{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(i-t),u=e*c;for(let f=u+c;u!==f;u+=4)st.slerpFlat(r,0,l,u-c,l,u,h);return r}},bn=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Ti(this.times,this.values,this.getValueSize(),e)}};bn.prototype.ValueTypeName="quaternion";bn.prototype.InterpolantFactoryMethodSmooth=void 0;var Mt=class extends Ne{constructor(e,t,n){super(e,t,n)}};Mt.prototype.ValueTypeName="string";Mt.prototype.ValueBufferType=Array;Mt.prototype.DefaultInterpolation=xn;Mt.prototype.InterpolantFactoryMethodLinear=void 0;Mt.prototype.InterpolantFactoryMethodSmooth=void 0;var Ei=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}};Ei.prototype.ValueTypeName="vector";var Ai=class{constructor(e,t,n){let i=this,r=!1,l=0,c=0,h,u=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(f){c++,r===!1&&i.onStart!==void 0&&i.onStart(f,l,c),r=!0},this.itemEnd=function(f){l++,i.onProgress!==void 0&&i.onProgress(f,l,c),l===c&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(f){i.onError!==void 0&&i.onError(f)},this.resolveURL=function(f){return f=f.normalize("NFC"),h?h(f):f},this.setURLModifier=function(f){return h=f,this},this.addHandler=function(f,p){return u.push(f,p),this},this.removeHandler=function(f){let p=u.indexOf(f);return p!==-1&&u.splice(p,2),this},this.getHandler=function(f){for(let p=0,g=u.length;p<g;p+=2){let y=u[p],v=u[p+1];if(y.global&&(y.lastIndex=0),y.test(f))return v}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},oo=new Ai,Ci=class{constructor(e){this.manager=e!==void 0?e:oo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},this.priority="auto",this.cache="default",typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}setPriority(e){return this.priority=e,this}setCache(e){return this.cache=e,this}abort(){return this}};Ci.DEFAULT_MATERIAL_NAME="__DEFAULT";var jr="\\[\\]\\.:\\/",bh=new RegExp("["+jr+"]","g"),Kr="[^"+jr+"]",wh="[^"+jr.replace("\\.","")+"]",Th=/((?:WC+[\/:])*)/.source.replace("WC",Kr),Eh=/(WCOD+)?/.source.replace("WCOD",wh),Ah=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Kr),Ch=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Kr),Rh=new RegExp("^"+Th+Eh+Ah+Ch+"$"),Ph=["material","materials","bones","map"],Br=class{constructor(e,t,n){let i=n||ae.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},ae=class s{constructor(e,t,n){this.path=t,this.parsedPath=n||s.parseTrackName(t),this.node=s.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new s.Composite(e,t,n):new s(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(bh,"")}static parseTrackName(e){let t=Rh.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);Ph.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let l=0;l<r.length;l++){let c=r[l];if(c.name===t||c.uuid===t)return c;let h=n(c.children);if(h)return h}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=s.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Ee("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let u=t.objectIndex;switch(n){case"materials":if(!e.material){pe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){pe("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){pe("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let f=0;f<e.length;f++)if(e[f].name===u){u=f;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){pe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){pe("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){pe("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(u!==void 0){if(e[u]===void 0){pe("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[u]}}let l=e[i];if(l===void 0){let u=t.nodeName;pe("PropertyBinding: Trying to update property for track: "+u+"."+i+" but it wasn't found.",e);return}let c=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?c=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){pe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){pe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}h=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=r}else l.fromArray!==void 0&&l.toArray!==void 0?(h=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(h=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=i;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};ae.Composite=Br;ae.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ae.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ae.prototype.GetterByBindingType=[ae.prototype._getValue_direct,ae.prototype._getValue_array,ae.prototype._getValue_arrayElement,ae.prototype._getValue_toArray];ae.prototype.SetterByBindingTypeAndVersioning=[[ae.prototype._setValue_direct,ae.prototype._setValue_direct_setNeedsUpdate,ae.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ae.prototype._setValue_array,ae.prototype._setValue_array_setNeedsUpdate,ae.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ae.prototype._setValue_arrayElement,ae.prototype._setValue_arrayElement_setNeedsUpdate,ae.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ae.prototype._setValue_fromArray,ae.prototype._setValue_fromArray_setNeedsUpdate,ae.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Gm=new Float32Array(1);var zr=class{static{this.prototype.isMatrix2=!0}constructor(e,t,n,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"187"}}));typeof window<"u"&&(window.__THREE__?Ee("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="187");var Ih=`#ifdef USE_ALPHAHASH
8
8
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
9
9
  #endif`,Lh=`#ifdef USE_ALPHAHASH
10
10
  const float ALPHA_HASH_SCALE = 0.05;
@@ -43,9 +43,9 @@ Originally allocated`),"captureStackTrace"in Error&&Error.captureStackTrace(x.le
43
43
  }
44
44
  #endif`,Dh=`#ifdef USE_ALPHAMAP
45
45
  diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
46
- #endif`,Uh=`#ifdef USE_ALPHAMAP
46
+ #endif`,Nh=`#ifdef USE_ALPHAMAP
47
47
  uniform sampler2D alphaMap;
48
- #endif`,Nh=`#ifdef USE_ALPHATEST
48
+ #endif`,Uh=`#ifdef USE_ALPHATEST
49
49
  #ifdef ALPHA_TO_COVERAGE
50
50
  diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
51
51
  if ( diffuseColor.a == 0.0 ) discard;
@@ -104,9 +104,9 @@ Originally allocated`),"captureStackTrace"in Error&&Error.captureStackTrace(x.le
104
104
  int y = j / size;
105
105
  return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
106
106
  }
107
- #endif`,Vh=`#ifdef USE_BATCHING
107
+ #endif`,kh=`#ifdef USE_BATCHING
108
108
  mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
109
- #endif`,kh=`vec3 transformed = vec3( position );
109
+ #endif`,Vh=`vec3 transformed = vec3( position );
110
110
  #ifdef USE_ALPHAHASH
111
111
  vPosition = vec3( position );
112
112
  #endif`,Gh=`vec3 objectNormal = vec3( normal );
@@ -282,7 +282,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
282
282
  #endif
283
283
  #ifdef USE_BATCHING_COLOR
284
284
  vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
285
- #endif`,ef=`#define PI 3.141592653589793
285
+ #endif`,ed=`#define PI 3.141592653589793
286
286
  #define PI2 6.283185307179586
287
287
  #define PI_HALF 1.5707963267948966
288
288
  #define RECIPROCAL_PI 0.3183098861837907
@@ -353,100 +353,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
353
353
  float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
354
354
  float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
355
355
  return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
356
- } // validated`,tf=`#ifdef ENVMAP_TYPE_CUBE_UV
357
- #define cubeUV_minMipLevel 4.0
358
- #define cubeUV_minTileSize 16.0
359
- float getFace( vec3 direction ) {
360
- vec3 absDirection = abs( direction );
361
- float face = - 1.0;
362
- if ( absDirection.x > absDirection.z ) {
363
- if ( absDirection.x > absDirection.y )
364
- face = direction.x > 0.0 ? 0.0 : 3.0;
365
- else
366
- face = direction.y > 0.0 ? 1.0 : 4.0;
367
- } else {
368
- if ( absDirection.z > absDirection.y )
369
- face = direction.z > 0.0 ? 2.0 : 5.0;
370
- else
371
- face = direction.y > 0.0 ? 1.0 : 4.0;
372
- }
373
- return face;
374
- }
375
- vec2 getUV( vec3 direction, float face ) {
376
- vec2 uv;
377
- if ( face == 0.0 ) {
378
- uv = vec2( direction.z, direction.y ) / abs( direction.x );
379
- } else if ( face == 1.0 ) {
380
- uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
381
- } else if ( face == 2.0 ) {
382
- uv = vec2( - direction.x, direction.y ) / abs( direction.z );
383
- } else if ( face == 3.0 ) {
384
- uv = vec2( - direction.z, direction.y ) / abs( direction.x );
385
- } else if ( face == 4.0 ) {
386
- uv = vec2( - direction.x, direction.z ) / abs( direction.y );
387
- } else {
388
- uv = vec2( direction.x, direction.y ) / abs( direction.z );
389
- }
390
- return 0.5 * ( uv + 1.0 );
391
- }
392
- vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
393
- float face = getFace( direction );
394
- float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
395
- mipInt = max( mipInt, cubeUV_minMipLevel );
396
- float faceSize = exp2( mipInt );
397
- highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
398
- if ( face > 2.0 ) {
399
- uv.y += faceSize;
400
- face -= 3.0;
401
- }
402
- uv.x += face * faceSize;
403
- uv.x += filterInt * 3.0 * cubeUV_minTileSize;
404
- uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
405
- uv.x *= CUBEUV_TEXEL_WIDTH;
406
- uv.y *= CUBEUV_TEXEL_HEIGHT;
407
- #ifdef texture2DGradEXT
408
- return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
409
- #else
410
- return texture2D( envMap, uv ).rgb;
411
- #endif
412
- }
413
- #define cubeUV_r0 1.0
414
- #define cubeUV_m0 - 2.0
415
- #define cubeUV_r1 0.8
416
- #define cubeUV_m1 - 1.0
417
- #define cubeUV_r4 0.4
418
- #define cubeUV_m4 2.0
419
- #define cubeUV_r5 0.305
420
- #define cubeUV_m5 3.0
421
- #define cubeUV_r6 0.21
422
- #define cubeUV_m6 4.0
423
- float roughnessToMip( float roughness ) {
424
- float mip = 0.0;
425
- if ( roughness >= cubeUV_r1 ) {
426
- mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
427
- } else if ( roughness >= cubeUV_r4 ) {
428
- mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
429
- } else if ( roughness >= cubeUV_r5 ) {
430
- mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
431
- } else if ( roughness >= cubeUV_r6 ) {
432
- mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
433
- } else {
434
- mip = - 2.0 * log2( 1.16 * roughness ); }
435
- return mip;
436
- }
437
- vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
438
- float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
439
- float mipF = fract( mip );
440
- float mipInt = floor( mip );
441
- vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
442
- if ( mipF == 0.0 ) {
443
- return vec4( color0, 1.0 );
444
- } else {
445
- vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
446
- return vec4( mix( color0, color1, mipF ), 1.0 );
447
- }
448
- }
449
- #endif`,nf=`vec3 transformedNormal = objectNormal;
356
+ } // validated`,td=`vec3 transformedNormal = objectNormal;
450
357
  #ifdef USE_TANGENT
451
358
  vec3 transformedTangent = objectTangent;
452
359
  #endif
@@ -472,21 +379,21 @@ transformedNormal = normalMatrix * transformedNormal;
472
379
  #endif
473
380
  #ifdef USE_TANGENT
474
381
  transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
475
- #endif`,rf=`#ifdef USE_DISPLACEMENTMAP
382
+ #endif`,nd=`#ifdef USE_DISPLACEMENTMAP
476
383
  uniform sampler2D displacementMap;
477
384
  uniform float displacementScale;
478
385
  uniform float displacementBias;
479
- #endif`,sf=`#ifdef USE_DISPLACEMENTMAP
386
+ #endif`,id=`#ifdef USE_DISPLACEMENTMAP
480
387
  transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
481
- #endif`,af=`#ifdef USE_EMISSIVEMAP
388
+ #endif`,rd=`#ifdef USE_EMISSIVEMAP
482
389
  vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
483
390
  #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
484
391
  emissiveColor = sRGBTransferEOTF( emissiveColor );
485
392
  #endif
486
393
  totalEmissiveRadiance *= emissiveColor.rgb;
487
- #endif`,of=`#ifdef USE_EMISSIVEMAP
394
+ #endif`,sd=`#ifdef USE_EMISSIVEMAP
488
395
  uniform sampler2D emissiveMap;
489
- #endif`,lf="gl_FragColor = linearToOutputTexel( gl_FragColor );",cf=`vec4 LinearTransferOETF( in vec4 value ) {
396
+ #endif`,ad="gl_FragColor = linearToOutputTexel( gl_FragColor );",od=`vec4 LinearTransferOETF( in vec4 value ) {
490
397
  return value;
491
398
  }
492
399
  vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -494,7 +401,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
494
401
  }
495
402
  vec4 sRGBTransferOETF( in vec4 value ) {
496
403
  return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
497
- }`,uf=`#ifdef USE_ENVMAP
404
+ }`,ld=`#ifdef USE_ENVMAP
498
405
  #ifdef ENV_WORLDPOS
499
406
  vec3 cameraToFrag;
500
407
  if ( isOrthographic ) {
@@ -521,15 +428,17 @@ vec4 sRGBTransferOETF( in vec4 value ) {
521
428
  outgoingLight += envColor.xyz * specularStrength * reflectivity;
522
429
  #endif
523
430
  #endif
524
- #endif`,hf=`#ifdef USE_ENVMAP
431
+ #endif`,cd=`#ifdef USE_ENVMAP
525
432
  uniform float envMapIntensity;
526
433
  uniform mat3 envMapRotation;
527
- #ifdef ENVMAP_TYPE_CUBE
528
- uniform samplerCube envMap;
529
- #else
530
- uniform sampler2D envMap;
434
+ uniform samplerCube envMap;
435
+ #ifdef ENVMAP_TYPE_PMREM
436
+ float roughnessToMip( const in float roughness ) {
437
+ float r = clamp( roughness, 0.0, 1.0 );
438
+ return ENVMAP_MAX_LOD * r * ( 2.0 - r );
439
+ }
531
440
  #endif
532
- #endif`,ff=`#ifdef USE_ENVMAP
441
+ #endif`,ud=`#ifdef USE_ENVMAP
533
442
  uniform float reflectivity;
534
443
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
535
444
  #define ENV_WORLDPOS
@@ -540,7 +449,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
540
449
  #else
541
450
  varying vec3 vReflect;
542
451
  #endif
543
- #endif`,df=`#ifdef USE_ENVMAP
452
+ #endif`,hd=`#ifdef USE_ENVMAP
544
453
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
545
454
  #define ENV_WORLDPOS
546
455
  #endif
@@ -551,7 +460,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
551
460
  varying vec3 vReflect;
552
461
  uniform float refractionRatio;
553
462
  #endif
554
- #endif`,pf=`#ifdef USE_ENVMAP
463
+ #endif`,dd=`#ifdef USE_ENVMAP
555
464
  #ifdef ENV_WORLDPOS
556
465
  vWorldPosition = worldPosition.xyz;
557
466
  #else
@@ -568,18 +477,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
568
477
  vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
569
478
  #endif
570
479
  #endif
571
- #endif`,mf=`#ifdef USE_FOG
480
+ #endif`,fd=`#ifdef USE_FOG
572
481
  vFogDepth = - mvPosition.z;
573
- #endif`,gf=`#ifdef USE_FOG
482
+ #endif`,pd=`#ifdef USE_FOG
574
483
  varying float vFogDepth;
575
- #endif`,_f=`#ifdef USE_FOG
484
+ #endif`,md=`#ifdef USE_FOG
576
485
  #ifdef FOG_EXP2
577
486
  float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
578
487
  #else
579
488
  float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
580
489
  #endif
581
490
  gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
582
- #endif`,yf=`#ifdef USE_FOG
491
+ #endif`,gd=`#ifdef USE_FOG
583
492
  uniform vec3 fogColor;
584
493
  varying float vFogDepth;
585
494
  #ifdef FOG_EXP2
@@ -588,7 +497,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
588
497
  uniform float fogNear;
589
498
  uniform float fogFar;
590
499
  #endif
591
- #endif`,vf=`#ifdef USE_GRADIENTMAP
500
+ #endif`,_d=`#ifdef USE_GRADIENTMAP
592
501
  uniform sampler2D gradientMap;
593
502
  #endif
594
503
  vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -600,12 +509,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
600
509
  vec2 fw = fwidth( coord ) * 0.5;
601
510
  return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
602
511
  #endif
603
- }`,xf=`#ifdef USE_LIGHTMAP
512
+ }`,yd=`#ifdef USE_LIGHTMAP
604
513
  uniform sampler2D lightMap;
605
514
  uniform float lightMapIntensity;
606
- #endif`,Sf=`LambertMaterial material;
515
+ #endif`,vd=`LambertMaterial material;
607
516
  material.diffuseColor = diffuseColor.rgb;
608
- material.specularStrength = specularStrength;`,bf=`varying vec3 vViewPosition;
517
+ material.specularStrength = specularStrength;`,xd=`varying vec3 vViewPosition;
609
518
  struct LambertMaterial {
610
519
  vec3 diffuseColor;
611
520
  float specularStrength;
@@ -619,7 +528,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
619
528
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
620
529
  }
621
530
  #define RE_Direct RE_Direct_Lambert
622
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Mf=`uniform bool receiveShadow;
531
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Sd=`uniform bool receiveShadow;
623
532
  uniform vec3 ambientLightColor;
624
533
  #if defined( USE_LIGHT_PROBES )
625
534
  uniform vec3 lightProbe[ 9 ];
@@ -748,22 +657,22 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
748
657
  return irradiance;
749
658
  }
750
659
  #endif
751
- #include <lightprobes_pars_fragment>`,wf=`#ifdef USE_ENVMAP
660
+ #include <lightprobes_pars_fragment>`,Md=`#ifdef USE_ENVMAP
752
661
  vec3 getIBLIrradiance( const in vec3 normal ) {
753
- #ifdef ENVMAP_TYPE_CUBE_UV
662
+ #ifdef ENVMAP_TYPE_PMREM
754
663
  vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
755
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
664
+ vec4 envMapColor = textureLod( envMap, envMapRotation * worldNormal, ENVMAP_MAX_LOD );
756
665
  return PI * envMapColor.rgb * envMapIntensity;
757
666
  #else
758
667
  return vec3( 0.0 );
759
668
  #endif
760
669
  }
761
670
  vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
762
- #ifdef ENVMAP_TYPE_CUBE_UV
671
+ #ifdef ENVMAP_TYPE_PMREM
763
672
  vec3 reflectVec = reflect( - viewDir, normal );
764
673
  reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
765
674
  reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );
766
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
675
+ vec4 envMapColor = textureLod( envMap, envMapRotation * reflectVec, roughnessToMip( roughness ) );
767
676
  return envMapColor.rgb * envMapIntensity;
768
677
  #else
769
678
  return vec3( 0.0 );
@@ -771,10 +680,10 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
771
680
  }
772
681
  #ifdef USE_RETROREFLECTION
773
682
  vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
774
- #ifdef ENVMAP_TYPE_CUBE_UV
683
+ #ifdef ENVMAP_TYPE_PMREM
775
684
  vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );
776
685
  retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );
777
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * retroVec, roughness );
686
+ vec4 envMapColor = textureLod( envMap, envMapRotation * retroVec, roughnessToMip( roughness ) );
778
687
  return envMapColor.rgb * envMapIntensity;
779
688
  #else
780
689
  return vec3( 0.0 );
@@ -783,7 +692,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
783
692
  #endif
784
693
  #ifdef USE_ANISOTROPY
785
694
  vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
786
- #ifdef ENVMAP_TYPE_CUBE_UV
695
+ #ifdef ENVMAP_TYPE_PMREM
787
696
  vec3 bentNormal = cross( bitangent, viewDir );
788
697
  bentNormal = normalize( cross( bentNormal, bitangent ) );
789
698
  bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
@@ -794,7 +703,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
794
703
  }
795
704
  #ifdef USE_RETROREFLECTION
796
705
  vec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
797
- #ifdef ENVMAP_TYPE_CUBE_UV
706
+ #ifdef ENVMAP_TYPE_PMREM
798
707
  vec3 bentNormal = cross( bitangent, viewDir );
799
708
  bentNormal = normalize( cross( bentNormal, bitangent ) );
800
709
  bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
@@ -805,8 +714,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
805
714
  }
806
715
  #endif
807
716
  #endif
808
- #endif`,Tf=`ToonMaterial material;
809
- material.diffuseColor = diffuseColor.rgb;`,Ef=`varying vec3 vViewPosition;
717
+ #endif`,bd=`ToonMaterial material;
718
+ material.diffuseColor = diffuseColor.rgb;`,wd=`varying vec3 vViewPosition;
810
719
  struct ToonMaterial {
811
720
  vec3 diffuseColor;
812
721
  };
@@ -818,11 +727,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
818
727
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
819
728
  }
820
729
  #define RE_Direct RE_Direct_Toon
821
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Af=`BlinnPhongMaterial material;
730
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Td=`BlinnPhongMaterial material;
822
731
  material.diffuseColor = diffuseColor.rgb;
823
732
  material.specularColor = specular;
824
733
  material.specularShininess = shininess;
825
- material.specularStrength = specularStrength;`,Cf=`varying vec3 vViewPosition;
734
+ material.specularStrength = specularStrength;`,Ed=`varying vec3 vViewPosition;
826
735
  struct BlinnPhongMaterial {
827
736
  vec3 diffuseColor;
828
737
  vec3 specularColor;
@@ -839,14 +748,22 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
839
748
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
840
749
  }
841
750
  #define RE_Direct RE_Direct_BlinnPhong
842
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Rf=`PhysicalMaterial material;
751
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Ad=`PhysicalMaterial material;
843
752
  material.diffuseColor = diffuseColor.rgb;
844
753
  material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
845
754
  material.metalness = metalnessFactor;
846
755
  vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
847
756
  float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
848
- material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
757
+ material.roughness = max( roughnessFactor, 0.045 );
758
+ material.roughness += geometryRoughness;
849
759
  material.roughness = min( material.roughness, 1.0 );
760
+ #ifdef USE_DIFFUSE_ROUGHNESS
761
+ float diffuseRoughnessFactor = diffuseRoughness;
762
+ #ifdef USE_DIFFUSE_ROUGHNESSMAP
763
+ diffuseRoughnessFactor *= texture2D( diffuseRoughnessMap, vDiffuseRoughnessMapUv ).r;
764
+ #endif
765
+ material.diffuseRoughness = saturate( diffuseRoughnessFactor );
766
+ #endif
850
767
  #ifdef IOR
851
768
  material.ior = ior;
852
769
  #ifdef USE_SPECULAR
@@ -882,7 +799,7 @@ material.roughness = min( material.roughness, 1.0 );
882
799
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
883
800
  material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
884
801
  #endif
885
- material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
802
+ material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.045 );
886
803
  material.clearcoatRoughness += geometryRoughness;
887
804
  material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
888
805
  #endif
@@ -932,7 +849,7 @@ material.roughness = min( material.roughness, 1.0 );
932
849
  material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
933
850
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
934
851
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
935
- #endif`,Pf=`uniform sampler2D dfgLUT;
852
+ #endif`,Cd=`uniform sampler2D dfgLUT;
936
853
  struct PhysicalMaterial {
937
854
  vec3 diffuseColor;
938
855
  vec3 diffuseContribution;
@@ -944,6 +861,9 @@ struct PhysicalMaterial {
944
861
  float dispersion;
945
862
  vec2 dfg;
946
863
  vec3 multiScatteringCompensation;
864
+ #ifdef USE_DIFFUSE_ROUGHNESS
865
+ float diffuseRoughness;
866
+ #endif
947
867
  #ifdef USE_RETROREFLECTION
948
868
  float retroreflectivity;
949
869
  #endif
@@ -992,6 +912,42 @@ vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH )
992
912
  float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
993
913
  return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
994
914
  }
915
+ #ifdef USE_DIFFUSE_ROUGHNESS
916
+ const float EON_EPSILON = 1e-7;
917
+ float FON_DirectionalAlbedo( const in float mu, const in float roughness, const in float A ) {
918
+ float muComp = 1.0 - mu;
919
+ float gOverPi = muComp * ( 0.0571085289 + muComp * ( 0.491881867 + muComp * ( - 0.332181442 + muComp * 0.0714429953 ) ) );
920
+ return A * ( 1.0 + roughness * gOverPi );
921
+ }
922
+ vec3 BRDF_EON( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 diffuseColor, const in float roughness ) {
923
+ vec3 rho = saturate( diffuseColor );
924
+ if ( roughness <= EON_EPSILON ) return BRDF_Lambert( rho );
925
+ float dotNL = saturate( dot( normal, lightDir ) );
926
+ float dotNV = saturate( dot( normal, viewDir ) );
927
+ float s = dot( lightDir, viewDir ) - dotNL * dotNV;
928
+ float sOverT = ( s > 0.0 ) ? s / max( max( dotNL, dotNV ), EON_EPSILON ) : s;
929
+ float A = 1.0 / ( 1.0 + ( 0.5 - 2.0 / ( 3.0 * PI ) ) * roughness );
930
+ vec3 singleScatter = rho * RECIPROCAL_PI * A * ( 1.0 + roughness * sOverT );
931
+ float averageAlbedo = A * ( 1.0 + ( 2.0 / 3.0 - 28.0 / ( 15.0 * PI ) ) * roughness );
932
+ float albedoV = FON_DirectionalAlbedo( dotNV, roughness, A );
933
+ float albedoL = FON_DirectionalAlbedo( dotNL, roughness, A );
934
+ vec3 rhoMultiScatter = rho * rho * averageAlbedo / max( vec3( EON_EPSILON ), vec3( 1.0 ) - rho * ( 1.0 - averageAlbedo ) );
935
+ vec3 multiScatter = rhoMultiScatter * RECIPROCAL_PI
936
+ * max( EON_EPSILON, 1.0 - albedoV )
937
+ * max( EON_EPSILON, 1.0 - albedoL )
938
+ / max( EON_EPSILON, 1.0 - averageAlbedo );
939
+ return singleScatter + multiScatter;
940
+ }
941
+ vec3 EON_DirectionalAlbedo( const in vec3 diffuseColor, const in float roughness, const in float dotNV ) {
942
+ vec3 rho = saturate( diffuseColor );
943
+ if ( roughness <= EON_EPSILON ) return rho;
944
+ float A = 1.0 / ( 1.0 + ( 0.5 - 2.0 / ( 3.0 * PI ) ) * roughness );
945
+ float directionalAlbedo = FON_DirectionalAlbedo( dotNV, roughness, A );
946
+ float averageAlbedo = A * ( 1.0 + ( 2.0 / 3.0 - 28.0 / ( 15.0 * PI ) ) * roughness );
947
+ vec3 rhoMultiScatter = rho * rho * averageAlbedo / max( vec3( EON_EPSILON ), vec3( 1.0 ) - rho * ( 1.0 - averageAlbedo ) );
948
+ return rho * directionalAlbedo + rhoMultiScatter * ( 1.0 - directionalAlbedo );
949
+ }
950
+ #endif
995
951
  float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
996
952
  float a2 = pow2( alpha );
997
953
  float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
@@ -1021,7 +977,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
1021
977
  vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1022
978
  vec3 f0 = material.clearcoatF0;
1023
979
  float f90 = material.clearcoatF90;
1024
- float roughness = material.clearcoatRoughness;
980
+ float roughness = max( material.clearcoatRoughness, 0.045 );
1025
981
  float alpha = pow2( roughness );
1026
982
  vec3 halfDir = normalize( lightDir + viewDir );
1027
983
  float dotNL = saturate( dot( normal, lightDir ) );
@@ -1037,7 +993,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
1037
993
  vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1038
994
  vec3 f0 = material.specularColorBlended;
1039
995
  float f90 = material.specularF90;
1040
- float roughness = material.roughness;
996
+ float roughness = max( material.roughness, 0.045 );
1041
997
  float alpha = pow2( roughness );
1042
998
  vec3 halfDir = normalize( lightDir + viewDir );
1043
999
  float dotNL = saturate( dot( normal, lightDir ) );
@@ -1055,8 +1011,9 @@ vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 norm
1055
1011
  float dotBL = dot( material.anisotropyB, lightDir );
1056
1012
  float dotBV = dot( material.anisotropyB, viewDir );
1057
1013
  float dotBH = dot( material.anisotropyB, halfDir );
1058
- float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1059
- float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1014
+ float alphaT = max( material.alphaT, alpha );
1015
+ float V = V_GGX_SmithCorrelated_Anisotropic( alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1016
+ float D = D_GGX_Anisotropic( alphaT, alpha, dotNH, dotTH, dotBH );
1060
1017
  #else
1061
1018
  float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1062
1019
  float D = D_GGX( alpha, dotNH );
@@ -1239,7 +1196,12 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geome
1239
1196
  vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );
1240
1197
  F = mix( F, retroF, saturate( material.retroreflectivity ) );
1241
1198
  #endif
1242
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );
1199
+ #ifdef USE_DIFFUSE_ROUGHNESS
1200
+ vec3 diffuseBRDF = BRDF_EON( directLight.direction, geometryViewDir, geometryNormal, material.diffuseColor, material.diffuseRoughness ) * ( 1.0 - material.metalness );
1201
+ #else
1202
+ vec3 diffuseBRDF = BRDF_Lambert( material.diffuseContribution );
1203
+ #endif
1204
+ reflectedLight.directDiffuse += irradiance * diffuseBRDF * ( 1.0 - F );
1243
1205
  }
1244
1206
  void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1245
1207
  vec3 singleScattering = vec3( 0.0 );
@@ -1249,7 +1211,13 @@ void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geomet
1249
1211
  #else
1250
1212
  computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );
1251
1213
  #endif
1252
- vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );
1214
+ #ifdef USE_DIFFUSE_ROUGHNESS
1215
+ float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
1216
+ vec3 diffuseAlbedo = EON_DirectionalAlbedo( material.diffuseColor, material.diffuseRoughness, dotNV ) * ( 1.0 - material.metalness );
1217
+ vec3 diffuse = irradiance * RECIPROCAL_PI * diffuseAlbedo * ( 1.0 - singleScattering - multiScattering );
1218
+ #else
1219
+ vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );
1220
+ #endif
1253
1221
  #ifdef USE_SHEEN
1254
1222
  float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1255
1223
  sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;
@@ -1279,7 +1247,12 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1279
1247
  vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1280
1248
  vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1281
1249
  vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1282
- vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1250
+ #ifdef USE_DIFFUSE_ROUGHNESS
1251
+ float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
1252
+ vec3 diffuse = EON_DirectionalAlbedo( material.diffuseColor, material.diffuseRoughness, dotNV ) * ( 1.0 - material.metalness ) * ( 1.0 - totalScatteringDielectric );
1253
+ #else
1254
+ vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1255
+ #endif
1283
1256
  vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1284
1257
  vec3 indirectSpecular = radiance * singleScattering;
1285
1258
  indirectSpecular += multiScattering * cosineWeightedIrradiance;
@@ -1299,7 +1272,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1299
1272
  #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1300
1273
  float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1301
1274
  return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1302
- }`,If=`
1275
+ }`,Rd=`
1303
1276
  vec3 geometryPosition = - vViewPosition;
1304
1277
  vec3 geometryNormal = normal;
1305
1278
  vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1438,22 +1411,32 @@ IncidentLight directLight;
1438
1411
  }
1439
1412
  #pragma unroll_loop_end
1440
1413
  #endif
1441
- #ifdef USE_LIGHT_PROBES_GRID
1414
+ #if NUM_LIGHT_PROBE_GRIDS > 0
1442
1415
  vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1443
1416
  vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
1444
- irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1417
+ int probeGrid = - 1;
1418
+ #pragma unroll_loop_start
1419
+ for ( int i = 0; i < NUM_LIGHT_PROBE_GRIDS; i ++ ) {
1420
+ if ( isInsideLightProbeGrid( probeWorldPos, probeWorldNormal, probesMin[ i ], probesMax[ i ], probesResolution[ i ] ) ) probeGrid = UNROLLED_LOOP_INDEX;
1421
+ }
1422
+ #pragma unroll_loop_end
1423
+ #pragma unroll_loop_start
1424
+ for ( int i = 0; i < NUM_LIGHT_PROBE_GRIDS; i ++ ) {
1425
+ if ( probeGrid == UNROLLED_LOOP_INDEX ) irradiance += getLightProbeGridIrradiance( probesSH[ i ], probesMin[ i ], probesMax[ i ], probesResolution[ i ], probeWorldPos, probeWorldNormal );
1426
+ }
1427
+ #pragma unroll_loop_end
1445
1428
  #endif
1446
1429
  #endif
1447
1430
  #if defined( RE_IndirectSpecular )
1448
1431
  vec3 radiance = vec3( 0.0 );
1449
1432
  vec3 clearcoatRadiance = vec3( 0.0 );
1450
- #endif`,Lf=`#if defined( RE_IndirectDiffuse )
1433
+ #endif`,Pd=`#if defined( RE_IndirectDiffuse )
1451
1434
  #ifdef USE_LIGHTMAP
1452
1435
  vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1453
1436
  vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1454
1437
  irradiance += lightMapIrradiance;
1455
1438
  #endif
1456
- #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1439
+ #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_PMREM )
1457
1440
  #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1458
1441
  iblIrradiance += getIBLIrradiance( geometryNormal );
1459
1442
  #endif
@@ -1477,7 +1460,7 @@ IncidentLight directLight;
1477
1460
  #ifdef USE_CLEARCOAT
1478
1461
  clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1479
1462
  #endif
1480
- #endif`,Df=`#if defined( RE_IndirectDiffuse )
1463
+ #endif`,Id=`#if defined( RE_IndirectDiffuse )
1481
1464
  #if defined( LAMBERT ) || defined( PHONG )
1482
1465
  irradiance += iblIrradiance;
1483
1466
  #endif
@@ -1485,19 +1468,23 @@ IncidentLight directLight;
1485
1468
  #endif
1486
1469
  #if defined( RE_IndirectSpecular )
1487
1470
  RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1488
- #endif`,Uf=`#ifdef USE_LIGHT_PROBES_GRID
1489
- uniform highp sampler3D probesSH;
1490
- uniform vec3 probesMin;
1491
- uniform vec3 probesMax;
1492
- uniform vec3 probesResolution;
1493
- vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1471
+ #endif`,Ld=`#if NUM_LIGHT_PROBE_GRIDS > 0
1472
+ uniform highp sampler3D probesSH[ NUM_LIGHT_PROBE_GRIDS ];
1473
+ uniform vec3 probesMin[ NUM_LIGHT_PROBE_GRIDS ];
1474
+ uniform vec3 probesMax[ NUM_LIGHT_PROBE_GRIDS ];
1475
+ uniform vec3 probesResolution[ NUM_LIGHT_PROBE_GRIDS ];
1476
+ bool isInsideLightProbeGrid( vec3 worldPos, vec3 worldNormal, vec3 probesMin, vec3 probesMax, vec3 probesResolution ) {
1477
+ vec3 spacing = ( probesMax - probesMin ) / probesResolution;
1478
+ vec3 samplePos = worldPos + worldNormal * spacing * 0.5;
1479
+ vec3 margin = spacing * 0.01;
1480
+ return all( greaterThanEqual( samplePos, probesMin - margin ) ) && all( lessThanEqual( samplePos, probesMax + margin ) );
1481
+ }
1482
+ vec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3 probesMax, vec3 probesResolution, vec3 worldPos, vec3 worldNormal ) {
1494
1483
  vec3 res = probesResolution;
1495
1484
  vec3 gridRange = probesMax - probesMin;
1496
- vec3 resMinusOne = res - 1.0;
1497
- vec3 probeSpacing = gridRange / resMinusOne;
1485
+ vec3 probeSpacing = gridRange / res;
1498
1486
  vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1499
- vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1500
- uvw = uvw * resMinusOne / res + 0.5 / res;
1487
+ vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.5 / res, 1.0 - 0.5 / res );
1501
1488
  float nz = res.z;
1502
1489
  float paddedSlices = nz + 2.0;
1503
1490
  float atlasDepth = 7.0 * paddedSlices;
@@ -1530,27 +1517,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1530
1517
  result += c8 * 0.429043 * ( x * x - y * y );
1531
1518
  return max( result, vec3( 0.0 ) );
1532
1519
  }
1533
- #endif`,Nf=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1520
+ #endif`,Dd=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1534
1521
  gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1535
- #endif`,Ff=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1522
+ #endif`,Nd=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1536
1523
  uniform float logDepthBufFC;
1537
1524
  varying float vFragDepth;
1538
1525
  varying float vIsPerspective;
1539
- #endif`,Of=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1526
+ #endif`,Ud=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1540
1527
  varying float vFragDepth;
1541
1528
  varying float vIsPerspective;
1542
- #endif`,Bf=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1529
+ #endif`,Fd=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1543
1530
  vFragDepth = 1.0 + gl_Position.w;
1544
1531
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1545
- #endif`,zf=`#ifdef USE_MAP
1532
+ #endif`,Od=`#ifdef USE_MAP
1546
1533
  vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1547
1534
  #ifdef DECODE_VIDEO_TEXTURE
1548
1535
  sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1549
1536
  #endif
1550
1537
  diffuseColor *= sampledDiffuseColor;
1551
- #endif`,Vf=`#ifdef USE_MAP
1538
+ #endif`,Bd=`#ifdef USE_MAP
1552
1539
  uniform sampler2D map;
1553
- #endif`,kf=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1540
+ #endif`,zd=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1554
1541
  #if defined( USE_POINTS_UV )
1555
1542
  vec2 uv = vUv;
1556
1543
  #else
@@ -1562,7 +1549,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1562
1549
  #endif
1563
1550
  #ifdef USE_ALPHAMAP
1564
1551
  diffuseColor.a *= texture2D( alphaMap, uv ).g;
1565
- #endif`,Gf=`#if defined( USE_POINTS_UV )
1552
+ #endif`,kd=`#if defined( USE_POINTS_UV )
1566
1553
  varying vec2 vUv;
1567
1554
  #else
1568
1555
  #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1574,33 +1561,37 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1574
1561
  #endif
1575
1562
  #ifdef USE_ALPHAMAP
1576
1563
  uniform sampler2D alphaMap;
1577
- #endif`,Hf=`float metalnessFactor = metalness;
1564
+ #endif`,Vd=`float metalnessFactor = metalness;
1578
1565
  #ifdef USE_METALNESSMAP
1579
1566
  vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1580
1567
  metalnessFactor *= texelMetalness.b;
1581
- #endif`,Wf=`#ifdef USE_METALNESSMAP
1568
+ #endif`,Gd=`#ifdef USE_METALNESSMAP
1582
1569
  uniform sampler2D metalnessMap;
1583
- #endif`,Xf=`#ifdef USE_INSTANCING_MORPH
1570
+ #endif`,Hd=`#ifdef USE_INSTANCING_MORPH
1584
1571
  float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1585
1572
  float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1586
1573
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1587
1574
  morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1588
1575
  }
1589
- #endif`,qf=`#if defined( USE_MORPHCOLORS )
1590
- vColor *= morphTargetBaseInfluence;
1576
+ #endif`,Wd=`#if defined( USE_MORPHCOLORS )
1577
+ #if defined( USE_COLOR_ALPHA )
1578
+ vColor *= morphTargetBaseInfluence;
1579
+ #elif defined( USE_COLOR )
1580
+ vColor.rgb *= morphTargetBaseInfluence;
1581
+ #endif
1591
1582
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1592
1583
  #if defined( USE_COLOR_ALPHA )
1593
1584
  if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1594
1585
  #elif defined( USE_COLOR )
1595
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1586
+ if ( morphTargetInfluences[ i ] != 0.0 ) vColor.rgb += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1596
1587
  #endif
1597
1588
  }
1598
- #endif`,Yf=`#ifdef USE_MORPHNORMALS
1589
+ #endif`,Xd=`#ifdef USE_MORPHNORMALS
1599
1590
  objectNormal *= morphTargetBaseInfluence;
1600
1591
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1601
1592
  if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1602
1593
  }
1603
- #endif`,$f=`#ifdef USE_MORPHTARGETS
1594
+ #endif`,qd=`#ifdef USE_MORPHTARGETS
1604
1595
  #ifndef USE_INSTANCING_MORPH
1605
1596
  uniform float morphTargetBaseInfluence;
1606
1597
  uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1614,12 +1605,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1614
1605
  ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1615
1606
  return texelFetch( morphTargetsTexture, morphUV, 0 );
1616
1607
  }
1617
- #endif`,Zf=`#ifdef USE_MORPHTARGETS
1608
+ #endif`,Yd=`#ifdef USE_MORPHTARGETS
1618
1609
  transformed *= morphTargetBaseInfluence;
1619
1610
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1620
1611
  if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1621
1612
  }
1622
- #endif`,Jf=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1613
+ #endif`,$d=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1623
1614
  #ifdef FLAT_SHADED
1624
1615
  vec3 fdx = dFdx( vViewPosition );
1625
1616
  vec3 fdy = dFdy( vViewPosition );
@@ -1660,7 +1651,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1660
1651
  tbn2[1] *= faceDirection;
1661
1652
  #endif
1662
1653
  #endif
1663
- vec3 nonPerturbedNormal = normal;`,jf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1654
+ vec3 nonPerturbedNormal = normal;`,Zd=`#ifdef USE_NORMALMAP_OBJECTSPACE
1664
1655
  normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1665
1656
  #ifdef FLIP_SIDED
1666
1657
  normal = - normal;
@@ -1678,19 +1669,19 @@ vec3 nonPerturbedNormal = normal;`,jf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1678
1669
  normal = normalize( tbn * mapN );
1679
1670
  #elif defined( USE_BUMPMAP )
1680
1671
  normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1681
- #endif`,Kf=`#ifndef FLAT_SHADED
1672
+ #endif`,Jd=`#ifndef FLAT_SHADED
1682
1673
  varying vec3 vNormal;
1683
1674
  #ifdef USE_TANGENT
1684
1675
  varying vec3 vTangent;
1685
1676
  varying vec3 vBitangent;
1686
1677
  #endif
1687
- #endif`,Qf=`#ifndef FLAT_SHADED
1678
+ #endif`,jd=`#ifndef FLAT_SHADED
1688
1679
  varying vec3 vNormal;
1689
1680
  #ifdef USE_TANGENT
1690
1681
  varying vec3 vTangent;
1691
1682
  varying vec3 vBitangent;
1692
1683
  #endif
1693
- #endif`,ed=`#ifndef FLAT_SHADED
1684
+ #endif`,Kd=`#ifndef FLAT_SHADED
1694
1685
  vNormal = normalize( transformedNormal );
1695
1686
  #ifdef USE_TANGENT
1696
1687
  vTangent = normalize( transformedTangent );
@@ -1699,7 +1690,7 @@ vec3 nonPerturbedNormal = normal;`,jf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1699
1690
  vBitangent = - vBitangent;
1700
1691
  #endif
1701
1692
  #endif
1702
- #endif`,td=`#ifdef USE_NORMALMAP
1693
+ #endif`,Qd=`#ifdef USE_NORMALMAP
1703
1694
  uniform sampler2D normalMap;
1704
1695
  uniform vec2 normalScale;
1705
1696
  #endif
@@ -1721,13 +1712,13 @@ vec3 nonPerturbedNormal = normal;`,jf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1721
1712
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1722
1713
  return mat3( T * scale, B * scale, N );
1723
1714
  }
1724
- #endif`,nd=`#ifdef USE_CLEARCOAT
1715
+ #endif`,ef=`#ifdef USE_CLEARCOAT
1725
1716
  vec3 clearcoatNormal = nonPerturbedNormal;
1726
- #endif`,id=`#ifdef USE_CLEARCOAT_NORMALMAP
1717
+ #endif`,tf=`#ifdef USE_CLEARCOAT_NORMALMAP
1727
1718
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1728
1719
  clearcoatMapN.xy *= clearcoatNormalScale;
1729
1720
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1730
- #endif`,rd=`#ifdef USE_CLEARCOATMAP
1721
+ #endif`,nf=`#ifdef USE_CLEARCOATMAP
1731
1722
  uniform sampler2D clearcoatMap;
1732
1723
  #endif
1733
1724
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1736,18 +1727,18 @@ vec3 nonPerturbedNormal = normal;`,jf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1736
1727
  #endif
1737
1728
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1738
1729
  uniform sampler2D clearcoatRoughnessMap;
1739
- #endif`,sd=`#ifdef USE_IRIDESCENCEMAP
1730
+ #endif`,rf=`#ifdef USE_IRIDESCENCEMAP
1740
1731
  uniform sampler2D iridescenceMap;
1741
1732
  #endif
1742
1733
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
1743
1734
  uniform sampler2D iridescenceThicknessMap;
1744
- #endif`,ad=`#ifdef OPAQUE
1735
+ #endif`,sf=`#ifdef OPAQUE
1745
1736
  diffuseColor.a = 1.0;
1746
1737
  #endif
1747
1738
  #ifdef USE_TRANSMISSION
1748
1739
  diffuseColor.a *= material.transmissionAlpha;
1749
1740
  #endif
1750
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,od=`vec3 packNormalToRGB( const in vec3 normal ) {
1741
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,af=`vec3 packNormalToRGB( const in vec3 normal ) {
1751
1742
  return normalize( normal ) * 0.5 + 0.5;
1752
1743
  }
1753
1744
  vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1826,9 +1817,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1826
1817
  #else
1827
1818
  return ( near * far ) / ( ( far - near ) * depth - far );
1828
1819
  #endif
1829
- }`,ld=`#ifdef PREMULTIPLIED_ALPHA
1820
+ }`,of=`#ifdef PREMULTIPLIED_ALPHA
1830
1821
  gl_FragColor.rgb *= gl_FragColor.a;
1831
- #endif`,cd=`vec4 mvPosition = vec4( transformed, 1.0 );
1822
+ #endif`,lf=`vec4 mvPosition = vec4( transformed, 1.0 );
1832
1823
  #ifdef USE_BATCHING
1833
1824
  mvPosition = batchingMatrix * mvPosition;
1834
1825
  #endif
@@ -1836,22 +1827,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1836
1827
  mvPosition = instanceMatrix * mvPosition;
1837
1828
  #endif
1838
1829
  mvPosition = modelViewMatrix * mvPosition;
1839
- gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
1830
+ gl_Position = projectionMatrix * mvPosition;`,cf=`#ifdef DITHERING
1840
1831
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1841
- #endif`,hd=`#ifdef DITHERING
1832
+ #endif`,uf=`#ifdef DITHERING
1842
1833
  vec3 dithering( vec3 color ) {
1843
1834
  float grid_position = rand( gl_FragCoord.xy );
1844
1835
  vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1845
1836
  dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1846
1837
  return color + dither_shift_RGB;
1847
1838
  }
1848
- #endif`,fd=`float roughnessFactor = roughness;
1839
+ #endif`,hf=`float roughnessFactor = roughness;
1849
1840
  #ifdef USE_ROUGHNESSMAP
1850
1841
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1851
1842
  roughnessFactor *= texelRoughness.g;
1852
- #endif`,dd=`#ifdef USE_ROUGHNESSMAP
1843
+ #endif`,df=`#ifdef USE_ROUGHNESSMAP
1853
1844
  uniform sampler2D roughnessMap;
1854
- #endif`,pd=`#if NUM_SPOT_LIGHT_COORDS > 0
1845
+ #endif`,ff=`#if NUM_SPOT_LIGHT_COORDS > 0
1855
1846
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1856
1847
  #endif
1857
1848
  #if NUM_SPOT_LIGHT_MAPS > 0
@@ -1942,12 +1933,16 @@ gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
1942
1933
  float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1943
1934
  float shadow = 1.0;
1944
1935
  shadowCoord.xyz /= shadowCoord.w;
1945
- shadowCoord.z += shadowBias;
1936
+ #ifdef USE_REVERSED_DEPTH_BUFFER
1937
+ shadowCoord.z -= shadowBias;
1938
+ #else
1939
+ shadowCoord.z += shadowBias;
1940
+ #endif
1946
1941
  bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1947
1942
  bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1948
1943
  if ( frustumTest ) {
1949
1944
  vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1950
- float radius = shadowRadius * texelSize.x;
1945
+ vec2 radius = shadowRadius * texelSize;
1951
1946
  float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1952
1947
  shadow = (
1953
1948
  texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
@@ -2054,12 +2049,14 @@ gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
2054
2049
  vec3 absVec = abs( lightToPosition );
2055
2050
  float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
2056
2051
  if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
2052
+ float lightDistance = length( lightToPosition );
2053
+ float depthRange = shadowCameraFar - shadowCameraNear;
2057
2054
  #ifdef USE_REVERSED_DEPTH_BUFFER
2058
- float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2059
- dp -= shadowBias;
2055
+ float depthA = - shadowCameraNear / depthRange - shadowBias;
2056
+ float depthB = shadowCameraNear * shadowCameraFar / ( depthRange * lightDistance );
2060
2057
  #else
2061
- float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2062
- dp += shadowBias;
2058
+ float depthA = shadowCameraFar / depthRange + shadowBias;
2059
+ float depthB = - shadowCameraNear * shadowCameraFar / ( depthRange * lightDistance );
2063
2060
  #endif
2064
2061
  float texelSize = shadowRadius / shadowMapSize.x;
2065
2062
  vec3 absDir = abs( bd3D );
@@ -2067,18 +2064,15 @@ gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
2067
2064
  tangent = normalize( cross( bd3D, tangent ) );
2068
2065
  vec3 bitangent = cross( bd3D, tangent );
2069
2066
  float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
2070
- vec2 sample0 = vogelDiskSample( 0, 5, phi );
2071
- vec2 sample1 = vogelDiskSample( 1, 5, phi );
2072
- vec2 sample2 = vogelDiskSample( 2, 5, phi );
2073
- vec2 sample3 = vogelDiskSample( 3, 5, phi );
2074
- vec2 sample4 = vogelDiskSample( 4, 5, phi );
2075
- shadow = (
2076
- texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
2077
- texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
2078
- texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
2079
- texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
2080
- texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
2081
- ) * 0.2;
2067
+ shadow = 0.0;
2068
+ for ( int i = 0; i < 5; i ++ ) {
2069
+ vec2 offset = vogelDiskSample( i, 5, phi );
2070
+ vec3 direction = bd3D + ( tangent * offset.x + bitangent * offset.y ) * texelSize;
2071
+ vec3 absDirection = abs( direction );
2072
+ float dp = depthA + depthB / max( max( absDirection.x, absDirection.y ), absDirection.z );
2073
+ shadow += texture( shadowMap, vec4( direction, dp ) );
2074
+ }
2075
+ shadow *= 0.2;
2082
2076
  }
2083
2077
  return mix( 1.0, shadow, shadowIntensity );
2084
2078
  }
@@ -2102,7 +2096,7 @@ gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
2102
2096
  }
2103
2097
  #endif
2104
2098
  #endif
2105
- #endif`,md=`#if NUM_SPOT_LIGHT_COORDS > 0
2099
+ #endif`,pf=`#if NUM_SPOT_LIGHT_COORDS > 0
2106
2100
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
2107
2101
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2108
2102
  #endif
@@ -2147,7 +2141,7 @@ gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
2147
2141
  };
2148
2142
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2149
2143
  #endif
2150
- #endif`,gd=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2144
+ #endif`,mf=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2151
2145
  #ifdef HAS_NORMAL
2152
2146
  vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
2153
2147
  #else
@@ -2187,7 +2181,7 @@ gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
2187
2181
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2188
2182
  }
2189
2183
  #pragma unroll_loop_end
2190
- #endif`,_d=`float getShadowMask() {
2184
+ #endif`,gf=`float getShadowMask() {
2191
2185
  float shadow = 1.0;
2192
2186
  #ifdef USE_SHADOWMAP
2193
2187
  #if NUM_SUN_LIGHT_SHADOWS > 0
@@ -2228,12 +2222,12 @@ gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
2228
2222
  #endif
2229
2223
  #endif
2230
2224
  return shadow;
2231
- }`,yd=`#ifdef USE_SKINNING
2225
+ }`,_f=`#ifdef USE_SKINNING
2232
2226
  mat4 boneMatX = getBoneMatrix( skinIndex.x );
2233
2227
  mat4 boneMatY = getBoneMatrix( skinIndex.y );
2234
2228
  mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2235
2229
  mat4 boneMatW = getBoneMatrix( skinIndex.w );
2236
- #endif`,vd=`#ifdef USE_SKINNING
2230
+ #endif`,yf=`#ifdef USE_SKINNING
2237
2231
  uniform mat4 bindMatrix;
2238
2232
  uniform mat4 bindMatrixInverse;
2239
2233
  uniform highp sampler2D boneTexture;
@@ -2248,7 +2242,7 @@ gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
2248
2242
  vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2249
2243
  return mat4( v1, v2, v3, v4 );
2250
2244
  }
2251
- #endif`,xd=`#ifdef USE_SKINNING
2245
+ #endif`,vf=`#ifdef USE_SKINNING
2252
2246
  vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2253
2247
  vec4 skinned = vec4( 0.0 );
2254
2248
  skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2256,7 +2250,7 @@ gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
2256
2250
  skinned += boneMatZ * skinVertex * skinWeight.z;
2257
2251
  skinned += boneMatW * skinVertex * skinWeight.w;
2258
2252
  transformed = ( bindMatrixInverse * skinned ).xyz;
2259
- #endif`,Sd=`#ifdef USE_SKINNING
2253
+ #endif`,xf=`#ifdef USE_SKINNING
2260
2254
  mat4 skinMatrix = mat4( 0.0 );
2261
2255
  skinMatrix += skinWeight.x * boneMatX;
2262
2256
  skinMatrix += skinWeight.y * boneMatY;
@@ -2267,17 +2261,17 @@ gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
2267
2261
  #ifdef USE_TANGENT
2268
2262
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2269
2263
  #endif
2270
- #endif`,bd=`float specularStrength;
2264
+ #endif`,Sf=`float specularStrength;
2271
2265
  #ifdef USE_SPECULARMAP
2272
2266
  vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2273
2267
  specularStrength = texelSpecular.r;
2274
2268
  #else
2275
2269
  specularStrength = 1.0;
2276
- #endif`,Md=`#ifdef USE_SPECULARMAP
2270
+ #endif`,Mf=`#ifdef USE_SPECULARMAP
2277
2271
  uniform sampler2D specularMap;
2278
- #endif`,wd=`#if defined( TONE_MAPPING )
2272
+ #endif`,bf=`#if defined( TONE_MAPPING )
2279
2273
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2280
- #endif`,Td=`#ifndef saturate
2274
+ #endif`,wf=`#ifndef saturate
2281
2275
  #define saturate( a ) clamp( a, 0.0, 1.0 )
2282
2276
  #endif
2283
2277
  uniform float toneMappingExposure;
@@ -2374,7 +2368,7 @@ vec3 NeutralToneMapping( vec3 color ) {
2374
2368
  float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2375
2369
  return mix( color, vec3( newPeak ), g );
2376
2370
  }
2377
- vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISSION
2371
+ vec3 CustomToneMapping( vec3 color ) { return color; }`,Tf=`#ifdef USE_TRANSMISSION
2378
2372
  material.transmission = transmission;
2379
2373
  material.transmissionAlpha = 1.0;
2380
2374
  material.thickness = thickness;
@@ -2395,7 +2389,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISS
2395
2389
  material.attenuationColor, material.attenuationDistance );
2396
2390
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2397
2391
  totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2398
- #endif`,Ad=`#ifdef USE_TRANSMISSION
2392
+ #endif`,Ef=`#ifdef USE_TRANSMISSION
2399
2393
  uniform float transmission;
2400
2394
  uniform float thickness;
2401
2395
  uniform float attenuationDistance;
@@ -2521,7 +2515,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISS
2521
2515
  float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2522
2516
  return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2523
2517
  }
2524
- #endif`,Cd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2518
+ #endif`,Af=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2525
2519
  varying vec2 vUv;
2526
2520
  #endif
2527
2521
  #ifdef USE_MAP
@@ -2551,6 +2545,9 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISS
2551
2545
  #ifdef USE_ROUGHNESSMAP
2552
2546
  varying vec2 vRoughnessMapUv;
2553
2547
  #endif
2548
+ #ifdef USE_DIFFUSE_ROUGHNESSMAP
2549
+ varying vec2 vDiffuseRoughnessMapUv;
2550
+ #endif
2554
2551
  #ifdef USE_ANISOTROPYMAP
2555
2552
  varying vec2 vAnisotropyMapUv;
2556
2553
  #endif
@@ -2591,7 +2588,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISS
2591
2588
  #ifdef USE_THICKNESSMAP
2592
2589
  uniform mat3 thicknessMapTransform;
2593
2590
  varying vec2 vThicknessMapUv;
2594
- #endif`,Rd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2591
+ #endif`,Cf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2595
2592
  varying vec2 vUv;
2596
2593
  #endif
2597
2594
  #ifdef USE_MAP
@@ -2634,6 +2631,10 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISS
2634
2631
  uniform mat3 roughnessMapTransform;
2635
2632
  varying vec2 vRoughnessMapUv;
2636
2633
  #endif
2634
+ #ifdef USE_DIFFUSE_ROUGHNESSMAP
2635
+ uniform mat3 diffuseRoughnessMapTransform;
2636
+ varying vec2 vDiffuseRoughnessMapUv;
2637
+ #endif
2637
2638
  #ifdef USE_ANISOTROPYMAP
2638
2639
  uniform mat3 anisotropyMapTransform;
2639
2640
  varying vec2 vAnisotropyMapUv;
@@ -2685,7 +2686,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISS
2685
2686
  #ifdef USE_THICKNESSMAP
2686
2687
  uniform mat3 thicknessMapTransform;
2687
2688
  varying vec2 vThicknessMapUv;
2688
- #endif`,Pd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2689
+ #endif`,Rf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2689
2690
  vUv = vec3( uv, 1 ).xy;
2690
2691
  #endif
2691
2692
  #ifdef USE_MAP
@@ -2718,6 +2719,9 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISS
2718
2719
  #ifdef USE_ROUGHNESSMAP
2719
2720
  vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2720
2721
  #endif
2722
+ #ifdef USE_DIFFUSE_ROUGHNESSMAP
2723
+ vDiffuseRoughnessMapUv = ( diffuseRoughnessMapTransform * vec3( DIFFUSE_ROUGHNESSMAP_UV, 1 ) ).xy;
2724
+ #endif
2721
2725
  #ifdef USE_ANISOTROPYMAP
2722
2726
  vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2723
2727
  #endif
@@ -2756,7 +2760,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISS
2756
2760
  #endif
2757
2761
  #ifdef USE_THICKNESSMAP
2758
2762
  vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2759
- #endif`,Id=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2763
+ #endif`,Pf=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2760
2764
  vec4 worldPosition = vec4( transformed, 1.0 );
2761
2765
  #ifdef USE_BATCHING
2762
2766
  worldPosition = batchingMatrix * worldPosition;
@@ -2765,12 +2769,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISS
2765
2769
  worldPosition = instanceMatrix * worldPosition;
2766
2770
  #endif
2767
2771
  worldPosition = modelMatrix * worldPosition;
2768
- #endif`,Ld=`varying vec2 vUv;
2772
+ #endif`,If=`varying vec2 vUv;
2769
2773
  uniform mat3 uvTransform;
2770
2774
  void main() {
2771
2775
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2772
2776
  gl_Position = vec4( position.xy, 1.0, 1.0 );
2773
- }`,Dd=`uniform sampler2D t2D;
2777
+ }`,Lf=`uniform sampler2D t2D;
2774
2778
  uniform float backgroundIntensity;
2775
2779
  varying vec2 vUv;
2776
2780
  void main() {
@@ -2782,43 +2786,36 @@ void main() {
2782
2786
  gl_FragColor = texColor;
2783
2787
  #include <tonemapping_fragment>
2784
2788
  #include <colorspace_fragment>
2785
- }`,Ud=`varying vec3 vWorldDirection;
2789
+ }`,Df=`varying vec3 vWorldDirection;
2786
2790
  #include <common>
2787
2791
  void main() {
2788
2792
  vWorldDirection = transformDirection( position, modelMatrix );
2789
2793
  #include <begin_vertex>
2790
2794
  #include <project_vertex>
2791
2795
  gl_Position.z = gl_Position.w;
2792
- }`,Nd=`#ifdef ENVMAP_TYPE_CUBE
2793
- uniform samplerCube envMap;
2794
- #elif defined( ENVMAP_TYPE_CUBE_UV )
2795
- uniform sampler2D envMap;
2796
- #endif
2797
- uniform float backgroundBlurriness;
2796
+ }`,Nf=`uniform float backgroundBlurriness;
2798
2797
  uniform float backgroundIntensity;
2799
2798
  uniform mat3 backgroundRotation;
2800
2799
  varying vec3 vWorldDirection;
2801
- #include <cube_uv_reflection_fragment>
2800
+ #include <envmap_common_pars_fragment>
2802
2801
  void main() {
2803
- #ifdef ENVMAP_TYPE_CUBE
2804
- vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2805
- #elif defined( ENVMAP_TYPE_CUBE_UV )
2806
- vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2802
+ #ifdef ENVMAP_TYPE_PMREM
2803
+ vec4 texColor = textureLod( envMap, backgroundRotation * vWorldDirection, roughnessToMip( backgroundBlurriness ) );
2807
2804
  #else
2808
- vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2805
+ vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2809
2806
  #endif
2810
2807
  texColor.rgb *= backgroundIntensity;
2811
2808
  gl_FragColor = texColor;
2812
2809
  #include <tonemapping_fragment>
2813
2810
  #include <colorspace_fragment>
2814
- }`,Fd=`varying vec3 vWorldDirection;
2811
+ }`,Uf=`varying vec3 vWorldDirection;
2815
2812
  #include <common>
2816
2813
  void main() {
2817
2814
  vWorldDirection = transformDirection( position, modelMatrix );
2818
2815
  #include <begin_vertex>
2819
2816
  #include <project_vertex>
2820
2817
  gl_Position.z = gl_Position.w;
2821
- }`,Od=`uniform samplerCube tCube;
2818
+ }`,Ff=`uniform samplerCube tCube;
2822
2819
  uniform float tFlip;
2823
2820
  uniform float opacity;
2824
2821
  varying vec3 vWorldDirection;
@@ -2828,7 +2825,7 @@ void main() {
2828
2825
  gl_FragColor.a *= opacity;
2829
2826
  #include <tonemapping_fragment>
2830
2827
  #include <colorspace_fragment>
2831
- }`,Bd=`#include <common>
2828
+ }`,Of=`#include <common>
2832
2829
  #include <batching_pars_vertex>
2833
2830
  #include <uv_pars_vertex>
2834
2831
  #include <displacementmap_pars_vertex>
@@ -2855,7 +2852,7 @@ void main() {
2855
2852
  #include <logdepthbuf_vertex>
2856
2853
  #include <clipping_planes_vertex>
2857
2854
  vHighPrecisionZW = gl_Position.zw;
2858
- }`,zd=`#if DEPTH_PACKING == 3200
2855
+ }`,Bf=`#if DEPTH_PACKING == 3200
2859
2856
  uniform float opacity;
2860
2857
  #endif
2861
2858
  #include <common>
@@ -2893,7 +2890,7 @@ void main() {
2893
2890
  #elif DEPTH_PACKING == 3203
2894
2891
  gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2895
2892
  #endif
2896
- }`,Vd=`#define DISTANCE
2893
+ }`,zf=`#define DISTANCE
2897
2894
  varying vec3 vWorldPosition;
2898
2895
  #include <common>
2899
2896
  #include <batching_pars_vertex>
@@ -2920,7 +2917,7 @@ void main() {
2920
2917
  #include <worldpos_vertex>
2921
2918
  #include <clipping_planes_vertex>
2922
2919
  vWorldPosition = worldPosition.xyz;
2923
- }`,kd=`#define DISTANCE
2920
+ }`,kf=`#define DISTANCE
2924
2921
  uniform vec3 referencePosition;
2925
2922
  uniform float nearDistance;
2926
2923
  uniform float farDistance;
@@ -2943,13 +2940,13 @@ void main() {
2943
2940
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2944
2941
  dist = saturate( dist );
2945
2942
  gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2946
- }`,Gd=`varying vec3 vWorldDirection;
2943
+ }`,Vf=`varying vec3 vWorldDirection;
2947
2944
  #include <common>
2948
2945
  void main() {
2949
2946
  vWorldDirection = transformDirection( position, modelMatrix );
2950
2947
  #include <begin_vertex>
2951
2948
  #include <project_vertex>
2952
- }`,Hd=`uniform sampler2D tEquirect;
2949
+ }`,Gf=`uniform sampler2D tEquirect;
2953
2950
  varying vec3 vWorldDirection;
2954
2951
  #include <common>
2955
2952
  void main() {
@@ -2958,7 +2955,7 @@ void main() {
2958
2955
  gl_FragColor = texture2D( tEquirect, sampleUV );
2959
2956
  #include <tonemapping_fragment>
2960
2957
  #include <colorspace_fragment>
2961
- }`,Wd=`uniform float scale;
2958
+ }`,Hf=`uniform float scale;
2962
2959
  attribute float lineDistance;
2963
2960
  varying float vLineDistance;
2964
2961
  #include <common>
@@ -2980,7 +2977,7 @@ void main() {
2980
2977
  #include <logdepthbuf_vertex>
2981
2978
  #include <clipping_planes_vertex>
2982
2979
  #include <fog_vertex>
2983
- }`,Xd=`uniform vec3 diffuse;
2980
+ }`,Wf=`uniform vec3 diffuse;
2984
2981
  uniform float opacity;
2985
2982
  uniform float dashSize;
2986
2983
  uniform float totalSize;
@@ -3008,7 +3005,7 @@ void main() {
3008
3005
  #include <colorspace_fragment>
3009
3006
  #include <fog_fragment>
3010
3007
  #include <premultiplied_alpha_fragment>
3011
- }`,qd=`#include <common>
3008
+ }`,Xf=`#include <common>
3012
3009
  #include <batching_pars_vertex>
3013
3010
  #include <uv_pars_vertex>
3014
3011
  #include <envmap_pars_vertex>
@@ -3040,7 +3037,7 @@ void main() {
3040
3037
  #include <worldpos_vertex>
3041
3038
  #include <envmap_vertex>
3042
3039
  #include <fog_vertex>
3043
- }`,Yd=`uniform vec3 diffuse;
3040
+ }`,qf=`uniform vec3 diffuse;
3044
3041
  uniform float opacity;
3045
3042
  #ifndef FLAT_SHADED
3046
3043
  varying vec3 vNormal;
@@ -3088,7 +3085,7 @@ void main() {
3088
3085
  #include <fog_fragment>
3089
3086
  #include <premultiplied_alpha_fragment>
3090
3087
  #include <dithering_fragment>
3091
- }`,$d=`#define LAMBERT
3088
+ }`,Yf=`#define LAMBERT
3092
3089
  varying vec3 vViewPosition;
3093
3090
  #include <common>
3094
3091
  #include <batching_pars_vertex>
@@ -3127,7 +3124,7 @@ void main() {
3127
3124
  #include <envmap_vertex>
3128
3125
  #include <shadowmap_vertex>
3129
3126
  #include <fog_vertex>
3130
- }`,Zd=`#define LAMBERT
3127
+ }`,$f=`#define LAMBERT
3131
3128
  uniform vec3 diffuse;
3132
3129
  uniform vec3 emissive;
3133
3130
  uniform float opacity;
@@ -3142,7 +3139,6 @@ uniform float opacity;
3142
3139
  #include <aomap_pars_fragment>
3143
3140
  #include <lightmap_pars_fragment>
3144
3141
  #include <emissivemap_pars_fragment>
3145
- #include <cube_uv_reflection_fragment>
3146
3142
  #include <envmap_common_pars_fragment>
3147
3143
  #include <envmap_pars_fragment>
3148
3144
  #include <envmap_physical_pars_fragment>
@@ -3185,7 +3181,7 @@ void main() {
3185
3181
  #include <fog_fragment>
3186
3182
  #include <premultiplied_alpha_fragment>
3187
3183
  #include <dithering_fragment>
3188
- }`,Jd=`#define MATCAP
3184
+ }`,Zf=`#define MATCAP
3189
3185
  varying vec3 vViewPosition;
3190
3186
  #include <common>
3191
3187
  #include <batching_pars_vertex>
@@ -3219,7 +3215,7 @@ void main() {
3219
3215
  #include <clipping_planes_vertex>
3220
3216
  #include <fog_vertex>
3221
3217
  vViewPosition = - mvPosition.xyz;
3222
- }`,jd=`#define MATCAP
3218
+ }`,Jf=`#define MATCAP
3223
3219
  uniform vec3 diffuse;
3224
3220
  uniform float opacity;
3225
3221
  uniform sampler2D matcap;
@@ -3265,7 +3261,7 @@ void main() {
3265
3261
  #include <fog_fragment>
3266
3262
  #include <premultiplied_alpha_fragment>
3267
3263
  #include <dithering_fragment>
3268
- }`,Kd=`#define NORMAL
3264
+ }`,jf=`#define NORMAL
3269
3265
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3270
3266
  varying vec3 vViewPosition;
3271
3267
  #endif
@@ -3298,7 +3294,7 @@ void main() {
3298
3294
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3299
3295
  vViewPosition = - mvPosition.xyz;
3300
3296
  #endif
3301
- }`,Qd=`#define NORMAL
3297
+ }`,Kf=`#define NORMAL
3302
3298
  uniform float opacity;
3303
3299
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3304
3300
  varying vec3 vViewPosition;
@@ -3319,7 +3315,7 @@ void main() {
3319
3315
  #ifdef OPAQUE
3320
3316
  gl_FragColor.a = 1.0;
3321
3317
  #endif
3322
- }`,ep=`#define PHONG
3318
+ }`,Qf=`#define PHONG
3323
3319
  varying vec3 vViewPosition;
3324
3320
  #include <common>
3325
3321
  #include <batching_pars_vertex>
@@ -3358,7 +3354,7 @@ void main() {
3358
3354
  #include <envmap_vertex>
3359
3355
  #include <shadowmap_vertex>
3360
3356
  #include <fog_vertex>
3361
- }`,tp=`#define PHONG
3357
+ }`,ep=`#define PHONG
3362
3358
  uniform vec3 diffuse;
3363
3359
  uniform vec3 emissive;
3364
3360
  uniform vec3 specular;
@@ -3375,7 +3371,6 @@ uniform float opacity;
3375
3371
  #include <aomap_pars_fragment>
3376
3372
  #include <lightmap_pars_fragment>
3377
3373
  #include <emissivemap_pars_fragment>
3378
- #include <cube_uv_reflection_fragment>
3379
3374
  #include <envmap_common_pars_fragment>
3380
3375
  #include <envmap_pars_fragment>
3381
3376
  #include <envmap_physical_pars_fragment>
@@ -3418,7 +3413,7 @@ void main() {
3418
3413
  #include <fog_fragment>
3419
3414
  #include <premultiplied_alpha_fragment>
3420
3415
  #include <dithering_fragment>
3421
- }`,np=`#define STANDARD
3416
+ }`,tp=`#define STANDARD
3422
3417
  varying vec3 vViewPosition;
3423
3418
  #ifdef USE_TRANSMISSION
3424
3419
  varying vec3 vWorldPosition;
@@ -3461,7 +3456,7 @@ void main() {
3461
3456
  #ifdef USE_TRANSMISSION
3462
3457
  vWorldPosition = worldPosition.xyz;
3463
3458
  #endif
3464
- }`,ip=`#define STANDARD
3459
+ }`,np=`#define STANDARD
3465
3460
  #ifdef PHYSICAL
3466
3461
  #define IOR
3467
3462
  #define USE_SPECULAR
@@ -3488,6 +3483,12 @@ uniform float opacity;
3488
3483
  uniform float clearcoat;
3489
3484
  uniform float clearcoatRoughness;
3490
3485
  #endif
3486
+ #ifdef USE_DIFFUSE_ROUGHNESS
3487
+ uniform float diffuseRoughness;
3488
+ #ifdef USE_DIFFUSE_ROUGHNESSMAP
3489
+ uniform sampler2D diffuseRoughnessMap;
3490
+ #endif
3491
+ #endif
3491
3492
  #ifdef USE_DISPERSION
3492
3493
  uniform float dispersion;
3493
3494
  #endif
@@ -3529,7 +3530,6 @@ varying vec3 vViewPosition;
3529
3530
  #include <lightmap_pars_fragment>
3530
3531
  #include <emissivemap_pars_fragment>
3531
3532
  #include <iridescence_fragment>
3532
- #include <cube_uv_reflection_fragment>
3533
3533
  #include <envmap_common_pars_fragment>
3534
3534
  #include <envmap_physical_pars_fragment>
3535
3535
  #include <fog_pars_fragment>
@@ -3589,7 +3589,7 @@ void main() {
3589
3589
  #include <fog_fragment>
3590
3590
  #include <premultiplied_alpha_fragment>
3591
3591
  #include <dithering_fragment>
3592
- }`,rp=`#define TOON
3592
+ }`,ip=`#define TOON
3593
3593
  varying vec3 vViewPosition;
3594
3594
  #include <common>
3595
3595
  #include <batching_pars_vertex>
@@ -3626,7 +3626,7 @@ void main() {
3626
3626
  #include <worldpos_vertex>
3627
3627
  #include <shadowmap_vertex>
3628
3628
  #include <fog_vertex>
3629
- }`,sp=`#define TOON
3629
+ }`,rp=`#define TOON
3630
3630
  uniform vec3 diffuse;
3631
3631
  uniform vec3 emissive;
3632
3632
  uniform float opacity;
@@ -3678,7 +3678,7 @@ void main() {
3678
3678
  #include <fog_fragment>
3679
3679
  #include <premultiplied_alpha_fragment>
3680
3680
  #include <dithering_fragment>
3681
- }`,ap=`uniform float size;
3681
+ }`,sp=`uniform float size;
3682
3682
  uniform float scale;
3683
3683
  #include <common>
3684
3684
  #include <color_pars_vertex>
@@ -3709,7 +3709,7 @@ void main() {
3709
3709
  #include <clipping_planes_vertex>
3710
3710
  #include <worldpos_vertex>
3711
3711
  #include <fog_vertex>
3712
- }`,op=`uniform vec3 diffuse;
3712
+ }`,ap=`uniform vec3 diffuse;
3713
3713
  uniform float opacity;
3714
3714
  #include <common>
3715
3715
  #include <color_pars_fragment>
@@ -3734,7 +3734,7 @@ void main() {
3734
3734
  #include <colorspace_fragment>
3735
3735
  #include <fog_fragment>
3736
3736
  #include <premultiplied_alpha_fragment>
3737
- }`,lp=`#include <common>
3737
+ }`,op=`#include <common>
3738
3738
  #include <batching_pars_vertex>
3739
3739
  #include <fog_pars_vertex>
3740
3740
  #include <morphtarget_pars_vertex>
@@ -3757,7 +3757,7 @@ void main() {
3757
3757
  #include <worldpos_vertex>
3758
3758
  #include <shadowmap_vertex>
3759
3759
  #include <fog_vertex>
3760
- }`,cp=`uniform vec3 color;
3760
+ }`,lp=`uniform vec3 color;
3761
3761
  uniform float opacity;
3762
3762
  #include <common>
3763
3763
  #include <fog_pars_fragment>
@@ -3773,7 +3773,7 @@ void main() {
3773
3773
  #include <colorspace_fragment>
3774
3774
  #include <fog_fragment>
3775
3775
  #include <premultiplied_alpha_fragment>
3776
- }`,up=`uniform float rotation;
3776
+ }`,cp=`uniform float rotation;
3777
3777
  uniform vec2 center;
3778
3778
  #include <common>
3779
3779
  #include <uv_pars_vertex>
@@ -3797,7 +3797,7 @@ void main() {
3797
3797
  #include <logdepthbuf_vertex>
3798
3798
  #include <clipping_planes_vertex>
3799
3799
  #include <fog_vertex>
3800
- }`,hp=`uniform vec3 diffuse;
3800
+ }`,up=`uniform vec3 diffuse;
3801
3801
  uniform float opacity;
3802
3802
  #include <common>
3803
3803
  #include <uv_pars_fragment>
@@ -3822,7 +3822,7 @@ void main() {
3822
3822
  #include <tonemapping_fragment>
3823
3823
  #include <colorspace_fragment>
3824
3824
  #include <fog_fragment>
3825
- }`,Q={alphahash_fragment:Ih,alphahash_pars_fragment:Lh,alphamap_fragment:Dh,alphamap_pars_fragment:Uh,alphatest_fragment:Nh,alphatest_pars_fragment:Fh,aomap_fragment:Oh,aomap_pars_fragment:Bh,batching_pars_vertex:zh,batching_vertex:Vh,begin_vertex:kh,beginnormal_vertex:Gh,bsdfs:Hh,iridescence_fragment:Wh,bumpmap_pars_fragment:Xh,clipping_planes_fragment:qh,clipping_planes_pars_fragment:Yh,clipping_planes_pars_vertex:$h,clipping_planes_vertex:Zh,color_fragment:Jh,color_pars_fragment:jh,color_pars_vertex:Kh,color_vertex:Qh,common:ef,cube_uv_reflection_fragment:tf,defaultnormal_vertex:nf,displacementmap_pars_vertex:rf,displacementmap_vertex:sf,emissivemap_fragment:af,emissivemap_pars_fragment:of,colorspace_fragment:lf,colorspace_pars_fragment:cf,envmap_fragment:uf,envmap_common_pars_fragment:hf,envmap_pars_fragment:ff,envmap_pars_vertex:df,envmap_physical_pars_fragment:wf,envmap_vertex:pf,fog_vertex:mf,fog_pars_vertex:gf,fog_fragment:_f,fog_pars_fragment:yf,gradientmap_pars_fragment:vf,lightmap_pars_fragment:xf,lights_lambert_fragment:Sf,lights_lambert_pars_fragment:bf,lights_pars_begin:Mf,lights_toon_fragment:Tf,lights_toon_pars_fragment:Ef,lights_phong_fragment:Af,lights_phong_pars_fragment:Cf,lights_physical_fragment:Rf,lights_physical_pars_fragment:Pf,lights_fragment_begin:If,lights_fragment_maps:Lf,lights_fragment_end:Df,lightprobes_pars_fragment:Uf,logdepthbuf_fragment:Nf,logdepthbuf_pars_fragment:Ff,logdepthbuf_pars_vertex:Of,logdepthbuf_vertex:Bf,map_fragment:zf,map_pars_fragment:Vf,map_particle_fragment:kf,map_particle_pars_fragment:Gf,metalnessmap_fragment:Hf,metalnessmap_pars_fragment:Wf,morphinstance_vertex:Xf,morphcolor_vertex:qf,morphnormal_vertex:Yf,morphtarget_pars_vertex:$f,morphtarget_vertex:Zf,normal_fragment_begin:Jf,normal_fragment_maps:jf,normal_pars_fragment:Kf,normal_pars_vertex:Qf,normal_vertex:ed,normalmap_pars_fragment:td,clearcoat_normal_fragment_begin:nd,clearcoat_normal_fragment_maps:id,clearcoat_pars_fragment:rd,iridescence_pars_fragment:sd,opaque_fragment:ad,packing:od,premultiplied_alpha_fragment:ld,project_vertex:cd,dithering_fragment:ud,dithering_pars_fragment:hd,roughnessmap_fragment:fd,roughnessmap_pars_fragment:dd,shadowmap_pars_fragment:pd,shadowmap_pars_vertex:md,shadowmap_vertex:gd,shadowmask_pars_fragment:_d,skinbase_vertex:yd,skinning_pars_vertex:vd,skinning_vertex:xd,skinnormal_vertex:Sd,specularmap_fragment:bd,specularmap_pars_fragment:Md,tonemapping_fragment:wd,tonemapping_pars_fragment:Td,transmission_fragment:Ed,transmission_pars_fragment:Ad,uv_pars_fragment:Cd,uv_pars_vertex:Rd,uv_vertex:Pd,worldpos_vertex:Id,background_vert:Ld,background_frag:Dd,backgroundCube_vert:Ud,backgroundCube_frag:Nd,cube_vert:Fd,cube_frag:Od,depth_vert:Bd,depth_frag:zd,distance_vert:Vd,distance_frag:kd,equirect_vert:Gd,equirect_frag:Hd,linedashed_vert:Wd,linedashed_frag:Xd,meshbasic_vert:qd,meshbasic_frag:Yd,meshlambert_vert:$d,meshlambert_frag:Zd,meshmatcap_vert:Jd,meshmatcap_frag:jd,meshnormal_vert:Kd,meshnormal_frag:Qd,meshphong_vert:ep,meshphong_frag:tp,meshphysical_vert:np,meshphysical_frag:ip,meshtoon_vert:rp,meshtoon_frag:sp,points_vert:ap,points_frag:op,shadow_vert:lp,shadow_frag:cp,sprite_vert:up,sprite_frag:hp},F={common:{diffuse:{value:new me(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new J},alphaMap:{value:null},alphaMapTransform:{value:new J},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new J}},envmap:{envMap:{value:null},envMapRotation:{value:new J},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new J}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new J}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new J},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new J},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new J},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new J}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new J}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new J}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new me(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new z},probesMax:{value:new z},probesResolution:{value:new z}},points:{diffuse:{value:new me(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new J},alphaTest:{value:0},uvTransform:{value:new J}},sprite:{diffuse:{value:new me(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new J},alphaMap:{value:null},alphaMapTransform:{value:new J},alphaTest:{value:0}}},uo={basic:{uniforms:Ae([F.common,F.specularmap,F.envmap,F.aomap,F.lightmap,F.fog]),vertexShader:Q.meshbasic_vert,fragmentShader:Q.meshbasic_frag},lambert:{uniforms:Ae([F.common,F.specularmap,F.envmap,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.fog,F.lights,{emissive:{value:new me(0)},envMapIntensity:{value:1}}]),vertexShader:Q.meshlambert_vert,fragmentShader:Q.meshlambert_frag},phong:{uniforms:Ae([F.common,F.specularmap,F.envmap,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.fog,F.lights,{emissive:{value:new me(0)},specular:{value:new me(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Q.meshphong_vert,fragmentShader:Q.meshphong_frag},standard:{uniforms:Ae([F.common,F.envmap,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.roughnessmap,F.metalnessmap,F.fog,F.lights,{emissive:{value:new me(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},toon:{uniforms:Ae([F.common,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.gradientmap,F.fog,F.lights,{emissive:{value:new me(0)}}]),vertexShader:Q.meshtoon_vert,fragmentShader:Q.meshtoon_frag},matcap:{uniforms:Ae([F.common,F.bumpmap,F.normalmap,F.displacementmap,F.fog,{matcap:{value:null}}]),vertexShader:Q.meshmatcap_vert,fragmentShader:Q.meshmatcap_frag},points:{uniforms:Ae([F.points,F.fog]),vertexShader:Q.points_vert,fragmentShader:Q.points_frag},dashed:{uniforms:Ae([F.common,F.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Q.linedashed_vert,fragmentShader:Q.linedashed_frag},depth:{uniforms:Ae([F.common,F.displacementmap]),vertexShader:Q.depth_vert,fragmentShader:Q.depth_frag},normal:{uniforms:Ae([F.common,F.bumpmap,F.normalmap,F.displacementmap,{opacity:{value:1}}]),vertexShader:Q.meshnormal_vert,fragmentShader:Q.meshnormal_frag},sprite:{uniforms:Ae([F.sprite,F.fog]),vertexShader:Q.sprite_vert,fragmentShader:Q.sprite_frag},background:{uniforms:{uvTransform:{value:new J},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Q.background_vert,fragmentShader:Q.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new J}},vertexShader:Q.backgroundCube_vert,fragmentShader:Q.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Q.cube_vert,fragmentShader:Q.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Q.equirect_vert,fragmentShader:Q.equirect_frag},distance:{uniforms:Ae([F.common,F.displacementmap,{referencePosition:{value:new z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Q.distance_vert,fragmentShader:Q.distance_frag},shadow:{uniforms:Ae([F.lights,F.fog,{color:{value:new me(0)},opacity:{value:1}}]),vertexShader:Q.shadow_vert,fragmentShader:Q.shadow_frag}};uo.physical={uniforms:Ae([uo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new J},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new J},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new J},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new J},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new J},sheen:{value:0},sheenColor:{value:new me(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new J},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new J},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new J},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new J},attenuationDistance:{value:0},attenuationColor:{value:new me(0)},specularColor:{value:new me(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new J},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new J},anisotropyVector:{value:new He},anisotropyMap:{value:null},anisotropyMapTransform:{value:new J}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag};var fp=new J;fp.set(-1,0,0,0,1,0,0,0,1);var bS={[Gr]:"LINEAR_TONE_MAPPING",[Hr]:"REINHARD_TONE_MAPPING",[Wr]:"CINEON_TONE_MAPPING",[Xr]:"ACES_FILMIC_TONE_MAPPING",[Yr]:"AGX_TONE_MAPPING",[$r]:"NEUTRAL_TONE_MAPPING",[qr]:"CUSTOM_TONE_MAPPING"};var MS=new Float32Array(16),wS=new Float32Array(9),TS=new Float32Array(4);var ES={[Gr]:"Linear",[Hr]:"Reinhard",[Wr]:"Cineon",[Xr]:"ACESFilmic",[Yr]:"AgX",[$r]:"Neutral",[qr]:"Custom"};var AS={[qa]:"SHADOWMAP_TYPE_PCF",[Ya]:"SHADOWMAP_TYPE_VSM"};var CS={[ja]:"ENVMAP_TYPE_CUBE",[Jr]:"ENVMAP_TYPE_CUBE",[Ka]:"ENVMAP_TYPE_CUBE_UV"};var RS={[Jr]:"ENVMAP_MODE_REFRACTION"};var PS={[$a]:"ENVMAP_BLENDING_MULTIPLY",[Za]:"ENVMAP_BLENDING_MIX",[Ja]:"ENVMAP_BLENDING_ADD"};var dp=new J;dp.set(-1,0,0,0,1,0,0,0,1);var IS=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);import pp from"@giro3d/giro3d/core/geographic/CoordinateSystem.js";import mp from"@giro3d/giro3d/core/OperationCounter.js";import{defer as ho}from"@giro3d/giro3d/core/RequestQueue.js";import gp from"@giro3d/giro3d/utils/Fetcher.js";import{nonNull as wt}from"@giro3d/giro3d/utils/tsutils.js";import{getLazPerf as _p}from"@giro3d/giro3d/sources/las/config.js";import{extractAttributes as yp,getDimensionsToRead as vp}from"@giro3d/giro3d/sources/las/dimension.js";import{getPerPointFilters as xp}from"@giro3d/giro3d/sources/las/filter.js";import{createBufferAttribute as Sp,readColor as bp,readPosition as Mp,readScalarAttribute as wp}from"@giro3d/giro3d/sources/las/readers.js";import{createLasView as Tp}from"@giro3d/giro3d/sources/las/worker.js";import{PointCloudSourceBase as Ep}from"@giro3d/giro3d/sources/PointCloudSource.js";function Ap(s,e){function t(h,u,d){if(!Number.isSafeInteger(u)||!Number.isSafeInteger(d)||u<0||d<u||d>h.byteLength)throw new Error("Invalid LAS metadata range.");return new Uint8Array(h.slice(u,d))}let n=h=>async()=>{let d=await(await gp.blob(h)).arrayBuffer();return new Uint8Array(d)};async function i(h){let u=await _p();return Pi.Las.PointData.decompressFile(h,u)}async function r(h){return(await s.get()).queue("DecodeLazFile",{buffer:h.buffer},[h.buffer]).then(d=>new Uint8Array(d))}class l extends Ep{isLASSource=!0;type="LASSource";_opCounter=new mp;_filters=[];_options={decimate:1,enableWorkers:!0,compressColorsToUint8:!0};_header=null;_volume=null;_buffer=null;get loading(){return this._opCounter.loading}get progress(){return this._opCounter.progress}get filters(){return this._filters}set filters(u){this._filters.length=0,this._filters.push(...u),this.dispatchEvent({type:"updated"})}constructor(u){if(super(),this._opCounter.addEventListener("changed",()=>this.dispatchEvent({type:"progress"})),this._options.compressColorsToUint8=u.compressColorsTo8Bit??this._options.compressColorsToUint8,this._options.decimate=u.decimate??1,this._options.decimate<1)throw new Error("decimate should be at least 1");this._options.enableWorkers=u.enableWorkers??!0,u.filters!=null&&u.filters.length>0&&this._filters.push(...u.filters),this._getter=typeof u.url=="string"?n(u.url):u.url}async initializeOnce(){this._opCounter.increment(),this._buffer=await this._getter().finally(()=>this._opCounter.decrement()),this._header=fo.Header.parse(new Uint8Array(this._buffer));let{min:u,max:d}=this._header;return this._volume=new We().set(new z(u[0],u[1],u[2]),new z(d[0],d[1],d[2])),this}async getView(u){this._opCounter.increment();let d=new Uint8Array(wt(this._buffer)),p=wt(this._header),g;return this._options.enableWorkers===!1?g=await i(d).finally(()=>this._opCounter.decrement()):g=await r(d).finally(()=>this._opCounter.decrement()),Tp(g,p,void 0,u)}async getMetadata(){let u=wt(this._header,"not initialized"),d=await this.getView(),p={pointCount:u.pointCount,volume:wt(this._volume),attributes:yp(d.dimensions,wt(this._volume),this._options.compressColorsToUint8,null)},g=wt(this._buffer,"not initialized"),y=(b,S)=>t(g,b,S),v=await Pi.Las.Vlr.walk((b,S)=>Promise.resolve(y(b,S)),u),M=Pi.Las.Vlr.find(v,"LASF_Projection",2112);if(M&&M.contentLength){let b=M.contentOffset,S=b+M.contentLength,R=po.Binary.toCString(y(b,S));if(R!==null&&R)try{p.crs=pp.fromWkt(R)}catch(L){console.error(`Failed to parse WKT for LAS "${this.id}": `,L)}}return Promise.resolve(p)}async getHierarchy(){let{min:u,max:d,pointCount:p}=wt(this._header,"not initialized"),g=new We().set(new z(u[0],u[1],u[2]),new z(d[0],d[1],d[2]));return{depth:0,volume:g,id:"root",hasData:!0,geometricError:0,center:g.getCenter(new z),sourceId:this.id,pointCount:p}}async getNodeData(u){let d=u.attributes??[],p=vp(d,u.position,this._filters),g=await this.getView(p),{min:y}=wt(this._volume),v=y.clone(),M=this._options.decimate??1,b=u.signal,S=xp(this._filters,g),R=this._options.compressColorsToUint8;this._opCounter.increment(d.length);let L,B;if(u.position){this._opCounter.increment();let V=await ho(()=>Mp(g,v,M,S)).finally(()=>this._opCounter.decrement());L=new Tn(new Float32Array(V.buffer),3),B=V.localBoundingBox}let C=await Promise.all(d.map(async V=>{let O;V.interpretation==="color"?O=()=>bp(g,M,R,S):O=()=>wp(g,V,M,S);let W=await ho(O,b).finally(()=>this._opCounter.decrement());return Sp(W,V,R)}));return Promise.resolve({origin:v,pointCount:L?.count??C[0]?.count,localBoundingBox:B,position:L,attributes:C})}getMemoryUsage(u){this._buffer!=null&&u.objects.set(this.id,{cpuMemory:this._buffer.byteLength,gpuMemory:0})}dispose(){s.dispose(),this._buffer=null,this._header=null,this._volume=null,this._filters.length=0}}function c(h,u){return new class extends h{initialize(){return this._initializePromise||(this._initializePromise=Promise.resolve().then(()=>this.initializeOnce()).then(d=>(this._ready=!0,this.dispatchEvent({type:"initialized"}),d))),this._initializePromise}async getNodeData(d){d.signal?.throwIfAborted();try{let p=await super.getNodeData(d);return d.signal?.throwIfAborted(),p}catch(p){throw d.signal?.throwIfAborted(),p}}}(u)}return c(l,e)}var An=On(hr());import{GlobalCache as mo}from"@giro3d/giro3d/core/Cache.js";import go from"@giro3d/giro3d/core/geographic/CoordinateSystem.js";import*as Pt from"@giro3d/giro3d/core/Octree.js";import Cp from"@giro3d/giro3d/core/OperationCounter.js";import Rp from"@giro3d/giro3d/core/RequestQueue.js";import Pp from"@giro3d/giro3d/utils/Fetcher.js";import{nonNull as ts}from"@giro3d/giro3d/utils/tsutils.js";import{getLazPerf as Ip}from"@giro3d/giro3d/sources/las/config.js";import{extractAttributes as Lp,getDimensionsToRead as Dp}from"@giro3d/giro3d/sources/las/dimension.js";import{createBufferAttribute as Up}from"@giro3d/giro3d/sources/las/readers.js";import{createLasView as Np,readView as Fp}from"@giro3d/giro3d/sources/las/worker.js";import{PointCloudSourceBase as Op}from"@giro3d/giro3d/sources/PointCloudSource.js";function Bp(s,e){function t(M){let b=[...M].sort((R,L)=>R.pageOffset-L.pageOffset),S=[];for(let R of b){let L=R.pageOffset,B=L+R.pageLength;if(!Number.isSafeInteger(L)||L<0||!Number.isSafeInteger(R.pageLength)||R.pageLength<0||R.pageLength%32||!Number.isSafeInteger(B))throw new Error("Invalid COPC hierarchy page range.");let C=S.at(-1);C&&L===C.end&&B-C.begin<=512*1024?(C.end=B,C.pages.push(R)):S.push({begin:L,end:B,pages:[R]})}return S}let n=new Rp,i=M=>async(b,S)=>{let L=await(await Pp.blob(M,{headers:{Range:`bytes=${b}-${S-1}`}})).arrayBuffer();return new Uint8Array(L)};async function r(M,b){let S=await Ip();return An.Las.PointData.decompressChunk(M,b,S)}async function l(M,b){return(await s.get()).queue("DecodeLazChunk",{buffer:M.buffer,metadata:b},[M.buffer]).then(R=>new Uint8Array(R))}let c=new z,h=new z;function u(M,b,S,R,L,B,C){let V=S.depth+1,O=S.x*2+L,W=S.y*2+B,$=S.z*2+C,j=`${V}-${O}-${W}-${$}`,_=b.get(j);if(!_)return;let T=S.volume.getCenter(c),D=S.volume.getSize(h).divideScalar(2),k=It=>It===0?-1:0,G=T.x+D.x*k(L),Y=T.y+D.y*k(B),U=T.z+D.z*k(C),ge=new z(G,Y,U),ve=ge.clone().add(D),K=new We(ge,ve),ue=K.getCenter(new z);return Pt.create({depth:V,x:O,y:W,z:$,id:j,center:ue,pointCount:_.pointCount,geometricError:R,hasData:_.pointCount>0,sourceId:M,volume:K},K,S)}async function d(M,b,S){return p(An.Copc.loadHierarchyPage,M,b,S)}async function p(M,b,S,R){let L=[S],B=new Set;for(;L.length;){let C=L.filter($=>{let j=`${$.pageOffset}:${$.pageLength}`;return B.has(j)?!1:(B.add(j),!0)}),V=t(C);L=[];let O=0,W=!1;await Promise.all(Array.from({length:Math.min(8,V.length)},async()=>{for(;!W&&O<V.length;){let $=V[O++];try{let j=b;if($.pages.length>1){let _=await b($.begin,$.end);if(_.byteLength!==$.end-$.begin)throw new Error("Truncated COPC hierarchy group.");j=async(T,D)=>{if(T<$.begin||D>$.end||D<T)throw new Error("COPC hierarchy page escaped its declared group.");return _.slice(T-$.begin,D-$.begin)}}for(let _ of $.pages){if(W)return;let{nodes:T,pages:D}=await M(j,_);for(let[k,G]of Object.entries(T))R.set(k,G);for(let k of Object.values(D))k&&L.push(k)}}catch(j){throw W=!0,j}}}))}}class g extends Op{isCOPCSource=!0;type="COPCSource";_opCounter=new Cp;_nodeMap=new Map;_filters=[];_options={decimate:1,enableWorkers:!0,compressColorsToUint8:!0};get loading(){return this._opCounter.loading}get progress(){return this._opCounter.progress}get filters(){return this._filters}set filters(b){this._filters.length=0,b!=null&&this._filters.push(...b),this.dispatchEvent({type:"updated"})}constructor(b){if(super(),this._opCounter.addEventListener("changed",()=>this.dispatchEvent({type:"progress"})),this._options.compressColorsToUint8=b.compressColorsTo8Bit??this._options.compressColorsToUint8,this._options.decimate=b.decimate??1,this._options.decimate<1)throw new Error("decimate should be at least 1");this._options.enableWorkers=b.enableWorkers??!0,b.filters!=null&&b.filters.length>0&&this._filters.push(...b.filters),this._getter=typeof b.url=="string"?i(b.url):b.url}async initializeOnce(){let b=this._opCounter;b.increment(3);let S=await An.Copc.create(this._getter).finally(()=>b.decrement()),[R,L,B]=S.header.min,[C,V,O]=S.header.max,W=new We(new z(R,L,B),new z(C,V,O)),$=new Map;await d(this._getter,S.info.rootHierarchyPage,$).finally(()=>b.decrement());let j=ts($.get("0-0-0-0"),"FATAL: no root node in the LAS file."),_=await this.loadPointDataView(this._getter,S,j).finally(()=>b.decrement());return this._data={copc:S,nodes:$,volume:W,dimensions:_.dimensions},this}getMetadata(){let b=this.ensureInitialized(),S=go.unknown;if(typeof b.copc.wkt<"u")try{S=go.fromWkt(b.copc.wkt)}catch(L){console.error(`Failed to parse WKT for COPC "${this.id}": `,L)}let R={pointCount:b.copc.header.pointCount,attributes:Lp(b.dimensions,b.volume,this._options.compressColorsToUint8,b.copc.info.gpsTimeRange),volume:b.volume,crs:S};return Promise.resolve(R)}getHierarchy(){let{copc:b,nodes:S}=this.ensureInitialized(),[R,L,B,C,V,O]=b.info.cube,W=new We(new z(R,L,B),new z(C,V,O)),$=ts(S.get("0-0-0-0")),j=b.info.spacing,_=Pt.create({depth:0,x:0,y:0,z:0,id:"0-0-0-0",volume:W,center:W.getCenter(new z),pointCount:$.pointCount,geometricError:j,hasData:$.pointCount>0,sourceId:this.id},W);return Pt.populate(_,D=>{let k=j/2**(D.depth+1);return[u(this.id,S,D,k,0,0,0),u(this.id,S,D,k,1,0,0),u(this.id,S,D,k,1,1,0),u(this.id,S,D,k,0,1,0),u(this.id,S,D,k,0,0,1),u(this.id,S,D,k,1,0,1),u(this.id,S,D,k,1,1,1),u(this.id,S,D,k,0,1,1)]}),Pt.traverse(_,D=>(this._nodeMap.set(D.id,D),!0)),Promise.resolve(_)}async getNodeData(b){let{nodes:S,copc:R}=this.ensureInitialized(),L=b.node.id,B=-b.node.depth,C=S.get(L);if(!C)throw new Error("no such node: "+L);let V=b.signal;V?.throwIfAborted();let O=b.attributes??[],W=Dp(O,b.position,this._filters),$=ts(this._nodeMap.get(L)),j=this._options.decimate,{x:_,y:T,z:D}=b.node.center,k={pointCount:C.pointCount,pointDataRecordFormat:R.header.pointDataRecordFormat,pointDataRecordLength:R.header.pointDataRecordLength},G;this._options.enableWorkers?G=await this.loadNodeDataWithWorker(C,B,V,R,k,b,_,T,D,W,j):G=await this.loadNodeData(R,C,W,B,V,_,T,D,j,b),V?.throwIfAborted();let Y,U;if(G.position){Y=new sn(new Float32Array(G.position.buffer),3);let[ve,K,ue,an,It,Lt]=G.position.localBoundingBox;U=new We(new z(ve,K,ue),new z(an,It,Lt))}let ge=O.map((ve,K)=>{let ue=G.attributes[K];if(ue!=null)return Up(ue,ve,this._options.compressColorsToUint8)});return{pointCount:Y?.count??ge[0]?.count,origin:$.center,localBoundingBox:U,position:Y,attributes:ge}}async loadNodeData(b,S,R,L,B,C,V,O,W,$){let j=await this._opCounter.wrap(this.loadPointDataView(this._getter,b,S,R,L,B));return B?.throwIfAborted(),Fp({view:j,origin:{x:C,y:V,z:O},stride:W,position:$.position,attributes:$.attributes??[],compressColors:this._options.compressColorsToUint8,filters:this._filters})}async loadNodeDataWithWorker(b,S,R,L,B,C,V,O,W,$,j){let _=await this._opCounter.wrap(this.loadPointDataViewBuffer(this._getter,b,S));R?.throwIfAborted();let T=_.slice(0);try{return this._opCounter.increment(),await(await s.get()).queue("ReadView",{buffer:T,header:L.header,metadata:B,position:C.position,origin:{x:V,y:O,z:W},include:$,filters:this._filters,eb:L.eb,stride:j,attributes:C.attributes??[],compressColors:this._options.compressColorsToUint8},[T])}finally{this._opCounter.decrement()}}ensureInitialized(){if(!this._data)throw new Error("not initialized");return this._data}async loadPointDataViewBuffer(b,S,R){let{pointDataOffset:L,pointDataLength:B}=S,C=`${this.id}-${L}-${B}`,V=mo.get(C);return V!=null?V.buffer:n.enqueue({id:C,priority:R,request:async()=>{let O=await b(L,L+B);return mo.set(C,O,{size:O.byteLength}),O.buffer}})}async loadPointDataView(b,S,R,L,B,C){let V=await this.loadPointDataViewBuffer(b,R,B);C?.throwIfAborted();let O;if(this._options.enableWorkers){let W=new Uint8Array(V.slice(0));O=await l(W,{pointCount:R.pointCount,pointDataRecordFormat:S.header.pointDataRecordFormat,pointDataRecordLength:S.header.pointDataRecordLength})}else{let W=new Uint8Array(V);O=await r(W,{pointCount:R.pointCount,pointDataRecordFormat:S.header.pointDataRecordFormat,pointDataRecordLength:S.header.pointDataRecordLength})}return C?.throwIfAborted(),Np(O,S.header,S.eb,L)}getMemoryUsage(){}dispose(){s.dispose(),this._data=void 0,this._nodeMap.clear(),this._filters.length=0}}function y(M){return M.isCOPCSource===!0}function v(M,b){return new class extends M{initialize(){return this._initializePromise||(this._initializePromise=Promise.resolve().then(()=>this.initializeOnce()).then(S=>(this._ready=!0,this.dispatchEvent({type:"initialized"}),S))),this._initializePromise}async getNodeData(S){S.signal?.throwIfAborted();try{let R=await super.getNodeData(S);return S.signal?.throwIfAborted(),R}catch(R){throw S.signal?.throwIfAborted(),R}}}(b)}return v(g,e)}function Vp(s,e){if(typeof s.prototype.loadNodeData!="function")throw new Error("Missing reviewed PointCloud loading method.");let t=new AbortController,n,i=()=>{t.signal.aborted||(t.abort(new Error("aborted")),n&&(n.frozen=!0))};return n=new class extends s{async loadNodeData(r,l,c){if(t.signal.aborted||l?.aborted)return;let h=new AbortController,u=()=>h.abort(new Error("aborted"));t.signal.addEventListener("abort",u,{once:!0}),l?.addEventListener("abort",u,{once:!0});try{return(t.signal.aborted||l?.aborted)&&u(),await super.loadNodeData(r,h.signal,c)}finally{t.signal.removeEventListener("abort",u),l?.removeEventListener("abort",u)}}clear(){t.signal.aborted||super.clear()}dispose(){try{i()}finally{super.dispose()}}}(e),{entity:n,stop:i}}function cb(s){return Vp(zp,s)}export{Bp as createCOPCSource,Ap as createLASSource,cb as createOwnedPointCloud};
3825
+ }`,Q={alphahash_fragment:Ih,alphahash_pars_fragment:Lh,alphamap_fragment:Dh,alphamap_pars_fragment:Nh,alphatest_fragment:Uh,alphatest_pars_fragment:Fh,aomap_fragment:Oh,aomap_pars_fragment:Bh,batching_pars_vertex:zh,batching_vertex:kh,begin_vertex:Vh,beginnormal_vertex:Gh,bsdfs:Hh,iridescence_fragment:Wh,bumpmap_pars_fragment:Xh,clipping_planes_fragment:qh,clipping_planes_pars_fragment:Yh,clipping_planes_pars_vertex:$h,clipping_planes_vertex:Zh,color_fragment:Jh,color_pars_fragment:jh,color_pars_vertex:Kh,color_vertex:Qh,common:ed,defaultnormal_vertex:td,displacementmap_pars_vertex:nd,displacementmap_vertex:id,emissivemap_fragment:rd,emissivemap_pars_fragment:sd,colorspace_fragment:ad,colorspace_pars_fragment:od,envmap_fragment:ld,envmap_common_pars_fragment:cd,envmap_pars_fragment:ud,envmap_pars_vertex:hd,envmap_physical_pars_fragment:Md,envmap_vertex:dd,fog_vertex:fd,fog_pars_vertex:pd,fog_fragment:md,fog_pars_fragment:gd,gradientmap_pars_fragment:_d,lightmap_pars_fragment:yd,lights_lambert_fragment:vd,lights_lambert_pars_fragment:xd,lights_pars_begin:Sd,lights_toon_fragment:bd,lights_toon_pars_fragment:wd,lights_phong_fragment:Td,lights_phong_pars_fragment:Ed,lights_physical_fragment:Ad,lights_physical_pars_fragment:Cd,lights_fragment_begin:Rd,lights_fragment_maps:Pd,lights_fragment_end:Id,lightprobes_pars_fragment:Ld,logdepthbuf_fragment:Dd,logdepthbuf_pars_fragment:Nd,logdepthbuf_pars_vertex:Ud,logdepthbuf_vertex:Fd,map_fragment:Od,map_pars_fragment:Bd,map_particle_fragment:zd,map_particle_pars_fragment:kd,metalnessmap_fragment:Vd,metalnessmap_pars_fragment:Gd,morphinstance_vertex:Hd,morphcolor_vertex:Wd,morphnormal_vertex:Xd,morphtarget_pars_vertex:qd,morphtarget_vertex:Yd,normal_fragment_begin:$d,normal_fragment_maps:Zd,normal_pars_fragment:Jd,normal_pars_vertex:jd,normal_vertex:Kd,normalmap_pars_fragment:Qd,clearcoat_normal_fragment_begin:ef,clearcoat_normal_fragment_maps:tf,clearcoat_pars_fragment:nf,iridescence_pars_fragment:rf,opaque_fragment:sf,packing:af,premultiplied_alpha_fragment:of,project_vertex:lf,dithering_fragment:cf,dithering_pars_fragment:uf,roughnessmap_fragment:hf,roughnessmap_pars_fragment:df,shadowmap_pars_fragment:ff,shadowmap_pars_vertex:pf,shadowmap_vertex:mf,shadowmask_pars_fragment:gf,skinbase_vertex:_f,skinning_pars_vertex:yf,skinning_vertex:vf,skinnormal_vertex:xf,specularmap_fragment:Sf,specularmap_pars_fragment:Mf,tonemapping_fragment:bf,tonemapping_pars_fragment:wf,transmission_fragment:Tf,transmission_pars_fragment:Ef,uv_pars_fragment:Af,uv_pars_vertex:Cf,uv_vertex:Rf,worldpos_vertex:Pf,background_vert:If,background_frag:Lf,backgroundCube_vert:Df,backgroundCube_frag:Nf,cube_vert:Uf,cube_frag:Ff,depth_vert:Of,depth_frag:Bf,distance_vert:zf,distance_frag:kf,equirect_vert:Vf,equirect_frag:Gf,linedashed_vert:Hf,linedashed_frag:Wf,meshbasic_vert:Xf,meshbasic_frag:qf,meshlambert_vert:Yf,meshlambert_frag:$f,meshmatcap_vert:Zf,meshmatcap_frag:Jf,meshnormal_vert:jf,meshnormal_frag:Kf,meshphong_vert:Qf,meshphong_frag:ep,meshphysical_vert:tp,meshphysical_frag:np,meshtoon_vert:ip,meshtoon_frag:rp,points_vert:sp,points_frag:ap,shadow_vert:op,shadow_frag:lp,sprite_vert:cp,sprite_frag:up},F={common:{diffuse:{value:new me(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new J},alphaMap:{value:null},alphaMapTransform:{value:new J},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new J}},envmap:{envMap:{value:null},envMapRotation:{value:new J},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new J}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new J}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new J},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new J},normalScale:{value:new Ge(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new J},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new J}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new J}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new J}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new me(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:[]},probesMin:{value:[]},probesMax:{value:[]},probesResolution:{value:[]}},points:{diffuse:{value:new me(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new J},alphaTest:{value:0},uvTransform:{value:new J}},sprite:{diffuse:{value:new me(16777215)},opacity:{value:1},center:{value:new Ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new J},alphaMap:{value:null},alphaMapTransform:{value:new J},alphaTest:{value:0}}},lo={basic:{uniforms:Ae([F.common,F.specularmap,F.envmap,F.aomap,F.lightmap,F.fog]),vertexShader:Q.meshbasic_vert,fragmentShader:Q.meshbasic_frag},lambert:{uniforms:Ae([F.common,F.specularmap,F.envmap,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.fog,F.lights,{emissive:{value:new me(0)},envMapIntensity:{value:1}}]),vertexShader:Q.meshlambert_vert,fragmentShader:Q.meshlambert_frag},phong:{uniforms:Ae([F.common,F.specularmap,F.envmap,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.fog,F.lights,{emissive:{value:new me(0)},specular:{value:new me(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Q.meshphong_vert,fragmentShader:Q.meshphong_frag},standard:{uniforms:Ae([F.common,F.envmap,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.roughnessmap,F.metalnessmap,F.fog,F.lights,{emissive:{value:new me(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},toon:{uniforms:Ae([F.common,F.aomap,F.lightmap,F.emissivemap,F.bumpmap,F.normalmap,F.displacementmap,F.gradientmap,F.fog,F.lights,{emissive:{value:new me(0)}}]),vertexShader:Q.meshtoon_vert,fragmentShader:Q.meshtoon_frag},matcap:{uniforms:Ae([F.common,F.bumpmap,F.normalmap,F.displacementmap,F.fog,{matcap:{value:null}}]),vertexShader:Q.meshmatcap_vert,fragmentShader:Q.meshmatcap_frag},points:{uniforms:Ae([F.points,F.fog]),vertexShader:Q.points_vert,fragmentShader:Q.points_frag},dashed:{uniforms:Ae([F.common,F.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Q.linedashed_vert,fragmentShader:Q.linedashed_frag},depth:{uniforms:Ae([F.common,F.displacementmap]),vertexShader:Q.depth_vert,fragmentShader:Q.depth_frag},normal:{uniforms:Ae([F.common,F.bumpmap,F.normalmap,F.displacementmap,{opacity:{value:1}}]),vertexShader:Q.meshnormal_vert,fragmentShader:Q.meshnormal_frag},sprite:{uniforms:Ae([F.sprite,F.fog]),vertexShader:Q.sprite_vert,fragmentShader:Q.sprite_frag},background:{uniforms:{uvTransform:{value:new J},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Q.background_vert,fragmentShader:Q.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new J}},vertexShader:Q.backgroundCube_vert,fragmentShader:Q.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Q.cube_vert,fragmentShader:Q.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Q.equirect_vert,fragmentShader:Q.equirect_frag},distance:{uniforms:Ae([F.common,F.displacementmap,{referencePosition:{value:new k},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Q.distance_vert,fragmentShader:Q.distance_frag},shadow:{uniforms:Ae([F.lights,F.fog,{color:{value:new me(0)},opacity:{value:1}}]),vertexShader:Q.shadow_vert,fragmentShader:Q.shadow_frag}};lo.physical={uniforms:Ae([lo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new J},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new J},clearcoatNormalScale:{value:new Ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new J},diffuseRoughness:{value:0},diffuseRoughnessMap:{value:null},diffuseRoughnessMapTransform:{value:new J},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new J},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new J},sheen:{value:0},sheenColor:{value:new me(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new J},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new J},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new J},transmissionSamplerSize:{value:new Ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new J},attenuationDistance:{value:0},attenuationColor:{value:new me(0)},specularColor:{value:new me(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new J},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new J},anisotropyVector:{value:new Ge},anisotropyMap:{value:null},anisotropyMapTransform:{value:new J}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag};var hp=new J;hp.set(-1,0,0,0,1,0,0,0,1);var bS={[kr]:"LINEAR_TONE_MAPPING",[Vr]:"REINHARD_TONE_MAPPING",[Gr]:"CINEON_TONE_MAPPING",[Hr]:"ACES_FILMIC_TONE_MAPPING",[Xr]:"AGX_TONE_MAPPING",[qr]:"NEUTRAL_TONE_MAPPING",[Wr]:"CUSTOM_TONE_MAPPING"};var wS=new Float32Array(16),TS=new Float32Array(9),ES=new Float32Array(4);var AS={[kr]:"Linear",[Vr]:"Reinhard",[Gr]:"Cineon",[Hr]:"ACESFilmic",[Xr]:"AgX",[qr]:"Neutral",[Wr]:"Custom"};var CS={[Xa]:"SHADOWMAP_TYPE_PCF",[qa]:"SHADOWMAP_TYPE_VSM"};var RS={[Ja]:"ENVMAP_MODE_REFRACTION"};var PS={[Ya]:"ENVMAP_BLENDING_MULTIPLY",[$a]:"ENVMAP_BLENDING_MIX",[Za]:"ENVMAP_BLENDING_ADD"};var dp=new J;dp.set(-1,0,0,0,1,0,0,0,1);var IS=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);import fp from"@giro3d/giro3d/core/geographic/CoordinateSystem.js";import pp from"@giro3d/giro3d/core/OperationCounter.js";import{defer as co}from"@giro3d/giro3d/core/RequestQueue.js";import mp from"@giro3d/giro3d/utils/Fetcher.js";import{nonNull as bt}from"@giro3d/giro3d/utils/tsutils.js";import{getLazPerf as gp}from"@giro3d/giro3d/sources/las/config.js";import{extractAttributes as _p,getDimensionsToRead as yp}from"@giro3d/giro3d/sources/las/dimension.js";import{getPerPointFilters as vp}from"@giro3d/giro3d/sources/las/filter.js";import{createBufferAttribute as xp,readColor as Sp,readPosition as Mp,readScalarAttribute as bp}from"@giro3d/giro3d/sources/las/readers.js";import{createLasView as wp}from"@giro3d/giro3d/sources/las/worker.js";import{PointCloudSourceBase as Tp}from"@giro3d/giro3d/sources/PointCloudSource.js";function Ep(s,e){function t(h,u,f){if(!Number.isSafeInteger(u)||!Number.isSafeInteger(f)||u<0||f<u||f>h.byteLength)throw new Error("Invalid LAS metadata range.");return new Uint8Array(h.slice(u,f))}let n=h=>async()=>{let f=await(await mp.blob(h)).arrayBuffer();return new Uint8Array(f)};async function i(h){let u=await gp();return Ri.Las.PointData.decompressFile(h,u)}async function r(h){return(await s.get()).queue("DecodeLazFile",{buffer:h.buffer},[h.buffer]).then(f=>new Uint8Array(f))}class l extends Tp{isLASSource=!0;type="LASSource";_opCounter=new pp;_filters=[];_options={decimate:1,enableWorkers:!0,compressColorsToUint8:!0};_header=null;_volume=null;_buffer=null;get loading(){return this._opCounter.loading}get progress(){return this._opCounter.progress}get filters(){return this._filters}set filters(u){this._filters.length=0,this._filters.push(...u),this.dispatchEvent({type:"updated"})}constructor(u){if(super(),this._opCounter.addEventListener("changed",()=>this.dispatchEvent({type:"progress"})),this._options.compressColorsToUint8=u.compressColorsTo8Bit??this._options.compressColorsToUint8,this._options.decimate=u.decimate??1,this._options.decimate<1)throw new Error("decimate should be at least 1");this._options.enableWorkers=u.enableWorkers??!0,u.filters!=null&&u.filters.length>0&&this._filters.push(...u.filters),this._getter=typeof u.url=="string"?n(u.url):u.url}async initializeOnce(){this._opCounter.increment(),this._buffer=await this._getter().finally(()=>this._opCounter.decrement()),this._header=uo.Header.parse(new Uint8Array(this._buffer));let{min:u,max:f}=this._header;return this._volume=new He().set(new k(u[0],u[1],u[2]),new k(f[0],f[1],f[2])),this}async getView(u){this._opCounter.increment();let f=new Uint8Array(bt(this._buffer)),p=bt(this._header),g;return this._options.enableWorkers===!1?g=await i(f).finally(()=>this._opCounter.decrement()):g=await r(f).finally(()=>this._opCounter.decrement()),wp(g,p,void 0,u)}async getMetadata(){let u=bt(this._header,"not initialized"),f=await this.getView(),p={pointCount:u.pointCount,volume:bt(this._volume),attributes:_p(f.dimensions,bt(this._volume),this._options.compressColorsToUint8,null)},g=bt(this._buffer,"not initialized"),y=(M,S)=>t(g,M,S),v=await Ri.Las.Vlr.walk((M,S)=>Promise.resolve(y(M,S)),u),b=Ri.Las.Vlr.find(v,"LASF_Projection",2112);if(b&&b.contentLength){let M=b.contentOffset,S=M+b.contentLength,R=ho.Binary.toCString(y(M,S));if(R!==null&&R)try{p.crs=fp.fromWkt(R)}catch(L){console.error(`Failed to parse WKT for LAS "${this.id}": `,L)}}return Promise.resolve(p)}async getHierarchy(){let{min:u,max:f,pointCount:p}=bt(this._header,"not initialized"),g=new He().set(new k(u[0],u[1],u[2]),new k(f[0],f[1],f[2]));return{depth:0,volume:g,id:"root",hasData:!0,geometricError:0,center:g.getCenter(new k),sourceId:this.id,pointCount:p}}async getNodeData(u){let f=u.attributes??[],p=yp(f,u.position,this._filters),g=await this.getView(p),{min:y}=bt(this._volume),v=y.clone(),b=this._options.decimate??1,M=u.signal,S=vp(this._filters,g),R=this._options.compressColorsToUint8;this._opCounter.increment(f.length);let L,B;if(u.position){this._opCounter.increment();let z=await co(()=>Mp(g,v,b,S)).finally(()=>this._opCounter.decrement());L=new Mn(new Float32Array(z.buffer),3),B=z.localBoundingBox}let C=await Promise.all(f.map(async z=>{let O;z.interpretation==="color"?O=()=>Sp(g,b,R,S):O=()=>bp(g,z,b,S);let W=await co(O,M).finally(()=>this._opCounter.decrement());return xp(W,z,R)}));return Promise.resolve({origin:v,pointCount:L?.count??C[0]?.count,localBoundingBox:B,position:L,attributes:C})}getMemoryUsage(u){this._buffer!=null&&u.objects.set(this.id,{cpuMemory:this._buffer.byteLength,gpuMemory:0})}dispose(){s.dispose(),this._buffer=null,this._header=null,this._volume=null,this._filters.length=0}}function c(h,u){return new class extends h{initialize(){return this._initializePromise||(this._initializePromise=Promise.resolve().then(()=>this.initializeOnce()).then(f=>(this._ready=!0,this.dispatchEvent({type:"initialized"}),f))),this._initializePromise}async getNodeData(f){f.signal?.throwIfAborted();try{let p=await super.getNodeData(f);return f.signal?.throwIfAborted(),p}catch(p){throw f.signal?.throwIfAborted(),p}}}(u)}return c(l,e)}var wn=Nn(ur());import{GlobalCache as fo}from"@giro3d/giro3d/core/Cache.js";import po from"@giro3d/giro3d/core/geographic/CoordinateSystem.js";import*as Rt from"@giro3d/giro3d/core/Octree.js";import Ap from"@giro3d/giro3d/core/OperationCounter.js";import Cp from"@giro3d/giro3d/core/RequestQueue.js";import Rp from"@giro3d/giro3d/utils/Fetcher.js";import{nonNull as Qr}from"@giro3d/giro3d/utils/tsutils.js";import{getLazPerf as Pp}from"@giro3d/giro3d/sources/las/config.js";import{extractAttributes as Ip,getDimensionsToRead as Lp}from"@giro3d/giro3d/sources/las/dimension.js";import{createBufferAttribute as Dp}from"@giro3d/giro3d/sources/las/readers.js";import{createLasView as Np,readView as Up}from"@giro3d/giro3d/sources/las/worker.js";import{PointCloudSourceBase as Fp}from"@giro3d/giro3d/sources/PointCloudSource.js";function Op(s,e){function t(b){let M=[...b].sort((R,L)=>R.pageOffset-L.pageOffset),S=[];for(let R of M){let L=R.pageOffset,B=L+R.pageLength;if(!Number.isSafeInteger(L)||L<0||!Number.isSafeInteger(R.pageLength)||R.pageLength<0||R.pageLength%32||!Number.isSafeInteger(B))throw new Error("Invalid COPC hierarchy page range.");let C=S.at(-1);C&&L===C.end&&B-C.begin<=512*1024?(C.end=B,C.pages.push(R)):S.push({begin:L,end:B,pages:[R]})}return S}let n=new Cp,i=b=>async(M,S)=>{let L=await(await Rp.blob(b,{headers:{Range:`bytes=${M}-${S-1}`}})).arrayBuffer();return new Uint8Array(L)};async function r(b,M){let S=await Pp();return wn.Las.PointData.decompressChunk(b,M,S)}async function l(b,M){return(await s.get()).queue("DecodeLazChunk",{buffer:b.buffer,metadata:M},[b.buffer]).then(R=>new Uint8Array(R))}let c=new k,h=new k;function u(b,M,S,R,L,B,C){let z=S.depth+1,O=S.x*2+L,W=S.y*2+B,$=S.z*2+C,j=`${z}-${O}-${W}-${$}`,_=M.get(j);if(!_)return;let T=S.volume.getCenter(c),D=S.volume.getSize(h).divideScalar(2),V=Pt=>Pt===0?-1:0,G=T.x+D.x*V(L),Y=T.y+D.y*V(B),N=T.z+D.z*V(C),ge=new k(G,Y,N),ve=ge.clone().add(D),K=new He(ge,ve),ue=K.getCenter(new k);return Rt.create({depth:z,x:O,y:W,z:$,id:j,center:ue,pointCount:_.pointCount,geometricError:R,hasData:_.pointCount>0,sourceId:b,volume:K},K,S)}async function f(b,M,S){return p(wn.Copc.loadHierarchyPage,b,M,S)}async function p(b,M,S,R){let L=[S],B=new Set;for(;L.length;){let C=L.filter($=>{let j=`${$.pageOffset}:${$.pageLength}`;return B.has(j)?!1:(B.add(j),!0)}),z=t(C);L=[];let O=0,W=!1;await Promise.all(Array.from({length:Math.min(8,z.length)},async()=>{for(;!W&&O<z.length;){let $=z[O++];try{let j=M;if($.pages.length>1){let _=await M($.begin,$.end);if(_.byteLength!==$.end-$.begin)throw new Error("Truncated COPC hierarchy group.");j=async(T,D)=>{if(T<$.begin||D>$.end||D<T)throw new Error("COPC hierarchy page escaped its declared group.");return _.slice(T-$.begin,D-$.begin)}}for(let _ of $.pages){if(W)return;let{nodes:T,pages:D}=await b(j,_);for(let[V,G]of Object.entries(T))R.set(V,G);for(let V of Object.values(D))V&&L.push(V)}}catch(j){throw W=!0,j}}}))}}class g extends Fp{isCOPCSource=!0;type="COPCSource";_opCounter=new Ap;_nodeMap=new Map;_filters=[];_options={decimate:1,enableWorkers:!0,compressColorsToUint8:!0};get loading(){return this._opCounter.loading}get progress(){return this._opCounter.progress}get filters(){return this._filters}set filters(M){this._filters.length=0,M!=null&&this._filters.push(...M),this.dispatchEvent({type:"updated"})}constructor(M){if(super(),this._opCounter.addEventListener("changed",()=>this.dispatchEvent({type:"progress"})),this._options.compressColorsToUint8=M.compressColorsTo8Bit??this._options.compressColorsToUint8,this._options.decimate=M.decimate??1,this._options.decimate<1)throw new Error("decimate should be at least 1");this._options.enableWorkers=M.enableWorkers??!0,M.filters!=null&&M.filters.length>0&&this._filters.push(...M.filters),this._getter=typeof M.url=="string"?i(M.url):M.url}async initializeOnce(){let M=this._opCounter;M.increment(3);let S=await wn.Copc.create(this._getter).finally(()=>M.decrement()),[R,L,B]=S.header.min,[C,z,O]=S.header.max,W=new He(new k(R,L,B),new k(C,z,O)),$=new Map;await f(this._getter,S.info.rootHierarchyPage,$).finally(()=>M.decrement());let j=Qr($.get("0-0-0-0"),"FATAL: no root node in the LAS file."),_=await this.loadPointDataView(this._getter,S,j).finally(()=>M.decrement());return this._data={copc:S,nodes:$,volume:W,dimensions:_.dimensions},this}getMetadata(){let M=this.ensureInitialized(),S=po.unknown;if(typeof M.copc.wkt<"u")try{S=po.fromWkt(M.copc.wkt)}catch(L){console.error(`Failed to parse WKT for COPC "${this.id}": `,L)}let R={pointCount:M.copc.header.pointCount,attributes:Ip(M.dimensions,M.volume,this._options.compressColorsToUint8,M.copc.info.gpsTimeRange),volume:M.volume,crs:S};return Promise.resolve(R)}getHierarchy(){let{copc:M,nodes:S}=this.ensureInitialized(),[R,L,B,C,z,O]=M.info.cube,W=new He(new k(R,L,B),new k(C,z,O)),$=Qr(S.get("0-0-0-0")),j=M.info.spacing,_=Rt.create({depth:0,x:0,y:0,z:0,id:"0-0-0-0",volume:W,center:W.getCenter(new k),pointCount:$.pointCount,geometricError:j,hasData:$.pointCount>0,sourceId:this.id},W);return Rt.populate(_,D=>{let V=j/2**(D.depth+1);return[u(this.id,S,D,V,0,0,0),u(this.id,S,D,V,1,0,0),u(this.id,S,D,V,1,1,0),u(this.id,S,D,V,0,1,0),u(this.id,S,D,V,0,0,1),u(this.id,S,D,V,1,0,1),u(this.id,S,D,V,1,1,1),u(this.id,S,D,V,0,1,1)]}),Rt.traverse(_,D=>(this._nodeMap.set(D.id,D),!0)),Promise.resolve(_)}async getNodeData(M){let{nodes:S,copc:R}=this.ensureInitialized(),L=M.node.id,B=-M.node.depth,C=S.get(L);if(!C)throw new Error("no such node: "+L);let z=M.signal;z?.throwIfAborted();let O=M.attributes??[],W=Lp(O,M.position,this._filters),$=Qr(this._nodeMap.get(L)),j=this._options.decimate,{x:_,y:T,z:D}=M.node.center,V={pointCount:C.pointCount,pointDataRecordFormat:R.header.pointDataRecordFormat,pointDataRecordLength:R.header.pointDataRecordLength},G;this._options.enableWorkers?G=await this.loadNodeDataWithWorker(C,B,z,R,V,M,_,T,D,W,j):G=await this.loadNodeData(R,C,W,B,z,_,T,D,j,M),z?.throwIfAborted();let Y,N;if(G.position){Y=new nn(new Float32Array(G.position.buffer),3);let[ve,K,ue,rn,Pt,It]=G.position.localBoundingBox;N=new He(new k(ve,K,ue),new k(rn,Pt,It))}let ge=O.map((ve,K)=>{let ue=G.attributes[K];if(ue!=null)return Dp(ue,ve,this._options.compressColorsToUint8)});return{pointCount:Y?.count??ge[0]?.count,origin:$.center,localBoundingBox:N,position:Y,attributes:ge}}async loadNodeData(M,S,R,L,B,C,z,O,W,$){let j=await this._opCounter.wrap(this.loadPointDataView(this._getter,M,S,R,L,B));return B?.throwIfAborted(),Up({view:j,origin:{x:C,y:z,z:O},stride:W,position:$.position,attributes:$.attributes??[],compressColors:this._options.compressColorsToUint8,filters:this._filters})}async loadNodeDataWithWorker(M,S,R,L,B,C,z,O,W,$,j){let _=await this._opCounter.wrap(this.loadPointDataViewBuffer(this._getter,M,S));R?.throwIfAborted();let T=_.slice(0);try{return this._opCounter.increment(),await(await s.get()).queue("ReadView",{buffer:T,header:L.header,metadata:B,position:C.position,origin:{x:z,y:O,z:W},include:$,filters:this._filters,eb:L.eb,stride:j,attributes:C.attributes??[],compressColors:this._options.compressColorsToUint8},[T])}finally{this._opCounter.decrement()}}ensureInitialized(){if(!this._data)throw new Error("not initialized");return this._data}async loadPointDataViewBuffer(M,S,R){let{pointDataOffset:L,pointDataLength:B}=S,C=`${this.id}-${L}-${B}`,z=fo.get(C);return z!=null?z.buffer:n.enqueue({id:C,priority:R,request:async()=>{let O=await M(L,L+B);return fo.set(C,O,{size:O.byteLength}),O.buffer}})}async loadPointDataView(M,S,R,L,B,C){let z=await this.loadPointDataViewBuffer(M,R,B);C?.throwIfAborted();let O;if(this._options.enableWorkers){let W=new Uint8Array(z.slice(0));O=await l(W,{pointCount:R.pointCount,pointDataRecordFormat:S.header.pointDataRecordFormat,pointDataRecordLength:S.header.pointDataRecordLength})}else{let W=new Uint8Array(z);O=await r(W,{pointCount:R.pointCount,pointDataRecordFormat:S.header.pointDataRecordFormat,pointDataRecordLength:S.header.pointDataRecordLength})}return C?.throwIfAborted(),Np(O,S.header,S.eb,L)}getMemoryUsage(){}dispose(){s.dispose(),this._data=void 0,this._nodeMap.clear(),this._filters.length=0}}function y(b){return b.isCOPCSource===!0}function v(b,M){return new class extends b{initialize(){return this._initializePromise||(this._initializePromise=Promise.resolve().then(()=>this.initializeOnce()).then(S=>(this._ready=!0,this.dispatchEvent({type:"initialized"}),S))),this._initializePromise}async getNodeData(S){S.signal?.throwIfAborted();try{let R=await super.getNodeData(S);return S.signal?.throwIfAborted(),R}catch(R){throw S.signal?.throwIfAborted(),R}}}(M)}return v(g,e)}function zp(s,e){if(typeof s.prototype.loadNodeData!="function")throw new Error("Missing reviewed PointCloud loading method.");let t=new AbortController,n,i=()=>{t.signal.aborted||(t.abort(new Error("aborted")),n&&(n.frozen=!0))};return n=new class extends s{async loadNodeData(r,l,c){if(t.signal.aborted||l?.aborted)return;let h=new AbortController,u=()=>h.abort(new Error("aborted"));t.signal.addEventListener("abort",u,{once:!0}),l?.addEventListener("abort",u,{once:!0});try{return(t.signal.aborted||l?.aborted)&&u(),await super.loadNodeData(r,h.signal,c)}finally{t.signal.removeEventListener("abort",u),l?.removeEventListener("abort",u)}}clear(){t.signal.aborted||super.clear()}dispose(){try{i()}finally{super.dispose()}}}(e),{entity:n,stop:i}}function cM(s){return zp(Bp,s)}export{Op as createCOPCSource,Ep as createLASSource,cM as createOwnedPointCloud};
3826
3826
  /*! Bundled license information:
3827
3827
 
3828
3828
  three/build/three.core.js: