@file-viewer/renderer-3d 3.3.4 → 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,16 +1,16 @@
1
- var Ag=Object.create;var Kh=Object.defineProperty;var Cg=Object.getOwnPropertyDescriptor;var Pg=Object.getOwnPropertyNames;var Rg=Object.getPrototypeOf,Ig=Object.prototype.hasOwnProperty;var Qh=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var lt=(n,t)=>()=>{try{return t||n((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}};var Lg=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Pg(t))!Ig.call(n,r)&&r!==e&&Kh(n,r,{get:()=>t[r],enumerable:!(i=Cg(t,r))||i.enumerable});return n};var tu=(n,t,e)=>(e=n!=null?Ag(Rg(n)):{},Lg(t||!n||!n.__esModule?Kh(e,"default",{value:n,enumerable:!0}):e,n));var nu=lt(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0})});var iu=lt(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.Hierarchy=void 0;bs.Hierarchy={parse:Ng};function Ng(n){return Object.entries(n).reduce((t,[e,i])=>(i===-1?t.pages[e]={}:i&&(t.nodes[e]={pointCount:i}),t),{nodes:{},pages:{}})}});var su=lt(Tn=>{"use strict";var Dg=Tn&&Tn.__createBinding||(Object.create?(function(n,t,e,i){i===void 0&&(i=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,i,r)}):(function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]})),ru=Tn&&Tn.__exportStar||function(n,t){for(var e in n)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&Dg(t,n,e)};Object.defineProperty(Tn,"__esModule",{value:!0});ru(nu(),Tn);ru(iu(),Tn)});var ws=lt(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.hierarchyItemLength=vi.infoLength=void 0;vi.infoLength=160;vi.hierarchyItemLength=32});var Es=lt(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.evlrHeaderLength=An.vlrHeaderLength=An.minHeaderLength=void 0;An.minHeaderLength=375;An.vlrHeaderLength=54;An.evlrHeaderLength=60});var au=lt(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.getBigUint64=xi.parseBigInt=void 0;function Ug(n){if(n>BigInt(Number.MAX_SAFE_INTEGER)||n<BigInt(-Number.MAX_SAFE_INTEGER))throw new Error(`Cannot convert bigint to number: ${n}`);return Number(n)}xi.parseBigInt=Ug;function Fg(n,t,e){if(n.getBigUint64)return n.getBigUint64(t,e);let[i,r]=e?[4,0]:[0,4],s=BigInt(n.getUint32(t+i,e)),a=BigInt(n.getUint32(t+r,e));return(s<<BigInt(32))+a}xi.getBigUint64=Fg});var lu=lt(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.toCString=Cn.toDataView=Cn.Binary=void 0;Cn.Binary={toDataView:Go,toCString:ou};function Go(n){return new DataView(n.buffer,n.byteOffset,n.length)}Cn.toDataView=Go;function ou(n){let t=Go(n),e="";for(let i=0;i<t.byteLength;++i){let r=t.getInt8(i);if(r===0)return e;e+=String.fromCharCode(r)}return e}Cn.toCString=ou});var du=lt(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.Bounds=void 0;Ts.Bounds={min:Og,max:Bg,mid:zo,width:cu,depth:hu,height:uu,cube:Gg,step:fu,stepTo:zg,intersection:kg};function Og(n){return[n[0],n[1],n[2]]}function Bg(n){return[n[3],n[4],n[5]]}function zo([n,t,e,i,r,s]){return[n+(i-n)/2,t+(r-t)/2,e+(s-e)/2]}function cu(n){return n[3]-n[0]}function hu(n){return n[4]-n[1]}function uu(n){return n[5]-n[2]}function Gg(n){let t=zo(n),e=Math.max(cu(n),hu(n),uu(n))/2;return[t[0]-e,t[1]-e,t[2]-e,t[0]+e,t[1]+e,t[2]+e]}function fu(n,[t,e,i]){let[r,s,a,o,l,c]=n,[h,u,m]=zo(n);return[t?h:r,e?u:s,i?m:a,t?o:h,e?l:u,i?c:m]}function zg(n,[t,e,i,r]){for(let s=t-1;s>=0;--s)n=fu(n,[e>>s&1,i>>s&1,r>>s&1]);return n}function kg(n,t){return[Math.max(n[0],t[0]),Math.max(n[1],t[1]),Math.max(n[2],t[2]),Math.min(n[3],t[3]),Math.min(n[4],t[4]),Math.min(n[5],t[5])]}});var pu=lt(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.Dimension=void 0;var Vg={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}};As.Dimension={Type:Vg,ctype:Hg};function Hg({type:n,size:t}){switch(n){case"signed":switch(t){case 1:return"int8";case 2:return"int16";case 4:return"int32";case 8:return"int64"}case"unsigned":switch(t){case 1:return"uint8";case 2:return"uint16";case 4:return"uint32";case 8:return"uint64"}case"float":switch(t){case 4:return"float";case 8:return"double"}}throw new Error(`Invalid dimension type/size: ${n}/${t}`)}});var gu=lt((Pn,mu)=>{var Cs=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,Ps=(function(){function n(){this.fetch=!1,this.DOMException=Cs.DOMException}return n.prototype=Cs,new n})();(function(n){var t=(function(e){var i=typeof n<"u"&&n||typeof self<"u"&&self||typeof global<"u"&&global||{},r={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function s(M){return M&&DataView.prototype.isPrototypeOf(M)}if(r.arrayBuffer)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(M){return M&&a.indexOf(Object.prototype.toString.call(M))>-1};function l(M){if(typeof M!="string"&&(M=String(M)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(M)||M==="")throw new TypeError('Invalid character in header field name: "'+M+'"');return M.toLowerCase()}function c(M){return typeof M!="string"&&(M=String(M)),M}function h(M){var A={next:function(){var z=M.shift();return{done:z===void 0,value:z}}};return r.iterable&&(A[Symbol.iterator]=function(){return A}),A}function u(M){this.map={},M instanceof u?M.forEach(function(A,z){this.append(z,A)},this):Array.isArray(M)?M.forEach(function(A){if(A.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+A.length);this.append(A[0],A[1])},this):M&&Object.getOwnPropertyNames(M).forEach(function(A){this.append(A,M[A])},this)}u.prototype.append=function(M,A){M=l(M),A=c(A);var z=this.map[M];this.map[M]=z?z+", "+A:A},u.prototype.delete=function(M){delete this.map[l(M)]},u.prototype.get=function(M){return M=l(M),this.has(M)?this.map[M]:null},u.prototype.has=function(M){return this.map.hasOwnProperty(l(M))},u.prototype.set=function(M,A){this.map[l(M)]=c(A)},u.prototype.forEach=function(M,A){for(var z in this.map)this.map.hasOwnProperty(z)&&M.call(A,this.map[z],z,this)},u.prototype.keys=function(){var M=[];return this.forEach(function(A,z){M.push(z)}),h(M)},u.prototype.values=function(){var M=[];return this.forEach(function(A){M.push(A)}),h(M)},u.prototype.entries=function(){var M=[];return this.forEach(function(A,z){M.push([z,A])}),h(M)},r.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);function m(M){if(!M._noBody){if(M.bodyUsed)return Promise.reject(new TypeError("Already read"));M.bodyUsed=!0}}function d(M){return new Promise(function(A,z){M.onload=function(){A(M.result)},M.onerror=function(){z(M.error)}})}function g(M){var A=new FileReader,z=d(A);return A.readAsArrayBuffer(M),z}function y(M){var A=new FileReader,z=d(A),j=/charset=([A-Za-z0-9_-]+)/.exec(M.type),X=j?j[1]:"utf-8";return A.readAsText(M,X),z}function v(M){for(var A=new Uint8Array(M),z=new Array(A.length),j=0;j<A.length;j++)z[j]=String.fromCharCode(A[j]);return z.join("")}function S(M){if(M.slice)return M.slice(0);var A=new Uint8Array(M.byteLength);return A.set(new Uint8Array(M)),A.buffer}function w(){return this.bodyUsed=!1,this._initBody=function(M){this.bodyUsed=this.bodyUsed,this._bodyInit=M,M?typeof M=="string"?this._bodyText=M:r.blob&&Blob.prototype.isPrototypeOf(M)?this._bodyBlob=M:r.formData&&FormData.prototype.isPrototypeOf(M)?this._bodyFormData=M:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(M)?this._bodyText=M.toString():r.arrayBuffer&&r.blob&&s(M)?(this._bodyArrayBuffer=S(M.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(M)||o(M))?this._bodyArrayBuffer=S(M):this._bodyText=M=Object.prototype.toString.call(M):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof M=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(M)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var M=m(this);if(M)return M;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 M=m(this);return M||(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(r.blob)return this.blob().then(g);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var M=m(this);if(M)return M;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(v(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(V)}),this.json=function(){return this.text().then(JSON.parse)},this}var I=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function U(M){var A=M.toUpperCase();return I.indexOf(A)>-1?A:M}function R(M,A){if(!(this instanceof R))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');A=A||{};var z=A.body;if(M instanceof R){if(M.bodyUsed)throw new TypeError("Already read");this.url=M.url,this.credentials=M.credentials,A.headers||(this.headers=new u(M.headers)),this.method=M.method,this.mode=M.mode,this.signal=M.signal,!z&&M._bodyInit!=null&&(z=M._bodyInit,M.bodyUsed=!0)}else this.url=String(M);if(this.credentials=A.credentials||this.credentials||"same-origin",(A.headers||!this.headers)&&(this.headers=new u(A.headers)),this.method=U(A.method||this.method||"GET"),this.mode=A.mode||this.mode||null,this.signal=A.signal||this.signal||(function(){if("AbortController"in i){var J=new AbortController;return J.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&z)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(z),(this.method==="GET"||this.method==="HEAD")&&(A.cache==="no-store"||A.cache==="no-cache")){var j=/([?&])_=[^&]*/;if(j.test(this.url))this.url=this.url.replace(j,"$1_="+new Date().getTime());else{var X=/\?/;this.url+=(X.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}R.prototype.clone=function(){return new R(this,{body:this._bodyInit})};function V(M){var A=new FormData;return M.trim().split("&").forEach(function(z){if(z){var j=z.split("="),X=j.shift().replace(/\+/g," "),J=j.join("=").replace(/\+/g," ");A.append(decodeURIComponent(X),decodeURIComponent(J))}}),A}function B(M){var A=new u,z=M.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(j){return j.indexOf(`
2
- `)===0?j.substr(1,j.length):j}).forEach(function(j){var X=j.split(":"),J=X.shift().trim();if(J){var k=X.join(":").trim();try{A.append(J,k)}catch(It){console.warn("Response "+It.message)}}}),A}w.call(R.prototype);function G(M,A){if(!(this instanceof G))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(A||(A={}),this.type="default",this.status=A.status===void 0?200:A.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=A.statusText===void 0?"":""+A.statusText,this.headers=new u(A.headers),this.url=A.url||"",this._initBody(M)}w.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},G.error=function(){var M=new G(null,{status:200,statusText:""});return M.ok=!1,M.status=0,M.type="error",M};var Y=[301,302,303,307,308];G.redirect=function(M,A){if(Y.indexOf(A)===-1)throw new RangeError("Invalid status code");return new G(null,{status:A,headers:{location:M}})},e.DOMException=i.DOMException;try{new e.DOMException}catch{e.DOMException=function(A,z){this.message=A,this.name=z;var j=Error(A);this.stack=j.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function K(M,A){return new Promise(function(z,j){var X=new R(M,A);if(X.signal&&X.signal.aborted)return j(new e.DOMException("Aborted","AbortError"));var J=new XMLHttpRequest;function k(){J.abort()}J.onload=function(){var ot={statusText:J.statusText,headers:B(J.getAllResponseHeaders()||"")};X.url.indexOf("file://")===0&&(J.status<200||J.status>599)?ot.status=200:ot.status=J.status,ot.url="responseURL"in J?J.responseURL:ot.headers.get("X-Request-URL");var Nt="response"in J?J.response:J.responseText;setTimeout(function(){z(new G(Nt,ot))},0)},J.onerror=function(){setTimeout(function(){j(new TypeError("Network request failed"))},0)},J.ontimeout=function(){setTimeout(function(){j(new TypeError("Network request timed out"))},0)},J.onabort=function(){setTimeout(function(){j(new e.DOMException("Aborted","AbortError"))},0)};function It(ot){try{return ot===""&&i.location.href?i.location.href:ot}catch{return ot}}if(J.open(X.method,It(X.url),!0),X.credentials==="include"?J.withCredentials=!0:X.credentials==="omit"&&(J.withCredentials=!1),"responseType"in J&&(r.blob?J.responseType="blob":r.arrayBuffer&&(J.responseType="arraybuffer")),A&&typeof A.headers=="object"&&!(A.headers instanceof u||i.Headers&&A.headers instanceof i.Headers)){var Kt=[];Object.getOwnPropertyNames(A.headers).forEach(function(ot){Kt.push(l(ot)),J.setRequestHeader(ot,c(A.headers[ot]))}),X.headers.forEach(function(ot,Nt){Kt.indexOf(Nt)===-1&&J.setRequestHeader(Nt,ot)})}else X.headers.forEach(function(ot,Nt){J.setRequestHeader(Nt,ot)});X.signal&&(X.signal.addEventListener("abort",k),J.onreadystatechange=function(){J.readyState===4&&X.signal.removeEventListener("abort",k)}),J.send(typeof X._bodyInit>"u"?null:X._bodyInit)})}return K.polyfill=!0,i.fetch||(i.fetch=K,i.Headers=u,i.Request=R,i.Response=G),e.Headers=u,e.Request=R,e.Response=G,e.fetch=K,Object.defineProperty(e,"__esModule",{value:!0}),e})({})})(Ps);Ps.fetch.ponyfill=!0;delete Ps.fetch.polyfill;var Mi=Cs.fetch?Cs:Ps;Pn=Mi.fetch;Pn.default=Mi.fetch;Pn.fetch=Mi.fetch;Pn.Headers=Mi.Headers;Pn.Request=Mi.Request;Pn.Response=Mi.Response;mu.exports=Pn});var _u=lt(()=>{});var xu=lt(ye=>{"use strict";var Wg=ye&&ye.__createBinding||(Object.create?(function(n,t,e,i){i===void 0&&(i=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,i,r)}):(function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]})),Xg=ye&&ye.__setModuleDefault||(Object.create?(function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}):function(n,t){n.default=t}),qg=ye&&ye.__importStar||function(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e in n)e!=="default"&&Object.prototype.hasOwnProperty.call(n,e)&&Wg(t,n,e);return Xg(t,n),t},Yg=ye&&ye.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ye,"__esModule",{value:!0});ye.Getter=void 0;var jg=Yg(gu());ye.Getter={create:Zg,http:yu,file:vu};function Zg(n){return typeof n=="function"?n:n.startsWith("http://")||n.startsWith("https://")?yu(n):vu(n)}function yu(n){return async function(e,i){if(e<0||i<0||e>i)throw new Error("Invalid range");let s=await(await(0,jg.default)(n,{headers:{Range:`bytes=${e}-${i-1}`}})).arrayBuffer();return new Uint8Array(s)}}function vu(n){return async function(e,i){let r=await Promise.resolve().then(()=>qg(_u()));async function s(a=0,o=1/0){if(a<0||o<0||a>o)throw new Error("Invalid range");await r.promises.access(n);let l=r.createReadStream(n,{start:a,end:o-1,autoClose:!0});return Jg(l)}return s(e,i)}}async function Jg(n){return await new Promise((t,e)=>{let i=[];n.on("data",r=>i.push(r)),n.on("error",e),n.on("end",()=>t(Buffer.concat(i)))})}});var Su=lt(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.Key=void 0;Si.Key={create:$g,parse:Mu,toString:Kg,step:Qg,up:t_,compare:e_,depth:n_};function $g(n,t=0,e=0,i=0){return typeof n!="number"?Mu(n):[n,t,e,i]}function Mu(n){if(typeof n!="string")return n;let[t,e,i,r,...s]=n.split("-").map(o=>parseInt(o,10)),a=[t,e,i,r];if(s.length!==0||a.some(o=>typeof o!="number"||Number.isNaN(o)))throw new Error(`Invalid key: ${n}`);return a}function Kg(n){return typeof n=="string"?n:n.join("-")}function Qg(n,[t,e,i]){let[r,s,a,o]=Si.Key.create(n);return[r+1,s*2+t,a*2+e,o*2+i]}function t_(n,t=1){let[e,i,r,s]=Si.Key.create(n);return[e-t,i>>t,r>>t,s>>t]}function e_(n,t){for(let e=0;e<n.length;++e){if(n[e]<t[e])return-1;if(n[e]>t[e])return 1}return 0}function n_(n){return n[0]}});var bu=lt(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.Scale=void 0;Rs.Scale={apply:(n,t=1,e=0)=>(n-e)/t,unapply:(n,t=1,e=0)=>n*t+e}});var wu=lt(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.Step=void 0;Is.Step={fromIndex:i_,list:r_};function i_(n){if(n<0||n>=8)throw new Error(`Invalid step index: ${n}`);let t=n>>0&1?1:0,e=n>>1&1?1:0,i=n>>2&1?1:0;return[t,e,i]}function r_(){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 ve=lt(bt=>{"use strict";var s_=bt&&bt.__createBinding||(Object.create?(function(n,t,e,i){i===void 0&&(i=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,i,r)}):(function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]})),a_=bt&&bt.__exportStar||function(n,t){for(var e in n)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&s_(t,n,e)};Object.defineProperty(bt,"__esModule",{value:!0});bt.Step=bt.Scale=bt.Key=bt.Getter=bt.Dimension=bt.Bounds=bt.Binary=void 0;a_(au(),bt);var o_=lu();Object.defineProperty(bt,"Binary",{enumerable:!0,get:function(){return o_.Binary}});var l_=du();Object.defineProperty(bt,"Bounds",{enumerable:!0,get:function(){return l_.Bounds}});var c_=pu();Object.defineProperty(bt,"Dimension",{enumerable:!0,get:function(){return c_.Dimension}});var h_=xu();Object.defineProperty(bt,"Getter",{enumerable:!0,get:function(){return h_.Getter}});var u_=Su();Object.defineProperty(bt,"Key",{enumerable:!0,get:function(){return u_.Key}});var f_=bu();Object.defineProperty(bt,"Scale",{enumerable:!0,get:function(){return f_.Scale}});var d_=wu();Object.defineProperty(bt,"Step",{enumerable:!0,get:function(){return d_.Step}})});var ko=lt(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.ExtraBytes=void 0;var Gt=ve();Ns.ExtraBytes={getDimension:p_,parse:m_,parseOne:Eu};var Ls=192;function p_({type:n,length:t}){switch(n){case"signed":case"unsigned":switch(t){case 1:case 2:case 4:case 8:return{type:n,size:t}}case"float":switch(t){case 4:case 8:return{type:n,size:t}}}}function m_(n){if(n.byteLength%Ls!==0)throw new Error(`Invalid extra bytes VLR length: ${n.byteLength}`);let t=[];for(let e=0;e<n.byteLength;e+=Ls)t.push(Eu(n.slice(e,e+Ls)));return t}function Eu(n){if(n.byteLength!==Ls)throw new Error(`Invalid extra bytes entry length: ${n.byteLength}`);let t=Gt.Binary.toDataView(n),e=Gt.Binary.toCString(n.slice(4,36)),i=Gt.Binary.toCString(n.slice(60,192)),r=t.getUint8(2),s=t.getUint8(3);if(r>=11)throw new Error(`Invalid extra bytes "type" value: ${r}`);if(r===0)return{name:e,description:i,length:s};let a=__(s),o=g_(r);if(!o)throw new Error(`Failed to extract dimension type: ${r}`);let{type:l,size:c}=o;function h(m){switch(l){case"signed":return(0,Gt.parseBigInt)(t.getBigInt64(m,!0));case"unsigned":return(0,Gt.parseBigInt)((0,Gt.getBigUint64)(t,m,!0));case"float":return t.getFloat64(m,!0)}}let u={name:e,description:i,type:l,length:c};return a.hasNodata&&(u.nodata=h(40)),a.hasMin&&(u.min=h(64)),a.hasMax&&(u.max=h(88)),a.hasScale&&(u.scale=t.getFloat64(112)),a.hasOffset&&(u.offset=t.getFloat64(136)),u}function g_(n){switch(n){case 1:return Gt.Dimension.Type.uint8;case 2:return Gt.Dimension.Type.int8;case 3:return Gt.Dimension.Type.uint16;case 4:return Gt.Dimension.Type.int16;case 5:return Gt.Dimension.Type.uint32;case 6:return Gt.Dimension.Type.int32;case 7:return Gt.Dimension.Type.uint64;case 8:return Gt.Dimension.Type.int64;case 9:return Gt.Dimension.Type.float32;case 10:return Gt.Dimension.Type.float64}}function __(n){return{hasNodata:!!(n&1),hasMin:!!(n>>1&1),hasMax:!!(n>>2&1),hasScale:!!(n>>3&1),hasOffset:!!(n>>4&1)}}});var Vo=lt(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.Dimensions=void 0;var y_=ve(),v_=ko();Ds.Dimensions={create:M_};var{Type:St}=y_.Dimension,x_={X:St.float64,Y:St.float64,Z:St.float64,Intensity:St.uint16,ReturnNumber:St.uint8,NumberOfReturns:St.uint8,ScanDirectionFlag:St.boolean,EdgeOfFlightLine:St.boolean,Classification:St.uint8,Synthetic:St.boolean,KeyPoint:St.boolean,Withheld:St.boolean,Overlap:St.boolean,ScanAngle:St.float32,UserData:St.uint8,PointSourceId:St.uint16,GpsTime:St.float64,Red:St.uint16,Green:St.uint16,Blue:St.uint16,ScannerChannel:St.uint8,Infrared:St.uint16};function M_(n,t=[]){return Object.keys(n).reduce((e,i)=>{let r=x_[i];if(r)return{...e,[i]:r};let s=t.find(o=>o.name===i),a=s&&v_.ExtraBytes.getDimension(s);if(a)return{...e,[i]:a};throw new Error(`Failed to look up LAS type: ${i}`)},{})}});var Ho=lt(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.Extractor=void 0;var Oe=ve();Fs.Extractor={create:E_};function S_(n){switch(n){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: ${n}`)}}function b_(n,t,{type:e,length:i}){let r=Rn(n);switch(e){case"signed":switch(i){case 1:return(s,a)=>s.getInt8(r(a)+t);case 2:return(s,a)=>s.getInt16(r(a)+t,!0);case 4:return(s,a)=>s.getInt32(r(a)+t,!0);case 8:return(s,a)=>(0,Oe.parseBigInt)(s.getBigInt64(r(a)+t,!0))}case"unsigned":switch(i){case 1:return(s,a)=>s.getUint8(r(a)+t);case 2:return(s,a)=>s.getUint16(r(a)+t,!0);case 4:return(s,a)=>s.getUint32(r(a)+t,!0);case 8:return(s,a)=>(0,Oe.parseBigInt)((0,Oe.getBigUint64)(s,r(a)+t,!0))}case"float":switch(i){case 4:return(s,a)=>s.getFloat32(r(a)+t,!0);case 8:return(s,a)=>s.getFloat64(r(a)+t,!0)}}}function w_(n,t){let i=S_(n.pointDataRecordFormat);return t.reduce((r,s)=>{let a=i;i+=s.length;let o=b_(n,a,s);if(!o)return r;let l=(c,h)=>Oe.Scale.unapply(o(c,h),s.scale,s.offset);return{...r,[s.name]:l}},{})}function E_(n,t=[]){let e=w_(n,t);return{...(()=>{let{pointDataRecordFormat:r}=n;switch(r){case 0:return Us(n);case 1:return T_(n);case 2:return A_(n);case 3:return C_(n);case 6:return Tu(n);case 7:return Au(n);case 8:return P_(n);default:throw new Error(`Unsupported point data record format: ${r}`)}})(),...e}}function Us(n){let{scale:t,offset:e}=n,i=Rn(n);function r(o,l){return o.getUint8(i(l)+14)}function s(o,l){return o.getUint8(i(l)+15)}function a(o,l){return s(o,l)&31}return{X:(o,l)=>Oe.Scale.unapply(o.getInt32(i(l),!0),t[0],e[0]),Y:(o,l)=>Oe.Scale.unapply(o.getInt32(i(l)+4,!0),t[1],e[1]),Z:(o,l)=>Oe.Scale.unapply(o.getInt32(i(l)+8,!0),t[2],e[2]),Intensity:(o,l)=>o.getUint16(i(l)+12,!0),ReturnNumber:(o,l)=>r(o,l)&7,NumberOfReturns:(o,l)=>(r(o,l)&56)>>3,ScanDirectionFlag:(o,l)=>(r(o,l)&64)>>6,EdgeOfFlightLine:(o,l)=>(r(o,l)&128)>>7,Classification:(o,l)=>{let c=a(o,l);return c===12?0:c},Synthetic:(o,l)=>(s(o,l)&32)>>5,KeyPoint:(o,l)=>(s(o,l)&64)>>6,Withheld:(o,l)=>(s(o,l)&128)>>7,Overlap:(o,l)=>a(o,l)===12?1:0,ScanAngle:(o,l)=>o.getInt8(i(l)+16),UserData:(o,l)=>o.getUint8(i(l)+17),PointSourceId:(o,l)=>o.getUint16(i(l)+18,!0)}}function T_(n){let t=Rn(n);return{...Us(n),GpsTime:(e,i)=>e.getFloat64(t(i)+20,!0)}}function A_(n){let t=Rn(n);return{...Us(n),Red:(e,i)=>e.getUint16(t(i)+20,!0),Green:(e,i)=>e.getUint16(t(i)+22,!0),Blue:(e,i)=>e.getUint16(t(i)+24,!0)}}function C_(n){let t=Rn(n);return{...Us(n),GpsTime:(e,i)=>e.getFloat64(t(i)+20,!0),Red:(e,i)=>e.getUint16(t(i)+28,!0),Green:(e,i)=>e.getUint16(t(i)+30,!0),Blue:(e,i)=>e.getUint16(t(i)+32,!0)}}function Tu(n){let{scale:t,offset:e}=n,i=Rn(n);function r(s,a){return s.getUint8(i(a)+15)}return{X:(s,a)=>Oe.Scale.unapply(s.getInt32(i(a),!0),t[0],e[0]),Y:(s,a)=>Oe.Scale.unapply(s.getInt32(i(a)+4,!0),t[1],e[1]),Z:(s,a)=>Oe.Scale.unapply(s.getInt32(i(a)+8,!0),t[2],e[2]),Intensity:(s,a)=>s.getUint16(i(a)+12,!0),ReturnNumber:(s,a)=>s.getUint16(i(a)+14,!0)&15,NumberOfReturns:(s,a)=>(s.getUint16(i(a)+14,!0)&240)>>4,Synthetic:(s,a)=>r(s,a)&1,KeyPoint:(s,a)=>(r(s,a)&2)>>1,Withheld:(s,a)=>(r(s,a)&4)>>2,Overlap:(s,a)=>(r(s,a)&8)>>3,ScannerChannel:(s,a)=>(r(s,a)&48)>>4,ScanDirectionFlag:(s,a)=>(r(s,a)&64)>>6,EdgeOfFlightLine:(s,a)=>(r(s,a)&128)>>7,Classification:(s,a)=>s.getUint8(i(a)+16),UserData:(s,a)=>s.getUint8(i(a)+17),ScanAngle:(s,a)=>s.getInt16(i(a)+18,!0)*.006,PointSourceId:(s,a)=>s.getUint16(i(a)+20,!0),GpsTime:(s,a)=>s.getFloat64(i(a)+22,!0)}}function Au(n){let t=Rn(n);return{...Tu(n),Red:(e,i)=>e.getUint16(t(i)+30,!0),Green:(e,i)=>e.getUint16(t(i)+32,!0),Blue:(e,i)=>e.getUint16(t(i)+34,!0)}}function P_(n){let t=Rn(n);return{...Au(n),Infrared:(e,i)=>e.getUint16(t(i)+36,!0)}}function Rn(n){let{pointDataRecordLength:t}=n;return function(i){return i*t}}});var Pu=lt(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.formatGuid=bi.parsePoint=void 0;var Cu=ve();function R_(n){let t=Cu.Binary.toDataView(n);if(t.byteLength!==24)throw new Error(`Invalid tuple buffer length: ${t.byteLength}`);return[t.getFloat64(0,!0),t.getFloat64(8,!0),t.getFloat64(16,!0)]}bi.parsePoint=R_;function I_(n){let t=Cu.Binary.toDataView(n);if(t.byteLength!==16)throw new Error(`Invalid GUID buffer length: ${t.byteLength}`);let e="";for(let i=0;i<t.byteLength;i+=4){let r=t.getUint32(i,!0);e+=r.toString(16).padStart(8,"0")}return[e.slice(0,8),e.slice(8,12),e.slice(12,16),e.slice(16,32)].join("-")}bi.formatGuid=I_});var Xo=lt(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.Header=void 0;var ee=ve(),Ru=Es(),Wo=Pu();Os.Header={parse:L_};function L_(n){if(n.byteLength<Ru.minHeaderLength)throw new Error(`Invalid header: must be at least ${Ru.minHeaderLength} bytes`);let t=ee.Binary.toDataView(n),e=ee.Binary.toCString(n.slice(0,4));if(e!=="LASF")throw new Error(`Invalid file signature: ${e}`);let i=t.getUint8(24),r=t.getUint8(25);if(i!==1||r!==2&&r!==4)throw new Error(`Invalid version (only 1.2 and 1.4 supported): ${i}.${r}`);let s={fileSignature:e,fileSourceId:t.getUint16(4,!0),globalEncoding:t.getUint16(6,!0),projectId:(0,Wo.formatGuid)(n.slice(8,24)),majorVersion:i,minorVersion:r,systemIdentifier:ee.Binary.toCString(n.slice(26,58)),generatingSoftware:ee.Binary.toCString(n.slice(58,90)),fileCreationDayOfYear:t.getUint16(90,!0),fileCreationYear:t.getUint16(92,!0),headerLength:t.getUint16(94,!0),pointDataOffset:t.getUint32(96,!0),vlrCount:t.getUint32(100,!0),pointDataRecordFormat:t.getUint8(104)&15,pointDataRecordLength:t.getUint16(105,!0),pointCount:t.getUint32(107,!0),pointCountByReturn:D_(n.slice(111,131)),scale:(0,Wo.parsePoint)(n.slice(131,155)),offset:(0,Wo.parsePoint)(n.slice(155,179)),min:[t.getFloat64(187,!0),t.getFloat64(203,!0),t.getFloat64(219,!0)],max:[t.getFloat64(179,!0),t.getFloat64(195,!0),t.getFloat64(211,!0)],waveformDataOffset:0,evlrOffset:0,evlrCount:0};return r==2?s:{...s,pointCount:(0,ee.parseBigInt)((0,ee.getBigUint64)(t,247,!0)),pointCountByReturn:N_(n.slice(255,375)),waveformDataOffset:(0,ee.parseBigInt)((0,ee.getBigUint64)(t,227,!0)),evlrOffset:(0,ee.parseBigInt)((0,ee.getBigUint64)(t,235,!0)),evlrCount:t.getUint32(243,!0)}}function N_(n){let t=ee.Binary.toDataView(n),e=[];for(let i=0;i<120;i+=8)e.push((0,ee.getBigUint64)(t,i,!0));return e.map(i=>(0,ee.parseBigInt)(i))}function D_(n){let t=ee.Binary.toDataView(n),e=[];for(let i=0;i<20;i+=4)e.push(t.getUint32(i,!0));return e}});var Iu=lt((Bs,Yo)=>{var qo=(()=>{var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return(function(t){t=t||{};var e=typeof t<"u"?t:{},i,r;e.ready=new Promise(function(f,p){i=f,r=p}),["_main","___getTypeName","__embind_initialize_bindings","_fflush","onRuntimeInitialized"].forEach(f=>{Object.getOwnPropertyDescriptor(e.ready,f)||Object.defineProperty(e.ready,f,{get:()=>Qt("You are getting "+f+" 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:()=>Qt("You are setting "+f+" 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 s=Object.assign({},e),a=[],o="./this.program",l=(f,p)=>{throw p},c=!0,h=!1,u=!1,m=!1;if(e.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 d="";function g(f){return e.locateFile?e.locateFile(f,d):d+f}var y,v,S,w;function I(f){if(f instanceof Vm)return;let p=f;f&&typeof f=="object"&&f.stack&&(p=[f,f.stack]),R("exiting due to exception: "+p)}if(m){if(typeof process=="object"&&typeof Qh=="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"&&(y=function(p){return read(p)}),S=function(p){let _;return typeof readbuffer=="function"?new Uint8Array(readbuffer(p)):(_=read(p,"binary"),k(typeof _=="object"),_)},v=function(p,_,x){setTimeout(()=>_(S(p)),0)},typeof scriptArgs<"u"?a=scriptArgs:typeof arguments<"u"&&(a=arguments),typeof quit=="function"&&(l=(f,p)=>{I(p),quit(f)}),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)}else if(c||h){if(h?d=self.location.href:typeof document<"u"&&document.currentScript&&(d=document.currentScript.src),n&&(d=n),d.indexOf("blob:")!==0?d=d.substr(0,d.replace(/[?#].*/,"").lastIndexOf("/")+1):d="",!(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?)");y=f=>{var p=new XMLHttpRequest;return p.open("GET",f,!1),p.send(null),p.responseText},h&&(S=f=>{var p=new XMLHttpRequest;return p.open("GET",f,!1),p.responseType="arraybuffer",p.send(null),new Uint8Array(p.response)}),v=(f,p,_)=>{var x=new XMLHttpRequest;x.open("GET",f,!0),x.responseType="arraybuffer",x.onload=()=>{if(x.status==200||x.status==0&&x.response){p(x.response);return}_()},x.onerror=_,x.send(null)},w=f=>document.title=f}else throw new Error("environment detection error");var U=e.print||console.log.bind(console),R=e.printErr||console.warn.bind(console);Object.assign(e,s),s=null,gg(),e.arguments&&(a=e.arguments),B("arguments","arguments_"),e.thisProgram&&(o=e.thisProgram),B("thisProgram","thisProgram"),e.quit&&(l=e.quit),B("quit","quit_"),k(typeof e.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),k(typeof e.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),k(typeof e.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),k(typeof e.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),k(typeof e.read>"u","Module.read option was removed (modify read_ in JS)"),k(typeof e.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),k(typeof e.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),k(typeof e.setWindowTitle>"u","Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),k(typeof e.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),B("read","read_"),B("readAsync","readAsync"),B("readBinary","readBinary"),B("setWindowTitle","setWindowTitle"),k(!h,"worker environment detected but not enabled at build time. Add 'worker' to `-sENVIRONMENT` to enable."),k(!u,"node environment detected but not enabled at build time. Add 'node' to `-sENVIRONMENT` to enable."),k(!m,"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");var V=4;function B(f,p){Object.getOwnPropertyDescriptor(e,f)||Object.defineProperty(e,f,{configurable:!0,get:function(){Qt("Module."+f+" has been replaced with plain "+p+" (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 G(f){Object.getOwnPropertyDescriptor(e,f)&&Qt("`Module."+f+"` was supplied but `"+f+"` not included in INCOMING_MODULE_JS_API")}function Y(f){return f==="FS_createPath"||f==="FS_createDataFile"||f==="FS_createPreloadedFile"||f==="FS_unlink"||f==="addRunDependency"||f==="FS_createLazyFile"||f==="FS_createDevice"||f==="removeRunDependency"}function K(f){typeof globalThis<"u"&&!Object.getOwnPropertyDescriptor(globalThis,f)&&Object.defineProperty(globalThis,f,{configurable:!0,get:function(){var p="`"+f+"` 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";Y(f)&&(p+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),bn(p)}})}function M(f){Object.getOwnPropertyDescriptor(e,f)||Object.defineProperty(e,f,{configurable:!0,get:function(){var p="'"+f+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";Y(f)&&(p+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),Qt(p)}})}var A;e.wasmBinary&&(A=e.wasmBinary),B("wasmBinary","wasmBinary");var z=e.noExitRuntime||!0;B("noExitRuntime","noExitRuntime"),typeof WebAssembly!="object"&&Qt("no native wasm support detected");var j,X=!1,J;function k(f,p){f||Qt("Assertion failed"+(p?": "+p:""))}var It=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Kt(f,p,_){for(var x=p+_,b=p;f[b]&&!(b>=x);)++b;if(b-p>16&&f.buffer&&It)return It.decode(f.subarray(p,b));for(var P="";p<b;){var L=f[p++];if(!(L&128)){P+=String.fromCharCode(L);continue}var E=f[p++]&63;if((L&224)==192){P+=String.fromCharCode((L&31)<<6|E);continue}var O=f[p++]&63;if((L&240)==224?L=(L&15)<<12|E<<6|O:((L&248)!=240&&bn("Invalid UTF-8 leading byte 0x"+L.toString(16)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),L=(L&7)<<18|E<<12|O<<6|f[p++]&63),L<65536)P+=String.fromCharCode(L);else{var H=L-65536;P+=String.fromCharCode(55296|H>>10,56320|H&1023)}}return P}function ot(f,p){return f?Kt(Dt,f,p):""}function Nt(f,p,_,x){if(!(x>0))return 0;for(var b=_,P=_+x-1,L=0;L<f.length;++L){var E=f.charCodeAt(L);if(E>=55296&&E<=57343){var O=f.charCodeAt(++L);E=65536+((E&1023)<<10)|O&1023}if(E<=127){if(_>=P)break;p[_++]=E}else if(E<=2047){if(_+1>=P)break;p[_++]=192|E>>6,p[_++]=128|E&63}else if(E<=65535){if(_+2>=P)break;p[_++]=224|E>>12,p[_++]=128|E>>6&63,p[_++]=128|E&63}else{if(_+3>=P)break;E>1114111&&bn("Invalid Unicode code point 0x"+E.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)."),p[_++]=240|E>>18,p[_++]=128|E>>12&63,p[_++]=128|E>>6&63,p[_++]=128|E&63}}return p[_]=0,_-b}function cr(f,p,_){return k(typeof _=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),Nt(f,Dt,p,_)}function hr(f){for(var p=0,_=0;_<f.length;++_){var x=f.charCodeAt(_);x<=127?p++:x<=2047?p+=2:x>=55296&&x<=57343?(p+=4,++_):p+=3}return p}var $n,ce,Dt,Ze,De,ut,at,fi,di;function Sh(f){$n=f,e.HEAP8=ce=new Int8Array(f),e.HEAP16=Ze=new Int16Array(f),e.HEAP32=ut=new Int32Array(f),e.HEAPU8=Dt=new Uint8Array(f),e.HEAPU16=De=new Uint16Array(f),e.HEAPU32=at=new Uint32Array(f),e.HEAPF32=fi=new Float32Array(f),e.HEAPF64=di=new Float64Array(f)}var vo=65536;e.TOTAL_STACK&&k(vo===e.TOTAL_STACK,"the stack size can no longer be determined at runtime");var xo=e.INITIAL_MEMORY||262144;B("INITIAL_MEMORY","INITIAL_MEMORY"),k(xo>=vo,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+xo+"! (TOTAL_STACK="+vo+")"),k(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,"JS engine does not provide full typed array support"),k(!e.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),k(xo==262144,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var Sn;function Pm(){var f=Bo();k((f&3)==0),at[f>>2]=34821223,at[f+4>>2]=2310721022,at[0]=1668509029}function Mo(){if(!X){var f=Bo(),p=at[f>>2],_=at[f+4>>2];(p!=34821223||_!=2310721022)&&Qt("Stack overflow! Stack cookie has been overwritten at 0x"+f.toString(16)+", expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+_.toString(16)+" 0x"+p.toString(16)),at[0]!==1668509029&&Qt("Runtime error: The application has corrupted its heap memory area (address zero)!")}}(function(){var f=new Int16Array(1),p=new Int8Array(f.buffer);if(f[0]=25459,p[0]!==115||p[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();var bh=[],wh=[],Eh=[],So=!1;function Rm(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Nm(e.preRun.shift());bo(bh)}function Im(){k(!So),So=!0,Mo(),bo(wh)}function Lm(){if(Mo(),e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Um(e.postRun.shift());bo(Eh)}function Nm(f){bh.unshift(f)}function Dm(f){wh.unshift(f)}function Um(f){Eh.unshift(f)}k(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),k(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),k(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),k(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 Kn=0,Qn=null,ur=null,fr={};function Fm(f){Kn++,e.monitorRunDependencies&&e.monitorRunDependencies(Kn),f?(k(!fr[f]),fr[f]=1,Qn===null&&typeof setInterval<"u"&&(Qn=setInterval(function(){if(X){clearInterval(Qn),Qn=null;return}var p=!1;for(var _ in fr)p||(p=!0,R("still waiting on run dependencies:")),R("dependency: "+_);p&&R("(end of list)")},1e4))):R("warning: run dependency added without ID")}function Om(f){if(Kn--,e.monitorRunDependencies&&e.monitorRunDependencies(Kn),f?(k(fr[f]),delete fr[f]):R("warning: run dependency removed without ID"),Kn==0&&(Qn!==null&&(clearInterval(Qn),Qn=null),ur)){var p=ur;ur=null,p()}}function Qt(f){e.onAbort&&e.onAbort(f),f="Aborted("+f+")",R(f),X=!0,J=1;var p=new WebAssembly.RuntimeError(f);throw r(p),p}var ge={error:function(){Qt("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(){ge.error()},createDataFile:function(){ge.error()},createPreloadedFile:function(){ge.error()},createLazyFile:function(){ge.error()},open:function(){ge.error()},mkdev:function(){ge.error()},registerDevice:function(){ge.error()},analyzePath:function(){ge.error()},loadFilesFromDB:function(){ge.error()},ErrnoError:function(){ge.error()}};e.FS_createDataFile=ge.createDataFile,e.FS_createPreloadedFile=ge.createPreloadedFile;var Bm="data:application/octet-stream;base64,";function Th(f){return f.startsWith(Bm)}function Gm(f){return f.startsWith("file://")}function Ut(f,p){return function(){var _=f,x=p;return p||(x=e.asm),k(So,"native function `"+_+"` called before runtime initialization"),x[f]||k(x[f],"exported native function `"+_+"` not found"),x[f].apply(null,arguments)}}var he;he="laz-perf.wasm",Th(he)||(he=g(he));function Ah(f){try{if(f==he&&A)return new Uint8Array(A);if(S)return S(f);throw"both async and sync fetching of the wasm failed"}catch(p){Qt(p)}}function zm(){return!A&&(c||h)&&typeof fetch=="function"?fetch(he,{credentials:"same-origin"}).then(function(f){if(!f.ok)throw"failed to load wasm binary file at '"+he+"'";return f.arrayBuffer()}).catch(function(){return Ah(he)}):Promise.resolve().then(function(){return Ah(he)})}function km(){var f={env:jh,wasi_snapshot_preview1:jh};function p(E,O){var H=E.exports;e.asm=H,j=e.asm.memory,k(j,"memory not found in wasm exports"),Sh(j.buffer),Sn=e.asm.__indirect_function_table,k(Sn,"table not found in wasm exports"),Dm(e.asm.__wasm_call_ctors),Om("wasm-instantiate")}Fm("wasm-instantiate");var _=e;function x(E){k(e===_,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),_=null,p(E.instance)}function b(E){return zm().then(function(O){return WebAssembly.instantiate(O,f)}).then(function(O){return O}).then(E,function(O){R("failed to asynchronously prepare wasm: "+O),Gm(he)&&R("warning: Loading from a file URI ("+he+") 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"),Qt(O)})}function P(){return!A&&typeof WebAssembly.instantiateStreaming=="function"&&!Th(he)&&typeof fetch=="function"?fetch(he,{credentials:"same-origin"}).then(function(E){var O=WebAssembly.instantiateStreaming(E,f);return O.then(x,function(H){return R("wasm streaming compile failed: "+H),R("falling back to ArrayBuffer instantiation"),b(x)})}):b(x)}if(e.instantiateWasm)try{var L=e.instantiateWasm(f,p);return L}catch(E){return R("Module.instantiateWasm callback failed with error: "+E),!1}return P().catch(r),{}}var yT,vT;function Vm(f){this.name="ExitStatus",this.message="Program terminated with exit("+f+")",this.status=f}function bo(f){for(;f.length>0;)f.shift()(e)}function Hm(f){return bn("warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling"),f}function xT(f){var p=/\b_Z[\w\d_]+/g;return f.replace(p,function(_){var x=Hm(_);return _===x?_:x+" ["+_+"]"})}function MT(){var f=new Error;if(!f.stack){try{throw new Error}catch(p){f=p}if(!f.stack)return"(no stack trace available)"}return f.stack.toString()}function bn(f){bn.shown||(bn.shown={}),bn.shown[f]||(bn.shown[f]=1,R(f))}function Ch(f,p){k(f.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),ce.set(f,p)}function Wm(f){return Oo(f+24)+24}function Xm(f){this.excPtr=f,this.ptr=f-24,this.set_type=function(p){at[this.ptr+4>>2]=p},this.get_type=function(){return at[this.ptr+4>>2]},this.set_destructor=function(p){at[this.ptr+8>>2]=p},this.get_destructor=function(){return at[this.ptr+8>>2]},this.set_refcount=function(p){ut[this.ptr>>2]=p},this.set_caught=function(p){p=p?1:0,ce[this.ptr+12>>0]=p},this.get_caught=function(){return ce[this.ptr+12>>0]!=0},this.set_rethrown=function(p){p=p?1:0,ce[this.ptr+13>>0]=p},this.get_rethrown=function(){return ce[this.ptr+13>>0]!=0},this.init=function(p,_){this.set_adjusted_ptr(0),this.set_type(p),this.set_destructor(_),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var p=ut[this.ptr>>2];ut[this.ptr>>2]=p+1},this.release_ref=function(){var p=ut[this.ptr>>2];return ut[this.ptr>>2]=p-1,k(p>0),p===1},this.set_adjusted_ptr=function(p){at[this.ptr+16>>2]=p},this.get_adjusted_ptr=function(){return at[this.ptr+16>>2]},this.get_exception_ptr=function(){var p=bg(this.get_type());if(p)return at[this.excPtr>>2];var _=this.get_adjusted_ptr();return _!==0?_:this.excPtr}}var qm=0,Ym=0;function jm(f,p,_){var x=new Xm(f);throw x.init(p,_),qm=f,Ym++,f+" - Exception catching is disabled, this exception cannot be caught. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch."}function Zm(f,p,_,x,b){}function wo(f){switch(f){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+f)}}function Jm(){for(var f=new Array(256),p=0;p<256;++p)f[p]=String.fromCharCode(p);Ph=f}var Ph=void 0;function _e(f){for(var p="",_=f;Dt[_];)p+=Ph[Dt[_++]];return p}var pi={},mi={},ms={},$m=48,Km=57;function Rh(f){if(f===void 0)return"_unknown";f=f.replace(/[^a-zA-Z0-9_]/g,"$");var p=f.charCodeAt(0);return p>=$m&&p<=Km?"_"+f:f}function Ih(f,p){return f=Rh(f),function(){"use strict";return p.apply(this,arguments)}}function Eo(f,p){var _=Ih(p,function(x){this.name=p,this.message=x;var b=new Error(x).stack;b!==void 0&&(this.stack=this.toString()+`
3
- `+b.replace(/^Error(:[^\n]*)?\n/,""))});return _.prototype=Object.create(f.prototype),_.prototype.constructor=_,_.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},_}var gi=void 0;function ct(f){throw new gi(f)}var Lh=void 0;function gs(f){throw new Lh(f)}function dr(f,p,_){f.forEach(function(E){ms[E]=p});function x(E){var O=_(E);O.length!==f.length&&gs("Mismatched type converter count");for(var H=0;H<f.length;++H)Je(f[H],O[H])}var b=new Array(p.length),P=[],L=0;p.forEach((E,O)=>{mi.hasOwnProperty(E)?b[O]=mi[E]:(P.push(E),pi.hasOwnProperty(E)||(pi[E]=[]),pi[E].push(()=>{b[O]=mi[E],++L,L===P.length&&x(b)}))}),P.length===0&&x(b)}function Je(f,p,_={}){if(!("argPackAdvance"in p))throw new TypeError("registerType registeredInstance requires argPackAdvance");var x=p.name;if(f||ct('type "'+x+'" must have a positive integer typeid pointer'),mi.hasOwnProperty(f)){if(_.ignoreDuplicateRegistrations)return;ct("Cannot register type '"+x+"' twice")}if(mi[f]=p,delete ms[f],pi.hasOwnProperty(f)){var b=pi[f];delete pi[f],b.forEach(P=>P())}}function Qm(f,p,_,x,b){var P=wo(_);p=_e(p),Je(f,{name:p,fromWireType:function(L){return!!L},toWireType:function(L,E){return E?x:b},argPackAdvance:8,readValueFromPointer:function(L){var E;if(_===1)E=ce;else if(_===2)E=Ze;else if(_===4)E=ut;else throw new TypeError("Unknown boolean type size: "+p);return this.fromWireType(E[L>>P])},destructorFunction:null})}function t0(f){if(!(this instanceof wn)||!(f instanceof wn))return!1;for(var p=this.$$.ptrType.registeredClass,_=this.$$.ptr,x=f.$$.ptrType.registeredClass,b=f.$$.ptr;p.baseClass;)_=p.upcast(_),p=p.baseClass;for(;x.baseClass;)b=x.upcast(b),x=x.baseClass;return p===x&&_===b}function e0(f){return{count:f.count,deleteScheduled:f.deleteScheduled,preservePointerOnDelete:f.preservePointerOnDelete,ptr:f.ptr,ptrType:f.ptrType,smartPtr:f.smartPtr,smartPtrType:f.smartPtrType}}function To(f){function p(_){return _.$$.ptrType.registeredClass.name}ct(p(f)+" instance already deleted")}var Ao=!1;function Nh(f){}function n0(f){f.smartPtr?f.smartPtrType.rawDestructor(f.smartPtr):f.ptrType.registeredClass.rawDestructor(f.ptr)}function Dh(f){f.count.value-=1;var p=f.count.value===0;p&&n0(f)}function Uh(f,p,_){if(p===_)return f;if(_.baseClass===void 0)return null;var x=Uh(f,p,_.baseClass);return x===null?null:_.downcast(x)}var Fh={};function i0(){return Object.keys(gr).length}function r0(){var f=[];for(var p in gr)gr.hasOwnProperty(p)&&f.push(gr[p]);return f}var pr=[];function Co(){for(;pr.length;){var f=pr.pop();f.$$.deleteScheduled=!1,f.delete()}}var mr=void 0;function s0(f){mr=f,pr.length&&mr&&mr(Co)}function a0(){e.getInheritedInstanceCount=i0,e.getLiveInheritedInstances=r0,e.flushPendingDeletes=Co,e.setDelayFunction=s0}var gr={};function o0(f,p){for(p===void 0&&ct("ptr should not be undefined");f.baseClass;)p=f.upcast(p),f=f.baseClass;return p}function l0(f,p){return p=o0(f,p),gr[p]}function _s(f,p){(!p.ptrType||!p.ptr)&&gs("makeClassHandle requires ptr and ptrType");var _=!!p.smartPtrType,x=!!p.smartPtr;return _!==x&&gs("Both smartPtrType and smartPtr must be specified"),p.count={value:1},_r(Object.create(f,{$$:{value:p}}))}function Oh(f){var p=this.getPointee(f);if(!p)return this.destructor(f),null;var _=l0(this.registeredClass,p);if(_!==void 0){if(_.$$.count.value===0)return _.$$.ptr=p,_.$$.smartPtr=f,_.clone();var x=_.clone();return this.destructor(f),x}function b(){return this.isSmartPointer?_s(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:p,smartPtrType:this,smartPtr:f}):_s(this.registeredClass.instancePrototype,{ptrType:this,ptr:f})}var P=this.registeredClass.getActualType(p),L=Fh[P];if(!L)return b.call(this);var E;this.isConst?E=L.constPointerType:E=L.pointerType;var O=Uh(p,this.registeredClass,E.registeredClass);return O===null?b.call(this):this.isSmartPointer?_s(E.registeredClass.instancePrototype,{ptrType:E,ptr:O,smartPtrType:this,smartPtr:f}):_s(E.registeredClass.instancePrototype,{ptrType:E,ptr:O})}function _r(f){return typeof FinalizationRegistry>"u"?(_r=p=>p,f):(Ao=new FinalizationRegistry(p=>{console.warn(p.leakWarning.stack.replace(/^Error: /,"")),Dh(p.$$)}),_r=p=>{var _=p.$$,x=!!_.smartPtr;if(x){var b={$$:_},P=_.ptrType.registeredClass;b.leakWarning=new Error("Embind found a leaked C++ instance "+P.name+" <0x"+_.ptr.toString(16)+`>.
1
+ var P_=Object.create;var pu=Object.defineProperty;var R_=Object.getOwnPropertyDescriptor;var I_=Object.getOwnPropertyNames;var N_=Object.getPrototypeOf,L_=Object.prototype.hasOwnProperty;var mu=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var lt=(i,t)=>()=>{try{return t||i((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}};var D_=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of I_(t))!L_.call(i,r)&&r!==e&&pu(i,r,{get:()=>t[r],enumerable:!(n=R_(t,r))||n.enumerable});return i};var gu=(i,t,e)=>(e=i!=null?P_(N_(i)):{},D_(t||!i||!i.__esModule?pu(e,"default",{value:i,enumerable:!0}):e,i));var yu=lt(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0})});var vu=lt(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.Hierarchy=void 0;Ts.Hierarchy={parse:O_};function O_(i){return Object.entries(i).reduce((t,[e,n])=>(n===-1?t.pages[e]={}:n&&(t.nodes[e]={pointCount:n}),t),{nodes:{},pages:{}})}});var Mu=lt(wi=>{"use strict";var U_=wi&&wi.__createBinding||(Object.create?(function(i,t,e,n){n===void 0&&(n=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,r)}):(function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]})),xu=wi&&wi.__exportStar||function(i,t){for(var e in i)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&U_(t,i,e)};Object.defineProperty(wi,"__esModule",{value:!0});xu(yu(),wi);xu(vu(),wi)});var As=lt(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.hierarchyItemLength=wn.infoLength=void 0;wn.infoLength=160;wn.hierarchyItemLength=32});var Cs=lt(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.evlrHeaderLength=Ti.vlrHeaderLength=Ti.minHeaderLength=void 0;Ti.minHeaderLength=375;Ti.vlrHeaderLength=54;Ti.evlrHeaderLength=60});var Su=lt(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.getBigUint64=Tn.parseBigInt=void 0;function F_(i){if(i>BigInt(Number.MAX_SAFE_INTEGER)||i<BigInt(-Number.MAX_SAFE_INTEGER))throw new Error(`Cannot convert bigint to number: ${i}`);return Number(i)}Tn.parseBigInt=F_;function B_(i,t,e){if(i.getBigUint64)return i.getBigUint64(t,e);let[n,r]=e?[4,0]:[0,4],s=BigInt(i.getUint32(t+n,e)),a=BigInt(i.getUint32(t+r,e));return(s<<BigInt(32))+a}Tn.getBigUint64=B_});var Eu=lt(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.toCString=Ai.toDataView=Ai.Binary=void 0;Ai.Binary={toDataView:Zo,toCString:bu};function Zo(i){return new DataView(i.buffer,i.byteOffset,i.length)}Ai.toDataView=Zo;function bu(i){let t=Zo(i),e="";for(let n=0;n<t.byteLength;++n){let r=t.getInt8(n);if(r===0)return e;e+=String.fromCharCode(r)}return e}Ai.toCString=bu});var Pu=lt(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.Bounds=void 0;Ps.Bounds={min:G_,max:z_,mid:Jo,width:wu,depth:Tu,height:Au,cube:k_,step:Cu,stepTo:V_,intersection:H_};function G_(i){return[i[0],i[1],i[2]]}function z_(i){return[i[3],i[4],i[5]]}function Jo([i,t,e,n,r,s]){return[i+(n-i)/2,t+(r-t)/2,e+(s-e)/2]}function wu(i){return i[3]-i[0]}function Tu(i){return i[4]-i[1]}function Au(i){return i[5]-i[2]}function k_(i){let t=Jo(i),e=Math.max(wu(i),Tu(i),Au(i))/2;return[t[0]-e,t[1]-e,t[2]-e,t[0]+e,t[1]+e,t[2]+e]}function Cu(i,[t,e,n]){let[r,s,a,o,l,c]=i,[h,u,p]=Jo(i);return[t?h:r,e?u:s,n?p:a,t?o:h,e?l:u,n?c:p]}function V_(i,[t,e,n,r]){for(let s=t-1;s>=0;--s)i=Cu(i,[e>>s&1,n>>s&1,r>>s&1]);return i}function H_(i,t){return[Math.max(i[0],t[0]),Math.max(i[1],t[1]),Math.max(i[2],t[2]),Math.min(i[3],t[3]),Math.min(i[4],t[4]),Math.min(i[5],t[5])]}});var Ru=lt(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.Dimension=void 0;var W_={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}};Rs.Dimension={Type:W_,ctype:X_};function X_({type:i,size:t}){switch(i){case"signed":switch(t){case 1:return"int8";case 2:return"int16";case 4:return"int32";case 8:return"int64"}case"unsigned":switch(t){case 1:return"uint8";case 2:return"uint16";case 4:return"uint32";case 8:return"uint64"}case"float":switch(t){case 4:return"float";case 8:return"double"}}throw new Error(`Invalid dimension type/size: ${i}/${t}`)}});var Nu=lt((Ci,Iu)=>{var Is=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,Ns=(function(){function i(){this.fetch=!1,this.DOMException=Is.DOMException}return i.prototype=Is,new i})();(function(i){var t=(function(e){var n=typeof i<"u"&&i||typeof self<"u"&&self||typeof global<"u"&&global||{},r={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 s(S){return S&&DataView.prototype.isPrototypeOf(S)}if(r.arrayBuffer)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(S){return S&&a.indexOf(Object.prototype.toString.call(S))>-1};function l(S){if(typeof S!="string"&&(S=String(S)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(S)||S==="")throw new TypeError('Invalid character in header field name: "'+S+'"');return S.toLowerCase()}function c(S){return typeof S!="string"&&(S=String(S)),S}function h(S){var T={next:function(){var H=S.shift();return{done:H===void 0,value:H}}};return r.iterable&&(T[Symbol.iterator]=function(){return T}),T}function u(S){this.map={},S instanceof u?S.forEach(function(T,H){this.append(H,T)},this):Array.isArray(S)?S.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):S&&Object.getOwnPropertyNames(S).forEach(function(T){this.append(T,S[T])},this)}u.prototype.append=function(S,T){S=l(S),T=c(T);var H=this.map[S];this.map[S]=H?H+", "+T:T},u.prototype.delete=function(S){delete this.map[l(S)]},u.prototype.get=function(S){return S=l(S),this.has(S)?this.map[S]:null},u.prototype.has=function(S){return this.map.hasOwnProperty(l(S))},u.prototype.set=function(S,T){this.map[l(S)]=c(T)},u.prototype.forEach=function(S,T){for(var H in this.map)this.map.hasOwnProperty(H)&&S.call(T,this.map[H],H,this)},u.prototype.keys=function(){var S=[];return this.forEach(function(T,H){S.push(H)}),h(S)},u.prototype.values=function(){var S=[];return this.forEach(function(T){S.push(T)}),h(S)},u.prototype.entries=function(){var S=[];return this.forEach(function(T,H){S.push([H,T])}),h(S)},r.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);function p(S){if(!S._noBody){if(S.bodyUsed)return Promise.reject(new TypeError("Already read"));S.bodyUsed=!0}}function d(S){return new Promise(function(T,H){S.onload=function(){T(S.result)},S.onerror=function(){H(S.error)}})}function _(S){var T=new FileReader,H=d(T);return T.readAsArrayBuffer(S),H}function g(S){var T=new FileReader,H=d(T),q=/charset=([A-Za-z0-9_-]+)/.exec(S.type),Y=q?q[1]:"utf-8";return T.readAsText(S,Y),H}function v(S){for(var T=new Uint8Array(S),H=new Array(T.length),q=0;q<T.length;q++)H[q]=String.fromCharCode(T[q]);return H.join("")}function x(S){if(S.slice)return S.slice(0);var T=new Uint8Array(S.byteLength);return T.set(new Uint8Array(S)),T.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(S){this.bodyUsed=this.bodyUsed,this._bodyInit=S,S?typeof S=="string"?this._bodyText=S:r.blob&&Blob.prototype.isPrototypeOf(S)?this._bodyBlob=S:r.formData&&FormData.prototype.isPrototypeOf(S)?this._bodyFormData=S:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)?this._bodyText=S.toString():r.arrayBuffer&&r.blob&&s(S)?(this._bodyArrayBuffer=x(S.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(S)||o(S))?this._bodyArrayBuffer=x(S):this._bodyText=S=Object.prototype.toString.call(S):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof S=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var S=p(this);if(S)return S;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 S=p(this);return S||(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(r.blob)return this.blob().then(_);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var S=p(this);if(S)return S;if(this._bodyBlob)return g(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(v(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(G)}),this.json=function(){return this.text().then(JSON.parse)},this}var A=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function P(S){var T=S.toUpperCase();return A.indexOf(T)>-1?T:S}function N(S,T){if(!(this instanceof N))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');T=T||{};var H=T.body;if(S instanceof N){if(S.bodyUsed)throw new TypeError("Already read");this.url=S.url,this.credentials=S.credentials,T.headers||(this.headers=new u(S.headers)),this.method=S.method,this.mode=S.mode,this.signal=S.signal,!H&&S._bodyInit!=null&&(H=S._bodyInit,S.bodyUsed=!0)}else this.url=String(S);if(this.credentials=T.credentials||this.credentials||"same-origin",(T.headers||!this.headers)&&(this.headers=new u(T.headers)),this.method=P(T.method||this.method||"GET"),this.mode=T.mode||this.mode||null,this.signal=T.signal||this.signal||(function(){if("AbortController"in n){var $=new AbortController;return $.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&H)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(H),(this.method==="GET"||this.method==="HEAD")&&(T.cache==="no-store"||T.cache==="no-cache")){var q=/([?&])_=[^&]*/;if(q.test(this.url))this.url=this.url.replace(q,"$1_="+new Date().getTime());else{var Y=/\?/;this.url+=(Y.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function G(S){var T=new FormData;return S.trim().split("&").forEach(function(H){if(H){var q=H.split("="),Y=q.shift().replace(/\+/g," "),$=q.join("=").replace(/\+/g," ");T.append(decodeURIComponent(Y),decodeURIComponent($))}}),T}function B(S){var T=new u,H=S.replace(/\r?\n[\t ]+/g," ");return H.split("\r").map(function(q){return q.indexOf(`
2
+ `)===0?q.substr(1,q.length):q}).forEach(function(q){var Y=q.split(":"),$=Y.shift().trim();if($){var z=Y.join(":").trim();try{T.append($,z)}catch(Nt){console.warn("Response "+Nt.message)}}}),T}b.call(N.prototype);function X(S,T){if(!(this instanceof X))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 u(T.headers),this.url=T.url||"",this._initBody(S)}b.call(X.prototype),X.prototype.clone=function(){return new X(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},X.error=function(){var S=new X(null,{status:200,statusText:""});return S.ok=!1,S.status=0,S.type="error",S};var k=[301,302,303,307,308];X.redirect=function(S,T){if(k.indexOf(T)===-1)throw new RangeError("Invalid status code");return new X(null,{status:T,headers:{location:S}})},e.DOMException=n.DOMException;try{new e.DOMException}catch{e.DOMException=function(T,H){this.message=T,this.name=H;var q=Error(T);this.stack=q.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function Z(S,T){return new Promise(function(H,q){var Y=new N(S,T);if(Y.signal&&Y.signal.aborted)return q(new e.DOMException("Aborted","AbortError"));var $=new XMLHttpRequest;function z(){$.abort()}$.onload=function(){var ot={statusText:$.statusText,headers:B($.getAllResponseHeaders()||"")};Y.url.indexOf("file://")===0&&($.status<200||$.status>599)?ot.status=200:ot.status=$.status,ot.url="responseURL"in $?$.responseURL:ot.headers.get("X-Request-URL");var Dt="response"in $?$.response:$.responseText;setTimeout(function(){H(new X(Dt,ot))},0)},$.onerror=function(){setTimeout(function(){q(new TypeError("Network request failed"))},0)},$.ontimeout=function(){setTimeout(function(){q(new TypeError("Network request timed out"))},0)},$.onabort=function(){setTimeout(function(){q(new e.DOMException("Aborted","AbortError"))},0)};function Nt(ot){try{return ot===""&&n.location.href?n.location.href:ot}catch{return ot}}if($.open(Y.method,Nt(Y.url),!0),Y.credentials==="include"?$.withCredentials=!0:Y.credentials==="omit"&&($.withCredentials=!1),"responseType"in $&&(r.blob?$.responseType="blob":r.arrayBuffer&&($.responseType="arraybuffer")),T&&typeof T.headers=="object"&&!(T.headers instanceof u||n.Headers&&T.headers instanceof n.Headers)){var te=[];Object.getOwnPropertyNames(T.headers).forEach(function(ot){te.push(l(ot)),$.setRequestHeader(ot,c(T.headers[ot]))}),Y.headers.forEach(function(ot,Dt){te.indexOf(Dt)===-1&&$.setRequestHeader(Dt,ot)})}else Y.headers.forEach(function(ot,Dt){$.setRequestHeader(Dt,ot)});Y.signal&&(Y.signal.addEventListener("abort",z),$.onreadystatechange=function(){$.readyState===4&&Y.signal.removeEventListener("abort",z)}),$.send(typeof Y._bodyInit>"u"?null:Y._bodyInit)})}return Z.polyfill=!0,n.fetch||(n.fetch=Z,n.Headers=u,n.Request=N,n.Response=X),e.Headers=u,e.Request=N,e.Response=X,e.fetch=Z,Object.defineProperty(e,"__esModule",{value:!0}),e})({})})(Ns);Ns.fetch.ponyfill=!0;delete Ns.fetch.polyfill;var An=Is.fetch?Is:Ns;Ci=An.fetch;Ci.default=An.fetch;Ci.fetch=An.fetch;Ci.Headers=An.Headers;Ci.Request=An.Request;Ci.Response=An.Response;Iu.exports=Ci});var Lu=lt(()=>{});var Uu=lt(ye=>{"use strict";var q_=ye&&ye.__createBinding||(Object.create?(function(i,t,e,n){n===void 0&&(n=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,r)}):(function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]})),Y_=ye&&ye.__setModuleDefault||(Object.create?(function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}):function(i,t){i.default=t}),j_=ye&&ye.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var e in i)e!=="default"&&Object.prototype.hasOwnProperty.call(i,e)&&q_(t,i,e);return Y_(t,i),t},Z_=ye&&ye.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ye,"__esModule",{value:!0});ye.Getter=void 0;var J_=Z_(Nu());ye.Getter={create:$_,http:Du,file:Ou};function $_(i){return typeof i=="function"?i:i.startsWith("http://")||i.startsWith("https://")?Du(i):Ou(i)}function Du(i){return async function(e,n){if(e<0||n<0||e>n)throw new Error("Invalid range");let s=await(await(0,J_.default)(i,{headers:{Range:`bytes=${e}-${n-1}`}})).arrayBuffer();return new Uint8Array(s)}}function Ou(i){return async function(e,n){let r=await Promise.resolve().then(()=>j_(Lu()));async function s(a=0,o=1/0){if(a<0||o<0||a>o)throw new Error("Invalid range");await r.promises.access(i);let l=r.createReadStream(i,{start:a,end:o-1,autoClose:!0});return K_(l)}return s(e,n)}}async function K_(i){return await new Promise((t,e)=>{let n=[];i.on("data",r=>n.push(r)),i.on("error",e),i.on("end",()=>t(Buffer.concat(n)))})}});var Bu=lt(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.Key=void 0;Cn.Key={create:Q_,parse:Fu,toString:ty,step:ey,up:iy,compare:ny,depth:ry};function Q_(i,t=0,e=0,n=0){return typeof i!="number"?Fu(i):[i,t,e,n]}function Fu(i){if(typeof i!="string")return i;let[t,e,n,r,...s]=i.split("-").map(o=>parseInt(o,10)),a=[t,e,n,r];if(s.length!==0||a.some(o=>typeof o!="number"||Number.isNaN(o)))throw new Error(`Invalid key: ${i}`);return a}function ty(i){return typeof i=="string"?i:i.join("-")}function ey(i,[t,e,n]){let[r,s,a,o]=Cn.Key.create(i);return[r+1,s*2+t,a*2+e,o*2+n]}function iy(i,t=1){let[e,n,r,s]=Cn.Key.create(i);return[e-t,n>>t,r>>t,s>>t]}function ny(i,t){for(let e=0;e<i.length;++e){if(i[e]<t[e])return-1;if(i[e]>t[e])return 1}return 0}function ry(i){return i[0]}});var Gu=lt(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.Scale=void 0;Ls.Scale={apply:(i,t=1,e=0)=>(i-e)/t,unapply:(i,t=1,e=0)=>i*t+e}});var zu=lt(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.Step=void 0;Ds.Step={fromIndex:sy,list:ay};function sy(i){if(i<0||i>=8)throw new Error(`Invalid step index: ${i}`);let t=i>>0&1?1:0,e=i>>1&1?1:0,n=i>>2&1?1:0;return[t,e,n]}function ay(){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 ve=lt(Et=>{"use strict";var oy=Et&&Et.__createBinding||(Object.create?(function(i,t,e,n){n===void 0&&(n=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,r)}):(function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]})),ly=Et&&Et.__exportStar||function(i,t){for(var e in i)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&oy(t,i,e)};Object.defineProperty(Et,"__esModule",{value:!0});Et.Step=Et.Scale=Et.Key=Et.Getter=Et.Dimension=Et.Bounds=Et.Binary=void 0;ly(Su(),Et);var cy=Eu();Object.defineProperty(Et,"Binary",{enumerable:!0,get:function(){return cy.Binary}});var hy=Pu();Object.defineProperty(Et,"Bounds",{enumerable:!0,get:function(){return hy.Bounds}});var uy=Ru();Object.defineProperty(Et,"Dimension",{enumerable:!0,get:function(){return uy.Dimension}});var fy=Uu();Object.defineProperty(Et,"Getter",{enumerable:!0,get:function(){return fy.Getter}});var dy=Bu();Object.defineProperty(Et,"Key",{enumerable:!0,get:function(){return dy.Key}});var py=Gu();Object.defineProperty(Et,"Scale",{enumerable:!0,get:function(){return py.Scale}});var my=zu();Object.defineProperty(Et,"Step",{enumerable:!0,get:function(){return my.Step}})});var $o=lt(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.ExtraBytes=void 0;var zt=ve();Us.ExtraBytes={getDimension:gy,parse:_y,parseOne:ku};var Os=192;function gy({type:i,length:t}){switch(i){case"signed":case"unsigned":switch(t){case 1:case 2:case 4:case 8:return{type:i,size:t}}case"float":switch(t){case 4:case 8:return{type:i,size:t}}}}function _y(i){if(i.byteLength%Os!==0)throw new Error(`Invalid extra bytes VLR length: ${i.byteLength}`);let t=[];for(let e=0;e<i.byteLength;e+=Os)t.push(ku(i.slice(e,e+Os)));return t}function ku(i){if(i.byteLength!==Os)throw new Error(`Invalid extra bytes entry length: ${i.byteLength}`);let t=zt.Binary.toDataView(i),e=zt.Binary.toCString(i.slice(4,36)),n=zt.Binary.toCString(i.slice(60,192)),r=t.getUint8(2),s=t.getUint8(3);if(r>=11)throw new Error(`Invalid extra bytes "type" value: ${r}`);if(r===0)return{name:e,description:n,length:s};let a=vy(s),o=yy(r);if(!o)throw new Error(`Failed to extract dimension type: ${r}`);let{type:l,size:c}=o;function h(p){switch(l){case"signed":return(0,zt.parseBigInt)(t.getBigInt64(p,!0));case"unsigned":return(0,zt.parseBigInt)((0,zt.getBigUint64)(t,p,!0));case"float":return t.getFloat64(p,!0)}}let u={name:e,description:n,type:l,length:c};return a.hasNodata&&(u.nodata=h(40)),a.hasMin&&(u.min=h(64)),a.hasMax&&(u.max=h(88)),a.hasScale&&(u.scale=t.getFloat64(112)),a.hasOffset&&(u.offset=t.getFloat64(136)),u}function yy(i){switch(i){case 1:return zt.Dimension.Type.uint8;case 2:return zt.Dimension.Type.int8;case 3:return zt.Dimension.Type.uint16;case 4:return zt.Dimension.Type.int16;case 5:return zt.Dimension.Type.uint32;case 6:return zt.Dimension.Type.int32;case 7:return zt.Dimension.Type.uint64;case 8:return zt.Dimension.Type.int64;case 9:return zt.Dimension.Type.float32;case 10:return zt.Dimension.Type.float64}}function vy(i){return{hasNodata:!!(i&1),hasMin:!!(i>>1&1),hasMax:!!(i>>2&1),hasScale:!!(i>>3&1),hasOffset:!!(i>>4&1)}}});var Ko=lt(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.Dimensions=void 0;var xy=ve(),My=$o();Fs.Dimensions={create:by};var{Type:bt}=xy.Dimension,Sy={X:bt.float64,Y:bt.float64,Z:bt.float64,Intensity:bt.uint16,ReturnNumber:bt.uint8,NumberOfReturns:bt.uint8,ScanDirectionFlag:bt.boolean,EdgeOfFlightLine:bt.boolean,Classification:bt.uint8,Synthetic:bt.boolean,KeyPoint:bt.boolean,Withheld:bt.boolean,Overlap:bt.boolean,ScanAngle:bt.float32,UserData:bt.uint8,PointSourceId:bt.uint16,GpsTime:bt.float64,Red:bt.uint16,Green:bt.uint16,Blue:bt.uint16,ScannerChannel:bt.uint8,Infrared:bt.uint16};function by(i,t=[]){return Object.keys(i).reduce((e,n)=>{let r=Sy[n];if(r)return{...e,[n]:r};let s=t.find(o=>o.name===n),a=s&&My.ExtraBytes.getDimension(s);if(a)return{...e,[n]:a};throw new Error(`Failed to look up LAS type: ${n}`)},{})}});var Qo=lt(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.Extractor=void 0;var Ge=ve();Gs.Extractor={create:Ay};function Ey(i){switch(i){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: ${i}`)}}function wy(i,t,{type:e,length:n}){let r=Pi(i);switch(e){case"signed":switch(n){case 1:return(s,a)=>s.getInt8(r(a)+t);case 2:return(s,a)=>s.getInt16(r(a)+t,!0);case 4:return(s,a)=>s.getInt32(r(a)+t,!0);case 8:return(s,a)=>(0,Ge.parseBigInt)(s.getBigInt64(r(a)+t,!0))}case"unsigned":switch(n){case 1:return(s,a)=>s.getUint8(r(a)+t);case 2:return(s,a)=>s.getUint16(r(a)+t,!0);case 4:return(s,a)=>s.getUint32(r(a)+t,!0);case 8:return(s,a)=>(0,Ge.parseBigInt)((0,Ge.getBigUint64)(s,r(a)+t,!0))}case"float":switch(n){case 4:return(s,a)=>s.getFloat32(r(a)+t,!0);case 8:return(s,a)=>s.getFloat64(r(a)+t,!0)}}}function Ty(i,t){let n=Ey(i.pointDataRecordFormat);return t.reduce((r,s)=>{let a=n;n+=s.length;let o=wy(i,a,s);if(!o)return r;let l=(c,h)=>Ge.Scale.unapply(o(c,h),s.scale,s.offset);return{...r,[s.name]:l}},{})}function Ay(i,t=[]){let e=Ty(i,t);return{...(()=>{let{pointDataRecordFormat:r}=i;switch(r){case 0:return Bs(i);case 1:return Cy(i);case 2:return Py(i);case 3:return Ry(i);case 6:return Vu(i);case 7:return Hu(i);case 8:return Iy(i);default:throw new Error(`Unsupported point data record format: ${r}`)}})(),...e}}function Bs(i){let{scale:t,offset:e}=i,n=Pi(i);function r(o,l){return o.getUint8(n(l)+14)}function s(o,l){return o.getUint8(n(l)+15)}function a(o,l){return s(o,l)&31}return{X:(o,l)=>Ge.Scale.unapply(o.getInt32(n(l),!0),t[0],e[0]),Y:(o,l)=>Ge.Scale.unapply(o.getInt32(n(l)+4,!0),t[1],e[1]),Z:(o,l)=>Ge.Scale.unapply(o.getInt32(n(l)+8,!0),t[2],e[2]),Intensity:(o,l)=>o.getUint16(n(l)+12,!0),ReturnNumber:(o,l)=>r(o,l)&7,NumberOfReturns:(o,l)=>(r(o,l)&56)>>3,ScanDirectionFlag:(o,l)=>(r(o,l)&64)>>6,EdgeOfFlightLine:(o,l)=>(r(o,l)&128)>>7,Classification:(o,l)=>{let c=a(o,l);return c===12?0:c},Synthetic:(o,l)=>(s(o,l)&32)>>5,KeyPoint:(o,l)=>(s(o,l)&64)>>6,Withheld:(o,l)=>(s(o,l)&128)>>7,Overlap:(o,l)=>a(o,l)===12?1:0,ScanAngle:(o,l)=>o.getInt8(n(l)+16),UserData:(o,l)=>o.getUint8(n(l)+17),PointSourceId:(o,l)=>o.getUint16(n(l)+18,!0)}}function Cy(i){let t=Pi(i);return{...Bs(i),GpsTime:(e,n)=>e.getFloat64(t(n)+20,!0)}}function Py(i){let t=Pi(i);return{...Bs(i),Red:(e,n)=>e.getUint16(t(n)+20,!0),Green:(e,n)=>e.getUint16(t(n)+22,!0),Blue:(e,n)=>e.getUint16(t(n)+24,!0)}}function Ry(i){let t=Pi(i);return{...Bs(i),GpsTime:(e,n)=>e.getFloat64(t(n)+20,!0),Red:(e,n)=>e.getUint16(t(n)+28,!0),Green:(e,n)=>e.getUint16(t(n)+30,!0),Blue:(e,n)=>e.getUint16(t(n)+32,!0)}}function Vu(i){let{scale:t,offset:e}=i,n=Pi(i);function r(s,a){return s.getUint8(n(a)+15)}return{X:(s,a)=>Ge.Scale.unapply(s.getInt32(n(a),!0),t[0],e[0]),Y:(s,a)=>Ge.Scale.unapply(s.getInt32(n(a)+4,!0),t[1],e[1]),Z:(s,a)=>Ge.Scale.unapply(s.getInt32(n(a)+8,!0),t[2],e[2]),Intensity:(s,a)=>s.getUint16(n(a)+12,!0),ReturnNumber:(s,a)=>s.getUint16(n(a)+14,!0)&15,NumberOfReturns:(s,a)=>(s.getUint16(n(a)+14,!0)&240)>>4,Synthetic:(s,a)=>r(s,a)&1,KeyPoint:(s,a)=>(r(s,a)&2)>>1,Withheld:(s,a)=>(r(s,a)&4)>>2,Overlap:(s,a)=>(r(s,a)&8)>>3,ScannerChannel:(s,a)=>(r(s,a)&48)>>4,ScanDirectionFlag:(s,a)=>(r(s,a)&64)>>6,EdgeOfFlightLine:(s,a)=>(r(s,a)&128)>>7,Classification:(s,a)=>s.getUint8(n(a)+16),UserData:(s,a)=>s.getUint8(n(a)+17),ScanAngle:(s,a)=>s.getInt16(n(a)+18,!0)*.006,PointSourceId:(s,a)=>s.getUint16(n(a)+20,!0),GpsTime:(s,a)=>s.getFloat64(n(a)+22,!0)}}function Hu(i){let t=Pi(i);return{...Vu(i),Red:(e,n)=>e.getUint16(t(n)+30,!0),Green:(e,n)=>e.getUint16(t(n)+32,!0),Blue:(e,n)=>e.getUint16(t(n)+34,!0)}}function Iy(i){let t=Pi(i);return{...Hu(i),Infrared:(e,n)=>e.getUint16(t(n)+36,!0)}}function Pi(i){let{pointDataRecordLength:t}=i;return function(n){return n*t}}});var Xu=lt(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.formatGuid=Pn.parsePoint=void 0;var Wu=ve();function Ny(i){let t=Wu.Binary.toDataView(i);if(t.byteLength!==24)throw new Error(`Invalid tuple buffer length: ${t.byteLength}`);return[t.getFloat64(0,!0),t.getFloat64(8,!0),t.getFloat64(16,!0)]}Pn.parsePoint=Ny;function Ly(i){let t=Wu.Binary.toDataView(i);if(t.byteLength!==16)throw new Error(`Invalid GUID buffer length: ${t.byteLength}`);let e="";for(let n=0;n<t.byteLength;n+=4){let r=t.getUint32(n,!0);e+=r.toString(16).padStart(8,"0")}return[e.slice(0,8),e.slice(8,12),e.slice(12,16),e.slice(16,32)].join("-")}Pn.formatGuid=Ly});var el=lt(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.Header=void 0;var ne=ve(),qu=Cs(),tl=Xu();zs.Header={parse:Dy};function Dy(i){if(i.byteLength<qu.minHeaderLength)throw new Error(`Invalid header: must be at least ${qu.minHeaderLength} bytes`);let t=ne.Binary.toDataView(i),e=ne.Binary.toCString(i.slice(0,4));if(e!=="LASF")throw new Error(`Invalid file signature: ${e}`);let n=t.getUint8(24),r=t.getUint8(25);if(n!==1||r!==2&&r!==4)throw new Error(`Invalid version (only 1.2 and 1.4 supported): ${n}.${r}`);let s={fileSignature:e,fileSourceId:t.getUint16(4,!0),globalEncoding:t.getUint16(6,!0),projectId:(0,tl.formatGuid)(i.slice(8,24)),majorVersion:n,minorVersion:r,systemIdentifier:ne.Binary.toCString(i.slice(26,58)),generatingSoftware:ne.Binary.toCString(i.slice(58,90)),fileCreationDayOfYear:t.getUint16(90,!0),fileCreationYear:t.getUint16(92,!0),headerLength:t.getUint16(94,!0),pointDataOffset:t.getUint32(96,!0),vlrCount:t.getUint32(100,!0),pointDataRecordFormat:t.getUint8(104)&15,pointDataRecordLength:t.getUint16(105,!0),pointCount:t.getUint32(107,!0),pointCountByReturn:Uy(i.slice(111,131)),scale:(0,tl.parsePoint)(i.slice(131,155)),offset:(0,tl.parsePoint)(i.slice(155,179)),min:[t.getFloat64(187,!0),t.getFloat64(203,!0),t.getFloat64(219,!0)],max:[t.getFloat64(179,!0),t.getFloat64(195,!0),t.getFloat64(211,!0)],waveformDataOffset:0,evlrOffset:0,evlrCount:0};return r==2?s:{...s,pointCount:(0,ne.parseBigInt)((0,ne.getBigUint64)(t,247,!0)),pointCountByReturn:Oy(i.slice(255,375)),waveformDataOffset:(0,ne.parseBigInt)((0,ne.getBigUint64)(t,227,!0)),evlrOffset:(0,ne.parseBigInt)((0,ne.getBigUint64)(t,235,!0)),evlrCount:t.getUint32(243,!0)}}function Oy(i){let t=ne.Binary.toDataView(i),e=[];for(let n=0;n<120;n+=8)e.push((0,ne.getBigUint64)(t,n,!0));return e.map(n=>(0,ne.parseBigInt)(n))}function Uy(i){let t=ne.Binary.toDataView(i),e=[];for(let n=0;n<20;n+=4)e.push(t.getUint32(n,!0));return e}});var Yu=lt((ks,nl)=>{var il=(()=>{var i=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return(function(t){t=t||{};var e=typeof t<"u"?t:{},n,r;e.ready=new Promise(function(f,m){n=f,r=m}),["_main","___getTypeName","__embind_initialize_bindings","_fflush","onRuntimeInitialized"].forEach(f=>{Object.getOwnPropertyDescriptor(e.ready,f)||Object.defineProperty(e.ready,f,{get:()=>ee("You are getting "+f+" 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:()=>ee("You are setting "+f+" 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 s=Object.assign({},e),a=[],o="./this.program",l=(f,m)=>{throw m},c=!0,h=!1,u=!1,p=!1;if(e.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 d="";function _(f){return e.locateFile?e.locateFile(f,d):d+f}var g,v,x,b;function A(f){if(f instanceof W0)return;let m=f;f&&typeof f=="object"&&f.stack&&(m=[f,f.stack]),N("exiting due to exception: "+m)}if(p){if(typeof process=="object"&&typeof mu=="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"&&(g=function(m){return read(m)}),x=function(m){let y;return typeof readbuffer=="function"?new Uint8Array(readbuffer(m)):(y=read(m,"binary"),z(typeof y=="object"),y)},v=function(m,y,M){setTimeout(()=>y(x(m)),0)},typeof scriptArgs<"u"?a=scriptArgs:typeof arguments<"u"&&(a=arguments),typeof quit=="function"&&(l=(f,m)=>{A(m),quit(f)}),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)}else if(c||h){if(h?d=self.location.href:typeof document<"u"&&document.currentScript&&(d=document.currentScript.src),i&&(d=i),d.indexOf("blob:")!==0?d=d.substr(0,d.replace(/[?#].*/,"").lastIndexOf("/")+1):d="",!(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?)");g=f=>{var m=new XMLHttpRequest;return m.open("GET",f,!1),m.send(null),m.responseText},h&&(x=f=>{var m=new XMLHttpRequest;return m.open("GET",f,!1),m.responseType="arraybuffer",m.send(null),new Uint8Array(m.response)}),v=(f,m,y)=>{var M=new XMLHttpRequest;M.open("GET",f,!0),M.responseType="arraybuffer",M.onload=()=>{if(M.status==200||M.status==0&&M.response){m(M.response);return}y()},M.onerror=y,M.send(null)},b=f=>document.title=f}else throw new Error("environment detection error");var P=e.print||console.log.bind(console),N=e.printErr||console.warn.bind(console);Object.assign(e,s),s=null,y_(),e.arguments&&(a=e.arguments),B("arguments","arguments_"),e.thisProgram&&(o=e.thisProgram),B("thisProgram","thisProgram"),e.quit&&(l=e.quit),B("quit","quit_"),z(typeof e.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),z(typeof e.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),z(typeof e.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),z(typeof e.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),z(typeof e.read>"u","Module.read option was removed (modify read_ in JS)"),z(typeof e.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),z(typeof e.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),z(typeof e.setWindowTitle>"u","Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),z(typeof e.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),B("read","read_"),B("readAsync","readAsync"),B("readBinary","readBinary"),B("setWindowTitle","setWindowTitle"),z(!h,"worker environment detected but not enabled at build time. Add 'worker' to `-sENVIRONMENT` to enable."),z(!u,"node environment detected but not enabled at build time. Add 'node' to `-sENVIRONMENT` to enable."),z(!p,"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");var G=4;function B(f,m){Object.getOwnPropertyDescriptor(e,f)||Object.defineProperty(e,f,{configurable:!0,get:function(){ee("Module."+f+" has been replaced with plain "+m+" (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 X(f){Object.getOwnPropertyDescriptor(e,f)&&ee("`Module."+f+"` was supplied but `"+f+"` not included in INCOMING_MODULE_JS_API")}function k(f){return f==="FS_createPath"||f==="FS_createDataFile"||f==="FS_createPreloadedFile"||f==="FS_unlink"||f==="addRunDependency"||f==="FS_createLazyFile"||f==="FS_createDevice"||f==="removeRunDependency"}function Z(f){typeof globalThis<"u"&&!Object.getOwnPropertyDescriptor(globalThis,f)&&Object.defineProperty(globalThis,f,{configurable:!0,get:function(){var m="`"+f+"` 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";k(f)&&(m+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),Si(m)}})}function S(f){Object.getOwnPropertyDescriptor(e,f)||Object.defineProperty(e,f,{configurable:!0,get:function(){var m="'"+f+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";k(f)&&(m+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),ee(m)}})}var T;e.wasmBinary&&(T=e.wasmBinary),B("wasmBinary","wasmBinary");var H=e.noExitRuntime||!0;B("noExitRuntime","noExitRuntime"),typeof WebAssembly!="object"&&ee("no native wasm support detected");var q,Y=!1,$;function z(f,m){f||ee("Assertion failed"+(m?": "+m:""))}var Nt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function te(f,m,y){for(var M=m+y,E=m;f[E]&&!(E>=M);)++E;if(E-m>16&&f.buffer&&Nt)return Nt.decode(f.subarray(m,E));for(var L="";m<E;){var O=f[m++];if(!(O&128)){L+=String.fromCharCode(O);continue}var C=f[m++]&63;if((O&224)==192){L+=String.fromCharCode((O&31)<<6|C);continue}var F=f[m++]&63;if((O&240)==224?O=(O&15)<<12|C<<6|F:((O&248)!=240&&Si("Invalid UTF-8 leading byte 0x"+O.toString(16)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),O=(O&7)<<18|C<<12|F<<6|f[m++]&63),O<65536)L+=String.fromCharCode(O);else{var V=O-65536;L+=String.fromCharCode(55296|V>>10,56320|V&1023)}}return L}function ot(f,m){return f?te(Ot,f,m):""}function Dt(f,m,y,M){if(!(M>0))return 0;for(var E=y,L=y+M-1,O=0;O<f.length;++O){var C=f.charCodeAt(O);if(C>=55296&&C<=57343){var F=f.charCodeAt(++O);C=65536+((C&1023)<<10)|F&1023}if(C<=127){if(y>=L)break;m[y++]=C}else if(C<=2047){if(y+1>=L)break;m[y++]=192|C>>6,m[y++]=128|C&63}else if(C<=65535){if(y+2>=L)break;m[y++]=224|C>>12,m[y++]=128|C>>6&63,m[y++]=128|C&63}else{if(y+3>=L)break;C>1114111&&Si("Invalid Unicode code point 0x"+C.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)."),m[y++]=240|C>>18,m[y++]=128|C>>12&63,m[y++]=128|C>>6&63,m[y++]=128|C&63}}return m[y]=0,y-E}function hr(f,m,y){return z(typeof y=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),Dt(f,Ot,m,y)}function ur(f){for(var m=0,y=0;y<f.length;++y){var M=f.charCodeAt(y);M<=127?m++:M<=2047?m+=2:M>=55296&&M<=57343?(m+=4,++y):m+=3}return m}var Ki,ce,Ot,Ze,Ue,ft,at,yn,vn;function Bh(f){Ki=f,e.HEAP8=ce=new Int8Array(f),e.HEAP16=Ze=new Int16Array(f),e.HEAP32=ft=new Int32Array(f),e.HEAPU8=Ot=new Uint8Array(f),e.HEAPU16=Ue=new Uint16Array(f),e.HEAPU32=at=new Uint32Array(f),e.HEAPF32=yn=new Float32Array(f),e.HEAPF64=vn=new Float64Array(f)}var Po=65536;e.TOTAL_STACK&&z(Po===e.TOTAL_STACK,"the stack size can no longer be determined at runtime");var Ro=e.INITIAL_MEMORY||262144;B("INITIAL_MEMORY","INITIAL_MEMORY"),z(Ro>=Po,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+Ro+"! (TOTAL_STACK="+Po+")"),z(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,"JS engine does not provide full typed array support"),z(!e.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),z(Ro==262144,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var Mi;function I0(){var f=jo();z((f&3)==0),at[f>>2]=34821223,at[f+4>>2]=2310721022,at[0]=1668509029}function Io(){if(!Y){var f=jo(),m=at[f>>2],y=at[f+4>>2];(m!=34821223||y!=2310721022)&&ee("Stack overflow! Stack cookie has been overwritten at 0x"+f.toString(16)+", expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+y.toString(16)+" 0x"+m.toString(16)),at[0]!==1668509029&&ee("Runtime error: The application has corrupted its heap memory area (address zero)!")}}(function(){var f=new Int16Array(1),m=new Int8Array(f.buffer);if(f[0]=25459,m[0]!==115||m[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();var Gh=[],zh=[],kh=[],No=!1;function N0(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)O0(e.preRun.shift());Lo(Gh)}function L0(){z(!No),No=!0,Io(),Lo(zh)}function D0(){if(Io(),e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)F0(e.postRun.shift());Lo(kh)}function O0(f){Gh.unshift(f)}function U0(f){zh.unshift(f)}function F0(f){kh.unshift(f)}z(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),z(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),z(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),z(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 Qi=0,tn=null,fr=null,dr={};function B0(f){Qi++,e.monitorRunDependencies&&e.monitorRunDependencies(Qi),f?(z(!dr[f]),dr[f]=1,tn===null&&typeof setInterval<"u"&&(tn=setInterval(function(){if(Y){clearInterval(tn),tn=null;return}var m=!1;for(var y in dr)m||(m=!0,N("still waiting on run dependencies:")),N("dependency: "+y);m&&N("(end of list)")},1e4))):N("warning: run dependency added without ID")}function G0(f){if(Qi--,e.monitorRunDependencies&&e.monitorRunDependencies(Qi),f?(z(dr[f]),delete dr[f]):N("warning: run dependency removed without ID"),Qi==0&&(tn!==null&&(clearInterval(tn),tn=null),fr)){var m=fr;fr=null,m()}}function ee(f){e.onAbort&&e.onAbort(f),f="Aborted("+f+")",N(f),Y=!0,$=1;var m=new WebAssembly.RuntimeError(f);throw r(m),m}var ge={error:function(){ee("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(){ge.error()},createDataFile:function(){ge.error()},createPreloadedFile:function(){ge.error()},createLazyFile:function(){ge.error()},open:function(){ge.error()},mkdev:function(){ge.error()},registerDevice:function(){ge.error()},analyzePath:function(){ge.error()},loadFilesFromDB:function(){ge.error()},ErrnoError:function(){ge.error()}};e.FS_createDataFile=ge.createDataFile,e.FS_createPreloadedFile=ge.createPreloadedFile;var z0="data:application/octet-stream;base64,";function Vh(f){return f.startsWith(z0)}function k0(f){return f.startsWith("file://")}function Ut(f,m){return function(){var y=f,M=m;return m||(M=e.asm),z(No,"native function `"+y+"` called before runtime initialization"),M[f]||z(M[f],"exported native function `"+y+"` not found"),M[f].apply(null,arguments)}}var he;he="laz-perf.wasm",Vh(he)||(he=_(he));function Hh(f){try{if(f==he&&T)return new Uint8Array(T);if(x)return x(f);throw"both async and sync fetching of the wasm failed"}catch(m){ee(m)}}function V0(){return!T&&(c||h)&&typeof fetch=="function"?fetch(he,{credentials:"same-origin"}).then(function(f){if(!f.ok)throw"failed to load wasm binary file at '"+he+"'";return f.arrayBuffer()}).catch(function(){return Hh(he)}):Promise.resolve().then(function(){return Hh(he)})}function H0(){var f={env:hu,wasi_snapshot_preview1:hu};function m(C,F){var V=C.exports;e.asm=V,q=e.asm.memory,z(q,"memory not found in wasm exports"),Bh(q.buffer),Mi=e.asm.__indirect_function_table,z(Mi,"table not found in wasm exports"),U0(e.asm.__wasm_call_ctors),G0("wasm-instantiate")}B0("wasm-instantiate");var y=e;function M(C){z(e===y,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),y=null,m(C.instance)}function E(C){return V0().then(function(F){return WebAssembly.instantiate(F,f)}).then(function(F){return F}).then(C,function(F){N("failed to asynchronously prepare wasm: "+F),k0(he)&&N("warning: Loading from a file URI ("+he+") 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"),ee(F)})}function L(){return!T&&typeof WebAssembly.instantiateStreaming=="function"&&!Vh(he)&&typeof fetch=="function"?fetch(he,{credentials:"same-origin"}).then(function(C){var F=WebAssembly.instantiateStreaming(C,f);return F.then(M,function(V){return N("wasm streaming compile failed: "+V),N("falling back to ArrayBuffer instantiation"),E(M)})}):E(M)}if(e.instantiateWasm)try{var O=e.instantiateWasm(f,m);return O}catch(C){return N("Module.instantiateWasm callback failed with error: "+C),!1}return L().catch(r),{}}var WA,XA;function W0(f){this.name="ExitStatus",this.message="Program terminated with exit("+f+")",this.status=f}function Lo(f){for(;f.length>0;)f.shift()(e)}function X0(f){return Si("warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling"),f}function qA(f){var m=/\b_Z[\w\d_]+/g;return f.replace(m,function(y){var M=X0(y);return y===M?y:M+" ["+y+"]"})}function YA(){var f=new Error;if(!f.stack){try{throw new Error}catch(m){f=m}if(!f.stack)return"(no stack trace available)"}return f.stack.toString()}function Si(f){Si.shown||(Si.shown={}),Si.shown[f]||(Si.shown[f]=1,N(f))}function Wh(f,m){z(f.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),ce.set(f,m)}function q0(f){return Yo(f+24)+24}function Y0(f){this.excPtr=f,this.ptr=f-24,this.set_type=function(m){at[this.ptr+4>>2]=m},this.get_type=function(){return at[this.ptr+4>>2]},this.set_destructor=function(m){at[this.ptr+8>>2]=m},this.get_destructor=function(){return at[this.ptr+8>>2]},this.set_refcount=function(m){ft[this.ptr>>2]=m},this.set_caught=function(m){m=m?1:0,ce[this.ptr+12>>0]=m},this.get_caught=function(){return ce[this.ptr+12>>0]!=0},this.set_rethrown=function(m){m=m?1:0,ce[this.ptr+13>>0]=m},this.get_rethrown=function(){return ce[this.ptr+13>>0]!=0},this.init=function(m,y){this.set_adjusted_ptr(0),this.set_type(m),this.set_destructor(y),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var m=ft[this.ptr>>2];ft[this.ptr>>2]=m+1},this.release_ref=function(){var m=ft[this.ptr>>2];return ft[this.ptr>>2]=m-1,z(m>0),m===1},this.set_adjusted_ptr=function(m){at[this.ptr+16>>2]=m},this.get_adjusted_ptr=function(){return at[this.ptr+16>>2]},this.get_exception_ptr=function(){var m=w_(this.get_type());if(m)return at[this.excPtr>>2];var y=this.get_adjusted_ptr();return y!==0?y:this.excPtr}}var j0=0,Z0=0;function J0(f,m,y){var M=new Y0(f);throw M.init(m,y),j0=f,Z0++,f+" - Exception catching is disabled, this exception cannot be caught. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch."}function $0(f,m,y,M,E){}function Do(f){switch(f){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+f)}}function K0(){for(var f=new Array(256),m=0;m<256;++m)f[m]=String.fromCharCode(m);Xh=f}var Xh=void 0;function _e(f){for(var m="",y=f;Ot[y];)m+=Xh[Ot[y++]];return m}var xn={},Mn={},ys={},Q0=48,tg=57;function qh(f){if(f===void 0)return"_unknown";f=f.replace(/[^a-zA-Z0-9_]/g,"$");var m=f.charCodeAt(0);return m>=Q0&&m<=tg?"_"+f:f}function Yh(f,m){return f=qh(f),function(){"use strict";return m.apply(this,arguments)}}function Oo(f,m){var y=Yh(m,function(M){this.name=m,this.message=M;var E=new Error(M).stack;E!==void 0&&(this.stack=this.toString()+`
3
+ `+E.replace(/^Error(:[^\n]*)?\n/,""))});return y.prototype=Object.create(f.prototype),y.prototype.constructor=y,y.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},y}var Sn=void 0;function ct(f){throw new Sn(f)}var jh=void 0;function vs(f){throw new jh(f)}function pr(f,m,y){f.forEach(function(C){ys[C]=m});function M(C){var F=y(C);F.length!==f.length&&vs("Mismatched type converter count");for(var V=0;V<f.length;++V)Je(f[V],F[V])}var E=new Array(m.length),L=[],O=0;m.forEach((C,F)=>{Mn.hasOwnProperty(C)?E[F]=Mn[C]:(L.push(C),xn.hasOwnProperty(C)||(xn[C]=[]),xn[C].push(()=>{E[F]=Mn[C],++O,O===L.length&&M(E)}))}),L.length===0&&M(E)}function Je(f,m,y={}){if(!("argPackAdvance"in m))throw new TypeError("registerType registeredInstance requires argPackAdvance");var M=m.name;if(f||ct('type "'+M+'" must have a positive integer typeid pointer'),Mn.hasOwnProperty(f)){if(y.ignoreDuplicateRegistrations)return;ct("Cannot register type '"+M+"' twice")}if(Mn[f]=m,delete ys[f],xn.hasOwnProperty(f)){var E=xn[f];delete xn[f],E.forEach(L=>L())}}function eg(f,m,y,M,E){var L=Do(y);m=_e(m),Je(f,{name:m,fromWireType:function(O){return!!O},toWireType:function(O,C){return C?M:E},argPackAdvance:8,readValueFromPointer:function(O){var C;if(y===1)C=ce;else if(y===2)C=Ze;else if(y===4)C=ft;else throw new TypeError("Unknown boolean type size: "+m);return this.fromWireType(C[O>>L])},destructorFunction:null})}function ig(f){if(!(this instanceof bi)||!(f instanceof bi))return!1;for(var m=this.$$.ptrType.registeredClass,y=this.$$.ptr,M=f.$$.ptrType.registeredClass,E=f.$$.ptr;m.baseClass;)y=m.upcast(y),m=m.baseClass;for(;M.baseClass;)E=M.upcast(E),M=M.baseClass;return m===M&&y===E}function ng(f){return{count:f.count,deleteScheduled:f.deleteScheduled,preservePointerOnDelete:f.preservePointerOnDelete,ptr:f.ptr,ptrType:f.ptrType,smartPtr:f.smartPtr,smartPtrType:f.smartPtrType}}function Uo(f){function m(y){return y.$$.ptrType.registeredClass.name}ct(m(f)+" instance already deleted")}var Fo=!1;function Zh(f){}function rg(f){f.smartPtr?f.smartPtrType.rawDestructor(f.smartPtr):f.ptrType.registeredClass.rawDestructor(f.ptr)}function Jh(f){f.count.value-=1;var m=f.count.value===0;m&&rg(f)}function $h(f,m,y){if(m===y)return f;if(y.baseClass===void 0)return null;var M=$h(f,m,y.baseClass);return M===null?null:y.downcast(M)}var Kh={};function sg(){return Object.keys(_r).length}function ag(){var f=[];for(var m in _r)_r.hasOwnProperty(m)&&f.push(_r[m]);return f}var mr=[];function Bo(){for(;mr.length;){var f=mr.pop();f.$$.deleteScheduled=!1,f.delete()}}var gr=void 0;function og(f){gr=f,mr.length&&gr&&gr(Bo)}function lg(){e.getInheritedInstanceCount=sg,e.getLiveInheritedInstances=ag,e.flushPendingDeletes=Bo,e.setDelayFunction=og}var _r={};function cg(f,m){for(m===void 0&&ct("ptr should not be undefined");f.baseClass;)m=f.upcast(m),f=f.baseClass;return m}function hg(f,m){return m=cg(f,m),_r[m]}function xs(f,m){(!m.ptrType||!m.ptr)&&vs("makeClassHandle requires ptr and ptrType");var y=!!m.smartPtrType,M=!!m.smartPtr;return y!==M&&vs("Both smartPtrType and smartPtr must be specified"),m.count={value:1},yr(Object.create(f,{$$:{value:m}}))}function Qh(f){var m=this.getPointee(f);if(!m)return this.destructor(f),null;var y=hg(this.registeredClass,m);if(y!==void 0){if(y.$$.count.value===0)return y.$$.ptr=m,y.$$.smartPtr=f,y.clone();var M=y.clone();return this.destructor(f),M}function E(){return this.isSmartPointer?xs(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:m,smartPtrType:this,smartPtr:f}):xs(this.registeredClass.instancePrototype,{ptrType:this,ptr:f})}var L=this.registeredClass.getActualType(m),O=Kh[L];if(!O)return E.call(this);var C;this.isConst?C=O.constPointerType:C=O.pointerType;var F=$h(m,this.registeredClass,C.registeredClass);return F===null?E.call(this):this.isSmartPointer?xs(C.registeredClass.instancePrototype,{ptrType:C,ptr:F,smartPtrType:this,smartPtr:f}):xs(C.registeredClass.instancePrototype,{ptrType:C,ptr:F})}function yr(f){return typeof FinalizationRegistry>"u"?(yr=m=>m,f):(Fo=new FinalizationRegistry(m=>{console.warn(m.leakWarning.stack.replace(/^Error: /,"")),Jh(m.$$)}),yr=m=>{var y=m.$$,M=!!y.smartPtr;if(M){var E={$$:y},L=y.ptrType.registeredClass;E.leakWarning=new Error("Embind found a leaked C++ instance "+L.name+" <0x"+y.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(b.leakWarning,Oh),Ao.register(p,b,p)}return p},Nh=p=>Ao.unregister(p),_r(f))}function c0(){if(this.$$.ptr||To(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var f=_r(Object.create(Object.getPrototypeOf(this),{$$:{value:e0(this.$$)}}));return f.$$.count.value+=1,f.$$.deleteScheduled=!1,f}function h0(){this.$$.ptr||To(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ct("Object already scheduled for deletion"),Nh(this),Dh(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function u0(){return!this.$$.ptr}function f0(){return this.$$.ptr||To(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ct("Object already scheduled for deletion"),pr.push(this),pr.length===1&&mr&&mr(Co),this.$$.deleteScheduled=!0,this}function d0(){wn.prototype.isAliasOf=t0,wn.prototype.clone=c0,wn.prototype.delete=h0,wn.prototype.isDeleted=u0,wn.prototype.deleteLater=f0}function wn(){}function Bh(f,p,_){if(f[p].overloadTable===void 0){var x=f[p];f[p]=function(){return f[p].overloadTable.hasOwnProperty(arguments.length)||ct("Function '"+_+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+f[p].overloadTable+")!"),f[p].overloadTable[arguments.length].apply(this,arguments)},f[p].overloadTable=[],f[p].overloadTable[x.argCount]=x}}function p0(f,p,_){e.hasOwnProperty(f)?((_===void 0||e[f].overloadTable!==void 0&&e[f].overloadTable[_]!==void 0)&&ct("Cannot register public name '"+f+"' twice"),Bh(e,f,f),e.hasOwnProperty(_)&&ct("Cannot register multiple overloads of a function with the same number of arguments ("+_+")!"),e[f].overloadTable[_]=p):(e[f]=p,_!==void 0&&(e[f].numArguments=_))}function m0(f,p,_,x,b,P,L,E){this.name=f,this.constructor=p,this.instancePrototype=_,this.rawDestructor=x,this.baseClass=b,this.getActualType=P,this.upcast=L,this.downcast=E,this.pureVirtualFunctions=[]}function Po(f,p,_){for(;p!==_;)p.upcast||ct("Expected null or instance of "+_.name+", got an instance of "+p.name),f=p.upcast(f),p=p.baseClass;return f}function g0(f,p){if(p===null)return this.isReference&&ct("null is not a valid "+this.name),0;p.$$||ct('Cannot pass "'+yi(p)+'" as a '+this.name),p.$$.ptr||ct("Cannot pass deleted object as a pointer of type "+this.name);var _=p.$$.ptrType.registeredClass,x=Po(p.$$.ptr,_,this.registeredClass);return x}function _0(f,p){var _;if(p===null)return this.isReference&&ct("null is not a valid "+this.name),this.isSmartPointer?(_=this.rawConstructor(),f!==null&&f.push(this.rawDestructor,_),_):0;p.$$||ct('Cannot pass "'+yi(p)+'" as a '+this.name),p.$$.ptr||ct("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&p.$$.ptrType.isConst&&ct("Cannot convert argument of type "+(p.$$.smartPtrType?p.$$.smartPtrType.name:p.$$.ptrType.name)+" to parameter type "+this.name);var x=p.$$.ptrType.registeredClass;if(_=Po(p.$$.ptr,x,this.registeredClass),this.isSmartPointer)switch(p.$$.smartPtr===void 0&&ct("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:p.$$.smartPtrType===this?_=p.$$.smartPtr:ct("Cannot convert argument of type "+(p.$$.smartPtrType?p.$$.smartPtrType.name:p.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:_=p.$$.smartPtr;break;case 2:if(p.$$.smartPtrType===this)_=p.$$.smartPtr;else{var b=p.clone();_=this.rawShare(_,Lo.toHandle(function(){b.delete()})),f!==null&&f.push(this.rawDestructor,_)}break;default:ct("Unsupporting sharing policy")}return _}function y0(f,p){if(p===null)return this.isReference&&ct("null is not a valid "+this.name),0;p.$$||ct('Cannot pass "'+yi(p)+'" as a '+this.name),p.$$.ptr||ct("Cannot pass deleted object as a pointer of type "+this.name),p.$$.ptrType.isConst&&ct("Cannot convert argument of type "+p.$$.ptrType.name+" to parameter type "+this.name);var _=p.$$.ptrType.registeredClass,x=Po(p.$$.ptr,_,this.registeredClass);return x}function ys(f){return this.fromWireType(ut[f>>2])}function v0(f){return this.rawGetPointee&&(f=this.rawGetPointee(f)),f}function x0(f){this.rawDestructor&&this.rawDestructor(f)}function M0(f){f!==null&&f.delete()}function S0(){$e.prototype.getPointee=v0,$e.prototype.destructor=x0,$e.prototype.argPackAdvance=8,$e.prototype.readValueFromPointer=ys,$e.prototype.deleteObject=M0,$e.prototype.fromWireType=Oh}function $e(f,p,_,x,b,P,L,E,O,H,Z){this.name=f,this.registeredClass=p,this.isReference=_,this.isConst=x,this.isSmartPointer=b,this.pointeeType=P,this.sharingPolicy=L,this.rawGetPointee=E,this.rawConstructor=O,this.rawShare=H,this.rawDestructor=Z,!b&&p.baseClass===void 0?x?(this.toWireType=g0,this.destructorFunction=null):(this.toWireType=y0,this.destructorFunction=null):this.toWireType=_0}function b0(f,p,_){e.hasOwnProperty(f)||gs("Replacing nonexistant public symbol"),e[f].overloadTable!==void 0&&_!==void 0?e[f].overloadTable[_]=p:(e[f]=p,e[f].argCount=_)}function w0(f,p,_){k("dynCall_"+f in e,"bad function pointer type - no table for sig '"+f+"'"),_&&_.length?k(_.length===f.substring(1).replace(/j/g,"--").length):k(f.length==1);var x=e["dynCall_"+f];return _&&_.length?x.apply(null,[p].concat(_)):x.call(null,p)}var yr=[];function vs(f){var p=yr[f];return p||(f>=yr.length&&(yr.length=f+1),yr[f]=p=Sn.get(f)),k(Sn.get(f)==p,"JavaScript-side Wasm function table mirror is out of date!"),p}function E0(f,p,_){if(f.includes("j"))return w0(f,p,_);k(vs(p),"missing table entry in dynCall: "+p);var x=vs(p).apply(null,_);return x}function T0(f,p){k(f.includes("j")||f.includes("p"),"getDynCaller should only be called with i64 sigs");var _=[];return function(){return _.length=0,Object.assign(_,arguments),E0(f,p,_)}}function _i(f,p){f=_e(f);function _(){return f.includes("j")?T0(f,p):vs(p)}var x=_();return typeof x!="function"&&ct("unknown function pointer with signature "+f+": "+p),x}var Gh=void 0;function A0(f){var p=_g(f),_=_e(p);return En(p),_}function Ro(f,p){var _=[],x={};function b(P){if(!x[P]&&!mi[P]){if(ms[P]){ms[P].forEach(b);return}_.push(P),x[P]=!0}}throw p.forEach(b),new Gh(f+": "+_.map(A0).join([", "]))}function C0(f,p,_,x,b,P,L,E,O,H,Z,Q,$){Z=_e(Z),P=_i(b,P),E&&(E=_i(L,E)),H&&(H=_i(O,H)),$=_i(Q,$);var yt=Rh(Z);p0(yt,function(){Ro("Cannot construct "+Z+" due to unbound types",[x])}),dr([f,p,_],x?[x]:[],function(ht){ht=ht[0];var pt,te;x?(pt=ht.registeredClass,te=pt.instancePrototype):te=wn.prototype;var Fe=Ih(yt,function(){if(Object.getPrototypeOf(this)!==F)throw new gi("Use 'new' to construct "+Z);if(q.constructor_body===void 0)throw new gi(Z+" has no accessible constructor");var Ss=q.constructor_body[arguments.length];if(Ss===void 0)throw new gi("Tried to invoke ctor of "+Z+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(q.constructor_body).toString()+") parameters instead!");return Ss.apply(this,arguments)}),F=Object.create(te,{constructor:{value:Fe}});Fe.prototype=F;var q=new m0(Z,Fe,F,$,pt,P,E,H),Bt=new $e(Z,q,!0,!1,!1),Ft=new $e(Z+"*",q,!1,!1,!1),ti=new $e(Z+" const*",q,!1,!0,!1);return Fh[f]={pointerType:Ft,constPointerType:ti},b0(yt,Fe),[Bt,Ft,ti]})}function zh(f,p){for(var _=[],x=0;x<f;x++)_.push(at[p+x*4>>2]);return _}function P0(f){for(;f.length;){var p=f.pop(),_=f.pop();_(p)}}function kh(f,p,_,x,b){var P=p.length;P<2&&ct("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var L=p[1]!==null&&_!==null,E=!1,O=1;O<p.length;++O)if(p[O]!==null&&p[O].destructorFunction===void 0){E=!0;break}var H=p[0].name!=="void",Z=P-2,Q=new Array(Z),$=[],yt=[];return function(){arguments.length!==Z&&ct("function "+f+" called with "+arguments.length+" arguments, expected "+Z+" args!"),yt.length=0;var ht;$.length=L?2:1,$[0]=b,L&&(ht=p[1].toWireType(yt,this),$[1]=ht);for(var pt=0;pt<Z;++pt)Q[pt]=p[pt+2].toWireType(yt,arguments[pt]),$.push(Q[pt]);var te=x.apply(null,$);function Fe(F){if(E)P0(yt);else for(var q=L?1:2;q<p.length;q++){var Bt=q===1?ht:Q[q-2];p[q].destructorFunction!==null&&p[q].destructorFunction(Bt)}if(H)return p[0].fromWireType(F)}return Fe(te)}}function R0(f,p,_,x,b,P){k(p>0);var L=zh(p,_);b=_i(x,b),dr([],[f],function(E){E=E[0];var O="constructor "+E.name;if(E.registeredClass.constructor_body===void 0&&(E.registeredClass.constructor_body=[]),E.registeredClass.constructor_body[p-1]!==void 0)throw new gi("Cannot register multiple constructors with identical number of parameters ("+(p-1)+") for class '"+E.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return E.registeredClass.constructor_body[p-1]=()=>{Ro("Cannot construct "+E.name+" due to unbound types",L)},dr([],L,function(H){return H.splice(1,0,null),E.registeredClass.constructor_body[p-1]=kh(O,H,null,b,P),[]}),[]})}function I0(f,p,_,x,b,P,L,E){var O=zh(_,x);p=_e(p),P=_i(b,P),dr([],[f],function(H){H=H[0];var Z=H.name+"."+p;p.startsWith("@@")&&(p=Symbol[p.substring(2)]),E&&H.registeredClass.pureVirtualFunctions.push(p);function Q(){Ro("Cannot call "+Z+" due to unbound types",O)}var $=H.registeredClass.instancePrototype,yt=$[p];return yt===void 0||yt.overloadTable===void 0&&yt.className!==H.name&&yt.argCount===_-2?(Q.argCount=_-2,Q.className=H.name,$[p]=Q):(Bh($,p,Z),$[p].overloadTable[_-2]=Q),dr([],O,function(ht){var pt=kh(Z,ht,H,P,L);return $[p].overloadTable===void 0?(pt.argCount=_-2,$[p]=pt):$[p].overloadTable[_-2]=pt,[]}),[]})}var Io=[],Ue=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function L0(f){f>4&&--Ue[f].refcount===0&&(Ue[f]=void 0,Io.push(f))}function N0(){for(var f=0,p=5;p<Ue.length;++p)Ue[p]!==void 0&&++f;return f}function D0(){for(var f=5;f<Ue.length;++f)if(Ue[f]!==void 0)return Ue[f];return null}function U0(){e.count_emval_handles=N0,e.get_first_emval=D0}var Lo={toValue:f=>(f||ct("Cannot use deleted val. handle = "+f),Ue[f].value),toHandle:f=>{switch(f){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var p=Io.length?Io.pop():Ue.length;return Ue[p]={refcount:1,value:f},p}}}};function F0(f,p){p=_e(p),Je(f,{name:p,fromWireType:function(_){var x=Lo.toValue(_);return L0(_),x},toWireType:function(_,x){return Lo.toHandle(x)},argPackAdvance:8,readValueFromPointer:ys,destructorFunction:null})}function yi(f){if(f===null)return"null";var p=typeof f;return p==="object"||p==="array"||p==="function"?f.toString():""+f}function O0(f,p){switch(p){case 2:return function(_){return this.fromWireType(fi[_>>2])};case 3:return function(_){return this.fromWireType(di[_>>3])};default:throw new TypeError("Unknown float type: "+f)}}function B0(f,p,_){var x=wo(_);p=_e(p),Je(f,{name:p,fromWireType:function(b){return b},toWireType:function(b,P){if(typeof P!="number"&&typeof P!="boolean")throw new TypeError('Cannot convert "'+yi(P)+'" to '+this.name);return P},argPackAdvance:8,readValueFromPointer:O0(p,x),destructorFunction:null})}function G0(f,p,_){switch(p){case 0:return _?function(b){return ce[b]}:function(b){return Dt[b]};case 1:return _?function(b){return Ze[b>>1]}:function(b){return De[b>>1]};case 2:return _?function(b){return ut[b>>2]}:function(b){return at[b>>2]};default:throw new TypeError("Unknown integer type: "+f)}}function z0(f,p,_,x,b){p=_e(p),b===-1&&(b=4294967295);var P=wo(_),L=Q=>Q;if(x===0){var E=32-8*_;L=Q=>Q<<E>>>E}var O=p.includes("unsigned"),H=(Q,$)=>{if(typeof Q!="number"&&typeof Q!="boolean")throw new TypeError('Cannot convert "'+yi(Q)+'" to '+$);if(Q<x||Q>b)throw new TypeError('Passing a number "'+yi(Q)+'" from JS side to C/C++ side to an argument of type "'+p+'", which is outside the valid range ['+x+", "+b+"]!")},Z;O?Z=function(Q,$){return H($,this.name),$>>>0}:Z=function(Q,$){return H($,this.name),$},Je(f,{name:p,fromWireType:L,toWireType:Z,argPackAdvance:8,readValueFromPointer:G0(p,P,x!==0),destructorFunction:null})}function k0(f,p,_){var x=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],b=x[p];function P(L){L=L>>2;var E=at,O=E[L],H=E[L+1];return new b($n,H,O)}_=_e(_),Je(f,{name:_,fromWireType:P,argPackAdvance:8,readValueFromPointer:P},{ignoreDuplicateRegistrations:!0})}function V0(f,p){p=_e(p);var _=p==="std::string";Je(f,{name:p,fromWireType:function(x){var b=at[x>>2],P=x+4,L;if(_)for(var E=P,O=0;O<=b;++O){var H=P+O;if(O==b||Dt[H]==0){var Z=H-E,Q=ot(E,Z);L===void 0?L=Q:(L+="\0",L+=Q),E=H+1}}else{for(var $=new Array(b),O=0;O<b;++O)$[O]=String.fromCharCode(Dt[P+O]);L=$.join("")}return En(x),L},toWireType:function(x,b){b instanceof ArrayBuffer&&(b=new Uint8Array(b));var P,L=typeof b=="string";L||b instanceof Uint8Array||b instanceof Uint8ClampedArray||b instanceof Int8Array||ct("Cannot pass non-string to std::string"),_&&L?P=hr(b):P=b.length;var E=Oo(4+P+1),O=E+4;if(at[E>>2]=P,_&&L)cr(b,O,P+1);else if(L)for(var H=0;H<P;++H){var Z=b.charCodeAt(H);Z>255&&(En(O),ct("String has UTF-16 code units that do not fit in 8 bits")),Dt[O+H]=Z}else for(var H=0;H<P;++H)Dt[O+H]=b[H];return x!==null&&x.push(En,E),E},argPackAdvance:8,readValueFromPointer:ys,destructorFunction:function(x){En(x)}})}var Vh=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function H0(f,p){k(f%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var _=f,x=_>>1,b=x+p/2;!(x>=b)&&De[x];)++x;if(_=x<<1,_-f>32&&Vh)return Vh.decode(Dt.subarray(f,_));for(var P="",L=0;!(L>=p/2);++L){var E=Ze[f+L*2>>1];if(E==0)break;P+=String.fromCharCode(E)}return P}function W0(f,p,_){if(k(p%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),k(typeof _=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),_===void 0&&(_=2147483647),_<2)return 0;_-=2;for(var x=p,b=_<f.length*2?_/2:f.length,P=0;P<b;++P){var L=f.charCodeAt(P);Ze[p>>1]=L,p+=2}return Ze[p>>1]=0,p-x}function X0(f){return f.length*2}function q0(f,p){k(f%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var _=0,x="";!(_>=p/4);){var b=ut[f+_*4>>2];if(b==0)break;if(++_,b>=65536){var P=b-65536;x+=String.fromCharCode(55296|P>>10,56320|P&1023)}else x+=String.fromCharCode(b)}return x}function Y0(f,p,_){if(k(p%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),k(typeof _=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),_===void 0&&(_=2147483647),_<4)return 0;for(var x=p,b=x+_-4,P=0;P<f.length;++P){var L=f.charCodeAt(P);if(L>=55296&&L<=57343){var E=f.charCodeAt(++P);L=65536+((L&1023)<<10)|E&1023}if(ut[p>>2]=L,p+=4,p+4>b)break}return ut[p>>2]=0,p-x}function j0(f){for(var p=0,_=0;_<f.length;++_){var x=f.charCodeAt(_);x>=55296&&x<=57343&&++_,p+=4}return p}function Z0(f,p,_){_=_e(_);var x,b,P,L,E;p===2?(x=H0,b=W0,L=X0,P=()=>De,E=1):p===4&&(x=q0,b=Y0,L=j0,P=()=>at,E=2),Je(f,{name:_,fromWireType:function(O){for(var H=at[O>>2],Z=P(),Q,$=O+4,yt=0;yt<=H;++yt){var ht=O+4+yt*p;if(yt==H||Z[ht>>E]==0){var pt=ht-$,te=x($,pt);Q===void 0?Q=te:(Q+="\0",Q+=te),$=ht+p}}return En(O),Q},toWireType:function(O,H){typeof H!="string"&&ct("Cannot pass non-string to C++ string type "+_);var Z=L(H),Q=Oo(4+Z+p);return at[Q>>2]=Z>>E,b(H,Q+4,Z+p),O!==null&&O.push(En,Q),Q},argPackAdvance:8,readValueFromPointer:ys,destructorFunction:function(O){En(O)}})}function J0(f,p){p=_e(p),Je(f,{isVoid:!0,name:p,argPackAdvance:0,fromWireType:function(){},toWireType:function(_,x){}})}function $0(){Qt("native code called abort()")}function K0(f,p,_){Dt.copyWithin(f,p,p+_)}function Q0(){return 2147483648}function tg(f){try{return j.grow(f-$n.byteLength+65535>>>16),Sh(j.buffer),1}catch(p){R("emscripten_realloc_buffer: Attempted to grow heap from "+$n.byteLength+" bytes to "+f+" bytes, but got error: "+p)}}function eg(f){var p=Dt.length;f=f>>>0,k(f>p);var _=Q0();if(f>_)return R("Cannot enlarge memory, asked to go up to "+f+" bytes, but the limit is "+_+" bytes!"),!1;let x=(O,H)=>O+(H-O%H)%H;for(var b=1;b<=4;b*=2){var P=p*(1+.2/b);P=Math.min(P,f+100663296);var L=Math.min(_,x(Math.max(f,P),65536)),E=tg(L);if(E)return!0}return R("Failed to grow the heap from "+p+" bytes to "+L+" bytes, not enough memory!"),!1}var No={};function ng(){return o||"./this.program"}function vr(){if(!vr.strings){var f=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",p={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:f,_:ng()};for(var _ in No)No[_]===void 0?delete p[_]:p[_]=No[_];var x=[];for(var _ in p)x.push(_+"="+p[_]);vr.strings=x}return vr.strings}function ig(f,p,_){for(var x=0;x<f.length;++x)k(f.charCodeAt(x)===(f.charCodeAt(x)&255)),ce[p++>>0]=f.charCodeAt(x);_||(ce[p>>0]=0)}var Do={varargs:void 0,get:function(){k(Do.varargs!=null),Do.varargs+=4;var f=ut[Do.varargs-4>>2];return f},getStr:function(f){var p=ot(f);return p}};function rg(f,p){var _=0;return vr().forEach(function(x,b){var P=p+_;at[f+b*4>>2]=P,ig(x,P),_+=x.length+1}),0}function sg(f,p){var _=vr();at[f>>2]=_.length;var x=0;return _.forEach(function(b){x+=b.length+1}),at[p>>2]=x,0}function ag(f){Qt("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM")}function og(f,p,_,x,b){return 70}var Uo=[null,[],[]];function Fo(f,p){var _=Uo[f];k(_),p===0||p===10?((f===1?U:R)(Kt(_,0)),_.length=0):_.push(p)}function ST(){yg(0),Uo[1].length&&Fo(1,10),Uo[2].length&&Fo(2,10)}function lg(f,p,_,x){for(var b=0,P=0;P<_;P++){var L=at[p>>2],E=at[p+4>>2];p+=8;for(var O=0;O<E;O++)Fo(f,Dt[L+O]);b+=E}return at[x>>2]=b,0}function xs(f){return f%4===0&&(f%100!==0||f%400===0)}function cg(f,p){for(var _=0,x=0;x<=p;_+=f[x++]);return _}var Hh=[31,29,31,30,31,30,31,31,30,31,30,31],Wh=[31,28,31,30,31,30,31,31,30,31,30,31];function hg(f,p){for(var _=new Date(f.getTime());p>0;){var x=xs(_.getFullYear()),b=_.getMonth(),P=(x?Hh:Wh)[b];if(p>P-_.getDate())p-=P-_.getDate()+1,_.setDate(1),b<11?_.setMonth(b+1):(_.setMonth(0),_.setFullYear(_.getFullYear()+1));else return _.setDate(_.getDate()+p),_}return _}function ug(f,p,_){var x=_>0?_:hr(f)+1,b=new Array(x),P=Nt(f,b,0,b.length);return p&&(b.length=P),b}function fg(f,p,_,x){var b=ut[x+40>>2],P={tm_sec:ut[x>>2],tm_min:ut[x+4>>2],tm_hour:ut[x+8>>2],tm_mday:ut[x+12>>2],tm_mon:ut[x+16>>2],tm_year:ut[x+20>>2],tm_wday:ut[x+24>>2],tm_yday:ut[x+28>>2],tm_isdst:ut[x+32>>2],tm_gmtoff:ut[x+36>>2],tm_zone:b?ot(b):""},L=ot(_),E={"%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 O in E)L=L.replace(new RegExp(O,"g"),E[O]);var H=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Z=["January","February","March","April","May","June","July","August","September","October","November","December"];function Q(F,q,Bt){for(var Ft=typeof F=="number"?F.toString():F||"";Ft.length<q;)Ft=Bt[0]+Ft;return Ft}function $(F,q){return Q(F,q,"0")}function yt(F,q){function Bt(ti){return ti<0?-1:ti>0?1:0}var Ft;return(Ft=Bt(F.getFullYear()-q.getFullYear()))===0&&(Ft=Bt(F.getMonth()-q.getMonth()))===0&&(Ft=Bt(F.getDate()-q.getDate())),Ft}function ht(F){switch(F.getDay()){case 0:return new Date(F.getFullYear()-1,11,29);case 1:return F;case 2:return new Date(F.getFullYear(),0,3);case 3:return new Date(F.getFullYear(),0,2);case 4:return new Date(F.getFullYear(),0,1);case 5:return new Date(F.getFullYear()-1,11,31);case 6:return new Date(F.getFullYear()-1,11,30)}}function pt(F){var q=hg(new Date(F.tm_year+1900,0,1),F.tm_yday),Bt=new Date(q.getFullYear(),0,4),Ft=new Date(q.getFullYear()+1,0,4),ti=ht(Bt),Ss=ht(Ft);return yt(ti,q)<=0?yt(Ss,q)<=0?q.getFullYear()+1:q.getFullYear():q.getFullYear()-1}var te={"%a":function(F){return H[F.tm_wday].substring(0,3)},"%A":function(F){return H[F.tm_wday]},"%b":function(F){return Z[F.tm_mon].substring(0,3)},"%B":function(F){return Z[F.tm_mon]},"%C":function(F){var q=F.tm_year+1900;return $(q/100|0,2)},"%d":function(F){return $(F.tm_mday,2)},"%e":function(F){return Q(F.tm_mday,2," ")},"%g":function(F){return pt(F).toString().substring(2)},"%G":function(F){return pt(F)},"%H":function(F){return $(F.tm_hour,2)},"%I":function(F){var q=F.tm_hour;return q==0?q=12:q>12&&(q-=12),$(q,2)},"%j":function(F){return $(F.tm_mday+cg(xs(F.tm_year+1900)?Hh:Wh,F.tm_mon-1),3)},"%m":function(F){return $(F.tm_mon+1,2)},"%M":function(F){return $(F.tm_min,2)},"%n":function(){return`
7
- `},"%p":function(F){return F.tm_hour>=0&&F.tm_hour<12?"AM":"PM"},"%S":function(F){return $(F.tm_sec,2)},"%t":function(){return" "},"%u":function(F){return F.tm_wday||7},"%U":function(F){var q=F.tm_yday+7-F.tm_wday;return $(Math.floor(q/7),2)},"%V":function(F){var q=Math.floor((F.tm_yday+7-(F.tm_wday+6)%7)/7);if((F.tm_wday+371-F.tm_yday-2)%7<=2&&q++,q){if(q==53){var Ft=(F.tm_wday+371-F.tm_yday)%7;Ft!=4&&(Ft!=3||!xs(F.tm_year))&&(q=1)}}else{q=52;var Bt=(F.tm_wday+7-F.tm_yday-1)%7;(Bt==4||Bt==5&&xs(F.tm_year%400-1))&&q++}return $(q,2)},"%w":function(F){return F.tm_wday},"%W":function(F){var q=F.tm_yday+7-(F.tm_wday+6)%7;return $(Math.floor(q/7),2)},"%y":function(F){return(F.tm_year+1900).toString().substring(2)},"%Y":function(F){return F.tm_year+1900},"%z":function(F){var q=F.tm_gmtoff,Bt=q>=0;return q=Math.abs(q)/60,q=q/60*100+q%60,(Bt?"+":"-")+("0000"+q).slice(-4)},"%Z":function(F){return F.tm_zone},"%%":function(){return"%"}};L=L.replace(/%%/g,"\0\0");for(var O in te)L.includes(O)&&(L=L.replace(new RegExp(O,"g"),te[O](P)));L=L.replace(/\0\0/g,"%");var Fe=ug(L,!1);return Fe.length>p?0:(Ch(Fe,f),Fe.length-1)}function dg(f,p,_,x){return fg(f,p,_,x)}function Xh(f,p){k(f<16384),f<128?p.push(f):p.push(f%128|128,f>>7)}function pg(f){for(var p={i:"i32",j:"i64",f:"f32",d:"f64",p:"i32"},_={parameters:[],results:f[0]=="v"?[]:[p[f[0]]]},x=1;x<f.length;++x)k(f[x]in p,"invalid signature char: "+f[x]),_.parameters.push(p[f[x]]);return _}function bT(f,p){if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(pg(p),f);var _=[1,96],x=p.slice(0,1),b=p.slice(1),P={i:127,p:127,j:126,f:125,d:124};Xh(b.length,_);for(var L=0;L<b.length;++L)k(b[L]in P,"invalid signature char: "+b[L]),_.push(P[b[L]]);x=="v"?_.push(0):_.push(1,P[x]);var E=[0,97,115,109,1,0,0,0,1];Xh(_.length,E),E.push.apply(E,_),E.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var O=new WebAssembly.Module(new Uint8Array(E)),H=new WebAssembly.Instance(O,{e:{f}}),Z=H.exports.f;return Z}function wT(f,p){if(qh)for(var _=f;_<f+p;_++){var x=vs(_);x&&qh.set(x,_)}}var qh=void 0,Yh=[];function ET(){if(Yh.length)return Yh.pop();try{Sn.grow(1)}catch(f){throw f instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":f}return Sn.length-1}function TT(f,p){Sn.set(f,p),yr[f]=Sn.get(f)}var AT=1;function mg(f){var p=e["_"+f];return k(p,"Cannot call unknown function "+f+", make sure it is exported"),p}function CT(f,p,_,x,b){var P={string:ht=>{var pt=0;if(ht!=null&&ht!==0){var te=(ht.length<<2)+1;pt=Jh(te),cr(ht,pt,te)}return pt},array:ht=>{var pt=Jh(ht.length);return Ch(ht,pt),pt}};function L(ht){return p==="string"?ot(ht):p==="boolean"?!!ht:ht}var E=mg(f),O=[],H=0;if(k(p!=="array",'Return type should not be "array".'),x)for(var Z=0;Z<x.length;Z++){var Q=P[_[Z]];Q?(H===0&&(H=Mg()),O[Z]=Q(x[Z])):O[Z]=x[Z]}var $=E.apply(null,O);function yt(ht){return H!==0&&Sg(H),L(ht)}return $=yt($),$}Jm(),gi=e.BindingError=Eo(Error,"BindingError"),Lh=e.InternalError=Eo(Error,"InternalError"),d0(),a0(),S0(),Gh=e.UnboundTypeError=Eo(Error,"UnboundTypeError"),U0();var PT=!0;function gg(){G("fetchSettings")}var jh={__cxa_allocate_exception:Wm,__cxa_throw:jm,_embind_register_bigint:Zm,_embind_register_bool:Qm,_embind_register_class:C0,_embind_register_class_constructor:R0,_embind_register_class_function:I0,_embind_register_emval:F0,_embind_register_float:B0,_embind_register_integer:z0,_embind_register_memory_view:k0,_embind_register_std_string:V0,_embind_register_std_wstring:Z0,_embind_register_void:J0,abort:$0,emscripten_memcpy_big:K0,emscripten_resize_heap:eg,environ_get:rg,environ_sizes_get:sg,fd_close:ag,fd_seek:og,fd_write:lg,strftime_l:dg},RT=km(),IT=e.___wasm_call_ctors=Ut("__wasm_call_ctors"),Oo=e._malloc=Ut("malloc"),En=e._free=Ut("free"),_g=e.___getTypeName=Ut("__getTypeName"),LT=e.__embind_initialize_bindings=Ut("_embind_initialize_bindings"),NT=e.___errno_location=Ut("__errno_location"),yg=e._fflush=Ut("fflush"),Zh=e._emscripten_stack_init=function(){return(Zh=e._emscripten_stack_init=e.asm.emscripten_stack_init).apply(null,arguments)},vg=e._emscripten_stack_get_free=function(){return(vg=e._emscripten_stack_get_free=e.asm.emscripten_stack_get_free).apply(null,arguments)},xg=e._emscripten_stack_get_base=function(){return(xg=e._emscripten_stack_get_base=e.asm.emscripten_stack_get_base).apply(null,arguments)},Bo=e._emscripten_stack_get_end=function(){return(Bo=e._emscripten_stack_get_end=e.asm.emscripten_stack_get_end).apply(null,arguments)},Mg=e.stackSave=Ut("stackSave"),Sg=e.stackRestore=Ut("stackRestore"),Jh=e.stackAlloc=Ut("stackAlloc"),bg=e.___cxa_is_pointer_type=Ut("__cxa_is_pointer_type"),DT=e.dynCall_viijii=Ut("dynCall_viijii"),UT=e.dynCall_ji=Ut("dynCall_ji"),FT=e.dynCall_jiji=Ut("dynCall_jiji"),OT=e.dynCall_iiiiij=Ut("dynCall_iiiiij"),BT=e.dynCall_iiiiijj=Ut("dynCall_iiiiijj"),GT=e.dynCall_iiiiiijj=Ut("dynCall_iiiiiijj"),wg=["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"];wg.forEach(M);var Eg=["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"];Eg.forEach(K);var Ms;ur=function f(){Ms||$h(),Ms||(ur=f)};function Tg(){Zh(),Pm()}function $h(f){if(f=f||a,Kn>0||(Tg(),Rm(),Kn>0))return;function p(){Ms||(Ms=!0,e.calledRun=!0,!X&&(Im(),i(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),k(!e._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),Lm()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),p()},1)):p(),Mo()}if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return $h(),t.ready})})();typeof Bs=="object"&&typeof Yo=="object"?Yo.exports=qo:typeof define=="function"&&define.amd?define([],function(){return qo}):typeof Bs=="object"&&(Bs.createLazPerf=qo)});var Zo=lt(Be=>{"use strict";var U_=Be&&Be.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Be,"__esModule",{value:!0});Be.LazPerf=Be.create=Be.createLazPerf=void 0;var jo=U_(Iu());Be.createLazPerf=jo.default;Be.create=jo.default;Be.LazPerf={create:jo.default}});var Fu=lt(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.decompressFile=In.decompressChunk=In.PointData=void 0;var Lu=Zo(),F_=Xo();In.PointData={createLazPerf:Lu.createLazPerf,decompressChunk:Du,decompressFile:Uu};var Jo;async function Nu(n){return n||(Jo||(Jo=(0,Lu.createLazPerf)()),Jo)}async function Du(n,{pointCount:t,pointDataRecordFormat:e,pointDataRecordLength:i},r){let s=await Nu(r),a=new Uint8Array(t*i),o=s._malloc(n.byteLength),l=s._malloc(i),c=new s.ChunkDecoder;try{s.HEAPU8.set(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),o),c.open(e,i,o);for(let h=0;h<t;++h)c.getPoint(l),a.set(new Uint8Array(s.HEAPU8.buffer,l,i),h*i)}finally{s._free(o),s._free(l),c.delete()}return a}In.decompressChunk=Du;async function Uu(n,t){let e=await Nu(t),i=F_.Header.parse(n),{pointCount:r,pointDataRecordLength:s}=i,a=new Uint8Array(r*s),o=e._malloc(n.byteLength),l=e._malloc(s),c=new e.LASZip;try{e.HEAPU8.set(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),o),c.open(o,n.byteLength);for(let h=0;h<r;++h)c.getPoint(l),a.set(new Uint8Array(e.HEAPU8.buffer,l,s),h*s)}finally{c.delete()}return a}In.decompressFile=Uu});var Ou=lt(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.View=void 0;var O_=ve(),B_=Vo(),G_=Ho();Gs.View={create:z_};function z_(n,t,e=[],i){let r=G_.Extractor.create(t,e);if(i){let h=new Set([...i]);r=Object.entries(r).reduce((u,[m,d])=>(h.has(m)&&(u[m]=d),u),{})}let s=B_.Dimensions.create(r,e),a=O_.Binary.toDataView(n),o=t.pointDataRecordLength;if(a.byteLength%o!==0)throw new Error(`Invalid buffer length (${a.byteLength}) for point length ${o}`);let l=a.byteLength/t.pointDataRecordLength;function c(h){let u=r[h];if(!u)throw new Error(`No extractor for dimension: ${h}`);return function(m){if(m>=l)throw new RangeError(`View index (${m}) out of range: ${l}`);return u(a,m)}}return{pointCount:l,dimensions:s,getter:c}}});var ku=lt(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.Vlr=void 0;var Ge=ve(),wi=Es();zs.Vlr={walk:H_,parse:zu,find:Gu,at:k_,fetch:V_};function Gu(n,t,e){return n.find(i=>i.userId===t&&i.recordId===e)}function k_(n,t,e){let i=Gu(n,t,e);if(!i)throw new Error(`VLR not found: ${t}/${e}`);return i}function V_(n,{contentOffset:t,contentLength:e}){return e===0?new Uint8Array:Ge.Getter.create(n)(t,t+e)}async function H_(n,t){let e=Ge.Getter.create(n),i=await Bu({get:e,startOffset:t.headerLength,count:t.vlrCount,isExtended:!1}),r=await Bu({get:e,startOffset:t.evlrOffset,count:t.evlrCount,isExtended:!0});return[...i,...r]}function zu(n,t){return(t?X_:W_)(n)}function W_(n){let t=Ge.Binary.toDataView(n);if(t.byteLength!==wi.vlrHeaderLength)throw new Error(`Invalid VLR header length (must be ${wi.vlrHeaderLength}): ${t.byteLength}`);return{userId:Ge.Binary.toCString(n.slice(2,18)),recordId:t.getUint16(18,!0),contentLength:t.getUint16(20,!0),description:Ge.Binary.toCString(n.slice(22,54)),isExtended:!1}}function X_(n){let t=Ge.Binary.toDataView(n);if(t.byteLength!==wi.evlrHeaderLength)throw new Error(`Invalid EVLR header length (must be ${wi.evlrHeaderLength}): ${t.byteLength}`);return{userId:Ge.Binary.toCString(n.slice(2,18)),recordId:t.getUint16(18,!0),contentLength:(0,Ge.parseBigInt)((0,Ge.getBigUint64)(t,20,!0)),description:Ge.Binary.toCString(n.slice(28,60)),isExtended:!0}}async function Bu({get:n,startOffset:t,count:e,isExtended:i}){let r=[],s=t,a=i?wi.evlrHeaderLength:wi.vlrHeaderLength;for(let o=0;o<e;++o){let l=a?await n(s,s+a):new Uint8Array,{userId:c,recordId:h,contentLength:u,description:m}=zu(l,i);r.push({userId:c,recordId:h,contentOffset:s+a,contentLength:u,description:m,isExtended:i}),s+=a+u}return r}});var $o=lt(gt=>{"use strict";var q_=gt&&gt.__createBinding||(Object.create?(function(n,t,e,i){i===void 0&&(i=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,i,r)}):(function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]})),Y_=gt&&gt.__setModuleDefault||(Object.create?(function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}):function(n,t){n.default=t}),j_=gt&&gt.__importStar||function(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e in n)e!=="default"&&Object.prototype.hasOwnProperty.call(n,e)&&q_(t,n,e);return Y_(t,n),t};Object.defineProperty(gt,"__esModule",{value:!0});gt.Vlr=gt.View=gt.PointData=gt.Header=gt.Extractor=gt.ExtraBytes=gt.Dimensions=gt.Constants=void 0;gt.Constants=j_(Es());var Z_=Vo();Object.defineProperty(gt,"Dimensions",{enumerable:!0,get:function(){return Z_.Dimensions}});var J_=ko();Object.defineProperty(gt,"ExtraBytes",{enumerable:!0,get:function(){return J_.ExtraBytes}});var $_=Ho();Object.defineProperty(gt,"Extractor",{enumerable:!0,get:function(){return $_.Extractor}});var K_=Xo();Object.defineProperty(gt,"Header",{enumerable:!0,get:function(){return K_.Header}});var Q_=Fu();Object.defineProperty(gt,"PointData",{enumerable:!0,get:function(){return Q_.PointData}});var ty=Ou();Object.defineProperty(gt,"View",{enumerable:!0,get:function(){return ty.View}});var ey=ku();Object.defineProperty(gt,"Vlr",{enumerable:!0,get:function(){return ey.Vlr}})});var Ko=lt(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.Hierarchy=void 0;var xr=ve(),Vu=ws();ks.Hierarchy={parse:Hu,load:ny};function Hu(n){let t=xr.Binary.toDataView(n);if(t.byteLength%Vu.hierarchyItemLength!==0)throw new Error(`Invalid hierarchy page length: ${t.byteLength}`);let e={},i={};for(let r=0;r<t.byteLength;r+=Vu.hierarchyItemLength){let s=t.getInt32(r+0,!0),a=t.getInt32(r+4,!0),o=t.getInt32(r+8,!0),l=t.getInt32(r+12,!0),c=(0,xr.parseBigInt)((0,xr.getBigUint64)(t,r+16,!0)),h=t.getInt32(r+24,!0),u=t.getInt32(r+28,!0),m=xr.Key.toString([s,a,o,l]);if(u<-1)throw new Error(`Invalid hierarchy point count at key: ${m}`);u===-1?i[m]={pageOffset:c,pageLength:h}:e[m]={pointCount:u,pointDataOffset:c,pointDataLength:h}}return{nodes:e,pages:i}}async function ny(n,t){let e=xr.Getter.create(n);return Hu(await e(t.pageOffset,t.pageOffset+t.pageLength))}});var Qo=lt(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.Info=void 0;var Mr=ve(),Wu=ws();Vs.Info={parse:iy};function iy(n){let t=Mr.Binary.toDataView(n);if(t.byteLength!==Wu.infoLength)throw new Error(`Invalid COPC info VLR length (should be ${Wu.infoLength}): ${t.byteLength}`);let e=[t.getFloat64(0,!0),t.getFloat64(8,!0),t.getFloat64(16,!0)],i=t.getFloat64(24,!0);return{cube:[e[0]-i,e[1]-i,e[2]-i,e[0]+i,e[1]+i,e[2]+i],spacing:t.getFloat64(32,!0),rootHierarchyPage:{pageOffset:(0,Mr.parseBigInt)((0,Mr.getBigUint64)(t,40,!0)),pageLength:(0,Mr.parseBigInt)((0,Mr.getBigUint64)(t,48,!0))},gpsTimeRange:[t.getFloat64(56,!0),t.getFloat64(64,!0)]}}});var Yu=lt(ze=>{"use strict";var ry=ze&&ze.__createBinding||(Object.create?(function(n,t,e,i){i===void 0&&(i=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,i,r)}):(function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]})),sy=ze&&ze.__setModuleDefault||(Object.create?(function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}):function(n,t){n.default=t}),ay=ze&&ze.__importStar||function(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e in n)e!=="default"&&Object.prototype.hasOwnProperty.call(n,e)&&ry(t,n,e);return sy(t,n),t};Object.defineProperty(ze,"__esModule",{value:!0});ze.Copc=void 0;var xe=ay($o()),Hs=ve(),oy=Ko(),ly=Qo();ze.Copc={create:cy,loadHierarchyPage:hy,loadCompressedPointDataBuffer:Xu,loadPointDataBuffer:qu,loadPointDataView:uy};async function cy(n){let t=Hs.Getter.create(n),e=65536,i=t(0,e);async function r(d,g){return g>=e?t(d,g):(await i).slice(d,g)}let s=xe.Header.parse(await r(0,xe.Constants.minHeaderLength)),a=await xe.Vlr.walk(r,s),o=xe.Vlr.find(a,"copc",1);if(!o)throw new Error("COPC info VLR is required");let l=ly.Info.parse(await xe.Vlr.fetch(r,o)),c,h=xe.Vlr.find(a,"LASF_Projection",2112);h&&h.contentLength&&(c=Hs.Binary.toCString(await xe.Vlr.fetch(r,h)),c===""&&(c=void 0));let u=[],m=xe.Vlr.find(a,"LASF_Spec",4);return m&&(u=xe.ExtraBytes.parse(await xe.Vlr.fetch(r,m))),{header:s,vlrs:a,info:l,wkt:c,eb:u}}async function hy(n,t){let e=Hs.Getter.create(n);return oy.Hierarchy.load(e,t)}async function Xu(n,{pointDataOffset:t,pointDataLength:e}){return Hs.Getter.create(n)(t,t+e)}async function qu(n,{pointDataRecordFormat:t,pointDataRecordLength:e},i,r){let s=await Xu(n,i),{pointCount:a}=i;return xe.PointData.decompressChunk(s,{pointCount:a,pointDataRecordFormat:t,pointDataRecordLength:e},r)}async function uy(n,t,e,{lazPerf:i,include:r}={}){let s=await qu(n,t.header,e,i);return xe.View.create(s,t.header,t.eb,r)}});var ju=lt(zt=>{"use strict";var fy=zt&&zt.__createBinding||(Object.create?(function(n,t,e,i){i===void 0&&(i=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,i,r)}):(function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]})),dy=zt&&zt.__setModuleDefault||(Object.create?(function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}):function(n,t){n.default=t}),py=zt&&zt.__importStar||function(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e in n)e!=="default"&&Object.prototype.hasOwnProperty.call(n,e)&&fy(t,n,e);return dy(t,n),t};Object.defineProperty(zt,"__esModule",{value:!0});zt.Info=zt.Hierarchy=zt.Copc=zt.Constants=void 0;zt.Constants=py(ws());var my=Yu();Object.defineProperty(zt,"Copc",{enumerable:!0,get:function(){return my.Copc}});var gy=Ko();Object.defineProperty(zt,"Hierarchy",{enumerable:!0,get:function(){return gy.Hierarchy}});var _y=Qo();Object.defineProperty(zt,"Info",{enumerable:!0,get:function(){return _y.Info}})});var Ku=lt(kt=>{"use strict";var Zu=kt&&kt.__createBinding||(Object.create?(function(n,t,e,i){i===void 0&&(i=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,i,r)}):(function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]})),yy=kt&&kt.__setModuleDefault||(Object.create?(function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}):function(n,t){n.default=t}),Ju=kt&&kt.__importStar||function(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e in n)e!=="default"&&Object.prototype.hasOwnProperty.call(n,e)&&Zu(t,n,e);return yy(t,n),t},$u=kt&&kt.__exportStar||function(n,t){for(var e in n)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&Zu(t,n,e)};Object.defineProperty(kt,"__esModule",{value:!0});kt.Las=kt.Ept=void 0;kt.Ept=Ju(su());$u(ju(),kt);kt.Las=Ju($o());$u(ve(),kt)});var yo=tu(Ku());var xf=1;var Mf=3,zl=0,Sf=1;var kl=1;var bf=100;var wf=204,Ef=205;var xl=0,Ml=1,Sl=2,ua=3,bl=4,wl=5,El=6,Tl=7,Vl=0,Tf=1,Af=2;var Hl=1,Wl=2,Xl=3,ql=4,Yl=5,jl=6,Zl=7;var Jl=300,Cf=301,$l=302;var Pf=306,Al=1e3,Pe=1001,Cl=1002,an=1003;var Ve=1006;var Rf=1008;var on=1009,Ca=1010,Pa=1011,Ra=1012,zr=1013,Ia=1014,ln=1015,kr=1016,La=1017,Na=1018,Da=1020;var Kl=1021;var cn=1023,Ql=1026,tc=1027,ec=1028,nc=1029,Ua=1030,ic=1031;var rc=1033;var Ar=2300,fa=2301,la=2302,Pl=2303,Rl=2400,Il=2401,Ll=2402;var Vr="",be="srgb",Nl="srgb-linear",Dl="linear",ca="srgb";var ha=7680;var If=519;var Lf=35044;var Oi=2e3,Ul=2001;function vy(n){for(let t=n.length-1;t>=0;--t)if(n[t]>=65535)return!0;return!1}function xy(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Fl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}var Qu={},da=null;function Nf(n){let t=n[0];if(typeof t=="string"&&t.startsWith("TSL:")){let e=n[1];e&&e.isStackTrace?n[0]+=" "+e.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function wt(...n){n=Nf(n);let t="THREE."+n.shift();if(da)da("warn",t,...n);else{let e=n[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...n)}}function _t(...n){n=Nf(n);let t="THREE."+n.shift();if(da)da("error",t,...n);else{let e=n[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...n)}}function Bi(...n){let t=n.join(" ");t in Qu||(Qu[t]=!0,wt(...n))}var My={[xl]:Ml,[Sl]:El,[bl]:Tl,[ua]:wl,[Ml]:xl,[El]:Sl,[Tl]:bl,[wl]:ua},Ot=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){let i=this._listeners;return i===void 0?!1:i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){let i=this._listeners;if(i===void 0)return;let r=i[t];if(r!==void 0){let s=r.indexOf(e);s!==-1&&r.splice(s,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let i=e[t.type];if(i!==void 0){t.target=this;let r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,t);t.target=null}}},Vt=["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"],tf=1234567,Df=Math.PI/180,sc=180/Math.PI;function Wi(){let n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Vt[n&255]+Vt[n>>8&255]+Vt[n>>16&255]+Vt[n>>24&255]+"-"+Vt[t&255]+Vt[t>>8&255]+"-"+Vt[t>>16&15|64]+Vt[t>>24&255]+"-"+Vt[e&63|128]+Vt[e>>8&255]+"-"+Vt[e>>16&255]+Vt[e>>24&255]+Vt[i&255]+Vt[i>>8&255]+Vt[i>>16&255]+Vt[i>>24&255]).toLowerCase()}function it(n,t,e){return Math.max(t,Math.min(e,n))}function ac(n,t){return(n%t+t)%t}function Sy(n,t,e,i,r){return i+(n-t)*(r-i)/(e-t)}function by(n,t,e){return n!==t?(e-n)/(t-n):0}function Tr(n,t,e){return(1-e)*n+e*t}function wy(n,t,e,i){return Tr(n,t,1-Math.exp(-e*i))}function Ey(n,t=1){return t-Math.abs(ac(n,t*2)-t)}function Ty(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*(3-2*n))}function Ay(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*n*(n*(n*6-15)+10))}function Cy(n,t){return n+Math.floor(Math.random()*(t-n+1))}function Py(n,t){return n+Math.random()*(t-n)}function Ry(n){return n*(.5-Math.random())}function Iy(n){n!==void 0&&(tf=n);let t=tf+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Ly(n){return n*Df}function Ny(n){return n*sc}function Dy(n){return n>0&&Number.isInteger(n)&&2**Math.round(Math.log2(n))===n}function Uy(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Fy(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Oy(n,t,e,i,r){let s=Math.cos,a=Math.sin,o=s(e/2),l=a(e/2),c=s((t+i)/2),h=a((t+i)/2),u=s((t-i)/2),m=a((t-i)/2),d=s((i-t)/2),g=a((i-t)/2);switch(r){case"XYX":n.set(o*h,l*u,l*m,o*c);break;case"YZY":n.set(l*m,o*h,l*u,o*c);break;case"ZXZ":n.set(l*u,l*m,o*h,o*c);break;case"XZX":n.set(o*h,l*g,l*d,o*c);break;case"YXY":n.set(l*d,o*h,l*g,o*c);break;case"ZYZ":n.set(l*g,l*d,o*h,o*c);break;default:wt("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Fi(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:case Uint8ClampedArray:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function qt(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var jt={DEG2RAD:Df,RAD2DEG:sc,generateUUID:Wi,clamp:it,euclideanModulo:ac,mapLinear:Sy,inverseLerp:by,lerp:Tr,damp:wy,pingpong:Ey,smoothstep:Ty,smootherstep:Ay,randInt:Cy,randFloat:Py,randFloatSpread:Ry,seededRandom:Iy,degToRad:Ly,radToDeg:Ny,isPowerOfTwo:Dy,ceilPowerOfTwo:Uy,floorPowerOfTwo:Fy,setQuaternionFromProperEuler:Oy,normalize:qt,denormalize:Fi},nt=class n{static{n.prototype.isVector2=!0}constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6],this.y=r[1]*e+r[4]*i+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=it(this.x,t.x,e.x),this.y=it(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=it(this.x,t,e),this.y=it(this.y,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(it(i,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(it(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),r=Math.sin(e),s=this.x-t.x,a=this.y-t.y;return this.x=s*i-a*r+t.x,this.y=s*r+a*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},He=class{constructor(t=0,e=0,i=0,r=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=r}static slerpFlat(t,e,i,r,s,a,o){let l=i[r+0],c=i[r+1],h=i[r+2],u=i[r+3],m=s[a+0],d=s[a+1],g=s[a+2],y=s[a+3];if(u!==y||l!==m||c!==d||h!==g){let v=l*m+c*d+h*g+u*y;v<0&&(m=-m,d=-d,g=-g,y=-y,v=-v);let S=1-o;if(v<.9995){let w=Math.acos(v),I=Math.sin(w);S=Math.sin(S*w)/I,o=Math.sin(o*w)/I,l=l*S+m*o,c=c*S+d*o,h=h*S+g*o,u=u*S+y*o}else{l=l*S+m*o,c=c*S+d*o,h=h*S+g*o,u=u*S+y*o;let w=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=w,c*=w,h*=w,u*=w}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,r,s,a){let o=i[r],l=i[r+1],c=i[r+2],h=i[r+3],u=s[a],m=s[a+1],d=s[a+2],g=s[a+3];return t[e]=o*g+h*u+l*d-c*m,t[e+1]=l*g+h*m+c*u-o*d,t[e+2]=c*g+h*d+o*m-l*u,t[e+3]=h*g-o*u-l*m-c*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let i=t._x,r=t._y,s=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(i/2),h=o(r/2),u=o(s/2),m=l(i/2),d=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=m*h*u+c*d*g,this._y=c*d*u-m*h*g,this._z=c*h*g+m*d*u,this._w=c*h*u-m*d*g;break;case"YXZ":this._x=m*h*u+c*d*g,this._y=c*d*u-m*h*g,this._z=c*h*g-m*d*u,this._w=c*h*u+m*d*g;break;case"ZXY":this._x=m*h*u-c*d*g,this._y=c*d*u+m*h*g,this._z=c*h*g+m*d*u,this._w=c*h*u-m*d*g;break;case"ZYX":this._x=m*h*u-c*d*g,this._y=c*d*u+m*h*g,this._z=c*h*g-m*d*u,this._w=c*h*u+m*d*g;break;case"YZX":this._x=m*h*u+c*d*g,this._y=c*d*u+m*h*g,this._z=c*h*g-m*d*u,this._w=c*h*u-m*d*g;break;case"XZY":this._x=m*h*u-c*d*g,this._y=c*d*u-m*h*g,this._z=c*h*g+m*d*u,this._w=c*h*u+m*d*g;break;default:wt("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,r=Math.sin(i);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],r=e[4],s=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],u=e[10],m=i+o+u;if(m>0){let d=.5/Math.sqrt(m+1);this._w=.25/d,this._x=(h-l)*d,this._y=(s-c)*d,this._z=(a-r)*d}else if(i>o&&i>u){let d=2*Math.sqrt(1+i-o-u);this._w=(h-l)/d,this._x=.25*d,this._y=(r+a)/d,this._z=(s+c)/d}else if(o>u){let d=2*Math.sqrt(1+o-i-u);this._w=(s-c)/d,this._x=(r+a)/d,this._y=.25*d,this._z=(l+h)/d}else{let d=2*Math.sqrt(1+u-i-o);this._w=(a-r)/d,this._x=(s+c)/d,this._y=(l+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(it(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(i===0)return this;let r=Math.min(1,e/i);return this.slerp(t,r),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,r=t._y,s=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=i*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-i*c,this._z=s*h+a*c+i*l-r*o,this._w=a*h-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(t,e){let i=t._x,r=t._y,s=t._z,a=t._w,o=this.dot(t);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-e;if(o<.9995){let c=Math.acos(o),h=Math.sin(c);l=Math.sin(l*c)/h,e=Math.sin(e*c)/h,this._x=this._x*l+i*e,this._y=this._y*l+r*e,this._z=this._z*l+s*e,this._w=this._w*l+a*e,this._onChangeCallback()}else this._x=this._x*l+i*e,this._y=this._y*l+r*e,this._z=this._z*l+s*e,this._w=this._w*l+a*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},C=class n{static{n.prototype.isVector3=!0}constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(ef.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ef.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*r,this.y=s[1]*e+s[4]*i+s[7]*r,this.z=s[2]*e+s[5]*i+s[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,r=this.z,s=t.elements,a=1/(s[3]*e+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*e+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*e+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(t){let e=this.x,i=this.y,r=this.z,s=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*r-o*i),h=2*(o*e-s*r),u=2*(s*i-a*e);return this.x=e+l*c+a*u-o*h,this.y=i+l*h+o*c-s*u,this.z=r+l*u+s*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*r,this.y=s[1]*e+s[5]*i+s[9]*r,this.z=s[2]*e+s[6]*i+s[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=it(this.x,t.x,e.x),this.y=it(this.y,t.y,e.y),this.z=it(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=it(this.x,t,e),this.y=it(this.y,t,e),this.z=it(this.z,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(it(i,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,r=t.y,s=t.z,a=e.x,o=e.y,l=e.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return tl.copy(this).projectOnVector(t),this.sub(tl)}reflect(t){return this.sub(tl.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(it(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let r=Math.sin(e)*t;return this.x=r*Math.sin(i),this.y=Math.cos(e)*t,this.z=r*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},tl=new C,ef=new He,tt=class n{static{n.prototype.isMatrix3=!0}constructor(t,e,i,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,i,r,s,a,o,l,c)}set(t,e,i,r,s,a,o,l,c){let h=this.elements;return h[0]=t,h[1]=r,h[2]=o,h[3]=e,h[4]=s,h[5]=l,h[6]=i,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,r=e.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],h=i[4],u=i[7],m=i[2],d=i[5],g=i[8],y=r[0],v=r[3],S=r[6],w=r[1],I=r[4],U=r[7],R=r[2],V=r[5],B=r[8];return s[0]=a*y+o*w+l*R,s[3]=a*v+o*I+l*V,s[6]=a*S+o*U+l*B,s[1]=c*y+h*w+u*R,s[4]=c*v+h*I+u*V,s[7]=c*S+h*U+u*B,s[2]=m*y+d*w+g*R,s[5]=m*v+d*I+g*V,s[8]=m*S+d*U+g*B,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-i*s*h+i*o*l+r*s*c-r*a*l}invert(){let t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=h*a-o*c,m=o*l-h*s,d=c*s-a*l,g=e*u+i*m+r*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let y=1/g;return t[0]=u*y,t[1]=(r*c-h*i)*y,t[2]=(o*i-r*a)*y,t[3]=m*y,t[4]=(h*e-r*l)*y,t[5]=(r*s-o*e)*y,t[6]=d*y,t[7]=(i*l-c*e)*y,t[8]=(a*e-i*s)*y,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,r,s,a,o){let l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+t,-r*c,r*l,-r*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return Bi("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(el.makeScale(t,e)),this}rotate(t){return Bi("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(el.makeRotation(-t)),this}translate(t,e){return Bi("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(el.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let r=0;r<9;r++)if(e[r]!==i[r])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},el=new tt,nf=new tt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),rf=new tt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function By(){let n={enabled:!0,workingColorSpace:Nl,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===ca&&(r.r=rn(r.r),r.g=rn(r.g),r.b=rn(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===ca&&(r.r=Gi(r.r),r.g=Gi(r.g),r.b=Gi(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Vr?Dl:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Bi("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Bi("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[Nl]:{primaries:t,whitePoint:i,transfer:Dl,toXYZ:nf,fromXYZ:rf,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:be},outputColorSpaceConfig:{drawingBufferColorSpace:be}},[be]:{primaries:t,whitePoint:i,transfer:ca,toXYZ:nf,fromXYZ:rf,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:be}}}),n}var Se=By();function rn(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Gi(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var Ei,pa=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{Ei===void 0&&(Ei=Fl("canvas")),Ei.width=t.width,Ei.height=t.height;let r=Ei.getContext("2d");t instanceof ImageData?r.putImageData(t,0,0):r.drawImage(t,0,0,t.width,t.height),i=Ei}return i.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Fl("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let r=i.getImageData(0,0,t.width,t.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=rn(s[a]/255)*255;return i.putImageData(r,0,0),e}else if(t.data){let e=t.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(rn(e[i]/255)*255):e[i]=rn(e[i]);return{data:e,width:t.width,height:t.height}}else return wt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Gy=0,Cr=class{constructor(t=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:Gy++}),this.uuid=Wi(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(nl(r[a].image)):s.push(nl(r[a]))}else s=nl(r);i.url=s}return e||(t.images[this.uuid]=i),i}};function nl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?pa.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(wt("Texture: Unable to serialize Texture."),{})}var zy=0,il=new C,we=class n extends Ot{constructor(t=n.DEFAULT_IMAGE,e=n.DEFAULT_MAPPING,i=Pe,r=Pe,s=Ve,a=Rf,o=cn,l=on,c=n.DEFAULT_ANISOTROPY,h=Vr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:zy++}),this.uuid=Wi(),this.name="",this.source=new Cr(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new nt(0,0),this.repeat=new nt(1,1),this.center=new nt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new tt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(il).x}get height(){return this.source.getSize(il).y}get depth(){return this.source.getSize(il).z}get image(){return this.source.data}set image(t){this.source.data=t}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(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let i=t[e];if(i===void 0){wt(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let r=this[e];if(r===void 0){wt(`Texture.setValues(): property '${e}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[e]=i}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Jl)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Al:t.x=t.x-Math.floor(t.x);break;case Pe:t.x=t.x<0?0:1;break;case Cl:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Al:t.y=t.y-Math.floor(t.y);break;case Pe:t.y=t.y<0?0:1;break;case Cl:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};we.DEFAULT_IMAGE=null;we.DEFAULT_MAPPING=Jl;we.DEFAULT_ANISOTROPY=1;var Yt=class n{static{n.prototype.isVector4=!0}constructor(t=0,e=0,i=0,r=1){this.x=t,this.y=e,this.z=i,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,r=this.z,s=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*e+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*e+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*e+a[7]*i+a[11]*r+a[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,r,s,l=t.elements,c=l[0],h=l[4],u=l[8],m=l[1],d=l[5],g=l[9],y=l[2],v=l[6],S=l[10];if(Math.abs(h-m)<.01&&Math.abs(u-y)<.01&&Math.abs(g-v)<.01){if(Math.abs(h+m)<.1&&Math.abs(u+y)<.1&&Math.abs(g+v)<.1&&Math.abs(c+d+S-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let I=(c+1)/2,U=(d+1)/2,R=(S+1)/2,V=(h+m)/4,B=(u+y)/4,G=(g+v)/4;return I>U&&I>R?I<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(I),r=V/i,s=B/i):U>R?U<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(U),i=V/r,s=G/r):R<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),i=B/s,r=G/s),this.set(i,r,s,e),this}let w=Math.sqrt((v-g)*(v-g)+(u-y)*(u-y)+(m-h)*(m-h));return Math.abs(w)<.001&&(w=1),this.x=(v-g)/w,this.y=(u-y)/w,this.z=(m-h)/w,this.w=Math.acos((c+d+S-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=it(this.x,t.x,e.x),this.y=it(this.y,t.y,e.y),this.z=it(this.z,t.z,e.z),this.w=it(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=it(this.x,t,e),this.y=it(this.y,t,e),this.z=it(this.z,t,e),this.w=it(this.w,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(it(i,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}},ma=class extends Ot{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ve,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new Yt(0,0,t,e),this.scissorTest=!1,this.viewport=new Yt(0,0,t,e),this.textures=[];let r={width:t,height:e,depth:i.depth},s=new we(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveColorBuffer=i.resolveColorBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.storeMultisampledColorBuffer=i.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=i.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=i.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(t={}){let e={minFilter:Ve,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),t!==null&&t.renderTarget===null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=t,this.textures[r].image.height=e,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;let r=Object.assign({},t.textures[e].image);this.textures[e].source=new Cr(r)}if(this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveColorBuffer=t.resolveColorBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,this.storeMultisampledColorBuffer=t.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=t.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=t.storeMultisampledStencilBuffer,t.depthTexture!==null)if(t.depthTexture.renderTarget===t){let e=t.depthTexture.clone();e.renderTarget=null,this.depthTexture=e}else this.depthTexture=t.depthTexture;return this.samples=t.samples,this.multiview=t.multiview,this.useArrayDepthTexture=t.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},zi=class extends ma{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}};var Ct=class n{static{n.prototype.isMatrix4=!0}constructor(t,e,i,r,s,a,o,l,c,h,u,m,d,g,y,v){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,i,r,s,a,o,l,c,h,u,m,d,g,y,v)}set(t,e,i,r,s,a,o,l,c,h,u,m,d,g,y,v){let S=this.elements;return S[0]=t,S[4]=e,S[8]=i,S[12]=r,S[1]=s,S[5]=a,S[9]=o,S[13]=l,S[2]=c,S[6]=h,S[10]=u,S[14]=m,S[3]=d,S[7]=g,S[11]=y,S[15]=v,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 n().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return this.determinantAffine()===0?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(t.determinantAffine()===0)return this.identity();let e=this.elements,i=t.elements,r=1/Ti.setFromMatrixColumn(t,0).length(),s=1/Ti.setFromMatrixColumn(t,1).length(),a=1/Ti.setFromMatrixColumn(t,2).length();return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,r=t.y,s=t.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),u=Math.sin(s);if(t.order==="XYZ"){let m=a*h,d=a*u,g=o*h,y=o*u;e[0]=l*h,e[4]=-l*u,e[8]=c,e[1]=d+g*c,e[5]=m-y*c,e[9]=-o*l,e[2]=y-m*c,e[6]=g+d*c,e[10]=a*l}else if(t.order==="YXZ"){let m=l*h,d=l*u,g=c*h,y=c*u;e[0]=m+y*o,e[4]=g*o-d,e[8]=a*c,e[1]=a*u,e[5]=a*h,e[9]=-o,e[2]=d*o-g,e[6]=y+m*o,e[10]=a*l}else if(t.order==="ZXY"){let m=l*h,d=l*u,g=c*h,y=c*u;e[0]=m-y*o,e[4]=-a*u,e[8]=g+d*o,e[1]=d+g*o,e[5]=a*h,e[9]=y-m*o,e[2]=-a*c,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){let m=a*h,d=a*u,g=o*h,y=o*u;e[0]=l*h,e[4]=g*c-d,e[8]=m*c+y,e[1]=l*u,e[5]=y*c+m,e[9]=d*c-g,e[2]=-c,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){let m=a*l,d=a*c,g=o*l,y=o*c;e[0]=l*h,e[4]=y-m*u,e[8]=g*u+d,e[1]=u,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=d*u+g,e[10]=m-y*u}else if(t.order==="XZY"){let m=a*l,d=a*c,g=o*l,y=o*c;e[0]=l*h,e[4]=-u,e[8]=c*h,e[1]=m*u+y,e[5]=a*h,e[9]=d*u-g,e[2]=g*u-d,e[6]=o*h,e[10]=y*u+m}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(ky,t,Vy)}lookAt(t,e,i){let r=this.elements;return ue.subVectors(t,e),ue.lengthSq()===0&&(ue.z=1),ue.normalize(),Ln.crossVectors(i,ue),Ln.lengthSq()===0&&(Math.abs(i.z)===1?ue.x+=1e-4:ue.z+=1e-4,ue.normalize(),Ln.crossVectors(i,ue)),Ln.normalize(),Ws.crossVectors(ue,Ln),r[0]=Ln.x,r[4]=Ws.x,r[8]=ue.x,r[1]=Ln.y,r[5]=Ws.y,r[9]=ue.y,r[2]=Ln.z,r[6]=Ws.z,r[10]=ue.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,r=e.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],h=i[1],u=i[5],m=i[9],d=i[13],g=i[2],y=i[6],v=i[10],S=i[14],w=i[3],I=i[7],U=i[11],R=i[15],V=r[0],B=r[4],G=r[8],Y=r[12],K=r[1],M=r[5],A=r[9],z=r[13],j=r[2],X=r[6],J=r[10],k=r[14],It=r[3],Kt=r[7],ot=r[11],Nt=r[15];return s[0]=a*V+o*K+l*j+c*It,s[4]=a*B+o*M+l*X+c*Kt,s[8]=a*G+o*A+l*J+c*ot,s[12]=a*Y+o*z+l*k+c*Nt,s[1]=h*V+u*K+m*j+d*It,s[5]=h*B+u*M+m*X+d*Kt,s[9]=h*G+u*A+m*J+d*ot,s[13]=h*Y+u*z+m*k+d*Nt,s[2]=g*V+y*K+v*j+S*It,s[6]=g*B+y*M+v*X+S*Kt,s[10]=g*G+y*A+v*J+S*ot,s[14]=g*Y+y*z+v*k+S*Nt,s[3]=w*V+I*K+U*j+R*It,s[7]=w*B+I*M+U*X+R*Kt,s[11]=w*G+I*A+U*J+R*ot,s[15]=w*Y+I*z+U*k+R*Nt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],r=t[8],s=t[12],a=t[1],o=t[5],l=t[9],c=t[13],h=t[2],u=t[6],m=t[10],d=t[14],g=t[3],y=t[7],v=t[11],S=t[15],w=l*d-c*m,I=o*d-c*u,U=o*m-l*u,R=a*d-c*h,V=a*m-l*h,B=a*u-o*h;return e*(y*w-v*I+S*U)-i*(g*w-v*R+S*V)+r*(g*I-y*R+S*B)-s*(g*U-y*V+v*B)}determinantAffine(){let t=this.elements,e=t[0],i=t[4],r=t[8],s=t[1],a=t[5],o=t[9],l=t[2],c=t[6],h=t[10];return e*(a*h-o*c)-i*(s*h-o*l)+r*(s*c-a*l)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){let r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=t[9],m=t[10],d=t[11],g=t[12],y=t[13],v=t[14],S=t[15],w=e*o-i*a,I=e*l-r*a,U=e*c-s*a,R=i*l-r*o,V=i*c-s*o,B=r*c-s*l,G=h*y-u*g,Y=h*v-m*g,K=h*S-d*g,M=u*v-m*y,A=u*S-d*y,z=m*S-d*v,j=w*z-I*A+U*M+R*K-V*Y+B*G;if(j===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let X=1/j;return t[0]=(o*z-l*A+c*M)*X,t[1]=(r*A-i*z-s*M)*X,t[2]=(y*B-v*V+S*R)*X,t[3]=(m*V-u*B-d*R)*X,t[4]=(l*K-a*z-c*Y)*X,t[5]=(e*z-r*K+s*Y)*X,t[6]=(v*U-g*B-S*I)*X,t[7]=(h*B-m*U+d*I)*X,t[8]=(a*A-o*K+c*G)*X,t[9]=(i*K-e*A-s*G)*X,t[10]=(g*V-y*U+S*w)*X,t[11]=(u*U-h*V-d*w)*X,t[12]=(o*Y-a*M-l*G)*X,t[13]=(e*M-i*Y+r*G)*X,t[14]=(y*I-g*R-v*w)*X,t[15]=(h*R-u*I+m*w)*X,this}scale(t){let e=this.elements,i=t.x,r=t.y,s=t.z;return e[0]*=i,e[4]*=r,e[8]*=s,e[1]*=i,e[5]*=r,e[9]*=s,e[2]*=i,e[6]*=r,e[10]*=s,e[3]*=i,e[7]*=r,e[11]*=s,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,r))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),r=Math.sin(e),s=1-i,a=t.x,o=t.y,l=t.z,c=s*a,h=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+i,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,r,s,a){return this.set(1,i,s,0,t,1,a,0,e,r,1,0,0,0,0,1),this}compose(t,e,i){let r=this.elements,s=e._x,a=e._y,o=e._z,l=e._w,c=s+s,h=a+a,u=o+o,m=s*c,d=s*h,g=s*u,y=a*h,v=a*u,S=o*u,w=l*c,I=l*h,U=l*u,R=i.x,V=i.y,B=i.z;return r[0]=(1-(y+S))*R,r[1]=(d+U)*R,r[2]=(g-I)*R,r[3]=0,r[4]=(d-U)*V,r[5]=(1-(m+S))*V,r[6]=(v+w)*V,r[7]=0,r[8]=(g+I)*B,r[9]=(v-w)*B,r[10]=(1-(m+y))*B,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,i){let r=this.elements;t.x=r[12],t.y=r[13],t.z=r[14];let s=this.determinantAffine();if(s===0)return i.set(1,1,1),e.identity(),this;let a=Ti.set(r[0],r[1],r[2]).length(),o=Ti.set(r[4],r[5],r[6]).length(),l=Ti.set(r[8],r[9],r[10]).length();s<0&&(a=-a),Te.copy(this);let c=1/a,h=1/o,u=1/l;return Te.elements[0]*=c,Te.elements[1]*=c,Te.elements[2]*=c,Te.elements[4]*=h,Te.elements[5]*=h,Te.elements[6]*=h,Te.elements[8]*=u,Te.elements[9]*=u,Te.elements[10]*=u,e.setFromRotationMatrix(Te),i.x=a,i.y=o,i.z=l,this}makePerspective(t,e,i,r,s,a,o=Oi,l=!1){let c=this.elements,h=2*s/(e-t),u=2*s/(i-r),m=(e+t)/(e-t),d=(i+r)/(i-r),g,y;if(l)g=s/(a-s),y=a*s/(a-s);else if(o===Oi)g=-(a+s)/(a-s),y=-2*a*s/(a-s);else if(o===Ul)g=-a/(a-s),y=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=m,c[12]=0,c[1]=0,c[5]=u,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=g,c[14]=y,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(t,e,i,r,s,a,o=Oi,l=!1){let c=this.elements,h=2/(e-t),u=2/(i-r),m=-(e+t)/(e-t),d=-(i+r)/(i-r),g,y;if(l)g=1/(a-s),y=a/(a-s);else if(o===Oi)g=-2/(a-s),y=-(a+s)/(a-s);else if(o===Ul)g=-1/(a-s),y=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=m,c[1]=0,c[5]=u,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=g,c[14]=y,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let r=0;r<16;r++)if(e[r]!==i[r])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}},Ti=new C,Te=new Ct,ky=new C(0,0,0),Vy=new C(1,1,1),Ln=new C,Ws=new C,ue=new C,sf=new Ct,af=new He,Bn=class n{constructor(t=0,e=0,i=0,r=n.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,r=this._order){return this._x=t,this._y=e,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let r=t.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],u=r[2],m=r[6],d=r[10];switch(e){case"XYZ":this._y=Math.asin(it(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-it(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(it(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-it(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(m,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(it(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-it(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:wt("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return sf.makeRotationFromQuaternion(t),this.setFromRotationMatrix(sf,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return af.setFromEuler(this),this.setFromQuaternion(af,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Bn.DEFAULT_ORDER="XYZ";var Pr=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},Hy=0,of=new C,Ai=new He,Ke=new Ct,Xs=new C,Sr=new C,Wy=new C,Xy=new He,lf=new C(1,0,0),cf=new C(0,1,0),hf=new C(0,0,1),uf={type:"added"},qy={type:"removed"},Ci={type:"childadded",child:null},rl={type:"childremoved",child:null},We=class n extends Ot{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Hy++}),this.uuid=Wi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let t=new C,e=new Bn,i=new He,r=new C(1,1,1);function s(){i.setFromEuler(e,!1)}function a(){e.setFromQuaternion(i,void 0,!1)}e._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Ct},normalMatrix:{value:new tt}}),this.matrix=new Ct,this.matrixWorld=new Ct,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Pr,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(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Ai.setFromAxisAngle(t,e),this.quaternion.multiply(Ai),this}rotateOnWorldAxis(t,e){return Ai.setFromAxisAngle(t,e),this.quaternion.premultiply(Ai),this}rotateX(t){return this.rotateOnAxis(lf,t)}rotateY(t){return this.rotateOnAxis(cf,t)}rotateZ(t){return this.rotateOnAxis(hf,t)}translateOnAxis(t,e){return of.copy(t).applyQuaternion(this.quaternion),this.position.add(of.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(lf,t)}translateY(t){return this.translateOnAxis(cf,t)}translateZ(t){return this.translateOnAxis(hf,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ke.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Xs.copy(t):Xs.set(t,e,i);let r=this.parent;this.updateWorldMatrix(!0,!1),Sr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ke.lookAt(Sr,Xs,this.up):Ke.lookAt(Xs,Sr,this.up),this.quaternion.setFromRotationMatrix(Ke),r&&(Ke.extractRotation(r.matrixWorld),Ai.setFromRotationMatrix(Ke),this.quaternion.premultiply(Ai.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(_t("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(uf),Ci.child=t,this.dispatchEvent(Ci),Ci.child=null):_t("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(qy),rl.child=t,this.dispatchEvent(rl),rl.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ke.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Ke.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ke),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(uf),Ci.child=t,this.dispatchEvent(Ci),Ci.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,r=this.children.length;i<r;i++){let a=this.children[i].getObjectByProperty(t,e);if(a!==void 0)return a}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);let r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Sr,t,Wy),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Sr,Xy,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(t){t(this);let e=this.children;for(let i=0,r=e.length;i<r;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let i=0,r=e.length;i<r;i++)e[i].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,i=t.y,r=t.z,s=this.matrix.elements;s[12]+=e-s[0]*e-s[4]*i-s[8]*r,s[13]+=i-s[1]*e-s[5]*i-s[9]*r,s[14]+=r-s[2]*e-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let i=0,r=e.length;i<r;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e,i=!1){let r=this.parent;if(t===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),e===!0){let s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].updateWorldMatrix(!1,!0,i)}}toJSON(t){let e=t===void 0||typeof t=="string",i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,r.name=this.name,r.castShadow=this.castShadow,r.receiveShadow=this.receiveShadow,r.visible=this.visible,r.frustumCulled=this.frustumCulled,r.renderOrder=this.renderOrder,r.static=this.static,r.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(t),r.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(t.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){let u=l[c];s(t.shapes,u)}else s(t.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(t.materials,this.material[l]));r.material=o}else r.material=s(t.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){let l=this.animations[o];r.animations.push(s(t.animations,l))}}if(e){let o=a(t.geometries),l=a(t.materials),c=a(t.textures),h=a(t.images),u=a(t.shapes),m=a(t.skeletons),d=a(t.animations),g=a(t.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),h.length>0&&(i.images=h),u.length>0&&(i.shapes=u),m.length>0&&(i.skeletons=m),d.length>0&&(i.animations=d),g.length>0&&(i.nodes=g)}return i.object=r,i;function a(o){let l=[];for(let c in o){let h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let i=0;i<t.children.length;i++){let r=t.children[i];this.add(r.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};We.DEFAULT_UP=new C(0,1,0);We.DEFAULT_MATRIX_AUTO_UPDATE=!0;We.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Uf={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},Nn={h:0,s:0,l:0},qs={h:0,s:0,l:0};function sl(n,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?n+(t-n)*6*e:e<1/2?t:e<2/3?n+(t-n)*6*(2/3-e):n}var et=class{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(e===void 0&&i===void 0){let r=t;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=be){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Se.colorSpaceToWorking(this,e),this}setRGB(t,e,i,r=Se.workingColorSpace){return this.r=t,this.g=e,this.b=i,Se.colorSpaceToWorking(this,r),this}setHSL(t,e,i,r=Se.workingColorSpace){if(t=ac(t,1),e=it(e,0,1),i=it(i,0,1),e===0)this.r=this.g=this.b=i;else{let s=i<=.5?i*(1+e):i+e-i*e,a=2*i-s;this.r=sl(a,s,t+1/3),this.g=sl(a,s,t),this.b=sl(a,s,t-1/3)}return Se.colorSpaceToWorking(this,r),this}setStyle(t,e=be){function i(s){s!==void 0&&parseFloat(s)<1&&wt("Color: Alpha component of "+t+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(t)){let s,a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:wt("Color: Unknown color model "+t)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){let s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(s,16),e);wt("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=be){let i=Uf[t.toLowerCase()];return i!==void 0?this.setHex(i,e):wt("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=rn(t.r),this.g=rn(t.g),this.b=rn(t.b),this}copyLinearToSRGB(t){return this.r=Gi(t.r),this.g=Gi(t.g),this.b=Gi(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=be){return Se.workingToColorSpace(Ht.copy(this),t),Math.round(it(Ht.r*255,0,255))*65536+Math.round(it(Ht.g*255,0,255))*256+Math.round(it(Ht.b*255,0,255))}getHexString(t=be){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Se.workingColorSpace){Se.workingToColorSpace(Ht.copy(this),e);let i=Ht.r,r=Ht.g,s=Ht.b,a=Math.max(i,r,s),o=Math.min(i,r,s),l,c,h=(o+a)/2;if(o===a)l=0,c=0;else{let u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case i:l=(r-s)/u+(r<s?6:0);break;case r:l=(s-i)/u+2;break;case s:l=(i-r)/u+4;break}l/=6}return t.h=l,t.s=c,t.l=h,t}getRGB(t,e=Se.workingColorSpace){return Se.workingToColorSpace(Ht.copy(this),e),t.r=Ht.r,t.g=Ht.g,t.b=Ht.b,t}getStyle(t=be){Se.workingToColorSpace(Ht.copy(this),t);let e=Ht.r,i=Ht.g,r=Ht.b;return t!==be?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(t,e,i){return this.getHSL(Nn),this.setHSL(Nn.h+t,Nn.s+e,Nn.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Nn),t.getHSL(qs);let i=Tr(Nn.h,qs.h,e),r=Tr(Nn.s,qs.s,e),s=Tr(Nn.l,qs.l,e);return this.setHSL(i,r,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,i=this.g,r=this.b,s=t.elements;return this.r=s[0]*e+s[3]*i+s[6]*r,this.g=s[1]*e+s[4]*i+s[7]*r,this.b=s[2]*e+s[5]*i+s[8]*r,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Ht=new et;et.NAMES=Uf;var Rr=class extends We{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Bn,this.environmentIntensity=1,this.environmentRotation=new Bn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),e.object.backgroundBlurriness=this.backgroundBlurriness,e.object.backgroundIntensity=this.backgroundIntensity,e.object.backgroundRotation=this.backgroundRotation.toArray(),e.object.environmentIntensity=this.environmentIntensity,e.object.environmentRotation=this.environmentRotation.toArray(),e}},Ae=new C,Qe=new C,al=new C,tn=new C,Pi=new C,Ri=new C,ff=new C,ol=new C,ll=new C,cl=new C,hl=new Yt,ul=new Yt,fl=new Yt,Fn=class n{constructor(t=new C,e=new C,i=new C){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,r){r.subVectors(i,e),Ae.subVectors(t,e),r.cross(Ae);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(t,e,i,r,s){Ae.subVectors(r,e),Qe.subVectors(i,e),al.subVectors(t,e);let a=Ae.dot(Ae),o=Ae.dot(Qe),l=Ae.dot(al),c=Qe.dot(Qe),h=Qe.dot(al),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;let m=1/u,d=(c*l-o*h)*m,g=(a*h-o*l)*m;return s.set(1-d-g,g,d)}static containsPoint(t,e,i,r){return this.getBarycoord(t,e,i,r,tn)===null?!1:tn.x>=0&&tn.y>=0&&tn.x+tn.y<=1}static getInterpolation(t,e,i,r,s,a,o,l){return this.getBarycoord(t,e,i,r,tn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,tn.x),l.addScaledVector(a,tn.y),l.addScaledVector(o,tn.z),l)}static getInterpolatedAttribute(t,e,i,r,s,a){return hl.setScalar(0),ul.setScalar(0),fl.setScalar(0),hl.fromBufferAttribute(t,e),ul.fromBufferAttribute(t,i),fl.fromBufferAttribute(t,r),a.setScalar(0),a.addScaledVector(hl,s.x),a.addScaledVector(ul,s.y),a.addScaledVector(fl,s.z),a}static isFrontFacing(t,e,i,r){return Ae.subVectors(i,e),Qe.subVectors(t,e),Ae.cross(Qe).dot(r)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,r){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,i,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,r),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ae.subVectors(this.c,this.b),Qe.subVectors(this.a,this.b),Ae.cross(Qe).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return n.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return n.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,r,s){return n.getInterpolation(t,this.a,this.b,this.c,e,i,r,s)}containsPoint(t){return n.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return n.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i=this.a,r=this.b,s=this.c,a,o;Pi.subVectors(r,i),Ri.subVectors(s,i),ol.subVectors(t,i);let l=Pi.dot(ol),c=Ri.dot(ol);if(l<=0&&c<=0)return e.copy(i);ll.subVectors(t,r);let h=Pi.dot(ll),u=Ri.dot(ll);if(h>=0&&u<=h)return e.copy(r);let m=l*u-h*c;if(m<=0&&l>=0&&h<=0)return a=l/(l-h),e.copy(i).addScaledVector(Pi,a);cl.subVectors(t,s);let d=Pi.dot(cl),g=Ri.dot(cl);if(g>=0&&d<=g)return e.copy(s);let y=d*c-l*g;if(y<=0&&c>=0&&g<=0)return o=c/(c-g),e.copy(i).addScaledVector(Ri,o);let v=h*g-d*u;if(v<=0&&u-h>=0&&d-g>=0)return ff.subVectors(s,r),o=(u-h)/(u-h+(d-g)),e.copy(r).addScaledVector(ff,o);let S=1/(v+y+m);return a=y*S,o=m*S,e.copy(i).addScaledVector(Pi,a).addScaledVector(Ri,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Re=class{constructor(t=new C(1/0,1/0,1/0),e=new C(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Ce.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Ce.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=Ce.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let i=t.geometry;if(i!==void 0){let s=i.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)t.isMesh===!0?t.getVertexPosition(a,Ce):Ce.fromBufferAttribute(s,a),Ce.applyMatrix4(t.matrixWorld),this.expandByPoint(Ce);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Ys.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Ys.copy(i.boundingBox)),Ys.applyMatrix4(t.matrixWorld),this.union(Ys)}let r=t.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Ce),Ce.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(br),js.subVectors(this.max,br),Ii.subVectors(t.a,br),Li.subVectors(t.b,br),Ni.subVectors(t.c,br),Dn.subVectors(Li,Ii),Un.subVectors(Ni,Li),ei.subVectors(Ii,Ni);let e=[0,-Dn.z,Dn.y,0,-Un.z,Un.y,0,-ei.z,ei.y,Dn.z,0,-Dn.x,Un.z,0,-Un.x,ei.z,0,-ei.x,-Dn.y,Dn.x,0,-Un.y,Un.x,0,-ei.y,ei.x,0];return!dl(e,Ii,Li,Ni,js)||(e=[1,0,0,0,1,0,0,0,1],!dl(e,Ii,Li,Ni,js))?!1:(Zs.crossVectors(Dn,Un),e=[Zs.x,Zs.y,Zs.z],dl(e,Ii,Li,Ni,js))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Ce).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Ce).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(en[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),en[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),en[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),en[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),en[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),en[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),en[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),en[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(en),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},en=[new C,new C,new C,new C,new C,new C,new C,new C],Ce=new C,Ys=new Re,Ii=new C,Li=new C,Ni=new C,Dn=new C,Un=new C,ei=new C,br=new C,js=new C,Zs=new C,ni=new C;function dl(n,t,e,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){ni.fromArray(n,s);let o=r.x*Math.abs(ni.x)+r.y*Math.abs(ni.y)+r.z*Math.abs(ni.z),l=t.dot(ni),c=e.dot(ni),h=i.dot(ni);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}var Tt=new C,Js=new nt,Yy=0,sn=class extends Ot{constructor(t,e,i=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Yy++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=i,this.usage=Lf,this.updateRanges=[],this.gpuType=ln,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[t+r]=e.array[i+r];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)Js.fromBufferAttribute(this,e),Js.applyMatrix3(t),this.setXY(e,Js.x,Js.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)Tt.fromBufferAttribute(this,e),Tt.applyMatrix3(t),this.setXYZ(e,Tt.x,Tt.y,Tt.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Tt.fromBufferAttribute(this,e),Tt.applyMatrix4(t),this.setXYZ(e,Tt.x,Tt.y,Tt.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Tt.fromBufferAttribute(this,e),Tt.applyNormalMatrix(t),this.setXYZ(e,Tt.x,Tt.y,Tt.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Tt.fromBufferAttribute(this,e),Tt.transformDirection(t),this.setXYZ(e,Tt.x,Tt.y,Tt.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=Fi(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=qt(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Fi(e,this.array)),e}setX(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Fi(e,this.array)),e}setY(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Fi(e,this.array)),e}setZ(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Fi(e,this.array)),e}setW(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=qt(e,this.array),i=qt(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,r){return t*=this.itemSize,this.normalized&&(e=qt(e,this.array),i=qt(i,this.array),r=qt(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=r,this}setXYZW(t,e,i,r,s){return t*=this.itemSize,this.normalized&&(e=qt(e,this.array),i=qt(i,this.array),r=qt(r,this.array),s=qt(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=r,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return t.name=this.name,t.usage=this.usage,t.gpuType=this.gpuType,t}dispose(){this.dispatchEvent({type:"dispose"})}};var Ir=class extends sn{constructor(t,e,i){super(new Uint16Array(t),e,i)}};var Lr=class extends sn{constructor(t,e,i){super(new Uint32Array(t),e,i)}};var On=class extends sn{constructor(t,e,i){super(new Float32Array(t),e,i)}},jy=new Re,wr=new C,pl=new C,ki=class{constructor(t=new C,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;e!==void 0?i.copy(e):jy.setFromPoints(t).getCenter(i);let r=0;for(let s=0,a=t.length;s<a;s++)r=Math.max(r,i.distanceToSquared(t[s]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;wr.subVectors(t,this.center);let e=wr.lengthSq();if(e>this.radius*this.radius){let i=Math.sqrt(e),r=(i-this.radius)*.5;this.center.addScaledVector(wr,r/i),this.radius+=r}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(pl.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(wr.copy(t.center).add(pl)),this.expandByPoint(wr.copy(t.center).sub(pl))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},Zy=0,Me=new Ct,ml=new We,Di=new C,fe=new Re,Er=new Re,Lt=new C,Vi=class n extends Ot{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Zy++}),this.uuid=Wi(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(vy(t)?Lr:Ir)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let s=new tt().getNormalMatrix(t);i.applyNormalMatrix(s),i.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(t),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return Me.makeRotationFromQuaternion(t),this.applyMatrix4(Me),this}rotateX(t){return Me.makeRotationX(t),this.applyMatrix4(Me),this}rotateY(t){return Me.makeRotationY(t),this.applyMatrix4(Me),this}rotateZ(t){return Me.makeRotationZ(t),this.applyMatrix4(Me),this}translate(t,e,i){return Me.makeTranslation(t,e,i),this.applyMatrix4(Me),this}scale(t,e,i){return Me.makeScale(t,e,i),this.applyMatrix4(Me),this}lookAt(t){return ml.lookAt(t),ml.updateMatrix(),this.applyMatrix4(ml.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Di).negate(),this.translate(Di.x,Di.y,Di.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let i=[];for(let r=0,s=t.length;r<s;r++){let a=t[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new On(i,3))}else{let i=Math.min(t.length,e.count);for(let r=0;r<i;r++){let s=t[r];e.setXYZ(r,s.x,s.y,s.z||0)}t.length>e.count&&wt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Re);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){_t("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new C(-1/0,-1/0,-1/0),new C(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,r=e.length;i<r;i++){let s=e[i];fe.setFromBufferAttribute(s),this.morphTargetsRelative?(Lt.addVectors(this.boundingBox.min,fe.min),this.boundingBox.expandByPoint(Lt),Lt.addVectors(this.boundingBox.max,fe.max),this.boundingBox.expandByPoint(Lt)):(this.boundingBox.expandByPoint(fe.min),this.boundingBox.expandByPoint(fe.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&_t('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ki);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){_t("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new C,1/0);return}if(t){let i=this.boundingSphere.center;if(fe.setFromBufferAttribute(t),e)for(let s=0,a=e.length;s<a;s++){let o=e[s];Er.setFromBufferAttribute(o),this.morphTargetsRelative?(Lt.addVectors(fe.min,Er.min),fe.expandByPoint(Lt),Lt.addVectors(fe.max,Er.max),fe.expandByPoint(Lt)):(fe.expandByPoint(Er.min),fe.expandByPoint(Er.max))}fe.getCenter(i);let r=0;for(let s=0,a=t.count;s<a;s++)Lt.fromBufferAttribute(t,s),r=Math.max(r,i.distanceToSquared(Lt));if(e)for(let s=0,a=e.length;s<a;s++){let o=e[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)Lt.fromBufferAttribute(o,c),l&&(Di.fromBufferAttribute(t,c),Lt.add(Di)),r=Math.max(r,i.distanceToSquared(Lt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&_t('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){_t("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=e.position,r=e.normal,s=e.uv,a=this.getAttribute("tangent");(a===void 0||a.count!==i.count)&&(a=new sn(new Float32Array(4*i.count),4),this.setAttribute("tangent",a));let o=[],l=[];for(let G=0;G<i.count;G++)o[G]=new C,l[G]=new C;let c=new C,h=new C,u=new C,m=new nt,d=new nt,g=new nt,y=new C,v=new C;function S(G,Y,K){c.fromBufferAttribute(i,G),h.fromBufferAttribute(i,Y),u.fromBufferAttribute(i,K),m.fromBufferAttribute(s,G),d.fromBufferAttribute(s,Y),g.fromBufferAttribute(s,K),h.sub(c),u.sub(c),d.sub(m),g.sub(m);let M=1/(d.x*g.y-g.x*d.y);isFinite(M)&&(y.copy(h).multiplyScalar(g.y).addScaledVector(u,-d.y).multiplyScalar(M),v.copy(u).multiplyScalar(d.x).addScaledVector(h,-g.x).multiplyScalar(M),o[G].add(y),o[Y].add(y),o[K].add(y),l[G].add(v),l[Y].add(v),l[K].add(v))}let w=this.groups;w.length===0&&(w=[{start:0,count:t.count}]);for(let G=0,Y=w.length;G<Y;++G){let K=w[G],M=K.start,A=K.count;for(let z=M,j=M+A;z<j;z+=3)S(t.getX(z+0),t.getX(z+1),t.getX(z+2))}let I=new C,U=new C,R=new C,V=new C;function B(G){R.fromBufferAttribute(r,G),V.copy(R);let Y=o[G];I.copy(Y),I.sub(R.multiplyScalar(R.dot(Y))).normalize(),U.crossVectors(V,Y);let M=U.dot(l[G])<0?-1:1;a.setXYZW(G,I.x,I.y,I.z,M)}for(let G=0,Y=w.length;G<Y;++G){let K=w[G],M=K.start,A=K.count;for(let z=M,j=M+A;z<j;z+=3)B(t.getX(z+0)),B(t.getX(z+1)),B(t.getX(z+2))}this._transformed=!0}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0||i.count!==e.count)i=new sn(new Float32Array(e.count*3),3),this.setAttribute("normal",i);else for(let m=0,d=i.count;m<d;m++)i.setXYZ(m,0,0,0);let r=new C,s=new C,a=new C,o=new C,l=new C,c=new C,h=new C,u=new C;if(t)for(let m=0,d=t.count;m<d;m+=3){let g=t.getX(m+0),y=t.getX(m+1),v=t.getX(m+2);r.fromBufferAttribute(e,g),s.fromBufferAttribute(e,y),a.fromBufferAttribute(e,v),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),o.fromBufferAttribute(i,g),l.fromBufferAttribute(i,y),c.fromBufferAttribute(i,v),o.add(h),l.add(h),c.add(h),i.setXYZ(g,o.x,o.y,o.z),i.setXYZ(y,l.x,l.y,l.z),i.setXYZ(v,c.x,c.y,c.z)}else for(let m=0,d=e.count;m<d;m+=3)r.fromBufferAttribute(e,m+0),s.fromBufferAttribute(e,m+1),a.fromBufferAttribute(e,m+2),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),i.setXYZ(m+0,h.x,h.y,h.z),i.setXYZ(m+1,h.x,h.y,h.z),i.setXYZ(m+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Lt.fromBufferAttribute(t,e),Lt.normalize(),t.setXYZ(e,Lt.x,Lt.y,Lt.z)}toNonIndexed(){function t(o,l){let c=o.array,h=o.itemSize,u=o.normalized,m=new c.constructor(l.length*h),d=0,g=0;for(let y=0,v=l.length;y<v;y++){o.isInterleavedBufferAttribute?d=l[y]*o.data.stride+o.offset:d=l[y]*h;for(let S=0;S<h;S++)m[g++]=c[d++]}return new sn(m,h,u)}if(this.index===null)return wt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new n,i=this.index.array,r=this.attributes;for(let o in r){let l=r[o],c=t(l,i);e.setAttribute(o,c)}let s=this.morphAttributes;for(let o in s){let l=[],c=s[o];for(let h=0,u=c.length;h<u;h++){let m=c[h],d=t(m,i);l.push(d)}e.morphAttributes[o]=l}e.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let o=0,l=a.length;o<l;o++){let c=a[o];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,t.name=this.name,Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let l in i){let c=i[l];t.data.attributes[l]=c.toJSON(t.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],h=[];for(let u=0,m=c.length;u<m;u++){let d=c[u];h.push(d.toJSON(t.data))}h.length>0&&(r[l]=h,s=!0)}s&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(t.data.boundingSphere=o.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;i!==null&&this.setIndex(i.clone());let r=t.attributes;for(let c in r){let h=r[c];this.setAttribute(c,h.clone(e))}let s=t.morphAttributes;for(let c in s){let h=[],u=s[c];for(let m=0,d=u.length;m<d;m++)h.push(u[m].clone(e));this.morphAttributes[c]=h}this.morphTargetsRelative=t.morphTargetsRelative;let a=t.groups;for(let c=0,h=a.length;c<h;c++){let u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}let o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());let l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this._transformed=t._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}};var gl=new C,Jy=new C,$y=new tt,ga=class{constructor(t=new C(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,r){return this.normal.set(t,e,i),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){let r=gl.subVectors(i,e).cross(Jy.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,i=!0){let r=t.delta(gl),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let a=-(t.start.dot(this.normal)+this.constant)/s;return i===!0&&(a<0||a>1)?null:e.copy(t.start).addScaledVector(r,a)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||$y.getNormalMatrix(t),r=this.coplanarPoint(gl).applyMatrix4(t),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(t){return this.normal.fromArray(t.normal),this.constant=t.constant,this}},Ky=0,Nr=class extends Ot{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ky++}),this.uuid=Wi(),this.name="",this.type="Material",this.blending=kl,this.side=zl,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=wf,this.blendDst=Ef,this.blendEquation=bf,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new et(0,0,0),this.blendAlpha=0,this.depthFunc=ua,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=If,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ha,this.stencilZFail=ha,this.stencilZPass=ha,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let i=t[e];if(i===void 0){wt(`Material: parameter '${e}' has value of undefined.`);continue}let r=this[e];if(r===void 0){wt(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector2&&i&&i.isVector2||r&&r.isEuler&&i&&i.isEuler||r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[e]=i}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,i.blending=this.blending,i.side=this.side,i.shadowSide=this.shadowSide,i.vertexColors=this.vertexColors,i.opacity=this.opacity,i.transparent=this.transparent,i.blendSrc=this.blendSrc,i.blendDst=this.blendDst,i.blendEquation=this.blendEquation,i.blendSrcAlpha=this.blendSrcAlpha,i.blendDstAlpha=this.blendDstAlpha,i.blendEquationAlpha=this.blendEquationAlpha,i.blendColor=this.blendColor.getHex(),i.blendAlpha=this.blendAlpha,i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.clipIntersection=this.clipIntersection,i.clipShadows=this.clipShadows,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,i.stencilWrite=this.stencilWrite,i.polygonOffset=this.polygonOffset,i.polygonOffsetFactor=this.polygonOffsetFactor,i.polygonOffsetUnits=this.polygonOffsetUnits,i.dithering=this.dithering,i.alphaTest=this.alphaTest,i.alphaHash=this.alphaHash,i.alphaToCoverage=this.alphaToCoverage,i.premultipliedAlpha=this.premultipliedAlpha,i.forceSinglePass=this.forceSinglePass,i.allowOverride=this.allowOverride,i.visible=this.visible,i.toneMapped=this.toneMapped,i.name=this.name,this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(i.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(i.clippingPlanes=this.clippingPlanes.map(s=>s.toJSON())),this.rotation!==void 0&&(i.rotation=this.rotation),this.depthPacking!==void 0&&(i.depthPacking=this.depthPacking),this.linewidth!==void 0&&(i.linewidth=this.linewidth),this.linecap!==void 0&&(i.linecap=this.linecap),this.linejoin!==void 0&&(i.linejoin=this.linejoin),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.wireframe!==void 0&&(i.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(i.flatShading=this.flatShading),this.fog!==void 0&&(i.fog=this.fog),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){let a=[];for(let o in s){let l=s[o];delete l.metadata,a.push(l)}return a}if(e){let s=r(t.textures),a=r(t.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}fromJSON(t,e){if(t.uuid!==void 0&&(this.uuid=t.uuid),t.name!==void 0&&(this.name=t.name),t.color!==void 0&&this.color!==void 0&&this.color.setHex(t.color),t.roughness!==void 0&&(this.roughness=t.roughness),t.metalness!==void 0&&(this.metalness=t.metalness),t.sheen!==void 0&&(this.sheen=t.sheen),t.sheenColor!==void 0&&(this.sheenColor=new et().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(this.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(t.emissive),t.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(t.specular),t.specularIntensity!==void 0&&(this.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(this.shininess=t.shininess),t.clearcoat!==void 0&&(this.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(this.dispersion=t.dispersion),t.retroreflectivity!==void 0&&(this.retroreflectivity=t.retroreflectivity),t.iridescence!==void 0&&(this.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(this.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(this.transmission=t.transmission),t.thickness!==void 0&&(this.thickness=t.thickness),t.attenuationDistance!==void 0&&(this.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(this.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(this.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(this.fog=t.fog),t.flatShading!==void 0&&(this.flatShading=t.flatShading),t.blending!==void 0&&(this.blending=t.blending),t.combine!==void 0&&(this.combine=t.combine),t.side!==void 0&&(this.side=t.side),t.shadowSide!==void 0&&(this.shadowSide=t.shadowSide),t.opacity!==void 0&&(this.opacity=t.opacity),t.transparent!==void 0&&(this.transparent=t.transparent),t.alphaTest!==void 0&&(this.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(this.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(this.depthFunc=t.depthFunc),t.depthTest!==void 0&&(this.depthTest=t.depthTest),t.depthWrite!==void 0&&(this.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(this.colorWrite=t.colorWrite),t.clippingPlanes!==void 0&&(this.clippingPlanes=t.clippingPlanes.map(i=>new ga().fromJSON(i))),t.clipIntersection!==void 0&&(this.clipIntersection=t.clipIntersection),t.clipShadows!==void 0&&(this.clipShadows=t.clipShadows),t.depthPacking!==void 0&&(this.depthPacking=t.depthPacking),t.blendSrc!==void 0&&(this.blendSrc=t.blendSrc),t.blendDst!==void 0&&(this.blendDst=t.blendDst),t.blendEquation!==void 0&&(this.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(this.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(this.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(this.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(this.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(this.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(this.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(this.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(this.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(this.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(this.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(this.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(this.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(this.rotation=t.rotation),t.linewidth!==void 0&&(this.linewidth=t.linewidth),t.linecap!==void 0&&(this.linecap=t.linecap),t.linejoin!==void 0&&(this.linejoin=t.linejoin),t.dashSize!==void 0&&(this.dashSize=t.dashSize),t.gapSize!==void 0&&(this.gapSize=t.gapSize),t.scale!==void 0&&(this.scale=t.scale),t.polygonOffset!==void 0&&(this.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(this.dithering=t.dithering),t.alphaToCoverage!==void 0&&(this.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(this.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(this.allowOverride=t.allowOverride),t.visible!==void 0&&(this.visible=t.visible),t.toneMapped!==void 0&&(this.toneMapped=t.toneMapped),t.userData!==void 0&&(this.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?this.vertexColors=t.vertexColors>0:this.vertexColors=t.vertexColors),t.size!==void 0&&(this.size=t.size),t.sizeAttenuation!==void 0&&(this.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(this.map=e[t.map]||null),t.matcap!==void 0&&(this.matcap=e[t.matcap]||null),t.alphaMap!==void 0&&(this.alphaMap=e[t.alphaMap]||null),t.bumpMap!==void 0&&(this.bumpMap=e[t.bumpMap]||null),t.bumpScale!==void 0&&(this.bumpScale=t.bumpScale),t.normalMap!==void 0&&(this.normalMap=e[t.normalMap]||null),t.normalMapType!==void 0&&(this.normalMapType=t.normalMapType),t.normalScale!==void 0){let i=t.normalScale;Array.isArray(i)===!1&&(i=[i,i]),this.normalScale=new nt().fromArray(i)}return t.displacementMap!==void 0&&(this.displacementMap=e[t.displacementMap]||null),t.displacementScale!==void 0&&(this.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(this.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(this.roughnessMap=e[t.roughnessMap]||null),t.metalnessMap!==void 0&&(this.metalnessMap=e[t.metalnessMap]||null),t.emissiveMap!==void 0&&(this.emissiveMap=e[t.emissiveMap]||null),t.emissiveIntensity!==void 0&&(this.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(this.specularMap=e[t.specularMap]||null),t.specularIntensityMap!==void 0&&(this.specularIntensityMap=e[t.specularIntensityMap]||null),t.specularColorMap!==void 0&&(this.specularColorMap=e[t.specularColorMap]||null),t.envMap!==void 0&&(this.envMap=e[t.envMap]||null),t.envMapRotation!==void 0&&this.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(this.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(this.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(this.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(this.lightMap=e[t.lightMap]||null),t.lightMapIntensity!==void 0&&(this.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(this.aoMap=e[t.aoMap]||null),t.aoMapIntensity!==void 0&&(this.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(this.gradientMap=e[t.gradientMap]||null),t.clearcoatMap!==void 0&&(this.clearcoatMap=e[t.clearcoatMap]||null),t.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=e[t.clearcoatRoughnessMap]||null),t.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=e[t.clearcoatNormalMap]||null),t.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new nt().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(this.iridescenceMap=e[t.iridescenceMap]||null),t.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=e[t.iridescenceThicknessMap]||null),t.transmissionMap!==void 0&&(this.transmissionMap=e[t.transmissionMap]||null),t.thicknessMap!==void 0&&(this.thicknessMap=e[t.thicknessMap]||null),t.anisotropyMap!==void 0&&(this.anisotropyMap=e[t.anisotropyMap]||null),t.sheenColorMap!==void 0&&(this.sheenColorMap=e[t.sheenColorMap]||null),t.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=e[t.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(e!==null){let r=e.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=e[s].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}};var nn=new C,_l=new C,$s=new C,Ks=new C,Dr=class{constructor(t=new C,e=new C(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,nn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=nn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(nn.copy(this.origin).addScaledVector(this.direction,e),nn.distanceToSquared(t))}distanceSqToSegment(t,e,i,r){_l.copy(t).add(e).multiplyScalar(.5),$s.copy(e).sub(t).normalize(),Ks.copy(this.origin).sub(_l);let s=t.distanceTo(e)*.5,a=-this.direction.dot($s),o=Ks.dot(this.direction),l=-Ks.dot($s),c=Ks.lengthSq(),h=Math.abs(1-a*a),u,m,d,g;if(h>0)if(u=a*l-o,m=a*o-l,g=s*h,u>=0)if(m>=-g)if(m<=g){let y=1/h;u*=y,m*=y,d=u*(u+a*m+2*o)+m*(a*u+m+2*l)+c}else m=s,u=Math.max(0,-(a*m+o)),d=-u*u+m*(m+2*l)+c;else m=-s,u=Math.max(0,-(a*m+o)),d=-u*u+m*(m+2*l)+c;else m<=-g?(u=Math.max(0,-(-a*s+o)),m=u>0?-s:Math.min(Math.max(-s,-l),s),d=-u*u+m*(m+2*l)+c):m<=g?(u=0,m=Math.min(Math.max(-s,-l),s),d=m*(m+2*l)+c):(u=Math.max(0,-(a*s+o)),m=u>0?s:Math.min(Math.max(-s,-l),s),d=-u*u+m*(m+2*l)+c);else m=a>0?-s:s,u=Math.max(0,-(a*m+o)),d=-u*u+m*(m+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(_l).addScaledVector($s,m),d}intersectSphere(t,e){if(t.radius<0)return null;nn.subVectors(t.center,this.origin);let i=nn.dot(this.direction),r=nn.dot(nn)-i*i,s=t.radius*t.radius;if(r>s)return null;let a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return i===null?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,r,s,a,o,l,c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,m=this.origin;return c>=0?(i=(t.min.x-m.x)*c,r=(t.max.x-m.x)*c):(i=(t.max.x-m.x)*c,r=(t.min.x-m.x)*c),h>=0?(s=(t.min.y-m.y)*h,a=(t.max.y-m.y)*h):(s=(t.max.y-m.y)*h,a=(t.min.y-m.y)*h),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),u>=0?(o=(t.min.z-m.z)*u,l=(t.max.z-m.z)*u):(o=(t.max.z-m.z)*u,l=(t.min.z-m.z)*u),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,e)}intersectsBox(t){return this.intersectBox(t,nn)!==null}intersectTriangle(t,e,i,r,s){let a=this.origin,o=this.direction,l=o.x,c=o.y,h=o.z,u=t.x-a.x,m=t.y-a.y,d=t.z-a.z,g=e.x-a.x,y=e.y-a.y,v=e.z-a.z,S=i.x-a.x,w=i.y-a.y,I=i.z-a.z,U=Math.abs(l),R=Math.abs(c),V=Math.abs(h),B,G,Y,K,M,A,z,j,X,J,k,It;if(U>=R&&U>=V?(Y=l,A=u,X=g,It=S,l>=0?(B=c,G=h,K=m,M=d,z=y,j=v,J=w,k=I):(B=h,G=c,K=d,M=m,z=v,j=y,J=I,k=w)):R>=V?(Y=c,A=m,X=y,It=w,c>=0?(B=h,G=l,K=d,M=u,z=v,j=g,J=I,k=S):(B=l,G=h,K=u,M=d,z=g,j=v,J=S,k=I)):(Y=h,A=d,X=v,It=I,h>=0?(B=l,G=c,K=u,M=m,z=g,j=y,J=S,k=w):(B=c,G=l,K=m,M=u,z=y,j=g,J=w,k=S)),Y===0)return null;let Kt=B/Y,ot=G/Y,Nt=1/Y,cr=K-Kt*A,hr=M-ot*A,$n=z-Kt*X,ce=j-ot*X,Dt=J-Kt*It,Ze=k-ot*It,De=Dt*ce-Ze*$n,ut=cr*Ze-hr*Dt,at=$n*hr-ce*cr;if(r){if(De<0||ut<0||at<0)return null}else if((De<0||ut<0||at<0)&&(De>0||ut>0||at>0))return null;let fi=De+ut+at;if(fi===0)return null;let di=Nt*(De*A+ut*X+at*It);return(fi>0?di<0:di>0)?null:this.at(di/fi,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},_a=class extends Nr{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new et(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bn,this.combine=Vl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},df=new Ct,ii=new Dr,Qs=new ki,pf=new C,ta=new C,ea=new C,na=new C,yl=new C,ia=new C,mf=new C,ra=new C,Ur=class extends We{constructor(t=new Vi,e=new _a){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){let r=e[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){let o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(t,e){let i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;e.fromBufferAttribute(r,t);let o=this.morphTargetInfluences;if(s&&o){ia.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let h=o[l],u=s[l];h!==0&&(yl.fromBufferAttribute(u,t),a?ia.addScaledVector(yl,h):ia.addScaledVector(yl.sub(e),h))}e.add(ia)}return e}intersectsFrustum(t){return t.intersectsObject(this)}raycast(t,e){let i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Qs.copy(i.boundingSphere),Qs.applyMatrix4(s),ii.copy(t.ray).recast(t.near),!(Qs.containsPoint(ii.origin)===!1&&(ii.intersectSphere(Qs,pf)===null||ii.origin.distanceToSquared(pf)>(t.far-t.near)**2))&&(df.copy(s).invert(),ii.copy(t.ray).applyMatrix4(df),!(i.boundingBox!==null&&ii.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(t,e,ii)))}_computeIntersections(t,e,i){let r,s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,m=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,y=m.length;g<y;g++){let v=m[g],S=a[v.materialIndex],w=Math.max(v.start,d.start),I=Math.min(o.count,Math.min(v.start+v.count,d.start+d.count));for(let U=w,R=I;U<R;U+=3){let V=o.getX(U),B=o.getX(U+1),G=o.getX(U+2);r=sa(this,S,t,i,c,h,u,V,B,G),r&&(r.faceIndex=Math.floor(U/3),r.face.materialIndex=v.materialIndex,e.push(r))}}else{let g=Math.max(0,d.start),y=Math.min(o.count,d.start+d.count);for(let v=g,S=y;v<S;v+=3){let w=o.getX(v),I=o.getX(v+1),U=o.getX(v+2);r=sa(this,a,t,i,c,h,u,w,I,U),r&&(r.faceIndex=Math.floor(v/3),e.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,y=m.length;g<y;g++){let v=m[g],S=a[v.materialIndex],w=Math.max(v.start,d.start),I=Math.min(l.count,Math.min(v.start+v.count,d.start+d.count));for(let U=w,R=I;U<R;U+=3){let V=U,B=U+1,G=U+2;r=sa(this,S,t,i,c,h,u,V,B,G),r&&(r.faceIndex=Math.floor(U/3),r.face.materialIndex=v.materialIndex,e.push(r))}}else{let g=Math.max(0,d.start),y=Math.min(l.count,d.start+d.count);for(let v=g,S=y;v<S;v+=3){let w=v,I=v+1,U=v+2;r=sa(this,a,t,i,c,h,u,w,I,U),r&&(r.faceIndex=Math.floor(v/3),e.push(r))}}}};function Qy(n,t,e,i,r,s,a,o){let l;if(t.side===Sf?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,t.side===zl,o),l===null)return null;ra.copy(o),ra.applyMatrix4(n.matrixWorld);let c=e.ray.origin.distanceTo(ra);return c<e.near||c>e.far?null:{distance:c,point:ra.clone(),object:n}}function sa(n,t,e,i,r,s,a,o,l,c){n.getVertexPosition(o,ta),n.getVertexPosition(l,ea),n.getVertexPosition(c,na);let h=Qy(n,t,e,i,ta,ea,na,mf);if(h){let u=new C;Fn.getBarycoord(mf,ta,ea,na,u),r&&(h.uv=Fn.getInterpolatedAttribute(r,o,l,c,u,new nt)),s&&(h.uv1=Fn.getInterpolatedAttribute(s,o,l,c,u,new nt)),a&&(h.normal=Fn.getInterpolatedAttribute(a,o,l,c,u,new C),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));let m={a:o,b:l,c,normal:new C,materialIndex:0};Fn.getNormal(ta,ea,na,m.normal),h.face=m,h.barycoord=u}return h}var Gn=class extends we{constructor(t=null,e=1,i=1,r,s,a,o,l,c=an,h=an,u,m){super(null,a,o,l,c,h,r,s,u,m),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Fr=class n extends Vi{constructor(t=1,e=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:r};let s=t/2,a=e/2,o=Math.floor(i),l=Math.floor(r),c=o+1,h=l+1,u=t/o,m=e/l,d=[],g=[],y=[],v=[];for(let S=0;S<h;S++){let w=S*m-a;for(let I=0;I<c;I++){let U=I*u-s;g.push(U,-w,0),y.push(0,0,1),v.push(I/o),v.push(1-S/l)}}for(let S=0;S<l;S++)for(let w=0;w<o;w++){let I=w+c*S,U=w+c*(S+1),R=w+1+c*(S+1),V=w+1+c*S;d.push(I,U,V),d.push(U,R,V)}this.setIndex(d),this.setAttribute("position",new On(g,3)),this.setAttribute("normal",new On(y,3)),this.setAttribute("uv",new On(v,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new n(t.width,t.height,t.widthSegments,t.heightSegments)}};function oc(n){let t={};for(let e in n){t[e]={};for(let i in n[e]){let r=n[e][i];if(gf(r))r.isRenderTargetTexture?(wt("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][i]=null):t[e][i]=r.clone();else if(Array.isArray(r))if(gf(r[0])){let s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();t[e][i]=s}else t[e][i]=r.slice();else t[e][i]=r}}return t}function Zt(n){let t={};for(let e=0;e<n.length;e++){let i=oc(n[e]);for(let r in i)t[r]=i[r]}return t}function gf(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function tv(n){let t=[];for(let e=0;e<n.length;e++)t.push(n[e].clone());return t}var ev=`void main() {
6
+ Originally allocated`),"captureStackTrace"in Error&&Error.captureStackTrace(E.leakWarning,Qh),Fo.register(m,E,m)}return m},Zh=m=>Fo.unregister(m),yr(f))}function ug(){if(this.$$.ptr||Uo(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var f=yr(Object.create(Object.getPrototypeOf(this),{$$:{value:ng(this.$$)}}));return f.$$.count.value+=1,f.$$.deleteScheduled=!1,f}function fg(){this.$$.ptr||Uo(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ct("Object already scheduled for deletion"),Zh(this),Jh(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function dg(){return!this.$$.ptr}function pg(){return this.$$.ptr||Uo(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ct("Object already scheduled for deletion"),mr.push(this),mr.length===1&&gr&&gr(Bo),this.$$.deleteScheduled=!0,this}function mg(){bi.prototype.isAliasOf=ig,bi.prototype.clone=ug,bi.prototype.delete=fg,bi.prototype.isDeleted=dg,bi.prototype.deleteLater=pg}function bi(){}function tu(f,m,y){if(f[m].overloadTable===void 0){var M=f[m];f[m]=function(){return f[m].overloadTable.hasOwnProperty(arguments.length)||ct("Function '"+y+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+f[m].overloadTable+")!"),f[m].overloadTable[arguments.length].apply(this,arguments)},f[m].overloadTable=[],f[m].overloadTable[M.argCount]=M}}function gg(f,m,y){e.hasOwnProperty(f)?((y===void 0||e[f].overloadTable!==void 0&&e[f].overloadTable[y]!==void 0)&&ct("Cannot register public name '"+f+"' twice"),tu(e,f,f),e.hasOwnProperty(y)&&ct("Cannot register multiple overloads of a function with the same number of arguments ("+y+")!"),e[f].overloadTable[y]=m):(e[f]=m,y!==void 0&&(e[f].numArguments=y))}function _g(f,m,y,M,E,L,O,C){this.name=f,this.constructor=m,this.instancePrototype=y,this.rawDestructor=M,this.baseClass=E,this.getActualType=L,this.upcast=O,this.downcast=C,this.pureVirtualFunctions=[]}function Go(f,m,y){for(;m!==y;)m.upcast||ct("Expected null or instance of "+y.name+", got an instance of "+m.name),f=m.upcast(f),m=m.baseClass;return f}function yg(f,m){if(m===null)return this.isReference&&ct("null is not a valid "+this.name),0;m.$$||ct('Cannot pass "'+En(m)+'" as a '+this.name),m.$$.ptr||ct("Cannot pass deleted object as a pointer of type "+this.name);var y=m.$$.ptrType.registeredClass,M=Go(m.$$.ptr,y,this.registeredClass);return M}function vg(f,m){var y;if(m===null)return this.isReference&&ct("null is not a valid "+this.name),this.isSmartPointer?(y=this.rawConstructor(),f!==null&&f.push(this.rawDestructor,y),y):0;m.$$||ct('Cannot pass "'+En(m)+'" as a '+this.name),m.$$.ptr||ct("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&m.$$.ptrType.isConst&&ct("Cannot convert argument of type "+(m.$$.smartPtrType?m.$$.smartPtrType.name:m.$$.ptrType.name)+" to parameter type "+this.name);var M=m.$$.ptrType.registeredClass;if(y=Go(m.$$.ptr,M,this.registeredClass),this.isSmartPointer)switch(m.$$.smartPtr===void 0&&ct("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:m.$$.smartPtrType===this?y=m.$$.smartPtr:ct("Cannot convert argument of type "+(m.$$.smartPtrType?m.$$.smartPtrType.name:m.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:y=m.$$.smartPtr;break;case 2:if(m.$$.smartPtrType===this)y=m.$$.smartPtr;else{var E=m.clone();y=this.rawShare(y,Vo.toHandle(function(){E.delete()})),f!==null&&f.push(this.rawDestructor,y)}break;default:ct("Unsupporting sharing policy")}return y}function xg(f,m){if(m===null)return this.isReference&&ct("null is not a valid "+this.name),0;m.$$||ct('Cannot pass "'+En(m)+'" as a '+this.name),m.$$.ptr||ct("Cannot pass deleted object as a pointer of type "+this.name),m.$$.ptrType.isConst&&ct("Cannot convert argument of type "+m.$$.ptrType.name+" to parameter type "+this.name);var y=m.$$.ptrType.registeredClass,M=Go(m.$$.ptr,y,this.registeredClass);return M}function Ms(f){return this.fromWireType(ft[f>>2])}function Mg(f){return this.rawGetPointee&&(f=this.rawGetPointee(f)),f}function Sg(f){this.rawDestructor&&this.rawDestructor(f)}function bg(f){f!==null&&f.delete()}function Eg(){$e.prototype.getPointee=Mg,$e.prototype.destructor=Sg,$e.prototype.argPackAdvance=8,$e.prototype.readValueFromPointer=Ms,$e.prototype.deleteObject=bg,$e.prototype.fromWireType=Qh}function $e(f,m,y,M,E,L,O,C,F,V,J){this.name=f,this.registeredClass=m,this.isReference=y,this.isConst=M,this.isSmartPointer=E,this.pointeeType=L,this.sharingPolicy=O,this.rawGetPointee=C,this.rawConstructor=F,this.rawShare=V,this.rawDestructor=J,!E&&m.baseClass===void 0?M?(this.toWireType=yg,this.destructorFunction=null):(this.toWireType=xg,this.destructorFunction=null):this.toWireType=vg}function wg(f,m,y){e.hasOwnProperty(f)||vs("Replacing nonexistant public symbol"),e[f].overloadTable!==void 0&&y!==void 0?e[f].overloadTable[y]=m:(e[f]=m,e[f].argCount=y)}function Tg(f,m,y){z("dynCall_"+f in e,"bad function pointer type - no table for sig '"+f+"'"),y&&y.length?z(y.length===f.substring(1).replace(/j/g,"--").length):z(f.length==1);var M=e["dynCall_"+f];return y&&y.length?M.apply(null,[m].concat(y)):M.call(null,m)}var vr=[];function Ss(f){var m=vr[f];return m||(f>=vr.length&&(vr.length=f+1),vr[f]=m=Mi.get(f)),z(Mi.get(f)==m,"JavaScript-side Wasm function table mirror is out of date!"),m}function Ag(f,m,y){if(f.includes("j"))return Tg(f,m,y);z(Ss(m),"missing table entry in dynCall: "+m);var M=Ss(m).apply(null,y);return M}function Cg(f,m){z(f.includes("j")||f.includes("p"),"getDynCaller should only be called with i64 sigs");var y=[];return function(){return y.length=0,Object.assign(y,arguments),Ag(f,m,y)}}function bn(f,m){f=_e(f);function y(){return f.includes("j")?Cg(f,m):Ss(m)}var M=y();return typeof M!="function"&&ct("unknown function pointer with signature "+f+": "+m),M}var eu=void 0;function Pg(f){var m=v_(f),y=_e(m);return Ei(m),y}function zo(f,m){var y=[],M={};function E(L){if(!M[L]&&!Mn[L]){if(ys[L]){ys[L].forEach(E);return}y.push(L),M[L]=!0}}throw m.forEach(E),new eu(f+": "+y.map(Pg).join([", "]))}function Rg(f,m,y,M,E,L,O,C,F,V,J,tt,K){J=_e(J),L=bn(E,L),C&&(C=bn(O,C)),V&&(V=bn(F,V)),K=bn(tt,K);var yt=qh(J);gg(yt,function(){zo("Cannot construct "+J+" due to unbound types",[M])}),pr([f,m,y],M?[M]:[],function(ht){ht=ht[0];var pt,ie;M?(pt=ht.registeredClass,ie=pt.instancePrototype):ie=bi.prototype;var Be=Yh(yt,function(){if(Object.getPrototypeOf(this)!==U)throw new Sn("Use 'new' to construct "+J);if(j.constructor_body===void 0)throw new Sn(J+" has no accessible constructor");var ws=j.constructor_body[arguments.length];if(ws===void 0)throw new Sn("Tried to invoke ctor of "+J+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(j.constructor_body).toString()+") parameters instead!");return ws.apply(this,arguments)}),U=Object.create(ie,{constructor:{value:Be}});Be.prototype=U;var j=new _g(J,Be,U,K,pt,L,C,V),Gt=new $e(J,j,!0,!1,!1),Ft=new $e(J+"*",j,!1,!1,!1),en=new $e(J+" const*",j,!1,!0,!1);return Kh[f]={pointerType:Ft,constPointerType:en},wg(yt,Be),[Gt,Ft,en]})}function iu(f,m){for(var y=[],M=0;M<f;M++)y.push(at[m+M*4>>2]);return y}function Ig(f){for(;f.length;){var m=f.pop(),y=f.pop();y(m)}}function nu(f,m,y,M,E){var L=m.length;L<2&&ct("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var O=m[1]!==null&&y!==null,C=!1,F=1;F<m.length;++F)if(m[F]!==null&&m[F].destructorFunction===void 0){C=!0;break}var V=m[0].name!=="void",J=L-2,tt=new Array(J),K=[],yt=[];return function(){arguments.length!==J&&ct("function "+f+" called with "+arguments.length+" arguments, expected "+J+" args!"),yt.length=0;var ht;K.length=O?2:1,K[0]=E,O&&(ht=m[1].toWireType(yt,this),K[1]=ht);for(var pt=0;pt<J;++pt)tt[pt]=m[pt+2].toWireType(yt,arguments[pt]),K.push(tt[pt]);var ie=M.apply(null,K);function Be(U){if(C)Ig(yt);else for(var j=O?1:2;j<m.length;j++){var Gt=j===1?ht:tt[j-2];m[j].destructorFunction!==null&&m[j].destructorFunction(Gt)}if(V)return m[0].fromWireType(U)}return Be(ie)}}function Ng(f,m,y,M,E,L){z(m>0);var O=iu(m,y);E=bn(M,E),pr([],[f],function(C){C=C[0];var F="constructor "+C.name;if(C.registeredClass.constructor_body===void 0&&(C.registeredClass.constructor_body=[]),C.registeredClass.constructor_body[m-1]!==void 0)throw new Sn("Cannot register multiple constructors with identical number of parameters ("+(m-1)+") for class '"+C.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return C.registeredClass.constructor_body[m-1]=()=>{zo("Cannot construct "+C.name+" due to unbound types",O)},pr([],O,function(V){return V.splice(1,0,null),C.registeredClass.constructor_body[m-1]=nu(F,V,null,E,L),[]}),[]})}function Lg(f,m,y,M,E,L,O,C){var F=iu(y,M);m=_e(m),L=bn(E,L),pr([],[f],function(V){V=V[0];var J=V.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]),C&&V.registeredClass.pureVirtualFunctions.push(m);function tt(){zo("Cannot call "+J+" due to unbound types",F)}var K=V.registeredClass.instancePrototype,yt=K[m];return yt===void 0||yt.overloadTable===void 0&&yt.className!==V.name&&yt.argCount===y-2?(tt.argCount=y-2,tt.className=V.name,K[m]=tt):(tu(K,m,J),K[m].overloadTable[y-2]=tt),pr([],F,function(ht){var pt=nu(J,ht,V,L,O);return K[m].overloadTable===void 0?(pt.argCount=y-2,K[m]=pt):K[m].overloadTable[y-2]=pt,[]}),[]})}var ko=[],Fe=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Dg(f){f>4&&--Fe[f].refcount===0&&(Fe[f]=void 0,ko.push(f))}function Og(){for(var f=0,m=5;m<Fe.length;++m)Fe[m]!==void 0&&++f;return f}function Ug(){for(var f=5;f<Fe.length;++f)if(Fe[f]!==void 0)return Fe[f];return null}function Fg(){e.count_emval_handles=Og,e.get_first_emval=Ug}var Vo={toValue:f=>(f||ct("Cannot use deleted val. handle = "+f),Fe[f].value),toHandle:f=>{switch(f){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var m=ko.length?ko.pop():Fe.length;return Fe[m]={refcount:1,value:f},m}}}};function Bg(f,m){m=_e(m),Je(f,{name:m,fromWireType:function(y){var M=Vo.toValue(y);return Dg(y),M},toWireType:function(y,M){return Vo.toHandle(M)},argPackAdvance:8,readValueFromPointer:Ms,destructorFunction:null})}function En(f){if(f===null)return"null";var m=typeof f;return m==="object"||m==="array"||m==="function"?f.toString():""+f}function Gg(f,m){switch(m){case 2:return function(y){return this.fromWireType(yn[y>>2])};case 3:return function(y){return this.fromWireType(vn[y>>3])};default:throw new TypeError("Unknown float type: "+f)}}function zg(f,m,y){var M=Do(y);m=_e(m),Je(f,{name:m,fromWireType:function(E){return E},toWireType:function(E,L){if(typeof L!="number"&&typeof L!="boolean")throw new TypeError('Cannot convert "'+En(L)+'" to '+this.name);return L},argPackAdvance:8,readValueFromPointer:Gg(m,M),destructorFunction:null})}function kg(f,m,y){switch(m){case 0:return y?function(E){return ce[E]}:function(E){return Ot[E]};case 1:return y?function(E){return Ze[E>>1]}:function(E){return Ue[E>>1]};case 2:return y?function(E){return ft[E>>2]}:function(E){return at[E>>2]};default:throw new TypeError("Unknown integer type: "+f)}}function Vg(f,m,y,M,E){m=_e(m),E===-1&&(E=4294967295);var L=Do(y),O=tt=>tt;if(M===0){var C=32-8*y;O=tt=>tt<<C>>>C}var F=m.includes("unsigned"),V=(tt,K)=>{if(typeof tt!="number"&&typeof tt!="boolean")throw new TypeError('Cannot convert "'+En(tt)+'" to '+K);if(tt<M||tt>E)throw new TypeError('Passing a number "'+En(tt)+'" from JS side to C/C++ side to an argument of type "'+m+'", which is outside the valid range ['+M+", "+E+"]!")},J;F?J=function(tt,K){return V(K,this.name),K>>>0}:J=function(tt,K){return V(K,this.name),K},Je(f,{name:m,fromWireType:O,toWireType:J,argPackAdvance:8,readValueFromPointer:kg(m,L,M!==0),destructorFunction:null})}function Hg(f,m,y){var M=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],E=M[m];function L(O){O=O>>2;var C=at,F=C[O],V=C[O+1];return new E(Ki,V,F)}y=_e(y),Je(f,{name:y,fromWireType:L,argPackAdvance:8,readValueFromPointer:L},{ignoreDuplicateRegistrations:!0})}function Wg(f,m){m=_e(m);var y=m==="std::string";Je(f,{name:m,fromWireType:function(M){var E=at[M>>2],L=M+4,O;if(y)for(var C=L,F=0;F<=E;++F){var V=L+F;if(F==E||Ot[V]==0){var J=V-C,tt=ot(C,J);O===void 0?O=tt:(O+="\0",O+=tt),C=V+1}}else{for(var K=new Array(E),F=0;F<E;++F)K[F]=String.fromCharCode(Ot[L+F]);O=K.join("")}return Ei(M),O},toWireType:function(M,E){E instanceof ArrayBuffer&&(E=new Uint8Array(E));var L,O=typeof E=="string";O||E instanceof Uint8Array||E instanceof Uint8ClampedArray||E instanceof Int8Array||ct("Cannot pass non-string to std::string"),y&&O?L=ur(E):L=E.length;var C=Yo(4+L+1),F=C+4;if(at[C>>2]=L,y&&O)hr(E,F,L+1);else if(O)for(var V=0;V<L;++V){var J=E.charCodeAt(V);J>255&&(Ei(F),ct("String has UTF-16 code units that do not fit in 8 bits")),Ot[F+V]=J}else for(var V=0;V<L;++V)Ot[F+V]=E[V];return M!==null&&M.push(Ei,C),C},argPackAdvance:8,readValueFromPointer:Ms,destructorFunction:function(M){Ei(M)}})}var ru=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Xg(f,m){z(f%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var y=f,M=y>>1,E=M+m/2;!(M>=E)&&Ue[M];)++M;if(y=M<<1,y-f>32&&ru)return ru.decode(Ot.subarray(f,y));for(var L="",O=0;!(O>=m/2);++O){var C=Ze[f+O*2>>1];if(C==0)break;L+=String.fromCharCode(C)}return L}function qg(f,m,y){if(z(m%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),z(typeof y=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),y===void 0&&(y=2147483647),y<2)return 0;y-=2;for(var M=m,E=y<f.length*2?y/2:f.length,L=0;L<E;++L){var O=f.charCodeAt(L);Ze[m>>1]=O,m+=2}return Ze[m>>1]=0,m-M}function Yg(f){return f.length*2}function jg(f,m){z(f%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var y=0,M="";!(y>=m/4);){var E=ft[f+y*4>>2];if(E==0)break;if(++y,E>=65536){var L=E-65536;M+=String.fromCharCode(55296|L>>10,56320|L&1023)}else M+=String.fromCharCode(E)}return M}function Zg(f,m,y){if(z(m%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),z(typeof y=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),y===void 0&&(y=2147483647),y<4)return 0;for(var M=m,E=M+y-4,L=0;L<f.length;++L){var O=f.charCodeAt(L);if(O>=55296&&O<=57343){var C=f.charCodeAt(++L);O=65536+((O&1023)<<10)|C&1023}if(ft[m>>2]=O,m+=4,m+4>E)break}return ft[m>>2]=0,m-M}function Jg(f){for(var m=0,y=0;y<f.length;++y){var M=f.charCodeAt(y);M>=55296&&M<=57343&&++y,m+=4}return m}function $g(f,m,y){y=_e(y);var M,E,L,O,C;m===2?(M=Xg,E=qg,O=Yg,L=()=>Ue,C=1):m===4&&(M=jg,E=Zg,O=Jg,L=()=>at,C=2),Je(f,{name:y,fromWireType:function(F){for(var V=at[F>>2],J=L(),tt,K=F+4,yt=0;yt<=V;++yt){var ht=F+4+yt*m;if(yt==V||J[ht>>C]==0){var pt=ht-K,ie=M(K,pt);tt===void 0?tt=ie:(tt+="\0",tt+=ie),K=ht+m}}return Ei(F),tt},toWireType:function(F,V){typeof V!="string"&&ct("Cannot pass non-string to C++ string type "+y);var J=O(V),tt=Yo(4+J+m);return at[tt>>2]=J>>C,E(V,tt+4,J+m),F!==null&&F.push(Ei,tt),tt},argPackAdvance:8,readValueFromPointer:Ms,destructorFunction:function(F){Ei(F)}})}function Kg(f,m){m=_e(m),Je(f,{isVoid:!0,name:m,argPackAdvance:0,fromWireType:function(){},toWireType:function(y,M){}})}function Qg(){ee("native code called abort()")}function t_(f,m,y){Ot.copyWithin(f,m,m+y)}function e_(){return 2147483648}function i_(f){try{return q.grow(f-Ki.byteLength+65535>>>16),Bh(q.buffer),1}catch(m){N("emscripten_realloc_buffer: Attempted to grow heap from "+Ki.byteLength+" bytes to "+f+" bytes, but got error: "+m)}}function n_(f){var m=Ot.length;f=f>>>0,z(f>m);var y=e_();if(f>y)return N("Cannot enlarge memory, asked to go up to "+f+" bytes, but the limit is "+y+" bytes!"),!1;let M=(F,V)=>F+(V-F%V)%V;for(var E=1;E<=4;E*=2){var L=m*(1+.2/E);L=Math.min(L,f+100663296);var O=Math.min(y,M(Math.max(f,L),65536)),C=i_(O);if(C)return!0}return N("Failed to grow the heap from "+m+" bytes to "+O+" bytes, not enough memory!"),!1}var Ho={};function r_(){return o||"./this.program"}function xr(){if(!xr.strings){var f=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",m={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:f,_:r_()};for(var y in Ho)Ho[y]===void 0?delete m[y]:m[y]=Ho[y];var M=[];for(var y in m)M.push(y+"="+m[y]);xr.strings=M}return xr.strings}function s_(f,m,y){for(var M=0;M<f.length;++M)z(f.charCodeAt(M)===(f.charCodeAt(M)&255)),ce[m++>>0]=f.charCodeAt(M);y||(ce[m>>0]=0)}var Wo={varargs:void 0,get:function(){z(Wo.varargs!=null),Wo.varargs+=4;var f=ft[Wo.varargs-4>>2];return f},getStr:function(f){var m=ot(f);return m}};function a_(f,m){var y=0;return xr().forEach(function(M,E){var L=m+y;at[f+E*4>>2]=L,s_(M,L),y+=M.length+1}),0}function o_(f,m){var y=xr();at[f>>2]=y.length;var M=0;return y.forEach(function(E){M+=E.length+1}),at[m>>2]=M,0}function l_(f){ee("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM")}function c_(f,m,y,M,E){return 70}var Xo=[null,[],[]];function qo(f,m){var y=Xo[f];z(y),m===0||m===10?((f===1?P:N)(te(y,0)),y.length=0):y.push(m)}function jA(){x_(0),Xo[1].length&&qo(1,10),Xo[2].length&&qo(2,10)}function h_(f,m,y,M){for(var E=0,L=0;L<y;L++){var O=at[m>>2],C=at[m+4>>2];m+=8;for(var F=0;F<C;F++)qo(f,Ot[O+F]);E+=C}return at[M>>2]=E,0}function bs(f){return f%4===0&&(f%100!==0||f%400===0)}function u_(f,m){for(var y=0,M=0;M<=m;y+=f[M++]);return y}var su=[31,29,31,30,31,30,31,31,30,31,30,31],au=[31,28,31,30,31,30,31,31,30,31,30,31];function f_(f,m){for(var y=new Date(f.getTime());m>0;){var M=bs(y.getFullYear()),E=y.getMonth(),L=(M?su:au)[E];if(m>L-y.getDate())m-=L-y.getDate()+1,y.setDate(1),E<11?y.setMonth(E+1):(y.setMonth(0),y.setFullYear(y.getFullYear()+1));else return y.setDate(y.getDate()+m),y}return y}function d_(f,m,y){var M=y>0?y:ur(f)+1,E=new Array(M),L=Dt(f,E,0,E.length);return m&&(E.length=L),E}function p_(f,m,y,M){var E=ft[M+40>>2],L={tm_sec:ft[M>>2],tm_min:ft[M+4>>2],tm_hour:ft[M+8>>2],tm_mday:ft[M+12>>2],tm_mon:ft[M+16>>2],tm_year:ft[M+20>>2],tm_wday:ft[M+24>>2],tm_yday:ft[M+28>>2],tm_isdst:ft[M+32>>2],tm_gmtoff:ft[M+36>>2],tm_zone:E?ot(E):""},O=ot(y),C={"%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 F in C)O=O.replace(new RegExp(F,"g"),C[F]);var V=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],J=["January","February","March","April","May","June","July","August","September","October","November","December"];function tt(U,j,Gt){for(var Ft=typeof U=="number"?U.toString():U||"";Ft.length<j;)Ft=Gt[0]+Ft;return Ft}function K(U,j){return tt(U,j,"0")}function yt(U,j){function Gt(en){return en<0?-1:en>0?1:0}var Ft;return(Ft=Gt(U.getFullYear()-j.getFullYear()))===0&&(Ft=Gt(U.getMonth()-j.getMonth()))===0&&(Ft=Gt(U.getDate()-j.getDate())),Ft}function ht(U){switch(U.getDay()){case 0:return new Date(U.getFullYear()-1,11,29);case 1:return U;case 2:return new Date(U.getFullYear(),0,3);case 3:return new Date(U.getFullYear(),0,2);case 4:return new Date(U.getFullYear(),0,1);case 5:return new Date(U.getFullYear()-1,11,31);case 6:return new Date(U.getFullYear()-1,11,30)}}function pt(U){var j=f_(new Date(U.tm_year+1900,0,1),U.tm_yday),Gt=new Date(j.getFullYear(),0,4),Ft=new Date(j.getFullYear()+1,0,4),en=ht(Gt),ws=ht(Ft);return yt(en,j)<=0?yt(ws,j)<=0?j.getFullYear()+1:j.getFullYear():j.getFullYear()-1}var ie={"%a":function(U){return V[U.tm_wday].substring(0,3)},"%A":function(U){return V[U.tm_wday]},"%b":function(U){return J[U.tm_mon].substring(0,3)},"%B":function(U){return J[U.tm_mon]},"%C":function(U){var j=U.tm_year+1900;return K(j/100|0,2)},"%d":function(U){return K(U.tm_mday,2)},"%e":function(U){return tt(U.tm_mday,2," ")},"%g":function(U){return pt(U).toString().substring(2)},"%G":function(U){return pt(U)},"%H":function(U){return K(U.tm_hour,2)},"%I":function(U){var j=U.tm_hour;return j==0?j=12:j>12&&(j-=12),K(j,2)},"%j":function(U){return K(U.tm_mday+u_(bs(U.tm_year+1900)?su:au,U.tm_mon-1),3)},"%m":function(U){return K(U.tm_mon+1,2)},"%M":function(U){return K(U.tm_min,2)},"%n":function(){return`
7
+ `},"%p":function(U){return U.tm_hour>=0&&U.tm_hour<12?"AM":"PM"},"%S":function(U){return K(U.tm_sec,2)},"%t":function(){return" "},"%u":function(U){return U.tm_wday||7},"%U":function(U){var j=U.tm_yday+7-U.tm_wday;return K(Math.floor(j/7),2)},"%V":function(U){var j=Math.floor((U.tm_yday+7-(U.tm_wday+6)%7)/7);if((U.tm_wday+371-U.tm_yday-2)%7<=2&&j++,j){if(j==53){var Ft=(U.tm_wday+371-U.tm_yday)%7;Ft!=4&&(Ft!=3||!bs(U.tm_year))&&(j=1)}}else{j=52;var Gt=(U.tm_wday+7-U.tm_yday-1)%7;(Gt==4||Gt==5&&bs(U.tm_year%400-1))&&j++}return K(j,2)},"%w":function(U){return U.tm_wday},"%W":function(U){var j=U.tm_yday+7-(U.tm_wday+6)%7;return K(Math.floor(j/7),2)},"%y":function(U){return(U.tm_year+1900).toString().substring(2)},"%Y":function(U){return U.tm_year+1900},"%z":function(U){var j=U.tm_gmtoff,Gt=j>=0;return j=Math.abs(j)/60,j=j/60*100+j%60,(Gt?"+":"-")+("0000"+j).slice(-4)},"%Z":function(U){return U.tm_zone},"%%":function(){return"%"}};O=O.replace(/%%/g,"\0\0");for(var F in ie)O.includes(F)&&(O=O.replace(new RegExp(F,"g"),ie[F](L)));O=O.replace(/\0\0/g,"%");var Be=d_(O,!1);return Be.length>m?0:(Wh(Be,f),Be.length-1)}function m_(f,m,y,M){return p_(f,m,y,M)}function ou(f,m){z(f<16384),f<128?m.push(f):m.push(f%128|128,f>>7)}function g_(f){for(var m={i:"i32",j:"i64",f:"f32",d:"f64",p:"i32"},y={parameters:[],results:f[0]=="v"?[]:[m[f[0]]]},M=1;M<f.length;++M)z(f[M]in m,"invalid signature char: "+f[M]),y.parameters.push(m[f[M]]);return y}function ZA(f,m){if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(g_(m),f);var y=[1,96],M=m.slice(0,1),E=m.slice(1),L={i:127,p:127,j:126,f:125,d:124};ou(E.length,y);for(var O=0;O<E.length;++O)z(E[O]in L,"invalid signature char: "+E[O]),y.push(L[E[O]]);M=="v"?y.push(0):y.push(1,L[M]);var C=[0,97,115,109,1,0,0,0,1];ou(y.length,C),C.push.apply(C,y),C.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var F=new WebAssembly.Module(new Uint8Array(C)),V=new WebAssembly.Instance(F,{e:{f}}),J=V.exports.f;return J}function JA(f,m){if(lu)for(var y=f;y<f+m;y++){var M=Ss(y);M&&lu.set(M,y)}}var lu=void 0,cu=[];function $A(){if(cu.length)return cu.pop();try{Mi.grow(1)}catch(f){throw f instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":f}return Mi.length-1}function KA(f,m){Mi.set(f,m),vr[f]=Mi.get(f)}var QA=1;function __(f){var m=e["_"+f];return z(m,"Cannot call unknown function "+f+", make sure it is exported"),m}function t2(f,m,y,M,E){var L={string:ht=>{var pt=0;if(ht!=null&&ht!==0){var ie=(ht.length<<2)+1;pt=fu(ie),hr(ht,pt,ie)}return pt},array:ht=>{var pt=fu(ht.length);return Wh(ht,pt),pt}};function O(ht){return m==="string"?ot(ht):m==="boolean"?!!ht:ht}var C=__(f),F=[],V=0;if(z(m!=="array",'Return type should not be "array".'),M)for(var J=0;J<M.length;J++){var tt=L[y[J]];tt?(V===0&&(V=b_()),F[J]=tt(M[J])):F[J]=M[J]}var K=C.apply(null,F);function yt(ht){return V!==0&&E_(V),O(ht)}return K=yt(K),K}K0(),Sn=e.BindingError=Oo(Error,"BindingError"),jh=e.InternalError=Oo(Error,"InternalError"),mg(),lg(),Eg(),eu=e.UnboundTypeError=Oo(Error,"UnboundTypeError"),Fg();var e2=!0;function y_(){X("fetchSettings")}var hu={__cxa_allocate_exception:q0,__cxa_throw:J0,_embind_register_bigint:$0,_embind_register_bool:eg,_embind_register_class:Rg,_embind_register_class_constructor:Ng,_embind_register_class_function:Lg,_embind_register_emval:Bg,_embind_register_float:zg,_embind_register_integer:Vg,_embind_register_memory_view:Hg,_embind_register_std_string:Wg,_embind_register_std_wstring:$g,_embind_register_void:Kg,abort:Qg,emscripten_memcpy_big:t_,emscripten_resize_heap:n_,environ_get:a_,environ_sizes_get:o_,fd_close:l_,fd_seek:c_,fd_write:h_,strftime_l:m_},i2=H0(),n2=e.___wasm_call_ctors=Ut("__wasm_call_ctors"),Yo=e._malloc=Ut("malloc"),Ei=e._free=Ut("free"),v_=e.___getTypeName=Ut("__getTypeName"),r2=e.__embind_initialize_bindings=Ut("_embind_initialize_bindings"),s2=e.___errno_location=Ut("__errno_location"),x_=e._fflush=Ut("fflush"),uu=e._emscripten_stack_init=function(){return(uu=e._emscripten_stack_init=e.asm.emscripten_stack_init).apply(null,arguments)},M_=e._emscripten_stack_get_free=function(){return(M_=e._emscripten_stack_get_free=e.asm.emscripten_stack_get_free).apply(null,arguments)},S_=e._emscripten_stack_get_base=function(){return(S_=e._emscripten_stack_get_base=e.asm.emscripten_stack_get_base).apply(null,arguments)},jo=e._emscripten_stack_get_end=function(){return(jo=e._emscripten_stack_get_end=e.asm.emscripten_stack_get_end).apply(null,arguments)},b_=e.stackSave=Ut("stackSave"),E_=e.stackRestore=Ut("stackRestore"),fu=e.stackAlloc=Ut("stackAlloc"),w_=e.___cxa_is_pointer_type=Ut("__cxa_is_pointer_type"),a2=e.dynCall_viijii=Ut("dynCall_viijii"),o2=e.dynCall_ji=Ut("dynCall_ji"),l2=e.dynCall_jiji=Ut("dynCall_jiji"),c2=e.dynCall_iiiiij=Ut("dynCall_iiiiij"),h2=e.dynCall_iiiiijj=Ut("dynCall_iiiiijj"),u2=e.dynCall_iiiiiijj=Ut("dynCall_iiiiiijj"),T_=["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"];T_.forEach(S);var A_=["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"];A_.forEach(Z);var Es;fr=function f(){Es||du(),Es||(fr=f)};function C_(){uu(),I0()}function du(f){if(f=f||a,Qi>0||(C_(),N0(),Qi>0))return;function m(){Es||(Es=!0,e.calledRun=!0,!Y&&(L0(),n(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),z(!e._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),D0()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),m()},1)):m(),Io()}if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return du(),t.ready})})();typeof ks=="object"&&typeof nl=="object"?nl.exports=il:typeof define=="function"&&define.amd?define([],function(){return il}):typeof ks=="object"&&(ks.createLazPerf=il)});var sl=lt(ze=>{"use strict";var Fy=ze&&ze.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ze,"__esModule",{value:!0});ze.LazPerf=ze.create=ze.createLazPerf=void 0;var rl=Fy(Yu());ze.createLazPerf=rl.default;ze.create=rl.default;ze.LazPerf={create:rl.default}});var Ku=lt(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.decompressFile=Ri.decompressChunk=Ri.PointData=void 0;var ju=sl(),By=el();Ri.PointData={createLazPerf:ju.createLazPerf,decompressChunk:Ju,decompressFile:$u};var al;async function Zu(i){return i||(al||(al=(0,ju.createLazPerf)()),al)}async function Ju(i,{pointCount:t,pointDataRecordFormat:e,pointDataRecordLength:n},r){let s=await Zu(r),a=new Uint8Array(t*n),o=s._malloc(i.byteLength),l=s._malloc(n),c=new s.ChunkDecoder;try{s.HEAPU8.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),o),c.open(e,n,o);for(let h=0;h<t;++h)c.getPoint(l),a.set(new Uint8Array(s.HEAPU8.buffer,l,n),h*n)}finally{s._free(o),s._free(l),c.delete()}return a}Ri.decompressChunk=Ju;async function $u(i,t){let e=await Zu(t),n=By.Header.parse(i),{pointCount:r,pointDataRecordLength:s}=n,a=new Uint8Array(r*s),o=e._malloc(i.byteLength),l=e._malloc(s),c=new e.LASZip;try{e.HEAPU8.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),o),c.open(o,i.byteLength);for(let h=0;h<r;++h)c.getPoint(l),a.set(new Uint8Array(e.HEAPU8.buffer,l,s),h*s)}finally{c.delete()}return a}Ri.decompressFile=$u});var Qu=lt(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.View=void 0;var Gy=ve(),zy=Ko(),ky=Qo();Vs.View={create:Vy};function Vy(i,t,e=[],n){let r=ky.Extractor.create(t,e);if(n){let h=new Set([...n]);r=Object.entries(r).reduce((u,[p,d])=>(h.has(p)&&(u[p]=d),u),{})}let s=zy.Dimensions.create(r,e),a=Gy.Binary.toDataView(i),o=t.pointDataRecordLength;if(a.byteLength%o!==0)throw new Error(`Invalid buffer length (${a.byteLength}) for point length ${o}`);let l=a.byteLength/t.pointDataRecordLength;function c(h){let u=r[h];if(!u)throw new Error(`No extractor for dimension: ${h}`);return function(p){if(p>=l)throw new RangeError(`View index (${p}) out of range: ${l}`);return u(a,p)}}return{pointCount:l,dimensions:s,getter:c}}});var rf=lt(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.Vlr=void 0;var ke=ve(),Rn=Cs();Hs.Vlr={walk:Xy,parse:nf,find:ef,at:Hy,fetch:Wy};function ef(i,t,e){return i.find(n=>n.userId===t&&n.recordId===e)}function Hy(i,t,e){let n=ef(i,t,e);if(!n)throw new Error(`VLR not found: ${t}/${e}`);return n}function Wy(i,{contentOffset:t,contentLength:e}){return e===0?new Uint8Array:ke.Getter.create(i)(t,t+e)}async function Xy(i,t){let e=ke.Getter.create(i),n=await tf({get:e,startOffset:t.headerLength,count:t.vlrCount,isExtended:!1}),r=await tf({get:e,startOffset:t.evlrOffset,count:t.evlrCount,isExtended:!0});return[...n,...r]}function nf(i,t){return(t?Yy:qy)(i)}function qy(i){let t=ke.Binary.toDataView(i);if(t.byteLength!==Rn.vlrHeaderLength)throw new Error(`Invalid VLR header length (must be ${Rn.vlrHeaderLength}): ${t.byteLength}`);return{userId:ke.Binary.toCString(i.slice(2,18)),recordId:t.getUint16(18,!0),contentLength:t.getUint16(20,!0),description:ke.Binary.toCString(i.slice(22,54)),isExtended:!1}}function Yy(i){let t=ke.Binary.toDataView(i);if(t.byteLength!==Rn.evlrHeaderLength)throw new Error(`Invalid EVLR header length (must be ${Rn.evlrHeaderLength}): ${t.byteLength}`);return{userId:ke.Binary.toCString(i.slice(2,18)),recordId:t.getUint16(18,!0),contentLength:(0,ke.parseBigInt)((0,ke.getBigUint64)(t,20,!0)),description:ke.Binary.toCString(i.slice(28,60)),isExtended:!0}}async function tf({get:i,startOffset:t,count:e,isExtended:n}){let r=[],s=t,a=n?Rn.evlrHeaderLength:Rn.vlrHeaderLength;for(let o=0;o<e;++o){let l=a?await i(s,s+a):new Uint8Array,{userId:c,recordId:h,contentLength:u,description:p}=nf(l,n);r.push({userId:c,recordId:h,contentOffset:s+a,contentLength:u,description:p,isExtended:n}),s+=a+u}return r}});var ol=lt(gt=>{"use strict";var jy=gt&&gt.__createBinding||(Object.create?(function(i,t,e,n){n===void 0&&(n=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,r)}):(function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]})),Zy=gt&&gt.__setModuleDefault||(Object.create?(function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}):function(i,t){i.default=t}),Jy=gt&&gt.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var e in i)e!=="default"&&Object.prototype.hasOwnProperty.call(i,e)&&jy(t,i,e);return Zy(t,i),t};Object.defineProperty(gt,"__esModule",{value:!0});gt.Vlr=gt.View=gt.PointData=gt.Header=gt.Extractor=gt.ExtraBytes=gt.Dimensions=gt.Constants=void 0;gt.Constants=Jy(Cs());var $y=Ko();Object.defineProperty(gt,"Dimensions",{enumerable:!0,get:function(){return $y.Dimensions}});var Ky=$o();Object.defineProperty(gt,"ExtraBytes",{enumerable:!0,get:function(){return Ky.ExtraBytes}});var Qy=Qo();Object.defineProperty(gt,"Extractor",{enumerable:!0,get:function(){return Qy.Extractor}});var tv=el();Object.defineProperty(gt,"Header",{enumerable:!0,get:function(){return tv.Header}});var ev=Ku();Object.defineProperty(gt,"PointData",{enumerable:!0,get:function(){return ev.PointData}});var iv=Qu();Object.defineProperty(gt,"View",{enumerable:!0,get:function(){return iv.View}});var nv=rf();Object.defineProperty(gt,"Vlr",{enumerable:!0,get:function(){return nv.Vlr}})});var ll=lt(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.Hierarchy=void 0;var Mr=ve(),sf=As();Ws.Hierarchy={parse:af,load:rv};function af(i){let t=Mr.Binary.toDataView(i);if(t.byteLength%sf.hierarchyItemLength!==0)throw new Error(`Invalid hierarchy page length: ${t.byteLength}`);let e={},n={};for(let r=0;r<t.byteLength;r+=sf.hierarchyItemLength){let s=t.getInt32(r+0,!0),a=t.getInt32(r+4,!0),o=t.getInt32(r+8,!0),l=t.getInt32(r+12,!0),c=(0,Mr.parseBigInt)((0,Mr.getBigUint64)(t,r+16,!0)),h=t.getInt32(r+24,!0),u=t.getInt32(r+28,!0),p=Mr.Key.toString([s,a,o,l]);if(u<-1)throw new Error(`Invalid hierarchy point count at key: ${p}`);u===-1?n[p]={pageOffset:c,pageLength:h}:e[p]={pointCount:u,pointDataOffset:c,pointDataLength:h}}return{nodes:e,pages:n}}async function rv(i,t){let e=Mr.Getter.create(i);return af(await e(t.pageOffset,t.pageOffset+t.pageLength))}});var cl=lt(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.Info=void 0;var Sr=ve(),of=As();Xs.Info={parse:sv};function sv(i){let t=Sr.Binary.toDataView(i);if(t.byteLength!==of.infoLength)throw new Error(`Invalid COPC info VLR length (should be ${of.infoLength}): ${t.byteLength}`);let e=[t.getFloat64(0,!0),t.getFloat64(8,!0),t.getFloat64(16,!0)],n=t.getFloat64(24,!0);return{cube:[e[0]-n,e[1]-n,e[2]-n,e[0]+n,e[1]+n,e[2]+n],spacing:t.getFloat64(32,!0),rootHierarchyPage:{pageOffset:(0,Sr.parseBigInt)((0,Sr.getBigUint64)(t,40,!0)),pageLength:(0,Sr.parseBigInt)((0,Sr.getBigUint64)(t,48,!0))},gpsTimeRange:[t.getFloat64(56,!0),t.getFloat64(64,!0)]}}});var hf=lt(Ve=>{"use strict";var av=Ve&&Ve.__createBinding||(Object.create?(function(i,t,e,n){n===void 0&&(n=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,r)}):(function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]})),ov=Ve&&Ve.__setModuleDefault||(Object.create?(function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}):function(i,t){i.default=t}),lv=Ve&&Ve.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var e in i)e!=="default"&&Object.prototype.hasOwnProperty.call(i,e)&&av(t,i,e);return ov(t,i),t};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.Copc=void 0;var xe=lv(ol()),qs=ve(),cv=ll(),hv=cl();Ve.Copc={create:uv,loadHierarchyPage:fv,loadCompressedPointDataBuffer:lf,loadPointDataBuffer:cf,loadPointDataView:dv};async function uv(i){let t=qs.Getter.create(i),e=65536,n=t(0,e);async function r(d,_){return _>=e?t(d,_):(await n).slice(d,_)}let s=xe.Header.parse(await r(0,xe.Constants.minHeaderLength)),a=await xe.Vlr.walk(r,s),o=xe.Vlr.find(a,"copc",1);if(!o)throw new Error("COPC info VLR is required");let l=hv.Info.parse(await xe.Vlr.fetch(r,o)),c,h=xe.Vlr.find(a,"LASF_Projection",2112);h&&h.contentLength&&(c=qs.Binary.toCString(await xe.Vlr.fetch(r,h)),c===""&&(c=void 0));let u=[],p=xe.Vlr.find(a,"LASF_Spec",4);return p&&(u=xe.ExtraBytes.parse(await xe.Vlr.fetch(r,p))),{header:s,vlrs:a,info:l,wkt:c,eb:u}}async function fv(i,t){let e=qs.Getter.create(i);return cv.Hierarchy.load(e,t)}async function lf(i,{pointDataOffset:t,pointDataLength:e}){return qs.Getter.create(i)(t,t+e)}async function cf(i,{pointDataRecordFormat:t,pointDataRecordLength:e},n,r){let s=await lf(i,n),{pointCount:a}=n;return xe.PointData.decompressChunk(s,{pointCount:a,pointDataRecordFormat:t,pointDataRecordLength:e},r)}async function dv(i,t,e,{lazPerf:n,include:r}={}){let s=await cf(i,t.header,e,n);return xe.View.create(s,t.header,t.eb,r)}});var uf=lt(kt=>{"use strict";var pv=kt&&kt.__createBinding||(Object.create?(function(i,t,e,n){n===void 0&&(n=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,r)}):(function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]})),mv=kt&&kt.__setModuleDefault||(Object.create?(function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}):function(i,t){i.default=t}),gv=kt&&kt.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var e in i)e!=="default"&&Object.prototype.hasOwnProperty.call(i,e)&&pv(t,i,e);return mv(t,i),t};Object.defineProperty(kt,"__esModule",{value:!0});kt.Info=kt.Hierarchy=kt.Copc=kt.Constants=void 0;kt.Constants=gv(As());var _v=hf();Object.defineProperty(kt,"Copc",{enumerable:!0,get:function(){return _v.Copc}});var yv=ll();Object.defineProperty(kt,"Hierarchy",{enumerable:!0,get:function(){return yv.Hierarchy}});var vv=cl();Object.defineProperty(kt,"Info",{enumerable:!0,get:function(){return vv.Info}})});var mf=lt(Vt=>{"use strict";var ff=Vt&&Vt.__createBinding||(Object.create?(function(i,t,e,n){n===void 0&&(n=e);var r=Object.getOwnPropertyDescriptor(t,e);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,r)}):(function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]})),xv=Vt&&Vt.__setModuleDefault||(Object.create?(function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}):function(i,t){i.default=t}),df=Vt&&Vt.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var e in i)e!=="default"&&Object.prototype.hasOwnProperty.call(i,e)&&ff(t,i,e);return xv(t,i),t},pf=Vt&&Vt.__exportStar||function(i,t){for(var e in i)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&ff(t,i,e)};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.Las=Vt.Ept=void 0;Vt.Ept=df(Mu());pf(uf(),Vt);Vt.Las=df(ol());pf(ve(),Vt)});var Co=gu(mf());var Ff=1;var Bf=3,Zl=0,Gf=1;var Jl=1;var zf=100;var kf=204,Vf=205;var Pl=0,Rl=1,Il=2,ga=3,Nl=4,Ll=5,Dl=6,Ol=7,$l=0,Hf=1,Wf=2;var Kl=1,Ql=2,tc=3,ec=4,ic=5,nc=6,rc=7;var sc=300;var Xf=302;var Ul=1e3,Ie=1001,Fl=1002,si=1003;var We=1006;var qf=1008;var ai=1009,La=1010,Da=1011,Oa=1012,kr=1013,Ua=1014,oi=1015,Vr=1016,Fa=1017,Ba=1018,Ga=1020;var ac=1021;var li=1023,oc=1026,lc=1027,cc=1028,hc=1029,za=1030,uc=1031;var fc=1033;var Cr=2300,_a=2301,fa=2302,Bl=2303,Gl=2400,zl=2401,kl=2402;var Hr="",be="srgb",Vl="srgb-linear",Hl="linear",da="srgb";var pa=7680;var Yf=519;var jf=35044;var Vn=2e3,Wl=2001;function Mv(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function Sv(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Xl(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}var gf={},ya=null;function Zf(i){let t=i[0];if(typeof t=="string"&&t.startsWith("TSL:")){let e=i[1];e&&e.isStackTrace?i[0]+=" "+e.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function wt(...i){i=Zf(i);let t="THREE."+i.shift();if(ya)ya("warn",t,...i);else{let e=i[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...i)}}function _t(...i){i=Zf(i);let t="THREE."+i.shift();if(ya)ya("error",t,...i);else{let e=i[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...i)}}function ma(...i){let t=i.join(" ");t in gf||(gf[t]=!0,wt(...i))}var bv={[Pl]:Pl,[Il]:Dl,[Nl]:Nl,[ga]:Ll,[Rl]:Rl,[Dl]:Il,[Ol]:Ol,[Ll]:ga},Bt=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let r=n[t];if(r!==void 0){let s=r.indexOf(e);s!==-1&&r.splice(s,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,t);t.target=null}}},Ht=["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"],_f=1234567,Jf=Math.PI/180,dc=180/Math.PI;function jn(){let i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Ht[i&255]+Ht[i>>8&255]+Ht[i>>16&255]+Ht[i>>24&255]+"-"+Ht[t&255]+Ht[t>>8&255]+"-"+Ht[t>>16&15|64]+Ht[t>>24&255]+"-"+Ht[e&63|128]+Ht[e>>8&255]+"-"+Ht[e>>16&255]+Ht[e>>24&255]+Ht[n&255]+Ht[n>>8&255]+Ht[n>>16&255]+Ht[n>>24&255]).toLowerCase()}function rt(i,t,e){return Math.max(t,Math.min(e,i))}function pc(i,t){return(i%t+t)%t}function Ev(i,t,e,n,r){return n+(i-t)*(r-n)/(e-t)}function wv(i,t,e){return i!==t?(e-i)/(t-i):0}function Ar(i,t,e){return(1-e)*i+e*t}function Tv(i,t,e,n){return Ar(i,t,1-Math.exp(-e*n))}function Av(i,t=1){return t-Math.abs(pc(i,t*2)-t)}function Cv(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function Pv(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function Rv(i,t){return i+Math.floor(Math.random()*(t-i+1))}function Iv(i,t){return i+Math.random()*(t-i)}function Nv(i){return i*(.5-Math.random())}function Lv(i){i!==void 0&&(_f=i);let t=_f+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Dv(i){return i*Jf}function Ov(i){return i*dc}function Uv(i){return i>0&&Number.isInteger(i)&&2**Math.round(Math.log2(i))===i}function Fv(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function $f(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Bv(i,t,e,n,r){let s=Math.cos,a=Math.sin,o=s(e/2),l=a(e/2),c=s((t+n)/2),h=a((t+n)/2),u=s((t-n)/2),p=a((t-n)/2),d=s((n-t)/2),_=a((n-t)/2);switch(r){case"XYX":i.set(o*h,l*u,l*p,o*c);break;case"YZY":i.set(l*p,o*h,l*u,o*c);break;case"ZXZ":i.set(l*u,l*p,o*h,o*c);break;case"XZX":i.set(o*h,l*_,l*d,o*c);break;case"YXY":i.set(l*d,o*h,l*_,o*c);break;case"ZYZ":i.set(l*_,l*d,o*h,o*c);break;default:wt("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function mc(i){switch(i.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 Kf(i,t){if(t.constructor===Float32Array)return i;let e=mc(t);if(e===void 0)throw new Error("THREE.MathUtils: Invalid component type.");return Math.max(i/e,-1)}function Qf(i,t){if(t.constructor===Float32Array)return i;let e=mc(t);if(e===void 0)throw new Error("THREE.MathUtils: Invalid component type.");return Math.round(i*e)}var Zt={DEG2RAD:Jf,RAD2DEG:dc,generateUUID:jn,clamp:rt,euclideanModulo:pc,mapLinear:Ev,inverseLerp:wv,lerp:Ar,damp:Tv,pingpong:Av,smoothstep:Cv,smootherstep:Pv,randInt:Rv,randFloat:Iv,randFloatSpread:Nv,seededRandom:Lv,degToRad:Dv,radToDeg:Ov,isPowerOfTwo:Uv,ceilPowerOfTwo:Fv,floorPowerOfTwo:$f,setQuaternionFromProperEuler:Bv,normalize:Qf,denormalize:Kf},nt=class{static{this.prototype.isVector2=!0}constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=rt(this.x,t.x,e.x),this.y=rt(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=rt(this.x,t,e),this.y=rt(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(rt(n,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(rt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),r=Math.sin(e),s=this.x-t.x,a=this.y-t.y;return this.x=s*n-a*r+t.x,this.y=s*r+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Xe=class{constructor(t=0,e=0,n=0,r=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=r}static slerpFlat(t,e,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],u=n[r+3],p=s[a+0],d=s[a+1],_=s[a+2],g=s[a+3];if(u!==g||l!==p||c!==d||h!==_){let v=l*p+c*d+h*_+u*g;v<0&&(p=-p,d=-d,_=-_,g=-g,v=-v);let x=1-o;if(v<.9995){let b=Math.acos(v),A=Math.sin(b);x=Math.sin(x*b)/A,o=Math.sin(o*b)/A,l=l*x+p*o,c=c*x+d*o,h=h*x+_*o,u=u*x+g*o}else{l=l*x+p*o,c=c*x+d*o,h=h*x+_*o,u=u*x+g*o;let b=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=b,c*=b,h*=b,u*=b}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,r,s,a){let o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],u=s[a],p=s[a+1],d=s[a+2],_=s[a+3];return t[e]=o*_+h*u+l*d-c*p,t[e+1]=l*_+h*p+c*u-o*d,t[e+2]=c*_+h*d+o*p-l*u,t[e+3]=h*_-o*u-l*p-c*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,r=t._y,s=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),u=o(s/2),p=l(n/2),d=l(r/2),_=l(s/2);switch(a){case"XYZ":this._x=p*h*u+c*d*_,this._y=c*d*u-p*h*_,this._z=c*h*_+p*d*u,this._w=c*h*u-p*d*_;break;case"YXZ":this._x=p*h*u+c*d*_,this._y=c*d*u-p*h*_,this._z=c*h*_-p*d*u,this._w=c*h*u+p*d*_;break;case"ZXY":this._x=p*h*u-c*d*_,this._y=c*d*u+p*h*_,this._z=c*h*_+p*d*u,this._w=c*h*u-p*d*_;break;case"ZYX":this._x=p*h*u-c*d*_,this._y=c*d*u+p*h*_,this._z=c*h*_-p*d*u,this._w=c*h*u+p*d*_;break;case"YZX":this._x=p*h*u+c*d*_,this._y=c*d*u+p*h*_,this._z=c*h*_-p*d*u,this._w=c*h*u-p*d*_;break;case"XZY":this._x=p*h*u-c*d*_,this._y=c*d*u-p*h*_,this._z=c*h*_+p*d*u,this._w=c*h*u+p*d*_;break;default:wt("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],r=e[4],s=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],u=e[10],p=n+o+u;if(p>0){let d=.5/Math.sqrt(p+1);this._w=.25/d,this._x=(h-l)*d,this._y=(s-c)*d,this._z=(a-r)*d}else if(n>o&&n>u){let d=2*Math.sqrt(1+n-o-u);this._w=(h-l)/d,this._x=.25*d,this._y=(r+a)/d,this._z=(s+c)/d}else if(o>u){let d=2*Math.sqrt(1+o-n-u);this._w=(s-c)/d,this._x=(r+a)/d,this._y=.25*d,this._z=(l+h)/d}else{let d=2*Math.sqrt(1+u-n-o);this._w=(a-r)/d,this._x=(s+c)/d,this._y=(l+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(rt(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let r=Math.min(1,e/n);return this.slerp(t,r),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,r=t._y,s=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(t,e){let n=t._x,r=t._y,s=t._z,a=t._w,o=this.dot(t);o<0&&(n=-n,r=-r,s=-s,a=-a,o=-o);let l=1-e;if(o<.9995){let c=Math.acos(o),h=Math.sin(c);l=Math.sin(l*c)/h,e=Math.sin(e*c)/h,this._x=this._x*l+n*e,this._y=this._y*l+r*e,this._z=this._z*l+s*e,this._w=this._w*l+a*e,this._onChangeCallback()}else this._x=this._x*l+n*e,this._y=this._y*l+r*e,this._z=this._z*l+s*e,this._w=this._w*l+a*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},R=class{static{this.prototype.isVector3=!0}constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(yf.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(yf.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*r,this.y=s[1]*e+s[4]*n+s[7]*r,this.z=s[2]*e+s[5]*n+s[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,r=this.z,s=t.elements,a=1/(s[3]*e+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*e+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*e+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(t){let e=this.x,n=this.y,r=this.z,s=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*r-o*n),h=2*(o*e-s*r),u=2*(s*n-a*e);return this.x=e+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=r+l*u+s*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r,this.y=s[1]*e+s[5]*n+s[9]*r,this.z=s[2]*e+s[6]*n+s[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=rt(this.x,t.x,e.x),this.y=rt(this.y,t.y,e.y),this.z=rt(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=rt(this.x,t,e),this.y=rt(this.y,t,e),this.z=rt(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(rt(n,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,l=e.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return hl.copy(this).projectOnVector(t),this.sub(hl)}reflect(t){return this.sub(hl.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(rt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},hl=new R,yf=new Xe,Q=class{static{this.prototype.isMatrix3=!0}constructor(t,e,n,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,r,s,a,o,l,c)}set(t,e,n,r,s,a,o,l,c){let h=this.elements;return h[0]=t,h[1]=r,h[2]=o,h[3]=e,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,r=e.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],p=n[2],d=n[5],_=n[8],g=r[0],v=r[3],x=r[6],b=r[1],A=r[4],P=r[7],N=r[2],G=r[5],B=r[8];return s[0]=a*g+o*b+l*N,s[3]=a*v+o*A+l*G,s[6]=a*x+o*P+l*B,s[1]=c*g+h*b+u*N,s[4]=c*v+h*A+u*G,s[7]=c*x+h*P+u*B,s[2]=p*g+d*b+_*N,s[5]=p*v+d*A+_*G,s[8]=p*x+d*P+_*B,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){let t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=h*a-o*c,p=o*l-h*s,d=c*s-a*l,_=e*u+n*p+r*d;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/_;return t[0]=u*g,t[1]=(r*c-h*n)*g,t[2]=(o*n-r*a)*g,t[3]=p*g,t[4]=(h*e-r*l)*g,t[5]=(r*s-o*e)*g,t[6]=d*g,t[7]=(n*l-c*e)*g,t[8]=(a*e-n*s)*g,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,s,a,o){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+t,-r*c,r*l,-r*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return ma("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(ul.makeScale(t,e)),this}rotate(t){return ma("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(ul.makeRotation(-t)),this}translate(t,e){return ma("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(ul.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},ul=new Q,vf=new Q().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),xf=new Q().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Gv(){let i={enabled:!0,workingColorSpace:Vl,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===da&&(r.r=ni(r.r),r.g=ni(r.g),r.b=ni(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===da&&(r.r=Hn(r.r),r.g=Hn(r.g),r.b=Hn(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Hr?Hl:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[a].fromXYZ).multiply(this.spaces[s].toXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Vl]:{primaries:t,whitePoint:n,transfer:Hl,toXYZ:vf,fromXYZ:xf,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:be},outputColorSpaceConfig:{drawingBufferColorSpace:be}},[be]:{primaries:t,whitePoint:n,transfer:da,toXYZ:vf,fromXYZ:xf,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:be}}}),i}var Se=Gv();function ni(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Hn(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var In,va=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{In===void 0&&(In=Xl("canvas")),In.width=t.width,In.height=t.height;let r=In.getContext("2d");t instanceof ImageData?r.putImageData(t,0,0):r.drawImage(t,0,0,t.width,t.height),n=In}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Xl("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let r=n.getImageData(0,0,t.width,t.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=ni(s[a]/255)*255;return n.putImageData(r,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(ni(e[n]/255)*255):e[n]=ni(e[n]);return{data:e,width:t.width,height:t.height}}else return wt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},zv=0,Pr=class{constructor(t=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:zv++}),this.uuid=jn(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width||0,e.height||0,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(fl(r[a].image)):s.push(fl(r[a]))}else s=fl(r);n.url=s}return e||(t.images[this.uuid]=n),n}};function fl(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?va.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(wt("Texture: Unable to serialize Texture."),{})}var kv=0,dl=new R,Ee=class i extends Bt{constructor(t=i.DEFAULT_IMAGE,e=i.DEFAULT_MAPPING,n=Ie,r=Ie,s=We,a=qf,o=li,l=ai,c=i.DEFAULT_ANISOTROPY,h=Hr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:kv++}),this.uuid=jn(),this.name="",this.source=new Pr(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new nt(0,0),this.repeat=new nt(1,1),this.center=new nt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Q,this.generateMipmaps=!0,this.mipmapsAutoUpdate=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.isPMREMTexture=!1,this.normalized=!1}get width(){return this.source.getSize(dl).x}get height(){return this.source.getSize(dl).y}get depth(){return this.source.getSize(dl).z}get image(){return this.source.data}set image(t){this.source.data=t}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(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.mipmapsAutoUpdate=t.mipmapsAutoUpdate,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isPMREMTexture=t.isPMREMTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let n=t[e];if(n===void 0){wt(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let r=this[e];if(r===void 0){wt(`Texture.setValues(): property '${e}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==sc)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ul:t.x=t.x-Math.floor(t.x);break;case Ie:t.x=t.x<0?0:1;break;case Fl:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Ul:t.y=t.y-Math.floor(t.y);break;case Ie:t.y=t.y<0?0:1;break;case Fl:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};Ee.DEFAULT_IMAGE=null;Ee.DEFAULT_MAPPING=sc;Ee.DEFAULT_ANISOTROPY=1;var jt=class{static{this.prototype.isVector4=!0}constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,r=this.z,s=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,s,l=t.elements,c=l[0],h=l[4],u=l[8],p=l[1],d=l[5],_=l[9],g=l[2],v=l[6],x=l[10];if(Math.abs(h-p)<.01&&Math.abs(u-g)<.01&&Math.abs(_-v)<.01){if(Math.abs(h+p)<.1&&Math.abs(u+g)<.1&&Math.abs(_+v)<.1&&Math.abs(c+d+x-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let A=(c+1)/2,P=(d+1)/2,N=(x+1)/2,G=(h+p)/4,B=(u+g)/4,X=(_+v)/4;return A>P&&A>N?A<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(A),r=G/n,s=B/n):P>N?P<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(P),n=G/r,s=X/r):N<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(N),n=B/s,r=X/s),this.set(n,r,s,e),this}let b=Math.sqrt((v-_)*(v-_)+(u-g)*(u-g)+(p-h)*(p-h));return Math.abs(b)<.001&&(b=1),this.x=(v-_)/b,this.y=(u-g)/b,this.z=(p-h)/b,this.w=Math.acos((c+d+x-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=rt(this.x,t.x,e.x),this.y=rt(this.y,t.y,e.y),this.z=rt(this.z,t.z,e.z),this.w=rt(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=rt(this.x,t,e),this.y=rt(this.y,t,e),this.z=rt(this.z,t,e),this.w=rt(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(rt(n,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}},xa=class extends Bt{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:We,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth,this.scissor=new jt(0,0,t,e),this.scissorTest=!1,this.viewport=new jt(0,0,t,e),this.textures=[];let r=n.count;for(let s=0;s<r;s++)this.textures[s]=new Ee({width:t,height:e,depth:n.depth}),this.textures[s].isRenderTargetTexture=!0,this.textures[s].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveColorBuffer=n.resolveColorBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.storeMultisampledColorBuffer=n.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=n.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=n.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(t={}){let e={minFilter:We,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.mipmapsAutoUpdate!==void 0&&(e.mipmapsAutoUpdate=t.mipmapsAutoUpdate),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),t!==null&&t.renderTarget===null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=t,this.textures[r].image.height=e,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;let r=Object.assign({},t.textures[e].image);this.textures[e].source=new Pr(r)}if(this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveColorBuffer=t.resolveColorBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,this.storeMultisampledColorBuffer=t.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=t.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=t.storeMultisampledStencilBuffer,t.depthTexture!==null)if(t.depthTexture.renderTarget===t){let e=t.depthTexture.clone();e.renderTarget=null,this.depthTexture=e}else this.depthTexture=t.depthTexture;else this.depthTexture=null;return this.samples=t.samples,this.multiview=t.multiview,this.useArrayDepthTexture=t.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},Wn=class extends xa{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}};var Pt=class i{static{this.prototype.isMatrix4=!0}constructor(t,e,n,r,s,a,o,l,c,h,u,p,d,_,g,v){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,r,s,a,o,l,c,h,u,p,d,_,g,v)}set(t,e,n,r,s,a,o,l,c,h,u,p,d,_,g,v){let x=this.elements;return x[0]=t,x[4]=e,x[8]=n,x[12]=r,x[1]=s,x[5]=a,x[9]=o,x[13]=l,x[2]=c,x[6]=h,x[10]=u,x[14]=p,x[3]=d,x[7]=_,x[11]=g,x[15]=v,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 i().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return this.determinantAffine()===0?(t.set(1,0,0),e.set(0,1,0),n.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){if(t.determinantAffine()===0)return this.identity();let e=this.elements,n=t.elements,r=1/Nn.setFromMatrixColumn(t,0).length(),s=1/Nn.setFromMatrixColumn(t,1).length(),a=1/Nn.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,n=t.x,r=t.y,s=t.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),u=Math.sin(s);if(t.order==="XYZ"){let p=a*h,d=a*u,_=o*h,g=o*u;e[0]=l*h,e[4]=-l*u,e[8]=c,e[1]=d+_*c,e[5]=p-g*c,e[9]=-o*l,e[2]=g-p*c,e[6]=_+d*c,e[10]=a*l}else if(t.order==="YXZ"){let p=l*h,d=l*u,_=c*h,g=c*u;e[0]=p+g*o,e[4]=_*o-d,e[8]=a*c,e[1]=a*u,e[5]=a*h,e[9]=-o,e[2]=d*o-_,e[6]=g+p*o,e[10]=a*l}else if(t.order==="ZXY"){let p=l*h,d=l*u,_=c*h,g=c*u;e[0]=p-g*o,e[4]=-a*u,e[8]=_+d*o,e[1]=d+_*o,e[5]=a*h,e[9]=g-p*o,e[2]=-a*c,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){let p=a*h,d=a*u,_=o*h,g=o*u;e[0]=l*h,e[4]=_*c-d,e[8]=p*c+g,e[1]=l*u,e[5]=g*c+p,e[9]=d*c-_,e[2]=-c,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){let p=a*l,d=a*c,_=o*l,g=o*c;e[0]=l*h,e[4]=g-p*u,e[8]=_*u+d,e[1]=u,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=d*u+_,e[10]=p-g*u}else if(t.order==="XZY"){let p=a*l,d=a*c,_=o*l,g=o*c;e[0]=l*h,e[4]=-u,e[8]=c*h,e[1]=p*u+g,e[5]=a*h,e[9]=d*u-_,e[2]=_*u-d,e[6]=o*h,e[10]=g*u+p}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Vv,t,Hv)}lookAt(t,e,n){let r=this.elements;return ue.subVectors(t,e),ue.lengthSq()===0&&(ue.z=1),ue.normalize(),Ii.crossVectors(n,ue),Ii.lengthSq()===0&&(Math.abs(n.z)===1?ue.x+=1e-4:ue.z+=1e-4,ue.normalize(),Ii.crossVectors(n,ue)),Ii.normalize(),Ys.crossVectors(ue,Ii),r[0]=Ii.x,r[4]=Ys.x,r[8]=ue.x,r[1]=Ii.y,r[5]=Ys.y,r[9]=ue.y,r[2]=Ii.z,r[6]=Ys.z,r[10]=ue.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,r=e.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],p=n[9],d=n[13],_=n[2],g=n[6],v=n[10],x=n[14],b=n[3],A=n[7],P=n[11],N=n[15],G=r[0],B=r[4],X=r[8],k=r[12],Z=r[1],S=r[5],T=r[9],H=r[13],q=r[2],Y=r[6],$=r[10],z=r[14],Nt=r[3],te=r[7],ot=r[11],Dt=r[15];return s[0]=a*G+o*Z+l*q+c*Nt,s[4]=a*B+o*S+l*Y+c*te,s[8]=a*X+o*T+l*$+c*ot,s[12]=a*k+o*H+l*z+c*Dt,s[1]=h*G+u*Z+p*q+d*Nt,s[5]=h*B+u*S+p*Y+d*te,s[9]=h*X+u*T+p*$+d*ot,s[13]=h*k+u*H+p*z+d*Dt,s[2]=_*G+g*Z+v*q+x*Nt,s[6]=_*B+g*S+v*Y+x*te,s[10]=_*X+g*T+v*$+x*ot,s[14]=_*k+g*H+v*z+x*Dt,s[3]=b*G+A*Z+P*q+N*Nt,s[7]=b*B+A*S+P*Y+N*te,s[11]=b*X+A*T+P*$+N*ot,s[15]=b*k+A*H+P*z+N*Dt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[4],r=t[8],s=t[12],a=t[1],o=t[5],l=t[9],c=t[13],h=t[2],u=t[6],p=t[10],d=t[14],_=t[3],g=t[7],v=t[11],x=t[15],b=l*d-c*p,A=o*d-c*u,P=o*p-l*u,N=a*d-c*h,G=a*p-l*h,B=a*u-o*h;return e*(g*b-v*A+x*P)-n*(_*b-v*N+x*G)+r*(_*A-g*N+x*B)-s*(_*P-g*G+v*B)}determinantAffine(){let t=this.elements,e=t[0],n=t[4],r=t[8],s=t[1],a=t[5],o=t[9],l=t[2],c=t[6],h=t[10];return e*(a*h-o*c)-n*(s*h-o*l)+r*(s*c-a*l)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){let r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=t[9],p=t[10],d=t[11],_=t[12],g=t[13],v=t[14],x=t[15],b=e*o-n*a,A=e*l-r*a,P=e*c-s*a,N=n*l-r*o,G=n*c-s*o,B=r*c-s*l,X=h*g-u*_,k=h*v-p*_,Z=h*x-d*_,S=u*v-p*g,T=u*x-d*g,H=p*x-d*v,q=b*H-A*T+P*S+N*Z-G*k+B*X;if(q===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let Y=1/q;return t[0]=(o*H-l*T+c*S)*Y,t[1]=(r*T-n*H-s*S)*Y,t[2]=(g*B-v*G+x*N)*Y,t[3]=(p*G-u*B-d*N)*Y,t[4]=(l*Z-a*H-c*k)*Y,t[5]=(e*H-r*Z+s*k)*Y,t[6]=(v*P-_*B-x*A)*Y,t[7]=(h*B-p*P+d*A)*Y,t[8]=(a*T-o*Z+c*X)*Y,t[9]=(n*Z-e*T-s*X)*Y,t[10]=(_*G-g*P+x*b)*Y,t[11]=(u*P-h*G-d*b)*Y,t[12]=(o*k-a*S-l*X)*Y,t[13]=(e*S-n*k+r*X)*Y,t[14]=(g*A-_*N-v*b)*Y,t[15]=(h*N-u*A+p*b)*Y,this}scale(t){let e=this.elements,n=t.x,r=t.y,s=t.z;return e[0]*=n,e[4]*=r,e[8]*=s,e[1]*=n,e[5]*=r,e[9]*=s,e[2]*=n,e[6]*=r,e[10]*=s,e[3]*=n,e[7]*=r,e[11]*=s,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let n=Math.cos(e),r=Math.sin(e),s=1-n,a=t.x,o=t.y,l=t.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,r,s,a){return this.set(1,n,s,0,t,1,a,0,e,r,1,0,0,0,0,1),this}compose(t,e,n){let r=this.elements,s=e._x,a=e._y,o=e._z,l=e._w,c=s+s,h=a+a,u=o+o,p=s*c,d=s*h,_=s*u,g=a*h,v=a*u,x=o*u,b=l*c,A=l*h,P=l*u,N=n.x,G=n.y,B=n.z;return r[0]=(1-(g+x))*N,r[1]=(d+P)*N,r[2]=(_-A)*N,r[3]=0,r[4]=(d-P)*G,r[5]=(1-(p+x))*G,r[6]=(v+b)*G,r[7]=0,r[8]=(_+A)*B,r[9]=(v-b)*B,r[10]=(1-(p+g))*B,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){let r=this.elements;t.x=r[12],t.y=r[13],t.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),e.identity(),this;let a=Nn.set(r[0],r[1],r[2]).length(),o=Nn.set(r[4],r[5],r[6]).length(),l=Nn.set(r[8],r[9],r[10]).length();s<0&&(a=-a),Ce.copy(this);let c=1/a,h=1/o,u=1/l;return Ce.elements[0]*=c,Ce.elements[1]*=c,Ce.elements[2]*=c,Ce.elements[4]*=h,Ce.elements[5]*=h,Ce.elements[6]*=h,Ce.elements[8]*=u,Ce.elements[9]*=u,Ce.elements[10]*=u,e.setFromRotationMatrix(Ce),n.x=a,n.y=o,n.z=l,this}makePerspective(t,e,n,r,s,a,o=Vn,l=!1){let c=this.elements,h=2*s/(e-t),u=2*s/(n-r),p=(e+t)/(e-t),d=(n+r)/(n-r),_,g;if(l)_=s/(a-s),g=a*s/(a-s);else if(o===Vn)_=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===Wl)_=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=u,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=_,c[14]=g,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(t,e,n,r,s,a,o=Vn,l=!1){let c=this.elements,h=2/(e-t),u=2/(n-r),p=-(e+t)/(e-t),d=-(n+r)/(n-r),_,g;if(l)_=1/(a-s),g=a/(a-s);else if(o===Vn)_=-2/(a-s),g=-(a+s)/(a-s);else if(o===Wl)_=-1/(a-s),g=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=u,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=_,c[14]=g,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},Nn=new R,Ce=new Pt,Vv=new R(0,0,0),Hv=new R(1,1,1),Ii=new R,Ys=new R,ue=new R,Mf=new Pt,Sf=new Xe,Fi=class i{constructor(t=0,e=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r=this._order){return this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){let r=t.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],u=r[2],p=r[6],d=r[10];switch(e){case"XYZ":this._y=Math.asin(rt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-rt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(rt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-rt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(rt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-rt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:wt("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Mf.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Mf,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Sf.setFromEuler(this),this.setFromQuaternion(Sf,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Fi.DEFAULT_ORDER="XYZ";var Rr=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},Wv=0,bf=new R,Ln=new Xe,Ke=new Pt,js=new R,br=new R,Xv=new R,qv=new Xe,Ef=new R(1,0,0),wf=new R(0,1,0),Tf=new R(0,0,1),Af={type:"added"},Yv={type:"removed"},Dn={type:"childadded",child:null},pl={type:"childremoved",child:null},qe=class i extends Bt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Wv++}),this.uuid=jn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let t=new R,e=new Fi,n=new Xe,r=new R(1,1,1);function s(){n.setFromEuler(e,!1)}function a(){e.setFromQuaternion(n,void 0,!1)}e._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Pt},normalMatrix:{value:new Q}}),this.matrix=new Pt,this.matrixWorld=new Pt,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Rr,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(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale),this.pivot!==null&&this.position.copy(this.pivot).applyMatrix4(this.matrix).sub(this.pivot)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Ln.setFromAxisAngle(t,e),this.quaternion.multiply(Ln),this}rotateOnWorldAxis(t,e){return Ln.setFromAxisAngle(t,e),this.quaternion.premultiply(Ln),this}rotateX(t){return this.rotateOnAxis(Ef,t)}rotateY(t){return this.rotateOnAxis(wf,t)}rotateZ(t){return this.rotateOnAxis(Tf,t)}translateOnAxis(t,e){return bf.copy(t).applyQuaternion(this.quaternion),this.position.add(bf.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Ef,t)}translateY(t){return this.translateOnAxis(wf,t)}translateZ(t){return this.translateOnAxis(Tf,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ke.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?js.copy(t):js.set(t,e,n);let r=this.parent;this.updateWorldMatrix(!0,!1),br.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ke.lookAt(br,js,this.up):Ke.lookAt(js,br,this.up),this.quaternion.setFromRotationMatrix(Ke),r&&(Ke.extractRotation(r.matrixWorld),Ln.setFromRotationMatrix(Ke),this.quaternion.premultiply(Ln.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(_t("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Af),Dn.child=t,this.dispatchEvent(Dn),Dn.child=null):_t("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Yv),pl.child=t,this.dispatchEvent(pl),pl.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ke.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Ke.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ke),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Af),Dn.child=t,this.dispatchEvent(Dn),Dn.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,r=this.children.length;n<r;n++){let a=this.children[n].getObjectByProperty(t,e);if(a!==void 0)return a}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);let r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(br,t,Xv),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(br,qv,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}intersectsFrustum(){return!0}traverse(t){t(this);let e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,n=t.y,r=t.z,s=this.matrix.elements;s[12]+=e-s[0]*e-s[4]*n-s[8]*r,s[13]+=n-s[1]*e-s[5]*n-s[9]*r,s[14]+=r-s[2]*e-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e,n=!1){let r=this.parent;if(t===!0&&r!==null&&r.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),e===!0){let s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].updateWorldMatrix(!1,!0,n)}}toJSON(t){let e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,r.name=this.name,r.castShadow=this.castShadow,r.receiveShadow=this.receiveShadow,r.visible=this.visible,r.frustumCulled=this.frustumCulled,r.renderOrder=this.renderOrder,r.static=this.static,r.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(t),r.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(t.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){let u=l[c];s(t.shapes,u)}else s(t.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(t.materials,this.material[l]));r.material=o}else r.material=s(t.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){let l=this.animations[o];r.animations.push(s(t.animations,l))}}if(e){let o=a(t.geometries),l=a(t.materials),c=a(t.textures),h=a(t.images),u=a(t.shapes),p=a(t.skeletons),d=a(t.animations),_=a(t.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),p.length>0&&(n.skeletons=p),d.length>0&&(n.animations=d),_.length>0&&(n.nodes=_)}return n.object=r,n;function a(o){let l=[];for(let c in o){let h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){let r=t.children[n];this.add(r.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};qe.DEFAULT_UP=new R(0,1,0);qe.DEFAULT_MATRIX_AUTO_UPDATE=!0;qe.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var td={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},Ni={h:0,s:0,l:0},Zs={h:0,s:0,l:0};function ml(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}var it=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let r=t;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=be){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Se.colorSpaceToWorking(this,e),this}setRGB(t,e,n,r=Se.workingColorSpace){return this.r=t,this.g=e,this.b=n,Se.colorSpaceToWorking(this,r),this}setHSL(t,e,n,r=Se.workingColorSpace){if(t=pc(t,1),e=rt(e,0,1),n=rt(n,0,1),e===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+e):n+e-n*e,a=2*n-s;this.r=ml(a,s,t+1/3),this.g=ml(a,s,t),this.b=ml(a,s,t-1/3)}return Se.colorSpaceToWorking(this,r),this}setStyle(t,e=be){function n(s){s!==void 0&&parseFloat(s)<1&&wt("Color: Alpha component of "+t+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(t)){let s,a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseFloat(s[1]))/100,Math.min(100,parseFloat(s[2]))/100,Math.min(100,parseFloat(s[3]))/100,e);break;case"hsl":case"hsla":if(s=/^\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:wt("Color: Unknown color model "+t)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){let s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(s,16),e);wt("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=be){let n=td[t.toLowerCase()];return n!==void 0?this.setHex(n,e):wt("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ni(t.r),this.g=ni(t.g),this.b=ni(t.b),this}copyLinearToSRGB(t){return this.r=Hn(t.r),this.g=Hn(t.g),this.b=Hn(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=be){return Se.workingToColorSpace(Wt.copy(this),t),Math.round(rt(Wt.r*255,0,255))*65536+Math.round(rt(Wt.g*255,0,255))*256+Math.round(rt(Wt.b*255,0,255))}getHexString(t=be){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Se.workingColorSpace){Se.workingToColorSpace(Wt.copy(this),e);let n=Wt.r,r=Wt.g,s=Wt.b,a=Math.max(n,r,s),o=Math.min(n,r,s),l,c,h=(o+a)/2;if(o===a)l=0,c=0;else{let u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(r-s)/u+(r<s?6:0);break;case r:l=(s-n)/u+2;break;case s:l=(n-r)/u+4;break}l/=6}return t.h=l,t.s=c,t.l=h,t}getRGB(t,e=Se.workingColorSpace){return Se.workingToColorSpace(Wt.copy(this),e),t.r=Wt.r,t.g=Wt.g,t.b=Wt.b,t}getStyle(t=be){Se.workingToColorSpace(Wt.copy(this),t);let e=Wt.r,n=Wt.g,r=Wt.b;return t!==be?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(t,e,n){return this.getHSL(Ni),this.setHSL(Ni.h+t,Ni.s+e,Ni.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Ni),t.getHSL(Zs);let n=Ar(Ni.h,Zs.h,e),r=Ar(Ni.s,Zs.s,e),s=Ar(Ni.l,Zs.l,e);return this.setHSL(n,r,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,n=this.g,r=this.b,s=t.elements;return this.r=s[0]*e+s[3]*n+s[6]*r,this.g=s[1]*e+s[4]*n+s[7]*r,this.b=s[2]*e+s[5]*n+s[8]*r,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Wt=new it;it.NAMES=td;var Ir=class extends qe{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Fi,this.environmentIntensity=1,this.environmentRotation=new Fi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),this.background=t.background!==null?t.background.clone():null,this.environment=t.environment!==null?t.environment.clone():null,this.fog=t.fog!==null?t.fog.clone():null,this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),this.overrideMaterial=t.overrideMaterial!==null?t.overrideMaterial.clone():null,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),e.object.backgroundBlurriness=this.backgroundBlurriness,e.object.backgroundIntensity=this.backgroundIntensity,e.object.backgroundRotation=this.backgroundRotation.toArray(),e.object.environmentIntensity=this.environmentIntensity,e.object.environmentRotation=this.environmentRotation.toArray(),e}},Pe=new R,Qe=new R,gl=new R,ti=new R,On=new R,Un=new R,Cf=new R,_l=new R,yl=new R,vl=new R,xl=new jt,Ml=new jt,Sl=new jt,Oi=class i{constructor(t=new R,e=new R,n=new R){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){r.subVectors(n,e),Pe.subVectors(t,e),r.cross(Pe);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(t,e,n,r,s){Pe.subVectors(r,e),Qe.subVectors(n,e),gl.subVectors(t,e);let a=Pe.dot(Pe),o=Pe.dot(Qe),l=Pe.dot(gl),c=Qe.dot(Qe),h=Qe.dot(gl),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;let p=1/u,d=(c*l-o*h)*p,_=(a*h-o*l)*p;return s.set(1-d-_,_,d)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,ti)===null?!1:ti.x>=0&&ti.y>=0&&ti.x+ti.y<=1}static getInterpolation(t,e,n,r,s,a,o,l){return this.getBarycoord(t,e,n,r,ti)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,ti.x),l.addScaledVector(a,ti.y),l.addScaledVector(o,ti.z),l)}static getInterpolatedAttribute(t,e,n,r,s,a){return xl.setScalar(0),Ml.setScalar(0),Sl.setScalar(0),xl.fromBufferAttribute(t,e),Ml.fromBufferAttribute(t,n),Sl.fromBufferAttribute(t,r),a.setScalar(0),a.addScaledVector(xl,s.x),a.addScaledVector(Ml,s.y),a.addScaledVector(Sl,s.z),a}static isFrontFacing(t,e,n,r){return Pe.subVectors(n,e),Qe.subVectors(t,e),Pe.cross(Qe).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,n,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,r),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Pe.subVectors(this.c,this.b),Qe.subVectors(this.a,this.b),Pe.cross(Qe).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return i.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return i.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,r,s){return i.getInterpolation(t,this.a,this.b,this.c,e,n,r,s)}containsPoint(t){return i.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return i.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,r=this.b,s=this.c,a,o;On.subVectors(r,n),Un.subVectors(s,n),_l.subVectors(t,n);let l=On.dot(_l),c=Un.dot(_l);if(l<=0&&c<=0)return e.copy(n);yl.subVectors(t,r);let h=On.dot(yl),u=Un.dot(yl);if(h>=0&&u<=h)return e.copy(r);let p=l*u-h*c;if(p<=0&&l>=0&&h<=0&&l-h>0)return a=l/(l-h),e.copy(n).addScaledVector(On,a);vl.subVectors(t,s);let d=On.dot(vl),_=Un.dot(vl);if(_>=0&&d<=_)return e.copy(s);let g=d*c-l*_;if(g<=0&&c>=0&&_<=0)return o=c/(c-_),e.copy(n).addScaledVector(Un,o);let v=h*_-d*u;if(v<=0&&u-h>=0&&d-_>=0)return Cf.subVectors(s,r),o=(u-h)/(u-h+(d-_)),e.copy(r).addScaledVector(Cf,o);let x=1/(v+g+p);return a=g*x,o=p*x,e.copy(n).addScaledVector(On,a).addScaledVector(Un,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Ne=class{constructor(t=new R(1/0,1/0,1/0),e=new R(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(Re.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(Re.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=Re.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let n=t.geometry;if(n!==void 0){let s=n.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0&&t.isBatchedMesh!==!0)for(let a=0,o=s.count;a<o;a++)t.isMesh===!0?t.getVertexPosition(a,Re):Re.fromBufferAttribute(s,a),Re.applyMatrix4(t.matrixWorld),this.expandByPoint(Re);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Js.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Js.copy(n.boundingBox)),Js.applyMatrix4(t.matrixWorld),this.union(Js)}let r=t.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Re),Re.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Er),$s.subVectors(this.max,Er),Fn.subVectors(t.a,Er),Bn.subVectors(t.b,Er),Gn.subVectors(t.c,Er),Li.subVectors(Bn,Fn),Di.subVectors(Gn,Bn),nn.subVectors(Fn,Gn);let e=[0,-Li.z,Li.y,0,-Di.z,Di.y,0,-nn.z,nn.y,Li.z,0,-Li.x,Di.z,0,-Di.x,nn.z,0,-nn.x,-Li.y,Li.x,0,-Di.y,Di.x,0,-nn.y,nn.x,0];return!bl(e,Fn,Bn,Gn,$s)||(e=[1,0,0,0,1,0,0,0,1],!bl(e,Fn,Bn,Gn,$s))?!1:(Ks.crossVectors(Li,Di),e=[Ks.x,Ks.y,Ks.z],bl(e,Fn,Bn,Gn,$s))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Re).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Re).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(ei[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ei[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ei[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ei[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ei[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ei[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ei[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ei[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ei),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},ei=[new R,new R,new R,new R,new R,new R,new R,new R],Re=new R,Js=new Ne,Fn=new R,Bn=new R,Gn=new R,Li=new R,Di=new R,nn=new R,Er=new R,$s=new R,Ks=new R,rn=new R;function bl(i,t,e,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){rn.fromArray(i,s);let o=r.x*Math.abs(rn.x)+r.y*Math.abs(rn.y)+r.z*Math.abs(rn.z),l=t.dot(rn),c=e.dot(rn),h=n.dot(rn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}var At=new R,Qs=new nt,jv=0,ri=class extends Bt{constructor(t,e,n=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:jv++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=jf,this.updateRanges=[],this.gpuType=oi,this.version=0,this._normalizationScale=t!==void 0?mc(t):void 0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this._normalizationScale=t._normalizationScale,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[t+r]=e.array[n+r];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)Qs.fromBufferAttribute(this,e),Qs.applyMatrix3(t),this.setXY(e,Qs.x,Qs.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)At.fromBufferAttribute(this,e),At.applyMatrix3(t),this.setXYZ(e,At.x,At.y,At.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)At.fromBufferAttribute(this,e),At.applyMatrix4(t),this.setXYZ(e,At.x,At.y,At.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)At.fromBufferAttribute(this,e),At.applyNormalMatrix(t),this.setXYZ(e,At.x,At.y,At.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)At.fromBufferAttribute(this,e),At.transformDirection(t),this.setXYZ(e,At.x,At.y,At.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=this._denormalize(n)),n}setComponent(t,e,n){return this.normalized&&(n=this._normalize(n)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=this._denormalize(e)),e}setX(t,e){return this.normalized&&(e=this._normalize(e)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=this._denormalize(e)),e}setY(t,e){return this.normalized&&(e=this._normalize(e)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=this._denormalize(e)),e}setZ(t,e){return this.normalized&&(e=this._normalize(e)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=this._denormalize(e)),e}setW(t,e){return this.normalized&&(e=this._normalize(e)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=this._normalize(e),n=this._normalize(n)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,r){return t*=this.itemSize,this.normalized&&(e=this._normalize(e),n=this._normalize(n),r=this._normalize(r)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this}setXYZW(t,e,n,r,s){return t*=this.itemSize,this.normalized&&(e=this._normalize(e),n=this._normalize(n),r=this._normalize(r),s=this._normalize(s)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return t.name=this.name,t.usage=this.usage,t.gpuType=this.gpuType,t}dispose(){this.dispatchEvent({type:"dispose"})}_denormalize(t){let e=this._normalizationScale;return e!==void 0?Math.max(t/e,-1):Kf(t,this.array)}_normalize(t){let e=this._normalizationScale;return e!==void 0?Math.round(t*e):Qf(t,this.array)}};var Nr=class extends ri{constructor(t,e,n){super(new Uint16Array(t),e,n)}};var Lr=class extends ri{constructor(t,e,n){super(new Uint32Array(t),e,n)}};var Ui=class extends ri{constructor(t,e,n){super(new Float32Array(t),e,n)}},Zv=new Ne,wr=new R,El=new R,Xn=class{constructor(t=new R,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):Zv.setFromPoints(t).getCenter(n);let r=0;for(let s=0,a=t.length;s<a;s++)r=Math.max(r,n.distanceToSquared(t[s]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;wr.subVectors(t,this.center);let e=wr.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),r=(n-this.radius)*.5;this.center.addScaledVector(wr,r/n),this.radius+=r}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(El.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(wr.copy(t.center).add(El)),this.expandByPoint(wr.copy(t.center).sub(El))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},Jv=0,Me=new Pt,wl=new qe,zn=new R,fe=new Ne,Tr=new Ne,Lt=new R,qn=class i extends Bt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Jv++}),this.uuid=jn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Mv(t)?Lr:Nr)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Q().getNormalMatrix(t);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(t),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return Me.makeRotationFromQuaternion(t),this.applyMatrix4(Me),this}rotateX(t){return Me.makeRotationX(t),this.applyMatrix4(Me),this}rotateY(t){return Me.makeRotationY(t),this.applyMatrix4(Me),this}rotateZ(t){return Me.makeRotationZ(t),this.applyMatrix4(Me),this}translate(t,e,n){return Me.makeTranslation(t,e,n),this.applyMatrix4(Me),this}scale(t,e,n){return Me.makeScale(t,e,n),this.applyMatrix4(Me),this}lookAt(t){return wl.lookAt(t),wl.updateMatrix(),this.applyMatrix4(wl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(zn).negate(),this.translate(zn.x,zn.y,zn.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let r=0,s=t.length;r<s;r++){let a=t[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Ui(n,3))}else{let n=Math.min(t.length,e.count);for(let r=0;r<n;r++){let s=t[r];e.setXYZ(r,s.x,s.y,s.z||0)}t.length>e.count&&wt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ne);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){_t("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new R(-1/0,-1/0,-1/0),new R(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,r=e.length;n<r;n++){let s=e[n];fe.setFromBufferAttribute(s),this.morphTargetsRelative?(Lt.addVectors(this.boundingBox.min,fe.min),this.boundingBox.expandByPoint(Lt),Lt.addVectors(this.boundingBox.max,fe.max),this.boundingBox.expandByPoint(Lt)):(this.boundingBox.expandByPoint(fe.min),this.boundingBox.expandByPoint(fe.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&_t('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Xn);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){_t("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new R,1/0);return}if(t){let n=this.boundingSphere.center;if(fe.setFromBufferAttribute(t),e)for(let s=0,a=e.length;s<a;s++){let o=e[s];Tr.setFromBufferAttribute(o),this.morphTargetsRelative?(Lt.addVectors(fe.min,Tr.min),fe.expandByPoint(Lt),Lt.addVectors(fe.max,Tr.max),fe.expandByPoint(Lt)):(fe.expandByPoint(Tr.min),fe.expandByPoint(Tr.max))}fe.getCenter(n);let r=0;for(let s=0,a=t.count;s<a;s++)Lt.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(Lt));if(e)for(let s=0,a=e.length;s<a;s++){let o=e[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)Lt.fromBufferAttribute(o,c),l&&(zn.fromBufferAttribute(t,c),Lt.add(zn)),r=Math.max(r,n.distanceToSquared(Lt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&_t('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){_t("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.position,r=e.normal,s=e.uv,a=this.getAttribute("tangent");(a===void 0||a.count!==n.count)&&(a=new ri(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));let o=[],l=[],c=new Uint8Array(n.count);for(let k=0;k<n.count;k++)o[k]=new R,l[k]=new R;let h=new R,u=new R,p=new R,d=new nt,_=new nt,g=new nt,v=new R,x=new R;function b(k,Z,S){c[k]=c[Z]=c[S]=1,h.fromBufferAttribute(n,k),u.fromBufferAttribute(n,Z),p.fromBufferAttribute(n,S),d.fromBufferAttribute(s,k),_.fromBufferAttribute(s,Z),g.fromBufferAttribute(s,S),u.sub(h),p.sub(h),_.sub(d),g.sub(d);let T=1/(_.x*g.y-g.x*_.y);isFinite(T)&&(v.copy(u).multiplyScalar(g.y).addScaledVector(p,-_.y).multiplyScalar(T),x.copy(p).multiplyScalar(_.x).addScaledVector(u,-g.x).multiplyScalar(T),o[k].add(v),o[Z].add(v),o[S].add(v),l[k].add(x),l[Z].add(x),l[S].add(x))}let A=this.groups;A.length===0&&(A=[{start:0,count:t.count}]);for(let k=0,Z=A.length;k<Z;++k){let S=A[k],T=S.start,H=S.count;for(let q=T,Y=T+H;q<Y;q+=3)b(t.getX(q+0),t.getX(q+1),t.getX(q+2))}let P=new R,N=new R,G=new R,B=new R;function X(k){G.fromBufferAttribute(r,k),B.copy(G);let Z=o[k];P.copy(Z),P.sub(G.multiplyScalar(G.dot(Z))).normalize(),N.crossVectors(B,Z);let T=N.dot(l[k])<0?-1:1;a.setXYZW(k,P.x,P.y,P.z,T)}for(let k=0,Z=n.count;k<Z;++k)c[k]&&X(k);this._transformed=!0}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==e.count)n=new ri(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let p=0,d=n.count;p<d;p++)n.setXYZ(p,0,0,0);let r=new R,s=new R,a=new R,o=new R,l=new R,c=new R,h=new R,u=new R;if(t)for(let p=0,d=t.count;p<d;p+=3){let _=t.getX(p+0),g=t.getX(p+1),v=t.getX(p+2);r.fromBufferAttribute(e,_),s.fromBufferAttribute(e,g),a.fromBufferAttribute(e,v),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,g),c.fromBufferAttribute(n,v),o.add(h),l.add(h),c.add(h),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(g,l.x,l.y,l.z),n.setXYZ(v,c.x,c.y,c.z)}else for(let p=0,d=e.count;p<d;p+=3)r.fromBufferAttribute(e,p+0),s.fromBufferAttribute(e,p+1),a.fromBufferAttribute(e,p+2),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),n.setXYZ(p+0,h.x,h.y,h.z),n.setXYZ(p+1,h.x,h.y,h.z),n.setXYZ(p+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Lt.fromBufferAttribute(t,e),Lt.normalize(),t.setXYZ(e,Lt.x,Lt.y,Lt.z)}toNonIndexed(){function t(o,l){let c=o.array,h=o.itemSize,u=o.normalized,p=new c.constructor(l.length*h),d=0,_=0;for(let g=0,v=l.length;g<v;g++){o.isInterleavedBufferAttribute?d=l[g]*o.data.stride+o.offset:d=l[g]*h;for(let x=0;x<h;x++)p[_++]=c[d++]}return new ri(p,h,u)}if(this.index===null)return wt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new i,n=this.index.array,r=this.attributes;for(let o in r){let l=r[o],c=t(l,n);e.setAttribute(o,c)}let s=this.morphAttributes;for(let o in s){let l=[],c=s[o];for(let h=0,u=c.length;h<u;h++){let p=c[h],d=t(p,n);l.push(d)}e.morphAttributes[o]=l}e.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let o=0,l=a.length;o<l;o++){let c=a[o];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,t.name=this.name,Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let l in n){let c=n[l];t.data.attributes[l]=c.toJSON(t.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],h=[];for(let u=0,p=c.length;u<p;u++){let d=c[u];h.push(d.toJSON(t.data))}h.length>0&&(r[l]=h,s=!0)}s&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(t.data.boundingSphere=o.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let r=t.attributes;for(let c in r){let h=r[c];this.setAttribute(c,h.clone(e))}let s=t.morphAttributes;for(let c in s){let h=[],u=s[c];for(let p=0,d=u.length;p<d;p++)h.push(u[p].clone(e));this.morphAttributes[c]=h}this.morphTargetsRelative=t.morphTargetsRelative;let a=t.groups;for(let c=0,h=a.length;c<h;c++){let u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}let o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());let l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this._transformed=t._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}};var Tl=new R,$v=new R,Kv=new Q,Ma=class{constructor(t=new R(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let r=Tl.subVectors(n,e).cross($v.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,n=!0){let r=t.delta(Tl),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let a=-(t.start.dot(this.normal)+this.constant)/s;return n===!0&&(a<0||a>1)?null:e.copy(t.start).addScaledVector(r,a)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||Kv.getNormalMatrix(t),r=this.coplanarPoint(Tl).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(t){return this.normal.fromArray(t.normal),this.constant=t.constant,this}},Qv=0,Dr=class extends Bt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Qv++}),this.uuid=jn(),this.name="",this.type="Material",this.blending=Jl,this.side=Zl,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=kf,this.blendDst=Vf,this.blendEquation=zf,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new it(0,0,0),this.blendAlpha=0,this.depthFunc=ga,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Yf,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=pa,this.stencilZFail=pa,this.stencilZPass=pa,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let n=t[e];if(n===void 0){wt(`Material: parameter '${e}' has value of undefined.`);continue}let r=this[e];if(r===void 0){wt(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.diffuseRoughness!==void 0&&(n.diffuseRoughness=this.diffuseRoughness),this.diffuseRoughnessMap&&this.diffuseRoughnessMap.isTexture&&(n.diffuseRoughnessMap=this.diffuseRoughnessMap.toJSON(t).uuid),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessMinimum=this.iridescenceThicknessMinimum),this.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessMaximum=this.iridescenceThicknessMaximum),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(s=>s.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let a=[];for(let o in s){let l=s[o];delete l.metadata,a.push(l)}return a}if(e){let s=r(t.textures),a=r(t.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}fromJSON(t,e){if(t.uuid!==void 0&&(this.uuid=t.uuid),t.name!==void 0&&(this.name=t.name),t.color!==void 0&&this.color!==void 0&&this.color.setHex(t.color),t.roughness!==void 0&&(this.roughness=t.roughness),t.metalness!==void 0&&(this.metalness=t.metalness),t.sheen!==void 0&&(this.sheen=t.sheen),t.sheenColor!==void 0&&(this.sheenColor=new it().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(this.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(t.emissive),t.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(t.specular),t.specularIntensity!==void 0&&(this.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(this.shininess=t.shininess),t.clearcoat!==void 0&&(this.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=t.clearcoatRoughness),t.diffuseRoughness!==void 0&&(this.diffuseRoughness=t.diffuseRoughness),t.dispersion!==void 0&&(this.dispersion=t.dispersion),t.retroreflectivity!==void 0&&(this.retroreflectivity=t.retroreflectivity),t.iridescence!==void 0&&(this.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(this.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessMinimum!==void 0&&(this.iridescenceThicknessMinimum=t.iridescenceThicknessMinimum),t.iridescenceThicknessMaximum!==void 0&&(this.iridescenceThicknessMaximum=t.iridescenceThicknessMaximum),t.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessMinimum=t.iridescenceThicknessRange[0],this.iridescenceThicknessMaximum=t.iridescenceThicknessRange[1]),t.transmission!==void 0&&(this.transmission=t.transmission),t.thickness!==void 0&&(this.thickness=t.thickness),t.attenuationDistance!==void 0&&(this.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(this.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(this.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(this.fog=t.fog),t.flatShading!==void 0&&(this.flatShading=t.flatShading),t.blending!==void 0&&(this.blending=t.blending),t.combine!==void 0&&(this.combine=t.combine),t.side!==void 0&&(this.side=t.side),t.shadowSide!==void 0&&(this.shadowSide=t.shadowSide),t.opacity!==void 0&&(this.opacity=t.opacity),t.transparent!==void 0&&(this.transparent=t.transparent),t.alphaTest!==void 0&&(this.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(this.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(this.depthFunc=t.depthFunc),t.depthTest!==void 0&&(this.depthTest=t.depthTest),t.depthWrite!==void 0&&(this.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(this.colorWrite=t.colorWrite),t.clippingPlanes!==void 0&&(this.clippingPlanes=t.clippingPlanes.map(n=>new Ma().fromJSON(n))),t.clipIntersection!==void 0&&(this.clipIntersection=t.clipIntersection),t.clipShadows!==void 0&&(this.clipShadows=t.clipShadows),t.depthPacking!==void 0&&(this.depthPacking=t.depthPacking),t.blendSrc!==void 0&&(this.blendSrc=t.blendSrc),t.blendDst!==void 0&&(this.blendDst=t.blendDst),t.blendEquation!==void 0&&(this.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(this.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(this.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(this.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(this.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(this.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(this.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(this.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(this.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(this.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(this.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(this.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(this.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(this.rotation=t.rotation),t.linewidth!==void 0&&(this.linewidth=t.linewidth),t.linecap!==void 0&&(this.linecap=t.linecap),t.linejoin!==void 0&&(this.linejoin=t.linejoin),t.dashSize!==void 0&&(this.dashSize=t.dashSize),t.gapSize!==void 0&&(this.gapSize=t.gapSize),t.scale!==void 0&&(this.scale=t.scale),t.polygonOffset!==void 0&&(this.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(this.dithering=t.dithering),t.alphaToCoverage!==void 0&&(this.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(this.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(this.allowOverride=t.allowOverride),t.visible!==void 0&&(this.visible=t.visible),t.toneMapped!==void 0&&(this.toneMapped=t.toneMapped),t.userData!==void 0&&(this.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?this.vertexColors=t.vertexColors>0:this.vertexColors=t.vertexColors),t.size!==void 0&&(this.size=t.size),t.sizeAttenuation!==void 0&&(this.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(this.map=e[t.map]||null),t.matcap!==void 0&&(this.matcap=e[t.matcap]||null),t.alphaMap!==void 0&&(this.alphaMap=e[t.alphaMap]||null),t.bumpMap!==void 0&&(this.bumpMap=e[t.bumpMap]||null),t.bumpScale!==void 0&&(this.bumpScale=t.bumpScale),t.normalMap!==void 0&&(this.normalMap=e[t.normalMap]||null),t.normalMapType!==void 0&&(this.normalMapType=t.normalMapType),t.normalScale!==void 0){let n=t.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new nt().fromArray(n)}return t.displacementMap!==void 0&&(this.displacementMap=e[t.displacementMap]||null),t.displacementScale!==void 0&&(this.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(this.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(this.roughnessMap=e[t.roughnessMap]||null),t.metalnessMap!==void 0&&(this.metalnessMap=e[t.metalnessMap]||null),t.emissiveMap!==void 0&&(this.emissiveMap=e[t.emissiveMap]||null),t.emissiveIntensity!==void 0&&(this.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(this.specularMap=e[t.specularMap]||null),t.specularIntensityMap!==void 0&&(this.specularIntensityMap=e[t.specularIntensityMap]||null),t.specularColorMap!==void 0&&(this.specularColorMap=e[t.specularColorMap]||null),t.envMap!==void 0&&(this.envMap=e[t.envMap]||null),t.envMapRotation!==void 0&&this.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(this.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(this.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(this.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(this.lightMap=e[t.lightMap]||null),t.lightMapIntensity!==void 0&&(this.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(this.aoMap=e[t.aoMap]||null),t.aoMapIntensity!==void 0&&(this.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(this.gradientMap=e[t.gradientMap]||null),t.clearcoatMap!==void 0&&(this.clearcoatMap=e[t.clearcoatMap]||null),t.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=e[t.clearcoatRoughnessMap]||null),t.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=e[t.clearcoatNormalMap]||null),t.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new nt().fromArray(t.clearcoatNormalScale)),t.diffuseRoughnessMap!==void 0&&(this.diffuseRoughnessMap=e[t.diffuseRoughnessMap]||null),t.iridescenceMap!==void 0&&(this.iridescenceMap=e[t.iridescenceMap]||null),t.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=e[t.iridescenceThicknessMap]||null),t.transmissionMap!==void 0&&(this.transmissionMap=e[t.transmissionMap]||null),t.thicknessMap!==void 0&&(this.thicknessMap=e[t.thicknessMap]||null),t.anisotropyMap!==void 0&&(this.anisotropyMap=e[t.anisotropyMap]||null),t.sheenColorMap!==void 0&&(this.sheenColorMap=e[t.sheenColorMap]||null),t.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=e[t.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,n=null;if(e!==null){let r=e.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=e[s].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}};var ii=new R,Al=new R,ta=new R,ea=new R,Or=class{constructor(t=new R,e=new R(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ii)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=ii.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ii.copy(this.origin).addScaledVector(this.direction,e),ii.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){Al.copy(t).add(e).multiplyScalar(.5),ta.copy(e).sub(t).normalize(),ea.copy(this.origin).sub(Al);let s=t.distanceTo(e)*.5,a=-this.direction.dot(ta),o=ea.dot(this.direction),l=-ea.dot(ta),c=ea.lengthSq(),h=Math.abs(1-a*a),u,p,d,_;if(h>0)if(u=a*l-o,p=a*o-l,_=s*h,u>=0)if(p>=-_)if(p<=_){let g=1/h;u*=g,p*=g,d=u*(u+a*p+2*o)+p*(a*u+p+2*l)+c}else p=s,u=Math.max(0,-(a*p+o)),d=-u*u+p*(p+2*l)+c;else p=-s,u=Math.max(0,-(a*p+o)),d=-u*u+p*(p+2*l)+c;else p<=-_?(u=Math.max(0,-(-a*s+o)),p=u>0?-s:Math.min(Math.max(-s,-l),s),d=-u*u+p*(p+2*l)+c):p<=_?(u=0,p=Math.min(Math.max(-s,-l),s),d=p*(p+2*l)+c):(u=Math.max(0,-(a*s+o)),p=u>0?s:Math.min(Math.max(-s,-l),s),d=-u*u+p*(p+2*l)+c);else p=a>0?-s:s,u=Math.max(0,-(a*p+o)),d=-u*u+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Al).addScaledVector(ta,p),d}intersectSphere(t,e){if(t.radius<0)return null;ii.subVectors(t.center,this.origin);let n=ii.dot(this.direction),r=ii.dot(ii)-n*n,s=t.radius*t.radius;if(r>s)return null;let a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){let n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,s,a,o,l,c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,p=this.origin;return c>=0?(n=(t.min.x-p.x)*c,r=(t.max.x-p.x)*c):(n=(t.max.x-p.x)*c,r=(t.min.x-p.x)*c),h>=0?(s=(t.min.y-p.y)*h,a=(t.max.y-p.y)*h):(s=(t.max.y-p.y)*h,a=(t.min.y-p.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),u>=0?(o=(t.min.z-p.z)*u,l=(t.max.z-p.z)*u):(o=(t.max.z-p.z)*u,l=(t.min.z-p.z)*u),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,e)}intersectsBox(t){return this.intersectBox(t,ii)!==null}intersectTriangle(t,e,n,r,s){let a=this.origin,o=this.direction,l=o.x,c=o.y,h=o.z,u=t.x-a.x,p=t.y-a.y,d=t.z-a.z,_=e.x-a.x,g=e.y-a.y,v=e.z-a.z,x=n.x-a.x,b=n.y-a.y,A=n.z-a.z,P=Math.abs(l),N=Math.abs(c),G=Math.abs(h),B,X,k,Z,S,T,H,q,Y,$,z,Nt;if(P>=N&&P>=G?(k=l,T=u,Y=_,Nt=x,l>=0?(B=c,X=h,Z=p,S=d,H=g,q=v,$=b,z=A):(B=h,X=c,Z=d,S=p,H=v,q=g,$=A,z=b)):N>=G?(k=c,T=p,Y=g,Nt=b,c>=0?(B=h,X=l,Z=d,S=u,H=v,q=_,$=A,z=x):(B=l,X=h,Z=u,S=d,H=_,q=v,$=x,z=A)):(k=h,T=d,Y=v,Nt=A,h>=0?(B=l,X=c,Z=u,S=p,H=_,q=g,$=x,z=b):(B=c,X=l,Z=p,S=u,H=g,q=_,$=b,z=x)),k===0)return null;let te=B/k,ot=X/k,Dt=1/k,hr=Z-te*T,ur=S-ot*T,Ki=H-te*Y,ce=q-ot*Y,Ot=$-te*Nt,Ze=z-ot*Nt,Ue=Ot*ce-Ze*Ki,ft=hr*Ze-ur*Ot,at=Ki*ur-ce*hr;if(r){if(Ue<0||ft<0||at<0)return null}else if((Ue<0||ft<0||at<0)&&(Ue>0||ft>0||at>0))return null;let yn=Ue+ft+at;if(yn===0)return null;let vn=Dt*(Ue*T+ft*Y+at*Nt);return(yn>0?vn<0:vn>0)?null:this.at(vn/yn,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Sa=class extends Dr{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new it(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Fi,this.combine=$l,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},Pf=new Pt,sn=new Or,ia=new Xn,Rf=new R,na=new R,ra=new R,sa=new R,Cl=new R,aa=new R,If=new R,oa=new R,Ur=class extends qe{constructor(t=new qn,e=new Sa){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0?this.morphTargetInfluences=t.morphTargetInfluences.slice():this.morphTargetInfluences=void 0,t.morphTargetDictionary!==void 0?this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary):this.morphTargetDictionary=void 0,this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let r=e[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){let o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(t,e){let n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;e.fromBufferAttribute(r,t);let o=this.morphTargetInfluences;if(s&&o){aa.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let h=o[l],u=s[l];h!==0&&(Cl.fromBufferAttribute(u,t),a?aa.addScaledVector(Cl,h):aa.addScaledVector(Cl.sub(e),h))}e.add(aa)}return e}intersectsFrustum(t){return t.intersectsObject(this)}raycast(t,e){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),ia.copy(n.boundingSphere),ia.applyMatrix4(s),sn.copy(t.ray).recast(t.near),!(ia.containsPoint(sn.origin)===!1&&(sn.intersectSphere(ia,Rf)===null||sn.origin.distanceToSquared(Rf)>(t.far-t.near)**2))&&(Pf.copy(s).invert(),sn.copy(t.ray).applyMatrix4(Pf),!(n.boundingBox!==null&&sn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,sn)))}_computeIntersections(t,e,n){let r,s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,p=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,g=p.length;_<g;_++){let v=p[_],x=a[v.materialIndex],b=Math.max(v.start,d.start),A=Math.min(o.count,Math.min(v.start+v.count,d.start+d.count));for(let P=b,N=A;P<N;P+=3){let G=o.getX(P),B=o.getX(P+1),X=o.getX(P+2);r=la(this,x,t,n,c,h,u,G,B,X),r&&(r.faceIndex=Math.floor(P/3),r.face.materialIndex=v.materialIndex,e.push(r))}}else{let _=Math.max(0,d.start),g=Math.min(o.count,d.start+d.count);for(let v=_,x=g;v<x;v+=3){let b=o.getX(v),A=o.getX(v+1),P=o.getX(v+2);r=la(this,a,t,n,c,h,u,b,A,P),r&&(r.faceIndex=Math.floor(v/3),e.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let _=0,g=p.length;_<g;_++){let v=p[_],x=a[v.materialIndex],b=Math.max(v.start,d.start),A=Math.min(l.count,Math.min(v.start+v.count,d.start+d.count));for(let P=b,N=A;P<N;P+=3){let G=P,B=P+1,X=P+2;r=la(this,x,t,n,c,h,u,G,B,X),r&&(r.faceIndex=Math.floor(P/3),r.face.materialIndex=v.materialIndex,e.push(r))}}else{let _=Math.max(0,d.start),g=Math.min(l.count,d.start+d.count);for(let v=_,x=g;v<x;v+=3){let b=v,A=v+1,P=v+2;r=la(this,a,t,n,c,h,u,b,A,P),r&&(r.faceIndex=Math.floor(v/3),e.push(r))}}}};function tx(i,t,e,n,r,s,a,o){let l;if(t.side===Gf?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,t.side===Zl,o),l===null)return null;oa.copy(o),oa.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(oa);return c<e.near||c>e.far?null:{distance:c,point:oa.clone(),object:i}}function la(i,t,e,n,r,s,a,o,l,c){i.getVertexPosition(o,na),i.getVertexPosition(l,ra),i.getVertexPosition(c,sa);let h=tx(i,t,e,n,na,ra,sa,If);if(h){let u=new R;Oi.getBarycoord(If,na,ra,sa,u),r&&(h.uv=Oi.getInterpolatedAttribute(r,o,l,c,u,new nt)),s&&(h.uv1=Oi.getInterpolatedAttribute(s,o,l,c,u,new nt)),a&&(h.normal=Oi.getInterpolatedAttribute(a,o,l,c,u,new R),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let p={a:o,b:l,c,normal:new R,materialIndex:0};Oi.getNormal(na,ra,sa,p.normal),h.face=p,h.barycoord=u}return h}var Bi=class extends Ee{constructor(t=null,e=1,n=1,r,s,a,o,l,c=si,h=si,u,p){super(null,a,o,l,c,h,r,s,u,p),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Fr=class i extends qn{constructor(t=1,e=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};let s=t/2,a=e/2,o=Math.floor(n),l=Math.floor(r),c=o+1,h=l+1,u=t/o,p=e/l,d=[],_=[],g=[],v=[];for(let x=0;x<h;x++){let b=x*p-a;for(let A=0;A<c;A++){let P=A*u-s;_.push(P,-b,0),g.push(0,0,1),v.push(A/o),v.push(1-x/l)}}for(let x=0;x<l;x++)for(let b=0;b<o;b++){let A=b+c*x,P=b+c*(x+1),N=b+1+c*(x+1),G=b+1+c*x;d.push(A,P,G),d.push(P,N,G)}this.setIndex(d),this.setAttribute("position",new Ui(_,3)),this.setAttribute("normal",new Ui(g,3)),this.setAttribute("uv",new Ui(v,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.widthSegments,t.heightSegments)}};function gc(i){let t={};for(let e in i){t[e]={};for(let n in i[e]){let r=i[e][n];if(Nf(r))r.isRenderTargetTexture?(wt("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=r.clone();else if(Array.isArray(r))if(Nf(r[0])){let s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();t[e][n]=s}else t[e][n]=r.slice();else t[e][n]=r}}return t}function Jt(i){let t={};for(let e=0;e<i.length;e++){let n=gc(i[e]);for(let r in n)t[r]=n[r]}return t}function Nf(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function ex(i){let t=[];for(let e=0;e<i.length;e++)t.push(i[e].clone());return t}var ix=`void main() {
8
8
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
9
- }`,nv=`void main() {
9
+ }`,nx=`void main() {
10
10
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
11
- }`,Hi=class extends Nr{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ev,this.fragmentShader=nv,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=oc(t.uniforms),this.uniformsGroups=tv(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let r in this.uniforms){let a=this.uniforms[r].value;a&&a.isTexture?e.uniforms[r]={type:"t",value:a.toJSON(t).uuid}:a&&a.isColor?e.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?e.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?e.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?e.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?e.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?e.uniforms[r]={type:"m4",value:a.toArray()}:e.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let i={};for(let r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}fromJSON(t,e){if(super.fromJSON(t,e),t.uniforms!==void 0)for(let i in t.uniforms){let r=t.uniforms[i];switch(this.uniforms[i]={},r.type){case"t":this.uniforms[i].value=e[r.value]||null;break;case"c":this.uniforms[i].value=new et().setHex(r.value);break;case"v2":this.uniforms[i].value=new nt().fromArray(r.value);break;case"v3":this.uniforms[i].value=new C().fromArray(r.value);break;case"v4":this.uniforms[i].value=new Yt().fromArray(r.value);break;case"m3":this.uniforms[i].value=new tt().fromArray(r.value);break;case"m4":this.uniforms[i].value=new Ct().fromArray(r.value);break;default:this.uniforms[i].value=r.value}}if(t.defines!==void 0&&(this.defines=t.defines),t.vertexShader!==void 0&&(this.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(this.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(this.glslVersion=t.glslVersion),t.extensions!==void 0)for(let i in t.extensions)this.extensions[i]=t.extensions[i];return t.lights!==void 0&&(this.lights=t.lights),t.clipping!==void 0&&(this.clipping=t.clipping),this}};function Ui(n,t){return!n||n.constructor===t?n:typeof t.BYTES_PER_ELEMENT=="number"?new t(n):Array.prototype.slice.call(n)}function vl(n){return n!==void 0&&n.inTangents!==void 0&&n.outTangents!==void 0}var zn=class{constructor(t,e,i,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,i=this._cachedIndex,r=e[i],s=e[i-1];t:{e:{let a;n:{i:if(!(t<r)){for(let o=i+2;;){if(r===void 0){if(t<s)break i;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===o)break;if(s=r,r=e[++i],t<r)break e}a=e.length;break n}if(!(t>=s)){let o=e[1];t<o&&(i=2,s=o);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=e[--i-1],t>=s)break e}a=i,i=0;break n}break t}for(;i<a;){let o=i+a>>>1;t<e[o]?a=o:i=o+1}if(r=e[i],s=e[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,t,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=t*r;for(let a=0;a!==r;++a)e[a]=i[s+a];return e}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},ya=class extends zn{constructor(t,e,i,r){super(t,e,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Rl,endingEnd:Rl}}intervalChanged_(t,e,i){let r=this.parameterPositions,s=t-2,a=t+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case Il:s=t,o=2*e-i;break;case Ll:s=r.length-2,o=e+r[s]-r[s+1];break;default:s=t,o=i}if(l===void 0)switch(this.getSettings_().endingEnd){case Il:a=t,l=2*i-e;break;case Ll:a=1,l=i+r[1]-r[0];break;default:a=t-1,l=e}let c=(i-e)*.5,h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(l-i),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(t,e,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,m=this._weightPrev,d=this._weightNext,g=(i-e)/(r-e),y=g*g,v=y*g,S=-m*v+2*m*y-m*g,w=(1+m)*v+(-1.5-2*m)*y+(-.5+m)*g+1,I=(-1-d)*v+(1.5+d)*y+.5*g,U=d*v-d*y;for(let R=0;R!==o;++R)s[R]=S*a[h+R]+w*a[c+R]+I*a[l+R]+U*a[u+R];return s}},va=class extends zn{constructor(t,e,i,r){super(t,e,i,r)}interpolate_(t,e,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=(i-e)/(r-e),u=1-h;for(let m=0;m!==o;++m)s[m]=a[c+m]*u+a[l+m]*h;return s}},xa=class extends zn{constructor(t,e,i,r){super(t,e,i,r)}interpolate_(t){return this.copySampleValue_(t-1)}},Ma=class extends zn{interpolate_(t,e,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=this.inTangents,u=this.outTangents;if(!h||!u){let g=(i-e)/(r-e),y=1-g;for(let v=0;v!==o;++v)s[v]=a[c+v]*y+a[l+v]*g;return s}let m=o*2,d=t-1;for(let g=0;g!==o;++g){let y=a[c+g],v=a[l+g],S=d*m+g*2,w=u[S],I=u[S+1],U=t*m+g*2,R=h[U],V=h[U+1],B=rv(i,e,w,R,r);s[g]=Ff(B,y,I,V,v)}return s}};function Ff(n,t,e,i,r){let s=1-n;return s*s*s*t+3*s*s*n*e+3*s*n*n*i+n*n*n*r}function iv(n,t,e,i,r){let s=1-n;return 3*s*s*(e-t)+6*s*n*(i-e)+3*n*n*(r-i)}function rv(n,t,e,i,r){let s=(n-t)/(r-t);for(let a=0;a<8;a++){let o=Ff(s,t,e,i,r)-n;if(Math.abs(o)<1e-10)break;let l=iv(s,t,e,i,r);if(Math.abs(l)<1e-10)break;s=Math.max(0,Math.min(1,s-o/l))}return s}var de=class{constructor(t,e,i,r){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ui(e,this.TimeBufferType),this.values=Ui(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Ui(t.times,Array),values:Ui(t.values,Array)};let r=t.getInterpolation();r!==t.DefaultInterpolation&&(i.interpolation=r),vl(t.settings)&&(i.settings={inTangents:Ui(t.settings.inTangents,Array),outTangents:Ui(t.settings.outTangents,Array)})}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new xa(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new va(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new ya(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodBezier(t){let e=new Ma(this.times,this.values,this.getValueSize(),t);return this.settings&&(e.inTangents=this.settings.inTangents,e.outTangents=this.settings.outTangents),e}setInterpolation(t){let e;switch(t){case Ar:e=this.InterpolantFactoryMethodDiscrete;break;case fa:e=this.InterpolantFactoryMethodLinear;break;case la:e=this.InterpolantFactoryMethodSmooth;break;case Pl:e=this.InterpolantFactoryMethodBezier;break}if(e===void 0){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return wt("KeyframeTrack:",i),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ar;case this.InterpolantFactoryMethodLinear:return fa;case this.InterpolantFactoryMethodSmooth:return la;case this.InterpolantFactoryMethodBezier:return Pl}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let i=0,r=e.length;i!==r;++i)e[i]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let i=0,r=e.length;i!==r;++i)e[i]*=t;vl(this.settings)&&(_f(this.settings.inTangents,t),_f(this.settings.outTangents,t))}return this}trim(t,e){let i=this.times,r=i.length,s=0,a=r-1;for(;s!==r&&i[s]<t;)++s;for(;a!==-1&&i[a]>e;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);let o=this.getValueSize();this.times=i.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(_t("KeyframeTrack: Invalid value size in track.",this),t=!1);let i=this.times,r=this.values,s=i.length;s===0&&(_t("KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let o=0;o!==s;o++){let l=i[o];if(typeof l=="number"&&isNaN(l)){_t("KeyframeTrack: Time is not a valid number.",this,o,l),t=!1;break}if(a!==null&&a>l){_t("KeyframeTrack: Out of order keys.",this,o,l,a),t=!1;break}a=l}if(r!==void 0&&xy(r))for(let o=0,l=r.length;o!==l;++o){let c=r[o];if(isNaN(c)){_t("KeyframeTrack: Value is not a valid number.",this,o,c),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===la,s=t.length-1,a=1;for(let o=1;o<s;++o){let l=!1,c=t[o],h=t[o+1];if(c!==h&&(o!==1||c!==t[0]))if(r)l=!0;else{let u=o*i,m=u-i,d=u+i;for(let g=0;g!==i;++g){let y=e[u+g];if(y!==e[m+g]||y!==e[d+g]){l=!0;break}}}if(l){if(o!==a){t[a]=t[o];let u=o*i,m=a*i;for(let d=0;d!==i;++d)e[m+d]=e[u+d]}++a}}if(s>0){t[a]=t[s];for(let o=s*i,l=a*i,c=0;c!==i;++c)e[l+c]=e[o+c];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*i)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),i=this.constructor,r=new i(this.name,t,e);return r.createInterpolant=this.createInterpolant,vl(this.settings)&&(r.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),r}};function _f(n,t){for(let e=0,i=n.length;e!==i;e+=2)n[e]*=t}de.prototype.ValueTypeName="";de.prototype.TimeBufferType=Float32Array;de.prototype.ValueBufferType=Float32Array;de.prototype.DefaultInterpolation=fa;var kn=class extends de{constructor(t,e,i){super(t,e,i)}};kn.prototype.ValueTypeName="bool";kn.prototype.ValueBufferType=Array;kn.prototype.DefaultInterpolation=Ar;kn.prototype.InterpolantFactoryMethodLinear=void 0;kn.prototype.InterpolantFactoryMethodSmooth=void 0;var Sa=class extends de{constructor(t,e,i,r){super(t,e,i,r)}};Sa.prototype.ValueTypeName="color";var ba=class extends de{constructor(t,e,i,r){super(t,e,i,r)}};ba.prototype.ValueTypeName="number";var wa=class extends zn{constructor(t,e,i,r){super(t,e,i,r)}interpolate_(t,e,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(i-e)/(r-e),c=t*o;for(let h=c+o;c!==h;c+=4)He.slerpFlat(s,0,a,c-o,a,c,l);return s}},Or=class extends de{constructor(t,e,i,r){super(t,e,i,r)}InterpolantFactoryMethodLinear(t){return new wa(this.times,this.values,this.getValueSize(),t)}};Or.prototype.ValueTypeName="quaternion";Or.prototype.InterpolantFactoryMethodSmooth=void 0;var Vn=class extends de{constructor(t,e,i){super(t,e,i)}};Vn.prototype.ValueTypeName="string";Vn.prototype.ValueBufferType=Array;Vn.prototype.DefaultInterpolation=Ar;Vn.prototype.InterpolantFactoryMethodLinear=void 0;Vn.prototype.InterpolantFactoryMethodSmooth=void 0;var Ea=class extends de{constructor(t,e,i,r){super(t,e,i,r)}};Ea.prototype.ValueTypeName="vector";var Ta=class{constructor(t,e,i){let r=this,s=!1,a=0,o=0,l,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this._abortController=null,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return h=h.normalize("NFC"),l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){let u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,m=c.length;u<m;u+=2){let d=c[u],g=c[u+1];if(d.global&&(d.lastIndex=0),d.test(h))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},Of=new Ta,Aa=class{constructor(t){this.manager=t!==void 0?t:Of,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(t,e){let i=this;return new Promise(function(r,s){i.load(t,r,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}};Aa.DEFAULT_MATERIAL_NAME="__DEFAULT";var aa=new C,oa=new He,ke=new C,Br=class extends We{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ct,this.projectionMatrix=new Ct,this.projectionMatrixInverse=new Ct,this.coordinateSystem=Oi,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorld.decompose(aa,oa,ke),ke.x===1&&ke.y===1&&ke.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aa,oa,ke.set(1,1,1)).invert()}updateWorldMatrix(t,e,i=!1){super.updateWorldMatrix(t,e,i),this.matrixWorld.decompose(aa,oa,ke),ke.x===1&&ke.y===1&&ke.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aa,oa,ke.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}};var lc="\\[\\]\\.:\\/",sv=new RegExp("["+lc+"]","g"),cc="[^"+lc+"]",av="[^"+lc.replace("\\.","")+"]",ov=/((?:WC+[\/:])*)/.source.replace("WC",cc),lv=/(WCOD+)?/.source.replace("WCOD",av),cv=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",cc),hv=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",cc),uv=new RegExp("^"+ov+lv+cv+hv+"$"),fv=["material","materials","bones","map"],Ol=class{constructor(t,e,i){let r=i||mt.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}getValue(t,e){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(t,e)}setValue(t,e){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},mt=class n{constructor(t,e,i){this.path=e,this.parsedPath=i||n.parseTrackName(e),this.node=n.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new n.Composite(t,e,i):new n(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(sv,"")}static parseTrackName(t){let e=uv.exec(t);if(e===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=i.nodeName.substring(r+1);fv.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(i!==void 0)return i}if(t.children){let i=function(s){for(let a=0;a<s.length;a++){let o=s[a];if(o.name===e||o.uuid===e)return o;let l=i(o.children);if(l)return l}return null},r=i(t.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)t[e++]=i[r]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,i=e.objectName,r=e.propertyName,s=e.propertyIndex;if(t||(t=n.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){wt("PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=e.objectIndex;switch(i){case"materials":if(!t.material){_t("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){_t("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){_t("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let h=0;h<t.length;h++)if(t[h].name===c){c=h;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){_t("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){_t("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[i]===void 0){_t("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[i]}if(c!==void 0){if(t[c]===void 0){_t("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}let a=t[r];if(a===void 0){let c=e.nodeName;_t("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?o=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!t.geometry){_t("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){_t("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[s]!==void 0&&(s=t.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};mt.Composite=Ol;mt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};mt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};mt.prototype.GetterByBindingType=[mt.prototype._getValue_direct,mt.prototype._getValue_array,mt.prototype._getValue_arrayElement,mt.prototype._getValue_toArray];mt.prototype.SetterByBindingTypeAndVersioning=[[mt.prototype._setValue_direct,mt.prototype._setValue_direct_setNeedsUpdate,mt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[mt.prototype._setValue_array,mt.prototype._setValue_array_setNeedsUpdate,mt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[mt.prototype._setValue_arrayElement,mt.prototype._setValue_arrayElement_setNeedsUpdate,mt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[mt.prototype._setValue_fromArray,mt.prototype._setValue_fromArray_setNeedsUpdate,mt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var v2=new Float32Array(1);var yf=new Ct,Gr=class{constructor(t,e,i=0,r=1/0){this.ray=new Dr(t,e),this.near=i,this.far=r,this.camera=null,this.layers=new Pr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,e.projectionMatrix.elements[14]).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):_t("Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return yf.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(yf),this}intersectObject(t,e=!0,i=[]){return Bl(t,this,i,e),i.sort(vf),i}intersectObjects(t,e=!0,i=[]){for(let r=0,s=t.length;r<s;r++)Bl(t[r],this,i,e);return i.sort(vf),i}};function vf(n,t){return n.distance-t.distance}function Bl(n,t,e,i){let r=!0;if(n.layers.test(t.layers)&&n.raycast(t,e)===!1&&(r=!1),r===!0&&i===!0){let s=n.children;for(let a=0,o=s.length;a<o;a++)Bl(s[a],t,e,!0)}}var Gl=class n{static{n.prototype.isMatrix2=!0}constructor(t,e,i,r){this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let i=0;i<4;i++)this.elements[i]=t[i+e];return this}set(t,e,i,r){let s=this.elements;return s[0]=t,s[2]=e,s[1]=i,s[3]=r,this}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"186"}}));typeof window<"u"&&(window.__THREE__?wt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="186");var bv=`#ifdef USE_ALPHAHASH
11
+ }`,Yn=class extends Dr{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ix,this.fragmentShader=nx,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=gc(t.uniforms),this.uniformsGroups=ex(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let r in this.uniforms){let a=this.uniforms[r].value;a&&a.isTexture?e.uniforms[r]={type:"t",value:a.toJSON(t).uuid}:a&&a.isColor?e.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?e.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?e.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?e.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?e.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?e.uniforms[r]={type:"m4",value:a.toArray()}:e.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}fromJSON(t,e){if(super.fromJSON(t,e),t.uniforms!==void 0)for(let n in t.uniforms){let r=t.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=e[r.value]||null;break;case"c":this.uniforms[n].value=new it().setHex(r.value);break;case"v2":this.uniforms[n].value=new nt().fromArray(r.value);break;case"v3":this.uniforms[n].value=new R().fromArray(r.value);break;case"v4":this.uniforms[n].value=new jt().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Q().fromArray(r.value);break;case"m4":this.uniforms[n].value=new Pt().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(t.defines!==void 0&&(this.defines=t.defines),t.vertexShader!==void 0&&(this.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(this.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(this.glslVersion=t.glslVersion),t.extensions!==void 0)for(let n in t.extensions)this.extensions[n]=t.extensions[n];return t.lights!==void 0&&(this.lights=t.lights),t.clipping!==void 0&&(this.clipping=t.clipping),this}};function kn(i,t){return!i||i.constructor===t?i:typeof t.BYTES_PER_ELEMENT=="number"?new t(i):Array.prototype.slice.call(i)}function ca(i){return i!==void 0&&i.inTangents!==void 0&&i.outTangents!==void 0}var Gi=class{constructor(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,r=e[n],s=e[n-1];t:{e:{let a;i:{n:if(!(t<r)){for(let o=n+2;;){if(r===void 0){if(t<s)break n;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=r,r=e[++n],t<r)break e}a=e.length;break i}if(!(t>=s)){let o=e[1];t<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=e[--n-1],t>=s)break e}a=n,n=0;break i}break t}for(;n<a;){let o=n+a>>>1;t<e[o]?a=o:n=o+1}if(r=e[n],s=e[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,t,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=t*r;for(let a=0;a!==r;++a)e[a]=n[s+a];return e}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},ba=class extends Gi{constructor(t,e,n,r){super(t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Gl,endingEnd:Gl}}intervalChanged_(t,e,n){let r=this.parameterPositions,s=t-2,a=t+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case zl:s=t,o=2*e-n;break;case kl:s=r.length-2,o=e+r[s]-r[s+1];break;default:s=t,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case zl:a=t,l=2*n-e;break;case kl:a=1,l=n+r[1]-r[0];break;default:a=t-1,l=e}let c=(n-e)*.5,h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(t,e,n,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,p=this._weightPrev,d=this._weightNext,_=(n-e)/(r-e),g=_*_,v=g*_,x=-p*v+2*p*g-p*_,b=(1+p)*v+(-1.5-2*p)*g+(-.5+p)*_+1,A=(-1-d)*v+(1.5+d)*g+.5*_,P=d*v-d*g;for(let N=0;N!==o;++N)s[N]=x*a[h+N]+b*a[c+N]+A*a[l+N]+P*a[u+N];return s}},Ea=class extends Gi{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t,e,n,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=(n-e)/(r-e),u=1-h;for(let p=0;p!==o;++p)s[p]=a[c+p]*u+a[l+p]*h;return s}},wa=class extends Gi{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t){return this.copySampleValue_(t-1)}},Ta=class extends Gi{interpolate_(t,e,n,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=this.inTangents,u=this.outTangents;if(!h||!u){let _=(n-e)/(r-e),g=1-_;for(let v=0;v!==o;++v)s[v]=a[c+v]*g+a[l+v]*_;return s}let p=o*2,d=t-1;for(let _=0;_!==o;++_){let g=a[c+_],v=a[l+_],x=d*p+_*2,b=u[x],A=u[x+1],P=t*p+_*2,N=h[P],G=h[P+1],B=sx(n,e,b,N,r);s[_]=ed(B,g,A,G,v)}return s}};function ed(i,t,e,n,r){let s=1-i;return s*s*s*t+3*s*s*i*e+3*s*i*i*n+i*i*i*r}function rx(i,t,e,n,r){let s=1-i;return 3*s*s*(e-t)+6*s*i*(n-e)+3*i*i*(r-n)}function sx(i,t,e,n,r){let s=(i-t)/(r-t);for(let a=0;a<8;a++){let o=ed(s,t,e,n,r)-i;if(Math.abs(o)<1e-10)break;let l=rx(s,t,e,n,r);if(Math.abs(l)<1e-10)break;s=Math.max(0,Math.min(1,s-o/l))}return s}var de=class{constructor(t,e,n,r){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=kn(e,this.TimeBufferType),this.values=kn(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:kn(t.times,Array),values:kn(t.values,Array)};let r=t.getInterpolation();r!==t.DefaultInterpolation&&(n.interpolation=r),ca(t.settings)&&(n.settings={inTangents:kn(t.settings.inTangents,Array),outTangents:kn(t.settings.outTangents,Array)})}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new wa(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ea(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new ba(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodBezier(t){let e=new Ta(this.times,this.values,this.getValueSize(),t);return this.settings&&(e.inTangents=this.settings.inTangents,e.outTangents=this.settings.outTangents),e}setInterpolation(t){let e;switch(t){case Cr:e=this.InterpolantFactoryMethodDiscrete;break;case _a:e=this.InterpolantFactoryMethodLinear;break;case fa:e=this.InterpolantFactoryMethodSmooth;break;case Bl:e=this.InterpolantFactoryMethodBezier;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return wt("KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Cr;case this.InterpolantFactoryMethodLinear:return _a;case this.InterpolantFactoryMethodSmooth:return fa;case this.InterpolantFactoryMethodBezier:return Bl}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]+=t;ca(this.settings)&&(Lf(this.settings.inTangents,t),Lf(this.settings.outTangents,t))}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]*=t;ca(this.settings)&&(Df(this.settings.inTangents,t),Df(this.settings.outTangents,t))}return this}trim(t,e){let n=this.times,r=n.length,s=0,a=r-1;for(;s!==r&&n[s]<t;)++s;for(;a!==-1&&n[a]>e;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);let o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(_t("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,r=this.values,s=n.length;s===0&&(_t("KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let o=0;o!==s;o++){let l=n[o];if(typeof l=="number"&&isNaN(l)){_t("KeyframeTrack: Time is not a valid number.",this,o,l),t=!1;break}if(a!==null&&a>l){_t("KeyframeTrack: Out of order keys.",this,o,l,a),t=!1;break}a=l}if(r!==void 0&&Sv(r))for(let o=0,l=r.length;o!==l;++o){let c=r[o];if(isNaN(c)){_t("KeyframeTrack: Value is not a valid number.",this,o,c),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===fa,s=t.length-1,a=1;for(let o=1;o<s;++o){let l=!1,c=t[o],h=t[o+1];if(c!==h&&(o!==1||c!==t[0]))if(r)l=!0;else{let u=o*n,p=u-n,d=u+n;for(let _=0;_!==n;++_){let g=e[u+_];if(g!==e[p+_]||g!==e[d+_]){l=!0;break}}}if(l){if(o!==a){t[a]=t[o];let u=o*n,p=a*n;for(let d=0;d!==n;++d)e[p+d]=e[u+d]}++a}}if(s>0){t[a]=t[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)e[l+c]=e[o+c];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,r=new n(this.name,t,e);return r.createInterpolant=this.createInterpolant,ca(this.settings)&&(r.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),r}};function Lf(i,t){for(let e=0,n=i.length;e!==n;e+=2)i[e]+=t}function Df(i,t){for(let e=0,n=i.length;e!==n;e+=2)i[e]*=t}de.prototype.ValueTypeName="";de.prototype.TimeBufferType=Float32Array;de.prototype.ValueBufferType=Float32Array;de.prototype.DefaultInterpolation=_a;var zi=class extends de{constructor(t,e,n){super(t,e,n)}};zi.prototype.ValueTypeName="bool";zi.prototype.ValueBufferType=Array;zi.prototype.DefaultInterpolation=Cr;zi.prototype.InterpolantFactoryMethodLinear=void 0;zi.prototype.InterpolantFactoryMethodSmooth=void 0;var Aa=class extends de{constructor(t,e,n,r){super(t,e,n,r)}};Aa.prototype.ValueTypeName="color";var Ca=class extends de{constructor(t,e,n,r){super(t,e,n,r)}};Ca.prototype.ValueTypeName="number";var Pa=class extends Gi{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t,e,n,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-e)/(r-e),c=t*o;for(let h=c+o;c!==h;c+=4)Xe.slerpFlat(s,0,a,c-o,a,c,l);return s}},Br=class extends de{constructor(t,e,n,r){super(t,e,n,r)}InterpolantFactoryMethodLinear(t){return new Pa(this.times,this.values,this.getValueSize(),t)}};Br.prototype.ValueTypeName="quaternion";Br.prototype.InterpolantFactoryMethodSmooth=void 0;var ki=class extends de{constructor(t,e,n){super(t,e,n)}};ki.prototype.ValueTypeName="string";ki.prototype.ValueBufferType=Array;ki.prototype.DefaultInterpolation=Cr;ki.prototype.InterpolantFactoryMethodLinear=void 0;ki.prototype.InterpolantFactoryMethodSmooth=void 0;var Ra=class extends de{constructor(t,e,n,r){super(t,e,n,r)}};Ra.prototype.ValueTypeName="vector";var Ia=class{constructor(t,e,n){let r=this,s=!1,a=0,o=0,l,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return h=h.normalize("NFC"),l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){let u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,p=c.length;u<p;u+=2){let d=c[u],_=c[u+1];if(d.global&&(d.lastIndex=0),d.test(h))return _}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},id=new Ia,Na=class{constructor(t){this.manager=t!==void 0?t:id,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(t,e){let n=this;return new Promise(function(r,s){n.load(t,r,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}setPriority(t){return this.priority=t,this}setCache(t){return this.cache=t,this}abort(){return this}};Na.DEFAULT_MATERIAL_NAME="__DEFAULT";var ha=new R,ua=new Xe,He=new R,Gr=class extends qe{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Pt,this.projectionMatrix=new Pt,this.projectionMatrixInverse=new Pt,this.coordinateSystem=Vn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorld.decompose(ha,ua,He),He.x===1&&He.y===1&&He.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ha,ua,He.set(1,1,1)).invert()}updateWorldMatrix(t,e,n=!1){super.updateWorldMatrix(t,e,n),this.matrixWorld.decompose(ha,ua,He),He.x===1&&He.y===1&&He.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ha,ua,He.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}};var _c="\\[\\]\\.:\\/",ax=new RegExp("["+_c+"]","g"),yc="[^"+_c+"]",ox="[^"+_c.replace("\\.","")+"]",lx=/((?:WC+[\/:])*)/.source.replace("WC",yc),cx=/(WCOD+)?/.source.replace("WCOD",ox),hx=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",yc),ux=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",yc),fx=new RegExp("^"+lx+cx+hx+ux+"$"),dx=["material","materials","bones","map"],ql=class{constructor(t,e,n){let r=n||mt.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},mt=class i{constructor(t,e,n){this.path=e,this.parsedPath=n||i.parseTrackName(e),this.node=i.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new i.Composite(t,e,n):new i(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(ax,"")}static parseTrackName(t){let e=fx.exec(t);if(e===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);dx.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(s){for(let a=0;a<s.length;a++){let o=s[a];if(o.name===e||o.uuid===e)return o;let l=n(o.children);if(l)return l}return null},r=n(t.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)t[e++]=n[r]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,n=e.objectName,r=e.propertyName,s=e.propertyIndex;if(t||(t=i.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){wt("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=e.objectIndex;switch(n){case"materials":if(!t.material){_t("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){_t("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){_t("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let h=0;h<t.length;h++)if(t[h].name===c){c=h;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){_t("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){_t("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){_t("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(c!==void 0){if(t[c]===void 0){_t("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}let a=t[r];if(a===void 0){let c=e.nodeName;_t("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?o=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!t.geometry){_t("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){_t("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[s]!==void 0&&(s=t.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};mt.Composite=ql;mt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};mt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};mt.prototype.GetterByBindingType=[mt.prototype._getValue_direct,mt.prototype._getValue_array,mt.prototype._getValue_arrayElement,mt.prototype._getValue_toArray];mt.prototype.SetterByBindingTypeAndVersioning=[[mt.prototype._setValue_direct,mt.prototype._setValue_direct_setNeedsUpdate,mt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[mt.prototype._setValue_array,mt.prototype._setValue_array_setNeedsUpdate,mt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[mt.prototype._setValue_arrayElement,mt.prototype._setValue_arrayElement_setNeedsUpdate,mt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[mt.prototype._setValue_fromArray,mt.prototype._setValue_fromArray_setNeedsUpdate,mt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var X2=new Float32Array(1);var Of=new Pt,zr=class{constructor(t,e,n=0,r=1/0){this.ray=new Or(t,e),this.near=n,this.far=r,this.camera=null,this.layers=new Rr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,e.projectionMatrix.elements[14]).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):_t("Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return Of.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Of),this}intersectObject(t,e=!0,n=[]){return Yl(t,this,n,e),n.sort(Uf),n}intersectObjects(t,e=!0,n=[]){for(let r=0,s=t.length;r<s;r++)Yl(t[r],this,n,e);return n.sort(Uf),n}};function Uf(i,t){return i.distance-t.distance}function Yl(i,t,e,n){let r=!0;if(i.layers.test(t.layers)&&i.raycast(t,e)===!1&&(r=!1),r===!0&&n===!0){let s=i.children;for(let a=0,o=s.length;a<o;a++)Yl(s[a],t,e,!0)}}var jl=class{static{this.prototype.isMatrix2=!0}constructor(t,e,n,r){this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,r){let s=this.elements;return s[0]=t,s[2]=e,s[1]=n,s[3]=r,this}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"187"}}));typeof window<"u"&&(window.__THREE__?wt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="187");var Ex=`#ifdef USE_ALPHAHASH
12
12
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
13
- #endif`,wv=`#ifdef USE_ALPHAHASH
13
+ #endif`,wx=`#ifdef USE_ALPHAHASH
14
14
  const float ALPHA_HASH_SCALE = 0.05;
15
15
  float hash2D( vec2 value ) {
16
16
  return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -45,20 +45,20 @@ Originally allocated`),"captureStackTrace"in Error&&Error.captureStackTrace(b.le
45
45
  : cases.z;
46
46
  return clamp( threshold , 1.0e-6, 1.0 );
47
47
  }
48
- #endif`,Ev=`#ifdef USE_ALPHAMAP
48
+ #endif`,Tx=`#ifdef USE_ALPHAMAP
49
49
  diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
50
- #endif`,Tv=`#ifdef USE_ALPHAMAP
50
+ #endif`,Ax=`#ifdef USE_ALPHAMAP
51
51
  uniform sampler2D alphaMap;
52
- #endif`,Av=`#ifdef USE_ALPHATEST
52
+ #endif`,Cx=`#ifdef USE_ALPHATEST
53
53
  #ifdef ALPHA_TO_COVERAGE
54
54
  diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
55
55
  if ( diffuseColor.a == 0.0 ) discard;
56
56
  #else
57
57
  if ( diffuseColor.a < alphaTest ) discard;
58
58
  #endif
59
- #endif`,Cv=`#ifdef USE_ALPHATEST
59
+ #endif`,Px=`#ifdef USE_ALPHATEST
60
60
  uniform float alphaTest;
61
- #endif`,Pv=`#ifdef USE_AOMAP
61
+ #endif`,Rx=`#ifdef USE_AOMAP
62
62
  float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
63
63
  reflectedLight.indirectDiffuse *= ambientOcclusion;
64
64
  #if defined( USE_CLEARCOAT )
@@ -71,10 +71,10 @@ Originally allocated`),"captureStackTrace"in Error&&Error.captureStackTrace(b.le
71
71
  float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
72
72
  reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
73
73
  #endif
74
- #endif`,Rv=`#ifdef USE_AOMAP
74
+ #endif`,Ix=`#ifdef USE_AOMAP
75
75
  uniform sampler2D aoMap;
76
76
  uniform float aoMapIntensity;
77
- #endif`,Iv=`#ifdef USE_BATCHING
77
+ #endif`,Nx=`#ifdef USE_BATCHING
78
78
  #if ! defined( GL_ANGLE_multi_draw )
79
79
  #define gl_DrawID _gl_DrawID
80
80
  uniform int _gl_DrawID;
@@ -108,15 +108,15 @@ Originally allocated`),"captureStackTrace"in Error&&Error.captureStackTrace(b.le
108
108
  int y = j / size;
109
109
  return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
110
110
  }
111
- #endif`,Lv=`#ifdef USE_BATCHING
111
+ #endif`,Lx=`#ifdef USE_BATCHING
112
112
  mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
113
- #endif`,Nv=`vec3 transformed = vec3( position );
113
+ #endif`,Dx=`vec3 transformed = vec3( position );
114
114
  #ifdef USE_ALPHAHASH
115
115
  vPosition = vec3( position );
116
- #endif`,Dv=`vec3 objectNormal = vec3( normal );
116
+ #endif`,Ox=`vec3 objectNormal = vec3( normal );
117
117
  #ifdef USE_TANGENT
118
118
  vec3 objectTangent = vec3( tangent.xyz );
119
- #endif`,Uv=`float G_BlinnPhong_Implicit( ) {
119
+ #endif`,Ux=`float G_BlinnPhong_Implicit( ) {
120
120
  return 0.25;
121
121
  }
122
122
  float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -130,7 +130,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
130
130
  float G = G_BlinnPhong_Implicit( );
131
131
  float D = D_BlinnPhong( shininess, dotNH );
132
132
  return F * ( G * D );
133
- } // validated`,Fv=`#ifdef USE_IRIDESCENCE
133
+ } // validated`,Fx=`#ifdef USE_IRIDESCENCE
134
134
  const mat3 XYZ_TO_REC709 = mat3(
135
135
  3.2404542, -0.9692660, 0.0556434,
136
136
  -1.5371385, 1.8760108, -0.2040259,
@@ -193,7 +193,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
193
193
  }
194
194
  return max( I, vec3( 0.0 ) );
195
195
  }
196
- #endif`,Ov=`#ifdef USE_BUMPMAP
196
+ #endif`,Bx=`#ifdef USE_BUMPMAP
197
197
  uniform sampler2D bumpMap;
198
198
  uniform float bumpScale;
199
199
  vec2 dHdxy_fwd() {
@@ -214,7 +214,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
214
214
  vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
215
215
  return normalize( abs( fDet ) * surf_norm - vGrad );
216
216
  }
217
- #endif`,Bv=`#if NUM_CLIPPING_PLANES > 0
217
+ #endif`,Gx=`#if NUM_CLIPPING_PLANES > 0
218
218
  vec4 plane;
219
219
  #ifdef ALPHA_TO_COVERAGE
220
220
  float distanceToPlane, distanceGradient;
@@ -260,20 +260,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
260
260
  if ( clipped ) discard;
261
261
  #endif
262
262
  #endif
263
- #endif`,Gv=`#if NUM_CLIPPING_PLANES > 0
263
+ #endif`,zx=`#if NUM_CLIPPING_PLANES > 0
264
264
  varying vec3 vClipPosition;
265
265
  uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
266
- #endif`,zv=`#if NUM_CLIPPING_PLANES > 0
266
+ #endif`,kx=`#if NUM_CLIPPING_PLANES > 0
267
267
  varying vec3 vClipPosition;
268
- #endif`,kv=`#if NUM_CLIPPING_PLANES > 0
268
+ #endif`,Vx=`#if NUM_CLIPPING_PLANES > 0
269
269
  vClipPosition = - mvPosition.xyz;
270
- #endif`,Vv=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
270
+ #endif`,Hx=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
271
271
  diffuseColor *= vColor;
272
- #endif`,Hv=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
272
+ #endif`,Wx=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
273
273
  varying vec4 vColor;
274
- #endif`,Wv=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
274
+ #endif`,Xx=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
275
275
  varying vec4 vColor;
276
- #endif`,Xv=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
276
+ #endif`,qx=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
277
277
  vColor = vec4( 1.0 );
278
278
  #endif
279
279
  #ifdef USE_COLOR_ALPHA
@@ -286,7 +286,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
286
286
  #endif
287
287
  #ifdef USE_BATCHING_COLOR
288
288
  vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
289
- #endif`,qv=`#define PI 3.141592653589793
289
+ #endif`,Yx=`#define PI 3.141592653589793
290
290
  #define PI2 6.283185307179586
291
291
  #define PI_HALF 1.5707963267948966
292
292
  #define RECIPROCAL_PI 0.3183098861837907
@@ -357,100 +357,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
357
357
  float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
358
358
  float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
359
359
  return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
360
- } // validated`,Yv=`#ifdef ENVMAP_TYPE_CUBE_UV
361
- #define cubeUV_minMipLevel 4.0
362
- #define cubeUV_minTileSize 16.0
363
- float getFace( vec3 direction ) {
364
- vec3 absDirection = abs( direction );
365
- float face = - 1.0;
366
- if ( absDirection.x > absDirection.z ) {
367
- if ( absDirection.x > absDirection.y )
368
- face = direction.x > 0.0 ? 0.0 : 3.0;
369
- else
370
- face = direction.y > 0.0 ? 1.0 : 4.0;
371
- } else {
372
- if ( absDirection.z > absDirection.y )
373
- face = direction.z > 0.0 ? 2.0 : 5.0;
374
- else
375
- face = direction.y > 0.0 ? 1.0 : 4.0;
376
- }
377
- return face;
378
- }
379
- vec2 getUV( vec3 direction, float face ) {
380
- vec2 uv;
381
- if ( face == 0.0 ) {
382
- uv = vec2( direction.z, direction.y ) / abs( direction.x );
383
- } else if ( face == 1.0 ) {
384
- uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
385
- } else if ( face == 2.0 ) {
386
- uv = vec2( - direction.x, direction.y ) / abs( direction.z );
387
- } else if ( face == 3.0 ) {
388
- uv = vec2( - direction.z, direction.y ) / abs( direction.x );
389
- } else if ( face == 4.0 ) {
390
- uv = vec2( - direction.x, direction.z ) / abs( direction.y );
391
- } else {
392
- uv = vec2( direction.x, direction.y ) / abs( direction.z );
393
- }
394
- return 0.5 * ( uv + 1.0 );
395
- }
396
- vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
397
- float face = getFace( direction );
398
- float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
399
- mipInt = max( mipInt, cubeUV_minMipLevel );
400
- float faceSize = exp2( mipInt );
401
- highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
402
- if ( face > 2.0 ) {
403
- uv.y += faceSize;
404
- face -= 3.0;
405
- }
406
- uv.x += face * faceSize;
407
- uv.x += filterInt * 3.0 * cubeUV_minTileSize;
408
- uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
409
- uv.x *= CUBEUV_TEXEL_WIDTH;
410
- uv.y *= CUBEUV_TEXEL_HEIGHT;
411
- #ifdef texture2DGradEXT
412
- return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
413
- #else
414
- return texture2D( envMap, uv ).rgb;
415
- #endif
416
- }
417
- #define cubeUV_r0 1.0
418
- #define cubeUV_m0 - 2.0
419
- #define cubeUV_r1 0.8
420
- #define cubeUV_m1 - 1.0
421
- #define cubeUV_r4 0.4
422
- #define cubeUV_m4 2.0
423
- #define cubeUV_r5 0.305
424
- #define cubeUV_m5 3.0
425
- #define cubeUV_r6 0.21
426
- #define cubeUV_m6 4.0
427
- float roughnessToMip( float roughness ) {
428
- float mip = 0.0;
429
- if ( roughness >= cubeUV_r1 ) {
430
- mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
431
- } else if ( roughness >= cubeUV_r4 ) {
432
- mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
433
- } else if ( roughness >= cubeUV_r5 ) {
434
- mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
435
- } else if ( roughness >= cubeUV_r6 ) {
436
- mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
437
- } else {
438
- mip = - 2.0 * log2( 1.16 * roughness ); }
439
- return mip;
440
- }
441
- vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
442
- float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
443
- float mipF = fract( mip );
444
- float mipInt = floor( mip );
445
- vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
446
- if ( mipF == 0.0 ) {
447
- return vec4( color0, 1.0 );
448
- } else {
449
- vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
450
- return vec4( mix( color0, color1, mipF ), 1.0 );
451
- }
452
- }
453
- #endif`,jv=`vec3 transformedNormal = objectNormal;
360
+ } // validated`,jx=`vec3 transformedNormal = objectNormal;
454
361
  #ifdef USE_TANGENT
455
362
  vec3 transformedTangent = objectTangent;
456
363
  #endif
@@ -476,21 +383,21 @@ transformedNormal = normalMatrix * transformedNormal;
476
383
  #endif
477
384
  #ifdef USE_TANGENT
478
385
  transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
479
- #endif`,Zv=`#ifdef USE_DISPLACEMENTMAP
386
+ #endif`,Zx=`#ifdef USE_DISPLACEMENTMAP
480
387
  uniform sampler2D displacementMap;
481
388
  uniform float displacementScale;
482
389
  uniform float displacementBias;
483
- #endif`,Jv=`#ifdef USE_DISPLACEMENTMAP
390
+ #endif`,Jx=`#ifdef USE_DISPLACEMENTMAP
484
391
  transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
485
- #endif`,$v=`#ifdef USE_EMISSIVEMAP
392
+ #endif`,$x=`#ifdef USE_EMISSIVEMAP
486
393
  vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
487
394
  #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
488
395
  emissiveColor = sRGBTransferEOTF( emissiveColor );
489
396
  #endif
490
397
  totalEmissiveRadiance *= emissiveColor.rgb;
491
- #endif`,Kv=`#ifdef USE_EMISSIVEMAP
398
+ #endif`,Kx=`#ifdef USE_EMISSIVEMAP
492
399
  uniform sampler2D emissiveMap;
493
- #endif`,Qv="gl_FragColor = linearToOutputTexel( gl_FragColor );",tx=`vec4 LinearTransferOETF( in vec4 value ) {
400
+ #endif`,Qx="gl_FragColor = linearToOutputTexel( gl_FragColor );",tM=`vec4 LinearTransferOETF( in vec4 value ) {
494
401
  return value;
495
402
  }
496
403
  vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -498,7 +405,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
498
405
  }
499
406
  vec4 sRGBTransferOETF( in vec4 value ) {
500
407
  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 );
501
- }`,ex=`#ifdef USE_ENVMAP
408
+ }`,eM=`#ifdef USE_ENVMAP
502
409
  #ifdef ENV_WORLDPOS
503
410
  vec3 cameraToFrag;
504
411
  if ( isOrthographic ) {
@@ -525,15 +432,17 @@ vec4 sRGBTransferOETF( in vec4 value ) {
525
432
  outgoingLight += envColor.xyz * specularStrength * reflectivity;
526
433
  #endif
527
434
  #endif
528
- #endif`,nx=`#ifdef USE_ENVMAP
435
+ #endif`,iM=`#ifdef USE_ENVMAP
529
436
  uniform float envMapIntensity;
530
437
  uniform mat3 envMapRotation;
531
- #ifdef ENVMAP_TYPE_CUBE
532
- uniform samplerCube envMap;
533
- #else
534
- uniform sampler2D envMap;
438
+ uniform samplerCube envMap;
439
+ #ifdef ENVMAP_TYPE_PMREM
440
+ float roughnessToMip( const in float roughness ) {
441
+ float r = clamp( roughness, 0.0, 1.0 );
442
+ return ENVMAP_MAX_LOD * r * ( 2.0 - r );
443
+ }
535
444
  #endif
536
- #endif`,ix=`#ifdef USE_ENVMAP
445
+ #endif`,nM=`#ifdef USE_ENVMAP
537
446
  uniform float reflectivity;
538
447
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
539
448
  #define ENV_WORLDPOS
@@ -544,7 +453,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
544
453
  #else
545
454
  varying vec3 vReflect;
546
455
  #endif
547
- #endif`,rx=`#ifdef USE_ENVMAP
456
+ #endif`,rM=`#ifdef USE_ENVMAP
548
457
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
549
458
  #define ENV_WORLDPOS
550
459
  #endif
@@ -555,7 +464,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
555
464
  varying vec3 vReflect;
556
465
  uniform float refractionRatio;
557
466
  #endif
558
- #endif`,sx=`#ifdef USE_ENVMAP
467
+ #endif`,sM=`#ifdef USE_ENVMAP
559
468
  #ifdef ENV_WORLDPOS
560
469
  vWorldPosition = worldPosition.xyz;
561
470
  #else
@@ -572,18 +481,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
572
481
  vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
573
482
  #endif
574
483
  #endif
575
- #endif`,ax=`#ifdef USE_FOG
484
+ #endif`,aM=`#ifdef USE_FOG
576
485
  vFogDepth = - mvPosition.z;
577
- #endif`,ox=`#ifdef USE_FOG
486
+ #endif`,oM=`#ifdef USE_FOG
578
487
  varying float vFogDepth;
579
- #endif`,lx=`#ifdef USE_FOG
488
+ #endif`,lM=`#ifdef USE_FOG
580
489
  #ifdef FOG_EXP2
581
490
  float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
582
491
  #else
583
492
  float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
584
493
  #endif
585
494
  gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
586
- #endif`,cx=`#ifdef USE_FOG
495
+ #endif`,cM=`#ifdef USE_FOG
587
496
  uniform vec3 fogColor;
588
497
  varying float vFogDepth;
589
498
  #ifdef FOG_EXP2
@@ -592,7 +501,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
592
501
  uniform float fogNear;
593
502
  uniform float fogFar;
594
503
  #endif
595
- #endif`,hx=`#ifdef USE_GRADIENTMAP
504
+ #endif`,hM=`#ifdef USE_GRADIENTMAP
596
505
  uniform sampler2D gradientMap;
597
506
  #endif
598
507
  vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -604,12 +513,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
604
513
  vec2 fw = fwidth( coord ) * 0.5;
605
514
  return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
606
515
  #endif
607
- }`,ux=`#ifdef USE_LIGHTMAP
516
+ }`,uM=`#ifdef USE_LIGHTMAP
608
517
  uniform sampler2D lightMap;
609
518
  uniform float lightMapIntensity;
610
- #endif`,fx=`LambertMaterial material;
519
+ #endif`,fM=`LambertMaterial material;
611
520
  material.diffuseColor = diffuseColor.rgb;
612
- material.specularStrength = specularStrength;`,dx=`varying vec3 vViewPosition;
521
+ material.specularStrength = specularStrength;`,dM=`varying vec3 vViewPosition;
613
522
  struct LambertMaterial {
614
523
  vec3 diffuseColor;
615
524
  float specularStrength;
@@ -623,7 +532,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
623
532
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
624
533
  }
625
534
  #define RE_Direct RE_Direct_Lambert
626
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,px=`uniform bool receiveShadow;
535
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,pM=`uniform bool receiveShadow;
627
536
  uniform vec3 ambientLightColor;
628
537
  #if defined( USE_LIGHT_PROBES )
629
538
  uniform vec3 lightProbe[ 9 ];
@@ -752,22 +661,22 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
752
661
  return irradiance;
753
662
  }
754
663
  #endif
755
- #include <lightprobes_pars_fragment>`,mx=`#ifdef USE_ENVMAP
664
+ #include <lightprobes_pars_fragment>`,mM=`#ifdef USE_ENVMAP
756
665
  vec3 getIBLIrradiance( const in vec3 normal ) {
757
- #ifdef ENVMAP_TYPE_CUBE_UV
666
+ #ifdef ENVMAP_TYPE_PMREM
758
667
  vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
759
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
668
+ vec4 envMapColor = textureLod( envMap, envMapRotation * worldNormal, ENVMAP_MAX_LOD );
760
669
  return PI * envMapColor.rgb * envMapIntensity;
761
670
  #else
762
671
  return vec3( 0.0 );
763
672
  #endif
764
673
  }
765
674
  vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
766
- #ifdef ENVMAP_TYPE_CUBE_UV
675
+ #ifdef ENVMAP_TYPE_PMREM
767
676
  vec3 reflectVec = reflect( - viewDir, normal );
768
677
  reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
769
678
  reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );
770
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
679
+ vec4 envMapColor = textureLod( envMap, envMapRotation * reflectVec, roughnessToMip( roughness ) );
771
680
  return envMapColor.rgb * envMapIntensity;
772
681
  #else
773
682
  return vec3( 0.0 );
@@ -775,10 +684,10 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
775
684
  }
776
685
  #ifdef USE_RETROREFLECTION
777
686
  vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
778
- #ifdef ENVMAP_TYPE_CUBE_UV
687
+ #ifdef ENVMAP_TYPE_PMREM
779
688
  vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );
780
689
  retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );
781
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * retroVec, roughness );
690
+ vec4 envMapColor = textureLod( envMap, envMapRotation * retroVec, roughnessToMip( roughness ) );
782
691
  return envMapColor.rgb * envMapIntensity;
783
692
  #else
784
693
  return vec3( 0.0 );
@@ -787,7 +696,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
787
696
  #endif
788
697
  #ifdef USE_ANISOTROPY
789
698
  vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
790
- #ifdef ENVMAP_TYPE_CUBE_UV
699
+ #ifdef ENVMAP_TYPE_PMREM
791
700
  vec3 bentNormal = cross( bitangent, viewDir );
792
701
  bentNormal = normalize( cross( bentNormal, bitangent ) );
793
702
  bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
@@ -798,7 +707,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
798
707
  }
799
708
  #ifdef USE_RETROREFLECTION
800
709
  vec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
801
- #ifdef ENVMAP_TYPE_CUBE_UV
710
+ #ifdef ENVMAP_TYPE_PMREM
802
711
  vec3 bentNormal = cross( bitangent, viewDir );
803
712
  bentNormal = normalize( cross( bentNormal, bitangent ) );
804
713
  bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
@@ -809,8 +718,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
809
718
  }
810
719
  #endif
811
720
  #endif
812
- #endif`,gx=`ToonMaterial material;
813
- material.diffuseColor = diffuseColor.rgb;`,_x=`varying vec3 vViewPosition;
721
+ #endif`,gM=`ToonMaterial material;
722
+ material.diffuseColor = diffuseColor.rgb;`,_M=`varying vec3 vViewPosition;
814
723
  struct ToonMaterial {
815
724
  vec3 diffuseColor;
816
725
  };
@@ -822,11 +731,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
822
731
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
823
732
  }
824
733
  #define RE_Direct RE_Direct_Toon
825
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,yx=`BlinnPhongMaterial material;
734
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,yM=`BlinnPhongMaterial material;
826
735
  material.diffuseColor = diffuseColor.rgb;
827
736
  material.specularColor = specular;
828
737
  material.specularShininess = shininess;
829
- material.specularStrength = specularStrength;`,vx=`varying vec3 vViewPosition;
738
+ material.specularStrength = specularStrength;`,vM=`varying vec3 vViewPosition;
830
739
  struct BlinnPhongMaterial {
831
740
  vec3 diffuseColor;
832
741
  vec3 specularColor;
@@ -843,14 +752,22 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
843
752
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
844
753
  }
845
754
  #define RE_Direct RE_Direct_BlinnPhong
846
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,xx=`PhysicalMaterial material;
755
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,xM=`PhysicalMaterial material;
847
756
  material.diffuseColor = diffuseColor.rgb;
848
757
  material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
849
758
  material.metalness = metalnessFactor;
850
759
  vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
851
760
  float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
852
- material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
761
+ material.roughness = max( roughnessFactor, 0.045 );
762
+ material.roughness += geometryRoughness;
853
763
  material.roughness = min( material.roughness, 1.0 );
764
+ #ifdef USE_DIFFUSE_ROUGHNESS
765
+ float diffuseRoughnessFactor = diffuseRoughness;
766
+ #ifdef USE_DIFFUSE_ROUGHNESSMAP
767
+ diffuseRoughnessFactor *= texture2D( diffuseRoughnessMap, vDiffuseRoughnessMapUv ).r;
768
+ #endif
769
+ material.diffuseRoughness = saturate( diffuseRoughnessFactor );
770
+ #endif
854
771
  #ifdef IOR
855
772
  material.ior = ior;
856
773
  #ifdef USE_SPECULAR
@@ -886,7 +803,7 @@ material.roughness = min( material.roughness, 1.0 );
886
803
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
887
804
  material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
888
805
  #endif
889
- material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
806
+ material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.045 );
890
807
  material.clearcoatRoughness += geometryRoughness;
891
808
  material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
892
809
  #endif
@@ -936,7 +853,7 @@ material.roughness = min( material.roughness, 1.0 );
936
853
  material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
937
854
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
938
855
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
939
- #endif`,Mx=`uniform sampler2D dfgLUT;
856
+ #endif`,MM=`uniform sampler2D dfgLUT;
940
857
  struct PhysicalMaterial {
941
858
  vec3 diffuseColor;
942
859
  vec3 diffuseContribution;
@@ -948,6 +865,9 @@ struct PhysicalMaterial {
948
865
  float dispersion;
949
866
  vec2 dfg;
950
867
  vec3 multiScatteringCompensation;
868
+ #ifdef USE_DIFFUSE_ROUGHNESS
869
+ float diffuseRoughness;
870
+ #endif
951
871
  #ifdef USE_RETROREFLECTION
952
872
  float retroreflectivity;
953
873
  #endif
@@ -996,6 +916,42 @@ vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH )
996
916
  float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
997
917
  return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
998
918
  }
919
+ #ifdef USE_DIFFUSE_ROUGHNESS
920
+ const float EON_EPSILON = 1e-7;
921
+ float FON_DirectionalAlbedo( const in float mu, const in float roughness, const in float A ) {
922
+ float muComp = 1.0 - mu;
923
+ float gOverPi = muComp * ( 0.0571085289 + muComp * ( 0.491881867 + muComp * ( - 0.332181442 + muComp * 0.0714429953 ) ) );
924
+ return A * ( 1.0 + roughness * gOverPi );
925
+ }
926
+ vec3 BRDF_EON( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 diffuseColor, const in float roughness ) {
927
+ vec3 rho = saturate( diffuseColor );
928
+ if ( roughness <= EON_EPSILON ) return BRDF_Lambert( rho );
929
+ float dotNL = saturate( dot( normal, lightDir ) );
930
+ float dotNV = saturate( dot( normal, viewDir ) );
931
+ float s = dot( lightDir, viewDir ) - dotNL * dotNV;
932
+ float sOverT = ( s > 0.0 ) ? s / max( max( dotNL, dotNV ), EON_EPSILON ) : s;
933
+ float A = 1.0 / ( 1.0 + ( 0.5 - 2.0 / ( 3.0 * PI ) ) * roughness );
934
+ vec3 singleScatter = rho * RECIPROCAL_PI * A * ( 1.0 + roughness * sOverT );
935
+ float averageAlbedo = A * ( 1.0 + ( 2.0 / 3.0 - 28.0 / ( 15.0 * PI ) ) * roughness );
936
+ float albedoV = FON_DirectionalAlbedo( dotNV, roughness, A );
937
+ float albedoL = FON_DirectionalAlbedo( dotNL, roughness, A );
938
+ vec3 rhoMultiScatter = rho * rho * averageAlbedo / max( vec3( EON_EPSILON ), vec3( 1.0 ) - rho * ( 1.0 - averageAlbedo ) );
939
+ vec3 multiScatter = rhoMultiScatter * RECIPROCAL_PI
940
+ * max( EON_EPSILON, 1.0 - albedoV )
941
+ * max( EON_EPSILON, 1.0 - albedoL )
942
+ / max( EON_EPSILON, 1.0 - averageAlbedo );
943
+ return singleScatter + multiScatter;
944
+ }
945
+ vec3 EON_DirectionalAlbedo( const in vec3 diffuseColor, const in float roughness, const in float dotNV ) {
946
+ vec3 rho = saturate( diffuseColor );
947
+ if ( roughness <= EON_EPSILON ) return rho;
948
+ float A = 1.0 / ( 1.0 + ( 0.5 - 2.0 / ( 3.0 * PI ) ) * roughness );
949
+ float directionalAlbedo = FON_DirectionalAlbedo( dotNV, roughness, A );
950
+ float averageAlbedo = A * ( 1.0 + ( 2.0 / 3.0 - 28.0 / ( 15.0 * PI ) ) * roughness );
951
+ vec3 rhoMultiScatter = rho * rho * averageAlbedo / max( vec3( EON_EPSILON ), vec3( 1.0 ) - rho * ( 1.0 - averageAlbedo ) );
952
+ return rho * directionalAlbedo + rhoMultiScatter * ( 1.0 - directionalAlbedo );
953
+ }
954
+ #endif
999
955
  float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1000
956
  float a2 = pow2( alpha );
1001
957
  float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
@@ -1025,7 +981,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
1025
981
  vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1026
982
  vec3 f0 = material.clearcoatF0;
1027
983
  float f90 = material.clearcoatF90;
1028
- float roughness = material.clearcoatRoughness;
984
+ float roughness = max( material.clearcoatRoughness, 0.045 );
1029
985
  float alpha = pow2( roughness );
1030
986
  vec3 halfDir = normalize( lightDir + viewDir );
1031
987
  float dotNL = saturate( dot( normal, lightDir ) );
@@ -1041,7 +997,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
1041
997
  vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1042
998
  vec3 f0 = material.specularColorBlended;
1043
999
  float f90 = material.specularF90;
1044
- float roughness = material.roughness;
1000
+ float roughness = max( material.roughness, 0.045 );
1045
1001
  float alpha = pow2( roughness );
1046
1002
  vec3 halfDir = normalize( lightDir + viewDir );
1047
1003
  float dotNL = saturate( dot( normal, lightDir ) );
@@ -1059,8 +1015,9 @@ vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 norm
1059
1015
  float dotBL = dot( material.anisotropyB, lightDir );
1060
1016
  float dotBV = dot( material.anisotropyB, viewDir );
1061
1017
  float dotBH = dot( material.anisotropyB, halfDir );
1062
- float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1063
- float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1018
+ float alphaT = max( material.alphaT, alpha );
1019
+ float V = V_GGX_SmithCorrelated_Anisotropic( alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1020
+ float D = D_GGX_Anisotropic( alphaT, alpha, dotNH, dotTH, dotBH );
1064
1021
  #else
1065
1022
  float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1066
1023
  float D = D_GGX( alpha, dotNH );
@@ -1243,7 +1200,12 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geome
1243
1200
  vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );
1244
1201
  F = mix( F, retroF, saturate( material.retroreflectivity ) );
1245
1202
  #endif
1246
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );
1203
+ #ifdef USE_DIFFUSE_ROUGHNESS
1204
+ vec3 diffuseBRDF = BRDF_EON( directLight.direction, geometryViewDir, geometryNormal, material.diffuseColor, material.diffuseRoughness ) * ( 1.0 - material.metalness );
1205
+ #else
1206
+ vec3 diffuseBRDF = BRDF_Lambert( material.diffuseContribution );
1207
+ #endif
1208
+ reflectedLight.directDiffuse += irradiance * diffuseBRDF * ( 1.0 - F );
1247
1209
  }
1248
1210
  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 ) {
1249
1211
  vec3 singleScattering = vec3( 0.0 );
@@ -1253,7 +1215,13 @@ void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geomet
1253
1215
  #else
1254
1216
  computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );
1255
1217
  #endif
1256
- vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );
1218
+ #ifdef USE_DIFFUSE_ROUGHNESS
1219
+ float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
1220
+ vec3 diffuseAlbedo = EON_DirectionalAlbedo( material.diffuseColor, material.diffuseRoughness, dotNV ) * ( 1.0 - material.metalness );
1221
+ vec3 diffuse = irradiance * RECIPROCAL_PI * diffuseAlbedo * ( 1.0 - singleScattering - multiScattering );
1222
+ #else
1223
+ vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );
1224
+ #endif
1257
1225
  #ifdef USE_SHEEN
1258
1226
  float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1259
1227
  sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;
@@ -1283,7 +1251,12 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1283
1251
  vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1284
1252
  vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1285
1253
  vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1286
- vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1254
+ #ifdef USE_DIFFUSE_ROUGHNESS
1255
+ float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
1256
+ vec3 diffuse = EON_DirectionalAlbedo( material.diffuseColor, material.diffuseRoughness, dotNV ) * ( 1.0 - material.metalness ) * ( 1.0 - totalScatteringDielectric );
1257
+ #else
1258
+ vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1259
+ #endif
1287
1260
  vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1288
1261
  vec3 indirectSpecular = radiance * singleScattering;
1289
1262
  indirectSpecular += multiScattering * cosineWeightedIrradiance;
@@ -1303,7 +1276,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1303
1276
  #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1304
1277
  float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1305
1278
  return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1306
- }`,Sx=`
1279
+ }`,SM=`
1307
1280
  vec3 geometryPosition = - vViewPosition;
1308
1281
  vec3 geometryNormal = normal;
1309
1282
  vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1442,22 +1415,32 @@ IncidentLight directLight;
1442
1415
  }
1443
1416
  #pragma unroll_loop_end
1444
1417
  #endif
1445
- #ifdef USE_LIGHT_PROBES_GRID
1418
+ #if NUM_LIGHT_PROBE_GRIDS > 0
1446
1419
  vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1447
1420
  vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
1448
- irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1421
+ int probeGrid = - 1;
1422
+ #pragma unroll_loop_start
1423
+ for ( int i = 0; i < NUM_LIGHT_PROBE_GRIDS; i ++ ) {
1424
+ if ( isInsideLightProbeGrid( probeWorldPos, probeWorldNormal, probesMin[ i ], probesMax[ i ], probesResolution[ i ] ) ) probeGrid = UNROLLED_LOOP_INDEX;
1425
+ }
1426
+ #pragma unroll_loop_end
1427
+ #pragma unroll_loop_start
1428
+ for ( int i = 0; i < NUM_LIGHT_PROBE_GRIDS; i ++ ) {
1429
+ if ( probeGrid == UNROLLED_LOOP_INDEX ) irradiance += getLightProbeGridIrradiance( probesSH[ i ], probesMin[ i ], probesMax[ i ], probesResolution[ i ], probeWorldPos, probeWorldNormal );
1430
+ }
1431
+ #pragma unroll_loop_end
1449
1432
  #endif
1450
1433
  #endif
1451
1434
  #if defined( RE_IndirectSpecular )
1452
1435
  vec3 radiance = vec3( 0.0 );
1453
1436
  vec3 clearcoatRadiance = vec3( 0.0 );
1454
- #endif`,bx=`#if defined( RE_IndirectDiffuse )
1437
+ #endif`,bM=`#if defined( RE_IndirectDiffuse )
1455
1438
  #ifdef USE_LIGHTMAP
1456
1439
  vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1457
1440
  vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1458
1441
  irradiance += lightMapIrradiance;
1459
1442
  #endif
1460
- #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1443
+ #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_PMREM )
1461
1444
  #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1462
1445
  iblIrradiance += getIBLIrradiance( geometryNormal );
1463
1446
  #endif
@@ -1481,7 +1464,7 @@ IncidentLight directLight;
1481
1464
  #ifdef USE_CLEARCOAT
1482
1465
  clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1483
1466
  #endif
1484
- #endif`,wx=`#if defined( RE_IndirectDiffuse )
1467
+ #endif`,EM=`#if defined( RE_IndirectDiffuse )
1485
1468
  #if defined( LAMBERT ) || defined( PHONG )
1486
1469
  irradiance += iblIrradiance;
1487
1470
  #endif
@@ -1489,19 +1472,23 @@ IncidentLight directLight;
1489
1472
  #endif
1490
1473
  #if defined( RE_IndirectSpecular )
1491
1474
  RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1492
- #endif`,Ex=`#ifdef USE_LIGHT_PROBES_GRID
1493
- uniform highp sampler3D probesSH;
1494
- uniform vec3 probesMin;
1495
- uniform vec3 probesMax;
1496
- uniform vec3 probesResolution;
1497
- vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1475
+ #endif`,wM=`#if NUM_LIGHT_PROBE_GRIDS > 0
1476
+ uniform highp sampler3D probesSH[ NUM_LIGHT_PROBE_GRIDS ];
1477
+ uniform vec3 probesMin[ NUM_LIGHT_PROBE_GRIDS ];
1478
+ uniform vec3 probesMax[ NUM_LIGHT_PROBE_GRIDS ];
1479
+ uniform vec3 probesResolution[ NUM_LIGHT_PROBE_GRIDS ];
1480
+ bool isInsideLightProbeGrid( vec3 worldPos, vec3 worldNormal, vec3 probesMin, vec3 probesMax, vec3 probesResolution ) {
1481
+ vec3 spacing = ( probesMax - probesMin ) / probesResolution;
1482
+ vec3 samplePos = worldPos + worldNormal * spacing * 0.5;
1483
+ vec3 margin = spacing * 0.01;
1484
+ return all( greaterThanEqual( samplePos, probesMin - margin ) ) && all( lessThanEqual( samplePos, probesMax + margin ) );
1485
+ }
1486
+ vec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3 probesMax, vec3 probesResolution, vec3 worldPos, vec3 worldNormal ) {
1498
1487
  vec3 res = probesResolution;
1499
1488
  vec3 gridRange = probesMax - probesMin;
1500
- vec3 resMinusOne = res - 1.0;
1501
- vec3 probeSpacing = gridRange / resMinusOne;
1489
+ vec3 probeSpacing = gridRange / res;
1502
1490
  vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1503
- vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1504
- uvw = uvw * resMinusOne / res + 0.5 / res;
1491
+ vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.5 / res, 1.0 - 0.5 / res );
1505
1492
  float nz = res.z;
1506
1493
  float paddedSlices = nz + 2.0;
1507
1494
  float atlasDepth = 7.0 * paddedSlices;
@@ -1534,27 +1521,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1534
1521
  result += c8 * 0.429043 * ( x * x - y * y );
1535
1522
  return max( result, vec3( 0.0 ) );
1536
1523
  }
1537
- #endif`,Tx=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1524
+ #endif`,TM=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1538
1525
  gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1539
- #endif`,Ax=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1526
+ #endif`,AM=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1540
1527
  uniform float logDepthBufFC;
1541
1528
  varying float vFragDepth;
1542
1529
  varying float vIsPerspective;
1543
- #endif`,Cx=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1530
+ #endif`,CM=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1544
1531
  varying float vFragDepth;
1545
1532
  varying float vIsPerspective;
1546
- #endif`,Px=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1533
+ #endif`,PM=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1547
1534
  vFragDepth = 1.0 + gl_Position.w;
1548
1535
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1549
- #endif`,Rx=`#ifdef USE_MAP
1536
+ #endif`,RM=`#ifdef USE_MAP
1550
1537
  vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1551
1538
  #ifdef DECODE_VIDEO_TEXTURE
1552
1539
  sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1553
1540
  #endif
1554
1541
  diffuseColor *= sampledDiffuseColor;
1555
- #endif`,Ix=`#ifdef USE_MAP
1542
+ #endif`,IM=`#ifdef USE_MAP
1556
1543
  uniform sampler2D map;
1557
- #endif`,Lx=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1544
+ #endif`,NM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1558
1545
  #if defined( USE_POINTS_UV )
1559
1546
  vec2 uv = vUv;
1560
1547
  #else
@@ -1566,7 +1553,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1566
1553
  #endif
1567
1554
  #ifdef USE_ALPHAMAP
1568
1555
  diffuseColor.a *= texture2D( alphaMap, uv ).g;
1569
- #endif`,Nx=`#if defined( USE_POINTS_UV )
1556
+ #endif`,LM=`#if defined( USE_POINTS_UV )
1570
1557
  varying vec2 vUv;
1571
1558
  #else
1572
1559
  #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1578,33 +1565,37 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1578
1565
  #endif
1579
1566
  #ifdef USE_ALPHAMAP
1580
1567
  uniform sampler2D alphaMap;
1581
- #endif`,Dx=`float metalnessFactor = metalness;
1568
+ #endif`,DM=`float metalnessFactor = metalness;
1582
1569
  #ifdef USE_METALNESSMAP
1583
1570
  vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1584
1571
  metalnessFactor *= texelMetalness.b;
1585
- #endif`,Ux=`#ifdef USE_METALNESSMAP
1572
+ #endif`,OM=`#ifdef USE_METALNESSMAP
1586
1573
  uniform sampler2D metalnessMap;
1587
- #endif`,Fx=`#ifdef USE_INSTANCING_MORPH
1574
+ #endif`,UM=`#ifdef USE_INSTANCING_MORPH
1588
1575
  float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1589
1576
  float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1590
1577
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1591
1578
  morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1592
1579
  }
1593
- #endif`,Ox=`#if defined( USE_MORPHCOLORS )
1594
- vColor *= morphTargetBaseInfluence;
1580
+ #endif`,FM=`#if defined( USE_MORPHCOLORS )
1581
+ #if defined( USE_COLOR_ALPHA )
1582
+ vColor *= morphTargetBaseInfluence;
1583
+ #elif defined( USE_COLOR )
1584
+ vColor.rgb *= morphTargetBaseInfluence;
1585
+ #endif
1595
1586
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1596
1587
  #if defined( USE_COLOR_ALPHA )
1597
1588
  if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1598
1589
  #elif defined( USE_COLOR )
1599
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1590
+ if ( morphTargetInfluences[ i ] != 0.0 ) vColor.rgb += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1600
1591
  #endif
1601
1592
  }
1602
- #endif`,Bx=`#ifdef USE_MORPHNORMALS
1593
+ #endif`,BM=`#ifdef USE_MORPHNORMALS
1603
1594
  objectNormal *= morphTargetBaseInfluence;
1604
1595
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1605
1596
  if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1606
1597
  }
1607
- #endif`,Gx=`#ifdef USE_MORPHTARGETS
1598
+ #endif`,GM=`#ifdef USE_MORPHTARGETS
1608
1599
  #ifndef USE_INSTANCING_MORPH
1609
1600
  uniform float morphTargetBaseInfluence;
1610
1601
  uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1618,12 +1609,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1618
1609
  ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1619
1610
  return texelFetch( morphTargetsTexture, morphUV, 0 );
1620
1611
  }
1621
- #endif`,zx=`#ifdef USE_MORPHTARGETS
1612
+ #endif`,zM=`#ifdef USE_MORPHTARGETS
1622
1613
  transformed *= morphTargetBaseInfluence;
1623
1614
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1624
1615
  if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1625
1616
  }
1626
- #endif`,kx=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1617
+ #endif`,kM=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1627
1618
  #ifdef FLAT_SHADED
1628
1619
  vec3 fdx = dFdx( vViewPosition );
1629
1620
  vec3 fdy = dFdy( vViewPosition );
@@ -1664,7 +1655,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1664
1655
  tbn2[1] *= faceDirection;
1665
1656
  #endif
1666
1657
  #endif
1667
- vec3 nonPerturbedNormal = normal;`,Vx=`#ifdef USE_NORMALMAP_OBJECTSPACE
1658
+ vec3 nonPerturbedNormal = normal;`,VM=`#ifdef USE_NORMALMAP_OBJECTSPACE
1668
1659
  normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1669
1660
  #ifdef FLIP_SIDED
1670
1661
  normal = - normal;
@@ -1682,19 +1673,19 @@ vec3 nonPerturbedNormal = normal;`,Vx=`#ifdef USE_NORMALMAP_OBJECTSPACE
1682
1673
  normal = normalize( tbn * mapN );
1683
1674
  #elif defined( USE_BUMPMAP )
1684
1675
  normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1685
- #endif`,Hx=`#ifndef FLAT_SHADED
1676
+ #endif`,HM=`#ifndef FLAT_SHADED
1686
1677
  varying vec3 vNormal;
1687
1678
  #ifdef USE_TANGENT
1688
1679
  varying vec3 vTangent;
1689
1680
  varying vec3 vBitangent;
1690
1681
  #endif
1691
- #endif`,Wx=`#ifndef FLAT_SHADED
1682
+ #endif`,WM=`#ifndef FLAT_SHADED
1692
1683
  varying vec3 vNormal;
1693
1684
  #ifdef USE_TANGENT
1694
1685
  varying vec3 vTangent;
1695
1686
  varying vec3 vBitangent;
1696
1687
  #endif
1697
- #endif`,Xx=`#ifndef FLAT_SHADED
1688
+ #endif`,XM=`#ifndef FLAT_SHADED
1698
1689
  vNormal = normalize( transformedNormal );
1699
1690
  #ifdef USE_TANGENT
1700
1691
  vTangent = normalize( transformedTangent );
@@ -1703,7 +1694,7 @@ vec3 nonPerturbedNormal = normal;`,Vx=`#ifdef USE_NORMALMAP_OBJECTSPACE
1703
1694
  vBitangent = - vBitangent;
1704
1695
  #endif
1705
1696
  #endif
1706
- #endif`,qx=`#ifdef USE_NORMALMAP
1697
+ #endif`,qM=`#ifdef USE_NORMALMAP
1707
1698
  uniform sampler2D normalMap;
1708
1699
  uniform vec2 normalScale;
1709
1700
  #endif
@@ -1725,13 +1716,13 @@ vec3 nonPerturbedNormal = normal;`,Vx=`#ifdef USE_NORMALMAP_OBJECTSPACE
1725
1716
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1726
1717
  return mat3( T * scale, B * scale, N );
1727
1718
  }
1728
- #endif`,Yx=`#ifdef USE_CLEARCOAT
1719
+ #endif`,YM=`#ifdef USE_CLEARCOAT
1729
1720
  vec3 clearcoatNormal = nonPerturbedNormal;
1730
- #endif`,jx=`#ifdef USE_CLEARCOAT_NORMALMAP
1721
+ #endif`,jM=`#ifdef USE_CLEARCOAT_NORMALMAP
1731
1722
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1732
1723
  clearcoatMapN.xy *= clearcoatNormalScale;
1733
1724
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1734
- #endif`,Zx=`#ifdef USE_CLEARCOATMAP
1725
+ #endif`,ZM=`#ifdef USE_CLEARCOATMAP
1735
1726
  uniform sampler2D clearcoatMap;
1736
1727
  #endif
1737
1728
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1740,18 +1731,18 @@ vec3 nonPerturbedNormal = normal;`,Vx=`#ifdef USE_NORMALMAP_OBJECTSPACE
1740
1731
  #endif
1741
1732
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1742
1733
  uniform sampler2D clearcoatRoughnessMap;
1743
- #endif`,Jx=`#ifdef USE_IRIDESCENCEMAP
1734
+ #endif`,JM=`#ifdef USE_IRIDESCENCEMAP
1744
1735
  uniform sampler2D iridescenceMap;
1745
1736
  #endif
1746
1737
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
1747
1738
  uniform sampler2D iridescenceThicknessMap;
1748
- #endif`,$x=`#ifdef OPAQUE
1739
+ #endif`,$M=`#ifdef OPAQUE
1749
1740
  diffuseColor.a = 1.0;
1750
1741
  #endif
1751
1742
  #ifdef USE_TRANSMISSION
1752
1743
  diffuseColor.a *= material.transmissionAlpha;
1753
1744
  #endif
1754
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Kx=`vec3 packNormalToRGB( const in vec3 normal ) {
1745
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KM=`vec3 packNormalToRGB( const in vec3 normal ) {
1755
1746
  return normalize( normal ) * 0.5 + 0.5;
1756
1747
  }
1757
1748
  vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1830,7 +1821,7 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1830
1821
  #else
1831
1822
  return ( near * far ) / ( ( far - near ) * depth - far );
1832
1823
  #endif
1833
- }`,Qx=`#ifdef PREMULTIPLIED_ALPHA
1824
+ }`,QM=`#ifdef PREMULTIPLIED_ALPHA
1834
1825
  gl_FragColor.rgb *= gl_FragColor.a;
1835
1826
  #endif`,t1=`vec4 mvPosition = vec4( transformed, 1.0 );
1836
1827
  #ifdef USE_BATCHING
@@ -1842,14 +1833,14 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1842
1833
  mvPosition = modelViewMatrix * mvPosition;
1843
1834
  gl_Position = projectionMatrix * mvPosition;`,e1=`#ifdef DITHERING
1844
1835
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1845
- #endif`,n1=`#ifdef DITHERING
1836
+ #endif`,i1=`#ifdef DITHERING
1846
1837
  vec3 dithering( vec3 color ) {
1847
1838
  float grid_position = rand( gl_FragCoord.xy );
1848
1839
  vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1849
1840
  dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1850
1841
  return color + dither_shift_RGB;
1851
1842
  }
1852
- #endif`,i1=`float roughnessFactor = roughness;
1843
+ #endif`,n1=`float roughnessFactor = roughness;
1853
1844
  #ifdef USE_ROUGHNESSMAP
1854
1845
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1855
1846
  roughnessFactor *= texelRoughness.g;
@@ -1946,12 +1937,16 @@ gl_Position = projectionMatrix * mvPosition;`,e1=`#ifdef DITHERING
1946
1937
  float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1947
1938
  float shadow = 1.0;
1948
1939
  shadowCoord.xyz /= shadowCoord.w;
1949
- shadowCoord.z += shadowBias;
1940
+ #ifdef USE_REVERSED_DEPTH_BUFFER
1941
+ shadowCoord.z -= shadowBias;
1942
+ #else
1943
+ shadowCoord.z += shadowBias;
1944
+ #endif
1950
1945
  bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1951
1946
  bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1952
1947
  if ( frustumTest ) {
1953
1948
  vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1954
- float radius = shadowRadius * texelSize.x;
1949
+ vec2 radius = shadowRadius * texelSize;
1955
1950
  float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1956
1951
  shadow = (
1957
1952
  texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
@@ -2058,12 +2053,14 @@ gl_Position = projectionMatrix * mvPosition;`,e1=`#ifdef DITHERING
2058
2053
  vec3 absVec = abs( lightToPosition );
2059
2054
  float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
2060
2055
  if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
2056
+ float lightDistance = length( lightToPosition );
2057
+ float depthRange = shadowCameraFar - shadowCameraNear;
2061
2058
  #ifdef USE_REVERSED_DEPTH_BUFFER
2062
- float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2063
- dp -= shadowBias;
2059
+ float depthA = - shadowCameraNear / depthRange - shadowBias;
2060
+ float depthB = shadowCameraNear * shadowCameraFar / ( depthRange * lightDistance );
2064
2061
  #else
2065
- float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2066
- dp += shadowBias;
2062
+ float depthA = shadowCameraFar / depthRange + shadowBias;
2063
+ float depthB = - shadowCameraNear * shadowCameraFar / ( depthRange * lightDistance );
2067
2064
  #endif
2068
2065
  float texelSize = shadowRadius / shadowMapSize.x;
2069
2066
  vec3 absDir = abs( bd3D );
@@ -2071,18 +2068,15 @@ gl_Position = projectionMatrix * mvPosition;`,e1=`#ifdef DITHERING
2071
2068
  tangent = normalize( cross( bd3D, tangent ) );
2072
2069
  vec3 bitangent = cross( bd3D, tangent );
2073
2070
  float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
2074
- vec2 sample0 = vogelDiskSample( 0, 5, phi );
2075
- vec2 sample1 = vogelDiskSample( 1, 5, phi );
2076
- vec2 sample2 = vogelDiskSample( 2, 5, phi );
2077
- vec2 sample3 = vogelDiskSample( 3, 5, phi );
2078
- vec2 sample4 = vogelDiskSample( 4, 5, phi );
2079
- shadow = (
2080
- texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
2081
- texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
2082
- texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
2083
- texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
2084
- texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
2085
- ) * 0.2;
2071
+ shadow = 0.0;
2072
+ for ( int i = 0; i < 5; i ++ ) {
2073
+ vec2 offset = vogelDiskSample( i, 5, phi );
2074
+ vec3 direction = bd3D + ( tangent * offset.x + bitangent * offset.y ) * texelSize;
2075
+ vec3 absDirection = abs( direction );
2076
+ float dp = depthA + depthB / max( max( absDirection.x, absDirection.y ), absDirection.z );
2077
+ shadow += texture( shadowMap, vec4( direction, dp ) );
2078
+ }
2079
+ shadow *= 0.2;
2086
2080
  }
2087
2081
  return mix( 1.0, shadow, shadowIntensity );
2088
2082
  }
@@ -2555,6 +2549,9 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,_1=`#ifdef USE_TRANSMISS
2555
2549
  #ifdef USE_ROUGHNESSMAP
2556
2550
  varying vec2 vRoughnessMapUv;
2557
2551
  #endif
2552
+ #ifdef USE_DIFFUSE_ROUGHNESSMAP
2553
+ varying vec2 vDiffuseRoughnessMapUv;
2554
+ #endif
2558
2555
  #ifdef USE_ANISOTROPYMAP
2559
2556
  varying vec2 vAnisotropyMapUv;
2560
2557
  #endif
@@ -2638,6 +2635,10 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,_1=`#ifdef USE_TRANSMISS
2638
2635
  uniform mat3 roughnessMapTransform;
2639
2636
  varying vec2 vRoughnessMapUv;
2640
2637
  #endif
2638
+ #ifdef USE_DIFFUSE_ROUGHNESSMAP
2639
+ uniform mat3 diffuseRoughnessMapTransform;
2640
+ varying vec2 vDiffuseRoughnessMapUv;
2641
+ #endif
2641
2642
  #ifdef USE_ANISOTROPYMAP
2642
2643
  uniform mat3 anisotropyMapTransform;
2643
2644
  varying vec2 vAnisotropyMapUv;
@@ -2722,6 +2723,9 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,_1=`#ifdef USE_TRANSMISS
2722
2723
  #ifdef USE_ROUGHNESSMAP
2723
2724
  vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2724
2725
  #endif
2726
+ #ifdef USE_DIFFUSE_ROUGHNESSMAP
2727
+ vDiffuseRoughnessMapUv = ( diffuseRoughnessMapTransform * vec3( DIFFUSE_ROUGHNESSMAP_UV, 1 ) ).xy;
2728
+ #endif
2725
2729
  #ifdef USE_ANISOTROPYMAP
2726
2730
  vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2727
2731
  #endif
@@ -2774,7 +2778,7 @@ uniform mat3 uvTransform;
2774
2778
  void main() {
2775
2779
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2776
2780
  gl_Position = vec4( position.xy, 1.0, 1.0 );
2777
- }`,w1=`uniform sampler2D t2D;
2781
+ }`,E1=`uniform sampler2D t2D;
2778
2782
  uniform float backgroundIntensity;
2779
2783
  varying vec2 vUv;
2780
2784
  void main() {
@@ -2786,30 +2790,23 @@ void main() {
2786
2790
  gl_FragColor = texColor;
2787
2791
  #include <tonemapping_fragment>
2788
2792
  #include <colorspace_fragment>
2789
- }`,E1=`varying vec3 vWorldDirection;
2793
+ }`,w1=`varying vec3 vWorldDirection;
2790
2794
  #include <common>
2791
2795
  void main() {
2792
2796
  vWorldDirection = transformDirection( position, modelMatrix );
2793
2797
  #include <begin_vertex>
2794
2798
  #include <project_vertex>
2795
2799
  gl_Position.z = gl_Position.w;
2796
- }`,T1=`#ifdef ENVMAP_TYPE_CUBE
2797
- uniform samplerCube envMap;
2798
- #elif defined( ENVMAP_TYPE_CUBE_UV )
2799
- uniform sampler2D envMap;
2800
- #endif
2801
- uniform float backgroundBlurriness;
2800
+ }`,T1=`uniform float backgroundBlurriness;
2802
2801
  uniform float backgroundIntensity;
2803
2802
  uniform mat3 backgroundRotation;
2804
2803
  varying vec3 vWorldDirection;
2805
- #include <cube_uv_reflection_fragment>
2804
+ #include <envmap_common_pars_fragment>
2806
2805
  void main() {
2807
- #ifdef ENVMAP_TYPE_CUBE
2808
- vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2809
- #elif defined( ENVMAP_TYPE_CUBE_UV )
2810
- vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2806
+ #ifdef ENVMAP_TYPE_PMREM
2807
+ vec4 texColor = textureLod( envMap, backgroundRotation * vWorldDirection, roughnessToMip( backgroundBlurriness ) );
2811
2808
  #else
2812
- vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2809
+ vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2813
2810
  #endif
2814
2811
  texColor.rgb *= backgroundIntensity;
2815
2812
  gl_FragColor = texColor;
@@ -2924,7 +2921,7 @@ void main() {
2924
2921
  #include <worldpos_vertex>
2925
2922
  #include <clipping_planes_vertex>
2926
2923
  vWorldPosition = worldPosition.xyz;
2927
- }`,L1=`#define DISTANCE
2924
+ }`,N1=`#define DISTANCE
2928
2925
  uniform vec3 referencePosition;
2929
2926
  uniform float nearDistance;
2930
2927
  uniform float farDistance;
@@ -2947,7 +2944,7 @@ void main() {
2947
2944
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2948
2945
  dist = saturate( dist );
2949
2946
  gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2950
- }`,N1=`varying vec3 vWorldDirection;
2947
+ }`,L1=`varying vec3 vWorldDirection;
2951
2948
  #include <common>
2952
2949
  void main() {
2953
2950
  vWorldDirection = transformDirection( position, modelMatrix );
@@ -2962,7 +2959,7 @@ void main() {
2962
2959
  gl_FragColor = texture2D( tEquirect, sampleUV );
2963
2960
  #include <tonemapping_fragment>
2964
2961
  #include <colorspace_fragment>
2965
- }`,U1=`uniform float scale;
2962
+ }`,O1=`uniform float scale;
2966
2963
  attribute float lineDistance;
2967
2964
  varying float vLineDistance;
2968
2965
  #include <common>
@@ -2984,7 +2981,7 @@ void main() {
2984
2981
  #include <logdepthbuf_vertex>
2985
2982
  #include <clipping_planes_vertex>
2986
2983
  #include <fog_vertex>
2987
- }`,F1=`uniform vec3 diffuse;
2984
+ }`,U1=`uniform vec3 diffuse;
2988
2985
  uniform float opacity;
2989
2986
  uniform float dashSize;
2990
2987
  uniform float totalSize;
@@ -3012,7 +3009,7 @@ void main() {
3012
3009
  #include <colorspace_fragment>
3013
3010
  #include <fog_fragment>
3014
3011
  #include <premultiplied_alpha_fragment>
3015
- }`,O1=`#include <common>
3012
+ }`,F1=`#include <common>
3016
3013
  #include <batching_pars_vertex>
3017
3014
  #include <uv_pars_vertex>
3018
3015
  #include <envmap_pars_vertex>
@@ -3146,7 +3143,6 @@ uniform float opacity;
3146
3143
  #include <aomap_pars_fragment>
3147
3144
  #include <lightmap_pars_fragment>
3148
3145
  #include <emissivemap_pars_fragment>
3149
- #include <cube_uv_reflection_fragment>
3150
3146
  #include <envmap_common_pars_fragment>
3151
3147
  #include <envmap_pars_fragment>
3152
3148
  #include <envmap_physical_pars_fragment>
@@ -3379,7 +3375,6 @@ uniform float opacity;
3379
3375
  #include <aomap_pars_fragment>
3380
3376
  #include <lightmap_pars_fragment>
3381
3377
  #include <emissivemap_pars_fragment>
3382
- #include <cube_uv_reflection_fragment>
3383
3378
  #include <envmap_common_pars_fragment>
3384
3379
  #include <envmap_pars_fragment>
3385
3380
  #include <envmap_physical_pars_fragment>
@@ -3492,6 +3487,12 @@ uniform float opacity;
3492
3487
  uniform float clearcoat;
3493
3488
  uniform float clearcoatRoughness;
3494
3489
  #endif
3490
+ #ifdef USE_DIFFUSE_ROUGHNESS
3491
+ uniform float diffuseRoughness;
3492
+ #ifdef USE_DIFFUSE_ROUGHNESSMAP
3493
+ uniform sampler2D diffuseRoughnessMap;
3494
+ #endif
3495
+ #endif
3495
3496
  #ifdef USE_DISPERSION
3496
3497
  uniform float dispersion;
3497
3498
  #endif
@@ -3533,7 +3534,6 @@ varying vec3 vViewPosition;
3533
3534
  #include <lightmap_pars_fragment>
3534
3535
  #include <emissivemap_pars_fragment>
3535
3536
  #include <iridescence_fragment>
3536
- #include <cube_uv_reflection_fragment>
3537
3537
  #include <envmap_common_pars_fragment>
3538
3538
  #include <envmap_physical_pars_fragment>
3539
3539
  #include <fog_pars_fragment>
@@ -3761,7 +3761,7 @@ void main() {
3761
3761
  #include <worldpos_vertex>
3762
3762
  #include <shadowmap_vertex>
3763
3763
  #include <fog_vertex>
3764
- }`,tM=`uniform vec3 color;
3764
+ }`,tS=`uniform vec3 color;
3765
3765
  uniform float opacity;
3766
3766
  #include <common>
3767
3767
  #include <fog_pars_fragment>
@@ -3777,7 +3777,7 @@ void main() {
3777
3777
  #include <colorspace_fragment>
3778
3778
  #include <fog_fragment>
3779
3779
  #include <premultiplied_alpha_fragment>
3780
- }`,eM=`uniform float rotation;
3780
+ }`,eS=`uniform float rotation;
3781
3781
  uniform vec2 center;
3782
3782
  #include <common>
3783
3783
  #include <uv_pars_vertex>
@@ -3801,7 +3801,7 @@ void main() {
3801
3801
  #include <logdepthbuf_vertex>
3802
3802
  #include <clipping_planes_vertex>
3803
3803
  #include <fog_vertex>
3804
- }`,nM=`uniform vec3 diffuse;
3804
+ }`,iS=`uniform vec3 diffuse;
3805
3805
  uniform float opacity;
3806
3806
  #include <common>
3807
3807
  #include <uv_pars_fragment>
@@ -3826,7 +3826,7 @@ void main() {
3826
3826
  #include <tonemapping_fragment>
3827
3827
  #include <colorspace_fragment>
3828
3828
  #include <fog_fragment>
3829
- }`,rt={alphahash_fragment:bv,alphahash_pars_fragment:wv,alphamap_fragment:Ev,alphamap_pars_fragment:Tv,alphatest_fragment:Av,alphatest_pars_fragment:Cv,aomap_fragment:Pv,aomap_pars_fragment:Rv,batching_pars_vertex:Iv,batching_vertex:Lv,begin_vertex:Nv,beginnormal_vertex:Dv,bsdfs:Uv,iridescence_fragment:Fv,bumpmap_pars_fragment:Ov,clipping_planes_fragment:Bv,clipping_planes_pars_fragment:Gv,clipping_planes_pars_vertex:zv,clipping_planes_vertex:kv,color_fragment:Vv,color_pars_fragment:Hv,color_pars_vertex:Wv,color_vertex:Xv,common:qv,cube_uv_reflection_fragment:Yv,defaultnormal_vertex:jv,displacementmap_pars_vertex:Zv,displacementmap_vertex:Jv,emissivemap_fragment:$v,emissivemap_pars_fragment:Kv,colorspace_fragment:Qv,colorspace_pars_fragment:tx,envmap_fragment:ex,envmap_common_pars_fragment:nx,envmap_pars_fragment:ix,envmap_pars_vertex:rx,envmap_physical_pars_fragment:mx,envmap_vertex:sx,fog_vertex:ax,fog_pars_vertex:ox,fog_fragment:lx,fog_pars_fragment:cx,gradientmap_pars_fragment:hx,lightmap_pars_fragment:ux,lights_lambert_fragment:fx,lights_lambert_pars_fragment:dx,lights_pars_begin:px,lights_toon_fragment:gx,lights_toon_pars_fragment:_x,lights_phong_fragment:yx,lights_phong_pars_fragment:vx,lights_physical_fragment:xx,lights_physical_pars_fragment:Mx,lights_fragment_begin:Sx,lights_fragment_maps:bx,lights_fragment_end:wx,lightprobes_pars_fragment:Ex,logdepthbuf_fragment:Tx,logdepthbuf_pars_fragment:Ax,logdepthbuf_pars_vertex:Cx,logdepthbuf_vertex:Px,map_fragment:Rx,map_pars_fragment:Ix,map_particle_fragment:Lx,map_particle_pars_fragment:Nx,metalnessmap_fragment:Dx,metalnessmap_pars_fragment:Ux,morphinstance_vertex:Fx,morphcolor_vertex:Ox,morphnormal_vertex:Bx,morphtarget_pars_vertex:Gx,morphtarget_vertex:zx,normal_fragment_begin:kx,normal_fragment_maps:Vx,normal_pars_fragment:Hx,normal_pars_vertex:Wx,normal_vertex:Xx,normalmap_pars_fragment:qx,clearcoat_normal_fragment_begin:Yx,clearcoat_normal_fragment_maps:jx,clearcoat_pars_fragment:Zx,iridescence_pars_fragment:Jx,opaque_fragment:$x,packing:Kx,premultiplied_alpha_fragment:Qx,project_vertex:t1,dithering_fragment:e1,dithering_pars_fragment:n1,roughnessmap_fragment:i1,roughnessmap_pars_fragment:r1,shadowmap_pars_fragment:s1,shadowmap_pars_vertex:a1,shadowmap_vertex:o1,shadowmask_pars_fragment:l1,skinbase_vertex:c1,skinning_pars_vertex:h1,skinning_vertex:u1,skinnormal_vertex:f1,specularmap_fragment:d1,specularmap_pars_fragment:p1,tonemapping_fragment:m1,tonemapping_pars_fragment:g1,transmission_fragment:_1,transmission_pars_fragment:y1,uv_pars_fragment:v1,uv_pars_vertex:x1,uv_vertex:M1,worldpos_vertex:S1,background_vert:b1,background_frag:w1,backgroundCube_vert:E1,backgroundCube_frag:T1,cube_vert:A1,cube_frag:C1,depth_vert:P1,depth_frag:R1,distance_vert:I1,distance_frag:L1,equirect_vert:N1,equirect_frag:D1,linedashed_vert:U1,linedashed_frag:F1,meshbasic_vert:O1,meshbasic_frag:B1,meshlambert_vert:G1,meshlambert_frag:z1,meshmatcap_vert:k1,meshmatcap_frag:V1,meshnormal_vert:H1,meshnormal_frag:W1,meshphong_vert:X1,meshphong_frag:q1,meshphysical_vert:Y1,meshphysical_frag:j1,meshtoon_vert:Z1,meshtoon_frag:J1,points_vert:$1,points_frag:K1,shadow_vert:Q1,shadow_frag:tM,sprite_vert:eM,sprite_frag:nM},W={common:{diffuse:{value:new et(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new tt},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new tt}},envmap:{envMap:{value:null},envMapRotation:{value:new tt},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new tt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new tt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new tt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new tt},normalScale:{value:new nt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new tt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new tt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new tt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new tt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new et(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 C},probesMax:{value:new C},probesResolution:{value:new C}},points:{diffuse:{value:new et(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0},uvTransform:{value:new tt}},sprite:{diffuse:{value:new et(16777215)},opacity:{value:1},center:{value:new nt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new tt},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0}}},Bf={basic:{uniforms:Zt([W.common,W.specularmap,W.envmap,W.aomap,W.lightmap,W.fog]),vertexShader:rt.meshbasic_vert,fragmentShader:rt.meshbasic_frag},lambert:{uniforms:Zt([W.common,W.specularmap,W.envmap,W.aomap,W.lightmap,W.emissivemap,W.bumpmap,W.normalmap,W.displacementmap,W.fog,W.lights,{emissive:{value:new et(0)},envMapIntensity:{value:1}}]),vertexShader:rt.meshlambert_vert,fragmentShader:rt.meshlambert_frag},phong:{uniforms:Zt([W.common,W.specularmap,W.envmap,W.aomap,W.lightmap,W.emissivemap,W.bumpmap,W.normalmap,W.displacementmap,W.fog,W.lights,{emissive:{value:new et(0)},specular:{value:new et(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:rt.meshphong_vert,fragmentShader:rt.meshphong_frag},standard:{uniforms:Zt([W.common,W.envmap,W.aomap,W.lightmap,W.emissivemap,W.bumpmap,W.normalmap,W.displacementmap,W.roughnessmap,W.metalnessmap,W.fog,W.lights,{emissive:{value:new et(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:rt.meshphysical_vert,fragmentShader:rt.meshphysical_frag},toon:{uniforms:Zt([W.common,W.aomap,W.lightmap,W.emissivemap,W.bumpmap,W.normalmap,W.displacementmap,W.gradientmap,W.fog,W.lights,{emissive:{value:new et(0)}}]),vertexShader:rt.meshtoon_vert,fragmentShader:rt.meshtoon_frag},matcap:{uniforms:Zt([W.common,W.bumpmap,W.normalmap,W.displacementmap,W.fog,{matcap:{value:null}}]),vertexShader:rt.meshmatcap_vert,fragmentShader:rt.meshmatcap_frag},points:{uniforms:Zt([W.points,W.fog]),vertexShader:rt.points_vert,fragmentShader:rt.points_frag},dashed:{uniforms:Zt([W.common,W.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:rt.linedashed_vert,fragmentShader:rt.linedashed_frag},depth:{uniforms:Zt([W.common,W.displacementmap]),vertexShader:rt.depth_vert,fragmentShader:rt.depth_frag},normal:{uniforms:Zt([W.common,W.bumpmap,W.normalmap,W.displacementmap,{opacity:{value:1}}]),vertexShader:rt.meshnormal_vert,fragmentShader:rt.meshnormal_frag},sprite:{uniforms:Zt([W.sprite,W.fog]),vertexShader:rt.sprite_vert,fragmentShader:rt.sprite_frag},background:{uniforms:{uvTransform:{value:new tt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:rt.background_vert,fragmentShader:rt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new tt}},vertexShader:rt.backgroundCube_vert,fragmentShader:rt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:rt.cube_vert,fragmentShader:rt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:rt.equirect_vert,fragmentShader:rt.equirect_frag},distance:{uniforms:Zt([W.common,W.displacementmap,{referencePosition:{value:new C},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:rt.distance_vert,fragmentShader:rt.distance_frag},shadow:{uniforms:Zt([W.lights,W.fog,{color:{value:new et(0)},opacity:{value:1}}]),vertexShader:rt.shadow_vert,fragmentShader:rt.shadow_frag}};Bf.physical={uniforms:Zt([Bf.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new tt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new tt},clearcoatNormalScale:{value:new nt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new tt},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new tt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new tt},sheen:{value:0},sheenColor:{value:new et(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new tt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new tt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new tt},transmissionSamplerSize:{value:new nt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new tt},attenuationDistance:{value:0},attenuationColor:{value:new et(0)},specularColor:{value:new et(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new tt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new tt},anisotropyVector:{value:new nt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new tt}}]),vertexShader:rt.meshphysical_vert,fragmentShader:rt.meshphysical_frag};var iM=new tt;iM.set(-1,0,0,0,1,0,0,0,1);var $R={[Hl]:"LINEAR_TONE_MAPPING",[Wl]:"REINHARD_TONE_MAPPING",[Xl]:"CINEON_TONE_MAPPING",[ql]:"ACES_FILMIC_TONE_MAPPING",[jl]:"AGX_TONE_MAPPING",[Zl]:"NEUTRAL_TONE_MAPPING",[Yl]:"CUSTOM_TONE_MAPPING"};var KR=new Float32Array(16),QR=new Float32Array(9),tI=new Float32Array(4);var eI={[Hl]:"Linear",[Wl]:"Reinhard",[Xl]:"Cineon",[ql]:"ACESFilmic",[jl]:"AgX",[Zl]:"Neutral",[Yl]:"Custom"};var nI={[xf]:"SHADOWMAP_TYPE_PCF",[Mf]:"SHADOWMAP_TYPE_VSM"};var iI={[Cf]:"ENVMAP_TYPE_CUBE",[$l]:"ENVMAP_TYPE_CUBE",[Pf]:"ENVMAP_TYPE_CUBE_UV"};var rI={[$l]:"ENVMAP_MODE_REFRACTION"};var sI={[Vl]:"ENVMAP_BLENDING_MULTIPLY",[Tf]:"ENVMAP_BLENDING_MIX",[Af]:"ENVMAP_BLENDING_ADD"};var rM=new tt;rM.set(-1,0,0,0,1,0,0,0,1);var aI=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]);var hc=class extends Ot{constructor(){super(),this._operations=0,this._completed=0,this._total=0}get operations(){return this._operations}get completed(){return this._completed}get loading(){return this._operations>0}get progress(){return this._operations===0?1:this._completed/this._total}decrement(){this._operations!==0&&(this._operations--,this._completed++,this.dispatchEvent({type:"changed"}),this._operations===0&&(this._total=0,this._completed=0,this.dispatchEvent({type:"complete"})))}wrap(t){return this.increment(),t.finally(()=>this.decrement())}increment(t=1){this._operations+=t,this._total+=t,this.dispatchEvent({type:"changed"})}},Fa=hc;function Xi(n,t){return{requestId:n,error:t instanceof Error?t.message:"unknown error"}}var Hr=class n{_workers=new Set;_disposed=!1;_messageId=0;get loading(){let t=!1;return this._workers.forEach(e=>{e.counter.loading&&(t=!0)}),t}get progress(){let t=0;return this._workers.forEach(e=>{t+=e.counter.progress}),t/this._workers.size}constructor(t){this._createWorker=t.createWorker,this._terminationDelay=t.terminationDelay??1e4,t.concurrency!=null?this._concurrency=t.concurrency:this._concurrency=n.defaultConcurrency}static get defaultConcurrency(){return typeof window<"u"&&window.navigator!=null?window.navigator.hardwareConcurrency:1}queue(t,e,i){if(this._disposed)throw new Error("this object is disposed");let r=this.getWorker();r.counter.increment(),r.idleTimeout&&(clearTimeout(r.idleTimeout),r.idleTimeout=null);let s=r.worker,a={id:this._messageId++,payload:e,type:t};return new Promise((o,l)=>{let c,h=u=>{let m=u.data;m.requestId===a.id&&(c(),"error"in m?l(new Error(m.error)):o(m.payload))};c=()=>{r.counter.decrement(),r.counter.loading||this.startWorkerTerminationTimeout(r),s.removeEventListener("message",h)},s.addEventListener("message",h),s.postMessage(a,i??[])})}dispose(){this._disposed||(this._disposed=!0,this._workers.forEach(t=>t.worker.terminate()))}startWorkerTerminationTimeout(t){let e=t.worker;t.idleTimeout=setTimeout(()=>{e.terminate(),this._workers.delete(t)},this._terminationDelay)}createWorker(){let t=this._createWorker(),e={counter:new Fa,worker:t,idleTimeout:null};return this._workers.add(e),e}getWorker(){if(this._workers.size===0)return this.createWorker();let t=[...this._workers],e=t.find(r=>!r.counter.loading);return e||(this._workers.size<this._concurrency?this.createWorker():(t.sort((r,s)=>r.counter.operations-s.counter.operations),t[0]))}};var Ac=tu(Zo());function Gf(n,t){if(!n)throw new Error(t)}function zf(n){for(let t in n)delete n[t]}var kf=1/0,uc=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,zf(this.queuedElements_)}dequeue(){let t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));let r=this.keyFunction_(i);return delete this.queuedElements_[r],i}enqueue(t){Gf(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let e=this.priorityFunction_(t);return e!=kf?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){let e=this.elements_,i=this.priorities_,r=e.length,s=e[t],a=i[t],o=t;for(;t<r>>1;){let l=this.getLeftChildIndex_(t),c=this.getRightChildIndex_(t),h=c<r&&i[c]<i[l]?c:l;e[t]=e[h],i[t]=i[h],t=h}e[t]=s,i[t]=a,this.siftDown_(o,t)}siftDown_(t,e){let i=this.elements_,r=this.priorities_,s=i[e],a=r[e];for(;e>t;){let o=this.getParentIndex_(e);if(r[o]>a)i[e]=i[o],r[e]=r[o],e=o;else break}i[e]=s,r[e]=a}reprioritize(){let t=this.priorityFunction_,e=this.elements_,i=this.priorities_,r=0,s=e.length,a,o,l;for(o=0;o<s;++o)a=e[o],l=t(a),l==kf?delete this.queuedElements_[this.keyFunction_(a)]:(i[r]=l,e[r++]=a);e.length=r,i.length=r,this.heapify_()}},Vf=uc;function sM(n){return new Promise(t=>setTimeout(t,n))}function aM(){return new Promise(n=>requestAnimationFrame(()=>n()))}var oM=(function(n){return n.Fullfilled="fulfilled",n.Rejected="rejected",n})({}),Oa=class extends Error{constructor(){super("aborted"),this.name="AbortError"}};function lM(){return new Oa}var cM=4;function Hf(n,t,e){let i=e?.outputItems??[];return(r=>{let s=performance.now();for(let a=r;a<n.length;a++){let o=n[a],l=t(o,a);if(l!=null&&i.push(l),performance.now()-s>cM){let h=a+1;return Promise.resolve(h)}}return e?.signal?.throwIfAborted(),Promise.resolve(void 0)})(e?.start??0).then(async r=>(r!=null&&(e?.signal?.throwIfAborted(),await Hf(n,t,{outputItems:i,signal:e?.signal,start:r})),i))}var Wr={delay:sM,PromiseStatus:oM,abortError:lM,nextFrame:aM,batch:Hf};function hM(){return!0}var fc=class{constructor(t,e,i,r,s,a,o){this.id=t,this._priority=e,this._signal=o,this._resolve=r,this.reject=s,this._request=i,this.shouldExecute=a??hM}getKey(){return this.id}getPriority(){return this._signal?.aborted===!0?1/0:this._priority}execute(){return this._signal?.aborted===!0?(this.reject(Wr.abortError()),Promise.reject()):this._request().then(t=>this._resolve(t)).catch(t=>this.reject(t))}};function uM(n){return n.getPriority()}function fM(n){return n.getKey()}var dM=10,dc=class extends Ot{constructor(t={}){super(),this._pendingIds=new Map,this._queue=new Vf(uM,fM),this._opCounter=new Fa,this._concurrentRequests=0,this._maxConcurrentRequests=t.maxConcurrentRequests??dM}get length(){return this._queue.getCount()}get progress(){return this._opCounter.progress}get loading(){return this._opCounter.loading}get pendingRequests(){return this._pendingIds.size}get concurrentRequests(){return this._concurrentRequests}onQueueAvailable(){for(;this._concurrentRequests<this._maxConcurrentRequests&&!this._queue.isEmpty();){let t=this._queue.dequeue(),e=t.getKey();t.shouldExecute()?(this._concurrentRequests++,t.execute().catch(i=>t.reject(i)).finally(()=>{this._opCounter.decrement(),this._pendingIds.delete(e),this._concurrentRequests--,this.onQueueAvailable(),this.dispatchEvent({type:"task-executed"})})):(this._opCounter.decrement(),this._pendingIds.delete(e),t.reject(Wr.abortError()),this.dispatchEvent({type:"task-cancelled"}))}}enqueue(t){let{id:e,request:i,signal:r,shouldExecute:s}=t,a=t.priority??0;if(r?.aborted===!0)return Promise.reject(Wr.abortError());if(this._pendingIds.has(e))return this._pendingIds.get(e);this._opCounter.increment();let o=new Promise((l,c)=>{let h=new fc(e,a,i,l,c,s,r);this._queue.isEmpty()?(this._queue.enqueue(h),this.onQueueAvailable()):this._queue.enqueue(h)});return this._pendingIds.set(e,o),o}},pM=new dc;var ne=(function(n){return n[n.Raw=0]="Raw",n[n.ScaleToMinMax=2]="ScaleToMinMax",n[n.CompressTo8Bit=3]="CompressTo8Bit",n})({}),pc=class n{get options(){return this._opts}constructor(t,e={}){this._mode=t,this._opts=e}get mode(){return this._mode}get min(){return this._opts.min}get max(){return this._opts.max}get negateValues(){return this._opts.negateValues}set negateValues(t){this._opts.negateValues=t}isDefault(){return this.mode===ne.Raw&&this.negateValues!==!0}withNegatedValues(){return this.negateValues=!0,this}static get Raw(){return new n(ne.Raw)}get colorSpace(){if(this._mode===ne.ScaleToMinMax)return Vr}static ScaleToMinMax(t,e){if(typeof t=="number"&&typeof e=="number")return new n(ne.ScaleToMinMax,{min:t,max:e});throw new Error("min and max should be numbers")}static CompressTo8Bit(t,e){if(typeof t=="number"&&typeof e=="number")return new n(ne.CompressTo8Bit,{min:t,max:e});throw new Error("min and max should be numbers")}toString(){switch(this.mode){case ne.Raw:return"Raw";case ne.ScaleToMinMax:return`Scaled (min: ${this._opts.min}, max: ${this._opts.max})`;case ne.CompressTo8Bit:return`Compressed to 8-bit (min: ${this._opts.min}, max: ${this._opts.max})`;default:return"unknown"}}setUniform(t){let e=this.mode;switch(t.mode=e,t.negateValues=this.negateValues??!1,t.min=0,t.max=1,e){case ne.ScaleToMinMax:case ne.CompressTo8Bit:t.min=this._opts.min??0,t.max=this._opts.max??1;break;case ne.Raw:break;default:throw new Error(`unknown interpretation mode: ${this.mode}`)}return t}},Ba=pc;var Xr=class extends we{isEmptyTexture=!0;constructor(){super()}};var Wf=!1,Xf=8,qf=2048,Yf=0,jf={isLogDepthBufferSupported(){return Wf},getMaxTextureUnitsCount(){return Xf},getMaxTextureSize(){return qf},getMaxAnisotropy(){return Yf},updateCapabilities(n){let t=n.getContext();Xf=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),qf=t.getParameter(t.MAX_TEXTURE_SIZE),Yf=n.capabilities.getMaxAnisotropy(),Wf=n.capabilities.logarithmicDepthBuffer}};var Zf=1009,Jf=1015;var mc=0,Hn=0;function $f(n){if(n instanceof Float32Array)return"Float32Array";if(n instanceof Float64Array)return"Float64Array";if(n instanceof Uint32Array)return"Uint32Array";if(n instanceof Uint16Array)return"Uint16Array";if(n instanceof Int32Array)return"Int32Array";if(n instanceof Int16Array)return"Int16Array";if(n instanceof Uint8Array)return"Uint8Array";if(n instanceof Int8Array)return"Int8Array";if(n instanceof Uint8ClampedArray)return"Uint8ClampedArray";throw new Error("unsupported type")}function gc(n,t){if(typeof t=="number")switch(t){case Zf:return new Uint8ClampedArray(n);case Jf:return new Float32Array(n)}else switch(t){case"Float32Array":return new Float32Array(n);case"Float64Array":return new Float64Array(n);case"Uint8ClampedArray":return new Uint8ClampedArray(n);case"Uint8Array":return new Uint8Array(n);case"Uint16Array":return new Uint16Array(n);case"Uint32Array":return new Uint32Array(n);case"Int8Array":return new Int8Array(n);case"Int16Array":return new Int16Array(n);case"Int32Array":return new Int32Array(n)}throw new Error("invalid state")}function Ga(n){let t=n.input.map(o=>gc(o,n.inputType)),e=n.opaqueValue,i;if(n.bufferSize&&n.dataType)switch(n.dataType){case Jf:i=new Float32Array(n.bufferSize);break;case Zf:i=new Uint8ClampedArray(n.bufferSize);break;default:throw new Error("unrecognized buffer type: "+n.dataType)}else throw console.error("missing values"),new Error("missing values");let r=1/0,s=-1/0,a=!0;if(t.length===1){let o=t[0],l=o.length;for(let c=0;c<l;c++){let h=c*2,u,m,d=o[c];d!==d||d===n.nodata?(u=Hn,m=mc):(u=d,m=e,a=!1),r=Math.min(r,u),s=Math.max(s,u),i[h+0]=u,i[h+1]=m}}if(t.length===2){let o=t[0],l=t[1],c=o.length;for(let h=0;h<c;h++){let u=h*2,m,d=o[h],g=l[h];d!==d||d===n.nodata?m=Hn:m=d,g>0&&(a=!1),r=Math.min(r,m),s=Math.max(s,m),i[u+0]=m,i[u+1]=l[h]}}if(t.length===3){let o=t[0],l=t[1],c=t[2],h=o.length,u;for(let m=0;m<h;m++){let d=m*4,g=o[m],y=l[m],v=c[m];(g!==g||g===n.nodata)&&(y!==y||y===n.nodata)&&(v!==v||v===n.nodata)?(g=Hn,y=Hn,v=Hn,u=mc):(u=e,a=!1),i[d+0]=g,i[d+1]=y,i[d+2]=v,i[d+3]=u}}if(t.length===4){let o=t[0],l=t[1],c=t[2],h=t[3],u=o.length;for(let m=0;m<u;m++){let d=m*4,g=o[m],y=l[m],v=c[m],S=h[m];(g!==g||g===n.nodata)&&(y!==y||y===n.nodata)&&(v!==v||v===n.nodata)?(g=Hn,y=Hn,v=Hn,S=mc):S>0&&(a=!1),i[d+0]=g,i[d+1]=y,i[d+2]=v,i[d+3]=S}}return{buffer:i.buffer,min:r,max:s,isTransparent:a}}onmessage=async function(n){let t=n.data;try{switch(t.type){case"CreatePixelBuffer":{let e=Ga(t.payload),i={requestId:t.id,payload:e};this.postMessage(i,{transfer:[i.payload.buffer]})}break;case"CreateImageBitmap":{let e=new Blob([t.payload.buffer]),i=await createImageBitmap(e,t.payload.options),r={requestId:t.id,payload:i};this.postMessage(r,{transfer:[i]})}break}}catch(e){this.postMessage(Xi(t.id,e))}};var mM=255,gM=1;function _M(n){return n?.isTexture}function yM(n){return n?.isRenderTarget}function Mc(n){return n.isDataTexture}function ka(n){return n.isCanvasTexture}function qr(n){switch(n){case on:case Ca:return 1;case Pa:case Ra:case La:case Na:return 2;case zr:case Ia:case Da:case ln:return 4;case kr:return 2;default:throw new Error(`unknown data type: ${n}`)}}function vM(n){switch(n){case on:return"UnsignedByteType";case Ca:return"ByteType";case Pa:return"ShortType";case Ra:return"UnsignedShortType";case La:return"UnsignedShort4444Type";case Na:return"UnsignedShort5551Type";case zr:return"IntType";case Ia:return"UnsignedIntType";case Da:return"UnsignedInt248Type";case ln:return"FloatType";case kr:return"HalfFloatType";default:throw new Error(`unknown data type: ${n}`)}}function Yr(n){switch(n){case Kl:return 1;case cn:return 4;case Ql:return 1;case tc:return 1;case ec:return 1;case nc:return 1;case Ua:return 2;case ic:return 2;case rc:return 4;default:throw new Error(`invalid pixel format: ${n}`)}}function xM(n){let t=Yr(n.format),e=qr(n.type);return n.image.width*n.image.height*t*e}function MM(n,t){let e=n.width*n.height*Yr(n.texture.format),i=n.texture.type===on?new Uint8Array(e):new Float32Array(e);t.readRenderTargetPixels(n,0,0,n.width,n.height,i),n.texture.data=i}function Sc(n){let t=document.createElement("canvas");t.width=n.width,t.height=n.height;let e=t.getContext("2d",{willReadFrequently:!0});if(!e)throw new Error("could not acquire 2D context on canvas");return e.drawImage(n,0,0),e.getImageData(0,0,n.width,n.height).data}var _c=null;function Qf(){return _c==null&&(_c=new Hr({createWorker:()=>new Worker(URL.createObjectURL(new Blob([atob("InVzZSBzdHJpY3QiOygoKT0+e2Z1bmN0aW9uIF8oZSx0KXtyZXR1cm57cmVxdWVzdElkOmUsZXJyb3I6dCBpbnN0YW5jZW9mIEVycm9yP3QubWVzc2FnZToidW5rbm93biBlcnJvciJ9fXZhciBrPTEwMDksVD0xMDE1LGI9MjU1LEI9MSxBPTAscD0wO2Z1bmN0aW9uIE0oZSl7aWYoZSBpbnN0YW5jZW9mIEZsb2F0MzJBcnJheSlyZXR1cm4iRmxvYXQzMkFycmF5IjtpZihlIGluc3RhbmNlb2YgRmxvYXQ2NEFycmF5KXJldHVybiJGbG9hdDY0QXJyYXkiO2lmKGUgaW5zdGFuY2VvZiBVaW50MzJBcnJheSlyZXR1cm4iVWludDMyQXJyYXkiO2lmKGUgaW5zdGFuY2VvZiBVaW50MTZBcnJheSlyZXR1cm4iVWludDE2QXJyYXkiO2lmKGUgaW5zdGFuY2VvZiBJbnQzMkFycmF5KXJldHVybiJJbnQzMkFycmF5IjtpZihlIGluc3RhbmNlb2YgSW50MTZBcnJheSlyZXR1cm4iSW50MTZBcnJheSI7aWYoZSBpbnN0YW5jZW9mIFVpbnQ4QXJyYXkpcmV0dXJuIlVpbnQ4QXJyYXkiO2lmKGUgaW5zdGFuY2VvZiBJbnQ4QXJyYXkpcmV0dXJuIkludDhBcnJheSI7aWYoZSBpbnN0YW5jZW9mIFVpbnQ4Q2xhbXBlZEFycmF5KXJldHVybiJVaW50OENsYW1wZWRBcnJheSI7dGhyb3cgbmV3IEVycm9yKCJ1bnN1cHBvcnRlZCB0eXBlIil9ZnVuY3Rpb24geChlLHQpe2lmKHR5cGVvZiB0PT0ibnVtYmVyIilzd2l0Y2godCl7Y2FzZSBrOnJldHVybiBuZXcgVWludDhDbGFtcGVkQXJyYXkoZSk7Y2FzZSBUOnJldHVybiBuZXcgRmxvYXQzMkFycmF5KGUpfWVsc2Ugc3dpdGNoKHQpe2Nhc2UiRmxvYXQzMkFycmF5IjpyZXR1cm4gbmV3IEZsb2F0MzJBcnJheShlKTtjYXNlIkZsb2F0NjRBcnJheSI6cmV0dXJuIG5ldyBGbG9hdDY0QXJyYXkoZSk7Y2FzZSJVaW50OENsYW1wZWRBcnJheSI6cmV0dXJuIG5ldyBVaW50OENsYW1wZWRBcnJheShlKTtjYXNlIlVpbnQ4QXJyYXkiOnJldHVybiBuZXcgVWludDhBcnJheShlKTtjYXNlIlVpbnQxNkFycmF5IjpyZXR1cm4gbmV3IFVpbnQxNkFycmF5KGUpO2Nhc2UiVWludDMyQXJyYXkiOnJldHVybiBuZXcgVWludDMyQXJyYXkoZSk7Y2FzZSJJbnQ4QXJyYXkiOnJldHVybiBuZXcgSW50OEFycmF5KGUpO2Nhc2UiSW50MTZBcnJheSI6cmV0dXJuIG5ldyBJbnQxNkFycmF5KGUpO2Nhc2UiSW50MzJBcnJheSI6cmV0dXJuIG5ldyBJbnQzMkFycmF5KGUpfXRocm93IG5ldyBFcnJvcigiaW52YWxpZCBzdGF0ZSIpfWZ1bmN0aW9uIEUoZSl7bGV0IHQ9ZS5pbnB1dC5tYXAobz0+eChvLGUuaW5wdXRUeXBlKSksaD1lLm9wYXF1ZVZhbHVlLG47aWYoZS5idWZmZXJTaXplJiZlLmRhdGFUeXBlKXN3aXRjaChlLmRhdGFUeXBlKXtjYXNlIFQ6bj1uZXcgRmxvYXQzMkFycmF5KGUuYnVmZmVyU2l6ZSk7YnJlYWs7Y2FzZSBrOm49bmV3IFVpbnQ4Q2xhbXBlZEFycmF5KGUuYnVmZmVyU2l6ZSk7YnJlYWs7ZGVmYXVsdDp0aHJvdyBuZXcgRXJyb3IoInVucmVjb2duaXplZCBidWZmZXIgdHlwZTogIitlLmRhdGFUeXBlKX1lbHNlIHRocm93IGNvbnNvbGUuZXJyb3IoIm1pc3NpbmcgdmFsdWVzIiksbmV3IEVycm9yKCJtaXNzaW5nIHZhbHVlcyIpO2xldCB5PTEvMCxtPS0xLzAsdz0hMDtpZih0Lmxlbmd0aD09PTEpe2xldCBvPXRbMF0sZj1vLmxlbmd0aDtmb3IobGV0IGQ9MDtkPGY7ZCsrKXtsZXQgaT1kKjIsYSxyLHM9b1tkXTtzIT09c3x8cz09PWUubm9kYXRhPyhhPXAscj1BKTooYT1zLHI9aCx3PSExKSx5PU1hdGgubWluKHksYSksbT1NYXRoLm1heChtLGEpLG5baSswXT1hLG5baSsxXT1yfX1pZih0Lmxlbmd0aD09PTIpe2xldCBvPXRbMF0sZj10WzFdLGQ9by5sZW5ndGg7Zm9yKGxldCBpPTA7aTxkO2krKyl7bGV0IGE9aSoyLHIscz1vW2ldLGM9ZltpXTtzIT09c3x8cz09PWUubm9kYXRhP3I9cDpyPXMsYz4wJiYodz0hMSkseT1NYXRoLm1pbih5LHIpLG09TWF0aC5tYXgobSxyKSxuW2ErMF09cixuW2ErMV09ZltpXX19aWYodC5sZW5ndGg9PT0zKXtsZXQgbz10WzBdLGY9dFsxXSxkPXRbMl0saT1vLmxlbmd0aCxhO2ZvcihsZXQgcj0wO3I8aTtyKyspe2xldCBzPXIqNCxjPW9bcl0sbD1mW3JdLHU9ZFtyXTsoYyE9PWN8fGM9PT1lLm5vZGF0YSkmJihsIT09bHx8bD09PWUubm9kYXRhKSYmKHUhPT11fHx1PT09ZS5ub2RhdGEpPyhjPXAsbD1wLHU9cCxhPUEpOihhPWgsdz0hMSksbltzKzBdPWMsbltzKzFdPWwsbltzKzJdPXUsbltzKzNdPWF9fWlmKHQubGVuZ3RoPT09NCl7bGV0IG89dFswXSxmPXRbMV0sZD10WzJdLGk9dFszXSxhPW8ubGVuZ3RoO2ZvcihsZXQgcj0wO3I8YTtyKyspe2xldCBzPXIqNCxjPW9bcl0sbD1mW3JdLHU9ZFtyXSxnPWlbcl07KGMhPT1jfHxjPT09ZS5ub2RhdGEpJiYobCE9PWx8fGw9PT1lLm5vZGF0YSkmJih1IT09dXx8dT09PWUubm9kYXRhKT8oYz1wLGw9cCx1PXAsZz1BKTpnPjAmJih3PSExKSxuW3MrMF09YyxuW3MrMV09bCxuW3MrMl09dSxuW3MrM109Z319cmV0dXJue2J1ZmZlcjpuLmJ1ZmZlcixtaW46eSxtYXg6bSxpc1RyYW5zcGFyZW50Ond9fW9ubWVzc2FnZT1hc3luYyBmdW5jdGlvbihlKXtsZXQgdD1lLmRhdGE7dHJ5e3N3aXRjaCh0LnR5cGUpe2Nhc2UiQ3JlYXRlUGl4ZWxCdWZmZXIiOntsZXQgaD1FKHQucGF5bG9hZCksbj17cmVxdWVzdElkOnQuaWQscGF5bG9hZDpofTt0aGlzLnBvc3RNZXNzYWdlKG4se3RyYW5zZmVyOltuLnBheWxvYWQuYnVmZmVyXX0pfWJyZWFrO2Nhc2UiQ3JlYXRlSW1hZ2VCaXRtYXAiOntsZXQgaD1uZXcgQmxvYihbdC5wYXlsb2FkLmJ1ZmZlcl0pLG49YXdhaXQgY3JlYXRlSW1hZ2VCaXRtYXAoaCx0LnBheWxvYWQub3B0aW9ucykseT17cmVxdWVzdElkOnQuaWQscGF5bG9hZDpufTt0aGlzLnBvc3RNZXNzYWdlKHkse3RyYW5zZmVyOltuXX0pfWJyZWFrfX1jYXRjaChoKXt0aGlzLnBvc3RNZXNzYWdlKF8odC5pZCxoKSl9fTt9KSgpOwo=")],{type:"text/javascript"})),{type:"module"}),concurrency:2})),_c}async function SM(n,t){if(window.Worker!=null){let e=Qf(),i=await n.arrayBuffer();return await e.queue("CreateImageBitmap",{buffer:i,options:t},[i])}else return createImageBitmap(n,t)}async function bM(n,t={}){let[e]=n.type.split(";");switch(e){case"image/webp":case"image/png":case"image/jpg":case"image/jpeg":{let i=t?.enableWorkers??!0,r,s={imageOrientation:t.flipY===!0?"flipY":"none"};i?r=await SM(n,s):r=await createImageBitmap(n,s);let a,o=jf.getMaxTextureSize();if(r.width>o||r.height>o)throw new Error(`image dimensions (${r.width} * ${r.height} pixels) exceed max texture size (${o} pixels)`);if(t.createDataTexture===!0){let l=Sc(r);a=new Gn(l,r.width,r.height,cn,on)}else a=new we(r);return a.wrapS=Pe,a.wrapT=Pe,a.minFilter=Ve,a.magFilter=Ve,a.generateMipmaps=!1,a.needsUpdate=!0,a}default:throw new Error(`unsupported media type for textures: ${n.type}`)}}function td(n,t,e,i,r){let s=n.isTransparent?new Xr:new Gn(gc(n.buffer,r),t,e,i,r);return wc(s)||(s.needsUpdate=!0,s.generateMipmaps=!1,s.magFilter=Ve,s.minFilter=Ve),{texture:s,min:n.min,max:n.max}}function ed(n){switch(n){case 1:case 2:return Ua;default:return cn}}function nd(n,...t){let{width:e,height:i,type:r,nodata:s}=n,a=r,o;switch(t.length){case 1:case 2:o=2;break;default:o=4;break}let l;return a===ln?l=gM:l=mM,{bufferSize:e*i*o,inputType:$f(t[0]),dataType:a,input:t.map(c=>n.makeCopyOfBuffers?c.buffer.slice(0):c.buffer),opaqueValue:l,nodata:s}}function wM(n,t,...e){let i=nd({width:n.width,height:n.height,type:t,nodata:n.nodata,makeCopyOfBuffers:!1},...e),r=Ga(i),s=ed(e.length);return td(r,n.width,n.height,s,i.dataType)}async function EM(n,t,...e){let i=nd({width:n.width,height:n.height,type:t,nodata:n.nodata,makeCopyOfBuffers:!0},...e),r;(n?.enableWorkers??!0)&&window.Worker!=null?r=await Qf().queue("CreatePixelBuffer",i,i.input):r=Ga(i);let a=ed(e.length);return td(r,n.width,n.height,a,i.dataType)}function TM(n,t){let e=n.length,i=new Uint8ClampedArray(e*4);for(let s=0;s<e;s++){let a=n[s],o=s*4;i[o+0]=a.r*255,i[o+1]=a.g*255,i[o+2]=a.b*255,i[o+3]=t?jt.clamp(t[s],0,1)*255:255}let r=new Gn(i,e,1,cn,on);return r.needsUpdate=!0,r}function bc(n,t,e=Ba.Raw,i=4){let r=1/0,s=-1/0,a=0,o=i-1;switch(e.mode){case ne.Raw:for(let l=0;l<n.length;l+=i){let c=n[l+a],h=n[l+o];c===c&&c!==t&&h!==0&&(r=Math.min(r,c),s=Math.max(s,c))}break;case ne.ScaleToMinMax:{let l=e.min,c=e.max;for(let h=0;h<n.length;h+=i){let u=n[h+a]/255,m=l+u*(c-l),d=n[h+o];m===m&&m!==t&&d!==0&&(r=Math.min(r,m),s=Math.max(s,m))}}break;default:throw new Error("not implemented")}return e.negateValues===!0?{min:-s,max:-r}:{min:r,max:s}}function AM(n,t){return qr(n)>qr(t)?n:t}function CM(n,t){return!(t!==cn||n===t)}function id(n,t=Ba.Raw){let e=Sc(n);return bc(e,0,t)}function PM(n,t=0,e=Ba.Raw){if(Mc(n)){let i=Yr(n.format);return bc(n.image.data,t,e,i)}return ka(n)?id(n.image,e):null}function wc(n){return n==null||n.isEmptyTexture?!0:ka(n)?n.source?.data==null:Mc(n)?n.image?.data==null:n.isRenderTargetTexture?!1:n.source?.data==null}function yc(n,t){if(t!=null)if(wc(t))n.objects.set(t.id,{gpuMemory:0,cpuMemory:0});else if(t.userData?.memoryUsage!=null){let e=t.userData.memoryUsage;n.objects.set(t.id,e)}else if(ka(t)){let{width:e,height:i}=t.source.data;n.objects.set(t.id,{gpuMemory:e*i*4,cpuMemory:0})}else{let{width:e,height:i}=t.image,r=e*i*qr(t.type)*Yr(t.format);t.isRenderTargetTexture?n.objects.set(t.id,{gpuMemory:r,cpuMemory:0}):n.objects.set(t.id,{gpuMemory:r,cpuMemory:r})}}var Kf=new Hi({uniforms:{depthTexture:{value:null}},vertexShader:`
3829
+ }`,st={alphahash_fragment:Ex,alphahash_pars_fragment:wx,alphamap_fragment:Tx,alphamap_pars_fragment:Ax,alphatest_fragment:Cx,alphatest_pars_fragment:Px,aomap_fragment:Rx,aomap_pars_fragment:Ix,batching_pars_vertex:Nx,batching_vertex:Lx,begin_vertex:Dx,beginnormal_vertex:Ox,bsdfs:Ux,iridescence_fragment:Fx,bumpmap_pars_fragment:Bx,clipping_planes_fragment:Gx,clipping_planes_pars_fragment:zx,clipping_planes_pars_vertex:kx,clipping_planes_vertex:Vx,color_fragment:Hx,color_pars_fragment:Wx,color_pars_vertex:Xx,color_vertex:qx,common:Yx,defaultnormal_vertex:jx,displacementmap_pars_vertex:Zx,displacementmap_vertex:Jx,emissivemap_fragment:$x,emissivemap_pars_fragment:Kx,colorspace_fragment:Qx,colorspace_pars_fragment:tM,envmap_fragment:eM,envmap_common_pars_fragment:iM,envmap_pars_fragment:nM,envmap_pars_vertex:rM,envmap_physical_pars_fragment:mM,envmap_vertex:sM,fog_vertex:aM,fog_pars_vertex:oM,fog_fragment:lM,fog_pars_fragment:cM,gradientmap_pars_fragment:hM,lightmap_pars_fragment:uM,lights_lambert_fragment:fM,lights_lambert_pars_fragment:dM,lights_pars_begin:pM,lights_toon_fragment:gM,lights_toon_pars_fragment:_M,lights_phong_fragment:yM,lights_phong_pars_fragment:vM,lights_physical_fragment:xM,lights_physical_pars_fragment:MM,lights_fragment_begin:SM,lights_fragment_maps:bM,lights_fragment_end:EM,lightprobes_pars_fragment:wM,logdepthbuf_fragment:TM,logdepthbuf_pars_fragment:AM,logdepthbuf_pars_vertex:CM,logdepthbuf_vertex:PM,map_fragment:RM,map_pars_fragment:IM,map_particle_fragment:NM,map_particle_pars_fragment:LM,metalnessmap_fragment:DM,metalnessmap_pars_fragment:OM,morphinstance_vertex:UM,morphcolor_vertex:FM,morphnormal_vertex:BM,morphtarget_pars_vertex:GM,morphtarget_vertex:zM,normal_fragment_begin:kM,normal_fragment_maps:VM,normal_pars_fragment:HM,normal_pars_vertex:WM,normal_vertex:XM,normalmap_pars_fragment:qM,clearcoat_normal_fragment_begin:YM,clearcoat_normal_fragment_maps:jM,clearcoat_pars_fragment:ZM,iridescence_pars_fragment:JM,opaque_fragment:$M,packing:KM,premultiplied_alpha_fragment:QM,project_vertex:t1,dithering_fragment:e1,dithering_pars_fragment:i1,roughnessmap_fragment:n1,roughnessmap_pars_fragment:r1,shadowmap_pars_fragment:s1,shadowmap_pars_vertex:a1,shadowmap_vertex:o1,shadowmask_pars_fragment:l1,skinbase_vertex:c1,skinning_pars_vertex:h1,skinning_vertex:u1,skinnormal_vertex:f1,specularmap_fragment:d1,specularmap_pars_fragment:p1,tonemapping_fragment:m1,tonemapping_pars_fragment:g1,transmission_fragment:_1,transmission_pars_fragment:y1,uv_pars_fragment:v1,uv_pars_vertex:x1,uv_vertex:M1,worldpos_vertex:S1,background_vert:b1,background_frag:E1,backgroundCube_vert:w1,backgroundCube_frag:T1,cube_vert:A1,cube_frag:C1,depth_vert:P1,depth_frag:R1,distance_vert:I1,distance_frag:N1,equirect_vert:L1,equirect_frag:D1,linedashed_vert:O1,linedashed_frag:U1,meshbasic_vert:F1,meshbasic_frag:B1,meshlambert_vert:G1,meshlambert_frag:z1,meshmatcap_vert:k1,meshmatcap_frag:V1,meshnormal_vert:H1,meshnormal_frag:W1,meshphong_vert:X1,meshphong_frag:q1,meshphysical_vert:Y1,meshphysical_frag:j1,meshtoon_vert:Z1,meshtoon_frag:J1,points_vert:$1,points_frag:K1,shadow_vert:Q1,shadow_frag:tS,sprite_vert:eS,sprite_frag:iS},W={common:{diffuse:{value:new it(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Q},alphaMap:{value:null},alphaMapTransform:{value:new Q},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Q}},envmap:{envMap:{value:null},envMapRotation:{value:new Q},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Q}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Q}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Q},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Q},normalScale:{value:new nt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Q},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Q}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Q}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Q}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new it(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 it(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Q},alphaTest:{value:0},uvTransform:{value:new Q}},sprite:{diffuse:{value:new it(16777215)},opacity:{value:1},center:{value:new nt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Q},alphaMap:{value:null},alphaMapTransform:{value:new Q},alphaTest:{value:0}}},nd={basic:{uniforms:Jt([W.common,W.specularmap,W.envmap,W.aomap,W.lightmap,W.fog]),vertexShader:st.meshbasic_vert,fragmentShader:st.meshbasic_frag},lambert:{uniforms:Jt([W.common,W.specularmap,W.envmap,W.aomap,W.lightmap,W.emissivemap,W.bumpmap,W.normalmap,W.displacementmap,W.fog,W.lights,{emissive:{value:new it(0)},envMapIntensity:{value:1}}]),vertexShader:st.meshlambert_vert,fragmentShader:st.meshlambert_frag},phong:{uniforms:Jt([W.common,W.specularmap,W.envmap,W.aomap,W.lightmap,W.emissivemap,W.bumpmap,W.normalmap,W.displacementmap,W.fog,W.lights,{emissive:{value:new it(0)},specular:{value:new it(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:st.meshphong_vert,fragmentShader:st.meshphong_frag},standard:{uniforms:Jt([W.common,W.envmap,W.aomap,W.lightmap,W.emissivemap,W.bumpmap,W.normalmap,W.displacementmap,W.roughnessmap,W.metalnessmap,W.fog,W.lights,{emissive:{value:new it(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:st.meshphysical_vert,fragmentShader:st.meshphysical_frag},toon:{uniforms:Jt([W.common,W.aomap,W.lightmap,W.emissivemap,W.bumpmap,W.normalmap,W.displacementmap,W.gradientmap,W.fog,W.lights,{emissive:{value:new it(0)}}]),vertexShader:st.meshtoon_vert,fragmentShader:st.meshtoon_frag},matcap:{uniforms:Jt([W.common,W.bumpmap,W.normalmap,W.displacementmap,W.fog,{matcap:{value:null}}]),vertexShader:st.meshmatcap_vert,fragmentShader:st.meshmatcap_frag},points:{uniforms:Jt([W.points,W.fog]),vertexShader:st.points_vert,fragmentShader:st.points_frag},dashed:{uniforms:Jt([W.common,W.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:st.linedashed_vert,fragmentShader:st.linedashed_frag},depth:{uniforms:Jt([W.common,W.displacementmap]),vertexShader:st.depth_vert,fragmentShader:st.depth_frag},normal:{uniforms:Jt([W.common,W.bumpmap,W.normalmap,W.displacementmap,{opacity:{value:1}}]),vertexShader:st.meshnormal_vert,fragmentShader:st.meshnormal_frag},sprite:{uniforms:Jt([W.sprite,W.fog]),vertexShader:st.sprite_vert,fragmentShader:st.sprite_frag},background:{uniforms:{uvTransform:{value:new Q},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:st.background_vert,fragmentShader:st.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Q}},vertexShader:st.backgroundCube_vert,fragmentShader:st.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:st.cube_vert,fragmentShader:st.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:st.equirect_vert,fragmentShader:st.equirect_frag},distance:{uniforms:Jt([W.common,W.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:st.distance_vert,fragmentShader:st.distance_frag},shadow:{uniforms:Jt([W.lights,W.fog,{color:{value:new it(0)},opacity:{value:1}}]),vertexShader:st.shadow_vert,fragmentShader:st.shadow_frag}};nd.physical={uniforms:Jt([nd.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Q},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Q},clearcoatNormalScale:{value:new nt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Q},diffuseRoughness:{value:0},diffuseRoughnessMap:{value:null},diffuseRoughnessMapTransform:{value:new Q},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Q},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Q},sheen:{value:0},sheenColor:{value:new it(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Q},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Q},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Q},transmissionSamplerSize:{value:new nt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Q},attenuationDistance:{value:0},attenuationColor:{value:new it(0)},specularColor:{value:new it(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Q},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Q},anisotropyVector:{value:new nt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Q}}]),vertexShader:st.meshphysical_vert,fragmentShader:st.meshphysical_frag};var nS=new Q;nS.set(-1,0,0,0,1,0,0,0,1);var EN={[Kl]:"LINEAR_TONE_MAPPING",[Ql]:"REINHARD_TONE_MAPPING",[tc]:"CINEON_TONE_MAPPING",[ec]:"ACES_FILMIC_TONE_MAPPING",[nc]:"AGX_TONE_MAPPING",[rc]:"NEUTRAL_TONE_MAPPING",[ic]:"CUSTOM_TONE_MAPPING"};var wN=new Float32Array(16),TN=new Float32Array(9),AN=new Float32Array(4);var CN={[Kl]:"Linear",[Ql]:"Reinhard",[tc]:"Cineon",[ec]:"ACESFilmic",[nc]:"AgX",[rc]:"Neutral",[ic]:"Custom"};var PN={[Ff]:"SHADOWMAP_TYPE_PCF",[Bf]:"SHADOWMAP_TYPE_VSM"};var RN={[Xf]:"ENVMAP_MODE_REFRACTION"};var IN={[$l]:"ENVMAP_BLENDING_MULTIPLY",[Hf]:"ENVMAP_BLENDING_MIX",[Wf]:"ENVMAP_BLENDING_ADD"};var rS=new Q;rS.set(-1,0,0,0,1,0,0,0,1);var NN=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]);var vc=class extends Bt{constructor(){super(),this._operations=0,this._completed=0,this._total=0}get operations(){return this._operations}get completed(){return this._completed}get loading(){return this._operations>0}get progress(){return this._operations===0?1:this._completed/this._total}decrement(){this._operations!==0&&(this._operations--,this._completed++,this.dispatchEvent({type:"changed"}),this._operations===0&&(this._total=0,this._completed=0,this.dispatchEvent({type:"complete"})))}wrap(t){return this.increment(),t.finally(()=>this.decrement())}increment(t=1){this._operations+=t,this._total+=t,this.dispatchEvent({type:"changed"})}},ka=vc;function Zn(i,t){return{requestId:i,error:t instanceof Error?t.message:"unknown error"}}var Wr=class i{_workers=new Set;_disposed=!1;_messageId=0;get loading(){let t=!1;return this._workers.forEach(e=>{e.counter.loading&&(t=!0)}),t}get progress(){let t=0;return this._workers.forEach(e=>{t+=e.counter.progress}),t/this._workers.size}constructor(t){this._createWorker=t.createWorker,this._terminationDelay=t.terminationDelay??1e4,t.concurrency!=null?this._concurrency=t.concurrency:this._concurrency=i.defaultConcurrency}static get defaultConcurrency(){return typeof window<"u"&&window.navigator!=null?window.navigator.hardwareConcurrency:1}queue(t,e,n){if(this._disposed)throw new Error("this object is disposed");let r=this.getWorker();r.counter.increment(),r.idleTimeout&&(clearTimeout(r.idleTimeout),r.idleTimeout=null);let s=r.worker,a={id:this._messageId++,payload:e,type:t};return new Promise((o,l)=>{let c,h=u=>{let p=u.data;p.requestId===a.id&&(c(),"error"in p?l(new Error(p.error)):o(p.payload))};c=()=>{r.counter.decrement(),r.counter.loading||this.startWorkerTerminationTimeout(r),s.removeEventListener("message",h)},s.addEventListener("message",h),s.postMessage(a,n??[])})}dispose(){this._disposed||(this._disposed=!0,this._workers.forEach(t=>t.worker.terminate()))}startWorkerTerminationTimeout(t){let e=t.worker;t.idleTimeout=setTimeout(()=>{e.terminate(),this._workers.delete(t)},this._terminationDelay)}createWorker(){let t=this._createWorker(),e={counter:new ka,worker:t,idleTimeout:null};return this._workers.add(e),e}getWorker(){if(this._workers.size===0)return this.createWorker();let t=[...this._workers],e=t.find(r=>!r.counter.loading);return e||(this._workers.size<this._concurrency?this.createWorker():(t.sort((r,s)=>r.counter.operations-s.counter.operations),t[0]))}};var Uc=gu(sl());function rd(i,t){if(!i)throw new Error(t)}function sd(i){for(let t in i)delete i[t]}var ad=1/0,xc=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,sd(this.queuedElements_)}dequeue(){let t=this.elements_,e=this.priorities_,n=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(t){rd(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let e=this.priorityFunction_(t);return e!=ad?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){let e=this.elements_,n=this.priorities_,r=e.length,s=e[t],a=n[t],o=t;for(;t<r>>1;){let l=this.getLeftChildIndex_(t),c=this.getRightChildIndex_(t),h=c<r&&n[c]<n[l]?c:l;e[t]=e[h],n[t]=n[h],t=h}e[t]=s,n[t]=a,this.siftDown_(o,t)}siftDown_(t,e){let n=this.elements_,r=this.priorities_,s=n[e],a=r[e];for(;e>t;){let o=this.getParentIndex_(e);if(r[o]>a)n[e]=n[o],r[e]=r[o],e=o;else break}n[e]=s,r[e]=a}reprioritize(){let t=this.priorityFunction_,e=this.elements_,n=this.priorities_,r=0,s=e.length,a,o,l;for(o=0;o<s;++o)a=e[o],l=t(a),l==ad?delete this.queuedElements_[this.keyFunction_(a)]:(n[r]=l,e[r++]=a);e.length=r,n.length=r,this.heapify_()}},od=xc;function sS(i){return new Promise(t=>setTimeout(t,i))}function aS(){return new Promise(i=>requestAnimationFrame(()=>i()))}var oS=(function(i){return i.Fullfilled="fulfilled",i.Rejected="rejected",i})({}),Va=class extends Error{constructor(){super("aborted"),this.name="AbortError"}};function lS(){return new Va}var cS=4;function ld(i,t,e){let n=e?.outputItems??[];return(r=>{let s=performance.now();for(let a=r;a<i.length;a++){let o=i[a],l=t(o,a);if(l!=null&&n.push(l),performance.now()-s>cS){let h=a+1;return Promise.resolve(h)}}return e?.signal?.throwIfAborted(),Promise.resolve(void 0)})(e?.start??0).then(async r=>(r!=null&&(e?.signal?.throwIfAborted(),await ld(i,t,{outputItems:n,signal:e?.signal,start:r})),n))}var Xr={delay:sS,PromiseStatus:oS,abortError:lS,nextFrame:aS,batch:ld};function hS(){return!0}var Mc=class{constructor(t,e,n,r,s,a,o){this.id=t,this._priority=e,this._signal=o,this._resolve=r,this.reject=s,this._request=n,this.shouldExecute=a??hS}getKey(){return this.id}getPriority(){return this._signal?.aborted===!0?1/0:this._priority}execute(){return this._signal?.aborted===!0?(this.reject(Xr.abortError()),Promise.reject()):this._request().then(t=>this._resolve(t)).catch(t=>this.reject(t))}};function uS(i){return i.getPriority()}function fS(i){return i.getKey()}var dS=10,Sc=class extends Bt{constructor(t={}){super(),this._pendingIds=new Map,this._queue=new od(uS,fS),this._opCounter=new ka,this._concurrentRequests=0,this._maxConcurrentRequests=t.maxConcurrentRequests??dS}get length(){return this._queue.getCount()}get progress(){return this._opCounter.progress}get loading(){return this._opCounter.loading}get pendingRequests(){return this._pendingIds.size}get concurrentRequests(){return this._concurrentRequests}onQueueAvailable(){for(;this._concurrentRequests<this._maxConcurrentRequests&&!this._queue.isEmpty();){let t=this._queue.dequeue(),e=t.getKey();t.shouldExecute()?(this._concurrentRequests++,t.execute().catch(n=>t.reject(n)).finally(()=>{this._opCounter.decrement(),this._pendingIds.delete(e),this._concurrentRequests--,this.onQueueAvailable(),this.dispatchEvent({type:"task-executed"})})):(this._opCounter.decrement(),this._pendingIds.delete(e),t.reject(Xr.abortError()),this.dispatchEvent({type:"task-cancelled"}))}}enqueue(t){let{id:e,request:n,signal:r,shouldExecute:s}=t,a=t.priority??0;if(r?.aborted===!0)return Promise.reject(Xr.abortError());if(this._pendingIds.has(e))return this._pendingIds.get(e);this._opCounter.increment();let o=new Promise((l,c)=>{let h=new Mc(e,a,n,l,c,s,r);this._queue.isEmpty()?(this._queue.enqueue(h),this.onQueueAvailable()):this._queue.enqueue(h)});return this._pendingIds.set(e,o),o}},pS=new Sc;var re=(function(i){return i[i.Raw=0]="Raw",i[i.ScaleToMinMax=2]="ScaleToMinMax",i[i.CompressTo8Bit=3]="CompressTo8Bit",i})({}),bc=class i{get options(){return this._opts}constructor(t,e={}){this._mode=t,this._opts=e}get mode(){return this._mode}get min(){return this._opts.min}get max(){return this._opts.max}get negateValues(){return this._opts.negateValues}set negateValues(t){this._opts.negateValues=t}isDefault(){return this.mode===re.Raw&&this.negateValues!==!0}withNegatedValues(){return this.negateValues=!0,this}static get Raw(){return new i(re.Raw)}get colorSpace(){if(this._mode===re.ScaleToMinMax)return Hr}static ScaleToMinMax(t,e){if(typeof t=="number"&&typeof e=="number")return new i(re.ScaleToMinMax,{min:t,max:e});throw new Error("min and max should be numbers")}static CompressTo8Bit(t,e){if(typeof t=="number"&&typeof e=="number")return new i(re.CompressTo8Bit,{min:t,max:e});throw new Error("min and max should be numbers")}toString(){switch(this.mode){case re.Raw:return"Raw";case re.ScaleToMinMax:return`Scaled (min: ${this._opts.min}, max: ${this._opts.max})`;case re.CompressTo8Bit:return`Compressed to 8-bit (min: ${this._opts.min}, max: ${this._opts.max})`;default:return"unknown"}}setUniform(t){let e=this.mode;switch(t.mode=e,t.negateValues=this.negateValues??!1,t.min=0,t.max=1,e){case re.ScaleToMinMax:case re.CompressTo8Bit:t.min=this._opts.min??0,t.max=this._opts.max??1;break;case re.Raw:break;default:throw new Error(`unknown interpretation mode: ${this.mode}`)}return t}},Ha=bc;var qr=class extends Ee{isEmptyTexture=!0;constructor(){super()}};var cd=!1,hd=8,ud=2048,fd=0,dd={isLogDepthBufferSupported(){return cd},getMaxTextureUnitsCount(){return hd},getMaxTextureSize(){return ud},getMaxAnisotropy(){return fd},updateCapabilities(i){let t=i.getContext();hd=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ud=t.getParameter(t.MAX_TEXTURE_SIZE),fd=i.capabilities.getMaxAnisotropy(),cd=i.capabilities.logarithmicDepthBuffer}};var pd=1009,md=1015;var Ec=0,Vi=0;function gd(i){if(i instanceof Float32Array)return"Float32Array";if(i instanceof Float64Array)return"Float64Array";if(i instanceof Uint32Array)return"Uint32Array";if(i instanceof Uint16Array)return"Uint16Array";if(i instanceof Int32Array)return"Int32Array";if(i instanceof Int16Array)return"Int16Array";if(i instanceof Uint8Array)return"Uint8Array";if(i instanceof Int8Array)return"Int8Array";if(i instanceof Uint8ClampedArray)return"Uint8ClampedArray";throw new Error("unsupported type")}function wc(i,t){if(typeof t=="number")switch(t){case pd:return new Uint8ClampedArray(i);case md:return new Float32Array(i)}else switch(t){case"Float32Array":return new Float32Array(i);case"Float64Array":return new Float64Array(i);case"Uint8ClampedArray":return new Uint8ClampedArray(i);case"Uint8Array":return new Uint8Array(i);case"Uint16Array":return new Uint16Array(i);case"Uint32Array":return new Uint32Array(i);case"Int8Array":return new Int8Array(i);case"Int16Array":return new Int16Array(i);case"Int32Array":return new Int32Array(i)}throw new Error("invalid state")}function Wa(i){let t=i.input.map(o=>wc(o,i.inputType)),e=i.opaqueValue,n;if(i.bufferSize&&i.dataType)switch(i.dataType){case md:n=new Float32Array(i.bufferSize);break;case pd:n=new Uint8ClampedArray(i.bufferSize);break;default:throw new Error("unrecognized buffer type: "+i.dataType)}else throw console.error("missing values"),new Error("missing values");let r=1/0,s=-1/0,a=!0;if(t.length===1){let o=t[0],l=o.length;for(let c=0;c<l;c++){let h=c*2,u,p,d=o[c];d!==d||d===i.nodata?(u=Vi,p=Ec):(u=d,p=e,a=!1),r=Math.min(r,u),s=Math.max(s,u),n[h+0]=u,n[h+1]=p}}if(t.length===2){let o=t[0],l=t[1],c=o.length;for(let h=0;h<c;h++){let u=h*2,p,d=o[h],_=l[h];d!==d||d===i.nodata?p=Vi:p=d,_>0&&(a=!1),r=Math.min(r,p),s=Math.max(s,p),n[u+0]=p,n[u+1]=l[h]}}if(t.length===3){let o=t[0],l=t[1],c=t[2],h=o.length,u;for(let p=0;p<h;p++){let d=p*4,_=o[p],g=l[p],v=c[p];(_!==_||_===i.nodata)&&(g!==g||g===i.nodata)&&(v!==v||v===i.nodata)?(_=Vi,g=Vi,v=Vi,u=Ec):(u=e,a=!1),n[d+0]=_,n[d+1]=g,n[d+2]=v,n[d+3]=u}}if(t.length===4){let o=t[0],l=t[1],c=t[2],h=t[3],u=o.length;for(let p=0;p<u;p++){let d=p*4,_=o[p],g=l[p],v=c[p],x=h[p];(_!==_||_===i.nodata)&&(g!==g||g===i.nodata)&&(v!==v||v===i.nodata)?(_=Vi,g=Vi,v=Vi,x=Ec):x>0&&(a=!1),n[d+0]=_,n[d+1]=g,n[d+2]=v,n[d+3]=x}}return{buffer:n.buffer,min:r,max:s,isTransparent:a}}onmessage=async function(i){let t=i.data;try{switch(t.type){case"CreatePixelBuffer":{let e=Wa(t.payload),n={requestId:t.id,payload:e};this.postMessage(n,{transfer:[n.payload.buffer]})}break;case"CreateImageBitmap":{let e=new Blob([t.payload.buffer]),n=await createImageBitmap(e,t.payload.options),r={requestId:t.id,payload:n};this.postMessage(r,{transfer:[n]})}break}}catch(e){this.postMessage(Zn(t.id,e))}};var mS=255,gS=1;function _S(i){return i?.isTexture}function yS(i){return i?.isRenderTarget}function Rc(i){return i.isDataTexture}function qa(i){return i.isCanvasTexture}function Yr(i){switch(i){case ai:case La:return 1;case Da:case Oa:case Fa:case Ba:return 2;case kr:case Ua:case Ga:case oi:return 4;case Vr:return 2;default:throw new Error(`unknown data type: ${i}`)}}function vS(i){switch(i){case ai:return"UnsignedByteType";case La:return"ByteType";case Da:return"ShortType";case Oa:return"UnsignedShortType";case Fa:return"UnsignedShort4444Type";case Ba:return"UnsignedShort5551Type";case kr:return"IntType";case Ua:return"UnsignedIntType";case Ga:return"UnsignedInt248Type";case oi:return"FloatType";case Vr:return"HalfFloatType";default:throw new Error(`unknown data type: ${i}`)}}function jr(i){switch(i){case ac:return 1;case li:return 4;case oc:return 1;case lc:return 1;case cc:return 1;case hc:return 1;case za:return 2;case uc:return 2;case fc:return 4;default:throw new Error(`invalid pixel format: ${i}`)}}function xS(i){let t=jr(i.format),e=Yr(i.type);return i.image.width*i.image.height*t*e}function MS(i,t){let e=i.width*i.height*jr(i.texture.format),n=i.texture.type===ai?new Uint8Array(e):new Float32Array(e);t.readRenderTargetPixels(i,0,0,i.width,i.height,n),i.texture.data=n}function Ic(i){let t=document.createElement("canvas");t.width=i.width,t.height=i.height;let e=t.getContext("2d",{willReadFrequently:!0});if(!e)throw new Error("could not acquire 2D context on canvas");return e.drawImage(i,0,0),e.getImageData(0,0,i.width,i.height).data}var Tc=null;function yd(){return Tc==null&&(Tc=new Wr({createWorker:()=>new Worker(URL.createObjectURL(new Blob([atob("InVzZSBzdHJpY3QiOygoKT0+e2Z1bmN0aW9uIF8oZSx0KXtyZXR1cm57cmVxdWVzdElkOmUsZXJyb3I6dCBpbnN0YW5jZW9mIEVycm9yP3QubWVzc2FnZToidW5rbm93biBlcnJvciJ9fXZhciBrPTEwMDksVD0xMDE1LGI9MjU1LEI9MSxBPTAscD0wO2Z1bmN0aW9uIE0oZSl7aWYoZSBpbnN0YW5jZW9mIEZsb2F0MzJBcnJheSlyZXR1cm4iRmxvYXQzMkFycmF5IjtpZihlIGluc3RhbmNlb2YgRmxvYXQ2NEFycmF5KXJldHVybiJGbG9hdDY0QXJyYXkiO2lmKGUgaW5zdGFuY2VvZiBVaW50MzJBcnJheSlyZXR1cm4iVWludDMyQXJyYXkiO2lmKGUgaW5zdGFuY2VvZiBVaW50MTZBcnJheSlyZXR1cm4iVWludDE2QXJyYXkiO2lmKGUgaW5zdGFuY2VvZiBJbnQzMkFycmF5KXJldHVybiJJbnQzMkFycmF5IjtpZihlIGluc3RhbmNlb2YgSW50MTZBcnJheSlyZXR1cm4iSW50MTZBcnJheSI7aWYoZSBpbnN0YW5jZW9mIFVpbnQ4QXJyYXkpcmV0dXJuIlVpbnQ4QXJyYXkiO2lmKGUgaW5zdGFuY2VvZiBJbnQ4QXJyYXkpcmV0dXJuIkludDhBcnJheSI7aWYoZSBpbnN0YW5jZW9mIFVpbnQ4Q2xhbXBlZEFycmF5KXJldHVybiJVaW50OENsYW1wZWRBcnJheSI7dGhyb3cgbmV3IEVycm9yKCJ1bnN1cHBvcnRlZCB0eXBlIil9ZnVuY3Rpb24geChlLHQpe2lmKHR5cGVvZiB0PT0ibnVtYmVyIilzd2l0Y2godCl7Y2FzZSBrOnJldHVybiBuZXcgVWludDhDbGFtcGVkQXJyYXkoZSk7Y2FzZSBUOnJldHVybiBuZXcgRmxvYXQzMkFycmF5KGUpfWVsc2Ugc3dpdGNoKHQpe2Nhc2UiRmxvYXQzMkFycmF5IjpyZXR1cm4gbmV3IEZsb2F0MzJBcnJheShlKTtjYXNlIkZsb2F0NjRBcnJheSI6cmV0dXJuIG5ldyBGbG9hdDY0QXJyYXkoZSk7Y2FzZSJVaW50OENsYW1wZWRBcnJheSI6cmV0dXJuIG5ldyBVaW50OENsYW1wZWRBcnJheShlKTtjYXNlIlVpbnQ4QXJyYXkiOnJldHVybiBuZXcgVWludDhBcnJheShlKTtjYXNlIlVpbnQxNkFycmF5IjpyZXR1cm4gbmV3IFVpbnQxNkFycmF5KGUpO2Nhc2UiVWludDMyQXJyYXkiOnJldHVybiBuZXcgVWludDMyQXJyYXkoZSk7Y2FzZSJJbnQ4QXJyYXkiOnJldHVybiBuZXcgSW50OEFycmF5KGUpO2Nhc2UiSW50MTZBcnJheSI6cmV0dXJuIG5ldyBJbnQxNkFycmF5KGUpO2Nhc2UiSW50MzJBcnJheSI6cmV0dXJuIG5ldyBJbnQzMkFycmF5KGUpfXRocm93IG5ldyBFcnJvcigiaW52YWxpZCBzdGF0ZSIpfWZ1bmN0aW9uIEUoZSl7bGV0IHQ9ZS5pbnB1dC5tYXAobz0+eChvLGUuaW5wdXRUeXBlKSksaD1lLm9wYXF1ZVZhbHVlLG47aWYoZS5idWZmZXJTaXplJiZlLmRhdGFUeXBlKXN3aXRjaChlLmRhdGFUeXBlKXtjYXNlIFQ6bj1uZXcgRmxvYXQzMkFycmF5KGUuYnVmZmVyU2l6ZSk7YnJlYWs7Y2FzZSBrOm49bmV3IFVpbnQ4Q2xhbXBlZEFycmF5KGUuYnVmZmVyU2l6ZSk7YnJlYWs7ZGVmYXVsdDp0aHJvdyBuZXcgRXJyb3IoInVucmVjb2duaXplZCBidWZmZXIgdHlwZTogIitlLmRhdGFUeXBlKX1lbHNlIHRocm93IGNvbnNvbGUuZXJyb3IoIm1pc3NpbmcgdmFsdWVzIiksbmV3IEVycm9yKCJtaXNzaW5nIHZhbHVlcyIpO2xldCB5PTEvMCxtPS0xLzAsdz0hMDtpZih0Lmxlbmd0aD09PTEpe2xldCBvPXRbMF0sZj1vLmxlbmd0aDtmb3IobGV0IGQ9MDtkPGY7ZCsrKXtsZXQgaT1kKjIsYSxyLHM9b1tkXTtzIT09c3x8cz09PWUubm9kYXRhPyhhPXAscj1BKTooYT1zLHI9aCx3PSExKSx5PU1hdGgubWluKHksYSksbT1NYXRoLm1heChtLGEpLG5baSswXT1hLG5baSsxXT1yfX1pZih0Lmxlbmd0aD09PTIpe2xldCBvPXRbMF0sZj10WzFdLGQ9by5sZW5ndGg7Zm9yKGxldCBpPTA7aTxkO2krKyl7bGV0IGE9aSoyLHIscz1vW2ldLGM9ZltpXTtzIT09c3x8cz09PWUubm9kYXRhP3I9cDpyPXMsYz4wJiYodz0hMSkseT1NYXRoLm1pbih5LHIpLG09TWF0aC5tYXgobSxyKSxuW2ErMF09cixuW2ErMV09ZltpXX19aWYodC5sZW5ndGg9PT0zKXtsZXQgbz10WzBdLGY9dFsxXSxkPXRbMl0saT1vLmxlbmd0aCxhO2ZvcihsZXQgcj0wO3I8aTtyKyspe2xldCBzPXIqNCxjPW9bcl0sbD1mW3JdLHU9ZFtyXTsoYyE9PWN8fGM9PT1lLm5vZGF0YSkmJihsIT09bHx8bD09PWUubm9kYXRhKSYmKHUhPT11fHx1PT09ZS5ub2RhdGEpPyhjPXAsbD1wLHU9cCxhPUEpOihhPWgsdz0hMSksbltzKzBdPWMsbltzKzFdPWwsbltzKzJdPXUsbltzKzNdPWF9fWlmKHQubGVuZ3RoPT09NCl7bGV0IG89dFswXSxmPXRbMV0sZD10WzJdLGk9dFszXSxhPW8ubGVuZ3RoO2ZvcihsZXQgcj0wO3I8YTtyKyspe2xldCBzPXIqNCxjPW9bcl0sbD1mW3JdLHU9ZFtyXSxnPWlbcl07KGMhPT1jfHxjPT09ZS5ub2RhdGEpJiYobCE9PWx8fGw9PT1lLm5vZGF0YSkmJih1IT09dXx8dT09PWUubm9kYXRhKT8oYz1wLGw9cCx1PXAsZz1BKTpnPjAmJih3PSExKSxuW3MrMF09YyxuW3MrMV09bCxuW3MrMl09dSxuW3MrM109Z319cmV0dXJue2J1ZmZlcjpuLmJ1ZmZlcixtaW46eSxtYXg6bSxpc1RyYW5zcGFyZW50Ond9fW9ubWVzc2FnZT1hc3luYyBmdW5jdGlvbihlKXtsZXQgdD1lLmRhdGE7dHJ5e3N3aXRjaCh0LnR5cGUpe2Nhc2UiQ3JlYXRlUGl4ZWxCdWZmZXIiOntsZXQgaD1FKHQucGF5bG9hZCksbj17cmVxdWVzdElkOnQuaWQscGF5bG9hZDpofTt0aGlzLnBvc3RNZXNzYWdlKG4se3RyYW5zZmVyOltuLnBheWxvYWQuYnVmZmVyXX0pfWJyZWFrO2Nhc2UiQ3JlYXRlSW1hZ2VCaXRtYXAiOntsZXQgaD1uZXcgQmxvYihbdC5wYXlsb2FkLmJ1ZmZlcl0pLG49YXdhaXQgY3JlYXRlSW1hZ2VCaXRtYXAoaCx0LnBheWxvYWQub3B0aW9ucykseT17cmVxdWVzdElkOnQuaWQscGF5bG9hZDpufTt0aGlzLnBvc3RNZXNzYWdlKHkse3RyYW5zZmVyOltuXX0pfWJyZWFrfX1jYXRjaChoKXt0aGlzLnBvc3RNZXNzYWdlKF8odC5pZCxoKSl9fTt9KSgpOwo=")],{type:"text/javascript"})),{type:"module"}),concurrency:2})),Tc}async function SS(i,t){if(window.Worker!=null){let e=yd(),n=await i.arrayBuffer();return await e.queue("CreateImageBitmap",{buffer:n,options:t},[n])}else return createImageBitmap(i,t)}async function bS(i,t={}){let[e]=i.type.split(";");switch(e){case"image/webp":case"image/png":case"image/jpg":case"image/jpeg":{let n=t?.enableWorkers??!0,r,s={imageOrientation:t.flipY===!0?"flipY":"none"};n?r=await SS(i,s):r=await createImageBitmap(i,s);let a,o=dd.getMaxTextureSize();if(r.width>o||r.height>o)throw new Error(`image dimensions (${r.width} * ${r.height} pixels) exceed max texture size (${o} pixels)`);if(t.createDataTexture===!0){let l=Ic(r);a=new Bi(l,r.width,r.height,li,ai)}else a=new Ee(r);return a.wrapS=Ie,a.wrapT=Ie,a.minFilter=We,a.magFilter=We,a.generateMipmaps=!1,a.needsUpdate=!0,a}default:throw new Error(`unsupported media type for textures: ${i.type}`)}}function vd(i,t,e,n,r){let s=i.isTransparent?new qr:new Bi(wc(i.buffer,r),t,e,n,r);return Lc(s)||(s.needsUpdate=!0,s.generateMipmaps=!1,s.magFilter=We,s.minFilter=We),{texture:s,min:i.min,max:i.max}}function xd(i){switch(i){case 1:case 2:return za;default:return li}}function Md(i,...t){let{width:e,height:n,type:r,nodata:s}=i,a=r,o;switch(t.length){case 1:case 2:o=2;break;default:o=4;break}let l;return a===oi?l=gS:l=mS,{bufferSize:e*n*o,inputType:gd(t[0]),dataType:a,input:t.map(c=>i.makeCopyOfBuffers?c.buffer.slice(0):c.buffer),opaqueValue:l,nodata:s}}function ES(i,t,...e){let n=Md({width:i.width,height:i.height,type:t,nodata:i.nodata,makeCopyOfBuffers:!1},...e),r=Wa(n),s=xd(e.length);return vd(r,i.width,i.height,s,n.dataType)}async function wS(i,t,...e){let n=Md({width:i.width,height:i.height,type:t,nodata:i.nodata,makeCopyOfBuffers:!0},...e),r;(i?.enableWorkers??!0)&&window.Worker!=null?r=await yd().queue("CreatePixelBuffer",n,n.input):r=Wa(n);let a=xd(e.length);return vd(r,i.width,i.height,a,n.dataType)}function TS(i,t){let e=i.length,n=new Uint8ClampedArray(e*4);for(let s=0;s<e;s++){let a=i[s],o=s*4;n[o+0]=a.r*255,n[o+1]=a.g*255,n[o+2]=a.b*255,n[o+3]=t?Zt.clamp(t[s],0,1)*255:255}let r=new Bi(n,e,1,li,ai);return r.needsUpdate=!0,r}function Nc(i,t,e=Ha.Raw,n=4){let r=1/0,s=-1/0,a=0,o=n-1;switch(e.mode){case re.Raw:for(let l=0;l<i.length;l+=n){let c=i[l+a],h=i[l+o];c===c&&c!==t&&h!==0&&(r=Math.min(r,c),s=Math.max(s,c))}break;case re.ScaleToMinMax:{let l=e.min,c=e.max;for(let h=0;h<i.length;h+=n){let u=i[h+a]/255,p=l+u*(c-l),d=i[h+o];p===p&&p!==t&&d!==0&&(r=Math.min(r,p),s=Math.max(s,p))}}break;default:throw new Error("not implemented")}return e.negateValues===!0?{min:-s,max:-r}:{min:r,max:s}}function AS(i,t){return Yr(i)>Yr(t)?i:t}function CS(i,t){return!(t!==li||i===t)}function Sd(i,t=Ha.Raw){let e=Ic(i);return Nc(e,0,t)}function PS(i,t=0,e=Ha.Raw){if(Rc(i)){let n=jr(i.format);return Nc(i.image.data,t,e,n)}return qa(i)?Sd(i.image,e):null}function Lc(i){return i==null||i.isEmptyTexture?!0:qa(i)?i.source?.data==null:Rc(i)?i.image?.data==null:i.isRenderTargetTexture?!1:i.source?.data==null}function Ac(i,t){if(t!=null)if(Lc(t))i.objects.set(t.id,{gpuMemory:0,cpuMemory:0});else if(t.userData?.memoryUsage!=null){let e=t.userData.memoryUsage;i.objects.set(t.id,e)}else if(qa(t)){let{width:e,height:n}=t.source.data;i.objects.set(t.id,{gpuMemory:e*n*4,cpuMemory:0})}else{let{width:e,height:n}=t.image,r=e*n*Yr(t.type)*jr(t.format);t.isRenderTargetTexture?i.objects.set(t.id,{gpuMemory:r,cpuMemory:0}):i.objects.set(t.id,{gpuMemory:r,cpuMemory:r})}}var _d=new Yn({uniforms:{depthTexture:{value:null}},vertexShader:`
3830
3830
  varying vec2 vUv;
3831
3831
  void main() {
3832
3832
  vUv = uv;
@@ -3842,10 +3842,10 @@ void main() {
3842
3842
  float depth = texture2D(depthTexture, vUv).r;
3843
3843
  gl_FragColor = packDepthToRGBA(depth);
3844
3844
  }
3845
- `}),za=new Yt(1,256,256*256,256*256*256),vc=255/256,RM=new Yt(vc/za.x,vc/za.y,vc/za.z,1/za.w),IM=new Fr(2,2);async function LM(n,t){let e=n.image.width,i=n.image.height,r=new Rr,s=new Ur(IM,Kf);r.add(s),Kf.uniforms.depthTexture.value=n;let a=new zi(e,i,{format:cn,type:on});t.setRenderTarget(a),t.render(r,new Br),t.setRenderTarget(null);let o=new Uint8Array(e*i*4);await t.readRenderTargetPixelsAsync(a,0,0,e,i,o);let l=new Float32Array(e*i),c=0,h=new Yt;for(let u=0;u<o.length;u+=4){let m=o[u+0]/255,d=o[u+1]/255,g=o[u+2]/255,y=o[u+3]/255;h.set(m,d,g,y);let v=h.dot(RM);l[c]=v,c++}return a.dispose(),l}function NM(n,t){let e=n.renderer.getContext(),i=e.getParameter(e.DEPTH_BITS),r=t.width*t.height*(i/8);n.objects.set(t.texture.id,{gpuMemory:r,cpuMemory:0})}function DM(n,t){t!=null&&(_M(t)?yc(n,t):yM(t)&&(t.depthBuffer&&(t.depthTexture!=null?yc(n,t.depthTexture):NM(n,t)),yc(n,t.texture)))}function UM(n){return n instanceof HTMLCanvasElement||n instanceof OffscreenCanvas?n.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,n.width,n.height).data:Sc(n)}function FM(n){let t=UM(n);for(let e=0;e<t.length;e+=4)if(t[e+3]!==0)return!1;return!0}function xc(n,t,e){let i=e?.getContext();if(i==null)return n;let r=an;return n===Ve&&(t===ln&&!i.getExtension("OES_texture_float_linear")||t===kr&&!i.getExtension("OES_texture_half_float_linear"))?r:n}function OM(n,t){n.minFilter=xc(n.minFilter,n.type,t),n.magFilter=xc(n.magFilter,n.type,t)}var Va={createDataTexture:wM,createDataTextureAsync:EM,isEmptyTexture:wc,decodeBlob:bM,getChannelCount:Yr,getBytesPerChannel:qr,getWiderType:AM,getDataTypeString:vM,create1DTexture:TM,createDataCopy:MM,computeMinMax:PM,isDataTexture:Mc,isCanvasTexture:ka,computeMinMaxFromBuffer:bc,computeMinMaxFromImage:id,estimateSize:xM,readDepthTexture:LM,shouldExpandRGB:CM,isCanvasEmpty:FM,getMemoryUsage:DM,getCompatibleTextureFilter:xc,ensureCompatibility:OM};var Ec=class extends Ot{},YI=new Ec;var BM="file-viewer-offline-cdn/npm/laz-perf@0.0.7/lib",GM=BM,Tc=null;function rd(n){Tc=n}var Ha;async function zM(n){return Ac.LazPerf.create({wasmBinary:n})}async function kM(n){return Ac.LazPerf.create({locateFile:t=>`${n}/${t}`})}function Cc(){return Ha||(Tc!=null?Ha=zM(Tc):Ha=kM(GM)),Ha}function Wa(n,t){return n==null||n.length===0?!0:n.every(e=>e(t))}function VM(n){let t=n.operator;switch(t){case"equal":return e=>e===n.value;case"less":return e=>e<n.value;case"lessequal":return e=>e<=n.value;case"greater":return e=>e>n.value;case"greaterequal":return e=>e>=n.value;case"not":return e=>e!==n.value;case"in":return e=>n.values.has(e);case"not_in":return e=>!n.values.has(e);default:throw new Error(`invalid filter operator: '${t}'`)}}function sd(n,t){if(n.length===0)return null;let e=[];for(let i of n){let r=VM(i);if(t.dimensions[i.dimension]!=null){let s=t.getter(i.dimension);e.push(a=>r(s(a)))}}return e.length>0?e:null}var Pc=class{_length=0;constructor(t,e){this._ctor=e,this._array=e(t)}get capacity(){return this._array.length}get length(){return this._length}push(t){this.isFull&&this.expand(),this._array[this._length]=t,this._length++}getArray(){return this.isFull?this._array:this._array.slice(0,this._length)}get isFull(){return this._length===this.capacity}expand(){let t=Math.round(this.capacity*1.5),e=this._ctor(t);e.set(this._array),this._array=e}},ad=Pc;function hn(n,t){if(n==null)throw new Error(t??"non-null assertion failed");return n}var un=0,fn=1,Xe=2,Wn=3,Rc=class{_lastExpansion=0;get byteLength(){return this.array.byteLength}get capacity(){return this.array.length/this._dimension}get array(){return this._array}toFloat32Array(){return this._array instanceof Float32Array?this._array.length===this._length*this._dimension?this._array:this._array.slice(0,this._length*this._dimension):new Float32Array(this._array.slice(0,this._length*this._dimension))}constructor(t,e){if(this._dimension=e,t.length%this._dimension!==0)throw new Error(`invalid size, expected a multiple of ${this._dimension}, got ${t.length}`);this._array=t,this._capacity=this._array.length/this._dimension,this._length=this._capacity}get length(){return this._length}set length(t){this._length=t}setX(t,e){let i=t*this._dimension;this._array[i+un]=e}getX(t){let e=t*this._dimension;return this._array[e+un]}setY(t,e){let i=t*this._dimension;this._array[i+fn]=e}getY(t){let e=t*this._dimension;return this._array[e+fn]}setZ(t,e){if(this._dimension>=3){let i=t*this._dimension;this._array[i+Xe]=e}}getZ(t){if(this._dimension>=3){let e=t*this._dimension;return this._array[e+Xe]}return null}setW(t,e){if(this._dimension>=4){let i=t*this._dimension;this._array[i+Wn]=e}}getW(t){if(this._dimension>=4){let e=t*this._dimension;return this._array[e+Wn]}return null}setVector(t,e){let i=t*this._dimension;this._array[i+un]=e.getComponent(un),this._array[i+fn]=e.getComponent(fn),this._dimension>=3&&(this._array[i+Xe]=e.getComponent(Xe)),this._dimension>=4&&(this._array[i+Wn]=e.getComponent(Wn))}set(t,e,i,r,s){let a=t*this._dimension;if(a>=this._array.length)throw new Error("index out of bounds");this._array[a+un]=e,this._array[a+fn]=i,this._dimension>=Xe&&r!=null&&(this._array[a+Xe]=r),this._dimension>=Wn&&s!=null&&(this._array[a+Wn]=s)}copyItem(t,e){let i=this._dimension,r=e*i,s=t*i;this._array[r+un]=this._array[s+un],this._array[r+fn]=this._array[s+fn],i>=3&&(this._array[r+Xe]=this._array[s+Xe]),i>=4&&(this._array[r+Wn]=this._array[s+Wn])}computeExpansionSize(){return this._lastExpansion===0?this._lastExpansion=32:(this._lastExpansion*=2,this._lastExpansion=jt.clamp(this._lastExpansion,32,65536)),this._lastExpansion}trim(){this._capacity>this._length&&(this._capacity=this._length,this._array=this._array.slice(0,this._length*this._dimension))}allocateIfFull(){if(this._capacity===this._length){let t=this._length;this.expand(this._length+this.computeExpansionSize()),this._capacity=this._array.length/this._dimension,this._length=t}}push(t,e,i,r){this._capacity===this._length&&this.allocateIfFull(),this.setX(this._length,t),this.setY(this._length,e),i!=null&&this.setZ(this._length,i),r!=null&&this.setW(this._length,r),this._length++}pushVector(t){this._capacity===this._length&&this.allocateIfFull(),this.assignVector(this._length*this._dimension,t),this._length++}expand(t){let e=new this.array.constructor(t*this._dimension);return e.set(this._array),this._array=e,this._capacity=this._array.length/this._dimension,this._length=this._capacity,this}forEach(t){let e=this.getTempVector(),i=this._dimension;for(let r=0;r<this._array.length;r+=i){this.readVector(r,e);let s=r/i;t(e,s,this)}}};var jr=class n extends Rc{dimension=3;constructor(t){super(t,3)}get(t,e){return e=e??new C,e.set(this.getX(t),this.getY(t),hn(this.getZ(t)))}clone(){return new n(this._array.slice(0))}getZ(t){return super.getZ(t)}getTempVector(){return new C}readVector(t,e){let i=this._array;e.set(i[t+un],i[t+fn],i[t+Xe])}assignVector(t,e){this._array[t+un]=e.x,this._array[t+fn]=e.y,this._array[t+Xe]=e.z}};var od=(function(n){return n[n.Elevation=1]="Elevation",n[n.Slope=2]="Slope",n[n.Aspect=3]="Aspect",n})(od||{}),ld=od;var Ic=class n extends Ot{_opacity=null;_shouldRecreateTexture=!0;constructor(t){if(super(),this._min=t.min,this._max=t.max,this._mode=t.mode??ld.Elevation,this._colors=hn(t.colors,"missing colors parameter"),t.opacities!=null){if(t.opacities.length!==this._colors.length)throw new Error("the opacity array must have the same length as the color array");this._opacity=t.opacities??null}this._cachedTexture=null,this._active=!0}get mode(){return this._mode}set mode(t){this._mode!==t&&(this._mode=t,this.notifyChange())}notifyChange(){this.dispatchEvent({type:"updated"})}get active(){return this._active}set active(t){this._active!==t&&(this._active=t,this.notifyChange())}get min(){return this._min}set min(t){this._min!==t&&(this._min=t,this.notifyChange())}get max(){return this._max}set max(t){this._max!==t&&(this._max=t,this.notifyChange())}get colors(){return this._colors}set colors(t){this._colors!==t&&(this._colors=t,this._opacity&&this._opacity.length!==t.length&&(this._opacity=null),this._shouldRecreateTexture=!0,this.notifyChange())}get opacity(){return this._opacity}set opacity(t){if(t&&t.length!==this.colors.length)throw new Error("the opacity array must have the same length as the color array");this._opacity!==t&&(this._opacity=t,this._shouldRecreateTexture=!0),this.notifyChange()}sample(t){let{min:e,max:i,colors:r}=this,s=jt.clamp(t,e,i),a=jt.mapLinear(s,e,i,0,r.length-1);return r[jt.clamp(Math.round(a),0,r.length-1)]}sampleOpacity(t){let{min:e,max:i,opacity:r}=this;if(!r)return 1;let s=jt.clamp(t,e,i),a=jt.mapLinear(s,e,i,0,r.length-1);return r[jt.clamp(Math.round(a),0,r.length-1)]}getTexture(){return(this._shouldRecreateTexture||this._cachedTexture==null)&&(this._cachedTexture?.dispose(),this._cachedTexture=Va.create1DTexture(this._colors,this._opacity??void 0),this._cachedTexture.minFilter=an,this._cachedTexture.magFilter=an,this._cachedTexture.wrapS=Pe,this._cachedTexture.wrapT=Pe,this._shouldRecreateTexture=!1),hn(this._cachedTexture)}clone(){return new n({colors:[...this.colors],min:this.min,max:this.max,mode:this._mode,opacities:this._opacity!=null?[...this._opacity]:void 0})}dispose(){this._cachedTexture?.dispose()}};var Lc=Ic;function cd(n){n("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),n("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),n("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var t=1;t<=60;++t)n("EPSG:"+(32600+t),"+proj=utm +zone="+t+" +datum=WGS84 +units=m"),n("EPSG:"+(32700+t),"+proj=utm +zone="+t+" +south +datum=WGS84 +units=m");n("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),n("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),n.WGS84=n["EPSG:4326"],n["EPSG:3785"]=n["EPSG:3857"],n.GOOGLE=n["EPSG:3857"],n["EPSG:900913"]=n["EPSG:3857"],n["EPSG:102113"]=n["EPSG:3857"]}var Ie=1,Le=2,dn=3,hd=4,Zr=5,Nc=6378137,ud=6356752314e-3,Dc=.0066943799901413165,ri=484813681109536e-20,T=Math.PI/2,fd=.16666666666666666,dd=.04722222222222222,pd=.022156084656084655,D=1e-10,dt=.017453292519943295,Pt=57.29577951308232,st=Math.PI/4,Xn=Math.PI*2,vt=3.14159265359;var ie={};ie.greenwich=0;ie.lisbon=-9.131906111111;ie.paris=2.337229166667;ie.bogota=-74.080916666667;ie.madrid=-3.687938888889;ie.rome=12.452333333333;ie.bern=7.439583333333;ie.jakarta=106.807719444444;ie.ferro=-17.666666666667;ie.brussels=4.367975;ie.stockholm=18.058277777778;ie.athens=23.7163375;ie.oslo=10.722916666667;var md=ie;var gd={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var _d=/[\s_\-\/\(\)]/g;function pe(n,t){if(n[t])return n[t];for(var e=Object.keys(n),i=t.toLowerCase().replace(_d,""),r=-1,s,a;++r<e.length;)if(s=e[r],a=s.toLowerCase().replace(_d,""),a===i)return n[s]}function Jr(n){var t={},e=n.split("+").map(function(o){return o.trim()}).filter(function(o){return o}).reduce(function(o,l){var c=l.split("=");return c.push(!0),o[c[0].toLowerCase()]=c[1],o},{}),i,r,s,a={proj:function(o){t.projName=["lonlat","latlon","latlong"].includes(o)?"longlat":o},datum:"datumCode",rf:function(o){t.rf=parseFloat(o)},lat_0:function(o){t.lat0=o*dt},lat_1:function(o){t.lat1=o*dt},lat_2:function(o){t.lat2=o*dt},lat_ts:function(o){t.lat_ts=o*dt},lon_0:function(o){t.long0=o*dt},lon_wrap:function(o){t.long_wrap=parseFloat(o)*dt},lon_1:function(o){t.long1=o*dt},lon_2:function(o){t.long2=o*dt},alpha:function(o){t.alpha=parseFloat(o)*dt},gamma:function(o){t.rectified_grid_angle=parseFloat(o)*dt},lonc:function(o){t.longc=o*dt},x_0:function(o){t.x0=parseFloat(o)},y_0:function(o){t.y0=parseFloat(o)},k_0:function(o){t.k0=parseFloat(o)},k:function(o){t.k0=parseFloat(o)},a:function(o){t.a=parseFloat(o)},b:function(o){t.b=parseFloat(o)},r:function(o){t.a=t.b=parseFloat(o)},r_a:function(){t.R_A=!0},zone:function(o){t.zone=parseInt(o,10)},south:function(){t.utmSouth=!0},towgs84:function(o){t.datum_params=o.split(",").map(function(l){return parseFloat(l)})},to_meter:function(o){t.to_meter=parseFloat(o)},units:function(o){t.units=o;var l=pe(gd,o);l&&(t.to_meter=l.to_meter)},from_greenwich:function(o){t.from_greenwich=o*dt},pm:function(o){var l=pe(md,o);t.from_greenwich=(l||parseFloat(o))*dt},nadgrids:function(o){o==="@null"?t.datumCode="none":t.nadgrids=o},axis:function(o){var l="ewnsud";o.length===3&&l.indexOf(o.substr(0,1))!==-1&&l.indexOf(o.substr(1,1))!==-1&&l.indexOf(o.substr(2,1))!==-1&&(t.axis=o)},approx:function(){t.approx=!0},over:function(){t.over=!0}};for(i in e)r=e[i],i in a?(s=a[i],typeof s=="function"?s(r):t[s]=r):t[i]=r;return typeof t.datumCode=="string"&&t.datumCode!=="WGS84"&&(t.datumCode=t.datumCode.toLowerCase()),t.projStr=n,t}var Uc=class{static getId(t){let e=t.find(i=>Array.isArray(i)&&i[0]==="ID");return e&&e.length>=3?{authority:e[1],code:parseInt(e[2],10)}:null}static convertUnit(t,e="unit"){if(!t||t.length<3)return{type:e,name:"unknown",conversion_factor:null};let i=t[1],r=parseFloat(t[2])||null,s=t.find(o=>Array.isArray(o)&&o[0]==="ID"),a=s?{authority:s[1],code:parseInt(s[2],10)}:null;return{type:e,name:i,conversion_factor:r,id:a}}static convertAxis(t){let e=t[1]||"Unknown",i,r=e.match(/^\((.)\)$/);if(r){let c=r[1].toUpperCase();if(c==="E")i="east";else if(c==="N")i="north";else if(c==="U")i="up";else if(t[2])i=t[2];else throw new Error(`Unknown axis abbreviation: ${c}`)}else i=t[2]||"unknown";let s=t.find(c=>Array.isArray(c)&&c[0]==="ORDER"),a=s?parseInt(s[1],10):null,o=t.find(c=>Array.isArray(c)&&(c[0]==="LENGTHUNIT"||c[0]==="ANGLEUNIT"||c[0]==="SCALEUNIT")),l=this.convertUnit(o);return{name:e,direction:i,unit:l,order:a}}static extractAxes(t){return t.filter(e=>Array.isArray(e)&&e[0]==="AXIS").map(e=>this.convertAxis(e)).sort((e,i)=>(e.order||0)-(i.order||0))}static convert(t,e={}){switch(t[0]){case"PROJCRS":e.type="ProjectedCRS",e.name=t[1],e.base_crs=t.find(d=>Array.isArray(d)&&d[0]==="BASEGEOGCRS")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="BASEGEOGCRS")):null,e.conversion=t.find(d=>Array.isArray(d)&&d[0]==="CONVERSION")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="CONVERSION")):null;let i=t.find(d=>Array.isArray(d)&&d[0]==="CS");i&&(e.coordinate_system={type:i[1],axis:this.extractAxes(t)});let r=t.find(d=>Array.isArray(d)&&d[0]==="LENGTHUNIT");if(r){let d=this.convertUnit(r);e.coordinate_system.unit=d}e.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":case"GEODCRS":e.type=t[0]==="GEODCRS"?"GeodeticCRS":"GeographicCRS",e.name=t[1];let s=t.find(d=>Array.isArray(d)&&(d[0]==="DATUM"||d[0]==="ENSEMBLE"));if(s){let d=this.convert(s);s[0]==="ENSEMBLE"?e.datum_ensemble=d:e.datum=d;let g=t.find(y=>Array.isArray(y)&&y[0]==="PRIMEM");g&&g[1]!=="Greenwich"&&(d.prime_meridian={name:g[1],longitude:parseFloat(g[2])})}e.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(t)},e.id=this.getId(t);break;case"DATUM":e.type="GeodeticReferenceFrame",e.name=t[1],e.ellipsoid=t.find(d=>Array.isArray(d)&&d[0]==="ELLIPSOID")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="ELLIPSOID")):null;break;case"ENSEMBLE":e.type="DatumEnsemble",e.name=t[1],e.members=t.filter(d=>Array.isArray(d)&&d[0]==="MEMBER").map(d=>({type:"DatumEnsembleMember",name:d[1],id:this.getId(d)}));let a=t.find(d=>Array.isArray(d)&&d[0]==="ENSEMBLEACCURACY");a&&(e.accuracy=parseFloat(a[1]));let o=t.find(d=>Array.isArray(d)&&d[0]==="ELLIPSOID");o&&(e.ellipsoid=this.convert(o)),e.id=this.getId(t);break;case"ELLIPSOID":e.type="Ellipsoid",e.name=t[1],e.semi_major_axis=parseFloat(t[2]),e.inverse_flattening=parseFloat(t[3]);let l=t.find(d=>Array.isArray(d)&&d[0]==="LENGTHUNIT")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="LENGTHUNIT"),e):null;break;case"CONVERSION":e.type="Conversion",e.name=t[1],e.method=t.find(d=>Array.isArray(d)&&d[0]==="METHOD")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="METHOD")):null,e.parameters=t.filter(d=>Array.isArray(d)&&d[0]==="PARAMETER").map(d=>this.convert(d));break;case"METHOD":e.type="Method",e.name=t[1],e.id=this.getId(t);break;case"PARAMETER":e.type="Parameter",e.name=t[1],e.value=parseFloat(t[2]),e.unit=this.convertUnit(t.find(d=>Array.isArray(d)&&(d[0]==="LENGTHUNIT"||d[0]==="ANGLEUNIT"||d[0]==="SCALEUNIT"))),e.id=this.getId(t);break;case"BOUNDCRS":e.type="BoundCRS";let c=t.find(d=>Array.isArray(d)&&d[0]==="SOURCECRS");if(c){let d=c.find(g=>Array.isArray(g));e.source_crs=d?this.convert(d):null}let h=t.find(d=>Array.isArray(d)&&d[0]==="TARGETCRS");if(h){let d=h.find(g=>Array.isArray(g));e.target_crs=d?this.convert(d):null}let u=t.find(d=>Array.isArray(d)&&d[0]==="ABRIDGEDTRANSFORMATION");u?e.transformation=this.convert(u):e.transformation=null;break;case"ABRIDGEDTRANSFORMATION":if(e.type="Transformation",e.name=t[1],e.method=t.find(d=>Array.isArray(d)&&d[0]==="METHOD")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="METHOD")):null,e.parameters=t.filter(d=>Array.isArray(d)&&(d[0]==="PARAMETER"||d[0]==="PARAMETERFILE")).map(d=>{if(d[0]==="PARAMETER")return this.convert(d);if(d[0]==="PARAMETERFILE")return{name:d[1],value:d[2],id:{authority:"EPSG",code:8656}}}),e.parameters.length===7){let d=e.parameters[6];d.name==="Scale difference"&&(d.value=Math.round((d.value-1)*1e12)/1e6)}e.id=this.getId(t);break;case"AXIS":e.coordinate_system||(e.coordinate_system={type:"unspecified",axis:[]}),e.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":let m=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(d=>{d.unit||(d.unit=m)}),m.conversion_factor&&m.conversion_factor!==1&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:m});break;default:e.keyword=t[0];break}return e}},Xa=Uc;var Fc=class extends Xa{static convert(t,e={}){return super.convert(t,e),e.coordinate_system&&e.coordinate_system.subtype==="Cartesian"&&delete e.coordinate_system,e.usage&&delete e.usage,e}},yd=Fc;var Oc=class extends Xa{static convert(t,e={}){super.convert(t,e);let i=t.find(s=>Array.isArray(s)&&s[0]==="CS");i&&(e.coordinate_system={subtype:i[1],axis:this.extractAxes(t)});let r=t.find(s=>Array.isArray(s)&&s[0]==="USAGE");if(r){let s=r.find(l=>Array.isArray(l)&&l[0]==="SCOPE"),a=r.find(l=>Array.isArray(l)&&l[0]==="AREA"),o=r.find(l=>Array.isArray(l)&&l[0]==="BBOX");e.usage={},s&&(e.usage.scope=s[1]),a&&(e.usage.area=a[1]),o&&(e.usage.bbox=o.slice(1))}return e}},vd=Oc;function HM(n){return n.find(t=>Array.isArray(t)&&t[0]==="USAGE")?"2019":(n.find(t=>Array.isArray(t)&&t[0]==="CS")||n[0]==="BOUNDCRS"||n[0]==="PROJCRS"||n[0]==="GEOGCRS","2015")}function xd(n){return(HM(n)==="2019"?vd:yd).convert(n)}function Md(n){let t=n.toUpperCase();return t.includes("PROJCRS")||t.includes("GEOGCRS")||t.includes("BOUNDCRS")||t.includes("VERTCRS")||t.includes("LENGTHUNIT")||t.includes("ANGLEUNIT")||t.includes("SCALEUNIT")?"WKT2":(t.includes("PROJCS")||t.includes("GEOGCS")||t.includes("LOCAL_CS")||t.includes("VERT_CS")||t.includes("UNIT"),"WKT1")}var Sd=YM,$r=1,bd=2,wd=3,qa=4,Ed=5,Bc=-1,WM=/\s/,XM=/[A-Za-z]/,qM=/[A-Za-z84_]/,Ya=/[,\]]/,Td=/[\d\.E\-\+]/;function pn(n){if(typeof n!="string")throw new Error("not a string");this.text=n.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=$r}pn.prototype.readCharicter=function(){var n=this.text[this.place++];if(this.state!==qa)for(;WM.test(n);){if(this.place>=this.text.length)return;n=this.text[this.place++]}switch(this.state){case $r:return this.neutral(n);case bd:return this.keyword(n);case qa:return this.quoted(n);case Ed:return this.afterquote(n);case wd:return this.number(n);case Bc:return}};pn.prototype.afterquote=function(n){if(n==='"'){this.word+='"',this.state=qa;return}if(Ya.test(n)){this.word=this.word.trim(),this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in afterquote yet, index '+this.place)};pn.prototype.afterItem=function(n){if(n===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=$r;return}if(n==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=$r,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Bc);return}};pn.prototype.number=function(n){if(Td.test(n)){this.word+=n;return}if(Ya.test(n)){this.word=parseFloat(this.word),this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in number yet, index '+this.place)};pn.prototype.quoted=function(n){if(n==='"'){this.state=Ed;return}this.word+=n};pn.prototype.keyword=function(n){if(qM.test(n)){this.word+=n;return}if(n==="["){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=$r;return}if(Ya.test(n)){this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in keyword yet, index '+this.place)};pn.prototype.neutral=function(n){if(XM.test(n)){this.word=n,this.state=bd;return}if(n==='"'){this.word="",this.state=qa;return}if(Td.test(n)){this.word=n,this.state=wd;return}if(Ya.test(n)){this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in neutral yet, index '+this.place)};pn.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Bc)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function YM(n){var t=new pn(n);return t.output()}function Gc(n,t,e){Array.isArray(t)&&(e.unshift(t),t=null);var i=t?{}:n,r=e.reduce(function(s,a){return si(a,s),s},i);t&&(n[t]=r)}function si(n,t){if(!Array.isArray(n)){t[n]=!0;return}var e=n.shift();if(e==="PARAMETER"&&(e=n.shift()),n.length===1){if(Array.isArray(n[0])){t[e]={},si(n[0],t[e]);return}t[e]=n[0];return}if(!n.length){t[e]=!0;return}if(e==="TOWGS84"){t[e]=n;return}if(e==="AXIS"){e in t||(t[e]=[]),t[e].push(n);return}Array.isArray(e)||(t[e]={});var i;switch(e){case"UNIT":case"PRIMEM":case"VERT_DATUM":t[e]={name:n[0].toLowerCase(),convert:n[1]},n.length===3&&si(n[2],t[e]);return;case"SPHEROID":case"ELLIPSOID":t[e]={name:n[0],a:n[1],rf:n[2]},n.length===4&&si(n[3],t[e]);return;case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":n[0]=["name",n[0]],Gc(t,e,n);return;case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":n[0]=["name",n[0]],Gc(t,e,n),t[e].type=e;return;default:for(i=-1;++i<n.length;)if(!Array.isArray(n[i]))return si(n,t[e]);return Gc(t,e,n)}}var jM=.017453292519943295;function me(n){return n*jM}function ja(n){let t=(n.projName||"").toLowerCase().replace(/_/g," ");n.long0===void 0&&n.longc!==void 0&&(n.long0=n.longc),!n.lat_ts&&n.lat1&&(t==="stereographic south pole"||t==="polar stereographic (variant b)")?(n.lat0=me(n.lat1>0?90:-90),n.lat_ts=n.lat1,delete n.lat1):!n.lat_ts&&n.lat0&&(t==="polar stereographic"||t==="polar stereographic (variant a)")&&(n.lat_ts=n.lat0,n.lat0=me(n.lat0>0?90:-90),delete n.lat1)}function Ad(n){let t={units:null,to_meter:void 0};return typeof n=="string"?(t.units=n.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.units==="meter"&&(t.to_meter=1)):n&&n.name&&(t.units=n.name.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.to_meter=n.conversion_factor),t}function Cd(n){return typeof n=="object"?n.value*n.unit.conversion_factor:n}function Pd(n,t){n.ellipsoid.radius?(t.a=n.ellipsoid.radius,t.rf=0):(t.a=Cd(n.ellipsoid.semi_major_axis),n.ellipsoid.inverse_flattening!==void 0?t.rf=n.ellipsoid.inverse_flattening:n.ellipsoid.semi_major_axis!==void 0&&n.ellipsoid.semi_minor_axis!==void 0&&(t.rf=t.a/(t.a-Cd(n.ellipsoid.semi_minor_axis))))}function Kr(n,t={}){return!n||typeof n!="object"?n:n.type==="BoundCRS"?(Kr(n.source_crs,t),n.transformation&&(n.transformation.method&&n.transformation.method.name==="NTv2"?t.nadgrids=n.transformation.parameters[0].value:t.datum_params=n.transformation.parameters.map(e=>e.value)),t):(Object.keys(n).forEach(e=>{let i=n[e];if(i!==null)switch(e){case"name":if(t.srsCode)break;t.name=i,t.srsCode=i;break;case"type":i==="GeographicCRS"?t.projName="longlat":i==="GeodeticCRS"?n.coordinate_system&&n.coordinate_system.subtype==="Cartesian"?t.projName="geocent":t.projName="longlat":i==="ProjectedCRS"&&n.conversion&&n.conversion.method&&(t.projName=n.conversion.method.name);break;case"datum":case"datum_ensemble":i.ellipsoid&&(t.ellps=i.ellipsoid.name,Pd(i,t)),i.prime_meridian&&(t.from_greenwich=i.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":t.ellps=i.name,Pd(i,t);break;case"prime_meridian":t.long0=(i.longitude||0)*Math.PI/180;break;case"coordinate_system":if(i.axis){let r={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},s=i.axis.map(a=>r[a.direction.toLowerCase()]);if(s.every(Boolean)&&(t.axis=s.join(""),t.axis.length===2&&(t.axis+="u")),i.unit){let{units:a,to_meter:o}=Ad(i.unit);t.units=a,t.to_meter=o}else if(i.axis[0]&&i.axis[0].unit){let{units:a,to_meter:o}=Ad(i.axis[0].unit);t.units=a,t.to_meter=o}}break;case"id":i.authority&&i.code&&(t.title=i.authority+":"+i.code);break;case"conversion":i.method&&i.method.name&&(t.projName=i.method.name),i.parameters&&i.parameters.forEach(r=>{let s=r.name.toLowerCase().replace(/\s+/g,"_"),a=r.value;r.unit&&r.unit.conversion_factor?t[s]=a*r.unit.conversion_factor:r.unit==="degree"?t[s]=a*Math.PI/180:t[s]=a});break;case"unit":i.name&&(t.units=i.name.toLowerCase(),t.units==="metre"&&(t.units="meter")),i.conversion_factor&&(t.to_meter=i.conversion_factor);break;case"base_crs":Kr(i,t),t.datumCode=i.id?i.id.authority+"_"+i.id.code:i.name;break;default:break}}),t.latitude_of_false_origin!==void 0&&(t.lat0=t.latitude_of_false_origin),t.longitude_of_false_origin!==void 0&&(t.long0=t.longitude_of_false_origin),t.latitude_of_standard_parallel!==void 0&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),t.latitude_of_1st_standard_parallel!==void 0&&(t.lat1=t.latitude_of_1st_standard_parallel),t.latitude_of_2nd_standard_parallel!==void 0&&(t.lat2=t.latitude_of_2nd_standard_parallel),t.latitude_of_projection_centre!==void 0&&(t.lat0=t.latitude_of_projection_centre),t.longitude_of_projection_centre!==void 0&&(t.longc=t.longitude_of_projection_centre),t.easting_at_false_origin!==void 0&&(t.x0=t.easting_at_false_origin),t.northing_at_false_origin!==void 0&&(t.y0=t.northing_at_false_origin),t.latitude_of_natural_origin!==void 0&&(t.lat0=t.latitude_of_natural_origin),t.longitude_of_natural_origin!==void 0&&(t.long0=t.longitude_of_natural_origin),t.longitude_of_origin!==void 0&&(t.long0=t.longitude_of_origin),t.false_easting!==void 0&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),t.false_northing!==void 0&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),t.standard_parallel_1!==void 0&&(t.lat1=t.standard_parallel_1),t.standard_parallel_2!==void 0&&(t.lat2=t.standard_parallel_2),t.scale_factor_at_natural_origin!==void 0&&(t.k0=t.scale_factor_at_natural_origin),t.scale_factor_at_projection_centre!==void 0&&(t.k0=t.scale_factor_at_projection_centre),t.scale_factor_on_pseudo_standard_parallel!==void 0&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),t.azimuth!==void 0&&(t.alpha=t.azimuth),t.azimuth_at_projection_centre!==void 0&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),ja(t),t)}var ZM=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function JM(n,t){var e=t[0],i=t[1];!(e in n)&&i in n&&(n[e]=n[i],t.length===3&&(n[e]=t[2](n[e])))}function Rd(n){for(var t=Object.keys(n),e=0,i=t.length;e<i;++e){var r=t[e];ZM.indexOf(r)!==-1&&$M(n[r]),typeof n[r]=="object"&&Rd(n[r])}}function $M(n){if(n.AUTHORITY){var t=Object.keys(n.AUTHORITY)[0];t&&t in n.AUTHORITY&&(n.title=t+":"+n.AUTHORITY[t])}if(n.type==="GEOGCS"?n.projName="longlat":n.type==="LOCAL_CS"?(n.projName="identity",n.local=!0):typeof n.PROJECTION=="object"?n.projName=Object.keys(n.PROJECTION)[0]:n.projName=n.PROJECTION,n.AXIS){for(var e="",i=0,r=n.AXIS.length;i<r;++i){var s=[n.AXIS[i][0].toLowerCase(),n.AXIS[i][1].toLowerCase()];s[0].indexOf("north")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="north"?e+="n":s[0].indexOf("south")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="south"?e+="s":s[0].indexOf("east")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="east"?e+="e":(s[0].indexOf("west")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="west")&&(e+="w")}e.length===2&&(e+="u"),e.length===3&&(n.axis=e)}n.UNIT&&(n.units=n.UNIT.name.toLowerCase(),n.units==="metre"&&(n.units="meter"),n.UNIT.convert&&(n.type==="GEOGCS"?n.DATUM&&n.DATUM.SPHEROID&&(n.to_meter=n.UNIT.convert*n.DATUM.SPHEROID.a):n.to_meter=n.UNIT.convert));var a=n.GEOGCS;n.type==="GEOGCS"&&(a=n),a&&(a.PRIMEM&&a.PRIMEM.convert&&(n.from_greenwich=me(a.PRIMEM.convert)),a.DATUM?n.datumCode=a.DATUM.name.toLowerCase():n.datumCode=a.name.toLowerCase(),n.datumCode.slice(0,2)==="d_"&&(n.datumCode=n.datumCode.slice(2)),n.datumCode==="new_zealand_1949"&&(n.datumCode="nzgd49"),(n.datumCode==="wgs_1984"||n.datumCode==="world_geodetic_system_1984")&&(n.PROJECTION==="Mercator_Auxiliary_Sphere"&&(n.sphere=!0),n.datumCode="wgs84"),n.datumCode==="belge_1972"&&(n.datumCode="rnb72"),a.DATUM&&a.DATUM.SPHEROID&&(n.ellps=a.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),n.ellps.toLowerCase().slice(0,13)==="international"&&(n.ellps="intl"),n.a=a.DATUM.SPHEROID.a,n.rf=parseFloat(a.DATUM.SPHEROID.rf)),a.DATUM&&a.DATUM.TOWGS84&&(n.datum_params=a.DATUM.TOWGS84),~n.datumCode.indexOf("osgb_1936")&&(n.datumCode="osgb36"),~n.datumCode.indexOf("osni_1952")&&(n.datumCode="osni52"),(~n.datumCode.indexOf("tm65")||~n.datumCode.indexOf("geodetic_datum_of_1965"))&&(n.datumCode="ire65"),n.datumCode==="ch1903+"&&(n.datumCode="ch1903"),~n.datumCode.indexOf("israel")&&(n.datumCode="isr93")),n.b&&!isFinite(n.b)&&(n.b=n.a),n.rectified_grid_angle&&(n.rectified_grid_angle=me(n.rectified_grid_angle));function o(h){var u=n.to_meter||1;return h*u}var l=function(h){return JM(n,h)},c=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",me],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",me],["x0","false_easting",o],["y0","false_northing",o],["long0","central_meridian",me],["lat0","latitude_of_origin",me],["lat0","standard_parallel_1",me],["lat1","standard_parallel_1",me],["lat2","standard_parallel_2",me],["azimuth","Azimuth"],["alpha","azimuth",me],["srsCode","name"]];c.forEach(l),ja(n)}function qn(n){if(typeof n=="object")return Kr(n);let t=Md(n);var e=Sd(n);if(t==="WKT2"){let s=xd(e);return Kr(s)}var i=e[0],r={};return si(e,r),Rd(r),r[i]}function re(n){var t=this;if(arguments.length===2){var e=arguments[1];typeof e=="string"?e.charAt(0)==="+"?re[n]=Jr(arguments[1]):re[n]=qn(arguments[1]):e&&typeof e=="object"&&!("projName"in e)?re[n]=qn(arguments[1]):(re[n]=e,e||delete re[n])}else if(arguments.length===1){if(Array.isArray(n))return n.map(function(i){return Array.isArray(i)?re.apply(t,i):re(i)});if(typeof n=="string"){if(n in re)return re[n]}else"EPSG"in n?re["EPSG:"+n.EPSG]=n:"ESRI"in n?re["ESRI:"+n.ESRI]=n:"IAU2000"in n?re["IAU2000:"+n.IAU2000]=n:console.log(n);return}}cd(re);var qi=re;function KM(n){return typeof n=="string"}function QM(n){return n in qi}function tS(n){return n.indexOf("+")!==0&&n.indexOf("[")!==-1||typeof n=="object"&&!("srsCode"in n)}var Id=["3857","900913","3785","102113"];function eS(n){if(n.title)return n.title.toLowerCase().indexOf("epsg:")===0&&Id.indexOf(n.title.substr(5))>-1;var t=pe(n,"authority");if(t){var e=pe(t,"epsg");return e&&Id.indexOf(e)>-1}}function nS(n){var t=pe(n,"extension");if(t)return pe(t,"proj4")}function iS(n){return n[0]==="+"}function rS(n){let t;if(KM(n))if(QM(n))t=qi[n];else if(tS(n)){t=qn(n);var e=nS(t);e&&(t=Jr(e))}else iS(n)&&(t=Jr(n));else"projName"in n?t=n:t=qn(n);return t&&eS(t)?qi["EPSG:3857"]:t}var Za=rS;function zc(n,t){n=n||{};var e,i;if(!t)return n;for(i in t)e=t[i],e!==void 0&&(n[i]=e);return n}function Wt(n,t,e){var i=n*t;return e/Math.sqrt(1-i*i)}function qe(n){return n<0?-1:1}function N(n,t){return t||Math.abs(n)<=vt?n:n-qe(n)*Xn}function Jt(n,t,e){var i=n*e,r=.5*n;return i=Math.pow((1-i)/(1+i),r),Math.tan(.5*(T-t))/i}function mn(n,t){for(var e=.5*n,i,r,s=T-2*Math.atan(t),a=0;a<=15;a++)if(i=n*Math.sin(s),r=T-2*Math.atan(t*Math.pow((1-i)/(1+i),e))-s,s+=r,Math.abs(r)<=1e-10)return s;return-9999}function sS(){var n=this.b/this.a;this.es=1-n*n,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.long0=this.long0||0,this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Wt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function aS(n){var t=n.x,e=n.y;if(e*Pt>90&&e*Pt<-90&&t*Pt>180&&t*Pt<-180)return null;var i,r;if(Math.abs(Math.abs(e)-T)<=D)return null;if(this.sphere)i=this.x0+this.a*this.k0*N(t-this.long0,this.over),r=this.y0+this.a*this.k0*Math.log(Math.tan(st+.5*e));else{var s=Math.sin(e),a=Jt(this.e,e,s);i=this.x0+this.a*this.k0*N(t-this.long0,this.over),r=this.y0-this.a*this.k0*Math.log(a)}return n.x=i,n.y=r,n}function oS(n){var t=n.x-this.x0,e=n.y-this.y0,i,r;if(this.sphere)r=T-2*Math.atan(Math.exp(-e/(this.a*this.k0)));else{var s=Math.exp(-e/(this.a*this.k0));if(r=mn(this.e,s),r===-9999)return null}return i=N(this.long0+t/(this.a*this.k0),this.over),n.x=i,n.y=r,n}var lS=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"],Ld={init:sS,forward:aS,inverse:oS,names:lS};function cS(){}function Nd(n){return n}var kc=["longlat","identity","lonlat","latlon","latlong"],Dd={init:cS,forward:Nd,inverse:Nd,names:kc};var hS=[Ld,Dd],ai={},Yi=[];function Ud(n,t){var e=Yi.length;return n.names?(Yi[e]=n,n.names.forEach(function(i){ai[i.toLowerCase()]=e}),this):(console.log(t),!0)}function Vc(n){return n.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}function uS(n){if(!n)return!1;var t=n.toLowerCase();if(typeof ai[t]<"u"&&Yi[ai[t]]||(t=Vc(t),t in ai&&Yi[ai[t]]))return Yi[ai[t]]}function fS(){hS.forEach(Ud)}var Fd={start:fS,add:Ud,get:uS};var dS={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,b:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},Hc=dS;var pS=Hc.WGS84;function Od(n,t,e,i){var r=n*n,s=t*t,a=(r-s)/r,o=0;i?(n*=1-a*(fd+a*(dd+a*pd)),r=n*n,a=0):o=Math.sqrt(a);var l=(r-s)/s;return{es:a,e:o,ep2:l}}function Bd(n,t,e,i,r){if(!n){var s=pe(Hc,i);s||(s=pS),n=s.a,t=s.b,e=s.rf}return e&&!t&&(t=(1-1/e)*n),(e===0||Math.abs(n-t)<D)&&(r=!0,t=n),{a:n,b:t,rf:e,sphere:r}}var $a={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clrk80ign",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(Gd in $a)Ja=$a[Gd],Ja.datumName&&($a[Ja.datumName]=Ja);var Ja,Gd,zd=$a;function mS(n,t,e,i,r,s,a){var o={};return o.datum_type=Zr,t&&(o.datum_type=hd,o.datum_params=t.map(parseFloat),(o.datum_params[0]!==0||o.datum_params[1]!==0||o.datum_params[2]!==0)&&(o.datum_type=Ie),o.datum_params.length>3&&(o.datum_params[3]!==0||o.datum_params[4]!==0||o.datum_params[5]!==0||o.datum_params[6]!==0)&&(o.datum_type=Le,o.datum_params[3]*=ri,o.datum_params[4]*=ri,o.datum_params[5]*=ri,o.datum_params[6]=o.datum_params[6]/1e6+1)),a&&(o.datum_type=dn,o.grids=a),o.a=e,o.b=i,o.es=r,o.ep2=s,o}var kd=mS;var Xc={};function qc(n,t,e){return t instanceof ArrayBuffer?gS(n,t,e):{ready:_S(n,t)}}function gS(n,t,e){var i=!0;e!==void 0&&e.includeErrorFields===!1&&(i=!1);var r=new DataView(t),s=vS(r),a=xS(r,s),o=MS(r,a,s,i),l={header:a,subgrids:o};return Xc[n]=l,l}async function _S(n,t){for(var e=[],i=await t.getImageCount(),r=i-1;r>=0;r--){var s=await t.getImage(r),a=await s.readRasters(),o=a,l=[s.getWidth(),s.getHeight()],c=s.getBoundingBox().map(Vd),h=typeof s.fileDirectory.getValue=="function"?s.fileDirectory.getValue("ModelPixelScale"):s.fileDirectory.ModelPixelScale,u=[h[0],h[1]].map(Vd),m=c[0]+(l[0]-1)*u[0],d=c[3]-(l[1]-1)*u[1],g=o[0],y=o[1],v=[];for(let I=l[1]-1;I>=0;I--)for(let U=l[0]-1;U>=0;U--){var S=I*l[0]+U;v.push([-Yn(y[S]),Yn(g[S])])}e.push({del:u,lim:l,ll:[-m,d],cvs:v})}var w={header:{nSubgrids:i},subgrids:e};return Xc[n]=w,w}function Hd(n){if(n===void 0)return null;var t=n.split(",");return t.map(yS)}function yS(n){if(n.length===0)return null;var t=n[0]==="@";return t&&(n=n.slice(1)),n==="null"?{name:"null",mandatory:!t,grid:null,isNull:!0}:{name:n,mandatory:!t,grid:Xc[n]||null,isNull:!1}}function Vd(n){return n*Math.PI/180}function Yn(n){return n/3600*Math.PI/180}function vS(n){var t=n.getInt32(8,!1);return t===11?!1:(t=n.getInt32(8,!0),t!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function xS(n,t){return{nFields:n.getInt32(8,t),nSubgridFields:n.getInt32(24,t),nSubgrids:n.getInt32(40,t),shiftType:Wc(n,56,64).trim(),fromSemiMajorAxis:n.getFloat64(120,t),fromSemiMinorAxis:n.getFloat64(136,t),toSemiMajorAxis:n.getFloat64(152,t),toSemiMinorAxis:n.getFloat64(168,t)}}function Wc(n,t,e){return String.fromCharCode.apply(null,new Uint8Array(n.buffer.slice(t,e)))}function MS(n,t,e,i){for(var r=176,s=[],a=0;a<t.nSubgrids;a++){var o=bS(n,r,e),l=wS(n,r,o,e,i),c=Math.round(1+(o.upperLongitude-o.lowerLongitude)/o.longitudeInterval),h=Math.round(1+(o.upperLatitude-o.lowerLatitude)/o.latitudeInterval);s.push({ll:[Yn(o.lowerLongitude),Yn(o.lowerLatitude)],del:[Yn(o.longitudeInterval),Yn(o.latitudeInterval)],lim:[c,h],count:o.gridNodeCount,cvs:SS(l)});var u=16;i===!1&&(u=8),r+=176+o.gridNodeCount*u}return s}function SS(n){return n.map(function(t){return[Yn(t.longitudeShift),Yn(t.latitudeShift)]})}function bS(n,t,e){return{name:Wc(n,t+8,t+16).trim(),parent:Wc(n,t+24,t+24+8).trim(),lowerLatitude:n.getFloat64(t+72,e),upperLatitude:n.getFloat64(t+88,e),lowerLongitude:n.getFloat64(t+104,e),upperLongitude:n.getFloat64(t+120,e),latitudeInterval:n.getFloat64(t+136,e),longitudeInterval:n.getFloat64(t+152,e),gridNodeCount:n.getInt32(t+168,e)}}function wS(n,t,e,i,r){var s=t+176,a=16;r===!1&&(a=8);for(var o=[],l=0;l<e.gridNodeCount;l++){var c={latitudeShift:n.getFloat32(s+l*a,i),longitudeShift:n.getFloat32(s+l*a+4,i)};r!==!1&&(c.latitudeAccuracy=n.getFloat32(s+l*a+8,i),c.longitudeAccuracy=n.getFloat32(s+l*a+12,i)),o.push(c)}return o}function ji(n,t){if(!(this instanceof ji))return new ji(n);this.forward=null,this.inverse=null,this.init=null,this.name,this.axis,this.names=null,this.title,t=t||function(c){if(c)throw c};var e=Za(n);if(typeof e!="object"){t("Could not parse to valid json: "+n);return}var i=ji.projections.get(e.projName);if(!i){t("Could not get projection name from: "+n);return}if(e.datumCode&&e.datumCode!=="none"){var r=pe(zd,e.datumCode);r&&(e.datum_params=e.datum_params||(r.towgs84?r.towgs84.split(","):null),e.ellps=r.ellipse,e.datumName=r.datumName?r.datumName:e.datumCode)}e.axis=e.axis||"enu",e.ellps=e.ellps||"wgs84",e.lat1=e.lat1||e.lat0;var s=Bd(e.a,e.b,e.rf,e.ellps,e.sphere),a=Od(s.a,s.b,s.rf,e.R_A),o=Hd(e.nadgrids),l=e.datum||kd(e.datumCode,e.datum_params,s.a,s.b,a.es,a.ep2,o);zc(this,e),zc(this,i),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=a.es,this.e=a.e,this.ep2=a.ep2,this.datum=l,"init"in this&&typeof this.init=="function"&&this.init(),this.k0||(this.k0=1),t(null,this)}ji.projections=Fd;ji.projections.start();var Ne=ji;function Wd(n,t){return n.datum_type!==t.datum_type||n.a!==t.a||Math.abs(n.es-t.es)>5e-11?!1:n.datum_type===Ie?n.datum_params[0]===t.datum_params[0]&&n.datum_params[1]===t.datum_params[1]&&n.datum_params[2]===t.datum_params[2]:n.datum_type===Le?n.datum_params[0]===t.datum_params[0]&&n.datum_params[1]===t.datum_params[1]&&n.datum_params[2]===t.datum_params[2]&&n.datum_params[3]===t.datum_params[3]&&n.datum_params[4]===t.datum_params[4]&&n.datum_params[5]===t.datum_params[5]&&n.datum_params[6]===t.datum_params[6]:!0}function Ka(n,t,e){var i=n.x,r=n.y,s=n.z?n.z:0,a,o,l,c;if(r<-T&&r>-1.001*T)r=-T;else if(r>T&&r<1.001*T)r=T;else{if(r<-T)return{x:-1/0,y:-1/0,z:n.z};if(r>T)return{x:1/0,y:1/0,z:n.z}}return i>Math.PI&&(i-=2*Math.PI),o=Math.sin(r),c=Math.cos(r),l=o*o,a=e/Math.sqrt(1-t*l),{x:(a+s)*c*Math.cos(i),y:(a+s)*c*Math.sin(i),z:(a*(1-t)+s)*o}}function Qa(n,t,e,i){var r=1e-12,s=r*r,a=30,o,l,c,h,u,m,d,g,y,v,S,w,I,U=n.x,R=n.y,V=n.z?n.z:0,B,G,Y;if(o=Math.sqrt(U*U+R*R),l=Math.sqrt(U*U+R*R+V*V),o/e<r){if(B=0,l/e<r)return G=T,Y=-i,{x:n.x,y:n.y,z:n.z}}else B=Math.atan2(R,U);c=V/l,h=o/l,u=1/Math.sqrt(1-t*(2-t)*h*h),g=h*(1-t)*u,y=c*u,I=0;do I++,d=e/Math.sqrt(1-t*y*y),Y=o*g+V*y-d*(1-t*y*y),m=t*d/(d+Y),u=1/Math.sqrt(1-m*(2-m)*h*h),v=h*(1-m)*u,S=c*u,w=S*g-v*y,g=v,y=S;while(w*w>s&&I<a);return G=Math.atan(S/Math.abs(v)),{x:B,y:G,z:Y}}function Xd(n,t,e){if(t===Ie)return{x:n.x+e[0],y:n.y+e[1],z:n.z+e[2]};if(t===Le){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6];return{x:c*(n.x-l*n.y+o*n.z)+i,y:c*(l*n.x+n.y-a*n.z)+r,z:c*(-o*n.x+a*n.y+n.z)+s}}}function qd(n,t,e){if(t===Ie)return{x:n.x-e[0],y:n.y-e[1],z:n.z-e[2]};if(t===Le){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],h=(n.x-i)/c,u=(n.y-r)/c,m=(n.z-s)/c;return{x:h+l*u-o*m,y:-l*h+u+a*m,z:o*h-a*u+m}}}function to(n){return n===Ie||n===Le}function Zd(n,t,e){if(Wd(n,t)||n.datum_type===Zr||t.datum_type===Zr)return e;var i=n.a,r=n.es;if(n.datum_type===dn){var s=Yd(n,!1,e);if(s!==0)return;i=Nc,r=Dc}var a=t.a,o=t.b,l=t.es;if(t.datum_type===dn&&(a=Nc,o=ud,l=Dc),r===l&&i===a&&!to(n.datum_type)&&!to(t.datum_type))return e;if(e=Ka(e,r,i),to(n.datum_type)&&(e=Xd(e,n.datum_type,n.datum_params)),to(t.datum_type)&&(e=qd(e,t.datum_type,t.datum_params)),e=Qa(e,l,a,o),t.datum_type===dn){var c=Yd(t,!0,e);if(c!==0)return}return e}function Yd(n,t,e){if(n.grids===null||n.grids.length===0)return console.log("Grid shift grids not found"),-1;var i={x:-e.x,y:e.y},r={x:Number.NaN,y:Number.NaN},s=[];t:for(var a=0;a<n.grids.length;a++){var o=n.grids[a];if(s.push(o.name),o.isNull){r=i;break}if(o.grid===null){if(o.mandatory)return console.log("Unable to find mandatory grid '"+o.name+"'"),-1;continue}for(var l=o.grid.subgrids,c=0,h=l.length;c<h;c++){var u=l[c],m=(Math.abs(u.del[1])+Math.abs(u.del[0]))/1e4,d=u.ll[0]-m,g=u.ll[1]-m,y=u.ll[0]+(u.lim[0]-1)*u.del[0]+m,v=u.ll[1]+(u.lim[1]-1)*u.del[1]+m;if(!(g>i.y||d>i.x||v<i.y||y<i.x)&&(r=ES(i,t,u),!isNaN(r.x)))break t}}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-i.x*Pt+" "+i.y*Pt+" tried: '"+s+"'"),-1):(e.x=-r.x,e.y=r.y,0)}function ES(n,t,e){var i={x:Number.NaN,y:Number.NaN};if(isNaN(n.x))return i;var r={x:n.x,y:n.y};r.x-=e.ll[0],r.y-=e.ll[1],r.x=N(r.x-Math.PI)+Math.PI;var s=jd(r,e);if(t){if(isNaN(s.x))return i;s.x=r.x-s.x,s.y=r.y-s.y;var a=9,o=1e-12,l,c;do{if(c=jd(s,e),isNaN(c.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}l={x:r.x-(c.x+s.x),y:r.y-(c.y+s.y)},s.x+=l.x,s.y+=l.y}while(a--&&Math.abs(l.x)>o&&Math.abs(l.y)>o);if(a<0)return console.log("Inverse grid shift iterator failed to converge."),i;i.x=N(s.x+e.ll[0]),i.y=s.y+e.ll[1]}else isNaN(s.x)||(i.x=n.x+s.x,i.y=n.y+s.y);return i}function jd(n,t){var e={x:n.x/t.del[0],y:n.y/t.del[1]},i={x:Math.floor(e.x),y:Math.floor(e.y)},r={x:e.x-1*i.x,y:e.y-1*i.y},s={x:Number.NaN,y:Number.NaN},a;if(i.x<0||i.x>=t.lim[0]||i.y<0||i.y>=t.lim[1])return s;a=i.y*t.lim[0]+i.x;var o={x:t.cvs[a][0],y:t.cvs[a][1]};a++;var l={x:t.cvs[a][0],y:t.cvs[a][1]};a+=t.lim[0];var c={x:t.cvs[a][0],y:t.cvs[a][1]};a--;var h={x:t.cvs[a][0],y:t.cvs[a][1]},u=r.x*r.y,m=r.x*(1-r.y),d=(1-r.x)*(1-r.y),g=(1-r.x)*r.y;return s.x=d*o.x+m*l.x+g*h.x+u*c.x,s.y=d*o.y+m*l.y+g*h.y+u*c.y,s}var oi=["x","y","z"];function Jd(n,t){let e={};for(let i=0,r=n.axis.length;i<r;i++){if(i===2&&t.z===void 0)continue;let s=t[oi[i]];switch(n.axis[i]){case"e":e.x=s;break;case"w":e.x=-s;break;case"n":e.y=s;break;case"s":e.y=-s;break;case"u":e.z=s;break;case"d":e.z=-s;break;default:return null}}return e}function $d(n,t){let e={};for(let i=0,r=n.axis.length;i<r;i++)if(!(i===2&&t.z===void 0))switch(n.axis[i]){case"e":e[oi[i]]=t.x;break;case"w":e[oi[i]]=-t.x;break;case"n":e[oi[i]]=t.y;break;case"s":e[oi[i]]=-t.y;break;case"u":e[oi[i]]=t.z;break;case"d":e[oi[i]]=-t.z;break;default:return null}return e}function Zi(n){var t={x:n[0],y:n[1]};return n.length>2&&(t.z=n[2]),n.length>3&&(t.m=n[3]),t}function Qd(n){Kd(n.x),Kd(n.y)}function Kd(n){if(typeof Number.isFinite=="function"){if(Number.isFinite(n))return;throw new TypeError("coordinates must be finite numbers")}if(typeof n!="number"||n!==n||!isFinite(n))throw new TypeError("coordinates must be finite numbers")}function TS(n,t){return(n.datum.datum_type===Ie||n.datum.datum_type===Le||n.datum.datum_type===dn)&&t.datumCode!=="WGS84"||(t.datum.datum_type===Ie||t.datum.datum_type===Le||t.datum.datum_type===dn)&&n.datumCode!=="WGS84"}function Qr(n,t,e,i){var r,s=e.z!==void 0;if(Qd(e),n.datum&&t.datum&&TS(n,t)&&(r=new Ne("WGS84"),e=Qr(n,r,e,i),n=r),i&&n.axis!=="enu"&&(e=Jd(n,e)),n.projName==="longlat")e={x:e.x*dt,y:e.y*dt,z:e.z||0};else if(n.to_meter&&(e={x:e.x*n.to_meter,y:e.y*n.to_meter,z:e.z||0}),e=n.inverse(e),!e)return;if(n.from_greenwich&&(e.x+=n.from_greenwich),e=Zd(n.datum,t.datum,e),!!e)return e=e,t.from_greenwich&&(e={x:e.x-t.from_greenwich,y:e.y,z:e.z||0}),t.projName==="longlat"?(t.long_wrap!==void 0&&(e.x=t.long_wrap+N(e.x-t.long_wrap)),e={x:e.x*Pt,y:e.y*Pt,z:e.z||0}):(e=t.forward(e),t.to_meter&&(e={x:e.x/t.to_meter,y:e.y/t.to_meter,z:e.z||0})),i&&t.axis!=="enu"?$d(t,e):(e&&!s&&t.projName!=="geocent"&&delete e.z,e)}function Yc(n,t,e,i){var r;return Array.isArray(e)?r=Zi(e):r={x:e.x,y:e.y,z:e.z,m:e.m},Qr(n,t,r,i)}var tp=Ne("WGS84");function jc(n,t,e,i){var r,s,a;return Array.isArray(e)?(r=Qr(n,t,Zi(e),i)||{x:NaN,y:NaN},e.length>2?(s=typeof n.name<"u"&&n.name==="geocent"||typeof t.name<"u"&&t.name==="geocent",s?typeof r.z=="number"?[r.x,r.y,r.z].concat(e.slice(3)):[r.x,r.y,e[2]].concat(e.slice(3)):i&&typeof r.z=="number"?[r.x,r.y,r.z].concat(e.slice(3)):[r.x,r.y].concat(e.slice(2))):[r.x,r.y]):(r=Qr(n,t,{x:e.x,y:e.y,z:e.z,m:e.m},i)||{x:NaN,y:NaN},a=Object.keys(e),a.length===2||(s=typeof n.name<"u"&&n.name==="geocent"||typeof t.name<"u"&&t.name==="geocent",a.forEach(function(o){o==="x"||o==="y"||o==="z"&&(s||i)||(r[o]=e[o])})),r)}function eo(n){return n instanceof Ne?n:typeof n=="object"&&"oProj"in n?n.oProj:Ne(n)}function AS(n,t,e){var i,r,s=!1,a;return typeof t>"u"?(r=eo(n),i=tp,s=!0):(typeof t.x<"u"||Array.isArray(t))&&(e=t,r=eo(n),i=tp,s=!0),i||(i=eo(n)),r||(r=eo(t)),e?jc(i,r,e):(a={forward:function(o,l){return jc(i,r,o,l)},inverse:function(o,l){return jc(r,i,o,l)}},s&&(a.oProj=r),a)}var ep=AS;var np=6,rp="AJSAJS",sp="AFAFAF",Ji=65,se=73,Ee=79,ts=86,es=90,ap={forward:Jc,inverse:CS,toPoint:$c};function Jc(n,t){return t=t||5,IS(PS({lat:n[1],lon:n[0]}),t)}function CS(n){var t=Kc(lp(n.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function $c(n){var t=Kc(lp(n.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function Zc(n){return n*(Math.PI/180)}function ip(n){return 180*(n/Math.PI)}function PS(n){var t=n.lat,e=n.lon,i=6378137,r=.00669438,s=.9996,a,o,l,c,h,u,m,d=Zc(t),g=Zc(e),y,v;v=Math.floor((e+180)/6)+1,e===180&&(v=60),t>=56&&t<64&&e>=3&&e<12&&(v=32),t>=72&&t<84&&(e>=0&&e<9?v=31:e>=9&&e<21?v=33:e>=21&&e<33?v=35:e>=33&&e<42&&(v=37)),a=(v-1)*6-180+3,y=Zc(a),o=r/(1-r),l=i/Math.sqrt(1-r*Math.sin(d)*Math.sin(d)),c=Math.tan(d)*Math.tan(d),h=o*Math.cos(d)*Math.cos(d),u=Math.cos(d)*(g-y),m=i*((1-r/4-3*r*r/64-5*r*r*r/256)*d-(3*r/8+3*r*r/32+45*r*r*r/1024)*Math.sin(2*d)+(15*r*r/256+45*r*r*r/1024)*Math.sin(4*d)-35*r*r*r/3072*Math.sin(6*d));var S=s*l*(u+(1-c+h)*u*u*u/6+(5-18*c+c*c+72*h-58*o)*u*u*u*u*u/120)+5e5,w=s*(m+l*Math.tan(d)*(u*u/2+(5-c+9*h+4*h*h)*u*u*u*u/24+(61-58*c+c*c+600*h-330*o)*u*u*u*u*u*u/720));return t<0&&(w+=1e7),{northing:Math.round(w),easting:Math.round(S),zoneNumber:v,zoneLetter:RS(t)}}function Kc(n){var t=n.northing,e=n.easting,i=n.zoneLetter,r=n.zoneNumber;if(r<0||r>60)return null;var s=.9996,a=6378137,o=.00669438,l,c=(1-Math.sqrt(1-o))/(1+Math.sqrt(1-o)),h,u,m,d,g,y,v,S,w,I=e-5e5,U=t;i<"N"&&(U-=1e7),v=(r-1)*6-180+3,l=o/(1-o),y=U/s,S=y/(a*(1-o/4-3*o*o/64-5*o*o*o/256)),w=S+(3*c/2-27*c*c*c/32)*Math.sin(2*S)+(21*c*c/16-55*c*c*c*c/32)*Math.sin(4*S)+151*c*c*c/96*Math.sin(6*S),h=a/Math.sqrt(1-o*Math.sin(w)*Math.sin(w)),u=Math.tan(w)*Math.tan(w),m=l*Math.cos(w)*Math.cos(w),d=a*(1-o)/Math.pow(1-o*Math.sin(w)*Math.sin(w),1.5),g=I/(h*s);var R=w-h*Math.tan(w)/d*(g*g/2-(5+3*u+10*m-4*m*m-9*l)*g*g*g*g/24+(61+90*u+298*m+45*u*u-252*l-3*m*m)*g*g*g*g*g*g/720);R=ip(R);var V=(g-(1+2*u+m)*g*g*g/6+(5-2*m+28*u-3*m*m+8*l+24*u*u)*g*g*g*g*g/120)/Math.cos(w);V=v+ip(V);var B;if(n.accuracy){var G=Kc({northing:n.northing+n.accuracy,easting:n.easting+n.accuracy,zoneLetter:n.zoneLetter,zoneNumber:n.zoneNumber});B={top:G.lat,right:G.lon,bottom:R,left:V}}else B={lat:R,lon:V};return B}function RS(n){var t="Z";return 84>=n&&n>=72?t="X":72>n&&n>=64?t="W":64>n&&n>=56?t="V":56>n&&n>=48?t="U":48>n&&n>=40?t="T":40>n&&n>=32?t="S":32>n&&n>=24?t="R":24>n&&n>=16?t="Q":16>n&&n>=8?t="P":8>n&&n>=0?t="N":0>n&&n>=-8?t="M":-8>n&&n>=-16?t="L":-16>n&&n>=-24?t="K":-24>n&&n>=-32?t="J":-32>n&&n>=-40?t="H":-40>n&&n>=-48?t="G":-48>n&&n>=-56?t="F":-56>n&&n>=-64?t="E":-64>n&&n>=-72?t="D":-72>n&&n>=-80&&(t="C"),t}function IS(n,t){var e="00000"+n.easting,i="00000"+n.northing;return n.zoneNumber+n.zoneLetter+LS(n.easting,n.northing,n.zoneNumber)+e.substr(e.length-5,t)+i.substr(i.length-5,t)}function LS(n,t,e){var i=op(e),r=Math.floor(n/1e5),s=Math.floor(t/1e5)%20;return NS(r,s,i)}function op(n){var t=n%np;return t===0&&(t=np),t}function NS(n,t,e){var i=e-1,r=rp.charCodeAt(i),s=sp.charCodeAt(i),a=r+n-1,o=s+t,l=!1;a>es&&(a=a-es+Ji-1,l=!0),(a===se||r<se&&a>se||(a>se||r<se)&&l)&&a++,(a===Ee||r<Ee&&a>Ee||(a>Ee||r<Ee)&&l)&&(a++,a===se&&a++),a>es&&(a=a-es+Ji-1),o>ts?(o=o-ts+Ji-1,l=!0):l=!1,(o===se||s<se&&o>se||(o>se||s<se)&&l)&&o++,(o===Ee||s<Ee&&o>Ee||(o>Ee||s<Ee)&&l)&&(o++,o===se&&o++),o>ts&&(o=o-ts+Ji-1);var c=String.fromCharCode(a)+String.fromCharCode(o);return c}function lp(n){if(n&&n.length===0)throw"MGRSPoint coverting from nothing";for(var t=n.length,e=null,i="",r,s=0;!/[A-Z]/.test(r=n.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+n;i+=r,s++}var a=parseInt(i,10);if(s===0||s+3>t)throw"MGRSPoint bad conversion from: "+n;var o=n.charAt(s++);if(o<="A"||o==="B"||o==="Y"||o>="Z"||o==="I"||o==="O")throw"MGRSPoint zone letter "+o+" not handled: "+n;e=n.substring(s,s+=2);for(var l=op(a),c=DS(e.charAt(0),l),h=US(e.charAt(1),l);h<FS(o);)h+=2e6;var u=t-s;if(u%2!==0)throw`MGRSPoint has to have an even number
3845
+ `}),Xa=new jt(1,256,256*256,256*256*256),Cc=255/256,RS=new jt(Cc/Xa.x,Cc/Xa.y,Cc/Xa.z,1/Xa.w),IS=new Fr(2,2);async function NS(i,t){let e=i.image.width,n=i.image.height,r=new Ir,s=new Ur(IS,_d);r.add(s),_d.uniforms.depthTexture.value=i;let a=new Wn(e,n,{format:li,type:ai});t.setRenderTarget(a),t.render(r,new Gr),t.setRenderTarget(null);let o=new Uint8Array(e*n*4);await t.readRenderTargetPixelsAsync(a,0,0,e,n,o);let l=new Float32Array(e*n),c=0,h=new jt;for(let u=0;u<o.length;u+=4){let p=o[u+0]/255,d=o[u+1]/255,_=o[u+2]/255,g=o[u+3]/255;h.set(p,d,_,g);let v=h.dot(RS);l[c]=v,c++}return a.dispose(),l}function LS(i,t){let e=i.renderer.getContext(),n=e.getParameter(e.DEPTH_BITS),r=t.width*t.height*(n/8);i.objects.set(t.texture.id,{gpuMemory:r,cpuMemory:0})}function DS(i,t){t!=null&&(_S(t)?Ac(i,t):yS(t)&&(t.depthBuffer&&(t.depthTexture!=null?Ac(i,t.depthTexture):LS(i,t)),Ac(i,t.texture)))}function OS(i){return i instanceof HTMLCanvasElement||i instanceof OffscreenCanvas?i.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,i.width,i.height).data:Ic(i)}function US(i){let t=OS(i);for(let e=0;e<t.length;e+=4)if(t[e+3]!==0)return!1;return!0}function Pc(i,t,e){let n=e?.getContext();if(n==null)return i;let r=si;return i===We&&(t===oi&&!n.getExtension("OES_texture_float_linear")||t===Vr&&!n.getExtension("OES_texture_half_float_linear"))?r:i}function FS(i,t){i.minFilter=Pc(i.minFilter,i.type,t),i.magFilter=Pc(i.magFilter,i.type,t)}var Ya={createDataTexture:ES,createDataTextureAsync:wS,isEmptyTexture:Lc,decodeBlob:bS,getChannelCount:jr,getBytesPerChannel:Yr,getWiderType:AS,getDataTypeString:vS,create1DTexture:TS,createDataCopy:MS,computeMinMax:PS,isDataTexture:Rc,isCanvasTexture:qa,computeMinMaxFromBuffer:Nc,computeMinMaxFromImage:Sd,estimateSize:xS,readDepthTexture:NS,shouldExpandRGB:CS,isCanvasEmpty:US,getMemoryUsage:DS,getCompatibleTextureFilter:Pc,ensureCompatibility:FS};var Dc=class extends Bt{},vL=new Dc;var BS="file-viewer-offline-cdn/npm/laz-perf@0.0.7/lib",GS=BS,Oc=null;function bd(i){Oc=i}var ja;async function zS(i){return Uc.LazPerf.create({wasmBinary:i})}async function kS(i){return Uc.LazPerf.create({locateFile:t=>`${i}/${t}`})}function Fc(){return ja||(Oc!=null?ja=zS(Oc):ja=kS(GS)),ja}function Za(i,t){return i==null||i.length===0?!0:i.every(e=>e(t))}function VS(i){let t=i.operator;switch(t){case"equal":return e=>e===i.value;case"less":return e=>e<i.value;case"lessequal":return e=>e<=i.value;case"greater":return e=>e>i.value;case"greaterequal":return e=>e>=i.value;case"not":return e=>e!==i.value;case"in":return e=>i.values.has(e);case"not_in":return e=>!i.values.has(e);default:throw new Error(`invalid filter operator: '${t}'`)}}function Ed(i,t){if(i.length===0)return null;let e=[];for(let n of i){let r=VS(n);if(t.dimensions[n.dimension]!=null){let s=t.getter(n.dimension);e.push(a=>r(s(a)))}}return e.length>0?e:null}var Bc=class{_length=0;constructor(t,e){this._ctor=e,this._array=e(t)}get capacity(){return this._array.length}get length(){return this._length}push(t){this.isFull&&this.expand(),this._array[this._length]=t,this._length++}getArray(){return this.isFull?this._array:this._array.slice(0,this._length)}get isFull(){return this._length===this.capacity}expand(){let t=Math.round(this.capacity*1.5),e=this._ctor(t);e.set(this._array),this._array=e}},wd=Bc;function ci(i,t){if(i==null)throw new Error(t??"non-null assertion failed");return i}var hi=0,ui=1,Ye=2,Hi=3,Gc=class{_lastExpansion=0;get byteLength(){return this.array.byteLength}get capacity(){return this.array.length/this._dimension}get array(){return this._array}toFloat32Array(){return this._array instanceof Float32Array?this._array.length===this._length*this._dimension?this._array:this._array.slice(0,this._length*this._dimension):new Float32Array(this._array.slice(0,this._length*this._dimension))}constructor(t,e){if(this._dimension=e,t.length%this._dimension!==0)throw new Error(`invalid size, expected a multiple of ${this._dimension}, got ${t.length}`);this._array=t,this._capacity=this._array.length/this._dimension,this._length=this._capacity}get length(){return this._length}set length(t){this._length=t}setX(t,e){let n=t*this._dimension;this._array[n+hi]=e}getX(t){let e=t*this._dimension;return this._array[e+hi]}setY(t,e){let n=t*this._dimension;this._array[n+ui]=e}getY(t){let e=t*this._dimension;return this._array[e+ui]}setZ(t,e){if(this._dimension>=3){let n=t*this._dimension;this._array[n+Ye]=e}}getZ(t){if(this._dimension>=3){let e=t*this._dimension;return this._array[e+Ye]}return null}setW(t,e){if(this._dimension>=4){let n=t*this._dimension;this._array[n+Hi]=e}}getW(t){if(this._dimension>=4){let e=t*this._dimension;return this._array[e+Hi]}return null}setVector(t,e){let n=t*this._dimension;this._array[n+hi]=e.getComponent(hi),this._array[n+ui]=e.getComponent(ui),this._dimension>=3&&(this._array[n+Ye]=e.getComponent(Ye)),this._dimension>=4&&(this._array[n+Hi]=e.getComponent(Hi))}set(t,e,n,r,s){let a=t*this._dimension;if(a>=this._array.length)throw new Error("index out of bounds");this._array[a+hi]=e,this._array[a+ui]=n,this._dimension>=Ye&&r!=null&&(this._array[a+Ye]=r),this._dimension>=Hi&&s!=null&&(this._array[a+Hi]=s)}copyItem(t,e){let n=this._dimension,r=e*n,s=t*n;this._array[r+hi]=this._array[s+hi],this._array[r+ui]=this._array[s+ui],n>=3&&(this._array[r+Ye]=this._array[s+Ye]),n>=4&&(this._array[r+Hi]=this._array[s+Hi])}computeExpansionSize(){return this._lastExpansion===0?this._lastExpansion=32:(this._lastExpansion*=2,this._lastExpansion=Zt.clamp(this._lastExpansion,32,65536)),this._lastExpansion}trim(){this._capacity>this._length&&(this._capacity=this._length,this._array=this._array.slice(0,this._length*this._dimension))}allocateIfFull(){if(this._capacity===this._length){let t=this._length;this.expand(this._length+this.computeExpansionSize()),this._capacity=this._array.length/this._dimension,this._length=t}}push(t,e,n,r){this._capacity===this._length&&this.allocateIfFull(),this.setX(this._length,t),this.setY(this._length,e),n!=null&&this.setZ(this._length,n),r!=null&&this.setW(this._length,r),this._length++}pushVector(t){this._capacity===this._length&&this.allocateIfFull(),this.assignVector(this._length*this._dimension,t),this._length++}expand(t){let e=new this.array.constructor(t*this._dimension);return e.set(this._array),this._array=e,this._capacity=this._array.length/this._dimension,this._length=this._capacity,this}forEach(t){let e=this.getTempVector(),n=this._dimension;for(let r=0;r<this._array.length;r+=n){this.readVector(r,e);let s=r/n;t(e,s,this)}}};var Zr=class i extends Gc{dimension=3;constructor(t){super(t,3)}get(t,e){return e=e??new R,e.set(this.getX(t),this.getY(t),ci(this.getZ(t)))}clone(){return new i(this._array.slice(0))}getZ(t){return super.getZ(t)}getTempVector(){return new R}readVector(t,e){let n=this._array;e.set(n[t+hi],n[t+ui],n[t+Ye])}assignVector(t,e){this._array[t+hi]=e.x,this._array[t+ui]=e.y,this._array[t+Ye]=e.z}};var Td=(function(i){return i[i.Elevation=1]="Elevation",i[i.Slope=2]="Slope",i[i.Aspect=3]="Aspect",i})(Td||{}),Ad=Td;var zc=class i extends Bt{_opacity=null;_shouldRecreateTexture=!0;constructor(t){if(super(),this._min=t.min,this._max=t.max,this._mode=t.mode??Ad.Elevation,this._colors=ci(t.colors,"missing colors parameter"),t.opacities!=null){if(t.opacities.length!==this._colors.length)throw new Error("the opacity array must have the same length as the color array");this._opacity=t.opacities??null}this._cachedTexture=null,this._active=!0}get mode(){return this._mode}set mode(t){this._mode!==t&&(this._mode=t,this.notifyChange())}notifyChange(){this.dispatchEvent({type:"updated"})}get active(){return this._active}set active(t){this._active!==t&&(this._active=t,this.notifyChange())}get min(){return this._min}set min(t){this._min!==t&&(this._min=t,this.notifyChange())}get max(){return this._max}set max(t){this._max!==t&&(this._max=t,this.notifyChange())}get colors(){return this._colors}set colors(t){this._colors!==t&&(this._colors=t,this._opacity&&this._opacity.length!==t.length&&(this._opacity=null),this._shouldRecreateTexture=!0,this.notifyChange())}get opacity(){return this._opacity}set opacity(t){if(t&&t.length!==this.colors.length)throw new Error("the opacity array must have the same length as the color array");this._opacity!==t&&(this._opacity=t,this._shouldRecreateTexture=!0),this.notifyChange()}sample(t){let{min:e,max:n,colors:r}=this,s=Zt.clamp(t,e,n),a=Zt.mapLinear(s,e,n,0,r.length-1);return r[Zt.clamp(Math.round(a),0,r.length-1)]}sampleOpacity(t){let{min:e,max:n,opacity:r}=this;if(!r)return 1;let s=Zt.clamp(t,e,n),a=Zt.mapLinear(s,e,n,0,r.length-1);return r[Zt.clamp(Math.round(a),0,r.length-1)]}getTexture(){return(this._shouldRecreateTexture||this._cachedTexture==null)&&(this._cachedTexture?.dispose(),this._cachedTexture=Ya.create1DTexture(this._colors,this._opacity??void 0),this._cachedTexture.minFilter=si,this._cachedTexture.magFilter=si,this._cachedTexture.wrapS=Ie,this._cachedTexture.wrapT=Ie,this._shouldRecreateTexture=!1),ci(this._cachedTexture)}clone(){return new i({colors:[...this.colors],min:this.min,max:this.max,mode:this._mode,opacities:this._opacity!=null?[...this._opacity]:void 0})}dispose(){this._cachedTexture?.dispose()}};var kc=zc;function Cd(i){i("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),i("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),i("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var t=1;t<=60;++t)i("EPSG:"+(32600+t),"+proj=utm +zone="+t+" +datum=WGS84 +units=m"),i("EPSG:"+(32700+t),"+proj=utm +zone="+t+" +south +datum=WGS84 +units=m");i("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),i("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),i.WGS84=i["EPSG:4326"],i["EPSG:3785"]=i["EPSG:3857"],i.GOOGLE=i["EPSG:3857"],i["EPSG:900913"]=i["EPSG:3857"],i["EPSG:102113"]=i["EPSG:3857"]}var Le=1,De=2,fi=3,Pd=4,Jr=5,Vc=6378137,Rd=6356752314e-3,Hc=.0066943799901413165,an=484813681109536e-20,w=Math.PI/2,Id=.16666666666666666,Nd=.04722222222222222,Ld=.022156084656084655,D=1e-10,ut=.017453292519943295,Rt=57.29577951308232,et=Math.PI/4,Wi=Math.PI*2,vt=3.14159265359;var se={};se.greenwich=0;se.lisbon=-9.131906111111;se.paris=2.337229166667;se.bogota=-74.080916666667;se.madrid=-3.687938888889;se.rome=12.452333333333;se.bern=7.439583333333;se.jakarta=106.807719444444;se.ferro=-17.666666666667;se.brussels=4.367975;se.stockholm=18.058277777778;se.athens=23.7163375;se.oslo=10.722916666667;var Dd=se;var Od={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var Ud=/[\s_\-\/\(\)]/g;function pe(i,t){if(i[t])return i[t];for(var e=Object.keys(i),n=t.toLowerCase().replace(Ud,""),r=-1,s,a;++r<e.length;)if(s=e[r],a=s.toLowerCase().replace(Ud,""),a===n)return i[s]}function $r(i){var t={},e=i.split("+").map(function(o){return o.trim()}).filter(function(o){return o}).reduce(function(o,l){var c=l.split("=");return c.push(!0),o[c[0].toLowerCase()]=c[1],o},{}),n,r,s,a={proj:function(o){t.projName=["lonlat","latlon","latlong"].includes(o)?"longlat":o},datum:"datumCode",rf:function(o){t.rf=parseFloat(o)},lat_0:function(o){t.lat0=o*ut},lat_1:function(o){t.lat1=o*ut},lat_2:function(o){t.lat2=o*ut},lat_ts:function(o){t.lat_ts=o*ut},lon_0:function(o){t.long0=o*ut},lon_wrap:function(o){t.long_wrap=parseFloat(o)*ut},lon_1:function(o){t.long1=o*ut},lon_2:function(o){t.long2=o*ut},alpha:function(o){t.alpha=parseFloat(o)*ut},gamma:function(o){t.rectified_grid_angle=parseFloat(o)*ut},lonc:function(o){t.longc=o*ut},x_0:function(o){t.x0=parseFloat(o)},y_0:function(o){t.y0=parseFloat(o)},h_0:function(o){t.h=parseFloat(o)},k_0:function(o){t.k0=parseFloat(o)},k:function(o){t.k0=parseFloat(o)},a:function(o){t.a=parseFloat(o)},b:function(o){t.b=parseFloat(o)},r:function(o){t.a=t.b=parseFloat(o)},r_a:function(){t.R_A=!0},zone:function(o){t.zone=parseInt(o,10)},south:function(){t.utmSouth=!0},hyperbolic:function(){t.hyperbolic=!0},towgs84:function(o){t.datum_params=o.split(",").map(function(l){return parseFloat(l)})},to_meter:function(o){t.to_meter=parseFloat(o)},units:function(o){t.units=o;var l=pe(Od,o);l&&(t.to_meter=l.to_meter)},from_greenwich:function(o){t.from_greenwich=o*ut},pm:function(o){var l=pe(Dd,o);t.from_greenwich=(l||parseFloat(o))*ut},nadgrids:function(o){o==="@null"?t.datumCode="none":t.nadgrids=o},axis:function(o){var l="ewnsud";o.length===3&&l.indexOf(o.substr(0,1))!==-1&&l.indexOf(o.substr(1,1))!==-1&&l.indexOf(o.substr(2,1))!==-1&&(t.axis=o)},approx:function(){t.approx=!0},over:function(){t.over=!0}};for(n in e)r=e[n],n in a?(s=a[n],typeof s=="function"?s(r):t[s]=r):t[n]=r;return typeof t.datumCode=="string"&&t.datumCode!=="WGS84"&&(t.datumCode=t.datumCode.toLowerCase()),t.projStr=i,t}var HS=.017453292519943295;function Xi(i){return i*HS}function Wc(i){return/^(equirectangular|equidistant[ _]cylindrical)/i.test(i||"")}function Ja(i){let t=(i.projName||"").toLowerCase().replace(/_/g," ");i.long0===void 0&&i.longc!==void 0&&(i.long0=i.longc),!i.lat_ts&&i.lat1&&(t==="stereographic south pole"||t==="polar stereographic (variant b)")?(i.lat0=Xi(i.lat1>0?90:-90),i.lat_ts=i.lat1,delete i.lat1):!i.lat_ts&&i.lat0&&(t==="polar stereographic"||t==="polar stereographic (variant a)")?(i.lat_ts=i.lat0,i.lat0=Xi(i.lat0>0?90:-90),delete i.lat1):i.lat_ts===void 0&&i.lat1!==void 0&&Wc(i.projName)&&(i.lat_ts=i.lat1,delete i.lat1)}var Xc=class{static getId(t){let e=t.find(n=>Array.isArray(n)&&n[0]==="ID");return e&&e.length>=3?{authority:e[1],code:this.parseCode(e[2])}:null}static parseCode(t){return/^-?\d+$/.test(t)?parseInt(t,10):t}static convertUnit(t,e="unit"){if(!t||t.length<3)return{type:e,name:"unknown",conversion_factor:null};let n=t[1],r=parseFloat(t[2])||null,s=t.find(o=>Array.isArray(o)&&o[0]==="ID"),a=s?{authority:s[1],code:this.parseCode(s[2])}:null;return{type:e,name:n,conversion_factor:r,id:a}}static convertAxis(t){let e=t[1]||"Unknown",n,r=e.match(/^\((.)\)$/);if(r){let c=r[1].toUpperCase();if(c==="E")n="east";else if(c==="N")n="north";else if(c==="U")n="up";else if(t[2])n=t[2];else throw new Error(`Unknown axis abbreviation: ${c}`)}else n=t[2]||"unknown";let s=t.find(c=>Array.isArray(c)&&c[0]==="ORDER"),a=s?parseInt(s[1],10):null,o=t.find(c=>Array.isArray(c)&&(c[0]==="LENGTHUNIT"||c[0]==="ANGLEUNIT"||c[0]==="SCALEUNIT")),l=this.convertUnit(o);return{name:e,direction:n,unit:l,order:a}}static extractAxes(t){return t.filter(e=>Array.isArray(e)&&e[0]==="AXIS").map(e=>this.convertAxis(e)).sort((e,n)=>(e.order||0)-(n.order||0))}static convertPrimeMeridianLongitude(t,e){let n=parseFloat(t[2]),r=t.find(a=>Array.isArray(a)&&(a[0]==="ANGLEUNIT"||a[0]==="UNIT"))||e,s=this.convertUnit(r,"AngularUnit");return!s.conversion_factor||Math.abs(s.conversion_factor/Xi(1)-1)<1e-9?n:{value:n,unit:s}}static convert(t,e={}){switch(t[0]){case"PROJCRS":e.type="ProjectedCRS",e.name=t[1];let n=t.find(g=>Array.isArray(g)&&(g[0]==="BASEGEOGCRS"||g[0]==="BASEGEODCRS"));e.base_crs=n?this.convert(n):null,e.conversion=t.find(g=>Array.isArray(g)&&g[0]==="CONVERSION")?this.convert(t.find(g=>Array.isArray(g)&&g[0]==="CONVERSION")):null;let r=t.find(g=>Array.isArray(g)&&g[0]==="CS");r&&(e.coordinate_system={subtype:r[1],axis:this.extractAxes(t)});let s=t.find(g=>Array.isArray(g)&&g[0]==="LENGTHUNIT");if(s){let g=this.convertUnit(s);e.coordinate_system.unit=g}e.id=this.getId(t);break;case"BASEGEOGCRS":case"BASEGEODCRS":case"GEOGCRS":case"GEODCRS":e.type=t[0]==="GEODCRS"?"GeodeticCRS":"GeographicCRS",e.name=t[1];let a=t.find(g=>Array.isArray(g)&&(g[0]==="DATUM"||g[0]==="ENSEMBLE"));if(a){let g=this.convert(a);a[0]==="ENSEMBLE"?e.datum_ensemble=g:e.datum=g;let v=t.find(x=>Array.isArray(x)&&x[0]==="PRIMEM");v&&v[1]!=="Greenwich"&&(g.prime_meridian={name:v[1],longitude:this.convertPrimeMeridianLongitude(v,t.find(x=>Array.isArray(x)&&x[0]==="ANGLEUNIT"))})}let o=t.find(g=>Array.isArray(g)&&g[0]==="CS");e.coordinate_system={subtype:o?o[1]:"ellipsoidal",axis:this.extractAxes(t)},e.id=this.getId(t);break;case"DATUM":e.type="GeodeticReferenceFrame",e.name=t[1],e.ellipsoid=t.find(g=>Array.isArray(g)&&g[0]==="ELLIPSOID")?this.convert(t.find(g=>Array.isArray(g)&&g[0]==="ELLIPSOID")):null;break;case"ENSEMBLE":e.type="DatumEnsemble",e.name=t[1],e.members=t.filter(g=>Array.isArray(g)&&g[0]==="MEMBER").map(g=>({type:"DatumEnsembleMember",name:g[1],id:this.getId(g)}));let l=t.find(g=>Array.isArray(g)&&g[0]==="ENSEMBLEACCURACY");l&&(e.accuracy=parseFloat(l[1]));let c=t.find(g=>Array.isArray(g)&&g[0]==="ELLIPSOID");c&&(e.ellipsoid=this.convert(c)),e.id=this.getId(t);break;case"ELLIPSOID":e.type="Ellipsoid",e.name=t[1],e.semi_major_axis=parseFloat(t[2]),e.inverse_flattening=parseFloat(t[3]);let h=t.find(g=>Array.isArray(g)&&g[0]==="LENGTHUNIT");h&&this.convert(h,e);break;case"CONVERSION":e.type="Conversion",e.name=t[1],e.method=t.find(g=>Array.isArray(g)&&g[0]==="METHOD")?this.convert(t.find(g=>Array.isArray(g)&&g[0]==="METHOD")):null,e.parameters=t.filter(g=>Array.isArray(g)&&g[0]==="PARAMETER").map(g=>this.convert(g));break;case"METHOD":e.type="Method",e.name=t[1],e.id=this.getId(t);break;case"PARAMETER":e.type="Parameter",e.name=t[1],e.value=parseFloat(t[2]),e.unit=this.convertUnit(t.find(g=>Array.isArray(g)&&(g[0]==="LENGTHUNIT"||g[0]==="ANGLEUNIT"||g[0]==="SCALEUNIT"))),e.id=this.getId(t);break;case"COMPOUNDCRS":e.type="CompoundCRS",e.name=t[1],e.components=t.slice(2).filter(g=>Array.isArray(g)&&g[0].endsWith("CRS")).map(g=>this.convert(g)),e.id=this.getId(t);break;case"BOUNDCRS":e.type="BoundCRS";let u=t.find(g=>Array.isArray(g)&&g[0]==="SOURCECRS");if(u){let g=u.find(v=>Array.isArray(v));e.source_crs=g?this.convert(g):null}let p=t.find(g=>Array.isArray(g)&&g[0]==="TARGETCRS");if(p){let g=p.find(v=>Array.isArray(v));e.target_crs=g?this.convert(g):null}let d=t.find(g=>Array.isArray(g)&&g[0]==="ABRIDGEDTRANSFORMATION");d?e.transformation=this.convert(d):e.transformation=null;break;case"ABRIDGEDTRANSFORMATION":if(e.type="Transformation",e.name=t[1],e.method=t.find(g=>Array.isArray(g)&&g[0]==="METHOD")?this.convert(t.find(g=>Array.isArray(g)&&g[0]==="METHOD")):null,e.parameters=t.filter(g=>Array.isArray(g)&&(g[0]==="PARAMETER"||g[0]==="PARAMETERFILE")).map(g=>{if(g[0]==="PARAMETER")return this.convert(g);if(g[0]==="PARAMETERFILE")return{name:g[1],value:g[2],id:{authority:"EPSG",code:8656}}}),e.parameters.length===7){let g=e.parameters[6];g.name==="Scale difference"&&!g.unit.conversion_factor&&(g.value=Math.round((g.value-1)*1e12)/1e6,g.unit={type:"ScaleUnit",name:"parts per million",conversion_factor:1e-6,id:null})}e.id=this.getId(t);break;case"AXIS":e.coordinate_system||(e.coordinate_system={type:"unspecified",axis:[]}),e.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":let _=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(g=>{g.unit||(g.unit=_)}),_.conversion_factor&&_.conversion_factor!==1&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:_});break;default:e.keyword=t[0];break}return e}},Fd=Xc;function Bd(i){i[0]=i[0].toUpperCase();for(var t=1;t<i.length;t++)Array.isArray(i[t])&&Bd(i[t])}var WS={GEODETICCRS:"GEODCRS",GEOGRAPHICCRS:"GEOGCRS",PROJECTEDCRS:"PROJCRS",GEODETICDATUM:"DATUM",TRF:"DATUM",SPHEROID:"ELLIPSOID",PRIMEMERIDIAN:"PRIMEM",PROJECTION:"METHOD",VERTICALCRS:"VERTCRS",VERTICALDATUM:"VDATUM",VRF:"VDATUM",ENGINEERINGCRS:"ENGCRS",ENGINEERINGDATUM:"EDATUM",PARAMETRICDATUM:"PDATUM",TIMEDATUM:"TDATUM",TEMPORALQUANTITY:"TIMEUNIT"};function Gd(i){i[0]=WS[i[0]]||i[0];for(var t=1;t<i.length;t++)Array.isArray(i[t])&&Gd(i[t])}function zd(i){return Bd(i),Gd(i),Fd.convert(i)}function kd(i){let t=i.toUpperCase();return t.includes("PROJCRS")||t.includes("GEOGCRS")||t.includes("BOUNDCRS")||t.includes("VERTCRS")||t.includes("LENGTHUNIT")||t.includes("ANGLEUNIT")||t.includes("SCALEUNIT")?"WKT2":(t.includes("PROJCS")||t.includes("GEOGCS")||t.includes("LOCAL_CS")||t.includes("VERT_CS")||t.includes("UNIT"),"WKT1")}var Vd=jS,Kr=1,Hd=2,Wd=3,$a=4,Xd=5,qc=-1,XS=/\s/,qS=/[A-Za-z]/,YS=/[A-Za-z84_]/,Ka=/[,\])]/,qd=/[\d\.Ee\-\+]/;function di(i){if(typeof i!="string")throw new Error("not a string");this.text=i.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Kr}di.prototype.readCharicter=function(){var i=this.text[this.place++];if(this.state!==$a)for(;XS.test(i);){if(this.place>=this.text.length)return;i=this.text[this.place++]}switch(this.state){case Kr:return this.neutral(i);case Hd:return this.keyword(i);case $a:return this.quoted(i);case Xd:return this.afterquote(i);case Wd:return this.number(i);case qc:return}};di.prototype.afterquote=function(i){if(i==='"'){this.word+='"',this.state=$a;return}if(Ka.test(i)){this.word=this.word.trim(),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in afterquote yet, index '+this.place)};di.prototype.afterItem=function(i){if(i===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Kr;return}if(i==="]"||i===")"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Kr,this.currentObject=this.stack.pop(),this.currentObject||(this.state=qc);return}};di.prototype.number=function(i){if(qd.test(i)){this.word+=i;return}if(Ka.test(i)){this.word=parseFloat(this.word),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in number yet, index '+this.place)};di.prototype.quoted=function(i){if(i==='"'){this.state=Xd;return}this.word+=i};di.prototype.keyword=function(i){if(YS.test(i)){this.word+=i;return}if(i==="["||i==="("){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=Kr;return}if(Ka.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in keyword yet, index '+this.place)};di.prototype.neutral=function(i){if(qS.test(i)){this.word=i,this.state=Hd;return}if(i==='"'){this.word="",this.state=$a;return}if(qd.test(i)){this.word=i,this.state=Wd;return}if(Ka.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in neutral yet, index '+this.place)};di.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===qc)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function jS(i){var t=new di(i);return t.output()}function Yc(i,t,e){Array.isArray(t)&&(e.unshift(t),t=null);var n=t?{}:i,r=e.reduce(function(s,a){return on(a,s),s},n);t&&(i[t]=r)}function on(i,t){if(!Array.isArray(i)){t[i]=!0;return}var e=i.shift();if(e==="PARAMETER"&&(e=i.shift()),i.length===1){if(Array.isArray(i[0])){t[e]={},on(i[0],t[e]);return}t[e]=i[0];return}if(!i.length){t[e]=!0;return}if(e==="TOWGS84"){t[e]=i;return}if(e==="AXIS"){e in t||(t[e]=[]),t[e].push(i);return}Array.isArray(e)||(t[e]={});var n;switch(e){case"UNIT":case"PRIMEM":case"VERT_DATUM":t[e]={name:i[0].toLowerCase(),convert:i[1]},i.length===3&&on(i[2],t[e]);return;case"SPHEROID":case"ELLIPSOID":t[e]={name:i[0],a:i[1],rf:i[2]},i.length===4&&on(i[3],t[e]);return;case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":i[0]=["name",i[0]],Yc(t,e,i);return;case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":i[0]=["name",i[0]],Yc(t,e,i),t[e].type=e;return;default:for(n=-1;++n<i.length;)if(!Array.isArray(i[n]))return on(i,t[e]);return Yc(t,e,i)}}function Yd(i){let t={units:null,to_meter:void 0};return typeof i=="string"?(t.units=i.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.units==="meter"&&(t.to_meter=1)):i&&i.name&&(t.units=i.name.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.to_meter=i.conversion_factor),t}function Zc(i){return typeof i=="object"?i.value*i.unit.conversion_factor:i}function jd(i){return typeof i!="object"?i*Math.PI/180:i.unit==="degree"?i.value*Math.PI/180:Zc(i)}var jc=Math.PI/648e3,Zd=[1,1,1,jc,jc,jc,1e-6];function ZS(i,t){let e=i.unit,n=e&&typeof e=="object"?e.conversion_factor:e==="degree"?Math.PI/180:e==="metre"||e==="unity"?1:null;return n&&t<Zd.length?i.value*n/Zd[t]:i.value}function JS(i){return i?i.id&&i.id.authority==="EPSG"?[9607,1032,1038].includes(Number(i.id.code)):/^Coordinate Frame rotation\b/i.test(i.name):!1}function Jd(i,t){i.ellipsoid.radius?(t.a=i.ellipsoid.radius,t.rf=0):(t.a=Zc(i.ellipsoid.semi_major_axis),i.ellipsoid.inverse_flattening!==void 0?t.rf=i.ellipsoid.inverse_flattening:i.ellipsoid.semi_major_axis!==void 0&&i.ellipsoid.semi_minor_axis!==void 0&&(t.rf=t.a/(t.a-Zc(i.ellipsoid.semi_minor_axis))))}function $d(i){return i.type==="BoundCRS"?!!i.source_crs&&$d(i.source_crs):i.type==="GeodeticCRS"?!i.coordinate_system||i.coordinate_system.subtype!=="Cartesian":i.type==="GeographicCRS"||i.type==="ProjectedCRS"}function Jn(i,t={}){if(!i||typeof i!="object")return i;if(i.type==="CompoundCRS"){let e=(i.components||[]).find($d);return e?Jn(e,t):t}if(i.type==="BoundCRS"){if(Jn(i.source_crs,t),i.transformation){if(i.transformation.method&&i.transformation.method.name==="NTv2")t.nadgrids=i.transformation.parameters[0].value;else if(t.datum_params=i.transformation.parameters.map(ZS),t.datum_params.length>=6&&JS(i.transformation.method))for(let e=3;e<6;++e)t.datum_params[e]=-t.datum_params[e]}return t}return Object.keys(i).forEach(e=>{let n=i[e];if(n!==null)switch(e){case"name":if(t.srsCode)break;t.name=n,t.srsCode=n;break;case"type":n==="GeographicCRS"?t.projName="longlat":n==="GeodeticCRS"?i.coordinate_system&&i.coordinate_system.subtype==="Cartesian"?t.projName="geocent":t.projName="longlat":n==="ProjectedCRS"&&i.conversion&&i.conversion.method&&(t.projName=i.conversion.method.name);break;case"datum":case"datum_ensemble":n.ellipsoid&&(t.ellps=n.ellipsoid.name,Jd(n,t)),n.prime_meridian&&(t.from_greenwich=jd(n.prime_meridian.longitude));break;case"ellipsoid":t.ellps=n.name,Jd(n,t);break;case"prime_meridian":t.long0=jd(n.longitude||0);break;case"coordinate_system":if(n.axis){let r={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},s=n.axis.map(a=>r[a.direction.toLowerCase()]);if(s.every(Boolean)&&(t.axis=s.join(""),t.axis.length===2&&(t.axis+="u")),n.unit){let{units:a,to_meter:o}=Yd(n.unit);t.units=a,t.to_meter=o}else if(n.axis[0]&&n.axis[0].unit){let{units:a,to_meter:o}=Yd(n.axis[0].unit);t.units=a,t.to_meter=o}}break;case"id":n.authority&&n.code&&(t.title=n.authority+":"+n.code);break;case"conversion":n.method&&n.method.name&&(t.projName=n.method.name),n.parameters&&n.parameters.forEach(r=>{let s=r.name.toLowerCase().replace(/\s+/g,"_"),a=r.value;r.unit&&r.unit.conversion_factor?t[s]=a*r.unit.conversion_factor:r.unit==="degree"?t[s]=a*Math.PI/180:t[s]=a});break;case"unit":n.name&&(t.units=n.name.toLowerCase(),t.units==="metre"&&(t.units="meter")),n.conversion_factor&&(t.to_meter=n.conversion_factor);break;case"base_crs":Jn(n,t),t.datumCode=n.id?n.id.authority+"_"+n.id.code:n.name;break;default:break}}),!t.datumCode&&(i.type==="GeographicCRS"||i.type==="GeodeticCRS")&&i.id&&(t.datumCode=i.id.authority+"_"+i.id.code),t.latitude_of_false_origin!==void 0&&(t.lat0=t.latitude_of_false_origin),t.longitude_of_false_origin!==void 0&&(t.long0=t.longitude_of_false_origin),t.latitude_of_standard_parallel!==void 0&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),t.latitude_of_1st_standard_parallel!==void 0&&(t.lat1=t.latitude_of_1st_standard_parallel),t.latitude_of_2nd_standard_parallel!==void 0&&(t.lat2=t.latitude_of_2nd_standard_parallel),t.latitude_of_projection_centre!==void 0&&(t.lat0=t.latitude_of_projection_centre),t.longitude_of_projection_centre!==void 0&&(t.longc=t.longitude_of_projection_centre),t.easting_at_false_origin!==void 0&&(t.x0=t.easting_at_false_origin),t.northing_at_false_origin!==void 0&&(t.y0=t.northing_at_false_origin),t.latitude_of_natural_origin!==void 0&&(t.lat0=t.latitude_of_natural_origin),t.longitude_of_natural_origin!==void 0&&(t.long0=t.longitude_of_natural_origin),t.longitude_of_origin!==void 0&&(t.long0=t.longitude_of_origin),t.false_easting!==void 0&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),t.false_northing!==void 0&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),t.projection_plane_origin_height!==void 0&&(t.h=t.projection_plane_origin_height),t.satellite_height!==void 0&&(t.h=t.satellite_height),t.viewpoint_height!==void 0&&(t.h=t.viewpoint_height),t.standard_parallel_1!==void 0&&(t.lat1=t.standard_parallel_1),t.standard_parallel_2!==void 0&&(t.lat2=t.standard_parallel_2),t.scale_factor_at_natural_origin!==void 0&&(t.k0=t.scale_factor_at_natural_origin),t.scale_factor_at_projection_centre!==void 0&&(t.k0=t.scale_factor_at_projection_centre),t.scale_factor_on_pseudo_standard_parallel!==void 0&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),t.azimuth!==void 0&&(t.alpha=t.azimuth),t.azimuth_at_projection_centre!==void 0&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),t.long0===void 0&&t.central_meridian!==void 0&&(t.long0=t.central_meridian),t.lat0===void 0&&t.latitude_of_origin!==void 0&&(t.lat0=t.latitude_of_origin),t.lat0===void 0&&t.latitude_of_center!==void 0&&(t.lat0=t.latitude_of_center),t.longc===void 0&&t.longitude_of_center!==void 0&&(t.longc=t.longitude_of_center),t.k0===void 0&&t.scale_factor!==void 0&&(t.k0=t.scale_factor),Ja(t),t}var $S=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"],KS=["projName","axis","units","to_meter","datumCode","datum_params","nadgrids","ellps","from_greenwich","a","rf","sphere","k0","x0","y0","long0","longc","lat0","lat1","lat2","lat_ts","alpha","rectified_grid_angle"];function QS(i,t){var e=t[0],n=t[1];!(e in i)&&n in i&&(i[e]=i[n],t.length===3&&(i[e]=t[2](i[e])))}function Kd(i){for(var t=Object.keys(i),e=0,n=t.length;e<n;++e){var r=t[e];$S.indexOf(r)!==-1&&tb(i[r]),typeof i[r]=="object"&&Kd(i[r])}}function tb(i){if(i.AUTHORITY){var t=Object.keys(i.AUTHORITY)[0];t&&t in i.AUTHORITY&&(i.title=t+":"+i.AUTHORITY[t])}if(i.type==="GEOGCS"?i.projName="longlat":i.type==="LOCAL_CS"?(i.projName="identity",i.local=!0):typeof i.PROJECTION=="object"?i.projName=Object.keys(i.PROJECTION)[0]:i.projName=i.PROJECTION,i.AXIS){for(var e="",n=0,r=i.AXIS.length;n<r;++n){var s=[i.AXIS[n][0].toLowerCase(),i.AXIS[n][1].toLowerCase()];s[0].indexOf("north")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="north"?e+="n":s[0].indexOf("south")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="south"?e+="s":s[0].indexOf("east")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="east"?e+="e":(s[0].indexOf("west")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="west")&&(e+="w")}e.length===2&&(e+="u"),e.length===3&&(i.axis=e)}i.UNIT&&(i.units=i.UNIT.name.toLowerCase(),i.units==="metre"&&(i.units="meter"),i.UNIT.convert&&(i.type==="GEOGCS"?i.DATUM&&i.DATUM.SPHEROID&&(i.to_meter=i.UNIT.convert*i.DATUM.SPHEROID.a):i.to_meter=i.UNIT.convert));var a=i.GEOGCS;i.type==="GEOGCS"&&(a=i),a&&(a.PRIMEM&&a.PRIMEM.convert&&(i.from_greenwich=Xi(a.PRIMEM.convert)),a.DATUM?i.datumCode=a.DATUM.name.toLowerCase():i.datumCode=a.name.toLowerCase(),i.datumCode.slice(0,2)==="d_"&&(i.datumCode=i.datumCode.slice(2)),i.datumCode==="new_zealand_1949"&&(i.datumCode="nzgd49"),(i.datumCode==="wgs_1984"||i.datumCode==="world_geodetic_system_1984")&&(i.PROJECTION==="Mercator_Auxiliary_Sphere"&&(i.sphere=!0),i.datumCode="wgs84"),i.datumCode==="belge_1972"&&(i.datumCode="rnb72"),a.DATUM&&a.DATUM.SPHEROID&&(i.ellps=a.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),i.ellps.toLowerCase().slice(0,13)==="international"&&(i.ellps="intl"),i.a=a.DATUM.SPHEROID.a,i.rf=parseFloat(a.DATUM.SPHEROID.rf)),a.DATUM&&a.DATUM.TOWGS84&&(i.datum_params=a.DATUM.TOWGS84),~i.datumCode.indexOf("osgb_1936")&&(i.datumCode="osgb36"),~i.datumCode.indexOf("osni_1952")&&(i.datumCode="osni52"),(~i.datumCode.indexOf("tm65")||~i.datumCode.indexOf("geodetic_datum_of_1965"))&&(i.datumCode="ire65"),i.datumCode==="ch1903+"&&(i.datumCode="ch1903"),~i.datumCode.indexOf("israel")&&(i.datumCode="isr93")),i.b&&!isFinite(i.b)&&(i.b=i.a);var o=a&&a.UNIT&&a.UNIT.convert,l=o&&Math.abs(o/Xi(1)-1)>1e-9?function(p){return p*o}:Xi;i.rectified_grid_angle&&(i.rectified_grid_angle=l(i.rectified_grid_angle));function c(p){var d=i.to_meter||1;return p*d}var h=function(p){return QS(i,p)},u=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",l],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",l],["x0","false_easting",c],["y0","false_northing",c],["long0","central_meridian",l],["lat0","latitude_of_origin",l],["lat1","standard_parallel_1",l],["lat2","standard_parallel_2",l],["h","Height",c],["azimuth","Azimuth"],["alpha","azimuth",l],["srsCode","name"]];u.forEach(h),Wc(i.projName)||h(["lat0","standard_parallel_1",l]),Ja(i)}function $n(i){if(typeof i=="object")return Jn(i);let t=kd(i);var e=Vd(i);if(t==="WKT2"){let o=zd(e);return Jn(o)}var n=e[0],r={};on(e,r),Kd(r);var s=r[n];if(n==="COMPD_CS"){var a=s.PROJCS||s.GEOGCS;a&&KS.forEach(function(o){o in a&&(s[o]=a[o])})}return s}function ae(i){var t=this;if(arguments.length===2){var e=arguments[1];typeof e=="string"?e.charAt(0)==="+"?ae[i]=$r(arguments[1]):ae[i]=$n(arguments[1]):e&&typeof e=="object"&&!("projName"in e)?ae[i]=$n(arguments[1]):(ae[i]=e,e||delete ae[i])}else if(arguments.length===1){if(Array.isArray(i))return i.map(function(n){return Array.isArray(n)?ae.apply(t,n):ae(n)});if(typeof i=="string"){if(i in ae)return ae[i]}else"EPSG"in i?ae["EPSG:"+i.EPSG]=i:"ESRI"in i?ae["ESRI:"+i.ESRI]=i:"IAU2000"in i?ae["IAU2000:"+i.IAU2000]=i:console.log(i);return}}Cd(ae);var pi=ae;function eb(i){return typeof i=="string"}function ib(i){return i in pi}function nb(i){return i.indexOf("+")!==0&&(i.indexOf("[")!==-1||i.indexOf("(")!==-1)||typeof i=="object"&&!("srsCode"in i)}var Qd=["3857","900913","3785","102113"];function rb(i){if(i.title)return i.title.toLowerCase().indexOf("epsg:")===0&&Qd.indexOf(i.title.substr(5))>-1;var t=pe(i,"authority");if(t){var e=pe(t,"epsg");return e&&Qd.indexOf(e)>-1}}function sb(i){var t=pe(i,"extension");if(t)return pe(t,"proj4")}function ab(i){return i[0]==="+"}function ob(i){let t;if(eb(i))if(ib(i))t=pi[i];else if(nb(i)){t=$n(i);var e=sb(t);e&&(t=$r(e))}else ab(i)&&(t=$r(i));else"projName"in i?t=i:t=$n(i);return t&&rb(t)?pi["EPSG:3857"]:t}var Qa=ob;function Jc(i,t){i=i||{};var e,n;if(!t)return i;for(n in t)e=t[n],e!==void 0&&(i[n]=e);return i}function Xt(i,t,e){var n=i*t;return e/Math.sqrt(1-n*n)}function xt(i){return i<0?-1:1}function I(i,t){return t||Math.abs(i)<=vt?i:i-xt(i)*Wi}function $t(i,t,e){var n=i*e,r=.5*i;return n=Math.pow((1-n)/(1+n),r),Math.tan(.5*(w-t))/n}function mi(i,t){for(var e=.5*i,n,r,s=w-2*Math.atan(t),a=0;a<=15;a++)if(n=i*Math.sin(s),r=w-2*Math.atan(t*Math.pow((1-n)/(1+n),e))-s,s+=r,Math.abs(r)<=1e-10)return s;return-9999}function lb(){var i=this.b/this.a;this.es=1-i*i,this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Xt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function cb(i){var t=i.x,e=i.y;if(e*Rt>90&&e*Rt<-90&&t*Rt>180&&t*Rt<-180)return null;var n,r;if(Math.abs(Math.abs(e)-w)<=D)return null;if(this.sphere)n=this.x0+this.a*this.k0*I(t-this.long0,this.over),r=this.y0+this.a*this.k0*Math.log(Math.tan(et+.5*e));else{var s=Math.sin(e),a=$t(this.e,e,s);n=this.x0+this.a*this.k0*I(t-this.long0,this.over),r=this.y0-this.a*this.k0*Math.log(a)}return i.x=n,i.y=r,i}function hb(i){var t=i.x-this.x0,e=i.y-this.y0,n,r;if(this.sphere)r=w-2*Math.atan(Math.exp(-e/(this.a*this.k0)));else{var s=Math.exp(-e/(this.a*this.k0));if(r=mi(this.e,s),r===-9999)return null}return n=I(this.long0+t/(this.a*this.k0),this.over),i.x=n,i.y=r,i}var ub=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"],tp={init:lb,forward:cb,inverse:hb,names:ub};function fb(){}function ep(i){return i}var $c=["longlat","identity","lonlat","latlon","latlong"],ip={init:fb,forward:ep,inverse:ep,names:$c};var db=[tp,ip],ln={},Kn=[];function np(i,t){var e=Kn.length;return i.names?(Kn[e]=i,i.names.forEach(function(n){ln[n.toLowerCase()]=e}),this):(console.log(t),!0)}function gi(i){return i.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}function pb(i){if(!i)return!1;var t=i.toLowerCase();if(typeof ln[t]<"u"&&Kn[ln[t]]||(t=gi(t),t in ln&&Kn[ln[t]]))return Kn[ln[t]]}function mb(){db.forEach(np)}var rp={start:mb,add:np,get:pb};var gb={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},"APL4.9":{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},danish:{a:63770192563e-4,rf:300,ellipseName:"Andrae 1876 (Denmark, Iceland)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},GSK2011:{a:63781365e-1,rf:298.2564151,ellipseName:"GSK-2011"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,b:6355863,ellipseName:"Plessis 1817 (France)"},PZ90:{a:6378136,rf:298.25784,ellipseName:"PZ-90"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},Kc=gb;var _b=Kc.WGS84;function sp(i,t,e,n){var r=i*i,s=t*t,a=(r-s)/r,o=0;n?(i*=1-a*(Id+a*(Nd+a*Ld)),r=i*i,a=0):o=Math.sqrt(a);var l=(r-s)/s;return{es:a,e:o,ep2:l}}function ap(i,t,e,n,r){if(!i){var s=pe(Kc,n);s||(s=_b),i=s.a,t=s.b,e=s.rf}return e&&!t&&(t=(1-1/e)*i),(e===0||Math.abs(i-t)<D)&&(r=!0,t=i),{a:i,b:t,rf:e,sphere:r}}var Qr={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clrk80ign",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},amersfoort:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244",ellipse:"bessel",datumName:"Amersfoort"}},op={"213.11,9.37,-74.95":"EPSG_5451","-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43":"IGNF_LURESG IGNF_LUREF IGNF_LURES IGNF_LUXGEO","-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065":"EPSG_4614","-499,-249,314":"EPSG_4615","-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031":"ESRI_37241","-440.296,58.548,296.265,1.128,10.202,4.559,-0.438":"ESRI_37249","-511.151,-181.269,139.609,1.05,2.703,1.798,3.071":"ESRI_37245","24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01":"EPSG_4178","-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984":"EPSG_4622","126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227":"EPSG_4625 IGNF_MART38 IGNF_MART38G IGNF_MART38GEO IGNF_MARTFD IGNF_MARTFDG","0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439":"EPSG_5252 EPSG_5250 EPSG_5251","597.1,71.4,412.1,0.894,0.068,-1.563,7.58":"EPSG_4314","-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166":"EPSG_4282","-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218":"EPSG_4231","-239.749,88.181,30.488,0.263,0.082,1.211,2.229":"EPSG_4274","-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006":"EPSG_4134","18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013":"EPSG_4254","-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175":"EPSG_4159","0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093":"EPSG_4687 EPSG_4998 EPSG_4999","-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225":"EPSG_4227","599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46":"EPSG_4746","612.4,77,440.2,-0.054,0.057,-2.797,2.55":"EPSG_4745","8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926":"EPSG_6311 EPSG_6309 EPSG_6310","565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244":"EPSG_4289","-89.5,-93.8,-123.1,0,0,-0.156,1.2":"EPSG_4230","-123.02,-158.95,-168.47":"EPSG_4154","570.8,85.7,462.8,4.998,1.587,5.261,3.56":"EPSG_4156","482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15":"EPSG_4299 EPSG_4300 EPSG_4188","33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84":"EPSG_4179","-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747":"EPSG_4313","163.511,127.533,-159.789,0,0,0.814,-0.6":"EPSG_4194","105,326,-102.5,0,0,0.814,-0.6":"EPSG_4195","-45,417,-3.5,0,0,0.814,-0.6":"EPSG_4196","-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246":"EPSG_4611","137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824":"EPSG_4633 IGNF_LIFOU56 IGNF_LIFOU56G","-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993":"EPSG_4641 IGNF_MARE53 IGNF_MARE53G","-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002":"EPSG_4643","982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805":"EPSG_4660","97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259":"EPSG_4662","577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664":"EPSG_3906","-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547":"EPSG_4307","-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686":"EPSG_6892","221.597,152.441,176.523,2.403,1.3893,0.884,11.4648":"EPSG_4690","218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817":"EPSG_4691 IGNF_MOOREA87 IGNF_MOOREA87G IGNF_MOOREA87GEO","72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653":"EPSG_4629","165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111":"EPSG_4630","217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093":"EPSG_4692","0,0,0,-0.008393,0.000749,-0.010276,0":"EPSG_9333 EPSG_9331 EPSG_9332","601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887":"EPSG_4312 EPSG_9266 EPSG_9267","-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496":"EPSG_4123","-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365":"EPSG_4309","-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058":"ESRI_104106","-275.7224,94.7824,340.8944,-8.001,-4.42,-11.821,1":"EPSG_4281","0,0,4.5,0,0,0.554,0.2263":"EPSG_4322 EPSG_4720 EPSG_4984 EPSG_4985","0,0,1.9,0,0,0.814,-0.38":"EPSG_4324 EPSG_4986 EPSG_4987","43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549":"EPSG_4284 ESRI_104135","446.448,-125.157,542.06,0.15,0.247,0.842,-20.489":"EPSG_4277","-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46":"EPSG_4207 EPSG_4803","347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647":"EPSG_4688","410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218":"EPSG_4689","278.3,93,474.5,7.889,0.05,-6.61,6.21":"EPSG_4273 EPSG_4817","204.64,834.74,293.8":"EPSG_4240","426.62,142.62,460.09,4.98,4.49,-12.42,-17.1":"ESRI_104131","-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68":"EPSG_4265 EPSG_4806","-111.92,-87.85,114.5,1.875,0.202,0.219,0.032":"EPSG_4263","-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536":"EPSG_4298","-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424":"EPSG_4270","-130,110,-13":"EPSG_4229","-55.5,-348,-229.2":"EPSG_4220","12.646,-155.176,-80.863":"EPSG_4214","-345,3,223":"EPSG_4232","-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037":"EPSG_4238","-170,33,326":"EPSG_4168","198,881,317":"EPSG_4131","-0.9738,1.9453,0.5486,0.027551,0.010049,0.011359,0":"EPSG_4152 EPSG_4956 EPSG_4957","-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0":"EPSG_9075 EPSG_9072 EPSG_9073 EPSG_9074 EPSG_9070 EPSG_9071","572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378":"EPSG_5228 ESRI_104696 ESRI_104697 EPSG_5229","485.021,169.465,483.839,7.786342,4.397554,4.102655,0":"EPSG_8351 ESRI_104648","-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06":"EPSG_4683 EPSG_4994 EPSG_4995","1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388":"EPSG_9294 EPSG_9292 EPSG_9293","31.95,300.99,419.19":"EPSG_4212","-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703":"EPSG_4191","52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191":"EPSG_4237","-1.08,-0.27,-0.9,0,0,0.16,-0.12":"EPSG_4740 EPSG_4922 EPSG_4923","419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496":"EPSG_4124","584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922":"EPSG_5681 EPSG_5828 EPSG_5830","23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262":"EPSG_4141","-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194":"EPSG_4204","226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798":"EPSG_4319","24.82,-131.21,-82.66,0,0,0.16,-0.12":"EPSG_4200","-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359":"EPSG_4127","674.374,15.056,405.346":"EPSG_4149 EPSG_4150 EPSG_4801","-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0":"EPSG_4617 EPSG_4954 EPSG_4955","-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485":"EPSG_4663","-211.939,137.626,58.3,-0.089,0.251,0.079,0.384":"EPSG_4664","-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048":"EPSG_4665","631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43":"EPSG_4666 ESRI_104105 EPSG_4904","-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188":"EPSG_4756","-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925":"EPSG_4723","8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081":"EPSG_4726","-8.0,160.0,176.0":"EPSG_4267 OGC_CRS27","-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693":"EPSG_5365 EPSG_5363 EPSG_5364","304.5,306.5,-318.1":"EPSG_4218 EPSG_4802","-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95":"EPSG_4242","-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289":"EPSG_4216","174.05,-25.49,112.57,0,0,0.554,0.2263":"EPSG_4673","-124,-60,154":"EPSG_4202","-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191":"EPSG_4203","595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408":"EPSG_3819","-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169":"EPSG_8694","275.57,676.78,229.6":"EPSG_4145","0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994":"EPSG_4283 EPSG_4938 EPSG_4939","2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063":"EPSG_4317","59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993":"EPSG_4272","-307.7,265.3,-363.5":"EPSG_4248","24,-121,-76":"EPSG_5561 EPSG_5558 EPSG_5560","-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338":"EPSG_5233 ESRI_104693","-86,-98,-119":"ESRI_104130 EPSG_4668","682,-203,480":"ESRI_104102 EPSG_4805","7,-10,-26":"ESRI_37207","-100,-248,259":"EPSG_4675","-89.121,-348.182,260.871":"ESRI_104109","-185.583,-230.096,281.361":"ESRI_104112","25.1,-275.6,222.6":"ESRI_104113","0,12,6":"IGNF_WGS72G IGNF_WGS72 IGNF_WGS72GEO","-168,-60,320":"IGNF_NTFG IGNF_NTF EPSG_4275 EPSG_4807 IGNF_NTFPGRAD IGNF_NTFP","-127,-769,472":"IGNF_EFATE57G EPSG_4714 IGNF_EFATE57 IGNF_EFATE57GEO","324.8,153.6,172.1":"IGNF_PGP50G IGNF_PGP50 IGNF_TERA50 IGNF_TERA50GEO IGNF_TERA50G","94,-948,-1262":"IGNF_REUN47G IGNF_REUN47 IGNF_REUN47GEO IGNF_REUN49 IGNF_REUN49G EPSG_4626","-186,230,110":"IGNF_CSG67G IGNF_CSG67 IGNF_CSG67GEO EPSG_4623","-467,-16,-300":"IGNF_GUAD48G IGNF_GUAD48 IGNF_GUAD48GEO IGNF_GUADANN IGNF_GUADANNG","162,117,154":"IGNF_TAHI51G IGNF_TAHI51 EPSG_4628","65,342,77":"IGNF_TAHAAG IGNF_TAHAA IGNF_TAHAAGEO","84,274,65":"IGNF_NUKU72G IGNF_NUKU72 IGNF_NUKU72GEO","365,194,166":"IGNF_PETRELS72G IGNF_PETRELS72 EPSG_4636","253,-133,-127":"IGNF_WALL78G IGNF_WALL78 IGNF_WALL78GEO","-382,-59,-262":"IGNF_MAYO50G IGNF_MAYO50 IGNF_MAYO50GEO EPSG_4632","-139,-967,436":"IGNF_TANNAG IGNF_TANNA","-13,-348,292":"IGNF_IGN72G EPSG_4642 IGNF_IGN72 IGNF_IGN72GEO IGNF_OUVE72 IGNF_OUVE72G IGNF_OUVEA72 IGNF_OUVEA72G","1118,23,66":"IGNF_ATIGG EPSG_4901 IGNF_ATI IGNF_ATIG","150.57,158.33,118.32":"IGNF_FANGA84G IGNF_FANGA84","202.13,174.6,-15.74":"IGNF_RUSAT84G IGNF_RUSAT84 IGNF_SAT84 IGNF_SAT84G","126.74,300.1,-75.49":"IGNF_KAUE70G IGNF_KAUE70","-10.8,-1.8,12.77":"IGNF_MOP90G IGNF_MOP90 IGNF_TETIA90 IGNF_TETIA90G","338.08,212.58,-296.17":"IGNF_MHPF67G IGNF_MHPF67","160.61,116.05,153.69":"IGNF_TAHI79G IGNF_TAHI79 IGNF_TAHI79GEO","1.5,3.84,4.81":"IGNF_ANAA92G IGNF_ANAA92 IGNF_ANAA92GEO","330.91,-13.92,58.56":"IGNF_MARQUI72G IGNF_MARQUI72","143.6,197.82,74.05":"IGNF_APAT86G IGNF_APAT86 IGNF_TUAM86 IGNF_TUAM86G","237.17,171.61,-77.84":"IGNF_TUBU69G IGNF_TUBU69","11.363,424.148,373.13":"IGNF_STPM50G IGNF_STPM50 IGNF_STPM50GEO EPSG_4638","-208.4058,-109.8777,-2.5764":"EPSG_4754 EPSG_4899 EPSG_4900","372.87,149.23,585.29":"ESRI_104101","0,-0.15,0.68":"EPSG_4693","293.17,726.18,245.36":"EPSG_6207","-133.63,-157.5,-158.62":"EPSG_4153","-241.54,-163.64,396.06":"EPSG_4132","-154.5,150.7,100.4":"EPSG_4221","-80.7,-132.5,41.1":"EPSG_4266","-70.9,-151.8,-41.4":"EPSG_4193","-0.41,0.46,-0.35":"EPSG_5340 EPSG_5341 EPSG_5342","-294.7,-200.1,525.5":"EPSG_4246","-3.2,-5.7,2.8":"EPSG_4318","-199.87,74.79,246.62":"EPSG_4121","-260.1,5.5,432.2":"EPSG_4223 ESRI_37225 EPSG_4816","-0.465,372.095,171.736":"EPSG_4158","-128.16,-282.42,21.93":"EPSG_4285","-404.78,685.68,45.47":"EPSG_4613 EPSG_4820","195.671,332.517,274.607":"EPSG_4607","-381.788,-57.501,-256.673":"EPSG_4475 EPSG_4472 EPSG_4473","-157.84,308.54,-146.6":"EPSG_4208","70.995,-335.916,262.898":"EPSG_4743","-323.65,551.39,-491.22":"EPSG_4710","-0.077,0.079,0.086":"EPSG_7881 EPSG_7879 EPSG_7880","283.729,735.942,261.143":"EPSG_4682","-156,-271,-189":"EPSG_4739","-80.01,253.26,291.19":"EPSG_4679","-56.263,16.136,-22.856":"EPSG_4750","-10.18,-350.43,291.37":"EPSG_4644","-103.746,-9.614,-255.95":"EPSG_4695","-355,21,72":"EPSG_4292","-61.702,284.488,472.052":"EPSG_4302","-124.76,53,466.79":"EPSG_4143","-153,153,307":"EPSG_4606","-770.1,158.4,-498.2":"EPSG_4699","-273.5,110.6,-357.9":"EPSG_4247","8.88,184.86,106.69":"EPSG_4160","-233.43,6.65,173.64":"EPSG_4161","-9.5,122.9,138.2":"EPSG_9251","-78.1,101.6,133.3":"EPSG_9253","-198.383,-240.517,-107.909":"EPSG_4297 EPSG_4810","-147,506,687":"EPSG_4301","-59,-11,-52":"EPSG_4618","44.585,-131.212,-39.544":"EPSG_4678 EPSG_4992 EPSG_4993","-130,29,364":"EPSG_4250","214,804,268":"EPSG_4144","-17.51,-108.32,-62.39":"EPSG_4147","-254.1,-5.36,-100.29":"EPSG_4259","-76,-138,67":"EPSG_4164","-378.873,676.002,-46.255":"EPSG_4211 EPSG_4813","-422.651,-172.995,84.02":"EPSG_4182","-143.87,243.37,-33.52":"EPSG_4224","-205.57,168.77,-4.12":"EPSG_4225","-67.35,3.88,-38.22":"EPSG_5527","98,390,-22":"EPSG_4752","-30,190,89":"EPSG_4310","-192.26,65.72,132.08":"EPSG_9248","124.5,-63.5,-281":"EPSG_4680","-79.9,-158,-168.9":"EPSG_4701","-146.21,112.63,4.05":"EPSG_4706","-165,-11,206":"EPSG_4201","-157,-2,-299":"EPSG_4210","-104,167,-38":"EPSG_4183","11,72,-101":"EPSG_4139","-2,151,181":"EPSG_4717","102,52,-38":"EPSG_4732","-377,681,-50":"EPSG_4280","-138,-105,-289":"EPSG_4209","31,146,47":"EPSG_4261","-73,46,-86":"EPSG_4658","265.025,384.929,-194.046":"EPSG_4721","-136,-108,-292":"EPSG_4222","-255,-15,71":"EPSG_4601","725,685,536":"EPSG_4602","72,213.7,93":"EPSG_4603","9,183,236":"EPSG_4605","137,248,-430":"EPSG_4621","-28,199,5":"EPSG_4657","103.25,-100.4,-307.19":"EPSG_4316","145,-187,103":"EPSG_4698","-206.1,-174.7,-87.7":"EPSG_4192","-265,120,-358":"EPSG_4311","58,-283,-182":"EPSG_4135","198,-226,-347":"ESRI_104138","-11,851,5":"EPSG_4245","-125,53,467":"EPSG_4142","-106,-87,188":"EPSG_4213","-133,-77,-51":"EPSG_4253","-132,-110,-335":"EPSG_4129","-77,-128,142":"EPSG_4713","217,823,299":"EPSG_4239","295,736,257":"EPSG_4146","-83,37,124":"EPSG_4155","-173,253,27":"EPSG_4165","175,-38,113":"EPSG_4672","-637,-549,-203":"EPSG_4236","-90,40,88":"EPSG_4251","-2,374,172":"EPSG_4271","-88,4,101":"EPSG_4175","298,-304,-375":"EPSG_4716","-23,259,-9":"EPSG_4315","-242.2,-144.9,370.3":"EPSG_4744","-97,787,86":"EPSG_4244","616,97,-251":"EPSG_4293","260,12,-147":"EPSG_4736","-235,-110,393":"EPSG_6883","-63,176,185":"EPSG_6894","-43,-163,45":"EPSG_4205","41,-220,-134":"EPSG_4256","639,405,60":"EPSG_4262","174,359,365":"EPSG_4604","-115,118,426":"EPSG_4169","-106,-129,165":"EPSG_4620","-203,141,53":"EPSG_4184","-289,-124,60":"EPSG_4616","-307,-92,127":"EPSG_9403 EPSG_4728","-133,-321,50":"EPSG_4684","-491,-22,435":"EPSG_4708","114,-116,-333":"EPSG_4707","145,75,-272":"EPSG_4709","-205,107,53":"EPSG_4712","124,-234,-25":"EPSG_4711","230,-199,-752":"EPSG_4718 ESRI_37218","211,147,111":"EPSG_4719","208,-435,-229":"EPSG_4724","189,-79,-202":"EPSG_4725","647,1777,-1124":"EPSG_4735","-794,119,-298":"EPSG_4722","-632,438,-609":"EPSG_4734","912,-58,1227":"EPSG_4727","185,165,42":"EPSG_4729","170,42,84":"EPSG_4730","276,-57,149":"EPSG_4733","-7,215,225":"ESRI_37240","252,-209,-751":"ESRI_37221","-123,-206,219":"ESRI_4305","-73,-247,227":"ESRI_104139 EPSG_4304 EPSG_4811","51,391,-36":"EPSG_4748","-384,664,-48":"EPSG_4219","-333,-222,114":"EPSG_4255","-587.8,519.75,145.76":"EPSG_4257 EPSG_4804","-963,510,-359":"EPSG_4646","-24,-203,268":"EPSG_6881","-183,-15,273":"EPSG_6882","-104,-129,239":"EPSG_4715","0,0,0":"IGNF_RGNCG EPSG_7683 IGNF_RGNC IGNF_RGNCGEO IGNF_RGNCGEODD EPSG_7681 EPSG_7682","589,76,480":"EPSG_4818","-189.6806,18.3463,-42.7695,-0.33746,-3.09264,2.53861,0.4598":"EPSG_9892 EPSG_9893 EPSG_4181","-84,-97,-117":"IGNF_ED50 IGNF_ED50GEO IGNF_ED50G","325,154,172":"EPSG_4637","253,-132,-127":"EPSG_4639"};for(Qc in op)for(th=op[Qc].split(" "),to=0;to<th.length;to++)Qr[th[to]]={towgs84:Qc};var th,to,Qc;for(lp in Qr)eo=Qr[lp],eo.datumName&&(Qr[eo.datumName]=eo);var eo,lp,cp=Qr;function yb(i,t,e,n,r,s,a){var o={};return o.datum_type=Jr,t&&(o.datum_type=Pd,o.datum_params=t.map(parseFloat),(o.datum_params[0]!==0||o.datum_params[1]!==0||o.datum_params[2]!==0)&&(o.datum_type=Le),o.datum_params.length>3&&(o.datum_params[3]!==0||o.datum_params[4]!==0||o.datum_params[5]!==0||o.datum_params[6]!==0)&&(o.datum_type=De,o.datum_params[3]*=an,o.datum_params[4]*=an,o.datum_params[5]*=an,o.datum_params[6]=o.datum_params[6]/1e6+1)),a&&(o.datum_type=fi,o.grids=a),o.a=e,o.b=n,o.es=r,o.ep2=s,o}var hp=yb;var ih={};function nh(i,t,e){return t instanceof ArrayBuffer?vb(i,t,e):{ready:xb(i,t)}}function vb(i,t,e){var n=!0;e!==void 0&&e.includeErrorFields===!1&&(n=!1);var r=new DataView(t),s=Sb(r),a=bb(r,s),o=Eb(r,a,s,n),l={header:a,subgrids:o};return ih[i]=l,l}async function xb(i,t){for(var e=[],n=await t.getImageCount(),r=n-1;r>=0;r--){var s=await t.getImage(r),a=await s.readRasters(),o=a,l=[s.getWidth(),s.getHeight()],c=s.getBoundingBox().map(up),h=typeof s.fileDirectory.getValue=="function"?s.fileDirectory.getValue("ModelPixelScale"):s.fileDirectory.ModelPixelScale,u=[h[0],h[1]].map(up),p=c[0]+(l[0]-1)*u[0],d=c[3]-(l[1]-1)*u[1],_=o[0],g=o[1],v=[];for(let A=l[1]-1;A>=0;A--)for(let P=l[0]-1;P>=0;P--){var x=A*l[0]+P;v.push([-qi(g[x]),qi(_[x])])}e.push({del:u,lim:l,ll:[-p,d],cvs:v})}var b={header:{nSubgrids:n},subgrids:e};return ih[i]=b,b}function fp(i){if(i===void 0)return null;var t=i.split(",");return t.map(Mb)}function Mb(i){if(i.length===0)return null;var t=i[0]==="@";return t&&(i=i.slice(1)),i==="null"?{name:"null",mandatory:!t,grid:null,isNull:!0}:{name:i,mandatory:!t,grid:ih[i]||null,isNull:!1}}function up(i){return i*Math.PI/180}function qi(i){return i/3600*Math.PI/180}function Sb(i){var t=i.getInt32(8,!1);return t===11?!1:(t=i.getInt32(8,!0),t!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function bb(i,t){return{nFields:i.getInt32(8,t),nSubgridFields:i.getInt32(24,t),nSubgrids:i.getInt32(40,t),shiftType:eh(i,56,64).trim(),fromSemiMajorAxis:i.getFloat64(120,t),fromSemiMinorAxis:i.getFloat64(136,t),toSemiMajorAxis:i.getFloat64(152,t),toSemiMinorAxis:i.getFloat64(168,t)}}function eh(i,t,e){return String.fromCharCode.apply(null,new Uint8Array(i.buffer.slice(t,e)))}function Eb(i,t,e,n){for(var r=176,s=[],a=0;a<t.nSubgrids;a++){var o=Tb(i,r,e),l=Ab(i,r,o,e,n),c=Math.round(1+(o.upperLongitude-o.lowerLongitude)/o.longitudeInterval),h=Math.round(1+(o.upperLatitude-o.lowerLatitude)/o.latitudeInterval);s.push({ll:[qi(o.lowerLongitude),qi(o.lowerLatitude)],del:[qi(o.longitudeInterval),qi(o.latitudeInterval)],lim:[c,h],count:o.gridNodeCount,cvs:wb(l)});var u=16;n===!1&&(u=8),r+=176+o.gridNodeCount*u}return s}function wb(i){return i.map(function(t){return[qi(t.longitudeShift),qi(t.latitudeShift)]})}function Tb(i,t,e){return{name:eh(i,t+8,t+16).trim(),parent:eh(i,t+24,t+24+8).trim(),lowerLatitude:i.getFloat64(t+72,e),upperLatitude:i.getFloat64(t+88,e),lowerLongitude:i.getFloat64(t+104,e),upperLongitude:i.getFloat64(t+120,e),latitudeInterval:i.getFloat64(t+136,e),longitudeInterval:i.getFloat64(t+152,e),gridNodeCount:i.getInt32(t+168,e)}}function Ab(i,t,e,n,r){var s=t+176,a=16;r===!1&&(a=8);for(var o=[],l=0;l<e.gridNodeCount;l++){var c={latitudeShift:i.getFloat32(s+l*a,n),longitudeShift:i.getFloat32(s+l*a+4,n)};r!==!1&&(c.latitudeAccuracy=i.getFloat32(s+l*a+8,n),c.longitudeAccuracy=i.getFloat32(s+l*a+12,n)),o.push(c)}return o}function Qn(i,t){if(!(this instanceof Qn))return new Qn(i);this.forward=null,this.inverse=null,this.init=null,this.name,this.axis,this.names=null,this.title,t=t||function(c){if(c)throw c};var e=Qa(i);if(typeof e!="object"){t("Could not parse to valid json: "+i);return}var n=Qn.projections.get(e.projName);if(!n){t("Could not get projection name from: "+i);return}if(e.datumCode&&e.datumCode!=="none"){var r=pe(cp,e.datumCode);r&&(e.datum_params=e.datum_params||(r.towgs84?r.towgs84.split(","):null),e.ellps=r.ellipse,e.datumName=r.datumName?r.datumName:e.datumCode)}e.axis=e.axis||"enu",e.ellps=e.ellps||"wgs84",e.lat1=e.lat1||e.lat0,e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0;var s=ap(e.a,e.b,e.rf,e.ellps,e.sphere),a=sp(s.a,s.b,s.rf,e.R_A),o=fp(e.nadgrids),l=e.datum||hp(e.datumCode,e.datum_params,s.a,s.b,a.es,a.ep2,o);Jc(this,e),Jc(this,n),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=a.es,this.e=a.e,this.ep2=a.ep2,this.datum=l,"init"in this&&typeof this.init=="function"&&this.init(),this.k0||(this.k0=1),t(null,this)}Qn.projections=rp;Qn.projections.start();var Oe=Qn;function dp(i,t){return i.datum_type!==t.datum_type||i.a!==t.a||Math.abs(i.es-t.es)>5e-11?!1:i.datum_type===Le?i.datum_params[0]===t.datum_params[0]&&i.datum_params[1]===t.datum_params[1]&&i.datum_params[2]===t.datum_params[2]:i.datum_type===De?i.datum_params[0]===t.datum_params[0]&&i.datum_params[1]===t.datum_params[1]&&i.datum_params[2]===t.datum_params[2]&&i.datum_params[3]===t.datum_params[3]&&i.datum_params[4]===t.datum_params[4]&&i.datum_params[5]===t.datum_params[5]&&i.datum_params[6]===t.datum_params[6]:!0}function io(i,t,e){var n=i.x,r=i.y,s=i.z?i.z:0,a,o,l,c;if(r<-w&&r>-1.001*w)r=-w;else if(r>w&&r<1.001*w)r=w;else{if(r<-w)return{x:-1/0,y:-1/0,z:i.z};if(r>w)return{x:1/0,y:1/0,z:i.z}}return n>Math.PI&&(n-=2*Math.PI),o=Math.sin(r),c=Math.cos(r),l=o*o,a=e/Math.sqrt(1-t*l),{x:(a+s)*c*Math.cos(n),y:(a+s)*c*Math.sin(n),z:(a*(1-t)+s)*o}}function no(i,t,e,n){var r=1e-12,s=r*r,a=30,o,l,c,h,u,p,d,_,g,v,x,b,A,P=i.x,N=i.y,G=i.z?i.z:0,B,X,k;if(o=Math.sqrt(P*P+N*N),l=Math.sqrt(P*P+N*N+G*G),o/e<r){if(B=0,l/e<r)return X=w,k=-n,{x:B,y:X,z:k}}else B=Math.atan2(N,P);c=G/l,h=o/l,u=1/Math.sqrt(1-t*(2-t)*h*h),_=h*(1-t)*u,g=c*u,A=0;do A++,d=e/Math.sqrt(1-t*g*g),k=o*_+G*g-d*(1-t*g*g),p=t*d/(d+k),u=1/Math.sqrt(1-p*(2-p)*h*h),v=h*(1-p)*u,x=c*u,b=x*_-v*g,_=v,g=x;while(b*b>s&&A<a);return X=Math.atan(x/Math.abs(v)),{x:B,y:X,z:k}}function pp(i,t,e){if(t===Le)return{x:i.x+e[0],y:i.y+e[1],z:i.z+e[2]};if(t===De){var n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6];return{x:c*(i.x-l*i.y+o*i.z)+n,y:c*(l*i.x+i.y-a*i.z)+r,z:c*(-o*i.x+a*i.y+i.z)+s}}}function mp(i,t,e){if(t===Le)return{x:i.x-e[0],y:i.y-e[1],z:i.z-e[2]};if(t===De){var n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],h=(i.x-n)/c,u=(i.y-r)/c,p=(i.z-s)/c;return{x:h+l*u-o*p,y:-l*h+u+a*p,z:o*h-a*u+p}}}function ro(i){return i===Le||i===De}function yp(i,t,e){if(dp(i,t)||i.datum_type===Jr||t.datum_type===Jr)return e;var n=i.a,r=i.es;if(i.datum_type===fi){var s=gp(i,!1,e);if(s!==0)return;n=Vc,r=Hc}var a=t.a,o=t.b,l=t.es;if(t.datum_type===fi&&(a=Vc,o=Rd,l=Hc),r===l&&n===a&&!ro(i.datum_type)&&!ro(t.datum_type))return e;if(e=io(e,r,n),ro(i.datum_type)&&(e=pp(e,i.datum_type,i.datum_params)),ro(t.datum_type)&&(e=mp(e,t.datum_type,t.datum_params)),e=no(e,l,a,o),t.datum_type===fi){var c=gp(t,!0,e);if(c!==0)return}return e}function gp(i,t,e){if(i.grids===null||i.grids.length===0)return console.log("Grid shift grids not found"),-1;var n={x:-e.x,y:e.y},r={x:Number.NaN,y:Number.NaN},s=[];t:for(var a=0;a<i.grids.length;a++){var o=i.grids[a];if(s.push(o.name),o.isNull){r=n;break}if(o.grid===null){if(o.mandatory)return console.log("Unable to find mandatory grid '"+o.name+"'"),-1;continue}for(var l=o.grid.subgrids,c=0,h=l.length;c<h;c++){var u=l[c],p=(Math.abs(u.del[1])+Math.abs(u.del[0]))/1e4,d=u.ll[0]-p,_=u.ll[1]-p,g=u.ll[0]+(u.lim[0]-1)*u.del[0]+p,v=u.ll[1]+(u.lim[1]-1)*u.del[1]+p;if(!(_>n.y||d>n.x||v<n.y||g<n.x)&&(r=Cb(n,t,u),!isNaN(r.x)))break t}}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-n.x*Rt+" "+n.y*Rt+" tried: '"+s+"'"),-1):(e.x=-r.x,e.y=r.y,0)}function Cb(i,t,e){var n={x:Number.NaN,y:Number.NaN};if(isNaN(i.x))return n;var r={x:i.x,y:i.y};r.x-=e.ll[0],r.y-=e.ll[1],r.x=I(r.x-Math.PI)+Math.PI;var s=_p(r,e);if(t){if(isNaN(s.x))return n;s.x=r.x-s.x,s.y=r.y-s.y;var a=9,o=1e-12,l,c;do{if(c=_p(s,e),isNaN(c.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}l={x:r.x-(c.x+s.x),y:r.y-(c.y+s.y)},s.x+=l.x,s.y+=l.y}while(a--&&Math.abs(l.x)>o&&Math.abs(l.y)>o);if(a<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=I(s.x+e.ll[0]),n.y=s.y+e.ll[1]}else isNaN(s.x)||(n.x=i.x+s.x,n.y=i.y+s.y);return n}function _p(i,t){var e={x:i.x/t.del[0],y:i.y/t.del[1]},n={x:Math.floor(e.x),y:Math.floor(e.y)},r={x:e.x-1*n.x,y:e.y-1*n.y},s={x:Number.NaN,y:Number.NaN},a;if(n.x<0||n.x>=t.lim[0]||n.y<0||n.y>=t.lim[1])return s;a=n.y*t.lim[0]+n.x;var o={x:t.cvs[a][0],y:t.cvs[a][1]};a++;var l={x:t.cvs[a][0],y:t.cvs[a][1]};a+=t.lim[0];var c={x:t.cvs[a][0],y:t.cvs[a][1]};a--;var h={x:t.cvs[a][0],y:t.cvs[a][1]},u=r.x*r.y,p=r.x*(1-r.y),d=(1-r.x)*(1-r.y),_=(1-r.x)*r.y;return s.x=d*o.x+p*l.x+_*h.x+u*c.x,s.y=d*o.y+p*l.y+_*h.y+u*c.y,s}var cn=["x","y","z"];function vp(i,t){let e={};for(let n=0,r=i.axis.length;n<r;n++){if(n===2&&t.z===void 0)continue;let s=t[cn[n]];switch(i.axis[n]){case"e":e.x=s;break;case"w":e.x=-s;break;case"n":e.y=s;break;case"s":e.y=-s;break;case"u":e.z=s;break;case"d":e.z=-s;break;default:return null}}return e}function xp(i,t){let e={};for(let n=0,r=i.axis.length;n<r;n++)if(!(n===2&&t.z===void 0))switch(i.axis[n]){case"e":e[cn[n]]=t.x;break;case"w":e[cn[n]]=-t.x;break;case"n":e[cn[n]]=t.y;break;case"s":e[cn[n]]=-t.y;break;case"u":e[cn[n]]=t.z;break;case"d":e[cn[n]]=-t.z;break;default:return null}return e}function tr(i){var t={x:i[0],y:i[1]};return i.length>2&&(t.z=i[2]),i.length>3&&(t.m=i[3]),t}function Sp(i){Mp(i.x),Mp(i.y)}function Mp(i){if(typeof Number.isFinite=="function"){if(Number.isFinite(i))return;throw new TypeError("coordinates must be finite numbers")}if(typeof i!="number"||i!==i||!isFinite(i))throw new TypeError("coordinates must be finite numbers")}function Pb(i,t){return(i.datum.datum_type===Le||i.datum.datum_type===De||i.datum.datum_type===fi)&&t.datumCode!=="WGS84"||(t.datum.datum_type===Le||t.datum.datum_type===De||t.datum.datum_type===fi)&&i.datumCode!=="WGS84"}var bp,so;function ts(i,t,e,n){var r=e.z!==void 0;if(Sp(e),i.datum&&t.datum&&Pb(i,t)&&((!so||bp!==pi("WGS84"))&&(so=new Oe("WGS84"),bp=pi("WGS84")),e=ts(i,so,e,n),i=so),n&&i.axis!=="enu"&&(e=vp(i,e)),i.projName==="longlat")e={x:e.x*ut,y:e.y*ut,z:e.z||0};else if(i.to_meter&&(e={x:e.x*i.to_meter,y:e.y*i.to_meter,z:e.z||0}),e=i.inverse(e),!e)return;if(i.from_greenwich&&(e.x+=i.from_greenwich),e=yp(i.datum,t.datum,e),!!e)return e=e,t.from_greenwich&&(e={x:e.x-t.from_greenwich,y:e.y,z:e.z||0}),t.projName==="longlat"?(t.long_wrap!==void 0&&(e.x=t.long_wrap+I(e.x-t.long_wrap)),e={x:e.x*Rt,y:e.y*Rt,z:e.z||0}):(e=t.forward(e),t.to_meter&&(e={x:e.x/t.to_meter,y:e.y/t.to_meter,z:e.z||0})),n&&t.axis!=="enu"?xp(t,e):(e&&!r&&t.projName!=="geocent"&&(e=e.m===void 0?{x:e.x,y:e.y}:{x:e.x,y:e.y,m:e.m}),e)}function rh(i,t,e,n){var r;return Array.isArray(e)?r=tr(e):r={x:e.x,y:e.y,z:e.z,m:e.m},ts(i,t,r,n)}var Ep=Oe("WGS84");function sh(i,t,e,n){var r,s,a;return Array.isArray(e)?(r=ts(i,t,tr(e),n)||{x:NaN,y:NaN},e.length>2?(s=typeof i.name<"u"&&i.name==="geocent"||typeof t.name<"u"&&t.name==="geocent",s?typeof r.z=="number"?[r.x,r.y,r.z].concat(e.slice(3)):[r.x,r.y,e[2]].concat(e.slice(3)):n&&typeof r.z=="number"?[r.x,r.y,r.z].concat(e.slice(3)):[r.x,r.y].concat(e.slice(2))):[r.x,r.y]):(r=ts(i,t,{x:e.x,y:e.y,z:e.z,m:e.m},n)||{x:NaN,y:NaN},a=Object.keys(e),a.length===2||(s=typeof i.name<"u"&&i.name==="geocent"||typeof t.name<"u"&&t.name==="geocent",a.forEach(function(o){o==="x"||o==="y"||o==="z"&&(s||n)||(r[o]=e[o])})),r)}function ao(i){return i instanceof Oe?i:typeof i=="object"&&"oProj"in i?i.oProj:Oe(i)}function Rb(i,t,e){var n,r,s=!1,a;return typeof t>"u"?(r=ao(i),n=Ep,s=!0):(typeof t.x<"u"||Array.isArray(t))&&(e=t,r=ao(i),n=Ep,s=!0),n||(n=ao(i)),r||(r=ao(t)),e?sh(n,r,e):(a={forward:function(o,l){return sh(n,r,o,l)},inverse:function(o,l){return sh(r,n,o,l)}},s&&(a.oProj=r),a)}var wp=Rb;var Tp=6,Cp="AJSAJS",Pp="AFAFAF",er=65,oe=73,we=79,es=86,is=90,Rp={forward:oh,inverse:Ib,toPoint:lh};function oh(i,t){return t=t||5,Db(Nb({lat:i[1],lon:i[0]}),t)}function Ib(i){var t=ch(Np(i.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function lh(i){var t=ch(Np(i.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function ah(i){return i*(Math.PI/180)}function Ap(i){return 180*(i/Math.PI)}function Nb(i){var t=i.lat,e=i.lon,n=6378137,r=.00669438,s=.9996,a,o,l,c,h,u,p,d=ah(t),_=ah(e),g,v;v=Math.floor((e+180)/6)+1,e===180&&(v=60),t>=56&&t<64&&e>=3&&e<12&&(v=32),t>=72&&t<84&&(e>=0&&e<9?v=31:e>=9&&e<21?v=33:e>=21&&e<33?v=35:e>=33&&e<42&&(v=37)),a=(v-1)*6-180+3,g=ah(a),o=r/(1-r),l=n/Math.sqrt(1-r*Math.sin(d)*Math.sin(d)),c=Math.tan(d)*Math.tan(d),h=o*Math.cos(d)*Math.cos(d),u=Math.cos(d)*(_-g),p=n*((1-r/4-3*r*r/64-5*r*r*r/256)*d-(3*r/8+3*r*r/32+45*r*r*r/1024)*Math.sin(2*d)+(15*r*r/256+45*r*r*r/1024)*Math.sin(4*d)-35*r*r*r/3072*Math.sin(6*d));var x=s*l*(u+(1-c+h)*u*u*u/6+(5-18*c+c*c+72*h-58*o)*u*u*u*u*u/120)+5e5,b=s*(p+l*Math.tan(d)*(u*u/2+(5-c+9*h+4*h*h)*u*u*u*u/24+(61-58*c+c*c+600*h-330*o)*u*u*u*u*u*u/720));return t<0&&(b+=1e7),{northing:Math.round(b),easting:Math.round(x),zoneNumber:v,zoneLetter:Lb(t)}}function ch(i){var t=i.northing,e=i.easting,n=i.zoneLetter,r=i.zoneNumber;if(r<0||r>60)return null;var s=.9996,a=6378137,o=.00669438,l,c=(1-Math.sqrt(1-o))/(1+Math.sqrt(1-o)),h,u,p,d,_,g,v,x,b,A=e-5e5,P=t;n<"N"&&(P-=1e7),v=(r-1)*6-180+3,l=o/(1-o),g=P/s,x=g/(a*(1-o/4-3*o*o/64-5*o*o*o/256)),b=x+(3*c/2-27*c*c*c/32)*Math.sin(2*x)+(21*c*c/16-55*c*c*c*c/32)*Math.sin(4*x)+151*c*c*c/96*Math.sin(6*x),h=a/Math.sqrt(1-o*Math.sin(b)*Math.sin(b)),u=Math.tan(b)*Math.tan(b),p=l*Math.cos(b)*Math.cos(b),d=a*(1-o)/Math.pow(1-o*Math.sin(b)*Math.sin(b),1.5),_=A/(h*s);var N=b-h*Math.tan(b)/d*(_*_/2-(5+3*u+10*p-4*p*p-9*l)*_*_*_*_/24+(61+90*u+298*p+45*u*u-252*l-3*p*p)*_*_*_*_*_*_/720);N=Ap(N);var G=(_-(1+2*u+p)*_*_*_/6+(5-2*p+28*u-3*p*p+8*l+24*u*u)*_*_*_*_*_/120)/Math.cos(b);G=v+Ap(G);var B;if(i.accuracy){var X=ch({northing:i.northing+i.accuracy,easting:i.easting+i.accuracy,zoneLetter:i.zoneLetter,zoneNumber:i.zoneNumber});B={top:X.lat,right:X.lon,bottom:N,left:G}}else B={lat:N,lon:G};return B}function Lb(i){var t="Z";return 84>=i&&i>=72?t="X":72>i&&i>=64?t="W":64>i&&i>=56?t="V":56>i&&i>=48?t="U":48>i&&i>=40?t="T":40>i&&i>=32?t="S":32>i&&i>=24?t="R":24>i&&i>=16?t="Q":16>i&&i>=8?t="P":8>i&&i>=0?t="N":0>i&&i>=-8?t="M":-8>i&&i>=-16?t="L":-16>i&&i>=-24?t="K":-24>i&&i>=-32?t="J":-32>i&&i>=-40?t="H":-40>i&&i>=-48?t="G":-48>i&&i>=-56?t="F":-56>i&&i>=-64?t="E":-64>i&&i>=-72?t="D":-72>i&&i>=-80&&(t="C"),t}function Db(i,t){var e="00000"+i.easting,n="00000"+i.northing;return i.zoneNumber+i.zoneLetter+Ob(i.easting,i.northing,i.zoneNumber)+e.substr(e.length-5,t)+n.substr(n.length-5,t)}function Ob(i,t,e){var n=Ip(e),r=Math.floor(i/1e5),s=Math.floor(t/1e5)%20;return Ub(r,s,n)}function Ip(i){var t=i%Tp;return t===0&&(t=Tp),t}function Ub(i,t,e){var n=e-1,r=Cp.charCodeAt(n),s=Pp.charCodeAt(n),a=r+i-1,o=s+t,l=!1;a>is&&(a=a-is+er-1,l=!0),(a===oe||r<oe&&a>oe||(a>oe||r<oe)&&l)&&a++,(a===we||r<we&&a>we||(a>we||r<we)&&l)&&(a++,a===oe&&a++),a>is&&(a=a-is+er-1),o>es?(o=o-es+er-1,l=!0):l=!1,(o===oe||s<oe&&o>oe||(o>oe||s<oe)&&l)&&o++,(o===we||s<we&&o>we||(o>we||s<we)&&l)&&(o++,o===oe&&o++),o>es&&(o=o-es+er-1);var c=String.fromCharCode(a)+String.fromCharCode(o);return c}function Np(i){if(i&&i.length===0)throw"MGRSPoint coverting from nothing";for(var t=i.length,e=null,n="",r,s=0;!/[A-Z]/.test(r=i.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+i;n+=r,s++}var a=parseInt(n,10);if(s===0||s+3>t)throw"MGRSPoint bad conversion from: "+i;var o=i.charAt(s++);if(o<="A"||o==="B"||o==="Y"||o>="Z"||o==="I"||o==="O")throw"MGRSPoint zone letter "+o+" not handled: "+i;e=i.substring(s,s+=2);for(var l=Ip(a),c=Fb(e.charAt(0),l),h=Bb(e.charAt(1),l);h<Gb(o);)h+=2e6;var u=t-s;if(u%2!==0)throw`MGRSPoint has to have an even number
3846
3846
  of digits after the zone letter and two 100km letters - front
3847
3847
  half for easting meters, second half for
3848
- northing meters`+n;var m=u/2,d=0,g=0,y,v,S,w,I;return m>0&&(y=1e5/Math.pow(10,m),v=n.substring(s,s+m),d=parseFloat(v)*y,S=n.substring(s+m),g=parseFloat(S)*y),w=d+c,I=g+h,{easting:w,northing:I,zoneLetter:o,zoneNumber:a,accuracy:y}}function DS(n,t){for(var e=rp.charCodeAt(t-1),i=1e5,r=!1;e!==n.charCodeAt(0);){if(e++,e===se&&e++,e===Ee&&e++,e>es){if(r)throw"Bad character: "+n;e=Ji,r=!0}i+=1e5}return i}function US(n,t){if(n>"V")throw"MGRSPoint given invalid Northing "+n;for(var e=sp.charCodeAt(t-1),i=0,r=!1;e!==n.charCodeAt(0);){if(e++,e===se&&e++,e===Ee&&e++,e>ts){if(r)throw"Bad character: "+n;e=Ji,r=!0}i+=1e5}return i}function FS(n){var t;switch(n){case"C":t=11e5;break;case"D":t=2e6;break;case"E":t=28e5;break;case"F":t=37e5;break;case"G":t=46e5;break;case"H":t=55e5;break;case"J":t=64e5;break;case"K":t=73e5;break;case"L":t=82e5;break;case"M":t=91e5;break;case"N":t=0;break;case"P":t=8e5;break;case"Q":t=17e5;break;case"R":t=26e5;break;case"S":t=35e5;break;case"T":t=44e5;break;case"U":t=53e5;break;case"V":t=62e5;break;case"W":t=7e6;break;case"X":t=79e5;break;default:t=-1}if(t>=0)return t;throw"Invalid zone letter: "+n}function $i(n,t,e){if(!(this instanceof $i))return new $i(n,t,e);if(Array.isArray(n))this.x=n[0],this.y=n[1],this.z=n[2]||0;else if(typeof n=="object")this.x=n.x,this.y=n.y,this.z=n.z||0;else if(typeof n=="string"&&typeof t>"u"){var i=n.split(",");this.x=parseFloat(i[0]),this.y=parseFloat(i[1]),this.z=parseFloat(i[2])||0}else this.x=n,this.y=t,this.z=e||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}$i.fromMGRS=function(n){return new $i($c(n))};$i.prototype.toMGRS=function(n){return Jc([this.x,this.y],n)};var cp=$i;var OS=1,BS=.25,hp=.046875,up=.01953125,fp=.01068115234375,GS=.75,zS=.46875,kS=.013020833333333334,VS=.007120768229166667,HS=.3645833333333333,WS=.005696614583333333,XS=.3076171875;function Ki(n){var t=[];t[0]=OS-n*(BS+n*(hp+n*(up+n*fp))),t[1]=n*(GS-n*(hp+n*(up+n*fp)));var e=n*n;return t[2]=e*(zS-n*(kS+n*VS)),e*=n,t[3]=e*(HS-n*WS),t[4]=e*n*XS,t}function Ye(n,t,e,i){return e*=t,t*=t,i[0]*n-e*(i[1]+t*(i[2]+t*(i[3]+t*i[4])))}var qS=20;function Qi(n,t,e){for(var i=1/(1-t),r=n,s=qS;s;--s){var a=Math.sin(r),o=1-t*a*a;if(o=(Ye(r,a,Math.cos(r),e)-n)*(o*Math.sqrt(o))*i,r-=o,Math.abs(o)<D)return r}return r}function YS(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=Ki(this.es),this.ml0=Ye(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function jS(n){var t=n.x,e=n.y,i=N(t-this.long0,this.over),r,s,a,o=Math.sin(e),l=Math.cos(e);if(this.es){var h=l*i,u=Math.pow(h,2),m=this.ep2*Math.pow(l,2),d=Math.pow(m,2),g=Math.abs(l)>D?Math.tan(e):0,y=Math.pow(g,2),v=Math.pow(y,2);r=1-this.es*Math.pow(o,2),h=h/Math.sqrt(r);var S=Ye(e,o,l,this.en);s=this.a*(this.k0*h*(1+u/6*(1-y+m+u/20*(5-18*y+v+14*m-58*y*m+u/42*(61+179*v-v*y-479*y)))))+this.x0,a=this.a*(this.k0*(S-this.ml0+o*i*h/2*(1+u/12*(5-y+9*m+4*d+u/30*(61+v-58*y+270*m-330*y*m+u/56*(1385+543*v-v*y-3111*y))))))+this.y0}else{var c=l*Math.sin(i);if(Math.abs(Math.abs(c)-1)<D)return 93;if(s=.5*this.a*this.k0*Math.log((1+c)/(1-c))+this.x0,a=l*Math.cos(i)/Math.sqrt(1-Math.pow(c,2)),c=Math.abs(a),c>=1){if(c-1>D)return 93;a=0}else a=Math.acos(a);e<0&&(a=-a),a=this.a*this.k0*(a-this.lat0)+this.y0}return n.x=s,n.y=a,n}function ZS(n){var t,e,i,r,s=(n.x-this.x0)*(1/this.a),a=(n.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+a/this.k0,e=Qi(t,this.es,this.en),Math.abs(e)<T){var u=Math.sin(e),m=Math.cos(e),d=Math.abs(m)>D?Math.tan(e):0,g=this.ep2*Math.pow(m,2),y=Math.pow(g,2),v=Math.pow(d,2),S=Math.pow(v,2);t=1-this.es*Math.pow(u,2);var w=s*Math.sqrt(t)/this.k0,I=Math.pow(w,2);t=t*d,i=e-t*I/(1-this.es)*.5*(1-I/12*(5+3*v-9*g*v+g-4*y-I/30*(61+90*v-252*g*v+45*S+46*g-I/56*(1385+3633*v+4095*S+1574*S*v)))),r=N(this.long0+w*(1-I/6*(1+2*v+g-I/20*(5+28*v+24*S+8*g*v+6*g-I/42*(61+662*v+1320*S+720*S*v))))/m,this.over)}else i=T*qe(a),r=0;else{var o=Math.exp(s/this.k0),l=.5*(o-1/o),c=this.lat0+a/this.k0,h=Math.cos(c);t=Math.sqrt((1-Math.pow(h,2))/(1+Math.pow(l,2))),i=Math.asin(t),a<0&&(i=-i),l===0&&h===0?r=0:r=N(Math.atan2(l,h)+this.long0,this.over)}return n.x=r,n.y=i,n}var JS=["Fast_Transverse_Mercator","Fast Transverse Mercator"],tr={init:YS,forward:jS,inverse:ZS,names:JS};function no(n){var t=Math.exp(n);return t=(t-1/t)/2,t}function At(n,t){n=Math.abs(n),t=Math.abs(t);var e=Math.max(n,t),i=Math.min(n,t)/(e||1);return e*Math.sqrt(1+Math.pow(i,2))}function dp(n){var t=1+n,e=t-1;return e===0?n:n*Math.log(t)/e}function pp(n){var t=Math.abs(n);return t=dp(t*(1+t/(At(1,t)+1))),n<0?-t:t}function io(n,t){for(var e=2*Math.cos(2*t),i=n.length-1,r=n[i],s=0,a;--i>=0;)a=-s+e*r+n[i],s=r,r=a;return t+a*Math.sin(2*t)}function mp(n,t){for(var e=2*Math.cos(t),i=n.length-1,r=n[i],s=0,a;--i>=0;)a=-s+e*r+n[i],s=r,r=a;return Math.sin(t)*a}function gp(n){var t=Math.exp(n);return t=(t+1/t)/2,t}function Qc(n,t,e){for(var i=Math.sin(t),r=Math.cos(t),s=no(e),a=gp(e),o=2*r*a,l=-2*i*s,c=n.length-1,h=n[c],u=0,m=0,d=0,g,y;--c>=0;)g=m,y=u,m=h,u=d,h=-g+o*m-l*u+n[c],d=-y+l*m+o*u;return o=i*a,l=r*s,[o*h-l*d,o*d+l*h]}function $S(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(tr.init.apply(this),this.forward=tr.forward,this.inverse=tr.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.k0=this.k0!==void 0?this.k0:1,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var n=this.es/(1+Math.sqrt(1-this.es)),t=n/(2-n),e=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+t*(-2854/675)))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))),e=e*t,this.cgb[1]=e*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+t*(2323/945))))),this.cbg[1]=e*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),e=e*t,this.cgb[2]=e*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=e*(-26/15+t*(34/21+t*(8/5+t*(-12686/2835)))),e=e*t,this.cgb[3]=e*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=e*(1237/630+t*(-12/5+t*(-24832/14175))),e=e*t,this.cgb[4]=e*(4174/315+t*(-144838/6237)),this.cbg[4]=e*(-734/315+t*(109598/31185)),e=e*t,this.cgb[5]=e*(601676/22275),this.cbg[5]=e*(444337/155925),e=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+e*(1/4+e*(1/64+e/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=e*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=e*(13/48+t*(-3/5+t*(557/1440+t*(281/630+t*(-1983433/1935360))))),e=e*t,this.utg[2]=e*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=e*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),e=e*t,this.utg[3]=e*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=e*(49561/161280+t*(-179/168+t*(6601661/7257600))),e=e*t,this.utg[4]=e*(-4583/161280+t*(108847/3991680)),this.gtu[4]=e*(34729/80640+t*(-3418889/1995840)),e=e*t,this.utg[5]=e*(-20648693/638668800),this.gtu[5]=e*(212378941/319334400);var i=io(this.cbg,this.lat0);this.Zb=-this.Qn*(i+mp(this.gtu,2*i))}function KS(n){var t=N(n.x-this.long0,this.over),e=n.y;e=io(this.cbg,e);var i=Math.sin(e),r=Math.cos(e),s=Math.sin(t),a=Math.cos(t);e=Math.atan2(i,a*r),t=Math.atan2(s*r,At(i,r*a)),t=pp(Math.tan(t));var o=Qc(this.gtu,2*e,2*t);e=e+o[0],t=t+o[1];var l,c;return Math.abs(t)<=2.623395162778?(l=this.a*(this.Qn*t)+this.x0,c=this.a*(this.Qn*e+this.Zb)+this.y0):(l=1/0,c=1/0),n.x=l,n.y=c,n}function QS(n){var t=(n.x-this.x0)*(1/this.a),e=(n.y-this.y0)*(1/this.a);e=(e-this.Zb)/this.Qn,t=t/this.Qn;var i,r;if(Math.abs(t)<=2.623395162778){var s=Qc(this.utg,2*e,2*t);e=e+s[0],t=t+s[1],t=Math.atan(no(t));var a=Math.sin(e),o=Math.cos(e),l=Math.sin(t),c=Math.cos(t);e=Math.atan2(a*c,At(l,c*o)),t=Math.atan2(l,c*o),i=N(t+this.long0,this.over),r=io(this.cgb,e)}else i=1/0,r=1/0;return n.x=i,n.y=r,n}var tb=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"],er={init:$S,forward:KS,inverse:QS,names:tb};function _p(n,t){if(n===void 0){if(n=Math.floor((N(t)+Math.PI)*30/Math.PI)+1,n<0)return 0;if(n>60)return 60}return n}var eb="etmerc";function nb(){var n=_p(this.zone,this.long0);if(n===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(n)-183)*dt,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,er.init.apply(this),this.forward=er.forward,this.inverse=er.inverse}var ib=["Universal Transverse Mercator System","utm"],yp={init:nb,names:ib,dependsOn:eb};function ro(n,t){return Math.pow((1-n)/(1+n),t)}var rb=20;function sb(){var n=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*n*n),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(n/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+st)/(Math.pow(Math.tan(.5*this.lat0+st),this.C)*ro(this.e*n,this.ratexp))}function ab(n){var t=n.x,e=n.y;return n.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*e+st),this.C)*ro(this.e*Math.sin(e),this.ratexp))-T,n.x=this.C*t,n}function ob(n){for(var t=1e-14,e=n.x/this.C,i=n.y,r=Math.pow(Math.tan(.5*i+st)/this.K,1/this.C),s=rb;s>0&&(i=2*Math.atan(r*ro(this.e*Math.sin(n.y),-.5*this.e))-T,!(Math.abs(i-n.y)<t));--s)n.y=i;return s?(n.x=e,n.y=i,n):null}var lb=["gauss"],so={init:sb,forward:ab,inverse:ob,names:lb};function cb(){so.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function hb(n){var t,e,i,r;return n.x=N(n.x-this.long0,this.over),so.forward.apply(this,[n]),t=Math.sin(n.y),e=Math.cos(n.y),i=Math.cos(n.x),r=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*e*i),n.x=r*e*Math.sin(n.x),n.y=r*(this.cosc0*t-this.sinc0*e*i),n.x=this.a*n.x+this.x0,n.y=this.a*n.y+this.y0,n}function ub(n){var t,e,i,r,s;if(n.x=(n.x-this.x0)/this.a,n.y=(n.y-this.y0)/this.a,n.x/=this.k0,n.y/=this.k0,s=At(n.x,n.y)){var a=2*Math.atan2(s,this.R2);t=Math.sin(a),e=Math.cos(a),r=Math.asin(e*this.sinc0+n.y*t*this.cosc0/s),i=Math.atan2(n.x*t,s*this.cosc0*e-n.y*this.sinc0*t)}else r=this.phic0,i=0;return n.x=i,n.y=r,so.inverse.apply(this,[n]),n.x=N(n.x+this.long0,this.over),n}var fb=["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],vp={init:cb,forward:hb,inverse:ub,names:fb};function th(n,t,e){return t*=e,Math.tan(.5*(T+n))*Math.pow((1-t)/(1+t),.5*e)}function db(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=D&&(this.k0=.5*(1+qe(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=D&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=D&&Math.abs(Math.cos(this.lat_ts))>D&&(this.k0=.5*this.cons*Wt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Jt(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Wt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(th(this.lat0,this.sinlat0,this.e))-T,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function pb(n){var t=n.x,e=n.y,i=Math.sin(e),r=Math.cos(e),s,a,o,l,c,h,u=N(t-this.long0,this.over);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=D&&Math.abs(e+this.lat0)<=D?(n.x=NaN,n.y=NaN,n):this.sphere?(s=2*this.k0/(1+this.sinlat0*i+this.coslat0*r*Math.cos(u)),n.x=this.a*s*r*Math.sin(u)+this.x0,n.y=this.a*s*(this.coslat0*i-this.sinlat0*r*Math.cos(u))+this.y0,n):(a=2*Math.atan(th(e,i,this.e))-T,l=Math.cos(a),o=Math.sin(a),Math.abs(this.coslat0)<=D?(c=Jt(this.e,e*this.con,this.con*i),h=2*this.a*this.k0*c/this.cons,n.x=this.x0+h*Math.sin(t-this.long0),n.y=this.y0-this.con*h*Math.cos(t-this.long0),n):(Math.abs(this.sinlat0)<D?(s=2*this.a*this.k0/(1+l*Math.cos(u)),n.y=s*o):(s=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*o+this.cosX0*l*Math.cos(u))),n.y=s*(this.cosX0*o-this.sinX0*l*Math.cos(u))+this.y0),n.x=s*l*Math.sin(u)+this.x0,n))}function mb(n){n.x-=this.x0,n.y-=this.y0;var t,e,i,r,s,a=Math.sqrt(n.x*n.x+n.y*n.y);if(this.sphere){var o=2*Math.atan(a/(2*this.a*this.k0));return t=this.long0,e=this.lat0,a<=D?(n.x=t,n.y=e,n):(e=Math.asin(Math.cos(o)*this.sinlat0+n.y*Math.sin(o)*this.coslat0/a),Math.abs(this.coslat0)<D?this.lat0>0?t=N(this.long0+Math.atan2(n.x,-1*n.y),this.over):t=N(this.long0+Math.atan2(n.x,n.y),this.over):t=N(this.long0+Math.atan2(n.x*Math.sin(o),a*this.coslat0*Math.cos(o)-n.y*this.sinlat0*Math.sin(o)),this.over),n.x=t,n.y=e,n)}else if(Math.abs(this.coslat0)<=D){if(a<=D)return e=this.lat0,t=this.long0,n.x=t,n.y=e,n;n.x*=this.con,n.y*=this.con,i=a*this.cons/(2*this.a*this.k0),e=this.con*mn(this.e,i),t=this.con*N(this.con*this.long0+Math.atan2(n.x,-1*n.y),this.over)}else r=2*Math.atan(a*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,a<=D?s=this.X0:(s=Math.asin(Math.cos(r)*this.sinX0+n.y*Math.sin(r)*this.cosX0/a),t=N(this.long0+Math.atan2(n.x*Math.sin(r),a*this.cosX0*Math.cos(r)-n.y*this.sinX0*Math.sin(r)),this.over)),e=-1*mn(this.e,Math.tan(.5*(T+s)));return n.x=t,n.y=e,n}var gb=["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],xp={init:db,forward:pb,inverse:mb,names:gb,ssfn_:th};function _b(){this.k0||(this.k0=1);var n=this.lat0;this.lambda0=this.long0;var t=Math.sin(n),e=this.a,i=this.rf,r=1/i,s=2*r-Math.pow(r,2),a=this.e=Math.sqrt(s);this.R=this.k0*e*Math.sqrt(1-s)/(1-s*Math.pow(t,2)),this.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(n),4)),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+n/2)),c=Math.log((1+a*t)/(1-a*t));this.K=o-this.alpha*l+this.alpha*a/2*c}function yb(n){var t=Math.log(Math.tan(Math.PI/4-n.y/2)),e=this.e/2*Math.log((1+this.e*Math.sin(n.y))/(1-this.e*Math.sin(n.y))),i=-this.alpha*(t+e)+this.K,r=2*(Math.atan(Math.exp(i))-Math.PI/4),s=this.alpha*(n.x-this.lambda0),a=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(s))),o=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(s));return n.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,n.x=this.R*a+this.x0,n}function vb(n){for(var t=n.x-this.x0,e=n.y-this.y0,i=t/this.R,r=2*(Math.atan(Math.exp(e/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(i)),a=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(r))),o=this.lambda0+a/this.alpha,l=0,c=s,h=-1e3,u=0;Math.abs(c-h)>1e-7;){if(++u>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(c))/2)),h=c,c=2*Math.atan(Math.exp(l))-Math.PI/2}return n.x=o,n.y=c,n}var xb=["somerc"],Mp={init:_b,forward:yb,inverse:vb,names:xb};var nr=1e-7;function Mb(n){var t=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],e=typeof n.projName=="object"?Object.keys(n.projName)[0]:n.projName;return"no_uoff"in n||"no_off"in n||t.indexOf(e)!==-1||t.indexOf(Vc(e))!==-1}function Sb(){var n,t,e,i,r,s,a,o,l,c,h=0,u,m=0,d=0,g=0,y=0,v=0,S=0;this.k0||(this.k0=1),this.no_off=Mb(this),this.no_rot="no_rot"in this;var w=!1;"alpha"in this&&(w=!0);var I=!1;if("rectified_grid_angle"in this&&(I=!0),w&&(S=this.alpha),I&&(h=this.rectified_grid_angle,w||(S=0,w=!0)),w||I)m=this.longc;else if(d=this.long1,y=this.lat1,g=this.long2,v=this.lat2,Math.abs(y-v)<=nr||(n=Math.abs(y))<=nr||Math.abs(n-T)<=nr||Math.abs(Math.abs(this.lat0)-T)<=nr||Math.abs(Math.abs(v)-T)<=nr)throw new Error;var U=1-this.es;t=Math.sqrt(U),Math.abs(this.lat0)>D?(o=Math.sin(this.lat0),e=Math.cos(this.lat0),n=1-this.es*o*o,this.B=e*e,this.B=Math.sqrt(1+this.es*this.B*this.B/U),this.A=this.B*this.k0*t/n,i=this.B*t/(e*Math.sqrt(n)),r=i*i-1,r<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=i,this.E*=Math.pow(Jt(this.e,this.lat0,o),this.B)):(this.B=1/t,this.A=this.k0,this.E=i=r=1),w||I?(w?(u=Math.asin(Math.sin(S)/i),I||(h=S)):(u=h,S=Math.asin(i*Math.sin(u))),this.lam0=m-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(s=Math.pow(Jt(this.e,y,Math.sin(y)),this.B),a=Math.pow(Jt(this.e,v,Math.sin(v)),this.B),r=this.E/s,l=(a-s)/(a+s),c=this.E*this.E,c=(c-a*s)/(c+a*s),n=d-g,n<-Math.PI?g-=Xn:n>Math.PI&&(g+=Xn),this.lam0=N(.5*(d+g)-Math.atan(c*Math.tan(.5*this.B*(d-g))/l)/this.B,this.over),u=Math.atan(2*Math.sin(this.B*N(d-this.lam0,this.over))/(r-1/r)),h=S=Math.asin(i*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(h),this.cosrot=Math.cos(h),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(i*i-1)/Math.cos(S))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(st-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(st+r))}function bb(n){var t={},e,i,r,s,a,o,l,c;if(n.x=n.x-this.lam0,Math.abs(Math.abs(n.y)-T)>D){if(a=this.E/Math.pow(Jt(this.e,n.y,Math.sin(n.y)),this.B),o=1/a,e=.5*(a-o),i=.5*(a+o),s=Math.sin(this.B*n.x),r=(e*this.singam-s*this.cosgam)/i,Math.abs(Math.abs(r)-1)<D)throw new Error;c=.5*this.ArB*Math.log((1-r)/(1+r)),o=Math.cos(this.B*n.x),Math.abs(o)<nr?l=this.A*n.x:l=this.ArB*Math.atan2(e*this.cosgam+s*this.singam,o)}else c=n.y>0?this.v_pole_n:this.v_pole_s,l=this.ArB*n.y;return this.no_rot?(t.x=l,t.y=c):(l-=this.u_0,t.x=c*this.cosrot+l*this.sinrot,t.y=l*this.cosrot-c*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,n.z!==void 0&&(t.z=n.z),n.m!==void 0&&(t.m=n.m),t}function wb(n){var t,e,i,r,s,a,o,l={};if(n.x=(n.x-this.x0)*(1/this.a),n.y=(n.y-this.y0)*(1/this.a),this.no_rot?(e=n.y,t=n.x):(e=n.x*this.cosrot-n.y*this.sinrot,t=n.y*this.cosrot+n.x*this.sinrot+this.u_0),i=Math.exp(-this.BrA*e),r=.5*(i-1/i),s=.5*(i+1/i),a=Math.sin(this.BrA*t),o=(a*this.cosgam+r*this.singam)/s,Math.abs(Math.abs(o)-1)<D)l.x=0,l.y=o<0?-T:T;else{if(l.y=this.E/Math.sqrt((1+o)/(1-o)),l.y=mn(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(r*this.cosgam-a*this.singam,Math.cos(this.BrA*t))}return l.x+=this.lam0,n.z!==void 0&&(l.z=n.z),n.m!==void 0&&(l.m=n.m),l}var Eb=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"],Sp={init:Sb,forward:bb,inverse:wb,names:Eb};function Tb(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,!(Math.abs(this.lat1+this.lat2)<D)){var n=this.b/this.a;this.e=Math.sqrt(1-n*n);var t=Math.sin(this.lat1),e=Math.cos(this.lat1),i=Wt(this.e,t,e),r=Jt(this.e,this.lat1,t),s=Math.sin(this.lat2),a=Math.cos(this.lat2),o=Wt(this.e,s,a),l=Jt(this.e,this.lat2,s),c=Jt(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>D?this.ns=Math.log(i/o)/Math.log(r/l):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=i/(this.ns*Math.pow(r,this.ns)),this.rh=Math.abs(Math.abs(this.lat0)-T)<D?0:this.a*this.f0*Math.pow(c,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Ab(n){var t=n.x,e=n.y;Math.abs(2*Math.abs(e)-Math.PI)<=D&&(e=qe(e)*(T-2*D));var i=Math.abs(Math.abs(e)-T),r,s;if(i>D)r=Jt(this.e,e,Math.sin(e)),s=this.a*this.f0*Math.pow(r,this.ns);else{if(i=e*this.ns,i<=0)return null;s=0}var a=this.ns*N(t-this.long0,this.over);return n.x=this.k0*(s*Math.sin(a))+this.x0,n.y=this.k0*(this.rh-s*Math.cos(a))+this.y0,n}function Cb(n){var t,e,i,r,s,a=(n.x-this.x0)/this.k0,o=this.rh-(n.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(a*a+o*o),e=1):(t=-Math.sqrt(a*a+o*o),e=-1);var l=0;if(t!==0&&(l=Math.atan2(e*a,e*o)),t!==0||this.ns>0){if(e=1/this.ns,i=Math.pow(t/(this.a*this.f0),e),r=mn(this.e,i),r===-9999)return null}else r=-T;return s=N(l/this.ns+this.long0,this.over),n.x=s,n.y=r,n}var Pb=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],bp={init:Tb,forward:Ab,inverse:Cb,names:Pb};function Rb(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Ib(n){var t,e,i,r,s,a,o,l=n.x,c=n.y,h=N(l-this.long0,this.over);return t=Math.pow((1+this.e*Math.sin(c))/(1-this.e*Math.sin(c)),this.alfa*this.e/2),e=2*(Math.atan(this.k*Math.pow(Math.tan(c/2+this.s45),this.alfa)/t)-this.s45),i=-h*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(e)+Math.sin(this.ad)*Math.cos(e)*Math.cos(i)),s=Math.asin(Math.cos(e)*Math.sin(i)/Math.cos(r)),a=this.n*s,o=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),n.y=o*Math.cos(a)/1,n.x=o*Math.sin(a)/1,this.czech||(n.y*=-1,n.x*=-1),n}function Lb(n){var t,e,i,r,s,a,o,l,c=n.x;n.x=n.y,n.y=c,this.czech||(n.y*=-1,n.x*=-1),a=Math.sqrt(n.x*n.x+n.y*n.y),s=Math.atan2(n.y,n.x),r=s/Math.sin(this.s0),i=2*(Math.atan(Math.pow(this.ro0/a,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(r)),e=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(t)),n.x=this.long0-e/this.alfa,o=t,l=0;var h=0;do n.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-n.y)<1e-10&&(l=1),o=n.y,h+=1;while(l===0&&h<15);return h>=15?null:n}var Nb=["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"],wp={init:Rb,forward:Ib,inverse:Lb,names:Nb};function Rt(n,t,e,i,r){return n*r-t*Math.sin(2*r)+e*Math.sin(4*r)-i*Math.sin(6*r)}function gn(n){return 1-.25*n*(1+n/16*(3+1.25*n))}function _n(n){return .375*n*(1+.25*n*(1+.46875*n))}function yn(n){return .05859375*n*n*(1+.75*n)}function vn(n){return n*n*n*(35/3072)}function ns(n,t,e){var i=t*e;return n/Math.sqrt(1-i*i)}function ae(n){return Math.abs(n)<T?n:n-qe(n)*Math.PI}function li(n,t,e,i,r){var s,a;s=n/t;for(var o=0;o<15;o++)if(a=(n-(t*s-e*Math.sin(2*s)+i*Math.sin(4*s)-r*Math.sin(6*s)))/(t-2*e*Math.cos(2*s)+4*i*Math.cos(4*s)-6*r*Math.cos(6*s)),s+=a,Math.abs(a)<=1e-10)return s;return NaN}function Db(){this.sphere||(this.e0=gn(this.es),this.e1=_n(this.es),this.e2=yn(this.es),this.e3=vn(this.es),this.ml0=this.a*Rt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Ub(n){var t,e,i=n.x,r=n.y;if(i=N(i-this.long0,this.over),this.sphere)t=this.a*Math.asin(Math.cos(r)*Math.sin(i)),e=this.a*(Math.atan2(Math.tan(r),Math.cos(i))-this.lat0);else{var s=Math.sin(r),a=Math.cos(r),o=ns(this.a,this.e,s),l=Math.tan(r)*Math.tan(r),c=i*Math.cos(r),h=c*c,u=this.es*a*a/(1-this.es),m=this.a*Rt(this.e0,this.e1,this.e2,this.e3,r);t=o*c*(1-h*l*(1/6-(8-l+8*u)*h/120)),e=m-this.ml0+o*s/a*h*(.5+(5-l+6*u)*h/24)}return n.x=t+this.x0,n.y=e+this.y0,n}function Fb(n){n.x-=this.x0,n.y-=this.y0;var t=n.x/this.a,e=n.y/this.a,i,r;if(this.sphere){var s=e+this.lat0;i=Math.asin(Math.sin(s)*Math.cos(t)),r=Math.atan2(Math.tan(t),Math.cos(s))}else{var a=this.ml0/this.a+e,o=li(a,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-T)<=D)return n.x=this.long0,n.y=T,e<0&&(n.y*=-1),n;var l=ns(this.a,this.e,Math.sin(o)),c=l*l*l/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(o),2),u=t*this.a/l,m=u*u;i=o-l*Math.tan(o)/c*u*u*(.5-(1+3*h)*u*u/24),r=u*(1-m*(h/3+(1+3*h)*h*m/15))/Math.cos(o)}return n.x=N(r+this.long0,this.over),n.y=ae(i),n}var Ob=["Cassini","Cassini_Soldner","cass"],Ep={init:Db,forward:Ub,inverse:Fb,names:Ob};function oe(n,t){var e;return n>1e-7?(e=n*t,(1-n*n)*(t/(1-e*e)-.5/n*Math.log((1-e)/(1+e)))):2*t}var Bb=.3333333333333333,Gb=.17222222222222222,zb=.10257936507936508,kb=.06388888888888888,Vb=.0664021164021164,Hb=.016415012942191543;function is(n){var t,e=[];return e[0]=n*Bb,t=n*n,e[0]+=t*Gb,e[1]=t*kb,t*=n,e[0]+=t*zb,e[1]+=t*Vb,e[2]=t*Hb,e}function rs(n,t){var e=n+n;return n+t[0]*Math.sin(e)+t[1]*Math.sin(e+e)+t[2]*Math.sin(e+e+e)}var eh=1,nh=2,ih=3,ao=4;function Wb(){var n=Math.abs(this.lat0);if(Math.abs(n-T)<D?this.mode=this.lat0<0?eh:nh:Math.abs(n)<D?this.mode=ih:this.mode=ao,this.es>0){var t;switch(this.qp=oe(this.e,1),this.mmf=.5/(1-this.es),this.apa=is(this.es),this.mode){case nh:this.dd=1;break;case eh:this.dd=1;break;case ih:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case ao:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=oe(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===ao&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Xb(n){var t,e,i,r,s,a,o,l,c,h,u=n.x,m=n.y;if(u=N(u-this.long0,this.over),this.sphere){if(s=Math.sin(m),h=Math.cos(m),i=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e=this.mode===this.EQUIT?1+h*i:1+this.sinph0*s+this.cosph0*h*i,e<=D)return null;e=Math.sqrt(2/e),t=e*h*Math.sin(u),e*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*h*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(m+this.lat0)<D)return null;e=st-m*.5,e=2*(this.mode===this.S_POLE?Math.cos(e):Math.sin(e)),t=e*Math.sin(u),e*=i}}else{switch(o=0,l=0,c=0,i=Math.cos(u),r=Math.sin(u),s=Math.sin(m),a=oe(this.e,s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(o=a/this.qp,l=Math.sqrt(1-o*o)),this.mode){case this.OBLIQ:c=1+this.sinb1*o+this.cosb1*l*i;break;case this.EQUIT:c=1+l*i;break;case this.N_POLE:c=T+m,a=this.qp-a;break;case this.S_POLE:c=m-T,a=this.qp+a;break}if(Math.abs(c)<D)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:c=Math.sqrt(2/c),this.mode===this.OBLIQ?e=this.ymf*c*(this.cosb1*o-this.sinb1*l*i):e=(c=Math.sqrt(2/(1+l*i)))*o*this.ymf,t=this.xmf*c*l*r;break;case this.N_POLE:case this.S_POLE:a>=0?(t=(c=Math.sqrt(a))*r,e=i*(this.mode===this.S_POLE?c:-c)):t=e=0;break}}return n.x=this.a*t+this.x0,n.y=this.a*e+this.y0,n}function qb(n){n.x-=this.x0,n.y-=this.y0;var t=n.x/this.a,e=n.y/this.a,i,r,s,a,o,l,c;if(this.sphere){var h=0,u,m=0;if(u=Math.sqrt(t*t+e*e),r=u*.5,r>1)return null;switch(r=2*Math.asin(r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(m=Math.sin(r),h=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(u)<=D?0:Math.asin(e*m/u),t*=m,e=h*u;break;case this.OBLIQ:r=Math.abs(u)<=D?this.lat0:Math.asin(h*this.sinph0+e*m*this.cosph0/u),t*=m*this.cosph0,e=(h-Math.sin(r)*this.sinph0)*u;break;case this.N_POLE:e=-e,r=T-r;break;case this.S_POLE:r-=T;break}i=e===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,e)}else{if(c=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,e*=this.dd,l=Math.sqrt(t*t+e*e),l<D)return n.x=this.long0,n.y=this.lat0,n;a=2*Math.asin(.5*l/this.rq),s=Math.cos(a),t*=a=Math.sin(a),this.mode===this.OBLIQ?(c=s*this.sinb1+e*a*this.cosb1/l,o=this.qp*c,e=l*this.cosb1*s-e*this.sinb1*a):(c=e*a/l,o=this.qp*c,e=l*s)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(e=-e),o=t*t+e*e,!o)return n.x=this.long0,n.y=this.lat0,n;c=1-o/this.qp,this.mode===this.S_POLE&&(c=-c)}i=Math.atan2(t,e),r=rs(Math.asin(c),this.apa)}return n.x=N(this.long0+i,this.over),n.y=r,n}var Yb=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Tp={init:Wb,forward:Xb,inverse:qb,names:Yb,S_POLE:eh,N_POLE:nh,EQUIT:ih,OBLIQ:ao};function le(n){return Math.abs(n)>1&&(n=n>1?1:-1),Math.asin(n)}function jb(){Math.abs(this.lat1+this.lat2)<D||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Wt(this.e3,this.sin_po,this.cos_po),this.qs1=oe(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Wt(this.e3,this.sin_po,this.cos_po),this.qs2=oe(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=oe(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>D?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Zb(n){var t=n.x,e=n.y;this.sin_phi=Math.sin(e),this.cos_phi=Math.cos(e);var i=oe(this.e3,this.sin_phi),r=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,s=this.ns0*N(t-this.long0,this.over),a=r*Math.sin(s)+this.x0,o=this.rh-r*Math.cos(s)+this.y0;return n.x=a,n.y=o,n}function Jb(n){var t,e,i,r,s,a;return n.x-=this.x0,n.y=this.rh-n.y+this.y0,this.ns0>=0?(t=Math.sqrt(n.x*n.x+n.y*n.y),i=1):(t=-Math.sqrt(n.x*n.x+n.y*n.y),i=-1),r=0,t!==0&&(r=Math.atan2(i*n.x,i*n.y)),i=t*this.ns0/this.a,this.sphere?a=Math.asin((this.c-i*i)/(2*this.ns0)):(e=(this.c-i*i)/this.ns0,a=this.phi1z(this.e3,e)),s=N(r/this.ns0+this.long0,this.over),n.x=s,n.y=a,n}function $b(n,t){var e,i,r,s,a,o=le(.5*t);if(n<D)return o;for(var l=n*n,c=1;c<=25;c++)if(e=Math.sin(o),i=Math.cos(o),r=n*e,s=1-r*r,a=.5*s*s/i*(t/(1-l)-e/s+.5/n*Math.log((1-r)/(1+r))),o=o+a,Math.abs(a)<=1e-7)return o;return null}var Kb=["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],Ap={init:jb,forward:Zb,inverse:Jb,names:Kb,phi1z:$b};function Qb(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function tw(n){var t,e,i,r,s,a,o,l,c=n.x,h=n.y;return i=N(c-this.long0,this.over),t=Math.sin(h),e=Math.cos(h),r=Math.cos(i),a=this.sin_p14*t+this.cos_p14*e*r,s=1,a>0||Math.abs(a)<=D?(o=this.x0+this.a*s*e*Math.sin(i)/a,l=this.y0+this.a*s*(this.cos_p14*t-this.sin_p14*e*r)/a):(o=this.x0+this.infinity_dist*e*Math.sin(i),l=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*e*r)),n.x=o,n.y=l,n}function ew(n){var t,e,i,r,s,a;return n.x=(n.x-this.x0)/this.a,n.y=(n.y-this.y0)/this.a,n.x/=this.k0,n.y/=this.k0,(t=Math.sqrt(n.x*n.x+n.y*n.y))?(r=Math.atan2(t,this.rc),e=Math.sin(r),i=Math.cos(r),a=le(i*this.sin_p14+n.y*e*this.cos_p14/t),s=Math.atan2(n.x*e,t*this.cos_p14*i-n.y*this.sin_p14*e),s=N(this.long0+s,this.over)):(a=this.phic0,s=0),n.x=s,n.y=a,n}var nw=["gnom"],Cp={init:Qb,forward:tw,inverse:ew,names:nw};function Pp(n,t){var e=1-(1-n*n)/(2*n)*Math.log((1-n)/(1+n));if(Math.abs(Math.abs(t)-e)<1e-6)return t<0?-1*T:T;for(var i=Math.asin(.5*t),r,s,a,o,l=0;l<30;l++)if(s=Math.sin(i),a=Math.cos(i),o=n*s,r=Math.pow(1-o*o,2)/(2*a)*(t/(1-n*n)-s/(1-o*o)+.5/n*Math.log((1-o)/(1+o))),i+=r,Math.abs(r)<=1e-10)return i;return NaN}function iw(){this.sphere||(this.k0=Wt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function rw(n){var t=n.x,e=n.y,i,r,s=N(t-this.long0,this.over);if(this.sphere)i=this.x0+this.a*s*Math.cos(this.lat_ts),r=this.y0+this.a*Math.sin(e)/Math.cos(this.lat_ts);else{var a=oe(this.e,Math.sin(e));i=this.x0+this.a*this.k0*s,r=this.y0+this.a*a*.5/this.k0}return n.x=i,n.y=r,n}function sw(n){n.x-=this.x0,n.y-=this.y0;var t,e;return this.sphere?(t=N(this.long0+n.x/this.a/Math.cos(this.lat_ts),this.over),e=Math.asin(n.y/this.a*Math.cos(this.lat_ts))):(e=Pp(this.e,2*n.y*this.k0/this.a),t=N(this.long0+n.x/(this.a*this.k0),this.over)),n.x=t,n.y=e,n}var aw=["cea"],Rp={init:iw,forward:rw,inverse:sw,names:aw};function ow(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function lw(n){var t=n.x,e=n.y,i=N(t-this.long0,this.over),r=ae(e-this.lat0);return n.x=this.x0+this.a*i*this.rc,n.y=this.y0+this.a*r,n}function cw(n){var t=n.x,e=n.y;return n.x=N(this.long0+(t-this.x0)/(this.a*this.rc),this.over),n.y=ae(this.lat0+(e-this.y0)/this.a),n}var hw=["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"],Ip={init:ow,forward:lw,inverse:cw,names:hw};var Lp=20;function uw(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=gn(this.es),this.e1=_n(this.es),this.e2=yn(this.es),this.e3=vn(this.es),this.ml0=this.a*Rt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function fw(n){var t=n.x,e=n.y,i,r,s,a=N(t-this.long0,this.over);if(s=a*Math.sin(e),this.sphere)Math.abs(e)<=D?(i=this.a*a,r=-1*this.a*this.lat0):(i=this.a*Math.sin(s)/Math.tan(e),r=this.a*(ae(e-this.lat0)+(1-Math.cos(s))/Math.tan(e)));else if(Math.abs(e)<=D)i=this.a*a,r=-1*this.ml0;else{var o=ns(this.a,this.e,Math.sin(e))/Math.tan(e);i=o*Math.sin(s),r=this.a*Rt(this.e0,this.e1,this.e2,this.e3,e)-this.ml0+o*(1-Math.cos(s))}return n.x=i+this.x0,n.y=r+this.y0,n}function dw(n){var t,e,i,r,s,a,o,l,c;if(i=n.x-this.x0,r=n.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=D)t=N(i/this.a+this.long0,this.over),e=0;else{a=this.lat0+r/this.a,o=i*i/this.a/this.a+a*a,l=a;var h;for(s=Lp;s;--s)if(h=Math.tan(l),c=-1*(a*(l*h+1)-l-.5*(l*l+o)*h)/((l-a)/h-1),l+=c,Math.abs(c)<=D){e=l;break}t=N(this.long0+Math.asin(i*Math.tan(l)/this.a)/Math.sin(e),this.over)}else if(Math.abs(r+this.ml0)<=D)e=0,t=N(this.long0+i/this.a,this.over);else{a=(this.ml0+r)/this.a,o=i*i/this.a/this.a+a*a,l=a;var u,m,d,g,y;for(s=Lp;s;--s)if(y=this.e*Math.sin(l),u=Math.sqrt(1-y*y)*Math.tan(l),m=this.a*Rt(this.e0,this.e1,this.e2,this.e3,l),d=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),g=m/this.a,c=(a*(u*g+1)-g-.5*u*(g*g+o))/(this.es*Math.sin(2*l)*(g*g+o-2*a*g)/(4*u)+(a-g)*(u*d-2/Math.sin(2*l))-d),l-=c,Math.abs(c)<=D){e=l;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(e),2))*Math.tan(e),t=N(this.long0+Math.asin(i*u/this.a)/Math.sin(e),this.over)}return n.x=t,n.y=e,n}var pw=["Polyconic","American_Polyconic","poly"],Np={init:uw,forward:fw,inverse:dw,names:pw};var mw=1;function gw(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function _w(n){var t,e=n.x,i=n.y,r=i-this.lat0,s=e-this.long0,a=r/ri*1e-5,o=s,l=1,c=0;for(t=1;t<=10;t++)l=l*a,c=c+this.A[t]*l;var h=c,u=o,m=1,d=0,g,y,v=0,S=0;for(t=1;t<=6;t++)g=m*h-d*u,y=d*h+m*u,m=g,d=y,v=v+this.B_re[t]*m-this.B_im[t]*d,S=S+this.B_im[t]*m+this.B_re[t]*d;return n.x=S*this.a+this.x0,n.y=v*this.a+this.y0,n}function yw(n){var t,e=n.x,i=n.y,r=e-this.x0,s=i-this.y0,a=s/this.a,o=r/this.a,l=1,c=0,h,u,m=0,d=0;for(t=1;t<=6;t++)h=l*a-c*o,u=c*a+l*o,l=h,c=u,m=m+this.C_re[t]*l-this.C_im[t]*c,d=d+this.C_im[t]*l+this.C_re[t]*c;for(var g=0;g<this.iterations;g++){var y=m,v=d,S,w,I=a,U=o;for(t=2;t<=6;t++)S=y*m-v*d,w=v*m+y*d,y=S,v=w,I=I+(t-1)*(this.B_re[t]*y-this.B_im[t]*v),U=U+(t-1)*(this.B_im[t]*y+this.B_re[t]*v);y=1,v=0;var R=this.B_re[1],V=this.B_im[1];for(t=2;t<=6;t++)S=y*m-v*d,w=v*m+y*d,y=S,v=w,R=R+t*(this.B_re[t]*y-this.B_im[t]*v),V=V+t*(this.B_im[t]*y+this.B_re[t]*v);var B=R*R+V*V;m=(I*R+U*V)/B,d=(U*R-I*V)/B}var G=m,Y=d,K=1,M=0;for(t=1;t<=9;t++)K=K*G,M=M+this.D[t]*K;var A=this.lat0+M*ri*1e5,z=this.long0+Y;return n.x=z,n.y=A,n}var vw=["New_Zealand_Map_Grid","nzmg"],Dp={init:gw,forward:_w,inverse:yw,names:vw,iterations:mw};function xw(){}function Mw(n){var t=n.x,e=n.y,i=N(t-this.long0,this.over),r=this.x0+this.a*i,s=this.y0+this.a*Math.log(Math.tan(Math.PI/4+e/2.5))*1.25;return n.x=r,n.y=s,n}function Sw(n){n.x-=this.x0,n.y-=this.y0;var t=N(this.long0+n.x/this.a,this.over),e=2.5*(Math.atan(Math.exp(.8*n.y/this.a))-Math.PI/4);return n.x=t,n.y=e,n}var bw=["Miller_Cylindrical","mill"],Up={init:xw,forward:Mw,inverse:Sw,names:bw};var ww=20;function Ew(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Ki(this.es)}function rh(n){var t,e,i=n.x,r=n.y;if(i=N(i-this.long0,this.over),this.sphere){if(!this.m)r=this.n!==1?Math.asin(this.n*Math.sin(r)):r;else for(var s=this.n*Math.sin(r),a=ww;a;--a){var o=(this.m*r+Math.sin(r)-s)/(this.m+Math.cos(r));if(r-=o,Math.abs(o)<D)break}t=this.a*this.C_x*i*(this.m+Math.cos(r)),e=this.a*this.C_y*r}else{var l=Math.sin(r),c=Math.cos(r);e=this.a*Ye(r,l,c,this.en),t=this.a*i*c/Math.sqrt(1-this.es*l*l)}return n.x=t,n.y=e,n}function sh(n){var t,e,i,r;return n.x-=this.x0,i=n.x/this.a,n.y-=this.y0,t=n.y/this.a,this.sphere?(t/=this.C_y,i=i/(this.C_x*(this.m+Math.cos(t))),this.m?t=le((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=le(Math.sin(t)/this.n)),i=N(i+this.long0,this.over),t=ae(t)):(t=Qi(n.y/this.a,this.es,this.en),r=Math.abs(t),r<T?(r=Math.sin(t),e=this.long0+n.x*Math.sqrt(1-this.es*r*r)/(this.a*Math.cos(t)),i=N(e,this.over)):r-D<T&&(i=this.long0)),n.x=i,n.y=t,n}var Tw=["Sinusoidal","sinu"],Fp={init:Ew,forward:rh,inverse:sh,names:Tw};function Aw(){this.sphere=!0,this.b=this.a,this.m=1,this.n=2.5707963267948966,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)}var Cw=rh,Pw=sh,Rw=["Eckert_VI","eck6"],Op={init:Aw,forward:Cw,inverse:Pw,names:Rw};function Iw(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0}function Lw(n){for(var t=n.x,e=n.y,i=N(t-this.long0,this.over),r=e,s=Math.PI*Math.sin(e);;){var a=-(r+Math.sin(r)-s)/(1+Math.cos(r));if(r+=a,Math.abs(a)<D)break}r/=2,Math.PI/2-Math.abs(e)<D&&(i=0);var o=.900316316158*this.a*i*Math.cos(r)+this.x0,l=1.4142135623731*this.a*Math.sin(r)+this.y0;return n.x=o,n.y=l,n}function Nw(n){var t,e;n.x-=this.x0,n.y-=this.y0,e=n.y/(1.4142135623731*this.a),Math.abs(e)>.999999999999&&(e=.999999999999),t=Math.asin(e);var i=N(this.long0+n.x/(.900316316158*this.a*Math.cos(t)),this.over);i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),e=(2*t+Math.sin(2*t))/Math.PI,Math.abs(e)>1&&(e=1);var r=Math.asin(e);return n.x=i,n.y=r,n}var Dw=["Mollweide","moll"],Bp={init:Iw,forward:Lw,inverse:Nw,names:Dw};function Uw(){Math.abs(this.lat1+this.lat2)<D||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=gn(this.es),this.e1=_n(this.es),this.e2=yn(this.es),this.e3=vn(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Wt(this.e,this.sin_phi,this.cos_phi),this.ml1=Rt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<D?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Wt(this.e,this.sin_phi,this.cos_phi),this.ml2=Rt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Rt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function Fw(n){var t=n.x,e=n.y,i;if(this.sphere)i=this.a*(this.g-e);else{var r=Rt(this.e0,this.e1,this.e2,this.e3,e);i=this.a*(this.g-r)}var s=this.ns*N(t-this.long0,this.over),a=this.x0+i*Math.sin(s),o=this.y0+this.rh-i*Math.cos(s);return n.x=a,n.y=o,n}function Ow(n){n.x-=this.x0,n.y=this.rh-n.y+this.y0;var t,e,i,r;this.ns>=0?(e=Math.sqrt(n.x*n.x+n.y*n.y),t=1):(e=-Math.sqrt(n.x*n.x+n.y*n.y),t=-1);var s=0;if(e!==0&&(s=Math.atan2(t*n.x,t*n.y)),this.sphere)return r=N(this.long0+s/this.ns,this.over),i=ae(this.g-e/this.a),n.x=r,n.y=i,n;var a=this.g-e/this.a;return i=li(a,this.e0,this.e1,this.e2,this.e3),r=N(this.long0+s/this.ns,this.over),n.x=r,n.y=i,n}var Bw=["Equidistant_Conic","eqdc"],Gp={init:Uw,forward:Fw,inverse:Ow,names:Bw};function Gw(){this.R=this.a}function zw(n){var t=n.x,e=n.y,i=N(t-this.long0,this.over),r,s;if(Math.abs(e)<=D)return r=this.x0+this.R*i,s=this.y0,n.x=r,n.y=s,n;var a=le(2*Math.abs(e/Math.PI));if(Math.abs(i)<=D||Math.abs(Math.abs(e)-T)<=D)return r=this.x0,e>=0?s=this.y0+Math.PI*this.R*Math.tan(.5*a):s=this.y0+Math.PI*this.R*-Math.tan(.5*a),n.x=r,n.y=s,n;var o=.5*Math.abs(Math.PI/i-i/Math.PI),l=o*o,c=Math.sin(a),h=Math.cos(a),u=h/(c+h-1),m=u*u,d=u*(2/c-1),g=d*d,y=Math.PI*this.R*(o*(u-g)+Math.sqrt(l*(u-g)*(u-g)-(g+l)*(m-g)))/(g+l);i<0&&(y=-y),r=this.x0+y;var v=l+u;return y=Math.PI*this.R*(d*v-o*Math.sqrt((g+l)*(l+1)-v*v))/(g+l),e>=0?s=this.y0+y:s=this.y0-y,n.x=r,n.y=s,n}function kw(n){var t,e,i,r,s,a,o,l,c,h,u,m,d;return n.x-=this.x0,n.y-=this.y0,u=Math.PI*this.R,i=n.x/u,r=n.y/u,s=i*i+r*r,a=-Math.abs(r)*(1+s),o=a-2*r*r+i*i,l=-2*a+1+2*r*r+s*s,d=r*r/l+(2*o*o*o/l/l/l-9*a*o/l/l)/27,c=(a-o*o/3/l)/l,h=2*Math.sqrt(-c/3),u=3*d/c/h,Math.abs(u)>1&&(u>=0?u=1:u=-1),m=Math.acos(u)/3,n.y>=0?e=(-h*Math.cos(m+Math.PI/3)-o/3/l)*Math.PI:e=-(-h*Math.cos(m+Math.PI/3)-o/3/l)*Math.PI,Math.abs(i)<D?t=this.long0:t=N(this.long0+Math.PI*(s-1+Math.sqrt(1+2*(i*i-r*r)+s*s))/2/i,this.over),n.x=t,n.y=e,n}var Vw=["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"],zp={init:Gw,forward:zw,inverse:kw,names:Vw};function kp(n,t,e,i,r,s){let a=i-t,o=Math.atan((1-s)*Math.tan(n)),l=Math.atan((1-s)*Math.tan(e)),c=Math.sin(o),h=Math.cos(o),u=Math.sin(l),m=Math.cos(l),d=a,g,y=100,v,S,w,I,U,R,V,B,G,Y,K,M,A,z;do{if(v=Math.sin(d),S=Math.cos(d),w=Math.sqrt(m*v*(m*v)+(h*u-c*m*S)*(h*u-c*m*S)),w===0)return{azi1:0,s12:0};I=c*u+h*m*S,U=Math.atan2(w,I),R=h*m*v/w,V=1-R*R,B=V!==0?I-2*c*u/V:0,G=s/16*V*(4+s*(4-3*V)),g=d,d=a+(1-G)*s*R*(U+G*w*(B+G*I*(-1+2*B*B)))}while(Math.abs(d-g)>1e-12&&--y>0);return y===0?{azi1:NaN,s12:NaN}:(Y=V*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),K=1+Y/16384*(4096+Y*(-768+Y*(320-175*Y))),M=Y/1024*(256+Y*(-128+Y*(74-47*Y))),A=M*w*(B+M/4*(I*(-1+2*B*B)-M/6*B*(-3+4*w*w)*(-3+4*B*B))),z=r*(1-s)*K*(U-A),{azi1:Math.atan2(m*v,h*u-c*m*S),s12:z})}function Vp(n,t,e,i,r,s){let a=Math.atan((1-s)*Math.tan(n)),o=Math.sin(a),l=Math.cos(a),c=Math.sin(e),h=Math.cos(e),u=Math.atan2(o,l*h),m=l*c,d=1-m*m,g=d*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),y=1+g/16384*(4096+g*(-768+g*(320-175*g))),v=g/1024*(256+g*(-128+g*(74-47*g))),S=i/(r*(1-s)*y),w,I=100,U,R,V,B;do U=Math.cos(2*u+S),R=Math.sin(S),V=Math.cos(S),B=v*R*(U+v/4*(V*(-1+2*U*U)-v/6*U*(-3+4*R*R)*(-3+4*U*U))),w=S,S=i/(r*(1-s)*y)+B;while(Math.abs(S-w)>1e-12&&--I>0);if(I===0)return{lat2:NaN,lon2:NaN};let G=o*R-l*V*h,Y=Math.atan2(o*V+l*R*h,(1-s)*Math.sqrt(m*m+G*G)),K=Math.atan2(R*c,l*V-o*R*h),M=s/16*d*(4+s*(4-3*d)),A=K-(1-M)*s*m*(S+M*R*(U+M*V*(-1+2*U*U))),z=t+A;return{lat2:Y,lon2:z}}function Hw(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.f=this.es/(1+Math.sqrt(1-this.es))}function Ww(n){var t=n.x,e=n.y,i=Math.sin(n.y),r=Math.cos(n.y),s=N(t-this.long0,this.over),a,o,l,c,h,u,m,d,g,y,v;return this.sphere?Math.abs(this.sin_p12-1)<=D?(n.x=this.x0+this.a*(T-e)*Math.sin(s),n.y=this.y0-this.a*(T-e)*Math.cos(s),n):Math.abs(this.sin_p12+1)<=D?(n.x=this.x0+this.a*(T+e)*Math.sin(s),n.y=this.y0+this.a*(T+e)*Math.cos(s),n):(g=this.sin_p12*i+this.cos_p12*r*Math.cos(s),m=Math.acos(g),d=m?m/Math.sin(m):1,n.x=this.x0+this.a*d*r*Math.sin(s),n.y=this.y0+this.a*d*(this.cos_p12*i-this.sin_p12*r*Math.cos(s)),n):(a=gn(this.es),o=_n(this.es),l=yn(this.es),c=vn(this.es),Math.abs(this.sin_p12-1)<=D?(h=this.a*Rt(a,o,l,c,T),u=this.a*Rt(a,o,l,c,e),n.x=this.x0+(h-u)*Math.sin(s),n.y=this.y0-(h-u)*Math.cos(s),n):Math.abs(this.sin_p12+1)<=D?(h=this.a*Rt(a,o,l,c,T),u=this.a*Rt(a,o,l,c,e),n.x=this.x0+(h+u)*Math.sin(s),n.y=this.y0+(h+u)*Math.cos(s),n):Math.abs(t)<D&&Math.abs(e-this.lat0)<D?(n.x=this.x0,n.y=this.y0,n):(y=kp(this.lat0,this.long0,e,t,this.a,this.f),v=y.azi1,n.x=this.x0+y.s12*Math.sin(v),n.y=this.y0+y.s12*Math.cos(v),n))}function Xw(n){n.x-=this.x0,n.y-=this.y0;var t,e,i,r,s,a,o,l,c,h,u,m,d,g,y,v;return this.sphere?(t=Math.sqrt(n.x*n.x+n.y*n.y),t>2*T*this.a?void 0:(e=t/this.a,i=Math.sin(e),r=Math.cos(e),s=this.long0,Math.abs(t)<=D?a=this.lat0:(a=le(r*this.sin_p12+n.y*i*this.cos_p12/t),o=Math.abs(this.lat0)-T,Math.abs(o)<=D?this.lat0>=0?s=N(this.long0+Math.atan2(n.x,-n.y),this.over):s=N(this.long0-Math.atan2(-n.x,n.y),this.over):s=N(this.long0+Math.atan2(n.x*i,t*this.cos_p12*r-n.y*this.sin_p12*i),this.over)),n.x=s,n.y=a,n)):(l=gn(this.es),c=_n(this.es),h=yn(this.es),u=vn(this.es),Math.abs(this.sin_p12-1)<=D?(m=this.a*Rt(l,c,h,u,T),t=Math.sqrt(n.x*n.x+n.y*n.y),d=m-t,a=li(d/this.a,l,c,h,u),s=N(this.long0+Math.atan2(n.x,-1*n.y),this.over),n.x=s,n.y=a,n):Math.abs(this.sin_p12+1)<=D?(m=this.a*Rt(l,c,h,u,T),t=Math.sqrt(n.x*n.x+n.y*n.y),d=t-m,a=li(d/this.a,l,c,h,u),s=N(this.long0+Math.atan2(n.x,n.y),this.over),n.x=s,n.y=a,n):(g=Math.atan2(n.x,n.y),y=Math.sqrt(n.x*n.x+n.y*n.y),v=Vp(this.lat0,this.long0,g,y,this.a,this.f),n.x=v.lon2,n.y=v.lat2,n))}var qw=["Azimuthal_Equidistant","aeqd"],Hp={init:Hw,forward:Ww,inverse:Xw,names:qw};function Yw(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)}function jw(n){var t,e,i,r,s,a,o,l,c=n.x,h=n.y;return i=N(c-(this.long0||0),this.over),t=Math.sin(h),e=Math.cos(h),r=Math.cos(i),a=this.sin_p14*t+this.cos_p14*e*r,s=1,(a>0||Math.abs(a)<=D)&&(o=(this.x0||0)+this.a*s*e*Math.sin(i),l=(this.y0||0)+this.a*s*(this.cos_p14*t-this.sin_p14*e*r)),n.x=o,n.y=l,n}function Zw(n){var t,e,i,r,s,a,o,l,c;return n.x-=this.x0||0,n.y-=this.y0||0,t=Math.sqrt(n.x*n.x+n.y*n.y),e=le(t/this.a),i=Math.sin(e),r=Math.cos(e),l=this.long0||0,c=this.lat0||0,a=l,Math.abs(t)<=D?(o=c,n.x=a,n.y=o,n):(o=le(r*this.sin_p14+n.y*i*this.cos_p14/t),s=Math.abs(c)-T,Math.abs(s)<=D?(c>=0?a=N(l+Math.atan2(n.x,-n.y),this.over):a=N(l-Math.atan2(-n.x,n.y),this.over),n.x=a,n.y=o,n):(a=N(l+Math.atan2(n.x*i,t*this.cos_p14*r-n.y*this.sin_p14*i),this.over),n.x=a,n.y=o,n))}var Jw=["ortho"],Wp={init:Yw,forward:jw,inverse:Zw,names:Jw};var xt={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},ft={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function $w(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=T-st/2?this.face=xt.TOP:this.lat0<=-(T-st/2)?this.face=xt.BOTTOM:Math.abs(this.long0)<=st?this.face=xt.FRONT:Math.abs(this.long0)<=T+st?this.face=this.long0>0?xt.RIGHT:xt.LEFT:this.face=xt.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function Kw(n){var t={x:0,y:0},e,i,r,s,a,o,l={value:0};if(n.x-=this.long0,this.es!==0?e=Math.atan(this.one_minus_f_squared*Math.tan(n.y)):e=n.y,i=n.x,this.face===xt.TOP)s=T-e,i>=st&&i<=T+st?(l.value=ft.AREA_0,r=i-T):i>T+st||i<=-(T+st)?(l.value=ft.AREA_1,r=i>0?i-vt:i+vt):i>-(T+st)&&i<=-st?(l.value=ft.AREA_2,r=i+T):(l.value=ft.AREA_3,r=i);else if(this.face===xt.BOTTOM)s=T+e,i>=st&&i<=T+st?(l.value=ft.AREA_0,r=-i+T):i<st&&i>=-st?(l.value=ft.AREA_1,r=-i):i<-st&&i>=-(T+st)?(l.value=ft.AREA_2,r=-i-T):(l.value=ft.AREA_3,r=i>0?-i+vt:-i-vt);else{var c,h,u,m,d,g,y;this.face===xt.RIGHT?i=ir(i,+T):this.face===xt.BACK?i=ir(i,+vt):this.face===xt.LEFT&&(i=ir(i,-T)),m=Math.sin(e),d=Math.cos(e),g=Math.sin(i),y=Math.cos(i),c=d*y,h=d*g,u=m,this.face===xt.FRONT?(s=Math.acos(c),r=oo(s,u,h,l)):this.face===xt.RIGHT?(s=Math.acos(h),r=oo(s,u,-c,l)):this.face===xt.BACK?(s=Math.acos(-c),r=oo(s,u,-h,l)):this.face===xt.LEFT?(s=Math.acos(-h),r=oo(s,u,c,l)):(s=r=0,l.value=ft.AREA_0)}return o=Math.atan(12/vt*(r+Math.acos(Math.sin(r)*Math.cos(st))-T)),a=Math.sqrt((1-Math.cos(s))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(r))))),l.value===ft.AREA_1?o+=T:l.value===ft.AREA_2?o+=vt:l.value===ft.AREA_3&&(o+=1.5*vt),t.x=a*Math.cos(o),t.y=a*Math.sin(o),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,n.x=t.x,n.y=t.y,n}function Qw(n){var t={lam:0,phi:0},e,i,r,s,a,o,l,c,h,u={value:0};if(n.x=(n.x-this.x0)/this.a,n.y=(n.y-this.y0)/this.a,i=Math.atan(Math.sqrt(n.x*n.x+n.y*n.y)),e=Math.atan2(n.y,n.x),n.x>=0&&n.x>=Math.abs(n.y)?u.value=ft.AREA_0:n.y>=0&&n.y>=Math.abs(n.x)?(u.value=ft.AREA_1,e-=T):n.x<0&&-n.x>=Math.abs(n.y)?(u.value=ft.AREA_2,e=e<0?e+vt:e-vt):(u.value=ft.AREA_3,e+=T),h=vt/12*Math.tan(e),a=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),o=Math.atan(a),r=Math.cos(e),s=Math.tan(i),l=1-r*r*s*s*(1-Math.cos(Math.atan(1/Math.cos(o)))),l<-1?l=-1:l>1&&(l=1),this.face===xt.TOP)c=Math.acos(l),t.phi=T-c,u.value===ft.AREA_0?t.lam=o+T:u.value===ft.AREA_1?t.lam=o<0?o+vt:o-vt:u.value===ft.AREA_2?t.lam=o-T:t.lam=o;else if(this.face===xt.BOTTOM)c=Math.acos(l),t.phi=c-T,u.value===ft.AREA_0?t.lam=-o+T:u.value===ft.AREA_1?t.lam=-o:u.value===ft.AREA_2?t.lam=-o-T:t.lam=o<0?-o-vt:-o+vt;else{var m,d,g;m=l,h=m*m,h>=1?g=0:g=Math.sqrt(1-h)*Math.sin(o),h+=g*g,h>=1?d=0:d=Math.sqrt(1-h),u.value===ft.AREA_1?(h=d,d=-g,g=h):u.value===ft.AREA_2?(d=-d,g=-g):u.value===ft.AREA_3&&(h=d,d=g,g=-h),this.face===xt.RIGHT?(h=m,m=-d,d=h):this.face===xt.BACK?(m=-m,d=-d):this.face===xt.LEFT&&(h=m,m=d,d=-h),t.phi=Math.acos(-g)-T,t.lam=Math.atan2(d,m),this.face===xt.RIGHT?t.lam=ir(t.lam,-T):this.face===xt.BACK?t.lam=ir(t.lam,-vt):this.face===xt.LEFT&&(t.lam=ir(t.lam,+T))}if(this.es!==0){var y,v,S;y=t.phi<0?1:0,v=Math.tan(t.phi),S=this.b/Math.sqrt(v*v+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-S*S)/(this.one_minus_f*S)),y&&(t.phi=-t.phi)}return t.lam+=this.long0,n.x=t.lam,n.y=t.phi,n}function oo(n,t,e,i){var r;return n<D?(i.value=ft.AREA_0,r=0):(r=Math.atan2(t,e),Math.abs(r)<=st?i.value=ft.AREA_0:r>st&&r<=T+st?(i.value=ft.AREA_1,r-=T):r>T+st||r<=-(T+st)?(i.value=ft.AREA_2,r=r>=0?r-vt:r+vt):(i.value=ft.AREA_3,r+=T)),r}function ir(n,t){var e=n+t;return e<-vt?e+=Xn:e>+vt&&(e-=Xn),e}var tE=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Xp={init:$w,forward:Kw,inverse:Qw,names:tE};var ah=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],ss=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],qp=.8487,Yp=1.3523,jp=Pt/5,eE=1/jp,rr=18,lo=function(n,t){return n[0]+t*(n[1]+t*(n[2]+t*n[3]))},nE=function(n,t){return n[1]+t*(2*n[2]+t*3*n[3])};function iE(n,t,e,i){for(var r=t;i;--i){var s=n(r);if(r-=s,Math.abs(s)<e)break}return r}function rE(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function sE(n){var t=N(n.x-this.long0,this.over),e=Math.abs(n.y),i=Math.floor(e*jp);i<0?i=0:i>=rr&&(i=rr-1),e=Pt*(e-eE*i);var r={x:lo(ah[i],e)*t,y:lo(ss[i],e)};return n.y<0&&(r.y=-r.y),r.x=r.x*this.a*qp+this.x0,r.y=r.y*this.a*Yp+this.y0,n.z!==void 0&&(r.z=n.z),n.m!==void 0&&(r.m=n.m),r}function aE(n){var t={x:(n.x-this.x0)/(this.a*qp),y:Math.abs(n.y-this.y0)/(this.a*Yp)};if(t.y>=1)t.x/=ah[rr][0],t.y=n.y<0?-T:T;else{var e=Math.floor(t.y*rr);for(e<0?e=0:e>=rr&&(e=rr-1);;)if(ss[e][0]>t.y)--e;else if(ss[e+1][0]<=t.y)++e;else break;var i=ss[e],r=5*(t.y-i[0])/(ss[e+1][0]-i[0]);r=iE(function(s){return(lo(i,s)-t.y)/nE(i,s)},r,D,100),t.x/=lo(ah[e],r),t.y=(5*e+r)*dt,n.y<0&&(t.y=-t.y)}return t.x=N(t.x+this.long0,this.over),n.z!==void 0&&(t.z=n.z),n.m!==void 0&&(t.m=n.m),t}var oE=["Robinson","robin"],Zp={init:rE,forward:sE,inverse:aE,names:oE};function lE(){this.name="geocent"}function cE(n){var t=Ka(n,this.es,this.a);return t}function hE(n){var t=Qa(n,this.es,this.a,this.b);return t}var uE=["Geocentric","geocentric","geocent","Geocent"],Jp={init:lE,forward:cE,inverse:hE,names:uE};var Xt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},as={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function fE(){if(Object.keys(as).forEach(function(e){if(typeof this[e]>"u")this[e]=as[e].def;else{if(as[e].num&&isNaN(this[e]))throw new Error("Invalid parameter value, must be numeric "+e+" = "+this[e]);as[e].num&&(this[e]=parseFloat(this[e]))}as[e].degrees&&(this[e]=this[e]*dt)}.bind(this)),Math.abs(Math.abs(this.lat0)-T)<D?this.mode=this.lat0<0?Xt.S_POLE:Xt.N_POLE:Math.abs(this.lat0)<D?this.mode=Xt.EQUIT:(this.mode=Xt.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var n=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(n),this.sw=Math.sin(n)}function dE(n){n.x-=this.long0;var t=Math.sin(n.y),e=Math.cos(n.y),i=Math.cos(n.x),r,s;switch(this.mode){case Xt.OBLIQ:s=this.sinph0*t+this.cosph0*e*i;break;case Xt.EQUIT:s=e*i;break;case Xt.S_POLE:s=-t;break;case Xt.N_POLE:s=t;break}switch(s=this.pn1/(this.p-s),r=s*e*Math.sin(n.x),this.mode){case Xt.OBLIQ:s*=this.cosph0*t-this.sinph0*e*i;break;case Xt.EQUIT:s*=t;break;case Xt.N_POLE:s*=-(e*i);break;case Xt.S_POLE:s*=e*i;break}var a,o;return a=s*this.cg+r*this.sg,o=1/(a*this.sw*this.h1+this.cw),r=(r*this.cg-s*this.sg)*this.cw*o,s=a*o,n.x=r*this.a,n.y=s*this.a,n}function pE(n){n.x/=this.a,n.y/=this.a;var t={x:n.x,y:n.y},e,i,r;r=1/(this.pn1-n.y*this.sw),e=this.pn1*n.x*r,i=this.pn1*n.y*this.cw*r,n.x=e*this.cg+i*this.sg,n.y=i*this.cg-e*this.sg;var s=At(n.x,n.y);if(Math.abs(s)<D)t.x=0,t.y=n.y;else{var a,o;switch(o=1-s*s*this.pfact,o=(this.p-Math.sqrt(o))/(this.pn1/s+s/this.pn1),a=Math.sqrt(1-o*o),this.mode){case Xt.OBLIQ:t.y=Math.asin(a*this.sinph0+n.y*o*this.cosph0/s),n.y=(a-this.sinph0*Math.sin(t.y))*s,n.x*=o*this.cosph0;break;case Xt.EQUIT:t.y=Math.asin(n.y*o/s),n.y=a*s,n.x*=o;break;case Xt.N_POLE:t.y=Math.asin(a),n.y=-n.y;break;case Xt.S_POLE:t.y=-Math.asin(a);break}t.x=Math.atan2(n.x,n.y)}return n.x=t.x+this.long0,n.y=t.y,n}var mE=["Tilted_Perspective","tpers"],$p={init:fE,forward:dE,inverse:pE,names:mE};function gE(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var n=1-this.es,t=1/n;this.radius_p=Math.sqrt(n),this.radius_p2=n,this.radius_p_inv2=t,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function _E(n){var t=n.x,e=n.y,i,r,s,a;if(t=t-this.long0,this.shape==="ellipse"){e=Math.atan(this.radius_p2*Math.tan(e));var o=this.radius_p/At(this.radius_p*Math.cos(e),Math.sin(e));if(r=o*Math.cos(t)*Math.cos(e),s=o*Math.sin(t)*Math.cos(e),a=o*Math.sin(e),(this.radius_g-r)*r-s*s-a*a*this.radius_p_inv2<0)return n.x=Number.NaN,n.y=Number.NaN,n;i=this.radius_g-r,this.flip_axis?(n.x=this.radius_g_1*Math.atan(s/At(a,i)),n.y=this.radius_g_1*Math.atan(a/i)):(n.x=this.radius_g_1*Math.atan(s/i),n.y=this.radius_g_1*Math.atan(a/At(s,i)))}else this.shape==="sphere"&&(i=Math.cos(e),r=Math.cos(t)*i,s=Math.sin(t)*i,a=Math.sin(e),i=this.radius_g-r,this.flip_axis?(n.x=this.radius_g_1*Math.atan(s/At(a,i)),n.y=this.radius_g_1*Math.atan(a/i)):(n.x=this.radius_g_1*Math.atan(s/i),n.y=this.radius_g_1*Math.atan(a/At(s,i))));return n.x=n.x*this.a,n.y=n.y*this.a,n}function yE(n){var t=-1,e=0,i=0,r,s,a,o;if(n.x=n.x/this.a,n.y=n.y/this.a,this.shape==="ellipse"){this.flip_axis?(i=Math.tan(n.y/this.radius_g_1),e=Math.tan(n.x/this.radius_g_1)*At(1,i)):(e=Math.tan(n.x/this.radius_g_1),i=Math.tan(n.y/this.radius_g_1)*At(1,e));var l=i/this.radius_p;if(r=e*e+l*l+t*t,s=2*this.radius_g*t,a=s*s-4*r*this.C,a<0)return n.x=Number.NaN,n.y=Number.NaN,n;o=(-s-Math.sqrt(a))/(2*r),t=this.radius_g+o*t,e*=o,i*=o,n.x=Math.atan2(e,t),n.y=Math.atan(i*Math.cos(n.x)/t),n.y=Math.atan(this.radius_p_inv2*Math.tan(n.y))}else if(this.shape==="sphere"){if(this.flip_axis?(i=Math.tan(n.y/this.radius_g_1),e=Math.tan(n.x/this.radius_g_1)*Math.sqrt(1+i*i)):(e=Math.tan(n.x/this.radius_g_1),i=Math.tan(n.y/this.radius_g_1)*Math.sqrt(1+e*e)),r=e*e+i*i+t*t,s=2*this.radius_g*t,a=s*s-4*r*this.C,a<0)return n.x=Number.NaN,n.y=Number.NaN,n;o=(-s-Math.sqrt(a))/(2*r),t=this.radius_g+o*t,e*=o,i*=o,n.x=Math.atan2(e,t),n.y=Math.atan(i*Math.cos(n.x)/t)}return n.x=n.x+this.long0,n}var vE=["Geostationary Satellite View","Geostationary_Satellite","geos"],Kp={init:gE,forward:_E,inverse:yE,names:vE};var os=1.340264,ls=-.081106,cs=893e-6,hs=.003796,co=Math.sqrt(3)/2;function xE(){this.long0=this.long0!==void 0?this.long0:0,this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.es!==0&&(this.apa=is(this.es),this.qp=oe(this.e,1),this.rqda=Math.sqrt(.5*this.qp))}function ME(n){var t=N(n.x-this.long0,this.over),e=n.y,i=Math.sin(e);this.es!==0&&(i=oe(this.e,i)/this.qp);var r=Math.asin(co*i),s=r*r,a=s*s*s;return n.x=t*Math.cos(r)/(co*(os+3*ls*s+a*(7*cs+9*hs*s))),n.y=r*(os+ls*s+a*(cs+hs*s)),this.es!==0&&(n.x*=this.rqda,n.y*=this.rqda),n.x=this.a*n.x+this.x0,n.y=this.a*n.y+this.y0,n}function SE(n){n.x=(n.x-this.x0)/this.a,n.y=(n.y-this.y0)/this.a,this.es!==0&&(n.x/=this.rqda,n.y/=this.rqda);var t=1e-9,e=12,i=n.y,r,s,a,o,l,c;for(c=0;c<e&&(r=i*i,s=r*r*r,a=i*(os+ls*r+s*(cs+hs*r))-n.y,o=os+3*ls*r+s*(7*cs+9*hs*r),i-=l=a/o,!(Math.abs(l)<t));++c);return r=i*i,s=r*r*r,n.x=co*n.x*(os+3*ls*r+s*(7*cs+9*hs*r))/Math.cos(i),n.y=Math.asin(Math.sin(i)/co),this.es!==0&&(n.y=rs(n.y,this.apa)),n.x=N(n.x+this.long0,this.over),n}var bE=["eqearth","Equal Earth","Equal_Earth"],Qp={init:xE,forward:ME,inverse:SE,names:bE};var us=1e-10;function wE(){var n;if(this.phi1=this.lat1,Math.abs(this.phi1)<us)throw new Error;this.es?(this.en=Ki(this.es),this.m1=Ye(this.phi1,this.am1=Math.sin(this.phi1),n=Math.cos(this.phi1),this.en),this.am1=n/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=TE,this.forward=EE):(Math.abs(this.phi1)+us>=T?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=CE,this.forward=AE)}function EE(n){var t=N(n.x-(this.long0||0),this.over),e=n.y,i,r,s;return i=this.am1+this.m1-Ye(e,r=Math.sin(e),s=Math.cos(e),this.en),r=s*t/(i*Math.sqrt(1-this.es*r*r)),n.x=i*Math.sin(r),n.y=this.am1-i*Math.cos(r),n.x=this.a*n.x+(this.x0||0),n.y=this.a*n.y+(this.y0||0),n}function TE(n){n.x=(n.x-(this.x0||0))/this.a,n.y=(n.y-(this.y0||0))/this.a;var t,e,i,r;if(e=At(n.x,n.y=this.am1-n.y),r=Qi(this.am1+this.m1-e,this.es,this.en),(t=Math.abs(r))<T)t=Math.sin(r),i=e*Math.atan2(n.x,n.y)*Math.sqrt(1-this.es*t*t)/Math.cos(r);else if(Math.abs(t-T)<=us)i=0;else throw new Error;return n.x=N(i+(this.long0||0),this.over),n.y=ae(r),n}function AE(n){var t=N(n.x-(this.long0||0),this.over),e=n.y,i,r;return r=this.cphi1+this.phi1-e,Math.abs(r)>us?(n.x=r*Math.sin(i=t*Math.cos(e)/r),n.y=this.cphi1-r*Math.cos(i)):n.x=n.y=0,n.x=this.a*n.x+(this.x0||0),n.y=this.a*n.y+(this.y0||0),n}function CE(n){n.x=(n.x-(this.x0||0))/this.a,n.y=(n.y-(this.y0||0))/this.a;var t,e,i=At(n.x,n.y=this.cphi1-n.y);if(e=this.cphi1+this.phi1-i,Math.abs(e)>T)throw new Error;return Math.abs(Math.abs(e)-T)<=us?t=0:t=i*Math.atan2(n.x,n.y)/Math.cos(e),n.x=N(t+(this.long0||0),this.over),n.y=ae(e),n}var PE=["bonne","Bonne (Werner lat_1=90)"],tm={init:wE,names:PE};var em={OBLIQUE:{forward:DE,inverse:FE},TRANSVERSE:{forward:UE,inverse:OE}},ho={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}};function RE(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=kc.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if(this.o_proj==="ob_tran")throw new Error("Invalid value for o_proj: "+this.o_proj);let n=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),t=Ne(n);if(!t)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);t.long0=0,this.obliqueProjection=t;let e,i=Object.keys(ho),r=o=>{if(typeof this[o]>"u")return;let l=parseFloat(this[o])*dt;if(isNaN(l))throw new Error("Invalid value for "+o+": "+this[o]);return l};for(let o=0;o<i.length;o++){let l=i[o],c=ho[l],h=Object.entries(c);if(h.some(([m])=>typeof this[m]<"u")){e=c;for(let m=0;m<h.length;m++){let[d,g]=h[m],y=r(d);if(typeof y>"u")throw new Error("Missing parameter: "+d+".");this[g]=y}break}}if(!e)throw new Error("No valid parameters provided for ob_tran projection.");let{lamp:s,phip:a}=NE(this,e);this.lamp=s,Math.abs(a)>D?(this.cphip=Math.cos(a),this.sphip=Math.sin(a),this.projectionType=em.OBLIQUE):this.projectionType=em.TRANSVERSE}function IE(n){return this.projectionType.forward(this,n)}function LE(n){return this.projectionType.inverse(this,n)}function NE(n,t){let e,i;if(t===ho.ROTATE){let r=n.oLongC,s=n.oLatC,a=n.oAlpha;if(Math.abs(Math.abs(s)-T)<=D)throw new Error("Invalid value for o_lat_c: "+n.o_lat_c+" should be < 90\xB0");i=r+Math.atan2(-1*Math.cos(a),-1*Math.sin(a)*Math.sin(s)),e=Math.asin(Math.cos(s)*Math.sin(a))}else if(t===ho.NEW_POLE)i=n.oLongP,e=n.oLatP;else{let r=n.oLong1,s=n.oLat1,a=n.oLong2,o=n.oLat2,l=Math.abs(s);if(Math.abs(s)>T-D)throw new Error("Invalid value for o_lat_1: "+n.o_lat_1+" should be < 90\xB0");if(Math.abs(o)>T-D)throw new Error("Invalid value for o_lat_2: "+n.o_lat_2+" should be < 90\xB0");if(Math.abs(s-o)<D)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(l<D)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");i=Math.atan2(Math.cos(s)*Math.sin(o)*Math.cos(r)-Math.sin(s)*Math.cos(o)*Math.cos(a),Math.sin(s)*Math.cos(o)*Math.sin(a)-Math.cos(s)*Math.sin(o)*Math.sin(r)),e=Math.atan(-1*Math.cos(i-r)/Math.tan(s))}return{lamp:i,phip:e}}function DE(n,t){let{x:e,y:i}=t;e=N(e-n.long0,n.over);let r=Math.cos(e),s=Math.sin(i),a=Math.cos(i);t.x=N(Math.atan2(a*Math.sin(e),n.sphip*a*r+n.cphip*s)+n.lamp),t.y=Math.asin(n.sphip*s-n.cphip*a*r);let o=n.obliqueProjection.forward(t);return n.isIdentity&&(o.x*=Pt,o.y*=Pt),o}function UE(n,t){let{x:e,y:i}=t;e=N(e-n.long0,n.over);let r=Math.cos(i),s=Math.cos(e);t.x=N(Math.atan2(r*Math.sin(e),Math.sin(i))+n.lamp),t.y=Math.asin(-1*r*s);let a=n.obliqueProjection.forward(t);return n.isIdentity&&(a.x*=Pt,a.y*=Pt),a}function FE(n,t){n.isIdentity&&(t.x*=dt,t.y*=dt);let e=n.obliqueProjection.inverse(t),{x:i,y:r}=e;if(i<Number.MAX_VALUE){i-=n.lamp;let s=Math.cos(i),a=Math.sin(r),o=Math.cos(r);t.x=Math.atan2(o*Math.sin(i),n.sphip*o*s-n.cphip*a),t.y=Math.asin(n.sphip*a+n.cphip*o*s)}return t.x=N(t.x+n.long0),t}function OE(n,t){n.isIdentity&&(t.x*=dt,t.y*=dt);let e=n.obliqueProjection.inverse(t),{x:i,y:r}=e;if(i<Number.MAX_VALUE){let s=Math.cos(r);i-=n.lamp,t.x=Math.atan2(s*Math.sin(i),-1*Math.sin(r)),t.y=Math.asin(s*Math.cos(i))}return t.x=N(t.x+n.long0),t}var BE=["General Oblique Transformation","General_Oblique_Transformation","ob_tran"],nm={init:RE,forward:IE,inverse:LE,names:BE};function im(n){n.Proj.projections.add(tr),n.Proj.projections.add(er),n.Proj.projections.add(yp),n.Proj.projections.add(vp),n.Proj.projections.add(xp),n.Proj.projections.add(Mp),n.Proj.projections.add(Sp),n.Proj.projections.add(bp),n.Proj.projections.add(wp),n.Proj.projections.add(Ep),n.Proj.projections.add(Tp),n.Proj.projections.add(Ap),n.Proj.projections.add(Cp),n.Proj.projections.add(Rp),n.Proj.projections.add(Ip),n.Proj.projections.add(Np),n.Proj.projections.add(Dp),n.Proj.projections.add(Up),n.Proj.projections.add(Fp),n.Proj.projections.add(Op),n.Proj.projections.add(Bp),n.Proj.projections.add(Gp),n.Proj.projections.add(zp),n.Proj.projections.add(Hp),n.Proj.projections.add(Wp),n.Proj.projections.add(Xp),n.Proj.projections.add(Zp),n.Proj.projections.add(Jp),n.Proj.projections.add($p),n.Proj.projections.add(Kp),n.Proj.projections.add(Qp),n.Proj.projections.add(tm),n.Proj.projections.add(nm)}var rm=Object.assign(ep,{defaultDatum:"WGS84",Proj:Ne,WGS84:new Ne("WGS84"),Point:cp,toPoint:Zi,defs:qi,nadgrid:qc,transform:Yc,mgrs:ap,version:"__VERSION__"});im(rm);var je=rm;var fs=class{_rootMap=new Map;get size(){if(this._rootMap.size===0)return 0;let t=0;return this._rootMap.forEach(e=>t+=e.size),t}forEach(t){this._rootMap.size!==0&&this._rootMap.forEach((e,i)=>{e.forEach((r,s)=>t(r,i,s,this))})}has(t,e){return this._rootMap.get(t)?.has(e)??!1}clear(){this._rootMap.clear()}getOrCreate(t,e,i){let r=this._rootMap.get(t);r==null&&(r=new Map,this._rootMap.set(t,r));let s=r.get(e);return s==null&&(s=i(t,e),r.set(e,s)),s}};var XO=new fs;var JO=new nt(0,0);function ds(n){return n[2]-n[0]}function oh(n,t,e){return Math.min(Math.max(n,t),e)}function sm(n,t,e){let i=t.getExtent(),r=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||ds(i),r=Math.floor((n[0]-i[0])/e)),r}var am={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var lh=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||am[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},jn=lh;var ps=6378137,sr=Math.PI*ps,zE=[-sr,-sr,sr,sr],kE=[-180,-85,180,85],uo=ps*Math.log(Math.tan(Math.PI/2)),Zn=class extends jn{constructor(t){super({code:t,units:"m",extent:zE,global:!0,worldExtent:kE,getPointResolution:function(e,i){return e/Math.cosh(i[1]/ps)}})}},ch=[new Zn("EPSG:3857"),new Zn("EPSG:102100"),new Zn("EPSG:102113"),new Zn("EPSG:900913"),new Zn("http://www.opengis.net/def/crs/EPSG/0/3857"),new Zn("http://www.opengis.net/gml/srs/epsg.xml#3857")];function om(n,t,e,i){let r=n.length;e=e!==void 0&&e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(r));for(let s=0;s<r;s+=i){t[s]=sr*n[s]/180;let a=ps*Math.log(Math.tan(Math.PI*(+n[s+1]+90)/360));a>uo?a=uo:a<-uo&&(a=-uo),t[s+1]=a}return t}function lm(n,t,e,i){let r=n.length;e=e!==void 0&&e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(r));for(let s=0;s<r;s+=i)t[s]=180*n[s]/sr,t[s+1]=360*Math.atan(Math.exp(n[s+1]/ps))/Math.PI-90;return t}var VE=6378137,cm=[-180,-90,180,90],HE=Math.PI*VE/180,xn=class extends jn{constructor(t,e){super({code:t,units:"degrees",extent:cm,axisOrientation:e,global:!0,metersPerUnit:HE,worldExtent:cm})}},hh=[new xn("CRS:84"),new xn("EPSG:4326","neu"),new xn("urn:ogc:def:crs:OGC:1.3:CRS84"),new xn("urn:ogc:def:crs:OGC:2:84"),new xn("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new xn("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new xn("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var uh={};function ar(n){return uh[n]||uh[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function hm(n,t){uh[n]=t}var or={};function ci(n,t,e){let i=n.getCode(),r=t.getCode();i in or||(or[i]={}),or[i][r]=e}function fh(n,t){return n in or&&t in or[n]?or[n][t]:null}var Jn=.00669438,fo=Jn*Jn,po=fo*Jn,d8=Jn/(1-Jn),um=Math.sqrt(1-Jn),lr=(1-um)/(1+um),fm=lr*lr,dh=fm*lr,ph=dh*lr,dm=ph*lr,p8=1-Jn/4-3*fo/64-5*po/256,m8=3*Jn/8+3*fo/32+45*po/1024,g8=15*fo/256+45*po/1024,_8=35*po/3072,y8=3/2*lr-27/32*dh+269/512*dm,v8=21/16*fm-55/32*ph,x8=151/96*dh-417/128*dm,M8=1097/512*ph;var WE=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function XE(n){let t=0;for(let r of WE){let s=n.match(r);if(s){t=parseInt(s[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function pm(n){return XE(n)?new jn({code:n,units:"m"}):null}var qE=[pm];function _m(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function mh(n){hm(n.getCode(),n),ci(n,n,_m)}function YE(n){n.forEach(mh)}function mm(n){if(typeof n!="string")return n!==void 0?n:null;let t=ar(n);if(t)return t;for(let e of qE){let i=e(n);if(i)return i}return null}function mo(n){YE(n),n.forEach(function(t){n.forEach(function(e){t!==e&&ci(t,e,_m)})})}function jE(n,t,e,i){n.forEach(function(r){t.forEach(function(s){ci(r,s,e),ci(s,r,i)})})}function gm(n){return(function(t,e,i,r){let s=t.length;i=i!==void 0?i:2,r=r??i,e=e!==void 0?e:new Array(s);for(let a=0;a<s;a+=r){let o=n(t.slice(a,a+i)),l=o.length;for(let c=0,h=r;c<h;++c)e[a+c]=c>=l?t[a+c]:o[c]}return e})}function ym(n,t,e,i){let r=mm(n),s=mm(t);!r||!s||(ci(r,s,gm(e)),ci(s,r,gm(i)))}function gh(n,t,e){return function(i){let r,s;if(n.canWrapX()){let a=n.getExtent(),o=ds(a);i=i.slice(0),s=sm(i,n,o),s&&(i[0]=i[0]-s*o),i[0]=oh(i[0],a[0],a[2]),i[1]=oh(i[1],a[1],a[3]),r=e(i)}else r=e(i);return s&&t.canWrapX()&&(r[0]+=s*ds(t.getExtent())),r}}function ZE(){mo(ch),mo(hh),jE(hh,ch,om,lm)}ZE();var JE=null;function go(n){JE=n;let t=Object.keys(n.defs),e=t.length,i,r;for(i=0;i<e;++i){let s=t[i];if(!ar(s)){let a=n.defs(s),o=a.units;!o&&a.projName==="longlat"&&(o="degrees"),mh(new jn({code:s,axisOrientation:a.axis,metersPerUnit:a.to_meter,units:o}))}}for(i=0;i<e;++i){let s=t[i],a=ar(s);for(r=0;r<e;++r){let o=t[r],l=ar(o);if(!(!a||!l)&&!fh(s,o))if(n.defs(s)===n.defs(o))mo([a,l]);else{let c=n(s,o);ym(a,l,gh(a,l,c.forward),gh(l,a,c.inverse))}}}}var _h=class n{constructor(t,e){this._authority=t,this._code=e}static parse(t){let e=t.trim().split(":");if(e.length===2){let i=Number.parseInt(e[1]);return new n(e[0],i)}throw new Error("could not parse SRID")}get authority(){return this._authority}get code(){return this._code}toString(){return`${this._authority}:${this._code}`}isEpsg(t){return this._authority==="EPSG"&&this._code===t}tryGetEpsgCode(){return this._authority!=="EPSG"?null:this._code}},hi=_h;function vm(n){switch(n.name.toLowerCase()){case"deg":case"degree":case"degrees":return"\xB0";case"rad":case"radian":case"radians":return"rad";case"m":case"meter":case"metre":case"meters":case"metres":return"m";case"ft":case"foot":case"feet":case"us-ft":case"us survey feet":case"us survey foot":return"ft";default:return""}}var $t=class n{type="linear";constructor(t,e){this.name=t,this.metersPerUnit=e}getSymbol(){return vm(this)}static meters=new n("meters",1);static feet=new n("feet",.3048);static usSurveyFeet=new n("US Survey feet",.304800609601219);equals(t){return t.metersPerUnit===this.metersPerUnit}static isLinearUnit(t){return t?t.type==="linear":!1}},Mn=class n{type="angular";constructor(t,e){this.name=t,this.degreesPerUnit=e}getSymbol(){return vm(this)}static degrees=new n("degrees",1);static radians=new n("radians",57.29578);equals(t){return t.degreesPerUnit===this.degreesPerUnit}static isAngularUnit(t){return t?t.type==="angular":!1}};function xm(n){switch(n.trim().toLowerCase()){case"deg":case"degree":case"degrees":return Mn.degrees;case"rad":case"radian":case"radians":return Mn.radians;case"m":case"meter":case"meters":case"metre":case"metres":return $t.meters;case"ft":case"feet":case"foot":return $t.feet;case"us-ft":case"us survey feet":case"us survey foot":case"foot (us survey)":return $t.usSurveyFeet;default:return}}function bm(n){return new $t(n.name,n.convert)}function yh(n){let[t,e]=Object.entries(n)[0];return new hi(t,Number.parseInt(e))}function vh(n){return"name"in n&&typeof n.name=="string"?n.name:"<unknown>"}function Mm(n){let t=vh(n),e=bm(n.UNIT);if(n.AUTHORITY){let i=yh(n.AUTHORITY);return{name:t,srid:i,unit:e}}return{name:t,unit:e}}var Sm=class n{static epsg3857=new n({name:"WGS 84 / Pseudo-Mercator",srid:new hi("EPSG",3857),horizontal:{unit:$t.meters},vertical:{unit:$t.meters}});static epsg4326=new n({name:"WGS 84",srid:new hi("EPSG",4326),horizontal:{unit:Mn.degrees},vertical:{unit:$t.meters}});static epsg4978=new n({name:"WGS 84",srid:new hi("EPSG",4978),horizontal:{unit:$t.meters},vertical:{unit:$t.meters}});static epsg4979=new n({name:"WGS 84",srid:new hi("EPSG",4979),horizontal:{unit:Mn.degrees},vertical:{unit:$t.meters}});static equirectangular=new n({name:"equirectangular",horizontal:{unit:Mn.degrees}});static unknown=new n({name:"unknown"});static _registry=new Map([["EPSG:3857",n.epsg3857],["EPSG:4326",n.epsg4326],["EPSG:4978",n.epsg4978],["EPSG:4979",n.epsg4979],["equirectangular",n.equirectangular],["unknown",n.unknown]]);static register(t,e,i){if(this._registry.has(t))return this._registry.get(t);try{this.registerCRSWithProjAndOpenLayers(t,e)}catch(s){if(i?.throwIfFailedToRegisterWithProj===!0)throw s;console.warn(s)}let r=n.fromWkt(e,{id:t});return this._registry.set(t,r),r}static clearRegistry(){this._registry.clear(),this._registry.set("EPSG:3857",n.epsg3857),this._registry.set("EPSG:4326",n.epsg4326),this._registry.set("EPSG:4978",n.epsg4978),this._registry.set("EPSG:4979",n.epsg4979),this._registry.set("equirectangular",n.equirectangular),this._registry.set("unknown",n.unknown)}static registerCRSWithProjAndOpenLayers(t,e){if(!t||t==="")throw new Error("missing CRS name");if(!e||e==="")throw new Error("missing CRS PROJ string");try{je.defs(t,e)}catch(i){let r="";throw i instanceof Error&&(r=": "+i.message),new Error(`failed to register PROJ definition for ${t}${r}`)}try{go(je)}catch(i){let r="";throw i instanceof Error&&(r=": "+i.message),new Error(`failed to register PROJ definitions in OpenLayers${r}`)}}static get(t){let e=this._registry.get(t);if(e)return e;throw new Error(`coordinate system not found: ${t}`)}static fromWkt(t,e){try{let i;try{i=qn(t)}catch{i=Za(t)}if("ID"in i)return new n({id:e?.id,name:vh(i),srid:yh(i.ID),definition:t});if("PROJCS"in i){let r=Mm(i.PROJCS),s={id:e?.id,name:r.name,srid:r.srid,definition:t,horizontal:{unit:r.unit}};return"VERT_CS"in i&&(s.vertical={unit:bm(i.VERT_CS.UNIT)}),new n(s)}else if("type"in i&&i.type==="PROJCS"){let r=Mm(i);return new n({id:e?.id,name:r.name,srid:r.srid,definition:t,horizontal:{unit:r.unit}})}else{let r,s;return"AUTHORITY"in i&&typeof i.AUTHORITY=="object"&&i.AUTHORITY&&(r=yh(i.AUTHORITY)),"title"in i&&typeof i.title=="string"&&(r=hi.parse(i.title)),"units"in i&&typeof i.units=="string"&&(s=xm(i.units)),new n({id:e?.id,name:vh(i),srid:r,horizontal:s!=null?{unit:s}:void 0})}}catch(i){throw console.error(`Failed to parse wkt "${t}".`),i}}get id(){return typeof this._customId<"u"?this._customId:typeof this.srid<"u"?this.srid.toString():this.name}constructor(t){this.name=t.name,this.srid=t.srid,this._customId=t.id,typeof t.horizontal<"u"&&(this.horizontal=t.horizontal),typeof t.vertical<"u"&&(this.vertical=t.vertical),typeof t.definition<"u"&&(this.definition=t.definition)}isGeographic(){let t=this.horizontal?.unit;return!!Mn.isAngularUnit(t)}get metersPerHorizontalUnit(){let t=this.horizontal?.unit;return $t.isLinearUnit(t)?t.metersPerUnit:1}get metersPerVerticalUnit(){let t=this.vertical?.unit;return $t.isLinearUnit(t)?t.metersPerUnit:this.metersPerHorizontalUnit}isEpsg(t){return typeof this.srid<"u"?this.srid.isEpsg(t):!1}isEquirectangular(){return this.name==="equirectangular"}isUnknown(){return this.name==="unknown"&&typeof this.definition>"u"}equals(t){return this.id===t.id}};je.defs("EPSG:4978","+proj=geocent +datum=WGS84 +units=m +no_defs +type=crs");je.defs("EPSG:4979","+proj=longlat +datum=WGS84 +no_defs +type=crs");je.defs("equirectangular","+proj=longlat +datum=WGS84 +no_defs +type=crs");go(je);var uB=new nt;var fB=[new nt,new nt,new nt,new nt,new nt,new nt,new nt,new nt];var tT=1024,eT=1024*tT,MB=1024*eT;var Et=class n{constructor(t,e=!0){this.color=new et(t),this.visible=e}clone(){return new n(this.color.clone(),this.visible)}},Mt=new Array(256),xh=new Et(16744704);for(let n=0;n<Mt.length;n++)Mt[n]=xh.clone();Mt[0]=new Et("#858585");Mt[1]=new Et("#bfbfbf");Mt[2]=new Et("#834000");Mt[3]=new Et("#008100");Mt[4]=new Et("#00bf00");Mt[5]=new Et("#00ff00");Mt[6]=new Et("#0081c1");Mt[7]=new Et("#ff0000");Mt[8]=xh.clone();Mt[9]=new Et("#0000ff");Mt[10]=new Et("#606d73");Mt[11]=new Et("#858585");Mt[12]=xh.clone();Mt[13]=new Et("#ede440");Mt[14]=new Et("#ed6840");Mt[15]=new Et("#29fff8");Mt[16]=new Et("#5e441d");Mt[17]=new Et("#7992c7");Mt[18]=new Et("#cd27d6");var ZB=new nt;var e5=new et(0,0,0);var l5=new et(0,0,0),c5=new Gr;var T5=new et,A5=new et;var a6=new nt(256,256),o6=new C,l6=new Lc({colors:[new et("black"),new et("white")],min:0,max:1e3}),c6=new Ct,h6=new et("#d8eb34"),u6={empty:new et("grey"),hidden:new et("#fc4903"),loading:new et("#f5da8c"),displayed:new et("#8cf59b")};var _o=class extends Error{constructor(t){super(`attribute '${t}' is not supported in this source`)}};function Em(n,t,e,i){let r=n.pointCount,[s,a,o]=["Red","Green","Blue"].map(n.getter),l=new jr(e?new Uint8Array(r*3):new Uint16Array(r*3));l.length=0;let c=e?1/65536*256:1;for(let h=0;h<r;h+=t)if(Wa(i,h)){let u=s(h)*c,m=a(h)*c,d=o(h)*c;l.push(u,m,d)}return l.array.buffer}function Tm(n,t,e,i){let r=n.pointCount,[s,a,o]=["X","Y","Z"].map(n.getter),l=Math.floor(r/e)+r%e,c=new jr(new Float32Array(l*3));c.length=0;let h=1/0,u=1/0,m=1/0,d=-1/0,g=-1/0,y=-1/0;for(let v=0;v<r;v+=e)if(Wa(i,v)){let S=s(v)-t.x,w=a(v)-t.y,I=o(v)-t.z;h=Math.min(S,h),u=Math.min(w,u),m=Math.min(I,m),d=Math.max(S,d),g=Math.max(w,g),y=Math.max(I,y),c.push(S,w,I)}return c.trim(),{buffer:c.array.buffer,localBoundingBox:new Re(new C(h,u,m),new C(d,g,y))}}function uT(n,t,e,i,r){for(let s=0;s<t;s+=e)Wa(r,s)&&i.push(n(s))}function Am(n,t,e,i){let r=t.name,s;switch(t.type){case"float":s=ui(Float32Array);break;case"signed":switch(t.size){case 1:s=ui(Int8Array);break;case 2:s=ui(Int16Array);break;case 4:s=ui(Int32Array);break;default:throw new Error("invalid attribute size for signed values: "+t.size)}break;case"unsigned":switch(t.size){case 1:s=ui(Uint8Array);break;case 2:s=ui(Uint16Array);break;case 4:s=ui(Uint32Array);break;default:throw new Error("invalid attribute size for unsigned values: "+t.size)}break;default:throw new _o(r)}return s(r,n,e,i)}function ui(n){return(t,e,i,r)=>{let s=e.pointCount,a=new ad(s,o=>new n(o));return uT(e.getter(t),s,i,a,r),a.getArray().buffer}}async function Cm(n,t){let e=await Cc();return yo.Las.PointData.decompressChunk(new Uint8Array(n),t,e)}async function fT(n){let t=await Cc();return yo.Las.PointData.decompressFile(new Uint8Array(n),t)}function dT(n){Cm(n.payload.buffer,n.payload.metadata).then(t=>{let e={requestId:n.id,payload:t.buffer};postMessage(e,{transfer:[t.buffer]})}).catch(t=>{postMessage(Xi(n.id,t))})}function pT(n){fT(n.payload.buffer).then(t=>{let e={requestId:n.id,payload:t.buffer};postMessage(e,{transfer:[t.buffer]})}).catch(t=>{console.error(t),postMessage(Xi(n.id,t))})}function mT(n,t,e,i){let r=yo.Las.View.create(n,t,e,i);if(e){let s={};for(let[a,o]of Object.entries(r.dimensions)){let l=o,c=e.find(h=>h.name===a);c&&(c.type==="signed"||c.type==="unsigned")&&(typeof c.scale=="number"&&c.scale!==1||typeof c.offset=="number"&&c.offset!==0)&&(l={type:"float",size:4}),s[a]=l}r.dimensions=s}return r}function gT(n){let{view:t,filters:e,origin:i,attributes:r,compressColors:s}=n,a=n.stride??1,o=sd(e??[],t),l;if(n.position){let h=Tm(t,i,a,o),u=[h.localBoundingBox.min.x,h.localBoundingBox.min.y,h.localBoundingBox.min.z,h.localBoundingBox.max.x,h.localBoundingBox.max.y,h.localBoundingBox.max.z];l={buffer:h.buffer,localBoundingBox:u}}let c=r.map(h=>{switch(h.interpretation){case"color":return Em(t,a,s,o);case"classification":case"unknown":return Am(t,h,a,o)}});return{position:l,attributes:c}}function _T(n){let{buffer:t,metadata:e,header:i,eb:r,include:s}=n.payload;Cm(t,e).then(a=>{let o=mT(a,i,r,s),l=gT({...n.payload,view:o}),c={requestId:n.id,payload:l},h=[...l.attributes];l.position&&h.push(l.position.buffer),postMessage(c,{transfer:h})}).catch(a=>{console.error(a),postMessage(Xi(n.id,a))})}onmessage=n=>{let t=n.data;switch(t.type){case"DecodeLazChunk":dT(t);break;case"DecodeLazFile":pT(t);break;case"ReadView":_T(t);break;case"SetWasmBinary":rd(t.buffer);break}};export{mT as createLasView,gT as readView};
3848
+ northing meters`+i;var p=u/2,d=0,_=0,g,v,x,b,A;return p>0&&(g=1e5/Math.pow(10,p),v=i.substring(s,s+p),d=parseFloat(v)*g,x=i.substring(s+p),_=parseFloat(x)*g),b=d+c,A=_+h,{easting:b,northing:A,zoneLetter:o,zoneNumber:a,accuracy:g}}function Fb(i,t){for(var e=Cp.charCodeAt(t-1),n=1e5,r=!1;e!==i.charCodeAt(0);){if(e++,e===oe&&e++,e===we&&e++,e>is){if(r)throw"Bad character: "+i;e=er,r=!0}n+=1e5}return n}function Bb(i,t){if(i>"V")throw"MGRSPoint given invalid Northing "+i;for(var e=Pp.charCodeAt(t-1),n=0,r=!1;e!==i.charCodeAt(0);){if(e++,e===oe&&e++,e===we&&e++,e>es){if(r)throw"Bad character: "+i;e=er,r=!0}n+=1e5}return n}function Gb(i){var t;switch(i){case"C":t=11e5;break;case"D":t=2e6;break;case"E":t=28e5;break;case"F":t=37e5;break;case"G":t=46e5;break;case"H":t=55e5;break;case"J":t=64e5;break;case"K":t=73e5;break;case"L":t=82e5;break;case"M":t=91e5;break;case"N":t=0;break;case"P":t=8e5;break;case"Q":t=17e5;break;case"R":t=26e5;break;case"S":t=35e5;break;case"T":t=44e5;break;case"U":t=53e5;break;case"V":t=62e5;break;case"W":t=7e6;break;case"X":t=79e5;break;default:t=-1}if(t>=0)return t;throw"Invalid zone letter: "+i}function ir(i,t,e){if(!(this instanceof ir))return new ir(i,t,e);if(Array.isArray(i))this.x=i[0],this.y=i[1],this.z=i[2]||0;else if(typeof i=="object")this.x=i.x,this.y=i.y,this.z=i.z||0;else if(typeof i=="string"&&typeof t>"u"){var n=i.split(",");this.x=parseFloat(n[0]),this.y=parseFloat(n[1]),this.z=parseFloat(n[2])||0}else this.x=i,this.y=t,this.z=e||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}ir.fromMGRS=function(i){return new ir(lh(i))};ir.prototype.toMGRS=function(i){return oh([this.x,this.y],i)};var Lp=ir;var zb=1,kb=.25,Dp=.046875,Op=.01953125,Up=.01068115234375,Vb=.75,Hb=.46875,Wb=.013020833333333334,Xb=.007120768229166667,qb=.3645833333333333,Yb=.005696614583333333,jb=.3076171875;function Te(i){var t=[];t[0]=zb-i*(kb+i*(Dp+i*(Op+i*Up))),t[1]=i*(Vb-i*(Dp+i*(Op+i*Up)));var e=i*i;return t[2]=e*(Hb-i*(Wb+i*Xb)),e*=i,t[3]=e*(qb-i*Yb),t[4]=e*i*jb,t}function It(i,t,e,n){return e*=t,t*=t,n[0]*i-e*(n[1]+t*(n[2]+t*(n[3]+t*n[4])))}var Zb=20;function Ae(i,t,e){for(var n=1/(1-t),r=i,s=Zb;s;--s){var a=Math.sin(r),o=1-t*a*a;if(o=(It(r,a,Math.cos(r),e)-i)*(o*Math.sqrt(o))*n,r-=o,Math.abs(o)<D)return r}return r}function Jb(){this.es&&(this.en=Te(this.es),this.ml0=It(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function $b(i){var t=i.x,e=i.y,n=I(t-this.long0,this.over),r,s,a,o=Math.sin(e),l=Math.cos(e);if(this.es){var h=l*n,u=Math.pow(h,2),p=this.ep2*Math.pow(l,2),d=Math.pow(p,2),_=Math.abs(l)>D?Math.tan(e):0,g=Math.pow(_,2),v=Math.pow(g,2);r=1-this.es*Math.pow(o,2),h=h/Math.sqrt(r);var x=It(e,o,l,this.en);s=this.a*(this.k0*h*(1+u/6*(1-g+p+u/20*(5-18*g+v+14*p-58*g*p+u/42*(61+179*v-v*g-479*g)))))+this.x0,a=this.a*(this.k0*(x-this.ml0+o*n*h/2*(1+u/12*(5-g+9*p+4*d+u/30*(61+v-58*g+270*p-330*g*p+u/56*(1385+543*v-v*g-3111*g))))))+this.y0}else{var c=l*Math.sin(n);if(Math.abs(Math.abs(c)-1)<D)return 93;if(s=.5*this.a*this.k0*Math.log((1+c)/(1-c))+this.x0,a=l*Math.cos(n)/Math.sqrt(1-Math.pow(c,2)),c=Math.abs(a),c>=1){if(c-1>D)return 93;a=0}else a=Math.acos(a);e<0&&(a=-a),a=this.a*this.k0*(a-this.lat0)+this.y0}return i.x=s,i.y=a,i}function Kb(i){var t,e,n,r,s=(i.x-this.x0)*(1/this.a),a=(i.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+a/this.k0,e=Ae(t,this.es,this.en),Math.abs(e)<w){var u=Math.sin(e),p=Math.cos(e),d=Math.abs(p)>D?Math.tan(e):0,_=this.ep2*Math.pow(p,2),g=Math.pow(_,2),v=Math.pow(d,2),x=Math.pow(v,2);t=1-this.es*Math.pow(u,2);var b=s*Math.sqrt(t)/this.k0,A=Math.pow(b,2);t=t*d,n=e-t*A/(1-this.es)*.5*(1-A/12*(5+3*v-9*_*v+_-4*g-A/30*(61+90*v-252*_*v+45*x+46*_-A/56*(1385+3633*v+4095*x+1574*x*v)))),r=I(this.long0+b*(1-A/6*(1+2*v+_-A/20*(5+28*v+24*x+8*_*v+6*_-A/42*(61+662*v+1320*x+720*x*v))))/p,this.over)}else n=w*xt(a),r=0;else{var o=Math.exp(s/this.k0),l=.5*(o-1/o),c=this.lat0+a/this.k0,h=Math.cos(c);t=Math.sqrt((1-Math.pow(h,2))/(1+Math.pow(l,2))),n=Math.asin(t),a<0&&(n=-n),l===0&&h===0?r=0:r=I(Math.atan2(l,h)+this.long0,this.over)}return i.x=r,i.y=n,i}var Qb=["Fast_Transverse_Mercator","Fast Transverse Mercator"],Yi={init:Jb,forward:$b,inverse:Kb,names:Qb};function oo(i){var t=Math.exp(i);return t=(t-1/t)/2,t}function Ct(i,t){i=Math.abs(i),t=Math.abs(t);var e=Math.max(i,t),n=Math.min(i,t)/(e||1);return e*Math.sqrt(1+Math.pow(n,2))}function Fp(i){var t=1+i,e=t-1;return e===0?i:i*Math.log(t)/e}function Bp(i){var t=Math.abs(i);return t=Fp(t*(1+t/(Ct(1,t)+1))),i<0?-t:t}function lo(i,t,e,n){for(var r=2*(e===void 0?Math.cos(2*t):e),s=i.length-1,a=i[s],o=0,l;--s>=0;)l=-o+r*a+i[s],o=a,a=l;return t+l*(n===void 0?Math.sin(2*t):n)}function Gp(i,t){for(var e=2*Math.cos(t),n=i.length-1,r=i[n],s=0,a;--n>=0;)a=-s+e*r+i[n],s=r,r=a;return Math.sin(t)*a}function zp(i){var t=Math.exp(i);return t=(t+1/t)/2,t}function hh(i,t,e){for(var n=Math.sin(t),r=Math.cos(t),s=oo(e),a=zp(e),o=2*r*a,l=-2*n*s,c=i.length-1,h=i[c],u=0,p=0,d=0,_,g;--c>=0;)_=p,g=u,p=h,u=d,h=-_+o*p-l*u+i[c],d=-g+l*p+o*u;return o=n*a,l=r*s,[o*h-l*d,o*d+l*h]}function tE(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Yi.init.apply(this),this.forward=Yi.forward,this.inverse=Yi.inverse),this.k0=this.k0!==void 0?this.k0:1,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var i=this.es/(1+Math.sqrt(1-this.es)),t=i/(2-i),e=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+t*(-2854/675)))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))),e=e*t,this.cgb[1]=e*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+t*(2323/945))))),this.cbg[1]=e*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),e=e*t,this.cgb[2]=e*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=e*(-26/15+t*(34/21+t*(8/5+t*(-12686/2835)))),e=e*t,this.cgb[3]=e*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=e*(1237/630+t*(-12/5+t*(-24832/14175))),e=e*t,this.cgb[4]=e*(4174/315+t*(-144838/6237)),this.cbg[4]=e*(-734/315+t*(109598/31185)),e=e*t,this.cgb[5]=e*(601676/22275),this.cbg[5]=e*(444337/155925),e=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+e*(1/4+e*(1/64+e/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=e*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=e*(13/48+t*(-3/5+t*(557/1440+t*(281/630+t*(-1983433/1935360))))),e=e*t,this.utg[2]=e*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=e*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),e=e*t,this.utg[3]=e*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=e*(49561/161280+t*(-179/168+t*(6601661/7257600))),e=e*t,this.utg[4]=e*(-4583/161280+t*(108847/3991680)),this.gtu[4]=e*(34729/80640+t*(-3418889/1995840)),e=e*t,this.utg[5]=e*(-20648693/638668800),this.gtu[5]=e*(212378941/319334400);var n=lo(this.cbg,this.lat0);this.Zb=-this.Qn*(n+Gp(this.gtu,2*n))}function eE(i){var t=I(i.x-this.long0,this.over),e=i.y;e=lo(this.cbg,e);var n=Math.sin(e),r=Math.cos(e),s=Math.sin(t),a=Math.cos(t);e=Math.atan2(n,a*r),t=Bp(s*r/Ct(n,r*a));var o=hh(this.gtu,2*e,2*t);e=e+o[0],t=t+o[1];var l,c;return Math.abs(t)<=2.623395162778?(l=this.a*(this.Qn*t)+this.x0,c=this.a*(this.Qn*e+this.Zb)+this.y0):(l=1/0,c=1/0),i.x=l,i.y=c,i}function iE(i){var t=(i.x-this.x0)*(1/this.a),e=(i.y-this.y0)*(1/this.a);e=(e-this.Zb)/this.Qn,t=t/this.Qn;var n,r;if(Math.abs(t)<=2.623395162778){var s=hh(this.utg,2*e,2*t);e=e+s[0],t=t+s[1];var a=oo(t),o=Math.sin(e),l=Math.cos(e),c=Ct(a,l);t=Math.atan2(a,l),e=Math.atan2(o,c),n=I(t+this.long0,this.over);var h=o*o+c*c;r=lo(this.cgb,e,(c*c-o*o)/h,2*o*c/h)}else n=1/0,r=1/0;return i.x=n,i.y=r,i}var nE=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],ji={init:tE,forward:eE,inverse:iE,names:nE};function rE(){var i=this.approx||this.es===0?Yi:ji;i.init.apply(this),this.forward=i.forward,this.inverse=i.inverse,/south[\W_]*orientated/i.test(this.projName)&&(this.x0=-this.x0,this.y0=-this.y0,this.axis==="enu"&&(this.axis="wsu"))}var sE=["Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","Transverse_Mercator_South_Orientated","tmerc"],kp={init:rE,names:sE};function Vp(i,t){if(i===void 0){if(i=Math.floor((I(t)+Math.PI)*30/Math.PI)+1,i<0)return 0;if(i>60)return 60}return i}var aE="etmerc";function oE(){var i=Vp(this.zone,this.long0);if(i===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(i)-183)*ut,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,ji.init.apply(this),this.forward=ji.forward,this.inverse=ji.inverse}var lE=["Universal Transverse Mercator System","utm"],Hp={init:oE,names:lE,dependsOn:aE};function co(i,t){return Math.pow((1-i)/(1+i),t)}var cE=20;function hE(){var i=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*i*i),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(i/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+et)/(Math.pow(Math.tan(.5*this.lat0+et),this.C)*co(this.e*i,this.ratexp))}function uE(i){var t=i.x,e=i.y;return i.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*e+et),this.C)*co(this.e*Math.sin(e),this.ratexp))-w,i.x=this.C*t,i}function fE(i){for(var t=1e-14,e=i.x/this.C,n=i.y,r=Math.pow(Math.tan(.5*n+et)/this.K,1/this.C),s=cE;s>0&&(n=2*Math.atan(r*co(this.e*Math.sin(i.y),-.5*this.e))-w,!(Math.abs(n-i.y)<t));--s)i.y=n;return s?(i.x=e,i.y=n,i):null}var dE=["gauss"],ho={init:hE,forward:uE,inverse:fE,names:dE};function pE(){ho.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function mE(i){var t,e,n,r;return i.x=I(i.x-this.long0,this.over),ho.forward.apply(this,[i]),t=Math.sin(i.y),e=Math.cos(i.y),n=Math.cos(i.x),r=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*e*n),i.x=r*e*Math.sin(i.x),i.y=r*(this.cosc0*t-this.sinc0*e*n),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function gE(i){var t,e,n,r,s;if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,s=Ct(i.x,i.y)){var a=2*Math.atan2(s,this.R2);t=Math.sin(a),e=Math.cos(a),r=Math.asin(e*this.sinc0+i.y*t*this.cosc0/s),n=Math.atan2(i.x*t,s*this.cosc0*e-i.y*this.sinc0*t)}else r=this.phic0,n=0;return i.x=n,i.y=r,ho.inverse.apply(this,[i]),i.x=I(i.x+this.long0,this.over),i}var _E=["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],Wp={init:pE,forward:mE,inverse:gE,names:_E};function uh(i,t,e){return t*=e,Math.tan(.5*(w+i))*Math.pow((1-t)/(1+t),.5*e)}function yE(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=D&&(this.k0=.5*(1+xt(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=D&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=D&&Math.abs(Math.cos(this.lat_ts))>D&&(this.k0=.5*this.cons*Xt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/$t(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Xt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(uh(this.lat0,this.sinlat0,this.e))-w,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function vE(i){var t=i.x,e=i.y,n=Math.sin(e),r=Math.cos(e),s,a,o,l,c,h,u=I(t-this.long0,this.over);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=D&&Math.abs(e+this.lat0)<=D?(i.x=NaN,i.y=NaN,i):this.sphere?(s=2*this.k0/(1+this.sinlat0*n+this.coslat0*r*Math.cos(u)),i.x=this.a*s*r*Math.sin(u)+this.x0,i.y=this.a*s*(this.coslat0*n-this.sinlat0*r*Math.cos(u))+this.y0,i):(a=2*Math.atan(uh(e,n,this.e))-w,l=Math.cos(a),o=Math.sin(a),Math.abs(this.coslat0)<=D?(c=$t(this.e,e*this.con,this.con*n),h=2*this.a*this.k0*c/this.cons,i.x=this.x0+h*Math.sin(t-this.long0),i.y=this.y0-this.con*h*Math.cos(t-this.long0),i):(Math.abs(this.sinlat0)<D?(s=2*this.a*this.k0/(1+l*Math.cos(u)),i.y=s*o):(s=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*o+this.cosX0*l*Math.cos(u))),i.y=s*(this.cosX0*o-this.sinX0*l*Math.cos(u))+this.y0),i.x=s*l*Math.sin(u)+this.x0,i))}function xE(i){i.x-=this.x0,i.y-=this.y0;var t,e,n,r,s,a=Math.sqrt(i.x*i.x+i.y*i.y);if(this.sphere){var o=2*Math.atan(a/(2*this.a*this.k0));return t=this.long0,e=this.lat0,a<=D?(i.x=t,i.y=e,i):(e=Math.asin(Math.cos(o)*this.sinlat0+i.y*Math.sin(o)*this.coslat0/a),Math.abs(this.coslat0)<D?this.lat0>0?t=I(this.long0+Math.atan2(i.x,-1*i.y),this.over):t=I(this.long0+Math.atan2(i.x,i.y),this.over):t=I(this.long0+Math.atan2(i.x*Math.sin(o),a*this.coslat0*Math.cos(o)-i.y*this.sinlat0*Math.sin(o)),this.over),i.x=t,i.y=e,i)}else if(Math.abs(this.coslat0)<=D){if(a<=D)return e=this.lat0,t=this.long0,i.x=t,i.y=e,i;i.x*=this.con,i.y*=this.con,n=a*this.cons/(2*this.a*this.k0),e=this.con*mi(this.e,n),t=this.con*I(this.con*this.long0+Math.atan2(i.x,-1*i.y),this.over)}else r=2*Math.atan(a*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,a<=D?s=this.X0:(s=Math.asin(Math.cos(r)*this.sinX0+i.y*Math.sin(r)*this.cosX0/a),t=I(this.long0+Math.atan2(i.x*Math.sin(r),a*this.cosX0*Math.cos(r)-i.y*this.sinX0*Math.sin(r)),this.over)),e=-1*mi(this.e,Math.tan(.5*(w+s)));return i.x=t,i.y=e,i}var ME=["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],Xp={init:yE,forward:vE,inverse:xE,names:ME,ssfn_:uh};function SE(){this.k0||(this.k0=1);var i=this.lat0;this.lambda0=this.long0;var t=Math.sin(i),e=this.a,n=this.rf,r=1/n,s=2*r-Math.pow(r,2),a=this.e=Math.sqrt(s);this.R=this.k0*e*Math.sqrt(1-s)/(1-s*Math.pow(t,2)),this.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(i),4)),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+i/2)),c=Math.log((1+a*t)/(1-a*t));this.K=o-this.alpha*l+this.alpha*a/2*c}function bE(i){var t=Math.log(Math.tan(Math.PI/4-i.y/2)),e=this.e/2*Math.log((1+this.e*Math.sin(i.y))/(1-this.e*Math.sin(i.y))),n=-this.alpha*(t+e)+this.K,r=2*(Math.atan(Math.exp(n))-Math.PI/4),s=this.alpha*(i.x-this.lambda0),a=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(s))),o=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(s));return i.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,i.x=this.R*a+this.x0,i}function EE(i){for(var t=i.x-this.x0,e=i.y-this.y0,n=t/this.R,r=2*(Math.atan(Math.exp(e/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(n)),a=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(r))),o=this.lambda0+a/this.alpha,l=0,c=s,h=-1e3,u=0;Math.abs(c-h)>1e-7;){if(++u>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(c))/2)),h=c,c=2*Math.atan(Math.exp(l))-Math.PI/2}return i.x=o,i.y=c,i}var wE=["somerc"],qp={init:SE,forward:bE,inverse:EE,names:wE};var nr=1e-7;function TE(i){var t=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],e=typeof i.projName=="object"?Object.keys(i.projName)[0]:i.projName;return"no_uoff"in i||"no_off"in i||t.indexOf(e)!==-1||t.indexOf(gi(e))!==-1}function AE(){var i,t,e,n,r,s,a,o,l,c,h=0,u,p=0,d=0,_=0,g=0,v=0,x=0;this.k0||(this.k0=1),this.no_off=TE(this),this.no_rot="no_rot"in this;var b=!1;"alpha"in this&&(b=!0);var A=!1;if("rectified_grid_angle"in this&&(A=!0),b&&(x=this.alpha),A&&(h=this.rectified_grid_angle,b||(x=0,b=!0)),b||A)p=this.longc;else if(d=this.long1,g=this.lat1,_=this.long2,v=this.lat2,Math.abs(g-v)<=nr||(i=Math.abs(g))<=nr||Math.abs(i-w)<=nr||Math.abs(Math.abs(this.lat0)-w)<=nr||Math.abs(Math.abs(v)-w)<=nr)throw new Error;var P=1-this.es;t=Math.sqrt(P),Math.abs(this.lat0)>D?(o=Math.sin(this.lat0),e=Math.cos(this.lat0),i=1-this.es*o*o,this.B=e*e,this.B=Math.sqrt(1+this.es*this.B*this.B/P),this.A=this.B*this.k0*t/i,n=this.B*t/(e*Math.sqrt(i)),r=n*n-1,r<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=n,this.E*=Math.pow($t(this.e,this.lat0,o),this.B)):(this.B=1/t,this.A=this.k0,this.E=n=r=1),b||A?(b?(u=Math.asin(Math.sin(x)/n),A||(h=x)):(u=h,x=Math.asin(n*Math.sin(u))),this.lam0=p-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(s=Math.pow($t(this.e,g,Math.sin(g)),this.B),a=Math.pow($t(this.e,v,Math.sin(v)),this.B),r=this.E/s,l=(a-s)/(a+s),c=this.E*this.E,c=(c-a*s)/(c+a*s),i=d-_,i<-Math.PI?_-=Wi:i>Math.PI&&(_+=Wi),this.lam0=I(.5*(d+_)-Math.atan(c*Math.tan(.5*this.B*(d-_))/l)/this.B,this.over),u=Math.atan(2*Math.sin(this.B*I(d-this.lam0,this.over))/(r-1/r)),h=x=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(h),this.cosrot=Math.cos(h),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(x))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(et-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(et+r))}function CE(i){var t={},e,n,r,s,a,o,l,c;if(i.x=i.x-this.lam0,Math.abs(Math.abs(i.y)-w)>D){if(a=this.E/Math.pow($t(this.e,i.y,Math.sin(i.y)),this.B),o=1/a,e=.5*(a-o),n=.5*(a+o),s=Math.sin(this.B*i.x),r=(e*this.singam-s*this.cosgam)/n,Math.abs(Math.abs(r)-1)<D)throw new Error;c=.5*this.ArB*Math.log((1-r)/(1+r)),o=Math.cos(this.B*i.x),Math.abs(o)<nr?l=this.A*i.x:l=this.ArB*Math.atan2(e*this.cosgam+s*this.singam,o)}else c=i.y>0?this.v_pole_n:this.v_pole_s,l=this.ArB*i.y;return this.no_rot?(t.x=l,t.y=c):(l-=this.u_0,t.x=c*this.cosrot+l*this.sinrot,t.y=l*this.cosrot-c*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,i.z!==void 0&&(t.z=i.z),i.m!==void 0&&(t.m=i.m),t}function PE(i){var t,e,n,r,s,a,o,l={};if(i.x=(i.x-this.x0)*(1/this.a),i.y=(i.y-this.y0)*(1/this.a),this.no_rot?(e=i.y,t=i.x):(e=i.x*this.cosrot-i.y*this.sinrot,t=i.y*this.cosrot+i.x*this.sinrot+this.u_0),n=Math.exp(-this.BrA*e),r=.5*(n-1/n),s=.5*(n+1/n),a=Math.sin(this.BrA*t),o=(a*this.cosgam+r*this.singam)/s,Math.abs(Math.abs(o)-1)<D)l.x=0,l.y=o<0?-w:w;else{if(l.y=this.E/Math.sqrt((1+o)/(1-o)),l.y=mi(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(r*this.cosgam-a*this.singam,Math.cos(this.BrA*t))}return l.x+=this.lam0,i.z!==void 0&&(l.z=i.z),i.m!==void 0&&(l.m=i.m),l}var RE=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"],Yp={init:AE,forward:CE,inverse:PE,names:RE};function IE(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),/west[\W_]*orientated/i.test(this.projName)&&(this.x0=-this.x0,this.axis==="enu"&&(this.axis="wnu")),!(Math.abs(this.lat1+this.lat2)<D)){var i=this.b/this.a;this.e=Math.sqrt(1-i*i);var t=Math.sin(this.lat1),e=Math.cos(this.lat1),n=Xt(this.e,t,e),r=$t(this.e,this.lat1,t),s=Math.sin(this.lat2),a=Math.cos(this.lat2),o=Xt(this.e,s,a),l=$t(this.e,this.lat2,s),c=$t(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>D?this.ns=Math.log(n/o)/Math.log(r/l):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=n/(this.ns*Math.pow(r,this.ns)),this.rh=Math.abs(Math.abs(this.lat0)-w)<D?0:this.a*this.f0*Math.pow(c,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function NE(i){var t=i.x,e=i.y;Math.abs(2*Math.abs(e)-Math.PI)<=D&&(e=xt(e)*(w-2*D));var n=Math.abs(Math.abs(e)-w),r,s;if(n>D)r=$t(this.e,e,Math.sin(e)),s=this.a*this.f0*Math.pow(r,this.ns);else{if(n=e*this.ns,n<=0)return null;s=0}var a=this.ns*I(t-this.long0,this.over);return i.x=this.k0*(s*Math.sin(a))+this.x0,i.y=this.k0*(this.rh-s*Math.cos(a))+this.y0,i}function LE(i){var t,e,n,r,s,a=(i.x-this.x0)/this.k0,o=this.rh-(i.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(a*a+o*o),e=1):(t=-Math.sqrt(a*a+o*o),e=-1);var l=0;if(t!==0&&(l=Math.atan2(e*a,e*o)),t!==0||this.ns>0){if(e=1/this.ns,n=Math.pow(t/(this.a*this.f0),e),r=mi(this.e,n),r===-9999)return null}else r=-w;return s=I(l/this.ns+this.long0,this.over),i.x=s,i.y=r,i}var DE=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)","Lambert Conic Conformal (West Orientated)","Lambert_Conic_Conformal_(West_Orientated)"],jp={init:IE,forward:NE,inverse:LE,names:DE};var nm=1089e3,rm=654e3,OE=.02946529277,UE=.02515965696,Zp=1193845912e-16,Jp=-4668270147e-16,$p=9233980362e-21,Kp=1523735715e-21,Qp=1696780024e-27,tm=4408314235e-27,em=-8331083518e-33,im=-3689471323e-33;function sm(i,t){var e=i*i,n=t*t,r=e*e,s=n*n;return[OE+Zp*i-Jp*t-2*Kp*i*t+$p*(e-n)+Qp*i*(e-3*n)-tm*t*(3*e-n)+4*em*i*t*(e-n)+im*(r+s-6*e*n),UE+Zp*t+Jp*i+2*$p*i*t+Kp*(e-n)+tm*i*(e-3*n)+Qp*t*(3*e-n)-4*im*i*t*(e-n)+em*(r+s-6*e*n)]}function FE(){var i=gi(this.projName).toLowerCase();this.modified=i==="mod_krovak"||i.indexOf("krovak_modified")===0,this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function BE(i){var t,e,n,r,s,a,o,l,c=i.x,h=i.y,u=I(c-this.long0,this.over);return t=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),e=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/t)-this.s45),n=-u*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(e)+Math.sin(this.ad)*Math.cos(e)*Math.cos(n)),s=Math.asin(Math.cos(e)*Math.sin(n)/Math.cos(r)),a=this.n*s,o=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),i.y=o*Math.cos(a)/1,i.x=o*Math.sin(a)/1,this.modified&&(l=sm(i.y-nm,i.x-rm),i.y-=l[0],i.x-=l[1]),i.y+=this.y0,i.x+=this.x0,this.czech||(i.y*=-1,i.x*=-1),i}function GE(i){var t,e,n,r,s,a,o,l,c,h=i.x;i.x=i.y,i.y=h,this.czech||(i.y*=-1,i.x*=-1),i.x-=this.y0,i.y-=this.x0,this.modified&&(l=sm(i.x-nm,i.y-rm),i.x+=l[0],i.y+=l[1]),a=Math.sqrt(i.x*i.x+i.y*i.y),s=Math.atan2(i.y,i.x),r=s/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/a,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),e=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(t)),i.x=this.long0-e/this.alfa,o=t,c=0;var u=0;do i.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-i.y)<1e-10&&(c=1),o=i.y,u+=1;while(c===0&&u<15);return u>=15?null:i}var zE=["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak","mod_krovak"],am={init:FE,forward:BE,inverse:GE,names:zE};function _i(i){return Math.abs(i)<w?i:i-xt(i)*Math.PI}function kE(){this.hyperbolic=!!this.hyperbolic||gi(this.projName).toLowerCase()==="hyperbolic_cassini_soldner",this.sphere||(this.en=Te(this.es),this.m0=It(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function om(i,t){var e=this.es,n=Math.sin(t),r=Math.cos(t),s=It(t,n,r,this.en),a=1/Math.sqrt(1-e*n*n),o=Math.tan(t),l=o*o,c=i*r,h=e*r*r/(1-e),u=c*c,p=a*c*(1-u*l*(1/6+(8-l+8*h)*u/120)),d=s-this.m0+a*o*u*(.5+(5-l+6*h)*u/24);if(this.hyperbolic){var _=a*a*a*(1-e);d-=d*d*d/(6*_*a)}return[p,d]}function VE(i,t,e,n,r){for(var s=0,a=0,o=0,l=0,c=0;c<15;c++){var h=i(n,r),u=h[0]-t,p=h[1]-e;if(Math.abs(u)<1e-12&&Math.abs(p)<1e-12)return[n,r];if(c===0||Math.abs(u)>1e-6||Math.abs(p)>1e-6){var d=n>0?-1e-6:1e-6,_=i(n+d,r),g=(_[0]-h[0])/d,v=(_[1]-h[1])/d,x=r>0?-1e-6:1e-6;_=i(n,r+x);var b=(_[0]-h[0])/x,A=(_[1]-h[1])/x,P=g*A-b*v;P!==0&&(s=A/P,a=-b/P,o=-v/P,l=g/P)}n-=Math.max(Math.min(u*s+p*a,.3),-.3),n=Math.max(Math.min(n,Math.PI),-Math.PI),r-=Math.max(Math.min(u*o+p*l,.3),-.3),r=Math.max(Math.min(r,w),-w)}return null}function HE(i){var t,e,n=i.x,r=i.y;if(n=I(n-this.long0,this.over),this.sphere)t=this.a*Math.asin(Math.cos(r)*Math.sin(n)),e=this.a*(Math.atan2(Math.tan(r),Math.cos(n))-this.lat0);else{var s=om.call(this,n,r);t=this.a*s[0],e=this.a*s[1]}return i.x=t+this.x0,i.y=e+this.y0,i}function WE(i){i.x-=this.x0,i.y-=this.y0;var t=i.x/this.a,e=i.y/this.a,n,r;if(this.sphere){var s=e+this.lat0;n=Math.asin(Math.sin(s)*Math.cos(t)),r=Math.atan2(Math.tan(t),Math.cos(s))}else{var a=this.es,o=Ae(this.m0+e,a,this.en);if(Math.abs(Math.abs(o)-w)<=D)return i.x=this.long0,i.y=w,e<0&&(i.y*=-1),i;var l=Math.tan(o),c=l*l,h=Math.sin(o),u=1/Math.sqrt(1-a*h*h),p=u*u*u*(1-a),d=t/u,_=d*d;n=o-u*l/p*_*(.5-(1+3*c)*_/24),r=d*(1-c*_*(1/3-(1+3*c)*_/15))/Math.cos(o);var g=VE(om.bind(this),t,e,r,n);if(!g)return null;r=g[0],n=g[1]}return i.x=I(r+this.long0,this.over),i.y=this.sphere?_i(n):n,i}var XE=["Cassini","Cassini_Soldner","Hyperbolic_Cassini_Soldner","cass"],lm={init:kE,forward:HE,inverse:WE,names:XE};function le(i,t){var e;return i>1e-7?(e=i*t,(1-i*i)*(t/(1-e*e)-.5/i*Math.log((1-e)/(1+e)))):2*t}var qE=.3333333333333333,YE=.17222222222222222,jE=.10257936507936508,ZE=.06388888888888888,JE=.0664021164021164,$E=.016415012942191543;function ns(i){var t,e=[];return e[0]=i*qE,t=i*i,e[0]+=t*YE,e[1]=t*ZE,t*=i,e[0]+=t*jE,e[1]+=t*JE,e[2]=t*$E,e}function rs(i,t){var e=i+i;return i+t[0]*Math.sin(e)+t[1]*Math.sin(e+e)+t[2]*Math.sin(e+e+e)}var fh=1,dh=2,ph=3,uo=4;function KE(){var i=Math.abs(this.lat0);if(Math.abs(i-w)<D?this.mode=this.lat0<0?fh:dh:Math.abs(i)<D?this.mode=ph:this.mode=uo,this.es>0){var t;switch(this.qp=le(this.e,1),this.mmf=.5/(1-this.es),this.apa=ns(this.es),this.mode){case dh:this.dd=1;break;case fh:this.dd=1;break;case ph:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case uo:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=le(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===uo&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function QE(i){var t,e,n,r,s,a,o,l,c,h,u=i.x,p=i.y;if(u=I(u-this.long0,this.over),this.sphere){if(s=Math.sin(p),h=Math.cos(p),n=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e=this.mode===this.EQUIT?1+h*n:1+this.sinph0*s+this.cosph0*h*n,e<=D)return null;e=Math.sqrt(2/e),t=e*h*Math.sin(u),e*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*h*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(p+this.lat0)<D)return null;e=et-p*.5,e=2*(this.mode===this.S_POLE?Math.cos(e):Math.sin(e)),t=e*Math.sin(u),e*=n}}else{switch(o=0,l=0,c=0,n=Math.cos(u),r=Math.sin(u),s=Math.sin(p),a=le(this.e,s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(o=a/this.qp,l=Math.sqrt(1-o*o)),this.mode){case this.OBLIQ:c=1+this.sinb1*o+this.cosb1*l*n;break;case this.EQUIT:c=1+l*n;break;case this.N_POLE:c=w+p,a=this.qp-a;break;case this.S_POLE:c=p-w,a=this.qp+a;break}if(Math.abs(c)<D)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:c=Math.sqrt(2/c),this.mode===this.OBLIQ?e=this.ymf*c*(this.cosb1*o-this.sinb1*l*n):e=(c=Math.sqrt(2/(1+l*n)))*o*this.ymf,t=this.xmf*c*l*r;break;case this.N_POLE:case this.S_POLE:a>=0?(t=(c=Math.sqrt(a))*r,e=n*(this.mode===this.S_POLE?c:-c)):t=e=0;break}}return i.x=this.a*t+this.x0,i.y=this.a*e+this.y0,i}function tw(i){i.x-=this.x0,i.y-=this.y0;var t=i.x/this.a,e=i.y/this.a,n,r,s,a,o,l,c;if(this.sphere){var h=0,u,p=0;if(u=Math.sqrt(t*t+e*e),r=u*.5,r>1)return null;switch(r=2*Math.asin(r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(p=Math.sin(r),h=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(u)<=D?0:Math.asin(e*p/u),t*=p,e=h*u;break;case this.OBLIQ:r=Math.abs(u)<=D?this.lat0:Math.asin(h*this.sinph0+e*p*this.cosph0/u),t*=p*this.cosph0,e=(h-Math.sin(r)*this.sinph0)*u;break;case this.N_POLE:e=-e,r=w-r;break;case this.S_POLE:r-=w;break}n=e===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,e)}else{if(c=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,e*=this.dd,l=Math.sqrt(t*t+e*e),l<D)return i.x=this.long0,i.y=this.lat0,i;a=2*Math.asin(.5*l/this.rq),s=Math.cos(a),t*=a=Math.sin(a),this.mode===this.OBLIQ?(c=s*this.sinb1+e*a*this.cosb1/l,o=this.qp*c,e=l*this.cosb1*s-e*this.sinb1*a):(c=e*a/l,o=this.qp*c,e=l*s)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(e=-e),o=t*t+e*e,!o)return i.x=this.long0,i.y=this.lat0,i;c=1-o/this.qp,this.mode===this.S_POLE&&(c=-c)}n=Math.atan2(t,e),r=rs(Math.asin(c),this.apa)}return i.x=I(this.long0+n,this.over),i.y=r,i}var ew=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],cm={init:KE,forward:QE,inverse:tw,names:ew,S_POLE:fh,N_POLE:dh,EQUIT:ph,OBLIQ:uo};function Kt(i){return Math.abs(i)>1&&(i=i>1?1:-1),Math.asin(i)}function iw(){Math.abs(this.lat1+this.lat2)<D||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Xt(this.e3,this.sin_po,this.cos_po),this.qs1=le(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Xt(this.e3,this.sin_po,this.cos_po),this.qs2=le(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=le(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>D?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function nw(i){var t=i.x,e=i.y;this.sin_phi=Math.sin(e),this.cos_phi=Math.cos(e);var n=le(this.e3,this.sin_phi),r=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,s=this.ns0*I(t-this.long0,this.over),a=r*Math.sin(s)+this.x0,o=this.rh-r*Math.cos(s)+this.y0;return i.x=a,i.y=o,i}function rw(i){var t,e,n,r,s,a;return i.x-=this.x0,i.y=this.rh-i.y+this.y0,this.ns0>=0?(t=Math.sqrt(i.x*i.x+i.y*i.y),n=1):(t=-Math.sqrt(i.x*i.x+i.y*i.y),n=-1),r=0,t!==0&&(r=Math.atan2(n*i.x,n*i.y)),n=t*this.ns0/this.a,this.sphere?a=Math.asin((this.c-n*n)/(2*this.ns0)):(e=(this.c-n*n)/this.ns0,a=this.phi1z(this.e3,e)),s=I(r/this.ns0+this.long0,this.over),i.x=s,i.y=a,i}function sw(i,t){var e,n,r,s,a,o=Kt(.5*t);if(i<D)return o;for(var l=i*i,c=1;c<=25;c++)if(e=Math.sin(o),n=Math.cos(o),r=i*e,s=1-r*r,a=.5*s*s/n*(t/(1-l)-e/s+.5/i*Math.log((1-r)/(1+r))),o=o+a,Math.abs(a)<=1e-7)return o;return null}var aw=["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],hm={init:iw,forward:nw,inverse:rw,names:aw,phi1z:sw};function ow(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function lw(i){var t,e,n,r,s,a,o,l,c=i.x,h=i.y;return n=I(c-this.long0,this.over),t=Math.sin(h),e=Math.cos(h),r=Math.cos(n),a=this.sin_p14*t+this.cos_p14*e*r,s=1,a>0||Math.abs(a)<=D?(o=this.x0+this.a*s*e*Math.sin(n)/a,l=this.y0+this.a*s*(this.cos_p14*t-this.sin_p14*e*r)/a):(o=this.x0+this.infinity_dist*e*Math.sin(n),l=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*e*r)),i.x=o,i.y=l,i}function cw(i){var t,e,n,r,s,a;return i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,(t=Math.sqrt(i.x*i.x+i.y*i.y))?(r=Math.atan2(t,this.rc),e=Math.sin(r),n=Math.cos(r),a=Kt(n*this.sin_p14+i.y*e*this.cos_p14/t),s=Math.atan2(i.x*e,t*this.cos_p14*n-i.y*this.sin_p14*e),s=I(this.long0+s,this.over)):(a=this.phic0,s=0),i.x=s,i.y=a,i}var hw=["gnom"],um={init:ow,forward:lw,inverse:cw,names:hw};function fm(i,t){var e=1-(1-i*i)/(2*i)*Math.log((1-i)/(1+i));if(Math.abs(Math.abs(t)-e)<1e-6)return t<0?-1*w:w;for(var n=Math.asin(.5*t),r,s,a,o,l=0;l<30;l++)if(s=Math.sin(n),a=Math.cos(n),o=i*s,r=Math.pow(1-o*o,2)/(2*a)*(t/(1-i*i)-s/(1-o*o)+.5/i*Math.log((1-o)/(1+o))),n+=r,Math.abs(r)<=1e-10)return n;return NaN}function uw(){this.sphere||(this.k0=Xt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function fw(i){var t=i.x,e=i.y,n,r,s=I(t-this.long0,this.over);if(this.sphere)n=this.x0+this.a*s*Math.cos(this.lat_ts),r=this.y0+this.a*Math.sin(e)/Math.cos(this.lat_ts);else{var a=le(this.e,Math.sin(e));n=this.x0+this.a*this.k0*s,r=this.y0+this.a*a*.5/this.k0}return i.x=n,i.y=r,i}function dw(i){i.x-=this.x0,i.y-=this.y0;var t,e;return this.sphere?(t=I(this.long0+i.x/this.a/Math.cos(this.lat_ts),this.over),e=Math.asin(i.y/this.a*Math.cos(this.lat_ts))):(e=fm(this.e,2*i.y*this.k0/this.a),t=I(this.long0+i.x/(this.a*this.k0),this.over)),i.x=t,i.y=e,i}var pw=["cea"],dm={init:uw,forward:fw,inverse:dw,names:pw};function mw(){if(!this.lat0)throw new Error("Invalid value for lat_0: lat_0 should be different from 0");this.k0||(this.k0=1);var i=this.alpha!==void 0?this.alpha:(parseFloat(this.azi)||0)*ut,t=Math.sin(this.lat0),e=1-this.es*t*t,n=1/Math.sqrt(e),r=(1-this.es)*n/e;this.kRg=this.k0*Math.sqrt(n*r),this.p0s=Math.atan(Math.sqrt(r/n)*Math.tan(this.lat0)),this.A=t/Math.sin(this.p0s),e=this.e*t,this.C=.5*this.e*this.A*Math.log((1+e)/(1-e))-this.A*Math.log(Math.tan(et+.5*this.lat0))+Math.log(Math.tan(et+.5*this.p0s)),e=i+i,this.Cb=1/(12*this.kRg*this.kRg),this.Ca=(1-Math.cos(e))*this.Cb,this.Cb*=Math.sin(e),this.Cc=3*(this.Ca*this.Ca-this.Cb*this.Cb),this.Cd=6*this.Ca*this.Cb}function gw(i){var t=I(i.x-this.long0,this.over),e=i.y,n=this.A*Math.log(Math.tan(et+.5*e)),r=this.e*Math.sin(e),s=.5*this.e*this.A*Math.log((1+r)/(1-r)),a=2*(Math.atan(Math.exp(n-s+this.C))-et),o=a-this.p0s,l=Math.cos(a),c=l*l,h=Math.sin(a),u=h*h,p=this.A*l,d=.5*this.A*p*h,_=d*this.A*this.A*(5*c-u)/12,g=p*this.A*this.A,v=g*(c-u)/6;g*=this.A*this.A*(5*c*c+u*(u-18*c))/120,r=t*t;var x=this.kRg*t*(p+r*(v+r*g)),b=this.kRg*(o+r*(d+r*_)),A=x*x,P=b*b;return n=3*x*P-x*A,s=b*P-3*A*b,x+=this.Ca*n+this.Cb*s,b+=this.Ca*s-this.Cb*n,i.x=this.a*x+this.x0,i.y=this.a*b+this.y0,i}function _w(i){var t=(i.x-this.x0)/this.a,e=(i.y-this.y0)/this.a,n=t*t,r=e*e,s=3*t*r-t*n,a=e*r-3*n*e,o=t*(5*r*r+n*(-10*r+n)),l=e*(5*n*n+r*(-10*n+r));t+=-this.Ca*s-this.Cb*a+this.Cc*o+this.Cd*l,e+=this.Cb*s-this.Ca*a-this.Cd*o+this.Cc*l;for(var c=this.p0s+e/this.kRg,h=c+this.lat0-this.p0s,u,p,d=20;d&&(s=this.A*Math.log(Math.tan(et+.5*h)),p=this.e*Math.sin(h),a=.5*this.e*this.A*Math.log((1+p)/(1-p)),u=c-2*(Math.atan(Math.exp(s-a+this.C))-et),h+=u,!(Math.abs(u)<D));--d);u=this.e*Math.sin(h),u=1-u*u;var _=(1-this.es)/(u*Math.sqrt(u));u=Math.tan(c);var g=u*u,v=this.kRg*this.kRg,x=_*this.k0*this.kRg,b=u/(2*x),A=u*(5+3*g)/(24*x*v);x=Math.cos(c)*this.kRg*this.A;var P=1/x;x*=v;var N=(1+2*g)/(6*x),G=(5+g*(28+24*g))/(120*x*v);return n=t*t,i.x=I(t*(P+n*(-N+n*G))+this.long0,this.over),i.y=h+n*(-b+A*n),i}var yw=["Laborde_Oblique_Mercator","labrd"],pm={init:mw,forward:gw,inverse:_w,names:yw};function vw(){if(this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts),this.es){var i=Math.sin(this.lat_ts),t=1/Math.sqrt(1-this.es*i*i);this.rc*=t,this.en=Te(this.es),this.ml0=It(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en)}}function xw(i){var t=i.x,e=i.y,n=I(t-this.long0,this.over);return i.x=this.x0+this.a*n*this.rc,this.es?i.y=this.y0+this.a*(It(e,Math.sin(e),Math.cos(e),this.en)-this.ml0):i.y=this.y0+this.a*(e-this.lat0),i}function Mw(i){var t=i.x,e=i.y;return i.x=I(this.long0+(t-this.x0)/(this.a*this.rc),this.over),this.es?i.y=Ae((e-this.y0)/this.a+this.ml0,this.es,this.en):i.y=this.lat0+(e-this.y0)/this.a,i}var Sw=["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","Equidistant_Cylindrical_Ellipsoidal","Plate_Carree","eqc"],mm={init:vw,forward:xw,inverse:Mw,names:Sw};function hn(i){return 1-.25*i*(1+i/16*(3+1.25*i))}function un(i){return .375*i*(1+.25*i*(1+.46875*i))}function fn(i){return .05859375*i*i*(1+.75*i)}function dn(i){return i*i*i*(35/3072)}function qt(i,t,e,n,r){return i*r-t*Math.sin(2*r)+e*Math.sin(4*r)-n*Math.sin(6*r)}function gm(i,t,e){var n=t*e;return i/Math.sqrt(1-n*n)}var _m=20;function bw(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=hn(this.es),this.e1=un(this.es),this.e2=fn(this.es),this.e3=dn(this.es),this.ml0=this.a*qt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Ew(i){var t=i.x,e=i.y,n,r,s,a=I(t-this.long0,this.over);if(s=a*Math.sin(e),this.sphere)Math.abs(e)<=D?(n=this.a*a,r=-1*this.a*this.lat0):(n=this.a*Math.sin(s)/Math.tan(e),r=this.a*(_i(e-this.lat0)+(1-Math.cos(s))/Math.tan(e)));else if(Math.abs(e)<=D)n=this.a*a,r=-1*this.ml0;else{var o=gm(this.a,this.e,Math.sin(e))/Math.tan(e);n=o*Math.sin(s),r=this.a*qt(this.e0,this.e1,this.e2,this.e3,e)-this.ml0+o*(1-Math.cos(s))}return i.x=n+this.x0,i.y=r+this.y0,i}function ww(i){var t,e,n,r,s,a,o,l,c;if(n=i.x-this.x0,r=i.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=D)t=I(n/this.a+this.long0,this.over),e=0;else{a=this.lat0+r/this.a,o=n*n/this.a/this.a+a*a,l=a;var h;for(s=_m;s;--s)if(h=Math.tan(l),c=-1*(a*(l*h+1)-l-.5*(l*l+o)*h)/((l-a)/h-1),l+=c,Math.abs(c)<=D){e=l;break}t=I(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(e),this.over)}else if(Math.abs(r+this.ml0)<=D)e=0,t=I(this.long0+n/this.a,this.over);else{a=(this.ml0+r)/this.a,o=n*n/this.a/this.a+a*a,l=a;var u,p,d,_,g;for(s=_m;s;--s)if(g=this.e*Math.sin(l),u=Math.sqrt(1-g*g)*Math.tan(l),p=this.a*qt(this.e0,this.e1,this.e2,this.e3,l),d=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),_=p/this.a,c=(a*(u*_+1)-_-.5*u*(_*_+o))/(this.es*Math.sin(2*l)*(_*_+o-2*a*_)/(4*u)+(a-_)*(u*d-2/Math.sin(2*l))-d),l-=c,Math.abs(c)<=D){e=l;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(e),2))*Math.tan(e),t=I(this.long0+Math.asin(n*u/this.a)/Math.sin(e),this.over)}return i.x=t,i.y=e,i}var Tw=["Polyconic","American_Polyconic","poly"],ym={init:bw,forward:Ew,inverse:ww,names:Tw};var Aw=1;function Cw(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function Pw(i){var t,e=i.x,n=i.y,r=n-this.lat0,s=e-this.long0,a=r/an*1e-5,o=s,l=1,c=0;for(t=1;t<=10;t++)l=l*a,c=c+this.A[t]*l;var h=c,u=o,p=1,d=0,_,g,v=0,x=0;for(t=1;t<=6;t++)_=p*h-d*u,g=d*h+p*u,p=_,d=g,v=v+this.B_re[t]*p-this.B_im[t]*d,x=x+this.B_im[t]*p+this.B_re[t]*d;return i.x=x*this.a+this.x0,i.y=v*this.a+this.y0,i}function Rw(i){var t,e=i.x,n=i.y,r=e-this.x0,s=n-this.y0,a=s/this.a,o=r/this.a,l=1,c=0,h,u,p=0,d=0;for(t=1;t<=6;t++)h=l*a-c*o,u=c*a+l*o,l=h,c=u,p=p+this.C_re[t]*l-this.C_im[t]*c,d=d+this.C_im[t]*l+this.C_re[t]*c;for(var _=0;_<this.iterations;_++){var g=p,v=d,x,b,A=a,P=o;for(t=2;t<=6;t++)x=g*p-v*d,b=v*p+g*d,g=x,v=b,A=A+(t-1)*(this.B_re[t]*g-this.B_im[t]*v),P=P+(t-1)*(this.B_im[t]*g+this.B_re[t]*v);g=1,v=0;var N=this.B_re[1],G=this.B_im[1];for(t=2;t<=6;t++)x=g*p-v*d,b=v*p+g*d,g=x,v=b,N=N+t*(this.B_re[t]*g-this.B_im[t]*v),G=G+t*(this.B_im[t]*g+this.B_re[t]*v);var B=N*N+G*G;p=(A*N+P*G)/B,d=(P*N-A*G)/B}var X=p,k=d,Z=1,S=0;for(t=1;t<=9;t++)Z=Z*X,S=S+this.D[t]*Z;var T=this.lat0+S*an*1e5,H=this.long0+k;return i.x=H,i.y=T,i}var Iw=["New_Zealand_Map_Grid","nzmg"],vm={init:Cw,forward:Pw,inverse:Rw,names:Iw,iterations:Aw};function Nw(){}function Lw(i){var t=i.x,e=i.y,n=I(t-this.long0,this.over),r=this.x0+this.a*n,s=this.y0+this.a*Math.log(Math.tan(Math.PI/4+e/2.5))*1.25;return i.x=r,i.y=s,i}function Dw(i){i.x-=this.x0,i.y-=this.y0;var t=I(this.long0+i.x/this.a,this.over),e=2.5*(Math.atan(Math.exp(.8*i.y/this.a))-Math.PI/4);return i.x=t,i.y=e,i}var Ow=["Miller_Cylindrical","mill"],xm={init:Nw,forward:Lw,inverse:Dw,names:Ow};var Uw=20;function Fw(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Te(this.es)}function mh(i){var t,e,n=i.x,r=i.y;if(n=I(n-this.long0,this.over),this.sphere){if(!this.m)r=this.n!==1?Math.asin(this.n*Math.sin(r)):r;else for(var s=this.n*Math.sin(r),a=Uw;a;--a){var o=(this.m*r+Math.sin(r)-s)/(this.m+Math.cos(r));if(r-=o,Math.abs(o)<D)break}t=this.a*this.C_x*n*(this.m+Math.cos(r)),e=this.a*this.C_y*r}else{var l=Math.sin(r),c=Math.cos(r);e=this.a*It(r,l,c,this.en),t=this.a*n*c/Math.sqrt(1-this.es*l*l)}return i.x=t,i.y=e,i}function gh(i){var t,e,n,r;return i.x-=this.x0,n=i.x/this.a,i.y-=this.y0,t=i.y/this.a,this.sphere?(t/=this.C_y,Math.abs(t)>w&&(t=xt(t)*w),n=n/(this.C_x*(this.m+Math.cos(t))),this.m?t=Kt((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=Kt(Math.sin(t)/this.n)),!this.over&&Math.abs(n)>Math.PI&&(n=xt(n)*Math.PI),n=I(n+this.long0,this.over)):(t=Ae(i.y/this.a,this.es,this.en),Math.abs(t)>w&&(t=xt(t)*w),r=Math.abs(t),r<w?(r=Math.sin(t),e=i.x*Math.sqrt(1-this.es*r*r)/(this.a*Math.cos(t)),!this.over&&Math.abs(e)>Math.PI&&(e=xt(e)*Math.PI),n=I(this.long0+e,this.over)):n=this.long0),i.x=n,i.y=t,i}var Bw=["Sinusoidal","sinu"],Mm={init:Fw,forward:mh,inverse:gh,names:Bw};function Gw(){this.sphere=!0,this.b=this.a,this.m=1,this.n=2.5707963267948966,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)}var zw=mh,kw=gh,Vw=["Eckert_VI","eck6"],Sm={init:Gw,forward:zw,inverse:kw,names:Vw};function Hw(){}function Ww(i){for(var t=i.x,e=i.y,n=I(t-this.long0,this.over),r=e,s=Math.PI*Math.sin(e);;){var a=-(r+Math.sin(r)-s)/(1+Math.cos(r));if(r+=a,Math.abs(a)<D)break}r/=2,Math.PI/2-Math.abs(e)<D&&(n=0);var o=.900316316158*this.a*n*Math.cos(r)+this.x0,l=1.4142135623731*this.a*Math.sin(r)+this.y0;return i.x=o,i.y=l,i}function Xw(i){var t,e;i.x-=this.x0,i.y-=this.y0,e=i.y/(1.4142135623731*this.a),Math.abs(e)>.999999999999&&(e=xt(e)*.999999999999),t=Math.asin(e);var n=i.x/(.900316316158*this.a*Math.cos(t));!this.over&&Math.abs(n)>Math.PI&&(n=xt(n)*Math.PI);var r=I(this.long0+n,this.over);e=(2*t+Math.sin(2*t))/Math.PI,Math.abs(e)>1&&(e=1);var s=Math.asin(e);return i.x=r,i.y=s,i}var qw=["Mollweide","moll"],bm={init:Hw,forward:Ww,inverse:Xw,names:qw};function ss(i,t,e,n,r){var s,a;s=i/t;for(var o=0;o<15;o++)if(a=(i-(t*s-e*Math.sin(2*s)+n*Math.sin(4*s)-r*Math.sin(6*s)))/(t-2*e*Math.cos(2*s)+4*n*Math.cos(4*s)-6*r*Math.cos(6*s)),s+=a,Math.abs(a)<=1e-10)return s;return NaN}function Yw(){Math.abs(this.lat1+this.lat2)<D||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=hn(this.es),this.e1=un(this.es),this.e2=fn(this.es),this.e3=dn(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Xt(this.e,this.sin_phi,this.cos_phi),this.ml1=qt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<D?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Xt(this.e,this.sin_phi,this.cos_phi),this.ml2=qt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=qt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function jw(i){var t=i.x,e=i.y,n;if(this.sphere)n=this.a*(this.g-e);else{var r=qt(this.e0,this.e1,this.e2,this.e3,e);n=this.a*(this.g-r)}var s=this.ns*I(t-this.long0,this.over),a=this.x0+n*Math.sin(s),o=this.y0+this.rh-n*Math.cos(s);return i.x=a,i.y=o,i}function Zw(i){i.x-=this.x0,i.y=this.rh-i.y+this.y0;var t,e,n,r;this.ns>=0?(e=Math.sqrt(i.x*i.x+i.y*i.y),t=1):(e=-Math.sqrt(i.x*i.x+i.y*i.y),t=-1);var s=0;if(e!==0&&(s=Math.atan2(t*i.x,t*i.y)),this.sphere)return r=I(this.long0+s/this.ns,this.over),n=_i(this.g-e/this.a),i.x=r,i.y=n,i;var a=this.g-e/this.a;return n=ss(a,this.e0,this.e1,this.e2,this.e3),r=I(this.long0+s/this.ns,this.over),i.x=r,i.y=n,i}var Jw=["Equidistant_Conic","eqdc"],Em={init:Yw,forward:jw,inverse:Zw,names:Jw};function $w(){this.R=this.a}function Kw(i){var t=i.x,e=i.y,n=I(t-this.long0,this.over),r,s;if(Math.abs(e)<=D)return r=this.x0+this.R*n,s=this.y0,i.x=r,i.y=s,i;var a=Kt(2*Math.abs(e/Math.PI));if(Math.abs(n)<=D||Math.abs(Math.abs(e)-w)<=D)return r=this.x0,e>=0?s=this.y0+Math.PI*this.R*Math.tan(.5*a):s=this.y0+Math.PI*this.R*-Math.tan(.5*a),i.x=r,i.y=s,i;var o=.5*Math.abs(Math.PI/n-n/Math.PI),l=o*o,c=Math.sin(a),h=Math.cos(a),u=h/(c+h-1),p=u*u,d=u*(2/c-1),_=d*d,g=Math.PI*this.R*(o*(u-_)+Math.sqrt(l*(u-_)*(u-_)-(_+l)*(p-_)))/(_+l);n<0&&(g=-g),r=this.x0+g;var v=l+u;return g=Math.PI*this.R*(d*v-o*Math.sqrt((_+l)*(l+1)-v*v))/(_+l),e>=0?s=this.y0+g:s=this.y0-g,i.x=r,i.y=s,i}function Qw(i){var t,e,n,r,s,a,o,l,c,h,u,p,d;return i.x-=this.x0,i.y-=this.y0,u=Math.PI*this.R,n=i.x/u,r=i.y/u,s=n*n+r*r,s>1&&(u=Math.sqrt(s),n/=u,r/=u,s=1),a=-Math.abs(r)*(1+s),o=a-2*r*r+n*n,l=-2*a+1+2*r*r+s*s,d=r*r/l+(2*o*o*o/l/l/l-9*a*o/l/l)/27,c=(a-o*o/3/l)/l,h=2*Math.sqrt(-c/3),u=3*d/c/h,Math.abs(u)>1&&(u>=0?u=1:u=-1),p=Math.acos(u)/3,i.y>=0?e=(-h*Math.cos(p+Math.PI/3)-o/3/l)*Math.PI:e=-(-h*Math.cos(p+Math.PI/3)-o/3/l)*Math.PI,Math.abs(n)<D?t=this.long0:t=I(this.long0+Math.PI*(s-1+Math.sqrt(1+2*(n*n-r*r)+s*s))/2/n,this.over),i.x=t,i.y=e,i}var tT=["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"],wm={init:$w,forward:Kw,inverse:Qw,names:tT};function Tm(i,t,e,n,r,s){let a=n-t,o=Math.atan((1-s)*Math.tan(i)),l=Math.atan((1-s)*Math.tan(e)),c=Math.sin(o),h=Math.cos(o),u=Math.sin(l),p=Math.cos(l),d=a,_,g=100,v,x,b,A,P,N,G,B,X,k,Z,S,T,H;do{if(v=Math.sin(d),x=Math.cos(d),b=Math.sqrt(p*v*(p*v)+(h*u-c*p*x)*(h*u-c*p*x)),b===0)return{azi1:0,s12:0};A=c*u+h*p*x,P=Math.atan2(b,A),N=h*p*v/b,G=1-N*N,B=G!==0?A-2*c*u/G:0,X=s/16*G*(4+s*(4-3*G)),_=d,d=a+(1-X)*s*N*(P+X*b*(B+X*A*(-1+2*B*B)))}while(Math.abs(d-_)>1e-12&&--g>0);return g===0?{azi1:NaN,s12:NaN}:(k=G*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),Z=1+k/16384*(4096+k*(-768+k*(320-175*k))),S=k/1024*(256+k*(-128+k*(74-47*k))),T=S*b*(B+S/4*(A*(-1+2*B*B)-S/6*B*(-3+4*b*b)*(-3+4*B*B))),H=r*(1-s)*Z*(P-T),{azi1:Math.atan2(p*v,h*u-c*p*x),s12:H})}function Am(i,t,e,n,r,s){let a=Math.atan((1-s)*Math.tan(i)),o=Math.sin(a),l=Math.cos(a),c=Math.sin(e),h=Math.cos(e),u=Math.atan2(o,l*h),p=l*c,d=1-p*p,_=d*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),g=1+_/16384*(4096+_*(-768+_*(320-175*_))),v=_/1024*(256+_*(-128+_*(74-47*_))),x=n/(r*(1-s)*g),b,A=100,P,N,G,B;do P=Math.cos(2*u+x),N=Math.sin(x),G=Math.cos(x),B=v*N*(P+v/4*(G*(-1+2*P*P)-v/6*P*(-3+4*N*N)*(-3+4*P*P))),b=x,x=n/(r*(1-s)*g)+B;while(Math.abs(x-b)>1e-12&&--A>0);if(A===0)return{lat2:NaN,lon2:NaN};let X=o*N-l*G*h,k=Math.atan2(o*G+l*N*h,(1-s)*Math.sqrt(p*p+X*X)),Z=Math.atan2(N*c,l*G-o*N*h),S=s/16*d*(4+s*(4-3*d)),T=Z-(1-S)*s*p*(x+S*N*(P+S*G*(-1+2*P*P))),H=t+T;return{lat2:k,lon2:H}}function eT(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es)),this.guam=(this.guam===!0||gi(this.projName).toLowerCase()==="guam_projection")&&this.es!==0,this.guam&&(this.en=Te(this.es),this.M1=It(this.lat0,this.sin_p12,this.cos_p12,this.en))}function iT(i){var t=i.x,e=i.y,n=Math.sin(i.y),r=Math.cos(i.y),s=I(t-this.long0,this.over),a,o,l,c,h,u,p,d,_,g,v,x;return this.sphere?Math.abs(this.sin_p12-1)<=D?(i.x=this.x0+this.a*(w-e)*Math.sin(s),i.y=this.y0-this.a*(w-e)*Math.cos(s),i):Math.abs(this.sin_p12+1)<=D?(i.x=this.x0+this.a*(w+e)*Math.sin(s),i.y=this.y0+this.a*(w+e)*Math.cos(s),i):(_=this.sin_p12*n+this.cos_p12*r*Math.cos(s),p=Math.acos(_),d=p?p/Math.sin(p):1,i.x=this.x0+this.a*d*r*Math.sin(s),i.y=this.y0+this.a*d*(this.cos_p12*n-this.sin_p12*r*Math.cos(s)),i):this.guam?(x=1/Math.sqrt(1-this.es*n*n),i.x=this.x0+this.a*s*r*x,i.y=this.y0+this.a*(It(e,n,r,this.en)-this.M1+.5*s*s*r*n*x),i):(a=hn(this.es),o=un(this.es),l=fn(this.es),c=dn(this.es),Math.abs(this.sin_p12-1)<=D?(h=this.a*qt(a,o,l,c,w),u=this.a*qt(a,o,l,c,e),i.x=this.x0+(h-u)*Math.sin(s),i.y=this.y0-(h-u)*Math.cos(s),i):Math.abs(this.sin_p12+1)<=D?(h=this.a*qt(a,o,l,c,w),u=this.a*qt(a,o,l,c,e),i.x=this.x0+(h+u)*Math.sin(s),i.y=this.y0+(h+u)*Math.cos(s),i):Math.abs(t)<D&&Math.abs(e-this.lat0)<D?(i.x=this.x0,i.y=this.y0,i):(g=Tm(this.lat0,this.long0,e,t,this.a,this.f),v=g.azi1,i.x=this.x0+g.s12*Math.sin(v),i.y=this.y0+g.s12*Math.cos(v),i))}function nT(i){i.x-=this.x0,i.y-=this.y0;var t,e,n,r,s,a,o,l,c,h,u,p,d,_,g,v,x,b,A,P;if(this.sphere)return t=Math.sqrt(i.x*i.x+i.y*i.y),t>2*w*this.a?void 0:(e=t/this.a,n=Math.sin(e),r=Math.cos(e),s=this.long0,Math.abs(t)<=D?a=this.lat0:(a=Kt(r*this.sin_p12+i.y*n*this.cos_p12/t),o=Math.abs(this.lat0)-w,Math.abs(o)<=D?this.lat0>=0?s=I(this.long0+Math.atan2(i.x,-i.y),this.over):s=I(this.long0-Math.atan2(-i.x,i.y),this.over):s=I(this.long0+Math.atan2(i.x*n,t*this.cos_p12*r-i.y*this.sin_p12*n),this.over)),i.x=s,i.y=a,i);if(this.guam){for(x=i.x/this.a,b=.5*x*x,a=this.lat0,P=0;P<3;++P)A=this.e*Math.sin(a),A=Math.sqrt(1-A*A),a=Ae(this.M1+i.y/this.a-b*Math.tan(a)*A,this.es,this.en);return i.x=I(this.long0+x*A/Math.cos(a),this.over),i.y=a,i}else return l=hn(this.es),c=un(this.es),h=fn(this.es),u=dn(this.es),Math.abs(this.sin_p12-1)<=D?(p=this.a*qt(l,c,h,u,w),t=Math.sqrt(i.x*i.x+i.y*i.y),d=p-t,a=ss(d/this.a,l,c,h,u),s=I(this.long0+Math.atan2(i.x,-1*i.y),this.over),i.x=s,i.y=a,i):Math.abs(this.sin_p12+1)<=D?(p=this.a*qt(l,c,h,u,w),t=Math.sqrt(i.x*i.x+i.y*i.y),d=t-p,a=ss(d/this.a,l,c,h,u),s=I(this.long0+Math.atan2(i.x,i.y),this.over),i.x=s,i.y=a,i):(_=Math.atan2(i.x,i.y),g=Math.sqrt(i.x*i.x+i.y*i.y),v=Am(this.lat0,this.long0,_,g,this.a,this.f),i.x=v.lon2,i.y=v.lat2,i)}var rT=["Azimuthal_Equidistant","Guam_Projection","aeqd"],Cm={init:eT,forward:iT,inverse:nT,names:rT};var fo=1,Pm=2,Rm=3,sT=4;function aT(){var i=this.lat0||0;this.sin_p14=Math.sin(i),this.cos_p14=Math.cos(i),this.sinalpha=Math.sin(this.alpha||0),this.cosalpha=Math.cos(this.alpha||0),Math.abs(Math.abs(i)-w)<=D?this.mode=i<0?Pm:fo:Math.abs(i)>D?this.mode=sT:this.mode=Rm,this.nu0=1/Math.sqrt(1-this.es*this.sin_p14*this.sin_p14),this.y_shift=this.es*this.nu0*this.sin_p14*this.cos_p14,this.y_scale=1/Math.sqrt(1-this.es*this.cos_p14*this.cos_p14)}function oT(i){var t,e,n,r,s,a,o,l,c,h,u,p=i.x,d=i.y;return n=I(p-(this.long0||0),this.over),t=Math.sin(d),e=Math.cos(d),r=Math.cos(n),s=this.sin_p14*t+this.cos_p14*e*r,(s>0||Math.abs(s)<=D)&&(u=this.a*this.k0,h=1/Math.sqrt(1-this.es*t*t),l=u*h*e*Math.sin(n),c=u*(h*(t*this.cos_p14-e*this.sin_p14*r)+this.es*(this.nu0*this.sin_p14-h*t)*this.cos_p14),a=(this.x0||0)+this.cosalpha*l-this.sinalpha*c,o=(this.y0||0)+this.sinalpha*l+this.cosalpha*c),i.x=a,i.y=o,i}function lT(i){var t,e,n,r,s,a,o,l,c,h,u,p,d,_,g,v,x,b,A,P,N,G,B,X,k,Z,S,T,H,q;if(h=i.x-(this.x0||0),u=i.y-(this.y0||0),i.x=(this.cosalpha*h+this.sinalpha*u)/this.k0,i.y=(-this.sinalpha*h+this.cosalpha*u)/this.k0,this.es!==0){if(h=i.x/this.a,u=i.y/this.a,this.mode===fo||this.mode===Pm){if(d=h*h+u*u,d>=1-1e-15){if(d-1>D)return null;o=0}else o=Math.acos(Math.sqrt(d*(1-this.es)/(1-this.es*d)))*(this.mode===fo?1:-1);a=Math.atan2(h,u*(this.mode===fo?-1:1))}else if(this.mode===Rm){if(p=u*this.a/this.b,h*h+p*p>1+1e-11)return null;s=(1-this.es)/u,_=u===0?0:1/(s*s+this.es),_>1-1e-11?(o=w*(u>0?1:-1),a=0):(o=Math.asin(Math.sqrt(_))*(u>0?1:-1),x=h*Math.sqrt((1-this.es*_)/(1-_)),a=Math.abs(x)-1>-1e-15?w*(h>0?1:-1):Math.asin(x))}else{if(p=(u-this.y_shift)/this.y_scale,d=h*h+p*p,d>1+1e-11)return null;for(t=Math.sqrt(d),t<=D?(o=this.lat0,a=0):(n=Math.min(t,1),r=Math.sqrt(1-n*n),g=r*this.sin_p14+p*n*this.cos_p14/t,o=Kt(g),a=Math.atan2(h*n*this.cos_p14,(r-this.sin_p14*g)*t)),q=0;q<20&&(g=Math.sin(o),v=Math.cos(o),x=Math.sin(a),b=Math.cos(a),s=1-this.es*g*g,A=1/Math.sqrt(s),P=(1-this.es)*A/s,N=-P*g*x,G=A*v*b,B=P*(v*this.cos_p14+g*this.sin_p14*b),X=A*this.sin_p14*v*x,k=N*X-G*B,Z=h-A*v*x,S=u-(A*(g*this.cos_p14-v*this.sin_p14*b)+this.es*(this.nu0*this.sin_p14-A*g)*this.cos_p14),!(Math.abs(Z)<1e-15&&Math.abs(S)<1e-15||(T=(X*Z-G*S)/k,H=(-B*Z+N*S)/k,o+=T,o>w?(o=w-(o-w),a=I(a+Math.PI)):o<-w&&(o=-w+(-w-o),a=I(a+Math.PI)),a+=H,Math.abs(T)<1e-12&&Math.abs(H)<1e-12)));q++);if(q===20)return null}return i.x=I(a+(this.long0||0),this.over),i.y=o,i}return t=Math.sqrt(i.x*i.x+i.y*i.y),e=Kt(t/this.a),n=Math.sin(e),r=Math.cos(e),l=this.long0||0,c=this.lat0||0,a=l,Math.abs(t)<=D?(o=c,i.x=a,i.y=o,i):(o=Kt(r*this.sin_p14+i.y*n*this.cos_p14/t),s=Math.abs(c)-w,Math.abs(s)<=D?(c>=0?a=I(l+Math.atan2(i.x,-i.y),this.over):a=I(l-Math.atan2(-i.x,i.y),this.over),i.x=a,i.y=o,i):(a=I(l+Math.atan2(i.x*n,t*this.cos_p14*r-i.y*this.sin_p14*n),this.over),i.x=a,i.y=o,i))}var cT=["Orthographic","Local_Orthographic","ortho"],Im={init:aT,forward:oT,inverse:lT,names:cT};var Mt={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},dt={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function hT(){this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=w-et/2?this.face=Mt.TOP:this.lat0<=-(w-et/2)?this.face=Mt.BOTTOM:Math.abs(this.long0)<=et?this.face=Mt.FRONT:Math.abs(this.long0)<=w+et?this.face=this.long0>0?Mt.RIGHT:Mt.LEFT:this.face=Mt.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function uT(i){var t={x:0,y:0},e,n,r,s,a,o,l={value:0};if(i.x-=this.long0,this.es!==0?e=Math.atan(this.one_minus_f_squared*Math.tan(i.y)):e=i.y,n=i.x,this.face===Mt.TOP)s=w-e,n>=et&&n<=w+et?(l.value=dt.AREA_0,r=n-w):n>w+et||n<=-(w+et)?(l.value=dt.AREA_1,r=n>0?n-vt:n+vt):n>-(w+et)&&n<=-et?(l.value=dt.AREA_2,r=n+w):(l.value=dt.AREA_3,r=n);else if(this.face===Mt.BOTTOM)s=w+e,n>=et&&n<=w+et?(l.value=dt.AREA_0,r=-n+w):n<et&&n>=-et?(l.value=dt.AREA_1,r=-n):n<-et&&n>=-(w+et)?(l.value=dt.AREA_2,r=-n-w):(l.value=dt.AREA_3,r=n>0?-n+vt:-n-vt);else{var c,h,u,p,d,_,g;this.face===Mt.RIGHT?n=rr(n,+w):this.face===Mt.BACK?n=rr(n,+vt):this.face===Mt.LEFT&&(n=rr(n,-w)),p=Math.sin(e),d=Math.cos(e),_=Math.sin(n),g=Math.cos(n),c=d*g,h=d*_,u=p,this.face===Mt.FRONT?(s=Math.acos(c),r=po(s,u,h,l)):this.face===Mt.RIGHT?(s=Math.acos(h),r=po(s,u,-c,l)):this.face===Mt.BACK?(s=Math.acos(-c),r=po(s,u,-h,l)):this.face===Mt.LEFT?(s=Math.acos(-h),r=po(s,u,c,l)):(s=r=0,l.value=dt.AREA_0)}return o=Math.atan(12/vt*(r+Math.acos(Math.sin(r)*Math.cos(et))-w)),a=Math.sqrt((1-Math.cos(s))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(r))))),l.value===dt.AREA_1?o+=w:l.value===dt.AREA_2?o+=vt:l.value===dt.AREA_3&&(o+=1.5*vt),t.x=a*Math.cos(o),t.y=a*Math.sin(o),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,i.x=t.x,i.y=t.y,i}function fT(i){var t={lam:0,phi:0},e,n,r,s,a,o,l,c,h,u={value:0};if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,n=Math.atan(Math.sqrt(i.x*i.x+i.y*i.y)),e=Math.atan2(i.y,i.x),i.x>=0&&i.x>=Math.abs(i.y)?u.value=dt.AREA_0:i.y>=0&&i.y>=Math.abs(i.x)?(u.value=dt.AREA_1,e-=w):i.x<0&&-i.x>=Math.abs(i.y)?(u.value=dt.AREA_2,e=e<0?e+vt:e-vt):(u.value=dt.AREA_3,e+=w),h=vt/12*Math.tan(e),a=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),o=Math.atan(a),r=Math.cos(e),s=Math.tan(n),l=1-r*r*s*s*(1-Math.cos(Math.atan(1/Math.cos(o)))),l<-1?l=-1:l>1&&(l=1),this.face===Mt.TOP)c=Math.acos(l),t.phi=w-c,u.value===dt.AREA_0?t.lam=o+w:u.value===dt.AREA_1?t.lam=o<0?o+vt:o-vt:u.value===dt.AREA_2?t.lam=o-w:t.lam=o;else if(this.face===Mt.BOTTOM)c=Math.acos(l),t.phi=c-w,u.value===dt.AREA_0?t.lam=-o+w:u.value===dt.AREA_1?t.lam=-o:u.value===dt.AREA_2?t.lam=-o-w:t.lam=o<0?-o-vt:-o+vt;else{var p,d,_;p=l,h=p*p,h>=1?_=0:_=Math.sqrt(1-h)*Math.sin(o),h+=_*_,h>=1?d=0:d=Math.sqrt(1-h),u.value===dt.AREA_1?(h=d,d=-_,_=h):u.value===dt.AREA_2?(d=-d,_=-_):u.value===dt.AREA_3&&(h=d,d=_,_=-h),this.face===Mt.RIGHT?(h=p,p=-d,d=h):this.face===Mt.BACK?(p=-p,d=-d):this.face===Mt.LEFT&&(h=p,p=d,d=-h),t.phi=Math.acos(-_)-w,t.lam=Math.atan2(d,p),this.face===Mt.RIGHT?t.lam=rr(t.lam,-w):this.face===Mt.BACK?t.lam=rr(t.lam,-vt):this.face===Mt.LEFT&&(t.lam=rr(t.lam,+w))}if(this.es!==0){var g,v,x;g=t.phi<0?1:0,v=Math.tan(t.phi),x=this.b/Math.sqrt(v*v+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-x*x)/(this.one_minus_f*x)),g&&(t.phi=-t.phi)}return t.lam+=this.long0,i.x=t.lam,i.y=t.phi,i}function po(i,t,e,n){var r;return i<D?(n.value=dt.AREA_0,r=0):(r=Math.atan2(t,e),Math.abs(r)<=et?n.value=dt.AREA_0:r>et&&r<=w+et?(n.value=dt.AREA_1,r-=w):r>w+et||r<=-(w+et)?(n.value=dt.AREA_2,r=r>=0?r-vt:r+vt):(n.value=dt.AREA_3,r+=w)),r}function rr(i,t){var e=i+t;return e<-vt?e+=Wi:e>+vt&&(e-=Wi),e}var dT=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Nm={init:hT,forward:uT,inverse:fT,names:dT};var _h=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],as=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Lm=.8487,Dm=1.3523,Om=Rt/5,pT=1/Om,sr=18,mo=function(i,t){return i[0]+t*(i[1]+t*(i[2]+t*i[3]))},mT=function(i,t){return i[1]+t*(2*i[2]+t*3*i[3])};function gT(i,t,e,n){for(var r=t;n;--n){var s=i(r);if(r-=s,Math.abs(s)<e)break}return r}function _T(){this.es=0,this.title=this.title||"Robinson"}function yT(i){var t=I(i.x-this.long0,this.over),e=Math.abs(i.y),n=Math.floor(e*Om);n<0?n=0:n>=sr&&(n=sr-1),e=Rt*(e-pT*n);var r={x:mo(_h[n],e)*t,y:mo(as[n],e)};return i.y<0&&(r.y=-r.y),r.x=r.x*this.a*Lm+this.x0,r.y=r.y*this.a*Dm+this.y0,i.z!==void 0&&(r.z=i.z),i.m!==void 0&&(r.m=i.m),r}function vT(i){var t={x:(i.x-this.x0)/(this.a*Lm),y:Math.abs(i.y-this.y0)/(this.a*Dm)};if(t.y>=1)t.x/=_h[sr][0],t.y=i.y<0?-w:w;else{var e=Math.floor(t.y*sr);for(e<0?e=0:e>=sr&&(e=sr-1);;)if(as[e][0]>t.y)--e;else if(as[e+1][0]<=t.y)++e;else break;var n=as[e],r=5*(t.y-n[0])/(as[e+1][0]-n[0]);r=gT(function(s){return(mo(n,s)-t.y)/mT(n,s)},r,D,100),t.x/=mo(_h[e],r),t.y=(5*e+r)*ut,i.y<0&&(t.y=-t.y)}return!this.over&&Math.abs(t.x)>Math.PI&&(t.x=xt(t.x)*Math.PI),t.x=I(t.x+this.long0,this.over),i.z!==void 0&&(t.z=i.z),i.m!==void 0&&(t.m=i.m),t}var xT=["Robinson","robin"],Um={init:_T,forward:yT,inverse:vT,names:xT};function MT(){this.name="geocent"}function ST(i){var t=io(i,this.es,this.a);return t}function bT(i){var t=no(i,this.es,this.a,this.b);return t}var ET=["Geocentric","geocentric","geocent","Geocent"],Fm={init:MT,forward:ST,inverse:bT,names:ET};var Yt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},os={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function wT(){if(Object.keys(os).forEach(function(e){if(typeof this[e]>"u")this[e]=os[e].def;else{if(os[e].num&&isNaN(this[e]))throw new Error("Invalid parameter value, must be numeric "+e+" = "+this[e]);os[e].num&&(this[e]=parseFloat(this[e]))}os[e].degrees&&(this[e]=this[e]*ut)}.bind(this)),Math.abs(Math.abs(this.lat0)-w)<D?this.mode=this.lat0<0?Yt.S_POLE:Yt.N_POLE:Math.abs(this.lat0)<D?this.mode=Yt.EQUIT:(this.mode=Yt.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var i=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(i),this.sw=Math.sin(i)}function TT(i){i.x-=this.long0;var t=Math.sin(i.y),e=Math.cos(i.y),n=Math.cos(i.x),r,s;switch(this.mode){case Yt.OBLIQ:s=this.sinph0*t+this.cosph0*e*n;break;case Yt.EQUIT:s=e*n;break;case Yt.S_POLE:s=-t;break;case Yt.N_POLE:s=t;break}switch(s=this.pn1/(this.p-s),r=s*e*Math.sin(i.x),this.mode){case Yt.OBLIQ:s*=this.cosph0*t-this.sinph0*e*n;break;case Yt.EQUIT:s*=t;break;case Yt.N_POLE:s*=-(e*n);break;case Yt.S_POLE:s*=e*n;break}var a,o;return a=s*this.cg+r*this.sg,o=1/(a*this.sw*this.h1+this.cw),r=(r*this.cg-s*this.sg)*this.cw*o,s=a*o,i.x=r*this.a,i.y=s*this.a,i}function AT(i){i.x/=this.a,i.y/=this.a;var t={x:i.x,y:i.y},e,n,r;r=1/(this.pn1-i.y*this.sw),e=this.pn1*i.x*r,n=this.pn1*i.y*this.cw*r,i.x=e*this.cg+n*this.sg,i.y=n*this.cg-e*this.sg;var s=Ct(i.x,i.y);if(Math.abs(s)<D)t.x=0,t.y=i.y;else{var a,o;switch(o=1-s*s*this.pfact,o=(this.p-Math.sqrt(o))/(this.pn1/s+s/this.pn1),a=Math.sqrt(1-o*o),this.mode){case Yt.OBLIQ:t.y=Math.asin(a*this.sinph0+i.y*o*this.cosph0/s),i.y=(a-this.sinph0*Math.sin(t.y))*s,i.x*=o*this.cosph0;break;case Yt.EQUIT:t.y=Math.asin(i.y*o/s),i.y=a*s,i.x*=o;break;case Yt.N_POLE:t.y=Math.asin(a),i.y=-i.y;break;case Yt.S_POLE:t.y=-Math.asin(a);break}t.x=Math.atan2(i.x,i.y)}return i.x=t.x+this.long0,i.y=t.y,i}var CT=["Tilted_Perspective","tpers"],Bm={init:wT,forward:TT,inverse:AT,names:CT};function PT(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var i=1-this.es,t=1/i;this.radius_p=Math.sqrt(i),this.radius_p2=i,this.radius_p_inv2=t,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function RT(i){var t=i.x,e=i.y,n,r,s,a;if(t=t-this.long0,this.shape==="ellipse"){e=Math.atan(this.radius_p2*Math.tan(e));var o=this.radius_p/Ct(this.radius_p*Math.cos(e),Math.sin(e));if(r=o*Math.cos(t)*Math.cos(e),s=o*Math.sin(t)*Math.cos(e),a=o*Math.sin(e),(this.radius_g-r)*r-s*s-a*a*this.radius_p_inv2<0)return i.x=Number.NaN,i.y=Number.NaN,i;n=this.radius_g-r,this.flip_axis?(i.x=this.radius_g_1*Math.atan(s/Ct(a,n)),i.y=this.radius_g_1*Math.atan(a/n)):(i.x=this.radius_g_1*Math.atan(s/n),i.y=this.radius_g_1*Math.atan(a/Ct(s,n)))}else this.shape==="sphere"&&(n=Math.cos(e),r=Math.cos(t)*n,s=Math.sin(t)*n,a=Math.sin(e),n=this.radius_g-r,this.flip_axis?(i.x=this.radius_g_1*Math.atan(s/Ct(a,n)),i.y=this.radius_g_1*Math.atan(a/n)):(i.x=this.radius_g_1*Math.atan(s/n),i.y=this.radius_g_1*Math.atan(a/Ct(s,n))));return i.x=i.x*this.a,i.y=i.y*this.a,i}function IT(i){var t=-1,e=0,n=0,r,s,a,o;if(i.x=i.x/this.a,i.y=i.y/this.a,this.shape==="ellipse"){this.flip_axis?(n=Math.tan(i.y/this.radius_g_1),e=Math.tan(i.x/this.radius_g_1)*Ct(1,n)):(e=Math.tan(i.x/this.radius_g_1),n=Math.tan(i.y/this.radius_g_1)*Ct(1,e));var l=n/this.radius_p;if(r=e*e+l*l+t*t,s=2*this.radius_g*t,a=s*s-4*r*this.C,a<0)return i.x=Number.NaN,i.y=Number.NaN,i;o=(-s-Math.sqrt(a))/(2*r),t=this.radius_g+o*t,e*=o,n*=o,i.x=Math.atan2(e,t),i.y=Math.atan(n*Math.cos(i.x)/t),i.y=Math.atan(this.radius_p_inv2*Math.tan(i.y))}else if(this.shape==="sphere"){if(this.flip_axis?(n=Math.tan(i.y/this.radius_g_1),e=Math.tan(i.x/this.radius_g_1)*Math.sqrt(1+n*n)):(e=Math.tan(i.x/this.radius_g_1),n=Math.tan(i.y/this.radius_g_1)*Math.sqrt(1+e*e)),r=e*e+n*n+t*t,s=2*this.radius_g*t,a=s*s-4*r*this.C,a<0)return i.x=Number.NaN,i.y=Number.NaN,i;o=(-s-Math.sqrt(a))/(2*r),t=this.radius_g+o*t,e*=o,n*=o,i.x=Math.atan2(e,t),i.y=Math.atan(n*Math.cos(i.x)/t)}return i.x=i.x+this.long0,i}var NT=["Geostationary Satellite View","Geostationary_Satellite","geos"],Gm={init:PT,forward:RT,inverse:IT,names:NT};var ls=1.340264,cs=-.081106,hs=893e-6,us=.003796,go=Math.sqrt(3)/2;function LT(){this.es!==0&&(this.apa=ns(this.es),this.qp=le(this.e,1),this.rqda=Math.sqrt(.5*this.qp))}function DT(i){var t=I(i.x-this.long0,this.over),e=i.y,n=Math.sin(e);this.es!==0&&(n=le(this.e,n)/this.qp);var r=Math.asin(go*n),s=r*r,a=s*s*s;return i.x=t*Math.cos(r)/(go*(ls+3*cs*s+a*(7*hs+9*us*s))),i.y=r*(ls+cs*s+a*(hs+us*s)),this.es!==0&&(i.x*=this.rqda,i.y*=this.rqda),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function OT(i){i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,this.es!==0&&(i.x/=this.rqda,i.y/=this.rqda);var t=1e-9,e=12,n=i.y,r,s,a,o,l,c;for(c=0;c<e&&(r=n*n,s=r*r*r,a=n*(ls+cs*r+s*(hs+us*r))-i.y,o=ls+3*cs*r+s*(7*hs+9*us*r),n-=l=a/o,!(Math.abs(l)<t));++c);return Math.abs(n)>Math.PI/3&&(n=xt(n)*Math.PI/3),r=n*n,s=r*r*r,i.x=go*i.x*(ls+3*cs*r+s*(7*hs+9*us*r))/Math.cos(n),!this.over&&Math.abs(i.x)>Math.PI&&(i.x=xt(i.x)*Math.PI),i.y=Math.asin(Math.sin(n)/go),this.es!==0&&(i.y=rs(i.y,this.apa)),i.x=I(i.x+this.long0,this.over),i}var UT=["eqearth","Equal Earth","Equal_Earth"],zm={init:LT,forward:DT,inverse:OT,names:UT};var fs=1e-10;function FT(){var i;if(this.phi1=this.lat1,Math.abs(this.phi1)<fs)throw new Error;this.es?(this.en=Te(this.es),this.m1=It(this.phi1,this.am1=Math.sin(this.phi1),i=Math.cos(this.phi1),this.en),this.am1=i/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=GT,this.forward=BT):(Math.abs(this.phi1)+fs>=w?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=kT,this.forward=zT)}function BT(i){var t=I(i.x-(this.long0||0),this.over),e=i.y,n,r,s;return n=this.am1+this.m1-It(e,r=Math.sin(e),s=Math.cos(e),this.en),r=s*t/(n*Math.sqrt(1-this.es*r*r)),i.x=n*Math.sin(r),i.y=this.am1-n*Math.cos(r),i.x=this.a*i.x+(this.x0||0),i.y=this.a*i.y+(this.y0||0),i}function GT(i){i.x=(i.x-(this.x0||0))/this.a,i.y=(i.y-(this.y0||0))/this.a;var t,e,n,r;if(e=Ct(i.x,i.y=this.am1-i.y),r=Ae(this.am1+this.m1-e,this.es,this.en),(t=Math.abs(r))<w)t=Math.sin(r),n=e*Math.atan2(i.x,i.y)*Math.sqrt(1-this.es*t*t)/Math.cos(r);else if(Math.abs(t-w)<=fs)n=0;else throw new Error;return i.x=I(n+(this.long0||0),this.over),i.y=_i(r),i}function zT(i){var t=I(i.x-(this.long0||0),this.over),e=i.y,n,r;return r=this.cphi1+this.phi1-e,Math.abs(r)>fs?(i.x=r*Math.sin(n=t*Math.cos(e)/r),i.y=this.cphi1-r*Math.cos(n)):i.x=i.y=0,i.x=this.a*i.x+(this.x0||0),i.y=this.a*i.y+(this.y0||0),i}function kT(i){i.x=(i.x-(this.x0||0))/this.a,i.y=(i.y-(this.y0||0))/this.a;var t,e,n=Ct(i.x,i.y=this.cphi1-i.y);if(e=this.cphi1+this.phi1-n,Math.abs(e)>w)throw new Error;return Math.abs(Math.abs(e)-w)<=fs?t=0:t=n*Math.atan2(i.x,i.y)/Math.cos(e),i.x=I(t+(this.long0||0),this.over),i.y=_i(e),i}var VT=["bonne","Bonne (Werner lat_1=90)"],km={init:FT,names:VT};var Vm={OBLIQUE:{forward:YT,inverse:ZT},TRANSVERSE:{forward:jT,inverse:JT}},_o={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}};function HT(){if(this.title=this.title||"General Oblique Transformation",this.isIdentity=$c.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if(this.o_proj==="ob_tran")throw new Error("Invalid value for o_proj: "+this.o_proj);let i=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),t=Oe(i);if(!t)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);t.long0=0,this.obliqueProjection=t;let e,n=Object.keys(_o),r=o=>{if(typeof this[o]>"u")return;let l=parseFloat(this[o])*ut;if(isNaN(l))throw new Error("Invalid value for "+o+": "+this[o]);return l};for(let o=0;o<n.length;o++){let l=n[o],c=_o[l],h=Object.entries(c);if(h.some(([p])=>typeof this[p]<"u")){e=c;for(let p=0;p<h.length;p++){let[d,_]=h[p],g=r(d);if(typeof g>"u")throw new Error("Missing parameter: "+d+".");this[_]=g}break}}if(!e)throw new Error("No valid parameters provided for ob_tran projection.");let{lamp:s,phip:a}=qT(this,e);this.lamp=s,Math.abs(a)>D?(this.cphip=Math.cos(a),this.sphip=Math.sin(a),this.projectionType=Vm.OBLIQUE):this.projectionType=Vm.TRANSVERSE}function WT(i){return this.projectionType.forward(this,i)}function XT(i){return this.projectionType.inverse(this,i)}function qT(i,t){let e,n;if(t===_o.ROTATE){let r=i.oLongC,s=i.oLatC,a=i.oAlpha;if(Math.abs(Math.abs(s)-w)<=D)throw new Error("Invalid value for o_lat_c: "+i.o_lat_c+" should be < 90\xB0");n=r+Math.atan2(-1*Math.cos(a),-1*Math.sin(a)*Math.sin(s)),e=Math.asin(Math.cos(s)*Math.sin(a))}else if(t===_o.NEW_POLE)n=i.oLongP,e=i.oLatP;else{let r=i.oLong1,s=i.oLat1,a=i.oLong2,o=i.oLat2,l=Math.abs(s);if(Math.abs(s)>w-D)throw new Error("Invalid value for o_lat_1: "+i.o_lat_1+" should be < 90\xB0");if(Math.abs(o)>w-D)throw new Error("Invalid value for o_lat_2: "+i.o_lat_2+" should be < 90\xB0");if(Math.abs(s-o)<D)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(l<D)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");n=Math.atan2(Math.cos(s)*Math.sin(o)*Math.cos(r)-Math.sin(s)*Math.cos(o)*Math.cos(a),Math.sin(s)*Math.cos(o)*Math.sin(a)-Math.cos(s)*Math.sin(o)*Math.sin(r)),e=Math.atan(-1*Math.cos(n-r)/Math.tan(s))}return{lamp:n,phip:e}}function YT(i,t){let{x:e,y:n}=t;e=I(e-i.long0,i.over);let r=Math.cos(e),s=Math.sin(n),a=Math.cos(n);t.x=I(Math.atan2(a*Math.sin(e),i.sphip*a*r+i.cphip*s)+i.lamp),t.y=Math.asin(i.sphip*s-i.cphip*a*r);let o=i.obliqueProjection.forward(t);return i.isIdentity&&(o.x*=Rt,o.y*=Rt),o}function jT(i,t){let{x:e,y:n}=t;e=I(e-i.long0,i.over);let r=Math.cos(n),s=Math.cos(e);t.x=I(Math.atan2(r*Math.sin(e),Math.sin(n))+i.lamp),t.y=Math.asin(-1*r*s);let a=i.obliqueProjection.forward(t);return i.isIdentity&&(a.x*=Rt,a.y*=Rt),a}function ZT(i,t){i.isIdentity&&(t.x*=ut,t.y*=ut);let e=i.obliqueProjection.inverse(t);if(!e)return null;let{x:n,y:r}=e;if(n<Number.MAX_VALUE){n-=i.lamp;let s=Math.cos(n),a=Math.sin(r),o=Math.cos(r);t.x=Math.atan2(o*Math.sin(n),i.sphip*o*s-i.cphip*a),t.y=Math.asin(i.sphip*a+i.cphip*o*s)}return t.x=I(t.x+i.long0),t}function JT(i,t){i.isIdentity&&(t.x*=ut,t.y*=ut);let e=i.obliqueProjection.inverse(t);if(!e)return null;let{x:n,y:r}=e;if(n<Number.MAX_VALUE){let s=Math.cos(r);n-=i.lamp,t.x=Math.atan2(s*Math.sin(n),-1*Math.sin(r)),t.y=Math.asin(s*Math.cos(n))}return t.x=I(t.x+i.long0),t}var $T=["General Oblique Transformation","General_Oblique_Transformation","ob_tran"],Hm={init:HT,forward:WT,inverse:XT,names:$T};function KT(){this.h=this.h||0;var i=this.h/this.a,t=Math.sin(this.lat0),e=1/Math.sqrt(1-this.es*t*t);this.A=1+i/e,this.rho0=(1-this.es)/Math.pow(1-this.es*t*t,1.5),this.B=Math.tan(this.lat0)/(2*this.rho0*e),this.C=1+i,this.D=this.rho0*(1+i/(1-this.es))}function QT(i){var t=I(i.x-this.long0,this.over),e=i.y,n=Math.sin(e),r=1/Math.sqrt(1-this.es*n*n),s=t*r*Math.cos(e),a=Math.sin(.5*(e+this.lat0)),o=(1-this.es)/Math.pow(1-this.es*a*a,1.5),l=1+this.h/(this.a*o);return i.x=this.a*this.A*s+this.x0,i.y=this.a*l*this.rho0*(e-this.lat0+this.B*s*s)+this.y0,i}function tA(i){var t=(i.x-this.x0)/this.a,e=(i.y-this.y0)/this.a,n=this.lat0+e/this.D-this.B*(t/this.C)*(t/this.C),r=Math.sin(n),s=1/Math.sqrt(1-this.es*r*r),a=t/(this.C*s*Math.cos(n));return i.x=I(a+this.long0,this.over),i.y=n,i}var eA=["Colombia Urban","IGAC_Plano_Cartesiano","col_urban"],Wm={init:KT,forward:QT,inverse:tA,names:eA};function Xm(i){i.Proj.projections.add(kp),i.Proj.projections.add(Yi),i.Proj.projections.add(ji),i.Proj.projections.add(Hp),i.Proj.projections.add(Wp),i.Proj.projections.add(Xp),i.Proj.projections.add(qp),i.Proj.projections.add(Yp),i.Proj.projections.add(jp),i.Proj.projections.add(am),i.Proj.projections.add(lm),i.Proj.projections.add(cm),i.Proj.projections.add(hm),i.Proj.projections.add(um),i.Proj.projections.add(dm),i.Proj.projections.add(pm),i.Proj.projections.add(mm),i.Proj.projections.add(ym),i.Proj.projections.add(vm),i.Proj.projections.add(xm),i.Proj.projections.add(Mm),i.Proj.projections.add(Sm),i.Proj.projections.add(bm),i.Proj.projections.add(Em),i.Proj.projections.add(wm),i.Proj.projections.add(Cm),i.Proj.projections.add(Im),i.Proj.projections.add(Nm),i.Proj.projections.add(Um),i.Proj.projections.add(Fm),i.Proj.projections.add(Bm),i.Proj.projections.add(Gm),i.Proj.projections.add(zm),i.Proj.projections.add(km),i.Proj.projections.add(Hm),i.Proj.projections.add(Wm)}var qm=Object.assign(wp,{defaultDatum:"WGS84",Proj:Oe,WGS84:new Oe("WGS84"),Point:Lp,toPoint:tr,defs:pi,nadgrid:nh,transform:rh,mgrs:Rp,version:"__VERSION__"});Xm(qm);var je=qm;var ds=class{_rootMap=new Map;get size(){if(this._rootMap.size===0)return 0;let t=0;return this._rootMap.forEach(e=>t+=e.size),t}forEach(t){this._rootMap.size!==0&&this._rootMap.forEach((e,n)=>{e.forEach((r,s)=>t(r,n,s,this))})}has(t,e){return this._rootMap.get(t)?.has(e)??!1}clear(){this._rootMap.clear()}getOrCreate(t,e,n){let r=this._rootMap.get(t);r==null&&(r=new Map,this._rootMap.set(t,r));let s=r.get(e);return s==null&&(s=n(t,e),r.set(e,s)),s}};var N5=new ds;var F5=new nt(0,0);function ps(i){return i[2]-i[0]}function yh(i,t,e){return Math.min(Math.max(i,t),e)}function Ym(i,t,e){let n=t.getExtent(),r=0;return t.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(e=e||ps(n),r=Math.floor((i[0]-n[0])/e)),r}var jm={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var vh=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||jm[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Zi=vh;var ms=6378137,ar=Math.PI*ms,nA=[-ar,-ar,ar,ar],rA=[-180,-85,180,85],yo=ms*Math.log(Math.tan(Math.PI/2)),Ji=class extends Zi{constructor(t){super({code:t,units:"m",extent:nA,global:!0,worldExtent:rA,getPointResolution:function(e,n){return e/Math.cosh(n[1]/ms)}})}},xh=[new Ji("EPSG:3857"),new Ji("EPSG:102100"),new Ji("EPSG:102113"),new Ji("EPSG:900913"),new Ji("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ji("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Zm(i,t,e,n){let r=i.length;e=e!==void 0&&e>1?e:2,n=n??e,t===void 0&&(e>2?t=i.slice():t=new Array(r));for(let s=0;s<r;s+=n){t[s]=ar*i[s]/180;let a=ms*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));a>yo?a=yo:a<-yo&&(a=-yo),t[s+1]=a}return t}function Jm(i,t,e,n){let r=i.length;e=e!==void 0&&e>1?e:2,n=n??e,t===void 0&&(e>2?t=i.slice():t=new Array(r));for(let s=0;s<r;s+=n)t[s]=180*i[s]/ar,t[s+1]=360*Math.atan(Math.exp(i[s+1]/ms))/Math.PI-90;return t}var sA=6378137,$m=[-180,-90,180,90],aA=Math.PI*sA/180,yi=class extends Zi{constructor(t,e){super({code:t,units:"degrees",extent:$m,axisOrientation:e,global:!0,metersPerUnit:aA,worldExtent:$m})}},Mh=[new yi("CRS:84"),new yi("EPSG:4326","neu"),new yi("urn:ogc:def:crs:OGC:1.3:CRS84"),new yi("urn:ogc:def:crs:OGC:2:84"),new yi("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new yi("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new yi("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var Sh={};function or(i){return Sh[i]||Sh[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Km(i,t){Sh[i]=t}var lr={};function pn(i,t,e){let n=i.getCode(),r=t.getCode();n in lr||(lr[n]={}),lr[n][r]=e}function bh(i,t){return i in lr&&t in lr[i]?lr[i][t]:null}var $i=.00669438,vo=$i*$i,xo=vo*$i,tG=$i/(1-$i),Qm=Math.sqrt(1-$i),cr=(1-Qm)/(1+Qm),t0=cr*cr,Eh=t0*cr,wh=Eh*cr,e0=wh*cr,eG=1-$i/4-3*vo/64-5*xo/256,iG=3*$i/8+3*vo/32+45*xo/1024,nG=15*vo/256+45*xo/1024,rG=35*xo/3072,sG=3/2*cr-27/32*Eh+269/512*e0,aG=21/16*t0-55/32*wh,oG=151/96*Eh-417/128*e0,lG=1097/512*wh;var oA=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function lA(i){let t=0;for(let r of oA){let s=i.match(r);if(s){t=parseInt(s[1]);break}}if(!t)return null;let e=0,n=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(n=!0,e=t-32600),e?{number:e,north:n}:null}function i0(i){return lA(i)?new Zi({code:i,units:"m"}):null}var cA=[i0];function s0(i,t){if(t!==void 0){for(let e=0,n=i.length;e<n;++e)t[e]=i[e];t=t}else t=i.slice();return t}function Th(i){Km(i.getCode(),i),pn(i,i,s0)}function hA(i){i.forEach(Th)}function n0(i){if(typeof i!="string")return i!==void 0?i:null;let t=or(i);if(t)return t;for(let e of cA){let n=e(i);if(n)return n}return null}function Mo(i){hA(i),i.forEach(function(t){i.forEach(function(e){t!==e&&pn(t,e,s0)})})}function uA(i,t,e,n){i.forEach(function(r){t.forEach(function(s){pn(r,s,e),pn(s,r,n)})})}function r0(i){return(function(t,e,n,r){let s=t.length;n=n!==void 0?n:2,r=r??n,e=e!==void 0?e:new Array(s);for(let a=0;a<s;a+=r){let o=i(t.slice(a,a+n)),l=o.length;for(let c=0,h=r;c<h;++c)e[a+c]=c>=l?t[a+c]:o[c]}return e})}function a0(i,t,e,n){let r=n0(i),s=n0(t);!r||!s||(pn(r,s,r0(e)),pn(s,r,r0(n)))}function Ah(i,t,e){return function(n){let r,s;if(i.canWrapX()){let a=i.getExtent(),o=ps(a);n=n.slice(0),s=Ym(n,i,o),s&&(n[0]=n[0]-s*o),n[0]=yh(n[0],a[0],a[2]),n[1]=yh(n[1],a[1],a[3]),r=e(n)}else r=e(n);return s&&t.canWrapX()&&(r[0]+=s*ps(t.getExtent())),r}}function fA(){Mo(xh),Mo(Mh),uA(Mh,xh,Zm,Jm)}fA();var dA=null;function So(i){dA=i;let t=Object.keys(i.defs),e=t.length,n,r;for(n=0;n<e;++n){let s=t[n];if(!or(s)){let a=i.defs(s),o=a.units;!o&&a.projName==="longlat"&&(o="degrees"),Th(new Zi({code:s,axisOrientation:a.axis,metersPerUnit:a.to_meter,units:o}))}}for(n=0;n<e;++n){let s=t[n],a=or(s);for(r=0;r<e;++r){let o=t[r],l=or(o);if(!(!a||!l)&&!bh(s,o))if(i.defs(s)===i.defs(o))Mo([a,l]);else{let c=i(s,o);a0(a,l,Ah(a,l,c.forward),Ah(l,a,c.inverse))}}}}var Ch=class{static getId(t){let e=t.find(n=>Array.isArray(n)&&n[0]==="ID");return e&&e.length>=3?{authority:e[1],code:parseInt(e[2],10)}:null}static convertUnit(t,e="unit"){if(!t||t.length<3)return{type:e,name:"unknown",conversion_factor:null};let n=t[1],r=parseFloat(t[2])||null,s=t.find(o=>Array.isArray(o)&&o[0]==="ID"),a=s?{authority:s[1],code:parseInt(s[2],10)}:null;return{type:e,name:n,conversion_factor:r,id:a}}static convertAxis(t){let e=t[1]||"Unknown",n,r=e.match(/^\((.)\)$/);if(r){let c=r[1].toUpperCase();if(c==="E")n="east";else if(c==="N")n="north";else if(c==="U")n="up";else if(t[2])n=t[2];else throw new Error(`Unknown axis abbreviation: ${c}`)}else n=t[2]||"unknown";let s=t.find(c=>Array.isArray(c)&&c[0]==="ORDER"),a=s?parseInt(s[1],10):null,o=t.find(c=>Array.isArray(c)&&(c[0]==="LENGTHUNIT"||c[0]==="ANGLEUNIT"||c[0]==="SCALEUNIT")),l=this.convertUnit(o);return{name:e,direction:n,unit:l,order:a}}static extractAxes(t){return t.filter(e=>Array.isArray(e)&&e[0]==="AXIS").map(e=>this.convertAxis(e)).sort((e,n)=>(e.order||0)-(n.order||0))}static convert(t,e={}){switch(t[0]){case"PROJCRS":e.type="ProjectedCRS",e.name=t[1],e.base_crs=t.find(d=>Array.isArray(d)&&d[0]==="BASEGEOGCRS")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="BASEGEOGCRS")):null,e.conversion=t.find(d=>Array.isArray(d)&&d[0]==="CONVERSION")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="CONVERSION")):null;let n=t.find(d=>Array.isArray(d)&&d[0]==="CS");n&&(e.coordinate_system={type:n[1],axis:this.extractAxes(t)});let r=t.find(d=>Array.isArray(d)&&d[0]==="LENGTHUNIT");if(r){let d=this.convertUnit(r);e.coordinate_system.unit=d}e.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":case"GEODCRS":e.type=t[0]==="GEODCRS"?"GeodeticCRS":"GeographicCRS",e.name=t[1];let s=t.find(d=>Array.isArray(d)&&(d[0]==="DATUM"||d[0]==="ENSEMBLE"));if(s){let d=this.convert(s);s[0]==="ENSEMBLE"?e.datum_ensemble=d:e.datum=d;let _=t.find(g=>Array.isArray(g)&&g[0]==="PRIMEM");_&&_[1]!=="Greenwich"&&(d.prime_meridian={name:_[1],longitude:parseFloat(_[2])})}e.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(t)},e.id=this.getId(t);break;case"DATUM":e.type="GeodeticReferenceFrame",e.name=t[1],e.ellipsoid=t.find(d=>Array.isArray(d)&&d[0]==="ELLIPSOID")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="ELLIPSOID")):null;break;case"ENSEMBLE":e.type="DatumEnsemble",e.name=t[1],e.members=t.filter(d=>Array.isArray(d)&&d[0]==="MEMBER").map(d=>({type:"DatumEnsembleMember",name:d[1],id:this.getId(d)}));let a=t.find(d=>Array.isArray(d)&&d[0]==="ENSEMBLEACCURACY");a&&(e.accuracy=parseFloat(a[1]));let o=t.find(d=>Array.isArray(d)&&d[0]==="ELLIPSOID");o&&(e.ellipsoid=this.convert(o)),e.id=this.getId(t);break;case"ELLIPSOID":e.type="Ellipsoid",e.name=t[1],e.semi_major_axis=parseFloat(t[2]),e.inverse_flattening=parseFloat(t[3]);let l=t.find(d=>Array.isArray(d)&&d[0]==="LENGTHUNIT")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="LENGTHUNIT"),e):null;break;case"CONVERSION":e.type="Conversion",e.name=t[1],e.method=t.find(d=>Array.isArray(d)&&d[0]==="METHOD")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="METHOD")):null,e.parameters=t.filter(d=>Array.isArray(d)&&d[0]==="PARAMETER").map(d=>this.convert(d));break;case"METHOD":e.type="Method",e.name=t[1],e.id=this.getId(t);break;case"PARAMETER":e.type="Parameter",e.name=t[1],e.value=parseFloat(t[2]),e.unit=this.convertUnit(t.find(d=>Array.isArray(d)&&(d[0]==="LENGTHUNIT"||d[0]==="ANGLEUNIT"||d[0]==="SCALEUNIT"))),e.id=this.getId(t);break;case"BOUNDCRS":e.type="BoundCRS";let c=t.find(d=>Array.isArray(d)&&d[0]==="SOURCECRS");if(c){let d=c.find(_=>Array.isArray(_));e.source_crs=d?this.convert(d):null}let h=t.find(d=>Array.isArray(d)&&d[0]==="TARGETCRS");if(h){let d=h.find(_=>Array.isArray(_));e.target_crs=d?this.convert(d):null}let u=t.find(d=>Array.isArray(d)&&d[0]==="ABRIDGEDTRANSFORMATION");u?e.transformation=this.convert(u):e.transformation=null;break;case"ABRIDGEDTRANSFORMATION":if(e.type="Transformation",e.name=t[1],e.method=t.find(d=>Array.isArray(d)&&d[0]==="METHOD")?this.convert(t.find(d=>Array.isArray(d)&&d[0]==="METHOD")):null,e.parameters=t.filter(d=>Array.isArray(d)&&(d[0]==="PARAMETER"||d[0]==="PARAMETERFILE")).map(d=>{if(d[0]==="PARAMETER")return this.convert(d);if(d[0]==="PARAMETERFILE")return{name:d[1],value:d[2],id:{authority:"EPSG",code:8656}}}),e.parameters.length===7){let d=e.parameters[6];d.name==="Scale difference"&&(d.value=Math.round((d.value-1)*1e12)/1e6)}e.id=this.getId(t);break;case"AXIS":e.coordinate_system||(e.coordinate_system={type:"unspecified",axis:[]}),e.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":let p=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(d=>{d.unit||(d.unit=p)}),p.conversion_factor&&p.conversion_factor!==1&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:p});break;default:e.keyword=t[0];break}return e}},bo=Ch;var Ph=class extends bo{static convert(t,e={}){return super.convert(t,e),e.coordinate_system&&e.coordinate_system.subtype==="Cartesian"&&delete e.coordinate_system,e.usage&&delete e.usage,e}},o0=Ph;var Rh=class extends bo{static convert(t,e={}){super.convert(t,e);let n=t.find(s=>Array.isArray(s)&&s[0]==="CS");n&&(e.coordinate_system={subtype:n[1],axis:this.extractAxes(t)});let r=t.find(s=>Array.isArray(s)&&s[0]==="USAGE");if(r){let s=r.find(l=>Array.isArray(l)&&l[0]==="SCOPE"),a=r.find(l=>Array.isArray(l)&&l[0]==="AREA"),o=r.find(l=>Array.isArray(l)&&l[0]==="BBOX");e.usage={},s&&(e.usage.scope=s[1]),a&&(e.usage.area=a[1]),o&&(e.usage.bbox=o.slice(1))}return e}},l0=Rh;function pA(i){return i.find(t=>Array.isArray(t)&&t[0]==="USAGE")?"2019":(i.find(t=>Array.isArray(t)&&t[0]==="CS")||i[0]==="BOUNDCRS"||i[0]==="PROJCRS"||i[0]==="GEOGCRS","2015")}function c0(i){return(pA(i)==="2019"?l0:o0).convert(i)}function h0(i){let t=i.toUpperCase();return t.includes("PROJCRS")||t.includes("GEOGCRS")||t.includes("BOUNDCRS")||t.includes("VERTCRS")||t.includes("LENGTHUNIT")||t.includes("ANGLEUNIT")||t.includes("SCALEUNIT")?"WKT2":(t.includes("PROJCS")||t.includes("GEOGCS")||t.includes("LOCAL_CS")||t.includes("VERT_CS")||t.includes("UNIT"),"WKT1")}var u0=yA,gs=1,f0=2,d0=3,Eo=4,p0=5,Ih=-1,mA=/\s/,gA=/[A-Za-z]/,_A=/[A-Za-z84_]/,wo=/[,\]]/,m0=/[\d\.E\-\+]/;function vi(i){if(typeof i!="string")throw new Error("not a string");this.text=i.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=gs}vi.prototype.readCharicter=function(){var i=this.text[this.place++];if(this.state!==Eo)for(;mA.test(i);){if(this.place>=this.text.length)return;i=this.text[this.place++]}switch(this.state){case gs:return this.neutral(i);case f0:return this.keyword(i);case Eo:return this.quoted(i);case p0:return this.afterquote(i);case d0:return this.number(i);case Ih:return}};vi.prototype.afterquote=function(i){if(i==='"'){this.word+='"',this.state=Eo;return}if(wo.test(i)){this.word=this.word.trim(),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in afterquote yet, index '+this.place)};vi.prototype.afterItem=function(i){if(i===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=gs;return}if(i==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=gs,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Ih);return}};vi.prototype.number=function(i){if(m0.test(i)){this.word+=i;return}if(wo.test(i)){this.word=parseFloat(this.word),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in number yet, index '+this.place)};vi.prototype.quoted=function(i){if(i==='"'){this.state=p0;return}this.word+=i};vi.prototype.keyword=function(i){if(_A.test(i)){this.word+=i;return}if(i==="["){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=gs;return}if(wo.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in keyword yet, index '+this.place)};vi.prototype.neutral=function(i){if(gA.test(i)){this.word=i,this.state=f0;return}if(i==='"'){this.word="",this.state=Eo;return}if(m0.test(i)){this.word=i,this.state=d0;return}if(wo.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in neutral yet, index '+this.place)};vi.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Ih)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function yA(i){var t=new vi(i);return t.output()}function Nh(i,t,e){Array.isArray(t)&&(e.unshift(t),t=null);var n=t?{}:i,r=e.reduce(function(s,a){return mn(a,s),s},n);t&&(i[t]=r)}function mn(i,t){if(!Array.isArray(i)){t[i]=!0;return}var e=i.shift();if(e==="PARAMETER"&&(e=i.shift()),i.length===1){if(Array.isArray(i[0])){t[e]={},mn(i[0],t[e]);return}t[e]=i[0];return}if(!i.length){t[e]=!0;return}if(e==="TOWGS84"){t[e]=i;return}if(e==="AXIS"){e in t||(t[e]=[]),t[e].push(i);return}Array.isArray(e)||(t[e]={});var n;switch(e){case"UNIT":case"PRIMEM":case"VERT_DATUM":t[e]={name:i[0].toLowerCase(),convert:i[1]},i.length===3&&mn(i[2],t[e]);return;case"SPHEROID":case"ELLIPSOID":t[e]={name:i[0],a:i[1],rf:i[2]},i.length===4&&mn(i[3],t[e]);return;case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":i[0]=["name",i[0]],Nh(t,e,i);return;case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":i[0]=["name",i[0]],Nh(t,e,i),t[e].type=e;return;default:for(n=-1;++n<i.length;)if(!Array.isArray(i[n]))return mn(i,t[e]);return Nh(t,e,i)}}var vA=.017453292519943295;function me(i){return i*vA}function To(i){let t=(i.projName||"").toLowerCase().replace(/_/g," ");i.long0===void 0&&i.longc!==void 0&&(i.long0=i.longc),!i.lat_ts&&i.lat1&&(t==="stereographic south pole"||t==="polar stereographic (variant b)")?(i.lat0=me(i.lat1>0?90:-90),i.lat_ts=i.lat1,delete i.lat1):!i.lat_ts&&i.lat0&&(t==="polar stereographic"||t==="polar stereographic (variant a)")&&(i.lat_ts=i.lat0,i.lat0=me(i.lat0>0?90:-90),delete i.lat1)}function g0(i){let t={units:null,to_meter:void 0};return typeof i=="string"?(t.units=i.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.units==="meter"&&(t.to_meter=1)):i&&i.name&&(t.units=i.name.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.to_meter=i.conversion_factor),t}function _0(i){return typeof i=="object"?i.value*i.unit.conversion_factor:i}function y0(i,t){i.ellipsoid.radius?(t.a=i.ellipsoid.radius,t.rf=0):(t.a=_0(i.ellipsoid.semi_major_axis),i.ellipsoid.inverse_flattening!==void 0?t.rf=i.ellipsoid.inverse_flattening:i.ellipsoid.semi_major_axis!==void 0&&i.ellipsoid.semi_minor_axis!==void 0&&(t.rf=t.a/(t.a-_0(i.ellipsoid.semi_minor_axis))))}function _s(i,t={}){return!i||typeof i!="object"?i:i.type==="BoundCRS"?(_s(i.source_crs,t),i.transformation&&(i.transformation.method&&i.transformation.method.name==="NTv2"?t.nadgrids=i.transformation.parameters[0].value:t.datum_params=i.transformation.parameters.map(e=>e.value)),t):(Object.keys(i).forEach(e=>{let n=i[e];if(n!==null)switch(e){case"name":if(t.srsCode)break;t.name=n,t.srsCode=n;break;case"type":n==="GeographicCRS"?t.projName="longlat":n==="GeodeticCRS"?i.coordinate_system&&i.coordinate_system.subtype==="Cartesian"?t.projName="geocent":t.projName="longlat":n==="ProjectedCRS"&&i.conversion&&i.conversion.method&&(t.projName=i.conversion.method.name);break;case"datum":case"datum_ensemble":n.ellipsoid&&(t.ellps=n.ellipsoid.name,y0(n,t)),n.prime_meridian&&(t.from_greenwich=n.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":t.ellps=n.name,y0(n,t);break;case"prime_meridian":t.long0=(n.longitude||0)*Math.PI/180;break;case"coordinate_system":if(n.axis){let r={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},s=n.axis.map(a=>r[a.direction.toLowerCase()]);if(s.every(Boolean)&&(t.axis=s.join(""),t.axis.length===2&&(t.axis+="u")),n.unit){let{units:a,to_meter:o}=g0(n.unit);t.units=a,t.to_meter=o}else if(n.axis[0]&&n.axis[0].unit){let{units:a,to_meter:o}=g0(n.axis[0].unit);t.units=a,t.to_meter=o}}break;case"id":n.authority&&n.code&&(t.title=n.authority+":"+n.code);break;case"conversion":n.method&&n.method.name&&(t.projName=n.method.name),n.parameters&&n.parameters.forEach(r=>{let s=r.name.toLowerCase().replace(/\s+/g,"_"),a=r.value;r.unit&&r.unit.conversion_factor?t[s]=a*r.unit.conversion_factor:r.unit==="degree"?t[s]=a*Math.PI/180:t[s]=a});break;case"unit":n.name&&(t.units=n.name.toLowerCase(),t.units==="metre"&&(t.units="meter")),n.conversion_factor&&(t.to_meter=n.conversion_factor);break;case"base_crs":_s(n,t),t.datumCode=n.id?n.id.authority+"_"+n.id.code:n.name;break;default:break}}),t.latitude_of_false_origin!==void 0&&(t.lat0=t.latitude_of_false_origin),t.longitude_of_false_origin!==void 0&&(t.long0=t.longitude_of_false_origin),t.latitude_of_standard_parallel!==void 0&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),t.latitude_of_1st_standard_parallel!==void 0&&(t.lat1=t.latitude_of_1st_standard_parallel),t.latitude_of_2nd_standard_parallel!==void 0&&(t.lat2=t.latitude_of_2nd_standard_parallel),t.latitude_of_projection_centre!==void 0&&(t.lat0=t.latitude_of_projection_centre),t.longitude_of_projection_centre!==void 0&&(t.longc=t.longitude_of_projection_centre),t.easting_at_false_origin!==void 0&&(t.x0=t.easting_at_false_origin),t.northing_at_false_origin!==void 0&&(t.y0=t.northing_at_false_origin),t.latitude_of_natural_origin!==void 0&&(t.lat0=t.latitude_of_natural_origin),t.longitude_of_natural_origin!==void 0&&(t.long0=t.longitude_of_natural_origin),t.longitude_of_origin!==void 0&&(t.long0=t.longitude_of_origin),t.false_easting!==void 0&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),t.false_northing!==void 0&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),t.standard_parallel_1!==void 0&&(t.lat1=t.standard_parallel_1),t.standard_parallel_2!==void 0&&(t.lat2=t.standard_parallel_2),t.scale_factor_at_natural_origin!==void 0&&(t.k0=t.scale_factor_at_natural_origin),t.scale_factor_at_projection_centre!==void 0&&(t.k0=t.scale_factor_at_projection_centre),t.scale_factor_on_pseudo_standard_parallel!==void 0&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),t.azimuth!==void 0&&(t.alpha=t.azimuth),t.azimuth_at_projection_centre!==void 0&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),To(t),t)}var xA=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function MA(i,t){var e=t[0],n=t[1];!(e in i)&&n in i&&(i[e]=i[n],t.length===3&&(i[e]=t[2](i[e])))}function v0(i){for(var t=Object.keys(i),e=0,n=t.length;e<n;++e){var r=t[e];xA.indexOf(r)!==-1&&SA(i[r]),typeof i[r]=="object"&&v0(i[r])}}function SA(i){if(i.AUTHORITY){var t=Object.keys(i.AUTHORITY)[0];t&&t in i.AUTHORITY&&(i.title=t+":"+i.AUTHORITY[t])}if(i.type==="GEOGCS"?i.projName="longlat":i.type==="LOCAL_CS"?(i.projName="identity",i.local=!0):typeof i.PROJECTION=="object"?i.projName=Object.keys(i.PROJECTION)[0]:i.projName=i.PROJECTION,i.AXIS){for(var e="",n=0,r=i.AXIS.length;n<r;++n){var s=[i.AXIS[n][0].toLowerCase(),i.AXIS[n][1].toLowerCase()];s[0].indexOf("north")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="north"?e+="n":s[0].indexOf("south")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="south"?e+="s":s[0].indexOf("east")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="east"?e+="e":(s[0].indexOf("west")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="west")&&(e+="w")}e.length===2&&(e+="u"),e.length===3&&(i.axis=e)}i.UNIT&&(i.units=i.UNIT.name.toLowerCase(),i.units==="metre"&&(i.units="meter"),i.UNIT.convert&&(i.type==="GEOGCS"?i.DATUM&&i.DATUM.SPHEROID&&(i.to_meter=i.UNIT.convert*i.DATUM.SPHEROID.a):i.to_meter=i.UNIT.convert));var a=i.GEOGCS;i.type==="GEOGCS"&&(a=i),a&&(a.PRIMEM&&a.PRIMEM.convert&&(i.from_greenwich=me(a.PRIMEM.convert)),a.DATUM?i.datumCode=a.DATUM.name.toLowerCase():i.datumCode=a.name.toLowerCase(),i.datumCode.slice(0,2)==="d_"&&(i.datumCode=i.datumCode.slice(2)),i.datumCode==="new_zealand_1949"&&(i.datumCode="nzgd49"),(i.datumCode==="wgs_1984"||i.datumCode==="world_geodetic_system_1984")&&(i.PROJECTION==="Mercator_Auxiliary_Sphere"&&(i.sphere=!0),i.datumCode="wgs84"),i.datumCode==="belge_1972"&&(i.datumCode="rnb72"),a.DATUM&&a.DATUM.SPHEROID&&(i.ellps=a.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),i.ellps.toLowerCase().slice(0,13)==="international"&&(i.ellps="intl"),i.a=a.DATUM.SPHEROID.a,i.rf=parseFloat(a.DATUM.SPHEROID.rf)),a.DATUM&&a.DATUM.TOWGS84&&(i.datum_params=a.DATUM.TOWGS84),~i.datumCode.indexOf("osgb_1936")&&(i.datumCode="osgb36"),~i.datumCode.indexOf("osni_1952")&&(i.datumCode="osni52"),(~i.datumCode.indexOf("tm65")||~i.datumCode.indexOf("geodetic_datum_of_1965"))&&(i.datumCode="ire65"),i.datumCode==="ch1903+"&&(i.datumCode="ch1903"),~i.datumCode.indexOf("israel")&&(i.datumCode="isr93")),i.b&&!isFinite(i.b)&&(i.b=i.a),i.rectified_grid_angle&&(i.rectified_grid_angle=me(i.rectified_grid_angle));function o(h){var u=i.to_meter||1;return h*u}var l=function(h){return MA(i,h)},c=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",me],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",me],["x0","false_easting",o],["y0","false_northing",o],["long0","central_meridian",me],["lat0","latitude_of_origin",me],["lat0","standard_parallel_1",me],["lat1","standard_parallel_1",me],["lat2","standard_parallel_2",me],["azimuth","Azimuth"],["alpha","azimuth",me],["srsCode","name"]];c.forEach(l),To(i)}function x0(i){if(typeof i=="object")return _s(i);let t=h0(i);var e=u0(i);if(t==="WKT2"){let s=c0(e);return _s(s)}var n=e[0],r={};return mn(e,r),v0(r),r[n]}var Lh=class i{constructor(t,e){this._authority=t,this._code=e}static parse(t){let e=t.trim().split(":");if(e.length===2){let n=Number.parseInt(e[1]);return new i(e[0],n)}throw new Error("could not parse SRID")}get authority(){return this._authority}get code(){return this._code}toString(){return`${this._authority}:${this._code}`}isEpsg(t){return this._authority==="EPSG"&&this._code===t}tryGetEpsgCode(){return this._authority!=="EPSG"?null:this._code}},gn=Lh;function M0(i){switch(i.name.toLowerCase()){case"deg":case"degree":case"degrees":return"\xB0";case"rad":case"radian":case"radians":return"rad";case"m":case"meter":case"metre":case"meters":case"metres":return"m";case"ft":case"foot":case"feet":case"us-ft":case"us survey feet":case"us survey foot":return"ft";default:return""}}var Qt=class i{type="linear";constructor(t,e){this.name=t,this.metersPerUnit=e}getSymbol(){return M0(this)}static meters=new i("meters",1);static feet=new i("feet",.3048);static usSurveyFeet=new i("US Survey feet",.304800609601219);equals(t){return t.metersPerUnit===this.metersPerUnit}static isLinearUnit(t){return t?t.type==="linear":!1}},xi=class i{type="angular";constructor(t,e){this.name=t,this.degreesPerUnit=e}getSymbol(){return M0(this)}static degrees=new i("degrees",1);static radians=new i("radians",57.29578);equals(t){return t.degreesPerUnit===this.degreesPerUnit}static isAngularUnit(t){return t?t.type==="angular":!1}};function S0(i){switch(i.trim().toLowerCase()){case"deg":case"degree":case"degrees":return xi.degrees;case"rad":case"radian":case"radians":return xi.radians;case"m":case"meter":case"meters":case"metre":case"metres":return Qt.meters;case"ft":case"feet":case"foot":return Qt.feet;case"us-ft":case"us survey feet":case"us survey foot":case"foot (us survey)":return Qt.usSurveyFeet;default:return}}function w0(i){return new Qt(i.name,i.convert)}function Dh(i){let[t,e]=Object.entries(i)[0];return new gn(t,Number.parseInt(e))}function Oh(i){return"name"in i&&typeof i.name=="string"?i.name:"<unknown>"}function b0(i){let t=Oh(i),e=w0(i.UNIT);if(i.AUTHORITY){let n=Dh(i.AUTHORITY);return{name:t,srid:n,unit:e}}return{name:t,unit:e}}var E0=class i{static epsg3857=new i({name:"WGS 84 / Pseudo-Mercator",srid:new gn("EPSG",3857),horizontal:{unit:Qt.meters},vertical:{unit:Qt.meters}});static epsg4326=new i({name:"WGS 84",srid:new gn("EPSG",4326),horizontal:{unit:xi.degrees},vertical:{unit:Qt.meters}});static epsg4978=new i({name:"WGS 84",srid:new gn("EPSG",4978),horizontal:{unit:Qt.meters},vertical:{unit:Qt.meters}});static epsg4979=new i({name:"WGS 84",srid:new gn("EPSG",4979),horizontal:{unit:xi.degrees},vertical:{unit:Qt.meters}});static equirectangular=new i({name:"equirectangular",horizontal:{unit:xi.degrees}});static unknown=new i({name:"unknown"});static _registry=new Map([["EPSG:3857",i.epsg3857],["EPSG:4326",i.epsg4326],["EPSG:4978",i.epsg4978],["EPSG:4979",i.epsg4979],["equirectangular",i.equirectangular],["unknown",i.unknown]]);static register(t,e,n){if(this._registry.has(t))return this._registry.get(t);try{this.registerCRSWithProjAndOpenLayers(t,e)}catch(s){if(n?.throwIfFailedToRegisterWithProj===!0)throw s;console.warn(s)}let r=i.fromWkt(e,{id:t});return this._registry.set(t,r),r}static clearRegistry(){this._registry.clear(),this._registry.set("EPSG:3857",i.epsg3857),this._registry.set("EPSG:4326",i.epsg4326),this._registry.set("EPSG:4978",i.epsg4978),this._registry.set("EPSG:4979",i.epsg4979),this._registry.set("equirectangular",i.equirectangular),this._registry.set("unknown",i.unknown)}static registerCRSWithProjAndOpenLayers(t,e){if(!t||t==="")throw new Error("missing CRS name");if(!e||e==="")throw new Error("missing CRS PROJ string");try{je.defs(t,e)}catch(n){let r="";throw n instanceof Error&&(r=": "+n.message),new Error(`failed to register PROJ definition for ${t}${r}`)}try{So(je)}catch(n){let r="";throw n instanceof Error&&(r=": "+n.message),new Error(`failed to register PROJ definitions in OpenLayers${r}`)}}static get(t){let e=this._registry.get(t);if(e)return e;throw new Error(`coordinate system not found: ${t}`)}static fromWkt(t,e){try{let n;try{n=x0(t)}catch{n=Qa(t)}if("ID"in n)return new i({id:e?.id,name:Oh(n),srid:Dh(n.ID),definition:t});if("PROJCS"in n){let r=b0(n.PROJCS),s={id:e?.id,name:r.name,srid:r.srid,definition:t,horizontal:{unit:r.unit}};return"VERT_CS"in n&&(s.vertical={unit:w0(n.VERT_CS.UNIT)}),new i(s)}else if("type"in n&&n.type==="PROJCS"){let r=b0(n);return new i({id:e?.id,name:r.name,srid:r.srid,definition:t,horizontal:{unit:r.unit}})}else{let r,s;return"AUTHORITY"in n&&typeof n.AUTHORITY=="object"&&n.AUTHORITY&&(r=Dh(n.AUTHORITY)),"title"in n&&typeof n.title=="string"&&(r=gn.parse(n.title)),"units"in n&&typeof n.units=="string"&&(s=S0(n.units)),new i({id:e?.id,name:Oh(n),srid:r,horizontal:s!=null?{unit:s}:void 0})}}catch(n){throw console.error(`Failed to parse wkt "${t}".`),n}}get id(){return typeof this._customId<"u"?this._customId:typeof this.srid<"u"?this.srid.toString():this.name}constructor(t){this.name=t.name,this.srid=t.srid,this._customId=t.id,typeof t.horizontal<"u"&&(this.horizontal=t.horizontal),typeof t.vertical<"u"&&(this.vertical=t.vertical),typeof t.definition<"u"&&(this.definition=t.definition)}isGeographic(){let t=this.horizontal?.unit;return!!xi.isAngularUnit(t)}get metersPerHorizontalUnit(){let t=this.horizontal?.unit;return Qt.isLinearUnit(t)?t.metersPerUnit:1}get metersPerVerticalUnit(){let t=this.vertical?.unit;return Qt.isLinearUnit(t)?t.metersPerUnit:this.metersPerHorizontalUnit}isEpsg(t){return typeof this.srid<"u"?this.srid.isEpsg(t):!1}isEquirectangular(){return this.name==="equirectangular"}isUnknown(){return this.name==="unknown"&&typeof this.definition>"u"}equals(t){return this.id===t.id}};je.defs("EPSG:4978","+proj=geocent +datum=WGS84 +units=m +no_defs +type=crs");je.defs("EPSG:4979","+proj=longlat +datum=WGS84 +no_defs +type=crs");je.defs("equirectangular","+proj=longlat +datum=WGS84 +no_defs +type=crs");So(je);var v6=new nt;var x6=[new nt,new nt,new nt,new nt,new nt,new nt,new nt,new nt];var TA=1024,AA=1024*TA,P6=1024*AA;var Tt=class i{constructor(t,e=!0){this.color=new it(t),this.visible=e}clone(){return new i(this.color.clone(),this.visible)}},St=new Array(256),Uh=new Tt(16744704);for(let i=0;i<St.length;i++)St[i]=Uh.clone();St[0]=new Tt("#858585");St[1]=new Tt("#bfbfbf");St[2]=new Tt("#834000");St[3]=new Tt("#008100");St[4]=new Tt("#00bf00");St[5]=new Tt("#00ff00");St[6]=new Tt("#0081c1");St[7]=new Tt("#ff0000");St[8]=Uh.clone();St[9]=new Tt("#0000ff");St[10]=new Tt("#606d73");St[11]=new Tt("#858585");St[12]=Uh.clone();St[13]=new Tt("#ede440");St[14]=new Tt("#ed6840");St[15]=new Tt("#29fff8");St[16]=new Tt("#5e441d");St[17]=new Tt("#7992c7");St[18]=new Tt("#cd27d6");var n8=new nt;var c8=new it(0,0,0);var g8=new it(0,0,0),_8=new zr;var D8=new it,O8=new it;var pz=new nt(256,256),mz=new R,gz=new kc({colors:[new it("black"),new it("white")],min:0,max:1e3}),_z=new Pt,yz=new it("#d8eb34"),vz={empty:new it("grey"),hidden:new it("#fc4903"),loading:new it("#f5da8c"),displayed:new it("#8cf59b")};var Ao=class extends Error{constructor(t){super(`attribute '${t}' is not supported in this source`)}};function A0(i,t,e,n){let r=i.pointCount,[s,a,o]=["Red","Green","Blue"].map(i.getter),l=new Zr(e?new Uint8Array(r*3):new Uint16Array(r*3));l.length=0;let c=e?1/65536*256:1;for(let h=0;h<r;h+=t)if(Za(n,h)){let u=s(h)*c,p=a(h)*c,d=o(h)*c;l.push(u,p,d)}return l.array.buffer}function C0(i,t,e,n){let r=i.pointCount,[s,a,o]=["X","Y","Z"].map(i.getter),l=Math.floor(r/e)+r%e,c=new Zr(new Float32Array(l*3));c.length=0;let h=1/0,u=1/0,p=1/0,d=-1/0,_=-1/0,g=-1/0;for(let v=0;v<r;v+=e)if(Za(n,v)){let x=s(v)-t.x,b=a(v)-t.y,A=o(v)-t.z;h=Math.min(x,h),u=Math.min(b,u),p=Math.min(A,p),d=Math.max(x,d),_=Math.max(b,_),g=Math.max(A,g),c.push(x,b,A)}return c.trim(),{buffer:c.array.buffer,localBoundingBox:new Ne(new R(h,u,p),new R(d,_,g))}}function FA(i,t,e,n,r){for(let s=0;s<t;s+=e)Za(r,s)&&n.push(i(s))}function P0(i,t,e,n){let r=t.name,s;switch(t.type){case"float":s=_n(Float32Array);break;case"signed":switch(t.size){case 1:s=_n(Int8Array);break;case 2:s=_n(Int16Array);break;case 4:s=_n(Int32Array);break;default:throw new Error("invalid attribute size for signed values: "+t.size)}break;case"unsigned":switch(t.size){case 1:s=_n(Uint8Array);break;case 2:s=_n(Uint16Array);break;case 4:s=_n(Uint32Array);break;default:throw new Error("invalid attribute size for unsigned values: "+t.size)}break;default:throw new Ao(r)}return s(r,i,e,n)}function _n(i){return(t,e,n,r)=>{let s=e.pointCount,a=new wd(s,o=>new i(o));return FA(e.getter(t),s,n,a,r),a.getArray().buffer}}async function R0(i,t){let e=await Fc();return Co.Las.PointData.decompressChunk(new Uint8Array(i),t,e)}async function BA(i){let t=await Fc();return Co.Las.PointData.decompressFile(new Uint8Array(i),t)}function GA(i){R0(i.payload.buffer,i.payload.metadata).then(t=>{let e={requestId:i.id,payload:t.buffer};postMessage(e,{transfer:[t.buffer]})}).catch(t=>{postMessage(Zn(i.id,t))})}function zA(i){BA(i.payload.buffer).then(t=>{let e={requestId:i.id,payload:t.buffer};postMessage(e,{transfer:[t.buffer]})}).catch(t=>{console.error(t),postMessage(Zn(i.id,t))})}function kA(i,t,e,n){let r=Co.Las.View.create(i,t,e,n);if(e){let s={};for(let[a,o]of Object.entries(r.dimensions)){let l=o,c=e.find(h=>h.name===a);c&&(c.type==="signed"||c.type==="unsigned")&&(typeof c.scale=="number"&&c.scale!==1||typeof c.offset=="number"&&c.offset!==0)&&(l={type:"float",size:4}),s[a]=l}r.dimensions=s}return r}function VA(i){let{view:t,filters:e,origin:n,attributes:r,compressColors:s}=i,a=i.stride??1,o=Ed(e??[],t),l;if(i.position){let h=C0(t,n,a,o),u=[h.localBoundingBox.min.x,h.localBoundingBox.min.y,h.localBoundingBox.min.z,h.localBoundingBox.max.x,h.localBoundingBox.max.y,h.localBoundingBox.max.z];l={buffer:h.buffer,localBoundingBox:u}}let c=r.map(h=>{switch(h.interpretation){case"color":return A0(t,a,s,o);case"classification":case"unknown":return P0(t,h,a,o)}});return{position:l,attributes:c}}function HA(i){let{buffer:t,metadata:e,header:n,eb:r,include:s}=i.payload;R0(t,e).then(a=>{let o=kA(a,n,r,s),l=VA({...i.payload,view:o}),c={requestId:i.id,payload:l},h=[...l.attributes];l.position&&h.push(l.position.buffer),postMessage(c,{transfer:h})}).catch(a=>{console.error(a),postMessage(Zn(i.id,a))})}onmessage=i=>{let t=i.data;switch(t.type){case"DecodeLazChunk":GA(t);break;case"DecodeLazFile":zA(t);break;case"ReadView":HA(t);break;case"SetWasmBinary":bd(t.buffer);break}};export{kA as createLasView,VA as readView};
3849
3849
  /*! Bundled license information:
3850
3850
 
3851
3851
  three/build/three.core.js: