import{GLTFLoader as c,ArrayItem as p}from"./glTFLoader-Bx351I09.js";import{e as m,aN as h,aO as y}from"./index-6jOCfdig.js";import"./index-Ds2meNS5.js";import"./svelte/svelte_svelte.js";import"./svelte/svelte_animate.js";import"./svelte/svelte_attachments.js";import"./svelte/svelte_easing.js";import"./svelte/svelte_internal_client.js";import"./svelte/svelte_internal_flags_async.js";import"./svelte/svelte_internal_flags_legacy.js";import"./svelte/svelte_internal_flags_tracing.js";import"./svelte/svelte_internal_server.js";import"./svelte/svelte_legacy.js";import"./svelte/svelte_motion.js";import"./svelte/svelte_reactivity.js";import"./svelte/svelte_reactivity_window.js";import"./svelte/svelte_server.js";import"./svelte/svelte_store.js";import"./svelte/svelte_transition.js";import"./svelte/svelte_events.js";import"./bone-DdTyU8i_.js";import"./skeleton-C0c5yg7x.js";import"./rawTexture-CpjOe2U7.js";import"./assetContainer-Drc86vic.js";import"./objectModelMapping-DT0r674A.js";let d=0,a=null;class r{static get Default(){return r._Default||(r._Default=new r),r._Default}constructor(){const e=r.Configuration.decoder;this._decoderModulePromise=m.LoadBabylonScriptAsync(e.url).then(()=>MeshoptDecoder.ready)}dispose(){delete this._decoderModulePromise}async decodeGltfBufferAsync(e,i,l,t,o){await this._decoderModulePromise,d===0&&(MeshoptDecoder.useWorkers(1),d=1);const s=await MeshoptDecoder.decodeGltfBufferAsync(i,l,e,t,o);return a!==null&&clearTimeout(a),a=setTimeout(()=>{MeshoptDecoder.useWorkers(0),d=0,a=null},1e3),s}}r.Configuration={decoder:{url:`${m._DefaultCdnUrl}/meshopt_decoder.js`}};r._Default=null;const u="EXT_meshopt_compression";class _{constructor(e){this.name=u,this.enabled=e.isExtensionUsed(u),this._loader=e}dispose(){this._loader=null}loadBufferViewAsync(e,i){return c.LoadExtensionAsync(e,i,this.name,async(l,t)=>{const o=i;if(o._meshOptData)return await o._meshOptData;const s=p.Get(`${e}/buffer`,this._loader.gltf.buffers,t.buffer);return o._meshOptData=this._loader.loadBufferAsync(`/buffers/${s.index}`,s,t.byteOffset||0,t.byteLength).then(async n=>await r.Default.decodeGltfBufferAsync(n,t.count,t.byteStride,t.mode,t.filter)),await o._meshOptData})}}h(u);y(u,!0,f=>new _(f));export{_ as EXT_meshopt_compression};
