import{A as x,h as D,i as A,I as R,j as W,k as B,L as I}from"./index-CDrXokXW.js";x.prototype._partialLoadFile=function(i,s,t,n,r=null){const a=o=>{t[s]=o,t._internalCount++,t._internalCount===6&&n(t)},l=(o,f)=>{r&&o&&r(o.status+" "+o.statusText,f)};this._loadFile(i,a,void 0,void 0,!0,l)};x.prototype._cascadeLoadFiles=function(i,s,t,n=null){const r=[];r._internalCount=0;for(let a=0;a<6;a++)this._partialLoadFile(t[a],a,r,s,n)};x.prototype._cascadeLoadImgs=function(i,s,t,n,r=null,a){const l=[];l._internalCount=0;for(let o=0;o<6;o++)this._partialLoadImg(n[o],o,l,i,s,t,r,a)};x.prototype._partialLoadImg=function(i,s,t,n,r,a,l=null,o){const f=D();A(i,_=>{t[s]=_,t._internalCount++,n&&n.removePendingData(f),t._internalCount===6&&a&&a(r,t)},(_,c)=>{n&&n.removePendingData(f),l&&l(_,c)},n?n.offlineProvider:null,o),n&&n.addPendingData(f)};x.prototype.createCubeTextureBase=function(i,s,t,n,r=null,a=null,l,o=null,f=!1,L=0,T=0,_=null,c=null,C=null,y=!1,g=null){const e=_||new R(this,7);e.isCube=!0,e.url=i,e.generateMipMaps=!n,e._lodGenerationScale=L,e._lodGenerationOffset=T,e._useSRGBBuffer=!!y&&this._caps.supportSRGBBuffers&&(this.version>1||this.isWebGPU||!!n),e!==_&&(e.label=i.substring(0,60)),this._doNotHandleContextLost||(e._extension=o,e._files=t,e._buffer=g);const m=i;this._transformTextureUrl&&!_&&(i=this._transformTextureUrl(i));const P=o??W(i),G=B(P),p=(u,d)=>{e.dispose(),a?a(u,d):u&&I.Warn(u)},F=(u,d)=>{i===m?u&&p(u.status+" "+u.statusText,d):(I.Warn(`Failed to load ${i}, falling back to the ${m}`),this.createCubeTextureBase(m,s,t,!!n,r,p,l,o,f,L,T,e,c,C,y,g))};if(G)G.then(u=>{const d=h=>{c&&c(e,h),u.loadCubeData(h,e,f,r,(w,v)=>{p(w,v)})};g?d(g):t&&t.length===6?u.supportCascades?this._cascadeLoadFiles(s,h=>d(h.map(w=>new Uint8Array(w))),t,p):p("Textures type does not support cascades."):this._loadFile(i,h=>d(new Uint8Array(h)),void 0,s?s.offlineProvider||null:void 0,!0,F)});else{if(!t||t.length===0)throw new Error("Cannot load cubemap because files were not defined, or the correct loader was not found.");this._cascadeLoadImgs(s,e,(u,d)=>{C&&C(u,d)},t,p)}return this._internalTexturesCache.push(e),e};
