@luma.gl/gltf 9.3.5 → 9.4.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.min.js CHANGED
@@ -4,7 +4,7 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['luma'] = factory();
6
6
  else root['luma'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var bn=Object.create;var Me=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var On=Object.getOwnPropertyNames;var Ln=Object.getPrototypeOf,In=Object.prototype.hasOwnProperty;var We=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Nt=(t,e)=>{for(var r in e)Me(t,r,{get:e[r],enumerable:!0})},ge=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of On(e))!In.call(t,s)&&s!==r&&Me(t,s,{get:()=>e[s],enumerable:!(n=Nn(e,s))||n.enumerable});return t},Te=(t,e,r)=>(ge(t,e,"default"),r&&ge(r,e,"default")),k=(t,e,r)=>(r=t!=null?bn(Ln(t)):{},ge(e||!t||!t.__esModule?Me(r,"default",{value:t,enumerable:!0}):r,t)),vn=t=>ge(Me({},"__esModule",{value:!0}),t);var G=We((li,Ot)=>{Ot.exports=globalThis.luma});var oe=We((fi,Lt)=>{Lt.exports=globalThis.luma});var $e=We((kc,cn)=>{cn.exports=globalThis.luma});var xe={};Nt(xe,{GLTFAnimator:()=>re,createScenegraphsFromGLTF:()=>wn,getGLTFExtensionSupport:()=>qe,loadPBREnvironment:()=>Yt,parseGLTFLights:()=>Ve,parsePBRMaterial:()=>he});Te(xe,k(G(),1));var st=k(oe(),1);async function Ye(t,e,r,n){return n._parse(t,e,r,n)}function j(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var K={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Pn=K.self||K.window||K.global||{},Cn=K.window||K.self||K.global||{},Fn=K.global||K.self||K.window||{},kn=K.document||{};var Xe=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var It=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Hn=It&&parseFloat(It[1])||0;var Un="",vt={};function ye(t){for(let e in vt)if(t.startsWith(e)){let r=vt[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${Un}${t}`),t}var J={};Nt(J,{dirname:()=>Bn,filename:()=>zn,join:()=>Kn,resolve:()=>$n});function Pt(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=window.location?.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function zn(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):t}function Bn(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function Kn(...t){let e="/";return t=t.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${e}`),"")),n!==t.length-1&&(r=r.replace(new RegExp(`${e}$`),"")),r)),t.join(e)}function $n(...t){let e=[];for(let o=0;o<t.length;o++)e[o]=t[o];let r="",n=!1,s;for(let o=e.length-1;o>=-1&&!n;o--){let i;o>=0?i=e[o]:(s===void 0&&(s=Pt()),i=s),i.length!==0&&(r=`${i}/${r}`,n=i.charCodeAt(0)===ie)}return r=Vn(r,!n),n?`/${r}`:r.length>0?r:"."}var ie=47,Ge=46;function Vn(t,e){let r="",n=-1,s=0,o,i=!1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(o===ie)break;o=ie}if(o===ie){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!i||r.charCodeAt(r.length-1)!==Ge||r.charCodeAt(r.length-2)!==Ge){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==ie;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,s=0,i=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,s=0,i=!1;continue}}e&&(r.length>0?r+="/..":r="..",i=!0)}else{let c=t.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,i=!1}n=a,s=0}else o===Ge&&s!==-1?++s:s=-1}return r}var Ct="4.4.0";var Dn=globalThis.loaders?.parseImageNode,je=typeof Image<"u",Je=typeof ImageBitmap<"u",qn=Boolean(Dn),Qe=Xe?!0:qn;function Ft(t){switch(t){case"auto":return Je||je||Qe;case"imagebitmap":return Je;case"image":return je;case"data":return Qe;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function kt(){if(Je)return"imagebitmap";if(je)return"image";if(Qe)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Ht(t){let e=Wn(t);if(!e)throw new Error("Not an image");return e}function _e(t){return Re(t)}function Re(t){switch(Ht(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Wn(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Yn=/^data:image\/svg\+xml/,Xn=/\.svg((\?|#).*)?$/;function Ae(t){return t&&(Yn.test(t)||Xn.test(t))}function Ut(t,e){if(Ae(e)){let n=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return Ze(t,e)}function Ze(t,e){if(Ae(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function Ee(t,e,r){let n=Ut(t,r),s=self.URL||self.webkitURL,o=typeof n!="string"&&s.createObjectURL(n);try{return await Gn(o||n,e)}finally{o&&s.revokeObjectURL(o)}}async function Gn(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,s)=>{try{r.onload=()=>n(r),r.onerror=o=>{let i=o instanceof Error?o.message:"error";s(new Error(i))}}catch(o){s(o)}})}var zt=!0;async function Bt(t,e,r){let n;Ae(r)?n=await Ee(t,e,r):n=Ze(t,r);let s=e&&e.imagebitmap;return await jn(n,s)}async function jn(t,e=null){if((Jn(e)||!zt)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),zt=!1}return await createImageBitmap(t)}function Jn(t){if(!t)return!0;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Kt(t){return!ts(t,"ftyp",4)||!(t[8]&96)?null:Qn(t)}function Qn(t){switch(Zn(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Zn(t,e,r){return String.fromCharCode(...t.slice(e,r))}function es(t){return[...t].map(e=>e.charCodeAt(0))}function ts(t,e,r=0){let n=es(e);for(let s=0;s<n.length;++s)if(n[s]!==t[s+r])return!1;return!0}var $=!1,ae=!0;function we(t){let e=ce(t);return ns(e)||is(e)||ss(e)||os(e)||rs(e)}function rs(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=Kt(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function ns(t){let e=ce(t);return e.byteLength>=24&&e.getUint32(0,$)===2303741511?{mimeType:"image/png",width:e.getUint32(16,$),height:e.getUint32(20,$)}:null}function ss(t){let e=ce(t);return e.byteLength>=10&&e.getUint32(0,$)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,ae),height:e.getUint16(8,ae)}:null}function os(t){let e=ce(t);return e.byteLength>=14&&e.getUint16(0,$)===16973&&e.getUint32(2,ae)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,ae),height:e.getUint32(22,ae)}:null}function is(t){let e=ce(t);if(!(e.byteLength>=3&&e.getUint16(0,$)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=as(),o=2;for(;o+9<e.byteLength;){let i=e.getUint16(o,$);if(s.has(i))return{mimeType:"image/jpeg",height:e.getUint16(o+5,$),width:e.getUint16(o+7,$)};if(!n.has(i))return null;o+=2,o+=e.getUint16(o,$)}return null}function as(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function ce(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function $t(t,e){let{mimeType:r}=we(t)||{},n=globalThis.loaders?.parseImageNode;return j(n),await n(t,r)}async function Vt(t,e,r){e=e||{};let s=(e.image||{}).type||"auto",{url:o}=r||{},i=cs(s),a;switch(i){case"imagebitmap":a=await Bt(t,e,o);break;case"image":a=await Ee(t,e,o);break;case"data":a=await $t(t,e);break;default:j(!1)}return s==="data"&&(a=Re(a)),a}function cs(t){switch(t){case"auto":case"data":return kt();default:return Ft(t),t}}var ls=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],fs=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],ps={image:{type:"auto",decode:!0}},Se={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Ct,mimeTypes:fs,extensions:ls,parse:Vt,tests:[t=>Boolean(we(new DataView(t)))],options:ps};var hs=t=>t&&typeof t=="object";async function Dt(t,e,r={}){return await et(t,e,r)}async function et(t,e,r){return Array.isArray(t)?await ds(t,e,r):hs(t)?await us(t,e,r):await e(t,r)}async function us(t,e,r){let n=[],s={};for(let o in t){let i=t[o],a=et(i,e,r).then(c=>{s[o]=c});n.push(a)}return await Promise.all(n),s}async function ds(t,e,r={}){let n=t.map(s=>et(s,e,r));return await Promise.all(n)}async function qt(t,e={},r){let n=be(e);return await Dt(t,async s=>await tt(s,n,r))}async function tt(t,e={},r){let n=xs(t,e,r),o=await _s(e,r)(n),i=Rs(e);if(r){let c=As(n,o,r);return await Ye(o,[Se],i,c)}let a=await o.arrayBuffer();return await Se.parse(a,i)}function be(t={}){if(t.core?.baseUrl)return t;let e=t.baseUrl;return e?{...t,core:{...t.core,baseUrl:e}}:t}function xs(t,e={},r){let n=ye(t);if(Es(t))return n;let s=gs(e,r);if(!s){if(n!==t||t.startsWith("@"))return n;throw new Error(`Unable to resolve relative image URL ${t} without a base URL`)}return ye(Ts(s,t))}function gs(t,e){return e?.baseUrl?e.baseUrl:t.baseUrl?rt(t.baseUrl):t.core?.baseUrl?Ms(t.core.baseUrl):null}function rt(t){return t.endsWith("/")?t.slice(0,-1):t}function Ms(t){return rt(J.dirname(t))}function Ts(t,e){if(ys(t))return new URL(e,`${rt(t)}/`).toString();let r=t.startsWith("/")?t:`/${t}`,n=J.resolve(r,e);return t.startsWith("/")?n:n.slice(1)}function ys(t){return t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:")||t.startsWith("blob:")}function _s(t,e){let r=t.fetch??t.core?.fetch;return e?.fetch?e.fetch:typeof r=="function"?r:r&&typeof r=="object"?n=>fetch(n,r):fetch}function Rs(t){let e=t.core,r={...t};if(delete r.baseUrl,!e?.baseUrl)return r;let n={...e};return delete n.baseUrl,{...r,core:n}}function As(t,e,r){let n=e.url||t,[s,o=""]=n.split("?");return{...r,url:n,response:e,filename:J.filename(s),baseUrl:J.dirname(s),queryString:o}}function Es(t){return t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("file:")||t.startsWith("http:")||t.startsWith("https:")||t.startsWith("/")}function Ne(t,e,r){return typeof t=="function"?t({...e,...r}):t}async function le(t,e={}){let r=await ws(t,e);return await qt(r,be(e))}async function ws(t,e,r={}){let n=e&&e.image&&e.image.mipLevels||0;return n!==0?await Ss(t,n,e,r):Ne(t,e,r)}async function Ss(t,e,r,n){let s=[],o=be(r);if(e==="auto"){let i=Ne(t,r,{...n,lod:0}),a=await tt(i,o),{width:c,height:l}=_e(a);e=bs({width:c,height:l}),s.push(i)}j(e>0);for(let i=s.length;i<e;++i){let a=Ne(t,r,{...n,lod:i});s.push(a)}return s}function bs(t){return 1+Math.floor(Math.log2(Math.max(t.width,t.height)))}function Yt(t,e){let r=e.specularMipLevels??1,n=new st.DynamicTexture(t,{id:"brdfLUT",sampler:{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"linear",magFilter:"linear"},data:le(nt(e.brdfLutUrl))}),s=Wt(t,{id:"DiffuseEnvSampler",getTextureForFace:i=>le(nt(e.getTexUrl("diffuse",Oe.indexOf(i),0))),sampler:{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"linear",magFilter:"linear"}}),o=Wt(t,{id:"SpecularEnvSampler",getTextureForFace:i=>{let a=[],c=Oe.indexOf(i);for(let l=0;l<r;l++)a.push(le(nt(e.getTexUrl("specular",c,l))));return Promise.all(a)},sampler:{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"linear",magFilter:"linear"}});return{brdfLutTexture:n,diffuseEnvSampler:s,specularEnvSampler:o}}var Oe=["+X","-X","+Y","-Y","+Z","-Z"];function nt(t){let e=globalThis.document?.baseURI??globalThis.location?.href;return e?new URL(t,e).toString():t}function Wt(t,{id:e,getTextureForFace:r,sampler:n}){let s=Promise.all(Oe.map(o=>r(o))).then(o=>{let i={};return Oe.forEach((a,c)=>{i[a]=o[c]}),i});return new st.DynamicTexture(t,{id:e,dimension:"cube",mipmaps:!1,sampler:n,data:s})}var b=k(G(),1);var R;(function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST=9728]="NEAREST",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(R||(R={}));function Gt(t){return{addressModeU:Xt(t.wrapS),addressModeV:Xt(t.wrapT),magFilter:Ns(t.magFilter),...Os(t.minFilter)}}function Xt(t){switch(t){case R.CLAMP_TO_EDGE:return"clamp-to-edge";case R.REPEAT:return"repeat";case R.MIRRORED_REPEAT:return"mirror-repeat";default:return}}function Ns(t){switch(t){case R.NEAREST:return"nearest";case R.LINEAR:return"linear";default:return}}function Os(t){switch(t){case R.NEAREST:return{minFilter:"nearest"};case R.LINEAR:return{minFilter:"linear"};case R.NEAREST_MIPMAP_NEAREST:return{minFilter:"nearest",mipmapFilter:"nearest"};case R.LINEAR_MIPMAP_NEAREST:return{minFilter:"linear",mipmapFilter:"nearest"};case R.NEAREST_MIPMAP_LINEAR:return{minFilter:"nearest",mipmapFilter:"linear"};case R.LINEAR_MIPMAP_LINEAR:return{minFilter:"linear",mipmapFilter:"linear"};default:return{}}}var Ra=1/Math.PI*180,Aa=1/180*Math.PI,Ls={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Ls}};var N=globalThis.mathgl.config;function jt(t,{precision:e=N.precision}={}){return t=Is(t),`${parseFloat(t.toPrecision(e))}`}function Q(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function ot(t,e,r){let n=N.EPSILON;r&&(N.EPSILON=r);try{if(t===e)return!0;if(Q(t)&&Q(e)){if(t.length!==e.length)return!1;for(let s=0;s<t.length;++s)if(!ot(t[s],e[s]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=N.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{N.EPSILON=n}}function Is(t){return Math.round(t/N.EPSILON)*N.EPSILON}var W=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+r];return this.check()}toArray(e=[],r=0){for(let n=0;n<this.ELEMENTS;++n)e[r+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:Q(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(N)}formatString(e){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+jt(this[n],e);return`${e.printTypes?this.constructor.name:""}[${r}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!ot(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,n){if(n===void 0)return this.lerp(this,e,r);for(let s=0;s<this.ELEMENTS;++s){let o=e[s],i=typeof r=="number"?r:r[s];this[s]=o+n*(i-o)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),r[n]);return this.check()}add(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(N.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),r);return this.check()}get elements(){return this}};function vs(t,e){if(t.length!==e)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}function w(t){if(!Number.isFinite(t))throw new Error(`Invalid number ${JSON.stringify(t)}`);return t}function Y(t,e,r=""){if(N.debug&&!vs(t,e))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return t}function it(t,e){if(!t)throw new Error(`math.gl assertion ${e}`)}var Le=class extends W{get x(){return this[0]}set x(e){this[0]=w(e)}get y(){return this[1]}set y(e){this[1]=w(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*this[r];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let r=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-e[n];r+=s*s}return w(r)}dot(e){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*e[n];return w(r)}normalize(){let e=this.magnitude();if(e!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=e;return this.check()}multiply(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return it(e>=0&&e<this.ELEMENTS,"index is out of range"),w(this[e])}setComponent(e,r){return it(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=r,this.check()}addVectors(e,r){return this.copy(e).add(r)}subVectors(e,r){return this.copy(e).subtract(r)}multiplyVectors(e,r){return this.copy(e).multiply(r)}addScaledVector(e,r){return this.add(new this.constructor(e).multiplyScalar(r))}};var I=typeof Float32Array<"u"?Float32Array:Array;var Ca=Math.PI/180;function Ps(){let t=new I(2);return I!=Float32Array&&(t[0]=0,t[1]=0),t}function Zt(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[3]*s+r[6],t[1]=r[1]*n+r[4]*s+r[7],t}function er(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[4]*s+r[12],t[1]=r[1]*n+r[5]*s+r[13],t}var Fa=function(){let t=Ps();return function(e,r,n,s,o,i){let a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],o(t,t,i),e[a]=t[0],e[a+1]=t[1];return e}}();function tr(t,e,r){let n=e[0],s=e[1],o=r[3]*n+r[7]*s||1;return t[0]=(r[0]*n+r[4]*s)/o,t[1]=(r[1]*n+r[5]*s)/o,t}function rr(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[3]*n+r[7]*s+r[11]*o||1;return t[0]=(r[0]*n+r[4]*s+r[8]*o)/i,t[1]=(r[1]*n+r[5]*s+r[9]*o)/i,t[2]=(r[2]*n+r[6]*s+r[10]*o)/i,t}function nr(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t[2]=e[2],t[3]=e[3],t}function Ie(t,e,r){let n=e[0],s=e[1],o=e[2];return t[0]=r[0]*n+r[3]*s+r[6]*o,t[1]=r[1]*n+r[4]*s+r[7]*o,t[2]=r[2]*n+r[5]*s+r[8]*o,t[3]=e[3],t}function at(){let t=new I(3);return I!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Cs(t){let e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function ct(t,e,r){let n=new I(3);return n[0]=t,n[1]=e,n[2]=r,n}function sr(t,e){let r=e[0],n=e[1],s=e[2],o=r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function or(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ve(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[0],a=r[1],c=r[2];return t[0]=s*c-o*a,t[1]=o*i-n*c,t[2]=n*a-s*i,t}function Pe(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[3]*n+r[7]*s+r[11]*o+r[15];return i=i||1,t[0]=(r[0]*n+r[4]*s+r[8]*o+r[12])/i,t[1]=(r[1]*n+r[5]*s+r[9]*o+r[13])/i,t[2]=(r[2]*n+r[6]*s+r[10]*o+r[14])/i,t}function ir(t,e,r){let n=e[0],s=e[1],o=e[2];return t[0]=n*r[0]+s*r[3]+o*r[6],t[1]=n*r[1]+s*r[4]+o*r[7],t[2]=n*r[2]+s*r[5]+o*r[8],t}function ar(t,e,r){let n=r[0],s=r[1],o=r[2],i=r[3],a=e[0],c=e[1],l=e[2],m=s*l-o*c,p=o*a-n*l,f=n*c-s*a,h=s*f-o*p,u=o*m-n*f,d=n*p-s*m,x=i*2;return m*=x,p*=x,f*=x,h*=2,u*=2,d*=2,t[0]=a+m+h,t[1]=c+p+u,t[2]=l+f+d,t}var cr=Cs;var Ua=function(){let t=at();return function(e,r,n,s,o,i){let a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],o(t,t,i),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2];return e}}();var Ce,Z=class extends Le{static get ZERO(){return Ce||(Ce=new Z(0,0,0,0),Object.freeze(Ce)),Ce}constructor(e=0,r=0,n=0,s=0){super(-0,-0,-0,-0),Q(e)&&arguments.length===1?this.copy(e):(N.debug&&(w(e),w(r),w(n),w(s)),this[0]=e,this[1]=r,this[2]=n,this[3]=s)}set(e,r,n,s){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return N.debug&&(w(e.x),w(e.y),w(e.z),w(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=w(e)}get w(){return this[3]}set w(e){this[3]=w(e)}transform(e){return Pe(this,this,e),this.check()}transformByMatrix3(e){return Ie(this,this,e),this.check()}transformByMatrix2(e){return nr(this,this,e),this.check()}transformByQuaternion(e){return ar(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}};var ee=class extends W{toString(){let e="[";if(N.printRowMajor){e+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)e+=` ${this[n*this.RANK+r]}`}else{e+="column-major:";for(let r=0;r<this.ELEMENTS;++r)e+=` ${this[r]}`}return e+="]",e}getElementIndex(e,r){return r*this.RANK+e}getElement(e,r){return this[r*this.RANK+e]}setElement(e,r,n){return this[r*this.RANK+e]=w(n),this}getColumn(e,r=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)r[s]=this[n+s];return r}setColumn(e,r){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=r[s];return this}};function lr(){let t=new I(9);return I!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function fr(t,e){if(t===e){let r=e[1],n=e[2],s=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=s}else 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];return t}function pr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=e[4],a=e[5],c=e[6],l=e[7],m=e[8],p=m*i-a*l,f=-m*o+a*c,h=l*o-i*c,u=r*p+n*f+s*h;return u?(u=1/u,t[0]=p*u,t[1]=(-m*n+s*l)*u,t[2]=(a*n-s*i)*u,t[3]=f*u,t[4]=(m*r-s*c)*u,t[5]=(-a*r+s*o)*u,t[6]=h*u,t[7]=(-l*r+n*c)*u,t[8]=(i*r-n*o)*u,t):null}function mr(t){let e=t[0],r=t[1],n=t[2],s=t[3],o=t[4],i=t[5],a=t[6],c=t[7],l=t[8];return e*(l*o-i*c)+r*(-l*s+i*a)+n*(c*s-o*a)}function lt(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],m=e[7],p=e[8],f=r[0],h=r[1],u=r[2],d=r[3],x=r[4],g=r[5],A=r[6],M=r[7],T=r[8];return t[0]=f*n+h*i+u*l,t[1]=f*s+h*a+u*m,t[2]=f*o+h*c+u*p,t[3]=d*n+x*i+g*l,t[4]=d*s+x*a+g*m,t[5]=d*o+x*c+g*p,t[6]=A*n+M*i+T*l,t[7]=A*s+M*a+T*m,t[8]=A*o+M*c+T*p,t}function hr(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],m=e[7],p=e[8],f=r[0],h=r[1];return t[0]=n,t[1]=s,t[2]=o,t[3]=i,t[4]=a,t[5]=c,t[6]=f*n+h*i+l,t[7]=f*s+h*a+m,t[8]=f*o+h*c+p,t}function ur(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],m=e[7],p=e[8],f=Math.sin(r),h=Math.cos(r);return t[0]=h*n+f*i,t[1]=h*s+f*a,t[2]=h*o+f*c,t[3]=h*i-f*n,t[4]=h*a-f*s,t[5]=h*c-f*o,t[6]=l,t[7]=m,t[8]=p,t}function ft(t,e,r){let n=r[0],s=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=s*e[3],t[4]=s*e[4],t[5]=s*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function dr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r+r,a=n+n,c=s+s,l=r*i,m=n*i,p=n*a,f=s*i,h=s*a,u=s*c,d=o*i,x=o*a,g=o*c;return t[0]=1-p-u,t[3]=m-g,t[6]=f+x,t[1]=m+g,t[4]=1-l-u,t[7]=h-d,t[2]=f-x,t[5]=h+d,t[8]=1-l-p,t}var pt;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL1ROW0=3]="COL1ROW0",t[t.COL1ROW1=4]="COL1ROW1",t[t.COL1ROW2=5]="COL1ROW2",t[t.COL2ROW0=6]="COL2ROW0",t[t.COL2ROW1=7]="COL2ROW1",t[t.COL2ROW2=8]="COL2ROW2"})(pt||(pt={}));var Hs=Object.freeze([1,0,0,0,1,0,0,0,1]),H=class extends ee{static get IDENTITY(){return zs()}static get ZERO(){return Us()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return pt}constructor(e,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):r.length>0?this.copy([e,...r]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(Hs)}fromObject(e){return this.check()}fromQuaternion(e){return dr(this,e),this.check()}set(e,r,n,s,o,i,a,c,l){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this[4]=o,this[5]=i,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(e,r,n,s,o,i,a,c,l){return this[0]=e,this[1]=s,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=i,this[8]=l,this.check()}determinant(){return mr(this)}transpose(){return fr(this,this),this.check()}invert(){return pr(this,this),this.check()}multiplyLeft(e){return lt(this,e,this),this.check()}multiplyRight(e){return lt(this,this,e),this.check()}rotate(e){return ur(this,this,e),this.check()}scale(e){return Array.isArray(e)?ft(this,this,e):ft(this,this,[e,e]),this.check()}translate(e){return hr(this,this,e),this.check()}transform(e,r){let n;switch(e.length){case 2:n=Zt(r||[-0,-0],e,this);break;case 3:n=ir(r||[-0,-0,-0],e,this);break;case 4:n=Ie(r||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Y(n,e.length),n}transformVector(e,r){return this.transform(e,r)}transformVector2(e,r){return this.transform(e,r)}transformVector3(e,r){return this.transform(e,r)}},Fe,ke=null;function Us(){return Fe||(Fe=new H([0,0,0,0,0,0,0,0,0]),Object.freeze(Fe)),Fe}function zs(){return ke||(ke=new H,Object.freeze(ke)),ke}function Bs(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function xr(t,e){if(t===e){let r=e[1],n=e[2],s=e[3],o=e[6],i=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=s,t[13]=i,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function gr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=e[4],a=e[5],c=e[6],l=e[7],m=e[8],p=e[9],f=e[10],h=e[11],u=e[12],d=e[13],x=e[14],g=e[15],A=r*a-n*i,M=r*c-s*i,T=r*l-o*i,y=n*c-s*a,_=n*l-o*a,v=s*l-o*c,P=m*d-p*u,C=m*x-f*u,F=m*g-h*u,U=p*x-f*d,z=p*g-h*d,B=f*g-h*x,E=A*B-M*z+T*U+y*F-_*C+v*P;return E?(E=1/E,t[0]=(a*B-c*z+l*U)*E,t[1]=(s*z-n*B-o*U)*E,t[2]=(d*v-x*_+g*y)*E,t[3]=(f*_-p*v-h*y)*E,t[4]=(c*F-i*B-l*C)*E,t[5]=(r*B-s*F+o*C)*E,t[6]=(x*T-u*v-g*M)*E,t[7]=(m*v-f*T+h*M)*E,t[8]=(i*z-a*F+l*P)*E,t[9]=(n*F-r*z-o*P)*E,t[10]=(u*_-d*T+g*A)*E,t[11]=(p*T-m*_-h*A)*E,t[12]=(a*C-i*U-c*P)*E,t[13]=(r*U-n*C+s*P)*E,t[14]=(d*M-u*y-x*A)*E,t[15]=(m*y-p*M+f*A)*E,t):null}function Mr(t){let e=t[0],r=t[1],n=t[2],s=t[3],o=t[4],i=t[5],a=t[6],c=t[7],l=t[8],m=t[9],p=t[10],f=t[11],h=t[12],u=t[13],d=t[14],x=t[15],g=e*i-r*o,A=e*a-n*o,M=r*a-n*i,T=l*u-m*h,y=l*d-p*h,_=m*d-p*u,v=e*_-r*y+n*T,P=o*_-i*y+a*T,C=l*M-m*A+p*g,F=h*M-u*A+d*g;return c*v-s*P+x*C-f*F}function mt(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],m=e[7],p=e[8],f=e[9],h=e[10],u=e[11],d=e[12],x=e[13],g=e[14],A=e[15],M=r[0],T=r[1],y=r[2],_=r[3];return t[0]=M*n+T*a+y*p+_*d,t[1]=M*s+T*c+y*f+_*x,t[2]=M*o+T*l+y*h+_*g,t[3]=M*i+T*m+y*u+_*A,M=r[4],T=r[5],y=r[6],_=r[7],t[4]=M*n+T*a+y*p+_*d,t[5]=M*s+T*c+y*f+_*x,t[6]=M*o+T*l+y*h+_*g,t[7]=M*i+T*m+y*u+_*A,M=r[8],T=r[9],y=r[10],_=r[11],t[8]=M*n+T*a+y*p+_*d,t[9]=M*s+T*c+y*f+_*x,t[10]=M*o+T*l+y*h+_*g,t[11]=M*i+T*m+y*u+_*A,M=r[12],T=r[13],y=r[14],_=r[15],t[12]=M*n+T*a+y*p+_*d,t[13]=M*s+T*c+y*f+_*x,t[14]=M*o+T*l+y*h+_*g,t[15]=M*i+T*m+y*u+_*A,t}function Tr(t,e,r){let n=r[0],s=r[1],o=r[2],i,a,c,l,m,p,f,h,u,d,x,g;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*o+e[12],t[13]=e[1]*n+e[5]*s+e[9]*o+e[13],t[14]=e[2]*n+e[6]*s+e[10]*o+e[14],t[15]=e[3]*n+e[7]*s+e[11]*o+e[15]):(i=e[0],a=e[1],c=e[2],l=e[3],m=e[4],p=e[5],f=e[6],h=e[7],u=e[8],d=e[9],x=e[10],g=e[11],t[0]=i,t[1]=a,t[2]=c,t[3]=l,t[4]=m,t[5]=p,t[6]=f,t[7]=h,t[8]=u,t[9]=d,t[10]=x,t[11]=g,t[12]=i*n+m*s+u*o+e[12],t[13]=a*n+p*s+d*o+e[13],t[14]=c*n+f*s+x*o+e[14],t[15]=l*n+h*s+g*o+e[15]),t}function yr(t,e,r){let n=r[0],s=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function _r(t,e,r,n){let s=n[0],o=n[1],i=n[2],a=Math.sqrt(s*s+o*o+i*i),c,l,m,p,f,h,u,d,x,g,A,M,T,y,_,v,P,C,F,U,z,B,E,se;return a<1e-6?null:(a=1/a,s*=a,o*=a,i*=a,l=Math.sin(r),c=Math.cos(r),m=1-c,p=e[0],f=e[1],h=e[2],u=e[3],d=e[4],x=e[5],g=e[6],A=e[7],M=e[8],T=e[9],y=e[10],_=e[11],v=s*s*m+c,P=o*s*m+i*l,C=i*s*m-o*l,F=s*o*m-i*l,U=o*o*m+c,z=i*o*m+s*l,B=s*i*m+o*l,E=o*i*m-s*l,se=i*i*m+c,t[0]=p*v+d*P+M*C,t[1]=f*v+x*P+T*C,t[2]=h*v+g*P+y*C,t[3]=u*v+A*P+_*C,t[4]=p*F+d*U+M*z,t[5]=f*F+x*U+T*z,t[6]=h*F+g*U+y*z,t[7]=u*F+A*U+_*z,t[8]=p*B+d*E+M*se,t[9]=f*B+x*E+T*se,t[10]=h*B+g*E+y*se,t[11]=u*B+A*E+_*se,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Rr(t,e,r){let n=Math.sin(r),s=Math.cos(r),o=e[4],i=e[5],a=e[6],c=e[7],l=e[8],m=e[9],p=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*s+l*n,t[5]=i*s+m*n,t[6]=a*s+p*n,t[7]=c*s+f*n,t[8]=l*s-o*n,t[9]=m*s-i*n,t[10]=p*s-a*n,t[11]=f*s-c*n,t}function Ar(t,e,r){let n=Math.sin(r),s=Math.cos(r),o=e[0],i=e[1],a=e[2],c=e[3],l=e[8],m=e[9],p=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*s-l*n,t[1]=i*s-m*n,t[2]=a*s-p*n,t[3]=c*s-f*n,t[8]=o*n+l*s,t[9]=i*n+m*s,t[10]=a*n+p*s,t[11]=c*n+f*s,t}function Er(t,e,r){let n=Math.sin(r),s=Math.cos(r),o=e[0],i=e[1],a=e[2],c=e[3],l=e[4],m=e[5],p=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*s+l*n,t[1]=i*s+m*n,t[2]=a*s+p*n,t[3]=c*s+f*n,t[4]=l*s-o*n,t[5]=m*s-i*n,t[6]=p*s-a*n,t[7]=f*s-c*n,t}function wr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r+r,a=n+n,c=s+s,l=r*i,m=n*i,p=n*a,f=s*i,h=s*a,u=s*c,d=o*i,x=o*a,g=o*c;return t[0]=1-p-u,t[1]=m+g,t[2]=f-x,t[3]=0,t[4]=m-g,t[5]=1-l-u,t[6]=h+d,t[7]=0,t[8]=f+x,t[9]=h-d,t[10]=1-l-p,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Sr(t,e,r,n,s,o,i){let a=1/(r-e),c=1/(s-n),l=1/(o-i);return t[0]=o*2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(s+n)*c,t[10]=(i+o)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*o*2*l,t[15]=0,t}function Ks(t,e,r,n,s){let o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0){let i=1/(n-s);t[10]=(s+n)*i,t[14]=2*s*n*i}else t[10]=-1,t[14]=-2*n;return t}var br=Ks;function $s(t,e,r,n,s,o,i){let a=1/(e-r),c=1/(n-s),l=1/(o-i);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*a,t[13]=(s+n)*c,t[14]=(i+o)*l,t[15]=1,t}var Nr=$s;function Or(t,e,r,n){let s,o,i,a,c,l,m,p,f,h,u=e[0],d=e[1],x=e[2],g=n[0],A=n[1],M=n[2],T=r[0],y=r[1],_=r[2];return Math.abs(u-T)<1e-6&&Math.abs(d-y)<1e-6&&Math.abs(x-_)<1e-6?Bs(t):(p=u-T,f=d-y,h=x-_,s=1/Math.sqrt(p*p+f*f+h*h),p*=s,f*=s,h*=s,o=A*h-M*f,i=M*p-g*h,a=g*f-A*p,s=Math.sqrt(o*o+i*i+a*a),s?(s=1/s,o*=s,i*=s,a*=s):(o=0,i=0,a=0),c=f*a-h*i,l=h*o-p*a,m=p*i-f*o,s=Math.sqrt(c*c+l*l+m*m),s?(s=1/s,c*=s,l*=s,m*=s):(c=0,l=0,m=0),t[0]=o,t[1]=c,t[2]=p,t[3]=0,t[4]=i,t[5]=l,t[6]=f,t[7]=0,t[8]=a,t[9]=m,t[10]=h,t[11]=0,t[12]=-(o*u+i*d+a*x),t[13]=-(c*u+l*d+m*x),t[14]=-(p*u+f*d+h*x),t[15]=1,t)}function Vs(){let t=new I(4);return I!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Lr(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function Ir(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function vr(t){let e=t[0],r=t[1],n=t[2],s=t[3];return Math.sqrt(e*e+r*r+n*n+s*s)}function Pr(t){let e=t[0],r=t[1],n=t[2],s=t[3];return e*e+r*r+n*n+s*s}function Cr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r*r+n*n+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),t[0]=r*i,t[1]=n*i,t[2]=s*i,t[3]=o*i,t}function Fr(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function kr(t,e,r,n){let s=e[0],o=e[1],i=e[2],a=e[3];return t[0]=s+n*(r[0]-s),t[1]=o+n*(r[1]-o),t[2]=i+n*(r[2]-i),t[3]=a+n*(r[3]-a),t}function Hr(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3];return t[0]=r[0]*n+r[4]*s+r[8]*o+r[12]*i,t[1]=r[1]*n+r[5]*s+r[9]*o+r[13]*i,t[2]=r[2]*n+r[6]*s+r[10]*o+r[14]*i,t[3]=r[3]*n+r[7]*s+r[11]*o+r[15]*i,t}function Ur(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[0],a=r[1],c=r[2],l=r[3],m=l*n+a*o-c*s,p=l*s+c*n-i*o,f=l*o+i*s-a*n,h=-i*n-a*s-c*o;return t[0]=m*l+h*-i+p*-c-f*-a,t[1]=p*l+h*-a+f*-i-m*-c,t[2]=f*l+h*-c+m*-a-p*-i,t[3]=e[3],t}var nc=function(){let t=Vs();return function(e,r,n,s,o,i){let a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],o(t,t,i),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e}}();var dt;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(dt||(dt={}));var qs=45*Math.PI/180,Ws=1,ht=.1,ut=500,Ys=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),V=class extends ee{static get IDENTITY(){return Gs()}static get ZERO(){return Xs()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return dt}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,r,n,s,o,i,a,c,l,m,p,f,h,u,d,x){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this[4]=o,this[5]=i,this[6]=a,this[7]=c,this[8]=l,this[9]=m,this[10]=p,this[11]=f,this[12]=h,this[13]=u,this[14]=d,this[15]=x,this.check()}setRowMajor(e,r,n,s,o,i,a,c,l,m,p,f,h,u,d,x){return this[0]=e,this[1]=o,this[2]=l,this[3]=h,this[4]=r,this[5]=i,this[6]=m,this[7]=u,this[8]=n,this[9]=a,this[10]=p,this[11]=d,this[12]=s,this[13]=c,this[14]=f,this[15]=x,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(Ys)}fromObject(e){return this.check()}fromQuaternion(e){return wr(this,e),this.check()}frustum(e){let{left:r,right:n,bottom:s,top:o,near:i=ht,far:a=ut}=e;return a===1/0?js(this,r,n,s,o,i):Sr(this,r,n,s,o,i,a),this.check()}lookAt(e){let{eye:r,center:n=[0,0,0],up:s=[0,1,0]}=e;return Or(this,r,n,s),this.check()}ortho(e){let{left:r,right:n,bottom:s,top:o,near:i=ht,far:a=ut}=e;return Nr(this,r,n,s,o,i,a),this.check()}orthographic(e){let{fovy:r=qs,aspect:n=Ws,focalDistance:s=1,near:o=ht,far:i=ut}=e;zr(r);let a=r/2,c=s*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:o,far:i})}perspective(e){let{fovy:r=45*Math.PI/180,aspect:n=1,near:s=.1,far:o=500}=e;return zr(r),br(this,r,n,s,o),this.check()}determinant(){return Mr(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return e[0]=this[0]*s,e[1]=this[1]*o,e[2]=this[2]*i,e[3]=0,e[4]=this[4]*s,e[5]=this[5]*o,e[6]=this[6]*i,e[7]=0,e[8]=this[8]*s,e[9]=this[9]*o,e[10]=this[10]*i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return e[0]=this[0]*s,e[1]=this[1]*o,e[2]=this[2]*i,e[3]=this[4]*s,e[4]=this[5]*o,e[5]=this[6]*i,e[6]=this[8]*s,e[7]=this[9]*o,e[8]=this[10]*i,e}transpose(){return xr(this,this),this.check()}invert(){return gr(this,this),this.check()}multiplyLeft(e){return mt(this,e,this),this.check()}multiplyRight(e){return mt(this,this,e),this.check()}rotateX(e){return Rr(this,this,e),this.check()}rotateY(e){return Ar(this,this,e),this.check()}rotateZ(e){return Er(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,r){return _r(this,this,e,r),this.check()}scale(e){return yr(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return Tr(this,this,e),this.check()}transform(e,r){return e.length===4?(r=Hr(r||[-0,-0,-0,-0],e,this),Y(r,4),r):this.transformAsPoint(e,r)}transformAsPoint(e,r){let{length:n}=e,s;switch(n){case 2:s=er(r||[-0,-0],e,this);break;case 3:s=Pe(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Y(s,e.length),s}transformAsVector(e,r){let n;switch(e.length){case 2:n=tr(r||[-0,-0],e,this);break;case 3:n=rr(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Y(n,e.length),n}transformPoint(e,r){return this.transformAsPoint(e,r)}transformVector(e,r){return this.transformAsPoint(e,r)}transformDirection(e,r){return this.transformAsVector(e,r)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,r,n){return this.identity().translate([e,r,n])}},He,Ue;function Xs(){return He||(He=new V([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(He)),He}function Gs(){return Ue||(Ue=new V,Object.freeze(Ue)),Ue}function zr(t){if(t>Math.PI*2)throw Error("expected radians")}function js(t,e,r,n,s,o){let i=2*o/(r-e),a=2*o/(s-n),c=(r+e)/(r-e),l=(s+n)/(s-n),m=-1,p=-1,f=-2*o;return t[0]=i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=l,t[10]=m,t[11]=p,t[12]=0,t[13]=0,t[14]=f,t[15]=0,t}function Br(){let t=new I(4);return I!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Kr(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function xt(t,e,r){r=r*.5;let n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function gt(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=r[0],c=r[1],l=r[2],m=r[3];return t[0]=n*m+i*a+s*l-o*c,t[1]=s*m+i*c+o*a-n*l,t[2]=o*m+i*l+n*c-s*a,t[3]=i*m-n*a-s*c-o*l,t}function $r(t,e,r){r*=.5;let n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+i*a,t[1]=s*c+o*a,t[2]=o*c-s*a,t[3]=i*c-n*a,t}function Vr(t,e,r){r*=.5;let n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c-o*a,t[1]=s*c+i*a,t[2]=o*c+n*a,t[3]=i*c-s*a,t}function Dr(t,e,r){r*=.5;let n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+s*a,t[1]=s*c-n*a,t[2]=o*c+i*a,t[3]=i*c-o*a,t}function qr(t,e){let r=e[0],n=e[1],s=e[2];return t[0]=r,t[1]=n,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),t}function pe(t,e,r,n){let s=e[0],o=e[1],i=e[2],a=e[3],c=r[0],l=r[1],m=r[2],p=r[3],f,h,u,d,x;return f=s*c+o*l+i*m+a*p,f<0&&(f=-f,c=-c,l=-l,m=-m,p=-p),1-f>1e-6?(h=Math.acos(f),x=Math.sin(h),u=Math.sin((1-n)*h)/x,d=Math.sin(n*h)/x):(u=1-n,d=n),t[0]=u*s+d*c,t[1]=u*o+d*l,t[2]=u*i+d*m,t[3]=u*a+d*p,t}function Wr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r*r+n*n+s*s+o*o,a=i?1/i:0;return t[0]=-r*a,t[1]=-n*a,t[2]=-s*a,t[3]=o*a,t}function Yr(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function Mt(t,e){let r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{let s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;n=Math.sqrt(e[s*3+s]-e[o*3+o]-e[i*3+i]+1),t[s]=.5*n,n=.5/n,t[3]=(e[o*3+i]-e[i*3+o])*n,t[o]=(e[o*3+s]+e[s*3+o])*n,t[i]=(e[i*3+s]+e[s*3+i])*n}return t}var Xr=Lr;var Gr=Ir,jr=Fr,Jr=kr,Qr=vr;var Zr=Pr;var en=Cr;var tn=function(){let t=at(),e=ct(1,0,0),r=ct(0,1,0);return function(n,s,o){let i=or(s,o);return i<-.999999?(ve(t,e,s),cr(t)<1e-6&&ve(t,r,s),sr(t,t),xt(n,t,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(ve(t,s,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+i,en(n,n))}}(),gc=function(){let t=Br(),e=Br();return function(r,n,s,o,i,a){return pe(t,n,i,a),pe(e,s,o,a),pe(r,t,e,2*a*(1-a)),r}}(),Mc=function(){let t=lr();return function(e,r,n,s){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=s[0],t[4]=s[1],t[7]=s[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],en(e,Mt(e,t))}}();var Js=[0,0,0,1],me=class extends W{constructor(e=0,r=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,r,n,s)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,r,n,s){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return Mt(this,e),this.check()}fromAxisRotation(e,r){return xt(this,e,r),this.check()}identity(){return Kr(this),this.check()}setAxisAngle(e,r){return this.fromAxisRotation(e,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=w(e)}get y(){return this[1]}set y(e){this[1]=w(e)}get z(){return this[2]}set z(e){this[2]=w(e)}get w(){return this[3]}set w(e){this[3]=w(e)}len(){return Qr(this)}lengthSquared(){return Zr(this)}dot(e){return jr(this,e)}rotationTo(e,r){return tn(this,e,r),this.check()}add(e){return Xr(this,this,e),this.check()}calculateW(){return qr(this,this),this.check()}conjugate(){return Yr(this,this),this.check()}invert(){return Wr(this,this),this.check()}lerp(e,r,n){return n===void 0?this.lerp(this,e,r):(Jr(this,e,r,n),this.check())}multiplyRight(e){return gt(this,this,e),this.check()}multiplyLeft(e){return gt(this,e,this),this.check()}normalize(){let e=this.len(),r=e>0?1/e:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,e===0&&(this[3]=1),this.check()}rotateX(e){return $r(this,this,e),this.check()}rotateY(e){return Vr(this,this,e),this.check()}rotateZ(e){return Dr(this,this,e),this.check()}scale(e){return Gr(this,this,e),this.check()}slerp(e,r,n){let s,o,i;switch(arguments.length){case 1:({start:s=Js,target:o,ratio:i}=e);break;case 2:s=this,o=e,i=r;break;default:s=e,o=r,i=n}return pe(this,s,o,i),this.check()}transformVector4(e,r=new Z){return Ur(r,e,this),Y(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,r){return this.setAxisAngle(e,r)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}};var Tt=[O("baseColor","pbr_baseColorSampler","baseColorTexture",["pbrMetallicRoughness","baseColorTexture"]),O("metallicRoughness","pbr_metallicRoughnessSampler","metallicRoughnessTexture",["pbrMetallicRoughness","metallicRoughnessTexture"]),O("normal","pbr_normalSampler","normalTexture",["normalTexture"]),O("occlusion","pbr_occlusionSampler","occlusionTexture",["occlusionTexture"]),O("emissive","pbr_emissiveSampler","emissiveTexture",["emissiveTexture"]),O("specularColor","pbr_specularColorSampler","KHR_materials_specular.specularColorTexture",["extensions","KHR_materials_specular","specularColorTexture"]),O("specularIntensity","pbr_specularIntensitySampler","KHR_materials_specular.specularTexture",["extensions","KHR_materials_specular","specularTexture"]),O("transmission","pbr_transmissionSampler","KHR_materials_transmission.transmissionTexture",["extensions","KHR_materials_transmission","transmissionTexture"]),O("thickness","pbr_thicknessSampler","KHR_materials_volume.thicknessTexture",["extensions","KHR_materials_volume","thicknessTexture"]),O("clearcoat","pbr_clearcoatSampler","KHR_materials_clearcoat.clearcoatTexture",["extensions","KHR_materials_clearcoat","clearcoatTexture"]),O("clearcoatRoughness","pbr_clearcoatRoughnessSampler","KHR_materials_clearcoat.clearcoatRoughnessTexture",["extensions","KHR_materials_clearcoat","clearcoatRoughnessTexture"]),O("clearcoatNormal","pbr_clearcoatNormalSampler","KHR_materials_clearcoat.clearcoatNormalTexture",["extensions","KHR_materials_clearcoat","clearcoatNormalTexture"]),O("sheenColor","pbr_sheenColorSampler","KHR_materials_sheen.sheenColorTexture",["extensions","KHR_materials_sheen","sheenColorTexture"]),O("sheenRoughness","pbr_sheenRoughnessSampler","KHR_materials_sheen.sheenRoughnessTexture",["extensions","KHR_materials_sheen","sheenRoughnessTexture"]),O("iridescence","pbr_iridescenceSampler","KHR_materials_iridescence.iridescenceTexture",["extensions","KHR_materials_iridescence","iridescenceTexture"]),O("iridescenceThickness","pbr_iridescenceThicknessSampler","KHR_materials_iridescence.iridescenceThicknessTexture",["extensions","KHR_materials_iridescence","iridescenceThicknessTexture"]),O("anisotropy","pbr_anisotropySampler","KHR_materials_anisotropy.anisotropyTexture",["extensions","KHR_materials_anisotropy","anisotropyTexture"])],Qs=new Map(Tt.map(t=>[t.slot,t]));function O(t,e,r,n){return{slot:t,binding:e,displayName:r,pathSegments:n,uvSetUniform:`${t}UVSet`,uvTransformUniform:`${t}UVTransform`}}function rn(){return Tt}function Be(t){let e=Qs.get(t);if(!e)throw new Error(`Unknown PBR texture transform slot ${t}`);return e}function Ke(t){let e=t?.extensions?.KHR_texture_transform;return{offset:e?.offset?[e.offset[0],e.offset[1]]:[0,0],rotation:e?.rotation??0,scale:e?.scale?[e.scale[0],e.scale[1]]:[1,1]}}function yt(t){return t?.extensions?.KHR_texture_transform?.texCoord??t?.texCoord??0}function nn(t){return Tt.find(e=>e.pathSegments.length===t.length&&e.pathSegments.every((r,n)=>t[n]===r))||null}function ze(t){let e=new H().set(1,0,0,0,1,0,t.offset[0],t.offset[1],1),r=new H().set(Math.cos(t.rotation),Math.sin(t.rotation),0,-Math.sin(t.rotation),Math.cos(t.rotation),0,0,0,1),n=new H().set(t.scale[0],0,0,0,t.scale[1],0,0,0,1);return Array.from(e.multiplyRight(r).multiplyRight(n))}function sn(t,e){let r=new H(ze(t)),n=new H(ze(e)),s=new H(r).invert();return Array.from(n.multiplyRight(s))}function he(t,e,r,n){let s={defines:{MANUAL_SRGB:!0,SRGB_FAST_APPROXIMATION:!0},bindings:{},uniforms:{camera:[0,0,0],metallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=!0;let{imageBasedLightingEnvironment:o}=n;return o&&(s.bindings.pbr_diffuseEnvSampler=o.diffuseEnvSampler.texture,s.bindings.pbr_specularEnvSampler=o.specularEnvSampler.texture,s.bindings.pbr_brdfLUT=o.brdfLutTexture.texture,s.uniforms.IBLenabled=!0,s.uniforms.scaleIBLAmbient=[1,1]),n?.pbrDebug&&(s.defines.PBR_DEBUG=!0,s.uniforms.scaleDiffBaseMR=[0,0,0,0],s.uniforms.scaleFGDSpec=[0,0,0,0]),r.NORMAL&&(s.defines.HAS_NORMALS=!0),r.TANGENT&&n?.useTangents&&(s.defines.HAS_TANGENTS=!0),r.TEXCOORD_0&&(s.defines.HAS_UV=!0),r.TEXCOORD_1&&(s.defines.HAS_UV_1=!0),r.JOINTS_0&&r.WEIGHTS_0&&(s.defines.HAS_SKIN=!0),r.COLOR_0&&(s.defines.HAS_COLORS=!0),n?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=!0),n?.lights&&(s.defines.USE_LIGHTS=!0),e&&(n.validateAttributes!==!1&&Zs(e,r),to(t,e,s,r,n.gltf)),s}function Zs(t,e){let r=on(t,0);r.length>0&&!e.TEXCOORD_0&&b.log.warn(`glTF material uses ${r.join(", ")} but primitive is missing TEXCOORD_0; textured shading will sample the default UV coordinates`)();let n=on(t,1);if(n.length>0&&!e.TEXCOORD_1&&b.log.warn(`glTF material uses ${n.join(", ")} with TEXCOORD_1 but primitive is missing TEXCOORD_1; those textures will be skipped`)(),Boolean(t.unlit||t.extensions?.KHR_materials_unlit)||e.NORMAL)return;let o=t.normalTexture?"lit PBR shading with normalTexture":"lit PBR shading";b.log.warn(`glTF primitive is missing NORMAL while using ${o}; shading will fall back to geometric normals`)()}function on(t,e){let r=[];for(let n of rn()){let s=eo(t,n.pathSegments);s&&yt(s)===e&&r.push(n.displayName)}return r}function eo(t,e){let r=t;for(let n of e)if(r=r?.[n],!r)return null;return r}function to(t,e,r,n,s){if(r.uniforms.unlit=Boolean(e.unlit||e.extensions?.KHR_materials_unlit),e.pbrMetallicRoughness&&so(t,e.pbrMetallicRoughness,r,n,s),e.normalTexture){L(t,e.normalTexture,"pbr_normalSampler",r,{featureOptions:{define:"HAS_NORMALMAP",enabledUniformName:"normalMapEnabled"},gltf:s,attributes:n,textureTransformSlot:"normal"});let{scale:o=1}=e.normalTexture;r.uniforms.normalScale=o}if(e.occlusionTexture){L(t,e.occlusionTexture,"pbr_occlusionSampler",r,{featureOptions:{define:"HAS_OCCLUSIONMAP",enabledUniformName:"occlusionMapEnabled"},gltf:s,attributes:n,textureTransformSlot:"occlusion"});let{strength:o=1}=e.occlusionTexture;r.uniforms.occlusionStrength=o}switch(r.uniforms.emissiveFactor=e.emissiveFactor||[0,0,0],e.emissiveTexture&&L(t,e.emissiveTexture,"pbr_emissiveSampler",r,{featureOptions:{define:"HAS_EMISSIVEMAP",enabledUniformName:"emissiveMapEnabled"},gltf:s,attributes:n,textureTransformSlot:"emissive"}),oo(t,e.extensions,r,s,n),e.alphaMode||"OPAQUE"){case"OPAQUE":break;case"MASK":{let{alphaCutoff:o=.5}=e;r.defines.ALPHA_CUTOFF=!0,r.uniforms.alphaCutoffEnabled=!0,r.uniforms.alphaCutoff=o;break}case"BLEND":b.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),ro(r);break}}function ro(t){t.parameters.blend=!0,t.parameters.blendColorOperation="add",t.parameters.blendColorSrcFactor="src-alpha",t.parameters.blendColorDstFactor="one-minus-src-alpha",t.parameters.blendAlphaOperation="add",t.parameters.blendAlphaSrcFactor="one",t.parameters.blendAlphaDstFactor="one-minus-src-alpha",t.glParameters.blend=!0,t.glParameters.blendEquation=R.FUNC_ADD,t.glParameters.blendFunc=[R.SRC_ALPHA,R.ONE_MINUS_SRC_ALPHA,R.ONE,R.ONE_MINUS_SRC_ALPHA]}function no(t){t.parameters.blend=!0,t.parameters.depthWriteEnabled=!1,t.parameters.blendColorOperation="add",t.parameters.blendColorSrcFactor="one",t.parameters.blendColorDstFactor="one-minus-src-alpha",t.parameters.blendAlphaOperation="add",t.parameters.blendAlphaSrcFactor="one",t.parameters.blendAlphaDstFactor="one-minus-src-alpha",t.glParameters.blend=!0,t.glParameters.depthMask=!1,t.glParameters.blendEquation=R.FUNC_ADD,t.glParameters.blendFunc=[R.ONE,R.ONE_MINUS_SRC_ALPHA,R.ONE,R.ONE_MINUS_SRC_ALPHA]}function so(t,e,r,n,s){e.baseColorTexture&&L(t,e.baseColorTexture,"pbr_baseColorSampler",r,{featureOptions:{define:"HAS_BASECOLORMAP",enabledUniformName:"baseColorMapEnabled"},gltf:s,attributes:n,textureTransformSlot:"baseColor"}),r.uniforms.baseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&L(t,e.metallicRoughnessTexture,"pbr_metallicRoughnessSampler",r,{featureOptions:{define:"HAS_METALROUGHNESSMAP",enabledUniformName:"metallicRoughnessMapEnabled"},gltf:s,attributes:n,textureTransformSlot:"metallicRoughness"});let{metallicFactor:o=1,roughnessFactor:i=1}=e;r.uniforms.metallicRoughnessValues=[o,i]}function oo(t,e,r,n,s={}){e&&(io(e)&&(r.defines.USE_MATERIAL_EXTENSIONS=!0),ao(t,e.KHR_materials_specular,r,n,s),co(e.KHR_materials_ior,r),lo(t,e.KHR_materials_transmission,r,n,s),fo(t,e.KHR_materials_volume,r,n,s),po(t,e.KHR_materials_clearcoat,r,n,s),mo(t,e.KHR_materials_sheen,r,n,s),ho(t,e.KHR_materials_iridescence,r,n,s),uo(t,e.KHR_materials_anisotropy,r,n,s),xo(e.KHR_materials_emissive_strength,r))}function io(t){return Boolean(t.KHR_materials_specular||t.KHR_materials_ior||t.KHR_materials_transmission||t.KHR_materials_volume||t.KHR_materials_clearcoat||t.KHR_materials_sheen||t.KHR_materials_iridescence||t.KHR_materials_anisotropy)}function ao(t,e,r,n,s={}){e&&(e.specularColorFactor&&(r.uniforms.specularColorFactor=e.specularColorFactor),e.specularFactor!==void 0&&(r.uniforms.specularIntensityFactor=e.specularFactor),e.specularColorTexture&&L(t,e.specularColorTexture,"pbr_specularColorSampler",r,{featureOptions:{define:"HAS_SPECULARCOLORMAP",enabledUniformName:"specularColorMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"specularColor"}),e.specularTexture&&L(t,e.specularTexture,"pbr_specularIntensitySampler",r,{featureOptions:{define:"HAS_SPECULARINTENSITYMAP",enabledUniformName:"specularIntensityMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"specularIntensity"}))}function co(t,e){t?.ior!==void 0&&(e.uniforms.ior=t.ior)}function lo(t,e,r,n,s={}){e&&(e.transmissionFactor!==void 0&&(r.uniforms.transmissionFactor=e.transmissionFactor),e.transmissionTexture&&L(t,e.transmissionTexture,"pbr_transmissionSampler",r,{featureOptions:{define:"HAS_TRANSMISSIONMAP",enabledUniformName:"transmissionMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"transmission"}),((e.transmissionFactor??0)>0||e.transmissionTexture)&&(b.log.warn("KHR_materials_transmission uses a premultiplied-alpha blending approximation and may require mesh sorting")(),no(r)))}function fo(t,e,r,n,s={}){e&&(e.thicknessFactor!==void 0&&(r.uniforms.thicknessFactor=e.thicknessFactor),e.thicknessTexture&&L(t,e.thicknessTexture,"pbr_thicknessSampler",r,{featureOptions:{define:"HAS_THICKNESSMAP"},gltf:n,attributes:s,textureTransformSlot:"thickness"}),e.attenuationDistance!==void 0&&(r.uniforms.attenuationDistance=e.attenuationDistance),e.attenuationColor&&(r.uniforms.attenuationColor=e.attenuationColor))}function po(t,e,r,n,s={}){e&&(e.clearcoatFactor!==void 0&&(r.uniforms.clearcoatFactor=e.clearcoatFactor),e.clearcoatRoughnessFactor!==void 0&&(r.uniforms.clearcoatRoughnessFactor=e.clearcoatRoughnessFactor),e.clearcoatTexture&&L(t,e.clearcoatTexture,"pbr_clearcoatSampler",r,{featureOptions:{define:"HAS_CLEARCOATMAP",enabledUniformName:"clearcoatMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"clearcoat"}),e.clearcoatRoughnessTexture&&L(t,e.clearcoatRoughnessTexture,"pbr_clearcoatRoughnessSampler",r,{featureOptions:{define:"HAS_CLEARCOATROUGHNESSMAP",enabledUniformName:"clearcoatRoughnessMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"clearcoatRoughness"}),e.clearcoatNormalTexture&&L(t,e.clearcoatNormalTexture,"pbr_clearcoatNormalSampler",r,{featureOptions:{define:"HAS_CLEARCOATNORMALMAP"},gltf:n,attributes:s,textureTransformSlot:"clearcoatNormal"}))}function mo(t,e,r,n,s={}){e&&(e.sheenColorFactor&&(r.uniforms.sheenColorFactor=e.sheenColorFactor),e.sheenRoughnessFactor!==void 0&&(r.uniforms.sheenRoughnessFactor=e.sheenRoughnessFactor),e.sheenColorTexture&&L(t,e.sheenColorTexture,"pbr_sheenColorSampler",r,{featureOptions:{define:"HAS_SHEENCOLORMAP",enabledUniformName:"sheenColorMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"sheenColor"}),e.sheenRoughnessTexture&&L(t,e.sheenRoughnessTexture,"pbr_sheenRoughnessSampler",r,{featureOptions:{define:"HAS_SHEENROUGHNESSMAP",enabledUniformName:"sheenRoughnessMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"sheenRoughness"}))}function ho(t,e,r,n,s={}){e&&(e.iridescenceFactor!==void 0&&(r.uniforms.iridescenceFactor=e.iridescenceFactor),e.iridescenceIor!==void 0&&(r.uniforms.iridescenceIor=e.iridescenceIor),(e.iridescenceThicknessMinimum!==void 0||e.iridescenceThicknessMaximum!==void 0)&&(r.uniforms.iridescenceThicknessRange=[e.iridescenceThicknessMinimum??100,e.iridescenceThicknessMaximum??400]),e.iridescenceTexture&&L(t,e.iridescenceTexture,"pbr_iridescenceSampler",r,{featureOptions:{define:"HAS_IRIDESCENCEMAP",enabledUniformName:"iridescenceMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"iridescence"}),e.iridescenceThicknessTexture&&L(t,e.iridescenceThicknessTexture,"pbr_iridescenceThicknessSampler",r,{featureOptions:{define:"HAS_IRIDESCENCETHICKNESSMAP"},gltf:n,attributes:s,textureTransformSlot:"iridescenceThickness"}))}function uo(t,e,r,n,s={}){e&&(e.anisotropyStrength!==void 0&&(r.uniforms.anisotropyStrength=e.anisotropyStrength),e.anisotropyRotation!==void 0&&(r.uniforms.anisotropyRotation=e.anisotropyRotation),e.anisotropyTexture&&L(t,e.anisotropyTexture,"pbr_anisotropySampler",r,{featureOptions:{define:"HAS_ANISOTROPYMAP",enabledUniformName:"anisotropyMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"anisotropy"}))}function xo(t,e){t?.emissiveStrength!==void 0&&(e.uniforms.emissiveStrength=t.emissiveStrength)}function L(t,e,r,n,s={}){let{featureOptions:o={},gltf:i,attributes:a={},textureTransformSlot:c}=s,{define:l,enabledUniformName:m}=o,p=yt(e);if(p>1){b.log.warn(`Skipping ${String(r)} because ${p} is not supported; only TEXCOORD_0 and TEXCOORD_1 are currently available`)();return}if(p===1&&!a.TEXCOORD_1){b.log.warn(`Skipping ${String(r)} because it requires TEXCOORD_1 but the primitive does not provide TEXCOORD_1`)();return}let f=go(e,i),h=f.texture?.source?.image;if(!h){b.log.warn(`Skipping unresolved glTF texture for ${String(r)}`)();return}let u={wrapS:10497,wrapT:10497,minFilter:9729,magFilter:9729,...f?.texture?.sampler},d={id:f.uniformName||f.id,sampler:Gt(u)},x;if(h.compressed)x=To(t,h,d);else{let{width:g,height:A}=t.getExternalImageSize(h);x=t.createTexture({...d,width:g,height:A,data:h})}if(n.bindings[r]=x,l&&(n.defines[l]=!0),m&&(n.uniforms[m]=!0),c){let g=Be(c);n.uniforms[g.uvSetUniform]=p,n.uniforms[g.uvTransformUniform]=ze(Ke(e))}n.generatedTextures.push(x)}function go(t,e){if(t.texture||t.index===void 0||!e?.textures)return t;let r=e.textures[t.index];return r?"texture"in r&&r.texture?{...r,...t,texture:r.texture}:"source"in r?{...t,texture:r}:t:t}function _t(t,e){return t.createTexture({...e,format:"rgba8unorm",width:1,height:1,mipLevels:1})}function an(t){return t.textureFormat}function Mo(t,e,r){let{blockWidth:n=1,blockHeight:s=1}=b.textureFormatDecoder.getInfo(r),o=1;for(let i=1;;i++){let a=Math.max(1,t>>i),c=Math.max(1,e>>i);if(a<n||c<s)break;o++}return o}function To(t,e,r){let n;if(Array.isArray(e.data)&&e.data[0]?.data?n=e.data:"mipmaps"in e&&Array.isArray(e.mipmaps)?n=e.mipmaps:n=[],n.length===0||!n[0]?.data)return b.log.warn("createCompressedTexture: compressed image has no valid mip levels, creating fallback")(),_t(t,r);let s=n[0],o=s.width??e.width??0,i=s.height??e.height??0;if(o<=0||i<=0)return b.log.warn("createCompressedTexture: base level has invalid dimensions, creating fallback")(),_t(t,r);let a=an(s);if(!a)return b.log.warn("createCompressedTexture: compressed image has no textureFormat, creating fallback")(),_t(t,r);let c=Mo(o,i,a),l=Math.min(n.length,c),m=1;for(let f=1;f<l;f++){let h=n[f];if(!h.data||h.width<=0||h.height<=0){b.log.warn(`createCompressedTexture: mip level ${f} has invalid data/dimensions, truncating`)();break}let u=an(h);if(u&&u!==a){b.log.warn(`createCompressedTexture: mip level ${f} format '${u}' differs from base '${a}', truncating`)();break}let d=Math.max(1,o>>f),x=Math.max(1,i>>f);if(h.width!==d||h.height!==x){b.log.warn(`createCompressedTexture: mip level ${f} dimensions ${h.width}x${h.height} don't match expected ${d}x${x}, truncating`)();break}m++}let p=t.createTexture({...r,format:a,usage:b.Texture.TEXTURE|b.Texture.COPY_DST,width:o,height:i,mipLevels:m,data:s.data});for(let f=1;f<m;f++)p.writeData(n[f].data,{width:n[f].width,height:n[f].height,mipLevel:f});return p}var ln=k($e(),1);function Ve(t,e={}){let r=t.lights||t.extensions?.KHR_lights_punctual?.lights;if(!r||!Array.isArray(r)||r.length===0)return[];let n=[],s=Eo(t.nodes||[]),o=new Map;for(let i of t.nodes||[]){let a=i.light??i.extensions?.KHR_lights_punctual?.light;if(typeof a!="number")continue;let c=r[a];if(!c)continue;let l=yo(c.color||[1,1,1],e.useByteColors??!0),m=c.intensity??1,p=c.range,f=fn(i,s,o);switch(c.type){case"directional":n.push(Ro(f,l,m));break;case"point":n.push(_o(f,l,m,p));break;case"spot":n.push(Ao(f,l,m,p,c.spot));break;default:break}}return n}function yo(t,e){return e?t.map(r=>r*255):(0,ln.normalizeByteColor3)(t,!1)}function _o(t,e,r,n){let s=pn(t),o=[1,0,0];return n!==void 0&&n>0&&(o=[1,0,1/(n*n)]),{type:"point",position:s,color:e,intensity:r,attenuation:o}}function Ro(t,e,r){return{type:"directional",direction:mn(t),color:e,intensity:r}}function Ao(t,e,r,n,s={}){let o=pn(t),i=mn(t),a=[1,0,0];return n!==void 0&&n>0&&(a=[1,0,1/(n*n)]),{type:"spot",position:o,direction:i,color:e,intensity:r,attenuation:a,innerConeAngle:s.innerConeAngle??0,outerConeAngle:s.outerConeAngle??Math.PI/4}}function Eo(t){let e=new Map;for(let r of t)for(let n of r.children||[])e.set(n.id,r);return e}function fn(t,e,r){let n=r.get(t.id);if(n)return n;let s=wo(t),o=e.get(t.id),i=o?new V(fn(o,e,r)).multiplyRight(s):s;return r.set(t.id,i),i}function wo(t){if(t.matrix)return new V(t.matrix);let e=new V;return t.translation&&e.translate(t.translation),t.rotation&&e.multiplyRight(new V().fromQuaternion(t.rotation)),t.scale&&e.scale(t.scale),e}function pn(t){return t.transformAsPoint([0,0,0])}function mn(t){return t.transformDirection([0,0,-1])}var X=k(oe(),1),xn=k($e(),1);function hn(t){switch(t){case R.POINTS:return"point-list";case R.LINES:return"line-list";case R.LINE_STRIP:return"line-strip";case R.TRIANGLES:return"triangle-list";case R.TRIANGLE_STRIP:return"triangle-strip";default:throw new Error(String(t))}}var D=k(G(),1),un=k(oe(),1),ue=k($e(),1),te=k(oe(),1),So=`
7
+ "use strict";var __exports__=(()=>{var Nn=Object.create;var Te=Object.defineProperty;var bn=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,vn=Object.prototype.hasOwnProperty;var Xe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Lt=(t,e)=>{for(var r in e)Te(t,r,{get:e[r],enumerable:!0})},Me=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ln(e))!vn.call(t,s)&&s!==r&&Te(t,s,{get:()=>e[s],enumerable:!(n=bn(e,s))||n.enumerable});return t},_e=(t,e,r)=>(Me(t,e,"default"),r&&Me(r,e,"default")),k=(t,e,r)=>(r=t!=null?Nn(In(t)):{},Me(e||!t||!t.__esModule?Te(r,"default",{value:t,enumerable:!0}):r,t)),Pn=t=>Me(Te({},"__esModule",{value:!0}),t);var Q=Xe((pi,It)=>{It.exports=globalThis.luma});var Z=Xe((mi,vt)=>{vt.exports=globalThis.luma});var De=Xe((Uc,fn)=>{fn.exports=globalThis.luma});var ge={};Lt(ge,{GLTFAnimator:()=>se,createScenegraphsFromGLTF:()=>Sn,getGLTFExtensionSupport:()=>Ye,loadPBREnvironment:()=>Gt,parseGLTFLights:()=>Ve,parsePBRMaterial:()=>ue});_e(ge,k(Q(),1));var it=k(Z(),1);async function Ge(t,e,r,n){return n._parse(t,e,r,n)}function j(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var $={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Cn=$.self||$.window||$.global||{},Fn=$.window||$.self||$.global||{},kn=$.global||$.self||$.window||{},Hn=$.document||{};var je=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Pt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Un=Pt&&parseFloat(Pt[1])||0;var zn="",Ct={};function ye(t){for(let e in Ct)if(t.startsWith(e)){let r=Ct[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${zn}${t}`),t}var J={};Lt(J,{dirname:()=>Kn,filename:()=>Bn,join:()=>$n,resolve:()=>Dn});function Ft(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=window.location?.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function Bn(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):t}function Kn(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function $n(...t){let e="/";return t=t.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${e}`),"")),n!==t.length-1&&(r=r.replace(new RegExp(`${e}$`),"")),r)),t.join(e)}function Dn(...t){let e=[];for(let o=0;o<t.length;o++)e[o]=t[o];let r="",n=!1,s;for(let o=e.length-1;o>=-1&&!n;o--){let i;o>=0?i=e[o]:(s===void 0&&(s=Ft()),i=s),i.length!==0&&(r=`${i}/${r}`,n=i.charCodeAt(0)===ae)}return r=Vn(r,!n),n?`/${r}`:r.length>0?r:"."}var ae=47,Je=46;function Vn(t,e){let r="",n=-1,s=0,o,i=!1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(o===ae)break;o=ae}if(o===ae){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!i||r.charCodeAt(r.length-1)!==Je||r.charCodeAt(r.length-2)!==Je){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==ae;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,s=0,i=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,s=0,i=!1;continue}}e&&(r.length>0?r+="/..":r="..",i=!0)}else{let c=t.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,i=!1}n=a,s=0}else o===Je&&s!==-1?++s:s=-1}return r}var kt="4.4.2";var qn=globalThis.loaders?.parseImageNode,Qe=typeof Image<"u",Ze=typeof ImageBitmap<"u",Wn=Boolean(qn),et=je?!0:Wn;function Ht(t){switch(t){case"auto":return Ze||Qe||et;case"imagebitmap":return Ze;case"image":return Qe;case"data":return et;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function Ut(){if(Ze)return"imagebitmap";if(Qe)return"image";if(et)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function zt(t){let e=Yn(t);if(!e)throw new Error("Not an image");return e}function Re(t){return Ae(t)}function Ae(t){switch(zt(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Yn(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Xn=/^data:image\/svg\+xml/,Gn=/\.svg((\?|#).*)?$/;function Ee(t){return t&&(Xn.test(t)||Gn.test(t))}function Bt(t,e){if(Ee(e)){let n=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return tt(t,e)}function tt(t,e){if(Ee(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function we(t,e,r){let n=Bt(t,r),s=self.URL||self.webkitURL,o=typeof n!="string"&&s.createObjectURL(n);try{return await jn(o||n,e)}finally{o&&s.revokeObjectURL(o)}}async function jn(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,s)=>{try{r.onload=()=>n(r),r.onerror=o=>{let i=o instanceof Error?o.message:"error";s(new Error(i))}}catch(o){s(o)}})}var Kt=!0;async function $t(t,e,r){let n;Ee(r)?n=await we(t,e,r):n=tt(t,r);let s=e&&e.imagebitmap;return await Jn(n,s)}async function Jn(t,e=null){if((Qn(e)||!Kt)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),Kt=!1}return await createImageBitmap(t)}function Qn(t){if(!t)return!0;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Dt(t){return!rs(t,"ftyp",4)||!(t[8]&96)?null:Zn(t)}function Zn(t){switch(es(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function es(t,e,r){return String.fromCharCode(...t.slice(e,r))}function ts(t){return[...t].map(e=>e.charCodeAt(0))}function rs(t,e,r=0){let n=ts(e);for(let s=0;s<n.length;++s)if(n[s]!==t[s+r])return!1;return!0}var D=!1,ce=!0;function Se(t){let e=le(t);return ss(e)||as(e)||os(e)||is(e)||ns(e)}function ns(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=Dt(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function ss(t){let e=le(t);return e.byteLength>=24&&e.getUint32(0,D)===2303741511?{mimeType:"image/png",width:e.getUint32(16,D),height:e.getUint32(20,D)}:null}function os(t){let e=le(t);return e.byteLength>=10&&e.getUint32(0,D)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,ce),height:e.getUint16(8,ce)}:null}function is(t){let e=le(t);return e.byteLength>=14&&e.getUint16(0,D)===16973&&e.getUint32(2,ce)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,ce),height:e.getUint32(22,ce)}:null}function as(t){let e=le(t);if(!(e.byteLength>=3&&e.getUint16(0,D)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=cs(),o=2;for(;o+9<e.byteLength;){let i=e.getUint16(o,D);if(s.has(i))return{mimeType:"image/jpeg",height:e.getUint16(o+5,D),width:e.getUint16(o+7,D)};if(!n.has(i))return null;o+=2,o+=e.getUint16(o,D)}return null}function cs(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function le(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function Vt(t,e){let{mimeType:r}=Se(t)||{},n=globalThis.loaders?.parseImageNode;return j(n),await n(t,r)}async function qt(t,e,r){e=e||{};let s=(e.image||{}).type||"auto",{url:o}=r||{},i=ls(s),a;switch(i){case"imagebitmap":a=await $t(t,e,o);break;case"image":a=await we(t,e,o);break;case"data":a=await Vt(t,e);break;default:j(!1)}return s==="data"&&(a=Ae(a)),a}function ls(t){switch(t){case"auto":case"data":return Ut();default:return Ht(t),t}}var fs=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],ps=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],ms={image:{type:"auto",decode:!0}},Oe={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:kt,mimeTypes:ps,extensions:fs,parse:qt,tests:[t=>Boolean(Se(new DataView(t)))],options:ms};var us=t=>t&&typeof t=="object";async function Wt(t,e,r={}){return await rt(t,e,r)}async function rt(t,e,r){return Array.isArray(t)?await xs(t,e,r):us(t)?await ds(t,e,r):await e(t,r)}async function ds(t,e,r){let n=[],s={};for(let o in t){let i=t[o],a=rt(i,e,r).then(c=>{s[o]=c});n.push(a)}return await Promise.all(n),s}async function xs(t,e,r={}){let n=t.map(s=>rt(s,e,r));return await Promise.all(n)}async function Yt(t,e={},r){let n=Ne(e);return await Wt(t,async s=>await nt(s,n,r))}async function nt(t,e={},r){let n=gs(t,e,r),o=await Rs(e,r)(n),i=As(e);if(r){let c=Es(n,o,r);return await Ge(o,[Oe],i,c)}let a=await o.arrayBuffer();return await Oe.parse(a,i)}function Ne(t={}){if(t.core?.baseUrl)return t;let e=t.baseUrl;return e?{...t,core:{...t.core,baseUrl:e}}:t}function gs(t,e={},r){let n=ye(t);if(ws(t))return n;let s=Ms(e,r);if(!s){if(n!==t||t.startsWith("@"))return n;throw new Error(`Unable to resolve relative image URL ${t} without a base URL`)}return ye(_s(s,t))}function Ms(t,e){return e?.baseUrl?e.baseUrl:t.baseUrl?st(t.baseUrl):t.core?.baseUrl?Ts(t.core.baseUrl):null}function st(t){return t.endsWith("/")?t.slice(0,-1):t}function Ts(t){return st(J.dirname(t))}function _s(t,e){if(ys(t))return new URL(e,`${st(t)}/`).toString();let r=t.startsWith("/")?t:`/${t}`,n=J.resolve(r,e);return t.startsWith("/")?n:n.slice(1)}function ys(t){return t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:")||t.startsWith("blob:")}function Rs(t,e){let r=t.fetch??t.core?.fetch;return e?.fetch?e.fetch:typeof r=="function"?r:r&&typeof r=="object"?n=>fetch(n,r):fetch}function As(t){let e=t.core,r={...t};if(delete r.baseUrl,!e?.baseUrl)return r;let n={...e};return delete n.baseUrl,{...r,core:n}}function Es(t,e,r){let n=e.url||t,[s,o=""]=n.split("?");return{...r,url:n,response:e,filename:J.filename(s),baseUrl:J.dirname(s),queryString:o}}function ws(t){return t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("file:")||t.startsWith("http:")||t.startsWith("https:")||t.startsWith("/")}function be(t,e,r){return typeof t=="function"?t({...e,...r}):t}async function fe(t,e={}){let r=await Ss(t,e);return await Yt(r,Ne(e))}async function Ss(t,e,r={}){let n=e&&e.image&&e.image.mipLevels||0;return n!==0?await Os(t,n,e,r):be(t,e,r)}async function Os(t,e,r,n){let s=[],o=Ne(r);if(e==="auto"){let i=be(t,r,{...n,lod:0}),a=await nt(i,o),{width:c,height:l}=Re(a);e=Ns({width:c,height:l}),s.push(i)}j(e>0);for(let i=s.length;i<e;++i){let a=be(t,r,{...n,lod:i});s.push(a)}return s}function Ns(t){return 1+Math.floor(Math.log2(Math.max(t.width,t.height)))}function Gt(t,e){let r=e.specularMipLevels??1,n=new it.DynamicTexture(t,{id:"brdfLUT",sampler:{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"linear",magFilter:"linear"},data:fe(ot(e.brdfLutUrl))}),s=Xt(t,{id:"DiffuseEnvSampler",getTextureForFace:i=>fe(ot(e.getTexUrl("diffuse",Le.indexOf(i),0))),sampler:{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"linear",magFilter:"linear"}}),o=Xt(t,{id:"SpecularEnvSampler",getTextureForFace:i=>{let a=[],c=Le.indexOf(i);for(let l=0;l<r;l++)a.push(fe(ot(e.getTexUrl("specular",c,l))));return Promise.all(a)},sampler:{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"linear",magFilter:"linear"}});return{brdfLutTexture:n,diffuseEnvSampler:s,specularEnvSampler:o}}var Le=["+X","-X","+Y","-Y","+Z","-Z"];function ot(t){let e=globalThis.document?.baseURI??globalThis.location?.href;return e?new URL(t,e).toString():t}function Xt(t,{id:e,getTextureForFace:r,sampler:n}){let s=Promise.all(Le.map(o=>r(o))).then(o=>{let i={};return Le.forEach((a,c)=>{i[a]=o[c]}),i});return new it.DynamicTexture(t,{id:e,dimension:"cube",mipmaps:!1,sampler:n,data:s})}var O=k(Q(),1);var R;(function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST=9728]="NEAREST",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(R||(R={}));function Jt(t){return{addressModeU:jt(t.wrapS),addressModeV:jt(t.wrapT),magFilter:bs(t.magFilter),...Ls(t.minFilter)}}function jt(t){switch(t){case R.CLAMP_TO_EDGE:return"clamp-to-edge";case R.REPEAT:return"repeat";case R.MIRRORED_REPEAT:return"mirror-repeat";default:return}}function bs(t){switch(t){case R.NEAREST:return"nearest";case R.LINEAR:return"linear";default:return}}function Ls(t){switch(t){case R.NEAREST:return{minFilter:"nearest"};case R.LINEAR:return{minFilter:"linear"};case R.NEAREST_MIPMAP_NEAREST:return{minFilter:"nearest",mipmapFilter:"nearest"};case R.LINEAR_MIPMAP_NEAREST:return{minFilter:"linear",mipmapFilter:"nearest"};case R.NEAREST_MIPMAP_LINEAR:return{minFilter:"nearest",mipmapFilter:"linear"};case R.LINEAR_MIPMAP_LINEAR:return{minFilter:"linear",mipmapFilter:"linear"};default:return{}}}var Ea=1/Math.PI*180,wa=1/180*Math.PI,Is={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Is}};var N=globalThis.mathgl.config;function Qt(t,{precision:e=N.precision}={}){return t=vs(t),`${parseFloat(t.toPrecision(e))}`}function ee(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function at(t,e,r){let n=N.EPSILON;r&&(N.EPSILON=r);try{if(t===e)return!0;if(ee(t)&&ee(e)){if(t.length!==e.length)return!1;for(let s=0;s<t.length;++s)if(!at(t[s],e[s]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=N.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{N.EPSILON=n}}function vs(t){return Math.round(t/N.EPSILON)*N.EPSILON}var Y=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+r];return this.check()}toArray(e=[],r=0){for(let n=0;n<this.ELEMENTS;++n)e[r+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:ee(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(N)}formatString(e){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Qt(this[n],e);return`${e.printTypes?this.constructor.name:""}[${r}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!at(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,n){if(n===void 0)return this.lerp(this,e,r);for(let s=0;s<this.ELEMENTS;++s){let o=e[s],i=typeof r=="number"?r:r[s];this[s]=o+n*(i-o)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),r[n]);return this.check()}add(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(N.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),r);return this.check()}get elements(){return this}};function Ps(t,e){if(t.length!==e)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}function w(t){if(!Number.isFinite(t))throw new Error(`Invalid number ${JSON.stringify(t)}`);return t}function X(t,e,r=""){if(N.debug&&!Ps(t,e))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return t}function ct(t,e){if(!t)throw new Error(`math.gl assertion ${e}`)}var Ie=class extends Y{get x(){return this[0]}set x(e){this[0]=w(e)}get y(){return this[1]}set y(e){this[1]=w(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*this[r];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let r=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-e[n];r+=s*s}return w(r)}dot(e){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*e[n];return w(r)}normalize(){let e=this.magnitude();if(e!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=e;return this.check()}multiply(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return ct(e>=0&&e<this.ELEMENTS,"index is out of range"),w(this[e])}setComponent(e,r){return ct(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=r,this.check()}addVectors(e,r){return this.copy(e).add(r)}subVectors(e,r){return this.copy(e).subtract(r)}multiplyVectors(e,r){return this.copy(e).multiply(r)}addScaledVector(e,r){return this.add(new this.constructor(e).multiplyScalar(r))}};var I=typeof Float32Array<"u"?Float32Array:Array;var ka=Math.PI/180;function Cs(){let t=new I(2);return I!=Float32Array&&(t[0]=0,t[1]=0),t}function tr(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[3]*s+r[6],t[1]=r[1]*n+r[4]*s+r[7],t}function rr(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[4]*s+r[12],t[1]=r[1]*n+r[5]*s+r[13],t}var Ha=function(){let t=Cs();return function(e,r,n,s,o,i){let a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],o(t,t,i),e[a]=t[0],e[a+1]=t[1];return e}}();function nr(t,e,r){let n=e[0],s=e[1],o=r[3]*n+r[7]*s||1;return t[0]=(r[0]*n+r[4]*s)/o,t[1]=(r[1]*n+r[5]*s)/o,t}function sr(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[3]*n+r[7]*s+r[11]*o||1;return t[0]=(r[0]*n+r[4]*s+r[8]*o)/i,t[1]=(r[1]*n+r[5]*s+r[9]*o)/i,t[2]=(r[2]*n+r[6]*s+r[10]*o)/i,t}function or(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t[2]=e[2],t[3]=e[3],t}function ve(t,e,r){let n=e[0],s=e[1],o=e[2];return t[0]=r[0]*n+r[3]*s+r[6]*o,t[1]=r[1]*n+r[4]*s+r[7]*o,t[2]=r[2]*n+r[5]*s+r[8]*o,t[3]=e[3],t}function lt(){let t=new I(3);return I!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Fs(t){let e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function ft(t,e,r){let n=new I(3);return n[0]=t,n[1]=e,n[2]=r,n}function ir(t,e){let r=e[0],n=e[1],s=e[2],o=r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function ar(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Pe(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[0],a=r[1],c=r[2];return t[0]=s*c-o*a,t[1]=o*i-n*c,t[2]=n*a-s*i,t}function Ce(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[3]*n+r[7]*s+r[11]*o+r[15];return i=i||1,t[0]=(r[0]*n+r[4]*s+r[8]*o+r[12])/i,t[1]=(r[1]*n+r[5]*s+r[9]*o+r[13])/i,t[2]=(r[2]*n+r[6]*s+r[10]*o+r[14])/i,t}function cr(t,e,r){let n=e[0],s=e[1],o=e[2];return t[0]=n*r[0]+s*r[3]+o*r[6],t[1]=n*r[1]+s*r[4]+o*r[7],t[2]=n*r[2]+s*r[5]+o*r[8],t}function lr(t,e,r){let n=r[0],s=r[1],o=r[2],i=r[3],a=e[0],c=e[1],l=e[2],m=s*l-o*c,p=o*a-n*l,f=n*c-s*a,h=s*f-o*p,u=o*m-n*f,d=n*p-s*m,x=i*2;return m*=x,p*=x,f*=x,h*=2,u*=2,d*=2,t[0]=a+m+h,t[1]=c+p+u,t[2]=l+f+d,t}var fr=Fs;var Ba=function(){let t=lt();return function(e,r,n,s,o,i){let a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],o(t,t,i),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2];return e}}();var Fe,te=class extends Ie{static get ZERO(){return Fe||(Fe=new te(0,0,0,0),Object.freeze(Fe)),Fe}constructor(e=0,r=0,n=0,s=0){super(-0,-0,-0,-0),ee(e)&&arguments.length===1?this.copy(e):(N.debug&&(w(e),w(r),w(n),w(s)),this[0]=e,this[1]=r,this[2]=n,this[3]=s)}set(e,r,n,s){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return N.debug&&(w(e.x),w(e.y),w(e.z),w(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=w(e)}get w(){return this[3]}set w(e){this[3]=w(e)}transform(e){return Ce(this,this,e),this.check()}transformByMatrix3(e){return ve(this,this,e),this.check()}transformByMatrix2(e){return or(this,this,e),this.check()}transformByQuaternion(e){return lr(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}};var re=class extends Y{toString(){let e="[";if(N.printRowMajor){e+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)e+=` ${this[n*this.RANK+r]}`}else{e+="column-major:";for(let r=0;r<this.ELEMENTS;++r)e+=` ${this[r]}`}return e+="]",e}getElementIndex(e,r){return r*this.RANK+e}getElement(e,r){return this[r*this.RANK+e]}setElement(e,r,n){return this[r*this.RANK+e]=w(n),this}getColumn(e,r=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)r[s]=this[n+s];return r}setColumn(e,r){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=r[s];return this}};function pr(){let t=new I(9);return I!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function mr(t,e){if(t===e){let r=e[1],n=e[2],s=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=s}else 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];return t}function hr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=e[4],a=e[5],c=e[6],l=e[7],m=e[8],p=m*i-a*l,f=-m*o+a*c,h=l*o-i*c,u=r*p+n*f+s*h;return u?(u=1/u,t[0]=p*u,t[1]=(-m*n+s*l)*u,t[2]=(a*n-s*i)*u,t[3]=f*u,t[4]=(m*r-s*c)*u,t[5]=(-a*r+s*o)*u,t[6]=h*u,t[7]=(-l*r+n*c)*u,t[8]=(i*r-n*o)*u,t):null}function ur(t){let e=t[0],r=t[1],n=t[2],s=t[3],o=t[4],i=t[5],a=t[6],c=t[7],l=t[8];return e*(l*o-i*c)+r*(-l*s+i*a)+n*(c*s-o*a)}function pt(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],m=e[7],p=e[8],f=r[0],h=r[1],u=r[2],d=r[3],x=r[4],g=r[5],A=r[6],M=r[7],T=r[8];return t[0]=f*n+h*i+u*l,t[1]=f*s+h*a+u*m,t[2]=f*o+h*c+u*p,t[3]=d*n+x*i+g*l,t[4]=d*s+x*a+g*m,t[5]=d*o+x*c+g*p,t[6]=A*n+M*i+T*l,t[7]=A*s+M*a+T*m,t[8]=A*o+M*c+T*p,t}function dr(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],m=e[7],p=e[8],f=r[0],h=r[1];return t[0]=n,t[1]=s,t[2]=o,t[3]=i,t[4]=a,t[5]=c,t[6]=f*n+h*i+l,t[7]=f*s+h*a+m,t[8]=f*o+h*c+p,t}function xr(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],m=e[7],p=e[8],f=Math.sin(r),h=Math.cos(r);return t[0]=h*n+f*i,t[1]=h*s+f*a,t[2]=h*o+f*c,t[3]=h*i-f*n,t[4]=h*a-f*s,t[5]=h*c-f*o,t[6]=l,t[7]=m,t[8]=p,t}function mt(t,e,r){let n=r[0],s=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=s*e[3],t[4]=s*e[4],t[5]=s*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function gr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r+r,a=n+n,c=s+s,l=r*i,m=n*i,p=n*a,f=s*i,h=s*a,u=s*c,d=o*i,x=o*a,g=o*c;return t[0]=1-p-u,t[3]=m-g,t[6]=f+x,t[1]=m+g,t[4]=1-l-u,t[7]=h-d,t[2]=f-x,t[5]=h+d,t[8]=1-l-p,t}var ht;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL1ROW0=3]="COL1ROW0",t[t.COL1ROW1=4]="COL1ROW1",t[t.COL1ROW2=5]="COL1ROW2",t[t.COL2ROW0=6]="COL2ROW0",t[t.COL2ROW1=7]="COL2ROW1",t[t.COL2ROW2=8]="COL2ROW2"})(ht||(ht={}));var Us=Object.freeze([1,0,0,0,1,0,0,0,1]),H=class extends re{static get IDENTITY(){return Bs()}static get ZERO(){return zs()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return ht}constructor(e,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):r.length>0?this.copy([e,...r]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(Us)}fromObject(e){return this.check()}fromQuaternion(e){return gr(this,e),this.check()}set(e,r,n,s,o,i,a,c,l){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this[4]=o,this[5]=i,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(e,r,n,s,o,i,a,c,l){return this[0]=e,this[1]=s,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=i,this[8]=l,this.check()}determinant(){return ur(this)}transpose(){return mr(this,this),this.check()}invert(){return hr(this,this),this.check()}multiplyLeft(e){return pt(this,e,this),this.check()}multiplyRight(e){return pt(this,this,e),this.check()}rotate(e){return xr(this,this,e),this.check()}scale(e){return Array.isArray(e)?mt(this,this,e):mt(this,this,[e,e]),this.check()}translate(e){return dr(this,this,e),this.check()}transform(e,r){let n;switch(e.length){case 2:n=tr(r||[-0,-0],e,this);break;case 3:n=cr(r||[-0,-0,-0],e,this);break;case 4:n=ve(r||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return X(n,e.length),n}transformVector(e,r){return this.transform(e,r)}transformVector2(e,r){return this.transform(e,r)}transformVector3(e,r){return this.transform(e,r)}},ke,He=null;function zs(){return ke||(ke=new H([0,0,0,0,0,0,0,0,0]),Object.freeze(ke)),ke}function Bs(){return He||(He=new H,Object.freeze(He)),He}function Ks(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Mr(t,e){if(t===e){let r=e[1],n=e[2],s=e[3],o=e[6],i=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=s,t[13]=i,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Tr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=e[4],a=e[5],c=e[6],l=e[7],m=e[8],p=e[9],f=e[10],h=e[11],u=e[12],d=e[13],x=e[14],g=e[15],A=r*a-n*i,M=r*c-s*i,T=r*l-o*i,_=n*c-s*a,y=n*l-o*a,v=s*l-o*c,P=m*d-p*u,C=m*x-f*u,F=m*g-h*u,U=p*x-f*d,z=p*g-h*d,B=f*g-h*x,E=A*B-M*z+T*U+_*F-y*C+v*P;return E?(E=1/E,t[0]=(a*B-c*z+l*U)*E,t[1]=(s*z-n*B-o*U)*E,t[2]=(d*v-x*y+g*_)*E,t[3]=(f*y-p*v-h*_)*E,t[4]=(c*F-i*B-l*C)*E,t[5]=(r*B-s*F+o*C)*E,t[6]=(x*T-u*v-g*M)*E,t[7]=(m*v-f*T+h*M)*E,t[8]=(i*z-a*F+l*P)*E,t[9]=(n*F-r*z-o*P)*E,t[10]=(u*y-d*T+g*A)*E,t[11]=(p*T-m*y-h*A)*E,t[12]=(a*C-i*U-c*P)*E,t[13]=(r*U-n*C+s*P)*E,t[14]=(d*M-u*_-x*A)*E,t[15]=(m*_-p*M+f*A)*E,t):null}function _r(t){let e=t[0],r=t[1],n=t[2],s=t[3],o=t[4],i=t[5],a=t[6],c=t[7],l=t[8],m=t[9],p=t[10],f=t[11],h=t[12],u=t[13],d=t[14],x=t[15],g=e*i-r*o,A=e*a-n*o,M=r*a-n*i,T=l*u-m*h,_=l*d-p*h,y=m*d-p*u,v=e*y-r*_+n*T,P=o*y-i*_+a*T,C=l*M-m*A+p*g,F=h*M-u*A+d*g;return c*v-s*P+x*C-f*F}function ut(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],m=e[7],p=e[8],f=e[9],h=e[10],u=e[11],d=e[12],x=e[13],g=e[14],A=e[15],M=r[0],T=r[1],_=r[2],y=r[3];return t[0]=M*n+T*a+_*p+y*d,t[1]=M*s+T*c+_*f+y*x,t[2]=M*o+T*l+_*h+y*g,t[3]=M*i+T*m+_*u+y*A,M=r[4],T=r[5],_=r[6],y=r[7],t[4]=M*n+T*a+_*p+y*d,t[5]=M*s+T*c+_*f+y*x,t[6]=M*o+T*l+_*h+y*g,t[7]=M*i+T*m+_*u+y*A,M=r[8],T=r[9],_=r[10],y=r[11],t[8]=M*n+T*a+_*p+y*d,t[9]=M*s+T*c+_*f+y*x,t[10]=M*o+T*l+_*h+y*g,t[11]=M*i+T*m+_*u+y*A,M=r[12],T=r[13],_=r[14],y=r[15],t[12]=M*n+T*a+_*p+y*d,t[13]=M*s+T*c+_*f+y*x,t[14]=M*o+T*l+_*h+y*g,t[15]=M*i+T*m+_*u+y*A,t}function yr(t,e,r){let n=r[0],s=r[1],o=r[2],i,a,c,l,m,p,f,h,u,d,x,g;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*o+e[12],t[13]=e[1]*n+e[5]*s+e[9]*o+e[13],t[14]=e[2]*n+e[6]*s+e[10]*o+e[14],t[15]=e[3]*n+e[7]*s+e[11]*o+e[15]):(i=e[0],a=e[1],c=e[2],l=e[3],m=e[4],p=e[5],f=e[6],h=e[7],u=e[8],d=e[9],x=e[10],g=e[11],t[0]=i,t[1]=a,t[2]=c,t[3]=l,t[4]=m,t[5]=p,t[6]=f,t[7]=h,t[8]=u,t[9]=d,t[10]=x,t[11]=g,t[12]=i*n+m*s+u*o+e[12],t[13]=a*n+p*s+d*o+e[13],t[14]=c*n+f*s+x*o+e[14],t[15]=l*n+h*s+g*o+e[15]),t}function Rr(t,e,r){let n=r[0],s=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Ar(t,e,r,n){let s=n[0],o=n[1],i=n[2],a=Math.sqrt(s*s+o*o+i*i),c,l,m,p,f,h,u,d,x,g,A,M,T,_,y,v,P,C,F,U,z,B,E,ie;return a<1e-6?null:(a=1/a,s*=a,o*=a,i*=a,l=Math.sin(r),c=Math.cos(r),m=1-c,p=e[0],f=e[1],h=e[2],u=e[3],d=e[4],x=e[5],g=e[6],A=e[7],M=e[8],T=e[9],_=e[10],y=e[11],v=s*s*m+c,P=o*s*m+i*l,C=i*s*m-o*l,F=s*o*m-i*l,U=o*o*m+c,z=i*o*m+s*l,B=s*i*m+o*l,E=o*i*m-s*l,ie=i*i*m+c,t[0]=p*v+d*P+M*C,t[1]=f*v+x*P+T*C,t[2]=h*v+g*P+_*C,t[3]=u*v+A*P+y*C,t[4]=p*F+d*U+M*z,t[5]=f*F+x*U+T*z,t[6]=h*F+g*U+_*z,t[7]=u*F+A*U+y*z,t[8]=p*B+d*E+M*ie,t[9]=f*B+x*E+T*ie,t[10]=h*B+g*E+_*ie,t[11]=u*B+A*E+y*ie,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Er(t,e,r){let n=Math.sin(r),s=Math.cos(r),o=e[4],i=e[5],a=e[6],c=e[7],l=e[8],m=e[9],p=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*s+l*n,t[5]=i*s+m*n,t[6]=a*s+p*n,t[7]=c*s+f*n,t[8]=l*s-o*n,t[9]=m*s-i*n,t[10]=p*s-a*n,t[11]=f*s-c*n,t}function wr(t,e,r){let n=Math.sin(r),s=Math.cos(r),o=e[0],i=e[1],a=e[2],c=e[3],l=e[8],m=e[9],p=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*s-l*n,t[1]=i*s-m*n,t[2]=a*s-p*n,t[3]=c*s-f*n,t[8]=o*n+l*s,t[9]=i*n+m*s,t[10]=a*n+p*s,t[11]=c*n+f*s,t}function Sr(t,e,r){let n=Math.sin(r),s=Math.cos(r),o=e[0],i=e[1],a=e[2],c=e[3],l=e[4],m=e[5],p=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*s+l*n,t[1]=i*s+m*n,t[2]=a*s+p*n,t[3]=c*s+f*n,t[4]=l*s-o*n,t[5]=m*s-i*n,t[6]=p*s-a*n,t[7]=f*s-c*n,t}function Or(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r+r,a=n+n,c=s+s,l=r*i,m=n*i,p=n*a,f=s*i,h=s*a,u=s*c,d=o*i,x=o*a,g=o*c;return t[0]=1-p-u,t[1]=m+g,t[2]=f-x,t[3]=0,t[4]=m-g,t[5]=1-l-u,t[6]=h+d,t[7]=0,t[8]=f+x,t[9]=h-d,t[10]=1-l-p,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Nr(t,e,r,n,s,o,i){let a=1/(r-e),c=1/(s-n),l=1/(o-i);return t[0]=o*2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(s+n)*c,t[10]=(i+o)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*o*2*l,t[15]=0,t}function $s(t,e,r,n,s){let o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0){let i=1/(n-s);t[10]=(s+n)*i,t[14]=2*s*n*i}else t[10]=-1,t[14]=-2*n;return t}var br=$s;function Ds(t,e,r,n,s,o,i){let a=1/(e-r),c=1/(n-s),l=1/(o-i);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*a,t[13]=(s+n)*c,t[14]=(i+o)*l,t[15]=1,t}var Lr=Ds;function Ir(t,e,r,n){let s,o,i,a,c,l,m,p,f,h,u=e[0],d=e[1],x=e[2],g=n[0],A=n[1],M=n[2],T=r[0],_=r[1],y=r[2];return Math.abs(u-T)<1e-6&&Math.abs(d-_)<1e-6&&Math.abs(x-y)<1e-6?Ks(t):(p=u-T,f=d-_,h=x-y,s=1/Math.sqrt(p*p+f*f+h*h),p*=s,f*=s,h*=s,o=A*h-M*f,i=M*p-g*h,a=g*f-A*p,s=Math.sqrt(o*o+i*i+a*a),s?(s=1/s,o*=s,i*=s,a*=s):(o=0,i=0,a=0),c=f*a-h*i,l=h*o-p*a,m=p*i-f*o,s=Math.sqrt(c*c+l*l+m*m),s?(s=1/s,c*=s,l*=s,m*=s):(c=0,l=0,m=0),t[0]=o,t[1]=c,t[2]=p,t[3]=0,t[4]=i,t[5]=l,t[6]=f,t[7]=0,t[8]=a,t[9]=m,t[10]=h,t[11]=0,t[12]=-(o*u+i*d+a*x),t[13]=-(c*u+l*d+m*x),t[14]=-(p*u+f*d+h*x),t[15]=1,t)}function Vs(){let t=new I(4);return I!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function vr(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function Pr(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function Cr(t){let e=t[0],r=t[1],n=t[2],s=t[3];return Math.sqrt(e*e+r*r+n*n+s*s)}function Fr(t){let e=t[0],r=t[1],n=t[2],s=t[3];return e*e+r*r+n*n+s*s}function kr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r*r+n*n+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),t[0]=r*i,t[1]=n*i,t[2]=s*i,t[3]=o*i,t}function Hr(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Ur(t,e,r,n){let s=e[0],o=e[1],i=e[2],a=e[3];return t[0]=s+n*(r[0]-s),t[1]=o+n*(r[1]-o),t[2]=i+n*(r[2]-i),t[3]=a+n*(r[3]-a),t}function zr(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3];return t[0]=r[0]*n+r[4]*s+r[8]*o+r[12]*i,t[1]=r[1]*n+r[5]*s+r[9]*o+r[13]*i,t[2]=r[2]*n+r[6]*s+r[10]*o+r[14]*i,t[3]=r[3]*n+r[7]*s+r[11]*o+r[15]*i,t}function Br(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[0],a=r[1],c=r[2],l=r[3],m=l*n+a*o-c*s,p=l*s+c*n-i*o,f=l*o+i*s-a*n,h=-i*n-a*s-c*o;return t[0]=m*l+h*-i+p*-c-f*-a,t[1]=p*l+h*-a+f*-i-m*-c,t[2]=f*l+h*-c+m*-a-p*-i,t[3]=e[3],t}var oc=function(){let t=Vs();return function(e,r,n,s,o,i){let a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],o(t,t,i),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e}}();var gt;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(gt||(gt={}));var Ws=45*Math.PI/180,Ys=1,dt=.1,xt=500,Xs=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),V=class extends re{static get IDENTITY(){return js()}static get ZERO(){return Gs()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return gt}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,r,n,s,o,i,a,c,l,m,p,f,h,u,d,x){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this[4]=o,this[5]=i,this[6]=a,this[7]=c,this[8]=l,this[9]=m,this[10]=p,this[11]=f,this[12]=h,this[13]=u,this[14]=d,this[15]=x,this.check()}setRowMajor(e,r,n,s,o,i,a,c,l,m,p,f,h,u,d,x){return this[0]=e,this[1]=o,this[2]=l,this[3]=h,this[4]=r,this[5]=i,this[6]=m,this[7]=u,this[8]=n,this[9]=a,this[10]=p,this[11]=d,this[12]=s,this[13]=c,this[14]=f,this[15]=x,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(Xs)}fromObject(e){return this.check()}fromQuaternion(e){return Or(this,e),this.check()}frustum(e){let{left:r,right:n,bottom:s,top:o,near:i=dt,far:a=xt}=e;return a===1/0?Js(this,r,n,s,o,i):Nr(this,r,n,s,o,i,a),this.check()}lookAt(e){let{eye:r,center:n=[0,0,0],up:s=[0,1,0]}=e;return Ir(this,r,n,s),this.check()}ortho(e){let{left:r,right:n,bottom:s,top:o,near:i=dt,far:a=xt}=e;return Lr(this,r,n,s,o,i,a),this.check()}orthographic(e){let{fovy:r=Ws,aspect:n=Ys,focalDistance:s=1,near:o=dt,far:i=xt}=e;Kr(r);let a=r/2,c=s*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:o,far:i})}perspective(e){let{fovy:r=45*Math.PI/180,aspect:n=1,near:s=.1,far:o=500}=e;return Kr(r),br(this,r,n,s,o),this.check()}determinant(){return _r(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return e[0]=this[0]*s,e[1]=this[1]*o,e[2]=this[2]*i,e[3]=0,e[4]=this[4]*s,e[5]=this[5]*o,e[6]=this[6]*i,e[7]=0,e[8]=this[8]*s,e[9]=this[9]*o,e[10]=this[10]*i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return e[0]=this[0]*s,e[1]=this[1]*o,e[2]=this[2]*i,e[3]=this[4]*s,e[4]=this[5]*o,e[5]=this[6]*i,e[6]=this[8]*s,e[7]=this[9]*o,e[8]=this[10]*i,e}transpose(){return Mr(this,this),this.check()}invert(){return Tr(this,this),this.check()}multiplyLeft(e){return ut(this,e,this),this.check()}multiplyRight(e){return ut(this,this,e),this.check()}rotateX(e){return Er(this,this,e),this.check()}rotateY(e){return wr(this,this,e),this.check()}rotateZ(e){return Sr(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,r){return Ar(this,this,e,r),this.check()}scale(e){return Rr(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return yr(this,this,e),this.check()}transform(e,r){return e.length===4?(r=zr(r||[-0,-0,-0,-0],e,this),X(r,4),r):this.transformAsPoint(e,r)}transformAsPoint(e,r){let{length:n}=e,s;switch(n){case 2:s=rr(r||[-0,-0],e,this);break;case 3:s=Ce(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return X(s,e.length),s}transformAsVector(e,r){let n;switch(e.length){case 2:n=nr(r||[-0,-0],e,this);break;case 3:n=sr(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return X(n,e.length),n}transformPoint(e,r){return this.transformAsPoint(e,r)}transformVector(e,r){return this.transformAsPoint(e,r)}transformDirection(e,r){return this.transformAsVector(e,r)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,r,n){return this.identity().translate([e,r,n])}},Ue,ze;function Gs(){return Ue||(Ue=new V([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Ue)),Ue}function js(){return ze||(ze=new V,Object.freeze(ze)),ze}function Kr(t){if(t>Math.PI*2)throw Error("expected radians")}function Js(t,e,r,n,s,o){let i=2*o/(r-e),a=2*o/(s-n),c=(r+e)/(r-e),l=(s+n)/(s-n),m=-1,p=-1,f=-2*o;return t[0]=i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=l,t[10]=m,t[11]=p,t[12]=0,t[13]=0,t[14]=f,t[15]=0,t}function $r(){let t=new I(4);return I!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Dr(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function Mt(t,e,r){r=r*.5;let n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function Tt(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=r[0],c=r[1],l=r[2],m=r[3];return t[0]=n*m+i*a+s*l-o*c,t[1]=s*m+i*c+o*a-n*l,t[2]=o*m+i*l+n*c-s*a,t[3]=i*m-n*a-s*c-o*l,t}function Vr(t,e,r){r*=.5;let n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+i*a,t[1]=s*c+o*a,t[2]=o*c-s*a,t[3]=i*c-n*a,t}function qr(t,e,r){r*=.5;let n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c-o*a,t[1]=s*c+i*a,t[2]=o*c+n*a,t[3]=i*c-s*a,t}function Wr(t,e,r){r*=.5;let n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+s*a,t[1]=s*c-n*a,t[2]=o*c+i*a,t[3]=i*c-o*a,t}function Yr(t,e){let r=e[0],n=e[1],s=e[2];return t[0]=r,t[1]=n,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),t}function me(t,e,r,n){let s=e[0],o=e[1],i=e[2],a=e[3],c=r[0],l=r[1],m=r[2],p=r[3],f,h,u,d,x;return f=s*c+o*l+i*m+a*p,f<0&&(f=-f,c=-c,l=-l,m=-m,p=-p),1-f>1e-6?(h=Math.acos(f),x=Math.sin(h),u=Math.sin((1-n)*h)/x,d=Math.sin(n*h)/x):(u=1-n,d=n),t[0]=u*s+d*c,t[1]=u*o+d*l,t[2]=u*i+d*m,t[3]=u*a+d*p,t}function Xr(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r*r+n*n+s*s+o*o,a=i?1/i:0;return t[0]=-r*a,t[1]=-n*a,t[2]=-s*a,t[3]=o*a,t}function Gr(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function _t(t,e){let r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{let s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;n=Math.sqrt(e[s*3+s]-e[o*3+o]-e[i*3+i]+1),t[s]=.5*n,n=.5/n,t[3]=(e[o*3+i]-e[i*3+o])*n,t[o]=(e[o*3+s]+e[s*3+o])*n,t[i]=(e[i*3+s]+e[s*3+i])*n}return t}var jr=vr;var Jr=Pr,Qr=Hr,Zr=Ur,en=Cr;var tn=Fr;var rn=kr;var nn=function(){let t=lt(),e=ft(1,0,0),r=ft(0,1,0);return function(n,s,o){let i=ar(s,o);return i<-.999999?(Pe(t,e,s),fr(t)<1e-6&&Pe(t,r,s),ir(t,t),Mt(n,t,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Pe(t,s,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+i,rn(n,n))}}(),Tc=function(){let t=$r(),e=$r();return function(r,n,s,o,i,a){return me(t,n,i,a),me(e,s,o,a),me(r,t,e,2*a*(1-a)),r}}(),_c=function(){let t=pr();return function(e,r,n,s){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=s[0],t[4]=s[1],t[7]=s[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],rn(e,_t(e,t))}}();var Qs=[0,0,0,1],he=class extends Y{constructor(e=0,r=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,r,n,s)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,r,n,s){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return _t(this,e),this.check()}fromAxisRotation(e,r){return Mt(this,e,r),this.check()}identity(){return Dr(this),this.check()}setAxisAngle(e,r){return this.fromAxisRotation(e,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=w(e)}get y(){return this[1]}set y(e){this[1]=w(e)}get z(){return this[2]}set z(e){this[2]=w(e)}get w(){return this[3]}set w(e){this[3]=w(e)}len(){return en(this)}lengthSquared(){return tn(this)}dot(e){return Qr(this,e)}rotationTo(e,r){return nn(this,e,r),this.check()}add(e){return jr(this,this,e),this.check()}calculateW(){return Yr(this,this),this.check()}conjugate(){return Gr(this,this),this.check()}invert(){return Xr(this,this),this.check()}lerp(e,r,n){return n===void 0?this.lerp(this,e,r):(Zr(this,e,r,n),this.check())}multiplyRight(e){return Tt(this,this,e),this.check()}multiplyLeft(e){return Tt(this,e,this),this.check()}normalize(){let e=this.len(),r=e>0?1/e:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,e===0&&(this[3]=1),this.check()}rotateX(e){return Vr(this,this,e),this.check()}rotateY(e){return qr(this,this,e),this.check()}rotateZ(e){return Wr(this,this,e),this.check()}scale(e){return Jr(this,this,e),this.check()}slerp(e,r,n){let s,o,i;switch(arguments.length){case 1:({start:s=Qs,target:o,ratio:i}=e);break;case 2:s=this,o=e,i=r;break;default:s=e,o=r,i=n}return me(this,s,o,i),this.check()}transformVector4(e,r=new te){return Br(r,e,this),X(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,r){return this.setAxisAngle(e,r)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}};var yt=[b("baseColor","pbr_baseColorSampler","baseColorTexture",["pbrMetallicRoughness","baseColorTexture"]),b("metallicRoughness","pbr_metallicRoughnessSampler","metallicRoughnessTexture",["pbrMetallicRoughness","metallicRoughnessTexture"]),b("normal","pbr_normalSampler","normalTexture",["normalTexture"]),b("occlusion","pbr_occlusionSampler","occlusionTexture",["occlusionTexture"]),b("emissive","pbr_emissiveSampler","emissiveTexture",["emissiveTexture"]),b("specularColor","pbr_specularColorSampler","KHR_materials_specular.specularColorTexture",["extensions","KHR_materials_specular","specularColorTexture"]),b("specularIntensity","pbr_specularIntensitySampler","KHR_materials_specular.specularTexture",["extensions","KHR_materials_specular","specularTexture"]),b("transmission","pbr_transmissionSampler","KHR_materials_transmission.transmissionTexture",["extensions","KHR_materials_transmission","transmissionTexture"]),b("thickness","pbr_thicknessSampler","KHR_materials_volume.thicknessTexture",["extensions","KHR_materials_volume","thicknessTexture"]),b("clearcoat","pbr_clearcoatSampler","KHR_materials_clearcoat.clearcoatTexture",["extensions","KHR_materials_clearcoat","clearcoatTexture"]),b("clearcoatRoughness","pbr_clearcoatRoughnessSampler","KHR_materials_clearcoat.clearcoatRoughnessTexture",["extensions","KHR_materials_clearcoat","clearcoatRoughnessTexture"]),b("clearcoatNormal","pbr_clearcoatNormalSampler","KHR_materials_clearcoat.clearcoatNormalTexture",["extensions","KHR_materials_clearcoat","clearcoatNormalTexture"]),b("sheenColor","pbr_sheenColorSampler","KHR_materials_sheen.sheenColorTexture",["extensions","KHR_materials_sheen","sheenColorTexture"]),b("sheenRoughness","pbr_sheenRoughnessSampler","KHR_materials_sheen.sheenRoughnessTexture",["extensions","KHR_materials_sheen","sheenRoughnessTexture"]),b("iridescence","pbr_iridescenceSampler","KHR_materials_iridescence.iridescenceTexture",["extensions","KHR_materials_iridescence","iridescenceTexture"]),b("iridescenceThickness","pbr_iridescenceThicknessSampler","KHR_materials_iridescence.iridescenceThicknessTexture",["extensions","KHR_materials_iridescence","iridescenceThicknessTexture"]),b("anisotropy","pbr_anisotropySampler","KHR_materials_anisotropy.anisotropyTexture",["extensions","KHR_materials_anisotropy","anisotropyTexture"])],Zs=new Map(yt.map(t=>[t.slot,t]));function b(t,e,r,n){return{slot:t,binding:e,displayName:r,pathSegments:n,uvSetUniform:`${t}UVSet`,uvTransformUniform:`${t}UVTransform`}}function sn(){return yt}function Ke(t){let e=Zs.get(t);if(!e)throw new Error(`Unknown PBR texture transform slot ${t}`);return e}function $e(t){let e=t?.extensions?.KHR_texture_transform;return{offset:e?.offset?[e.offset[0],e.offset[1]]:[0,0],rotation:e?.rotation??0,scale:e?.scale?[e.scale[0],e.scale[1]]:[1,1]}}function Rt(t){return t?.extensions?.KHR_texture_transform?.texCoord??t?.texCoord??0}function on(t){return yt.find(e=>e.pathSegments.length===t.length&&e.pathSegments.every((r,n)=>t[n]===r))||null}function Be(t){let e=new H().set(1,0,0,0,1,0,t.offset[0],t.offset[1],1),r=new H().set(Math.cos(t.rotation),Math.sin(t.rotation),0,-Math.sin(t.rotation),Math.cos(t.rotation),0,0,0,1),n=new H().set(t.scale[0],0,0,0,t.scale[1],0,0,0,1);return Array.from(e.multiplyRight(r).multiplyRight(n))}function an(t,e){let r=new H(Be(t)),n=new H(Be(e)),s=new H(r).invert();return Array.from(n.multiplyRight(s))}var eo={NORMAL:["NORMAL","normals"],TANGENT:["TANGENT"],TEXCOORD_0:["TEXCOORD_0","texCoords"],TEXCOORD_1:["TEXCOORD_1","texCoords1"],JOINTS_0:["JOINTS_0"],WEIGHTS_0:["WEIGHTS_0"],COLOR_0:["COLOR_0","colors"]};function ue(t,e,r,n){let s={defines:{MANUAL_SRGB:!0,SRGB_FAST_APPROXIMATION:!0},bindings:{},uniforms:{camera:[0,0,0],metallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=!0;let{imageBasedLightingEnvironment:o}=n;return o&&(s.bindings.pbr_diffuseEnvSampler=o.diffuseEnvSampler.texture,s.bindings.pbr_specularEnvSampler=o.specularEnvSampler.texture,s.bindings.pbr_brdfLUT=o.brdfLutTexture.texture,s.uniforms.IBLenabled=!0,s.uniforms.scaleIBLAmbient=[1,1]),n?.pbrDebug&&(s.defines.PBR_DEBUG=!0,s.uniforms.scaleDiffBaseMR=[0,0,0,0],s.uniforms.scaleFGDSpec=[0,0,0,0]),K(r,"NORMAL")&&(s.defines.HAS_NORMALS=!0),K(r,"TANGENT")&&n?.useTangents&&(s.defines.HAS_TANGENTS=!0),K(r,"TEXCOORD_0")&&(s.defines.HAS_UV=!0),K(r,"TEXCOORD_1")&&(s.defines.HAS_UV_1=!0),K(r,"JOINTS_0")&&K(r,"WEIGHTS_0")&&(s.defines.HAS_SKIN=!0),K(r,"COLOR_0")&&(s.defines.HAS_COLORS=!0),n?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=!0),n?.lights&&(s.defines.USE_LIGHTS=!0),e&&(n.validateAttributes!==!1&&to(e,r),no(t,e,s,r,n.gltf)),s}function to(t,e){let r=cn(t,0);r.length>0&&!K(e,"TEXCOORD_0")&&O.log.warn(`glTF material uses ${r.join(", ")} but primitive is missing TEXCOORD_0; textured shading will sample the default UV coordinates`)();let n=cn(t,1);if(n.length>0&&!K(e,"TEXCOORD_1")&&O.log.warn(`glTF material uses ${n.join(", ")} with TEXCOORD_1 but primitive is missing TEXCOORD_1; those textures will be skipped`)(),Boolean(t.unlit||t.extensions?.KHR_materials_unlit)||K(e,"NORMAL"))return;let o=t.normalTexture?"lit PBR shading with normalTexture":"lit PBR shading";O.log.warn(`glTF primitive is missing NORMAL while using ${o}; shading will fall back to geometric normals`)()}function cn(t,e){let r=[];for(let n of sn()){let s=ro(t,n.pathSegments);s&&Rt(s)===e&&r.push(n.displayName)}return r}function K(t,e){return eo[e].some(r=>Boolean(t[r]))}function ro(t,e){let r=t;for(let n of e)if(r=r?.[n],!r)return null;return r}function no(t,e,r,n,s){if(r.uniforms.unlit=Boolean(e.unlit||e.extensions?.KHR_materials_unlit),e.pbrMetallicRoughness&&io(t,e.pbrMetallicRoughness,r,n,s),e.normalTexture){L(t,e.normalTexture,"pbr_normalSampler",r,{featureOptions:{define:"HAS_NORMALMAP",enabledUniformName:"normalMapEnabled"},gltf:s,attributes:n,textureTransformSlot:"normal"});let{scale:o=1}=e.normalTexture;r.uniforms.normalScale=o}if(e.occlusionTexture){L(t,e.occlusionTexture,"pbr_occlusionSampler",r,{featureOptions:{define:"HAS_OCCLUSIONMAP",enabledUniformName:"occlusionMapEnabled"},gltf:s,attributes:n,textureTransformSlot:"occlusion"});let{strength:o=1}=e.occlusionTexture;r.uniforms.occlusionStrength=o}switch(r.uniforms.emissiveFactor=e.emissiveFactor||[0,0,0],e.emissiveTexture&&L(t,e.emissiveTexture,"pbr_emissiveSampler",r,{featureOptions:{define:"HAS_EMISSIVEMAP",enabledUniformName:"emissiveMapEnabled"},gltf:s,attributes:n,textureTransformSlot:"emissive"}),ao(t,e.extensions,r,s,n),e.alphaMode||"OPAQUE"){case"OPAQUE":break;case"MASK":{let{alphaCutoff:o=.5}=e;r.defines.ALPHA_CUTOFF=!0,r.uniforms.alphaCutoffEnabled=!0,r.uniforms.alphaCutoff=o;break}case"BLEND":O.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),so(r);break}}function so(t){t.parameters.blend=!0,t.parameters.blendColorOperation="add",t.parameters.blendColorSrcFactor="src-alpha",t.parameters.blendColorDstFactor="one-minus-src-alpha",t.parameters.blendAlphaOperation="add",t.parameters.blendAlphaSrcFactor="one",t.parameters.blendAlphaDstFactor="one-minus-src-alpha",t.glParameters.blend=!0,t.glParameters.blendEquation=R.FUNC_ADD,t.glParameters.blendFunc=[R.SRC_ALPHA,R.ONE_MINUS_SRC_ALPHA,R.ONE,R.ONE_MINUS_SRC_ALPHA]}function oo(t){t.parameters.blend=!0,t.parameters.depthWriteEnabled=!1,t.parameters.blendColorOperation="add",t.parameters.blendColorSrcFactor="one",t.parameters.blendColorDstFactor="one-minus-src-alpha",t.parameters.blendAlphaOperation="add",t.parameters.blendAlphaSrcFactor="one",t.parameters.blendAlphaDstFactor="one-minus-src-alpha",t.glParameters.blend=!0,t.glParameters.depthMask=!1,t.glParameters.blendEquation=R.FUNC_ADD,t.glParameters.blendFunc=[R.ONE,R.ONE_MINUS_SRC_ALPHA,R.ONE,R.ONE_MINUS_SRC_ALPHA]}function io(t,e,r,n,s){e.baseColorTexture&&L(t,e.baseColorTexture,"pbr_baseColorSampler",r,{featureOptions:{define:"HAS_BASECOLORMAP",enabledUniformName:"baseColorMapEnabled"},gltf:s,attributes:n,textureTransformSlot:"baseColor"}),r.uniforms.baseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&L(t,e.metallicRoughnessTexture,"pbr_metallicRoughnessSampler",r,{featureOptions:{define:"HAS_METALROUGHNESSMAP",enabledUniformName:"metallicRoughnessMapEnabled"},gltf:s,attributes:n,textureTransformSlot:"metallicRoughness"});let{metallicFactor:o=1,roughnessFactor:i=1}=e;r.uniforms.metallicRoughnessValues=[o,i]}function ao(t,e,r,n,s={}){e&&(co(e)&&(r.defines.USE_MATERIAL_EXTENSIONS=!0),lo(t,e.KHR_materials_specular,r,n,s),fo(e.KHR_materials_ior,r),po(t,e.KHR_materials_transmission,r,n,s),mo(t,e.KHR_materials_volume,r,n,s),ho(t,e.KHR_materials_clearcoat,r,n,s),uo(t,e.KHR_materials_sheen,r,n,s),xo(t,e.KHR_materials_iridescence,r,n,s),go(t,e.KHR_materials_anisotropy,r,n,s),Mo(e.KHR_materials_emissive_strength,r))}function co(t){return Boolean(t.KHR_materials_specular||t.KHR_materials_ior||t.KHR_materials_transmission||t.KHR_materials_volume||t.KHR_materials_clearcoat||t.KHR_materials_sheen||t.KHR_materials_iridescence||t.KHR_materials_anisotropy)}function lo(t,e,r,n,s={}){e&&(e.specularColorFactor&&(r.uniforms.specularColorFactor=e.specularColorFactor),e.specularFactor!==void 0&&(r.uniforms.specularIntensityFactor=e.specularFactor),e.specularColorTexture&&L(t,e.specularColorTexture,"pbr_specularColorSampler",r,{featureOptions:{define:"HAS_SPECULARCOLORMAP",enabledUniformName:"specularColorMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"specularColor"}),e.specularTexture&&L(t,e.specularTexture,"pbr_specularIntensitySampler",r,{featureOptions:{define:"HAS_SPECULARINTENSITYMAP",enabledUniformName:"specularIntensityMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"specularIntensity"}))}function fo(t,e){t?.ior!==void 0&&(e.uniforms.ior=t.ior)}function po(t,e,r,n,s={}){e&&(e.transmissionFactor!==void 0&&(r.uniforms.transmissionFactor=e.transmissionFactor),e.transmissionTexture&&L(t,e.transmissionTexture,"pbr_transmissionSampler",r,{featureOptions:{define:"HAS_TRANSMISSIONMAP",enabledUniformName:"transmissionMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"transmission"}),((e.transmissionFactor??0)>0||e.transmissionTexture)&&(O.log.warn("KHR_materials_transmission uses a premultiplied-alpha blending approximation and may require mesh sorting")(),oo(r)))}function mo(t,e,r,n,s={}){e&&(e.thicknessFactor!==void 0&&(r.uniforms.thicknessFactor=e.thicknessFactor),e.thicknessTexture&&L(t,e.thicknessTexture,"pbr_thicknessSampler",r,{featureOptions:{define:"HAS_THICKNESSMAP"},gltf:n,attributes:s,textureTransformSlot:"thickness"}),e.attenuationDistance!==void 0&&(r.uniforms.attenuationDistance=e.attenuationDistance),e.attenuationColor&&(r.uniforms.attenuationColor=e.attenuationColor))}function ho(t,e,r,n,s={}){e&&(e.clearcoatFactor!==void 0&&(r.uniforms.clearcoatFactor=e.clearcoatFactor),e.clearcoatRoughnessFactor!==void 0&&(r.uniforms.clearcoatRoughnessFactor=e.clearcoatRoughnessFactor),e.clearcoatTexture&&L(t,e.clearcoatTexture,"pbr_clearcoatSampler",r,{featureOptions:{define:"HAS_CLEARCOATMAP",enabledUniformName:"clearcoatMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"clearcoat"}),e.clearcoatRoughnessTexture&&L(t,e.clearcoatRoughnessTexture,"pbr_clearcoatRoughnessSampler",r,{featureOptions:{define:"HAS_CLEARCOATROUGHNESSMAP",enabledUniformName:"clearcoatRoughnessMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"clearcoatRoughness"}),e.clearcoatNormalTexture&&L(t,e.clearcoatNormalTexture,"pbr_clearcoatNormalSampler",r,{featureOptions:{define:"HAS_CLEARCOATNORMALMAP"},gltf:n,attributes:s,textureTransformSlot:"clearcoatNormal"}))}function uo(t,e,r,n,s={}){e&&(e.sheenColorFactor&&(r.uniforms.sheenColorFactor=e.sheenColorFactor),e.sheenRoughnessFactor!==void 0&&(r.uniforms.sheenRoughnessFactor=e.sheenRoughnessFactor),e.sheenColorTexture&&L(t,e.sheenColorTexture,"pbr_sheenColorSampler",r,{featureOptions:{define:"HAS_SHEENCOLORMAP",enabledUniformName:"sheenColorMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"sheenColor"}),e.sheenRoughnessTexture&&L(t,e.sheenRoughnessTexture,"pbr_sheenRoughnessSampler",r,{featureOptions:{define:"HAS_SHEENROUGHNESSMAP",enabledUniformName:"sheenRoughnessMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"sheenRoughness"}))}function xo(t,e,r,n,s={}){e&&(e.iridescenceFactor!==void 0&&(r.uniforms.iridescenceFactor=e.iridescenceFactor),e.iridescenceIor!==void 0&&(r.uniforms.iridescenceIor=e.iridescenceIor),(e.iridescenceThicknessMinimum!==void 0||e.iridescenceThicknessMaximum!==void 0)&&(r.uniforms.iridescenceThicknessRange=[e.iridescenceThicknessMinimum??100,e.iridescenceThicknessMaximum??400]),e.iridescenceTexture&&L(t,e.iridescenceTexture,"pbr_iridescenceSampler",r,{featureOptions:{define:"HAS_IRIDESCENCEMAP",enabledUniformName:"iridescenceMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"iridescence"}),e.iridescenceThicknessTexture&&L(t,e.iridescenceThicknessTexture,"pbr_iridescenceThicknessSampler",r,{featureOptions:{define:"HAS_IRIDESCENCETHICKNESSMAP"},gltf:n,attributes:s,textureTransformSlot:"iridescenceThickness"}))}function go(t,e,r,n,s={}){e&&(e.anisotropyStrength!==void 0&&(r.uniforms.anisotropyStrength=e.anisotropyStrength),e.anisotropyRotation!==void 0&&(r.uniforms.anisotropyRotation=e.anisotropyRotation),e.anisotropyTexture&&L(t,e.anisotropyTexture,"pbr_anisotropySampler",r,{featureOptions:{define:"HAS_ANISOTROPYMAP",enabledUniformName:"anisotropyMapEnabled"},gltf:n,attributes:s,textureTransformSlot:"anisotropy"}))}function Mo(t,e){t?.emissiveStrength!==void 0&&(e.uniforms.emissiveStrength=t.emissiveStrength)}function L(t,e,r,n,s={}){let{featureOptions:o={},gltf:i,attributes:a={},textureTransformSlot:c}=s,{define:l,enabledUniformName:m}=o,p=Rt(e);if(p>1){O.log.warn(`Skipping ${String(r)} because ${p} is not supported; only TEXCOORD_0 and TEXCOORD_1 are currently available`)();return}if(p===1&&!K(a,"TEXCOORD_1")){O.log.warn(`Skipping ${String(r)} because it requires TEXCOORD_1 but the primitive does not provide TEXCOORD_1`)();return}let f=To(e,i),h=f.texture?.source?.image;if(!h){O.log.warn(`Skipping unresolved glTF texture for ${String(r)}`)();return}let u={wrapS:10497,wrapT:10497,minFilter:9729,magFilter:9729,...f?.texture?.sampler},d={id:f.uniformName||f.id,sampler:Jt(u)},x;if(h.compressed)x=yo(t,h,d);else{let{width:g,height:A}=t.getExternalImageSize(h);x=t.createTexture({...d,width:g,height:A,data:h})}if(n.bindings[r]=x,l&&(n.defines[l]=!0),m&&(n.uniforms[m]=!0),c){let g=Ke(c);n.uniforms[g.uvSetUniform]=p,n.uniforms[g.uvTransformUniform]=Be($e(e))}n.generatedTextures.push(x)}function To(t,e){if(t.texture||t.index===void 0||!e?.textures)return t;let r=e.textures[t.index];return r?"texture"in r&&r.texture?{...r,...t,texture:r.texture}:"source"in r?{...t,texture:r}:t:t}function At(t,e){return t.createTexture({...e,format:"rgba8unorm",width:1,height:1,mipLevels:1})}function ln(t){return t.textureFormat}function _o(t,e,r){let{blockWidth:n=1,blockHeight:s=1}=O.textureFormatDecoder.getInfo(r),o=1;for(let i=1;;i++){let a=Math.max(1,t>>i),c=Math.max(1,e>>i);if(a<n||c<s)break;o++}return o}function yo(t,e,r){let n;if(Array.isArray(e.data)&&e.data[0]?.data?n=e.data:"mipmaps"in e&&Array.isArray(e.mipmaps)?n=e.mipmaps:n=[],n.length===0||!n[0]?.data)return O.log.warn("createCompressedTexture: compressed image has no valid mip levels, creating fallback")(),At(t,r);let s=n[0],o=s.width??e.width??0,i=s.height??e.height??0;if(o<=0||i<=0)return O.log.warn("createCompressedTexture: base level has invalid dimensions, creating fallback")(),At(t,r);let a=ln(s);if(!a)return O.log.warn("createCompressedTexture: compressed image has no textureFormat, creating fallback")(),At(t,r);let c=_o(o,i,a),l=Math.min(n.length,c),m=1;for(let f=1;f<l;f++){let h=n[f];if(!h.data||h.width<=0||h.height<=0){O.log.warn(`createCompressedTexture: mip level ${f} has invalid data/dimensions, truncating`)();break}let u=ln(h);if(u&&u!==a){O.log.warn(`createCompressedTexture: mip level ${f} format '${u}' differs from base '${a}', truncating`)();break}let d=Math.max(1,o>>f),x=Math.max(1,i>>f);if(h.width!==d||h.height!==x){O.log.warn(`createCompressedTexture: mip level ${f} dimensions ${h.width}x${h.height} don't match expected ${d}x${x}, truncating`)();break}m++}let p=t.createTexture({...r,format:a,usage:O.Texture.TEXTURE|O.Texture.COPY_DST,width:o,height:i,mipLevels:m,data:s.data});for(let f=1;f<m;f++)p.writeData(n[f].data,{width:n[f].width,height:n[f].height,mipLevel:f});return p}var pn=k(De(),1);function Ve(t,e={}){let r=t.lights||t.extensions?.KHR_lights_punctual?.lights;if(!r||!Array.isArray(r)||r.length===0)return[];let n=[],s=So(t.nodes||[]),o=new Map;for(let i of t.nodes||[]){let a=i.light??i.extensions?.KHR_lights_punctual?.light;if(typeof a!="number")continue;let c=r[a];if(!c)continue;let l=Ro(c.color||[1,1,1],e.useByteColors??!0),m=c.intensity??1,p=c.range,f=mn(i,s,o);switch(c.type){case"directional":n.push(Eo(f,l,m));break;case"point":n.push(Ao(f,l,m,p));break;case"spot":n.push(wo(f,l,m,p,c.spot));break;default:break}}return n}function Ro(t,e){return e?t.map(r=>r*255):(0,pn.normalizeByteColor3)(t,!1)}function Ao(t,e,r,n){let s=hn(t),o=[1,0,0];return n!==void 0&&n>0&&(o=[1,0,1/(n*n)]),{type:"point",position:s,color:e,intensity:r,attenuation:o}}function Eo(t,e,r){return{type:"directional",direction:un(t),color:e,intensity:r}}function wo(t,e,r,n,s={}){let o=hn(t),i=un(t),a=[1,0,0];return n!==void 0&&n>0&&(a=[1,0,1/(n*n)]),{type:"spot",position:o,direction:i,color:e,intensity:r,attenuation:a,innerConeAngle:s.innerConeAngle??0,outerConeAngle:s.outerConeAngle??Math.PI/4}}function So(t){let e=new Map;for(let r of t)for(let n of r.children||[])e.set(n.id,r);return e}function mn(t,e,r){let n=r.get(t.id);if(n)return n;let s=Oo(t),o=e.get(t.id),i=o?new V(mn(o,e,r)).multiplyRight(s):s;return r.set(t.id,i),i}function Oo(t){if(t.matrix)return new V(t.matrix);let e=new V;return t.translation&&e.translate(t.translation),t.rotation&&e.multiplyRight(new V().fromQuaternion(t.rotation)),t.scale&&e.scale(t.scale),e}function hn(t){return t.transformAsPoint([0,0,0])}function un(t){return t.transformDirection([0,0,-1])}var G=k(Z(),1),Mn=k(De(),1);function dn(t){switch(t){case R.POINTS:return"point-list";case R.LINES:return"line-list";case R.LINE_STRIP:return"line-strip";case R.TRIANGLES:return"triangle-list";case R.TRIANGLE_STRIP:return"triangle-strip";default:throw new Error(String(t))}}var q=k(Q(),1),xn=k(Z(),1),de=k(De(),1),ne=k(Z(),1),No=`
8
8
  struct VertexInputs {
9
9
  @location(0) positions: vec3f,
10
10
  #ifdef HAS_NORMALS
@@ -159,13 +159,13 @@ fn fragmentMain(inputs: FragmentInputs) -> @location(0) vec4f {
159
159
  pbr_setPositionNormalTangentUV(pos, _NORMAL, _TANGENT, _TEXCOORD_0, _TEXCOORD_1);
160
160
  gl_Position = pbrProjection.modelViewProjectionMatrix * pos;
161
161
  }
162
- `,No=`#version 300 es
162
+ `,Lo=`#version 300 es
163
163
  out vec4 fragmentColor;
164
164
 
165
165
  void main(void) {
166
166
  vec3 pos = pbr_vPosition;
167
167
  fragmentColor = pbr_filterColor(vec4(1.0));
168
168
  }
169
- `;function Rt(t,e){let r=e.materialFactory||new te.MaterialFactory(t,{modules:[ue.pbrMaterial]}),n={...e.parsedPPBRMaterial.uniforms};delete n.camera;let s=Object.fromEntries(Object.entries({...n,...e.parsedPPBRMaterial.bindings}).filter(([i,a])=>r.ownsBinding(i)&&Oo(a))),o=r.createMaterial({id:e.id,bindings:s});return o.setProps({pbrMaterial:n}),o}function dn(t,e){let{id:r,geometry:n,parsedPPBRMaterial:s,vertexCount:o,modelOptions:i={}}=e;D.log.info(4,"createGLTFModel defines: ",s.defines)();let a=[],c={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},l={id:r,source:So,vs:bo,fs:No,geometry:n,topology:n.topology,vertexCount:o,modules:[ue.pbrMaterial,ue.skin],...i,defines:{...s.defines,...i.defines},parameters:{...c,...s.parameters,...i.parameters}},m=e.material||Rt(t,{id:r?`${r}-material`:void 0,parsedPPBRMaterial:s});l.material=m;let p=new te.Model(t,l),f={...s.uniforms,...i.uniforms,...s.bindings,...i.bindings},h=Lo(p.shaderInputs.getModules(),m,f);return p.shaderInputs.setProps(h),new te.ModelNode({managedResources:a,model:p})}function Oo(t){return t instanceof D.Buffer||t instanceof un.DynamicTexture||t instanceof D.Sampler||t instanceof D.Texture||t instanceof D.TextureView}function Lo(t,e,r){let n=new Map;for(let o of t){for(let i of Object.keys(o.uniformTypes||{}))n.set(i,o.name);for(let i of o.bindingLayout||[])n.set(i.name,o.name)}let s={};for(let[o,i]of Object.entries(r)){if(i===void 0)continue;let a=n.get(o);!a||e.ownsModule(a)||(s[a]||={},s[a][o]=i)}return s}var Io={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:void 0,lights:!0,useTangents:!1,useByteColors:!0};function gn(t,e,r={}){let n={...Io,...r},s=new X.MaterialFactory(t,{modules:[xn.pbrMaterial]}),o=(e.materials||[]).map((p,f)=>Rt(t,{id:Ho(p,f),parsedPPBRMaterial:he(t,p,{},{...n,gltf:e,validateAttributes:!1}),materialFactory:s})),i=new Map;(e.materials||[]).forEach((p,f)=>{i.set(p.id,o[f])});let a=new Map;e.meshes.forEach((p,f)=>{let h=Po(t,p,e,i,n);a.set(p.id,h)});let c=new Map,l=new Map;return e.nodes.forEach((p,f)=>{let h=vo(t,p,n);c.set(f,h),l.set(p.id,h)}),e.nodes.forEach((p,f)=>{if(c.get(f).add((p.children??[]).map(({id:h})=>{let u=l.get(h);if(!u)throw new Error(`Cannot find child ${h} of node ${f}`);return u})),p.mesh){let h=a.get(p.mesh.id);if(!h)throw new Error(`Cannot find mesh child ${p.mesh.id} of node ${f}`);c.get(f).add(h)}}),{scenes:e.scenes.map(p=>{let f=(p.nodes||[]).map(({id:h})=>{let u=l.get(h);if(!u)throw new Error(`Cannot find child ${h} of scene ${p.name||p.id}`);return u});return new X.GroupNode({id:p.name||p.id,children:f})}),materials:o,gltfMeshIdToNodeMap:a,gltfNodeIdToNodeMap:l,gltfNodeIndexToNodeMap:c}}function vo(t,e,r){return new X.GroupNode({id:e.name||e.id,children:[],matrix:e.matrix,position:e.translation,rotation:e.rotation,scale:e.scale})}function Po(t,e,r,n,s){let i=(e.primitives||[]).map((c,l)=>Co({device:t,gltfPrimitive:c,primitiveIndex:l,gltfMesh:e,gltf:r,gltfMaterialIdToMaterialMap:n,options:s}));return new X.GroupNode({id:e.name||e.id,children:i})}function Co({device:t,gltfPrimitive:e,primitiveIndex:r,gltfMesh:n,gltf:s,gltfMaterialIdToMaterialMap:o,options:i}){let a=e.name||`${n.name||n.id}-primitive-${r}`,c=hn(e.mode??4),l=e.indices?e.indices.count:Fo(e.attributes),m=ko(a,e,c),p=he(t,e.material,m.attributes,{...i,gltf:s}),f=dn(t,{id:a,geometry:m,material:e.material&&o.get(e.material.id)||null,parsedPPBRMaterial:p,modelOptions:i.modelOptions,vertexCount:l});return f.bounds=[e.attributes.POSITION.min,e.attributes.POSITION.max],f}function Fo(t){let e=1/0;for(let r of Object.values(t))if(r){let{value:n,size:s,components:o}=r,i=s??o;n?.length!==void 0&&i>=1&&(e=Math.min(e,n.length/i))}if(!Number.isFinite(e))throw new Error("Could not determine vertex count from attributes");return e}function ko(t,e,r){let n={};for(let[s,o]of Object.entries(e.attributes)){let{components:i,size:a,value:c,normalized:l}=o;n[s]={size:a??i,value:c,normalized:l}}return new X.Geometry({id:t,topology:r,indices:e.indices?.value,attributes:n})}function Ho(t,e){return t.name||t.id||`material-${e}`}var Tn=k(G(),1);var At=k(G(),1);function Uo(t,e,r){switch(e){case"translation":return t.setPosition(r).updateMatrix();case"rotation":return t.setRotation(r).updateMatrix();case"scale":return t.setScale(r).updateMatrix();default:return At.log.warn(`Bad animation path ${e}`)(),null}}function Mn(t,{input:e,interpolation:r,output:n},s,o){let i=Et(t,{input:e,interpolation:r,output:n},o);i&&Uo(s,o,i)}function Et(t,{input:e,interpolation:r,output:n},s){let o=e[e.length-1];if(!Number.isFinite(o)||o<=0)return n[0]||null;let i=t%o,a=e.findIndex(p=>p>=i);if(a<0)return n[n.length-1]||null;let c=Math.max(0,a-1),l=e[c],m=e[a];switch(r){case"STEP":return n[c];case"LINEAR":if(m>l){let p=(i-l)/(m-l);return zo(s,n[c],n[a],p)}return n[c]||null;case"CUBICSPLINE":if(m>l){let p=(i-l)/(m-l),f=m-l,h=n[3*c+1],u=n[3*c+2],d=n[3*a+0],x=n[3*a+1];return Bo({p0:h,outTangent0:u,inTangent1:d,p1:x,tDiff:f,ratio:p})}return n[3*c+1]||null;default:return At.log.warn(`Interpolation ${r} not supported`)(),null}}function zo(t,e,r,n){if(t==="rotation")return new me().slerp({start:e,target:r,ratio:n});let s=[];for(let o=0;o<e.length;o++)s[o]=n*r[o]+(1-n)*e[o];return s}function Bo({p0:t,outTangent0:e,inTangent1:r,p1:n,tDiff:s,ratio:o}){let i=[];for(let a=0;a<t.length;a++){let c=e[a]*s,l=r[a]*s;i[a]=(2*Math.pow(o,3)-3*Math.pow(o,2)+1)*t[a]+(Math.pow(o,3)-2*Math.pow(o,2)+o)*c+(-2*Math.pow(o,3)+3*Math.pow(o,2))*n[a]+(Math.pow(o,3)-Math.pow(o,2))*l}return i}var wt=class{animation;gltfNodeIdToNodeMap;materials;startTime=0;playing=!0;speed=1;materialTextureTransformState=new Map;constructor(e){if(this.animation=e.animation,this.gltfNodeIdToNodeMap=e.gltfNodeIdToNodeMap,this.materials=e.materials||[],this.animation.name||="unnamed",Object.assign(this,e),this.animation.channels.some(r=>r.type!=="node")&&!this.materials.length)throw new Error(`Animation ${this.animation.name} targets materials, but GLTFAnimator was created without a materials array`)}setTime(e){if(!this.playing)return;let n=(e/1e3-this.startTime)*this.speed;this.animation.channels.forEach(s=>{if(s.type==="node"){let{sampler:a,targetNodeId:c,path:l}=s,m=this.gltfNodeIdToNodeMap.get(c);if(!m)throw new Error(`Cannot find animation target node ${c}`);Mn(n,a,m,l);return}let o=this.materials[s.targetMaterialIndex];if(!o)throw new Error(`Cannot find animation target material ${s.targetMaterialIndex} for ${s.pointer}`);let i=Et(n,s.sampler);i&&(s.type==="material"?Ko(o,s,i):Do(o,s,i,this.materialTextureTransformState))})}},re=class{animations;constructor(e){this.animations=e.animations.map((r,n)=>{let s=r.name||`Animation-${n}`;return new wt({gltfNodeIdToNodeMap:e.gltfNodeIdToNodeMap,materials:e.materials,animation:{name:s,channels:r.channels}})})}animate(e){Tn.log.warn("GLTFAnimator#animate is deprecated. Use GLTFAnimator#setTime instead")(),this.setTime(e)}setTime(e){this.animations.forEach(r=>r.setTime(e))}getAnimations(){return this.animations}};function Ko(t,e,r){let n=e.component!==void 0?{[e.property]:Vo($o(t,e.property),e.component,r[0])}:{[e.property]:r.length===1?r[0]:r};t.setProps({pbrMaterial:n})}function $o(t,e){let n=t.shaderInputs.getUniformValues().pbrMaterial?.[e];return Array.isArray(n)?[...n]:[]}function Vo(t,e,r){let n=[...t];return n[e]=r,n}function Do(t,e,r,n){let s=Be(e.textureSlot),o=qo(n,t,e);switch(e.path){case"offset":e.component!==void 0?o.offset[e.component]=r[0]:o.offset=[r[0],r[1]];break;case"rotation":o.rotation=r[0];break;case"scale":e.component!==void 0?o.scale[e.component]=r[0]:o.scale=[r[0],r[1]];break}t.setProps({pbrMaterial:{[s.uvTransformUniform]:sn(e.baseTransform,o)}})}function qo(t,e,r){let n=t.get(e)||{},s=n[r.textureSlot];return s||(s={offset:[...r.baseTransform.offset],rotation:r.baseTransform.rotation,scale:[...r.baseTransform.scale]},n[r.textureSlot]=s,t.set(e,n)),s}var ne=k(G(),1);var Wo={supportLevel:"none",comment:"Not currently listed in the luma.gl glTF extension support registry."},yn={KHR_draco_mesh_compression:{supportLevel:"built-in",comment:"Decoded by loaders.gl before luma.gl builds the scenegraph."},EXT_meshopt_compression:{supportLevel:"built-in",comment:"Meshopt-compressed primitives are decoded during load."},KHR_mesh_quantization:{supportLevel:"built-in",comment:"Quantized accessors are unpacked before geometry creation."},KHR_lights_punctual:{supportLevel:"built-in",comment:"Parsed into luma.gl Light objects."},KHR_materials_unlit:{supportLevel:"built-in",comment:"Unlit materials bypass the default lighting path."},KHR_materials_emissive_strength:{supportLevel:"built-in",comment:"Applied by the stock PBR shader."},KHR_texture_basisu:{supportLevel:"built-in",comment:"BasisU / KTX2 textures pass through when the device supports them."},KHR_texture_transform:{supportLevel:"built-in",comment:"UV transforms are applied during load."},EXT_texture_webp:{supportLevel:"loader-only",comment:"Texture source is resolved during load; final support depends on browser and device decode support."},EXT_texture_avif:{supportLevel:"loader-only",comment:"Texture source is resolved during load; final support depends on browser and device decode support."},KHR_materials_specular:{supportLevel:"built-in",comment:"The stock shader now applies specular factors and textures to the dielectric F0 term."},KHR_materials_ior:{supportLevel:"built-in",comment:"The stock shader now drives dielectric reflectance from the glTF IOR value."},KHR_materials_transmission:{supportLevel:"built-in",comment:"The stock shader now applies transmission to the base layer and exposes transparency through alpha, without a scene-color refraction buffer."},KHR_materials_volume:{supportLevel:"built-in",comment:"Thickness and attenuation now tint transmitted light in the stock shader."},KHR_materials_clearcoat:{supportLevel:"built-in",comment:"The stock shader now adds a secondary clearcoat specular lobe."},KHR_materials_sheen:{supportLevel:"built-in",comment:"The stock shader now adds a sheen lobe for cloth-like materials."},KHR_materials_iridescence:{supportLevel:"built-in",comment:"The stock shader now tints specular response with a view-dependent thin-film iridescence approximation."},KHR_materials_anisotropy:{supportLevel:"built-in",comment:"The stock shader now shapes highlights and IBL response with an anisotropy-direction approximation."},KHR_materials_pbrSpecularGlossiness:{supportLevel:"loader-only",comment:"Extension data can be loaded, but it is not translated into the default metallic-roughness material path."},KHR_materials_variants:{supportLevel:"loader-only",comment:"Variant metadata can be loaded, but applications must choose and apply variants."},EXT_mesh_gpu_instancing:{supportLevel:"none",comment:"GPU instancing data is not yet converted into luma.gl instanced draw setup."},KHR_node_visibility:{supportLevel:"none",comment:"Node-visibility animations and toggles are not mapped onto runtime scenegraph state."},KHR_animation_pointer:{supportLevel:"parsed-and-wired",comment:"Selected node TRS, material factor, and KHR_texture_transform offset/rotation/scale pointers are wired to runtime updates; unsupported targets are skipped."},KHR_materials_diffuse_transmission:{supportLevel:"none",comment:"Diffuse-transmission shading is not implemented in the stock PBR shader."},KHR_materials_dispersion:{supportLevel:"none",comment:"Chromatic dispersion is not implemented in the stock PBR shader."},KHR_materials_volume_scatter:{supportLevel:"none",comment:"Volume scattering is not implemented in the stock PBR shader."},KHR_xmp:{supportLevel:"none",comment:"Metadata payloads remain in the loaded glTF, but luma.gl does not interpret them."},KHR_xmp_json_ld:{supportLevel:"none",comment:"Metadata is preserved in the glTF, but luma.gl does not interpret it."},EXT_lights_image_based:{supportLevel:"none",comment:"Use loadPBREnvironment() or custom environment setup instead."},EXT_texture_video:{supportLevel:"none",comment:"Video textures are not created automatically by the stock pipeline."},MSFT_lod:{supportLevel:"none",comment:"Level-of-detail switching is not implemented in the stock scenegraph loader."}};function qe(t){let r=Array.from(Yo(t)).sort().map(n=>{let s=yn[n]||Wo;return[n,{extensionName:n,supported:s.supportLevel==="built-in"||s.supportLevel==="parsed-and-wired",supportLevel:s.supportLevel,comment:s.comment}]});return new Map(r)}function St(t){return yn[t]||null}function Yo(t){let e=t,r=new Set;return De(r,t.extensionsUsed),De(r,t.extensionsRequired),De(r,e.extensionsRemoved),De(r,Object.keys(t.extensions||{})),(e.lights?.length||(t.nodes||[]).some(n=>"light"in n))&&r.add("KHR_lights_punctual"),(t.materials||[]).some(n=>{let s=n;return s.unlit||s.extensions?.KHR_materials_unlit})&&r.add("KHR_materials_unlit"),r}function De(t,e=[]){for(let r of e)t.add(r)}var Xo={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Go={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function bt(t){let e=Go[t.componentType],r=Xo[t.type],n=r*t.count,{buffer:s,byteOffset:o=0}=t.bufferView?.data??{};return{typedArray:new e(s,o+(t.byteOffset||0),n),components:r}}function _n(t){let e=t.animations||[],r=new Map,n=new Map;return e.flatMap((s,o)=>{let i=s.name||`Animation-${o}`,a=new Map,c=s.channels.flatMap(({sampler:l,target:m})=>{let p=a.get(l);if(!p){let h=s.samplers[l];if(!h)throw new Error(`Cannot find animation sampler ${l}`);let{input:u,interpolation:d="LINEAR",output:x}=h;p={input:oi(t.accessors[u],r),interpolation:d,output:ii(t.accessors[x],n)},a.set(l,p)}let f=jo(t,m,p);return f?[f]:[]});return c.length?[{name:i,channels:c}]:[]})}function jo(t,e,r){if(e.path==="pointer")return Jo(t,e,r);let n=Rn(e.path);if(!n)return null;let s=t.nodes[e.node??0];if(!s)throw new Error(`Cannot find animation target ${e.node}`);return{type:"node",sampler:r,targetNodeId:s.id,path:n}}function Jo(t,e,r){let n=e.extensions?.KHR_animation_pointer?.pointer;if(typeof n!="string"||!n.startsWith("/"))return ne.log.warn("KHR_animation_pointer channel is missing a valid JSON pointer and will be skipped")(),null;let s=ni(n);switch(s[0]){case"nodes":return Qo(t,s,r,n);case"materials":return Zo(t,s,r,n);default:return de(n,`top-level target "${s[0]}" has no runtime animation mapping`),null}}function Qo(t,e,r,n){if(e.length!==3)return de(n,"node pointers must use /nodes/{index}/{translation|rotation|scale|weights}"),null;let s=Number(e[1]),o=t.nodes[s];if(!Number.isInteger(s)||!o)return ne.log.warn(`KHR_animation_pointer target ${n} references a missing node and will be skipped`)(),null;let i=Rn(e[2]);return i?i==="weights"?(ne.log.warn(`KHR_animation_pointer target ${n} will be skipped because morph weights are not implemented in GLTFAnimator`)(),null):{type:"node",sampler:r,targetNodeId:o.id,path:i}:(de(n,`node property "${e[2]}" has no runtime animation mapping`),null)}function Zo(t,e,r,n){if(e.length<3)return de(n,"material pointers must include a material index and target property path"),null;let s=Number(e[1]),o=t.materials[s];if(!Number.isInteger(s)||!o)return ne.log.warn(`KHR_animation_pointer target ${n} references a missing material and will be skipped`)(),null;let i=ei(o,e.slice(2));return"reason"in i?(de(n,i.reason),null):{sampler:r,pointer:n,targetMaterialIndex:s,...i}}function Rn(t){switch(t){case"translation":case"rotation":case"scale":case"weights":return t;default:return null}}function ei(t,e){let r=ti(t,e);if(!("reason"in r)||r.reason!=="not-a-texture-transform-target")return r;switch(e.join("/")){case"pbrMetallicRoughness/baseColorFactor":return t.pbrMetallicRoughness?{type:"material",property:"baseColorFactor"}:{reason:S(e)};case"pbrMetallicRoughness/metallicFactor":return t.pbrMetallicRoughness?{type:"material",property:"metallicRoughnessValues",component:0}:{reason:S(e)};case"pbrMetallicRoughness/roughnessFactor":return t.pbrMetallicRoughness?{type:"material",property:"metallicRoughnessValues",component:1}:{reason:S(e)};case"normalTexture/scale":return t.normalTexture?{type:"material",property:"normalScale"}:{reason:S(e)};case"occlusionTexture/strength":return t.occlusionTexture?{type:"material",property:"occlusionStrength"}:{reason:S(e)};case"emissiveFactor":return{type:"material",property:"emissiveFactor"};case"alphaCutoff":return{type:"material",property:"alphaCutoff"};case"extensions/KHR_materials_specular/specularFactor":return t.extensions?.KHR_materials_specular?{type:"material",property:"specularIntensityFactor"}:{reason:S(e)};case"extensions/KHR_materials_specular/specularColorFactor":return t.extensions?.KHR_materials_specular?{type:"material",property:"specularColorFactor"}:{reason:S(e)};case"extensions/KHR_materials_ior/ior":return t.extensions?.KHR_materials_ior?{type:"material",property:"ior"}:{reason:S(e)};case"extensions/KHR_materials_transmission/transmissionFactor":return t.extensions?.KHR_materials_transmission?{type:"material",property:"transmissionFactor"}:{reason:S(e)};case"extensions/KHR_materials_volume/thicknessFactor":return t.extensions?.KHR_materials_volume?{type:"material",property:"thicknessFactor"}:{reason:S(e)};case"extensions/KHR_materials_volume/attenuationDistance":return t.extensions?.KHR_materials_volume?{type:"material",property:"attenuationDistance"}:{reason:S(e)};case"extensions/KHR_materials_volume/attenuationColor":return t.extensions?.KHR_materials_volume?{type:"material",property:"attenuationColor"}:{reason:S(e)};case"extensions/KHR_materials_clearcoat/clearcoatFactor":return t.extensions?.KHR_materials_clearcoat?{type:"material",property:"clearcoatFactor"}:{reason:S(e)};case"extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor":return t.extensions?.KHR_materials_clearcoat?{type:"material",property:"clearcoatRoughnessFactor"}:{reason:S(e)};case"extensions/KHR_materials_sheen/sheenColorFactor":return t.extensions?.KHR_materials_sheen?{type:"material",property:"sheenColorFactor"}:{reason:S(e)};case"extensions/KHR_materials_sheen/sheenRoughnessFactor":return t.extensions?.KHR_materials_sheen?{type:"material",property:"sheenRoughnessFactor"}:{reason:S(e)};case"extensions/KHR_materials_iridescence/iridescenceFactor":return t.extensions?.KHR_materials_iridescence?{type:"material",property:"iridescenceFactor"}:{reason:S(e)};case"extensions/KHR_materials_iridescence/iridescenceIor":return t.extensions?.KHR_materials_iridescence?{type:"material",property:"iridescenceIor"}:{reason:S(e)};case"extensions/KHR_materials_iridescence/iridescenceThicknessMinimum":return t.extensions?.KHR_materials_iridescence?{type:"material",property:"iridescenceThicknessRange",component:0}:{reason:S(e)};case"extensions/KHR_materials_iridescence/iridescenceThicknessMaximum":return t.extensions?.KHR_materials_iridescence?{type:"material",property:"iridescenceThicknessRange",component:1}:{reason:S(e)};case"extensions/KHR_materials_anisotropy/anisotropyStrength":return t.extensions?.KHR_materials_anisotropy?{type:"material",property:"anisotropyStrength"}:{reason:S(e)};case"extensions/KHR_materials_anisotropy/anisotropyRotation":return t.extensions?.KHR_materials_anisotropy?{type:"material",property:"anisotropyRotation"}:{reason:S(e)};case"extensions/KHR_materials_emissive_strength/emissiveStrength":return t.extensions?.KHR_materials_emissive_strength?{type:"material",property:"emissiveStrength"}:{reason:S(e)};default:return{reason:S(e)}}}function ti(t,e){let r=e.lastIndexOf("extensions");if(r<0||e[r+1]!=="KHR_texture_transform"||r<1)return{reason:"not-a-texture-transform-target"};let n=nn(e.slice(0,r));if(!n)return{reason:si(e.slice(0,r))};let s=ri(t,n.pathSegments);if(!s)return{reason:`texture-transform target "${e.slice(0,r).join("/")}" does not exist on the referenced material`};let o=e[r+2];if(o==="texCoord")return{reason:"animated KHR_texture_transform.texCoord is unsupported because texCoord selection is structural, not a runtime float/vector update"};if(o!=="offset"&&o!=="rotation"&&o!=="scale")return{reason:`KHR_texture_transform property "${o}" is not animatable; supported properties are offset, rotation, and scale`};let i=e[r+3];if(e.length>r+4)return{reason:`KHR_texture_transform.${o} does not support nested property paths`};let a;if(i!==void 0){if(a=Number(i),o==="rotation")return{reason:"KHR_texture_transform.rotation does not support component indices"};if(!Number.isInteger(a)||a<0||a>1)return{reason:`KHR_texture_transform.${o} component index "${i}" is invalid; only 0 and 1 are supported`}}return{type:"textureTransform",textureSlot:n.slot,path:o,component:a,baseTransform:Ke(s)}}function ri(t,e){let r=t;for(let n of e)if(r=r?.[n],!r)return null;return r}function ni(t){return t.slice(1).split("/").map(e=>e.replace(/~1/g,"/").replace(/~0/g,"~"))}function S(t){let e=An(t);if(e){let r=St(e);if(r?.supportLevel==="none")return`${e} is referenced by this pointer, but ${r.comment.charAt(0).toLowerCase()}${r.comment.slice(1)}`}return`no runtime target exists for material property "${t.join("/")}"`}function si(t){let e=An(t);if(e){let r=St(e);if(r?.supportLevel==="none")return`${e} is referenced by this pointer, but ${r.comment.charAt(0).toLowerCase()}${r.comment.slice(1)}`}return`texture-transform target "${t.join("/")}" has no runtime texture-slot mapping`}function An(t){let e=t.indexOf("extensions"),r=t[e+1];return e>=0&&r?r:null}function de(t,e){ne.log.warn(`KHR_animation_pointer target ${t} will be skipped because ${e}`)()}function oi(t,e){if(e.has(t))return e.get(t);let{typedArray:r,components:n}=bt(t);En(n===1,"accessorToJsArray1D must have exactly 1 component");let s=Array.from(r);return e.set(t,s),s}function ii(t,e){if(e.has(t))return e.get(t);let{typedArray:r,components:n}=bt(t);En(n>=1,"accessorToJsArray2D must have at least 1 component");let s=[];for(let o=0;o<r.length;o+=n)s.push(Array.from(r.slice(o,o+n)));return e.set(t,s),s}function En(t,e){if(!t)throw new Error(e)}function wn(t,e,r){let{scenes:n,materials:s,gltfMeshIdToNodeMap:o,gltfNodeIdToNodeMap:i,gltfNodeIndexToNodeMap:a}=gn(t,e,r),c=_n(e),l=new re({animations:c,gltfNodeIdToNodeMap:i,materials:s}),m=Ve(e,{useByteColors:r?.useByteColors??!0}),p=qe(e),f=n.map(u=>Sn(u.getBounds())),h=ai(f);return{scenes:n,materials:s,animator:l,lights:m,extensionSupport:p,sceneBounds:f,modelBounds:h,gltfMeshIdToNodeMap:o,gltfNodeIdToNodeMap:i,gltfNodeIndexToNodeMap:a,gltf:e}}function Sn(t){if(!t)return{bounds:null,center:[0,0,0],size:[0,0,0],radius:.5,recommendedOrbitDistance:1};let e=[[t[0][0],t[0][1],t[0][2]],[t[1][0],t[1][1],t[1][2]]],r=[e[1][0]-e[0][0],e[1][1]-e[0][1],e[1][2]-e[0][2]],n=[e[0][0]+r[0]*.5,e[0][1]+r[1]*.5,e[0][2]+r[2]*.5],s=Math.max(r[0],r[1],r[2])*.5,o=Math.max(.5*Math.hypot(r[0],r[1],r[2]),.001);return{bounds:e,center:n,size:r,radius:o,recommendedOrbitDistance:Math.max(Math.max(s,.001)/Math.tan(Math.PI/6)*1.15,o*1.1)}}function ai(t){let e=null;for(let r of t)if(r.bounds){if(!e){e=[[...r.bounds[0]],[...r.bounds[1]]];continue}for(let n=0;n<3;n++)e[0][n]=Math.min(e[0][n],r.bounds[0][n]),e[1][n]=Math.max(e[1][n],r.bounds[1][n])}return Sn(e)}return vn(xe);})();
169
+ `;function Et(t,e){let r=e.materialFactory||new ne.MaterialFactory(t,{modules:[de.pbrMaterial]}),n={...e.parsedPPBRMaterial.uniforms};delete n.camera;let s=Object.fromEntries(Object.entries({...n,...e.parsedPPBRMaterial.bindings}).filter(([i,a])=>r.ownsBinding(i)&&Io(a))),o=r.createMaterial({id:e.id,bindings:s});return o.setProps({pbrMaterial:n}),o}function gn(t,e){let{id:r,geometry:n,parsedPPBRMaterial:s,vertexCount:o,modelOptions:i={}}=e;q.log.info(4,"createGLTFModel defines: ",s.defines)();let a=[],c={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},l={id:r,source:No,vs:bo,fs:Lo,geometry:n,topology:n.topology,vertexCount:o,modules:[de.pbrMaterial,de.skin],...i,defines:{...s.defines,...i.defines},parameters:{...c,...s.parameters,...i.parameters}},m=e.material||Et(t,{id:r?`${r}-material`:void 0,parsedPPBRMaterial:s});l.material=m;let p=new ne.Model(t,l),f={...s.uniforms,...i.uniforms,...s.bindings,...i.bindings},h=vo(p.shaderInputs.getModules(),m,f);return p.shaderInputs.setProps(h),new ne.ModelNode({managedResources:a,model:p})}function Io(t){return t instanceof q.Buffer||t instanceof xn.DynamicTexture||t instanceof q.Sampler||t instanceof q.Texture||t instanceof q.TextureView}function vo(t,e,r){let n=new Map;for(let o of t){for(let i of Object.keys(o.uniformTypes||{}))n.set(i,o.name);for(let i of o.bindingLayout||[])n.set(i.name,o.name)}let s={};for(let[o,i]of Object.entries(r)){if(i===void 0)continue;let a=n.get(o);!a||e.ownsModule(a)||(s[a]||={},s[a][o]=i)}return s}var Po={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:void 0,lights:!0,useTangents:!1,useByteColors:!0};function Tn(t,e,r={}){let n={...Po,...r},s=new G.MaterialFactory(t,{modules:[Mn.pbrMaterial]}),o=(e.materials||[]).map((p,f)=>Et(t,{id:zo(p,f),parsedPPBRMaterial:ue(t,p,{},{...n,gltf:e,validateAttributes:!1}),materialFactory:s})),i=new Map;(e.materials||[]).forEach((p,f)=>{i.set(p.id,o[f])});let a=new Map;e.meshes.forEach((p,f)=>{let h=Fo(t,p,e,i,n);a.set(p.id,h)});let c=new Map,l=new Map;return e.nodes.forEach((p,f)=>{let h=Co(t,p,n);c.set(f,h),l.set(p.id,h)}),e.nodes.forEach((p,f)=>{if(c.get(f).add((p.children??[]).map(({id:h})=>{let u=l.get(h);if(!u)throw new Error(`Cannot find child ${h} of node ${f}`);return u})),p.mesh){let h=a.get(p.mesh.id);if(!h)throw new Error(`Cannot find mesh child ${p.mesh.id} of node ${f}`);c.get(f).add(h)}}),{scenes:e.scenes.map(p=>{let f=(p.nodes||[]).map(({id:h})=>{let u=l.get(h);if(!u)throw new Error(`Cannot find child ${h} of scene ${p.name||p.id}`);return u});return new G.GroupNode({id:p.name||p.id,children:f})}),materials:o,gltfMeshIdToNodeMap:a,gltfNodeIdToNodeMap:l,gltfNodeIndexToNodeMap:c}}function Co(t,e,r){return new G.GroupNode({id:e.name||e.id,children:[],matrix:e.matrix,position:e.translation,rotation:e.rotation,scale:e.scale})}function Fo(t,e,r,n,s){let i=(e.primitives||[]).map((c,l)=>ko({device:t,gltfPrimitive:c,primitiveIndex:l,gltfMesh:e,gltf:r,gltfMaterialIdToMaterialMap:n,options:s}));return new G.GroupNode({id:e.name||e.id,children:i})}function ko({device:t,gltfPrimitive:e,primitiveIndex:r,gltfMesh:n,gltf:s,gltfMaterialIdToMaterialMap:o,options:i}){let a=e.name||`${n.name||n.id}-primitive-${r}`,c=dn(e.mode??4),l=e.indices?e.indices.count:Ho(e.attributes),m=Uo(a,e,c),p=ue(t,e.material,m.attributes,{...i,gltf:s}),f=gn(t,{id:a,geometry:m,material:e.material&&o.get(e.material.id)||null,parsedPPBRMaterial:p,modelOptions:i.modelOptions,vertexCount:l});return f.bounds=[e.attributes.POSITION.min,e.attributes.POSITION.max],f}function Ho(t){let e=1/0;for(let r of Object.values(t))if(r){let{value:n,size:s,components:o}=r,i=s??o;n?.length!==void 0&&i>=1&&(e=Math.min(e,n.length/i))}if(!Number.isFinite(e))throw new Error("Could not determine vertex count from attributes");return e}function Uo(t,e,r){let n={};for(let[s,o]of Object.entries(e.attributes)){let{components:i,size:a,value:c,normalized:l}=o;n[s]={size:a??i,value:c,normalized:l}}return new G.Geometry({id:t,topology:r,indices:e.indices?.value,attributes:n})}function zo(t,e){return t.name||t.id||`material-${e}`}var qe=k(Z(),1);var wt=k(Q(),1);function Bo(t,e,r){switch(e){case"translation":return t.setPosition(r).updateMatrix();case"rotation":return t.setRotation(r).updateMatrix();case"scale":return t.setScale(r).updateMatrix();default:return wt.log.warn(`Bad animation path ${e}`)(),null}}function _n(t,{input:e,interpolation:r,output:n},s,o){let i=St(t,{input:e,interpolation:r,output:n},o);i&&Bo(s,o,i)}function St(t,{input:e,interpolation:r,output:n},s){let o=e[e.length-1];if(!Number.isFinite(o)||o<=0)return n[0]||null;let i=t%o,a=e.findIndex(p=>p>=i);if(a<0)return n[n.length-1]||null;let c=Math.max(0,a-1),l=e[c],m=e[a];switch(r){case"STEP":return n[c];case"LINEAR":if(m>l){let p=(i-l)/(m-l);return Ko(s,n[c],n[a],p)}return n[c]||null;case"CUBICSPLINE":if(m>l){let p=(i-l)/(m-l),f=m-l,h=n[3*c+1],u=n[3*c+2],d=n[3*a+0],x=n[3*a+1];return $o({p0:h,outTangent0:u,inTangent1:d,p1:x,tDiff:f,ratio:p})}return n[3*c+1]||null;default:return wt.log.warn(`Interpolation ${r} not supported`)(),null}}function Ko(t,e,r,n){if(t==="rotation")return new he().slerp({start:e,target:r,ratio:n});let s=[];for(let o=0;o<e.length;o++)s[o]=n*r[o]+(1-n)*e[o];return s}function $o({p0:t,outTangent0:e,inTangent1:r,p1:n,tDiff:s,ratio:o}){let i=[];for(let a=0;a<t.length;a++){let c=e[a]*s,l=r[a]*s;i[a]=(2*Math.pow(o,3)-3*Math.pow(o,2)+1)*t[a]+(Math.pow(o,3)-2*Math.pow(o,2)+o)*c+(-2*Math.pow(o,3)+3*Math.pow(o,2))*n[a]+(Math.pow(o,3)-Math.pow(o,2))*l}return i}var Ot=class extends qe.AnimationClipController{animation;gltfNodeIdToNodeMap;materials;materialTextureTransformState=new Map;constructor(e){if(super({name:e.animation.name||"unnamed"}),this.animation=e.animation,this.gltfNodeIdToNodeMap=e.gltfNodeIdToNodeMap,this.materials=e.materials||[],this.animation.name||="unnamed",this.name=this.animation.name,Object.assign(this,e),this.animation.channels.some(r=>r.type!=="node")&&!this.materials.length)throw new Error(`Animation ${this.animation.name} targets materials, but GLTFAnimator was created without a materials array`)}applyTime(e){this.animation.channels.forEach(r=>{if(r.type==="node"){let{sampler:o,targetNodeId:i,path:a}=r,c=this.gltfNodeIdToNodeMap.get(i);if(!c)throw new Error(`Cannot find animation target node ${i}`);_n(e,o,c,a);return}let n=this.materials[r.targetMaterialIndex];if(!n)throw new Error(`Cannot find animation target material ${r.targetMaterialIndex} for ${r.pointer}`);let s=St(e,r.sampler);s&&(r.type==="material"?Do(n,r,s):Wo(n,r,s,this.materialTextureTransformState))})}},se=class extends qe.Animator{constructor(e){super(e.animations.map((r,n)=>{let s=r.name||`Animation-${n}`;return new Ot({gltfNodeIdToNodeMap:e.gltfNodeIdToNodeMap,materials:e.materials,animation:{name:s,channels:r.channels}})}))}};function Do(t,e,r){let n=e.component!==void 0?{[e.property]:qo(Vo(t,e.property),e.component,r[0])}:{[e.property]:r.length===1?r[0]:r};t.setProps({pbrMaterial:n})}function Vo(t,e){let n=t.shaderInputs.getUniformValues().pbrMaterial?.[e];return Array.isArray(n)?[...n]:[]}function qo(t,e,r){let n=[...t];return n[e]=r,n}function Wo(t,e,r,n){let s=Ke(e.textureSlot),o=Yo(n,t,e);switch(e.path){case"offset":e.component!==void 0?o.offset[e.component]=r[0]:o.offset=[r[0],r[1]];break;case"rotation":o.rotation=r[0];break;case"scale":e.component!==void 0?o.scale[e.component]=r[0]:o.scale=[r[0],r[1]];break}t.setProps({pbrMaterial:{[s.uvTransformUniform]:an(e.baseTransform,o)}})}function Yo(t,e,r){let n=t.get(e)||{},s=n[r.textureSlot];return s||(s={offset:[...r.baseTransform.offset],rotation:r.baseTransform.rotation,scale:[...r.baseTransform.scale]},n[r.textureSlot]=s,t.set(e,n)),s}var oe=k(Q(),1);var Xo={supportLevel:"none",comment:"Not currently listed in the luma.gl glTF extension support registry."},yn={KHR_draco_mesh_compression:{supportLevel:"built-in",comment:"Decoded by loaders.gl before luma.gl builds the scenegraph."},EXT_meshopt_compression:{supportLevel:"built-in",comment:"Meshopt-compressed primitives are decoded during load."},KHR_mesh_quantization:{supportLevel:"built-in",comment:"Quantized accessors are unpacked before geometry creation."},KHR_lights_punctual:{supportLevel:"built-in",comment:"Parsed into luma.gl Light objects."},KHR_materials_unlit:{supportLevel:"built-in",comment:"Unlit materials bypass the default lighting path."},KHR_materials_emissive_strength:{supportLevel:"built-in",comment:"Applied by the stock PBR shader."},KHR_texture_basisu:{supportLevel:"built-in",comment:"BasisU / KTX2 textures pass through when the device supports them."},KHR_texture_transform:{supportLevel:"built-in",comment:"UV transforms are applied during load."},EXT_texture_webp:{supportLevel:"loader-only",comment:"Texture source is resolved during load; final support depends on browser and device decode support."},EXT_texture_avif:{supportLevel:"loader-only",comment:"Texture source is resolved during load; final support depends on browser and device decode support."},KHR_materials_specular:{supportLevel:"built-in",comment:"The stock shader now applies specular factors and textures to the dielectric F0 term."},KHR_materials_ior:{supportLevel:"built-in",comment:"The stock shader now drives dielectric reflectance from the glTF IOR value."},KHR_materials_transmission:{supportLevel:"built-in",comment:"The stock shader now applies transmission to the base layer and exposes transparency through alpha, without a scene-color refraction buffer."},KHR_materials_volume:{supportLevel:"built-in",comment:"Thickness and attenuation now tint transmitted light in the stock shader."},KHR_materials_clearcoat:{supportLevel:"built-in",comment:"The stock shader now adds a secondary clearcoat specular lobe."},KHR_materials_sheen:{supportLevel:"built-in",comment:"The stock shader now adds a sheen lobe for cloth-like materials."},KHR_materials_iridescence:{supportLevel:"built-in",comment:"The stock shader now tints specular response with a view-dependent thin-film iridescence approximation."},KHR_materials_anisotropy:{supportLevel:"built-in",comment:"The stock shader now shapes highlights and IBL response with an anisotropy-direction approximation."},KHR_materials_pbrSpecularGlossiness:{supportLevel:"loader-only",comment:"Extension data can be loaded, but it is not translated into the default metallic-roughness material path."},KHR_materials_variants:{supportLevel:"loader-only",comment:"Variant metadata can be loaded, but applications must choose and apply variants."},EXT_mesh_gpu_instancing:{supportLevel:"none",comment:"GPU instancing data is not yet converted into luma.gl instanced draw setup."},KHR_node_visibility:{supportLevel:"none",comment:"Node-visibility animations and toggles are not mapped onto runtime scenegraph state."},KHR_animation_pointer:{supportLevel:"parsed-and-wired",comment:"Selected node TRS, material factor, and KHR_texture_transform offset/rotation/scale pointers are wired to runtime updates; unsupported targets are skipped."},KHR_materials_diffuse_transmission:{supportLevel:"none",comment:"Diffuse-transmission shading is not implemented in the stock PBR shader."},KHR_materials_dispersion:{supportLevel:"none",comment:"Chromatic dispersion is not implemented in the stock PBR shader."},KHR_materials_volume_scatter:{supportLevel:"none",comment:"Volume scattering is not implemented in the stock PBR shader."},KHR_xmp:{supportLevel:"none",comment:"Metadata payloads remain in the loaded glTF, but luma.gl does not interpret them."},KHR_xmp_json_ld:{supportLevel:"none",comment:"Metadata is preserved in the glTF, but luma.gl does not interpret it."},EXT_lights_image_based:{supportLevel:"none",comment:"Use loadPBREnvironment() or custom environment setup instead."},EXT_texture_video:{supportLevel:"none",comment:"Video textures are not created automatically by the stock pipeline."},MSFT_lod:{supportLevel:"none",comment:"Level-of-detail switching is not implemented in the stock scenegraph loader."}};function Ye(t){let r=Array.from(Go(t)).sort().map(n=>{let s=yn[n]||Xo;return[n,{extensionName:n,supported:s.supportLevel==="built-in"||s.supportLevel==="parsed-and-wired",supportLevel:s.supportLevel,comment:s.comment}]});return new Map(r)}function Nt(t){return yn[t]||null}function Go(t){let e=t,r=new Set;return We(r,t.extensionsUsed),We(r,t.extensionsRequired),We(r,e.extensionsRemoved),We(r,Object.keys(t.extensions||{})),(e.lights?.length||(t.nodes||[]).some(n=>"light"in n))&&r.add("KHR_lights_punctual"),(t.materials||[]).some(n=>{let s=n;return s.unlit||s.extensions?.KHR_materials_unlit})&&r.add("KHR_materials_unlit"),r}function We(t,e=[]){for(let r of e)t.add(r)}var jo={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Jo={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function bt(t){let e=Jo[t.componentType],r=jo[t.type],n=r*t.count,{buffer:s,byteOffset:o=0}=t.bufferView?.data??{};return{typedArray:new e(s,o+(t.byteOffset||0),n),components:r}}function Rn(t){let e=t.animations||[],r=new Map,n=new Map;return e.flatMap((s,o)=>{let i=s.name||`Animation-${o}`,a=new Map,c=s.channels.flatMap(({sampler:l,target:m})=>{let p=a.get(l);if(!p){let h=s.samplers[l];if(!h)throw new Error(`Cannot find animation sampler ${l}`);let{input:u,interpolation:d="LINEAR",output:x}=h;p={input:ai(t.accessors[u],r),interpolation:d,output:ci(t.accessors[x],n)},a.set(l,p)}let f=Qo(t,m,p);return f?[f]:[]});return c.length?[{name:i,channels:c}]:[]})}function Qo(t,e,r){if(e.path==="pointer")return Zo(t,e,r);let n=An(e.path);if(!n)return null;let s=t.nodes[e.node??0];if(!s)throw new Error(`Cannot find animation target ${e.node}`);return{type:"node",sampler:r,targetNodeId:s.id,path:n}}function Zo(t,e,r){let n=e.extensions?.KHR_animation_pointer?.pointer;if(typeof n!="string"||!n.startsWith("/"))return oe.log.warn("KHR_animation_pointer channel is missing a valid JSON pointer and will be skipped")(),null;let s=oi(n);switch(s[0]){case"nodes":return ei(t,s,r,n);case"materials":return ti(t,s,r,n);default:return xe(n,`top-level target "${s[0]}" has no runtime animation mapping`),null}}function ei(t,e,r,n){if(e.length!==3)return xe(n,"node pointers must use /nodes/{index}/{translation|rotation|scale|weights}"),null;let s=Number(e[1]),o=t.nodes[s];if(!Number.isInteger(s)||!o)return oe.log.warn(`KHR_animation_pointer target ${n} references a missing node and will be skipped`)(),null;let i=An(e[2]);return i?i==="weights"?(oe.log.warn(`KHR_animation_pointer target ${n} will be skipped because morph weights are not implemented in GLTFAnimator`)(),null):{type:"node",sampler:r,targetNodeId:o.id,path:i}:(xe(n,`node property "${e[2]}" has no runtime animation mapping`),null)}function ti(t,e,r,n){if(e.length<3)return xe(n,"material pointers must include a material index and target property path"),null;let s=Number(e[1]),o=t.materials[s];if(!Number.isInteger(s)||!o)return oe.log.warn(`KHR_animation_pointer target ${n} references a missing material and will be skipped`)(),null;let i=ri(o,e.slice(2));return"reason"in i?(xe(n,i.reason),null):{sampler:r,pointer:n,targetMaterialIndex:s,...i}}function An(t){switch(t){case"translation":case"rotation":case"scale":case"weights":return t;default:return null}}function ri(t,e){let r=ni(t,e);if(!("reason"in r)||r.reason!=="not-a-texture-transform-target")return r;switch(e.join("/")){case"pbrMetallicRoughness/baseColorFactor":return t.pbrMetallicRoughness?{type:"material",property:"baseColorFactor"}:{reason:S(e)};case"pbrMetallicRoughness/metallicFactor":return t.pbrMetallicRoughness?{type:"material",property:"metallicRoughnessValues",component:0}:{reason:S(e)};case"pbrMetallicRoughness/roughnessFactor":return t.pbrMetallicRoughness?{type:"material",property:"metallicRoughnessValues",component:1}:{reason:S(e)};case"normalTexture/scale":return t.normalTexture?{type:"material",property:"normalScale"}:{reason:S(e)};case"occlusionTexture/strength":return t.occlusionTexture?{type:"material",property:"occlusionStrength"}:{reason:S(e)};case"emissiveFactor":return{type:"material",property:"emissiveFactor"};case"alphaCutoff":return{type:"material",property:"alphaCutoff"};case"extensions/KHR_materials_specular/specularFactor":return t.extensions?.KHR_materials_specular?{type:"material",property:"specularIntensityFactor"}:{reason:S(e)};case"extensions/KHR_materials_specular/specularColorFactor":return t.extensions?.KHR_materials_specular?{type:"material",property:"specularColorFactor"}:{reason:S(e)};case"extensions/KHR_materials_ior/ior":return t.extensions?.KHR_materials_ior?{type:"material",property:"ior"}:{reason:S(e)};case"extensions/KHR_materials_transmission/transmissionFactor":return t.extensions?.KHR_materials_transmission?{type:"material",property:"transmissionFactor"}:{reason:S(e)};case"extensions/KHR_materials_volume/thicknessFactor":return t.extensions?.KHR_materials_volume?{type:"material",property:"thicknessFactor"}:{reason:S(e)};case"extensions/KHR_materials_volume/attenuationDistance":return t.extensions?.KHR_materials_volume?{type:"material",property:"attenuationDistance"}:{reason:S(e)};case"extensions/KHR_materials_volume/attenuationColor":return t.extensions?.KHR_materials_volume?{type:"material",property:"attenuationColor"}:{reason:S(e)};case"extensions/KHR_materials_clearcoat/clearcoatFactor":return t.extensions?.KHR_materials_clearcoat?{type:"material",property:"clearcoatFactor"}:{reason:S(e)};case"extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor":return t.extensions?.KHR_materials_clearcoat?{type:"material",property:"clearcoatRoughnessFactor"}:{reason:S(e)};case"extensions/KHR_materials_sheen/sheenColorFactor":return t.extensions?.KHR_materials_sheen?{type:"material",property:"sheenColorFactor"}:{reason:S(e)};case"extensions/KHR_materials_sheen/sheenRoughnessFactor":return t.extensions?.KHR_materials_sheen?{type:"material",property:"sheenRoughnessFactor"}:{reason:S(e)};case"extensions/KHR_materials_iridescence/iridescenceFactor":return t.extensions?.KHR_materials_iridescence?{type:"material",property:"iridescenceFactor"}:{reason:S(e)};case"extensions/KHR_materials_iridescence/iridescenceIor":return t.extensions?.KHR_materials_iridescence?{type:"material",property:"iridescenceIor"}:{reason:S(e)};case"extensions/KHR_materials_iridescence/iridescenceThicknessMinimum":return t.extensions?.KHR_materials_iridescence?{type:"material",property:"iridescenceThicknessRange",component:0}:{reason:S(e)};case"extensions/KHR_materials_iridescence/iridescenceThicknessMaximum":return t.extensions?.KHR_materials_iridescence?{type:"material",property:"iridescenceThicknessRange",component:1}:{reason:S(e)};case"extensions/KHR_materials_anisotropy/anisotropyStrength":return t.extensions?.KHR_materials_anisotropy?{type:"material",property:"anisotropyStrength"}:{reason:S(e)};case"extensions/KHR_materials_anisotropy/anisotropyRotation":return t.extensions?.KHR_materials_anisotropy?{type:"material",property:"anisotropyRotation"}:{reason:S(e)};case"extensions/KHR_materials_emissive_strength/emissiveStrength":return t.extensions?.KHR_materials_emissive_strength?{type:"material",property:"emissiveStrength"}:{reason:S(e)};default:return{reason:S(e)}}}function ni(t,e){let r=e.lastIndexOf("extensions");if(r<0||e[r+1]!=="KHR_texture_transform"||r<1)return{reason:"not-a-texture-transform-target"};let n=on(e.slice(0,r));if(!n)return{reason:ii(e.slice(0,r))};let s=si(t,n.pathSegments);if(!s)return{reason:`texture-transform target "${e.slice(0,r).join("/")}" does not exist on the referenced material`};let o=e[r+2];if(o==="texCoord")return{reason:"animated KHR_texture_transform.texCoord is unsupported because texCoord selection is structural, not a runtime float/vector update"};if(o!=="offset"&&o!=="rotation"&&o!=="scale")return{reason:`KHR_texture_transform property "${o}" is not animatable; supported properties are offset, rotation, and scale`};let i=e[r+3];if(e.length>r+4)return{reason:`KHR_texture_transform.${o} does not support nested property paths`};let a;if(i!==void 0){if(a=Number(i),o==="rotation")return{reason:"KHR_texture_transform.rotation does not support component indices"};if(!Number.isInteger(a)||a<0||a>1)return{reason:`KHR_texture_transform.${o} component index "${i}" is invalid; only 0 and 1 are supported`}}return{type:"textureTransform",textureSlot:n.slot,path:o,component:a,baseTransform:$e(s)}}function si(t,e){let r=t;for(let n of e)if(r=r?.[n],!r)return null;return r}function oi(t){return t.slice(1).split("/").map(e=>e.replace(/~1/g,"/").replace(/~0/g,"~"))}function S(t){let e=En(t);if(e){let r=Nt(e);if(r?.supportLevel==="none")return`${e} is referenced by this pointer, but ${r.comment.charAt(0).toLowerCase()}${r.comment.slice(1)}`}return`no runtime target exists for material property "${t.join("/")}"`}function ii(t){let e=En(t);if(e){let r=Nt(e);if(r?.supportLevel==="none")return`${e} is referenced by this pointer, but ${r.comment.charAt(0).toLowerCase()}${r.comment.slice(1)}`}return`texture-transform target "${t.join("/")}" has no runtime texture-slot mapping`}function En(t){let e=t.indexOf("extensions"),r=t[e+1];return e>=0&&r?r:null}function xe(t,e){oe.log.warn(`KHR_animation_pointer target ${t} will be skipped because ${e}`)()}function ai(t,e){if(e.has(t))return e.get(t);let{typedArray:r,components:n}=bt(t);wn(n===1,"accessorToJsArray1D must have exactly 1 component");let s=Array.from(r);return e.set(t,s),s}function ci(t,e){if(e.has(t))return e.get(t);let{typedArray:r,components:n}=bt(t);wn(n>=1,"accessorToJsArray2D must have at least 1 component");let s=[];for(let o=0;o<r.length;o+=n)s.push(Array.from(r.slice(o,o+n)));return e.set(t,s),s}function wn(t,e){if(!t)throw new Error(e)}function Sn(t,e,r){let{scenes:n,materials:s,gltfMeshIdToNodeMap:o,gltfNodeIdToNodeMap:i,gltfNodeIndexToNodeMap:a}=Tn(t,e,r),c=Rn(e),l=new se({animations:c,gltfNodeIdToNodeMap:i,materials:s}),m=Ve(e,{useByteColors:r?.useByteColors??!0}),p=Ye(e),f=n.map(u=>On(u.getBounds())),h=li(f);return{scenes:n,materials:s,animator:l,lights:m,extensionSupport:p,sceneBounds:f,modelBounds:h,gltfMeshIdToNodeMap:o,gltfNodeIdToNodeMap:i,gltfNodeIndexToNodeMap:a,gltf:e}}function On(t){if(!t)return{bounds:null,center:[0,0,0],size:[0,0,0],radius:.5,recommendedOrbitDistance:1};let e=[[t[0][0],t[0][1],t[0][2]],[t[1][0],t[1][1],t[1][2]]],r=[e[1][0]-e[0][0],e[1][1]-e[0][1],e[1][2]-e[0][2]],n=[e[0][0]+r[0]*.5,e[0][1]+r[1]*.5,e[0][2]+r[2]*.5],s=Math.max(r[0],r[1],r[2])*.5,o=Math.max(.5*Math.hypot(r[0],r[1],r[2]),.001);return{bounds:e,center:n,size:r,radius:o,recommendedOrbitDistance:Math.max(Math.max(s,.001)/Math.tan(Math.PI/6)*1.15,o*1.1)}}function li(t){let e=null;for(let r of t)if(r.bounds){if(!e){e=[[...r.bounds[0]],[...r.bounds[1]]];continue}for(let n=0;n<3;n++)e[0][n]=Math.min(e[0][n],r.bounds[0][n]),e[1][n]=Math.max(e[1][n],r.bounds[1][n])}return On(e)}return Pn(ge);})();
170
170
  return __exports__;
171
171
  });
@@ -1,43 +1,31 @@
1
- import { GroupNode, Material } from '@luma.gl/engine';
1
+ import { AnimationClipController, Animator, GroupNode, Material } from '@luma.gl/engine';
2
2
  import { GLTFAnimation } from "./animations/animations.js";
3
3
  import { type PBRTextureTransform, type PBRTextureTransformSlot } from "../pbr/texture-transform.js";
4
4
  /** Construction props for a single glTF animation controller. */
5
- type GLTFSingleAnimatorProps = {
5
+ type GLTFAnimationClipProps = {
6
6
  /** Animation data to evaluate. */
7
7
  animation: GLTFAnimation;
8
8
  /** Mapping from glTF node ids to scenegraph nodes. */
9
9
  gltfNodeIdToNodeMap: Map<string, GroupNode>;
10
10
  /** Materials aligned with the source glTF materials array. */
11
11
  materials?: Material[];
12
- /** Start time in seconds. */
13
- startTime?: number;
14
- /** Whether playback is active. */
15
- playing?: boolean;
16
- /** Playback speed multiplier. */
17
- speed?: number;
18
12
  };
19
13
  /** Evaluates one glTF animation against the generated scenegraph. */
20
- declare class GLTFSingleAnimator {
14
+ export declare class GLTFAnimationClip extends AnimationClipController {
21
15
  /** Animation definition being played. */
22
16
  animation: GLTFAnimation;
23
17
  /** Target scenegraph lookup table. */
24
18
  gltfNodeIdToNodeMap: Map<string, GroupNode>;
25
19
  /** Materials aligned with the source glTF materials array. */
26
20
  materials: Material[];
27
- /** Playback start time in seconds. */
28
- startTime: number;
29
- /** Whether playback is currently enabled. */
30
- playing: boolean;
31
- /** Playback speed multiplier. */
32
- speed: number;
33
21
  /** Mutable runtime texture-transform state for animated material slots. */
34
22
  materialTextureTransformState: Map<Material<Partial<Record<string, Record<string, unknown>>>, {
35
- [x: string]: import("@luma.gl/engine").DynamicTexture | import("@luma.gl/core").Binding;
23
+ [x: string]: import("@luma.gl/core").Binding | import("@luma.gl/engine").TextureBindingSource | import("@luma.gl/engine").DynamicBuffer | import("@luma.gl/engine").DynamicBufferRange;
36
24
  }>, Partial<Record<PBRTextureTransformSlot, PBRTextureTransform>>>;
37
25
  /** Creates a single-animation controller. */
38
- constructor(props: GLTFSingleAnimatorProps);
39
- /** Advances the animation to the supplied wall-clock time in milliseconds. */
40
- setTime(timeMs: number): void;
26
+ constructor(props: GLTFAnimationClipProps);
27
+ /** Applies the resolved local clip time in seconds. */
28
+ protected applyTime(time: number): void;
41
29
  }
42
30
  /** Construction props for {@link GLTFAnimator}. */
43
31
  export type GLTFAnimatorProps = {
@@ -49,17 +37,9 @@ export type GLTFAnimatorProps = {
49
37
  materials?: Material[];
50
38
  };
51
39
  /** Coordinates playback of every animation found in a glTF scene. */
52
- export declare class GLTFAnimator {
53
- /** Individual animation controllers. */
54
- animations: GLTFSingleAnimator[];
40
+ export declare class GLTFAnimator extends Animator<GLTFAnimationClip> {
55
41
  /** Creates an animator for the supplied glTF scenegraph. */
56
42
  constructor(props: GLTFAnimatorProps);
57
- /** @deprecated Use .setTime(). Will be removed (deck.gl is using this) */
58
- animate(time: number): void;
59
- /** Advances every animation to the supplied wall-clock time in milliseconds. */
60
- setTime(time: number): void;
61
- /** Returns the per-animation controllers managed by this animator. */
62
- getAnimations(): GLTFSingleAnimator[];
63
43
  }
64
44
  export {};
65
45
  //# sourceMappingURL=gltf-animator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gltf-animator.d.ts","sourceRoot":"","sources":["../../src/gltf/gltf-animator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,aAAa,EAId,mCAAgC;AAEjC,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,oCAAiC;AAElC,iEAAiE;AACjE,KAAK,uBAAuB,GAAG;IAC7B,kCAAkC;IAClC,SAAS,EAAE,aAAa,CAAC;IACzB,sDAAsD;IACtD,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC5C,8DAA8D;IAC9D,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qEAAqE;AACrE,cAAM,kBAAkB;IACtB,yCAAyC;IACzC,SAAS,EAAE,aAAa,CAAC;IACzB,sCAAsC;IACtC,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC5C,8DAA8D;IAC9D,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAK;IACtB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAQ;IACxB,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAK;IAClB,2EAA2E;IAC3E,6BAA6B;;uEAGzB;IAEJ,6CAA6C;gBACjC,KAAK,EAAE,uBAAuB;IAiB1C,8EAA8E;IAC9E,OAAO,CAAC,MAAM,EAAE,MAAM;CA0CvB;AAED,mDAAmD;AACnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8CAA8C;IAC9C,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,sDAAsD;IACtD,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC5C,8DAA8D;IAC9D,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,qEAAqE;AACrE,qBAAa,YAAY;IACvB,wCAAwC;IACxC,UAAU,EAAE,kBAAkB,EAAE,CAAC;IAEjC,4DAA4D;gBAChD,KAAK,EAAE,iBAAiB;IAWpC,0EAA0E;IAC1E,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK3B,gFAAgF;IAChF,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI3B,sEAAsE;IACtE,aAAa;CAGd"}
1
+ {"version":3,"file":"gltf-animator.d.ts","sourceRoot":"","sources":["../../src/gltf/gltf-animator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,uBAAuB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACvF,OAAO,EACL,aAAa,EAId,mCAAgC;AAEjC,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,oCAAiC;AAElC,iEAAiE;AACjE,KAAK,sBAAsB,GAAG;IAC5B,kCAAkC;IAClC,SAAS,EAAE,aAAa,CAAC;IACzB,sDAAsD;IACtD,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC5C,8DAA8D;IAC9D,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,qEAAqE;AACrE,qBAAa,iBAAkB,SAAQ,uBAAuB;IAC5D,yCAAyC;IACzC,SAAS,EAAE,aAAa,CAAC;IACzB,sCAAsC;IACtC,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC5C,8DAA8D;IAC9D,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,2EAA2E;IAC3E,6BAA6B;;uEAGzB;IAEJ,6CAA6C;gBACjC,KAAK,EAAE,sBAAsB;IAmBzC,uDAAuD;cACpC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAmCjD;AAED,mDAAmD;AACnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8CAA8C;IAC9C,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,sDAAsD;IACtD,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC5C,8DAA8D;IAC9D,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,qEAAqE;AACrE,qBAAa,YAAa,SAAQ,QAAQ,CAAC,iBAAiB,CAAC;IAC3D,4DAA4D;gBAChD,KAAK,EAAE,iBAAiB;CAYrC"}