@vctrl/hooks 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +0,0 @@
1
- "use strict";const Dr=require("react"),Dn=require("./_commonjsHelpers-DZAafUiT.cjs");class fs{constructor(){this._listeners={}}addEventListener(e,t){const r=this._listeners;return r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t),this}removeEventListener(e,t){if(this._listeners===void 0)return this;const n=this._listeners[e];if(n!==void 0){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}return this}dispatchEvent(e){if(this._listeners===void 0)return this;const r=this._listeners[e.type];if(r!==void 0){const n=r.slice(0);for(let i=0,o=n.length;i<o;i++)n[i].call(this,e)}return this}dispose(){for(const e in this._listeners)delete this._listeners[e]}}class Xe extends fs{constructor(e,t,r,n={}){if(super(),this._name=void 0,this._parent=void 0,this._child=void 0,this._attributes=void 0,this._disposed=!1,this._name=e,this._parent=t,this._child=r,this._attributes=n,!t.isOnGraph(r))throw new Error("Cannot connect disconnected graphs.")}getName(){return this._name}getParent(){return this._parent}getChild(){return this._child}setChild(e){return this._child=e,this}getAttributes(){return this._attributes}dispose(){this._disposed||(this._disposed=!0,this.dispatchEvent({type:"dispose",target:this}),super.dispose())}isDisposed(){return this._disposed}}class Ir extends fs{constructor(...e){super(...e),this._emptySet=new Set,this._edges=new Set,this._parentEdges=new Map,this._childEdges=new Map}listEdges(){return Array.from(this._edges)}listParentEdges(e){return Array.from(this._childEdges.get(e)||this._emptySet)}listParents(e){return this.listParentEdges(e).map(t=>t.getParent())}listChildEdges(e){return Array.from(this._parentEdges.get(e)||this._emptySet)}listChildren(e){return this.listChildEdges(e).map(t=>t.getChild())}disconnectParents(e,t){let r=this.listParentEdges(e);return t&&(r=r.filter(n=>t(n.getParent()))),r.forEach(n=>n.dispose()),this}createEdge(e,t,r,n){return this._registerEdge(new Xe(e,t,r,n))}_registerEdge(e){this._edges.add(e);const t=e.getParent();this._parentEdges.has(t)||this._parentEdges.set(t,new Set),this._parentEdges.get(t).add(e);const r=e.getChild();return this._childEdges.has(r)||this._childEdges.set(r,new Set),this._childEdges.get(r).add(e),e.addEventListener("dispose",()=>this._removeEdge(e)),e}_removeEdge(e){return this._edges.delete(e),this._parentEdges.get(e.getParent()).delete(e),this._childEdges.get(e.getChild()).delete(e),this}}function ut(){return ut=Object.assign||function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},ut.apply(this,arguments)}class _e{constructor(e){if(this.list=[],e)for(const t of e)this.list.push(t)}add(e){this.list.push(e)}remove(e){const t=this.list.indexOf(e);t>=0&&this.list.splice(t,1)}removeChild(e){const t=[];for(const r of this.list)r.getChild()===e&&t.push(r);for(const r of t)this.remove(r);return t}listRefsByChild(e){const t=[];for(const r of this.list)r.getChild()===e&&t.push(r);return t}values(){return this.list}}class _{constructor(e){if(this.set=new Set,this.map=new Map,e)for(const t of e)this.add(t)}add(e){const t=e.getChild();this.removeChild(t),this.set.add(e),this.map.set(t,e)}remove(e){this.set.delete(e),this.map.delete(e.getChild())}removeChild(e){const t=this.map.get(e)||null;return t&&this.remove(t),t}getRefByChild(e){return this.map.get(e)||null}values(){return Array.from(this.set)}}class fe{constructor(e){this.map={},e&&Object.assign(this.map,e)}set(e,t){this.map[e]=t}delete(e){delete this.map[e]}get(e){return this.map[e]||null}keys(){return Object.keys(this.map)}values(){return Object.values(this.map)}}const K=Symbol("attributes"),We=Symbol("immutableKeys");class Bs extends fs{constructor(e){super(),this._disposed=!1,this.graph=void 0,this[K]=void 0,this[We]=void 0,this.graph=e,this[We]=new Set,this[K]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){const e=this.getDefaults(),t={};for(const r in e){const n=e[r];if(n instanceof Bs){const i=this.graph.createEdge(r,this,n);i.addEventListener("dispose",()=>n.dispose()),this[We].add(r),t[r]=i}else t[r]=n}return t}isOnGraph(e){return this.graph===e.graph}isDisposed(){return this._disposed}dispose(){this._disposed||(this.graph.listChildEdges(this).forEach(e=>e.dispose()),this.graph.disconnectParents(this),this._disposed=!0,this.dispatchEvent({type:"dispose"}))}detach(){return this.graph.disconnectParents(this),this}swap(e,t){for(const r in this[K]){const n=this[K][r];if(n instanceof Xe){const i=n;i.getChild()===e&&this.setRef(r,t,i.getAttributes())}else if(n instanceof _e)for(const i of n.listRefsByChild(e)){const o=i.getAttributes();this.removeRef(r,e),this.addRef(r,t,o)}else if(n instanceof _){const i=n.getRefByChild(e);if(i){const o=i.getAttributes();this.removeRef(r,e),this.addRef(r,t,o)}}else if(n instanceof fe)for(const i of n.keys()){const o=n.get(i);o.getChild()===e&&this.setRefMap(r,i,t,o.getAttributes())}}return this}get(e){return this[K][e]}set(e,t){return this[K][e]=t,this.dispatchEvent({type:"change",attribute:e})}getRef(e){const t=this[K][e];return t?t.getChild():null}setRef(e,t,r){if(this[We].has(e))throw new Error(`Cannot overwrite immutable attribute, "${e}".`);const n=this[K][e];if(n&&n.dispose(),!t)return this;const i=this.graph.createEdge(e,this,t,r);return i.addEventListener("dispose",()=>{delete this[K][e],this.dispatchEvent({type:"change",attribute:e})}),this[K][e]=i,this.dispatchEvent({type:"change",attribute:e})}listRefs(e){return this.assertRefList(e).values().map(r=>r.getChild())}addRef(e,t,r){const n=this.graph.createEdge(e,this,t,r),i=this.assertRefList(e);return i.add(n),n.addEventListener("dispose",()=>{i.remove(n),this.dispatchEvent({type:"change",attribute:e})}),this.dispatchEvent({type:"change",attribute:e})}removeRef(e,t){const r=this.assertRefList(e);if(r instanceof _e)for(const n of r.removeChild(t))n.dispose();else{const n=r.removeChild(t);n&&n.dispose()}return this}assertRefList(e){const t=this[K][e];if(t instanceof _e||t instanceof _)return t;throw new Error(`Expected RefList or RefSet for attribute "${e}"`)}listRefMapKeys(e){return this.assertRefMap(e).keys()}listRefMapValues(e){return this.assertRefMap(e).values().map(t=>t.getChild())}getRefMap(e,t){const n=this.assertRefMap(e).get(t);return n?n.getChild():null}setRefMap(e,t,r,n){const i=this.assertRefMap(e),o=i.get(t);if(o&&o.dispose(),!r)return this;n=Object.assign(n||{},{key:t});const a=this.graph.createEdge(e,this,r,ut({},n,{key:t}));return a.addEventListener("dispose",()=>{i.delete(t),this.dispatchEvent({type:"change",attribute:e,key:t})}),i.set(t,a),this.dispatchEvent({type:"change",attribute:e,key:t})}assertRefMap(e){const t=this[K][e];if(t instanceof fe)return t;throw new Error(`Expected RefMap for attribute "${e}"`)}dispatchEvent(e){return super.dispatchEvent(ut({},e,{target:this})),this.graph.dispatchEvent(ut({},e,{target:this,type:`node:${e.type}`})),this}}const In="v4.0.8",ze="@glb.bin";var E;(function(s){s.ACCESSOR="Accessor",s.ANIMATION="Animation",s.ANIMATION_CHANNEL="AnimationChannel",s.ANIMATION_SAMPLER="AnimationSampler",s.BUFFER="Buffer",s.CAMERA="Camera",s.MATERIAL="Material",s.MESH="Mesh",s.PRIMITIVE="Primitive",s.PRIMITIVE_TARGET="PrimitiveTarget",s.NODE="Node",s.ROOT="Root",s.SCENE="Scene",s.SKIN="Skin",s.TEXTURE="Texture",s.TEXTURE_INFO="TextureInfo"})(E||(E={}));var Ft;(function(s){s.INTERLEAVED="interleaved",s.SEPARATE="separate"})(Ft||(Ft={}));var se;(function(s){s.ARRAY_BUFFER="ARRAY_BUFFER",s.ELEMENT_ARRAY_BUFFER="ELEMENT_ARRAY_BUFFER",s.INVERSE_BIND_MATRICES="INVERSE_BIND_MATRICES",s.OTHER="OTHER",s.SPARSE="SPARSE"})(se||(se={}));var ae;(function(s){s[s.R=4096]="R",s[s.G=256]="G",s[s.B=16]="B",s[s.A=1]="A"})(ae||(ae={}));var Je;(function(s){s.GLTF="GLTF",s.GLB="GLB"})(Je||(Je={}));const gt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};var Yt=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var s=0,e=arguments.length;e--;)s+=arguments[e]*arguments[e];return Math.sqrt(s)});function Tr(){var s=new Yt(3);return Yt!=Float32Array&&(s[0]=0,s[1]=0,s[2]=0),s}function Ut(s){var e=s[0],t=s[1],r=s[2];return Math.hypot(e,t,r)}function mr(s,e,t){var r=e[0],n=e[1],i=e[2],o=t[3]*r+t[7]*n+t[11]*i+t[15];return o=o||1,s[0]=(t[0]*r+t[4]*n+t[8]*i+t[12])/o,s[1]=(t[1]*r+t[5]*n+t[9]*i+t[13])/o,s[2]=(t[2]*r+t[6]*n+t[10]*i+t[14])/o,s}(function(){var s=Tr();return function(e,t,r,n,i,o){var a,A;for(t||(t=3),r||(r=0),n?A=Math.min(n*t+r,e.length):A=e.length,a=r;a<A;a+=t)s[0]=e[a],s[1]=e[a+1],s[2]=e[a+2],i(s,s,o),e[a]=s[0],e[a+1]=s[1],e[a+2]=s[2];return e}})();function Fr(s){const e=Tn(),t=s.propertyType===E.NODE?[s]:s.listChildren();for(const r of t)r.traverse(n=>{const i=n.getMesh();if(!i)return;const o=yr(i,n.getWorldMatrix());o.min.every(isFinite)&&o.max.every(isFinite)&&(qt(o.min,e),qt(o.max,e))});return e}function yr(s,e){const t=Tn();for(const r of s.listPrimitives()){const n=r.getAttribute("POSITION"),i=r.getIndices();if(!n)continue;let o=[0,0,0],a=[0,0,0];for(let A=0,u=i?i.getCount():n.getCount();A<u;A++){const f=i?i.getScalar(A):A;o=n.getElement(f,o),a=mr(a,o,e),qt(a,t)}}return t}function qt(s,e){for(let t=0;t<3;t++)e.min[t]=Math.min(s[t],e.min[t]),e.max[t]=Math.max(s[t],e.max[t])}function Tn(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class O{static createBufferFromDataURI(e){if(typeof Buffer>"u"){const t=atob(e.split(",")[1]),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}else{const t=e.split(",")[1],r=e.indexOf("base64")>=0;return Buffer.from(t,r?"base64":"utf8")}}static encodeText(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):Buffer.from(e)}static decodeText(e){return typeof TextDecoder<"u"?new TextDecoder().decode(e):Buffer.from(e).toString("utf8")}static concat(e){let t=0;for(const i of e)t+=i.byteLength;const r=new Uint8Array(t);let n=0;for(const i of e)r.set(i,n),n+=i.byteLength;return r}static pad(e,t=0){const r=this.padNumber(e.byteLength);if(r===e.byteLength)return e;const n=new Uint8Array(r);if(n.set(e),t!==0)for(let i=e.byteLength;i<r;i++)n[i]=t;return n}static padNumber(e){return Math.ceil(e/4)*4}static equals(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;let r=e.byteLength;for(;r--;)if(e[r]!==t[r])return!1;return!0}static toView(e,t=0,r=1/0){return new Uint8Array(e.buffer,e.byteOffset+t,Math.min(e.byteLength,r))}static assertView(e){if(e&&!ArrayBuffer.isView(e))throw new Error(`Method requires Uint8Array parameter; received "${typeof e}".`);return e}}class xr{static hexToFactor(e,t){e=Math.floor(e);const r=t;return r[0]=(e>>16&255)/255,r[1]=(e>>8&255)/255,r[2]=(e&255)/255,this.convertSRGBToLinear(t,t)}static factorToHex(e){const t=[...e],[r,n,i]=this.convertLinearToSRGB(e,t);return r*255<<16^n*255<<8^i*255<<0}static convertSRGBToLinear(e,t){const r=e,n=t;for(let i=0;i<3;i++)n[i]=r[i]<.04045?r[i]*.0773993808:Math.pow(r[i]*.9478672986+.0521327014,2.4);return t}static convertLinearToSRGB(e,t){const r=e,n=t;for(let i=0;i<3;i++)n[i]=r[i]<.0031308?r[i]*12.92:1.055*Math.pow(r[i],.41666)-.055;return t}}class Mr{match(e){return e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255}getSize(e){let t=new DataView(e.buffer,e.byteOffset+4),r,n;for(;t.byteLength;){if(r=t.getUint16(0,!1),Rr(t,r),n=t.getUint8(r+1),n===192||n===193||n===194)return[t.getUint16(r+7,!1),t.getUint16(r+5,!1)];t=new DataView(e.buffer,t.byteOffset+r+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(e){return 3}}class Lt{match(e){return e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71&&e[4]===13&&e[5]===10&&e[6]===26&&e[7]===10}getSize(e){const t=new DataView(e.buffer,e.byteOffset);return O.decodeText(e.slice(12,16))===Lt.PNG_FRIED_CHUNK_NAME?[t.getUint32(32,!1),t.getUint32(36,!1)]:[t.getUint32(16,!1),t.getUint32(20,!1)]}getChannels(e){return 4}}Lt.PNG_FRIED_CHUNK_NAME="CgBI";class Be{static registerFormat(e,t){this.impls[e]=t}static getMimeType(e){for(const t in this.impls)if(this.impls[t].match(e))return t;return null}static getSize(e,t){return this.impls[t]?this.impls[t].getSize(e):null}static getChannels(e,t){return this.impls[t]?this.impls[t].getChannels(e):null}static getVRAMByteLength(e,t){if(!this.impls[t])return null;if(this.impls[t].getVRAMByteLength)return this.impls[t].getVRAMByteLength(e);let r=0;const n=4,i=this.getSize(e,t);if(!i)return null;for(;i[0]>1||i[1]>1;)r+=i[0]*i[1]*n,i[0]=Math.max(Math.floor(i[0]/2),1),i[1]=Math.max(Math.floor(i[1]/2),1);return r+=1*1*n,r}static mimeTypeToExtension(e){return e==="image/jpeg"?"jpg":e.split("/").pop()}static extensionToMimeType(e){return e==="jpg"?"image/jpeg":e?`image/${e}`:""}}Be.impls={"image/jpeg":new Mr,"image/png":new Lt};function Rr(s,e){if(e>s.byteLength)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(s.getUint8(e)!==255)throw new TypeError("Invalid JPG, marker table corrupted");return s}class Qe{static basename(e){const t=e.split(/[\\/]/).pop();return t.substring(0,t.lastIndexOf("."))}static extension(e){if(e.startsWith("data:image/")){const t=e.match(/data:(image\/\w+)/)[1];return Be.mimeTypeToExtension(t)}else{if(e.startsWith("data:model/gltf+json"))return"gltf";if(e.startsWith("data:model/gltf-binary"))return"glb";if(e.startsWith("data:application/"))return"bin"}return e.split(/[\\/]/).pop().split(/[.]/).pop()}}function Ls(s){return Object.prototype.toString.call(s)==="[object Object]"}function ve(s){if(Ls(s)===!1)return!1;const e=s.constructor;if(e===void 0)return!0;const t=e.prototype;return!(Ls(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}var zt,Qt;(function(s){s[s.SILENT=4]="SILENT",s[s.ERROR=3]="ERROR",s[s.WARN=2]="WARN",s[s.INFO=1]="INFO",s[s.DEBUG=0]="DEBUG"})(Qt||(Qt={}));class oe{constructor(e){this.verbosity=void 0,this.verbosity=e}debug(e){this.verbosity<=oe.Verbosity.DEBUG&&console.debug(e)}info(e){this.verbosity<=oe.Verbosity.INFO&&console.info(e)}warn(e){this.verbosity<=oe.Verbosity.WARN&&console.warn(e)}error(e){this.verbosity<=oe.Verbosity.ERROR&&console.error(e)}}zt=oe;oe.Verbosity=Qt;oe.DEFAULT_INSTANCE=new zt(zt.Verbosity.INFO);function Nr(s){var e=s[0],t=s[1],r=s[2],n=s[3],i=s[4],o=s[5],a=s[6],A=s[7],u=s[8],f=s[9],l=s[10],c=s[11],B=s[12],h=s[13],g=s[14],C=s[15],p=e*o-t*i,y=e*a-r*i,D=e*A-n*i,T=t*a-r*o,I=t*A-n*o,m=r*A-n*a,d=u*h-f*B,F=u*g-l*B,x=u*C-c*B,M=f*g-l*h,N=f*C-c*h,G=l*C-c*g;return p*G-y*N+D*M+T*x-I*F+m*d}function Sr(s,e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],A=e[5],u=e[6],f=e[7],l=e[8],c=e[9],B=e[10],h=e[11],g=e[12],C=e[13],p=e[14],y=e[15],D=t[0],T=t[1],I=t[2],m=t[3];return s[0]=D*r+T*a+I*l+m*g,s[1]=D*n+T*A+I*c+m*C,s[2]=D*i+T*u+I*B+m*p,s[3]=D*o+T*f+I*h+m*y,D=t[4],T=t[5],I=t[6],m=t[7],s[4]=D*r+T*a+I*l+m*g,s[5]=D*n+T*A+I*c+m*C,s[6]=D*i+T*u+I*B+m*p,s[7]=D*o+T*f+I*h+m*y,D=t[8],T=t[9],I=t[10],m=t[11],s[8]=D*r+T*a+I*l+m*g,s[9]=D*n+T*A+I*c+m*C,s[10]=D*i+T*u+I*B+m*p,s[11]=D*o+T*f+I*h+m*y,D=t[12],T=t[13],I=t[14],m=t[15],s[12]=D*r+T*a+I*l+m*g,s[13]=D*n+T*A+I*c+m*C,s[14]=D*i+T*u+I*B+m*p,s[15]=D*o+T*f+I*h+m*y,s}function Gr(s,e){var t=e[0],r=e[1],n=e[2],i=e[4],o=e[5],a=e[6],A=e[8],u=e[9],f=e[10];return s[0]=Math.hypot(t,r,n),s[1]=Math.hypot(i,o,a),s[2]=Math.hypot(A,u,f),s}function br(s,e){var t=new Yt(3);Gr(t,e);var r=1/t[0],n=1/t[1],i=1/t[2],o=e[0]*r,a=e[1]*n,A=e[2]*i,u=e[4]*r,f=e[5]*n,l=e[6]*i,c=e[8]*r,B=e[9]*n,h=e[10]*i,g=o+f+h,C=0;return g>0?(C=Math.sqrt(g+1)*2,s[3]=.25*C,s[0]=(l-B)/C,s[1]=(c-A)/C,s[2]=(a-u)/C):o>f&&o>h?(C=Math.sqrt(1+o-f-h)*2,s[3]=(l-B)/C,s[0]=.25*C,s[1]=(a+u)/C,s[2]=(c+A)/C):f>h?(C=Math.sqrt(1+f-o-h)*2,s[3]=(c-A)/C,s[0]=(a+u)/C,s[1]=.25*C,s[2]=(l+B)/C):(C=Math.sqrt(1+h-o-f)*2,s[3]=(a-u)/C,s[0]=(c+A)/C,s[1]=(l+B)/C,s[2]=.25*C),s}class H{static identity(e){return e}static eq(e,t,r=1e-5){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(Math.abs(e[n]-t[n])>r)return!1;return!0}static clamp(e,t,r){return e<t?t:e>r?r:e}static decodeNormalizedInt(e,t){switch(t){case 5126:return e;case 5123:return e/65535;case 5121:return e/255;case 5122:return Math.max(e/32767,-1);case 5120:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}static encodeNormalizedInt(e,t){switch(t){case 5126:return e;case 5123:return Math.round(H.clamp(e,0,1)*65535);case 5121:return Math.round(H.clamp(e,0,1)*255);case 5122:return Math.round(H.clamp(e,-1,1)*32767);case 5120:return Math.round(H.clamp(e,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(e,t,r,n){let i=Ut([e[0],e[1],e[2]]);const o=Ut([e[4],e[5],e[6]]),a=Ut([e[8],e[9],e[10]]);Nr(e)<0&&(i=-i),t[0]=e[12],t[1]=e[13],t[2]=e[14];const u=e.slice(),f=1/i,l=1/o,c=1/a;u[0]*=f,u[1]*=f,u[2]*=f,u[4]*=l,u[5]*=l,u[6]*=l,u[8]*=c,u[9]*=c,u[10]*=c,br(r,u),n[0]=i,n[1]=o,n[2]=a}static compose(e,t,r,n){const i=n,o=t[0],a=t[1],A=t[2],u=t[3],f=o+o,l=a+a,c=A+A,B=o*f,h=o*l,g=o*c,C=a*l,p=a*c,y=A*c,D=u*f,T=u*l,I=u*c,m=r[0],d=r[1],F=r[2];return i[0]=(1-(C+y))*m,i[1]=(h+I)*m,i[2]=(g-T)*m,i[3]=0,i[4]=(h-I)*d,i[5]=(1-(B+y))*d,i[6]=(p+D)*d,i[7]=0,i[8]=(g+T)*F,i[9]=(p-D)*F,i[10]=(1-(B+C))*F,i[11]=0,i[12]=e[0],i[13]=e[1],i[14]=e[2],i[15]=1,i}}function Or(s,e){if(!!s!=!!e)return!1;const t=s.getChild(),r=e.getChild();return t===r||t.equals(r)}function Lr(s,e){if(!!s!=!!e)return!1;const t=s.values(),r=e.values();if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++){const i=t[n],o=r[n];if(i.getChild()!==o.getChild()&&!i.getChild().equals(o.getChild()))return!1}return!0}function Hr(s,e){if(!!s!=!!e)return!1;const t=s.keys(),r=e.keys();if(t.length!==r.length)return!1;for(const n of t){const i=s.get(n),o=e.get(n);if(!!i!=!!o)return!1;const a=i.getChild(),A=o.getChild();if(a!==A&&!a.equals(A))return!1}return!0}function mn(s,e){if(s===e)return!0;if(!!s!=!!e||!s||!e||s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;return!0}function Fn(s,e){if(s===e)return!0;if(!!s!=!!e)return!1;if(!ve(s)||!ve(e))return s===e;const t=s,r=e;let n=0,i=0,o;for(o in t)n++;for(o in r)i++;if(n!==i)return!1;for(o in t){const a=t[o],A=r[o];if(yt(a)&&yt(A)){if(!mn(a,A))return!1}else if(ve(a)&&ve(A)){if(!Fn(a,A))return!1}else if(a!==A)return!1}return!0}function yt(s){return Array.isArray(s)||ArrayBuffer.isView(s)}const Hs="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",wr=999,Pr=6,ws=new Set,_r=function(){let e="";for(let t=0;t<Pr;t++)e+=Hs.charAt(Math.floor(Math.random()*Hs.length));return e},vr=function(){for(let e=0;e<wr;e++){const t=_r();if(!ws.has(t))return ws.add(t),t}return""},Ps="https://null.example";class ft{static dirname(e){const t=e.lastIndexOf("/");return t===-1?"./":e.substring(0,t+1)}static basename(e){return Qe.basename(new URL(e,Ps).pathname)}static extension(e){return Qe.extension(new URL(e,Ps).pathname)}static resolve(e,t){if(!this.isRelativePath(t))return t;const r=e.split("/"),n=t.split("/");r.pop();for(let i=0;i<n.length;i++)n[i]!=="."&&(n[i]===".."?r.pop():r.push(n[i]));return r.join("/")}static isAbsoluteURL(e){return this.PROTOCOL_REGEXP.test(e)}static isRelativePath(e){return!/^(?:[a-zA-Z]+:)?\//.test(e)}}ft.DEFAULT_INIT={};ft.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;const me=s=>s,Kr=new Set;class ls extends Bs{constructor(e,t=""){super(e),this[K].name=t,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(e,t){return Array.isArray(t)&&(t=t.slice()),super.set(e,t)}getName(){return this.get("name")}setName(e){return this.set("name",e)}getExtras(){return this.get("extras")}setExtras(e){return this.set("extras",e)}clone(){const e=this.constructor;return new e(this.graph).copy(this,me)}copy(e,t=me){for(const r in this[K]){const n=this[K][r];if(n instanceof Xe)this[We].has(r)||n.dispose();else if(n instanceof _e||n instanceof _)for(const i of n.values())i.dispose();else if(n instanceof fe)for(const i of n.values())i.dispose()}for(const r in e[K]){const n=this[K][r],i=e[K][r];if(i instanceof Xe)this[We].has(r)?n.getChild().copy(t(i.getChild()),t):this.setRef(r,t(i.getChild()),i.getAttributes());else if(i instanceof _||i instanceof _e)for(const o of i.values())this.addRef(r,t(o.getChild()),o.getAttributes());else if(i instanceof fe)for(const o of i.keys()){const a=i.get(o);this.setRefMap(r,o,t(a.getChild()),a.getAttributes())}else ve(i)?this[K][r]=JSON.parse(JSON.stringify(i)):Array.isArray(i)||i instanceof ArrayBuffer||ArrayBuffer.isView(i)?this[K][r]=i.slice():this[K][r]=i}return this}equals(e,t=Kr){if(this===e)return!0;if(this.propertyType!==e.propertyType)return!1;for(const r in this[K]){if(t.has(r))continue;const n=this[K][r],i=e[K][r];if(n instanceof Xe||i instanceof Xe){if(!Or(n,i))return!1}else if(n instanceof _||i instanceof _||n instanceof _e||i instanceof _e){if(!Lr(n,i))return!1}else if(n instanceof fe||i instanceof fe){if(!Hr(n,i))return!1}else if(ve(n)||ve(i)){if(!Fn(n,i))return!1}else if(yt(n)||yt(i)){if(!mn(n,i))return!1}else if(n!==i)return!1}return!0}detach(){return this.graph.disconnectParents(this,e=>e.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class $ extends ls{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new fe})}getExtension(e){return this.getRefMap("extensions",e)}setExtension(e,t){return t&&t._validateParent(this),this.setRefMap("extensions",e,t)}listExtensions(){return this.listRefMapValues("extensions")}}class R extends ${init(){this.propertyType=E.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:R.Type.SCALAR,componentType:R.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(e){switch(e){case R.Type.SCALAR:return 1;case R.Type.VEC2:return 2;case R.Type.VEC3:return 3;case R.Type.VEC4:return 4;case R.Type.MAT2:return 4;case R.Type.MAT3:return 9;case R.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+e)}}static getComponentSize(e){switch(e){case R.ComponentType.BYTE:return 1;case R.ComponentType.UNSIGNED_BYTE:return 1;case R.ComponentType.SHORT:return 2;case R.ComponentType.UNSIGNED_SHORT:return 2;case R.ComponentType.UNSIGNED_INT:return 4;case R.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+e)}}getMinNormalized(e){const t=this.getNormalized(),r=this.getElementSize(),n=this.getComponentType();if(this.getMin(e),t)for(let i=0;i<r;i++)e[i]=H.decodeNormalizedInt(e[i],n);return e}getMin(e){const t=this.getArray(),r=this.getCount(),n=this.getElementSize();for(let i=0;i<n;i++)e[i]=1/0;for(let i=0;i<r*n;i+=n)for(let o=0;o<n;o++){const a=t[i+o];Number.isFinite(a)&&(e[o]=Math.min(e[o],a))}return e}getMaxNormalized(e){const t=this.getNormalized(),r=this.getElementSize(),n=this.getComponentType();if(this.getMax(e),t)for(let i=0;i<r;i++)e[i]=H.decodeNormalizedInt(e[i],n);return e}getMax(e){const t=this.get("array"),r=this.getCount(),n=this.getElementSize();for(let i=0;i<n;i++)e[i]=-1/0;for(let i=0;i<r*n;i+=n)for(let o=0;o<n;o++){const a=t[i+o];Number.isFinite(a)&&(e[o]=Math.max(e[o],a))}return e}getCount(){const e=this.get("array");return e?e.length/this.getElementSize():0}getType(){return this.get("type")}setType(e){return this.set("type",e)}getElementSize(){return R.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(e){return this.set("normalized",e)}getScalar(e){const t=this.getElementSize(),r=this.getComponentType(),n=this.getArray();return this.getNormalized()?H.decodeNormalizedInt(n[e*t],r):n[e*t]}setScalar(e,t){const r=this.getElementSize(),n=this.getComponentType(),i=this.getArray();return this.getNormalized()?i[e*r]=H.encodeNormalizedInt(t,n):i[e*r]=t,this}getElement(e,t){const r=this.getNormalized(),n=this.getElementSize(),i=this.getComponentType(),o=this.getArray();for(let a=0;a<n;a++)r?t[a]=H.decodeNormalizedInt(o[e*n+a],i):t[a]=o[e*n+a];return t}setElement(e,t){const r=this.getNormalized(),n=this.getElementSize(),i=this.getComponentType(),o=this.getArray();for(let a=0;a<n;a++)r?o[e*n+a]=H.encodeNormalizedInt(t[a],i):o[e*n+a]=t[a];return this}getSparse(){return this.get("sparse")}setSparse(e){return this.set("sparse",e)}getBuffer(){return this.getRef("buffer")}setBuffer(e){return this.setRef("buffer",e)}getArray(){return this.get("array")}setArray(e){return this.set("componentType",e?Jr(e):R.ComponentType.FLOAT),this.set("array",e),this}getByteLength(){const e=this.get("array");return e?e.byteLength:0}}R.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};R.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function Jr(s){switch(s.constructor){case Float32Array:return R.ComponentType.FLOAT;case Uint32Array:return R.ComponentType.UNSIGNED_INT;case Uint16Array:return R.ComponentType.UNSIGNED_SHORT;case Uint8Array:return R.ComponentType.UNSIGNED_BYTE;case Int16Array:return R.ComponentType.SHORT;case Int8Array:return R.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class yn extends ${init(){this.propertyType=E.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new _,samplers:new _})}addChannel(e){return this.addRef("channels",e)}removeChannel(e){return this.removeRef("channels",e)}listChannels(){return this.listRefs("channels")}addSampler(e){return this.addRef("samplers",e)}removeSampler(e){return this.removeRef("samplers",e)}listSamplers(){return this.listRefs("samplers")}}class et extends ${init(){this.propertyType=E.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(e){return this.set("targetPath",e)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(e){return this.setRef("targetNode",e)}getSampler(){return this.getRef("sampler")}setSampler(e){return this.setRef("sampler",e)}}et.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class tt extends ${init(){this.propertyType=E.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:tt.Interpolation.LINEAR,input:null,output:null})}getInterpolation(){return this.get("interpolation")}setInterpolation(e){return this.set("interpolation",e)}getInput(){return this.getRef("input")}setInput(e){return this.setRef("input",e,{usage:se.OTHER})}getOutput(){return this.getRef("output")}setOutput(e){return this.setRef("output",e,{usage:se.OTHER})}}tt.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class xn extends ${init(){this.propertyType=E.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(e){return this.set("uri",e)}}class Ve extends ${init(){this.propertyType=E.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:Ve.Type.PERSPECTIVE,znear:.1,zfar:100,aspectRatio:null,yfov:Math.PI*2*50/360,xmag:1,ymag:1})}getType(){return this.get("type")}setType(e){return this.set("type",e)}getZNear(){return this.get("znear")}setZNear(e){return this.set("znear",e)}getZFar(){return this.get("zfar")}setZFar(e){return this.set("zfar",e)}getAspectRatio(){return this.get("aspectRatio")}setAspectRatio(e){return this.set("aspectRatio",e)}getYFov(){return this.get("yfov")}setYFov(e){return this.set("yfov",e)}getXMag(){return this.get("xmag")}setXMag(e){return this.set("xmag",e)}getYMag(){return this.get("ymag")}setYMag(e){return this.set("ymag",e)}}Ve.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class J extends ls{_validateParent(e){if(!this.parentTypes.includes(e.propertyType))throw new Error(`Parent "${e.propertyType}" invalid for child "${this.propertyType}".`)}}J.EXTENSION_NAME=void 0;class P extends ${init(){this.propertyType=E.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:P.WrapMode.REPEAT,wrapT:P.WrapMode.REPEAT})}getTexCoord(){return this.get("texCoord")}setTexCoord(e){return this.set("texCoord",e)}getMagFilter(){return this.get("magFilter")}setMagFilter(e){return this.set("magFilter",e)}getMinFilter(){return this.get("minFilter")}setMinFilter(e){return this.set("minFilter",e)}getWrapS(){return this.get("wrapS")}setWrapS(e){return this.set("wrapS",e)}getWrapT(){return this.get("wrapT")}setWrapT(e){return this.set("wrapT",e)}}P.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};P.MagFilter={NEAREST:9728,LINEAR:9729};P.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};const{R:Ct,G:dt,B:Et,A:Ur}=ae;class Ce extends ${init(){this.propertyType=E.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:Ce.AlphaMode.OPAQUE,alphaCutoff:.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new P(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new P(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new P(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new P(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new P(this.graph,"metallicRoughnessTextureInfo")})}getDoubleSided(){return this.get("doubleSided")}setDoubleSided(e){return this.set("doubleSided",e)}getAlpha(){return this.get("baseColorFactor")[3]}setAlpha(e){const t=this.get("baseColorFactor").slice();return t[3]=e,this.set("baseColorFactor",t)}getAlphaMode(){return this.get("alphaMode")}setAlphaMode(e){return this.set("alphaMode",e)}getAlphaCutoff(){return this.get("alphaCutoff")}setAlphaCutoff(e){return this.set("alphaCutoff",e)}getBaseColorFactor(){return this.get("baseColorFactor")}setBaseColorFactor(e){return this.set("baseColorFactor",e)}getBaseColorTexture(){return this.getRef("baseColorTexture")}getBaseColorTextureInfo(){return this.getRef("baseColorTexture")?this.getRef("baseColorTextureInfo"):null}setBaseColorTexture(e){return this.setRef("baseColorTexture",e,{channels:Ct|dt|Et|Ur,isColor:!0})}getEmissiveFactor(){return this.get("emissiveFactor")}setEmissiveFactor(e){return this.set("emissiveFactor",e)}getEmissiveTexture(){return this.getRef("emissiveTexture")}getEmissiveTextureInfo(){return this.getRef("emissiveTexture")?this.getRef("emissiveTextureInfo"):null}setEmissiveTexture(e){return this.setRef("emissiveTexture",e,{channels:Ct|dt|Et,isColor:!0})}getNormalScale(){return this.get("normalScale")}setNormalScale(e){return this.set("normalScale",e)}getNormalTexture(){return this.getRef("normalTexture")}getNormalTextureInfo(){return this.getRef("normalTexture")?this.getRef("normalTextureInfo"):null}setNormalTexture(e){return this.setRef("normalTexture",e,{channels:Ct|dt|Et})}getOcclusionStrength(){return this.get("occlusionStrength")}setOcclusionStrength(e){return this.set("occlusionStrength",e)}getOcclusionTexture(){return this.getRef("occlusionTexture")}getOcclusionTextureInfo(){return this.getRef("occlusionTexture")?this.getRef("occlusionTextureInfo"):null}setOcclusionTexture(e){return this.setRef("occlusionTexture",e,{channels:Ct})}getRoughnessFactor(){return this.get("roughnessFactor")}setRoughnessFactor(e){return this.set("roughnessFactor",e)}getMetallicFactor(){return this.get("metallicFactor")}setMetallicFactor(e){return this.set("metallicFactor",e)}getMetallicRoughnessTexture(){return this.getRef("metallicRoughnessTexture")}getMetallicRoughnessTextureInfo(){return this.getRef("metallicRoughnessTexture")?this.getRef("metallicRoughnessTextureInfo"):null}setMetallicRoughnessTexture(e){return this.setRef("metallicRoughnessTexture",e,{channels:dt|Et})}}Ce.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class Mn extends ${init(){this.propertyType=E.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new _})}addPrimitive(e){return this.addRef("primitives",e)}removePrimitive(e){return this.removeRef("primitives",e)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(e){return this.set("weights",e)}}class hs extends ${init(){this.propertyType=E.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:new _})}copy(e,t=me){if(t===me)throw new Error("Node cannot be copied.");return super.copy(e,t)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(e){return this.set("translation",e)}setRotation(e){return this.set("rotation",e)}setScale(e){return this.set("scale",e)}getMatrix(){return H.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(e){const t=this.get("translation").slice(),r=this.get("rotation").slice(),n=this.get("scale").slice();return H.decompose(e,t,r,n),this.set("translation",t).set("rotation",r).set("scale",n)}getWorldTranslation(){const e=[0,0,0];return H.decompose(this.getWorldMatrix(),e,[0,0,0,1],[1,1,1]),e}getWorldRotation(){const e=[0,0,0,1];return H.decompose(this.getWorldMatrix(),[0,0,0],e,[1,1,1]),e}getWorldScale(){const e=[1,1,1];return H.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],e),e}getWorldMatrix(){const e=[];for(let n=this;n!=null;n=n.getParentNode())e.push(n);let t;const r=e.pop().getMatrix();for(;t=e.pop();)Sr(r,r,t.getMatrix());return r}addChild(e){const t=e.getParentNode();t&&t.removeChild(e);for(const r of e.listParents())r.propertyType===E.SCENE&&r.removeChild(e);return this.addRef("children",e)}removeChild(e){return this.removeRef("children",e)}listChildren(){return this.listRefs("children")}getParentNode(){for(const e of this.listParents())if(e.propertyType===E.NODE)return e;return null}getMesh(){return this.getRef("mesh")}setMesh(e){return this.setRef("mesh",e)}getCamera(){return this.getRef("camera")}setCamera(e){return this.setRef("camera",e)}getSkin(){return this.getRef("skin")}setSkin(e){return this.setRef("skin",e)}getWeights(){return this.get("weights")}setWeights(e){return this.set("weights",e)}traverse(e){e(this);for(const t of this.listChildren())t.traverse(e);return this}}class U extends ${init(){this.propertyType=E.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:U.Mode.TRIANGLES,material:null,indices:null,attributes:new fe,targets:new _})}getIndices(){return this.getRef("indices")}setIndices(e){return this.setRef("indices",e,{usage:se.ELEMENT_ARRAY_BUFFER})}getAttribute(e){return this.getRefMap("attributes",e)}setAttribute(e,t){return this.setRefMap("attributes",e,t,{usage:se.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}getMaterial(){return this.getRef("material")}setMaterial(e){return this.setRef("material",e)}getMode(){return this.get("mode")}setMode(e){return this.set("mode",e)}listTargets(){return this.listRefs("targets")}addTarget(e){return this.addRef("targets",e)}removeTarget(e){return this.removeRef("targets",e)}}U.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class Rn extends ls{init(){this.propertyType=E.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new fe})}getAttribute(e){return this.getRefMap("attributes",e)}setAttribute(e,t){return this.setRefMap("attributes",e,t,{usage:se.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function Z(){return Z=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},Z.apply(this,arguments)}class Ht extends ${init(){this.propertyType=E.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new _})}copy(e,t=me){if(t===me)throw new Error("Scene cannot be copied.");return super.copy(e,t)}addChild(e){const t=e.getParentNode();return t&&t.removeChild(e),this.addRef("children",e)}removeChild(e){return this.removeRef("children",e)}listChildren(){return this.listRefs("children")}traverse(e){for(const t of this.listChildren())t.traverse(e);return this}}class Nn extends ${init(){this.propertyType=E.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new _})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(e){return this.setRef("skeleton",e)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(e){return this.setRef("inverseBindMatrices",e,{usage:se.INVERSE_BIND_MATRICES})}addJoint(e){return this.addRef("joints",e)}removeJoint(e){return this.removeRef("joints",e)}listJoints(){return this.listRefs("joints")}}class Bt extends ${init(){this.propertyType=E.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||Be.extensionToMimeType(Qe.extension(this.get("uri")))}setMimeType(e){return this.set("mimeType",e)}getURI(){return this.get("uri")}setURI(e){this.set("uri",e);const t=Be.extensionToMimeType(Qe.extension(e));return t&&this.set("mimeType",t),this}getImage(){return this.get("image")}setImage(e){return this.set("image",O.assertView(e))}getSize(){const e=this.get("image");return e?Be.getSize(e,this.getMimeType()):null}}class st extends ${init(){this.propertyType=E.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${In}`,version:"2.0"},defaultScene:null,accessors:new _,animations:new _,buffers:new _,cameras:new _,materials:new _,meshes:new _,nodes:new _,scenes:new _,skins:new _,textures:new _})}constructor(e){super(e),this._extensions=new Set,e.addEventListener("node:create",t=>{this._addChildOfRoot(t.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(e,t=me){if(t===me)throw new Error("Root cannot be copied.");this.set("asset",Z({},e.get("asset"))),this.setName(e.getName()),this.setExtras(Z({},e.getExtras())),this.setDefaultScene(e.getDefaultScene()?t(e.getDefaultScene()):null);for(const r of e.listRefMapKeys("extensions")){const n=e.getExtension(r);this.setExtension(r,t(n))}return this}_addChildOfRoot(e){return e instanceof Ht?this.addRef("scenes",e):e instanceof hs?this.addRef("nodes",e):e instanceof Ve?this.addRef("cameras",e):e instanceof Nn?this.addRef("skins",e):e instanceof Mn?this.addRef("meshes",e):e instanceof Ce?this.addRef("materials",e):e instanceof Bt?this.addRef("textures",e):e instanceof yn?this.addRef("animations",e):e instanceof R?this.addRef("accessors",e):e instanceof xn&&this.addRef("buffers",e),this}getAsset(){return this.get("asset")}listExtensionsUsed(){return Array.from(this._extensions)}listExtensionsRequired(){return this.listExtensionsUsed().filter(e=>e.isRequired())}_enableExtension(e){return this._extensions.add(e),this}_disableExtension(e){return this._extensions.delete(e),this}listScenes(){return this.listRefs("scenes")}setDefaultScene(e){return this.setRef("defaultScene",e)}getDefaultScene(){return this.getRef("defaultScene")}listNodes(){return this.listRefs("nodes")}listCameras(){return this.listRefs("cameras")}listSkins(){return this.listRefs("skins")}listMeshes(){return this.listRefs("meshes")}listMaterials(){return this.listRefs("materials")}listTextures(){return this.listRefs("textures")}listAnimations(){return this.listRefs("animations")}listAccessors(){return this.listRefs("accessors")}listBuffers(){return this.listRefs("buffers")}}class Ae{static fromGraph(e){return Ae._GRAPH_DOCUMENTS.get(e)||null}constructor(){this._graph=new Ir,this._root=new st(this._graph),this._logger=oe.DEFAULT_INSTANCE,Ae._GRAPH_DOCUMENTS.set(this._graph,this)}getRoot(){return this._root}getGraph(){return this._graph}getLogger(){return this._logger}setLogger(e){return this._logger=e,this}clone(){throw new Error("Use 'cloneDocument(source)' from '@gltf-transform/functions'.")}merge(e){throw new Error("Use 'mergeDocuments(target, source)' from '@gltf-transform/functions'.")}async transform(...e){const t=e.map(r=>r.name);for(const r of e)await r(this,{stack:t});return this}createExtension(e){const t=e.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find(n=>n.extensionName===t)||new e(this)}createScene(e=""){return new Ht(this._graph,e)}createNode(e=""){return new hs(this._graph,e)}createCamera(e=""){return new Ve(this._graph,e)}createSkin(e=""){return new Nn(this._graph,e)}createMesh(e=""){return new Mn(this._graph,e)}createPrimitive(){return new U(this._graph)}createPrimitiveTarget(e=""){return new Rn(this._graph,e)}createMaterial(e=""){return new Ce(this._graph,e)}createTexture(e=""){return new Bt(this._graph,e)}createAnimation(e=""){return new yn(this._graph,e)}createAnimationChannel(e=""){return new et(this._graph,e)}createAnimationSampler(e=""){return new tt(this._graph,e)}createAccessor(e="",t=null){return t||(t=this.getRoot().listBuffers()[0]),new R(this._graph,e).setBuffer(t)}createBuffer(e=""){return new xn(this._graph,e)}}Ae._GRAPH_DOCUMENTS=new WeakMap;class v{constructor(e){this.extensionName="",this.prereadTypes=[],this.prewriteTypes=[],this.readDependencies=[],this.writeDependencies=[],this.document=void 0,this.required=!1,this.properties=new Set,this._listener=void 0,this.document=e,e.getRoot()._enableExtension(this),this._listener=r=>{const n=r,i=n.target;i instanceof J&&i.extensionName===this.extensionName&&(n.type==="node:create"&&this._addExtensionProperty(i),n.type==="node:dispose"&&this._removeExtensionProperty(i))};const t=e.getGraph();t.addEventListener("node:create",this._listener),t.addEventListener("node:dispose",this._listener)}dispose(){this.document.getRoot()._disableExtension(this);const e=this.document.getGraph();e.removeEventListener("node:create",this._listener),e.removeEventListener("node:dispose",this._listener);for(const t of this.properties)t.dispose()}static register(){}isRequired(){return this.required}setRequired(e){return this.required=e,this}listProperties(){return Array.from(this.properties)}_addExtensionProperty(e){return this.properties.add(e),this}_removeExtensionProperty(e){return this.properties.delete(e),this}install(e,t){return this}preread(e,t){return this}prewrite(e,t){return this}}v.EXTENSION_NAME=void 0;class Vr{constructor(e){this.jsonDoc=void 0,this.buffers=[],this.bufferViews=[],this.bufferViewBuffers=[],this.accessors=[],this.textures=[],this.textureInfos=new Map,this.materials=[],this.meshes=[],this.cameras=[],this.nodes=[],this.skins=[],this.animations=[],this.scenes=[],this.jsonDoc=e}setTextureInfo(e,t){this.textureInfos.set(e,t),t.texCoord!==void 0&&e.setTexCoord(t.texCoord),t.extras!==void 0&&e.setExtras(t.extras);const r=this.jsonDoc.json.textures[t.index];if(r.sampler===void 0)return;const n=this.jsonDoc.json.samplers[r.sampler];n.magFilter!==void 0&&e.setMagFilter(n.magFilter),n.minFilter!==void 0&&e.setMinFilter(n.minFilter),n.wrapS!==void 0&&e.setWrapS(n.wrapS),n.wrapT!==void 0&&e.setWrapT(n.wrapT)}}const _s={logger:oe.DEFAULT_INSTANCE,extensions:[],dependencies:{}},jr=new Set([E.BUFFER,E.TEXTURE,E.MATERIAL,E.MESH,E.PRIMITIVE,E.NODE,E.SCENE]);class kr{static read(e,t=_s){const r=Z({},_s,t),{json:n}=e,i=new Ae().setLogger(r.logger);this.validate(e,r);const o=new Vr(e),a=n.asset,A=i.getRoot().getAsset();a.copyright&&(A.copyright=a.copyright),a.extras&&(A.extras=a.extras),n.extras!==void 0&&i.getRoot().setExtras(Z({},n.extras));const u=n.extensionsUsed||[],f=n.extensionsRequired||[];r.extensions.sort((d,F)=>d.EXTENSION_NAME>F.EXTENSION_NAME?1:-1);for(const d of r.extensions)if(u.includes(d.EXTENSION_NAME)){const F=i.createExtension(d).setRequired(f.includes(d.EXTENSION_NAME)),x=F.prereadTypes.filter(M=>!jr.has(M));x.length&&r.logger.warn(`Preread hooks for some types (${x.join()}), requested by extension ${F.extensionName}, are unsupported. Please file an issue or a PR.`);for(const M of F.readDependencies)F.install(M,r.dependencies[M])}const l=n.buffers||[];i.getRoot().listExtensionsUsed().filter(d=>d.prereadTypes.includes(E.BUFFER)).forEach(d=>d.preread(o,E.BUFFER)),o.buffers=l.map(d=>{const F=i.createBuffer(d.name);return d.extras&&F.setExtras(d.extras),d.uri&&d.uri.indexOf("__")!==0&&F.setURI(d.uri),F});const c=n.bufferViews||[];o.bufferViewBuffers=c.map((d,F)=>{if(!o.bufferViews[F]){const x=e.json.buffers[d.buffer],M=x.uri?e.resources[x.uri]:e.resources[ze],N=d.byteOffset||0;o.bufferViews[F]=O.toView(M,N,d.byteLength)}return o.buffers[d.buffer]});const B=n.accessors||[];o.accessors=B.map(d=>{const F=o.bufferViewBuffers[d.bufferView],x=i.createAccessor(d.name,F).setType(d.type);return d.extras&&x.setExtras(d.extras),d.normalized!==void 0&&x.setNormalized(d.normalized),d.bufferView===void 0||x.setArray(Tt(d,o)),x});const h=n.images||[],g=n.textures||[];i.getRoot().listExtensionsUsed().filter(d=>d.prereadTypes.includes(E.TEXTURE)).forEach(d=>d.preread(o,E.TEXTURE)),o.textures=h.map(d=>{const F=i.createTexture(d.name);if(d.extras&&F.setExtras(d.extras),d.bufferView!==void 0){const x=n.bufferViews[d.bufferView],M=e.json.buffers[x.buffer],N=M.uri?e.resources[M.uri]:e.resources[ze],G=x.byteOffset||0,S=x.byteLength,b=N.slice(G,G+S);F.setImage(b)}else d.uri!==void 0&&(F.setImage(e.resources[d.uri]),d.uri.indexOf("__")!==0&&F.setURI(d.uri));if(d.mimeType!==void 0)F.setMimeType(d.mimeType);else if(d.uri){const x=Qe.extension(d.uri);F.setMimeType(Be.extensionToMimeType(x))}return F}),i.getRoot().listExtensionsUsed().filter(d=>d.prereadTypes.includes(E.MATERIAL)).forEach(d=>d.preread(o,E.MATERIAL));const C=n.materials||[];o.materials=C.map(d=>{const F=i.createMaterial(d.name);d.extras&&F.setExtras(d.extras),d.alphaMode!==void 0&&F.setAlphaMode(d.alphaMode),d.alphaCutoff!==void 0&&F.setAlphaCutoff(d.alphaCutoff),d.doubleSided!==void 0&&F.setDoubleSided(d.doubleSided);const x=d.pbrMetallicRoughness||{};if(x.baseColorFactor!==void 0&&F.setBaseColorFactor(x.baseColorFactor),d.emissiveFactor!==void 0&&F.setEmissiveFactor(d.emissiveFactor),x.metallicFactor!==void 0&&F.setMetallicFactor(x.metallicFactor),x.roughnessFactor!==void 0&&F.setRoughnessFactor(x.roughnessFactor),x.baseColorTexture!==void 0){const M=x.baseColorTexture,N=o.textures[g[M.index].source];F.setBaseColorTexture(N),o.setTextureInfo(F.getBaseColorTextureInfo(),M)}if(d.emissiveTexture!==void 0){const M=d.emissiveTexture,N=o.textures[g[M.index].source];F.setEmissiveTexture(N),o.setTextureInfo(F.getEmissiveTextureInfo(),M)}if(d.normalTexture!==void 0){const M=d.normalTexture,N=o.textures[g[M.index].source];F.setNormalTexture(N),o.setTextureInfo(F.getNormalTextureInfo(),M),d.normalTexture.scale!==void 0&&F.setNormalScale(d.normalTexture.scale)}if(d.occlusionTexture!==void 0){const M=d.occlusionTexture,N=o.textures[g[M.index].source];F.setOcclusionTexture(N),o.setTextureInfo(F.getOcclusionTextureInfo(),M),d.occlusionTexture.strength!==void 0&&F.setOcclusionStrength(d.occlusionTexture.strength)}if(x.metallicRoughnessTexture!==void 0){const M=x.metallicRoughnessTexture,N=o.textures[g[M.index].source];F.setMetallicRoughnessTexture(N),o.setTextureInfo(F.getMetallicRoughnessTextureInfo(),M)}return F}),i.getRoot().listExtensionsUsed().filter(d=>d.prereadTypes.includes(E.MESH)).forEach(d=>d.preread(o,E.MESH));const p=n.meshes||[];i.getRoot().listExtensionsUsed().filter(d=>d.prereadTypes.includes(E.PRIMITIVE)).forEach(d=>d.preread(o,E.PRIMITIVE)),o.meshes=p.map(d=>{const F=i.createMesh(d.name);return d.extras&&F.setExtras(d.extras),d.weights!==void 0&&F.setWeights(d.weights),(d.primitives||[]).forEach(M=>{const N=i.createPrimitive();M.extras&&N.setExtras(M.extras),M.material!==void 0&&N.setMaterial(o.materials[M.material]),M.mode!==void 0&&N.setMode(M.mode);for(const[b,L]of Object.entries(M.attributes||{}))N.setAttribute(b,o.accessors[L]);M.indices!==void 0&&N.setIndices(o.accessors[M.indices]);const G=d.extras&&d.extras.targetNames||[];(M.targets||[]).forEach((b,L)=>{const w=G[L]||L.toString(),j=i.createPrimitiveTarget(w);for(const[ee,q]of Object.entries(b))j.setAttribute(ee,o.accessors[q]);N.addTarget(j)}),F.addPrimitive(N)}),F});const y=n.cameras||[];o.cameras=y.map(d=>{const F=i.createCamera(d.name).setType(d.type);if(d.extras&&F.setExtras(d.extras),d.type===Ve.Type.PERSPECTIVE){const x=d.perspective;F.setYFov(x.yfov),F.setZNear(x.znear),x.zfar!==void 0&&F.setZFar(x.zfar),x.aspectRatio!==void 0&&F.setAspectRatio(x.aspectRatio)}else{const x=d.orthographic;F.setZNear(x.znear).setZFar(x.zfar).setXMag(x.xmag).setYMag(x.ymag)}return F});const D=n.nodes||[];i.getRoot().listExtensionsUsed().filter(d=>d.prereadTypes.includes(E.NODE)).forEach(d=>d.preread(o,E.NODE)),o.nodes=D.map(d=>{const F=i.createNode(d.name);if(d.extras&&F.setExtras(d.extras),d.translation!==void 0&&F.setTranslation(d.translation),d.rotation!==void 0&&F.setRotation(d.rotation),d.scale!==void 0&&F.setScale(d.scale),d.matrix!==void 0){const x=[0,0,0],M=[0,0,0,1],N=[1,1,1];H.decompose(d.matrix,x,M,N),F.setTranslation(x),F.setRotation(M),F.setScale(N)}return d.weights!==void 0&&F.setWeights(d.weights),F});const T=n.skins||[];o.skins=T.map(d=>{const F=i.createSkin(d.name);d.extras&&F.setExtras(d.extras),d.inverseBindMatrices!==void 0&&F.setInverseBindMatrices(o.accessors[d.inverseBindMatrices]),d.skeleton!==void 0&&F.setSkeleton(o.nodes[d.skeleton]);for(const x of d.joints)F.addJoint(o.nodes[x]);return F}),D.map((d,F)=>{const x=o.nodes[F];(d.children||[]).forEach(N=>x.addChild(o.nodes[N])),d.mesh!==void 0&&x.setMesh(o.meshes[d.mesh]),d.camera!==void 0&&x.setCamera(o.cameras[d.camera]),d.skin!==void 0&&x.setSkin(o.skins[d.skin])});const I=n.animations||[];o.animations=I.map(d=>{const F=i.createAnimation(d.name);d.extras&&F.setExtras(d.extras);const M=(d.samplers||[]).map(G=>{const S=i.createAnimationSampler().setInput(o.accessors[G.input]).setOutput(o.accessors[G.output]).setInterpolation(G.interpolation||tt.Interpolation.LINEAR);return G.extras&&S.setExtras(G.extras),F.addSampler(S),S});return(d.channels||[]).forEach(G=>{const S=i.createAnimationChannel().setSampler(M[G.sampler]).setTargetPath(G.target.path);G.target.node!==void 0&&S.setTargetNode(o.nodes[G.target.node]),G.extras&&S.setExtras(G.extras),F.addChannel(S)}),F});const m=n.scenes||[];return i.getRoot().listExtensionsUsed().filter(d=>d.prereadTypes.includes(E.SCENE)).forEach(d=>d.preread(o,E.SCENE)),o.scenes=m.map(d=>{const F=i.createScene(d.name);return d.extras&&F.setExtras(d.extras),(d.nodes||[]).map(M=>o.nodes[M]).forEach(M=>F.addChild(M)),F}),n.scene!==void 0&&i.getRoot().setDefaultScene(o.scenes[n.scene]),i.getRoot().listExtensionsUsed().forEach(d=>d.read(o)),B.forEach((d,F)=>{const x=o.accessors[F],M=!!d.sparse,N=!d.bufferView&&!x.getArray();(M||N)&&x.setSparse(!0).setArray(Wr(d,o))}),i}static validate(e,t){const r=e.json;if(r.asset.version!=="2.0")throw new Error(`Unsupported glTF version, "${r.asset.version}".`);if(r.extensionsRequired){for(const n of r.extensionsRequired)if(!t.extensions.find(i=>i.EXTENSION_NAME===n))throw new Error(`Missing required extension, "${n}".`)}if(r.extensionsUsed)for(const n of r.extensionsUsed)t.extensions.find(i=>i.EXTENSION_NAME===n)||t.logger.warn(`Missing optional extension, "${n}".`)}}function Xr(s,e){const t=e.jsonDoc,r=e.bufferViews[s.bufferView],n=t.json.bufferViews[s.bufferView],i=gt[s.componentType],o=R.getElementSize(s.type),a=i.BYTES_PER_ELEMENT,A=s.byteOffset||0,u=new i(s.count*o),f=new DataView(r.buffer,r.byteOffset,r.byteLength),l=n.byteStride;for(let c=0;c<s.count;c++)for(let B=0;B<o;B++){const h=A+c*l+B*a;let g;switch(s.componentType){case R.ComponentType.FLOAT:g=f.getFloat32(h,!0);break;case R.ComponentType.UNSIGNED_INT:g=f.getUint32(h,!0);break;case R.ComponentType.UNSIGNED_SHORT:g=f.getUint16(h,!0);break;case R.ComponentType.UNSIGNED_BYTE:g=f.getUint8(h);break;case R.ComponentType.SHORT:g=f.getInt16(h,!0);break;case R.ComponentType.BYTE:g=f.getInt8(h);break;default:throw new Error(`Unexpected componentType "${s.componentType}".`)}u[c*o+B]=g}return u}function Tt(s,e){const t=e.jsonDoc,r=e.bufferViews[s.bufferView],n=t.json.bufferViews[s.bufferView],i=gt[s.componentType],o=R.getElementSize(s.type),a=i.BYTES_PER_ELEMENT,A=o*a;if(n.byteStride!==void 0&&n.byteStride!==A)return Xr(s,e);const u=r.byteOffset+(s.byteOffset||0),f=s.count*o*a;return new i(r.buffer.slice(u,u+f))}function Wr(s,e){const t=gt[s.componentType],r=R.getElementSize(s.type);let n;s.bufferView!==void 0?n=Tt(s,e):n=new t(s.count*r);const i=s.sparse;if(!i)return n;const o=i.count,a=Z({},s,i.indices,{count:o,type:"SCALAR"}),A=Z({},s,i.values,{count:o}),u=Tt(a,e),f=Tt(A,e);for(let l=0;l<a.count;l++)for(let c=0;c<r;c++)n[u[l]*r+c]=f[l*r+c];return n}var lt;(function(s){s[s.ARRAY_BUFFER=34962]="ARRAY_BUFFER",s[s.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(lt||(lt={}));class le{constructor(e,t,r){this._doc=void 0,this.jsonDoc=void 0,this.options=void 0,this.accessorIndexMap=new Map,this.animationIndexMap=new Map,this.bufferIndexMap=new Map,this.cameraIndexMap=new Map,this.skinIndexMap=new Map,this.materialIndexMap=new Map,this.meshIndexMap=new Map,this.nodeIndexMap=new Map,this.imageIndexMap=new Map,this.textureDefIndexMap=new Map,this.textureInfoDefMap=new Map,this.samplerDefIndexMap=new Map,this.sceneIndexMap=new Map,this.imageBufferViews=[],this.otherBufferViews=new Map,this.otherBufferViewsIndexMap=new Map,this.extensionData={},this.bufferURIGenerator=void 0,this.imageURIGenerator=void 0,this.logger=void 0,this._accessorUsageMap=new Map,this.accessorUsageGroupedByParent=new Set(["ARRAY_BUFFER"]),this.accessorParents=new Map,this._doc=e,this.jsonDoc=t,this.options=r;const n=e.getRoot(),i=n.listBuffers().length,o=n.listTextures().length;this.bufferURIGenerator=new vs(i>1,()=>r.basename||"buffer"),this.imageURIGenerator=new vs(o>1,a=>Yr(e,a)||r.basename||"texture"),this.logger=e.getLogger()}createTextureInfoDef(e,t){const r={magFilter:t.getMagFilter()||void 0,minFilter:t.getMinFilter()||void 0,wrapS:t.getWrapS(),wrapT:t.getWrapT()},n=JSON.stringify(r);this.samplerDefIndexMap.has(n)||(this.samplerDefIndexMap.set(n,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(r));const i={source:this.imageIndexMap.get(e),sampler:this.samplerDefIndexMap.get(n)},o=JSON.stringify(i);this.textureDefIndexMap.has(o)||(this.textureDefIndexMap.set(o,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push(i));const a={index:this.textureDefIndexMap.get(o)};return t.getTexCoord()!==0&&(a.texCoord=t.getTexCoord()),Object.keys(t.getExtras()).length>0&&(a.extras=t.getExtras()),this.textureInfoDefMap.set(t,a),a}createPropertyDef(e){const t={};return e.getName()&&(t.name=e.getName()),Object.keys(e.getExtras()).length>0&&(t.extras=e.getExtras()),t}createAccessorDef(e){const t=this.createPropertyDef(e);return t.type=e.getType(),t.componentType=e.getComponentType(),t.count=e.getCount(),this._doc.getGraph().listParentEdges(e).some(n=>n.getName()==="attributes"&&n.getAttributes().key==="POSITION"||n.getName()==="input")&&(t.max=e.getMax([]).map(Math.fround),t.min=e.getMin([]).map(Math.fround)),e.getNormalized()&&(t.normalized=e.getNormalized()),t}createImageData(e,t,r){if(this.options.format===Je.GLB)this.imageBufferViews.push(t),e.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:t.byteLength});else{const n=Be.mimeTypeToExtension(r.getMimeType());e.uri=this.imageURIGenerator.createURI(r,n),this.jsonDoc.resources[e.uri]=t}}getAccessorUsage(e){const t=this._accessorUsageMap.get(e);if(t)return t;if(e.getSparse())return se.SPARSE;for(const r of this._doc.getGraph().listParentEdges(e)){const{usage:n}=r.getAttributes();if(n)return n;r.getParent().propertyType!==E.ROOT&&this.logger.warn(`Missing attribute ".usage" on edge, "${r.getName()}".`)}return se.OTHER}addAccessorToUsageGroup(e,t){const r=this._accessorUsageMap.get(e);if(r&&r!==t)throw new Error(`Accessor with usage "${r}" cannot be reused as "${t}".`);return this._accessorUsageMap.set(e,t),this}}le.BufferViewTarget=lt;le.BufferViewUsage=se;le.USAGE_TO_TARGET={[se.ARRAY_BUFFER]:lt.ARRAY_BUFFER,[se.ELEMENT_ARRAY_BUFFER]:lt.ELEMENT_ARRAY_BUFFER};class vs{constructor(e,t){this.multiple=void 0,this.basename=void 0,this.counter={},this.multiple=e,this.basename=t}createURI(e,t){if(e.getURI())return e.getURI();if(this.multiple){const r=this.basename(e);return this.counter[r]=this.counter[r]||1,`${r}_${this.counter[r]++}.${t}`}else return`${this.basename(e)}.${t}`}}function Yr(s,e){const t=s.getGraph().listParentEdges(e).find(r=>r.getParent()!==s.getRoot());return t?t.getName().replace(/texture$/i,""):""}const{BufferViewUsage:Dt}=le,{UNSIGNED_INT:qr,UNSIGNED_SHORT:zr,UNSIGNED_BYTE:Qr}=R.ComponentType,Zr=new Set([E.ACCESSOR,E.BUFFER,E.MATERIAL,E.MESH]);class $r{static write(e,t){const r=e.getGraph(),n=e.getRoot(),i={asset:Z({generator:`glTF-Transform ${In}`},n.getAsset()),extras:Z({},n.getExtras())},o={json:i,resources:{}},a=new le(e,o,t),A=t.logger||oe.DEFAULT_INSTANCE,u=new Set(t.extensions.map(p=>p.EXTENSION_NAME)),f=e.getRoot().listExtensionsUsed().filter(p=>u.has(p.extensionName)).sort((p,y)=>p.extensionName>y.extensionName?1:-1),l=e.getRoot().listExtensionsRequired().filter(p=>u.has(p.extensionName)).sort((p,y)=>p.extensionName>y.extensionName?1:-1);f.length<e.getRoot().listExtensionsUsed().length&&A.warn("Some extensions were not registered for I/O, and will not be written.");for(const p of f){const y=p.prewriteTypes.filter(D=>!Zr.has(D));y.length&&A.warn(`Prewrite hooks for some types (${y.join()}), requested by extension ${p.extensionName}, are unsupported. Please file an issue or a PR.`);for(const D of p.writeDependencies)p.install(D,t.dependencies[D])}function c(p,y,D,T){const I=[];let m=0;for(const x of p){const M=a.createAccessorDef(x);M.bufferView=i.bufferViews.length;const N=x.getArray(),G=O.pad(O.toView(N));M.byteOffset=m,m+=G.byteLength,I.push(G),a.accessorIndexMap.set(x,i.accessors.length),i.accessors.push(M)}const d=O.concat(I),F={buffer:y,byteOffset:D,byteLength:d.byteLength};return T&&(F.target=T),i.bufferViews.push(F),{buffers:I,byteLength:m}}function B(p,y,D){const T=p[0].getCount();let I=0;for(const M of p){const N=a.createAccessorDef(M);N.bufferView=i.bufferViews.length,N.byteOffset=I;const G=M.getElementSize(),S=M.getComponentSize();I+=O.padNumber(G*S),a.accessorIndexMap.set(M,i.accessors.length),i.accessors.push(N)}const m=T*I,d=new ArrayBuffer(m),F=new DataView(d);for(let M=0;M<T;M++){let N=0;for(const G of p){const S=G.getElementSize(),b=G.getComponentSize(),L=G.getComponentType(),w=G.getArray();for(let j=0;j<S;j++){const ee=M*I+N+j*b,q=w[M*S+j];switch(L){case R.ComponentType.FLOAT:F.setFloat32(ee,q,!0);break;case R.ComponentType.BYTE:F.setInt8(ee,q);break;case R.ComponentType.SHORT:F.setInt16(ee,q,!0);break;case R.ComponentType.UNSIGNED_BYTE:F.setUint8(ee,q);break;case R.ComponentType.UNSIGNED_SHORT:F.setUint16(ee,q,!0);break;case R.ComponentType.UNSIGNED_INT:F.setUint32(ee,q,!0);break;default:throw new Error("Unexpected component type: "+L)}}N+=O.padNumber(S*b)}}const x={buffer:y,byteOffset:D,byteLength:m,byteStride:I,target:le.BufferViewTarget.ARRAY_BUFFER};return i.bufferViews.push(x),{byteLength:m,buffers:[new Uint8Array(d)]}}function h(p,y,D){const T=[];let I=0;const m=new Map;let d=-1/0,F=!1;for(const L of p){const w=a.createAccessorDef(L);i.accessors.push(w),a.accessorIndexMap.set(L,i.accessors.length-1);const j=[],ee=[],q=[],Y=new Array(L.getElementSize()).fill(0);for(let Ee=0,Er=L.getCount();Ee<Er;Ee++)if(L.getElement(Ee,q),!H.eq(q,Y,0)){d=Math.max(Ee,d),j.push(Ee);for(let Jt=0;Jt<q.length;Jt++)ee.push(q[Jt])}const te=j.length,de={accessorDef:w,count:te};if(m.set(L,de),te===0)continue;te>L.getCount()/2&&(F=!0);const Kt=gt[L.getComponentType()];de.indices=j,de.values=new Kt(ee)}if(!Number.isFinite(d))return{buffers:T,byteLength:I};F&&A.warn("Some sparse accessors have >50% non-zero elements, which may increase file size.");const x=d<255?Uint8Array:d<65535?Uint16Array:Uint32Array,M=d<255?Qr:d<65535?zr:qr,N={buffer:y,byteOffset:D+I,byteLength:0};for(const L of p){const w=m.get(L);if(w.count===0)continue;w.indicesByteOffset=N.byteLength;const j=O.pad(O.toView(new x(w.indices)));T.push(j),I+=j.byteLength,N.byteLength+=j.byteLength}i.bufferViews.push(N);const G=i.bufferViews.length-1,S={buffer:y,byteOffset:D+I,byteLength:0};for(const L of p){const w=m.get(L);if(w.count===0)continue;w.valuesByteOffset=S.byteLength;const j=O.pad(O.toView(w.values));T.push(j),I+=j.byteLength,S.byteLength+=j.byteLength}i.bufferViews.push(S);const b=i.bufferViews.length-1;for(const L of p){const w=m.get(L);w.count!==0&&(w.accessorDef.sparse={count:w.count,indices:{bufferView:G,byteOffset:w.indicesByteOffset,componentType:M},values:{bufferView:b,byteOffset:w.valuesByteOffset}})}return{buffers:T,byteLength:I}}if(i.accessors=[],i.bufferViews=[],i.samplers=[],i.textures=[],i.images=n.listTextures().map((p,y)=>{const D=a.createPropertyDef(p);p.getMimeType()&&(D.mimeType=p.getMimeType());const T=p.getImage();return T&&a.createImageData(D,T,p),a.imageIndexMap.set(p,y),D}),f.filter(p=>p.prewriteTypes.includes(E.ACCESSOR)).forEach(p=>p.prewrite(a,E.ACCESSOR)),n.listAccessors().forEach(p=>{const y=a.accessorUsageGroupedByParent,D=a.accessorParents;if(a.accessorIndexMap.has(p))return;const T=a.getAccessorUsage(p);if(a.addAccessorToUsageGroup(p,T),y.has(T)){const I=r.listParents(p).find(m=>m.propertyType!==E.ROOT);D.set(p,I)}}),f.filter(p=>p.prewriteTypes.includes(E.BUFFER)).forEach(p=>p.prewrite(a,E.BUFFER)),(n.listAccessors().length>0||n.listTextures().length>0||a.otherBufferViews.size>0)&&n.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");i.buffers=[],n.listBuffers().forEach((p,y)=>{const D=a.createPropertyDef(p),T=a.accessorUsageGroupedByParent,I=p.listParents().filter(S=>S instanceof R),m=new Set(I.map(S=>a.accessorParents.get(S))),d=new Map(Array.from(m).map((S,b)=>[S,b])),F={};for(const S of I){var x;if(a.accessorIndexMap.has(S))continue;const b=a.getAccessorUsage(S);let L=b;if(T.has(b)){const w=a.accessorParents.get(S);L+=`:${d.get(w)}`}F[x=L]||(F[x]={usage:b,accessors:[]}),F[L].accessors.push(S)}const M=[],N=i.buffers.length;let G=0;for(const{usage:S,accessors:b}of Object.values(F))if(S===Dt.ARRAY_BUFFER&&t.vertexLayout===Ft.INTERLEAVED){const L=B(b,N,G);G+=L.byteLength,M.push(...L.buffers)}else if(S===Dt.ARRAY_BUFFER)for(const L of b){const w=B([L],N,G);G+=w.byteLength,M.push(...w.buffers)}else if(S===Dt.SPARSE){const L=h(b,N,G);G+=L.byteLength,M.push(...L.buffers)}else if(S===Dt.ELEMENT_ARRAY_BUFFER){const L=le.BufferViewTarget.ELEMENT_ARRAY_BUFFER,w=c(b,N,G,L);G+=w.byteLength,M.push(...w.buffers)}else{const L=c(b,N,G);G+=L.byteLength,M.push(...L.buffers)}if(a.imageBufferViews.length&&y===0){for(let S=0;S<a.imageBufferViews.length;S++)if(i.bufferViews[i.images[S].bufferView].byteOffset=G,G+=a.imageBufferViews[S].byteLength,M.push(a.imageBufferViews[S]),G%8){const b=8-G%8;G+=b,M.push(new Uint8Array(b))}}if(a.otherBufferViews.has(p))for(const S of a.otherBufferViews.get(p))i.bufferViews.push({buffer:N,byteOffset:G,byteLength:S.byteLength}),a.otherBufferViewsIndexMap.set(S,i.bufferViews.length-1),G+=S.byteLength,M.push(S);if(G){let S;t.format===Je.GLB?S=ze:(S=a.bufferURIGenerator.createURI(p,"bin"),D.uri=S),D.byteLength=G,o.resources[S]=O.concat(M)}i.buffers.push(D),a.bufferIndexMap.set(p,y)}),n.listAccessors().find(p=>!p.getBuffer())&&A.warn("Skipped writing one or more Accessors: no Buffer assigned."),f.filter(p=>p.prewriteTypes.includes(E.MATERIAL)).forEach(p=>p.prewrite(a,E.MATERIAL)),i.materials=n.listMaterials().map((p,y)=>{const D=a.createPropertyDef(p);if(p.getAlphaMode()!==Ce.AlphaMode.OPAQUE&&(D.alphaMode=p.getAlphaMode()),p.getAlphaMode()===Ce.AlphaMode.MASK&&(D.alphaCutoff=p.getAlphaCutoff()),p.getDoubleSided()&&(D.doubleSided=!0),D.pbrMetallicRoughness={},H.eq(p.getBaseColorFactor(),[1,1,1,1])||(D.pbrMetallicRoughness.baseColorFactor=p.getBaseColorFactor()),H.eq(p.getEmissiveFactor(),[0,0,0])||(D.emissiveFactor=p.getEmissiveFactor()),p.getRoughnessFactor()!==1&&(D.pbrMetallicRoughness.roughnessFactor=p.getRoughnessFactor()),p.getMetallicFactor()!==1&&(D.pbrMetallicRoughness.metallicFactor=p.getMetallicFactor()),p.getBaseColorTexture()){const T=p.getBaseColorTexture(),I=p.getBaseColorTextureInfo();D.pbrMetallicRoughness.baseColorTexture=a.createTextureInfoDef(T,I)}if(p.getEmissiveTexture()){const T=p.getEmissiveTexture(),I=p.getEmissiveTextureInfo();D.emissiveTexture=a.createTextureInfoDef(T,I)}if(p.getNormalTexture()){const T=p.getNormalTexture(),I=p.getNormalTextureInfo(),m=a.createTextureInfoDef(T,I);p.getNormalScale()!==1&&(m.scale=p.getNormalScale()),D.normalTexture=m}if(p.getOcclusionTexture()){const T=p.getOcclusionTexture(),I=p.getOcclusionTextureInfo(),m=a.createTextureInfoDef(T,I);p.getOcclusionStrength()!==1&&(m.strength=p.getOcclusionStrength()),D.occlusionTexture=m}if(p.getMetallicRoughnessTexture()){const T=p.getMetallicRoughnessTexture(),I=p.getMetallicRoughnessTextureInfo();D.pbrMetallicRoughness.metallicRoughnessTexture=a.createTextureInfoDef(T,I)}return a.materialIndexMap.set(p,y),D}),f.filter(p=>p.prewriteTypes.includes(E.MESH)).forEach(p=>p.prewrite(a,E.MESH)),i.meshes=n.listMeshes().map((p,y)=>{const D=a.createPropertyDef(p);let T=null;return D.primitives=p.listPrimitives().map(I=>{const m={attributes:{}};m.mode=I.getMode();const d=I.getMaterial();d&&(m.material=a.materialIndexMap.get(d)),Object.keys(I.getExtras()).length&&(m.extras=I.getExtras());const F=I.getIndices();F&&(m.indices=a.accessorIndexMap.get(F));for(const x of I.listSemantics())m.attributes[x]=a.accessorIndexMap.get(I.getAttribute(x));for(const x of I.listTargets()){const M={};for(const N of x.listSemantics())M[N]=a.accessorIndexMap.get(x.getAttribute(N));m.targets=m.targets||[],m.targets.push(M)}return I.listTargets().length&&!T&&(T=I.listTargets().map(x=>x.getName())),m}),p.getWeights().length&&(D.weights=p.getWeights()),T&&(D.extras=D.extras||{},D.extras.targetNames=T),a.meshIndexMap.set(p,y),D}),i.cameras=n.listCameras().map((p,y)=>{const D=a.createPropertyDef(p);if(D.type=p.getType(),D.type===Ve.Type.PERSPECTIVE){D.perspective={znear:p.getZNear(),zfar:p.getZFar(),yfov:p.getYFov()};const T=p.getAspectRatio();T!==null&&(D.perspective.aspectRatio=T)}else D.orthographic={znear:p.getZNear(),zfar:p.getZFar(),xmag:p.getXMag(),ymag:p.getYMag()};return a.cameraIndexMap.set(p,y),D}),i.nodes=n.listNodes().map((p,y)=>{const D=a.createPropertyDef(p);return H.eq(p.getTranslation(),[0,0,0])||(D.translation=p.getTranslation()),H.eq(p.getRotation(),[0,0,0,1])||(D.rotation=p.getRotation()),H.eq(p.getScale(),[1,1,1])||(D.scale=p.getScale()),p.getWeights().length&&(D.weights=p.getWeights()),a.nodeIndexMap.set(p,y),D}),i.skins=n.listSkins().map((p,y)=>{const D=a.createPropertyDef(p),T=p.getInverseBindMatrices();T&&(D.inverseBindMatrices=a.accessorIndexMap.get(T));const I=p.getSkeleton();return I&&(D.skeleton=a.nodeIndexMap.get(I)),D.joints=p.listJoints().map(m=>a.nodeIndexMap.get(m)),a.skinIndexMap.set(p,y),D}),n.listNodes().forEach((p,y)=>{const D=i.nodes[y],T=p.getMesh();T&&(D.mesh=a.meshIndexMap.get(T));const I=p.getCamera();I&&(D.camera=a.cameraIndexMap.get(I));const m=p.getSkin();m&&(D.skin=a.skinIndexMap.get(m)),p.listChildren().length>0&&(D.children=p.listChildren().map(d=>a.nodeIndexMap.get(d)))}),i.animations=n.listAnimations().map((p,y)=>{const D=a.createPropertyDef(p),T=new Map;return D.samplers=p.listSamplers().map((I,m)=>{const d=a.createPropertyDef(I);return d.input=a.accessorIndexMap.get(I.getInput()),d.output=a.accessorIndexMap.get(I.getOutput()),d.interpolation=I.getInterpolation(),T.set(I,m),d}),D.channels=p.listChannels().map(I=>{const m=a.createPropertyDef(I);return m.sampler=T.get(I.getSampler()),m.target={node:a.nodeIndexMap.get(I.getTargetNode()),path:I.getTargetPath()},m}),a.animationIndexMap.set(p,y),D}),i.scenes=n.listScenes().map((p,y)=>{const D=a.createPropertyDef(p);return D.nodes=p.listChildren().map(T=>a.nodeIndexMap.get(T)),a.sceneIndexMap.set(p,y),D});const C=n.getDefaultScene();return C&&(i.scene=n.listScenes().indexOf(C)),i.extensionsUsed=f.map(p=>p.extensionName),i.extensionsRequired=l.map(p=>p.extensionName),f.forEach(p=>p.write(a)),ei(i),o}}function ei(s){const e=[];for(const t in s){const r=s[t];(Array.isArray(r)&&r.length===0||r===null||r===""||r&&typeof r=="object"&&Object.keys(r).length===0)&&e.push(t)}for(const t of e)delete s[t]}var xt;(function(s){s[s.JSON=1313821514]="JSON",s[s.BIN=5130562]="BIN"})(xt||(xt={}));class ti{constructor(){this._logger=oe.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=Ft.INTERLEAVED,this.lastReadBytes=0,this.lastWriteBytes=0}setLogger(e){return this._logger=e,this}registerExtensions(e){for(const t of e)this._extensions.add(t),t.register();return this}registerDependencies(e){return Object.assign(this._dependencies,e),this}setVertexLayout(e){return this._vertexLayout=e,this}async read(e){return await this.readJSON(await this.readAsJSON(e))}async readAsJSON(e){const t=await this.readURI(e,"view");this.lastReadBytes=t.byteLength;const r=Ks(t)?this._binaryToJSON(t):{json:JSON.parse(O.decodeText(t)),resources:{}};return await this._readResourcesExternal(r,this.dirname(e)),this._readResourcesInternal(r),r}async readJSON(e){return e=this._copyJSON(e),this._readResourcesInternal(e),kr.read(e,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(e){const t=this._binaryToJSON(O.assertView(e));this._readResourcesInternal(t);const r=t.json;if(r.buffers&&r.buffers.some(n=>si(t,n)))throw new Error("Cannot resolve external buffers with binaryToJSON().");if(r.images&&r.images.some(n=>ni(t,n)))throw new Error("Cannot resolve external images with binaryToJSON().");return t}async readBinary(e){return this.readJSON(await this.binaryToJSON(O.assertView(e)))}async writeJSON(e,t={}){if(t.format===Je.GLB&&e.getRoot().listBuffers().length>1)throw new Error("GLB must have 0–1 buffers.");return $r.write(e,{format:t.format||Je.GLTF,basename:t.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:Z({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(e){const{json:t,resources:r}=await this.writeJSON(e,{format:Je.GLB}),n=new Uint32Array([1179937895,2,12]),i=JSON.stringify(t),o=O.pad(O.encodeText(i),32),a=O.toView(new Uint32Array([o.byteLength,1313821514])),A=O.concat([a,o]);n[n.length-1]+=A.byteLength;const u=Object.values(r)[0];if(!u||!u.byteLength)return O.concat([O.toView(n),A]);const f=O.pad(u,0),l=O.toView(new Uint32Array([f.byteLength,5130562])),c=O.concat([l,f]);return n[n.length-1]+=c.byteLength,O.concat([O.toView(n),A,c])}async _readResourcesExternal(e,t){var r=this;const n=e.json.images||[],i=e.json.buffers||[],o=[...n,...i].map(async function(a){const A=a.uri;if(!A||A.match(/data:/))return Promise.resolve();e.resources[A]=await r.readURI(r.resolve(t,A),"view"),r.lastReadBytes+=e.resources[A].byteLength});await Promise.all(o)}_readResourcesInternal(e){function t(i){if(i.uri){if(i.uri in e.resources){O.assertView(e.resources[i.uri]);return}if(i.uri.match(/data:/)){const o=`__${vr()}.${Qe.extension(i.uri)}`;e.resources[o]=O.createBufferFromDataURI(i.uri),i.uri=o}}}(e.json.images||[]).forEach(i=>{if(i.bufferView===void 0&&i.uri===void 0)throw new Error("Missing resource URI or buffer view.");t(i)}),(e.json.buffers||[]).forEach(t)}_copyJSON(e){const{images:t,buffers:r}=e.json;return e={json:Z({},e.json),resources:Z({},e.resources)},t&&(e.json.images=t.map(n=>Z({},n))),r&&(e.json.buffers=r.map(n=>Z({},n))),e}_binaryToJSON(e){if(!Ks(e))throw new Error("Invalid glTF 2.0 binary.");const t=new Uint32Array(e.buffer,e.byteOffset+12,2);if(t[1]!==xt.JSON)throw new Error("Missing required GLB JSON chunk.");const r=20,n=t[0],i=O.decodeText(O.toView(e,r,n)),o=JSON.parse(i),a=r+n;if(e.byteLength<=a)return{json:o,resources:{}};const A=new Uint32Array(e.buffer,e.byteOffset+a,2);if(A[1]!==xt.BIN)return{json:o,resources:{}};const u=A[0],f=O.toView(e,a+8,u);return{json:o,resources:{[ze]:f}}}}function si(s,e){return e.uri!==void 0&&!(e.uri in s.resources)}function ni(s,e){return e.uri!==void 0&&!(e.uri in s.resources)&&e.bufferView===void 0}function Ks(s){if(s.byteLength<3*Uint32Array.BYTES_PER_ELEMENT)return!1;const e=new Uint32Array(s.buffer,s.byteOffset,3);return e[0]===1179937895&&e[1]===2}class ri extends ti{constructor(e=ft.DEFAULT_INIT){super(),this._fetchConfig=void 0,this._fetchConfig=e}async readURI(e,t){const r=await fetch(e,this._fetchConfig);switch(t){case"view":return new Uint8Array(await r.arrayBuffer());case"text":return r.text()}}resolve(e,t){return ft.resolve(e,t)}dirname(e){return ft.dirname(e)}}function ii(s){for(var e=new Array(s),t=0;t<s;++t)e[t]=t;return e}var oi=ii;/*!
2
- * Determine if an object is a Buffer
3
- *
4
- * @author Feross Aboukhadijeh <https://feross.org>
5
- * @license MIT
6
- */var ai=function(s){return s!=null&&(Sn(s)||Ai(s)||!!s._isBuffer)};function Sn(s){return!!s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function Ai(s){return typeof s.readFloatLE=="function"&&typeof s.slice=="function"&&Sn(s.slice(0,0))}var ci=oi,ui=ai,fi=typeof Float64Array<"u";function Bi(s,e){return s[0]-e[0]}function li(){var s=this.stride,e=new Array(s.length),t;for(t=0;t<e.length;++t)e[t]=[Math.abs(s[t]),t];e.sort(Bi);var r=new Array(e.length);for(t=0;t<r.length;++t)r[t]=e[t][1];return r}function hi(s,e){var t=["View",e,"d",s].join("");e<0&&(t="View_Nil"+s);var r=s==="generic";if(e===-1){var n="function "+t+"(a){this.data=a;};var proto="+t+".prototype;proto.dtype='"+s+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+t+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+t+"(a){return new "+t+"(a);}",g=new Function(n);return g()}else if(e===0){var n="function "+t+"(a,d) {this.data = a;this.offset = d};var proto="+t+".prototype;proto.dtype='"+s+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+t+"_copy() {return new "+t+"(this.data,this.offset)};proto.pick=function "+t+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+t+"_get(){return "+(r?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+t+"_set(v){return "+(r?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+t+"(a,b,c,d){return new "+t+"(a,d)}",g=new Function("TrivialArray",n);return g(Mt[s][0])}var n=["'use strict'"],i=ci(e),o=i.map(function(C){return"i"+C}),a="this.offset+"+i.map(function(C){return"this.stride["+C+"]*i"+C}).join("+"),A=i.map(function(C){return"b"+C}).join(","),u=i.map(function(C){return"c"+C}).join(",");n.push("function "+t+"(a,"+A+","+u+",d){this.data=a","this.shape=["+A+"]","this.stride=["+u+"]","this.offset=d|0}","var proto="+t+".prototype","proto.dtype='"+s+"'","proto.dimension="+e),n.push("Object.defineProperty(proto,'size',{get:function "+t+"_size(){return "+i.map(function(C){return"this.shape["+C+"]"}).join("*"),"}})"),e===1?n.push("proto.order=[0]"):(n.push("Object.defineProperty(proto,'order',{get:"),e<4?(n.push("function "+t+"_order(){"),e===2?n.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):e===3&&n.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):n.push("ORDER})")),n.push("proto.set=function "+t+"_set("+o.join(",")+",v){"),r?n.push("return this.data.set("+a+",v)}"):n.push("return this.data["+a+"]=v}"),n.push("proto.get=function "+t+"_get("+o.join(",")+"){"),r?n.push("return this.data.get("+a+")}"):n.push("return this.data["+a+"]}"),n.push("proto.index=function "+t+"_index(",o.join(),"){return "+a+"}"),n.push("proto.hi=function "+t+"_hi("+o.join(",")+"){return new "+t+"(this.data,"+i.map(function(C){return["(typeof i",C,"!=='number'||i",C,"<0)?this.shape[",C,"]:i",C,"|0"].join("")}).join(",")+","+i.map(function(C){return"this.stride["+C+"]"}).join(",")+",this.offset)}");var f=i.map(function(C){return"a"+C+"=this.shape["+C+"]"}),l=i.map(function(C){return"c"+C+"=this.stride["+C+"]"});n.push("proto.lo=function "+t+"_lo("+o.join(",")+"){var b=this.offset,d=0,"+f.join(",")+","+l.join(","));for(var c=0;c<e;++c)n.push("if(typeof i"+c+"==='number'&&i"+c+">=0){d=i"+c+"|0;b+=c"+c+"*d;a"+c+"-=d}");n.push("return new "+t+"(this.data,"+i.map(function(C){return"a"+C}).join(",")+","+i.map(function(C){return"c"+C}).join(",")+",b)}"),n.push("proto.step=function "+t+"_step("+o.join(",")+"){var "+i.map(function(C){return"a"+C+"=this.shape["+C+"]"}).join(",")+","+i.map(function(C){return"b"+C+"=this.stride["+C+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var c=0;c<e;++c)n.push("if(typeof i"+c+"==='number'){d=i"+c+"|0;if(d<0){c+=b"+c+"*(a"+c+"-1);a"+c+"=ceil(-a"+c+"/d)}else{a"+c+"=ceil(a"+c+"/d)}b"+c+"*=d}");n.push("return new "+t+"(this.data,"+i.map(function(C){return"a"+C}).join(",")+","+i.map(function(C){return"b"+C}).join(",")+",c)}");for(var B=new Array(e),h=new Array(e),c=0;c<e;++c)B[c]="a[i"+c+"]",h[c]="b[i"+c+"]";n.push("proto.transpose=function "+t+"_transpose("+o+"){"+o.map(function(C,p){return C+"=("+C+"===undefined?"+p+":"+C+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+t+"(this.data,"+B.join(",")+","+h.join(",")+",this.offset)}"),n.push("proto.pick=function "+t+"_pick("+o+"){var a=[],b=[],c=this.offset");for(var c=0;c<e;++c)n.push("if(typeof i"+c+"==='number'&&i"+c+">=0){c=(c+this.stride["+c+"]*i"+c+")|0}else{a.push(this.shape["+c+"]);b.push(this.stride["+c+"])}");n.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),n.push("return function construct_"+t+"(data,shape,stride,offset){return new "+t+"(data,"+i.map(function(C){return"shape["+C+"]"}).join(",")+","+i.map(function(C){return"stride["+C+"]"}).join(",")+",offset)}");var g=new Function("CTOR_LIST","ORDER",n.join(`
7
- `));return g(Mt[s],li)}function pi(s){if(ui(s))return"buffer";if(fi)switch(Object.prototype.toString.call(s)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(s)?"array":"generic"}var Mt={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};function gi(s,e,t,r){if(s===void 0){var u=Mt.array[0];return u([])}else typeof s=="number"&&(s=[s]);e===void 0&&(e=[s.length]);var n=e.length;if(t===void 0){t=new Array(n);for(var i=n-1,o=1;i>=0;--i)t[i]=o,o*=e[i]}if(r===void 0){r=0;for(var i=0;i<n;++i)t[i]<0&&(r-=(e[i]-1)*t[i])}for(var a=pi(s),A=Mt[a];A.length<=n+1;)A.push(hi(a,A.length-1));var u=A[n+1];return u(s,e,t,r)}var Ci=gi;const di=Dn.getDefaultExportFromCjs(Ci);var Ei={};function Di(s,e){for(var t=1,r=s.length,n=s[0],i=s[0],o=1;o<r;++o)if(i=n,n=s[o],e(n,i)){if(o===t){t++;continue}s[t++]=n}return s.length=t,s}function Ii(s){for(var e=1,t=s.length,r=s[0],n=s[0],i=1;i<t;++i,n=r)if(n=r,r=s[i],r!==n){if(i===e){e++;continue}s[e++]=r}return s.length=e,s}function Ti(s,e,t){return s.length===0?s:e?(t||s.sort(e),Di(s,e)):(t||s.sort(),Ii(s))}var mi=Ti,Fi=mi;function Gn(s,e,t){var r=s.length,n=e.arrayArgs.length,i=e.indexArgs.length>0,o=[],a=[],A=0,u=0,f,l;for(f=0;f<r;++f)a.push(["i",f,"=0"].join(""));for(l=0;l<n;++l)for(f=0;f<r;++f)u=A,A=s[f],f===0?a.push(["d",l,"s",f,"=t",l,"p",A].join("")):a.push(["d",l,"s",f,"=(t",l,"p",A,"-s",u,"*t",l,"p",u,")"].join(""));for(a.length>0&&o.push("var "+a.join(",")),f=r-1;f>=0;--f)A=s[f],o.push(["for(i",f,"=0;i",f,"<s",A,";++i",f,"){"].join(""));for(o.push(t),f=0;f<r;++f){for(u=A,A=s[f],l=0;l<n;++l)o.push(["p",l,"+=d",l,"s",f].join(""));i&&(f>0&&o.push(["index[",u,"]-=s",u].join("")),o.push(["++index[",A,"]"].join(""))),o.push("}")}return o.join(`
8
- `)}function yi(s,e,t,r){for(var n=e.length,i=t.arrayArgs.length,o=t.blockSize,a=t.indexArgs.length>0,A=[],u=0;u<i;++u)A.push(["var offset",u,"=p",u].join(""));for(var u=s;u<n;++u)A.push(["for(var j"+u+"=SS[",e[u],"]|0;j",u,">0;){"].join("")),A.push(["if(j",u,"<",o,"){"].join("")),A.push(["s",e[u],"=j",u].join("")),A.push(["j",u,"=0"].join("")),A.push(["}else{s",e[u],"=",o].join("")),A.push(["j",u,"-=",o,"}"].join("")),a&&A.push(["index[",e[u],"]=j",u].join(""));for(var u=0;u<i;++u){for(var f=["offset"+u],l=s;l<n;++l)f.push(["j",l,"*t",u,"p",e[l]].join(""));A.push(["p",u,"=(",f.join("+"),")"].join(""))}A.push(Gn(e,t,r));for(var u=s;u<n;++u)A.push("}");return A.join(`
9
- `)}function xi(s){for(var e=0,t=s[0].length;e<t;){for(var r=1;r<s.length;++r)if(s[r][e]!==s[0][e])return e;++e}return e}function Vt(s,e,t){for(var r=s.body,n=[],i=[],o=0;o<s.args.length;++o){var a=s.args[o];if(!(a.count<=0)){var A=new RegExp(a.name,"g"),u="",f=e.arrayArgs.indexOf(o);switch(e.argTypes[o]){case"offset":var l=e.offsetArgIndex.indexOf(o),c=e.offsetArgs[l];f=c.array,u="+q"+l;case"array":u="p"+f+u;var B="l"+o,h="a"+f;if(e.arrayBlockIndices[f]===0)a.count===1?t[f]==="generic"?a.lvalue?(n.push(["var ",B,"=",h,".get(",u,")"].join("")),r=r.replace(A,B),i.push([h,".set(",u,",",B,")"].join(""))):r=r.replace(A,[h,".get(",u,")"].join("")):r=r.replace(A,[h,"[",u,"]"].join("")):t[f]==="generic"?(n.push(["var ",B,"=",h,".get(",u,")"].join("")),r=r.replace(A,B),a.lvalue&&i.push([h,".set(",u,",",B,")"].join(""))):(n.push(["var ",B,"=",h,"[",u,"]"].join("")),r=r.replace(A,B),a.lvalue&&i.push([h,"[",u,"]=",B].join("")));else{for(var g=[a.name],C=[u],p=0;p<Math.abs(e.arrayBlockIndices[f]);p++)g.push("\\s*\\[([^\\]]+)\\]"),C.push("$"+(p+1)+"*t"+f+"b"+p);if(A=new RegExp(g.join(""),"g"),u=C.join("+"),t[f]==="generic")throw new Error("cwise: Generic arrays not supported in combination with blocks!");r=r.replace(A,[h,"[",u,"]"].join(""))}break;case"scalar":r=r.replace(A,"Y"+e.scalarArgs.indexOf(o));break;case"index":r=r.replace(A,"index");break;case"shape":r=r.replace(A,"shape");break}}}return[n.join(`
10
- `),r,i.join(`
11
- `)].join(`
12
- `).trim()}function Mi(s){for(var e=new Array(s.length),t=!0,r=0;r<s.length;++r){var n=s[r],i=n.match(/\d+/);i?i=i[0]:i="",n.charAt(0)===0?e[r]="u"+n.charAt(1)+i:e[r]=n.charAt(0)+i,r>0&&(t=t&&e[r]===e[r-1])}return t?e[0]:e.join("")}function Ri(s,e){for(var t=e[1].length-Math.abs(s.arrayBlockIndices[0])|0,r=new Array(s.arrayArgs.length),n=new Array(s.arrayArgs.length),i=0;i<s.arrayArgs.length;++i)n[i]=e[2*i],r[i]=e[2*i+1];for(var o=[],a=[],A=[],u=[],f=[],i=0;i<s.arrayArgs.length;++i){s.arrayBlockIndices[i]<0?(A.push(0),u.push(t),o.push(t),a.push(t+s.arrayBlockIndices[i])):(A.push(s.arrayBlockIndices[i]),u.push(s.arrayBlockIndices[i]+t),o.push(0),a.push(s.arrayBlockIndices[i]));for(var l=[],c=0;c<r[i].length;c++)A[i]<=r[i][c]&&r[i][c]<u[i]&&l.push(r[i][c]-A[i]);f.push(l)}for(var B=["SS"],h=["'use strict'"],g=[],c=0;c<t;++c)g.push(["s",c,"=SS[",c,"]"].join(""));for(var i=0;i<s.arrayArgs.length;++i){B.push("a"+i),B.push("t"+i),B.push("p"+i);for(var c=0;c<t;++c)g.push(["t",i,"p",c,"=t",i,"[",A[i]+c,"]"].join(""));for(var c=0;c<Math.abs(s.arrayBlockIndices[i]);++c)g.push(["t",i,"b",c,"=t",i,"[",o[i]+c,"]"].join(""))}for(var i=0;i<s.scalarArgs.length;++i)B.push("Y"+i);if(s.shapeArgs.length>0&&g.push("shape=SS.slice(0)"),s.indexArgs.length>0){for(var C=new Array(t),i=0;i<t;++i)C[i]="0";g.push(["index=[",C.join(","),"]"].join(""))}for(var i=0;i<s.offsetArgs.length;++i){for(var p=s.offsetArgs[i],y=[],c=0;c<p.offset.length;++c)p.offset[c]!==0&&(p.offset[c]===1?y.push(["t",p.array,"p",c].join("")):y.push([p.offset[c],"*t",p.array,"p",c].join("")));y.length===0?g.push("q"+i+"=0"):g.push(["q",i,"=",y.join("+")].join(""))}var D=Fi([].concat(s.pre.thisVars).concat(s.body.thisVars).concat(s.post.thisVars));g=g.concat(D),g.length>0&&h.push("var "+g.join(","));for(var i=0;i<s.arrayArgs.length;++i)h.push("p"+i+"|=0");s.pre.body.length>3&&h.push(Vt(s.pre,s,n));var T=Vt(s.body,s,n),I=xi(f);I<t?h.push(yi(I,f[0],s,T)):h.push(Gn(f[0],s,T)),s.post.body.length>3&&h.push(Vt(s.post,s,n)),s.debug&&console.log("-----Generated cwise routine for ",e,`:
13
- `+h.join(`
14
- `)+`
15
- ----------`);var m=[s.funcName||"unnamed","_cwise_loop_",r[0].join("s"),"m",I,Mi(n)].join(""),d=new Function(["function ",m,"(",B.join(","),"){",h.join(`
16
- `),"} return ",m].join(""));return d()}var Ni=Ri,Si=Ni;function Gi(s){var e=["'use strict'","var CACHED={}"],t=[],r=s.funcName+"_cwise_thunk";e.push(["return function ",r,"(",s.shimArgs.join(","),"){"].join(""));for(var n=[],i=[],o=[["array",s.arrayArgs[0],".shape.slice(",Math.max(0,s.arrayBlockIndices[0]),s.arrayBlockIndices[0]<0?","+s.arrayBlockIndices[0]+")":")"].join("")],a=[],A=[],u=0;u<s.arrayArgs.length;++u){var f=s.arrayArgs[u];t.push(["t",f,"=array",f,".dtype,","r",f,"=array",f,".order"].join("")),n.push("t"+f),n.push("r"+f),i.push("t"+f),i.push("r"+f+".join()"),o.push("array"+f+".data"),o.push("array"+f+".stride"),o.push("array"+f+".offset|0"),u>0&&(a.push("array"+s.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(s.arrayBlockIndices[0])-Math.abs(s.arrayBlockIndices[u]))),A.push("array"+s.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,s.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,s.arrayBlockIndices[u])+"]"))}s.arrayArgs.length>1&&(e.push("if (!("+a.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+s.arrayArgs[0]+".shape.length-"+Math.abs(s.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+A.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var u=0;u<s.scalarArgs.length;++u)o.push("scalar"+s.scalarArgs[u]);t.push(["type=[",i.join(","),"].join()"].join("")),t.push("proc=CACHED[type]"),e.push("var "+t.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",n.join(","),"])}","return proc(",o.join(","),")}"].join("")),s.debug&&console.log(`-----Generated thunk:
17
- `+e.join(`
18
- `)+`
19
- ----------`);var l=new Function("compile",e.join(`
20
- `));return l(Si.bind(void 0,s))}var bi=Gi,Oi=bi;function Li(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function Hi(s){var e=new Li;e.pre=s.pre,e.body=s.body,e.post=s.post;var t=s.args.slice(0);e.argTypes=t;for(var r=0;r<t.length;++r){var n=t[r];if(n==="array"||typeof n=="object"&&n.blockIndices){if(e.argTypes[r]="array",e.arrayArgs.push(r),e.arrayBlockIndices.push(n.blockIndices?n.blockIndices:0),e.shimArgs.push("array"+r),r<e.pre.args.length&&e.pre.args[r].count>0)throw new Error("cwise: pre() block may not reference array args");if(r<e.post.args.length&&e.post.args[r].count>0)throw new Error("cwise: post() block may not reference array args")}else if(n==="scalar")e.scalarArgs.push(r),e.shimArgs.push("scalar"+r);else if(n==="index"){if(e.indexArgs.push(r),r<e.pre.args.length&&e.pre.args[r].count>0)throw new Error("cwise: pre() block may not reference array index");if(r<e.body.args.length&&e.body.args[r].lvalue)throw new Error("cwise: body() block may not write to array index");if(r<e.post.args.length&&e.post.args[r].count>0)throw new Error("cwise: post() block may not reference array index")}else if(n==="shape"){if(e.shapeArgs.push(r),r<e.pre.args.length&&e.pre.args[r].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(r<e.body.args.length&&e.body.args[r].lvalue)throw new Error("cwise: body() block may not write to array shape");if(r<e.post.args.length&&e.post.args[r].lvalue)throw new Error("cwise: post() block may not write to array shape")}else if(typeof n=="object"&&n.offset)e.argTypes[r]="offset",e.offsetArgs.push({array:n.array,offset:n.offset}),e.offsetArgIndex.push(r);else throw new Error("cwise: Unknown argument type "+t[r])}if(e.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(e.pre.args.length>t.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>t.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>t.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!s.printCode||!!s.debug,e.funcName=s.funcName||"cwise",e.blockSize=s.blockSize||64,Oi(e)}var wi=Hi;(function(s){var e=wi,t={body:"",args:[],thisVars:[],localVars:[]};function r(c){if(!c)return t;for(var B=0;B<c.args.length;++B){var h=c.args[B];B===0?c.args[B]={name:h,lvalue:!0,rvalue:!!c.rvalue,count:c.count||1}:c.args[B]={name:h,lvalue:!1,rvalue:!0,count:1}}return c.thisVars||(c.thisVars=[]),c.localVars||(c.localVars=[]),c}function n(c){return e({args:c.args,pre:r(c.pre),body:r(c.body),post:r(c.proc),funcName:c.funcName})}function i(c){for(var B=[],h=0;h<c.args.length;++h)B.push("a"+h);var g=new Function("P",["return function ",c.funcName,"_ndarrayops(",B.join(","),") {P(",B.join(","),");return a0}"].join(""));return g(n(c))}var o={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};(function(){for(var c in o){var B=o[c];s[c]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+B+"c"},funcName:c}),s[c+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a"+B+"=b"},rvalue:!0,funcName:c+"eq"}),s[c+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+B+"s"},funcName:c+"s"}),s[c+"seq"]=i({args:["array","scalar"],body:{args:["a","s"],body:"a"+B+"=s"},rvalue:!0,funcName:c+"seq"})}})();var a={not:"!",bnot:"~",neg:"-",recip:"1.0/"};(function(){for(var c in a){var B=a[c];s[c]=i({args:["array","array"],body:{args:["a","b"],body:"a="+B+"b"},funcName:c}),s[c+"eq"]=i({args:["array"],body:{args:["a"],body:"a="+B+"a"},rvalue:!0,count:2,funcName:c+"eq"})}})();var A={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};(function(){for(var c in A){var B=A[c];s[c]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+B+"c"},funcName:c}),s[c+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+B+"s"},funcName:c+"s"}),s[c+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a=a"+B+"b"},rvalue:!0,count:2,funcName:c+"eq"}),s[c+"seq"]=i({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+B+"s"},rvalue:!0,count:2,funcName:c+"seq"})}})();var u=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];(function(){for(var c=0;c<u.length;++c){var B=u[c];s[B]=i({args:["array","array"],pre:{args:[],body:"this_f=Math."+B,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:B}),s[B+"eq"]=i({args:["array"],pre:{args:[],body:"this_f=Math."+B,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:B+"eq"})}})();var f=["max","min","atan2","pow"];(function(){for(var c=0;c<f.length;++c){var B=f[c];s[B]=i({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+B,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:B}),s[B+"s"]=i({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+B,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:B+"s"}),s[B+"eq"]=i({args:["array","array"],pre:{args:[],body:"this_f=Math."+B,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:B+"eq"}),s[B+"seq"]=i({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+B,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:B+"seq"})}})();var l=["atan2","pow"];(function(){for(var c=0;c<l.length;++c){var B=l[c];s[B+"op"]=i({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+B,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:B+"op"}),s[B+"ops"]=i({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+B,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:B+"ops"}),s[B+"opeq"]=i({args:["array","array"],pre:{args:[],body:"this_f=Math."+B,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:B+"opeq"}),s[B+"opseq"]=i({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+B,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:B+"opseq"})}})(),s.any=e({args:["array"],pre:t,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),s.all=e({args:["array"],pre:t,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),s.sum=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),s.prod=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),s.norm2squared=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),s.norm2=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),s.norminf=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),s.norm1=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),s.sup=e({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),s.inf=e({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),s.argmin=e({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),s.argmax=e({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),s.random=i({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),s.assign=i({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),s.assigns=i({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),s.equals=e({args:["array","array"],pre:t,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})})(Ei);function Pi(s,e){if(!(s instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");const t=new Blob([s],{type:e}),r=URL.createObjectURL(t);return new Promise((n,i)=>{const o=new Image;o.crossOrigin="anonymous",o.onload=function(){URL.revokeObjectURL(r);const A=new OffscreenCanvas(o.width,o.height).getContext("2d");A.drawImage(o,0,0);const u=A.getImageData(0,0,o.width,o.height);n(di(new Uint8Array(u.data),[o.width,o.height,4],[4,4*o.width,1],0))},o.onerror=a=>{URL.revokeObjectURL(r),i(a)},o.src=r})}async function _i(s,e){return Pi(s,e)}const vi=0,Ki=0,Ji=0,Ui=2,Vi=0,ji=163,ki=166,Xi=0,Wi=2,Yi=1,qi=64,zi=0;class Qi{constructor(){this.vkFormat=zi,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=vi,this.levels=[],this.dataFormatDescriptor=[{vendorId:Ji,descriptorType:Ki,descriptorBlockSize:0,versionNumber:Ui,colorModel:Vi,colorPrimaries:Yi,transferFunction:Wi,flags:Xi,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class it{constructor(e,t,r,n){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=n,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian),t=this._dataView.getUint32(this._offset+4,this._littleEndian),r=e+2**32*t;return this._offset+=8,r}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==t&&n<e;)n++,this._offset++;return n<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}const z=[171,75,84,88,32,50,48,187,13,10,26,10];function Js(s){return new TextDecoder().decode(s)}function jt(s){const e=new Uint8Array(s.buffer,s.byteOffset,z.length);if(e[0]!==z[0]||e[1]!==z[1]||e[2]!==z[2]||e[3]!==z[3]||e[4]!==z[4]||e[5]!==z[5]||e[6]!==z[6]||e[7]!==z[7]||e[8]!==z[8]||e[9]!==z[9]||e[10]!==z[10]||e[11]!==z[11])throw new Error("Missing KTX 2.0 identifier.");const t=new Qi,r=17*Uint32Array.BYTES_PER_ELEMENT,n=new it(s,z.length,r,!0);t.vkFormat=n._nextUint32(),t.typeSize=n._nextUint32(),t.pixelWidth=n._nextUint32(),t.pixelHeight=n._nextUint32(),t.pixelDepth=n._nextUint32(),t.layerCount=n._nextUint32(),t.faceCount=n._nextUint32();const i=n._nextUint32();t.supercompressionScheme=n._nextUint32();const o=n._nextUint32(),a=n._nextUint32(),A=n._nextUint32(),u=n._nextUint32(),f=n._nextUint64(),l=n._nextUint64(),c=i*3*8,B=new it(s,z.length+r,c,!0);for(let Y=0;Y<i;Y++)t.levels.push({levelData:new Uint8Array(s.buffer,s.byteOffset+B._nextUint64(),B._nextUint64()),uncompressedByteLength:B._nextUint64()});const h=new it(s,o,a,!0),g={vendorId:h._skip(4)._nextUint16(),descriptorType:h._nextUint16(),versionNumber:h._nextUint16(),descriptorBlockSize:h._nextUint16(),colorModel:h._nextUint8(),colorPrimaries:h._nextUint8(),transferFunction:h._nextUint8(),flags:h._nextUint8(),texelBlockDimension:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],bytesPlane:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],samples:[]},y=(g.descriptorBlockSize/4-6)/4;for(let Y=0;Y<y;Y++){const te={bitOffset:h._nextUint16(),bitLength:h._nextUint8(),channelType:h._nextUint8(),samplePosition:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};te.channelType&qi?(te.sampleLower=h._nextInt32(),te.sampleUpper=h._nextInt32()):(te.sampleLower=h._nextUint32(),te.sampleUpper=h._nextUint32()),g.samples[Y]=te}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(g);const D=new it(s,A,u,!0);for(;D._offset<u;){const Y=D._nextUint32(),te=D._scan(Y),de=Js(te);if(t.keyValue[de]=D._nextUint8Array(Y-te.byteLength-1),de.match(/^ktx/i)){const Ee=Js(t.keyValue[de]);t.keyValue[de]=Ee.substring(0,Ee.lastIndexOf("\0"))}const Kt=Y%4?4-Y%4:0;D._skip(Kt)}if(l<=0)return t;const T=new it(s,f,l,!0),I=T._nextUint16(),m=T._nextUint16(),d=T._nextUint32(),F=T._nextUint32(),x=T._nextUint32(),M=T._nextUint32(),N=[];for(let Y=0;Y<i;Y++)N.push({imageFlags:T._nextUint32(),rgbSliceByteOffset:T._nextUint32(),rgbSliceByteLength:T._nextUint32(),alphaSliceByteOffset:T._nextUint32(),alphaSliceByteLength:T._nextUint32()});const G=f+T._offset,S=G+d,b=S+F,L=b+x,w=new Uint8Array(s.buffer,s.byteOffset+G,d),j=new Uint8Array(s.buffer,s.byteOffset+S,F),ee=new Uint8Array(s.buffer,s.byteOffset+b,x),q=new Uint8Array(s.buffer,s.byteOffset+L,M);return t.globalData={endpointCount:I,selectorCount:m,imageDescs:N,endpointsData:w,selectorsData:j,tablesData:ee,extendedData:q},t}const ps="EXT_mesh_gpu_instancing",Zt="EXT_meshopt_compression",Zi="EXT_texture_webp",$i="EXT_texture_avif",bn="KHR_draco_mesh_compression",gs="KHR_lights_punctual",Cs="KHR_materials_anisotropy",ds="KHR_materials_clearcoat",Es="KHR_materials_diffuse_transmission",Ds="KHR_materials_dispersion",Is="KHR_materials_emissive_strength",Ts="KHR_materials_ior",ms="KHR_materials_iridescence",Fs="KHR_materials_pbrSpecularGlossiness",ys="KHR_materials_sheen",xs="KHR_materials_specular",Ms="KHR_materials_transmission",Rs="KHR_materials_unlit",Ns="KHR_materials_volume",je="KHR_materials_variants",eo="KHR_mesh_quantization",to="KHR_texture_basisu",Ss="KHR_texture_transform",Rt="KHR_xmp_json_ld",$t="INSTANCE_ATTRIBUTE";class On extends J{init(){this.extensionName=ps,this.propertyType="InstancedMesh",this.parentTypes=[E.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new fe})}getAttribute(e){return this.getRefMap("attributes",e)}setAttribute(e,t){return this.setRefMap("attributes",e,t,{usage:$t})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}On.EXTENSION_NAME=ps;const Fe=ps;class so extends v{constructor(...e){super(...e),this.extensionName=Fe,this.provideTypes=[E.NODE],this.prewriteTypes=[E.ACCESSOR]}createInstancedMesh(){return new On(this.document.getGraph())}read(e){return(e.jsonDoc.json.nodes||[]).forEach((n,i)=>{if(!n.extensions||!n.extensions[Fe])return;const o=n.extensions[Fe],a=this.createInstancedMesh();for(const A in o.attributes)a.setAttribute(A,e.accessors[o.attributes[A]]);e.nodes[i].setExtension(Fe,a)}),this}prewrite(e){e.accessorUsageGroupedByParent.add($t);for(const t of this.properties)for(const r of t.listAttributes())e.addAccessorToUsageGroup(r,$t);return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listNodes().forEach(r=>{const n=r.getExtension(Fe);if(n){const i=e.nodeIndexMap.get(r),o=t.json.nodes[i],a={attributes:{}};n.listSemantics().forEach(A=>{const u=n.getAttribute(A);a.attributes[A]=e.accessorIndexMap.get(u)}),o.extensions=o.extensions||{},o.extensions[Fe]=a}}),this}}so.EXTENSION_NAME=Fe;function ge(){return ge=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},ge.apply(this,arguments)}var ht;(function(s){s.QUANTIZE="quantize",s.FILTER="filter"})(ht||(ht={}));var qe;(function(s){s.ATTRIBUTES="ATTRIBUTES",s.TRIANGLES="TRIANGLES",s.INDICES="INDICES"})(qe||(qe={}));var V;(function(s){s.NONE="NONE",s.OCTAHEDRAL="OCTAHEDRAL",s.QUATERNION="QUATERNION",s.EXPONENTIAL="EXPONENTIAL"})(V||(V={}));const{BYTE:no,SHORT:Us,FLOAT:ro}=R.ComponentType,{encodeNormalizedInt:Vs,decodeNormalizedInt:es}=H;function io(s,e,t,r){const{filter:n,bits:i}=r,o={array:s.getArray(),byteStride:s.getElementSize()*s.getComponentSize(),componentType:s.getComponentType(),normalized:s.getNormalized()};if(t!==qe.ATTRIBUTES)return o;if(n!==V.NONE){let a=s.getNormalized()?oo(s):new Float32Array(o.array);switch(n){case V.EXPONENTIAL:o.byteStride=s.getElementSize()*4,o.componentType=ro,o.normalized=!1,o.array=e.encodeFilterExp(a,s.getCount(),o.byteStride,i);break;case V.OCTAHEDRAL:o.byteStride=i>8?8:4,o.componentType=i>8?Us:no,o.normalized=!0,a=s.getElementSize()===3?Ao(a):a,o.array=e.encodeFilterOct(a,s.getCount(),o.byteStride,i);break;case V.QUATERNION:o.byteStride=8,o.componentType=Us,o.normalized=!0,o.array=e.encodeFilterQuat(a,s.getCount(),o.byteStride,i);break;default:throw new Error("Invalid filter.")}o.min=s.getMin([]),o.max=s.getMax([]),s.getNormalized()&&(o.min=o.min.map(A=>es(A,s.getComponentType())),o.max=o.max.map(A=>es(A,s.getComponentType()))),o.normalized&&(o.min=o.min.map(A=>Vs(A,o.componentType)),o.max=o.max.map(A=>Vs(A,o.componentType)))}else o.byteStride%4&&(o.array=ao(o.array,s.getElementSize()),o.byteStride=o.array.byteLength/s.getCount());return o}function oo(s){const e=s.getComponentType(),t=s.getArray(),r=new Float32Array(t.length);for(let n=0;n<t.length;n++)r[n]=es(t[n],e);return r}function ao(s,e){const r=O.padNumber(s.BYTES_PER_ELEMENT*e)/s.BYTES_PER_ELEMENT,n=s.length/e,i=new s.constructor(n*r);for(let o=0;o*e<s.length;o++)for(let a=0;a<e;a++)i[o*r+a]=s[o*e+a];return i}function Ao(s){const e=new Float32Array(s.length*4/3);for(let t=0,r=s.length/3;t<r;t++)e[t*4]=s[t*3],e[t*4+1]=s[t*3+1],e[t*4+2]=s[t*3+2];return e}function co(s,e){return e===le.BufferViewUsage.ELEMENT_ARRAY_BUFFER?s.listParents().some(r=>r instanceof U&&r.getMode()===U.Mode.TRIANGLES)?qe.TRIANGLES:qe.INDICES:qe.ATTRIBUTES}function uo(s,e){const t=e.getGraph().listParentEdges(s).filter(r=>!(r.getParent()instanceof st));for(const r of t){const n=r.getName(),i=r.getAttributes().key||"",o=r.getParent().propertyType===E.PRIMITIVE_TARGET;if(n==="indices")return{filter:V.NONE};if(n==="attributes"){if(i==="POSITION")return{filter:V.NONE};if(i==="TEXCOORD_0")return{filter:V.NONE};if(i.startsWith("JOINTS_"))return{filter:V.NONE};if(i.startsWith("WEIGHTS_"))return{filter:V.NONE};if(i==="NORMAL"||i==="TANGENT")return o?{filter:V.NONE}:{filter:V.OCTAHEDRAL,bits:8}}if(n==="output"){const a=Ln(s);return a==="rotation"?{filter:V.QUATERNION,bits:16}:a==="translation"?{filter:V.EXPONENTIAL,bits:12}:a==="scale"?{filter:V.EXPONENTIAL,bits:12}:{filter:V.NONE}}if(n==="input")return{filter:V.NONE};if(n==="inverseBindMatrices")return{filter:V.NONE}}return{filter:V.NONE}}function Ln(s){for(const e of s.listParents())if(e instanceof tt){for(const t of e.listParents())if(t instanceof et)return t.getTargetPath()}return null}function fo(s){return!s.extensions||!s.extensions[Zt]?!1:!!s.extensions[Zt].fallback}const Q=Zt,js={method:ht.QUANTIZE};class Hn extends v{constructor(...e){super(...e),this.extensionName=Q,this.prereadTypes=[E.BUFFER,E.PRIMITIVE],this.prewriteTypes=[E.BUFFER,E.ACCESSOR],this.readDependencies=["meshopt.decoder"],this.writeDependencies=["meshopt.encoder"],this._decoder=null,this._decoderFallbackBufferMap=new Map,this._encoder=null,this._encoderOptions=js,this._encoderFallbackBuffer=null,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={}}install(e,t){return e==="meshopt.decoder"&&(this._decoder=t),e==="meshopt.encoder"&&(this._encoder=t),this}setEncoderOptions(e){return this._encoderOptions=ge({},js,e),this}preread(e,t){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${Q}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${Q}]: Missing WASM support.`)}return t===E.BUFFER?this._prereadBuffers(e):t===E.PRIMITIVE&&this._prereadPrimitives(e),this}_prereadBuffers(e){const t=e.jsonDoc;(t.json.bufferViews||[]).forEach((n,i)=>{if(!n.extensions||!n.extensions[Q])return;const o=n.extensions[Q],a=o.byteOffset||0,A=o.byteLength||0,u=o.count,f=o.byteStride,l=new Uint8Array(u*f),c=t.json.buffers[o.buffer],B=c.uri?t.resources[c.uri]:t.resources[ze],h=O.toView(B,a,A);this._decoder.decodeGltfBuffer(l,u,f,h,o.mode,o.filter),e.bufferViews[i]=l})}_prereadPrimitives(e){const t=e.jsonDoc;(t.json.bufferViews||[]).forEach(n=>{if(!n.extensions||!n.extensions[Q])return;const i=n.extensions[Q],o=e.buffers[i.buffer],a=e.buffers[n.buffer],A=t.json.buffers[n.buffer];fo(A)&&this._decoderFallbackBufferMap.set(a,o)})}read(e){if(!this.isRequired())return this;for(const[t,r]of this._decoderFallbackBufferMap){for(const n of t.listParents())n instanceof R&&n.swap(t,r);t.dispose()}return this}prewrite(e,t){return t===E.ACCESSOR?this._prewriteAccessors(e):t===E.BUFFER&&this._prewriteBuffers(e),this}_prewriteAccessors(e){const t=e.jsonDoc.json,r=this._encoder,n=this._encoderOptions,i=this.document.getGraph(),o=this.document.createBuffer(),a=this.document.getRoot().listBuffers().indexOf(o);let A=1;const u=new Map,f=l=>{for(const c of i.listParents(l)){if(c.propertyType===E.ROOT)continue;let B=u.get(l);return B===void 0&&u.set(l,B=A++),B}return-1};this._encoderFallbackBuffer=o,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={};for(const l of this.document.getRoot().listAccessors()){if(Ln(l)==="weights"||l.getSparse())continue;const c=e.getAccessorUsage(l),B=e.accessorUsageGroupedByParent.has(c)?f(l):null,h=co(l,c),g=n.method===ht.FILTER?uo(l,this.document):{filter:V.NONE},C=io(l,r,h,g),{array:p,byteStride:y}=C,D=l.getBuffer();if(!D)throw new Error(`${Q}: Missing buffer for accessor.`);const T=this.document.getRoot().listBuffers().indexOf(D),I=[c,B,h,g.filter,y,T].join(":");let m=this._encoderBufferViews[I],d=this._encoderBufferViewData[I],F=this._encoderBufferViewAccessors[I];(!m||!d)&&(F=this._encoderBufferViewAccessors[I]=[],d=this._encoderBufferViewData[I]=[],m=this._encoderBufferViews[I]={buffer:a,target:le.USAGE_TO_TARGET[c],byteOffset:0,byteLength:0,byteStride:c===le.BufferViewUsage.ARRAY_BUFFER?y:void 0,extensions:{[Q]:{buffer:T,byteOffset:0,byteLength:0,mode:h,filter:g.filter!==V.NONE?g.filter:void 0,byteStride:y,count:0}}});const x=e.createAccessorDef(l);x.componentType=C.componentType,x.normalized=C.normalized,x.byteOffset=m.byteLength,x.min&&C.min&&(x.min=C.min),x.max&&C.max&&(x.max=C.max),e.accessorIndexMap.set(l,t.accessors.length),t.accessors.push(x),F.push(x),d.push(new Uint8Array(p.buffer,p.byteOffset,p.byteLength)),m.byteLength+=p.byteLength,m.extensions.EXT_meshopt_compression.count+=l.getCount()}}_prewriteBuffers(e){const t=this._encoder;for(const r in this._encoderBufferViews){const n=this._encoderBufferViews[r],i=this._encoderBufferViewData[r],o=this.document.getRoot().listBuffers()[n.extensions[Q].buffer],a=e.otherBufferViews.get(o)||[],{count:A,byteStride:u,mode:f}=n.extensions[Q],l=O.concat(i),c=t.encodeGltfBuffer(l,A,u,f),B=O.pad(c);n.extensions[Q].byteLength=c.byteLength,i.length=0,i.push(B),a.push(B),e.otherBufferViews.set(o,a)}}write(e){let t=0;for(const o in this._encoderBufferViews){const a=this._encoderBufferViews[o],A=this._encoderBufferViewData[o][0],u=e.otherBufferViewsIndexMap.get(A),f=this._encoderBufferViewAccessors[o];for(const h of f)h.bufferView=u;const l=e.jsonDoc.json.bufferViews[u],c=l.byteOffset||0;Object.assign(l,a),l.byteOffset=t;const B=l.extensions[Q];B.byteOffset=c,t+=O.padNumber(a.byteLength)}const r=this._encoderFallbackBuffer,n=e.bufferIndexMap.get(r),i=e.jsonDoc.json.buffers[n];return i.byteLength=t,i.extensions={[Q]:{fallback:!0}},r.dispose(),this}}Hn.EXTENSION_NAME=Q;Hn.EncoderMethod=ht;const at=$i;class Bo{match(e){return e.length>=12&&O.decodeText(e.slice(4,12))==="ftypavif"}getSize(e){if(!this.match(e))return null;const t=new DataView(e.buffer,e.byteOffset,e.byteLength);let r=ks(t,0);if(!r)return null;let n=r.end;for(;r=ks(t,n);)if(r.type==="meta")n=r.start+4;else if(r.type==="iprp"||r.type==="ipco")n=r.start;else{if(r.type==="ispe")return[t.getUint32(r.start+4),t.getUint32(r.start+8)];if(r.type==="mdat")break;n=r.end}return null}getChannels(e){return 4}}class lo extends v{constructor(...e){super(...e),this.extensionName=at,this.prereadTypes=[E.TEXTURE]}static register(){Be.registerFormat("image/avif",new Bo)}preread(e){return(e.jsonDoc.json.textures||[]).forEach(r=>{r.extensions&&r.extensions[at]&&(r.source=r.extensions[at].source)}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listTextures().forEach(r=>{if(r.getMimeType()==="image/avif"){const n=e.imageIndexMap.get(r);(t.json.textures||[]).forEach(o=>{o.source===n&&(o.extensions=o.extensions||{},o.extensions[at]={source:o.source},delete o.source)})}}),this}}lo.EXTENSION_NAME=at;function ks(s,e){if(s.byteLength<4+e)return null;const t=s.getUint32(e);return s.byteLength<t+e||t<8?null:{type:O.decodeText(new Uint8Array(s.buffer,s.byteOffset+e+4,4)),start:e+8,end:e+t}}const At=Zi;class ho{match(e){return e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80}getSize(e){const t=O.decodeText(e.slice(0,4)),r=O.decodeText(e.slice(8,12));if(t!=="RIFF"||r!=="WEBP")return null;const n=new DataView(e.buffer,e.byteOffset);let i=12;for(;i<n.byteLength;){const o=O.decodeText(new Uint8Array([n.getUint8(i),n.getUint8(i+1),n.getUint8(i+2),n.getUint8(i+3)])),a=n.getUint32(i+4,!0);if(o==="VP8 "){const A=n.getInt16(i+14,!0)&16383,u=n.getInt16(i+16,!0)&16383;return[A,u]}else if(o==="VP8L"){const A=n.getUint8(i+9),u=n.getUint8(i+10),f=n.getUint8(i+11),l=n.getUint8(i+12),c=1+((u&63)<<8|A),B=1+((l&15)<<10|f<<2|(u&192)>>6);return[c,B]}i+=8+a+a%2}return null}getChannels(e){return 4}}class po extends v{constructor(...e){super(...e),this.extensionName=At,this.prereadTypes=[E.TEXTURE]}static register(){Be.registerFormat("image/webp",new ho)}preread(e){return(e.jsonDoc.json.textures||[]).forEach(r=>{r.extensions&&r.extensions[At]&&(r.source=r.extensions[At].source)}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listTextures().forEach(r=>{if(r.getMimeType()==="image/webp"){const n=e.imageIndexMap.get(r);(t.json.textures||[]).forEach(o=>{o.source===n&&(o.extensions=o.extensions||{},o.extensions[At]={source:o.source},delete o.source)})}}),this}}po.EXTENSION_NAME=At;const Xs=bn;let X,wn,Pn;function go(s,e){const t=new X.DecoderBuffer;try{if(t.Init(e,e.length),s.GetEncodedGeometryType(t)!==X.TRIANGULAR_MESH)throw new Error(`[${Xs}] Unknown geometry type.`);const n=new X.Mesh;if(!s.DecodeBufferToMesh(t,n).ok()||n.ptr===0)throw new Error(`[${Xs}] Decoding failure.`);return n}finally{X.destroy(t)}}function Co(s,e){const r=e.num_faces()*3;let n,i;if(e.num_points()<=65534){const o=r*Uint16Array.BYTES_PER_ELEMENT;n=X._malloc(o),s.GetTrianglesUInt16Array(e,o,n),i=new Uint16Array(X.HEAPU16.buffer,n,r).slice()}else{const o=r*Uint32Array.BYTES_PER_ELEMENT;n=X._malloc(o),s.GetTrianglesUInt32Array(e,o,n),i=new Uint32Array(X.HEAPU32.buffer,n,r).slice()}return X._free(n),i}function Eo(s,e,t,r){const n=Pn[r.componentType],i=wn[r.componentType],o=t.num_components(),A=e.num_points()*o,u=A*i.BYTES_PER_ELEMENT,f=X._malloc(u);s.GetAttributeDataArrayForAllPoints(e,t,n,u,f);const l=new i(X.HEAPF32.buffer,f,A).slice();return X._free(f),l}function Do(s){X=s,wn={[R.ComponentType.FLOAT]:Float32Array,[R.ComponentType.UNSIGNED_INT]:Uint32Array,[R.ComponentType.UNSIGNED_SHORT]:Uint16Array,[R.ComponentType.UNSIGNED_BYTE]:Uint8Array,[R.ComponentType.SHORT]:Int16Array,[R.ComponentType.BYTE]:Int8Array},Pn={[R.ComponentType.FLOAT]:X.DT_FLOAT32,[R.ComponentType.UNSIGNED_INT]:X.DT_UINT32,[R.ComponentType.UNSIGNED_SHORT]:X.DT_UINT16,[R.ComponentType.UNSIGNED_BYTE]:X.DT_UINT8,[R.ComponentType.SHORT]:X.DT_INT16,[R.ComponentType.BYTE]:X.DT_INT8}}let ne;var pt;(function(s){s[s.EDGEBREAKER=1]="EDGEBREAKER",s[s.SEQUENTIAL=0]="SEQUENTIAL"})(pt||(pt={}));var ie;(function(s){s.POSITION="POSITION",s.NORMAL="NORMAL",s.COLOR="COLOR",s.TEX_COORD="TEX_COORD",s.GENERIC="GENERIC"})(ie||(ie={}));const _n={[ie.POSITION]:14,[ie.NORMAL]:10,[ie.COLOR]:8,[ie.TEX_COORD]:12,[ie.GENERIC]:12},Ws={decodeSpeed:5,encodeSpeed:5,method:pt.EDGEBREAKER,quantizationBits:_n,quantizationVolume:"mesh"};function Io(s){ne=s}function To(s,e=Ws){const t=ge({},Ws,e);t.quantizationBits=ge({},_n,e.quantizationBits);const r=new ne.MeshBuilder,n=new ne.Mesh,i=new ne.ExpertEncoder(n),o={},a=new ne.DracoInt8Array,A=s.listTargets().length>0;let u=!1;for(const g of s.listSemantics()){const C=s.getAttribute(g);if(C.getSparse()){u=!0;continue}const p=mo(g),y=Fo(r,C.getComponentType(),n,ne[p],C.getCount(),C.getElementSize(),C.getArray());if(y===-1)throw new Error(`Error compressing "${g}" attribute.`);if(o[g]=y,t.quantizationVolume==="mesh"||g!=="POSITION")i.SetAttributeQuantization(y,t.quantizationBits[p]);else if(typeof t.quantizationVolume=="object"){const{quantizationVolume:D}=t,T=Math.max(D.max[0]-D.min[0],D.max[1]-D.min[1],D.max[2]-D.min[2]);i.SetAttributeExplicitQuantization(y,t.quantizationBits[p],C.getElementSize(),D.min,T)}else throw new Error("Invalid quantization volume state.")}const f=s.getIndices();if(!f)throw new ts("Primitive must have indices.");r.AddFacesToMesh(n,f.getCount()/3,f.getArray()),i.SetSpeedOptions(t.encodeSpeed,t.decodeSpeed),i.SetTrackEncodedProperties(!0),t.method===pt.SEQUENTIAL||A||u?i.SetEncodingMethod(ne.MESH_SEQUENTIAL_ENCODING):i.SetEncodingMethod(ne.MESH_EDGEBREAKER_ENCODING);const l=i.EncodeToDracoBuffer(!(A||u),a);if(l<=0)throw new ts("Error applying Draco compression.");const c=new Uint8Array(l);for(let g=0;g<l;++g)c[g]=a.GetValue(g);const B=i.GetNumberOfEncodedPoints(),h=i.GetNumberOfEncodedFaces()*3;return ne.destroy(a),ne.destroy(n),ne.destroy(r),ne.destroy(i),{numVertices:B,numIndices:h,data:c,attributeIDs:o}}function mo(s){return s==="POSITION"?ie.POSITION:s==="NORMAL"?ie.NORMAL:s.startsWith("COLOR_")?ie.COLOR:s.startsWith("TEXCOORD_")?ie.TEX_COORD:ie.GENERIC}function Fo(s,e,t,r,n,i,o){switch(e){case R.ComponentType.UNSIGNED_BYTE:return s.AddUInt8Attribute(t,r,n,i,o);case R.ComponentType.BYTE:return s.AddInt8Attribute(t,r,n,i,o);case R.ComponentType.UNSIGNED_SHORT:return s.AddUInt16Attribute(t,r,n,i,o);case R.ComponentType.SHORT:return s.AddInt16Attribute(t,r,n,i,o);case R.ComponentType.UNSIGNED_INT:return s.AddUInt32Attribute(t,r,n,i,o);case R.ComponentType.FLOAT:return s.AddFloatAttribute(t,r,n,i,o);default:throw new Error(`Unexpected component type, "${e}".`)}}class ts extends Error{}const k=bn;class vn extends v{constructor(...e){super(...e),this.extensionName=k,this.prereadTypes=[E.PRIMITIVE],this.prewriteTypes=[E.ACCESSOR],this.readDependencies=["draco3d.decoder"],this.writeDependencies=["draco3d.encoder"],this._decoderModule=null,this._encoderModule=null,this._encoderOptions={}}install(e,t){return e==="draco3d.decoder"&&(this._decoderModule=t,Do(this._decoderModule)),e==="draco3d.encoder"&&(this._encoderModule=t,Io(this._encoderModule)),this}setEncoderOptions(e){return this._encoderOptions=e,this}preread(e){if(!this._decoderModule)throw new Error(`[${k}] Please install extension dependency, "draco3d.decoder".`);const t=this.document.getLogger(),r=e.jsonDoc,n=new Map;try{const i=r.json.meshes||[];for(const o of i)for(const a of o.primitives){if(!a.extensions||!a.extensions[k])continue;const A=a.extensions[k];let[u,f]=n.get(A.bufferView)||[];if(!f||!u){const l=r.json.bufferViews[A.bufferView],c=r.json.buffers[l.buffer],B=c.uri?r.resources[c.uri]:r.resources[ze],h=l.byteOffset||0,g=l.byteLength,C=O.toView(B,h,g);u=new this._decoderModule.Decoder,f=go(u,C),n.set(A.bufferView,[u,f]),t.debug(`[${k}] Decompressed ${C.byteLength} bytes.`)}for(const l in a.attributes){const c=e.jsonDoc.json.accessors[a.attributes[l]],B=u.GetAttributeByUniqueId(f,A.attributes[l]),h=Eo(u,f,B,c);e.accessors[a.attributes[l]].setArray(h)}a.indices!==void 0&&e.accessors[a.indices].setArray(Co(u,f))}}finally{for(const[i,o]of Array.from(n.values()))this._decoderModule.destroy(i),this._decoderModule.destroy(o)}return this}read(e){return this}prewrite(e,t){if(!this._encoderModule)throw new Error(`[${k}] Please install extension dependency, "draco3d.encoder".`);const r=this.document.getLogger();r.debug(`[${k}] Compression options: ${JSON.stringify(this._encoderOptions)}`);const n=yo(this.document),i=new Map;let o="mesh";this._encoderOptions.quantizationVolume==="scene"&&(this.document.getRoot().listScenes().length!==1?r.warn(`[${k}]: quantizationVolume=scene requires exactly 1 scene.`):o=Fr(this.document.getRoot().listScenes().pop()));for(const a of Array.from(n.keys())){const A=n.get(a);if(!A)throw new Error("Unexpected primitive.");if(i.has(A)){i.set(A,i.get(A));continue}const u=a.getIndices(),f=e.jsonDoc.json.accessors;let l;try{l=To(a,ge({},this._encoderOptions,{quantizationVolume:o}))}catch(h){if(h instanceof ts){r.warn(`[${k}]: ${h.message} Skipping primitive compression.`);continue}throw h}i.set(A,l);const c=e.createAccessorDef(u);c.count=l.numIndices,e.accessorIndexMap.set(u,f.length),f.push(c),l.numVertices>65534&&c.componentType!==R.ComponentType.UNSIGNED_INT&&(c.componentType=R.ComponentType.UNSIGNED_INT);for(const h of a.listSemantics()){const g=a.getAttribute(h);if(l.attributeIDs[h]===void 0)continue;const C=e.createAccessorDef(g);C.count=l.numVertices,e.accessorIndexMap.set(g,f.length),f.push(C)}const B=a.getAttribute("POSITION").getBuffer()||this.document.getRoot().listBuffers()[0];e.otherBufferViews.has(B)||e.otherBufferViews.set(B,[]),e.otherBufferViews.get(B).push(l.data)}return r.debug(`[${k}] Compressed ${n.size} primitives.`),e.extensionData[k]={primitiveHashMap:n,primitiveEncodingMap:i},this}write(e){const t=e.extensionData[k];for(const r of this.document.getRoot().listMeshes()){const n=e.jsonDoc.json.meshes[e.meshIndexMap.get(r)];for(let i=0;i<r.listPrimitives().length;i++){const o=r.listPrimitives()[i],a=n.primitives[i],A=t.primitiveHashMap.get(o);if(!A)continue;const u=t.primitiveEncodingMap.get(A);u&&(a.extensions=a.extensions||{},a.extensions[k]={bufferView:e.otherBufferViewsIndexMap.get(u.data),attributes:u.attributeIDs})}}if(!t.primitiveHashMap.size){const r=e.jsonDoc.json;r.extensionsUsed=(r.extensionsUsed||[]).filter(n=>n!==k),r.extensionsRequired=(r.extensionsRequired||[]).filter(n=>n!==k)}return this}}vn.EXTENSION_NAME=k;vn.EncoderMethod=pt;function yo(s){const e=s.getLogger(),t=new Set,r=new Set;let n=0,i=0;for(const l of s.getRoot().listMeshes())for(const c of l.listPrimitives())c.getIndices()?c.getMode()!==U.Mode.TRIANGLES?(r.add(c),i++):t.add(c):(r.add(c),n++);n>0&&e.warn(`[${k}] Skipping Draco compression of ${n} non-indexed primitives.`),i>0&&e.warn(`[${k}] Skipping Draco compression of ${i} non-TRIANGLES primitives.`);const o=s.getRoot().listAccessors(),a=new Map;for(let l=0;l<o.length;l++)a.set(o[l],l);const A=new Map,u=new Set,f=new Map;for(const l of Array.from(t)){let c=Ys(l,a);if(u.has(c)){f.set(l,c);continue}if(A.has(l.getIndices())){const B=l.getIndices(),h=B.clone();a.set(h,s.getRoot().listAccessors().length-1),l.swap(B,h)}for(const B of l.listAttributes())if(A.has(B)){const h=B.clone();a.set(h,s.getRoot().listAccessors().length-1),l.swap(B,h)}c=Ys(l,a),u.add(c),f.set(l,c),A.set(l.getIndices(),c);for(const B of l.listAttributes())A.set(B,c)}for(const l of Array.from(A.keys())){const c=new Set(l.listParents().map(B=>B.propertyType));if(c.size!==2||!c.has(E.PRIMITIVE)||!c.has(E.ROOT))throw new Error(`[${k}] Compressed accessors must only be used as indices or vertex attributes.`)}for(const l of Array.from(t)){const c=f.get(l),B=l.getIndices();if(A.get(B)!==c||l.listAttributes().some(h=>A.get(h)!==c))throw new Error(`[${k}] Draco primitives must share all, or no, accessors.`)}for(const l of Array.from(r)){const c=l.getIndices();if(A.has(c)||l.listAttributes().some(B=>A.has(B)))throw new Error(`[${k}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return f}function Ys(s,e){const t=[],r=s.getIndices();t.push(e.get(r));for(const n of s.listAttributes())t.push(e.get(n));return t.sort().join("|")}class Ze extends J{init(){this.extensionName=gs,this.propertyType="Light",this.parentTypes=[E.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:Ze.Type.POINT,range:null,innerConeAngle:0,outerConeAngle:Math.PI/4})}getColor(){return this.get("color")}setColor(e){return this.set("color",e)}getIntensity(){return this.get("intensity")}setIntensity(e){return this.set("intensity",e)}getType(){return this.get("type")}setType(e){return this.set("type",e)}getRange(){return this.get("range")}setRange(e){return this.set("range",e)}getInnerConeAngle(){return this.get("innerConeAngle")}setInnerConeAngle(e){return this.set("innerConeAngle",e)}getOuterConeAngle(){return this.get("outerConeAngle")}setOuterConeAngle(e){return this.set("outerConeAngle",e)}}Ze.EXTENSION_NAME=gs;Ze.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};const ce=gs;class xo extends v{constructor(...e){super(...e),this.extensionName=ce}createLight(e=""){return new Ze(this.document.getGraph(),e)}read(e){const t=e.jsonDoc;if(!t.json.extensions||!t.json.extensions[ce])return this;const i=(t.json.extensions[ce].lights||[]).map(o=>{var a,A;const u=this.createLight().setName(o.name||"").setType(o.type);return o.color!==void 0&&u.setColor(o.color),o.intensity!==void 0&&u.setIntensity(o.intensity),o.range!==void 0&&u.setRange(o.range),((a=o.spot)==null?void 0:a.innerConeAngle)!==void 0&&u.setInnerConeAngle(o.spot.innerConeAngle),((A=o.spot)==null?void 0:A.outerConeAngle)!==void 0&&u.setOuterConeAngle(o.spot.outerConeAngle),u});return t.json.nodes.forEach((o,a)=>{if(!o.extensions||!o.extensions[ce])return;const A=o.extensions[ce];e.nodes[a].setExtension(ce,i[A.light])}),this}write(e){const t=e.jsonDoc;if(this.properties.size===0)return this;const r=[],n=new Map;for(const i of this.properties){const o=i,a={type:o.getType()};H.eq(o.getColor(),[1,1,1])||(a.color=o.getColor()),o.getIntensity()!==1&&(a.intensity=o.getIntensity()),o.getRange()!=null&&(a.range=o.getRange()),o.getName()&&(a.name=o.getName()),o.getType()===Ze.Type.SPOT&&(a.spot={innerConeAngle:o.getInnerConeAngle(),outerConeAngle:o.getOuterConeAngle()}),r.push(a),n.set(o,r.length-1)}return this.document.getRoot().listNodes().forEach(i=>{const o=i.getExtension(ce);if(o){const a=e.nodeIndexMap.get(i),A=t.json.nodes[a];A.extensions=A.extensions||{},A.extensions[ce]={light:n.get(o)}}}),t.json.extensions=t.json.extensions||{},t.json.extensions[ce]={lights:r},this}}xo.EXTENSION_NAME=ce;const{R:Mo,G:Ro,B:No}=ae;class Kn extends J{init(){this.extensionName=Cs,this.propertyType="Anisotropy",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new P(this.graph,"anisotropyTextureInfo")})}getAnisotropyStrength(){return this.get("anisotropyStrength")}setAnisotropyStrength(e){return this.set("anisotropyStrength",e)}getAnisotropyRotation(){return this.get("anisotropyRotation")}setAnisotropyRotation(e){return this.set("anisotropyRotation",e)}getAnisotropyTexture(){return this.getRef("anisotropyTexture")}getAnisotropyTextureInfo(){return this.getRef("anisotropyTexture")?this.getRef("anisotropyTextureInfo"):null}setAnisotropyTexture(e){return this.setRef("anisotropyTexture",e,{channels:Mo|Ro|No})}}Kn.EXTENSION_NAME=Cs;const ye=Cs;class So extends v{constructor(...e){super(...e),this.extensionName=ye,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createAnisotropy(){return new Kn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[ye]){const a=this.createAnisotropy();e.materials[o].setExtension(ye,a);const A=i.extensions[ye];if(A.anisotropyStrength!==void 0&&a.setAnisotropyStrength(A.anisotropyStrength),A.anisotropyRotation!==void 0&&a.setAnisotropyRotation(A.anisotropyRotation),A.anisotropyTexture!==void 0){const u=A.anisotropyTexture,f=e.textures[n[u.index].source];a.setAnisotropyTexture(f),e.setTextureInfo(a.getAnisotropyTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(ye);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[ye]={};if(n.getAnisotropyStrength()>0&&(a.anisotropyStrength=n.getAnisotropyStrength()),n.getAnisotropyRotation()!==0&&(a.anisotropyRotation=n.getAnisotropyRotation()),n.getAnisotropyTexture()){const A=n.getAnisotropyTexture(),u=n.getAnisotropyTextureInfo();a.anisotropyTexture=e.createTextureInfoDef(A,u)}}}),this}}So.EXTENSION_NAME=ye;const{R:qs,G:zs,B:Go}=ae;class Jn extends J{init(){this.extensionName=ds,this.propertyType="Clearcoat",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new P(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new P(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new P(this.graph,"clearcoatNormalTextureInfo")})}getClearcoatFactor(){return this.get("clearcoatFactor")}setClearcoatFactor(e){return this.set("clearcoatFactor",e)}getClearcoatTexture(){return this.getRef("clearcoatTexture")}getClearcoatTextureInfo(){return this.getRef("clearcoatTexture")?this.getRef("clearcoatTextureInfo"):null}setClearcoatTexture(e){return this.setRef("clearcoatTexture",e,{channels:qs})}getClearcoatRoughnessFactor(){return this.get("clearcoatRoughnessFactor")}setClearcoatRoughnessFactor(e){return this.set("clearcoatRoughnessFactor",e)}getClearcoatRoughnessTexture(){return this.getRef("clearcoatRoughnessTexture")}getClearcoatRoughnessTextureInfo(){return this.getRef("clearcoatRoughnessTexture")?this.getRef("clearcoatRoughnessTextureInfo"):null}setClearcoatRoughnessTexture(e){return this.setRef("clearcoatRoughnessTexture",e,{channels:zs})}getClearcoatNormalScale(){return this.get("clearcoatNormalScale")}setClearcoatNormalScale(e){return this.set("clearcoatNormalScale",e)}getClearcoatNormalTexture(){return this.getRef("clearcoatNormalTexture")}getClearcoatNormalTextureInfo(){return this.getRef("clearcoatNormalTexture")?this.getRef("clearcoatNormalTextureInfo"):null}setClearcoatNormalTexture(e){return this.setRef("clearcoatNormalTexture",e,{channels:qs|zs|Go})}}Jn.EXTENSION_NAME=ds;const xe=ds;class bo extends v{constructor(...e){super(...e),this.extensionName=xe,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createClearcoat(){return new Jn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[xe]){const a=this.createClearcoat();e.materials[o].setExtension(xe,a);const A=i.extensions[xe];if(A.clearcoatFactor!==void 0&&a.setClearcoatFactor(A.clearcoatFactor),A.clearcoatRoughnessFactor!==void 0&&a.setClearcoatRoughnessFactor(A.clearcoatRoughnessFactor),A.clearcoatTexture!==void 0){const u=A.clearcoatTexture,f=e.textures[n[u.index].source];a.setClearcoatTexture(f),e.setTextureInfo(a.getClearcoatTextureInfo(),u)}if(A.clearcoatRoughnessTexture!==void 0){const u=A.clearcoatRoughnessTexture,f=e.textures[n[u.index].source];a.setClearcoatRoughnessTexture(f),e.setTextureInfo(a.getClearcoatRoughnessTextureInfo(),u)}if(A.clearcoatNormalTexture!==void 0){const u=A.clearcoatNormalTexture,f=e.textures[n[u.index].source];a.setClearcoatNormalTexture(f),e.setTextureInfo(a.getClearcoatNormalTextureInfo(),u),u.scale!==void 0&&a.setClearcoatNormalScale(u.scale)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(xe);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[xe]={clearcoatFactor:n.getClearcoatFactor(),clearcoatRoughnessFactor:n.getClearcoatRoughnessFactor()};if(n.getClearcoatTexture()){const A=n.getClearcoatTexture(),u=n.getClearcoatTextureInfo();a.clearcoatTexture=e.createTextureInfoDef(A,u)}if(n.getClearcoatRoughnessTexture()){const A=n.getClearcoatRoughnessTexture(),u=n.getClearcoatRoughnessTextureInfo();a.clearcoatRoughnessTexture=e.createTextureInfoDef(A,u)}if(n.getClearcoatNormalTexture()){const A=n.getClearcoatNormalTexture(),u=n.getClearcoatNormalTextureInfo();a.clearcoatNormalTexture=e.createTextureInfoDef(A,u),n.getClearcoatNormalScale()!==1&&(a.clearcoatNormalTexture.scale=n.getClearcoatNormalScale())}}}),this}}bo.EXTENSION_NAME=xe;const{R:Oo,G:Lo,B:Ho,A:wo}=ae;class Un extends J{init(){this.extensionName=Es,this.propertyType="DiffuseTransmission",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new P(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new P(this.graph,"diffuseTransmissionColorTextureInfo")})}getDiffuseTransmissionFactor(){return this.get("diffuseTransmissionFactor")}setDiffuseTransmissionFactor(e){return this.set("diffuseTransmissionFactor",e)}getDiffuseTransmissionTexture(){return this.getRef("diffuseTransmissionTexture")}getDiffuseTransmissionTextureInfo(){return this.getRef("diffuseTransmissionTexture")?this.getRef("diffuseTransmissionTextureInfo"):null}setDiffuseTransmissionTexture(e){return this.setRef("diffuseTransmissionTexture",e,{channels:wo})}getDiffuseTransmissionColorFactor(){return this.get("diffuseTransmissionColorFactor")}setDiffuseTransmissionColorFactor(e){return this.set("diffuseTransmissionColorFactor",e)}getDiffuseTransmissionColorTexture(){return this.getRef("diffuseTransmissionColorTexture")}getDiffuseTransmissionColorTextureInfo(){return this.getRef("diffuseTransmissionColorTexture")?this.getRef("diffuseTransmissionColorTextureInfo"):null}setDiffuseTransmissionColorTexture(e){return this.setRef("diffuseTransmissionColorTexture",e,{channels:Oo|Lo|Ho})}}Un.EXTENSION_NAME=Es;const Me=Es;class Po extends v{constructor(...e){super(...e),this.extensionName=Me}createDiffuseTransmission(){return new Un(this.document.getGraph())}read(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[Me]){const a=this.createDiffuseTransmission();e.materials[o].setExtension(Me,a);const A=i.extensions[Me];if(A.diffuseTransmissionFactor!==void 0&&a.setDiffuseTransmissionFactor(A.diffuseTransmissionFactor),A.diffuseTransmissionColorFactor!==void 0&&a.setDiffuseTransmissionColorFactor(A.diffuseTransmissionColorFactor),A.diffuseTransmissionTexture!==void 0){const u=A.diffuseTransmissionTexture,f=e.textures[n[u.index].source];a.setDiffuseTransmissionTexture(f),e.setTextureInfo(a.getDiffuseTransmissionTextureInfo(),u)}if(A.diffuseTransmissionColorTexture!==void 0){const u=A.diffuseTransmissionColorTexture,f=e.textures[n[u.index].source];a.setDiffuseTransmissionColorTexture(f),e.setTextureInfo(a.getDiffuseTransmissionColorTextureInfo(),u)}}}),this}write(e){const t=e.jsonDoc;for(const r of this.document.getRoot().listMaterials()){const n=r.getExtension(Me);if(!n)continue;const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[Me]={diffuseTransmissionFactor:n.getDiffuseTransmissionFactor(),diffuseTransmissionColorFactor:n.getDiffuseTransmissionColorFactor()};if(n.getDiffuseTransmissionTexture()){const A=n.getDiffuseTransmissionTexture(),u=n.getDiffuseTransmissionTextureInfo();a.diffuseTransmissionTexture=e.createTextureInfoDef(A,u)}if(n.getDiffuseTransmissionColorTexture()){const A=n.getDiffuseTransmissionColorTexture(),u=n.getDiffuseTransmissionColorTextureInfo();a.diffuseTransmissionColorTexture=e.createTextureInfoDef(A,u)}}return this}}Po.EXTENSION_NAME=Me;class Vn extends J{init(){this.extensionName=Ds,this.propertyType="Dispersion",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{dispersion:0})}getDispersion(){return this.get("dispersion")}setDispersion(e){return this.set("dispersion",e)}}Vn.EXTENSION_NAME=Ds;const Re=Ds;class _o extends v{constructor(...e){super(...e),this.extensionName=Re,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createDispersion(){return new Vn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((n,i)=>{if(n.extensions&&n.extensions[Re]){const o=this.createDispersion();e.materials[i].setExtension(Re,o);const a=n.extensions[Re];a.dispersion!==void 0&&o.setDispersion(a.dispersion)}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Re);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{},o.extensions[Re]={dispersion:n.getDispersion()}}}),this}}_o.EXTENSION_NAME=Re;class jn extends J{init(){this.extensionName=Is,this.propertyType="EmissiveStrength",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{emissiveStrength:1})}getEmissiveStrength(){return this.get("emissiveStrength")}setEmissiveStrength(e){return this.set("emissiveStrength",e)}}jn.EXTENSION_NAME=Is;const Ne=Is;class vo extends v{constructor(...e){super(...e),this.extensionName=Ne,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createEmissiveStrength(){return new jn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((n,i)=>{if(n.extensions&&n.extensions[Ne]){const o=this.createEmissiveStrength();e.materials[i].setExtension(Ne,o);const a=n.extensions[Ne];a.emissiveStrength!==void 0&&o.setEmissiveStrength(a.emissiveStrength)}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Ne);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{},o.extensions[Ne]={emissiveStrength:n.getEmissiveStrength()}}}),this}}vo.EXTENSION_NAME=Ne;class kn extends J{init(){this.extensionName=Ts,this.propertyType="IOR",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{ior:1.5})}getIOR(){return this.get("ior")}setIOR(e){return this.set("ior",e)}}kn.EXTENSION_NAME=Ts;const Se=Ts;class Ko extends v{constructor(...e){super(...e),this.extensionName=Se,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createIOR(){return new kn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((n,i)=>{if(n.extensions&&n.extensions[Se]){const o=this.createIOR();e.materials[i].setExtension(Se,o);const a=n.extensions[Se];a.ior!==void 0&&o.setIOR(a.ior)}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Se);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{},o.extensions[Se]={ior:n.getIOR()}}}),this}}Ko.EXTENSION_NAME=Se;const{R:Jo,G:Uo}=ae;class Xn extends J{init(){this.extensionName=ms,this.propertyType="Iridescence",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new P(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new P(this.graph,"iridescenceThicknessTextureInfo")})}getIridescenceFactor(){return this.get("iridescenceFactor")}setIridescenceFactor(e){return this.set("iridescenceFactor",e)}getIridescenceTexture(){return this.getRef("iridescenceTexture")}getIridescenceTextureInfo(){return this.getRef("iridescenceTexture")?this.getRef("iridescenceTextureInfo"):null}setIridescenceTexture(e){return this.setRef("iridescenceTexture",e,{channels:Jo})}getIridescenceIOR(){return this.get("iridescenceIOR")}setIridescenceIOR(e){return this.set("iridescenceIOR",e)}getIridescenceThicknessMinimum(){return this.get("iridescenceThicknessMinimum")}setIridescenceThicknessMinimum(e){return this.set("iridescenceThicknessMinimum",e)}getIridescenceThicknessMaximum(){return this.get("iridescenceThicknessMaximum")}setIridescenceThicknessMaximum(e){return this.set("iridescenceThicknessMaximum",e)}getIridescenceThicknessTexture(){return this.getRef("iridescenceThicknessTexture")}getIridescenceThicknessTextureInfo(){return this.getRef("iridescenceThicknessTexture")?this.getRef("iridescenceThicknessTextureInfo"):null}setIridescenceThicknessTexture(e){return this.setRef("iridescenceThicknessTexture",e,{channels:Uo})}}Xn.EXTENSION_NAME=ms;const Ge=ms;class Vo extends v{constructor(...e){super(...e),this.extensionName=Ge,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createIridescence(){return new Xn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[Ge]){const a=this.createIridescence();e.materials[o].setExtension(Ge,a);const A=i.extensions[Ge];if(A.iridescenceFactor!==void 0&&a.setIridescenceFactor(A.iridescenceFactor),A.iridescenceIor!==void 0&&a.setIridescenceIOR(A.iridescenceIor),A.iridescenceThicknessMinimum!==void 0&&a.setIridescenceThicknessMinimum(A.iridescenceThicknessMinimum),A.iridescenceThicknessMaximum!==void 0&&a.setIridescenceThicknessMaximum(A.iridescenceThicknessMaximum),A.iridescenceTexture!==void 0){const u=A.iridescenceTexture,f=e.textures[n[u.index].source];a.setIridescenceTexture(f),e.setTextureInfo(a.getIridescenceTextureInfo(),u)}if(A.iridescenceThicknessTexture!==void 0){const u=A.iridescenceThicknessTexture,f=e.textures[n[u.index].source];a.setIridescenceThicknessTexture(f),e.setTextureInfo(a.getIridescenceThicknessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Ge);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[Ge]={};if(n.getIridescenceFactor()>0&&(a.iridescenceFactor=n.getIridescenceFactor()),n.getIridescenceIOR()!==1.3&&(a.iridescenceIor=n.getIridescenceIOR()),n.getIridescenceThicknessMinimum()!==100&&(a.iridescenceThicknessMinimum=n.getIridescenceThicknessMinimum()),n.getIridescenceThicknessMaximum()!==400&&(a.iridescenceThicknessMaximum=n.getIridescenceThicknessMaximum()),n.getIridescenceTexture()){const A=n.getIridescenceTexture(),u=n.getIridescenceTextureInfo();a.iridescenceTexture=e.createTextureInfoDef(A,u)}if(n.getIridescenceThicknessTexture()){const A=n.getIridescenceThicknessTexture(),u=n.getIridescenceThicknessTextureInfo();a.iridescenceThicknessTexture=e.createTextureInfoDef(A,u)}}}),this}}Vo.EXTENSION_NAME=Ge;const{R:Qs,G:Zs,B:$s,A:en}=ae;class Wn extends J{init(){this.extensionName=Fs,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new P(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new P(this.graph,"specularGlossinessTextureInfo")})}getDiffuseFactor(){return this.get("diffuseFactor")}setDiffuseFactor(e){return this.set("diffuseFactor",e)}getDiffuseTexture(){return this.getRef("diffuseTexture")}getDiffuseTextureInfo(){return this.getRef("diffuseTexture")?this.getRef("diffuseTextureInfo"):null}setDiffuseTexture(e){return this.setRef("diffuseTexture",e,{channels:Qs|Zs|$s|en,isColor:!0})}getSpecularFactor(){return this.get("specularFactor")}setSpecularFactor(e){return this.set("specularFactor",e)}getGlossinessFactor(){return this.get("glossinessFactor")}setGlossinessFactor(e){return this.set("glossinessFactor",e)}getSpecularGlossinessTexture(){return this.getRef("specularGlossinessTexture")}getSpecularGlossinessTextureInfo(){return this.getRef("specularGlossinessTexture")?this.getRef("specularGlossinessTextureInfo"):null}setSpecularGlossinessTexture(e){return this.setRef("specularGlossinessTexture",e,{channels:Qs|Zs|$s|en})}}Wn.EXTENSION_NAME=Fs;const be=Fs;class jo extends v{constructor(...e){super(...e),this.extensionName=be,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createPBRSpecularGlossiness(){return new Wn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[be]){const a=this.createPBRSpecularGlossiness();e.materials[o].setExtension(be,a);const A=i.extensions[be];if(A.diffuseFactor!==void 0&&a.setDiffuseFactor(A.diffuseFactor),A.specularFactor!==void 0&&a.setSpecularFactor(A.specularFactor),A.glossinessFactor!==void 0&&a.setGlossinessFactor(A.glossinessFactor),A.diffuseTexture!==void 0){const u=A.diffuseTexture,f=e.textures[n[u.index].source];a.setDiffuseTexture(f),e.setTextureInfo(a.getDiffuseTextureInfo(),u)}if(A.specularGlossinessTexture!==void 0){const u=A.specularGlossinessTexture,f=e.textures[n[u.index].source];a.setSpecularGlossinessTexture(f),e.setTextureInfo(a.getSpecularGlossinessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(be);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[be]={diffuseFactor:n.getDiffuseFactor(),specularFactor:n.getSpecularFactor(),glossinessFactor:n.getGlossinessFactor()};if(n.getDiffuseTexture()){const A=n.getDiffuseTexture(),u=n.getDiffuseTextureInfo();a.diffuseTexture=e.createTextureInfoDef(A,u)}if(n.getSpecularGlossinessTexture()){const A=n.getSpecularGlossinessTexture(),u=n.getSpecularGlossinessTextureInfo();a.specularGlossinessTexture=e.createTextureInfoDef(A,u)}}}),this}}jo.EXTENSION_NAME=be;const{R:ko,G:Xo,B:Wo,A:Yo}=ae;class Yn extends J{init(){this.extensionName=ys,this.propertyType="Sheen",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new P(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new P(this.graph,"sheenRoughnessTextureInfo")})}getSheenColorFactor(){return this.get("sheenColorFactor")}setSheenColorFactor(e){return this.set("sheenColorFactor",e)}getSheenColorTexture(){return this.getRef("sheenColorTexture")}getSheenColorTextureInfo(){return this.getRef("sheenColorTexture")?this.getRef("sheenColorTextureInfo"):null}setSheenColorTexture(e){return this.setRef("sheenColorTexture",e,{channels:ko|Xo|Wo,isColor:!0})}getSheenRoughnessFactor(){return this.get("sheenRoughnessFactor")}setSheenRoughnessFactor(e){return this.set("sheenRoughnessFactor",e)}getSheenRoughnessTexture(){return this.getRef("sheenRoughnessTexture")}getSheenRoughnessTextureInfo(){return this.getRef("sheenRoughnessTexture")?this.getRef("sheenRoughnessTextureInfo"):null}setSheenRoughnessTexture(e){return this.setRef("sheenRoughnessTexture",e,{channels:Yo})}}Yn.EXTENSION_NAME=ys;const Oe=ys;class qo extends v{constructor(...e){super(...e),this.extensionName=Oe,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createSheen(){return new Yn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[Oe]){const a=this.createSheen();e.materials[o].setExtension(Oe,a);const A=i.extensions[Oe];if(A.sheenColorFactor!==void 0&&a.setSheenColorFactor(A.sheenColorFactor),A.sheenRoughnessFactor!==void 0&&a.setSheenRoughnessFactor(A.sheenRoughnessFactor),A.sheenColorTexture!==void 0){const u=A.sheenColorTexture,f=e.textures[n[u.index].source];a.setSheenColorTexture(f),e.setTextureInfo(a.getSheenColorTextureInfo(),u)}if(A.sheenRoughnessTexture!==void 0){const u=A.sheenRoughnessTexture,f=e.textures[n[u.index].source];a.setSheenRoughnessTexture(f),e.setTextureInfo(a.getSheenRoughnessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Oe);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[Oe]={sheenColorFactor:n.getSheenColorFactor(),sheenRoughnessFactor:n.getSheenRoughnessFactor()};if(n.getSheenColorTexture()){const A=n.getSheenColorTexture(),u=n.getSheenColorTextureInfo();a.sheenColorTexture=e.createTextureInfoDef(A,u)}if(n.getSheenRoughnessTexture()){const A=n.getSheenRoughnessTexture(),u=n.getSheenRoughnessTextureInfo();a.sheenRoughnessTexture=e.createTextureInfoDef(A,u)}}}),this}}qo.EXTENSION_NAME=Oe;const{R:zo,G:Qo,B:Zo,A:$o}=ae;class qn extends J{init(){this.extensionName=xs,this.propertyType="Specular",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new P(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new P(this.graph,"specularColorTextureInfo")})}getSpecularFactor(){return this.get("specularFactor")}setSpecularFactor(e){return this.set("specularFactor",e)}getSpecularColorFactor(){return this.get("specularColorFactor")}setSpecularColorFactor(e){return this.set("specularColorFactor",e)}getSpecularTexture(){return this.getRef("specularTexture")}getSpecularTextureInfo(){return this.getRef("specularTexture")?this.getRef("specularTextureInfo"):null}setSpecularTexture(e){return this.setRef("specularTexture",e,{channels:$o})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(e){return this.setRef("specularColorTexture",e,{channels:zo|Qo|Zo,isColor:!0})}}qn.EXTENSION_NAME=xs;const Le=xs;class ea extends v{constructor(...e){super(...e),this.extensionName=Le,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createSpecular(){return new qn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[Le]){const a=this.createSpecular();e.materials[o].setExtension(Le,a);const A=i.extensions[Le];if(A.specularFactor!==void 0&&a.setSpecularFactor(A.specularFactor),A.specularColorFactor!==void 0&&a.setSpecularColorFactor(A.specularColorFactor),A.specularTexture!==void 0){const u=A.specularTexture,f=e.textures[n[u.index].source];a.setSpecularTexture(f),e.setTextureInfo(a.getSpecularTextureInfo(),u)}if(A.specularColorTexture!==void 0){const u=A.specularColorTexture,f=e.textures[n[u.index].source];a.setSpecularColorTexture(f),e.setTextureInfo(a.getSpecularColorTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Le);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[Le]={};if(n.getSpecularFactor()!==1&&(a.specularFactor=n.getSpecularFactor()),H.eq(n.getSpecularColorFactor(),[1,1,1])||(a.specularColorFactor=n.getSpecularColorFactor()),n.getSpecularTexture()){const A=n.getSpecularTexture(),u=n.getSpecularTextureInfo();a.specularTexture=e.createTextureInfoDef(A,u)}if(n.getSpecularColorTexture()){const A=n.getSpecularColorTexture(),u=n.getSpecularColorTextureInfo();a.specularColorTexture=e.createTextureInfoDef(A,u)}}}),this}}ea.EXTENSION_NAME=Le;const{R:ta}=ae;class zn extends J{init(){this.extensionName=Ms,this.propertyType="Transmission",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new P(this.graph,"transmissionTextureInfo")})}getTransmissionFactor(){return this.get("transmissionFactor")}setTransmissionFactor(e){return this.set("transmissionFactor",e)}getTransmissionTexture(){return this.getRef("transmissionTexture")}getTransmissionTextureInfo(){return this.getRef("transmissionTexture")?this.getRef("transmissionTextureInfo"):null}setTransmissionTexture(e){return this.setRef("transmissionTexture",e,{channels:ta})}}zn.EXTENSION_NAME=Ms;const He=Ms;class sa extends v{constructor(...e){super(...e),this.extensionName=He,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createTransmission(){return new zn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[He]){const a=this.createTransmission();e.materials[o].setExtension(He,a);const A=i.extensions[He];if(A.transmissionFactor!==void 0&&a.setTransmissionFactor(A.transmissionFactor),A.transmissionTexture!==void 0){const u=A.transmissionTexture,f=e.textures[n[u.index].source];a.setTransmissionTexture(f),e.setTextureInfo(a.getTransmissionTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(He);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[He]={transmissionFactor:n.getTransmissionFactor()};if(n.getTransmissionTexture()){const A=n.getTransmissionTexture(),u=n.getTransmissionTextureInfo();a.transmissionTexture=e.createTextureInfoDef(A,u)}}}),this}}sa.EXTENSION_NAME=He;class Qn extends J{init(){this.extensionName=Rs,this.propertyType="Unlit",this.parentTypes=[E.MATERIAL]}}Qn.EXTENSION_NAME=Rs;const ke=Rs;class na extends v{constructor(...e){super(...e),this.extensionName=ke,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createUnlit(){return new Qn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((r,n)=>{r.extensions&&r.extensions[ke]&&e.materials[n].setExtension(ke,this.createUnlit())}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{if(r.getExtension(ke)){const n=e.materialIndexMap.get(r),i=t.json.materials[n];i.extensions=i.extensions||{},i.extensions[ke]={}}}),this}}na.EXTENSION_NAME=ke;class Zn extends J{init(){this.extensionName=je,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new _})}getMaterial(){return this.getRef("material")}setMaterial(e){return this.setRef("material",e)}addVariant(e){return this.addRef("variants",e)}removeVariant(e){return this.removeRef("variants",e)}listVariants(){return this.listRefs("variants")}}Zn.EXTENSION_NAME=je;class $n extends J{init(){this.extensionName=je,this.propertyType="MappingList",this.parentTypes=[E.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new _})}addMapping(e){return this.addRef("mappings",e)}removeMapping(e){return this.removeRef("mappings",e)}listMappings(){return this.listRefs("mappings")}}$n.EXTENSION_NAME=je;class ss extends J{init(){this.extensionName=je,this.propertyType="Variant",this.parentTypes=["MappingList"]}}ss.EXTENSION_NAME=je;const ue=je;class ra extends v{constructor(...e){super(...e),this.extensionName=ue}createMappingList(){return new $n(this.document.getGraph())}createVariant(e=""){return new ss(this.document.getGraph(),e)}createMapping(){return new Zn(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter(e=>e instanceof ss)}read(e){const t=e.jsonDoc;if(!t.json.extensions||!t.json.extensions[ue])return this;const i=(t.json.extensions[ue].variants||[]).map(a=>this.createVariant().setName(a.name||""));return(t.json.meshes||[]).forEach((a,A)=>{const u=e.meshes[A];(a.primitives||[]).forEach((l,c)=>{if(!l.extensions||!l.extensions[ue])return;const B=this.createMappingList(),h=l.extensions[ue];for(const g of h.mappings){const C=this.createMapping();g.material!==void 0&&C.setMaterial(e.materials[g.material]);for(const p of g.variants||[])C.addVariant(i[p]);B.addMapping(C)}u.listPrimitives()[c].setExtension(ue,B)})}),this}write(e){const t=e.jsonDoc,r=this.listVariants();if(!r.length)return this;const n=[],i=new Map;for(const o of r)i.set(o,n.length),n.push(e.createPropertyDef(o));for(const o of this.document.getRoot().listMeshes()){const a=e.meshIndexMap.get(o);o.listPrimitives().forEach((A,u)=>{const f=A.getExtension(ue);if(!f)return;const l=e.jsonDoc.json.meshes[a].primitives[u],c=f.listMappings().map(B=>{const h=e.createPropertyDef(B),g=B.getMaterial();return g&&(h.material=e.materialIndexMap.get(g)),h.variants=B.listVariants().map(C=>i.get(C)),h});l.extensions=l.extensions||{},l.extensions[ue]={mappings:c}})}return t.json.extensions=t.json.extensions||{},t.json.extensions[ue]={variants:n},this}}ra.EXTENSION_NAME=ue;const{G:ia}=ae;class er extends J{init(){this.extensionName=Ns,this.propertyType="Volume",this.parentTypes=[E.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new P(this.graph,"thicknessTexture"),attenuationDistance:1/0,attenuationColor:[1,1,1]})}getThicknessFactor(){return this.get("thicknessFactor")}setThicknessFactor(e){return this.set("thicknessFactor",e)}getThicknessTexture(){return this.getRef("thicknessTexture")}getThicknessTextureInfo(){return this.getRef("thicknessTexture")?this.getRef("thicknessTextureInfo"):null}setThicknessTexture(e){return this.setRef("thicknessTexture",e,{channels:ia})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(e){return this.set("attenuationDistance",e)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(e){return this.set("attenuationColor",e)}}er.EXTENSION_NAME=Ns;const we=Ns;class oa extends v{constructor(...e){super(...e),this.extensionName=we,this.prereadTypes=[E.MESH],this.prewriteTypes=[E.MESH]}createVolume(){return new er(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[we]){const a=this.createVolume();e.materials[o].setExtension(we,a);const A=i.extensions[we];if(A.thicknessFactor!==void 0&&a.setThicknessFactor(A.thicknessFactor),A.attenuationDistance!==void 0&&a.setAttenuationDistance(A.attenuationDistance),A.attenuationColor!==void 0&&a.setAttenuationColor(A.attenuationColor),A.thicknessTexture!==void 0){const u=A.thicknessTexture,f=e.textures[n[u.index].source];a.setThicknessTexture(f),e.setTextureInfo(a.getThicknessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(we);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[we]={};if(n.getThicknessFactor()>0&&(a.thicknessFactor=n.getThicknessFactor()),Number.isFinite(n.getAttenuationDistance())&&(a.attenuationDistance=n.getAttenuationDistance()),H.eq(n.getAttenuationColor(),[1,1,1])||(a.attenuationColor=n.getAttenuationColor()),n.getThicknessTexture()){const A=n.getThicknessTexture(),u=n.getThicknessTextureInfo();a.thicknessTexture=e.createTextureInfoDef(A,u)}}}),this}}oa.EXTENSION_NAME=we;const tr=eo;class Gs extends v{constructor(...e){super(...e),this.extensionName=tr}read(e){return this}write(e){return this}}Gs.EXTENSION_NAME=tr;const ct=to;class aa{match(e){return e[0]===171&&e[1]===75&&e[2]===84&&e[3]===88&&e[4]===32&&e[5]===50&&e[6]===48&&e[7]===187&&e[8]===13&&e[9]===10&&e[10]===26&&e[11]===10}getSize(e){const t=jt(e);return[t.pixelWidth,t.pixelHeight]}getChannels(e){const r=jt(e).dataFormatDescriptor[0];if(r.colorModel===ji)return r.samples.length===2&&(r.samples[1].channelType&15)===15?4:3;if(r.colorModel===ki)return(r.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${r.colorModel}".`)}getVRAMByteLength(e){const t=jt(e),r=this.getChannels(e)>3;let n=0;for(let i=0;i<t.levels.length;i++){const o=t.levels[i];if(o.uncompressedByteLength)n+=o.uncompressedByteLength;else{const a=Math.max(1,Math.floor(t.pixelWidth/Math.pow(2,i))),A=Math.max(1,Math.floor(t.pixelHeight/Math.pow(2,i))),u=r?16:8;n+=a/4*(A/4)*u}}return n}}class Aa extends v{constructor(...e){super(...e),this.extensionName=ct,this.prereadTypes=[E.TEXTURE]}static register(){Be.registerFormat("image/ktx2",new aa)}preread(e){return e.jsonDoc.json.textures.forEach(t=>{if(t.extensions&&t.extensions[ct]){const r=t.extensions[ct];t.source=r.source}}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listTextures().forEach(r=>{if(r.getMimeType()==="image/ktx2"){const n=e.imageIndexMap.get(r);t.json.textures.forEach(i=>{i.source===n&&(i.extensions=i.extensions||{},i.extensions[ct]={source:i.source},delete i.source)})}}),this}}Aa.EXTENSION_NAME=ct;class sr extends J{init(){this.extensionName=Ss,this.propertyType="Transform",this.parentTypes=[E.TEXTURE_INFO]}getDefaults(){return Object.assign(super.getDefaults(),{offset:[0,0],rotation:0,scale:[1,1],texCoord:null})}getOffset(){return this.get("offset")}setOffset(e){return this.set("offset",e)}getRotation(){return this.get("rotation")}setRotation(e){return this.set("rotation",e)}getScale(){return this.get("scale")}setScale(e){return this.set("scale",e)}getTexCoord(){return this.get("texCoord")}setTexCoord(e){return this.set("texCoord",e)}}sr.EXTENSION_NAME=Ss;const Pe=Ss;class ca extends v{constructor(...e){super(...e),this.extensionName=Pe}createTransform(){return new sr(this.document.getGraph())}read(e){for(const[t,r]of Array.from(e.textureInfos.entries())){if(!r.extensions||!r.extensions[Pe])continue;const n=this.createTransform(),i=r.extensions[Pe];i.offset!==void 0&&n.setOffset(i.offset),i.rotation!==void 0&&n.setRotation(i.rotation),i.scale!==void 0&&n.setScale(i.scale),i.texCoord!==void 0&&n.setTexCoord(i.texCoord),t.setExtension(Pe,n)}return this}write(e){const t=Array.from(e.textureInfoDefMap.entries());for(const[r,n]of t){const i=r.getExtension(Pe);if(!i)continue;n.extensions=n.extensions||{};const o={},a=H.eq;a(i.getOffset(),[0,0])||(o.offset=i.getOffset()),i.getRotation()!==0&&(o.rotation=i.getRotation()),a(i.getScale(),[1,1])||(o.scale=i.getScale()),i.getTexCoord()!=null&&(o.texCoord=i.getTexCoord()),n.extensions[Pe]=o}return this}}ca.EXTENSION_NAME=Pe;const ua=[E.ROOT,E.SCENE,E.NODE,E.MESH,E.MATERIAL,E.TEXTURE,E.ANIMATION];class nr extends J{init(){this.extensionName=Rt,this.propertyType="Packet",this.parentTypes=ua}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(e){return this.set("context",ge({},e))}listProperties(){return Object.keys(this.get("properties"))}getProperty(e){const t=this.get("properties");return e in t?t[e]:null}setProperty(e,t){this._assertContext(e);const r=ge({},this.get("properties"));return t?r[e]=t:delete r[e],this.set("properties",r)}toJSONLD(){const e=kt(this.get("context")),t=kt(this.get("properties"));return ge({"@context":e},t)}fromJSONLD(e){e=kt(e);const t=e["@context"];return t&&this.set("context",t),delete e["@context"],this.set("properties",e)}_assertContext(e){if(!(e.split(":")[0]in this.get("context")))throw new Error(`${Rt}: Missing context for term, "${e}".`)}}nr.EXTENSION_NAME=Rt;function kt(s){return JSON.parse(JSON.stringify(s))}const pe=Rt;class fa extends v{constructor(...e){super(...e),this.extensionName=pe}createPacket(){return new nr(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(e){var t;const r=(t=e.jsonDoc.json.extensions)==null?void 0:t[pe];if(!r||!r.packets)return this;const n=e.jsonDoc.json,i=this.document.getRoot(),o=r.packets.map(u=>this.createPacket().fromJSONLD(u)),a=[[n.asset],n.scenes,n.nodes,n.meshes,n.materials,n.images,n.animations],A=[[i],i.listScenes(),i.listNodes(),i.listMeshes(),i.listMaterials(),i.listTextures(),i.listAnimations()];for(let u=0;u<a.length;u++){const f=a[u]||[];for(let l=0;l<f.length;l++){const c=f[l];if(c.extensions&&c.extensions[pe]){const B=c.extensions[pe];A[u][l].setExtension(pe,o[B.packet])}}}return this}write(e){const{json:t}=e.jsonDoc,r=[];for(const n of this.properties){r.push(n.toJSONLD());for(const i of n.listParents()){let o;switch(i.propertyType){case E.ROOT:o=t.asset;break;case E.SCENE:o=t.scenes[e.sceneIndexMap.get(i)];break;case E.NODE:o=t.nodes[e.nodeIndexMap.get(i)];break;case E.MESH:o=t.meshes[e.meshIndexMap.get(i)];break;case E.MATERIAL:o=t.materials[e.materialIndexMap.get(i)];break;case E.TEXTURE:o=t.images[e.imageIndexMap.get(i)];break;case E.ANIMATION:o=t.animations[e.animationIndexMap.get(i)];break;default:o=null,this.document.getLogger().warn(`[${pe}]: Unsupported parent property, "${i.propertyType}"`);break}o&&(o.extensions=o.extensions||{},o.extensions[pe]={packet:r.length-1})}}return r.length>0&&(t.extensions=t.extensions||{},t.extensions[pe]={packets:r}),this}}fa.EXTENSION_NAME=pe;function Ue(){return Ue=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},Ue.apply(this,arguments)}U.Mode;function nt(s,e){return Object.defineProperty(e,"name",{value:s}),e}function rt(s,e){const t=Ue({},s);for(const r in e)e[r]!==void 0&&(t[r]=e[r]);return t}function Ba(s){const e=s.getIndices(),t=s.getAttribute("POSITION");switch(s.getMode()){case U.Mode.POINTS:return e?e.getCount():t.getCount();case U.Mode.LINES:return e?e.getCount()/2:t.getCount()/2;case U.Mode.LINE_LOOP:return e?e.getCount():t.getCount();case U.Mode.LINE_STRIP:return e?e.getCount()-1:t.getCount()-1;case U.Mode.TRIANGLES:return e?e.getCount()/3:t.getCount()/3;case U.Mode.TRIANGLE_STRIP:case U.Mode.TRIANGLE_FAN:return e?e.getCount()-2:t.getCount()-2;default:throw new Error("Unexpected mode: "+s.getMode())}}function tn(s){return s.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function la(s,e,t=2){return(s>e?"–":"+")+(Math.abs(s-e)/s*100).toFixed(t)+"%"}function wt(s,e){return`${tn(s)} → ${tn(e)} (${la(s,e)})`}function bs(s){const e=[];for(const t of s.listAttributes())e.push(t);for(const t of s.listTargets())for(const r of t.listAttributes())e.push(r);return Array.from(new Set(e))}function ha(s,e,t){s.swap(e,t);for(const r of s.listTargets())r.swap(e,t)}function pa(s,e){if(s==null&&e==null)return!0;if(s==null||e==null||s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;return!0}function $e(s,e){return s.createAccessor(e.getName()).setArray(e.getArray()).setType(e.getType()).setBuffer(e.getBuffer()).setNormalized(e.getNormalized()).setSparse(e.getSparse())}function ga(s,e=s){const t=rr(s,e);for(let r=0;r<t.length;r++)t[r]=r;return t}function rr(s,e=s){return e<=65534?new Uint16Array(s):new Uint32Array(s)}function ir(s){for(const e in s)return!1;return!0}function Ca(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function da(s){const e=new Set;let t=s,r;for(;r=t.getParentNode();){if(e.has(r))throw new Error("Circular dependency in scene graph.");e.add(r),t=r}return t.listParents().filter(n=>n instanceof Ht)}function Ea(s){const e=da(s),t=s.getParentNode();if(!t)return s;s.setMatrix(s.getWorldMatrix()),t.removeChild(s);for(const r of e)r.addChild(s);return s}var Nt=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var s=0,e=arguments.length;e--;)s+=arguments[e]*arguments[e];return Math.sqrt(s)});function Da(s,e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5],A=e[6],u=e[7],f=e[8],l=e[9],c=e[10],B=e[11],h=e[12],g=e[13],C=e[14],p=e[15],y=t*a-r*o,D=t*A-n*o,T=t*u-i*o,I=r*A-n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=0,s[2]=0,s[3]=0,s[4]=0,s[5]=e[1],s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=e[2],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s}function Ta(s,e,t,r){var n=e[0],i=e[1],o=e[2],a=e[3],A=n+n,u=i+i,f=o+o,l=n*A,c=n*u,B=n*f,h=i*u,g=i*f,C=o*f,p=a*A,y=a*u,D=a*f,T=r[0],I=r[1],m=r[2];return s[0]=(1-(h+C))*T,s[1]=(c+D)*T,s[2]=(B-y)*T,s[3]=0,s[4]=(c-D)*I,s[5]=(1-(l+C))*I,s[6]=(g+p)*I,s[7]=0,s[8]=(B+y)*m,s[9]=(g-p)*m,s[10]=(1-(l+h))*m,s[11]=0,s[12]=t[0],s[13]=t[1],s[14]=t[2],s[15]=1,s}function ma(){var s=new Nt(3);return Nt!=Float32Array&&(s[0]=0,s[1]=0,s[2]=0),s}function Fa(s,e,t){return s[0]=e[0]*t[0],s[1]=e[1]*t[1],s[2]=e[2]*t[2],s}function ns(s,e,t){return s[0]=Math.min(e[0],t[0]),s[1]=Math.min(e[1],t[1]),s[2]=Math.min(e[2],t[2]),s}function rs(s,e,t){return s[0]=Math.max(e[0],t[0]),s[1]=Math.max(e[1],t[1]),s[2]=Math.max(e[2],t[2]),s}function sn(s,e,t){return s[0]=e[0]*t,s[1]=e[1]*t,s[2]=e[2]*t,s}function ya(s,e,t){var r=e[0],n=e[1],i=e[2],o=t[3]*r+t[7]*n+t[11]*i+t[15];return o=o||1,s[0]=(t[0]*r+t[4]*n+t[8]*i+t[12])/o,s[1]=(t[1]*r+t[5]*n+t[9]*i+t[13])/o,s[2]=(t[2]*r+t[6]*n+t[10]*i+t[14])/o,s}var xa=Fa;(function(){var s=ma();return function(e,t,r,n,i,o){var a,A;for(t||(t=3),r||(r=0),n?A=Math.min(n*t+r,e.length):A=e.length,a=r;a<A;a+=t)s[0]=e[a],s[1]=e[a+1],s[2]=e[a+2],i(s,s,o),e[a]=s[0],e[a+1]=s[1],e[a+2]=s[2];return e}})();const Te="dedup",Xt={keepUniqueNames:!1,propertyTypes:[E.ACCESSOR,E.MESH,E.TEXTURE,E.MATERIAL,E.SKIN]};function Pt(s=Xt){const e=rt(Xt,s),t=new Set(e.propertyTypes);for(const r of e.propertyTypes)if(!Xt.propertyTypes.includes(r))throw new Error(`${Te}: Unsupported deduplication on type "${r}".`);return nt(Te,r=>{const n=r.getLogger();t.has(E.ACCESSOR)&&Ma(r),t.has(E.TEXTURE)&&Na(r,e),t.has(E.MATERIAL)&&Sa(r,e),t.has(E.MESH)&&Ra(r,e),t.has(E.SKIN)&&Ga(r,e),n.debug(`${Te}: Complete.`)})}function Ma(s){const e=s.getLogger(),t=new Map,r=new Map,n=new Map,i=new Map,o=s.getRoot().listMeshes();o.forEach(l=>{l.listPrimitives().forEach(c=>{c.listAttributes().forEach(B=>a(B,r)),a(c.getIndices(),t)})});for(const l of s.getRoot().listAnimations())for(const c of l.listSamplers())a(c.getInput(),n),a(c.getOutput(),i);function a(l,c){if(!l)return;const B=[l.getCount(),l.getType(),l.getComponentType(),l.getNormalized(),l.getSparse()].join(":");let h=c.get(B);h||c.set(B,h=new Set),h.add(l)}function A(l,c){for(let B=0;B<l.length;B++){const h=l[B],g=O.toView(h.getArray());if(!c.has(h))for(let C=B+1;C<l.length;C++){const p=l[C];c.has(p)||O.equals(g,O.toView(p.getArray()))&&c.set(p,h)}}}let u=0;const f=new Map;for(const l of[r,t,n,i])for(const c of l.values())u+=c.size,A(Array.from(c),f);e.debug(`${Te}: Merged ${f.size} of ${u} accessors.`),o.forEach(l=>{l.listPrimitives().forEach(c=>{c.listAttributes().forEach(h=>{f.has(h)&&c.swap(h,f.get(h))});const B=c.getIndices();B&&f.has(B)&&c.swap(B,f.get(B))})});for(const l of s.getRoot().listAnimations())for(const c of l.listSamplers()){const B=c.getInput(),h=c.getOutput();B&&f.has(B)&&c.swap(B,f.get(B)),h&&f.has(h)&&c.swap(h,f.get(h))}Array.from(f.keys()).forEach(l=>l.dispose())}function Ra(s,e){const t=s.getLogger(),r=s.getRoot(),n=new Map;r.listAccessors().forEach((a,A)=>n.set(a,A)),r.listMaterials().forEach((a,A)=>n.set(a,A));const i=r.listMeshes().length,o=new Map;for(const a of r.listMeshes()){const A=[];for(const f of a.listPrimitives())A.push(or(f,n));let u="";if(e.keepUniqueNames&&(u+=a.getName()+";"),u+=A.join(";"),o.has(u)){const f=o.get(u);a.listParents().forEach(l=>{l.propertyType!==E.ROOT&&l.swap(a,f)}),a.dispose()}else o.set(u,a)}t.debug(`${Te}: Merged ${i-o.size} of ${i} meshes.`)}function Na(s,e){const t=s.getLogger(),r=s.getRoot(),n=r.listTextures(),i=new Map;for(let o=0;o<n.length;o++){const a=n[o],A=a.getImage();if(!i.has(a))for(let u=o+1;u<n.length;u++){const f=n[u],l=f.getImage();if(i.has(f)||a.getMimeType()!==f.getMimeType()||e.keepUniqueNames&&a.getName()!==f.getName())continue;const c=a.getSize(),B=f.getSize();!c||!B||c[0]===B[0]&&c[1]===B[1]&&(!A||!l||O.equals(A,l)&&i.set(f,a))}}t.debug(`${Te}: Merged ${i.size} of ${r.listTextures().length} textures.`),Array.from(i.entries()).forEach(([o,a])=>{o.listParents().forEach(A=>{A instanceof st||A.swap(o,a)}),o.dispose()})}function Sa(s,e){const t=s.getLogger(),n=s.getRoot().listMaterials(),i=new Map,o=new Map,a=new Set;e.keepUniqueNames||a.add("name");for(let A=0;A<n.length;A++){const u=n[A];if(!i.has(u)&&!nn(u,o))for(let f=A+1;f<n.length;f++){const l=n[f];i.has(l)||nn(l,o)||u.equals(l,a)&&i.set(l,u)}}t.debug(`${Te}: Merged ${i.size} of ${n.length} materials.`),Array.from(i.entries()).forEach(([A,u])=>{A.listParents().forEach(f=>{f instanceof st||f.swap(A,u)}),A.dispose()})}function Ga(s,e){const t=s.getLogger(),n=s.getRoot().listSkins(),i=new Map,o=new Set(["joints"]);e.keepUniqueNames||o.add("name");for(let a=0;a<n.length;a++){const A=n[a];if(!i.has(A))for(let u=a+1;u<n.length;u++){const f=n[u];i.has(f)||A.equals(f,o)&&pa(A.listJoints(),f.listJoints())&&i.set(f,A)}}t.debug(`${Te}: Merged ${i.size} of ${n.length} skins.`),Array.from(i.entries()).forEach(([a,A])=>{a.listParents().forEach(u=>{u instanceof st||u.swap(a,A)}),a.dispose()})}function or(s,e){const t=[];for(const r of s.listSemantics()){const n=s.getAttribute(r);t.push(r+":"+e.get(n))}if(s instanceof U){const r=s.getIndices();r&&t.push("indices:"+e.get(r));const n=s.getMaterial();n&&t.push("material:"+e.get(n)),t.push("mode:"+s.getMode());for(const i of s.listTargets())t.push("target:"+or(i,e))}return t.join(",")}function nn(s,e){if(e.has(s))return e.get(s);const t=s.getGraph(),r=new Set,n=t.listParentEdges(s);for(;n.length>0;){const i=n.pop();if(i.getAttributes().modifyChild===!0)return e.set(s,!0),!0;const o=i.getChild();if(!r.has(o))for(const a of t.listChildEdges(o))n.push(a)}return e.set(s,!1),!1}function ar(){var s=new Nt(4);return Nt!=Float32Array&&(s[0]=0,s[1]=0,s[2]=0,s[3]=0),s}function ba(s,e,t){return s[0]=e[0]+t[0],s[1]=e[1]+t[1],s[2]=e[2]+t[2],s[3]=e[3]+t[3],s}function Oa(s,e,t){return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],s[3]=e[3]-t[3],s}function La(s,e,t){return s[0]=e[0]*t[0],s[1]=e[1]*t[1],s[2]=e[2]*t[2],s[3]=e[3]*t[3],s}function Ha(s,e,t){return s[0]=e[0]*t,s[1]=e[1]*t,s[2]=e[2]*t,s[3]=e[3]*t,s}function wa(s){var e=s[0],t=s[1],r=s[2],n=s[3];return Math.hypot(e,t,r,n)}var Ar=Oa,Pa=La,cr=wa;(function(){var s=ar();return function(e,t,r,n,i,o){var a,A;for(t||(t=4),r||(r=0),n?A=Math.min(n*t+r,e.length):A=e.length,a=r;a<A;a+=t)s[0]=e[a],s[1]=e[a+1],s[2]=e[a+2],s[3]=e[a+3],i(s,s,o),e[a]=s[0],e[a+1]=s[1],e[a+2]=s[2],e[a+3]=s[3];return e}})();const _a=/color|emissive|diffuse/i;function va(s){return s.getGraph().listParentEdges(s).some(n=>n.getAttributes().isColor||_a.test(n.getName()))?"srgb":null}function Ka(s){const e=s.getGraph(),t=new Set,r=new Set;function n(i){const o=new Set;for(const a of e.listChildEdges(i))a.getChild()instanceof Bt&&o.add(a.getName()+"Info");for(const a of e.listChildEdges(i)){const A=a.getChild();t.has(A)||(t.add(A),A instanceof P&&o.has(a.getName())?r.add(A):A instanceof J&&n(A))}}return n(s),Array.from(r)}function Ja(s){const t=Ae.fromGraph(s.getGraph()).getRoot(),r=s.getGraph().listParentEdges(s).filter(n=>n.getParent()!==t).map(n=>n.getName());return Array.from(new Set(r))}const Ye="prune",is=3/255,rn={propertyTypes:[E.NODE,E.SKIN,E.MESH,E.CAMERA,E.PRIMITIVE,E.PRIMITIVE_TARGET,E.ANIMATION,E.MATERIAL,E.TEXTURE,E.ACCESSOR,E.BUFFER],keepLeaves:!1,keepAttributes:!1,keepIndices:!1,keepSolidTextures:!1,keepExtras:!1};function _t(s=rn){const e=rt(rn,s),t=new Set(e.propertyTypes),r=e.keepExtras;return nt(Ye,async n=>{const i=n.getLogger(),o=n.getRoot(),a=n.getGraph(),A=new Ua,u=f=>A.dispose(f.target);if(a.addEventListener("node:dispose",u),t.has(E.MESH))for(const f of o.listMeshes())f.listPrimitives().length>0||f.dispose();if(t.has(E.NODE)){if(!e.keepLeaves)for(const f of o.listScenes())ur(a,f,r);for(const f of o.listNodes())re(f,r)}if(t.has(E.SKIN))for(const f of o.listSkins())re(f,r);if(t.has(E.MESH))for(const f of o.listMeshes())re(f,r);if(t.has(E.CAMERA))for(const f of o.listCameras())re(f,r);if(t.has(E.PRIMITIVE)&&on(a,E.PRIMITIVE,r),t.has(E.PRIMITIVE_TARGET)&&on(a,E.PRIMITIVE_TARGET,r),!e.keepAttributes&&t.has(E.ACCESSOR)){const f=new Map;for(const l of o.listMeshes())for(const c of l.listPrimitives()){const B=c.getMaterial();if(!B)continue;const h=fr(n,c,B),g=ja(c,h);an(c,g),c.listTargets().forEach(C=>an(C,g)),f.has(B)?f.get(B).add(c):f.set(B,new Set([c]))}for(const[l,c]of f)ka(l,Array.from(c))}if(!e.keepIndices&&t.has(E.ACCESSOR))for(const f of o.listMeshes())for(const l of f.listPrimitives())Va(l);if(t.has(E.ANIMATION))for(const f of o.listAnimations()){for(const l of f.listChannels())l.getTargetNode()||l.dispose();if(f.listChannels().length)f.listSamplers().forEach(l=>re(l,r));else{const l=f.listSamplers();re(f,r),l.forEach(c=>re(c,r))}}if(t.has(E.MATERIAL)&&o.listMaterials().forEach(f=>re(f,r)),t.has(E.TEXTURE)&&(o.listTextures().forEach(f=>re(f,r)),e.keepSolidTextures||await Xa(n)),t.has(E.ACCESSOR)&&o.listAccessors().forEach(f=>re(f,r)),t.has(E.BUFFER)&&o.listBuffers().forEach(f=>re(f,r)),a.removeEventListener("node:dispose",u),A.empty())i.debug(`${Ye}: No unused properties found.`);else{const f=A.entries().map(([l,c])=>`${l} (${c})`).join(", ");i.info(`${Ye}: Removed types... ${f}`)}i.debug(`${Ye}: Complete.`)})}class Ua{constructor(){this.disposed={}}empty(){for(const e in this.disposed)return!1;return!0}entries(){return Object.entries(this.disposed)}dispose(e){this.disposed[e.propertyType]=this.disposed[e.propertyType]||0,this.disposed[e.propertyType]++}}function re(s,e){const t=s.listParents().filter(n=>!(n instanceof st||n instanceof et)),r=e&&!ir(s.getExtras());!t.length&&!r&&s.dispose()}function on(s,e,t){for(const r of s.listEdges()){const n=r.getParent();n.propertyType===e&&re(n,t)}}function ur(s,e,t){if(e.listChildren().forEach(o=>ur(s,o,t)),e instanceof Ht)return;const r=s.listParentEdges(e).some(o=>{const a=o.getParent().propertyType;return a!==E.ROOT&&a!==E.SCENE&&a!==E.NODE}),n=s.listChildren(e).length===0,i=t&&!ir(e.getExtras());n&&!r&&!i&&e.dispose()}function an(s,e){for(const t of e)s.setAttribute(t,null)}function Va(s){const e=s.getIndices(),t=e&&e.getArray(),r=s.listAttributes()[0];if(!(!t||!r)&&e.getCount()===r.getCount()){for(let n=0,i=t.length;n<i;n++)if(n!==t[n])return;s.setIndices(null)}}function ja(s,e){const t=[];for(const r of s.listSemantics())(r==="NORMAL"&&!e.has(r)||r==="TANGENT"&&!e.has(r)||r.startsWith("TEXCOORD_")&&!e.has(r)||r.startsWith("COLOR_")&&r!=="COLOR_0")&&t.push(r);return t}function fr(s,e,t,r=new Set){const i=s.getGraph().listChildEdges(t),o=new Set;for(const u of i)u.getChild()instanceof Bt&&o.add(u.getName());for(const u of i){const f=u.getName(),l=u.getChild();l instanceof P&&o.has(f.replace(/Info$/,""))&&r.add(`TEXCOORD_${l.getTexCoord()}`),l instanceof Bt&&f.match(/normalTexture/i)&&r.add("TANGENT"),l instanceof J&&fr(s,e,l,r)}const a=t instanceof Ce&&!t.getExtension("KHR_materials_unlit"),A=e.getMode()===U.Mode.POINTS;return a&&!A&&r.add("NORMAL"),r}function ka(s,e){const t=Ka(s),r=new Set(t.map(A=>A.getTexCoord())),n=Array.from(r).sort(),i=new Map(n.map((A,u)=>[A,u])),o=new Map(n.map((A,u)=>[`TEXCOORD_${A}`,`TEXCOORD_${u}`]));for(const A of t){const u=A.getTexCoord();A.setTexCoord(i.get(u))}for(const A of e){const u=A.listSemantics().filter(f=>f.startsWith("TEXCOORD_")).sort();a(A,u),A.listTargets().forEach(f=>a(f,u))}function a(A,u){for(const f of u){const l=A.getAttribute(f);if(!l)continue;const c=o.get(f);c!==f&&(A.setAttribute(c,l),A.setAttribute(f,null))}}}async function Xa(s){const e=s.getRoot(),t=s.getGraph(),r=s.getLogger(),i=e.listTextures().map(async o=>{var a;const A=await Ya(o);if(!A)return;va(o)==="srgb"&&xr.convertSRGBToLinear(A,A);const u=o.getName()||o.getURI(),f=(a=o.getSize())==null?void 0:a.join("x"),l=Ja(o);for(const c of t.listParentEdges(o)){const B=c.getParent();B!==e&&Wa(B,A,c.getName(),r)&&c.dispose()}o.listParents().length===1&&(o.dispose(),r.debug(`${Ye}: Removed solid-color texture "${u}" (${f}px ${l.join(", ")})`))});await Promise.all(i)}function Wa(s,e,t,r){if(s instanceof Ce)switch(t){case"baseColorTexture":return s.setBaseColorFactor(Pa(e,e,s.getBaseColorFactor())),!0;case"emissiveTexture":return s.setEmissiveFactor(xa([0,0,0],e.slice(0,3),s.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(e[0]-1)<=is;case"metallicRoughnessTexture":return s.setRoughnessFactor(e[1]*s.getRoughnessFactor()),s.setMetallicFactor(e[2]*s.getMetallicFactor()),!0;case"normalTexture":return cr(Ar(ar(),e,[.5,.5,1,1]))<=is}return r.warn(`${Ye}: Detected single-color ${t} texture. Pruning ${t} not yet supported.`),!1}async function Ya(s){const e=await qa(s);if(!e)return null;const t=[1/0,1/0,1/0,1/0],r=[-1/0,-1/0,-1/0,-1/0],n=[0,0,0,0],[i,o]=e.shape;for(let a=0;a<i;a++){for(let A=0;A<o;A++)for(let u=0;u<4;u++)t[u]=Math.min(t[u],e.get(a,A,u)),r[u]=Math.max(r[u],e.get(a,A,u));if(cr(Ar(n,r,t))/255>is)return null}return Ha(n,ba(n,r,t),.5/255)}async function qa(s){try{return await _i(s.getImage(),s.getMimeType())}catch{return null}}const De=2**32-1;class za{constructor(e){this.attributes=[],this.u8=void 0,this.u32=void 0;let t=0;for(const r of bs(e))t+=this._initAttribute(r);this.u8=new Uint8Array(t),this.u32=new Uint32Array(this.u8.buffer)}_initAttribute(e){const t=e.getArray(),r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=e.getElementSize()*e.getComponentSize(),i=O.padNumber(n);return this.attributes.push({u8:r,byteStride:n,paddedByteStride:i}),i}hash(e){let t=0;for(const{u8:r,byteStride:n,paddedByteStride:i}of this.attributes){for(let o=0;o<i;o++)o<n?this.u8[t+o]=r[e*n+o]:this.u8[t+o]=0;t+=i}return Qa(0,this.u32)}equal(e,t){for(const{u8:r,byteStride:n}of this.attributes)for(let i=0;i<n;i++)if(r[e*n+i]!==r[t*n+i])return!1;return!0}}function Qa(s,e){for(let n=0,i=e.length;n<i;n++){let o=e[n];o=Math.imul(o,1540483477)>>>0,o=(o^o>>24)>>>0,o=Math.imul(o,1540483477)>>>0,s=Math.imul(s,1540483477)>>>0,s=(s^o)>>>0}return s}function Za(s,e,t,r,n=De){const i=e-1;let a=t.hash(r)&i;for(let A=0;A<=i;A++){const u=s[a];if(u===n||t.equal(u,r))return a;a=a+A+1&i}throw new Error("Hash table full.")}var W;(function(s){s.RENDER="render",s.RENDER_CACHED="render-cached",s.UPLOAD="upload",s.UPLOAD_NAIVE="upload-naive",s.DISTINCT="distinct",s.DISTINCT_POSITION="distinct-position",s.UNUSED="unused"})(W||(W={}));function he(s,e){const t=s.getAttribute("POSITION"),r=s.getIndices();switch(e){case W.RENDER:return r?r.getCount():t.getCount();case W.RENDER_CACHED:return r?new Set(r.getArray()).size:t.getCount();case W.UPLOAD_NAIVE:case W.UPLOAD:return t.getCount();case W.DISTINCT:case W.DISTINCT_POSITION:return $a(e);case W.UNUSED:return r?t.getCount()-new Set(r.getArray()).size:0;default:return eA(e)}}function $a(s){throw new Error(`Not implemented: ${s}`)}function eA(s){throw new Error(`Unexpected value: ${s}`)}function St(s,e,t){const r=Ae.fromGraph(s.getGraph());(!e||!t)&&([e,t]=tA(s));const n=s.getIndices(),i=n?n.getArray():null,o=he(s,W.RENDER),a=r.createAccessor(),A=o,u=rr(A,t);for(let l=0;l<A;l++)u[l]=e[i?i[l]:l];s.setIndices(a.setArray(u));const f=bs(s);for(const l of s.listAttributes()){const c=$e(r,l);os(l,n,e,c,t),s.swap(l,c)}for(const l of s.listTargets())for(const c of l.listAttributes()){const B=$e(r,c);os(c,n,e,B,t),l.swap(c,B)}n&&n.listParents().length===1&&n.dispose();for(const l of f)l.listParents().length===1&&l.dispose();return s}function os(s,e,t,r,n){const i=s.getElementSize(),o=s.getArray(),a=e?e.getArray():null,A=e?e.getCount():s.getCount(),u=new o.constructor(n*i),f=new Uint8Array(n);for(let l=0;l<A;l++){const c=a?a[l]:l,B=t[c];if(!f[B]){for(let h=0;h<i;h++)u[B*i+h]=o[c*i+h];f[B]=1}}return r.setArray(u)}function tA(s){const e=he(s,W.UPLOAD),t=s.getIndices(),r=t?t.getArray():null;if(!t||!r)return[ga(e,1e6),e];const n=new Uint32Array(e).fill(De);let i=0;for(let o=0;o<r.length;o++){const a=r[o];n[a]===De&&(n[a]=i++)}return[n,i]}const as="weld",Gt={overwrite:!0,cleanup:!0};function Br(s=Gt){const e=rt(Gt,s);return nt(as,async t=>{const r=t.getLogger();for(const n of t.getRoot().listMeshes()){for(const i of n.listPrimitives())lr(i,e),he(i,W.RENDER)===0&&i.dispose();n.listPrimitives().length===0&&n.dispose()}e.cleanup&&await t.transform(_t({propertyTypes:[E.ACCESSOR,E.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),Pt({propertyTypes:[E.ACCESSOR]})),r.debug(`${as}: Complete.`)})}function lr(s,e=Gt){const t=s.getGraph(),n=Ae.fromGraph(t).getLogger(),i=Ue({},Gt,e);if(s.getIndices()&&!i.overwrite||s.getMode()===U.Mode.POINTS)return;const o=s.getAttribute("POSITION").getCount(),a=s.getIndices(),A=a==null?void 0:a.getArray(),u=a?a.getCount():o,f=new za(s),l=Ca(o+o/4),c=new Uint32Array(l).fill(De),B=new Uint32Array(o).fill(De);let h=0;for(let g=0;g<u;g++){const C=A?A[g]:g;if(B[C]!==De)continue;const p=Za(c,l,f,C,De),y=c[p];y===De?(c[p]=C,B[C]=h++):B[C]=B[y]}n.debug(`${as}: ${wt(o,h)} vertices.`),St(s,B,h)}R.ComponentType;const{LINES:UA,LINE_STRIP:VA,LINE_LOOP:jA,TRIANGLES:sA,TRIANGLE_STRIP:nA,TRIANGLE_FAN:rA}=U.Mode;function iA(s){const e=s.getGraph(),t=Ae.fromGraph(e);s.getIndices()||lr(s);const r=s.getIndices(),n=r.getArray(),i=Ba(s),o=gt[r.getComponentType()],a=new o(i*3),A=s.getMode();if(A===nA)for(let f=0,l=n.length;f<l-2;f++)f%2?(a[f*3]=n[f+1],a[f*3+1]=n[f],a[f*3+2]=n[f+2]):(a[f*3]=n[f],a[f*3+1]=n[f+1],a[f*3+2]=n[f+2]);else if(A===rA)for(let f=0;f<i;f++)a[f*3]=n[0],a[f*3+1]=n[f+1],a[f*3+2]=n[f+2];else throw new Error("Only TRIANGLE_STRIP and TRIANGLE_FAN may be converted to TRIANGLES.");s.setMode(sA);const u=t.getRoot();r.listParents().some(f=>f!==u&&f!==s)?s.setIndices($e(t,r).setArray(a)):r.setArray(a)}function As(s,e,t){const r=new Float32Array(s.length);for(let n=0,i=s.length;n<i;n++)t?r[n]=H.decodeNormalizedInt(s[n],e):r[n]=s[n];return r}const Wt="flatten",An={cleanup:!0};function oA(s=An){const e=rt(An,s);return nt(Wt,async t=>{const r=t.getRoot(),n=t.getLogger(),i=new Set;for(const u of r.listSkins())for(const f of u.listJoints())i.add(f);const o=new Set;for(const u of r.listAnimations())for(const f of u.listChannels()){const l=f.getTargetNode();l&&f.getTargetPath()!=="weights"&&o.add(l)}const a=new Set,A=new Set;for(const u of r.listScenes())u.traverse(f=>{const l=f.getParentNode();l&&((i.has(l)||a.has(l))&&a.add(f),(o.has(l)||A.has(l))&&A.add(f))});for(const u of r.listScenes())u.traverse(f=>{o.has(f)||a.has(f)||A.has(f)||Ea(f)});o.size&&n.debug(`${Wt}: Flattening node hierarchies with TRS animation not yet supported.`),e.cleanup&&await t.transform(_t({propertyTypes:[E.NODE],keepLeaves:!1})),n.debug(`${Wt}: Complete.`)})}U.Mode;function aA(s,e=1/0){if(Number.isFinite(e)&&e%4||e<=0)throw new Error("Limit must be positive multiple of four.");const t=s.getAttribute("POSITION").getCount(),r=s.listSemantics().filter(u=>u.startsWith("WEIGHTS_")).length,n=new Uint16Array(r*4),i=new Float32Array(r*4),o=new Float32Array(r*4),a=new Uint32Array(r*4),A=new Uint32Array(r*4);for(let u=0;u<t;u++){bt(s,u,"WEIGHTS",i),bt(s,u,"JOINTS",a);for(let f=0;f<r*4;f++)n[f]=f;n.sort((f,l)=>i[f]>i[l]?-1:1);for(let f=0;f<n.length;f++)o[f]=i[n[f]],A[f]=a[n[f]];Ot(s,u,"WEIGHTS",o),Ot(s,u,"JOINTS",A)}for(let u=r;u*4>e;u--){const f=s.getAttribute(`WEIGHTS_${u-1}`),l=s.getAttribute(`JOINTS_${u-1}`);s.setAttribute(`WEIGHTS_${u-1}`,null),s.setAttribute(`JOINTS_${u-1}`,null),f.listParents().length===1&&f.dispose(),l.listParents().length===1&&l.dispose()}AA(s)}function AA(s){if(!cA(s))return;const e=s.getAttribute("POSITION").getCount(),t=s.listSemantics().filter(l=>l.startsWith("WEIGHTS_")).length,r=s.getAttribute("WEIGHTS_0"),n=r.getArray(),i=r.getComponentType(),o=r.getNormalized(),a=o?i:void 0,A=o?H.decodeNormalizedInt(1,i):Number.EPSILON,u=new Uint32Array(t*4).fill(0),f=n.slice(0,t*4).fill(0);for(let l=0;l<e;l++){bt(s,l,"JOINTS",u),bt(s,l,"WEIGHTS",f,a);let c=cn(f,a);if(c!==0&&c!==1){if(Math.abs(1-c)>A)for(let B=0;B<f.length;B++)if(o){const h=H.decodeNormalizedInt(f[B],i);f[B]=H.encodeNormalizedInt(h/c,i)}else f[B]/=c;if(c=cn(f,a),o&&c!==1){for(let B=f.length-1;B>=0;B--)if(f[B]>0){const h=1-c;f[B]+=Math.sign(h)*H.encodeNormalizedInt(Math.abs(h),i);break}}}for(let B=f.length-1;B>=0;B--)f[B]===0&&(u[B]=0);Ot(s,l,"JOINTS",u),Ot(s,l,"WEIGHTS",f,a)}}function bt(s,e,t,r,n){let i;const o=[0,0,0,0];for(let a=0;i=s.getAttribute(`${t}_${a}`);a++){i.getElement(e,o);for(let A=0;A<4;A++)n?r[a*4+A]=H.encodeNormalizedInt(o[A],n):r[a*4+A]=o[A]}return r}function Ot(s,e,t,r,n){let i;const o=[0,0,0,0];for(let a=0;i=s.getAttribute(`${t}_${a}`);a++){for(let A=0;A<4;A++)n?o[A]=H.decodeNormalizedInt(r[a*4+A],n):o[A]=r[a*4+A];i.setElement(e,o)}}function cn(s,e){let t=0;for(let r=0;r<s.length;r++)e?t+=H.decodeNormalizedInt(s[r],e):t+=s[r];return t}function cA(s){const e=s.listSemantics().filter(n=>n.startsWith("WEIGHTS_")).map(n=>s.getAttribute(n)),t=e.map(n=>n.getNormalized()),r=e.map(n=>n.getComponentType());return new Set(t).size===1&&new Set(r).size===1}const Ie="quantize",uA=[Int8Array,Int16Array,Int32Array],{TRANSLATION:fA,ROTATION:BA,SCALE:lA,WEIGHTS:hA}=et.TargetPath,pA=[fA,BA,lA],mt={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};function un(s=mt){const e=rt(mt,Ue({patternTargets:s.pattern||mt.pattern},s));return nt(Ie,async t=>{const r=t.getLogger(),n=t.getRoot();let i;e.quantizationVolume==="scene"&&(i=Bn(mA(n.listMeshes().map(ln))));for(const a of t.getRoot().listMeshes()){e.quantizationVolume==="mesh"&&(i=Bn(ln(a))),i&&e.pattern.test("POSITION")&&(gA(t,a,i),EA(a,1/i.scale));for(const A of a.listPrimitives()){const u=he(A,W.RENDER),f=he(A,W.UPLOAD);u<f/2&&St(A),fn(t,A,i,e);for(const l of A.listTargets())fn(t,l,i,e)}}n.listMeshes().flatMap(a=>a.listPrimitives()).some(hr)&&t.createExtension(Gs).setRequired(!0),e.cleanup&&await t.transform(_t({propertyTypes:[E.ACCESSOR,E.SKIN,E.MATERIAL],keepAttributes:!0,keepIndices:!0,keepLeaves:!0,keepSolidTextures:!0}),Pt({propertyTypes:[E.ACCESSOR,E.MATERIAL,E.SKIN],keepUniqueNames:!0})),r.debug(`${Ie}: Complete.`)})}function fn(s,e,t,r){const n=e instanceof Rn,i=s.getLogger();for(const o of e.listSemantics()){if(!n&&!r.pattern.test(o)||n&&!r.patternTargets.test(o))continue;const a=e.getAttribute(o),{bits:A,ctor:u}=IA(o,a,i,r);if(!u)continue;if(A<8||A>16)throw new Error(`${Ie}: Requires bits = 8–16.`);if(a.getComponentSize()<=A/8)continue;const f=a.clone();if(o==="POSITION"){const l=t.scale,c=[];e instanceof U?Da(c,vt(t)):Ia(c,[1/l,1/l,1/l]);for(let B=0,h=[0,0,0],g=f.getCount();B<g;B++)f.getElement(B,h),f.setElement(B,ya(h,h,c))}DA(f,u,A),e.setAttribute(o,f)}if(r.normalizeWeights&&e.getAttribute("WEIGHTS_0")&&aA(e,1/0),e instanceof U&&e.getIndices()&&e.listAttributes().length&&e.listAttributes()[0].getCount()<65535){const o=e.getIndices();o.setArray(new Uint16Array(o.getArray()))}}function Bn(s){const{min:e,max:t}=s,r=Math.max((t[0]-e[0])/2,(t[1]-e[1])/2,(t[2]-e[2])/2);return{offset:[e[0]+(t[0]-e[0])/2,e[1]+(t[1]-e[1])/2,e[2]+(t[2]-e[2])/2],scale:r}}function gA(s,e,t){const r=vt(t);for(const n of e.listParents()){if(!(n instanceof hs))continue;const i=n.listParents().filter(c=>c instanceof et),o=i.some(c=>pA.includes(c.getTargetPath())),a=n.listChildren().length>0,A=n.getSkin();if(A){n.setSkin(CA(A,t));continue}const u=n.getExtension("EXT_mesh_gpu_instancing");if(u){n.setExtension("EXT_mesh_gpu_instancing",dA(u,t));continue}let f;a||o?(f=s.createNode("").setMesh(e),n.addChild(f).setMesh(null),i.filter(c=>c.getTargetPath()===hA).forEach(c=>c.setTargetNode(f))):f=n;const l=f.getMatrix();Os(l,l,r),f.setMatrix(l)}}function CA(s,e){s=s.clone();const t=vt(e),r=s.getInverseBindMatrices().clone(),n=[];for(let i=0,o=r.getCount();i<o;i++)r.getElement(i,n),Os(n,n,t),r.setElement(i,n);return s.setInverseBindMatrices(r)}function dA(s,e){var t,r,n;if(!s.getAttribute("TRANSLATION")&&!s.getAttribute("ROTATION")&&!s.getAttribute("SCALE"))return s;s=s.clone();const i=(t=s.getAttribute("TRANSLATION"))==null?void 0:t.clone(),o=(r=s.getAttribute("ROTATION"))==null?void 0:r.clone(),a=(n=s.getAttribute("SCALE"))==null?void 0:n.clone(),A=i||o||a,u=[0,0,0],f=[0,0,0,1],l=[1,1,1],c=[0,0,0],B=[0,0,0,1],h=[1,1,1],g=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],C=vt(e);for(let p=0,y=A.getCount();p<y;p++)H.compose(i?i.getElement(p,c):u,o?o.getElement(p,B):f,a?a.getElement(p,h):l,g),Os(g,g,C),H.decompose(g,c,B,h),i&&i.setElement(p,c),o&&o.setElement(p,B),a&&a.setElement(p,h);return i&&s.setAttribute("TRANSLATION",i),o&&s.setAttribute("ROTATION",o),a&&s.setAttribute("SCALE",a),s}function EA(s,e){for(const t of s.listPrimitives()){let r=t.getMaterial();if(!r)continue;let n=r.getExtension("KHR_materials_volume");!n||n.getThicknessFactor()<=0||(n=n.clone().setThicknessFactor(n.getThicknessFactor()*e),r=r.clone().setExtension("KHR_materials_volume",n),t.setMaterial(r))}}function DA(s,e,t){const r=new e(s.getArray().length),n=uA.includes(e)?1:0,i=t-n,o=e.BYTES_PER_ELEMENT*8-n,a=Math.pow(2,i)-1,A=o-i,u=2*i-o,f=[n>0?-1:0,1];for(let l=0,c=0,B=[];l<s.getCount();l++){s.getElement(l,B);for(let h=0;h<B.length;h++){let g=FA(B[h],f);g=Math.round(Math.abs(g)*a),g=g<<A|g>>u,r[c++]=g*Math.sign(B[h])}}s.setArray(r).setNormalized(!0).setSparse(!1)}function IA(s,e,t,r){const n=e.getMinNormalized([]),i=e.getMaxNormalized([]);let o,a;if(s==="POSITION")o=r.quantizePosition,a=o<=8?Int8Array:Int16Array;else if(s==="NORMAL"||s==="TANGENT")o=r.quantizeNormal,a=o<=8?Int8Array:Int16Array;else if(s.startsWith("COLOR_"))o=r.quantizeColor,a=o<=8?Uint8Array:Uint16Array;else if(s.startsWith("TEXCOORD_")){if(n.some(A=>A<0)||i.some(A=>A>1))return t.warn(`${Ie}: Skipping ${s}; out of [0,1] range.`),{bits:-1};o=r.quantizeTexcoord,a=o<=8?Uint8Array:Uint16Array}else{if(s.startsWith("JOINTS_"))return o=Math.max(...e.getMax([]))<=255?8:16,a=o<=8?Uint8Array:Uint16Array,e.getComponentSize()>o/8&&e.setArray(new a(e.getArray())),{bits:-1};if(s.startsWith("WEIGHTS_")){if(n.some(A=>A<0)||i.some(A=>A>1))return t.warn(`${Ie}: Skipping ${s}; out of [0,1] range.`),{bits:-1};o=r.quantizeWeight,a=o<=8?Uint8Array:Uint16Array}else if(s.startsWith("_")){if(n.some(A=>A<-1)||i.some(A=>A>1))return t.warn(`${Ie}: Skipping ${s}; out of [-1,1] range.`),{bits:-1};o=r.quantizeGeneric,a=n.some(A=>A<0)?a=o<=8?Int8Array:Int16Array:a=o<=8?Uint8Array:Uint16Array}else throw new Error(`${Ie}: Unexpected semantic, "${s}".`)}return{bits:o,ctor:a}}function ln(s){const e=[],t=[];for(const n of s.listPrimitives()){const i=n.getAttribute("POSITION");i&&e.push(i);for(const o of n.listTargets()){const a=o.getAttribute("POSITION");a&&t.push(a)}}if(e.length===0)throw new Error(`${Ie}: Missing "POSITION" attribute.`);const r=hn(e,3);if(t.length>0){const{min:n,max:i}=hn(t,3);ns(r.min,r.min,ns(n,sn(n,n,2),[0,0,0])),rs(r.max,r.max,rs(i,sn(i,i,2),[0,0,0]))}return r}function TA(s,e){const t=e.getComponentSize();if(s==="POSITION"||s==="NORMAL"||s==="TANGENT")return t<4;if(s.startsWith("TEXCOORD_")){const r=e.getComponentType(),n=e.getNormalized();return t<4&&!(n&&r===R.ComponentType.UNSIGNED_BYTE)&&!(n&&r===R.ComponentType.UNSIGNED_SHORT)}return!1}function hr(s){for(const e of s.listSemantics()){const t=s.getAttribute("POSITION");if(TA(e,t))return!0}return s.propertyType===E.PRIMITIVE?s.listTargets().some(hr):!1}function hn(s,e){const t=new Array(e).fill(1/0),r=new Array(e).fill(-1/0),n=[],i=[];for(const o of s){o.getMinNormalized(n),o.getMaxNormalized(i);for(let a=0;a<e;a++)t[a]=Math.min(t[a],n[a]),r[a]=Math.max(r[a],i[a])}return{min:t,max:r}}function mA(s){const e=s[0];for(const t of s)ns(e.min,e.min,t.min),rs(e.max,e.max,t.max);return e}function vt(s){return Ta([],[0,0,0,1],s.offset,[s.scale,s.scale,s.scale])}function FA(s,e){return Math.min(Math.max(s,e[0]),e[1])}Ue({level:"high"},mt);const yA="unweld";function xA(s,e=new Map){const t=s.getIndices();if(!t)return;const r=s.getGraph(),n=Ae.fromGraph(r),i=n.getLogger(),o=s.getAttribute("POSITION").getCount();for(const A of s.listAttributes())s.swap(A,pn(n,A,t,e)),A.listParents().length===1&&A.dispose();for(const A of s.listTargets())for(const u of A.listAttributes())A.swap(u,pn(n,u,t,e)),u.listParents().length===1&&u.dispose();const a=s.getAttribute("POSITION").getCount();i.debug(`${yA}: ${wt(o,a)} vertices.`),s.setIndices(null),t.listParents().length===1&&t.dispose()}function pn(s,e,t,r){if(r.has(e)&&r.get(e).has(t))return r.get(e).get(t);const n=e.getArray(),i=n.constructor,o=new i(t.getCount()*e.getElementSize()),a=t.getArray(),A=e.getElementSize();for(let f=0,l=t.getCount();f<l;f++)for(let c=0;c<A;c++)o[f*A+c]=n[a[f]*A+c];r.has(e)||r.set(e,new Map);const u=$e(s,e).setArray(o);return r.get(e).set(t,u),u}var gn;(function(s){s[s.STEP=0]="STEP",s[s.LERP=1]="LERP",s[s.SLERP=2]="SLERP"})(gn||(gn={}));const MA=1e-6;function RA(s,e,t,r=1e-4){const n=e.length/s.length,i=new Array(n).fill(0),o=new Array(n).fill(0),a=new Array(n).fill(0),A=new Array(n).fill(0),u=s.length-1;let f=1;for(let l=1;l<u;++l){const c=s[f-1],B=s[l],h=s[l+1],g=(B-c)/(h-c);let C=!1;if(B!==h&&(l!==1||B!==s[0]))if(ot(e,f-1,A),ot(e,l,o),ot(e,l+1,a),t==="slerp"){const p=GA(i,A,a,g),y=dn(A,o)+dn(o,a);C=!It(o,p,r)||y+Number.EPSILON>=Math.PI}else if(t==="lerp"){const p=SA(i,A,a,g);C=!It(o,p,r)}else t==="step"&&(C=!It(o,A)||!It(o,a));C&&(l!==f&&(s[f]=s[l],Cn(e,f,ot(e,l,i))),f++)}return u>0&&(s[f]=s[u],Cn(e,f,ot(e,u,i)),f++),f}function ot(s,e,t){for(let r=0,n=t.length;r<n;r++)t[r]=s[e*n+r];return t}function Cn(s,e,t){for(let r=0,n=t.length;r<n;r++)s[e*n+r]=t[r]}function It(s,e,t=0){if(s.length!==e.length)return!1;for(let r=0;r<s.length;r++)if(Math.abs(s[r]-e[r])>t)return!1;return!0}function NA(s,e,t){return s*(1-t)+e*t}function SA(s,e,t,r){for(let n=0;n<e.length;n++)s[n]=NA(e[n],t[n],r);return s}function GA(s,e,t,r){let n=e[0],i=e[1],o=e[2],a=e[3],A=t[0],u=t[1],f=t[2],l=t[3],c,B,h,g,C;return B=n*A+i*u+o*f+a*l,B<0&&(B=-B,A=-A,u=-u,f=-f,l=-l),1-B>MA?(c=Math.acos(B),h=Math.sin(c),g=Math.sin((1-r)*c)/h,C=Math.sin(r*c)/h):(g=1-r,C=r),s[0]=g*n+C*A,s[1]=g*i+C*u,s[2]=g*o+C*f,s[3]=g*a+C*l,s}function dn(s,e){const t=bA(s,e);return Math.acos(2*t*t-1)}function bA(s,e){return s[0]*e[0]+s[1]*e[1]+s[2]*e[2]+s[3]*e[3]}Promise.resolve();const Ke="simplify",{POINTS:pr,LINES:OA,LINE_STRIP:LA,LINE_LOOP:HA,TRIANGLES:wA,TRIANGLE_STRIP:gr,TRIANGLE_FAN:Cr}=U.Mode,dr={ratio:0,error:1e-4,lockBorder:!1,cleanup:!0};function PA(s){const e=rt(dr,s),t=e.simplifier;if(!t)throw new Error(`${Ke}: simplifier dependency required — install "meshoptimizer".`);return nt(Ke,async r=>{const n=r.getLogger();await t.ready,await r.transform(Br({overwrite:!1,cleanup:e.cleanup}));let i=0;for(const o of r.getRoot().listMeshes()){for(const a of o.listPrimitives()){const A=a.getMode();A===wA||A===gr||A===Cr||a.getMode()===pr&&t.simplifyPoints?(En(a,e),he(a,W.RENDER)===0&&a.dispose()):i++}o.listPrimitives().length===0&&o.dispose()}i>0&&n.warn(`${Ke}: Skipping simplification of ${i} primitives: Unsupported draw mode.`),e.cleanup&&await r.transform(_t({propertyTypes:[E.ACCESSOR,E.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),Pt({propertyTypes:[E.ACCESSOR]})),n.debug(`${Ke}: Complete.`)})}function En(s,e){const t=Ue({},dr,e),r=t.simplifier,n=s.getGraph(),i=Ae.fromGraph(n),o=i.getLogger();switch(s.getMode()){case pr:return _A(i,s,t);case OA:case LA:case HA:return o.warn(`${Ke}: Skipping primitive simplification: Unsupported draw mode.`),s;case gr:case Cr:iA(s);break}const a=he(s,W.UPLOAD),A=he(s,W.RENDER);A<a/2&&St(s);const u=s.getAttribute("POSITION"),f=s.getIndices();let l=u.getArray(),c=f.getArray();l instanceof Float32Array||(l=As(l,u.getComponentType(),u.getNormalized())),c instanceof Uint32Array||(c=new Uint32Array(c));const B=Math.floor(t.ratio*A/3)*3,h=t.lockBorder?["LockBorder"]:[],[g,C]=r.simplify(c,l,3,B,t.error,h);s.setIndices($e(i,f).setArray(g)),f.listParents().length===1&&f.dispose(),St(s);const p=he(s,W.UPLOAD);return p<=65534&&s.getIndices().setArray(new Uint16Array(s.getIndices().getArray())),o.debug(`${Ke}: ${wt(a,p)} vertices, error: ${C.toFixed(4)}.`),s}function _A(s,e,t){const r=t.simplifier,n=s.getLogger();e.getIndices()&&xA(e);const o=e.getAttribute("POSITION"),a=e.getAttribute("COLOR_0"),A=o.getCount();let u=o.getArray(),f=a?a.getArray():void 0;const l=a?a.getComponentSize():void 0;u instanceof Float32Array||(u=As(u,o.getComponentType(),o.getNormalized())),f&&!(f instanceof Float32Array)&&(f=As(f,o.getComponentType(),o.getNormalized())),r.useExperimentalFeatures=!0;const c=Math.floor(t.ratio*A),B=r.simplifyPoints(u,3,c,f,l);r.useExperimentalFeatures=!1;const[h,g]=r.compactMesh(B);n.debug(`${Ke}: ${wt(o.getCount(),g)} vertices.`);for(const C of bs(e)){const p=$e(s,C);os(C,null,h,p,g),ha(e,C,p),C.listParents().length===1&&C.dispose()}return e}var cs;(function(s){s.LANCZOS3="lanczos3",s.LANCZOS2="lanczos2"})(cs||(cs={}));cs.LANCZOS3;(function(){var s="B9h79tEBBBENQ9gEUEU9gEUB9gBB9gVUUUUUEU9gDUUEU9gLUUUUEU9gVUUUUUB9gLUUUUB9gIUUUEU9gD99UE99I8ayDILEVLEVLOOOOORRVBWWBEdddLVE9wEIIVIEBEOWEUEC+g/KEKR/QIhO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwvBE8f9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwv9C9v919u9kBDe9tw79o9v9wT9fw9u9j9v9kw9WwvTw949Wwv79p9v9uBIy9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwvBL8e9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwv9C9v919u9kBV8a9tw79o9v9wT9fw9u9j9v9kw69u9kw949Wwv79p9v9uBOe9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jwBRA9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jw9C9v919u9kBWl9tw79o9v9wT9fw9u9j9v9kws9p2Twv9P9jTBdk9tw79o9v9wT9fw9u9j9v9kws9p2Twv9R919hTBQl9tw79o9v9wT9fw9u9j9v9kws9p2Twvt949wBKe9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9owBpA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9ow9TTv9p9wBSA9tw79o9v9wT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E+KJJBh+BJJJBBARC98FHRAOCUFHOXBKKAVC+QDF8kJJJJBK/uLEVUCUAICDTGVAICffffI0eGOCBYD1+KJJBhJJJJBBHRALALYD9gGWCDTFARbDBALAWCEFbD9gABARbDBAOCBYD1+KJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDLCUADCDTADCffffI0eCBYD1+KJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDWABYDBCBAVZ+TJJJB8aADCI9uHWDNADtMBABYDBHOAEHLADHRINAOALYDBCDTFGVAVYDBCEFbDBALCLFHLARCUFGRMBKKDNAItMBABYDBHLABYDLHRCBHVAIHOINARAVbDBARCLFHRALYDBAVFHVALCLFHLAOCUFGOMBKKDNADCI6MBAWCEAWCE0eHdABYDLHRABYDWHVCBHLINAECWFYDBHOAECLFYDBHDARAEYDBCDTFGWAWYDBGWCEFbDBAVAWCDTFALbDBARADCDTFGDADYDBGDCEFbDBAVADCDTFALbDBARAOCDTFGOAOYDBGOCEFbDBAVAOCDTFALbDBAECXFHEAdALCEFGL9HMBKKDNAItMBABYDLHEABYDBHLINAEAEYDBALYDB9rbDBALCLFHLAECLFHEAICUFGIMBKKKqBABAEADAIC+01JJBZ+MJJJBKqBABAEADAIC+c+JJJBZ+MJJJBK9dEEUABCfEAICDTZ+TJJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD+M+KJJBGEABCIFC98gFGBbD+M+KJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB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+/w+nOzBBBB+wv9o8+UF888+9I/h/68+9C9g/l89/N/M9M89/d8kO8+BBBBF+8Tz9M836zs+2azl/Zpzz818ez9E+LXz/u98f8+819e/68+BC+EQKXEBBBDBBBAwBB",e=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var t,r=WebAssembly.instantiate(n(s),{}).then(function(c){t=c.instance,t.exports.__wasm_call_ctors(),t.exports.meshopt_encodeVertexVersion(0),t.exports.meshopt_encodeIndexVersion(1)});function n(c){for(var B=new Uint8Array(c.length),h=0;h<c.length;++h){var g=c.charCodeAt(h);B[h]=g>96?g-71:g>64?g-65:g>47?g+4:g>46?63:62}for(var C=0,h=0;h<c.length;++h)B[C++]=B[h]<60?e[B[h]]:(B[h]-60)*64+B[++h];return B.buffer.slice(0,C)}function i(c){if(!c)throw new Error("Assertion failed")}function o(c){return new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}function a(c,B,h){var g=t.exports.sbrk,C=g(c.length*4),p=g(B*4),y=new Uint8Array(t.exports.memory.buffer),D=o(c);y.set(D,C),h&&h(C,C,c.length,B);var T=t.exports.meshopt_optimizeVertexFetchRemap(p,C,c.length,B);y=new Uint8Array(t.exports.memory.buffer);var I=new Uint32Array(B);new Uint8Array(I.buffer).set(y.subarray(p,p+B*4)),D.set(y.subarray(C,C+c.length*4)),g(C-g(0));for(var m=0;m<c.length;++m)c[m]=I[c[m]];return[I,T]}function A(c,B,h,g,C){var p=t.exports.sbrk,y=p(B),D=p(g*C),T=new Uint8Array(t.exports.memory.buffer);T.set(o(h),D);var I=c(y,B,D,g,C),m=new Uint8Array(I);return m.set(T.subarray(y,y+I)),p(y-p(0)),m}function u(c){for(var B=0,h=0;h<c.length;++h){var g=c[h];B=B<g?g:B}return B}function f(c,B){if(i(B==2||B==4),B==4)return new Uint32Array(c.buffer,c.byteOffset,c.byteLength/4);var h=new Uint16Array(c.buffer,c.byteOffset,c.byteLength/2);return new Uint32Array(h)}function l(c,B,h,g,C,p){var y=t.exports.sbrk,D=y(h*g),T=y(h*p),I=new Uint8Array(t.exports.memory.buffer);I.set(o(B),T),c(D,h,g,C,T);var m=new Uint8Array(h*g);return m.set(I.subarray(D,D+h*g)),y(D-y(0)),m}return{ready:r,supported:!0,reorderMesh:function(c,B,h){var g=B?h?t.exports.meshopt_optimizeVertexCacheStrip:t.exports.meshopt_optimizeVertexCache:void 0;return a(c,u(c)+1,g)},encodeVertexBuffer:function(c,B,h){i(h>0&&h<=256),i(h%4==0);var g=t.exports.meshopt_encodeVertexBufferBound(B,h);return A(t.exports.meshopt_encodeVertexBuffer,g,c,B,h)},encodeIndexBuffer:function(c,B,h){i(h==2||h==4),i(B%3==0);var g=f(c,h),C=t.exports.meshopt_encodeIndexBufferBound(B,u(g)+1);return A(t.exports.meshopt_encodeIndexBuffer,C,g,B,4)},encodeIndexSequence:function(c,B,h){i(h==2||h==4);var g=f(c,h),C=t.exports.meshopt_encodeIndexSequenceBound(B,u(g)+1);return A(t.exports.meshopt_encodeIndexSequence,C,g,B,4)},encodeGltfBuffer:function(c,B,h,g){var C={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return i(C[g]),C[g](c,B,h)},encodeFilterOct:function(c,B,h,g){return i(h==4||h==8),i(g>=1&&g<=16),l(t.exports.meshopt_encodeFilterOct,c,B,h,g,16)},encodeFilterQuat:function(c,B,h,g){return i(h==8),i(g>=4&&g<=16),l(t.exports.meshopt_encodeFilterQuat,c,B,h,g,16)},encodeFilterExp:function(c,B,h,g){return i(h>0&&h%4==0),i(g>=1&&g<=24),l(t.exports.meshopt_encodeFilterExp,c,B,h,g,h)}}})();(function(){var s="B9h79tEBBBE8fV9gBB9gVUUUUUEU9gIUUUB9gEUEU9g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ce86BBAOC97FAaAcFGarBBAoCIgGoAoCIsGoe86BBAOC98FAaAoFGorBBALrBIGLCO4GaAaCIsGae86BBAOC99FAoAaFGorBBALCL4CIgGaAaCIsGae86BBAOC9+FAoAaFGorBBALCD4CIgGaAaCIsGae86BBAOCUFAoAaFGOrBBALCIgGLALCIsGLe86BBAOALFHLXDKAoALrBWALrBBGaCL4GcAcCSsGce86BBAOCgFALCWFAcFGorBBAaCSgGaAaCSsGae86BBAOCvFAoAaFGorBBALrBEGaCL4GcAcCSsGce86BBAOC7FAoAcFGorBBAaCSgGaAaCSsGae86BBAOCTFAoAaFGorBBALrBDGaCL4GcAcCSsGce86BBAOC91FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC4FAoAaFGorBBALrBIGaCL4GcAcCSsGce86BBAOC93FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC94FAoAaFGorBBALrBLGaCL4GcAcCSsGce86BBAOC95FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC96FAoAaFGorBBALrBVGaCL4GcAcCSsGce86BBAOC97FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC98FAoAaFGorBBALrBOGaCL4GcAcCSsGce86BBAOC99FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC9+FAoAaFGorBBALrBRGLCL4GaAaCSsGae86BBAOCUFAoAaFGOrBBALCSgGLALCSsGLe86BBAOALFHLXEKAoAL8pBB83BBAoCWFALCWF8pBB83BBALCZFHLKDNAIAM9PMBAICZFHOARAL9rCl0MEKKAIAM6MIALtMIDNAKtMBAWApFrBBHoCBHOAZHIINAIAWCJ/CBFAOFrBBGaCE4CBAaCEg9r7AoFGo86BBAIADFHIAOCEFGOAK9HMBKKAZCEFHZApCEFGpAD6HSALHhApAD9HMEXVKKCBHLASCEgMDXIKALAXAD2FHcDNAKtMBCBHhCEHSAWCJDFHMINARAL9rAX6MIALtMDALAXFHLAWAhFrBBHoCBHOAMHIINAIAWCJ/CBFAOFrBBGaCE4CBAaCEg9r7AoFGo86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DBABCLFHBAECUFGEMBKKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABKKKEBCJWKLZ9kBB",e="B9h79tEBBBEkL9gBB9gVUUUUUEU9gIUUUB9gEUEUIKQBBEBEEDDDILVE9wEEEVIEBEOWEUEC+Q/aEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBDy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBLe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBOk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBRl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBWL79iv9rBdQ/T9TQLBZIK9+EVU8jJJJJBCZ9rHBCBHEINCBHDCBHIINABCWFADFAICJUAEAD4CEgGLe86BBAIALFHIADCEFGDCW9HMBKAEC+Q+YJJBFAI86BBAECITC+Q1JJBFAB8pIW83IBAECEFGECJD9HMBKK/H8jLhUD97EUO978jJJJJBCJ/KB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P+sEP/6EP/mEGQAQP/mEP/kEP/kEP/lEPXBBBBBBBBBBBBBBBBP+4EP/jEPXB/+fsB/+fsB/+fsB/+fsGKP/mEPXBBN0BBN0BBN0BBN0GRP/kEPXffBBffBBffBBffBBGMP9OAXAKP/mEARP/kECZP+rEP9QGXAQAKP/mEARP/kECZP+rEAdAKP/mEARP/kEAMP9OP9QGKPMBEZhDIoaLVcxORqlGRP5BAIPBLAPeB+t+J83IBAIARP5EAIPBLAPeE+t+J83IWAIAXAKPMWdkyQK8aeXM35pS8e8fGKP5BAIPBLAPeD+t+J83IZAIAKP5EAIPBLAPeI+t+J83IkKAWAIAO/8QBBKK+pDDIUE978jJJJJBC/AB9rHIDNADCD4AE2GLC98gGVtMBCBHDABHEINAEAEPBBBGOCWP+rECWP+sEP/6EAOCEP+sEPXBBJzBBJzBBJzBBJzP+uEPXBBJfBBJfBBJfBBJfP9OP/mEPKBBAECZFHEADCLFGDAV6MBKKDNAVAL9PMBAIALCIgGDCDTGEvCBC/ABAE9r/8KBAIABAVCDTFGVAE/8QBBDNADtMBAIAIPBLBGOCWP+rECWP+sEP/6EAOCEP+sEPXBBJzBBJzBBJzBBJzP+uEPXBBJfBBJfBBJfBBJfP9OP/mEPKLBKAVAIAE/8QBBKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIKKKEBCJWKLZ9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n=s;WebAssembly.validate(t)&&(n=e);var i,o=WebAssembly.instantiate(a(n),{}).then(function(l){i=l.instance,i.exports.__wasm_call_ctors()});function a(l){for(var c=new Uint8Array(l.length),B=0;B<l.length;++B){var h=l.charCodeAt(B);c[B]=h>96?h-71:h>64?h-65:h>47?h+4:h>46?63:62}for(var g=0,B=0;B<l.length;++B)c[g++]=c[B]<60?r[c[B]]:(c[B]-60)*64+c[++B];return c.buffer.slice(0,g)}function A(l,c,B,h,g,C){var p=i.exports.sbrk,y=B+3&-4,D=p(y*h),T=p(g.length),I=new Uint8Array(i.exports.memory.buffer);I.set(g,T);var m=l(D,B,h,T,g.length);if(m==0&&C&&C(D,y,h),c.set(I.subarray(D,D+B*h)),p(D-p(0)),m!=0)throw new Error("Malformed buffer data: "+m)}var u={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},f={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:o,supported:!0,decodeVertexBuffer:function(l,c,B,h,g){A(i.exports.meshopt_decodeVertexBuffer,l,c,B,h,i.exports[u[g]])},decodeIndexBuffer:function(l,c,B,h){A(i.exports.meshopt_decodeIndexBuffer,l,c,B,h)},decodeIndexSequence:function(l,c,B,h){A(i.exports.meshopt_decodeIndexSequence,l,c,B,h)},decodeGltfBuffer:function(l,c,B,h,g,C){A(i.exports[f[g]],l,c,B,h,i.exports[u[C]])}}})();var vA=function(){var s="B9h79tEBBBECd9gEUEU9gEUB9gBB9gQUUUUUUU99UUEU9gVUUUUUB9gLUUUUE999gIUUUE999gLUUUUEU9gIUUUEUIMXDILVORBWWBEWLVE9w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AICDTZ1JJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD/01JJBGEABCIFC98gFGBbD/01JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABK9TEIUCBCBYD/01JJBGEABCIFC98gFGBbD/01JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK9+EIUzBHEDNDNCBYD/01JJBGDAECZTGI9NMBCUHEADAI9rCffIFCZ4NBCUsMEKADHEKCBABAE9rCIFC98gCBYD/01JJBFGDbD/01JJBDNADzBCZTGE9NMBADAE9rCffIFCZ4NB8aKK6EIUCBHIDNADtMBDNINABrBBGLAErBBGV9HMEAECEFHEABCEFHBADCUFGDMBXDKKALAV9rHIKAIKK+CEDBCJWK9pffUUffUUffUUffUfffUfffUfBBBBBBBBEEEBEEBEBBEEEBEBBBBBEBEBBBBBEBBBDBBBBBBBBBBBBBBBEEEEEBEBBBBBEBBBBBEEBBBBBBC/sWKXEBBBDBBBJ9kBB",e=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var t,r=WebAssembly.instantiate(n(s),{}).then(function(c){t=c.instance,t.exports.__wasm_call_ctors()});function n(c){for(var B=new Uint8Array(c.length),h=0;h<c.length;++h){var g=c.charCodeAt(h);B[h]=g>96?g-71:g>64?g-65:g>47?g+4:g>46?63:62}for(var C=0,h=0;h<c.length;++h)B[C++]=B[h]<60?e[B[h]]:(B[h]-60)*64+B[++h];return B.buffer.slice(0,C)}function i(c){if(!c)throw new Error("Assertion failed")}function o(c){return new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}function a(c,B){var h=t.exports.sbrk,g=h(c.length*4),C=h(B*4),p=new Uint8Array(t.exports.memory.buffer),y=o(c);p.set(y,g);var D=t.exports.meshopt_optimizeVertexFetchRemap(C,g,c.length,B);p=new Uint8Array(t.exports.memory.buffer);var T=new Uint32Array(B);new Uint8Array(T.buffer).set(p.subarray(C,C+B*4)),y.set(p.subarray(g,g+c.length*4)),h(g-h(0));for(var I=0;I<c.length;++I)c[I]=T[c[I]];return[T,D]}function A(c){for(var B=0,h=0;h<c.length;++h){var g=c[h];B=B<g?g:B}return B}function u(c,B,h,g,C,p,y,D,T){var I=t.exports.sbrk,m=I(4),d=I(h*4),F=I(C*p),x=I(h*4),M=new Uint8Array(t.exports.memory.buffer);M.set(o(g),F),M.set(o(B),x);var N=c(d,x,h,F,C,p,y,D,T,m);M=new Uint8Array(t.exports.memory.buffer);var G=new Uint32Array(N);o(G).set(M.subarray(d,d+N*4));var S=new Float32Array(1);return o(S).set(M.subarray(m,m+4)),I(m-I(0)),[G,S[0]]}function f(c,B,h,g){var C=t.exports.sbrk,p=C(h*g),y=new Uint8Array(t.exports.memory.buffer);y.set(o(B),p);var D=c(p,h,g);return C(p-C(0)),D}var l={LockBorder:1};return{ready:r,supported:!0,compactMesh:function(c){i(c instanceof Uint32Array||c instanceof Int32Array||c instanceof Uint16Array||c instanceof Int16Array),i(c.length%3==0);var B=c.BYTES_PER_ELEMENT==4?c:new Uint32Array(c);return a(B,A(c)+1)},simplify:function(c,B,h,g,C,p){i(c instanceof Uint32Array||c instanceof Int32Array||c instanceof Uint16Array||c instanceof Int16Array),i(c.length%3==0),i(B instanceof Float32Array),i(B.length%h==0),i(h>=3),i(g%3==0);for(var y=0,D=0;D<(p?p.length:0);++D)y|=l[p[D]];var T=c.BYTES_PER_ELEMENT==4?c:new Uint32Array(c),I=u(t.exports.meshopt_simplify,T,c.length,B,B.length,h*4,g,C,y);return I[0]=c instanceof Uint32Array?I[0]:new c.constructor(I[0]),I},getScale:function(c,B){return i(c instanceof Float32Array),i(c.length%B==0),f(t.exports.meshopt_simplifyScale,c,c.length,B*4)}}}();const KA=new Dn.GLTFExporter,us=new ri;us.registerExtensions([Gs]);const JA=()=>{const s=Dr.useRef(null);async function e(o){const a=await KA.parseAsync(o,{binary:!0});s.current=await us.readBinary(new Uint8Array(a))}async function t(){if(!s.current)return;const o=await s.current.transform(oA(),un(),Br(),PA({simplifier:vA,ratio:.1,error:1e-4}));s.current=o}async function r(){if(!s.current)return;const o=await s.current.transform(Pt({}));s.current=o}async function n(){if(!s.current)return;const o=await s.current.transform(un({}));s.current=o}async function i(){if(s.current)return await us.writeBinary(s.current)}return{load:e,getModel:i,simplifyOptimization:t,dedupOptimization:r,quantizeOptimization:n}};exports.useOptimizeModel=JA;