@loaders.gl/gltf 3.0.9 → 3.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.es5.min.js +1 -1
- package/dist/dist.es5.min.js.map +1 -1
- package/dist/dist.min.js +1 -1
- package/dist/dist.min.js.map +1 -1
- package/dist/es5/bundle.js +2 -2
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/glb-loader.js +10 -33
- package/dist/es5/glb-loader.js.map +1 -1
- package/dist/es5/glb-writer.js +9 -8
- package/dist/es5/glb-writer.js.map +1 -1
- package/dist/es5/gltf-loader.js +14 -52
- package/dist/es5/gltf-loader.js.map +1 -1
- package/dist/es5/gltf-writer.js +10 -10
- package/dist/es5/gltf-writer.js.map +1 -1
- package/dist/es5/index.js +7 -7
- package/dist/es5/lib/api/gltf-scenegraph.js +447 -541
- package/dist/es5/lib/api/gltf-scenegraph.js.map +1 -1
- package/dist/es5/lib/api/normalize-gltf-v1.js +150 -280
- package/dist/es5/lib/api/normalize-gltf-v1.js.map +1 -1
- package/dist/es5/lib/api/post-process-gltf.js +279 -354
- package/dist/es5/lib/api/post-process-gltf.js.map +1 -1
- package/dist/es5/lib/encoders/encode-glb.js +19 -22
- package/dist/es5/lib/encoders/encode-glb.js.map +1 -1
- package/dist/es5/lib/encoders/encode-gltf.js +3 -5
- package/dist/es5/lib/encoders/encode-gltf.js.map +1 -1
- package/dist/es5/lib/extensions/EXT_meshopt_compression.js +34 -99
- package/dist/es5/lib/extensions/EXT_meshopt_compression.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_binary_gltf.js +8 -22
- package/dist/es5/lib/extensions/KHR_binary_gltf.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js +70 -244
- package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_lights_punctual.js +38 -102
- package/dist/es5/lib/extensions/KHR_lights_punctual.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_materials_unlit.js +22 -67
- package/dist/es5/lib/extensions/KHR_materials_unlit.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_techniques_webgl.js +32 -88
- package/dist/es5/lib/extensions/KHR_techniques_webgl.js.map +1 -1
- package/dist/es5/lib/extensions/gltf-extensions.js +17 -67
- package/dist/es5/lib/extensions/gltf-extensions.js.map +1 -1
- package/dist/es5/lib/gltf-utils/get-typed-array.js +6 -6
- package/dist/es5/lib/gltf-utils/get-typed-array.js.map +1 -1
- package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js +19 -21
- package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js.map +1 -1
- package/dist/es5/lib/gltf-utils/gltf-constants.js +13 -13
- package/dist/es5/lib/gltf-utils/gltf-constants.js.map +1 -1
- package/dist/es5/lib/gltf-utils/gltf-utils.js +16 -16
- package/dist/es5/lib/gltf-utils/gltf-utils.js.map +1 -1
- package/dist/es5/lib/gltf-utils/resolve-url.js +2 -2
- package/dist/es5/lib/gltf-utils/resolve-url.js.map +1 -1
- package/dist/es5/lib/parsers/parse-glb.js +34 -38
- package/dist/es5/lib/parsers/parse-glb.js.map +1 -1
- package/dist/es5/lib/parsers/parse-gltf.js +80 -215
- package/dist/es5/lib/parsers/parse-gltf.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/es5/lib/utils/version.js.map +1 -1
- package/dist/es5/meshopt/meshopt-decoder.js +46 -197
- package/dist/es5/meshopt/meshopt-decoder.js.map +1 -1
- package/dist/esm/lib/api/gltf-scenegraph.js +1 -1
- package/dist/esm/lib/api/gltf-scenegraph.js.map +1 -1
- package/dist/esm/lib/api/normalize-gltf-v1.js +3 -3
- package/dist/esm/lib/api/normalize-gltf-v1.js.map +1 -1
- package/dist/esm/lib/api/post-process-gltf.js +12 -12
- package/dist/esm/lib/api/post-process-gltf.js.map +1 -1
- package/dist/esm/lib/gltf-utils/resolve-url.js +1 -1
- package/dist/esm/lib/gltf-utils/resolve-url.js.map +1 -1
- package/dist/esm/lib/parsers/parse-glb.js +2 -6
- package/dist/esm/lib/parsers/parse-glb.js.map +1 -1
- package/dist/esm/lib/parsers/parse-gltf.js +1 -1
- package/dist/esm/lib/parsers/parse-gltf.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/esm/lib/utils/version.js.map +1 -1
- package/dist/esm/meshopt/meshopt-decoder.js +1 -1
- package/dist/esm/meshopt/meshopt-decoder.js.map +1 -1
- package/package.json +6 -6
package/dist/dist.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(r,s,function(t){return e[t]}.bind(null,s));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";(function(e,r){n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return a}));const s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==e&&e,document:"undefined"!=typeof document&&document},i=s.global||s.self||s.window||{},o="object"!=typeof r||"[object process]"!==String(r)||r.browser,a="function"==typeof importScripts,c=("undefined"!=typeof window&&window.orientation,void 0!==r&&r.version&&/v([0-9]*)/.exec(r.version));c&&parseFloat(c[1])}).call(this,n(4),n(6))},function(e,t,n){"use strict";(function(e,r){n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o}));const s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==e&&e,document:"undefined"!=typeof document&&document},i=s.global||s.self||s.window,o="object"!=typeof r||"[object process]"!==String(r)||r.browser,a=void 0!==r&&r.version&&/v([0-9]*)/.exec(r.version);a&&parseFloat(a[1])}).call(this,n(4),n(6))},function(e,t){},,function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){},function(e,t){var n,r,s=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,u=[],f=!1,d=-1;function l(){f&&c&&(f=!1,c.length?u=c.concat(u):d=-1,u.length&&h())}function h(){if(!f){var e=a(l);f=!0;for(var t=u.length;t;){for(c=u,u=[];++d<t;)c&&c[d].run();d=-1,t=u.length}c=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function g(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new m(e,t)),1!==u.length||f||a(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=g,s.addListener=g,s.once=g,s.off=g,s.removeListener=g,s.removeAllListeners=g,s.emit=g,s.prependListener=g,s.prependOnceListener=g,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},,function(e,t,n){(function(t){const r=n(11),s="undefined"==typeof window?t:window;s.loaders=s.loaders||{},e.exports=Object.assign(s.loaders,r)}).call(this,n(4))},,,function(e,t,n){"use strict";n.r(t),n.d(t,"KHR_DRACO_MESH_COMPRESSION",(function(){return a})),n.d(t,"GLTFLoader",(function(){return mt})),n.d(t,"GLTFWriter",(function(){return wt})),n.d(t,"GLBLoader",(function(){return Tt})),n.d(t,"GLBWriter",(function(){return _t})),n.d(t,"GLTFScenegraph",(function(){return Ne})),n.d(t,"postProcessGLTF",(function(){return ot}));var r={};n.r(r),n.d(r,"decode",(function(){return Ce})),n.d(r,"encode",(function(){return Pe}));var s={};n.r(s),n.d(s,"decode",(function(){return qe})),n.d(s,"encode",(function(){return Ge}));var i={};n.r(i),n.d(i,"decode",(function(){return $e})),n.d(i,"encode",(function(){return He}));var o={};n.r(o),n.d(o,"decode",(function(){return Ke})),n.d(o,"encode",(function(){return We}));const a="KHR_draco_mesh_compression";function c(e,t){if(!e)throw new Error(t)}var u=n(1);const{_parseImageNode:f}=u.a,d="undefined"!=typeof Image,l="undefined"!=typeof ImageBitmap,h=Boolean(f),m=!!u.b||h;function g(e){const t=y(e);if(!t)throw new Error("Not an image");return t}function b(e){switch(g(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function y(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&e instanceof Image?"image":e&&"object"==typeof e&&e.data&&e.width&&e.height?"data":null}const p=/^data:image\/svg\+xml/,w=/\.svg((\?|#).*)?$/;function T(e){return e&&(p.test(e)||w.test(e))}function v(e,t){if(T(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function _(e,t,n){const r=function(e,t){if(T(t)){const t=(new TextDecoder).decode(e);return"data:image/svg+xml;base64,"+btoa(t)}return v(e,t)}(e,n),s=self.URL||self.webkitURL,i="string"!=typeof r&&s.createObjectURL(r);try{return await async function(e,t){const n=new Image;if(n.src=e,t.image&&t.image.decode&&n.decode)return await n.decode(),n;return await new Promise((t,r)=>{try{n.onload=()=>t(n),n.onerror=t=>r(new Error(`Could not load image ${e}: ${t}`))}catch(e){r(e)}})}(i||r,t)}finally{i&&s.revokeObjectURL(i)}}const x={};let A=!0;async function I(e,t,n){let r;if(T(n)){r=await _(e,t,n)}else r=v(e,n);const s=t&&t.imagebitmap;return await async function(e,t=null){!function(e){for(const t in e||x)return!1;return!0}(t)&&A||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),A=!1}return await createImageBitmap(e)}(r,s)}function j(e){const t=E(e);return function(e){const t=E(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,!1)))return null;return{mimeType:"image/png",width:t.getUint32(16,!1),height:t.getUint32(20,!1)}}(t)||function(e){const t=E(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,!1)&&255===t.getUint8(2)))return null;const{tableMarkers:n,sofMarkers:r}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let s=2;for(;s+9<t.byteLength;){const e=t.getUint16(s,!1);if(r.has(e))return{mimeType:"image/jpeg",height:t.getUint16(s+5,!1),width:t.getUint16(s+7,!1)};if(!n.has(e))return null;s+=2,s+=t.getUint16(s,!1)}return null}(t)||function(e){const t=E(e);if(!(t.byteLength>=10&&1195984440===t.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:t.getUint16(6,!0),height:t.getUint16(8,!0)}}(t)||function(e){const t=E(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,!1)&&t.getUint32(2,!0)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,!0),height:t.getUint32(22,!0)}}(t)}function E(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}const O={id:"image",module:"images",name:"Images",version:"3.0.9",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(e,t,n){const r=((t=t||{}).image||{}).type||"auto",{url:s}=n||{};let i;switch(function(e){switch(e){case"auto":case"data":return function(){if(l)return"imagebitmap";if(d)return"image";if(m)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return l||d||m;case"imagebitmap":return l;case"image":return d;case"data":return m;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}(e),e}}(r)){case"imagebitmap":i=await I(e,t,s);break;case"image":i=await _(e,t,s);break;case"data":i=await function(e,t){const{mimeType:n}=j(e)||{},{_parseImageNode:r}=u.a;return c(r),r(e,n,t)}(e,t);break;default:c(!1)}return"data"===r&&(i=b(i)),i},tests:[e=>Boolean(j(new DataView(e)))],options:{image:{type:"auto",decode:!0}}};function S(e,t,n){if(e.byteLength<=t+n)return"";const r=new DataView(e);let s="";for(let e=0;e<n;e++)s+=String.fromCharCode(r.getUint8(t+e));return s}function U(e){try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse JSON from data starting with "${function(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return S(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return S(e,0,t)}return""}(e)}"`)}}n(5);function M(e,t,n){const r=void 0!==n?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}function L(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function R(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;const n=t.baseUri||t.uri;if(!n)throw new Error("'baseUri' must be provided to resolve relative url "+e);return n.substr(0,n.lastIndexOf("/")+1)+e}function B(e,t,n){const r=e.bufferViews[n];L(r);const s=t[r.buffer];L(s);const i=(r.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,i,r.byteLength)}const F={name:"Draco",id:"draco",module:"draco",version:"3.0.9",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class N{constructor(e,t){D(this,"fields",void 0),D(this,"metadata",void 0),function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}(Array.isArray(e)),function(e){const t={};for(const n of e)t[n.name]&&console.warn("Schema: duplicated field name",n.name,n),t[n.name]=!0}(e),this.fields=e,this.metadata=t||new Map}compareTo(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(let t=0;t<this.fields.length;++t)if(!this.fields[t].compareTo(e.fields[t]))return!1;return!0}select(...e){const t=Object.create(null);for(const n of e)t[n]=!0;const n=this.fields.filter(e=>t[e.name]);return new N(n,this.metadata)}selectAt(...e){const t=e.map(e=>this.fields[e]).filter(Boolean);return new N(t,this.metadata)}assign(e){let t,n=this.metadata;if(e instanceof N){const r=e;t=r.fields,n=V(V(new Map,this.metadata),r.metadata)}else t=e;const r=Object.create(null);for(const e of this.fields)r[e.name]=e;for(const e of t)r[e.name]=e;const s=Object.values(r);return new N(s,n)}}function V(e,t){return new Map([...e||new Map,...t||new Map])}let C,P,z,k,q,G,$,H;function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(C||(C={}));class W{static isNull(e){return e&&e.typeId===C.Null}static isInt(e){return e&&e.typeId===C.Int}static isFloat(e){return e&&e.typeId===C.Float}static isBinary(e){return e&&e.typeId===C.Binary}static isUtf8(e){return e&&e.typeId===C.Utf8}static isBool(e){return e&&e.typeId===C.Bool}static isDecimal(e){return e&&e.typeId===C.Decimal}static isDate(e){return e&&e.typeId===C.Date}static isTime(e){return e&&e.typeId===C.Time}static isTimestamp(e){return e&&e.typeId===C.Timestamp}static isInterval(e){return e&&e.typeId===C.Interval}static isList(e){return e&&e.typeId===C.List}static isStruct(e){return e&&e.typeId===C.Struct}static isUnion(e){return e&&e.typeId===C.Union}static isFixedSizeBinary(e){return e&&e.typeId===C.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===C.FixedSizeList}static isMap(e){return e&&e.typeId===C.Map}static isDictionary(e){return e&&e.typeId===C.Dictionary}get typeId(){return C.NONE}compareTo(e){return this===e}}Symbol.toStringTag;Symbol.toStringTag;P=Symbol.toStringTag;class X extends W{constructor(e,t){super(),K(this,"isSigned",void 0),K(this,"bitWidth",void 0),this.isSigned=e,this.bitWidth=t}get typeId(){return C.Int}get[P](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class Q extends X{constructor(){super(!0,8)}}class J extends X{constructor(){super(!0,16)}}class Y extends X{constructor(){super(!0,32)}}class Z extends X{constructor(){super(!1,8)}}class ee extends X{constructor(){super(!1,16)}}class te extends X{constructor(){super(!1,32)}}const ne=32,re=64;z=Symbol.toStringTag;class se extends W{constructor(e){super(),K(this,"precision",void 0),this.precision=e}get typeId(){return C.Float}get[z](){return"Float"}toString(){return"Float"+this.precision}}class ie extends se{constructor(){super(ne)}}class oe extends se{constructor(){super(re)}}Symbol.toStringTag;Symbol.toStringTag;k=Symbol.toStringTag;q=Symbol.toStringTag;G=Symbol.toStringTag;$=Symbol.toStringTag;H=Symbol.toStringTag;class ae extends W{constructor(e,t){super(),K(this,"listSize",void 0),K(this,"children",void 0),this.listSize=e,this.children=[t]}get typeId(){return C.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[H](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ue{constructor(e,t,n=!1,r=new Map){ce(this,"name",void 0),ce(this,"type",void 0),ce(this,"nullable",void 0),ce(this,"metadata",void 0),this.name=e,this.type=t,this.nullable=n,this.metadata=r}get typeId(){return this.type&&this.type.typeId}clone(){return new ue(this.name,this.type,this.nullable,this.metadata)}compareTo(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}function fe(e,t,n){const r=n?de(n.metadata):void 0,s=function(e){switch(e.constructor){case Int8Array:return new Q;case Uint8Array:return new Z;case Int16Array:return new J;case Uint16Array:return new ee;case Int32Array:return new Y;case Uint32Array:return new te;case Float32Array:return new ie;case Float64Array:return new oe;default:throw new Error("array type not supported")}}(t.value);return new ue(e,new ae(t.size,new ue("value",s)),!1,r)}function de(e){const t=new Map;for(const n in e)t.set(n+".string",JSON.stringify(e[n]));return t}function le(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const he={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},me={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class ge{constructor(e){le(this,"draco",void 0),le(this,"decoder",void 0),le(this,"metadataQuerier",void 0),this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,t={}){const n=new this.draco.DecoderBuffer;n.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const r=this.decoder.GetEncodedGeometryType(n),s=r===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let e;switch(r){case this.draco.TRIANGULAR_MESH:e=this.decoder.DecodeBufferToMesh(n,s);break;case this.draco.POINT_CLOUD:e=this.decoder.DecodeBufferToPointCloud(n,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!e.ok()||!s.ptr){const t="DRACO decompression failed: "+e.error_msg();throw new Error(t)}const i=this._getDracoLoaderData(s,r,t),o=this._getMeshData(s,i,t),a=function(e){let t=1/0,n=1/0,r=1/0,s=-1/0,i=-1/0,o=-1/0;const a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let e=0;e<c;e+=3){const c=a[e],u=a[e+1],f=a[e+2];t=c<t?c:t,n=u<n?u:n,r=f<r?f:r,s=c>s?c:s,i=u>i?u:i,o=f>o?f:o}return[[t,n,r],[s,i,o]]}(o.attributes),c=function(e,t,n){const r=de(t.metadata),s=[],i=function(e){const t={};for(const n in e){const r=e[n];t[r.name||"undefined"]=r}return t}(t.attributes);for(const t in e){const n=fe(t,e[t],i[t]);s.push(n)}if(n){const e=fe("indices",n);s.push(e)}return new N(s,r)}(o.attributes,i,o.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:a},...o,schema:c}}finally{this.draco.destroy(n),s&&this.draco.destroy(s)}}_getDracoLoaderData(e,t,n){const r=this._getTopLevelMetadata(e),s=this._getDracoAttributes(e,n);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:r,attributes:s}}_getDracoAttributes(e,t){const n={};for(let r=0;r<e.num_attributes();r++){const s=this.decoder.GetAttribute(e,r),i=this._getAttributeMetadata(e,r);n[s.unique_id()]={unique_id:s.unique_id(),attribute_type:s.attribute_type(),data_type:s.data_type(),num_components:s.num_components(),byte_offset:s.byte_offset(),byte_stride:s.byte_stride(),normalized:s.normalized(),attribute_index:r,metadata:i};const o=this._getQuantizationTransform(s,t);o&&(n[s.unique_id()].quantization_transform=o);const a=this._getOctahedronTransform(s,t);a&&(n[s.unique_id()].octahedron_transform=a)}return n}_getMeshData(e,t,n){const r=this._getMeshAttributes(t,e,n);if(!r.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:r,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:r,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:r}}_getMeshAttributes(e,t,n){const r={};for(const s of Object.values(e.attributes)){const e=this._deduceAttributeName(s,n);s.name=e;const{value:i,size:o}=this._getAttributeValues(t,s);r[e]={value:i,size:o,byteOffset:s.byte_offset,byteStride:s.byte_stride,normalized:s.normalized}}return r}_getTriangleListIndices(e){const t=3*e.num_faces(),n=4*t,r=this.draco._malloc(n);try{return this.decoder.GetTrianglesUInt32Array(e,n,r),new Uint32Array(this.draco.HEAPF32.buffer,r,t).slice()}finally{this.draco._free(r)}}_getTriangleStripIndices(e){const t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),function(e){const t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){const n=me[t.data_type],r=t.num_components,s=e.num_points()*r,i=s*n.BYTES_PER_ELEMENT,o=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}(this.draco,n);let a;const c=this.draco._malloc(i);try{const r=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,r,o,i,c),a=new n(this.draco.HEAPF32.buffer,c,s).slice()}finally{this.draco._free(c)}return{value:a,size:r}}_deduceAttributeName(e,t){const n=e.unique_id;for(const[e,r]of Object.entries(t.extraAttributes||{}))if(r===n)return e;const r=e.attribute_type;for(const e in he){if(this.draco[e]===r)return he[e]}const s=t.attributeNameEntry||"name";return e.metadata[s]?e.metadata[s].string:"CUSTOM_ATTRIBUTE_"+n}_getTopLevelMetadata(e){const t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}_getAttributeMetadata(e,t){const n=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(n)}_getDracoMetadata(e){if(!e||!e.ptr)return{};const t={},n=this.metadataQuerier.NumEntries(e);for(let r=0;r<n;r++){const n=this.metadataQuerier.GetEntryName(e,r);t[n]=this._getDracoMetadataField(e,n)}return t}_getDracoMetadataField(e,t){const n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,n);const r=function(e){const t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}(n);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:r}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(e){const{quantizedAttributes:t=[],octahedronAttributes:n=[]}=e,r=[...t,...n];for(const e of r)this.decoder.SkipAttributeTransform(this.draco[e])}_getQuantizationTransform(e,t){const{quantizedAttributes:n=[]}=t,r=e.attribute_type();if(n.map(e=>this.decoder[e]).includes(r)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits(),range:t.range(),min_values:new Float32Array([1,2,3]).map(e=>t.min_value(e))}}finally{this.draco.destroy(t)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:n=[]}=t,r=e.attribute_type();if(n.map(e=>this.decoder[e]).includes(r)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits()}}finally{this.draco.destroy(t)}}return null}}var be=n(0),ye=n(2);const pe={};async function we(e,t=null,n={}){return t&&(e=function(e,t,n){if(e.startsWith("http"))return e;const r=n.modules||{};if(r[e])return r[e];if(!be.b)return`modules/${t}/dist/libs/${e}`;if(n.CDN)return function(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}(n.CDN.startsWith("http")),`${n.CDN}/${t}@3.0.9/dist/libs/${e}`;if(be.c)return"../src/libs/"+e;return`modules/${t}/src/libs/${e}`}(e,t,n)),pe[e]=pe[e]||async function(e){if(e.endsWith("wasm")){const t=await fetch(e);return await t.arrayBuffer()}if(!be.b)return ye.requireFromFile&&await ye.requireFromFile(e);if(be.c)return importScripts(e);const t=await fetch(e);return function(e,t){if(!be.b)return ye.requireFromString&&ye.requireFromString(e,t);if(be.c)return eval.call(be.a,e),null;const n=document.createElement("script");n.id=t;try{n.appendChild(document.createTextNode(e))}catch(t){n.text=e}return document.body.appendChild(n),null}(await t.text(),e)}(e),await pe[e]}let Te;async function ve(e){const t=e.modules||{};return Te=t.draco3d?Te||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):Te||async function(e){let t,n;switch(e.draco&&e.draco.decoderType){case"js":t=await we("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",e);break;case"wasm":default:[t,n]=await Promise.all([await we("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",e),await we("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","draco",e)])}return t=t||globalThis.DracoDecoderModule,await function(e,t){const n={};t&&(n.wasmBinary=t);return new Promise(t=>{e({...n,onModuleLoaded:e=>t({draco:e})})})}(t,n)}(e),await Te}const _e={...F,parse:async function(e,t){const{draco:n}=await ve(t),r=new ge(n);try{return r.parseSync(e,null==t?void 0:t.draco)}finally{r.destroy()}}};function xe(e,t){if(!e)throw new Error(t||"loader assertion failed.")}function Ae(e,t){return xe(e>=0),xe(t>0),e+(t-1)&~(t-1)}function Ie(e,t,n){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{const t=e.byteOffset,n=e.byteLength;r=new Uint8Array(e.buffer||e.arrayBuffer,t,n)}return t.set(r,n),n+Ae(r.byteLength,4)}const je=["SCALAR","VEC2","VEC3","VEC4"],Ee=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Oe=new Map(Ee),Se={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ue={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Me={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Le(e){return je[e-1]||je[0]}function Re(e){const t=Oe.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Be(e,t){const n=Me[e.componentType],r=Se[e.type],s=Ue[e.componentType],i=e.count*r,o=e.count*r*s;return L(o>=0&&o<=t.byteLength),{ArrayType:n,length:i,byteLength:o}}function Fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const De={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class Ne{constructor(e){Fe(this,"gltf",void 0),Fe(this,"sourceBuffers",void 0),Fe(this,"byteLength",void 0),this.gltf=e||{json:{...De},buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),n=this.json.extensions||{};return t?n[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const n=this.json[e]&&this.json[e][t];if(!n)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return n}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,n=this.gltf.buffers[t];L(n);const r=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,r,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),n=this.getBuffer(t.buffer).data,{ArrayType:r,length:s}=Be(e,t);return new r(n,t.byteOffset+e.byteOffset,s)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),n=this.getBuffer(t.buffer).data,r=t.byteOffset||0;return new Uint8Array(n,r,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}setObjectExtension(e,t,n){(e.extensions||{})[t]=n}removeObjectExtension(e,t){const n=e.extensions||{},r=n[t];return delete n[t],r}addExtension(e,t={}){return L(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return L(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setDefaultScene(e){this.json.scene=e}addScene(e){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:n}=e;this.json.nodes=this.json.nodes||[];const r={mesh:t};return n&&(r.matrix=n),this.json.nodes.push(r),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:n,material:r,mode:s=4}=e,i={primitives:[{attributes:this._addAttributes(t),mode:s}]};if(n){const e=this._addIndices(n);i.primitives[0].indices=e}return Number.isFinite(r)&&(i.primitives[0].material=r),this.json.meshes=this.json.meshes||[],this.json.meshes.push(i),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){const n=j(e),r=t||(null==n?void 0:n.mimeType),s={bufferView:this.addBufferView(e),mimeType:r};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}addBufferView(e){const t=e.byteLength;L(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const n={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=Ae(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(n),this.json.bufferViews.length-1}addAccessor(e,t){const n={bufferView:e,type:Le(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const n=this.addBufferView(e);let r={min:t.min,max:t.max};r.min&&r.max||(r=this._getAccessorMinMax(e,t.size));const s={size:t.size,componentType:Re(e),count:Math.round(e.length/t.size),min:r.min,max:r.max};return this.addAccessor(n,Object.assign(s,t))}addTexture(e){const{imageIndex:t}=e,n={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){var e,t;this.gltf.buffers=[];const n=this.byteLength,r=new ArrayBuffer(n),s=new Uint8Array(r);let i=0;for(const e of this.sourceBuffers||[])i=Ie(e,s,i);null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=n:this.json.buffers=[{byteLength:n}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(e,t){let n=!0;for(;n;){const r=e.indexOf(t);r>-1?e.splice(r,1):n=!1}}_addAttributes(e={}){const t={};for(const n in e){const r=e[n],s=this._getGltfAttributeName(n),i=this.addBinaryBuffer(r.value,r);t[s]=i}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,t){const n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];const r=e.subarray(0,t);for(const e of r)n.min.push(e),n.max.push(e);for(let r=t;r<e.length;r+=t)for(let s=0;s<t;s++)n.min[0+s]=Math.min(n.min[0+s],e[r+s]),n.max[0+s]=Math.max(n.max[0+s],e[r+s]);return n}}function Ve(e){const{buffer:t,size:n,count:r}=function(e){let t=e,n=1,r=0;e&&e.value&&(t=e.value,n=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t,n=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(n&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),r=t.length/n);return{buffer:t,size:n,count:r}}(e);return{value:t,size:n,byteOffset:0,count:r,type:Le(n),componentType:Re(t)}}async function Ce(e,t,n){var r;if(null==t||null===(r=t.gltf)||void 0===r||!r.decompressMeshes)return;const s=new Ne(e),i=[];for(const e of function*(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}(s))s.getObjectExtension(e,a)&&i.push(ze(s,e,t,n));await Promise.all(i),s.removeExtension(a)}function Pe(e,t={}){const n=new Ne(e);for(const e of n.json.meshes||[])ke(e,t),n.addRequiredExtension(a)}async function ze(e,t,n,r){const s=e.getObjectExtension(t,a);if(!s)return;const i=e.getTypedArrayForBufferView(s.bufferView),o=M(i.buffer,i.byteOffset),{parse:c}=r,u={...n};delete u["3d-tiles"];const f=await c(o,_e,u,r),d=function(e){const t={};for(const n in e){const r=e[n];if("indices"!==n){const e=Ve(r);t[n]=e}}return t}(f.attributes);for(const[n,r]of Object.entries(d))if(n in t.attributes){const s=t.attributes[n],i=e.getAccessor(s);null!=i&&i.min&&null!=i&&i.max&&(r.min=i.min,r.max=i.max)}t.attributes=d,f.indices&&(t.indices=Ve(f.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(t)}function ke(e,t,n=4,r,s){var i;if(!r.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=r.DracoWriter.encodeSync({attributes:e}),c=null==s||null===(i=s.parseSync)||void 0===i?void 0:i.call(s,{attributes:e}),u=r._addFauxAttributes(c.attributes),f=r.addBufferView(o);return{primitives:[{attributes:u,mode:n,extensions:{[a]:{bufferView:f,attributes:u}}}]}}async function qe(e){const t=new Ne(e),{json:n}=t;t.removeExtension("KHR_materials_unlit");for(const e of n.materials||[]){e.extensions&&e.extensions.KHR_materials_unlit&&(e.unlit=!0),t.removeObjectExtension(e,"KHR_materials_unlit")}}function Ge(e){const t=new Ne(e),{json:n}=t;if(t.materials)for(const e of n.materials||[])e.unlit&&(delete e.unlit,t.addObjectExtension(e,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}async function $e(e){const t=new Ne(e),{json:n}=t,r=t.getExtension("KHR_lights_punctual");r&&(t.json.lights=r.lights,t.removeExtension("KHR_lights_punctual"));for(const e of n.nodes||[]){const n=t.getObjectExtension(e,"KHR_lights_punctual");n&&(e.light=n.light),t.removeObjectExtension(e,"KHR_lights_punctual")}}async function He(e){const t=new Ne(e),{json:n}=t;if(n.lights){const e=t.addExtension("KHR_lights_punctual");L(!e.lights),e.lights=n.lights,delete n.lights}if(t.json.lights){for(const e of t.json.lights){const n=e.node;t.addObjectExtension(n,"KHR_lights_punctual",e)}delete t.json.lights}}async function Ke(e){const t=new Ne(e),{json:n}=t,r=t.getExtension("KHR_techniques_webgl");if(r){const e=function(e,t){const{programs:n=[],shaders:r=[],techniques:s=[]}=e,i=new TextDecoder;return r.forEach(e=>{if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=i.decode(t.getTypedArrayForBufferView(e.bufferView))}),n.forEach(e=>{e.fragmentShader=r[e.fragmentShader],e.vertexShader=r[e.vertexShader]}),s.forEach(e=>{e.program=n[e.program]}),s}(r,t);for(const r of n.materials||[]){const n=t.getObjectExtension(r,"KHR_techniques_webgl");n&&(r.technique=Object.assign({},n,e[n.technique]),r.technique.values=Xe(r.technique,t)),t.removeObjectExtension(r,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}}async function We(e,t){}function Xe(e,t){const n=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(t=>{e.uniforms[t].value&&!(t in n)&&(n[t]=e.uniforms[t].value)}),Object.keys(n).forEach(e=>{"object"==typeof n[e]&&void 0!==n[e].index&&(n[e].texture=t.getTexture(n[e].index))}),n}const Qe={KHR_draco_mesh_compression:r,KHR_materials_unlit:s,KHR_lights_punctual:i,KHR_techniques_webgl:o};const Je={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Ye={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class Ze{constructor(e){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}}normalize(e,t){this.json=e.json;const n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version "+n.asset.version)}if(!t.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),function(e){const t=new Ne(e),{json:n}=t;for(const e of n.images||[]){const n=t.removeObjectExtension(e,"KHR_binary_glTF");n&&Object.assign(e,n)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,t.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(const t in Je)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const n=e[t];if(n&&!Array.isArray(n)){e[t]=[];for(const r in n){const s=n[r];s.id=s.id||r;const i=e[t].length;e[t].push(s),this.idToIndexMap[t][r]=i}}}_convertObjectIdsToArrayIndices(e){for(const t in Je)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:e,indices:n,material:r}=t;for(const t in e)e[t]=this._convertIdToIndex(e[t],"accessor");n&&(t.indices=this._convertIdToIndex(n,"accessor")),r&&(t.material=this._convertIdToIndex(r,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(e=>this._convertIdToIndex(e,"node"))),e.meshes&&(e.meshes=e.meshes.map(e=>this._convertIdToIndex(e,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(e=>this._convertIdToIndex(e,"node")))}_convertIdsToIndices(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute "+t),e[t]=[]);for(const n of e[t])for(const e in n){const t=n[e],r=this._convertIdToIndex(t,e);n[e]=r}}_convertIdToIndex(e,t){const n=Ye[t];if(n in this.idToIndexMap){const r=this.idToIndexMap[n][e];if(!Number.isFinite(r))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return r}return e}_updateObjects(e){for(const e of this.json.buffers)delete e.type}_updateMaterial(e){for(const t of e.materials){t.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const n=t.values&&t.values.tex,r=e.textures.findIndex(e=>e.id===n);-1!==r&&(t.pbrMetallicRoughness.baseColorTexture={index:r})}}}const et={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},tt={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},nt={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},rt={magFilter:nt.TEXTURE_MAG_FILTER,minFilter:nt.TEXTURE_MIN_FILTER,wrapS:nt.TEXTURE_WRAP_S,wrapT:nt.TEXTURE_WRAP_T},st={[nt.TEXTURE_MAG_FILTER]:nt.LINEAR,[nt.TEXTURE_MIN_FILTER]:nt.NEAREST_MIPMAP_LINEAR,[nt.TEXTURE_WRAP_S]:nt.REPEAT,[nt.TEXTURE_WRAP_]:nt.REPEAT};class it{postProcess(e,t={}){const{json:n,buffers:r=[],images:s=[],baseUri:i=""}=e;return L(n),this.baseUri=i,this.json=n,this.buffers=r,this.images=s,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map((e,t)=>this._resolveBufferView(e,t))),e.images&&(e.images=e.images.map((e,t)=>this._resolveImage(e,t))),e.samplers&&(e.samplers=e.samplers.map((e,t)=>this._resolveSampler(e,t))),e.textures&&(e.textures=e.textures.map((e,t)=>this._resolveTexture(e,t))),e.accessors&&(e.accessors=e.accessors.map((e,t)=>this._resolveAccessor(e,t))),e.materials&&(e.materials=e.materials.map((e,t)=>this._resolveMaterial(e,t))),e.meshes&&(e.meshes=e.meshes.map((e,t)=>this._resolveMesh(e,t))),e.nodes&&(e.nodes=e.nodes.map((e,t)=>this._resolveNode(e,t))),e.skins&&(e.skins=e.skins.map((e,t)=>this._resolveSkin(e,t))),e.scenes&&(e.scenes=e.scenes.map((e,t)=>this._resolveScene(e,t))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const n=this.json[e]&&this.json[e][t];return n||console.warn(`glTF file error: Could not find ${e}[${t}]`),n}_resolveScene(e,t){return e.id=e.id||"scene-"+t,e.nodes=(e.nodes||[]).map(e=>this.getNode(e)),e}_resolveNode(e,t){return e.id=e.id||"node-"+t,e.children&&(e.children=e.children.map(e=>this.getNode(e))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((e,t)=>{const n=this.getMesh(t);return e.id=n.id,e.primitives=e.primitives.concat(n.primitives),e},{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||"skin-"+t,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||"mesh-"+t,e.primitives&&(e.primitives=e.primitives.map(e=>{const t=(e={...e}).attributes;e.attributes={};for(const n in t)e.attributes[n]=this.getAccessor(t[n]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e})),e}_resolveMaterial(e,t){if(e.id=e.id||"material-"+t,e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var n,r;if(e.id=e.id||"accessor-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(n=e.componentType,tt[n]),e.components=(r=e.type,et[r]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:n,byteLength:r}=Be(e,e.bufferView),s=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+t.byteOffset,i=t.arrayBuffer.slice(s,s+r);e.value=new n(i)}return e}_resolveTexture(e,t){return e.id=e.id||"texture-"+t,e.sampler="sampler"in e?this.getSampler(e.sampler):st,e.source=this.getImage(e.source),e}_resolveSampler(e,t){e.id=e.id||"sampler-"+t,e.parameters={};for(const t in e){const n=this._enumSamplerParameter(t);void 0!==n&&(e.parameters[n]=e[t])}return e}_enumSamplerParameter(e){return rt[e]}_resolveImage(e,t){e.id=e.id||"image-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));const n=this.images[t];return n&&(e.image=n),e}_resolveBufferView(e,t){e.id=e.id||"bufferView-"+t;const n=e.buffer;e.buffer=this.buffers[n];const r=this.buffers[n].arrayBuffer;let s=this.buffers[n].byteOffset||0;return"byteOffset"in e&&(s+=e.byteOffset),e.data=new Uint8Array(r,s,e.byteLength),e}_resolveCamera(e,t){return e.id=e.id||"camera-"+t,e.perspective,e.orthographic,e}}function ot(e,t){return(new it).postProcess(e,t)}const at=1735152710;function ct(e,t=0,n={}){const r=new DataView(e),{magic:s=at}=n,i=r.getUint32(t,!1);return i===s||i===at}function ut(e,t,n=0,r={}){const s=new DataView(t),i=function(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}(s,n+0),o=s.getUint32(n+4,!0),a=s.getUint32(n+8,!0);switch(Object.assign(e,{header:{byteOffset:n,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),n+=12,e.version){case 1:return function(e,t,n){xe(e.header.byteLength>20);const r=t.getUint32(n+0,!0),s=t.getUint32(n+4,!0);return n+=8,xe(0===s),ft(e,t,n,r),n+=r,n+=dt(e,t,n,e.header.byteLength)}(e,s,n);case 2:return function(e,t,n,r){return xe(e.header.byteLength>20),function(e,t,n,r){for(;n+8<=e.header.byteLength;){const s=t.getUint32(n+0,!0),i=t.getUint32(n+4,!0);switch(n+=8,i){case 1313821514:ft(e,t,n,s);break;case 5130562:dt(e,t,n,s);break;case 0:r.strict||ft(e,t,n,s);break;case 1:r.strict||dt(e,t,n,s)}n+=Ae(s,4)}}(e,t,n,r),n+e.header.byteLength}(e,s,n,{});default:throw new Error(`Invalid GLB version ${e.version}. Only supports v1 and v2.`)}}function ft(e,t,n,r){const s=new Uint8Array(t.buffer,n,r),i=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(i),Ae(r,4)}function dt(e,t,n,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:t.buffer}),Ae(r,4)}async function lt(e,t,n=0,r,s){var i,o,a,c;!function(e,t,n,r){r.uri&&(e.baseUri=r.uri);if(t instanceof ArrayBuffer&&!ct(t,n,r)){const e=new TextDecoder;t=e.decode(t)}if("string"==typeof t)e.json=U(t);else if(t instanceof ArrayBuffer){const s={};n=ut(s,t,n,r.glb),L("glTF"===s.type,"Invalid GLB magic string "+s.type),e._glb=s,e.json=s.json}else L(!1,"GLTF: must be ArrayBuffer or string");const s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){const{binChunks:t}=e._glb;e.buffers[0]={arrayBuffer:t[0].arrayBuffer,byteOffset:t[0].byteOffset,byteLength:t[0].byteLength}}const i=e.json.images||[];e.images=new Array(i.length).fill({})}(e,t,n,r),function(e,t={}){(new Ze).normalize(e,t)}(e,{normalize:null==r||null===(i=r.gltf)||void 0===i?void 0:i.normalize});const u=[];if(null!=r&&null!==(o=r.gltf)&&void 0!==o&&o.loadBuffers&&e.json.buffers&&await async function(e,t,n){for(let i=0;i<e.json.buffers.length;++i){const o=e.json.buffers[i];if(o.uri){var r,s;const{fetch:a}=n;L(a);const c=R(o.uri,t),u=await(null==n||null===(r=n.fetch)||void 0===r?void 0:r.call(n,c)),f=await(null==u||null===(s=u.arrayBuffer)||void 0===s?void 0:s.call(u));e.buffers[i]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete o.uri}}}(e,r,s),null!=r&&null!==(a=r.gltf)&&void 0!==a&&a.loadImages){const t=async function(e,t,n){const r=e.json.images||[],s=[];for(let i=0;i<r.length;++i)s.push(ht(e,r[i],i,t,n));return await Promise.all(s)}(e,r,s);u.push(t)}const f=async function(e,t={},n){for(const s in Qe){var r;const i=(null==t||null===(r=t.gltf)||void 0===r?void 0:r.excludeExtensions)||{};if(!(s in i&&!i[s])){const r=Qe[s];await r.decode(e,t,n)}}}(e,r,s);return u.push(f),await Promise.all(u),null!=r&&null!==(c=r.gltf)&&void 0!==c&&c.postProcess?ot(e,r):e}async function ht(e,t,n,r,s){const{fetch:i,parse:o}=s;let a;if(t.uri){const e=R(t.uri,r),n=await i(e);a=await n.arrayBuffer()}if(Number.isFinite(t.bufferView)){const n=B(e.json,e.buffers,t.bufferView);a=M(n.buffer,n.byteOffset,n.byteLength)}L(a,"glTF image has no data");const c=await o(a,O,{},s);e.images[n]=c}const mt={name:"glTF",id:"gltf",module:"gltf",version:"3.0.9",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},n){(t={...mt.options,...t}).gltf={...mt.options.gltf,...t.gltf};const{byteOffset:r=0}=t;return await lt({},e,r,t,n)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};function gt(e,t,n,r){const s=Ae(n.byteLength,r),i=s-n.byteLength;if(e){const r=new Uint8Array(e.buffer,e.byteOffset+t,n.byteLength),s=new Uint8Array(n);r.set(s);for(let r=0;r<i;++r)e.setUint8(t+n.byteLength+r,32)}return t+=s}const bt=1179937895;function yt(e,t,n=0,r={}){const{magic:s=bt,version:i=2,json:o={},binary:a}=e,c=n;t&&(t.setUint32(n+0,s,!0),t.setUint32(n+4,i,!0),t.setUint32(n+8,0,!0));const u=n+8,f=n+=12;t&&(t.setUint32(n+0,0,!0),t.setUint32(n+4,1313821514,!0));if(n=function(e,t,n,r){return t=gt(e,t,(new TextEncoder).encode(n),r)}(t,n+=8,JSON.stringify(o),4),t){const e=n-f-8;t.setUint32(f+0,e,!0)}if(a){const e=n;if(t&&(t.setUint32(n+0,0,!0),t.setUint32(n+4,5130562,!0)),n=gt(t,n+=8,a,4),t){const r=n-e-8;t.setUint32(e+0,r,!0)}}if(t){const e=n-c;t.setUint32(u,e,!0)}return n}function pt(e,t,n,r){return function(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}(e),yt(e,t,n,r)}const wt={name:"glTF",id:"gltf",module:"gltf",version:"3.0.9",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,encodeSync:function(e,t={}){const{byteOffset:n=0}=t,r=pt(e,null,n,t),s=new ArrayBuffer(r),i=new DataView(s);return pt(e,i,n,t),s},options:{gltf:{}}};const Tt={name:"GLB",id:"glb",module:"gltf",version:"3.0.9",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,parse:async function(e,t){return vt(e,t)},parseSync:vt,options:{glb:{strict:!1}}};function vt(e,t){const{byteOffset:n=0}=t||{},r={};return ut(r,e,n,null==t?void 0:t.glb),r}const _t={name:"GLB",id:"glb",module:"gltf",version:"3.0.9",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,encodeSync:function(e,t){const{byteOffset:n=0}=t,r=yt(e,null,n,t),s=new ArrayBuffer(r),i=new DataView(s);return yt(e,i,n,t),s},options:{glb:{}}}}])}));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(r,s,function(t){return e[t]}.bind(null,s));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";(function(e,r){n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return a}));const s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==e&&e,document:"undefined"!=typeof document&&document},i=s.global||s.self||s.window||{},o="object"!=typeof r||"[object process]"!==String(r)||r.browser,a="function"==typeof importScripts,c=("undefined"!=typeof window&&window.orientation,void 0!==r&&r.version&&/v([0-9]*)/.exec(r.version));c&&parseFloat(c[1])}).call(this,n(5),n(6))},function(e,t,n){"use strict";(function(e,r){n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o}));const s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==e&&e,document:"undefined"!=typeof document&&document},i=s.global||s.self||s.window,o="object"!=typeof r||"[object process]"!==String(r)||r.browser,a=void 0!==r&&r.version&&/v([0-9]*)/.exec(r.version);a&&parseFloat(a[1])}).call(this,n(5),n(6))},function(e,t){},function(e,t){},,function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n,r,s=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,u=[],f=!1,d=-1;function l(){f&&c&&(f=!1,c.length?u=c.concat(u):d=-1,u.length&&h())}function h(){if(!f){var e=a(l);f=!0;for(var t=u.length;t;){for(c=u,u=[];++d<t;)c&&c[d].run();d=-1,t=u.length}c=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function g(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new m(e,t)),1!==u.length||f||a(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=g,s.addListener=g,s.once=g,s.off=g,s.removeListener=g,s.removeAllListeners=g,s.emit=g,s.prependListener=g,s.prependOnceListener=g,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},,function(e,t,n){(function(t){const r=n(11),s="undefined"==typeof window?t:window;s.loaders=s.loaders||{},e.exports=Object.assign(s.loaders,r)}).call(this,n(5))},,,function(e,t,n){"use strict";n.r(t),n.d(t,"KHR_DRACO_MESH_COMPRESSION",(function(){return a})),n.d(t,"GLTFLoader",(function(){return mt})),n.d(t,"GLTFWriter",(function(){return wt})),n.d(t,"GLBLoader",(function(){return Tt})),n.d(t,"GLBWriter",(function(){return _t})),n.d(t,"GLTFScenegraph",(function(){return Ne})),n.d(t,"postProcessGLTF",(function(){return ot}));var r={};n.r(r),n.d(r,"decode",(function(){return Ce})),n.d(r,"encode",(function(){return Pe}));var s={};n.r(s),n.d(s,"decode",(function(){return qe})),n.d(s,"encode",(function(){return Ge}));var i={};n.r(i),n.d(i,"decode",(function(){return $e})),n.d(i,"encode",(function(){return He}));var o={};n.r(o),n.d(o,"decode",(function(){return Ke})),n.d(o,"encode",(function(){return We}));const a="KHR_draco_mesh_compression";function c(e,t){if(!e)throw new Error(t)}var u=n(1);const{_parseImageNode:f}=u.a,d="undefined"!=typeof Image,l="undefined"!=typeof ImageBitmap,h=Boolean(f),m=!!u.b||h;function g(e){const t=y(e);if(!t)throw new Error("Not an image");return t}function b(e){switch(g(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function y(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&e instanceof Image?"image":e&&"object"==typeof e&&e.data&&e.width&&e.height?"data":null}const p=/^data:image\/svg\+xml/,w=/\.svg((\?|#).*)?$/;function T(e){return e&&(p.test(e)||w.test(e))}function v(e,t){if(T(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function _(e,t,n){const r=function(e,t){if(T(t)){let t=(new TextDecoder).decode(e);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(t=unescape(encodeURIComponent(t)))}catch(e){throw new Error(e.message)}return"data:image/svg+xml;base64,"+btoa(t)}return v(e,t)}(e,n),s=self.URL||self.webkitURL,i="string"!=typeof r&&s.createObjectURL(r);try{return await async function(e,t){const n=new Image;if(n.src=e,t.image&&t.image.decode&&n.decode)return await n.decode(),n;return await new Promise((t,r)=>{try{n.onload=()=>t(n),n.onerror=t=>r(new Error(`Could not load image ${e}: ${t}`))}catch(e){r(e)}})}(i||r,t)}finally{i&&s.revokeObjectURL(i)}}const x={};let A=!0;async function I(e,t,n){let r;if(T(n)){r=await _(e,t,n)}else r=v(e,n);const s=t&&t.imagebitmap;return await async function(e,t=null){!function(e){for(const t in e||x)return!1;return!0}(t)&&A||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),A=!1}return await createImageBitmap(e)}(r,s)}function j(e){const t=E(e);return function(e){const t=E(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,!1)))return null;return{mimeType:"image/png",width:t.getUint32(16,!1),height:t.getUint32(20,!1)}}(t)||function(e){const t=E(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,!1)&&255===t.getUint8(2)))return null;const{tableMarkers:n,sofMarkers:r}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let s=2;for(;s+9<t.byteLength;){const e=t.getUint16(s,!1);if(r.has(e))return{mimeType:"image/jpeg",height:t.getUint16(s+5,!1),width:t.getUint16(s+7,!1)};if(!n.has(e))return null;s+=2,s+=t.getUint16(s,!1)}return null}(t)||function(e){const t=E(e);if(!(t.byteLength>=10&&1195984440===t.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:t.getUint16(6,!0),height:t.getUint16(8,!0)}}(t)||function(e){const t=E(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,!1)&&t.getUint32(2,!0)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,!0),height:t.getUint32(22,!0)}}(t)}function E(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}const O={id:"image",module:"images",name:"Images",version:"3.0.13",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(e,t,n){const r=((t=t||{}).image||{}).type||"auto",{url:s}=n||{};let i;switch(function(e){switch(e){case"auto":case"data":return function(){if(l)return"imagebitmap";if(d)return"image";if(m)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return l||d||m;case"imagebitmap":return l;case"image":return d;case"data":return m;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}(e),e}}(r)){case"imagebitmap":i=await I(e,t,s);break;case"image":i=await _(e,t,s);break;case"data":i=await function(e,t){const{mimeType:n}=j(e)||{},{_parseImageNode:r}=u.a;return c(r),r(e,n,t)}(e,t);break;default:c(!1)}return"data"===r&&(i=b(i)),i},tests:[e=>Boolean(j(new DataView(e)))],options:{image:{type:"auto",decode:!0}}};function S(e,t,n){if(e.byteLength<=t+n)return"";const r=new DataView(e);let s="";for(let e=0;e<n;e++)s+=String.fromCharCode(r.getUint8(t+e));return s}function U(e){try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse JSON from data starting with "${function(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return S(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return S(e,0,t)}return""}(e)}"`)}}n(2);function M(e,t,n){const r=void 0!==n?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}function L(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function R(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;const n=t.baseUri||t.uri;if(!n)throw new Error("'baseUri' must be provided to resolve relative url "+e);return n.substr(0,n.lastIndexOf("/")+1)+e}function B(e,t,n){const r=e.bufferViews[n];L(r);const s=t[r.buffer];L(s);const i=(r.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,i,r.byteLength)}const F={name:"Draco",id:"draco",module:"draco",version:"3.0.13",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class N{constructor(e,t){D(this,"fields",void 0),D(this,"metadata",void 0),function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}(Array.isArray(e)),function(e){const t={};for(const n of e)t[n.name]&&console.warn("Schema: duplicated field name",n.name,n),t[n.name]=!0}(e),this.fields=e,this.metadata=t||new Map}compareTo(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(let t=0;t<this.fields.length;++t)if(!this.fields[t].compareTo(e.fields[t]))return!1;return!0}select(...e){const t=Object.create(null);for(const n of e)t[n]=!0;const n=this.fields.filter(e=>t[e.name]);return new N(n,this.metadata)}selectAt(...e){const t=e.map(e=>this.fields[e]).filter(Boolean);return new N(t,this.metadata)}assign(e){let t,n=this.metadata;if(e instanceof N){const r=e;t=r.fields,n=V(V(new Map,this.metadata),r.metadata)}else t=e;const r=Object.create(null);for(const e of this.fields)r[e.name]=e;for(const e of t)r[e.name]=e;const s=Object.values(r);return new N(s,n)}}function V(e,t){return new Map([...e||new Map,...t||new Map])}let C,P,z,k,q,G,$,H;function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(C||(C={}));class W{static isNull(e){return e&&e.typeId===C.Null}static isInt(e){return e&&e.typeId===C.Int}static isFloat(e){return e&&e.typeId===C.Float}static isBinary(e){return e&&e.typeId===C.Binary}static isUtf8(e){return e&&e.typeId===C.Utf8}static isBool(e){return e&&e.typeId===C.Bool}static isDecimal(e){return e&&e.typeId===C.Decimal}static isDate(e){return e&&e.typeId===C.Date}static isTime(e){return e&&e.typeId===C.Time}static isTimestamp(e){return e&&e.typeId===C.Timestamp}static isInterval(e){return e&&e.typeId===C.Interval}static isList(e){return e&&e.typeId===C.List}static isStruct(e){return e&&e.typeId===C.Struct}static isUnion(e){return e&&e.typeId===C.Union}static isFixedSizeBinary(e){return e&&e.typeId===C.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===C.FixedSizeList}static isMap(e){return e&&e.typeId===C.Map}static isDictionary(e){return e&&e.typeId===C.Dictionary}get typeId(){return C.NONE}compareTo(e){return this===e}}Symbol.toStringTag;Symbol.toStringTag;P=Symbol.toStringTag;class X extends W{constructor(e,t){super(),K(this,"isSigned",void 0),K(this,"bitWidth",void 0),this.isSigned=e,this.bitWidth=t}get typeId(){return C.Int}get[P](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class Q extends X{constructor(){super(!0,8)}}class J extends X{constructor(){super(!0,16)}}class Y extends X{constructor(){super(!0,32)}}class Z extends X{constructor(){super(!1,8)}}class ee extends X{constructor(){super(!1,16)}}class te extends X{constructor(){super(!1,32)}}const ne=32,re=64;z=Symbol.toStringTag;class se extends W{constructor(e){super(),K(this,"precision",void 0),this.precision=e}get typeId(){return C.Float}get[z](){return"Float"}toString(){return"Float"+this.precision}}class ie extends se{constructor(){super(ne)}}class oe extends se{constructor(){super(re)}}Symbol.toStringTag;Symbol.toStringTag;k=Symbol.toStringTag;q=Symbol.toStringTag;G=Symbol.toStringTag;$=Symbol.toStringTag;H=Symbol.toStringTag;class ae extends W{constructor(e,t){super(),K(this,"listSize",void 0),K(this,"children",void 0),this.listSize=e,this.children=[t]}get typeId(){return C.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[H](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ue{constructor(e,t,n=!1,r=new Map){ce(this,"name",void 0),ce(this,"type",void 0),ce(this,"nullable",void 0),ce(this,"metadata",void 0),this.name=e,this.type=t,this.nullable=n,this.metadata=r}get typeId(){return this.type&&this.type.typeId}clone(){return new ue(this.name,this.type,this.nullable,this.metadata)}compareTo(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}function fe(e,t,n){const r=n?de(n.metadata):void 0,s=function(e){switch(e.constructor){case Int8Array:return new Q;case Uint8Array:return new Z;case Int16Array:return new J;case Uint16Array:return new ee;case Int32Array:return new Y;case Uint32Array:return new te;case Float32Array:return new ie;case Float64Array:return new oe;default:throw new Error("array type not supported")}}(t.value);return new ue(e,new ae(t.size,new ue("value",s)),!1,r)}function de(e){const t=new Map;for(const n in e)t.set(n+".string",JSON.stringify(e[n]));return t}function le(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const he={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},me={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class ge{constructor(e){le(this,"draco",void 0),le(this,"decoder",void 0),le(this,"metadataQuerier",void 0),this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,t={}){const n=new this.draco.DecoderBuffer;n.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const r=this.decoder.GetEncodedGeometryType(n),s=r===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let e;switch(r){case this.draco.TRIANGULAR_MESH:e=this.decoder.DecodeBufferToMesh(n,s);break;case this.draco.POINT_CLOUD:e=this.decoder.DecodeBufferToPointCloud(n,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!e.ok()||!s.ptr){const t="DRACO decompression failed: "+e.error_msg();throw new Error(t)}const i=this._getDracoLoaderData(s,r,t),o=this._getMeshData(s,i,t),a=function(e){let t=1/0,n=1/0,r=1/0,s=-1/0,i=-1/0,o=-1/0;const a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let e=0;e<c;e+=3){const c=a[e],u=a[e+1],f=a[e+2];t=c<t?c:t,n=u<n?u:n,r=f<r?f:r,s=c>s?c:s,i=u>i?u:i,o=f>o?f:o}return[[t,n,r],[s,i,o]]}(o.attributes),c=function(e,t,n){const r=de(t.metadata),s=[],i=function(e){const t={};for(const n in e){const r=e[n];t[r.name||"undefined"]=r}return t}(t.attributes);for(const t in e){const n=fe(t,e[t],i[t]);s.push(n)}if(n){const e=fe("indices",n);s.push(e)}return new N(s,r)}(o.attributes,i,o.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:a},...o,schema:c}}finally{this.draco.destroy(n),s&&this.draco.destroy(s)}}_getDracoLoaderData(e,t,n){const r=this._getTopLevelMetadata(e),s=this._getDracoAttributes(e,n);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:r,attributes:s}}_getDracoAttributes(e,t){const n={};for(let r=0;r<e.num_attributes();r++){const s=this.decoder.GetAttribute(e,r),i=this._getAttributeMetadata(e,r);n[s.unique_id()]={unique_id:s.unique_id(),attribute_type:s.attribute_type(),data_type:s.data_type(),num_components:s.num_components(),byte_offset:s.byte_offset(),byte_stride:s.byte_stride(),normalized:s.normalized(),attribute_index:r,metadata:i};const o=this._getQuantizationTransform(s,t);o&&(n[s.unique_id()].quantization_transform=o);const a=this._getOctahedronTransform(s,t);a&&(n[s.unique_id()].octahedron_transform=a)}return n}_getMeshData(e,t,n){const r=this._getMeshAttributes(t,e,n);if(!r.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:r,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:r,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:r}}_getMeshAttributes(e,t,n){const r={};for(const s of Object.values(e.attributes)){const e=this._deduceAttributeName(s,n);s.name=e;const{value:i,size:o}=this._getAttributeValues(t,s);r[e]={value:i,size:o,byteOffset:s.byte_offset,byteStride:s.byte_stride,normalized:s.normalized}}return r}_getTriangleListIndices(e){const t=3*e.num_faces(),n=4*t,r=this.draco._malloc(n);try{return this.decoder.GetTrianglesUInt32Array(e,n,r),new Uint32Array(this.draco.HEAPF32.buffer,r,t).slice()}finally{this.draco._free(r)}}_getTriangleStripIndices(e){const t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),function(e){const t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){const n=me[t.data_type],r=t.num_components,s=e.num_points()*r,i=s*n.BYTES_PER_ELEMENT,o=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}(this.draco,n);let a;const c=this.draco._malloc(i);try{const r=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,r,o,i,c),a=new n(this.draco.HEAPF32.buffer,c,s).slice()}finally{this.draco._free(c)}return{value:a,size:r}}_deduceAttributeName(e,t){const n=e.unique_id;for(const[e,r]of Object.entries(t.extraAttributes||{}))if(r===n)return e;const r=e.attribute_type;for(const e in he){if(this.draco[e]===r)return he[e]}const s=t.attributeNameEntry||"name";return e.metadata[s]?e.metadata[s].string:"CUSTOM_ATTRIBUTE_"+n}_getTopLevelMetadata(e){const t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}_getAttributeMetadata(e,t){const n=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(n)}_getDracoMetadata(e){if(!e||!e.ptr)return{};const t={},n=this.metadataQuerier.NumEntries(e);for(let r=0;r<n;r++){const n=this.metadataQuerier.GetEntryName(e,r);t[n]=this._getDracoMetadataField(e,n)}return t}_getDracoMetadataField(e,t){const n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,n);const r=function(e){const t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}(n);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:r}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(e){const{quantizedAttributes:t=[],octahedronAttributes:n=[]}=e,r=[...t,...n];for(const e of r)this.decoder.SkipAttributeTransform(this.draco[e])}_getQuantizationTransform(e,t){const{quantizedAttributes:n=[]}=t,r=e.attribute_type();if(n.map(e=>this.decoder[e]).includes(r)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits(),range:t.range(),min_values:new Float32Array([1,2,3]).map(e=>t.min_value(e))}}finally{this.draco.destroy(t)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:n=[]}=t,r=e.attribute_type();if(n.map(e=>this.decoder[e]).includes(r)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits()}}finally{this.draco.destroy(t)}}return null}}var be=n(0),ye=n(3);const pe={};async function we(e,t=null,n={}){return t&&(e=function(e,t,n){if(e.startsWith("http"))return e;const r=n.modules||{};if(r[e])return r[e];if(!be.b)return`modules/${t}/dist/libs/${e}`;if(n.CDN)return function(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}(n.CDN.startsWith("http")),`${n.CDN}/${t}@3.0.13/dist/libs/${e}`;if(be.c)return"../src/libs/"+e;return`modules/${t}/src/libs/${e}`}(e,t,n)),pe[e]=pe[e]||async function(e){if(e.endsWith("wasm")){const t=await fetch(e);return await t.arrayBuffer()}if(!be.b)return ye.requireFromFile&&await ye.requireFromFile(e);if(be.c)return importScripts(e);const t=await fetch(e);return function(e,t){if(!be.b)return ye.requireFromString&&ye.requireFromString(e,t);if(be.c)return eval.call(be.a,e),null;const n=document.createElement("script");n.id=t;try{n.appendChild(document.createTextNode(e))}catch(t){n.text=e}return document.body.appendChild(n),null}(await t.text(),e)}(e),await pe[e]}let Te;async function ve(e){const t=e.modules||{};return Te=t.draco3d?Te||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):Te||async function(e){let t,n;switch(e.draco&&e.draco.decoderType){case"js":t=await we("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",e);break;case"wasm":default:[t,n]=await Promise.all([await we("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",e),await we("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","draco",e)])}return t=t||globalThis.DracoDecoderModule,await function(e,t){const n={};t&&(n.wasmBinary=t);return new Promise(t=>{e({...n,onModuleLoaded:e=>t({draco:e})})})}(t,n)}(e),await Te}const _e={...F,parse:async function(e,t){const{draco:n}=await ve(t),r=new ge(n);try{return r.parseSync(e,null==t?void 0:t.draco)}finally{r.destroy()}}};function xe(e,t){if(!e)throw new Error(t||"loader assertion failed.")}function Ae(e,t){return xe(e>=0),xe(t>0),e+(t-1)&~(t-1)}function Ie(e,t,n){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{const t=e.byteOffset,n=e.byteLength;r=new Uint8Array(e.buffer||e.arrayBuffer,t,n)}return t.set(r,n),n+Ae(r.byteLength,4)}const je=["SCALAR","VEC2","VEC3","VEC4"],Ee=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Oe=new Map(Ee),Se={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ue={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Me={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Le(e){return je[e-1]||je[0]}function Re(e){const t=Oe.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Be(e,t){const n=Me[e.componentType],r=Se[e.type],s=Ue[e.componentType],i=e.count*r,o=e.count*r*s;return L(o>=0&&o<=t.byteLength),{ArrayType:n,length:i,byteLength:o}}function Fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const De={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class Ne{constructor(e){Fe(this,"gltf",void 0),Fe(this,"sourceBuffers",void 0),Fe(this,"byteLength",void 0),this.gltf=e||{json:{...De},buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),n=this.json.extensions||{};return t?n[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const n=this.json[e]&&this.json[e][t];if(!n)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return n}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,n=this.gltf.buffers[t];L(n);const r=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,r,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),n=this.getBuffer(t.buffer).data,{ArrayType:r,length:s}=Be(e,t);return new r(n,t.byteOffset+e.byteOffset,s)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),n=this.getBuffer(t.buffer).data,r=t.byteOffset||0;return new Uint8Array(n,r,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}setObjectExtension(e,t,n){(e.extensions||{})[t]=n}removeObjectExtension(e,t){const n=e.extensions||{},r=n[t];return delete n[t],r}addExtension(e,t={}){return L(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return L(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setDefaultScene(e){this.json.scene=e}addScene(e){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:n}=e;this.json.nodes=this.json.nodes||[];const r={mesh:t};return n&&(r.matrix=n),this.json.nodes.push(r),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:n,material:r,mode:s=4}=e,i={primitives:[{attributes:this._addAttributes(t),mode:s}]};if(n){const e=this._addIndices(n);i.primitives[0].indices=e}return Number.isFinite(r)&&(i.primitives[0].material=r),this.json.meshes=this.json.meshes||[],this.json.meshes.push(i),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){const n=j(e),r=t||(null==n?void 0:n.mimeType),s={bufferView:this.addBufferView(e),mimeType:r};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}addBufferView(e){const t=e.byteLength;L(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const n={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=Ae(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(n),this.json.bufferViews.length-1}addAccessor(e,t){const n={bufferView:e,type:Le(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const n=this.addBufferView(e);let r={min:t.min,max:t.max};r.min&&r.max||(r=this._getAccessorMinMax(e,t.size));const s={size:t.size,componentType:Re(e),count:Math.round(e.length/t.size),min:r.min,max:r.max};return this.addAccessor(n,Object.assign(s,t))}addTexture(e){const{imageIndex:t}=e,n={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){var e,t;this.gltf.buffers=[];const n=this.byteLength,r=new ArrayBuffer(n),s=new Uint8Array(r);let i=0;for(const e of this.sourceBuffers||[])i=Ie(e,s,i);null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=n:this.json.buffers=[{byteLength:n}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(e,t){let n=!0;for(;n;){const r=e.indexOf(t);r>-1?e.splice(r,1):n=!1}}_addAttributes(e={}){const t={};for(const n in e){const r=e[n],s=this._getGltfAttributeName(n),i=this.addBinaryBuffer(r.value,r);t[s]=i}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,t){const n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];const r=e.subarray(0,t);for(const e of r)n.min.push(e),n.max.push(e);for(let r=t;r<e.length;r+=t)for(let s=0;s<t;s++)n.min[0+s]=Math.min(n.min[0+s],e[r+s]),n.max[0+s]=Math.max(n.max[0+s],e[r+s]);return n}}function Ve(e){const{buffer:t,size:n,count:r}=function(e){let t=e,n=1,r=0;e&&e.value&&(t=e.value,n=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t,n=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(n&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),r=t.length/n);return{buffer:t,size:n,count:r}}(e);return{value:t,size:n,byteOffset:0,count:r,type:Le(n),componentType:Re(t)}}async function Ce(e,t,n){var r;if(null==t||null===(r=t.gltf)||void 0===r||!r.decompressMeshes)return;const s=new Ne(e),i=[];for(const e of function*(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}(s))s.getObjectExtension(e,a)&&i.push(ze(s,e,t,n));await Promise.all(i),s.removeExtension(a)}function Pe(e,t={}){const n=new Ne(e);for(const e of n.json.meshes||[])ke(e,t),n.addRequiredExtension(a)}async function ze(e,t,n,r){const s=e.getObjectExtension(t,a);if(!s)return;const i=e.getTypedArrayForBufferView(s.bufferView),o=M(i.buffer,i.byteOffset),{parse:c}=r,u={...n};delete u["3d-tiles"];const f=await c(o,_e,u,r),d=function(e){const t={};for(const n in e){const r=e[n];if("indices"!==n){const e=Ve(r);t[n]=e}}return t}(f.attributes);for(const[n,r]of Object.entries(d))if(n in t.attributes){const s=t.attributes[n],i=e.getAccessor(s);null!=i&&i.min&&null!=i&&i.max&&(r.min=i.min,r.max=i.max)}t.attributes=d,f.indices&&(t.indices=Ve(f.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(t)}function ke(e,t,n=4,r,s){var i;if(!r.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=r.DracoWriter.encodeSync({attributes:e}),c=null==s||null===(i=s.parseSync)||void 0===i?void 0:i.call(s,{attributes:e}),u=r._addFauxAttributes(c.attributes),f=r.addBufferView(o);return{primitives:[{attributes:u,mode:n,extensions:{[a]:{bufferView:f,attributes:u}}}]}}async function qe(e){const t=new Ne(e),{json:n}=t;t.removeExtension("KHR_materials_unlit");for(const e of n.materials||[]){e.extensions&&e.extensions.KHR_materials_unlit&&(e.unlit=!0),t.removeObjectExtension(e,"KHR_materials_unlit")}}function Ge(e){const t=new Ne(e),{json:n}=t;if(t.materials)for(const e of n.materials||[])e.unlit&&(delete e.unlit,t.addObjectExtension(e,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}async function $e(e){const t=new Ne(e),{json:n}=t,r=t.getExtension("KHR_lights_punctual");r&&(t.json.lights=r.lights,t.removeExtension("KHR_lights_punctual"));for(const e of n.nodes||[]){const n=t.getObjectExtension(e,"KHR_lights_punctual");n&&(e.light=n.light),t.removeObjectExtension(e,"KHR_lights_punctual")}}async function He(e){const t=new Ne(e),{json:n}=t;if(n.lights){const e=t.addExtension("KHR_lights_punctual");L(!e.lights),e.lights=n.lights,delete n.lights}if(t.json.lights){for(const e of t.json.lights){const n=e.node;t.addObjectExtension(n,"KHR_lights_punctual",e)}delete t.json.lights}}async function Ke(e){const t=new Ne(e),{json:n}=t,r=t.getExtension("KHR_techniques_webgl");if(r){const e=function(e,t){const{programs:n=[],shaders:r=[],techniques:s=[]}=e,i=new TextDecoder;return r.forEach(e=>{if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=i.decode(t.getTypedArrayForBufferView(e.bufferView))}),n.forEach(e=>{e.fragmentShader=r[e.fragmentShader],e.vertexShader=r[e.vertexShader]}),s.forEach(e=>{e.program=n[e.program]}),s}(r,t);for(const r of n.materials||[]){const n=t.getObjectExtension(r,"KHR_techniques_webgl");n&&(r.technique=Object.assign({},n,e[n.technique]),r.technique.values=Xe(r.technique,t)),t.removeObjectExtension(r,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}}async function We(e,t){}function Xe(e,t){const n=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(t=>{e.uniforms[t].value&&!(t in n)&&(n[t]=e.uniforms[t].value)}),Object.keys(n).forEach(e=>{"object"==typeof n[e]&&void 0!==n[e].index&&(n[e].texture=t.getTexture(n[e].index))}),n}const Qe={KHR_draco_mesh_compression:r,KHR_materials_unlit:s,KHR_lights_punctual:i,KHR_techniques_webgl:o};const Je={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Ye={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class Ze{constructor(e){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}}normalize(e,t){this.json=e.json;const n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version "+n.asset.version)}if(!t.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),function(e){const t=new Ne(e),{json:n}=t;for(const e of n.images||[]){const n=t.removeObjectExtension(e,"KHR_binary_glTF");n&&Object.assign(e,n)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,t.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(const t in Je)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const n=e[t];if(n&&!Array.isArray(n)){e[t]=[];for(const r in n){const s=n[r];s.id=s.id||r;const i=e[t].length;e[t].push(s),this.idToIndexMap[t][r]=i}}}_convertObjectIdsToArrayIndices(e){for(const t in Je)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:e,indices:n,material:r}=t;for(const t in e)e[t]=this._convertIdToIndex(e[t],"accessor");n&&(t.indices=this._convertIdToIndex(n,"accessor")),r&&(t.material=this._convertIdToIndex(r,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(e=>this._convertIdToIndex(e,"node"))),e.meshes&&(e.meshes=e.meshes.map(e=>this._convertIdToIndex(e,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(e=>this._convertIdToIndex(e,"node")))}_convertIdsToIndices(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute "+t),e[t]=[]);for(const n of e[t])for(const e in n){const t=n[e],r=this._convertIdToIndex(t,e);n[e]=r}}_convertIdToIndex(e,t){const n=Ye[t];if(n in this.idToIndexMap){const r=this.idToIndexMap[n][e];if(!Number.isFinite(r))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return r}return e}_updateObjects(e){for(const e of this.json.buffers)delete e.type}_updateMaterial(e){for(const t of e.materials){t.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const n=t.values&&t.values.tex,r=e.textures.findIndex(e=>e.id===n);-1!==r&&(t.pbrMetallicRoughness.baseColorTexture={index:r})}}}const et={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},tt={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},nt={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},rt={magFilter:nt.TEXTURE_MAG_FILTER,minFilter:nt.TEXTURE_MIN_FILTER,wrapS:nt.TEXTURE_WRAP_S,wrapT:nt.TEXTURE_WRAP_T},st={[nt.TEXTURE_MAG_FILTER]:nt.LINEAR,[nt.TEXTURE_MIN_FILTER]:nt.NEAREST_MIPMAP_LINEAR,[nt.TEXTURE_WRAP_S]:nt.REPEAT,[nt.TEXTURE_WRAP_]:nt.REPEAT};class it{postProcess(e,t={}){const{json:n,buffers:r=[],images:s=[],baseUri:i=""}=e;return L(n),this.baseUri=i,this.json=n,this.buffers=r,this.images=s,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map((e,t)=>this._resolveBufferView(e,t))),e.images&&(e.images=e.images.map((e,t)=>this._resolveImage(e,t))),e.samplers&&(e.samplers=e.samplers.map((e,t)=>this._resolveSampler(e,t))),e.textures&&(e.textures=e.textures.map((e,t)=>this._resolveTexture(e,t))),e.accessors&&(e.accessors=e.accessors.map((e,t)=>this._resolveAccessor(e,t))),e.materials&&(e.materials=e.materials.map((e,t)=>this._resolveMaterial(e,t))),e.meshes&&(e.meshes=e.meshes.map((e,t)=>this._resolveMesh(e,t))),e.nodes&&(e.nodes=e.nodes.map((e,t)=>this._resolveNode(e,t))),e.skins&&(e.skins=e.skins.map((e,t)=>this._resolveSkin(e,t))),e.scenes&&(e.scenes=e.scenes.map((e,t)=>this._resolveScene(e,t))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const n=this.json[e]&&this.json[e][t];return n||console.warn(`glTF file error: Could not find ${e}[${t}]`),n}_resolveScene(e,t){return e.id=e.id||"scene-"+t,e.nodes=(e.nodes||[]).map(e=>this.getNode(e)),e}_resolveNode(e,t){return e.id=e.id||"node-"+t,e.children&&(e.children=e.children.map(e=>this.getNode(e))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((e,t)=>{const n=this.getMesh(t);return e.id=n.id,e.primitives=e.primitives.concat(n.primitives),e},{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||"skin-"+t,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||"mesh-"+t,e.primitives&&(e.primitives=e.primitives.map(e=>{const t=(e={...e}).attributes;e.attributes={};for(const n in t)e.attributes[n]=this.getAccessor(t[n]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e})),e}_resolveMaterial(e,t){if(e.id=e.id||"material-"+t,e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var n,r;if(e.id=e.id||"accessor-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(n=e.componentType,tt[n]),e.components=(r=e.type,et[r]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:n,byteLength:r}=Be(e,e.bufferView),s=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+t.byteOffset,i=t.arrayBuffer.slice(s,s+r);e.value=new n(i)}return e}_resolveTexture(e,t){return e.id=e.id||"texture-"+t,e.sampler="sampler"in e?this.getSampler(e.sampler):st,e.source=this.getImage(e.source),e}_resolveSampler(e,t){e.id=e.id||"sampler-"+t,e.parameters={};for(const t in e){const n=this._enumSamplerParameter(t);void 0!==n&&(e.parameters[n]=e[t])}return e}_enumSamplerParameter(e){return rt[e]}_resolveImage(e,t){e.id=e.id||"image-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));const n=this.images[t];return n&&(e.image=n),e}_resolveBufferView(e,t){e.id=e.id||"bufferView-"+t;const n=e.buffer;e.buffer=this.buffers[n];const r=this.buffers[n].arrayBuffer;let s=this.buffers[n].byteOffset||0;return"byteOffset"in e&&(s+=e.byteOffset),e.data=new Uint8Array(r,s,e.byteLength),e}_resolveCamera(e,t){return e.id=e.id||"camera-"+t,e.perspective,e.orthographic,e}}function ot(e,t){return(new it).postProcess(e,t)}const at=1735152710;function ct(e,t=0,n={}){const r=new DataView(e),{magic:s=at}=n,i=r.getUint32(t,!1);return i===s||i===at}function ut(e,t,n=0,r={}){const s=new DataView(t),i=function(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}(s,n+0),o=s.getUint32(n+4,!0),a=s.getUint32(n+8,!0);switch(Object.assign(e,{header:{byteOffset:n,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),n+=12,e.version){case 1:return function(e,t,n){xe(e.header.byteLength>20);const r=t.getUint32(n+0,!0),s=t.getUint32(n+4,!0);return n+=8,xe(0===s),ft(e,t,n,r),n+=r,n+=dt(e,t,n,e.header.byteLength)}(e,s,n);case 2:return function(e,t,n,r){return xe(e.header.byteLength>20),function(e,t,n,r){for(;n+8<=e.header.byteLength;){const s=t.getUint32(n+0,!0),i=t.getUint32(n+4,!0);switch(n+=8,i){case 1313821514:ft(e,t,n,s);break;case 5130562:dt(e,t,n,s);break;case 0:r.strict||ft(e,t,n,s);break;case 1:r.strict||dt(e,t,n,s)}n+=Ae(s,4)}}(e,t,n,r),n+e.header.byteLength}(e,s,n,{});default:throw new Error(`Invalid GLB version ${e.version}. Only supports v1 and v2.`)}}function ft(e,t,n,r){const s=new Uint8Array(t.buffer,n,r),i=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(i),Ae(r,4)}function dt(e,t,n,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:t.buffer}),Ae(r,4)}async function lt(e,t,n=0,r,s){var i,o,a,c;!function(e,t,n,r){r.uri&&(e.baseUri=r.uri);if(t instanceof ArrayBuffer&&!ct(t,n,r)){const e=new TextDecoder;t=e.decode(t)}if("string"==typeof t)e.json=U(t);else if(t instanceof ArrayBuffer){const s={};n=ut(s,t,n,r.glb),L("glTF"===s.type,"Invalid GLB magic string "+s.type),e._glb=s,e.json=s.json}else L(!1,"GLTF: must be ArrayBuffer or string");const s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){const{binChunks:t}=e._glb;e.buffers[0]={arrayBuffer:t[0].arrayBuffer,byteOffset:t[0].byteOffset,byteLength:t[0].byteLength}}const i=e.json.images||[];e.images=new Array(i.length).fill({})}(e,t,n,r),function(e,t={}){(new Ze).normalize(e,t)}(e,{normalize:null==r||null===(i=r.gltf)||void 0===i?void 0:i.normalize});const u=[];if(null!=r&&null!==(o=r.gltf)&&void 0!==o&&o.loadBuffers&&e.json.buffers&&await async function(e,t,n){for(let i=0;i<e.json.buffers.length;++i){const o=e.json.buffers[i];if(o.uri){var r,s;const{fetch:a}=n;L(a);const c=R(o.uri,t),u=await(null==n||null===(r=n.fetch)||void 0===r?void 0:r.call(n,c)),f=await(null==u||null===(s=u.arrayBuffer)||void 0===s?void 0:s.call(u));e.buffers[i]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete o.uri}}}(e,r,s),null!=r&&null!==(a=r.gltf)&&void 0!==a&&a.loadImages){const t=async function(e,t,n){const r=e.json.images||[],s=[];for(let i=0;i<r.length;++i)s.push(ht(e,r[i],i,t,n));return await Promise.all(s)}(e,r,s);u.push(t)}const f=async function(e,t={},n){for(const s in Qe){var r;const i=(null==t||null===(r=t.gltf)||void 0===r?void 0:r.excludeExtensions)||{};if(!(s in i&&!i[s])){const r=Qe[s];await r.decode(e,t,n)}}}(e,r,s);return u.push(f),await Promise.all(u),null!=r&&null!==(c=r.gltf)&&void 0!==c&&c.postProcess?ot(e,r):e}async function ht(e,t,n,r,s){const{fetch:i,parse:o}=s;let a;if(t.uri){const e=R(t.uri,r),n=await i(e);a=await n.arrayBuffer()}if(Number.isFinite(t.bufferView)){const n=B(e.json,e.buffers,t.bufferView);a=M(n.buffer,n.byteOffset,n.byteLength)}L(a,"glTF image has no data");const c=await o(a,O,{},s);e.images[n]=c}const mt={name:"glTF",id:"gltf",module:"gltf",version:"3.0.13",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},n){(t={...mt.options,...t}).gltf={...mt.options.gltf,...t.gltf};const{byteOffset:r=0}=t;return await lt({},e,r,t,n)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};function gt(e,t,n,r){const s=Ae(n.byteLength,r),i=s-n.byteLength;if(e){const r=new Uint8Array(e.buffer,e.byteOffset+t,n.byteLength),s=new Uint8Array(n);r.set(s);for(let r=0;r<i;++r)e.setUint8(t+n.byteLength+r,32)}return t+=s}const bt=1179937895;function yt(e,t,n=0,r={}){const{magic:s=bt,version:i=2,json:o={},binary:a}=e,c=n;t&&(t.setUint32(n+0,s,!0),t.setUint32(n+4,i,!0),t.setUint32(n+8,0,!0));const u=n+8,f=n+=12;t&&(t.setUint32(n+0,0,!0),t.setUint32(n+4,1313821514,!0));if(n=function(e,t,n,r){return t=gt(e,t,(new TextEncoder).encode(n),r)}(t,n+=8,JSON.stringify(o),4),t){const e=n-f-8;t.setUint32(f+0,e,!0)}if(a){const e=n;if(t&&(t.setUint32(n+0,0,!0),t.setUint32(n+4,5130562,!0)),n=gt(t,n+=8,a,4),t){const r=n-e-8;t.setUint32(e+0,r,!0)}}if(t){const e=n-c;t.setUint32(u,e,!0)}return n}function pt(e,t,n,r){return function(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}(e),yt(e,t,n,r)}const wt={name:"glTF",id:"gltf",module:"gltf",version:"3.0.13",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,encodeSync:function(e,t={}){const{byteOffset:n=0}=t,r=pt(e,null,n,t),s=new ArrayBuffer(r),i=new DataView(s);return pt(e,i,n,t),s},options:{gltf:{}}};const Tt={name:"GLB",id:"glb",module:"gltf",version:"3.0.13",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,parse:async function(e,t){return vt(e,t)},parseSync:vt,options:{glb:{strict:!1}}};function vt(e,t){const{byteOffset:n=0}=t||{},r={};return ut(r,e,n,null==t?void 0:t.glb),r}const _t={name:"GLB",id:"glb",module:"gltf",version:"3.0.13",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,encodeSync:function(e,t){const{byteOffset:n=0}=t,r=yt(e,null,n,t),s=new ArrayBuffer(r),i=new DataView(s);return yt(e,i,n,t),s},options:{glb:{}}}}])}));
|
|
2
2
|
//# sourceMappingURL=dist.min.js.map
|